UNPKG

@progress/kendo-ui

Version:

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

3 lines 45.8 kB
/* @license */ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`kendo.treeview.min.js`),require(`kendo.popup.min.js`),require(`kendo.actionsheet.min.js`),require(`kendo.binder.min.js`),require(`kendo.html.chip.min.js`),require(`kendo.html.chiplist.min.js`),require(`kendo.html.button.min.js`),require(`kendo.html.input.min.js`),require(`kendo.label.min.js`),require(`kendo.icons.min.js`),require(`kendo.core.min.js`)):typeof define==`function`&&define.amd?define([`exports`,`kendo.treeview.min`,`kendo.popup.min`,`kendo.actionsheet.min`,`kendo.binder.min`,`kendo.html.chip.min`,`kendo.html.chiplist.min`,`kendo.html.button.min`,`kendo.html.input.min`,`kendo.label.min`,`kendo.icons.min`,`kendo.core.min`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.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.Core))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),(function(e,t){var n=window.kendo,r=n.ui,i=n.keys,a=`k-disabled`,o=`select`,s=`checked`,c=`dataBound`,l=`click`,u=`.kendoTreeView`,d=`indeterminate`,f=`navigate`,p,m=r.TreeView;function h(e){return function(t){var n=t.children(`.k-animation-container`);return n.length||(n=t),n.children(e)}}p=h(`.k-treeview-group`);var g=m.extend({init:function(e,t,n){var r=this;r.dropdowntree=n,m.fn.init.call(r,e,t),r.dropdowntree._isMultipleSelection()&&r.wrapper.on(l+u,`.k-treeview-item-content.k-selected .k-treeview-leaf`,r._clickSelectedItem.bind(r))},_checkOnSelect:function(e){if(!e.isDefaultPrevented()){var t=this.dataItem(e.node);t.set(`checked`,!t.checked)}},_setCheckedValue:function(e,t){e.set(s,t)},_click:function(e){var t=this;t.dropdowntree._isMultipleSelection()&&t.one(`select`,t._checkOnSelect),m.fn._click.call(t,e)},_clickSelectedItem:function(t){var n=this,r=e(t.currentTarget),i=this.dataItem(r);n._trigger(o,r)||(i.set(`checked`,!i.checked),n.dataItem(r).set(`selected`,!1))},defaultrefresh:function(e){var n=this,r=e.node,i=e.action,a=e.items,o=this.wrapper,s=this.options,l=s.loadOnDemand,u=s.checkboxes&&s.checkboxes.checkChildren,d;if(!this._skip){if(e.field)return!a[0]||!a[0].level?void 0:this._updateNodes(a,e.field);if(r&&(o=this.findByUid(r.uid),this._progress(o,!1)),u&&i!=`remove`){var f=!1;for(d=0;d<a.length;d++)if(`checked`in a[d]){f=!0;break}if(!f&&r&&r.checked)for(d=0;d<a.length;d++)a[d].checked=!0}if(i==`add`?this._appendItems(e.index,a,o):i==`remove`?this._remove(this.findByUid(a[0].uid),!1):i==`itemchange`?this._updateNodes(a):i==`itemloaded`?this._refreshChildren(o,a,e.index):this._refreshRoot(a),i!=`remove`)for(d=0;d<a.length;d++)(!l||a[d].expanded)&&a[d].load();n.wrapper.find(`>ul`).attr(`role`,`tree`),this._applyLevelStyles(),this.trigger(c,{node:r?o:t}),this.dropdowntree._treeViewDataBound({node:r?o:t,sender:this}),this.options.checkboxes.checkChildren&&this.updateIndeterminate()}},_previousVisible:function(e){var t=this,n,r;if(!e.length||e.prev().length)for(r=e.length?e.prev():t.root.children().last();t._expanded(r)&&(n=p(r).children().last(),n.length);)r=n;else r=t.parent(e)||e,r.length||(t.dropdowntree.checkAll&&t.dropdowntree.checkAll.is(`:visible`)?t.dropdowntree.checkAll.find(`.k-checkbox`).trigger(`focus`):t.dropdowntree.filterInput?t.dropdowntree.filterInput.trigger(`focus`):t.dropdowntree.wrapper.trigger(`focus`));return r},_keydown:function(r){var c=this,l=r.keyCode,u,p=c.current(),m=c._expanded(p),h=p.find(`.k-checkbox-wrap`).first().find(`:checkbox`),g=n.support.isRtl(c.element);r.target==r.currentTarget&&(!g&&l==i.RIGHT||g&&l==i.LEFT?m?u=c._nextVisible(p):p.find(`.k-treeview-item-content`).first().hasClass(a)||c.expand(p):!g&&l==i.LEFT||g&&l==i.RIGHT?m&&!p.find(`.k-treeview-item-content`).first().hasClass(a)?c.collapse(p):(u=c.parent(p),c._enabled(u)||(u=t)):l==i.DOWN?u=c._nextVisible(p):l==i.UP&&!r.altKey?u=c._previousVisible(p):l==i.HOME?u=c._nextVisible(e()):l==i.END?u=c._previousVisible(e()):l==i.ENTER&&!p.find(`.k-treeview-item-content`).first().hasClass(a)?p.find(`.k-treeview-item-content`).first().hasClass(`k-selected`)||c._trigger(o,p)||c.select(p):l==i.SPACEBAR&&h.length&&!p.find(`.k-treeview-item-content`).first().hasClass(a)?(h.prop(s,!h.prop(s)).data(d,!1).prop(d,!1),c._checkboxChange({target:h}),u=p):r.altKey&&l===i.UP||l===i.ESC?c._closePopup():l===i.TAB&&(r.preventDefault(),c._closePopup()),u&&(r.preventDefault(),p[0]!=u[0]&&(c._trigger(f,u),c.current(u),c.scrollTo(u))))},_closePopup:function(){this.dropdowntree.close(),this.dropdowntree.wrapper.trigger(`focus`)},refresh:function(e){this.defaultrefresh(e),!this.dropdowntree.options.skipUpdateOnBind&&(e.action===`itemchange`?this.dropdowntree._isMultipleSelection()?e.field===`checked`&&this.dropdowntree._checkValue(e.items[0]):e.field!==`checked`&&e.field!==`expanded`&&e.items[0].selected&&this.dropdowntree._selectValue(e.items[0]):this.dropdowntree.refresh(e))}});n.ui._dropdowntree=g})(window.kendo.jQuery),kendo.jQuery;function f(e,t,n){return{value:e.selectable===`multiple`||e.checkboxes?t:t[0],success:function(e){n(e)}}}let p=kendo.jQuery,m=`k-loading`,h=`k-input-inner`,g=`aria-busy`;function _(){let e=this;e._loading=p(`<span></span>`).addClass(`k-icon k-i-loading k-input-loading-icon`).attr(`role`,`presentation`),e._showBusy=b.bind(e),e._hideBusy=x.bind(e),e._toggleLoader=v.bind(e),e._showBusyHandler=y.bind(e)}function v(e){let t=this,n=t.wrapper.hasClass(m),r=t.wrapper.find(`.k-input-values`),i=t.options.name.toLowerCase()===`multiselect`;if(t._loading)if(e&&!n)if(t.wrapper.addClass(m),t._suffixContainer){let e=t.wrapper.find(`.k-input-separator`);p(e[e.length-1]).before(t._loading)}else if(t._arrow)t._arrow.before(t._loading);else if(r.length>0&&i)t._loading.insertAfter(r);else{let e=t.element.hasClass(h)?t.element:t.wrapper.find(`.${h}`);t._loading.insertAfter(e)}else n&&(t.wrapper.removeClass(m),t._loading.remove())}function y(){let e=this;e._focused?e._focused.attr(g,!0):(e.element.hasClass(h)?e.element:e.wrapper.find(`.${h}`)).attr(g,!0),e._toggleLoader(!0),e._hideClear()}function b(e){let t=this;e&&e.isDefaultPrevented()||(t._request=!0,!t._busy&&(t._busy=setTimeout(t._showBusyHandler,100)))}function x(){let e=this;clearTimeout(e._busy),e._toggleLoader(!1),e._busy=null,e._request&&=!1,e._focused?e._focused.attr(g,!1):(e.element.hasClass(h)?e.element:e.wrapper.find(`.${h}`)).attr(g,!0),e._toggleCloseVisibility?e._toggleCloseVisibility():e._showClear()}let S={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`]};(function(e,t){var n=window.kendo,r=n.ui,i=n.html,a=n.htmlEncode,o=n.mediaQuery,s=r.Widget,c=r._dropdowntree,l=n.data.ObservableArray,u=n.data.ObservableObject,d=e.extend,p=n._activeElement,m=`.kendoDropDownTree`,h=n.keys,g=n.support,v=`k-hidden`,y=`width`,b=g.browser,x=n._outerWidth,S=`.`,C=`disabled`,w=`readonly`,T=`k-disabled`,E=`aria-disabled`,D=`k-hover`,O=`k-focus`,k=`mouseenter`+m+` mouseleave`+m,A=`tabindex`,j=`click`,M=`open`,N=`close`,P=`change`,F=/"/g,I=`.k-chip`;function L(t){if(Array.isArray(t)){var r=t.length,i=e.map(t,function(e){return function(t){return t[e]}});return function(e){var t=e._level;if(!(!t&&t!==0))return i[Math.min(t,r-1)](e)}}else return n.getter(t)}var R=n.ui.Widget.extend({init:function(t,r){var i=this;i.ns=m,n.ui.Widget.fn.init.call(i,t,r),i._selection=i._getSelection(),i._focusInputHandler=i._focusInput.bind(i),i._initial=i.element.val(),i._values=[];var a=this.options.value;if((a===null||!a.length)&&(this._noInitialValue=!0),this._isNullorUndefined(a)||(this._valueMethodCalled=!0,a=this._isArrayOfObjects(a)&&i.options.autoBind?a.map(e=>e[i.options.dataValueField]):a,this._values=Array.isArray(a)?a.slice(0):[a]),i.bigScreenMQL=o(`large`),i.smallScreenMQL=o(`small`),i.options.adaptiveMode==`auto`&&i.smallScreenMQL.onChange(function(){i.popup&&n.isFunction(i.popup.fullscreen)&&i.popup.fullscreen(i.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(A,this.wrapper.attr(A)),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(),i.options.adaptiveMode==`auto`&&i.bigScreenMQL.onChange(()=>{i.list=e(`<div class='k-list-container'/>`).append(i.tree),i._header.bind(i)(),i._noData.bind(i)(),i._footer.bind(i)(),i._reset.bind(i)(),i.popup&&=(i.popup.wrapper&&i.popup.wrapper.remove(),i.popup.destroy(),i.popup.element.remove(),null),i.treeview&&i.treeview.destroy(),i._popup.bind(i)(),i._filterHeader.bind(i)(),i._treeview.bind(i)(),i._renderFooter.bind(i)(),i._checkAll.bind(i)(),i._enable.bind(i)(),i._toggleCloseVisibility.bind(i)(),i._aria.bind(i)()}),this._clearButton(),this._filterHeader(),this._treeview(),this._renderFooter(),this._checkAll(),this._enable(),this._toggleCloseVisibility(),!this.options.autoBind){var s=r.text||``;this._isNullorUndefined(r.value)?s?this._textAccessor(s):r.placeholder&&this._placeholder(!0):this._preselect(r.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(),n.notify(this)},_bindLoader:function(){let e=this;e._initLoader=_.bind(e),e._initLoader()},_label:function(){var t=this,r=t.options,i=e.isPlainObject(r.label)?r.label:{content:r.label};t.label=new n.ui.Label(null,e.extend({},i,{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 n={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({},n,this.options.treeview),t.template&&(this.options.treeview.template=t.template),t.size&&(this.options.treeview.size=t.size)},_dataSource:function(){let t=this,r=t.options.dataSource;t._requestStartHandler=t._showBusy,t._requestEndHandler=t._hideBusy,t._errorHandler=function(){t._hideBusy()},t.dataSource=n.data.HierarchicalDataSource.create(r).bind(`progress`,t._requestStartHandler).bind(`error`,t._errorHandler).bind(`requestEnd`,t._requestEndHandler),r&&e.extend(t.options.treeview,{dataSource:t.dataSource})},_popupOpen:function(){var e=this.popup;e.wrapper=n.wrap(e.element)},_getSelection:function(){return this._isMultipleSelection()?(this.options._altname=`MultiSelectTree`,new r.DropDownTree.MultipleSelection(this)):new r.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=>typeof e==`object`).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.`,filterInputPlaceholder:`Filter`},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:t,fillMode:t,rounded:t,label:null,adaptiveTitle:null,adaptiveSubtitle:null},events:[`open`,`close`,`dataBound`,P,`select`,`filtering`],focus:function(){this.wrapper.trigger(`focus`)},dataItem:function(e){return this.treeview.dataItem(e)},readonly:function(e){this._editable({readonly:e===t?!0:e,disable:!1}),this._toggleCloseVisibility(),this.label&&this.label.floatingLabel&&this.label.floatingLabel.readonly(e===t?!0:e)},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t?!0:e)}),this._toggleCloseVisibility(),this.label&&this.label.floatingLabel&&this.label.floatingLabel.enable(e=e===t?!0: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=this.options,n;if(clearTimeout(this._typingTimeout),!t.enforceMinLength&&!e.length||e.length>=t.minLength){if(n=this._getFilter(e),this.trigger(`filtering`,{filter:n})||Array.isArray(this.options.dataTextField))return;this._filtering=!0,this.treeview.dataSource.filter(n)}},_mapValuesToId:function(e){let t=this;if(typeof t.dataSource.options.schema.model==`function`)throw Error(`The valueMapper needs dataSource.schema`);let n=t.dataSource.options.schema.model.id;return e.map(e=>e[n])},requireValueMapper:function(e,t){let n=this,r=t||e.value;if(r&&=r instanceof Array?r:[r],r&&e.loadOnDemand&&typeof e.loadOnDemand.valueMapper!=`function`)throw 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`);r.length&&n.options.loadOnDemand.valueMapper(f(n.options,r,n._useValueMapper.bind(n,r,0)))},_useValueMapper:function(t,n,r){let i=this,a=e.Deferred();i._deferred=a,i._handleValueMapperData(n,r),a.done(()=>{n++,n<t.length&&i._useValueMapper(t,n,r)})},_handleValueMapperData:function(e,t){let n=this,r=t[e]instanceof Array?t[e]:t;!r||!r.length||n._loadItem(r,0)},_loadItem:function(e,t){let n=this,r=n.dataSource.get(e[t]);r&&r.load().done(()=>{t++,t<e.length-1?n._loadItem(e,t):n._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`)),s.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||e===null)&&(e={}),e.label&&this._inputLabel?this.label.setOptions(e.label):e.label===!1?(this.label._unwrapFloating(),this._inputLabel.remove(),delete this._inputLabel):e.label&&this._label(),this._aria()},destroy:function(){n.ui.Widget.fn.destroy.call(this),this.treeview&&this.treeview.destroy(),this.popup.destroy(),this.wrapper.off(m),this._clear.off(m),this.filterInput&&this.filterInput.off(m),this.tagList&&this.tagList.off(m),this.bigScreenMQL&&this.bigScreenMQL.destroy(),this.smallScreenMQL&&this.smallScreenMQL.destroy(),n.unbind(this.tagList),this.options.checkAll&&this.checkAll&&this.checkAll.off(m),this._form&&this._form.off(`reset`,this._resetHandler),this.label&&this.label.destroy()},setValue:function(e){e=Array.isArray(e)||e instanceof l?e.slice(0):[e],this._values=e},items:function(){return this.treeview.items()},_useValueMapperWithValue:function(e){let t=this,n=e instanceof Array?e:[e];typeof n[0]==`object`&&(n=t._mapValuesToId(n)),t.requireValueMapper(this.options,n),t._deferred.done(()=>{t._selection._setValue(n)})},value:function(e){let t=this,n=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){n?n.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());return}else if(n&&n.valueMapper){t._useValueMapperWithValue(e);return}}return t._selection._setValue(e)},text:function(e){var n,r=this.options.ignoreCase;if(e=e===null?``:e,e!==t&&!this._isMultipleSelection()){if(typeof e!=`string`){this._textAccessor(e);return}n=r?e:e.toLowerCase(),this._selectItemByText(n),this._textAccessor(n),this._refreshFloatingLabel()}else return this._textAccessor()},_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=n.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,r=e(t.header),i=t.options.headerTemplate;if(n.destroy(r),r.remove(),!i){t.header=null;return}r=e((typeof i==`function`?i:n.template(i))({})),t.header=r[0]?r:null,t.list.prepend(r)},_noData:function(){var t=this,r=e(t.noData),i=t.options.noDataTemplate===!0?a(t.options.messages.noData):t.options.noDataTemplate;if(n.destroy(r),r.remove(),!i){t.noData=null;return}t.noData=e(`<div class="k-no-data"></div>`).hide().appendTo(t.list),t.noDataTemplate=typeof i==`function`?i:n.template(()=>i)},_renderNoData:function(){var e=this,t=e.noData;t&&t.html(e.noDataTemplate({instance:e}))},_footer:function(){var t=this,r=e(t.footer),i=t.options.footerTemplate;if(n.destroy(r),r.remove(),!i){t.footer=null;return}t.footer=e(`<div class="k-footer"></div>`).appendTo(t.list),t.footerTemplate=typeof i==`function`?i:n.template(i)},_renderFooter:function(){var e=this,t=e.footer;t&&t.html(e.footerTemplate({instance:e}))},_enable:function(){var e=this,n=e.options,r=e.element.is(`[disabled]`);n.enable!==t&&(n.enabled=n.enable),!n.enabled||r?e.enable(!1):e.readonly(e.element.is(`[readonly]`))},_adjustListWidth:function(){var e=this,t=e.list,n=t[0].style.width,r=e.wrapper,i,a;if(!(!t.data(y)&&n))return i=window.getComputedStyle?window.getComputedStyle(r[0],null):0,a=parseFloat(i&&i.width)||x(r),i&&b.msie&&(a+=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight)+parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth)),n=t.css(`box-sizing`)===`border-box`?a:a-(x(t)-t.width()),t.css({fontFamily:r.css(`font-family`),width:e.options.autoWidth?`auto`:n,minWidth:n,whiteSpace:e.options.autoWidth?`nowrap`:`normal`}).data(y,n),!0},_reset:function(){var t=this,n=t.element,r=n.attr(`form`),i=r?e(`#`+r):n.closest(`form`);i[0]&&(t._resetHandler=function(){setTimeout(function(){t.value(t._initial)})},t._form=i.on(`reset`,t._resetHandler))},_hasActionSheet:function(){return this.options.adaptiveMode===`auto`&&!this.bigScreenMQL.mediaQueryList.matches},_popup:function(){var t=this,i=this;t.options.checkboxes?(t.options.checkAll&&t.list.attr(`role`,`application`),t.list.addClass(`k-multiselecttree-popup`)):t.list.addClass(`k-dropdowntree-popup`),i.options.adaptiveMode==`auto`&&!i.bigScreenMQL.mediaQueryList.matches?(e(document.body).append(i.list),i.popup=new r.ActionSheet(i.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">${i.options.adaptiveTitle||(i.label?i.label.element.text():i.options.label||i.options.placeholder||`Select`)}</div>`+(i.options.adaptiveSubtitle?`<div class="k-actionsheet-subtitle k-text-center">${i.options.adaptiveSubtitle||``}</div>`:``)+`</div>`+(e.closeButton?`<div class="k-actionsheet-actions">`+n.html.renderButton(`<button tabindex="-1" ${n.attr(`ref-actionsheet-close-button`)}></button>`,{icon:`check`,fillMode:`flat`})+`</div>`:``)+`</div>`+(this._isFilterEnabled()?`<div class="k-actionsheet-titlebar-group k-actionsheet-filter"></div>`:``)+`</div>`,closeButton:!0,focusOnActivate:!1,fullscreen:i.smallScreenMQL.mediaQueryList.matches,popup:d({},i.options.popup,{anchor:i.wrapper,open:i._openHandler.bind(i),close:i._closeHandler.bind(i),animation:i.options.animation,isRtl:g.isRtl(i.wrapper),autosize:i.options.autoWidth}),deactivate:()=>{this._refreshFloatingLabel()},activate:()=>{this._refreshFloatingLabel()}})):(i.popup=new r.Popup(i.list,d({},i.options.popup,{anchor:i.wrapper,open:i._openHandler.bind(i),close:i._closeHandler.bind(i),animation:i.options.animation,isRtl:g.isRtl(i.wrapper),autosize:i.options.autoWidth,deactivate:()=>{this._refreshFloatingLabel()},activate:()=>{this._refreshFloatingLabel()}})),i.popup.one(`open`,i._popupOpen.bind(i)))},_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&&t!==0&&(t=e),t},_checkValue:function(t){var n=``,r=-1,i=this.value(),a=this.options.tagMode===`multiple`;if((t||t===0)&&(t.level&&(t._level=t.level()),n=this._currentValue(t),r=i.indexOf(n)),t.checked){if(e.grep(this._tags,function(e){return e.uid===t._tagUid}).length)return;var o=new u(t.toJSON());t._tagUid=o.uid,this._tags.push(o),this._tags.length===1&&(this.span.hide(),a||this._multipleTags.push(o)),r===-1&&(i.push(n),this.setValue(i))}else{var s=this._tags.find(function(e){return e.uid===t._tagUid}),c=this._tags.indexOf(s);if(c!==-1)this._tags.splice(c,1);else{this._treeViewCheckAllCheck(t);return}this._tags.length===0&&(this.span.show(),a||this._multipleTags.splice(0,1)),r!==-1&&(i.splice(r,1),this.setValue(i))}this._treeViewCheckAllCheck(t),!this._preventChangeTrigger&&!this._valueMethodCalled&&!this.dataSource._requestInProgress&&this.trigger(P),this.options.autoClose&&this.popup.visible()&&(this.close(),this.wrapper.trigger(`focus`)),this.popup.position(),this._toggleCloseVisibility(),this._updateSelectedOptions()},_updateSelectedOptions:function(){if(this.element[0].tagName.toLowerCase()===`select`){var e=this._tags,t=``,n=null,r=null;if(e.length)for(var i=0;i<e.length;i++)n=e[i],r=this._value(n),t+=this._option(r,this._text(n),!0);this.element.html(t)}},_option:function(e,r,i){var a=`<option`;return e!==t&&(e+=``,e.indexOf(`"`)!==-1&&(e=e.replace(F,`&quot;`)),a+=` value="`+e+`"`),i&&(a+=` selected`),a+=`>`,r!==t&&(a+=n.htmlEncode(r)),a+=`</option>`},_selectValue:function(e){var t=``,n=``;(e||e===0)&&(e.level&&(e._level=e.level()),n=this._text(e)||e,t=this._currentValue(e)),t===null&&(t=``),this.setValue(t),this._textAccessor(n,e),this._accessor(t),!this._preventChangeTrigger&&!this._valueMethodCalled&&this.trigger(P),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(P)},_clearText:function(){this.options.placeholder?this._placeholder(!0):this.span&&this.span.html(``)},_inputTemplate:function(){var e=this.options.valueTemplate;e=e?n.template(e):e=>a(this._text(e)),this.valueTemplate=e},_assignInstance:function(e,t){var n=this.options.dataTextField,r={};return n?(z(r,n.split(S),e),z(r,this.options.dataValueField.split(S),t),r=new u(r)):r=e,r},_textAccessor:function(n,r){var i=this.valueTemplate,a=this.span;if(n===t)return a.text();a.removeClass(`k-readonly`),!r&&(e.isPlainObject(n)||n instanceof u)&&(r=n),r||=this._assignInstance(n,this._accessor());try{a.html(i(r))}catch{a&&a.html(``)}},_accessors:function(){var e=this.element,t=this.options,r=e.attr(n.attr(`text-field`)),i=e.attr(n.attr(`value-field`));!t.dataTextField&&r&&(t.dataTextField=r),!t.dataValueField&&i&&(t.dataValueField=i),t.dataTextField=t.dataTextField||`text`,t.dataValueField=t.dataValueField||`value`,this._text=L(t.dataTextField),this._value=L(t.dataValueField)},_accessor:function(e,t){return this._accessorInput(e,t)},_accessorInput:function(e){var n=this.element[0];if(e===t)return n.value;e===null&&(e=``),n.value=e},_clearInput:function(){var e=this.element[0];e.value=``},_clearButton:function(){var t=a(this.options.messages.clear);this._clear||=e(`<span unselectable="on" class="k-clear-value" title="`+t+`">`+n.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(w),t=this.value()&&!this._isMultipleSelection()||this.value().length,n=this.element.val()&&this.element.val()!==this.options.placeholder;!e&&(t||n)?this._showClear():this._hideClear()},_showClear:function(){this._clear&&this._clear.removeClass(v)},_hideClear:function(){this._clear&&this._clear.addClass(v)},_openHandler:function(e){this._adjustListWidth(),this.trigger(M)?e.preventDefault():(this.wrapper.attr(`aria-expanded`,!0),this.tree.attr(`aria-hidden`,!1))},_closeHandler:function(e){this.trigger(N)?e.preventDefault():(this.wrapper.attr(`aria-expanded`,!1),this.tree.attr(`aria-hidden`,!0))},_treeview:function(){var e=this;e.options.adaptiveMode!=`auto`&&e.options.height&&e.tree.css(`max-height`,e.options.height),e.tree.attr(`id`,n.guid()),e.treeview=new c(e.tree,d({size:e.options.size},e.options.treeview),e),e.dataSource=e.treeview.dataSource,e.treeview.bind(`select`,function(t){e.trigger(`select`,t)}),e.treeview.bind(`expand`,function(){e.options.autoWidth&&e.popup&&e.popup.visible()&&setTimeout(function(){e.popup.position()},(e.treeview.options?.animation?.expand||{}).duration||0)}),e.treeview.bind(`collapse`,function(){e.options.autoWidth&&e.popup&&e.popup.visible()&&setTimeout(function(){e.popup.position()},(e.treeview.options?.animation?.collapse||{}).duration||0)})},_treeViewDataBound:function(e){if(e.node&&this._prev&&this._prev.length&&e.sender.expand(e.node),this._filtering){e.node||(this._filtering=!1),this._isMultipleSelection()||this._deselectItem(e);return}if(this.treeview||=e.sender,e.node){var t=e.sender.dataItem(e.node);if(t){var n=t.children.data();this._checkLoadedItems(n)}}else{var r=e.sender.dataSource.data();this._checkLoadedItems(r)}this.trigger(`dataBound`,e)},_deselectItem:function(e){var t=[];if(!e.node)t=e.sender.dataSource.data();else{var n=e.sender.dataItem(e.node);n&&(t=n.children.data())}for(var r=0;r<t.length;r++)t[r].selected&&!this._valueComparer(t[r],this.value())&&t[r].set(`selected`,!1)},_checkLoadedItems:function(e){var t=this.value();if(e)for(var n=0;n<e.length;n++)this._selection._checkLoadedItem(e[n],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" type="text" autocomplete="off">`+n.ui.icon({icon:`search`,iconClass:`k-input-icon`})+`</span></div>`;this.filterInput&&=(this.filterInput.off(m).parent().remove(),null),this._isFilterEnabled()&&(this._disableCheckChildren(),this.filterInput=e(`<input class="k-input-inner" type="text" />`).attr({placeholder:this.element.attr(`placeholder`)||this.options.messages.filterInputPlaceholder,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(){this.checkAll&&=(this.checkAll.find(`.k-checkbox-label, .k-checkbox`).off(m),this.checkAll.remove(),null),this._isMultipleSelection()&&this.options.checkAll&&(this.checkAll=e(`<div class="k-check-all">`+i.renderCheckBox(d({},this.options,{label:`Check All`}))+`</div>`).insertBefore(this.tree),this.checkAll.find(`.k-checkbox-label`).html(n.template(this.options.checkAllTemplate)({instance:this})),this.checkAll.find(`.k-checkbox`).on(`change`+m,this._changeCheckAll.bind(this)).on(`keydown`+m,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===h.UP||t===h.ESC||t===h.TAB){this.close(),this.wrapper.trigger(`focus`),e.preventDefault();return}t===h.UP&&(this.filterInput?this.filterInput.trigger(`focus`):this.wrapper.trigger(`focus`),e.preventDefault()),t===h.DOWN&&(this.tree&&this.tree.is(`:visible`)&&this.tree.trigger(`focus`),e.preventDefault()),t===h.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,n){for(var r=0;r<e.length&&this[t](e[r],n);r++)this._traverceChildren(e[r],t,n)},_uncheckItemByUid:function(e){this._dfs(this.dataSource.data(),`_uncheckItemEqualsUid`,e)},_uncheckItemEqualsUid:function(e,t){return e.enabled!==!1&&e._tagUid==t?(e.set(`checked`,!1),!1):!0},_selectItemByText:function(e){this._dfs(this.dataSource.data(),`_itemEqualsText`,e)},_itemEqualsText:function(e,t){return e.enabled!==!1&&this._text(e)===t?(this.treeview.select(this.treeview.findByUid(e.uid)),this._selectValue(e),!1):!0},_selectItemByValue:function(e){this._dfs(this.dataSource.data(),`_itemEqualsValue`,e)},_itemEqualsValue:function(e,t){return e.enabled!==!1&&this._valueComparer(e,t)?(this.treeview.select(this.treeview.findByUid(e.uid)),!1):!0},_checkItemByValue:function(e){for(var t=this.treeview.dataItems(),n=0;n<e.length;n++)this._dfs(t,`_checkItemEqualsValue`,e[n])},_checkItemEqualsValue:function(e,t){return e.enabled!==!1&&this._valueComparer(e,t)?(e.set(`checked`,!0),!1):!0},_valueComparer:function(e,t){var n=this._value(e),r;if(!this._isNullorUndefined(n)){if(this._isNullorUndefined(t))return!1;var i=this._value(t);return i?n==i:n==t}return r=this._text(e),r?this._text(t)?r==this._text(t):r==t:!1},_isNullorUndefined:function(e){return e===t||e===null},_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&&=e.checked,this._allItemsAreUnchecked&&=!e.checked,e.checked&&this._allCheckedItems.push(e),!0},_traverceChildren:function(e,t,n){var r=e[e._childrenOptions&&e._childrenOptions.schema?e._childrenOptions.schema.data:null]||e.items||e.children;r&&this._dfs(r,t,n)},_toggleCheckAllItems:function(e){this._dfs(this.dataSource.data(),`_checkAllCheckItem`,e)},_checkAllCheckItem:function(e,t){return e.enabled===!1?e.checked?this._disabledCheckedItems.push(e):this._disabledUnCheckedItems.push(e):e.set(`checked`,t),!0},_isFilterEnabled:function(){var e=this.options.filter;return e&&e!==`none`},_editable:function(t){var n=this,r=n.element,i=t.disable,a=t.readonly,o=n.wrapper.add(n.filterInput).off(m),s=n.wrapper.off(k);n._isMultipleSelection()&&n.tagList.off(j+m),!a&&!i?(r.prop(C,!1).prop(w,!1),s.removeClass(T).on(k,n._toggleHover),n._clear.on(`click`+m,n._clearClick.bind(n)),o.attr(A,o.data(A)).attr(E,!1).on(`keydown`+m,n._keydown.bind(n)).on(`focusin`+m,n._focusinHandler.bind(n)).on(`focusout`+m,n._focusoutHandler.bind(n)),n.wrapper.on(j+m,n._wrapperClick.bind(n)),this._isMultipleSelection()&&(n.tagList.on(j+m,`div.k-chip`,function(t){e(t.currentTarget).addClass(O)}),n.tagList.on(j+m,`.k-chip-remove-action .k-icon`,function(e){n._removeTagClick(e)}))):i?(o.removeAttr(A),s.addClass(T)):(o.attr(A,o.data(A)),s.removeClass(T),o.on(`focusin`+m,n._focusinHandler.bind(n)).on(`focusout`+m,n._focusoutHandler.bind(n))),r.attr(C,i).attr(w,a),o.attr(E,i)},_focusinHandler:function(){this.wrapper.addClass(O),this._prevent=!1},_focusoutHandler:function(){var e=this;this._isMultipleSelection()&&this.tagList.find(S+O).removeClass(O),e._prevent||(this.wrapper.removeClass(O),e._prevent=!0,e.element.trigger(`blur`))},_toggle:function(e){e=e===t?!this.popup.visible():e,this[e?M:N]()},_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(D,t.type===`mouseenter`)},_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&&b.version==11){var e=this.popup;e._toggleResize(!1),setTimeout(function(){e._toggleResize(!0)},50)}},_keydown:function(e){var t=e.keyCode,n=e.altKey,r,i,a,o,s=this.popup.visible();if(this.filterInput&&(r=this.filterInput[0]===p()),this.wrapper&&(i=this.wrapper[0]===p()),i){if(t===h.ESC){this._clearTextAndValue(),e.preventDefault();return}if(this._isMultipleSelection()){if(t===h.LEFT){this._focusPrevTag(),e.preventDefault();return}if(t===h.RIGHT){this._focusNextTag(),e.preventDefault();return}if(t===h.HOME){this._focusFirstTag(),e.preventDefault();return}if(t===h.END){this._focusLastTag(),e.preventDefault();return}if(t===h.DELETE){a=this.tagList.find(S+O).first(),a.length&&(o=this._tags[a.index()],this._removeTag(o)),e.preventDefault();return}if(t===h.BACKSPACE){a=this.tagList.find(S+O).first(),a.length?(o=this._tags[a.index()],this._removeTag(o)):(a=this._focusLastTag(),a.length&&(o=this._tags[a.index()],this._removeTag(o))),e.preventDefault();return}}}if(r&&(t===h.ESC&&this._clearFilter(),t===h.UP&&!n&&(this.wrapper.trigger(`focus`),e.preventDefault()),b.msie&&b.version<10&&(t===h.BACKSPACE||t===h.DELETE)&&this._search(),t===h.TAB)){this.close(),this.wrapper.trigger(`focus`),e.preventDefault();return}if(n&&t===h.UP||t===h.ESC){this.close(),this.wrapper.trigger(`focus`),e.preventDefault();return}if(t===h.ENTER&&this._typingTimeout&&this.filterInput&&s){e.preventDefault();return}t===h.SPACEBAR&&!r&&(this._toggle(!s),e.preventDefault()),n&&t===h.DOWN&&!s&&(this.open(),e.preventDefault()),t===h.DOWN&&s&&(this.filterInput&&!r?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()),t===h.TAB&&s&&(this.close(),this.wrapper.trigger(`focus`),e.preventDefault())},_focusPrevTag:function(){var e=this.tagList.find(S+O);if(e.length){var t=this._activeId;e.first().removeClass(O).removeAttr(`id`).prev(I).addClass(O).attr(`id`,t),this.wrapper.attr(`aria-activedescendant`,t)}else this._focusLastTag()},_focusNextTag:function(){var e=this.tagList.find(S+O);if(e.length){var t=this._activeId;e.first().removeClass(O).removeAttr(`id`).next(I).addClass(O).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(I).first().addClass(O).attr(`id`,e);return this.wrapper.attr(`aria-activedescendant`,e),t},_focusLastTag:function(){var e=this._activeId;this._clearDisabledTag();var t=this.tagList.children(I).last().addClass(O).attr(`id`,e);return this.wrapper.attr(`aria-activedescendant`,e),t},_clearDisabledTag:function(){this.tagList.find(S+O).removeClass(O).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 n=this._tags[e(t.currentTarget.closest(I)).index()];this._removeTag(n)},_removeTag:function(e){if(e){var t=e.uid;this._uncheckItemByUid(t)}}});function z(e,t,n){for(var r=0,i=t.length-1,a;r<i;++r)a=t[r],a in e||(e[a]={}),e=e[a];e[t[i]]=n}r.plugin(R),n.cssProperties.registerPrefix(`DropDownTree`,`k-picker-`),n.cssProperties.registerValues(`DropDownTree`,[{prop:`rounded`,values:n.cssProperties.roundedValues.concat([[`full`,`full`]])}]),n.cssProperties.registerPrefix(`MultiSelectTree`,`k-input-`),n.cssProperties.registerValues(`MultiSelectTree`,[{prop:`rounded`,values:n.cssProperties.roundedValues.concat([[`full`,`full`]])}]);var B=n.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=this._dropdowntree,t=e.element,n=t[0],r=t.parent();r.is(`span.k-dropdowntree`)||(r=t.wrap(`<span />`).parent(),r[0].style.cssText=n.style.cssText,r[0].title=n.title),e._focused=e.wrapper=r.addClass(`k-dropdowntree k-picker`).addClass(n.className).removeClass(`input-validation-error`).removeClass(`k-invalid`).css(`display`,``).attr({accesskey:t.attr(`accesskey`),unselectable:`on`}),t.hide().removeAttr(`accesskey`)},_span:function(){var e=this._dropdowntree,t=e.wrapper,n=`span.k-input-value-text`,r=t.find(n);r[0]||(t.append(`<span unselectable="on" class="k-input-inner"><span class="k-input-value-text"></span></span>`+i.renderButton(`<button unselectable="on" class="k-input-button" aria-label="select" tabindex="-1"></button>`,d({},e.options,{icon:`caret-alt-down`,shape:`none`}))).append(e.element),r=t.find(n)),e.span=r,e._arrow=t.find(`.k-input-button`),e._arrowIcon=e._arrow.find(`.k-icon,.k-svg-icon`)},_setValue:function(e){var n=this._dropdowntree,r;if(e===t||e===null)return r=n._values.slice()[0],e=typeof r==`object`?r:n._accessor()||r,e===t||e===null?``:e;if(n._valueMethodCalled=!0,e.length===0){n._clearTextAndValue(),n._valueMethodCalled=!1;return}n._selectItemByValue(e),n._toggleCloseVisibility(),n._refreshFloatingLabel()},_clearValue:function(){var e=this._dropdowntree,t=e.treeview.select(),n=e._values.length,r=!1;return e.treeview.dataItem(t)?(e.treeview.dataItem(t).set(`selected`,!1),r=!0):n>0&&(r=!0),!!(!e._valueMethodCalled&&r)},_checkLoadedItem:function(e,t){var n=this._dropdowntree;!n._isNullorUndefined(t)&&t!==``?n._valueComparer(e,t)?(n._preventChangeTrigger=!0,e.set(`selected`,!0),n._preventChangeTrigger=!1):e.selected&&n.treeview.select(n.treeview.findByUid(e.uid)):!t&&e.selected&&n.treeview.select(n.treeview.findByUid(e.uid))}}),V=n.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 l([]),t._multipleTags=new l([]),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,r){var i=this._dropdowntree,a=r||i.options.value;!Array.isArray(t)&&!(t instanceof n.data.ObservableArray)&&(t=[t]),(e.isPlainObject(t[0])||t[0]instanceof n.data.ObservableObject||!i.options.dataValueField)&&(i.dataSource.data(t),i.value(a))},_tagTemplate:function(){var t=this._dropdowntree,r=t.options,o=r.valueTemplate,s=r.tagMode===`multiple`,c=a(r.messages.singleTag);o=o?n.template(o):t.valueTemplate,t.valueTemplate=function(n){return i.renderChip(`<span class="`+(n.enabled===!1?`k-disabled`:``)+`"`+(n.enabled===!1?`aria-disabled="true"`:``)+`></span>`,e.extend({},r,{attr:{unselectable:`on`,"aria-keyshortcuts":`Enter Delete`,role:`option`},text:s?o(n):`<span unselectable="on" data-bind="text: tags.length"></span><span unselectable="on">&nbsp;`+c+`</span>`,removable:s,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,n=t.parent(`.k-multiselecttree`);n[0]||(n=t.wrap(`<span class="k-multiselecttree k-input" unselectable="on" />`).parent(),n[0].style.cssText=t[0].style.cssText,n[0].title=t[0].title),e.wrapper=n.addClass(t[0].className).css(`display`,``)},_tagList:function(){var t=this._dropdowntree,r=t.wrapper.children(`div.k-input-values`);if(!r[0]){var a=t.options.tagMode===`multiple`?`tags`:`multipleTag`;r=e(i.renderChipList(`<div unselectable="on" class="k-input-values k-selection-multiple" data-template="tagTemplate" data-bind="source: `+a+`" />`,e.extend({selectable:`none`},t.options))).appendTo(t.wrapper)}t.tagList=r,t.tagList.attr(`id`,n.guid()+`_tagList`),t.wrapper.attr(`aria-controls`,t.tagList.attr(`id`));var o=n.observable({multipleTag:t._multipleTags,tags:t._tags,tagTemplate:t.valueTemplate});n.bind(t.tagList,o),t.tagList.attr(`data-stop`,!0)},_refreshTagListAria:function(){var t=this;t.tagList&&i.renderChipList(t.tagList,e.extend({selectable:t.tagList.items().length===0?`none`:`multiple`},t.options))},_setValue:function(e){var n=this,r=this._dropdowntree,i=r._values;if(e===t||e===null)return r._values.slice();r.setValue(e),r._valueMethodCalled=!0,e.length?(this._removeValues(i,e),r._checkItemByValue(e)):r._clearTextAndValue(),r._valueMethodCalled=!1,r._toggleCloseVisibility(),n._refreshTagListAria(),r._refreshFloatingLabel()},_removeValues:function(e,t){for(var n=this._dropdowntree,r=this._getNewValues(e,t),i=0;i<r.length;i++)for(var a=0;a<n._tags.length;a++)n._valueComparer(n._tags[a],r[i])&&n._uncheckItemByUid(n._tags[a].uid)},_getNewValues:function(e,t){for(var n=[],r=0;r<e.length;r++)t.indexOf(e[r])===-1&&n.push(e[r]);return n},_clearValue:function(){for(var e=this._dropdowntree,t=e._tags.slice(),n=0;n<t.length;n++){var r=t[n].uid;e._preventChangeTrigger=!0,e._uncheckItemByUid(r)}return!!(t.length&&(e._preventChangeTrigger=!1,!e._valueMethodCalled))},_checkLoadedItem:function(e,t){var n=this._dropdowntree;if(n._noInitialValue&&e.checked){n._checkValue(e);return}(t.length||this._isDataSourceSet)&&(t.indexOf(n._currentValue(e))!==-1||t.indexOf(e))!==-1&&!this._findTag(n._currentValue(e))&&(e.checked?n._checkValue(e):(n._preventChangeTrigger=!0,e.set(`checked`,!0),n._preventChangeTrigger=!1))},_findTag:function(e){var t=this._dropdowntree;return t._tags.find(function(n){return t._valueComparer(n,e)})}});n.ui.DropDownTree.SingleSelection=B,n.ui.DropDownTree.MultipleSelection=V})(window.kendo.jQuery);var C=kendo;e.__meta__=S,e.default=C}); //# sourceMappingURL=kendo.dropdowntree.min.js.map