UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 43.9 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("kendo.treeview.js"),require("kendo.popup.js"),require("kendo.actionsheet.js"),require("kendo.binder.js"),require("kendo.html.chip.js"),require("kendo.html.chiplist.js"),require("kendo.html.button.js"),require("kendo.html.input.js"),require("kendo.label.js"),require("kendo.icons.js"),require("kendo.valueMapper.chunk.js"),require("kendo.dropdowns-loader.chunk.js")):"function"==typeof define&&define.amd?define(["exports","kendo.treeview","kendo.popup","kendo.actionsheet","kendo.binder","kendo.html.chip","kendo.html.chiplist","kendo.html.button","kendo.html.input","kendo.label","kendo.icons","kendo.valueMapper.chunk","kendo.dropdowns-loader.chunk"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Dropdowntree={}),e.kendo._globals.Treeview,e.kendo._globals.Popup,e.kendo._globals.Actionsheet,e.kendo._globals.Binder,e.kendo._globals.HtmlChip,e.kendo._globals.HtmlChiplist,e.kendo._globals.HtmlButton,e.kendo._globals.HtmlInput,e.kendo._globals.Label,e.kendo._globals.Icons,e.kendo._globals.ValueMapperChunk,e.kendo._globals.DropdownsLoaderChunk)}(this,(function(e,t,i,s,a,n,r,l,o,d,h,c,p){!function(e,t){var i,s,a=window.kendo,n=a.ui,r=a.keys,l="k-disabled",o="select",d="checked",h="indeterminate",c=n.TreeView;s=".k-treeview-group",i=function(e){var t=e.children(".k-animation-container");return t.length||(t=e),t.children(s)};var p=c.extend({init:function(e,t,i){var s=this;s.dropdowntree=i,c.fn.init.call(s,e,t),s.dropdowntree._isMultipleSelection()&&s.wrapper.on("click.kendoTreeView",".k-treeview-leaf.k-selected",s._clickSelectedItem.bind(s))},_checkOnSelect:function(e){if(!e.isDefaultPrevented()){var t=this.dataItem(e.node);t.set("checked",!t.checked)}},_setCheckedValue:function(e,t){e.set(d,t)},_click:function(e){var t=this;t.dropdowntree._isMultipleSelection()&&t.one("select",t._checkOnSelect),c.fn._click.call(t,e)},_clickSelectedItem:function(t){var i=this,s=e(t.currentTarget);i.one("select",i._checkOnSelect),i._trigger(o,s)||i.dataItem(s).set("selected",!1)},defaultrefresh:function(e){var i,s=e.node,a=e.action,n=e.items,r=this.wrapper,l=this.options,o=l.loadOnDemand,d=l.checkboxes&&l.checkboxes.checkChildren;if(!this._skip){if(e.field){if(!n[0]||!n[0].level)return;return this._updateNodes(n,e.field)}if(s&&(r=this.findByUid(s.uid),this._progress(r,!1)),d&&"remove"!=a){var h=!1;for(i=0;i<n.length;i++)if("checked"in n[i]){h=!0;break}if(!h&&s&&s.checked)for(i=0;i<n.length;i++)n[i].checked=!0}if("add"==a?this._appendItems(e.index,n,r):"remove"==a?this._remove(this.findByUid(n[0].uid),!1):"itemchange"==a?this._updateNodes(n):"itemloaded"==a?this._refreshChildren(r,n,e.index):this._refreshRoot(n),"remove"!=a)for(i=0;i<n.length;i++)o&&!n[i].expanded||n[i].load();this.wrapper.find(">ul").attr("role","tree"),this.trigger("dataBound",{node:s?r:t}),this.dropdowntree._treeViewDataBound({node:s?r:t,sender:this}),this.options.checkboxes.checkChildren&&this.updateIndeterminate()}},_previousVisible:function(e){var t,s,a=this;if(!e.length||e.prev().length)for(s=e.length?e.prev():a.root.children().last();a._expanded(s)&&(t=i(s).children().last()).length;)s=t;else(s=a.parent(e)||e).length||(a.dropdowntree.checkAll&&a.dropdowntree.checkAll.is(":visible")?a.dropdowntree.checkAll.find(".k-checkbox").trigger("focus"):a.dropdowntree.filterInput?a.dropdowntree.filterInput.trigger("focus"):a.dropdowntree.wrapper.trigger("focus"));return s},_keydown:function(i){var s,n=this,c=i.keyCode,p=n.current(),u=n._expanded(p),_=p.find(".k-checkbox-wrap").first().find(":checkbox"),f=a.support.isRtl(n.element);i.target==i.currentTarget&&(!f&&c==r.RIGHT||f&&c==r.LEFT?u?s=n._nextVisible(p):p.find(".k-treeview-leaf").first().hasClass(l)||n.expand(p):!f&&c==r.LEFT||f&&c==r.RIGHT?u&&!p.find(".k-treeview-leaf").first().hasClass(l)?n.collapse(p):(s=n.parent(p),n._enabled(s)||(s=t)):c==r.DOWN?s=n._nextVisible(p):c!=r.UP||i.altKey?c==r.HOME?s=n._nextVisible(e()):c==r.END?s=n._previousVisible(e()):c!=r.ENTER||p.find(".k-treeview-leaf").first().hasClass(l)?c==r.SPACEBAR&&_.length&&!p.find(".k-treeview-leaf").first().hasClass(l)?(_.prop(d,!_.prop(d)).data(h,!1).prop(h,!1),n._checkboxChange({target:_}),s=p):i.altKey&&c===r.UP||c===r.ESC?n._closePopup():c===r.TAB&&(i.preventDefault(),n._closePopup()):p.find(".k-treeview-leaf").first().hasClass("k-selected")||n._trigger(o,p)||n.select(p):s=n._previousVisible(p),s&&(i.preventDefault(),p[0]!=s[0]&&(n._trigger("navigate",s),n.current(s),n.scrollTo(s))))},_closePopup:function(){this.dropdowntree.close(),this.dropdowntree.wrapper.trigger("focus")},refresh:function(e){this.defaultrefresh(e),this.dropdowntree.options.skipUpdateOnBind||("itemchange"===e.action?this.dropdowntree._isMultipleSelection()?"checked"===e.field&&this.dropdowntree._checkValue(e.items[0]):"checked"!==e.field&&"expanded"!==e.field&&e.items[0].selected&&this.dropdowntree._selectValue(e.items[0]):this.dropdowntree.refresh(e))}});a.ui._dropdowntree=p}(window.kendo.jQuery);!function(e,t){var i=window.kendo,s=i.ui,a=i.html,n=i.htmlEncode,r=i.mediaQuery,l=s.Widget,o=s._dropdowntree,d=i.data.ObservableArray,h=i.data.ObservableObject,u=e.extend,_=i._activeElement,f=".kendoDropDownTree",v=i.keys,g=i.support,m="k-hidden",k="width",b=g.browser,w=i._outerWidth,C=".",T="disabled",x="readonly",y="k-disabled",A="aria-disabled",I="k-focus",S="mouseenter"+f+" mouseleave"+f,V="tabindex",L="click",D="open",M="close",F="change",O=/"/g,B=".k-chip";function E(t){if(Array.isArray(t)){var s=t.length,a=e.map(t,(function(e){return function(t){return t[e]}}));return function(e){var t=e._level;if(t||0===t)return a[Math.min(t,s-1)](e)}}return i.getter(t)}var U=i.ui.Widget.extend({init:function(t,s){var a=this;a.ns=f,i.ui.Widget.fn.init.call(a,t,s),a._selection=a._getSelection(),a._focusInputHandler=a._focusInput.bind(a),a._initial=a.element.val(),a._values=[];var n=this.options.value;if(null!==n&&n.length||(this._noInitialValue=!0),this._isNullorUndefined(n)||(this._valueMethodCalled=!0,n=this._isArrayOfObjects(n)&&a.options.autoBind?n.map((e=>e[a.options.dataValueField])):n,this._values=Array.isArray(n)?n.slice(0):[n]),a.bigScreenMQL=r("large"),a.smallScreenMQL=r("small"),"auto"==a.options.adaptiveMode&&a.smallScreenMQL.onChange((function(){a.popup&&i.isFunction(a.popup.fullscreen)&&a.popup.fullscreen(a.smallScreenMQL.mediaQueryList.matches)})),this._bindLoader(),this._inputTemplate(),this._accessors(),this._setTreeViewOptions(this.options),this._dataSource(),this._selection._initWrapper(),this._applyCssClasses(),this._placeholder(!0),this._tabindex(),this.wrapper.data(V,this.wrapper.attr(V)),this.tree=e("<div/>").attr({tabIndex:-1,"aria-hidden":!0}),this.list=e("<div/>").append(this.tree),this._header(),this._noData(),this._footer(),this._reset(),this._popup(),"auto"==a.options.adaptiveMode&&a.bigScreenMQL.onChange((()=>{a.list=e("<div class='k-list-container'/>").append(a.tree),a._header.bind(a)(),a._noData.bind(a)(),a._footer.bind(a)(),a._reset.bind(a)(),a.popup&&(a.popup.wrapper&&a.popup.wrapper.remove(),a.popup.destroy(),a.popup.element.remove(),a.popup=null),a.treeview&&a.treeview.destroy(),a._popup.bind(a)(),a._filterHeader.bind(a)(),a._treeview.bind(a)(),a._renderFooter.bind(a)(),a._checkAll.bind(a)(),a._enable.bind(a)(),a._toggleCloseVisibility.bind(a)(),a._aria.bind(a)()})),this._clearButton(),this._filterHeader(),this._treeview(),this._renderFooter(),this._checkAll(),this._enable(),this._toggleCloseVisibility(),!this.options.autoBind){var l=s.text||"";this._isNullorUndefined(s.value)?l?this._textAccessor(l):s.placeholder&&this._placeholder(!0):this._preselect(s.value)}e(this.element).parents("fieldset").is(":disabled")&&this.enable(!1),this._valueMethodCalled=!1,this.options.label&&this._label(),this.options.loadOnDemand&&this.options.loadOnDemand.valueMapper&&this.options.value&&this.one("dataBound",(()=>this.requireValueMapper(this.options))),this._aria(),i.notify(this)},_bindLoader:function(){const e=this;e._initLoader=p.i.bind(e),e._initLoader()},_label:function(){var t=this,s=t.options,a=e.isPlainObject(s.label)?s.label:{content:s.label};t.label=new i.ui.Label(null,e.extend({},a,{widget:t,floatCheck:t._floatCheck.bind(t)})),t._inputLabel=t.label.element},_floatCheck:function(){return!(this.value()&&!this._isMultipleSelection()||this.value().length||this.text())&&!this.popup.visible()},_refreshFloatingLabel:function(){var e=this;e.label&&e.label.floatingLabel&&e.label.floatingLabel.refresh()},_preselect:function(e,t){this._selection._preselect(e,t)},_setTreeViewOptions:function(t){var i={autoBind:t.autoBind,checkboxes:t.checkboxes,dataImageUrlField:t.dataImageUrlField,dataSpriteCssClassField:t.dataSpriteCssClassField,dataTextField:t.dataTextField,dataUrlField:t.dataUrlField,loadOnDemand:t.loadOnDemand,size:t.size};this.options.treeview=e.extend({},i,this.options.treeview),t.template&&(this.options.treeview.template=t.template),t.size&&(this.options.treeview.size=t.size)},_dataSource:function(){const t=this,s=t.options.dataSource;t._requestStartHandler=t._showBusy,t._requestEndHandler=t._hideBusy,t._errorHandler=function(){t._hideBusy()},t.dataSource=i.data.HierarchicalDataSource.create(s).bind("progress",t._requestStartHandler).bind("error",t._errorHandler).bind("requestEnd",t._requestEndHandler),s&&e.extend(t.options.treeview,{dataSource:t.dataSource})},_popupOpen:function(){var e=this.popup;e.wrapper=i.wrap(e.element)},_getSelection:function(){return this._isMultipleSelection()?(this.options._altname="MultiSelectTree",new s.DropDownTree.MultipleSelection(this)):new s.DropDownTree.SingleSelection(this)},setDataSource:function(e){this._isDataSourceSet=!0,this._tags&&(this._noInitialValue=!0,this.setValue([]),this._tags.empty(),this.span.show(),this._multipleTags.empty()),this.dataSource=e,this.treeview.setDataSource(e),this._isDataSourceSet=!1},_isMultipleSelection:function(){return this.options&&(this.options.treeview.checkboxes||this.options.checkboxes)},_isArrayOfObjects:function(e){return Array.isArray(e)&&e.map((e=>"object"==typeof e)).includes(!0)},options:{name:"DropDownTree",adaptiveMode:"none",animation:{},autoBind:!0,autoClose:!0,autoWidth:!1,clearButton:!0,dataTextField:"",dataValueField:"",dataImageUrlField:"",dataSpriteCssClassField:"",dataUrlField:"",delay:500,enabled:!0,enforceMinLength:!1,filter:"none",height:200,ignoreCase:!0,index:0,loadOnDemand:!1,messages:{singleTag:"item(s) selected",clear:"clear",deleteTag:"delete",noData:"No data found."},minLength:1,checkboxes:!1,noDataTemplate:!0,placeholder:"",checkAll:!1,checkAllTemplate:()=>"Check all",tagMode:"multiple",template:null,text:null,treeview:{},valuePrimitive:!1,footerTemplate:()=>"",headerTemplate:()=>"",value:null,valueTemplate:null,popup:null,filterLabel:null,size:"medium",fillMode:"solid",rounded:"medium",label:null},events:["open","close","dataBound",F,"select","filtering"],focus:function(){this.wrapper.trigger("focus")},dataItem:function(e){return this.treeview.dataItem(e)},readonly:function(e){this._editable({readonly:e===t||e,disable:!1}),this._toggleCloseVisibility(),this.label&&this.label.floatingLabel&&this.label.floatingLabel.readonly(e===t||e)},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t||e)}),this._toggleCloseVisibility(),this.label&&this.label.floatingLabel&&this.label.floatingLabel.enable(e=e===t||e)},toggle:function(e){this._toggle(e)},open:function(){var e=this.popup;this.options.autoBind||this.dataSource.data().length||(this.treeview._progress(!0),this._isFilterEnabled()?this._search():this.dataSource.fetch()),!e.visible()&&this._allowOpening()&&(e.one("activate",this._focusInputHandler),e._hovered=!0,e.open())},close:function(){this.popup.close()},search:function(e){var t,i=this.options;if(clearTimeout(this._typingTimeout),!i.enforceMinLength&&!e.length||e.length>=i.minLength){if(t=this._getFilter(e),this.trigger("filtering",{filter:t})||Array.isArray(this.options.dataTextField))return;this._filtering=!0,this.treeview.dataSource.filter(t)}},_mapValuesToId:function(e){if("function"==typeof this.dataSource.options.schema.model)throw new Error("The valueMapper needs dataSource.schema");const t=this.dataSource.options.schema.model.id;return e.map((e=>e[t]))},requireValueMapper:function(e,t){const i=this;let s=t||e.value;if(s=s&&(s instanceof Array?s:[s]),s&&e.loadOnDemand&&"function"!=typeof e.loadOnDemand.valueMapper)throw new Error("ValueMapper is not provided while the value is being set. See http://docs.telerik.com/kendo-ui/controls/editors/combobox/virtualization#the-valuemapper-function");if(s.length){let e=0;i.options.loadOnDemand.valueMapper(c.v(i.options,s,i._useValueMapper.bind(i,s,e)))}},_useValueMapper:function(t,i,s){const a=this,n=e.Deferred();a._deferred=n,a._handleValueMapperData(i,s),n.done((()=>{++i<t.length&&a._useValueMapper(t,i,s)}))},_handleValueMapperData:function(e,t){const i=t[e]instanceof Array?t[e]:t;if(!i||!i.length)return;this._loadItem(i,0)},_loadItem:function(e,t){const i=this,s=i.dataSource.get(e[t]);s&&s.load().done((()=>{++t<e.length-1?i._loadItem(e,t):i._deferred.resolve()}))},_getFilter:function(e){return{field:this.options.dataTextField,operator:this.options.filter,value:e,ignoreCase:this.options.ignoreCase}},refresh:function(){var t=this.treeview.dataSource.flatView();this._renderFooter(),this._renderNoData(),this.filterInput&&this.checkAll&&this.checkAll.toggle(!this.filterInput.val().length),this.tree.toggle(!!t.length),e(this.noData).toggle(!t.length)},setOptions:function(e){this.options.checkboxes!=e.checkboxes&&(delete e.checkboxes,window.console.warn("setOptions method can not be used to set the checkboxes option in DropDownTree")),l.fn.setOptions.call(this,e),this._setTreeViewOptions(e),this._dataSource(),(this.options.treeview||e.size)&&(this.treeview.destroy(),this._treeview()),e.height&&this.tree&&this.tree.css("max-height",e.height),this._header(),this._noData(),this._footer(),this._renderFooter(),this._renderNoData(),this.span&&(this._isMultipleSelection()||this.span.hasClass("k-readonly"))&&this._placeholder(!0),this._inputTemplate(),this._accessors(),this._filterHeader(),this._checkAll(),this._enable(),e&&(e.enable||e.enabled)&&this.enable(!0),this._clearButton(),e!==t&&null!==e||(e={}),e.label&&this._inputLabel?this.label.setOptions(e.label):!1===e.label?(this.label._unwrapFloating(),this._inputLabel.remove(),delete this._inputLabel):e.label&&this._label(),this._aria()},destroy:function(){i.ui.Widget.fn.destroy.call(this),this.treeview&&this.treeview.destroy(),this.popup.destroy(),this.wrapper.off(f),this._clear.off(f),this.filterInput&&this.filterInput.off(f),this.tagList&&this.tagList.off(f),this.bigScreenMQL&&this.bigScreenMQL.destroy(),this.smallScreenMQL&&this.smallScreenMQL.destroy(),i.unbind(this.tagList),this.options.checkAll&&this.checkAll&&this.checkAll.off(f),this._form&&this._form.off("reset",this._resetHandler),this.label&&this.label.destroy()},setValue:function(e){e=Array.isArray(e)||e instanceof d?e.slice(0):[e],this._values=e},items:function(){return this.treeview.items()},_useValueMapperWithValue:function(e){const t=this;let i=e instanceof Array?e:[e];"object"==typeof i[0]&&(i=t._mapValuesToId(i)),t.requireValueMapper(this.options,i),t._deferred.done((()=>{t._selection._setValue(i)}))},value:function(e){const t=this,i=t.options.loadOnDemand;if(e)if(t.filterInput&&t.dataSource._filter)t._filtering=!0,t.dataSource.filter({});else{if(!t.dataSource.data().length||!t.treeview.dataSource.data().length)return void(i?i.valueMapper?t.one("dataBound",(()=>{t._useValueMapperWithValue(e)})):t.dataSource.fetch((function(){t._selection._setValue(e)})):(t.treeview.one("loadCompleted",(function(){t._selection._setValue(e)})),!t.options.autoBind&&t.options.valuePrimitive&&t.dataSource.fetch()));if(i&&i.valueMapper)return void t._useValueMapperWithValue(e)}return t._selection._setValue(e)},text:function(e){var i,s=this.options.ignoreCase;if((e=null===e?"":e)===t||this._isMultipleSelection())return this._textAccessor();"string"==typeof e?(i=s?e:e.toLowerCase(),this._selectItemByText(i),this._textAccessor(i),this._refreshFloatingLabel()):this._textAccessor(e)},_aria:function(){this.wrapper.find("span.k-input-inner");this.wrapper.attr({"aria-haspopup":"tree","aria-expanded":!1,"aria-controls":this.treeview.element.attr("id"),role:"combobox"}),this._activeId=i.guid(),this._ariaLabel(this.wrapper),this.filterInput&&this.options.filterLabel&&this.filterInput.attr("aria-label",this.options.filterLabel),this.options.checkboxes&&(this.wrapper.attr({"aria-describedby":this.tagList[0].id}),this.tagList.attr({role:"listbox","aria-orientation":"horizontal","aria-multiselectable":!0}),this._ariaLabel(this.tagList))},_header:function(){var t=this,s=e(t.header),a=t.options.headerTemplate;if(i.destroy(s),s.remove(),a){var n="function"!=typeof a?i.template(a):a;s=e(n({})),t.header=s[0]?s:null,t.list.prepend(s)}else t.header=null},_noData:function(){var t=this,s=e(t.noData),a=!0===t.options.noDataTemplate?n(t.options.messages.noData):t.options.noDataTemplate;i.destroy(s),s.remove(),a?(t.noData=e('<div class="k-no-data"></div>').hide().appendTo(t.list),t.noDataTemplate="function"!=typeof a?i.template((()=>a)):a):t.noData=null},_renderNoData:function(){var e=this,t=e.noData;t&&t.html(e.noDataTemplate({instance:e}))},_footer:function(){var t=this,s=e(t.footer),a=t.options.footerTemplate;i.destroy(s),s.remove(),a?(t.footer=e('<div class="k-footer"></div>').appendTo(t.list),t.footerTemplate="function"!=typeof a?i.template(a):a):t.footer=null},_renderFooter:function(){var e=this,t=e.footer;t&&t.html(e.footerTemplate({instance:e}))},_enable:function(){var e=this,i=e.options,s=e.element.is("[disabled]");i.enable!==t&&(i.enabled=i.enable),!i.enabled||s?e.enable(!1):e.readonly(e.element.is("[readonly]"))},_adjustListWidth:function(){var e,t,i=this,s=i.list,a=s[0].style.width,n=i.wrapper;if(s.data(k)||!a)return e=window.getComputedStyle?window.getComputedStyle(n[0],null):0,t=parseFloat(e&&e.width)||w(n),e&&b.msie&&(t+=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth)),a="border-box"!==s.css("box-sizing")?t-(w(s)-s.width()):t,s.css({fontFamily:n.css("font-family"),width:i.options.autoWidth?"auto":a,minWidth:a,whiteSpace:i.options.autoWidth?"nowrap":"normal"}).data(k,a),!0},_reset:function(){var t=this,i=t.element,s=i.attr("form"),a=s?e("#"+s):i.closest("form");a[0]&&(t._resetHandler=function(){setTimeout((function(){t.value(t._initial)}))},t._form=a.on("reset",t._resetHandler))},_hasActionSheet:function(){return"auto"===this.options.adaptiveMode&&!this.bigScreenMQL.mediaQueryList.matches},_popup:function(){var t=this,a=this;t.options.checkboxes?(t.options.checkAll&&t.list.attr("role","application"),t.list.addClass("k-multiselecttree-popup")):t.list.addClass("k-dropdowntree-popup"),"auto"!=a.options.adaptiveMode||a.bigScreenMQL.mediaQueryList.matches?(a.popup=new s.Popup(a.list,u({},a.options.popup,{anchor:a.wrapper,open:a._openHandler.bind(a),close:a._closeHandler.bind(a),animation:a.options.animation,isRtl:g.isRtl(a.wrapper),autosize:a.options.autoWidth,deactivate:()=>{this._refreshFloatingLabel()},activate:()=>{this._refreshFloatingLabel()}})),a.popup.one("open",a._popupOpen.bind(a))):(e(document.body).append(a.list),a.popup=new s.ActionSheet(a.list,{adaptive:!0,hideOverflowContent:!0,headerTemplate:e=>`<div class="k-text-center k-actionsheet-titlebar" ><div class="k-actionsheet-titlebar-group k-hbox"><div class="k-actionsheet-title"><div class="k-text-center">${a.label?a.label.element.text():a.options.label||a.options.placeholder||"Select"}</div>`+(a.options.placeholder&&(a.label||a.options.label)?`<div class="k-actionsheet-subtitle k-text-center">${a.options.placeholder||""}</div>`:"")+"</div>"+(e.closeButton?'<div class="k-actionsheet-actions">'+i.html.renderButton(`<button tabindex="-1" ${i.attr("ref-actionsheet-close-button")}></button>`,{icon:"x",fillMode:"flat",size:"large"})+"</div>":"")+"</div>"+(this._isFilterEnabled()?'<div class="k-actionsheet-titlebar-group k-actionsheet-filter"></div>':"")+"</div>",closeButton:!0,focusOnActivate:!1,fullscreen:a.smallScreenMQL.mediaQueryList.matches,popup:u({},a.options.popup,{anchor:a.wrapper,open:a._openHandler.bind(a),close:a._closeHandler.bind(a),animation:a.options.animation,isRtl:g.isRtl(a.wrapper),autosize:a.options.autoWidth}),deactivate:()=>{this._refreshFloatingLabel()},activate:()=>{this._refreshFloatingLabel()}}))},_allowOpening:function(){return this.options.noDataTemplate||this.treeview.dataSource.flatView().length},_placeholder:function(e){this.span&&this.span.toggleClass("k-readonly",e).text(e?this.options.placeholder:"")},_currentValue:function(e){var t=this._value(e);return t||0===t||(t=e),t},_checkValue:function(t){var i="",s=-1,a=this.value(),n="multiple"===this.options.tagMode;if((t||0===t)&&(t.level&&(t._level=t.level()),i=this._currentValue(t),s=a.indexOf(i)),t.checked){if(e.grep(this._tags,(function(e){return e.uid===t._tagUid})).length)return;var r=new h(t.toJSON());t._tagUid=r.uid,this._tags.push(r),1===this._tags.length&&(this.span.hide(),n||this._multipleTags.push(r)),-1===s&&(a.push(i),this.setValue(a))}else{var l=this._tags.find((function(e){return e.uid===t._tagUid})),o=this._tags.indexOf(l);if(-1===o)return void this._treeViewCheckAllCheck(t);this._tags.splice(o,1),0===this._tags.length&&(this.span.show(),n||this._multipleTags.splice(0,1)),-1!==s&&(a.splice(s,1),this.setValue(a))}this._treeViewCheckAllCheck(t),this._preventChangeTrigger||this._valueMethodCalled||this.dataSource._requestInProgress||this.trigger(F),this.options.autoClose&&this.popup.visible()&&(this.close(),this.wrapper.trigger("focus")),this.popup.position(),this._toggleCloseVisibility(),this._updateSelectedOptions()},_updateSelectedOptions:function(){if("select"===this.element[0].tagName.toLowerCase()){var e=this._tags,t="",i=null,s=null;if(e.length)for(var a=0;a<e.length;a++)i=e[a],s=this._value(i),t+=this._option(s,this._text(i),!0);this.element.html(t)}},_option:function(e,s,a){var n="<option";return e!==t&&(-1!==(e+="").indexOf('"')&&(e=e.replace(O,"&quot;")),n+=' value="'+e+'"'),a&&(n+=" selected"),n+=">",s!==t&&(n+=i.htmlEncode(s)),n+"</option>"},_selectValue:function(e){var t="",i="";(e||0===e)&&(e.level&&(e._level=e.level()),i=this._text(e)||e,t=this._currentValue(e)),null===t&&(t=""),this.setValue(t),this._textAccessor(i,e),this._accessor(t),this._preventChangeTrigger||this._valueMethodCalled||this.trigger(F),this._valueMethodCalled=!1,this.options.autoClose&&this.popup.visible()&&(this.close(),this.wrapper.trigger("focus")),this.popup.position(),this._toggleCloseVisibility()},_clearClick:function(e){e.stopPropagation(),this.wrapper.trigger("focus"),this._clearTextAndValue()},_clearTextAndValue:function(){var e=this._selection._clearValue();this.setValue([]),this._clearInput(),this._clearText(),this.popup.position(),this._toggleCloseVisibility(),this._refreshFloatingLabel(),e&&this.trigger(F)},_clearText:function(){this.options.placeholder?this._placeholder(!0):this.span&&this.span.html("")},_inputTemplate:function(){var e=this.options.valueTemplate;e=e?i.template(e):e=>n(this._text(e)),this.valueTemplate=e},_assignInstance:function(e,t){var i=this.options.dataTextField,s={};return i?(H(s,i.split(C),e),H(s,this.options.dataValueField.split(C),t),s=new h(s)):s=e,s},_textAccessor:function(i,s){var a=this.valueTemplate,n=this.span;if(i===t)return n.text();n.removeClass("k-readonly"),!s&&(e.isPlainObject(i)||i instanceof h)&&(s=i),s||(s=this._assignInstance(i,this._accessor()));try{n.html(a(s))}catch(e){n&&n.html("")}},_accessors:function(){var e=this.element,t=this.options,s=e.attr(i.attr("text-field")),a=e.attr(i.attr("value-field"));!t.dataTextField&&s&&(t.dataTextField=s),!t.dataValueField&&a&&(t.dataValueField=a),t.dataTextField=t.dataTextField||"text",t.dataValueField=t.dataValueField||"value",this._text=E(t.dataTextField),this._value=E(t.dataValueField)},_accessor:function(e,t){return this._accessorInput(e,t)},_accessorInput:function(e){var i=this.element[0];if(e===t)return i.value;null===e&&(e=""),i.value=e},_clearInput:function(){this.element[0].value=""},_clearButton:function(){var t=n(this.options.messages.clear);this._clear||(this._clear=e('<span unselectable="on" class="k-clear-value" title="'+t+'">'+i.ui.icon("x")+"</span>").attr({tabIndex:-1})),this.options.clearButton?this._clear.insertAfter(this.span.parent()):this.options.clearButton||this._clear.remove()},_toggleCloseVisibility:function(){var e=this.element.attr(x),t=this.value()&&!this._isMultipleSelection()||this.value().length,i=this.element.val()&&this.element.val()!==this.options.placeholder;e||!t&&!i?this._hideClear():this._showClear()},_showClear:function(){this._clear&&this._clear.removeClass(m)},_hideClear:function(){this._clear&&this._clear.addClass(m)},_openHandler:function(e){this._adjustListWidth(),this.trigger(D)?e.preventDefault():(this.wrapper.attr("aria-expanded",!0),this.tree.attr("aria-hidden",!1))},_closeHandler:function(e){this.trigger(M)?e.preventDefault():(this.wrapper.attr("aria-expanded",!1),this.tree.attr("aria-hidden",!0))},_treeview:function(){var e=this;"auto"!=e.options.adaptiveMode&&e.options.height&&e.tree.css("max-height",e.options.height),e.tree.attr("id",i.guid()),e.treeview=new o(e.tree,u({size:e.options.size},e.options.treeview),e),e.dataSource=e.treeview.dataSource,e.treeview.bind("select",(function(t){e.trigger("select",t)}))},_treeViewDataBound:function(e){if(e.node&&this._prev&&this._prev.length&&e.sender.expand(e.node),this._filtering)return e.node||(this._filtering=!1),void(this._isMultipleSelection()||this._deselectItem(e));if(this.treeview||(this.treeview=e.sender),e.node){var t=e.sender.dataItem(e.node);if(t){var i=t.children.data();this._checkLoadedItems(i)}}else{var s=e.sender.dataSource.data();this._checkLoadedItems(s)}this.trigger("dataBound",e)},_deselectItem:function(e){var t=[];if(e.node){var i=e.sender.dataItem(e.node);i&&(t=i.children.data())}else t=e.sender.dataSource.data();for(var s=0;s<t.length;s++)t[s].selected&&!this._valueComparer(t[s],this.value())&&t[s].set("selected",!1)},_checkLoadedItems:function(e){var t=this.value();if(e)for(var i=0;i<e.length;i++)this._selection._checkLoadedItem(e[i],t)},_treeViewCheckAllCheck:function(e){this.options.checkAll&&this.checkAll&&(this._getAllChecked(),e.checked?this._checkCheckAll():this._uncheckCheckAll())},_checkCheckAll:function(){var e=this.checkAll.find(".k-checkbox");this._allItemsAreChecked?e.prop("checked",!0).prop("indeterminate",!1):e.prop("indeterminate",!0)},_uncheckCheckAll:function(){var e=this.checkAll.find(".k-checkbox");this._allItemsAreUnchecked?e.prop("checked",!1).prop("indeterminate",!1):e.prop("indeterminate",!0)},_filterHeader:function(){var t='<div class="k-list-filter"><span class="k-textbox k-input k-input-md k-rounded-md k-input-solid" type="text" autocomplete="off">'+i.ui.icon({icon:"search",iconClass:"k-input-icon"})+"</span></div>";this.filterInput&&(this.filterInput.off(f).parent().remove(),this.filterInput=null),this._isFilterEnabled()&&(this._disableCheckChildren(),this.filterInput=e('<input class="k-input-inner" type="text" />').attr({placeholder:this.element.attr("placeholder"),title:this.element.attr("title"),role:"searchbox","aria-haspopup":"tree","aria-autocomplete":"list"}),this.filterInput.on("input",this._filterChange.bind(this)),this._hasActionSheet()?e(t).appendTo(this.popup.wrapper.find(".k-actionsheet-filter")).find(".k-textbox").append(this.filterInput):e(t).insertBefore(this.tree).find(".k-textbox").append(this.filterInput))},_filterChange:function(){this.filterInput&&this._search()},_disableCheckChildren:function(){this._isMultipleSelection()&&this.options.treeview.checkboxes&&this.options.treeview.checkboxes.checkChildren&&(this.options.treeview.checkboxes.checkChildren=!1)},_checkAll:function(){if(this.checkAll&&(this.checkAll.find(".k-checkbox-label, .k-checkbox").off(f),this.checkAll.remove(),this.checkAll=null),this._isMultipleSelection()&&this.options.checkAll){var t=a.renderCheckBox(u({},this.options,{label:"Check All",rounded:"medium"}));this.checkAll=e('<div class="k-check-all">'+t+"</div>").insertBefore(this.tree),this.checkAll.find(".k-checkbox-label").html(i.template(this.options.checkAllTemplate)({instance:this})),this.checkAll.find(".k-checkbox").on("change"+f,this._changeCheckAll.bind(this)).on("keydown"+f,this._keydownCheckAll.bind(this)),this._disabledCheckedItems=[],this._disabledUnCheckedItems=[],this._getAllChecked(),this._allItemsAreUnchecked||this._checkCheckAll()}},_changeCheckAll:function(){var e=this.checkAll.find(".k-checkbox").prop("checked");this._updateCheckAll(e)},_updateCheckAll:function(e){var t=this.checkAll.find(".k-checkbox");this._toggleCheckAllItems(e),t.prop("checked",e),this._disabledCheckedItems.length&&this._disabledUnCheckedItems.length?t.prop("indeterminate",!0):this._disabledCheckedItems.length?t.prop("indeterminate",!e):this._disabledUnCheckedItems.length?t.prop("indeterminate",e):t.prop("indeterminate",!1),this._disabledCheckedItems=[],this._disabledUnCheckedItems=[]},_keydownCheckAll:function(e){var t=e.keyCode;if(e.altKey&&t===v.UP||t===v.ESC||t===v.TAB)return this.close(),this.wrapper.trigger("focus"),void e.preventDefault();t===v.UP&&(this.filterInput?this.filterInput.trigger("focus"):this.wrapper.trigger("focus"),e.preventDefault()),t===v.DOWN&&(this.tree&&this.tree.is(":visible")&&this.tree.trigger("focus"),e.preventDefault()),t===v.SPACEBAR&&(b.msie||b.edge)&&(this._clickCheckAll(),e.preventDefault())},_clickCheckAll:function(){var e=this.checkAll.find(".k-checkbox"),t=e.prop("checked");this._updateCheckAll(!t),e.trigger("focus")},_dfs:function(e,t,i){for(var s=0;s<e.length&&this[t](e[s],i);s++)this._traverceChildren(e[s],t,i)},_uncheckItemByUid:function(e){this._dfs(this.dataSource.data(),"_uncheckItemEqualsUid",e)},_uncheckItemEqualsUid:function(e,t){return!1===e.enabled||e._tagUid!=t||(e.set("checked",!1),!1)},_selectItemByText:function(e){this._dfs(this.dataSource.data(),"_itemEqualsText",e)},_itemEqualsText:function(e,t){return!1===e.enabled||this._text(e)!==t||(this.treeview.select(this.treeview.findByUid(e.uid)),this._selectValue(e),!1)},_selectItemByValue:function(e){this._dfs(this.dataSource.data(),"_itemEqualsValue",e)},_itemEqualsValue:function(e,t){return!1===e.enabled||!this._valueComparer(e,t)||(this.treeview.select(this.treeview.findByUid(e.uid)),!1)},_checkItemByValue:function(e){for(var t=this.treeview.dataItems(),i=0;i<e.length;i++)this._dfs(t,"_checkItemEqualsValue",e[i])},_checkItemEqualsValue:function(e,t){return!1===e.enabled||!this._valueComparer(e,t)||(e.set("checked",!0),!1)},_valueComparer:function(e,t){var i,s=this._value(e);if(!this._isNullorUndefined(s)){if(this._isNullorUndefined(t))return!1;var a=this._value(t);return a?s==a:s==t}return!!(i=this._text(e))&&(this._text(t)?i==this._text(t):i==t)},_isNullorUndefined:function(e){return e===t||null===e},_getAllChecked:function(){return this._allCheckedItems=[],this._allItemsAreChecked=!0,this._allItemsAreUnchecked=!0,this._dfs(this.dataSource.data(),"_getAllCheckedItems"),this._allCheckedItems},_getAllCheckedItems:function(e){return this._allItemsAreChecked&&(this._allItemsAreChecked=e.checked),this._allItemsAreUnchecked&&(this._allItemsAreUnchecked=!e.checked),e.checked&&this._allCheckedItems.push(e),!0},_traverceChildren:function(e,t,i){var s=e[e._childrenOptions&&e._childrenOptions.schema?e._childrenOptions.schema.data:null]||e.items||e.children;s&&this._dfs(s,t,i)},_toggleCheckAllItems:function(e){this._dfs(this.dataSource.data(),"_checkAllCheckItem",e)},_checkAllCheckItem:function(e,t){return!1===e.enabled?e.checked?this._disabledCheckedItems.push(e):this._disabledUnCheckedItems.push(e):e.set("checked",t),!0},_isFilterEnabled:function(){var e=this.options.filter;return e&&"none"!==e},_editable:function(t){var i=this,s=i.element,a=t.disable,n=t.readonly,r=i.wrapper.add(i.filterInput).off(f),l=i.wrapper.off(S);i._isMultipleSelection()&&i.tagList.off(L+f),n||a?a?(r.removeAttr(V),l.addClass(y)):(r.attr(V,r.data(V)),l.removeClass(y),r.on("focusin"+f,i._focusinHandler.bind(i)).on("focusout"+f,i._focusoutHandler.bind(i))):(s.prop(T,!1).prop(x,!1),l.removeClass(y).on(S,i._toggleHover),i._clear.on("click"+f,i._clearClick.bind(i)),r.attr(V,r.data(V)).attr(A,!1).on("keydown"+f,i._keydown.bind(i)).on("focusin"+f,i._focusinHandler.bind(i)).on("focusout"+f,i._focusoutHandler.bind(i)),i.wrapper.on(L+f,i._wrapperClick.bind(i)),this._isMultipleSelection()&&(i.tagList.on(L+f,"div.k-chip",(function(t){e(t.currentTarget).addClass(I)})),i.tagList.on(L+f,".k-chip-remove-action .k-icon",(function(e){i._removeTagClick(e)})))),s.attr(T,a).attr(x,n),r.attr(A,a)},_focusinHandler:function(){this.wrapper.addClass(I),this._prevent=!1},_focusoutHandler:function(){var e=this;this._isMultipleSelection()&&this.tagList.find(C+I).removeClass(I),e._prevent||(this.wrapper.removeClass(I),e._prevent=!0,e.element.trigger("blur"))},_toggle:function(e){this[(e=e!==t?e:!this.popup.visible())?D:M]()},_wrapperClick:function(e){e.preventDefault(),this.popup.unbind("activate",this._focusInputHandler),this._focused=this.wrapper,this._prevent=!1,this._toggle()},_toggleHover:function(t){e(t.currentTarget).toggleClass("k-hover","mouseenter"===t.type)},_focusInput:function(){this.filterInput?this.filterInput.trigger("focus"):this.checkAll?this.checkAll.find(".k-checkbox").trigger("focus"):this.tree.is(":visible")&&(this.tree[0].focus({preventScroll:!0}),this._ie11PreventScrollOnFocus())},_ie11PreventScrollOnFocus:function(){if(b.msie&&11==b.version){var e=this.popup;e._toggleResize(!1),setTimeout((function(){e._toggleResize(!0)}),50)}},_keydown:function(e){var t,i,s,a,n=e.keyCode,r=e.altKey,l=this.popup.visible();if(this.filterInput&&(t=this.filterInput[0]===_()),this.wrapper&&(i=this.wrapper[0]===_()),i){if(n===v.ESC)return this._clearTextAndValue(),void e.preventDefault();if(this._isMultipleSelection()){if(n===v.LEFT)return this._focusPrevTag(),void e.preventDefault();if(n===v.RIGHT)return this._focusNextTag(),void e.preventDefault();if(n===v.HOME)return this._focusFirstTag(),void e.preventDefault();if(n===v.END)return this._focusLastTag(),void e.preventDefault();if(n===v.DELETE)return(s=this.tagList.find(C+I).first()).length&&(a=this._tags[s.index()],this._removeTag(a)),void e.preventDefault();if(n===v.BACKSPACE)return((s=this.tagList.find(C+I).first()).length||(s=this._focusLastTag()).length)&&(a=this._tags[s.index()],this._removeTag(a)),void e.preventDefault()}}return t&&(n===v.ESC&&this._clearFilter(),n!==v.UP||r||(this.wrapper.trigger("focus"),e.preventDefault()),b.msie&&b.version<10&&(n!==v.BACKSPACE&&n!==v.DELETE||this._search()),n===v.TAB)||r&&n===v.UP||n===v.ESC?(this.close(),this.wrapper.trigger("focus"),void e.preventDefault()):void(n===v.ENTER&&this._typingTimeout&&this.filterInput&&l?e.preventDefault():(n!==v.SPACEBAR||t||(this._toggle(!l),e.preventDefault()),r&&n===v.DOWN&&!l&&(this.open(),e.preventDefault()),n===v.DOWN&&l&&(this.filterInput&&!t?this.filterInput.trigger("focus"):this.checkAll&&this.checkAll.is(":visible")?this.checkAll.find("input").trigger("focus"):this.tree.is(":visible")&&(this.tree[0].focus({preventScroll:!0}),this._ie11PreventScrollOnFocus()),e.preventDefault()),n===v.TAB&&l&&(this.close(),this.wrapper.trigger("focus"),e.preventDefault())))},_focusPrevTag:function(){var e=this.tagList.find(C+I);if(e.length){var t=this._activeId;e.first().removeClass(I).removeAttr("id").prev(B).addClass(I).attr("id",t),this.wrapper.attr("aria-activedescendant",t)}else this._focusLastTag()},_focusNextTag:function(){var e=this.tagList.find(C+I);if(e.length){var t=this._activeId;e.first().removeClass(I).removeAttr("id").next(B).addClass(I).attr("id",t),this.wrapper.attr("aria-activedescendant",t)}else this._focusFirstTag()},_focusFirstTag:function(){var e=this._activeId;this._clearDisabledTag();var t=this.tagList.children(B).first().addClass(I).attr("id",e);return this.wrapper.attr("aria-activedescendant",e),t},_focusLastTag:function(){var e=this._activeId;this._clearDisabledTag();var t=this.tagList.children(B).last().addClass(I).attr("id",e);return this.wrapper.attr("aria-activedescendant",e),t},_clearDisabledTag:function(){this.tagList.find(C+I).removeClass(I).removeAttr("id")},_search:function(){var e=this;clearTimeout(e._typingTimeout),e._typingTimeout=setTimeout((function(){var t=e.filterInput.val();e._prev!==t&&(e._prev=t,e.search(t)),e._typingTimeout=null}),e.options.delay)},_clearFilter:function(){this.filterInput.val().length&&(this.filterInput.val(""),this._prev="",this._filtering=!0,this.treeview.dataSource.filter({}))},_removeTagClick:function(t){t.stopPropagation();var i=this._tags[e(t.currentTarget.closest(B)).index()];this._removeTag(i)},_removeTag:function(e){if(e){var t=e.uid;this._uncheckItemByUid(t)}}});function H(e,t,i){for(var s,a=0,n=t.length-1;a<n;++a)(s=t[a])in e||(e[s]={}),e=e[s];e[t[n]]=i}s.plugin(U),i.cssProperties.registerPrefix("DropDownTree","k-picker-"),i.cssProperties.registerValues("DropDownTree",[{prop:"rounded",values:i.cssProperties.roundedValues.concat([["full","full"]])}]),i.cssProperties.registerPrefix("MultiSelectTree","k-input-"),i.cssProperties.registerValues("MultiSelectTree",[{prop:"rounded",values:i.cssProperties.roundedValues.concat([["full","full"]])}]);var P=i.Class.extend({init:function(e){this._dropdowntree=e},_initWrapper:function(){this._wrapper(),this._span()},_preselect:function(e){this._dropdowntree._selectValue(e)},_wrapper:function(){var e,t=this._dropdowntree,i=t.element,s=i[0];(e=i.parent()).is("span.k-dropdowntree")||((e=i.wrap("<span />").parent())[0].style.cssText=s.style.cssText,e[0].title=s.title),t._focused=t.wrapper=e.addClass("k-dropdowntree k-picker").addClass(s.className).removeClass("input-validation-error").removeClass("k-invalid").css("display","").attr({accesskey:i.attr("accesskey"),unselectable:"on"}),i.hide().removeAttr("accesskey")},_span:function(){var e,t=this._dropdowntree,i=t.wrapper,s="span.k-input-value-text";(e=i.find(s))[0]||(i.append('<span unselectable="on" class="k-input-inner"><span class="k-input-value-text"></span></span>'+a.renderButton('<button unselectable="on" class="k-input-button" aria-label="select" tabindex="-1"></button>',u({},t.options,{icon:"caret-alt-down",shape:"none",rounded:"none"}))).append(t.element),e=i.find(s)),t.span=e,t._arrow=i.find(".k-input-button"),t._arrowIcon=t._arrow.find(".k-icon,.k-svg-icon")},_setValue:function(e){var i,s=this._dropdowntree;return e===t||null===e?(e="object"==typeof(i=s._values.slice()[0])?i:s._accessor()||i)===t||null===e?"":e:(s._valueMethodCalled=!0,0===e.length?(s._clearTextAndValue(),void(s._valueMethodCalled=!1)):(s._selectItemByValue(e),s._toggleCloseVisibility(),void s._refreshFloatingLabel()))},_clearValue:function(){var e=this._dropdowntree,t=e.treeview.select(),i=e._values.length,s=!1;return e.treeview.dataItem(t)?(e.treeview.dataItem(t).set("selected",!1),s=!0):i>0&&(s=!0),!(e._valueMethodCalled||!s)},_checkLoadedItem:function(e,t){var i=this._dropdowntree;i._isNullorUndefined(t)||""===t?!t&&e.selected&&i.treeview.select(i.treeview.findByUid(e.uid)):i._valueComparer(e,t)?(i._preventChangeTrigger=!0,e.set("selected",!0),i._preventChangeTrigger=!1):e.selected&&i.treeview.select(i.treeview.findByUid(e.uid))}}),q=i.Class.extend({init:function(e){this._dropdowntree=e},_initWrapper:function(){var t=this._dropdowntree;this._tagTemplate(),t.element.attr("multiple","multiple").hide(),this._wrapper(),t._tags=new d([]),t._multipleTags=new d([]),this._tagList(),t.span=e('<span unselectable="on" class="k-input-inner"><span class="k-input-value-text"></span></span>').appendTo(t.wrapper).find(".k-input-value-text")},_preselect:function(t,s){var a=this._dropdowntree,n=s||a.options.value;Array.isArray(t)||t instanceof i.data.ObservableArray||(t=[t]),(e.isPlainObject(t[0])||t[0]instanceof i.data.ObservableObject||!a.options.dataValueField)&&(a.dataSource.data(t),a.value(n))},_tagTemplate:function(){var t=this._dropdowntree,s=t.options,r=s.valueTemplate,l="multiple"===s.tagMode,o=n(s.messages.singleTag);r=r?i.template(r):t.valueTemplate,t.valueTemplate=function(i){return a.renderChip('<span class="'+(!1===i.enabled?"k-disabled":"")+'"'+(!1===i.enabled?'aria-disabled="true"':"")+"></span>",e.extend({},s,{fillMode:"solid",themeColor:"base",rounded:"medium",attr:{unselectable:"on","aria-keyshortcuts":"Enter Delete",role:"option"},text:l?r(i):'<span unselectable="on" data-bind="text: tags.length"></span><span unselectable="on">&nbsp;'+o+"</span>",removable:l,removeIcon:"x-circle",removableAttr:{unselectable:"on","aria-hidden":!0,"aria-label":t.options.messages.deleteTag,title:t.options.messages.deleteTag}}))}},_wrapper:function(){var e=this._dropdowntree,t=e.element,i=t.parent(".k-multiselecttree");i[0]||((i=t.wrap('<span class="k-multiselecttree k-input" unselectable="on" />').parent())[0].style.cssText=t[0].style.cssText,i[0].title=t[0].title),e.wrapper=i.addClass(t[0].className).css("display","")},_tagList:function(){var t=this._dropdowntree,s=t.wrapper.children("div.k-input-values");if(!s[0]){var n="multiple"===t.options.tagMode?"tags":"multipleTag";s=e(a.renderChipList('<div unselectable="on" class="k-input-values k-selection-multiple" data-template="tagTemplate" data-bind="source: '+n+'" />',e.extend({selectable:"none"},t.options))).appendTo(t.wrapper)}t.tagList=s,t.tagList.attr("id",i.guid()+"_tagList"),t.wrapper.attr("aria-controls",t.tagList.attr("id"));var r=i.observable({multipleTag:t._multipleTags,tags:t._tags,tagTemplate:t.valueTemplate});i.bind(t.tagList,r),t.tagList.attr("data-stop",!0)},_refreshTagListAria:function(){var t=this;t.tagList&&a.renderChipList(t.tagList,e.extend({selectable:0===t.tagList.items().length?"none":"multiple"},t.options))},_setValue:function(e){var i=this._dropdowntree,s=i._values;if(e===t||null===e)return i._values.slice();i.setValue(e),i._valueMethodCalled=!0,e.length?(this._removeValues(s,e),i._checkItemByValue(e)):i._clearTextAndValue(),i._valueMethodCalled=!1,i._toggleCloseVisibility(),this._refreshTagListAria(),i._refreshFloatingLabel()},_removeValues:function(e,t){for(var i=this._dropdowntree,s=this._getNewValues(e,t),a=0;a<s.length;a++)for(var n=0;n<i._tags.length;n++)i._valueComparer(i._tags[n],s[a])&&i._uncheckItemByUid(i._tags[n].uid)},_getNewValues:function(e,t){for(var i=[],s=0;s<e.length;s++)-1===t.indexOf(e[s])&&i.push(e[s]);return i},_clearValue:function(){for(var e=this._dropdowntree,t=e._tags.slice(),i=0;i<t.length;i++){var s=t[i].uid;e._preventChangeTrigger=!0,e._uncheckItemByUid(s)}return!(!t.length||(e._preventChangeTrigger=!1,e._valueMethodCalled))},_checkLoadedItem:function(e,t){var i=this._dropdowntree;i._noInitialValue&&e.checked?i._checkValue(e):!t.length&&!this._isDataSourceSet||-1===(-1!==t.indexOf(i._currentValue(e))||t.indexOf(e))||this._findTag(i._currentValue(e))||(e.checked?i._checkValue(e):(i._preventChangeTrigger=!0,e.set("checked",!0),i._preventChangeTrigger=!1))},_findTag:function(e){var t=this._dropdowntree;return t._tags.find((function(i){return t._valueComparer(i,e)}))}});i.ui.DropDownTree.SingleSelection=P,i.ui.DropDownTree.MultipleSelection=q}(window.kendo.jQuery);var u=kendo;e.__meta__={id:"dropdowntree",name:"DropDownTree",category:"web",description:"The DropDownTree widget displays a hierarchy of items and allows the selection of single or multiple items.",depends:["treeview","popup","binder","html.chip","html.chiplist","html.button","html.input","label","icons","actionsheet","valueMapper.chunk","dropdowns-loader.chunk"]},e.default=u,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=kendo.dropdowntree.min.js.map