@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 4.51 kB
JavaScript
module.exports=function(o){function t(e){if(n[e])return n[e].exports;var i=n[e]={exports:{},id:e,loaded:!1};return o[e].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=o,t.c=n,t.p="",t(0)}({0:function(o,t,n){n(1040),o.exports=n(1040)},3:function(o,t){o.exports=function(){throw Error("define cannot be used indirect")}},967:function(o,t){o.exports=require("../kendo.dropdownlist")},1030:function(o,t){o.exports=require("../kendo.toolbar")},1040:function(o,t,n){var e,i,a;!function(r,define){i=[n(1030),n(967)],e=r,a="function"==typeof e?e.apply(t,i):e,!(void 0!==a&&(o.exports=a))}(function(){return function(o,t){var n=window.kendo,e=n.ui,i=o.extend,a=o.proxy,r=n.ui.ToolBar,d=n.toolbar.Item,m="click",s="dropDownChange",c="action",p=r.extend({init:function(o,t){var n=this;n._extendOptions(t),r.fn.init.call(n,o,t),n._attachEvents(),n.toggleTools()},events:r.fn.events.concat([s,c]),defaultTools:{open:{type:"button",icon:"upload",name:"open",command:"OpenImageEditorCommand",showText:"overflow"},save:{type:"button",icon:"download",name:"save",command:"SaveImageEditorCommand",showText:"overflow",toggleCondition:"canExport"},separator:{type:"separator"},undo:{type:"button",icon:"undo",name:"undo",command:"UndoImageEditorCommand",showText:"overflow",toggleCondition:"undo"},redo:{type:"button",icon:"redo",name:"redo",command:"RedoImageEditorCommand",showText:"overflow",toggleCondition:"redo"},separator1:{type:"separator"},crop:{type:"button",icon:"crop",name:"crop",command:"OpenPaneImageEditorCommand",options:"crop",showText:"overflow",toggleCondition:"canExport"},resize:{type:"button",icon:"image-resize",name:"resize",command:"OpenPaneImageEditorCommand",options:"resize",showText:"overflow",toggleCondition:"canExport"},zoomIn:{type:"button",icon:"zoom-in",name:"zoomIn",command:"ZoomImageEditorCommand",showText:"overflow",options:"zoomIn",toggleCondition:"enable"},zoomOut:{type:"button",icon:"zoom-out",name:"zoomOut",command:"ZoomImageEditorCommand",showText:"overflow",options:"zoomOut",toggleCondition:"enable"},zoomDropdown:{type:"imageEditorZoomDropDown",name:"zoomDropdown",command:"ZoomImageEditorCommand",text:"Zoom options",toggleCondition:"enable",items:[{name:"zoomActualSize",icon:"zoom-actual-size",text:"Show actual size",options:"actualSize"},{name:"zoomFitToScreen",icon:"zoom-best-fit",text:"Fit to screen",options:"fitToScreen"}]}},_attachEvents:function(){var o=this;o.bind(s,a(o._dropDownChange,o)),o.bind(m,a(o._click,o))},_extendOptions:function(o){var t=this,n=o.items?o.items:Object.keys(t.defaultTools);t.options=o,t.options.items=t._extendToolsOptions(n)},_extendToolsOptions:function(t){var e=this,a=e.options.messages;if(t.length)return t.map(function(t){var r,d,m=o.isPlainObject(t)&&1===Object.keys(t).length&&t.name;return t=m?t.name:t,r=o.isPlainObject(t)?t:i({},e.defaultTools[t]),d=a[r.name]||r.text,n.deepExtend(r,{id:r.name+"-"+n.guid(),name:r.name,text:d,attributes:{"aria-label":d,title:d,"data-command":r.command,"data-options":r.options,"data-toggle":r.toggleCondition},overflow:r.overflow}),"imageEditorZoomDropDown"===r.type&&(r.items=e._extendToolsOptions(r.items)),r},e)},_click:function(t){var n=o(t.target).data("command"),e=o(t.target).data("options");n&&this.action({command:n,options:e})},_dropDownChange:function(o){o.command&&this.action({command:o.command,options:o.options})},action:function(o){this.trigger(c,o)},toggleTools:function(t){var e=this,i=e.element.find("[data-toggle]");i.each(function(i,a){var r=o(a),d=null,m=r.data("toggle"),s=t&&t[m];r.is("[data-role]")&&(d=n.widgetInstance(r)),d&&d.enable?d.enable(s||!1):e.enable(r,s)})},destroy:function(){var o=this;o.zoomDropdown&&o.zoomDropdown.destroy(),r.fn.destroy.call(this)}}),l=d.extend({init:function(t,n){var i=this,r=o("<div></div>"),d=o("<input />").attr(t.attributes),m='<span class="k-icon k-i-#:icon#"></span> #:text#';i.element=r,i.input=d,i.toolbar=n,i.dropDown=new e.DropDownList(i.input,{optionLabel:{text:t.text,icon:""},dataTextField:"text",dataSource:t.items,template:m,change:a(i._change,i)}),i.element.append(i.dropDown.wrapper),i.dropDown.list.find(".k-list-optionlabel").hide(),i.toolbar.zoomDropdown=i},_change:function(o){var t=this;t.toolbar.trigger(s,{command:o.sender.element.data("command"),options:o.sender.dataItem().options})},destroy:function(){this.dropDown.destroy()}});n.toolbar.registerComponent("imageEditorZoomDropDown",l),i(n.ui,{imageeditor:{ToolBar:p,ZoomDropDown:l}})}(window.kendo.jQuery),window.kendo},n(3))}});