@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 7.81 kB
JavaScript
module.exports=function(o){function t(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return o[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var e={};return t.m=o,t.c=e,t.p="",t(0)}({0:function(o,t,e){e(1587),o.exports=e(1587)},3:function(o,t){o.exports=function(){throw Error("define cannot be used indirect")}},6:function(o,t){o.exports=require("../kendo.combobox")},1030:function(o,t){o.exports=require("../kendo.toolbar")},1587:function(o,t,e){var n,a,i;!function(s,define){a=[e(1030),e(6),e(1588)],n=s,i="function"==typeof n?n.apply(t,a):n,!(void 0!==i&&(o.exports=i))}(function(){return function(o,t){function e(o,t,e){var n=e?x.zoomOverflowButtons:x.zoomButtons;o.append(w({text:t.zoomOut,command:b,iconClass:x.zoomOutIcon,showText:e,className:n})),o.append(w({text:t.zoomIn,command:h,iconClass:x.zoomInIcon,showText:e,className:n}))}var n,a,i,s=window.kendo,m=o.extend,r=o.proxy,l="action",c="k-flat",d="keydown",p=s.support.click,u="change",h="zoomin",b="zoomout",f=s.toolbar.Item,g=s.ui.ToolBar,v={auto:"auto",actual:"actual",fitToWidth:"fitToWidth",fitToPage:"fitToPage"},x={zoomOutIcon:"k-i-zoom-out",zoomInIcon:"k-i-zoom-in",zoomButtons:"k-button-icon k-flat",zoomOverflowButtons:"k-button-icontext k-overflow-button",overflowHidden:"k-overflow-hidden"},w=s.template('<a href="\\#" aria-label="#=text#" title="#=text#" data-command="#=command#" class="k-button #=className#"><span class="k-icon #= iconClass #"></span> ${showText ? text : ""}</a>'),k=s.template('<select title="#=zoomLevel#">#for(var zoomIndex in zoomLevels){## var zoomLevel = zoomLevels[zoomIndex]; #<option value="#= zoomLevel.percent || (zoomLevel + "%") #">${zoomLevel.text ? zoomLevel.text : zoomLevel + "%"}</option>#}#</select>'),z={pager:{type:"pager",overflow:"never",command:"PageChangeCommand"},spacer:{type:"spacer"},zoom:{type:"zoom",command:"ZoomCommand",zoomInOut:!0,combobox:{zoomLevels:[50,100,150,200,300,400]}},toggleSelection:{type:"buttonGroup",attributes:{"class":"k-toggle-selection-group"},buttons:[{togglable:!0,text:"Enable Selection",command:"EnableSelectionCommand",icon:"cursor",showText:"overflow",name:"toggleSelection",group:"toggle-pan"},{togglable:!0,text:"Enable Panning",command:"EnablePanCommand",icon:"hand",showText:"overflow",name:"togglePan",group:"toggle-pan",selected:!0}]},spacer2:{type:"spacer"},search:{type:"button",text:"Search",command:"OpenSearchCommand",icon:"search",name:"search",showText:"overflow"},open:{type:"button",text:"Open",showText:"overflow",name:"open",icon:"folder-open",command:"OpenCommand"},download:{type:"button",text:"Download",showText:"overflow",name:"download",icon:"download",command:"DownloadCommand"},print:{type:"button",text:"Print",showText:"overflow",name:"print",icon:"print",command:"PrintCommand"}},_=m({},z,{exportAs:{type:"button",text:"Export",showText:"overflow",name:"exportAs",icon:"image-export",command:"ExportCommand"}}),y=f.extend({init:function(t,e){var n=o("<div />");this.options=m(!0,t,e.options.pager),this.toolbar=e,this.toolbar.pager=new s.pdfviewer.Pager(n,m({},t,{change:r(this._change,this)})),this.element=n,this.element.on(d,r(this._keydown,this)),this.attributes(),this.addUidAttr(),this.addOverflowAttr()},_change:function(o){this.options.change&&this.options.change(o.page)||this.toolbar.action({command:"PageChangeCommand",options:{value:o.page}})},_keydown:function(t){var e=this,n=o(t.target),a=t.keyCode,i=e.element.find(":kendoFocusable"),m=i.index(n),r=t.shiftKey?-1:1;a===s.keys.TAB&&i[m+r]&&(i[m+r].focus(),t.preventDefault(),t.stopPropagation())}});s.toolbar.registerComponent("pager",y),n=f.extend({init:function(o,t){this._init(o,t),this.toolbar.zoom=this,t.options.scale&&(this._initValue=100*t.options.scale+"%"),this._appendElements(),this._click=s.throttle(this._click.bind(this),200),this._keydown=s.throttle(this._keydown.bind(this),200),this.element.on(p,".k-button",this._click),this.element.on(d,".k-button",this._keydown),this.attributes(),this.addUidAttr(),this.addOverflowAttr()},_init:function(t,e){var n=o("<div />");this.options=m(!0,t,{messages:e.options.messages.zoom}),this.toolbar=e,this.element=n},_appendElements:function(){var o=this.options;o.zoomInOut&&e(this.element,o.messages,!1),o.combobox&&this._buildComboBox()},_buildComboBox:function(){var t,e=this,n=e.options.messages,a=e.options.combobox,i=[{percent:v.auto,text:n.autoWidth},{percent:v.actual,text:n.actualWidth},{percent:v.fitToWidth,text:n.fitToWidth},{percent:v.fitToPage,text:n.fitToPage}];i=i.concat(a.zoomLevels),t=o(k({zoomLevels:i,zoomLevel:n.zoomLevel})),s.support.mobileOS?e.element.append(t):(t=t.kendoComboBox(m({autoWidth:!0,clearButton:!1,value:e._initValue},a)).getKendoComboBox(),e.element.append(t.wrapper),e.combobox=t,e._currentValue=t.value()),t.bind(u,s.throttle(e.change.bind(e),300))},change:function(o){var e,n=o.sender?o.sender.value():o.target.value;if((""+n).match(/^[0-9]+%?$/))e=parseInt(n.replace("%",""),10)/100;else if(!v[n])return this.combobox&&this.combobox.value(this._currentValue),o.preventDefault(),t;this._currentValue=n,this.toolbar.action({command:"ZoomCommand",options:{scale:e||n}})},_buttonCommand:function(t){var e=o(t).closest(".k-button"),n=e.data("command");this.toolbar.action({command:"ZoomCommand",options:{zoomIn:n===h,zoomOut:n===b,updateComboBox:!0}})},_click:function(o){this._buttonCommand(o.target)},_keydown:function(o){var t=o.keyCode,e=s.keys;t===e.ENTER&&(this._buttonCommand(o.target),o.preventDefault())},enable:function(o){var t=this.element;t.find(".k-button, select").toggleClass("k-state-disabled",!o),this.combobox&&this.combobox.enable(o)},destroy:function(){this.combobox&&this.combobox.destroy()}}),a=n.extend({_init:function(t,e){var n=o("<li></li>");this.options=m(!0,t,{messages:e.options.messages.zoom}),this.toolbar=e,this.element=n},_appendElements:function(){var o=this.options;o.zoomInOut&&e(this.element,o.messages,!0)},overflowHidden:function(){this.element.addClass(x.overflowHidden)}}),s.toolbar.registerComponent("zoom",n,a),i=g.extend({init:function(o,t){var e=this,n=t.items&&t.items.length?t.items:Object.keys(z);e.options=t,t.items=e._updateItems(n),g.fn.init.call(e,o,t),e.bind({click:e._click,toggle:e._click}),t.viewer.bind({update:e._update.bind(e)})},events:[l],_updateItems:function(t){var e=this,n=this.options.messages;return t.map(function(t){var a,i,m,r=o.isPlainObject(t)&&1===Object.keys(t).length&&t.name;return t=r?t.name:t,a=o.isPlainObject(t)?t:_[t],m=a.name,"buttonGroup"===a.type?a.buttons=e._updateItems(a.buttons):i="pager"!==a.type?{name:m,attributes:{"aria-label":n[m],title:n[m],"data-command":a.command,"class":c},overflow:a.overflow}:{overflow:"never"},s.deepExtend(a,i),a})},_click:function(t){var e=o(t.target).data("command");e&&this.action({command:e,options:t.options})},_update:function(o){var t={page:o.page||1,total:o.total||1};this.zoom&&(this.zoom.enable(!o.isBlank),"zoom"===o.action&&this._updateZoomComboBox(o.zoom)),("pagechange"===o.action||o.isBlank)&&this.pager&&this.pager.setOptions(t),this.enable(this.wrapper.find(".k-toggle-selection-group"),!o.isBlank),this.enable(this.wrapper.find("[data-command='OpenSearchCommand']"),!o.isBlank),this.enable(this.wrapper.find("[data-command='DownloadCommand']"),!o.isBlank),this.enable(this.wrapper.find("[data-command='PrintCommand']"),!o.isBlank)},_updateZoomComboBox:function(o){var t=o===v.auto||o===v.actual;t||(o=Math.round(100*o)+"%"),this.zoom&&this.zoom.combobox&&(this.zoom._currentValue=o,this.zoom.combobox.value(o))},action:function(o){this.trigger(l,o)},destroy:function(){this.pager&&this.pager.destroy(),this.zoom&&this.zoom.destroy(),g.fn.destroy.call(this)}}),m(s.pdfviewer,{Toolbar:i,DefaultTools:z})}(window.kendo.jQuery),window.kendo},e(3))},1588:function(o,t){o.exports=require("./pager")}});