@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 2.32 kB
JavaScript
module.exports=function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}({0:function(e,t,o){o(1517),e.exports=o(1517)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},19:function(e,t){e.exports=require("../kendo.core")},1517:function(e,t,o){var n,i,a;!function(s,define){i=[o(19)],n=s,a="function"==typeof n?n.apply(t,i):n,!(void 0!==a&&(e.exports=a))}(function(){!function(e){var t,o,n;e.support.browser.msie&&e.support.browser.version<9||(t=e.jQuery,o={input:"k-spreadsheet-name-editor",list:"k-spreadsheet-name-list"},n=e.ui.Widget.extend({init:function(n,i){var a,s,r;e.ui.Widget.call(this,n,i),n.addClass(o.input),a=i.messages.nameBox||"Name Box",s=new e.data.DataSource({transport:{read:function(t){var o=[];this._workbook.forEachName(function(t){!t.hidden&&t.value instanceof e.spreadsheet.Ref&&o.push({name:t.name})}),t.success(o)}.bind(this),cache:!1}}),r=t("<input />").attr("title",a).attr("aria-label",a),this.combo=r.appendTo(n).kendoComboBox({clearButton:!1,dataTextField:"name",dataValueField:"name",template:"#:data.name#<a class='k-button-delete' href='\\#'><span class='k-icon k-i-close'></span></a>",dataSource:s,autoBind:!1,ignoreCase:!0,change:this._on_listChange.bind(this),noDataTemplate:"<div></div>",open:function(){s.read()}}).getKendoComboBox(),this.combo.input.on("keydown",this._on_keyDown.bind(this)).on("focus",this._on_focus.bind(this)),this.combo.popup.element.addClass("k-spreadsheet-names-popup").on("mousemove",function(e){e.stopPropagation()}).on("click",".k-button-delete",function(e){e.preventDefault(),e.stopPropagation();var o=t(e.target).closest(".k-item");o=this.combo.dataItem(o),this._deleteItem(o.name)}.bind(this))},value:function(e){return void 0===e?this.combo.value():void this.combo.value(e)},_deleteItem:function(e){this.trigger("delete",{name:e})},_on_keyDown:function(e){switch(e.keyCode){case 27:this.combo.value(this._prevValue),this.trigger("cancel");break;case 13:this.trigger("enter")}},_on_focus:function(){this._prevValue=this.combo.value()},_on_listChange:function(){var e=this.combo.value();e&&this.trigger("select",{name:e})}}),e.spreadsheet.NameEditor=n)}(window.kendo)},o(3))}});