@mescius/wijmo.nav 5.20252.44 → 5.20261.45-nightly.d20260105.t014601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +2 -2
- package/index.d.ts +8 -8
- package/index.js +2 -2
- package/package.json +2 -2
package/es5-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260105.t014601
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)};import{Binding,isString,isArray,assert,EventArgs,asType,asEnum,_startDrag,CancelEventArgs,hasClass,removeClass,addClass,toggleClass,setAttribute,setChecked,enable,isFunction,asBoolean,removeChild,animate as coreAnimate,Control,asArray,asFunction,closest,closestClass,getActiveElement,contains,Key,Event,ObservableArray,NotifyCollectionChangedAction,ControlStateClsNames,ControlClsNames,UtilitesClsNames,createElement,Rect,setCss,asInt,animate,getElement,isBoolean,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.nav";export var AccordionClsNames={header:"wj-header",hostElement:"wj-accordion",showIcons:"wj-show-icons",activeContent:"wj-active-content"};export var TabPanelClsNames={hostElement:"wj-tabpanel",tabHeader:"wj-tabheader",tabHeaders:"wj-tabheaders",tabPane:"wj-tabpane",tabPanes:"wj-tabpanes",screenReaderOnly:"wj-sr-only"};export var TreeViewClsNames={dragFeedback:"wj-tv-drag-feedback",dragItemCount:"wj-tv-drag-ic",hostElement:"wj-treeview",largerDragItemCount:"wj-larger-drag-ic",marker:"wj-marker",lineMarker:"wj-line-marker",node:"wj-node",nodeCheck:"wj-node-check",nodeList:"wj-nodelist",nodeText:"wj-node-text"};var TabPanel=function(e){__extends(TabPanel,e);function TabPanel(t,i,n,r){var s=e.call(this,t,null,!0)||this;s._tabs=new ObservableArray;s._selectedIndex=-1;s._animated=!0;s._autoSwitch=!0;s._isInitialized=!1;s.selectedIndexChanged=new Event;var o=s.hostElement,a=[];if(!n)for(;o.firstElementChild;){var l=o.firstElementChild;o.removeChild(l);r||a.push(l)}var d=s.getTemplate();s.applyTemplate(ControlClsNames.hostElement+" "+TabPanelClsNames.hostElement+" "+UtilitesClsNames.animated,d,{_dRoot:"root",_dTabHeaders:"tabheaders",_dTabPanes:"tabpanes",_tabStatus:"tab-select-status"});o.tabIndex=-1;s._dRoot.tabIndex=s._dTabHeaders.tabIndex=s._dTabPanes.tabIndex=-1;i&&isBoolean(i.isAnimated)&&(s.isAnimated=i.isAnimated);s.addEventListener(o,"click",s._click.bind(s));s.addEventListener(o,"keydown",s._keydown.bind(s));s._tabs.collectionChanged.addHandler(s._populateControl.bind(s));s.tabs.deferUpdate((function(){a.forEach((function(e){assert(2==e.childElementCount,"TabPanel children should contain header and pane elements");s.tabs.push(new Tab(e.children[0],e.children[1]))}))}));s.initialize(i);if(s.selectedIndex<0&&s.tabs.length)s.selectedIndex=0;else{s._isInitialized=!0;s.onSelectedIndexChanged();delete s._isInitialized}return s}Object.defineProperty(TabPanel,"controlTemplate",{get:function(){TabPanel._ctrlTemplate||(TabPanel._ctrlTemplate='<div wj-part="root"><div wj-part="tabheaders" class="'+TabPanelClsNames.tabHeaders+'" role="tablist"></div><div wj-part="tabpanes" class="'+TabPanelClsNames.tabPanes+'"></div><div wj-part="tab-select-status" aria-live="polite" class="'+TabPanelClsNames.screenReaderOnly+'"></div></div>');return TabPanel._ctrlTemplate},set:function(e){TabPanel._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"tabs",{get:function(){return this._tabs},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(e){if((e=asInt(e,!1))!=this._selectedIndex){this._selectedIndex=e;this._updateContent();this.onSelectedIndexChanged();this.tabs[e]&&this.tabs[e].header&&(this._tabStatus.textContent=""+this.tabs[e].header.textContent)}else"Angular2"==this.workingAs&&this._updateContent()},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"selectedTab",{get:function(){var e=this._selectedIndex;return e>-1?this._tabs[e]:null},set:function(e){for(var t=-1,i=0;i<this._tabs.length&&t<0;i++)this._tabs[i]==e&&(t=i);this.selectedIndex=t},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e);toggleClass(this.hostElement,UtilitesClsNames.animated,this._animated)},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"autoSwitch",{get:function(){return this._autoSwitch},set:function(e){if(e!=this._autoSwitch){this._autoSwitch=asBoolean(e);this._updateContent()}},enumerable:!0,configurable:!0});TabPanel.prototype.getTab=function(e){for(var t=0;t<this._tabs.length;t++){if((i=this._tabs[t]).header.id==e||i.pane.id==e)return i}for(t=0;t<this._tabs.length;t++){var i;if((i=this._tabs[t]).header.textContent==e)return i}return null};TabPanel.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};TabPanel.prototype._populateControl=function(){var e=this;this._removeChildren(this._dTabHeaders);this._removeChildren(this._dTabPanes);var t=-1;this._tabs.forEach((function(i,n){assert(i instanceof Tab,"tabs array must contain Tab objects.");i._setPanel(e);var r=i.header;addClass(r,TabPanelClsNames.tabHeader);setAttribute(r,"role","tab");e._dTabHeaders.appendChild(r);var s=i.pane;addClass(s,TabPanelClsNames.tabPane);setAttribute(s,"role","tabpanel");setAttribute(s,"aria-labelledby",r.id?r.id:null);e._dTabPanes.appendChild(s);t<0&&(hasClass(r,ControlStateClsNames.active)||"true"==r.getAttribute("aria-selected"))&&(t=n)}));t<0&&this._tabs.length>0&&(t=0);t>-1?this.selectedIndex=t:this.selectedIndex>-1&&this.selectedIndex<this._tabs.length&&this._updateContent();this._validateSelection()};TabPanel.prototype._validateSelection=function(){var e=this.selectedTab;if(e&&(e.isDisabled||!e.isVisible)){var t=this._getNextIndex(this.selectedIndex,1);t<0&&(t=this._getNextIndex(this.selectedIndex,-1));this.selectedIndex=t}};TabPanel.prototype._updateContent=function(){var e=this,t=contains(this._dTabHeaders,getActiveElement()),i=this._dTabHeaders.children,n=this._dTabPanes.children,r=this._selectedIndex;if(r>-1&&r<n.length){var s=(d=n[r]).style;if(this.isAnimated){this._eAnim&&(this._eAnim.style.opacity="");this._toAnim&&clearInterval(this._toAnim);s.opacity="0";this._eAnim=d;this._toAnim=animate((function(t){if(1==t){e._eAnim=null;e._toAnim=null;s.opacity=""}else s.opacity=t.toString()}))}else s.opacity=""}for(var o=0;o<i.length;o++){var a=o==r,l=i[o];setAttribute(l,"aria-selected",a);toggleClass(l,ControlStateClsNames.active,a);var d=n[o];toggleClass(d,ControlStateClsNames.active,a);l.tabIndex=a||!this._autoSwitch?this._orgTabIndex:-1;if(a){t&&l.focus();this._szObserver||Control.invalidateAll(d)}}};TabPanel.prototype._removeChildren=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)};TabPanel.prototype._click=function(e){var t=this._getTabIndex(e.target);if(t>-1){var i=this._tabs[t];!i.isDisabled&&i.isVisible&&(this.selectedIndex=t)}};TabPanel.prototype._keydown=function(e){if(!e.defaultPrevented){var t=this._getTabIndex(getActiveElement());if(t>-1){var i=this._getKeyCode(e);switch(i){case Key.Left:case Key.Up:case Key.Right:case Key.Down:case Key.Home:case Key.PageUp:case Key.End:case Key.PageDown:switch(i){case Key.Left:case Key.Up:t=this._getNextIndex(t,-1);break;case Key.Right:case Key.Down:t=this._getNextIndex(t,1);break;case Key.Home:case Key.PageUp:t=this._getNextIndex(-1,1);break;case Key.End:case Key.PageDown:t=this._getNextIndex(this._tabs.length,-1)}t>-1&&(this._autoSwitch?this.selectedIndex=t:this._tabs[t].header.focus());e.preventDefault();break;case Key.Enter:case Key.Space:if(t>-1){this._tabs[t].header.click()}e.preventDefault()}}}};TabPanel.prototype._getTabIndex=function(e){var t=closest(e,"."+TabPanelClsNames.tabHeader);if(t&&closest(t,"."+TabPanelClsNames.hostElement)==this.hostElement)for(var i=0;i<this._tabs.length;i++)if(this._tabs[i].header==t)return i;return-1};TabPanel.prototype._getNextIndex=function(e,t){for(var i=e+t;i>-1&&i<this._tabs.length;i+=t){var n=this._tabs[i];if(!n.isDisabled&&n.isVisible)return i}return-1};TabPanel.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};TabPanel.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};TabPanel.prototype._updateTabIndex=function(){var e=this._dTabHeaders.children,t=this._selectedIndex;if(t>-1&&t<e.length){e[t].tabIndex=this.isDisabled?-1:this._orgTabIndex}this.hostElement.tabIndex=-1};TabPanel.prototype.dispose=function(){if(this._toAnim){clearInterval(this._toAnim);this._toAnim=null}this._tabs.collectionChanged.removeHandler(this._populateControl,this);this._tabs.forEach((function(e){e.dispose()}));this._tabs.clear();e.prototype.dispose.call(this)};TabPanel._ctrlTemplate="";return TabPanel}(Control);export{TabPanel};var Tab=function(){function Tab(e,t){this._hdr=asType(getElement(e),HTMLElement);this._pane=asType(getElement(t),HTMLElement)}Object.defineProperty(Tab.prototype,"tabPanel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"header",{get:function(){return this._hdr},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"pane",{get:function(){return this._pane},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"isDisabled",{get:function(){return hasClass(this._hdr,ControlStateClsNames.disabled)},set:function(e){toggleClass(this._hdr,ControlStateClsNames.disabled,asBoolean(e));this._p&&this._p._validateSelection()},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"isVisible",{get:function(){return"none"!=this._hdr.style.display},set:function(e){this._hdr.style.display=asBoolean(e)?"":"none";this._p&&this._p._validateSelection()},enumerable:!0,configurable:!0});Tab.prototype._setParts=function(e,t){e=asType(getElement(e),HTMLElement);t=asType(getElement(t),HTMLElement,!1);if(this._hdr!==e||this._pane!==t){var i=this.isDisabled,n=this.isVisible;this._hdr=e;this._pane=t;this.isDisabled=i;this.isVisible=n;var r=this.tabPanel;r&&!r.tabs.isUpdating&&r._populateControl()}};Tab.prototype._setPanel=function(e){this._p=e};Tab.prototype.dispose=function(){this._hdr=null;this._pane=null;this._p=null};return Tab}();export{Tab};var _CLS_ACTIVE=ControlStateClsNames.active,Accordion=function(e){__extends(Accordion,e);function Accordion(t,i,n){var r=e.call(this,t,null,!0)||this;r._panes=new ObservableArray;r._selectedIndex=-1;r._animated=!0;r._autoSwitch=!0;r._alCollapseAll=!1;r._alExpandMany=!1;r._autoSwitching=!1;r.selectedIndexChanged=new Event;var s=r.hostElement,o=r._panes,a=[];if(!n)for(;s.firstElementChild;){var l=s.firstElementChild;s.removeChild(l);a.push(l)}addClass(s,ControlClsNames.hostElement+" "+AccordionClsNames.hostElement+" "+AccordionClsNames.showIcons);s.tabIndex=-1;r.addEventListener(s,"click",r._click.bind(r));r.addEventListener(s,"keydown",r._keydown.bind(r));o.collectionChanged.addHandler(r._populateControl.bind(r));o.deferUpdate((function(){a.forEach((function(e){assert(2==e.childElementCount,"Accordion children should contain header and pane elements");o.push(new AccordionPane(e.children[0],e.children[1]))}))}));r.initialize(i);var d=i?i.selectedIndex:null;r.selectedIndex!=d&&r.selectedIndex<0&&o.length?r.selectedIndex=0:r.onSelectedIndexChanged();return r}Object.defineProperty(Accordion.prototype,"panes",{get:function(){return this._panes},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(e){if((e=asInt(e,!1))!=this._selectedIndex){this._selectedIndex=e;this._updateContent();this.onSelectedIndexChanged()}else this._updateContent()},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"selectedPane",{get:function(){var e=this._selectedIndex;return e>-1?this._panes[e]:null},set:function(e){this.selectedIndex=this._getIndexOfPane(e)},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"showIcons",{get:function(){return hasClass(this.hostElement,AccordionClsNames.showIcons)},set:function(e){toggleClass(this.hostElement,AccordionClsNames.showIcons,asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"autoSwitch",{get:function(){return this._autoSwitch},set:function(e){if(e!=this._autoSwitch){this._autoSwitch=asBoolean(e);this._updateContent()}},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"allowCollapseAll",{get:function(){return this._alCollapseAll},set:function(e){this._alCollapseAll=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"allowExpandMany",{get:function(){return this._alExpandMany},set:function(e){var t=this;if(e!=this._alExpandMany){this._alExpandMany=e=asBoolean(e);e||this.panes.forEach((function(e,i){var n=i==t.selectedIndex;toggleActiveClass(e.header,n);setAttribute(e.header,"aria-expanded",n)}))}},enumerable:!0,configurable:!0});Accordion.prototype.getPane=function(e){for(var t=0;t<this._panes.length;t++){if((i=this._panes[t]).header.id==e||i.content.id==e)return i}for(t=0;t<this._panes.length;t++){var i;if((i=this._panes[t]).header.textContent==e)return i}return null};Accordion.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};Accordion.prototype._populateControl=function(){var e=this,t=-1,i=this.hostElement;this._panes.forEach((function(n,r){assert(n instanceof AccordionPane,"panes array must contain AccordionPane objects.");n._setAccordion(e);var s=n.header;addClass(s,AccordionClsNames.header);setAttribute(s,"role","button");i.appendChild(s);var o=n.content;addClass(o,ControlClsNames.content);setAttribute(o,"role","region");setAttribute(o,"aria-labelledby",s.id?s.id:null);i.appendChild(o);t<0&&(hasClass(s,_CLS_ACTIVE)||"true"==s.getAttribute("aria-expanded"))&&(t=r)}));t>-1?this.selectedIndex=t:this.selectedIndex>-1&&this.selectedIndex<this._panes.length&&this._updateContent();this._validateSelection()};Accordion.prototype._validateSelection=function(){var e=this.selectedPane;if(e&&(e.isDisabled||!e.isVisible)){var t=this._getNextIndex(this.selectedIndex,1);t<0&&(t=this._getNextIndex(this.selectedIndex,-1));this.selectedIndex=t}};Accordion.prototype._updateContent=function(){var e=this,t=contains(this.hostElement,getActiveElement()),i=this._selectedIndex,n=this._panes,r=[];n.forEach((function(n,s){var o=n.header,a=s==i,l=hasClass(o,_CLS_ACTIVE),d=a||l&&e._alExpandMany&&n!=e._hidePane,h=d&&!l,c=l&&!d;e._animated&&(h||c)&&r.push({show:h,pane:n});setAttribute(o,"aria-expanded",d);e._animated||toggleActiveClass(o,d);if(a){t&&o.focus();e._szObserver||Control.invalidateAll(n.content)}}));this._updatePanesTabIndex();if(this._animated&&r.length){r.forEach((function(e){toggleActiveClass(e.pane.header,!0);e.height=e.pane.content.offsetHeight;e.show&&(e.pane.content.style.height="0")}));this._toAnim=animate((function(e){e<1?r.forEach((function(t){var i=t.height*(t.show?e:1-e);t.pane.content.style.height=i.toFixed(0)+"px"})):r.forEach((function(e){e.pane.content.style.height="";toggleActiveClass(e.pane.header,e.show)}))}))}this._hidePane=null};Accordion.prototype._updatePanesTabIndex=function(){var e=this;this._panes.forEach((function(t,i){t.header.tabIndex=e._selectedIndex!==i&&e._autoSwitch?-1:e._orgTabIndex}))};Accordion.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this._updatePanesTabIndex()};Accordion.prototype._click=function(e){var t=this._getPaneIndex(e.target);if(t>-1){var i=this._panes[t];if(!i.isDisabled&&i.isVisible){if(!hasClass(i.header,_CLS_ACTIVE)||this._autoSwitching)this.selectedIndex=t;else{var n=this._getNextActiveIndex(t);if(n>-1||this._alCollapseAll){this._hidePane=i;this.selectedIndex=n}}}}};Accordion.prototype._keydown=function(e){if(!e.defaultPrevented){var t=this._getPaneIndex(getActiveElement());if(t>-1){var i=this._getKeyCode(e);switch(i){case Key.Left:case Key.Up:case Key.Right:case Key.Down:case Key.Home:case Key.PageUp:case Key.End:case Key.PageDown:switch(i){case Key.Left:case Key.Up:t=this._getNextIndex(t,-1);break;case Key.Right:case Key.Down:t=this._getNextIndex(t,1);break;case Key.Home:case Key.PageUp:t=this._getNextIndex(-1,1);break;case Key.End:case Key.PageDown:t=this._getNextIndex(this._panes.length,-1)}if(t>-1){var n=this._panes[t];if(this._autoSwitch){this._autoSwitching=!0;n.header.click();this._autoSwitching=!1}else n.header.focus()}e.preventDefault();break;case Key.Enter:case Key.Space:if(t>-1){(n=this._panes[t]).header.click()}e.preventDefault()}}}};Accordion.prototype._getPaneIndex=function(e){var t=closest(e,"."+AccordionClsNames.header);if(t&&closest(t,"."+AccordionClsNames.hostElement)==this.hostElement)for(var i=0;i<this._panes.length;i++)if(this._panes[i].header==t)return i;return-1};Accordion.prototype._getNextIndex=function(e,t){for(var i=e+t;i>-1&&i<this._panes.length;i+=t){var n=this._panes[i];if(!n.isDisabled&&n.isVisible)return i}return-1};Accordion.prototype._getIndexOfPane=function(e){for(var t=-1,i=this._panes,n=0;n<i.length&&t<0;n++)i[n]==e&&(t=n);return t};Accordion.prototype._getNextActiveIndex=function(e){for(var t=-1,i=this.panes,n=1;n<i.length;n++){var r=(e+n)%i.length,s=i[r];if(hasClass(s.header,_CLS_ACTIVE)){t=r;break}}return t};Accordion.prototype._togglePane=function(e,t){if(e.isCollapsed!==t&&e.isVisible&&!e.isDisabled)if(t){if(this.allowCollapseAll||this.panes.filter((function(e){return!e.isCollapsed})).length>1){this._hidePane=e;var i=this._getIndexOfPane(e);this.selectedIndex=this._getNextActiveIndex(i)}}else this.selectedPane=e};Accordion.prototype.dispose=function(){if(this._animated&&this._toAnim){clearInterval(this._toAnim);this._toAnim=null}this._panes.collectionChanged.removeHandler(this._populateControl,this);this._panes.forEach((function(e){e.dispose()}));this._panes.clear();e.prototype.dispose.call(this)};return Accordion}(Control);export{Accordion};var AccordionPane=function(){function AccordionPane(e,t){this._hdr=asType(getElement(e),HTMLElement);this._content=asType(getElement(t),HTMLElement)}Object.defineProperty(AccordionPane.prototype,"accordion",{get:function(){return this._acc},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"header",{get:function(){return this._hdr},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"isDisabled",{get:function(){return hasClass(this._hdr,ControlStateClsNames.disabled)},set:function(e){toggleClass(this._hdr,ControlStateClsNames.disabled,asBoolean(e));this._acc&&this._acc._validateSelection()},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"isVisible",{get:function(){return"none"!=this._hdr.style.display},set:function(e){this._hdr.style.display=asBoolean(e)?"":"none";this._acc&&this._acc._validateSelection()},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"isCollapsed",{get:function(){return!hasClass(this._hdr,_CLS_ACTIVE)},set:function(e){var t=this._acc;t?t._togglePane(this,e):toggleActiveClass(this._hdr,!asBoolean(e))},enumerable:!0,configurable:!0});AccordionPane.prototype._setParts=function(e,t){e=asType(getElement(e),HTMLElement);t=asType(getElement(t),HTMLElement,!1);if(this._hdr!==e||this._content!==t){var i=this.isDisabled,n=this.isVisible;this._hdr=e;this._content=t;this.isDisabled=i;this.isVisible=n;var r=this.accordion;r&&!r.panes.isUpdating&&r._populateControl()}};AccordionPane.prototype._setAccordion=function(e){this._acc=e};AccordionPane.prototype.dispose=function(){this._hdr=null;this._content=null;this._acc=null};return AccordionPane}();export{AccordionPane};function toggleActiveClass(e,t){toggleClass(e,_CLS_ACTIVE,t);toggleClass(e.nextElementSibling,AccordionClsNames.activeContent,t)}var FormatNodeEventArgs=function(e){__extends(FormatNodeEventArgs,e);function FormatNodeEventArgs(t,i,n){var r=e.call(this)||this;r._data=t;r._e=asType(i,HTMLElement);r._level=n;return r}Object.defineProperty(FormatNodeEventArgs.prototype,"dataItem",{get:function(){return this._data},enumerable:!0,configurable:!0});Object.defineProperty(FormatNodeEventArgs.prototype,"element",{get:function(){return this._e},enumerable:!0,configurable:!0});Object.defineProperty(FormatNodeEventArgs.prototype,"level",{get:function(){return this._level},enumerable:!0,configurable:!0});return FormatNodeEventArgs}(EventArgs);export{FormatNodeEventArgs};var TreeNodeEventArgs=function(e){__extends(TreeNodeEventArgs,e);function TreeNodeEventArgs(t){var i=e.call(this)||this;i._node=t;return i}Object.defineProperty(TreeNodeEventArgs.prototype,"node",{get:function(){return this._node},enumerable:!0,configurable:!0});return TreeNodeEventArgs}(CancelEventArgs);export{TreeNodeEventArgs};var TreeNodeDragDropEventArgs=function(e){__extends(TreeNodeDragDropEventArgs,e);function TreeNodeDragDropEventArgs(t,i,n){var r=e.call(this)||this;r._src=asType(t,TreeNode);r._tgt=asType(i,TreeNode);r._pos=n;return r}Object.defineProperty(TreeNodeDragDropEventArgs.prototype,"dragSource",{get:function(){return this._src},enumerable:!0,configurable:!0});Object.defineProperty(TreeNodeDragDropEventArgs.prototype,"dropTarget",{get:function(){return this._tgt},enumerable:!0,configurable:!0});Object.defineProperty(TreeNodeDragDropEventArgs.prototype,"position",{get:function(){return this._pos},set:function(e){this._pos=asEnum(e,DropPosition)},enumerable:!0,configurable:!0});return TreeNodeDragDropEventArgs}(CancelEventArgs);export{TreeNodeDragDropEventArgs};export var DropPosition;!function(e){e[e.Before=0]="Before";e[e.After=1]="After";e[e.Into=2]="Into"}(DropPosition||(DropPosition={}));var TreeNode=function(){function TreeNode(e,t){if(hasClass(t,TreeViewClsNames.hostElement)){e=Control.getControl(t);t=null}else TreeNode._assertNode(t);if(t&&t[TreeNode.CacheKey]&&t[TreeNode.CacheKey]._t==e)return t[TreeNode.CacheKey];t&&(t[TreeNode.CacheKey]=this);this._t=e;this._e=t}Object.defineProperty(TreeNode.prototype,"dataItem",{get:function(){return this._e[TreeView._DATAITEM_KEY]},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"element",{get:function(){return this._e},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"treeView",{get:function(){return this._t},enumerable:!0,configurable:!0});TreeNode.prototype.ensureVisible=function(){var e=!!this.parentNode&&this.parentNode.isCollapsed;this.treeView._scrollNode=this;for(var t=this.parentNode;t;t=t.parentNode)t.isCollapsed=!1;this.treeView.isAnimated&&e||this._scrollIntoView()};TreeNode.prototype._scrollIntoView=function(){if(this.treeView._scrollNode){var e=this._t.hostElement,t=this.treeView._scrollNode.element.getBoundingClientRect(),i=e.getBoundingClientRect(),n=e.offsetHeight-e.clientHeight;t.bottom>i.bottom-n?e.scrollTop+=t.bottom-(i.bottom-n):t.top<i.top&&(e.scrollTop-=i.top-t.top);this.treeView._scrollNode=null}};TreeNode.prototype.equals=function(e){return null!=e&&e.element==this.element};Object.defineProperty(TreeNode.prototype,"isSelected",{get:function(){var e=this._t;return e.selectedNode==this||e.selectedNodes.includes(this)},enumerable:!0,configurable:!0});TreeNode.prototype.select=function(e){void 0===e&&(e=!1);var t=this._t,i=t._selNode;if(!this.equals(i)){if(i){removeClass(i.element,TreeView._CSEL);setAttribute(i.element,"aria-selected",!1)}t._selNode=this;addClass(this.element,TreeView._CSEL);setAttribute(this.element,"aria-selected",!0);this.ensureVisible();if(t.allowMultiSelect&&!t.selectedNodes.includes(this))t.selectedNodes.push(this);else if(!t.selectedNodes.includes(this)){t.selectedNodes.beginUpdate();t.selectedNodes.clear();t.selectedNodes.push(this);t.selectedNodes.endUpdate(!0)}t._updateFocus(i);e||t.onSelectedItemChanged()}};TreeNode.prototype.deSelect=function(e){void 0===e&&(e=!1);if(this.isSelected){var t=this._t;removeClass(this.element,TreeView._CSEL);setAttribute(this.element,"aria-selected",!1);t.selectedNodes.remove(this);t.selectedNode==this?e?t._selNode=null:t.selectedNode=null:e||t.onSelectedItemChanged()}};Object.defineProperty(TreeNode.prototype,"index",{get:function(){for(var e=0,t=this._pse(this.element);t;t=this._pse(t))TreeNode._isNode(t)&&e++;return e},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"parentNode",{get:function(){var e=null;if(this._e){var t=this._e.parentElement;TreeNode._assertNodeList(t);e=this._pse(t)}return e?new TreeNode(this._t,e):null},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"level",{get:function(){for(var e=-1,t=this;t;t=t.parentNode)e++;return e},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"hasChildren",{get:function(){return TreeNode._isNode(this._e)&&!TreeNode._isEmpty(this._e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"hasPendingChildren",{get:function(){return this.isCollapsed&&this.hasChildren&&!TreeNode._isNodeList(this.element.nextElementSibling)&&isFunction(this._t.lazyLoadFunction)},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"nodes",{get:function(){return this.hasChildren?TreeNode._getChildNodes(this._t,this._e.nextSibling):null},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"checkBox",{get:function(){return this._e.querySelector("input."+TreeView._CNDC)},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"isCollapsed",{get:function(){return this.hasChildren&&hasClass(this._e,TreeView._CCLD)},set:function(e){if(e!=this.isCollapsed){var t=this._t,i=new TreeNodeEventArgs(this);if(t.onIsCollapsedChanging(i)){this.setCollapsed(asBoolean(e),t.isAnimated,t.autoCollapse);t.onIsCollapsedChanged(i)}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"isChecked",{get:function(){var e=this.checkBox;return e&&!e.indeterminate?e.checked:null},set:function(e){if(e!=this.isChecked){var t=this._t,i=new TreeNodeEventArgs(this);if(t.onIsCheckedChanging(i)){this.setChecked(asBoolean(e),!0);t.onIsCheckedChanged(i)}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"isDisabled",{get:function(){return this._e&&null!=this._e.getAttribute("disabled")},set:function(e){if((e=asBoolean(e,!0))!=this.isDisabled){enable(this._e,!e);this.isDisabled&&this._t&&this._t.collapseWhenDisabled&&(this.isCollapsed=!0)}},enumerable:!0,configurable:!0});TreeNode.prototype.previous=function(e,t){var i=this._pse(this._e);!i&&TreeNode._isNodeList(this._e.parentElement)&&(i=this._pse(this._e.parentElement));if(TreeNode._isNodeList(i)){for(;TreeNode._isNodeList(i)&&i.childElementCount;)i=i.lastChild;TreeNode._isNodeList(i)&&(i=this._pse(i))}var n=TreeNode._isNode(i)?new TreeNode(this._t,i):null;e&&n&&!n.element.offsetHeight&&(n=n.previous(e,t));t&&n&&n.isDisabled&&(n=n.previous(e,t));return n};TreeNode.prototype.next=function(e,t){var i=this._e.nextSibling;TreeNode._isNodeList(i)&&(i=i.childElementCount?i.firstChild:i.nextSibling);if(!i)for(var n=this._e.parentElement;!i&&TreeNode._isNodeList(n);n=n.parentElement)i=n.nextSibling;var r=TreeNode._isNode(i)?new TreeNode(this._t,i):null;e&&r&&!r.element.offsetHeight&&(r=r.next(e,t));t&&r&&r.isDisabled&&(r=r.next(e,t));return r};TreeNode.prototype.previousSibling=function(){for(var e=this._pse(this.element);TreeNode._isNodeList(e);)e=this._pse(e);return e?new TreeNode(this._t,e):null};TreeNode.prototype.nextSibling=function(){var e=this.element.nextSibling;TreeNode._isNodeList(e)&&(e=e.nextSibling);return e?new TreeNode(this._t,e):null};TreeNode.prototype.setCollapsed=function(e,t,i){var n=this,r=this._t,s=this._e,o=this._e.nextElementSibling,a=TreeNode._isNodeList(o);setAttribute(s,"aria-expanded",a?(!e).toString():null);if(e!=this.isCollapsed)if(e||a||!isFunction(r.lazyLoadFunction)){null==t&&(t=r.isAnimated);null==i&&(i=r.autoCollapse);if(t){if(a){var l=o.offsetHeight,d=o.style,h=r.hostElement,c=h.style;h.scrollHeight<=h.clientHeight&&(c.overflowY="hidden");if(e){toggleClass(s,TreeView._CCLG,!0);coreAnimate((function(e){if(e<1){e=1-e;d.height=(e*l).toFixed(0)+"px"}else{d.height=d.opacity=c.overflowY="";toggleClass(s,TreeView._CCLD,!0);toggleClass(s,TreeView._CCLG,!1)}}),TreeView._AN_DLY)}else{toggleClass(s,TreeView._CCLD,!1);d.height=d.opacity="0";coreAnimate((function(e){d.height=e>=1?d.opacity=c.overflowY="":(e*l).toFixed(0)+"px"}),TreeView._AN_DLY,void 0,(function(){n._scrollIntoView()}))}}}else toggleClass(s,TreeView._CCLD,e);if(!e&&i){var u=s.parentElement;if(TreeNode._isNodeList(u))for(var p=0;p<u.children.length;p++){var _=u.children[p];if(_!=s&&TreeNode._isNode(_)){toggleClass(_,TreeView._CCLD,!0);_.setAttribute("aria-expanded","false")}}}this.element}else r._lazyLoadNode(this)};TreeNode.prototype.setChecked=function(e,t){var i=this.checkBox,n=i.checked!=e;setChecked(i,e);if(this.hasChildren)for(var r=0;r<this.nodes.length;r++)this.nodes[r].setChecked(e,!1);var s=this._t;s&&s.checkedMemberPath&&s._chkPath.setValue(this.dataItem,this.level,e);if(t){var o=this.parentNode;o&&o._updateCheckedState()}s&&n&&s._raiseCheckedItemsChanged()};TreeNode.prototype.remove=function(){var e=this._t,t=this.parentNode,i=this._getArray(),n=i.indexOf(this.dataItem);e.selectedNode==this&&(e.selectedNode=this.nextSibling()||this.previousSibling()||t);var r=this.element.nextSibling;TreeNode._isNodeList(r)&&removeChild(r);removeChild(this.element);t&&t._updateState();i.splice(n,1);this._t=null};TreeNode.prototype.addChildNode=function(e,t){var i=this._t._createNode(t),n=this.nodes;n?e<n.length?i.move(n[e],DropPosition.Before):i.move(n[n.length-1],DropPosition.After):i.move(this,DropPosition.Into);return i};TreeNode.prototype.refresh=function(e){var t=this._getArray();e&&(t[this.index]=e);e=t[this.index];var i=this._t._createNode(e),n=this.hasChildren&&!this.hasPendingChildren?this.element.nextSibling:null;n&&removeChild(n);(n=i.hasChildren&&!i.hasPendingChildren?i.element.nextSibling:null)&&this.element.parentElement.insertBefore(n,this.element.nextSibling);this.element.innerHTML=i.element.innerHTML;this._updateState()};TreeNode.prototype.move=function(e,t){if(e instanceof TreeNode&&this._contains(e))return!1;var i=this.parentNode,n=this._getArray();this._moveElements(e,t);e.treeView&&(this._t=e.treeView);i&&i._updateState();var r=this.parentNode;r&&r._updateState();var s=this.dataItem,o=n.indexOf(s),a=this._getArray();n.splice(o,1);a.splice(this.index,0,s);return!0};Object.defineProperty(TreeNode.prototype,"itemsSource",{get:function(){return this._getArray()},enumerable:!0,configurable:!0});TreeNode.prototype._pse=function(e){return e.previousElementSibling};TreeNode.prototype._contains=function(e){for(;e;e=e.parentNode)if(e.element==this.element)return!0;return!1};TreeNode.prototype._getArray=function(){var e=this._t,t=this.parentNode,i=e.itemsSource;if(t){var n=e._itmPath;if(!(i=n.getValue(t.dataItem,this.level))){i=[];n.setValue(t.dataItem,this.level,i)}}return i};TreeNode.prototype._moveElements=function(e,t){var i=document.createDocumentFragment(),n=this.hasChildren&&!this.hasPendingChildren?this.element.nextSibling:null;i.appendChild(this.element);if(n){TreeNode._assertNodeList(n);i.appendChild(n)}if(e instanceof TreeView)e._root.insertBefore(i,null);else{var r=e.element,s=r?r.parentElement:e.treeView._root;TreeNode._assertNodeList(s);var o=DropPosition;switch(t){case o.Before:s.insertBefore(i,r);break;case o.After:r=(e=e.nextSibling())?e.element:null;s.insertBefore(i,r);break;case o.Into:if(!e.hasChildren||e.hasPendingChildren){n=document.createElement("div");addClass(n,TreeView._CNDL);s.insertBefore(n,r.nextSibling)}s=e.element.nextSibling;TreeNode._assertNodeList(s);s.insertBefore(i,null)}}};TreeNode.prototype._updateState=function(){this._updateEmptyState();this._updateCheckedState()};TreeNode.prototype._updateEmptyState=function(){var e=this.element.nextSibling,t=!1;TreeNode._isNodeList(e)&&(e.childElementCount?t=!0:removeChild(e));toggleClass(this.element,TreeView._CEMP,!t);t||this.element.removeAttribute("aria-expanded")};TreeNode.prototype._updateCheckedState=function(){var e=this._t,t=this.checkBox,i=this.nodes,n=0,r=0,s=!1;if(t&&i){for(var o=0;o<i.length&&!s;o++){switch(i[o].isChecked){case!0:n++;break;case!1:r++;break;case null:s=!0}n&&r&&(s=!0)}setChecked(t,s?null:n>0);if(e&&e.checkedMemberPath){var a=s?null:t.checked;e._chkPath.setValue(this.dataItem,this.level,a)}}var l=this.parentNode;l&&l._updateCheckedState()};TreeNode.prototype.dispose=function(){delete this._e[TreeNode.CacheKey];this._t=null;var e=this._e.nextElementSibling;TreeNode._isNodeList(e)&&e.parentNode&&e.parentNode.removeChild(e);this.nodes&&this.nodes.forEach((function(e){e.dispose()}));this._e.innerHTML="";this._e=null};TreeNode._getChildNodes=function(e,t){var i=[];if(TreeNode._isNodeList(t))for(var n=t.children,r=0;r<n.length;r++){var s=n[r];TreeNode._isNode(s)&&i.push(new TreeNode(e,s))}return i};TreeNode._isNode=function(e){return e&&hasClass(e,TreeView._CND)};TreeNode._isNodeList=function(e){return e&&hasClass(e,TreeView._CNDL)};TreeNode._isEmpty=function(e){return TreeNode._isNode(e)&&hasClass(e,TreeView._CEMP)};TreeNode._isCollapsed=function(e){return TreeNode._isNode(e)&&!TreeNode._isEmpty(e)&&hasClass(e,TreeView._CCLD)};TreeNode._assertNode=function(e){assert(TreeNode._isNode(e),"node expected")};TreeNode._assertNodeList=function(e){assert(TreeNode._isNodeList(e),"nodeList expected")};TreeNode.CacheKey="$_WJ_TV_NODE";return TreeNode}();export{TreeNode};var _BindingArray=function(){function _BindingArray(e){this.path=e}Object.defineProperty(_BindingArray.prototype,"path",{get:function(){return this._path},set:function(e){this._path=e;if(isString(e))this._bindings=[new Binding(e)];else if(isArray(e)){this._bindings=[];for(var t=0;t<e.length;t++)this._bindings.push(new Binding(e[t]))}else null!=e&&assert(!1,"Path should be a string or an array of strings.");this._maxLevel=this._bindings?this._bindings.length-1:-1},enumerable:!0,configurable:!0});_BindingArray.prototype.getValue=function(e,t){var i=Math.min(t,this._maxLevel);return i>-1?this._bindings[i].getValue(e):null};_BindingArray.prototype.setValue=function(e,t,i){var n=Math.min(t,this._maxLevel);n>-1&&this._bindings[n].setValue(e,i)};return _BindingArray}();export{_BindingArray};var TreeView=function(e){__extends(TreeView,e);function TreeView(t,i){void 0===i&&(i={});var n=e.call(this,t)||this;n._selNodes=new ObservableArray;n._itmPath=new _BindingArray("items");n._chkPath=new _BindingArray;n._dspPath=new _BindingArray("header");n._imgPath=new _BindingArray;n._html=!1;n._animated=!0;n._chkOnClick=!1;n._collOnClick=!1;n._xpndOnClick=!0;n._xpndOnLoad=!0;n._autoColl=!0;n._showChk=!1;n._collapseWhenDisabled=!0;n._srch="";n._isReadOnly=!0;n._preserveSelNode=!1;n._allowMultiSelect=!1;n.itemsSourceChanged=new Event;n.loadingItems=new Event;n.loadedItems=new Event;n.itemClicked=new Event;n.selectedItemChanged=new Event;n.checkedItemsChanged=new Event;n.isCollapsedChanging=new Event;n.isCollapsedChanged=new Event;n.isCheckedChanging=new Event;n.isCheckedChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n.dragStart=new Event;n.dragOver=new Event;n.drop=new Event;n.dragEnd=new Event;n.nodeEditStarting=new Event;n.nodeEditStarted=new Event;n.nodeEditEnding=new Event;n.nodeEditEnded=new Event;n.options=i;var r=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+TreeViewClsNames.hostElement,r,{_root:"root"});var s=n.hostElement;setAttribute(s,"role","tree",!0);addClass(n._root,TreeView._CNDL);setAttribute(n._root,"role","group",!0);n.addEventListener(s,"mousedown",n._mousedown.bind(n));n.addEventListener(s,"click",n._click.bind(n));n.addEventListener(s,"keydown",n._keydown.bind(n));n.addEventListener(s,"keypress",n._keypress.bind(n));n.addEventListener(s,"wheel",(function(e){s.scrollHeight>s.offsetHeight&&(e.deltaY<0&&0==s.scrollTop||e.deltaY>0&&s.scrollTop+s.offsetHeight>=s.scrollHeight)&&e.preventDefault()}));n.addEventListener(s,"blur",(function(){n._edtNode&&!contains(n._edtNode.element,getActiveElement())&&n.finishEditing()}),!0);n.addEventListener(s,"paste",(function(e){if(n._edtNode&&!n.isContentHtml){var t=(e.clipboardData||window.clipboardData).getData("text"),i=window.getSelection();if(t&&i.rangeCount){i.deleteFromDocument();i.getRangeAt(0).insertNode(document.createTextNode(t));e.preventDefault()}}}));n._selNodes.collectionChanged.addHandler((function(e,t){switch(t.action){case NotifyCollectionChangedAction.Add:addClass(t.item.element,TreeView._CMSEL);break;case NotifyCollectionChangedAction.Remove:removeClass(t.item.element,TreeView._CMSEL);break;case NotifyCollectionChangedAction.Change:addClass(t.item.element,TreeView._CMSEL);break;case NotifyCollectionChangedAction.Reset:n.hostElement.querySelectorAll("."+TreeView._CMSEL).forEach((function(e){return removeClass(e,TreeView._CMSEL)}))}}));n.initialize(i);n.refresh();return n}Object.defineProperty(TreeView,"controlTemplate",{get:function(){TreeView._ctrlTemplate||(TreeView._ctrlTemplate='<div wj-part="root"></div>');return TreeView._ctrlTemplate},set:function(e){TreeView._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"itemsSource",{get:function(){return this._items},set:function(e){if(this._items!=e){this._items=asArray(e);this.onItemsSourceChanged();this._srcChanged=!0;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"childItemsPath",{get:function(){return this._itmPath.path},set:function(e){if(e!=this.childItemsPath){this._itmPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"displayMemberPath",{get:function(){return this._dspPath.path},set:function(e){if(e!=this.displayMemberPath){this._dspPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"imageMemberPath",{get:function(){return this._imgPath.path},set:function(e){if(e!=this.imageMemberPath){this._imgPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"checkedMemberPath",{get:function(){return this._chkPath.path},set:function(e){if(e!=this.checkedMemberPath){this._chkPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"isContentHtml",{get:function(){return this._html},set:function(e){if(e!=this._html){this._html=asBoolean(e);this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"showCheckboxes",{get:function(){return this._showChk},set:function(e){if(e!=this._showChk){this._showChk=asBoolean(e);this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"autoCollapse",{get:function(){return this._autoColl},set:function(e){this._autoColl=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"collapseWhenDisabled",{get:function(){return this._collapseWhenDisabled},set:function(e){this._collapseWhenDisabled=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e);toggleClass(this.hostElement,UtilitesClsNames.animated,this._animated)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(e){this._isReadOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});TreeView.prototype.startEditing=function(e){this._prevDragState=this.allowDragging;if(this.isReadOnly)return!1;e||(e=this.selectedNode);if(!e||e.isDisabled)return!1;if(!this.finishEditing())return!1;var t=e.element.querySelector("."+TreeView._CNDT);if(!t)return!1;var i=new TreeNodeEventArgs(e);if(!this.onNodeEditStarting(i))return!1;t.tabIndex=0;t.focus();t.contentEditable="true";t.style.cursor="auto";var n=document.createRange();n.selectNodeContents(t);var r=getSelection();r.removeAllRanges();r.addRange(n);this.allowDragging=!this.isTxtSelected(t);t.focus();setAttribute(t,"autocomplete","off");setAttribute(t,"autocorrect","off");this._edtNode=e;this.onNodeEditStarted(i);return!0};TreeView.prototype.finishEditing=function(e){var t=this._edtNode;if(t){var i=t.element.querySelector("."+TreeView._CNDT);if(!i)return!1;var n=new TreeNodeEventArgs(t);if(!this.onNodeEditEnding(n))return!1;var r=t.dataItem,s=t.level;this.isContentHtml?e?i.innerHTML=this._dspPath.getValue(r,s):this._dspPath.setValue(r,s,i.innerHTML):e?i.textContent=this._dspPath.getValue(r,s):this._dspPath.setValue(r,s,i.textContent);document.createRange().selectNodeContents(i);getSelection().removeAllRanges();i.contentEditable="false";i.style.cursor="";this.allowDragging=this._prevDragState;this._edtNode=null;this.onNodeEditEnded(n)}return!0};Object.defineProperty(TreeView.prototype,"allowDragging",{get:function(){return null!=this._dd},set:function(e){if(e!=this.allowDragging){if(asBoolean(e))this._dd=new _TreeDragDropManager(this);else{this._dd.dispose();this._dd=null}for(var t=this.hostElement.querySelectorAll("."+TreeView._CND),i=0;i<t.length;i++){var n=t[i];setAttribute(n,"draggable",!!this._dd||null)}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"checkOnClick",{get:function(){return this._chkOnClick},set:function(e){this._chkOnClick=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"expandOnClick",{get:function(){return this._xpndOnClick},set:function(e){this._xpndOnClick=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"collapseOnClick",{get:function(){return this._collOnClick},set:function(e){this._collOnClick=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"expandOnLoad",{get:function(){return this._xpndOnLoad},set:function(e){this._xpndOnLoad=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedItem",{get:function(){return this._selNode?this._selNode.dataItem:null},set:function(e){if(e!=this.selectedItem){this._isDirty&&this.refresh();this.selectedNode=e?this.getNode(e):null}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedNode",{get:function(){return this._selNode},set:function(e){if(e!=this.selectedNode){this._prevSel=this._selNode;if(e)e.select();else if(this._selNode){var t=this._selNode.element;removeClass(t,TreeView._CSEL);setAttribute(t,"aria-selected",!1);this._selNode=null;this._updateFocus(this._prevSel);this.onSelectedItemChanged()}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedPath",{get:function(){for(var e=[],t=this.selectedNode;t;t=t.parentNode){var i=this._dspPath.getValue(t.dataItem,t.level);e.splice(0,0,i)}return e},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"checkedItems",{get:function(){if(null==this._chkItems){var e=TreeView,t="."+e._CND+"."+e._CEMP+" > input:checked."+e._CNDC,i=this._root.querySelectorAll(t);this._chkItems=[];for(var n=0;n<i.length;n++){var r=i[n].parentElement[e._DATAITEM_KEY];this._chkItems.push(r)}}return this._chkItems},set:function(e){if(this.showCheckboxes){this._isDirty&&this.refresh();for(var t=TreeView,i="."+t._CND+"."+t._CEMP,n=this._root.querySelectorAll(i),r=0;r<n.length;r++){var s=new TreeNode(this,n[r]),o=e.indexOf(s.dataItem)>-1;s.isChecked!=o&&(s.isChecked=o)}}},enumerable:!0,configurable:!0});TreeView.prototype.checkAllItems=function(e){if(this.showCheckboxes)for(var t=TreeView,i="."+t._CND+"."+t._CEMP,n=this._root.querySelectorAll(i),r=0;r<n.length;r++){var s=new TreeNode(this,n[r]);s.isChecked!=e&&(s.isChecked=e)}};Object.defineProperty(TreeView.prototype,"totalItemCount",{get:function(){return this.hostElement.querySelectorAll("."+TreeView._CND).length},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"lazyLoadFunction",{get:function(){return this._lazyLoad},set:function(e){if(e!=this._lazyLoad){this._lazyLoad=asFunction(e);this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"preserveSelectedNode",{get:function(){return this._preserveSelNode},set:function(e){this._preserveSelNode=asBoolean(e,!1)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedNodes",{get:function(){return this._selNodes},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"allowMultiSelect",{get:function(){return this._allowMultiSelect},set:function(e){this._allowMultiSelect=asBoolean(e,!1);this._allowMultiSelect&&this.selectedNodes.forEach((function(e){return addClass(e.element,TreeView._CMSEL)}))},enumerable:!0,configurable:!0});TreeView.prototype.getFirstNode=function(e,t){var i=this.hostElement.querySelector("."+TreeView._CND),n=i?new TreeNode(this,i):null;e&&n&&!n.element.offsetHeight&&(n=n.next(e,t));t&&n&&n.isDisabled&&(n=n.next(e,t));return n};TreeView.prototype.getLastNode=function(e,t){var i=this.hostElement.querySelectorAll("."+TreeView._CND+":last-child"),n=i.length?new TreeNode(this,i[i.length-1]):null;e&&n&&!n.element.offsetHeight&&(n=n.previous(e,t));t&&n&&n.isDisabled&&(n=n.previous(e,t));return n};Object.defineProperty(TreeView.prototype,"nodes",{get:function(){return TreeNode._getChildNodes(this,this._root)},enumerable:!0,configurable:!0});TreeView.prototype.getNode=function(e){this._isDirty&&this._loadTree();for(var t=this.hostElement.querySelectorAll("."+TreeView._CND),i=0;i<t.length;i++){var n=t[i];if(n[TreeView._DATAITEM_KEY]==e)return new TreeNode(this,n)}return null};TreeView.prototype.addChildNode=function(e,t){var i=this._createNode(t),n=this.nodes;n?e<n.length?i.move(n[e],DropPosition.Before):i.move(n[n.length-1],DropPosition.After):i.move(this,DropPosition.Into);return i};TreeView.prototype.collapseToLevel=function(e){var t=this._animated,i=this._autoColl;this._animated=this._autoColl=!1;this._collapseToLevel(this.nodes,e,0);this._animated=t;this._autoColl=i};TreeView.prototype.loadTree=function(e){this._loadTree(e)};TreeView.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)};TreeView.prototype.onLoadingItems=function(e){this.loadingItems.raise(this,e);return!e.cancel};TreeView.prototype.onLoadedItems=function(e){this.loadedItems.raise(this,e)};TreeView.prototype.onItemClicked=function(e){this.itemClicked.raise(this,e)};TreeView.prototype.onSelectedItemChanged=function(e){this.selectedItemChanged.raise(this,e)};TreeView.prototype.onCheckedItemsChanged=function(e){this._chkItems=null;this.checkedItemsChanged.raise(this,e)};TreeView.prototype.onIsCollapsedChanging=function(e){this.isCollapsedChanging.raise(this,e);return!e.cancel};TreeView.prototype.onIsCollapsedChanged=function(e){this.isCollapsedChanged.raise(this,e)};TreeView.prototype.onIsCheckedChanging=function(e){this.isCheckedChanging.raise(this,e);return!e.cancel};TreeView.prototype.onIsCheckedChanged=function(e){this.isCheckedChanged.raise(this,e)};TreeView.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};TreeView.prototype.onDragStart=function(e){this.dragStart.raise(this,e);return!e.cancel};TreeView.prototype.onDragOver=function(e){this.dragOver.raise(this,e);return!e.cancel};TreeView.prototype.onDrop=function(e){this.drop.raise(this,e);return!e.cancel};TreeView.prototype.onDragEnd=function(e){this.dragEnd.raise(this,e)};TreeView.prototype.onNodeEditStarting=function(e){this.nodeEditStarting.raise(this,e);return!e.cancel};TreeView.prototype.onNodeEditStarted=function(e){this.nodeEditStarted.raise(this,e)};TreeView.prototype.onNodeEditEnding=function(e){this.nodeEditEnding.raise(this,e);return!e.cancel};TreeView.prototype.onNodeEditEnded=function(e){this.nodeEditEnded.raise(this,e)};TreeView.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.isUpdating||!this._isDirty||this.disposed||this._loadTree(!0)};TreeView.prototype._updateFocus=function(e){this._updateTabIndex();if(this.containsFocus()){var t=this._selNode;t?t.element.focus():this.hostElement.focus()}e&&(e.element.tabIndex=-1)};TreeView.prototype._updateTabIndex=function(){var e=this._selNode;e&&(e.element.tabIndex=this._orgTabIndex);this.hostElement.tabIndex=e||this.isDisabled?-1:this._orgTabIndex};TreeView.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._updateTabIndex()};TreeView.prototype._raiseCheckedItemsChanged=function(){var e=this;this._toItemsChanged&&clearTimeout(this._toItemsChanged);this._toItemsChanged=setTimeout((function(){e._toItemsChanged=null;e.onCheckedItemsChanged()}),10)};TreeView.prototype._reload=function(){this._isDirty=!0;this.invalidate()};TreeView.prototype._createNode=function(e){var t=__assign({},this.options);this.formatItem&&(t.formatItem=this.formatItem.getHandler());return new TreeView(document.createElement("div"),__assign({},t,{expandOnLoad:this.expandOnLoad,allowDragging:this.allowDragging,lazyLoadFunction:this.lazyLoadFunction,childItemsPath:this.childItemsPath,displayMemberPath:this.displayMemberPath,imageMemberPath:this.imageMemberPath,isContentHtml:this.isContentHtml,showCheckboxes:this.showCheckboxes,itemsSource:[e]})).getFirstNode()};TreeView.prototype._getCollapseIconWidthBounds=function(e){var t=getComputedStyle(e,":before"),i=parseFloat(getComputedStyle(e).paddingLeft),n=0,r=0;if("auto"!==t.width)if("none"==t.transform){n=i;r=parseFloat(t.width)+i}else{var s=parseFloat(t.height),o=(parseFloat(t.width)-s)/2;n=i+o;r=parseFloat(t.height)+i+o}else;if(this.rightToLeft){var a=r-n;n=(r=e.clientWidth-n)-a}return{left:n,right:r}};TreeView.prototype._mousedown=function(e){if(!e.defaultPrevented){var t=closestClass(e.target,TreeView._CND),i=t?new TreeNode(this,t):null;if(i&&!i.isDisabled){var n=this._getCollapseIconWidthBounds(t),r=t==e.target&&e.offsetX>=n.left&&e.offsetX<=n.right;if(!this.preserveSelectedNode||!r)if((e.ctrlKey||e.metaKey)&&this.allowMultiSelect)i.isSelected?i.deSelect():i.select();else if(e.shiftKey&&this.allowMultiSelect){var s=this.selectedNode;s||(s=this._prevSel);if(s){for(var o=this._getNodesBetween(i.element,s.element),a=new Set(this.selectedNodes),l=o.length-1;l>=0;l--){var d=new TreeNode(this,o[l]);a.has(d)?a.delete(d):d.select(!0)}var h=s.equals(this.selectedNode)&&a.size>0;Array.from(a).forEach((function(e){return e.deSelect(!0)}));s.select();h&&this.onSelectedItemChanged()}}else{i.isSelected?this._prevSel=i:this._clearMultiSelectedNodes();this.selectedNode=i;i.select()}}}};TreeView.prototype._getNodesBetween=function(e,t){var i=e,n=t;if(this._getOffsetFromRoot(i)>this._getOffsetFromRoot(t)){i=t;n=e}for(var r=[],s=this.hostElement.querySelectorAll("."+TreeView._CND),o=!1,a=s.length-1;a>=0;a--){var l=s[a];l==n&&(o=!0);o&&r.unshift(l);if(l==i)break}return r};TreeView.prototype._getOffsetFromRoot=function(e){for(var t=0;e!=this.hostElement;){t+=e.offsetTop;e=e.parentElement}return t};TreeView.prototype._checkCollapseIconClick=function(e){var t=this;if(!e.defaultPrevented){var i=closestClass(e.target,TreeView._CND),n=i?new TreeNode(this,i):null;if(n&&!n.isDisabled){var r=this._getCollapseIconWidthBounds(i),s=i==e.target&&e.offsetX>=r.left&&e.offsetX<=r.right;if(this.preserveSelectedNode&&s){(e.ctrlKey||e.metaKey)&&!n.hasPendingChildren?this.collapseToLevel(n.isCollapsed?n.level+1:n.level):n.isCollapsed=!n.isCollapsed;this.isAnimated?this._setFocusTimer=setTimeout((function(){t.focus()}),TreeView._AN_DLY+Control._ANIM_DEF_STEP):this.focus();e.preventDefault()}}}};TreeView.prototype._click=function(e){this._checkCollapseIconClick(e);if(!e.defaultPrevented){var t=closestClass(e.target,TreeView._CND);if(t){var i=new TreeNode(this,t),n="input."+TreeView._CNDC,r=closest(e.target,n),s=t.getBoundingClientRect(),o=this.rightToLeft?s.right-e.clientX:e.clientX-s.left;if(i.isDisabled)return;if(!r&&i.equals(this._edtNode))return;!r&&this._chkOnClick&&(!i.hasChildren||o>t.offsetHeight)&&(r=t.querySelector(n));var a=this._prevSel,l=(e.shiftKey||e.ctrlKey||e.metaKey)&&this.allowMultiSelect;if(!l){this.selectedNode=i;this._clearMultiSelectedNodes(!0)}t.focus();if(r){e.preventDefault();e.stopPropagation();this._updateCheckedTimer=setTimeout((function(){i.isChecked=!i.isChecked}))}if(!r){var d=(e.ctrlKey||e.metaKey)&&!i.hasPendingChildren,h=i.isCollapsed,c=!1;if(i.hasChildren)if(o<=t.offsetHeight){c=!0;d?this.collapseToLevel(h?i.level+1:i.level):i.isCollapsed=!h}else if(this.expandOnClick&&h){c=!0;d?this.collapseToLevel(i.level+1):i.isCollapsed=!1}else if(this.collapseOnClick&&!h){c=!0;d?this.collapseToLevel(i.level):i.isCollapsed=!0}c&&d&&this.selectedNode&&this.selectedNode.ensureVisible();if(!c&&!this.isReadOnly&&!l){var u=this.selectedNode;u&&u.equals(a)&&this.startEditing()}}this.selectedItem&&this.onItemClicked()}}};TreeView.prototype._keydown=function(e){if(!e.defaultPrevented){var t=this._getKeyCode(e),i=this._selNode,n=void 0,r=!0;if(!i)switch(t){case Key.Up:case Key.Down:case Key.Left:case Key.Right:case Key.Enter:case Key.Home:case Key.End:if(n=this.getFirstNode(!0,!0)){this.selectedNode=n;e.preventDefault();return}}if(i&&!i.isDisabled){switch(t){case Key.F2:this.startEditing();e.preventDefault();break;case Key.Escape:this.finishEditing(!0);e.preventDefault();break;case Key.Up:case Key.Down:this.finishEditing();break;case Key.Enter:if(this._edtNode){this.finishEditing();t=Key.Down}else{this.startEditing();e.preventDefault()}}if(this._edtNode)return;if(this.rightToLeft)switch(t){case Key.Left:t=Key.Right;break;case Key.Right:t=Key.Left}switch(t){case Key.Left:!i.isCollapsed&&i.hasChildren?i.isCollapsed=!0:(i=i.parentNode)&&i.select();break;case Key.Right:i.isCollapsed&&i.hasChildren&&(i.isCollapsed=!1);break;case Key.Up:n=i.previous(!0,!0);break;case Key.Down:n=i.next(!0,!0);break;case Key.Home:n=this.getFirstNode(!0,!0);break;case Key.End:n=this.getLastNode(!0,!0);break;case Key.Space:if(this.selectedItem){var s=i.checkBox;s&&(i.isChecked=s.indeterminate||!s.checked)}break;case Key.Enter:this.selectedItem&&this.onItemClicked();break;default:r=!1}if(r){e.preventDefault();e.shiftKey?n&&n.isSelected&&i.deSelect(!0):this._clearMultiSelectedNodes(!n);n&&n.select()}}}};TreeView.prototype._keypress=function(e){var t=this;if(!e.defaultPrevented){if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.target instanceof HTMLInputElement)return;if(this._edtNode)return;if(e.charCode>32&&this.startEditing(this.selectedNode)){var i=getActiveElement();if(contains(this._edtNode.element,i)){i.textContent=String.fromCharCode(e.charCode);e.preventDefault();var n=document.createRange();n.selectNodeContents(i);n.collapse(!1);var r=getSelection();r.removeAllRanges();r.addRange(n)}return}if(e.charCode>32||32==e.charCode&&this._srch){e.preventDefault();this._srch+=String.fromCharCode(e.charCode).toLowerCase();this._toSrch&&clearTimeout(this._toSrch);this._toSrch=setTimeout((function(){t._toSrch=null;t._srch=""}),TreeView._AS_DLY);var s=this._findNext();if(null==s&&this._srch.length>1){this._srch=this._srch[this._srch.length-1];s=this._findNext()}null!=s&&(this.selectedItem=s)}}};TreeView.prototype._findNext=function(){if(this.hostElement&&this.selectedItem){var e=this.getNode(this.selectedItem),t=e,i=!1,n=!1;1==this._srch.length&&(n=!0);for(;t;){if(!t.isDisabled&&!n){if(0==t.element.textContent.trim().toLowerCase().indexOf(this._srch))return t.dataItem}var r=t.next(!0,!0);if(r==e&&i)break;if(!r&&!i){r=this.getFirstNode(!0,!0);i=!0}t=r;n=!1}}return null};TreeView.prototype._loadTree=function(e){var t=this,i=this._root;if(i){if(!this.onLoadingItems(new CancelEventArgs))return;var n=this.containsFocus(),r=this._srcChanged;this._isDirty=!1;this._srcChanged=!1;var s=this.selectedItem;this.selectedItem=null;var o=[];if(this.allowMultiSelect){this.selectedNodes.forEach((function(e){return o.push(e.dataItem)}));this.selectedNodes.beginUpdate();this.selectedNodes.clear();this.selectedNodes.endUpdate(!0)}this._chkItems=null;this._ldLvl=-1;var a=void 0;if(e&&isFunction(window.Map)&&!r&&this.nodes.length>0){a=new Map;for(var l=this.hostElement.querySelectorAll("."+TreeView._CND),d=0;d<l.length;d++){var h=l[d];hasClass(h,TreeView._CCLD)&&a.set(h[TreeView._DATAITEM_KEY],!0)}}i.innerHTML="";this._items&&this._items.forEach((function(e){t._addItem(i,0,e)}));if(a)for(l=this.hostElement.querySelectorAll("."+TreeView._CND),d=0;d<l.length;d++){h=l[d];var c=TreeNode._isNodeList(h.nextElementSibling),u=!TreeNode._isEmpty(h),p=a.get(h[TreeView._DATAITEM_KEY]);u&&(p||c)&&toggleClass(h,TreeView._CCLD,1==p);setAttribute(h,"aria-expanded",u?(!hasClass(h,TreeView._CCLD)).toString():null)}n&&!this.containsFocus()&&this.focus();this.allowMultiSelect&&o.forEach((function(e){var i=t.getNode(e);i&&i.select(!0)}));this.selectedItem=s;this.onLoadedItems();this._ldLvl=-1;this._srcChanged=!1}};TreeView.prototype._addItem=function(e,t,i){var n,r=this._dspPath.getValue(i,t),s=this._imgPath.getValue(i,t),o=asArray(this._itmPath.getValue(i,t),!0),a=document.createElement("div");addClass(a,TreeView._CND);a.tabIndex=-1;setAttribute(a,"role","treeitem",!0);setAttribute(a,"aria-selected",!1);var l=document.createElement("span");this.isContentHtml?l.innerHTML=r:l.textContent=r;addClass(l,TreeView._CNDT);a.appendChild(l);if(s){var d=document.createElement("img");d.src=s;a.insertBefore(d,a.firstChild)}if(this._showChk&&!this._lazyLoad){(n=document.createElement("input")).type="checkbox";n.tabIndex=-1;addClass(n,TreeView._CNDC);a.insertBefore(n,a.firstChild)}this._dd&&a.setAttribute("draggable","true");e.appendChild(a);a[TreeView._DATAITEM_KEY]=i;o&&0==o.length&&!this.lazyLoadFunction&&(o=null);if(o){var h=this.expandOnLoad;if(t>this._ldLvl&&h){this._ldLvl=t;if(0==o.length){h=!1;addClass(a,TreeView._CCLD)}}else{h=!1;addClass(a,TreeView._CCLD);t<this._ldLvl&&(this._ldLvl=100)}if(o.length>0){var c=document.createElement("div");c.tabIndex=-1;addClass(c,TreeView._CNDL);for(var u=0;u<o.length;u++)this._addItem(c,t+1,o[u]);e.appendChild(c);setAttribute(c,"role","group",!0)}setAttribute(a,"aria-expanded",h.toString(),!0)}else addClass(a,TreeView._CEMP);if(n&&this.checkedMemberPath)if(o&&o.length){new TreeNode(this,a)._updateCheckedState()}else n.checked=this._chkPath.getValue(i,t);this.formatItem.hasHandlers&&this.onFormatItem(new FormatNodeEventArgs(i,a,t))};TreeView.prototype._collapseToLevel=function(e,t,i){for(var n=0;n<e.length;n++){var r=e[n];if(!r.hasPendingChildren){r.isCollapsed=i>=t;r.hasChildren&&this._collapseToLevel(r.nodes,t,i+1)}}};TreeView.prototype._lazyLoadNode=function(e){var t=this.hostElement;if(!hasClass(t,TreeView._CLDG)){addClass(t,TreeView._CLDG);addClass(e.element,TreeView._CLDG);this.lazyLoadFunction(e,this._lazyLoadCallback.bind(e))}};TreeView.prototype._lazyLoadCallback=function(e){this.treeView._lazyLoadNodeDone(this,e)};TreeView.prototype._lazyLoadNodeDone=function(e,t){var i=TreeView;removeClass(e.element,i._CLDG);removeClass(this.hostElement,i._CLDG);var n=e.dataItem,r=e.level,s=asArray(t,!0);if(null==s||0==s.length){this._itmPath.setValue(n,r,null);addClass(e.element,i._CEMP);removeClass(e.element,i._CCLD)}else if(s.length){this._itmPath.setValue(n,r,s);var o=document.createElement("div"),a=e.element;addClass(o,i._CNDL);a.parentElement.insertBefore(o,a.nextSibling);for(var l=0;l<s.length;l++)this._addItem(o,r+1,s[l]);e.isCollapsed=!1}};TreeView.prototype.isTxtSelected=function(e){var t=window.getSelection();return t.anchorNode===e&&t.toString().length>0};TreeView.prototype._clearMultiSelectedNodes=function(e){void 0===e&&(e=!1);for(var t=this._selNodes.length-1;t>=0;t--)e&&this._selNodes[t]==this.selectedNode||this._selNodes[t].deSelect(!0)};TreeView.prototype.dispose=function(){if(this._toSrch){clearTimeout(this._toSrch);this._toSrch=null}if(this._toItemsChanged){clearTimeout(this._toItemsChanged);this._toItemsChanged=null}if(this._updateCheckedTimer){clearTimeout(this._updateCheckedTimer);this._updateCheckedTimer=null}if(this._setFocusTimer){clearTimeout(this._setFocusTimer);this._setFocusTimer=null}if(this._dd){this._dd.dispose();this._dd=null}this._prevSel=null;if(this._edtNode){var t=this._edtNode.element.querySelector("."+TreeView._CNDT);t&&delete t.contentEditable;this._edtNode=null}this._chkItems=null;this._lazyLoad=null;this._items=null;this.options=null;this._itmPath=null;this._chkPath=null;this._dspPath=null;this._imgPath=null;if(this._selNodes&&this._selNodes.length>0){this._selNodes.forEach((function(e){e.dispose()}));this._selNodes=null}this.nodes&&this.nodes.length>0&&this.nodes.forEach((function(e){e.dispose()}));this.formatItem&&this.formatItem.hasHandlers&&this.formatItem.removeAllHandlers();this._selNodes&&this._selNodes.collectionChanged&&this._selNodes.collectionChanged.removeAllHandlers();var i=this.hostElement;if(i){i.querySelectorAll("."+TreeView._CND).forEach((function(e){e[TreeView._DATAITEM_KEY]&&delete e[TreeView._DATAITEM_KEY];e[TreeNode.CacheKey]&&delete e[TreeNode.CacheKey]}));i.querySelectorAll("."+TreeView._CLDG).forEach((function(e){removeClass(e,TreeView._CLDG)}))}if(this._root){this._root.innerHTML="";this._root=null}this._srch="";e.prototype.dispose.call(this)};TreeView._DATAITEM_KEY="wj-Data-Item";TreeView._AS_DLY=600;TreeView._AN_DLY=200;TreeView._CND=TreeViewClsNames.node;TreeView._CNDL=TreeViewClsNames.nodeList;TreeView._CEMP=ControlStateClsNames.empty;TreeView._CNDT=TreeViewClsNames.nodeText;TreeView._CNDC=TreeViewClsNames.nodeCheck;TreeView._CSEL=ControlStateClsNames.selected;TreeView._CMSEL=ControlStateClsNames.multiSelected;TreeView._CCLD=ControlStateClsNames.collapsed;TreeView._CCLG=ControlStateClsNames.collapsing;TreeView._CLDG=ControlStateClsNames.loading;TreeView._ctrlTemplate="";return TreeView}(Control);export{TreeView};var _TreeDragDropManager=function(){function _TreeDragDropManager(e){this._tree=asType(e,TreeView);this._dragstartBnd=this._dragstart.bind(this);this._dragoverBnd=this._dragover.bind(this);this._dropBnd=this._drop.bind(this);this._dragendBnd=this._dragend.bind(this);_TreeDragDropManager._activeTreeCount++;var t=this._tree,i=t.hostElement;t.addEventListener(i,"dragstart",this._dragstartBnd);t.addEventListener(i,"dragover",this._dragoverBnd);t.addEventListener(i,"dragleave",this._dragoverBnd);t.addEventListener(i,"drop",this._dropBnd);t.addEventListener(i,"dragend",this._dragendBnd);t.addEventListener(i,"keydown",this._keydown)}_TreeDragDropManager.prototype.dispose=function(){_TreeDragDropManager._activeTreeCount--;if(0===_TreeDragDropManager._activeTreeCount){removeChild(_TreeDragDropManager._dMarker);_TreeDragDropManager._markerInstance=null;if(_TreeDragDropManager._drgSrc){_TreeDragDropManager._drgSrc.dispose();_TreeDragDropManager._drgSrc=null}}};_TreeDragDropManager.prototype._dragstart=function(e){if(!e.defaultPrevented){var t=this._tree,i=closestClass(e.target,TreeView._CND),n=_TreeDragDropManager;n._drgSrc=TreeNode._isNode(i)?new TreeNode(t,i):null;if(n._drgSrc){var r=new TreeNodeEventArgs(n._drgSrc);t.onDragStart(r)||(n._drgSrc=null)}if(n._drgSrc&&e.dataTransfer){_startDrag(e.dataTransfer,"copyMove");e.stopPropagation()}else e.preventDefault()}};_TreeDragDropManager.prototype._removeDragFeedback=function(){document.body.querySelectorAll("."+_TreeDragDropManager.CLS_DRAG_FEEDBACK).forEach((function(e){return e.remove()}))};_TreeDragDropManager.prototype._dragover=function(e){this._handleDragDrop(e,!1)};_TreeDragDropManager.prototype._drop=function(e){this._handleDragDrop(e,!0)};_TreeDragDropManager.prototype._dragend=function(e){_TreeDragDropManager._drgSrc=null;this._showDragMarker();this._removeDragFeedback();this._tree.onDragEnd()};_TreeDragDropManager.prototype._keydown=function(e){e.defaultPrevented||e.keyCode==Key.Escape&&this._dragendBnd(null)};Object.defineProperty(_TreeDragDropManager,"_dMarker",{get:function(){this._markerInstance||(this._markerInstance="undefined"!=typeof window?createElement('<div class="'+TreeViewClsNames.marker+'"> </div>'):null);return this._markerInstance},enumerable:!0,configurable:!0});_TreeDragDropManager.prototype._handleDragDrop=function(e,t){var i,n,r=this._tree,s=_TreeDragDropManager,o=DropPosition,a=o.Into;if(!e.defaultPrevented&&s._drgSrc){var l=document.elementFromPoint(e.clientX,e.clientY),d=closestClass(l,TreeView._CND);if(null==d){var h=Control.getControl(closest(l,"."+TreeViewClsNames.hostElement));h instanceof TreeView&&0==h.totalItemCount&&(d=h.hostElement)}d==s._drgSrc.element&&(d=null);if(d&&r.allowMultiSelect&&TreeNode._isNode(d)&&r.hostElement.contains(s._drgSrc.element)){var c=new TreeNode(r,d);if(c.isSelected)d=null;else for(var u=r.selectedNodes.length-1;u>=0;u--){var p=r.selectedNodes[u];if(p.hasChildren&&p._contains(c)){d=null;break}}}if(d){n=d.getBoundingClientRect();var _=new TreeNode(r,d),f=_.hasPendingChildren?n.height/2:n.height/3;if(null==_.element){(n=Rect.fromBoundingRect(n)).inflate(-12,-12);a=o.Before}else if(e.clientY<n.top+f)a=o.Before;else if(e.clientY>n.bottom-f||_.hasPendingChildren){a=o.After;if(_.hasChildren&&!_.isCollapsed&&!_.hasPendingChildren){a=o.Before;n=(d=(_=_.next(!0,!1)).element).getBoundingClientRect()}}if(s._drgSrc._contains(_))d=null;else{(i=new TreeNodeDragDropEventArgs(s._drgSrc,_,a)).cancel=s._drgSrc.treeView!=_.treeView;r.onDragOver(i)||(d=null)}}if(d)if((a=i.position)==o.Before){var g=i.dragSource.next(!0,!1);g&&g.element==d&&(d=null)}else if(a==o.After){var m=i.dragSource.previous(!0,!1);m&&m.element==d&&(d=null)}if(d&&!t){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation();this._showDragMarker(n,a)}else this._showDragMarker();if(d&&t&&r.onDrop(i)){r.hostElement.focus();if(r.allowMultiSelect){var C=this._getTopLevelSelectedNodes(),b=i.dragSource.treeView,T=i.dropTarget.treeView;i.position==DropPosition.After&&C.reverse();C.forEach((function(e){return e.move(i.dropTarget,i.position)}));if(b!=T){b.selectedNodes.clear();b.selectedNode=null;C.forEach((function(e){return e.select()}))}}else{var v=i.dragSource;v.move(i.dropTarget,i.position);v.ensureVisible();v.select()}}}};_TreeDragDropManager.prototype._getTopLevelSelectedNodes=function(){var e=_TreeDragDropManager._drgSrc.treeView,t=[];e.hostElement.querySelectorAll("."+TreeView._CMSEL+" , ."+TreeView._CSEL).forEach((function(i){var n=new TreeNode(e,i);(function(e,t){if(!t)return!1;for(var i=0;i<t.length;i++)if(t[i]._contains(e))return!0;return!1})(n,t)||t.push(n)}));return t};_TreeDragDropManager.prototype._showDragMarker=function(e,t){var i=this._tree,n=_TreeDragDropManager._dMarker.parentElement;if(e){var r=i.hostElement.getBoundingClientRect(),s=t==DropPosition.After?e.bottom:e.top,o={top:Math.round(s-r.top+i.hostElement.scrollTop-2),width:"75%",height:t==DropPosition.Into?e.height:0,opacity:t==DropPosition.Into?"0.15":""};toggleClass(_TreeDragDropManager._dMarker,TreeViewClsNames.lineMarker,t!==DropPosition.Into);i.rightToLeft?o.right=Math.round(r.right-e.right):o.left=Math.round(e.left-r.left);setCss(_TreeDragDropManager._dMarker,o);n!=i._root&&i._root.appendChild(_TreeDragDropManager._dMarker)}else n&&n.removeChild(_TreeDragDropManager._dMarker)};_TreeDragDropManager.CLS_DRAG_FEEDBACK=TreeViewClsNames.dragFeedback;_TreeDragDropManager.CLS_DRAG_ITEMCOUNT=TreeViewClsNames.dragItemCount;_TreeDragDropManager.CLS_DRAG_ITEMCOUNT_LARGE=TreeViewClsNames.largerDragItemCount;_TreeDragDropManager._activeTreeCount=0;return _TreeDragDropManager}();export{_TreeDragDropManager};_registerModule("wijmo.nav",selfModule);
|
|
14
|
+
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)};import{Binding,isString,isArray,assert,EventArgs,asType,asEnum,CancelEventArgs,hasClass,removeClass,addClass,toggleClass,setAttribute,setChecked,enable,isFunction,asBoolean,removeChild,animate as coreAnimate,Control,asArray,asFunction,closest,closestClass,getActiveElement,contains,Key,Event,ObservableArray,NotifyCollectionChangedAction,ControlStateClsNames,ControlClsNames,UtilitesClsNames,createElement,_startDrag,Rect,setCss,asInt,animate,getElement,isBoolean,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.nav";export var AccordionClsNames={header:"wj-header",hostElement:"wj-accordion",showIcons:"wj-show-icons",activeContent:"wj-active-content"};export var TabPanelClsNames={hostElement:"wj-tabpanel",tabHeader:"wj-tabheader",tabHeaders:"wj-tabheaders",tabPane:"wj-tabpane",tabPanes:"wj-tabpanes",screenReaderOnly:"wj-sr-only"};export var TreeViewClsNames={dragFeedback:"wj-tv-drag-feedback",dragItemCount:"wj-tv-drag-ic",hostElement:"wj-treeview",largerDragItemCount:"wj-larger-drag-ic",marker:"wj-marker",lineMarker:"wj-line-marker",node:"wj-node",nodeCheck:"wj-node-check",nodeList:"wj-nodelist",nodeText:"wj-node-text"};var TabPanel=function(e){__extends(TabPanel,e);function TabPanel(t,i,n,r){var s=e.call(this,t,null,!0)||this;s._tabs=new ObservableArray;s._selectedIndex=-1;s._animated=!0;s._autoSwitch=!0;s._isInitialized=!1;s.selectedIndexChanged=new Event;var o=s.hostElement,a=[];if(!n)for(;o.firstElementChild;){var l=o.firstElementChild;o.removeChild(l);r||a.push(l)}var d=s.getTemplate();s.applyTemplate(ControlClsNames.hostElement+" "+TabPanelClsNames.hostElement+" "+UtilitesClsNames.animated,d,{_dRoot:"root",_dTabHeaders:"tabheaders",_dTabPanes:"tabpanes",_tabStatus:"tab-select-status"});o.tabIndex=-1;s._dRoot.tabIndex=s._dTabHeaders.tabIndex=s._dTabPanes.tabIndex=-1;i&&isBoolean(i.isAnimated)&&(s.isAnimated=i.isAnimated);s.addEventListener(o,"click",s._click.bind(s));s.addEventListener(o,"keydown",s._keydown.bind(s));s._tabs.collectionChanged.addHandler(s._populateControl.bind(s));s.tabs.deferUpdate((function(){a.forEach((function(e){assert(2==e.childElementCount,"TabPanel children should contain header and pane elements");s.tabs.push(new Tab(e.children[0],e.children[1]))}))}));s.initialize(i);if(s.selectedIndex<0&&s.tabs.length)s.selectedIndex=0;else{s._isInitialized=!0;s.onSelectedIndexChanged();delete s._isInitialized}return s}Object.defineProperty(TabPanel,"controlTemplate",{get:function(){TabPanel._ctrlTemplate||(TabPanel._ctrlTemplate='<div wj-part="root"><div wj-part="tabheaders" class="'+TabPanelClsNames.tabHeaders+'" role="tablist"></div><div wj-part="tabpanes" class="'+TabPanelClsNames.tabPanes+'"></div><div wj-part="tab-select-status" aria-live="polite" class="'+TabPanelClsNames.screenReaderOnly+'"></div></div>');return TabPanel._ctrlTemplate},set:function(e){TabPanel._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"tabs",{get:function(){return this._tabs},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(e){if((e=asInt(e,!1))!=this._selectedIndex){this._selectedIndex=e;this._updateContent();this.onSelectedIndexChanged();this.tabs[e]&&this.tabs[e].header&&(this._tabStatus.textContent=""+this.tabs[e].header.textContent)}else"Angular2"==this.workingAs&&this._updateContent()},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"selectedTab",{get:function(){var e=this._selectedIndex;return e>-1?this._tabs[e]:null},set:function(e){for(var t=-1,i=0;i<this._tabs.length&&t<0;i++)this._tabs[i]==e&&(t=i);this.selectedIndex=t},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e);toggleClass(this.hostElement,UtilitesClsNames.animated,this._animated)},enumerable:!0,configurable:!0});Object.defineProperty(TabPanel.prototype,"autoSwitch",{get:function(){return this._autoSwitch},set:function(e){if(e!=this._autoSwitch){this._autoSwitch=asBoolean(e);this._updateContent()}},enumerable:!0,configurable:!0});TabPanel.prototype.getTab=function(e){for(var t=0;t<this._tabs.length;t++){if((i=this._tabs[t]).header.id==e||i.pane.id==e)return i}for(t=0;t<this._tabs.length;t++){var i;if((i=this._tabs[t]).header.textContent==e)return i}return null};TabPanel.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};TabPanel.prototype._populateControl=function(){var e=this;this._removeChildren(this._dTabHeaders);this._removeChildren(this._dTabPanes);var t=-1;this._tabs.forEach((function(i,n){assert(i instanceof Tab,"tabs array must contain Tab objects.");i._setPanel(e);var r=i.header;addClass(r,TabPanelClsNames.tabHeader);setAttribute(r,"role","tab");e._dTabHeaders.appendChild(r);var s=i.pane;addClass(s,TabPanelClsNames.tabPane);setAttribute(s,"role","tabpanel");setAttribute(s,"aria-labelledby",r.id?r.id:null);e._dTabPanes.appendChild(s);t<0&&(hasClass(r,ControlStateClsNames.active)||"true"==r.getAttribute("aria-selected"))&&(t=n)}));t<0&&this._tabs.length>0&&(t=0);t>-1?this.selectedIndex=t:this.selectedIndex>-1&&this.selectedIndex<this._tabs.length&&this._updateContent();this._validateSelection()};TabPanel.prototype._validateSelection=function(){var e=this.selectedTab;if(e&&(e.isDisabled||!e.isVisible)){var t=this._getNextIndex(this.selectedIndex,1);t<0&&(t=this._getNextIndex(this.selectedIndex,-1));this.selectedIndex=t}};TabPanel.prototype._updateContent=function(){var e=this,t=contains(this._dTabHeaders,getActiveElement()),i=this._dTabHeaders.children,n=this._dTabPanes.children,r=this._selectedIndex;if(r>-1&&r<n.length){var s=(d=n[r]).style;if(this.isAnimated){this._eAnim&&(this._eAnim.style.opacity="");this._toAnim&&clearInterval(this._toAnim);s.opacity="0";this._eAnim=d;this._toAnim=animate((function(t){if(1==t){e._eAnim=null;e._toAnim=null;s.opacity=""}else s.opacity=t.toString()}))}else s.opacity=""}for(var o=0;o<i.length;o++){var a=o==r,l=i[o];setAttribute(l,"aria-selected",a);toggleClass(l,ControlStateClsNames.active,a);var d=n[o];toggleClass(d,ControlStateClsNames.active,a);l.tabIndex=a||!this._autoSwitch?this._orgTabIndex:-1;if(a){t&&l.focus();this._szObserver||Control.invalidateAll(d)}}};TabPanel.prototype._removeChildren=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)};TabPanel.prototype._click=function(e){var t=this._getTabIndex(e.target);if(t>-1){var i=this._tabs[t];!i.isDisabled&&i.isVisible&&(this.selectedIndex=t)}};TabPanel.prototype._keydown=function(e){if(!e.defaultPrevented){var t=this._getTabIndex(getActiveElement());if(t>-1){var i=this._getKeyCode(e);switch(i){case Key.Left:case Key.Up:case Key.Right:case Key.Down:case Key.Home:case Key.PageUp:case Key.End:case Key.PageDown:switch(i){case Key.Left:case Key.Up:t=this._getNextIndex(t,-1);break;case Key.Right:case Key.Down:t=this._getNextIndex(t,1);break;case Key.Home:case Key.PageUp:t=this._getNextIndex(-1,1);break;case Key.End:case Key.PageDown:t=this._getNextIndex(this._tabs.length,-1)}t>-1&&(this._autoSwitch?this.selectedIndex=t:this._tabs[t].header.focus());e.preventDefault();break;case Key.Enter:case Key.Space:if(t>-1){this._tabs[t].header.click()}e.preventDefault()}}}};TabPanel.prototype._getTabIndex=function(e){var t=closest(e,"."+TabPanelClsNames.tabHeader);if(t&&closest(t,"."+TabPanelClsNames.hostElement)==this.hostElement)for(var i=0;i<this._tabs.length;i++)if(this._tabs[i].header==t)return i;return-1};TabPanel.prototype._getNextIndex=function(e,t){for(var i=e+t;i>-1&&i<this._tabs.length;i+=t){var n=this._tabs[i];if(!n.isDisabled&&n.isVisible)return i}return-1};TabPanel.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};TabPanel.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};TabPanel.prototype._updateTabIndex=function(){var e=this._dTabHeaders.children,t=this._selectedIndex;if(t>-1&&t<e.length){e[t].tabIndex=this.isDisabled?-1:this._orgTabIndex}this.hostElement.tabIndex=-1};TabPanel.prototype.dispose=function(){if(this._toAnim){clearInterval(this._toAnim);this._toAnim=null}this._tabs.collectionChanged.removeHandler(this._populateControl,this);this._tabs.forEach((function(e){e.dispose()}));this._tabs.clear();e.prototype.dispose.call(this)};TabPanel._ctrlTemplate="";return TabPanel}(Control);export{TabPanel};var Tab=function(){function Tab(e,t){this._hdr=asType(getElement(e),HTMLElement);this._pane=asType(getElement(t),HTMLElement)}Object.defineProperty(Tab.prototype,"tabPanel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"header",{get:function(){return this._hdr},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"pane",{get:function(){return this._pane},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"isDisabled",{get:function(){return hasClass(this._hdr,ControlStateClsNames.disabled)},set:function(e){toggleClass(this._hdr,ControlStateClsNames.disabled,asBoolean(e));this._p&&this._p._validateSelection()},enumerable:!0,configurable:!0});Object.defineProperty(Tab.prototype,"isVisible",{get:function(){return"none"!=this._hdr.style.display},set:function(e){this._hdr.style.display=asBoolean(e)?"":"none";this._p&&this._p._validateSelection()},enumerable:!0,configurable:!0});Tab.prototype._setParts=function(e,t){e=asType(getElement(e),HTMLElement);t=asType(getElement(t),HTMLElement,!1);if(this._hdr!==e||this._pane!==t){var i=this.isDisabled,n=this.isVisible;this._hdr=e;this._pane=t;this.isDisabled=i;this.isVisible=n;var r=this.tabPanel;r&&!r.tabs.isUpdating&&r._populateControl()}};Tab.prototype._setPanel=function(e){this._p=e};Tab.prototype.dispose=function(){this._hdr=null;this._pane=null;this._p=null};return Tab}();export{Tab};var _CLS_ACTIVE=ControlStateClsNames.active,Accordion=function(e){__extends(Accordion,e);function Accordion(t,i,n){var r=e.call(this,t,null,!0)||this;r._panes=new ObservableArray;r._selectedIndex=-1;r._animated=!0;r._autoSwitch=!0;r._alCollapseAll=!1;r._alExpandMany=!1;r._autoSwitching=!1;r.selectedIndexChanged=new Event;var s=r.hostElement,o=r._panes,a=[];if(!n)for(;s.firstElementChild;){var l=s.firstElementChild;s.removeChild(l);a.push(l)}addClass(s,ControlClsNames.hostElement+" "+AccordionClsNames.hostElement+" "+AccordionClsNames.showIcons);s.tabIndex=-1;r.addEventListener(s,"click",r._click.bind(r));r.addEventListener(s,"keydown",r._keydown.bind(r));o.collectionChanged.addHandler(r._populateControl.bind(r));o.deferUpdate((function(){a.forEach((function(e){assert(2==e.childElementCount,"Accordion children should contain header and pane elements");o.push(new AccordionPane(e.children[0],e.children[1]))}))}));r.initialize(i);var d=i?i.selectedIndex:null;r.selectedIndex!=d&&r.selectedIndex<0&&o.length?r.selectedIndex=0:r.onSelectedIndexChanged();return r}Object.defineProperty(Accordion.prototype,"panes",{get:function(){return this._panes},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(e){if((e=asInt(e,!1))!=this._selectedIndex){this._selectedIndex=e;this._updateContent();this.onSelectedIndexChanged()}else this._updateContent()},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"selectedPane",{get:function(){var e=this._selectedIndex;return e>-1?this._panes[e]:null},set:function(e){this.selectedIndex=this._getIndexOfPane(e)},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"showIcons",{get:function(){return hasClass(this.hostElement,AccordionClsNames.showIcons)},set:function(e){toggleClass(this.hostElement,AccordionClsNames.showIcons,asBoolean(e))},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"autoSwitch",{get:function(){return this._autoSwitch},set:function(e){if(e!=this._autoSwitch){this._autoSwitch=asBoolean(e);this._updateContent()}},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"allowCollapseAll",{get:function(){return this._alCollapseAll},set:function(e){this._alCollapseAll=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Accordion.prototype,"allowExpandMany",{get:function(){return this._alExpandMany},set:function(e){var t=this;if(e!=this._alExpandMany){this._alExpandMany=e=asBoolean(e);e||this.panes.forEach((function(e,i){var n=i==t.selectedIndex;toggleActiveClass(e.header,n);setAttribute(e.header,"aria-expanded",n)}))}},enumerable:!0,configurable:!0});Accordion.prototype.getPane=function(e){for(var t=0;t<this._panes.length;t++){if((i=this._panes[t]).header.id==e||i.content.id==e)return i}for(t=0;t<this._panes.length;t++){var i;if((i=this._panes[t]).header.textContent==e)return i}return null};Accordion.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};Accordion.prototype._populateControl=function(){var e=this,t=-1,i=this.hostElement;this._panes.forEach((function(n,r){assert(n instanceof AccordionPane,"panes array must contain AccordionPane objects.");n._setAccordion(e);var s=n.header;addClass(s,AccordionClsNames.header);setAttribute(s,"role","button");i.appendChild(s);var o=n.content;addClass(o,ControlClsNames.content);setAttribute(o,"role","region");setAttribute(o,"aria-labelledby",s.id?s.id:null);i.appendChild(o);t<0&&(hasClass(s,_CLS_ACTIVE)||"true"==s.getAttribute("aria-expanded"))&&(t=r)}));t>-1?this.selectedIndex=t:this.selectedIndex>-1&&this.selectedIndex<this._panes.length&&this._updateContent();this._validateSelection()};Accordion.prototype._validateSelection=function(){var e=this.selectedPane;if(e&&(e.isDisabled||!e.isVisible)){var t=this._getNextIndex(this.selectedIndex,1);t<0&&(t=this._getNextIndex(this.selectedIndex,-1));this.selectedIndex=t}};Accordion.prototype._updateContent=function(){var e=this,t=contains(this.hostElement,getActiveElement()),i=this._selectedIndex,n=this._panes,r=[];n.forEach((function(n,s){var o=n.header,a=s==i,l=hasClass(o,_CLS_ACTIVE),d=a||l&&e._alExpandMany&&n!=e._hidePane,h=d&&!l,c=l&&!d;e._animated&&(h||c)&&r.push({show:h,pane:n});setAttribute(o,"aria-expanded",d);e._animated||toggleActiveClass(o,d);if(a){t&&o.focus();e._szObserver||Control.invalidateAll(n.content)}}));this._updatePanesTabIndex();if(this._animated&&r.length){r.forEach((function(e){toggleActiveClass(e.pane.header,!0);e.height=e.pane.content.offsetHeight;e.show&&(e.pane.content.style.height="0")}));this._toAnim=animate((function(e){e<1?r.forEach((function(t){var i=t.height*(t.show?e:1-e);t.pane.content.style.height=i.toFixed(0)+"px"})):r.forEach((function(e){e.pane.content.style.height="";toggleActiveClass(e.pane.header,e.show)}))}))}this._hidePane=null};Accordion.prototype._updatePanesTabIndex=function(){var e=this;this._panes.forEach((function(t,i){t.header.tabIndex=e._selectedIndex!==i&&e._autoSwitch?-1:e._orgTabIndex}))};Accordion.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this._updatePanesTabIndex()};Accordion.prototype._click=function(e){var t=this._getPaneIndex(e.target);if(t>-1){var i=this._panes[t];if(!i.isDisabled&&i.isVisible){if(!hasClass(i.header,_CLS_ACTIVE)||this._autoSwitching)this.selectedIndex=t;else{var n=this._getNextActiveIndex(t);if(n>-1||this._alCollapseAll){this._hidePane=i;this.selectedIndex=n}}}}};Accordion.prototype._keydown=function(e){if(!e.defaultPrevented){var t=this._getPaneIndex(getActiveElement());if(t>-1){var i=this._getKeyCode(e);switch(i){case Key.Left:case Key.Up:case Key.Right:case Key.Down:case Key.Home:case Key.PageUp:case Key.End:case Key.PageDown:switch(i){case Key.Left:case Key.Up:t=this._getNextIndex(t,-1);break;case Key.Right:case Key.Down:t=this._getNextIndex(t,1);break;case Key.Home:case Key.PageUp:t=this._getNextIndex(-1,1);break;case Key.End:case Key.PageDown:t=this._getNextIndex(this._panes.length,-1)}if(t>-1){var n=this._panes[t];if(this._autoSwitch){this._autoSwitching=!0;n.header.click();this._autoSwitching=!1}else n.header.focus()}e.preventDefault();break;case Key.Enter:case Key.Space:if(t>-1){(n=this._panes[t]).header.click()}e.preventDefault()}}}};Accordion.prototype._getPaneIndex=function(e){var t=closest(e,"."+AccordionClsNames.header);if(t&&closest(t,"."+AccordionClsNames.hostElement)==this.hostElement)for(var i=0;i<this._panes.length;i++)if(this._panes[i].header==t)return i;return-1};Accordion.prototype._getNextIndex=function(e,t){for(var i=e+t;i>-1&&i<this._panes.length;i+=t){var n=this._panes[i];if(!n.isDisabled&&n.isVisible)return i}return-1};Accordion.prototype._getIndexOfPane=function(e){for(var t=-1,i=this._panes,n=0;n<i.length&&t<0;n++)i[n]==e&&(t=n);return t};Accordion.prototype._getNextActiveIndex=function(e){for(var t=-1,i=this.panes,n=1;n<i.length;n++){var r=(e+n)%i.length,s=i[r];if(hasClass(s.header,_CLS_ACTIVE)){t=r;break}}return t};Accordion.prototype._togglePane=function(e,t){if(e.isCollapsed!==t&&e.isVisible&&!e.isDisabled)if(t){if(this.allowCollapseAll||this.panes.filter((function(e){return!e.isCollapsed})).length>1){this._hidePane=e;var i=this._getIndexOfPane(e);this.selectedIndex=this._getNextActiveIndex(i)}}else this.selectedPane=e};Accordion.prototype.dispose=function(){if(this._animated&&this._toAnim){clearInterval(this._toAnim);this._toAnim=null}this._panes.collectionChanged.removeHandler(this._populateControl,this);this._panes.forEach((function(e){e.dispose()}));this._panes.clear();e.prototype.dispose.call(this)};return Accordion}(Control);export{Accordion};var AccordionPane=function(){function AccordionPane(e,t){this._hdr=asType(getElement(e),HTMLElement);this._content=asType(getElement(t),HTMLElement)}Object.defineProperty(AccordionPane.prototype,"accordion",{get:function(){return this._acc},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"header",{get:function(){return this._hdr},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"isDisabled",{get:function(){return hasClass(this._hdr,ControlStateClsNames.disabled)},set:function(e){toggleClass(this._hdr,ControlStateClsNames.disabled,asBoolean(e));this._acc&&this._acc._validateSelection()},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"isVisible",{get:function(){return"none"!=this._hdr.style.display},set:function(e){this._hdr.style.display=asBoolean(e)?"":"none";this._acc&&this._acc._validateSelection()},enumerable:!0,configurable:!0});Object.defineProperty(AccordionPane.prototype,"isCollapsed",{get:function(){return!hasClass(this._hdr,_CLS_ACTIVE)},set:function(e){var t=this._acc;t?t._togglePane(this,e):toggleActiveClass(this._hdr,!asBoolean(e))},enumerable:!0,configurable:!0});AccordionPane.prototype._setParts=function(e,t){e=asType(getElement(e),HTMLElement);t=asType(getElement(t),HTMLElement,!1);if(this._hdr!==e||this._content!==t){var i=this.isDisabled,n=this.isVisible;this._hdr=e;this._content=t;this.isDisabled=i;this.isVisible=n;var r=this.accordion;r&&!r.panes.isUpdating&&r._populateControl()}};AccordionPane.prototype._setAccordion=function(e){this._acc=e};AccordionPane.prototype.dispose=function(){this._hdr=null;this._content=null;this._acc=null};return AccordionPane}();export{AccordionPane};function toggleActiveClass(e,t){toggleClass(e,_CLS_ACTIVE,t);toggleClass(e.nextElementSibling,AccordionClsNames.activeContent,t)}var FormatNodeEventArgs=function(e){__extends(FormatNodeEventArgs,e);function FormatNodeEventArgs(t,i,n){var r=e.call(this)||this;r._data=t;r._e=asType(i,HTMLElement);r._level=n;return r}Object.defineProperty(FormatNodeEventArgs.prototype,"dataItem",{get:function(){return this._data},enumerable:!0,configurable:!0});Object.defineProperty(FormatNodeEventArgs.prototype,"element",{get:function(){return this._e},enumerable:!0,configurable:!0});Object.defineProperty(FormatNodeEventArgs.prototype,"level",{get:function(){return this._level},enumerable:!0,configurable:!0});return FormatNodeEventArgs}(EventArgs);export{FormatNodeEventArgs};var TreeNodeEventArgs=function(e){__extends(TreeNodeEventArgs,e);function TreeNodeEventArgs(t){var i=e.call(this)||this;i._node=t;return i}Object.defineProperty(TreeNodeEventArgs.prototype,"node",{get:function(){return this._node},enumerable:!0,configurable:!0});return TreeNodeEventArgs}(CancelEventArgs);export{TreeNodeEventArgs};var TreeNodeDragDropEventArgs=function(e){__extends(TreeNodeDragDropEventArgs,e);function TreeNodeDragDropEventArgs(t,i,n){var r=e.call(this)||this;r._src=asType(t,TreeNode);r._tgt=asType(i,TreeNode);r._pos=n;return r}Object.defineProperty(TreeNodeDragDropEventArgs.prototype,"dragSource",{get:function(){return this._src},enumerable:!0,configurable:!0});Object.defineProperty(TreeNodeDragDropEventArgs.prototype,"dropTarget",{get:function(){return this._tgt},enumerable:!0,configurable:!0});Object.defineProperty(TreeNodeDragDropEventArgs.prototype,"position",{get:function(){return this._pos},set:function(e){this._pos=asEnum(e,DropPosition)},enumerable:!0,configurable:!0});return TreeNodeDragDropEventArgs}(CancelEventArgs);export{TreeNodeDragDropEventArgs};export var DropPosition;!function(e){e[e.Before=0]="Before";e[e.After=1]="After";e[e.Into=2]="Into"}(DropPosition||(DropPosition={}));var TreeNode=function(){function TreeNode(e,t){if(hasClass(t,TreeViewClsNames.hostElement)){e=Control.getControl(t);t=null}else TreeNode._assertNode(t);if(t&&t[TreeNode.CacheKey]&&t[TreeNode.CacheKey]._t==e)return t[TreeNode.CacheKey];t&&(t[TreeNode.CacheKey]=this);this._t=e;this._e=t}Object.defineProperty(TreeNode.prototype,"dataItem",{get:function(){return this._e[TreeView._DATAITEM_KEY]},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"element",{get:function(){return this._e},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"treeView",{get:function(){return this._t},enumerable:!0,configurable:!0});TreeNode.prototype.ensureVisible=function(){var e=!!this.parentNode&&this.parentNode.isCollapsed;this.treeView._scrollNode=this;for(var t=this.parentNode;t;t=t.parentNode)t.isCollapsed=!1;this.treeView.isAnimated&&e||this._scrollIntoView()};TreeNode.prototype._scrollIntoView=function(){if(this.treeView._scrollNode){var e=this._t.hostElement,t=this.treeView._scrollNode.element.getBoundingClientRect(),i=e.getBoundingClientRect(),n=e.offsetHeight-e.clientHeight;t.bottom>i.bottom-n?e.scrollTop+=t.bottom-(i.bottom-n):t.top<i.top&&(e.scrollTop-=i.top-t.top);this.treeView._scrollNode=null}};TreeNode.prototype.equals=function(e){return null!=e&&e.element==this.element};Object.defineProperty(TreeNode.prototype,"isSelected",{get:function(){var e=this._t;return e.selectedNode==this||e.selectedNodes.includes(this)},enumerable:!0,configurable:!0});TreeNode.prototype.select=function(e){void 0===e&&(e=!1);var t=this._t,i=t._selNode;if(!this.equals(i)){if(i){removeClass(i.element,TreeView._CSEL);setAttribute(i.element,"aria-selected",!1)}t._selNode=this;addClass(this.element,TreeView._CSEL);setAttribute(this.element,"aria-selected",!0);this.ensureVisible();if(t.allowMultiSelect&&!t.selectedNodes.includes(this))t.selectedNodes.push(this);else if(!t.selectedNodes.includes(this)){t.selectedNodes.beginUpdate();t.selectedNodes.clear();t.selectedNodes.push(this);t.selectedNodes.endUpdate(!0)}t._updateFocus(i);e||t.onSelectedItemChanged()}};TreeNode.prototype.deSelect=function(e){void 0===e&&(e=!1);if(this.isSelected){var t=this._t;removeClass(this.element,TreeView._CSEL);setAttribute(this.element,"aria-selected",!1);t.selectedNodes.remove(this);t.selectedNode==this?e?t._selNode=null:t.selectedNode=null:e||t.onSelectedItemChanged()}};Object.defineProperty(TreeNode.prototype,"index",{get:function(){for(var e=0,t=this._pse(this.element);t;t=this._pse(t))TreeNode._isNode(t)&&e++;return e},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"parentNode",{get:function(){var e=null;if(this._e){var t=this._e.parentElement;TreeNode._assertNodeList(t);e=this._pse(t)}return e?new TreeNode(this._t,e):null},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"level",{get:function(){for(var e=-1,t=this;t;t=t.parentNode)e++;return e},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"hasChildren",{get:function(){return TreeNode._isNode(this._e)&&!TreeNode._isEmpty(this._e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"hasPendingChildren",{get:function(){return this.isCollapsed&&this.hasChildren&&!TreeNode._isNodeList(this.element.nextElementSibling)&&isFunction(this._t.lazyLoadFunction)},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"nodes",{get:function(){return this.hasChildren?TreeNode._getChildNodes(this._t,this._e.nextSibling):null},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"checkBox",{get:function(){return this._e.querySelector("input."+TreeView._CNDC)},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"isCollapsed",{get:function(){return this.hasChildren&&hasClass(this._e,TreeView._CCLD)},set:function(e){if(e!=this.isCollapsed){var t=this._t,i=new TreeNodeEventArgs(this);if(t.onIsCollapsedChanging(i)){this.setCollapsed(asBoolean(e),t.isAnimated,t.autoCollapse);t.onIsCollapsedChanged(i)}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"isChecked",{get:function(){var e=this.checkBox;return e&&!e.indeterminate?e.checked:null},set:function(e){if(e!=this.isChecked){var t=this._t,i=new TreeNodeEventArgs(this);if(t.onIsCheckedChanging(i)){this.setChecked(asBoolean(e),!0);t.onIsCheckedChanged(i)}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeNode.prototype,"isDisabled",{get:function(){return this._e&&null!=this._e.getAttribute("disabled")},set:function(e){if((e=asBoolean(e,!0))!=this.isDisabled){enable(this._e,!e);this.isDisabled&&this._t&&this._t.collapseWhenDisabled&&(this.isCollapsed=!0)}},enumerable:!0,configurable:!0});TreeNode.prototype.previous=function(e,t){var i=this._pse(this._e);!i&&TreeNode._isNodeList(this._e.parentElement)&&(i=this._pse(this._e.parentElement));if(TreeNode._isNodeList(i)){for(;TreeNode._isNodeList(i)&&i.childElementCount;)i=i.lastChild;TreeNode._isNodeList(i)&&(i=this._pse(i))}var n=TreeNode._isNode(i)?new TreeNode(this._t,i):null;e&&n&&!n.element.offsetHeight&&(n=n.previous(e,t));t&&n&&n.isDisabled&&(n=n.previous(e,t));return n};TreeNode.prototype.next=function(e,t){var i=this._e.nextSibling;TreeNode._isNodeList(i)&&(i=i.childElementCount?i.firstChild:i.nextSibling);if(!i)for(var n=this._e.parentElement;!i&&TreeNode._isNodeList(n);n=n.parentElement)i=n.nextSibling;var r=TreeNode._isNode(i)?new TreeNode(this._t,i):null;e&&r&&!r.element.offsetHeight&&(r=r.next(e,t));t&&r&&r.isDisabled&&(r=r.next(e,t));return r};TreeNode.prototype.previousSibling=function(){for(var e=this._pse(this.element);TreeNode._isNodeList(e);)e=this._pse(e);return e?new TreeNode(this._t,e):null};TreeNode.prototype.nextSibling=function(){var e=this.element.nextSibling;TreeNode._isNodeList(e)&&(e=e.nextSibling);return e?new TreeNode(this._t,e):null};TreeNode.prototype.setCollapsed=function(e,t,i){var n=this,r=this._t,s=this._e,o=this._e.nextElementSibling,a=TreeNode._isNodeList(o);setAttribute(s,"aria-expanded",a?(!e).toString():null);if(e!=this.isCollapsed)if(e||a||!isFunction(r.lazyLoadFunction)){null==t&&(t=r.isAnimated);null==i&&(i=r.autoCollapse);if(t){if(a){var l=o.offsetHeight,d=o.style,h=r.hostElement,c=h.style;h.scrollHeight<=h.clientHeight&&(c.overflowY="hidden");if(e){toggleClass(s,TreeView._CCLG,!0);coreAnimate((function(e){if(e<1){e=1-e;d.height=(e*l).toFixed(0)+"px"}else{d.height=d.opacity=c.overflowY="";toggleClass(s,TreeView._CCLD,!0);toggleClass(s,TreeView._CCLG,!1)}}),TreeView._AN_DLY)}else{toggleClass(s,TreeView._CCLD,!1);d.height=d.opacity="0";coreAnimate((function(e){d.height=e>=1?d.opacity=c.overflowY="":(e*l).toFixed(0)+"px"}),TreeView._AN_DLY,void 0,(function(){n._scrollIntoView()}))}}}else toggleClass(s,TreeView._CCLD,e);if(!e&&i){var u=s.parentElement;if(TreeNode._isNodeList(u))for(var p=0;p<u.children.length;p++){var _=u.children[p];if(_!=s&&TreeNode._isNode(_)){toggleClass(_,TreeView._CCLD,!0);_.setAttribute("aria-expanded","false")}}}this.element}else r._lazyLoadNode(this)};TreeNode.prototype.setChecked=function(e,t){var i=this.checkBox,n=i.checked!=e;setChecked(i,e);if(this.hasChildren)for(var r=0;r<this.nodes.length;r++)this.nodes[r].setChecked(e,!1);var s=this._t;s&&s.checkedMemberPath&&s._chkPath.setValue(this.dataItem,this.level,e);if(t){var o=this.parentNode;o&&o._updateCheckedState()}s&&n&&s._raiseCheckedItemsChanged()};TreeNode.prototype.remove=function(){var e=this._t,t=this.parentNode,i=this._getArray(),n=i.indexOf(this.dataItem);e.selectedNode==this&&(e.selectedNode=this.nextSibling()||this.previousSibling()||t);var r=this.element.nextSibling;TreeNode._isNodeList(r)&&removeChild(r);removeChild(this.element);t&&t._updateState();i.splice(n,1);this._t=null};TreeNode.prototype.addChildNode=function(e,t){var i=this._t._createNode(t),n=this.nodes;n?e<n.length?i.move(n[e],DropPosition.Before):i.move(n[n.length-1],DropPosition.After):i.move(this,DropPosition.Into);return i};TreeNode.prototype.refresh=function(e){var t=this._getArray();e&&(t[this.index]=e);e=t[this.index];var i=this._t._createNode(e),n=this.hasChildren&&!this.hasPendingChildren?this.element.nextSibling:null;n&&removeChild(n);(n=i.hasChildren&&!i.hasPendingChildren?i.element.nextSibling:null)&&this.element.parentElement.insertBefore(n,this.element.nextSibling);this.element.innerHTML=i.element.innerHTML;this._updateState()};TreeNode.prototype.move=function(e,t){if(e instanceof TreeNode&&this._contains(e))return!1;var i=this.parentNode,n=this._getArray();this._moveElements(e,t);e.treeView&&(this._t=e.treeView);i&&i._updateState();var r=this.parentNode;r&&r._updateState();var s=this.dataItem,o=n.indexOf(s),a=this._getArray();n.splice(o,1);a.splice(this.index,0,s);return!0};Object.defineProperty(TreeNode.prototype,"itemsSource",{get:function(){return this._getArray()},enumerable:!0,configurable:!0});TreeNode.prototype._pse=function(e){return e.previousElementSibling};TreeNode.prototype._contains=function(e){for(;e;e=e.parentNode)if(e.element==this.element)return!0;return!1};TreeNode.prototype._getArray=function(){var e=this._t,t=this.parentNode,i=e.itemsSource;if(t){var n=e._itmPath;if(!(i=n.getValue(t.dataItem,this.level))){i=[];n.setValue(t.dataItem,this.level,i)}}return i};TreeNode.prototype._moveElements=function(e,t){var i=document.createDocumentFragment(),n=this.hasChildren&&!this.hasPendingChildren?this.element.nextSibling:null;i.appendChild(this.element);if(n){TreeNode._assertNodeList(n);i.appendChild(n)}if(e instanceof TreeView)e._root.insertBefore(i,null);else{var r=e.element,s=r?r.parentElement:e.treeView._root;TreeNode._assertNodeList(s);var o=DropPosition;switch(t){case o.Before:s.insertBefore(i,r);break;case o.After:r=(e=e.nextSibling())?e.element:null;s.insertBefore(i,r);break;case o.Into:if(!e.hasChildren||e.hasPendingChildren){n=document.createElement("div");addClass(n,TreeView._CNDL);s.insertBefore(n,r.nextSibling)}s=e.element.nextSibling;TreeNode._assertNodeList(s);s.insertBefore(i,null)}}};TreeNode.prototype._updateState=function(){this._updateEmptyState();this._updateCheckedState()};TreeNode.prototype._updateEmptyState=function(){var e=this.element.nextSibling,t=!1;TreeNode._isNodeList(e)&&(e.childElementCount?t=!0:removeChild(e));toggleClass(this.element,TreeView._CEMP,!t);t||this.element.removeAttribute("aria-expanded")};TreeNode.prototype._updateCheckedState=function(){var e=this._t,t=this.checkBox,i=this.nodes,n=0,r=0,s=!1;if(t&&i){for(var o=0;o<i.length&&!s;o++){switch(i[o].isChecked){case!0:n++;break;case!1:r++;break;case null:s=!0}n&&r&&(s=!0)}setChecked(t,s?null:n>0);if(e&&e.checkedMemberPath){var a=s?null:t.checked;e._chkPath.setValue(this.dataItem,this.level,a)}}var l=this.parentNode;l&&l._updateCheckedState()};TreeNode.prototype.dispose=function(){delete this._e[TreeNode.CacheKey];this._t=null;var e=this._e.nextElementSibling;TreeNode._isNodeList(e)&&e.parentNode&&e.parentNode.removeChild(e);this.nodes&&this.nodes.forEach((function(e){e.dispose()}));this._e.innerHTML="";this._e=null};TreeNode._getChildNodes=function(e,t){var i=[];if(TreeNode._isNodeList(t))for(var n=t.children,r=0;r<n.length;r++){var s=n[r];TreeNode._isNode(s)&&i.push(new TreeNode(e,s))}return i};TreeNode._isNode=function(e){return e&&hasClass(e,TreeView._CND)};TreeNode._isNodeList=function(e){return e&&hasClass(e,TreeView._CNDL)};TreeNode._isEmpty=function(e){return TreeNode._isNode(e)&&hasClass(e,TreeView._CEMP)};TreeNode._isCollapsed=function(e){return TreeNode._isNode(e)&&!TreeNode._isEmpty(e)&&hasClass(e,TreeView._CCLD)};TreeNode._assertNode=function(e){assert(TreeNode._isNode(e),"node expected")};TreeNode._assertNodeList=function(e){assert(TreeNode._isNodeList(e),"nodeList expected")};TreeNode.CacheKey="$_WJ_TV_NODE";return TreeNode}();export{TreeNode};var _BindingArray=function(){function _BindingArray(e){this.path=e}Object.defineProperty(_BindingArray.prototype,"path",{get:function(){return this._path},set:function(e){this._path=e;if(isString(e))this._bindings=[new Binding(e)];else if(isArray(e)){this._bindings=[];for(var t=0;t<e.length;t++)this._bindings.push(new Binding(e[t]))}else null!=e&&assert(!1,"Path should be a string or an array of strings.");this._maxLevel=this._bindings?this._bindings.length-1:-1},enumerable:!0,configurable:!0});_BindingArray.prototype.getValue=function(e,t){var i=Math.min(t,this._maxLevel);return i>-1?this._bindings[i].getValue(e):null};_BindingArray.prototype.setValue=function(e,t,i){var n=Math.min(t,this._maxLevel);n>-1&&this._bindings[n].setValue(e,i)};return _BindingArray}();export{_BindingArray};var TreeView=function(e){__extends(TreeView,e);function TreeView(t,i){void 0===i&&(i={});var n=e.call(this,t)||this;n._selNodes=new ObservableArray;n._itmPath=new _BindingArray("items");n._chkPath=new _BindingArray;n._dspPath=new _BindingArray("header");n._imgPath=new _BindingArray;n._html=!1;n._animated=!0;n._chkOnClick=!1;n._collOnClick=!1;n._xpndOnClick=!0;n._xpndOnLoad=!0;n._autoColl=!0;n._showChk=!1;n._collapseWhenDisabled=!0;n._srch="";n._isReadOnly=!0;n._preserveSelNode=!1;n._allowMultiSelect=!1;n.itemsSourceChanged=new Event;n.loadingItems=new Event;n.loadedItems=new Event;n.itemClicked=new Event;n.selectedItemChanged=new Event;n.checkedItemsChanged=new Event;n.isCollapsedChanging=new Event;n.isCollapsedChanged=new Event;n.isCheckedChanging=new Event;n.isCheckedChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n.dragStart=new Event;n.dragOver=new Event;n.drop=new Event;n.dragEnd=new Event;n.nodeEditStarting=new Event;n.nodeEditStarted=new Event;n.nodeEditEnding=new Event;n.nodeEditEnded=new Event;n.options=i;var r=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+TreeViewClsNames.hostElement,r,{_root:"root"});var s=n.hostElement;setAttribute(s,"role","tree",!0);addClass(n._root,TreeView._CNDL);setAttribute(n._root,"role","group",!0);n.addEventListener(s,"mousedown",n._mousedown.bind(n));n.addEventListener(s,"click",n._click.bind(n));n.addEventListener(s,"keydown",n._keydown.bind(n));n.addEventListener(s,"keypress",n._keypress.bind(n));n.addEventListener(s,"wheel",(function(e){s.scrollHeight>s.offsetHeight&&(e.deltaY<0&&0==s.scrollTop||e.deltaY>0&&s.scrollTop+s.offsetHeight>=s.scrollHeight)&&e.preventDefault()}));n.addEventListener(s,"blur",(function(){n._edtNode&&!contains(n._edtNode.element,getActiveElement())&&n.finishEditing()}),!0);n.addEventListener(s,"paste",(function(e){if(n._edtNode&&!n.isContentHtml){var t=(e.clipboardData||window.clipboardData).getData("text"),i=window.getSelection();if(t&&i.rangeCount){i.deleteFromDocument();i.getRangeAt(0).insertNode(document.createTextNode(t));e.preventDefault()}}}));n._selNodes.collectionChanged.addHandler((function(e,t){switch(t.action){case NotifyCollectionChangedAction.Add:addClass(t.item.element,TreeView._CMSEL);break;case NotifyCollectionChangedAction.Remove:removeClass(t.item.element,TreeView._CMSEL);break;case NotifyCollectionChangedAction.Change:addClass(t.item.element,TreeView._CMSEL);break;case NotifyCollectionChangedAction.Reset:n.hostElement.querySelectorAll("."+TreeView._CMSEL).forEach((function(e){removeClass(e,TreeView._CMSEL)}))}}));n.initialize(i);n.refresh();return n}Object.defineProperty(TreeView,"controlTemplate",{get:function(){TreeView._ctrlTemplate||(TreeView._ctrlTemplate='<div wj-part="root"></div>');return TreeView._ctrlTemplate},set:function(e){TreeView._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"itemsSource",{get:function(){return this._items},set:function(e){if(this._items!=e){this._items=asArray(e);this.onItemsSourceChanged();this._srcChanged=!0;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"childItemsPath",{get:function(){return this._itmPath.path},set:function(e){if(e!=this.childItemsPath){this._itmPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"displayMemberPath",{get:function(){return this._dspPath.path},set:function(e){if(e!=this.displayMemberPath){this._dspPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"imageMemberPath",{get:function(){return this._imgPath.path},set:function(e){if(e!=this.imageMemberPath){this._imgPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"checkedMemberPath",{get:function(){return this._chkPath.path},set:function(e){if(e!=this.checkedMemberPath){this._chkPath.path=e;this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"isContentHtml",{get:function(){return this._html},set:function(e){if(e!=this._html){this._html=asBoolean(e);this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"showCheckboxes",{get:function(){return this._showChk},set:function(e){if(e!=this._showChk){this._showChk=asBoolean(e);this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"autoCollapse",{get:function(){return this._autoColl},set:function(e){this._autoColl=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"collapseWhenDisabled",{get:function(){return this._collapseWhenDisabled},set:function(e){this._collapseWhenDisabled=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e);toggleClass(this.hostElement,UtilitesClsNames.animated,this._animated)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(e){this._isReadOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});TreeView.prototype.startEditing=function(e){this._prevDragState=this.allowDragging;if(this.isReadOnly)return!1;e||(e=this.selectedNode);if(!e||e.isDisabled)return!1;if(!this.finishEditing())return!1;var t=e.element.querySelector("."+TreeView._CNDT);if(!t)return!1;var i=new TreeNodeEventArgs(e);if(!this.onNodeEditStarting(i))return!1;t.tabIndex=0;t.focus();t.contentEditable="true";t.style.cursor="auto";var n=document.createRange();n.selectNodeContents(t);var r=getSelection();r.removeAllRanges();r.addRange(n);this.allowDragging=!this.isTxtSelected(t);t.focus();setAttribute(t,"autocomplete","off");setAttribute(t,"autocorrect","off");this._edtNode=e;this.onNodeEditStarted(i);return!0};TreeView.prototype.finishEditing=function(e){var t=this._edtNode;if(t){var i=t.element.querySelector("."+TreeView._CNDT);if(!i)return!1;var n=new TreeNodeEventArgs(t);if(!this.onNodeEditEnding(n))return!1;var r=t.dataItem,s=t.level;this.isContentHtml?e?i.innerHTML=this._dspPath.getValue(r,s):this._dspPath.setValue(r,s,i.innerHTML):e?i.textContent=this._dspPath.getValue(r,s):this._dspPath.setValue(r,s,i.textContent);document.createRange().selectNodeContents(i);getSelection().removeAllRanges();i.contentEditable="false";i.style.cursor="";this.allowDragging=this._prevDragState;this._edtNode=null;this.onNodeEditEnded(n)}return!0};Object.defineProperty(TreeView.prototype,"allowDragging",{get:function(){return null!=this._dd},set:function(e){if(e!=this.allowDragging){if(asBoolean(e))this._dd=new _TreeDragDropManager(this);else{this._dd.dispose();this._dd=null}for(var t=this.hostElement.querySelectorAll("."+TreeView._CND),i=0;i<t.length;i++){var n=t[i];setAttribute(n,"draggable",!!this._dd||null)}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"checkOnClick",{get:function(){return this._chkOnClick},set:function(e){this._chkOnClick=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"expandOnClick",{get:function(){return this._xpndOnClick},set:function(e){this._xpndOnClick=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"collapseOnClick",{get:function(){return this._collOnClick},set:function(e){this._collOnClick=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"expandOnLoad",{get:function(){return this._xpndOnLoad},set:function(e){this._xpndOnLoad=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedItem",{get:function(){return this._selNode?this._selNode.dataItem:null},set:function(e){if(e!=this.selectedItem){this._isDirty&&this.refresh();this.selectedNode=e?this.getNode(e):null}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedNode",{get:function(){return this._selNode},set:function(e){if(e!=this.selectedNode){this._prevSel=this._selNode;if(e)e.select();else if(this._selNode){var t=this._selNode.element;removeClass(t,TreeView._CSEL);setAttribute(t,"aria-selected",!1);this._selNode=null;this._updateFocus(this._prevSel);this.onSelectedItemChanged()}}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedPath",{get:function(){for(var e=[],t=this.selectedNode;t;t=t.parentNode){var i=this._dspPath.getValue(t.dataItem,t.level);e.splice(0,0,i)}return e},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"checkedItems",{get:function(){if(null==this._chkItems){var e=TreeView,t="."+e._CND+"."+e._CEMP+" > input:checked."+e._CNDC,i=this._root.querySelectorAll(t);this._chkItems=[];for(var n=0;n<i.length;n++){var r=i[n].parentElement[e._DATAITEM_KEY];this._chkItems.push(r)}}return this._chkItems},set:function(e){if(this.showCheckboxes){this._isDirty&&this.refresh();for(var t=TreeView,i="."+t._CND+"."+t._CEMP,n=this._root.querySelectorAll(i),r=0;r<n.length;r++){var s=new TreeNode(this,n[r]),o=e.indexOf(s.dataItem)>-1;s.isChecked!=o&&(s.isChecked=o)}}},enumerable:!0,configurable:!0});TreeView.prototype.checkAllItems=function(e){if(this.showCheckboxes)for(var t=TreeView,i="."+t._CND+"."+t._CEMP,n=this._root.querySelectorAll(i),r=0;r<n.length;r++){var s=new TreeNode(this,n[r]);s.isChecked!=e&&(s.isChecked=e)}};Object.defineProperty(TreeView.prototype,"totalItemCount",{get:function(){return this.hostElement.querySelectorAll("."+TreeView._CND).length},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"lazyLoadFunction",{get:function(){return this._lazyLoad},set:function(e){if(e!=this._lazyLoad){this._lazyLoad=asFunction(e);this._reload()}},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"preserveSelectedNode",{get:function(){return this._preserveSelNode},set:function(e){this._preserveSelNode=asBoolean(e,!1)},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"selectedNodes",{get:function(){return this._selNodes},enumerable:!0,configurable:!0});Object.defineProperty(TreeView.prototype,"allowMultiSelect",{get:function(){return this._allowMultiSelect},set:function(e){this._allowMultiSelect=asBoolean(e,!1);this._allowMultiSelect&&this.selectedNodes.forEach((function(e){addClass(e.element,TreeView._CMSEL)}))},enumerable:!0,configurable:!0});TreeView.prototype.getFirstNode=function(e,t){var i=this.hostElement.querySelector("."+TreeView._CND),n=i?new TreeNode(this,i):null;e&&n&&!n.element.offsetHeight&&(n=n.next(e,t));t&&n&&n.isDisabled&&(n=n.next(e,t));return n};TreeView.prototype.getLastNode=function(e,t){var i=this.hostElement.querySelectorAll("."+TreeView._CND+":last-child"),n=i.length?new TreeNode(this,i[i.length-1]):null;e&&n&&!n.element.offsetHeight&&(n=n.previous(e,t));t&&n&&n.isDisabled&&(n=n.previous(e,t));return n};Object.defineProperty(TreeView.prototype,"nodes",{get:function(){return TreeNode._getChildNodes(this,this._root)},enumerable:!0,configurable:!0});TreeView.prototype.getNode=function(e){this._isDirty&&this._loadTree();for(var t=this.hostElement.querySelectorAll("."+TreeView._CND),i=0;i<t.length;i++){var n=t[i];if(n[TreeView._DATAITEM_KEY]==e)return new TreeNode(this,n)}return null};TreeView.prototype.addChildNode=function(e,t){var i=this._createNode(t),n=this.nodes;n?e<n.length?i.move(n[e],DropPosition.Before):i.move(n[n.length-1],DropPosition.After):i.move(this,DropPosition.Into);return i};TreeView.prototype.collapseToLevel=function(e){var t=this._animated,i=this._autoColl;this._animated=this._autoColl=!1;this._collapseToLevel(this.nodes,e,0);this._animated=t;this._autoColl=i};TreeView.prototype.loadTree=function(e){this._loadTree(e)};TreeView.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)};TreeView.prototype.onLoadingItems=function(e){this.loadingItems.raise(this,e);return!e.cancel};TreeView.prototype.onLoadedItems=function(e){this.loadedItems.raise(this,e)};TreeView.prototype.onItemClicked=function(e){this.itemClicked.raise(this,e)};TreeView.prototype.onSelectedItemChanged=function(e){this.selectedItemChanged.raise(this,e)};TreeView.prototype.onCheckedItemsChanged=function(e){this._chkItems=null;this.checkedItemsChanged.raise(this,e)};TreeView.prototype.onIsCollapsedChanging=function(e){this.isCollapsedChanging.raise(this,e);return!e.cancel};TreeView.prototype.onIsCollapsedChanged=function(e){this.isCollapsedChanged.raise(this,e)};TreeView.prototype.onIsCheckedChanging=function(e){this.isCheckedChanging.raise(this,e);return!e.cancel};TreeView.prototype.onIsCheckedChanged=function(e){this.isCheckedChanged.raise(this,e)};TreeView.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};TreeView.prototype.onDragStart=function(e){this.dragStart.raise(this,e);return!e.cancel};TreeView.prototype.onDragOver=function(e){this.dragOver.raise(this,e);return!e.cancel};TreeView.prototype.onDrop=function(e){this.drop.raise(this,e);return!e.cancel};TreeView.prototype.onDragEnd=function(e){this.dragEnd.raise(this,e)};TreeView.prototype.onNodeEditStarting=function(e){this.nodeEditStarting.raise(this,e);return!e.cancel};TreeView.prototype.onNodeEditStarted=function(e){this.nodeEditStarted.raise(this,e)};TreeView.prototype.onNodeEditEnding=function(e){this.nodeEditEnding.raise(this,e);return!e.cancel};TreeView.prototype.onNodeEditEnded=function(e){this.nodeEditEnded.raise(this,e)};TreeView.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.isUpdating||!this._isDirty||this.disposed||this._loadTree(!0)};TreeView.prototype._updateFocus=function(e){this._updateTabIndex();if(this.containsFocus()){var t=this._selNode;t?t.element.focus():this.hostElement.focus()}e&&(e.element.tabIndex=-1)};TreeView.prototype._updateTabIndex=function(){var e=this._selNode;e&&(e.element.tabIndex=this._orgTabIndex);this.hostElement.tabIndex=e||this.isDisabled?-1:this._orgTabIndex};TreeView.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._updateTabIndex()};TreeView.prototype._raiseCheckedItemsChanged=function(){var e=this;this._toItemsChanged&&clearTimeout(this._toItemsChanged);this._toItemsChanged=setTimeout((function(){e._toItemsChanged=null;e.onCheckedItemsChanged()}),10)};TreeView.prototype._reload=function(){this._isDirty=!0;this.invalidate()};TreeView.prototype._createNode=function(e){var t=__assign({},this.options);this.formatItem&&(t.formatItem=this.formatItem.getHandler());return new TreeView(document.createElement("div"),__assign({},t,{expandOnLoad:this.expandOnLoad,allowDragging:this.allowDragging,lazyLoadFunction:this.lazyLoadFunction,childItemsPath:this.childItemsPath,displayMemberPath:this.displayMemberPath,imageMemberPath:this.imageMemberPath,isContentHtml:this.isContentHtml,showCheckboxes:this.showCheckboxes,itemsSource:[e]})).getFirstNode()};TreeView.prototype._getCollapseIconWidthBounds=function(e){var t=getComputedStyle(e,":before"),i=parseFloat(getComputedStyle(e).paddingLeft),n=0,r=0;if("auto"!==t.width)if("none"==t.transform){n=i;r=parseFloat(t.width)+i}else{var s=parseFloat(t.height),o=(parseFloat(t.width)-s)/2;n=i+o;r=parseFloat(t.height)+i+o}else;if(this.rightToLeft){var a=r-n;n=(r=e.clientWidth-n)-a}return{left:n,right:r}};TreeView.prototype._mousedown=function(e){if(!e.defaultPrevented){var t=closestClass(e.target,TreeView._CND),i=t?new TreeNode(this,t):null;if(i&&!i.isDisabled){var n=this._getCollapseIconWidthBounds(t),r=t==e.target&&e.offsetX>=n.left&&e.offsetX<=n.right;if(!this.preserveSelectedNode||!r)if((e.ctrlKey||e.metaKey)&&this.allowMultiSelect)i.isSelected?i.deSelect():i.select();else if(e.shiftKey&&this.allowMultiSelect){var s=this.selectedNode;s||(s=this._prevSel);if(s){for(var o=this._getNodesBetween(i.element,s.element),a=new Set(this.selectedNodes),l=o.length-1;l>=0;l--){var d=new TreeNode(this,o[l]);a.has(d)?a.delete(d):d.select(!0)}var h=s.equals(this.selectedNode)&&a.size>0;Array.from(a).forEach((function(e){e.deSelect(!0)}));s.select();h&&this.onSelectedItemChanged()}}else{i.isSelected?this._prevSel=i:this._clearMultiSelectedNodes();this.selectedNode=i;i.select()}}}};TreeView.prototype._getNodesBetween=function(e,t){var i=e,n=t;if(this._getOffsetFromRoot(i)>this._getOffsetFromRoot(t)){i=t;n=e}for(var r=[],s=this.hostElement.querySelectorAll("."+TreeView._CND),o=!1,a=s.length-1;a>=0;a--){var l=s[a];l==n&&(o=!0);o&&r.unshift(l);if(l==i)break}return r};TreeView.prototype._getOffsetFromRoot=function(e){for(var t=0;e!=this.hostElement;){t+=e.offsetTop;e=e.parentElement}return t};TreeView.prototype._checkCollapseIconClick=function(e){var t=this;if(!e.defaultPrevented){var i=closestClass(e.target,TreeView._CND),n=i?new TreeNode(this,i):null;if(n&&!n.isDisabled){var r=this._getCollapseIconWidthBounds(i),s=i==e.target&&e.offsetX>=r.left&&e.offsetX<=r.right;if(this.preserveSelectedNode&&s){(e.ctrlKey||e.metaKey)&&!n.hasPendingChildren?this.collapseToLevel(n.isCollapsed?n.level+1:n.level):n.isCollapsed=!n.isCollapsed;this.isAnimated?this._setFocusTimer=setTimeout((function(){t.focus()}),TreeView._AN_DLY+Control._ANIM_DEF_STEP):this.focus();e.preventDefault()}}}};TreeView.prototype._click=function(e){this._checkCollapseIconClick(e);if(!e.defaultPrevented){var t=closestClass(e.target,TreeView._CND);if(t){var i=new TreeNode(this,t),n="input."+TreeView._CNDC,r=closest(e.target,n),s=t.getBoundingClientRect(),o=this.rightToLeft?s.right-e.clientX:e.clientX-s.left;if(i.isDisabled)return;if(!r&&i.equals(this._edtNode))return;!r&&this._chkOnClick&&(!i.hasChildren||o>t.offsetHeight)&&(r=t.querySelector(n));var a=this._prevSel,l=(e.shiftKey||e.ctrlKey||e.metaKey)&&this.allowMultiSelect;if(!l){this.selectedNode=i;this._clearMultiSelectedNodes(!0)}t.focus();if(r){e.preventDefault();e.stopPropagation();this._updateCheckedTimer=setTimeout((function(){i.isChecked=!i.isChecked}))}if(!r){var d=(e.ctrlKey||e.metaKey)&&!i.hasPendingChildren,h=i.isCollapsed,c=!1;if(i.hasChildren)if(o<=t.offsetHeight){c=!0;d?this.collapseToLevel(h?i.level+1:i.level):i.isCollapsed=!h}else if(this.expandOnClick&&h){c=!0;d?this.collapseToLevel(i.level+1):i.isCollapsed=!1}else if(this.collapseOnClick&&!h){c=!0;d?this.collapseToLevel(i.level):i.isCollapsed=!0}c&&d&&this.selectedNode&&this.selectedNode.ensureVisible();if(!c&&!this.isReadOnly&&!l){var u=this.selectedNode;u&&u.equals(a)&&this.startEditing()}}this.selectedItem&&this.onItemClicked()}}};TreeView.prototype._keydown=function(e){if(!e.defaultPrevented){var t=this._getKeyCode(e),i=this._selNode,n=void 0,r=!0;if(!i)switch(t){case Key.Up:case Key.Down:case Key.Left:case Key.Right:case Key.Enter:case Key.Home:case Key.End:if(n=this.getFirstNode(!0,!0)){this.selectedNode=n;e.preventDefault();return}}if(i&&!i.isDisabled){switch(t){case Key.F2:this.startEditing();e.preventDefault();break;case Key.Escape:this.finishEditing(!0);e.preventDefault();break;case Key.Up:case Key.Down:this.finishEditing();break;case Key.Enter:if(this._edtNode){this.finishEditing();t=Key.Down}else{this.startEditing();e.preventDefault()}}if(this._edtNode)return;if(this.rightToLeft)switch(t){case Key.Left:t=Key.Right;break;case Key.Right:t=Key.Left}switch(t){case Key.Left:!i.isCollapsed&&i.hasChildren?i.isCollapsed=!0:(i=i.parentNode)&&i.select();break;case Key.Right:i.isCollapsed&&i.hasChildren&&(i.isCollapsed=!1);break;case Key.Up:n=i.previous(!0,!0);break;case Key.Down:n=i.next(!0,!0);break;case Key.Home:n=this.getFirstNode(!0,!0);break;case Key.End:n=this.getLastNode(!0,!0);break;case Key.Space:if(this.selectedItem){var s=i.checkBox;s&&(i.isChecked=s.indeterminate||!s.checked)}break;case Key.Enter:this.selectedItem&&this.onItemClicked();break;default:r=!1}if(r){e.preventDefault();e.shiftKey?n&&n.isSelected&&i.deSelect(!0):this._clearMultiSelectedNodes(!n);n&&n.select()}}}};TreeView.prototype._keypress=function(e){var t=this;if(!e.defaultPrevented){if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.target instanceof HTMLInputElement)return;if(this._edtNode)return;if(e.charCode>32&&this.startEditing(this.selectedNode)){var i=getActiveElement();if(contains(this._edtNode.element,i)){i.textContent=String.fromCharCode(e.charCode);e.preventDefault();var n=document.createRange();n.selectNodeContents(i);n.collapse(!1);var r=getSelection();r.removeAllRanges();r.addRange(n)}return}if(e.charCode>32||32==e.charCode&&this._srch){e.preventDefault();this._srch+=String.fromCharCode(e.charCode).toLowerCase();this._toSrch&&clearTimeout(this._toSrch);this._toSrch=setTimeout((function(){t._toSrch=null;t._srch=""}),TreeView._AS_DLY);var s=this._findNext();if(null==s&&this._srch.length>1){this._srch=this._srch[this._srch.length-1];s=this._findNext()}null!=s&&(this.selectedItem=s)}}};TreeView.prototype._findNext=function(){if(this.hostElement&&this.selectedItem){var e=this.getNode(this.selectedItem),t=e,i=!1,n=!1;1==this._srch.length&&(n=!0);for(;t;){if(!t.isDisabled&&!n){if(0==t.element.textContent.trim().toLowerCase().indexOf(this._srch))return t.dataItem}var r=t.next(!0,!0);if(r==e&&i)break;if(!r&&!i){r=this.getFirstNode(!0,!0);i=!0}t=r;n=!1}}return null};TreeView.prototype._loadTree=function(e){var t=this,i=this._root;if(i){if(!this.onLoadingItems(new CancelEventArgs))return;var n=this.containsFocus(),r=this._srcChanged;this._isDirty=!1;this._srcChanged=!1;var s=this.selectedItem;this.selectedItem=null;var o=[];if(this.allowMultiSelect){this.selectedNodes.forEach((function(e){o.push(e.dataItem)}));this.selectedNodes.beginUpdate();this.selectedNodes.clear();this.selectedNodes.endUpdate(!0)}this._chkItems=null;this._ldLvl=-1;var a=void 0;if(e&&isFunction(window.Map)&&!r&&this.nodes.length>0){a=new Map;for(var l=this.hostElement.querySelectorAll("."+TreeView._CND),d=0;d<l.length;d++){var h=l[d];hasClass(h,TreeView._CCLD)&&a.set(h[TreeView._DATAITEM_KEY],!0)}}i.innerHTML="";this._items&&this._items.forEach((function(e){t._addItem(i,0,e)}));if(a)for(l=this.hostElement.querySelectorAll("."+TreeView._CND),d=0;d<l.length;d++){h=l[d];var c=TreeNode._isNodeList(h.nextElementSibling),u=!TreeNode._isEmpty(h),p=a.get(h[TreeView._DATAITEM_KEY]);u&&(p||c)&&toggleClass(h,TreeView._CCLD,1==p);setAttribute(h,"aria-expanded",u?(!hasClass(h,TreeView._CCLD)).toString():null)}n&&!this.containsFocus()&&this.focus();this.allowMultiSelect&&o.forEach((function(e){var i=t.getNode(e);i&&i.select(!0)}));this.selectedItem=s;this.onLoadedItems();this._ldLvl=-1;this._srcChanged=!1}};TreeView.prototype._addItem=function(e,t,i){var n,r=this._dspPath.getValue(i,t),s=this._imgPath.getValue(i,t),o=asArray(this._itmPath.getValue(i,t),!0),a=document.createElement("div");addClass(a,TreeView._CND);a.tabIndex=-1;setAttribute(a,"role","treeitem",!0);setAttribute(a,"aria-selected",!1);var l=document.createElement("span");this.isContentHtml?l.innerHTML=r:l.textContent=r;addClass(l,TreeView._CNDT);a.appendChild(l);if(s){var d=document.createElement("img");d.src=s;a.insertBefore(d,a.firstChild)}if(this._showChk&&!this._lazyLoad){(n=document.createElement("input")).type="checkbox";n.tabIndex=-1;addClass(n,TreeView._CNDC);a.insertBefore(n,a.firstChild)}this._dd&&a.setAttribute("draggable","true");e.appendChild(a);a[TreeView._DATAITEM_KEY]=i;o&&0==o.length&&!this.lazyLoadFunction&&(o=null);if(o){var h=this.expandOnLoad;if(t>this._ldLvl&&h){this._ldLvl=t;if(0==o.length){h=!1;addClass(a,TreeView._CCLD)}}else{h=!1;addClass(a,TreeView._CCLD);t<this._ldLvl&&(this._ldLvl=100)}if(o.length>0){var c=document.createElement("div");c.tabIndex=-1;addClass(c,TreeView._CNDL);for(var u=0;u<o.length;u++)this._addItem(c,t+1,o[u]);e.appendChild(c);setAttribute(c,"role","group",!0)}setAttribute(a,"aria-expanded",h.toString(),!0)}else addClass(a,TreeView._CEMP);if(n&&this.checkedMemberPath)if(o&&o.length){new TreeNode(this,a)._updateCheckedState()}else n.checked=this._chkPath.getValue(i,t);this.formatItem.hasHandlers&&this.onFormatItem(new FormatNodeEventArgs(i,a,t))};TreeView.prototype._collapseToLevel=function(e,t,i){for(var n=0;n<e.length;n++){var r=e[n];if(!r.hasPendingChildren){r.isCollapsed=i>=t;r.hasChildren&&this._collapseToLevel(r.nodes,t,i+1)}}};TreeView.prototype._lazyLoadNode=function(e){var t=this.hostElement;if(!hasClass(t,TreeView._CLDG)){addClass(t,TreeView._CLDG);addClass(e.element,TreeView._CLDG);this.lazyLoadFunction(e,this._lazyLoadCallback.bind(e))}};TreeView.prototype._lazyLoadCallback=function(e){this.treeView._lazyLoadNodeDone(this,e)};TreeView.prototype._lazyLoadNodeDone=function(e,t){var i=TreeView;removeClass(e.element,i._CLDG);removeClass(this.hostElement,i._CLDG);var n=e.dataItem,r=e.level,s=asArray(t,!0);if(null==s||0==s.length){this._itmPath.setValue(n,r,null);addClass(e.element,i._CEMP);removeClass(e.element,i._CCLD)}else if(s.length){this._itmPath.setValue(n,r,s);var o=document.createElement("div"),a=e.element;addClass(o,i._CNDL);a.parentElement.insertBefore(o,a.nextSibling);for(var l=0;l<s.length;l++)this._addItem(o,r+1,s[l]);e.isCollapsed=!1}};TreeView.prototype.isTxtSelected=function(e){var t=window.getSelection();return t.anchorNode===e&&t.toString().length>0};TreeView.prototype._clearMultiSelectedNodes=function(e){void 0===e&&(e=!1);for(var t=this._selNodes.length-1;t>=0;t--)e&&this._selNodes[t]==this.selectedNode||this._selNodes[t].deSelect(!0)};TreeView.prototype.dispose=function(){if(this._toSrch){clearTimeout(this._toSrch);this._toSrch=null}if(this._toItemsChanged){clearTimeout(this._toItemsChanged);this._toItemsChanged=null}if(this._updateCheckedTimer){clearTimeout(this._updateCheckedTimer);this._updateCheckedTimer=null}if(this._setFocusTimer){clearTimeout(this._setFocusTimer);this._setFocusTimer=null}if(this._dd){this._dd.dispose();this._dd=null}this._prevSel=null;if(this._edtNode){var t=this._edtNode.element.querySelector("."+TreeView._CNDT);t&&delete t.contentEditable;this._edtNode=null}this._chkItems=null;this._lazyLoad=null;this._items=null;this.options=null;this._itmPath=null;this._chkPath=null;this._dspPath=null;this._imgPath=null;if(this._selNodes&&this._selNodes.length>0){this._selNodes.forEach((function(e){e.dispose()}));this._selNodes=null}this.nodes&&this.nodes.length>0&&this.nodes.forEach((function(e){e.dispose()}));this.formatItem&&this.formatItem.hasHandlers&&this.formatItem.removeAllHandlers();this._selNodes&&this._selNodes.collectionChanged&&this._selNodes.collectionChanged.removeAllHandlers();var i=this.hostElement;if(i){i.querySelectorAll("."+TreeView._CND).forEach((function(e){e[TreeView._DATAITEM_KEY]&&delete e[TreeView._DATAITEM_KEY];e[TreeNode.CacheKey]&&delete e[TreeNode.CacheKey]}));i.querySelectorAll("."+TreeView._CLDG).forEach((function(e){removeClass(e,TreeView._CLDG)}))}if(this._root){this._root.innerHTML="";this._root=null}this._srch="";e.prototype.dispose.call(this)};TreeView._DATAITEM_KEY="wj-Data-Item";TreeView._AS_DLY=600;TreeView._AN_DLY=200;TreeView._CND=TreeViewClsNames.node;TreeView._CNDL=TreeViewClsNames.nodeList;TreeView._CEMP=ControlStateClsNames.empty;TreeView._CNDT=TreeViewClsNames.nodeText;TreeView._CNDC=TreeViewClsNames.nodeCheck;TreeView._CSEL=ControlStateClsNames.selected;TreeView._CMSEL=ControlStateClsNames.multiSelected;TreeView._CCLD=ControlStateClsNames.collapsed;TreeView._CCLG=ControlStateClsNames.collapsing;TreeView._CLDG=ControlStateClsNames.loading;TreeView._ctrlTemplate="";return TreeView}(Control);export{TreeView};var _TreeDragDropManager=function(){function _TreeDragDropManager(e){this._tree=asType(e,TreeView);this._dragstartBnd=this._dragstart.bind(this);this._dragoverBnd=this._dragover.bind(this);this._dropBnd=this._drop.bind(this);this._dragendBnd=this._dragend.bind(this);_TreeDragDropManager._activeTreeCount++;var t=this._tree,i=t.hostElement;t.addEventListener(i,"dragstart",this._dragstartBnd);t.addEventListener(i,"dragover",this._dragoverBnd);t.addEventListener(i,"dragleave",this._dragoverBnd);t.addEventListener(i,"drop",this._dropBnd);t.addEventListener(i,"dragend",this._dragendBnd);t.addEventListener(i,"keydown",this._keydown)}_TreeDragDropManager.prototype.dispose=function(){_TreeDragDropManager._activeTreeCount--;if(0===_TreeDragDropManager._activeTreeCount){removeChild(_TreeDragDropManager._dMarker);_TreeDragDropManager._markerInstance=null;if(_TreeDragDropManager._drgSrc){_TreeDragDropManager._drgSrc.dispose();_TreeDragDropManager._drgSrc=null}}};_TreeDragDropManager.prototype._dragstart=function(e){if(!e.defaultPrevented){var t=this._tree,i=closestClass(e.target,TreeView._CND),n=_TreeDragDropManager;n._drgSrc=TreeNode._isNode(i)?new TreeNode(t,i):null;if(n._drgSrc){var r=new TreeNodeEventArgs(n._drgSrc);t.onDragStart(r)||(n._drgSrc=null)}if(n._drgSrc&&e.dataTransfer){_startDrag(e.dataTransfer,"copyMove");e.stopPropagation()}else e.preventDefault()}};_TreeDragDropManager.prototype._removeDragFeedback=function(){document.body.querySelectorAll("."+_TreeDragDropManager.CLS_DRAG_FEEDBACK).forEach((function(e){e.remove()}))};_TreeDragDropManager.prototype._dragover=function(e){this._handleDragDrop(e,!1)};_TreeDragDropManager.prototype._drop=function(e){this._handleDragDrop(e,!0)};_TreeDragDropManager.prototype._dragend=function(e){_TreeDragDropManager._drgSrc=null;this._showDragMarker();this._removeDragFeedback();this._tree.onDragEnd()};_TreeDragDropManager.prototype._keydown=function(e){e.defaultPrevented||e.keyCode==Key.Escape&&this._dragendBnd(null)};Object.defineProperty(_TreeDragDropManager,"_dMarker",{get:function(){_TreeDragDropManager._markerInstance||(_TreeDragDropManager._markerInstance="undefined"!=typeof window?createElement('<div class="'+TreeViewClsNames.marker+'"> </div>'):null);return _TreeDragDropManager._markerInstance},enumerable:!0,configurable:!0});_TreeDragDropManager.prototype._handleDragDrop=function(e,t){var i,n,r=this._tree,s=_TreeDragDropManager,o=DropPosition,a=o.Into;if(!e.defaultPrevented&&s._drgSrc){var l=document.elementFromPoint(e.clientX,e.clientY),d=closestClass(l,TreeView._CND);if(null==d){var h=Control.getControl(closest(l,"."+TreeViewClsNames.hostElement));h instanceof TreeView&&0==h.totalItemCount&&(d=h.hostElement)}d==s._drgSrc.element&&(d=null);if(d&&r.allowMultiSelect&&TreeNode._isNode(d)&&r.hostElement.contains(s._drgSrc.element)){var c=new TreeNode(r,d);if(c.isSelected)d=null;else for(var u=r.selectedNodes.length-1;u>=0;u--){var p=r.selectedNodes[u];if(p.hasChildren&&p._contains(c)){d=null;break}}}if(d){n=d.getBoundingClientRect();var _=new TreeNode(r,d),f=_.hasPendingChildren?n.height/2:n.height/3;if(null==_.element){(n=Rect.fromBoundingRect(n)).inflate(-12,-12);a=o.Before}else if(e.clientY<n.top+f)a=o.Before;else if(e.clientY>n.bottom-f||_.hasPendingChildren){a=o.After;if(_.hasChildren&&!_.isCollapsed&&!_.hasPendingChildren){a=o.Before;n=(d=(_=_.next(!0,!1)).element).getBoundingClientRect()}}if(s._drgSrc._contains(_))d=null;else{(i=new TreeNodeDragDropEventArgs(s._drgSrc,_,a)).cancel=s._drgSrc.treeView!=_.treeView;r.onDragOver(i)||(d=null)}}if(d)if((a=i.position)==o.Before){var g=i.dragSource.next(!0,!1);g&&g.element==d&&(d=null)}else if(a==o.After){var m=i.dragSource.previous(!0,!1);m&&m.element==d&&(d=null)}if(d&&!t){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation();this._showDragMarker(n,a)}else this._showDragMarker();if(d&&t&&r.onDrop(i)){r.hostElement.focus();if(r.allowMultiSelect){var C=this._getTopLevelSelectedNodes(),b=i.dragSource.treeView,T=i.dropTarget.treeView;i.position==DropPosition.After&&C.reverse();C.forEach((function(e){e.move(i.dropTarget,i.position)}));if(b!=T){b.selectedNodes.clear();b.selectedNode=null;C.forEach((function(e){e.select()}))}}else{var v=i.dragSource;v.move(i.dropTarget,i.position);v.ensureVisible();v.select()}}}};_TreeDragDropManager.prototype._getTopLevelSelectedNodes=function(){var e=_TreeDragDropManager._drgSrc.treeView,t=[];e.hostElement.querySelectorAll("."+TreeView._CMSEL+" , ."+TreeView._CSEL).forEach((function(i){var n=new TreeNode(e,i);(function(e,t){if(!t)return!1;for(var i=0;i<t.length;i++)if(t[i]._contains(e))return!0;return!1})(n,t)||t.push(n)}));return t};_TreeDragDropManager.prototype._showDragMarker=function(e,t){var i=this._tree,n=_TreeDragDropManager._dMarker.parentElement;if(e){var r=i.hostElement.getBoundingClientRect(),s=t==DropPosition.After?e.bottom:e.top,o={top:Math.round(s-r.top+i.hostElement.scrollTop-2),width:"75%",height:t==DropPosition.Into?e.height:0,opacity:t==DropPosition.Into?"0.15":""};toggleClass(_TreeDragDropManager._dMarker,TreeViewClsNames.lineMarker,t!==DropPosition.Into);i.rightToLeft?o.right=Math.round(r.right-e.right):o.left=Math.round(e.left-r.left);setCss(_TreeDragDropManager._dMarker,o);n!=i._root&&i._root.appendChild(_TreeDragDropManager._dMarker)}else n&&n.removeChild(_TreeDragDropManager._dMarker)};_TreeDragDropManager.CLS_DRAG_FEEDBACK=TreeViewClsNames.dragFeedback;_TreeDragDropManager.CLS_DRAG_ITEMCOUNT=TreeViewClsNames.dragItemCount;_TreeDragDropManager.CLS_DRAG_ITEMCOUNT_LARGE=TreeViewClsNames.largerDragItemCount;_TreeDragDropManager._activeTreeCount=0;return _TreeDragDropManager}();export{_TreeDragDropManager};_registerModule("wijmo.nav",selfModule);
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260105.t014601
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -1412,7 +1412,7 @@ export declare class TreeView extends Control {
|
|
|
1412
1412
|
*
|
|
1413
1413
|
* @param e {@link TreeNodeEventArgs} that contains the event data.
|
|
1414
1414
|
* @return True if the event was not canceled.
|
|
1415
|
-
|
|
1415
|
+
*/
|
|
1416
1416
|
onNodeEditStarting(e: TreeNodeEventArgs): boolean;
|
|
1417
1417
|
/**
|
|
1418
1418
|
* Occurs after a {@link TreeNode} has entered edit mode.
|
|
@@ -1440,10 +1440,10 @@ export declare class TreeView extends Control {
|
|
|
1440
1440
|
*/
|
|
1441
1441
|
readonly nodeEditEnded: Event<TreeView, TreeNodeEventArgs>;
|
|
1442
1442
|
/**
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1443
|
+
* Raises the {@link nodeEditEnded} event.
|
|
1444
|
+
*
|
|
1445
|
+
* @param e {@link TreeNodeEventArgs} that contains the event data.
|
|
1446
|
+
*/
|
|
1447
1447
|
onNodeEditEnded(e: TreeNodeEventArgs): void;
|
|
1448
1448
|
/**
|
|
1449
1449
|
* Overridden to re-populate the tree.
|
|
@@ -1475,8 +1475,8 @@ export declare class TreeView extends Control {
|
|
|
1475
1475
|
private isTxtSelected;
|
|
1476
1476
|
_clearMultiSelectedNodes(preserveCurrentNode?: boolean): void;
|
|
1477
1477
|
/**
|
|
1478
|
-
|
|
1479
|
-
|
|
1478
|
+
* Disposes of the control and all its resources.
|
|
1479
|
+
*/
|
|
1480
1480
|
dispose(): void;
|
|
1481
1481
|
}
|
|
1482
1482
|
/**
|