UNPKG

@circlon/angular-tree-component

Version:
1 lines 63.3 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("mobx")):"function"==typeof define&&define.amd?define("@circlon/angular-tree-component",["exports","@angular/core","@angular/common","mobx"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).circlon=e.circlon||{},e.circlon["angular-tree-component"]={}),e.ng.core,e.ng.common,e.mobx)}(this,(function(e,t,n,o){"use strict";var i=function(){function e(e,t){this.templateRef=e,this.viewContainer=t,this.templateBindings={}}return e.prototype.ngOnInit=function(){this.view=this.viewContainer.createEmbeddedView(this.templateRef),this.dispose&&this.dispose(),this.shouldDetach()&&this.view.detach(),this.autoDetect(this.view)},e.prototype.shouldDetach=function(){return this.treeMobxAutorun&&this.treeMobxAutorun.detach},e.prototype.autoDetect=function(e){this.dispose=o.autorun((function(){return e.detectChanges()}))},e.prototype.ngOnDestroy=function(){this.dispose&&this.dispose()},e}();i.decorators=[{type:t.Directive,args:[{selector:"[treeMobxAutorun]"}]}],i.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},i.propDecorators={treeMobxAutorun:[{type:t.Input}]};var r,s={LEFT:37,UP:38,RIGHT:39,DOWN:40,ENTER:13,SPACE:32,CONTEXT_MENU:32},d={TOGGLE_ACTIVE:function(e,t,n){return t&&t.toggleActivated()},TOGGLE_ACTIVE_MULTI:function(e,t,n){return t&&t.toggleActivated(!0)},TOGGLE_SELECTED:function(e,t,n){return t&&t.toggleSelected()},ACTIVATE:function(e,t,n){return t.setIsActive(!0)},DEACTIVATE:function(e,t,n){return t.setIsActive(!1)},SELECT:function(e,t,n){return t.setIsSelected(!0)},DESELECT:function(e,t,n){return t.setIsSelected(!1)},FOCUS:function(e,t,n){return t.focus()},TOGGLE_EXPANDED:function(e,t,n){return t.hasChildren&&t.toggleExpanded()},EXPAND:function(e,t,n){return t.expand()},COLLAPSE:function(e,t,n){return t.collapse()},DRILL_DOWN:function(e,t,n){return e.focusDrillDown()},DRILL_UP:function(e,t,n){return e.focusDrillUp()},NEXT_NODE:function(e,t,n){return e.focusNextNode()},PREVIOUS_NODE:function(e,t,n){return e.focusPreviousNode()},MOVE_NODE:function(e,t,n,o){var i=o.from,r=o.to;n.ctrlKey?e.copyNode(i,r):e.moveNode(i,r)}},a={mouse:{click:d.TOGGLE_ACTIVE,dblClick:null,contextMenu:null,expanderClick:d.TOGGLE_EXPANDED,checkboxClick:d.TOGGLE_SELECTED,drop:d.MOVE_NODE},keys:(r={},r[s.RIGHT]=d.DRILL_DOWN,r[s.LEFT]=d.DRILL_UP,r[s.DOWN]=d.NEXT_NODE,r[s.UP]=d.PREVIOUS_NODE,r[s.SPACE]=d.TOGGLE_ACTIVE,r[s.ENTER]=d.TOGGLE_ACTIVE,r)},l=function(){function e(e){var t,n,o,i,r,l,p,c,u,h,g,f,v,y,m,b,N,E,O,D,I,C,x,w,j,A,S,P,T,M,F,_,R,L,k,H,V,B,G,$,U,W,X,Y,K,Z,z,q,J,Q,ee,te,ne,oe,ie,re,se,de,ae,le,pe;void 0===e&&(e={}),this.options=e,this.actionMapping={mouse:{click:null!==(r=null===(i=null===(o=null===(n=this.options)||void 0===n?void 0:n.actionMapping)||void 0===o?void 0:o.mouse)||void 0===i?void 0:i.click)&&void 0!==r?r:a.mouse.click,dblClick:null!==(u=null===(c=null===(p=null===(l=this.options)||void 0===l?void 0:l.actionMapping)||void 0===p?void 0:p.mouse)||void 0===c?void 0:c.dblClick)&&void 0!==u?u:a.mouse.dblClick,contextMenu:null!==(v=null===(f=null===(g=null===(h=this.options)||void 0===h?void 0:h.actionMapping)||void 0===g?void 0:g.mouse)||void 0===f?void 0:f.contextMenu)&&void 0!==v?v:a.mouse.contextMenu,expanderClick:null!==(N=null===(b=null===(m=null===(y=this.options)||void 0===y?void 0:y.actionMapping)||void 0===m?void 0:m.mouse)||void 0===b?void 0:b.expanderClick)&&void 0!==N?N:a.mouse.expanderClick,checkboxClick:null!==(I=null===(D=null===(O=null===(E=this.options)||void 0===E?void 0:E.actionMapping)||void 0===O?void 0:O.mouse)||void 0===D?void 0:D.checkboxClick)&&void 0!==I?I:a.mouse.checkboxClick,drop:null!==(j=null===(w=null===(x=null===(C=this.options)||void 0===C?void 0:C.actionMapping)||void 0===x?void 0:x.mouse)||void 0===w?void 0:w.drop)&&void 0!==j?j:a.mouse.drop,dragStart:null!==(T=null===(P=null===(S=null===(A=this.options)||void 0===A?void 0:A.actionMapping)||void 0===S?void 0:S.mouse)||void 0===P?void 0:P.dragStart)&&void 0!==T?T:void 0,drag:null!==(R=null===(_=null===(F=null===(M=this.options)||void 0===M?void 0:M.actionMapping)||void 0===F?void 0:F.mouse)||void 0===_?void 0:_.drag)&&void 0!==R?R:void 0,dragEnd:null!==(V=null===(H=null===(k=null===(L=this.options)||void 0===L?void 0:L.actionMapping)||void 0===k?void 0:k.mouse)||void 0===H?void 0:H.dragEnd)&&void 0!==V?V:void 0,dragOver:null!==(U=null===($=null===(G=null===(B=this.options)||void 0===B?void 0:B.actionMapping)||void 0===G?void 0:G.mouse)||void 0===$?void 0:$.dragOver)&&void 0!==U?U:void 0,dragLeave:null!==(K=null===(Y=null===(X=null===(W=this.options)||void 0===W?void 0:W.actionMapping)||void 0===X?void 0:X.mouse)||void 0===Y?void 0:Y.dragLeave)&&void 0!==K?K:void 0,dragEnter:null!==(J=null===(q=null===(z=null===(Z=this.options)||void 0===Z?void 0:Z.actionMapping)||void 0===z?void 0:z.mouse)||void 0===q?void 0:q.dragEnter)&&void 0!==J?J:void 0,mouseOver:null!==(ne=null===(te=null===(ee=null===(Q=this.options)||void 0===Q?void 0:Q.actionMapping)||void 0===ee?void 0:ee.mouse)||void 0===te?void 0:te.mouseOver)&&void 0!==ne?ne:void 0,mouseOut:null!==(se=null===(re=null===(ie=null===(oe=this.options)||void 0===oe?void 0:oe.actionMapping)||void 0===ie?void 0:ie.mouse)||void 0===re?void 0:re.mouseOut)&&void 0!==se?se:void 0},keys:(t={},t[s.RIGHT]=d.DRILL_DOWN,t[s.LEFT]=d.DRILL_UP,t[s.DOWN]=d.NEXT_NODE,t[s.UP]=d.PREVIOUS_NODE,t[s.SPACE]=d.TOGGLE_ACTIVE,t[s.ENTER]=d.TOGGLE_ACTIVE,t)},(null===(ae=null===(de=this.options)||void 0===de?void 0:de.actionMapping)||void 0===ae?void 0:ae.keys)&&(this.actionMapping.keys=Object.assign(Object.assign({},this.actionMapping.keys),this.options.actionMapping.keys)),e.rtl&&(this.actionMapping.keys[s.RIGHT]=(null===(le=e.actionMapping)||void 0===le?void 0:le.keys[s.RIGHT])||d.DRILL_UP,this.actionMapping.keys[s.LEFT]=(null===(pe=e.actionMapping)||void 0===pe?void 0:pe.keys[s.LEFT])||d.DRILL_DOWN)}return Object.defineProperty(e.prototype,"hasChildrenField",{get:function(){return this.options.hasChildrenField||"hasChildren"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childrenField",{get:function(){return this.options.childrenField||"children"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayField",{get:function(){return this.options.displayField||"name"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idField",{get:function(){return this.options.idField||"id"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isExpandedField",{get:function(){return this.options.isExpandedField||"isExpanded"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getChildren",{get:function(){return this.options.getChildren},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"levelPadding",{get:function(){return this.options.levelPadding||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useVirtualScroll",{get:function(){return this.options.useVirtualScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animateExpand",{get:function(){return this.options.animateExpand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animateSpeed",{get:function(){return this.options.animateSpeed||1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animateAcceleration",{get:function(){return this.options.animateAcceleration||1.2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollOnActivate",{get:function(){return void 0===this.options.scrollOnActivate||this.options.scrollOnActivate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtl",{get:function(){return!!this.options.rtl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootId",{get:function(){return this.options.rootId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useCheckbox",{get:function(){return this.options.useCheckbox},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useTriState",{get:function(){return void 0===this.options.useTriState||this.options.useTriState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollContainer",{get:function(){return this.options.scrollContainer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allowDragoverStyling",{get:function(){return void 0===this.options.allowDragoverStyling||this.options.allowDragoverStyling},enumerable:!1,configurable:!0}),e.prototype.getNodeClone=function(e){if(this.options.getNodeClone)return this.options.getNodeClone(e);var t=Object.assign({},e.data);return t.id&&delete t.id,t},e.prototype.allowDrop=function(e,t,n){return this.options.allowDrop instanceof Function?this.options.allowDrop(e,t,n):void 0===this.options.allowDrop||this.options.allowDrop},e.prototype.allowDrag=function(e){return this.options.allowDrag instanceof Function?this.options.allowDrag(e):this.options.allowDrag},e.prototype.nodeClass=function(e){return this.options.nodeClass?this.options.nodeClass(e):""},e.prototype.nodeHeight=function(e){if(e.data.virtual)return 0;var t=this.options.nodeHeight||22;return"function"==typeof t&&(t=t(e)),t+(0===e.index?2:1)*this.dropSlotHeight},Object.defineProperty(e.prototype,"dropSlotHeight",{get:function(){return"number"==typeof this.options.dropSlotHeight?this.options.dropSlotHeight:2},enumerable:!1,configurable:!0}),e}();Object.create;function p(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,r=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function u(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e}Object.create;var h={toggleExpanded:"toggleExpanded",activate:"activate",deactivate:"deactivate",nodeActivate:"nodeActivate",nodeDeactivate:"nodeDeactivate",select:"select",deselect:"deselect",focus:"focus",blur:"blur",initialized:"initialized",updateData:"updateData",moveNode:"moveNode",copyNode:"copyNode",event:"event",loadNodeChildren:"loadNodeChildren",changeFilter:"changeFilter",stateChange:"stateChange"},g=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},f=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},v=function(){function e(e,t,n,o){var i=this;this.data=e,this.parent=t,this.treeModel=n,this.position=0,this.allowDrop=function(e,t){return i.options.allowDrop(e,{parent:i,index:0},t)},this.allowDragoverStyling=function(){return i.options.allowDragoverStyling},void 0!==this.id&&null!==this.id||(this.id=Math.floor(1e13*Math.random())),this.index=o,this.getField("children")&&this._initChildren(),this.autoLoadChildren()}return Object.defineProperty(e.prototype,"isHidden",{get:function(){return this.treeModel.isHidden(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isExpanded",{get:function(){return this.treeModel.isExpanded(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActive",{get:function(){return this.treeModel.isActive(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFocused",{get:function(){return this.treeModel.isNodeFocused(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSelected",{get:function(){return this.isSelectable()?this.treeModel.isSelected(this):this.children.some((function(e){return e.isSelected}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAllSelected",{get:function(){return this.isSelectable()?this.treeModel.isSelected(this):this.children.every((function(e){return e.isAllSelected}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPartiallySelected",{get:function(){return this.isSelected&&!this.isAllSelected},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this.parent?this.parent.level+1:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.parent?u(this.parent.path,[this.id]):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elementRef",{get:function(){throw"Element Ref is no longer supported since introducing virtual scroll\n\n You may use a template to obtain a reference to the element"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalNode",{get:function(){return this._originalNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChildren",{get:function(){return!!(this.getField("hasChildren")||this.children&&this.children.length>0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCollapsed",{get:function(){return!this.isExpanded},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLeaf",{get:function(){return!this.hasChildren},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRoot",{get:function(){return this.parent.data.virtual},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realParent",{get:function(){return this.isRoot?null:this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this.treeModel.options},enumerable:!1,configurable:!0}),e.prototype.fireEvent=function(e){this.treeModel.fireEvent(e)},Object.defineProperty(e.prototype,"displayField",{get:function(){return this.getField("display")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this.getField("id")},set:function(e){this.setField("id",e)},enumerable:!1,configurable:!0}),e.prototype.getField=function(e){return this.data[this.options[e+"Field"]]},e.prototype.setField=function(e,t){this.data[this.options[e+"Field"]]=t},e.prototype._findAdjacentSibling=function(e,t){void 0===t&&(t=!1);var n=this._getParentsChildren(t),o=n.indexOf(this);return n.length>o+e?n[o+e]:null},e.prototype.findNextSibling=function(e){return void 0===e&&(e=!1),this._findAdjacentSibling(1,e)},e.prototype.findPreviousSibling=function(e){return void 0===e&&(e=!1),this._findAdjacentSibling(-1,e)},e.prototype.getVisibleChildren=function(){return this.visibleChildren},Object.defineProperty(e.prototype,"visibleChildren",{get:function(){return(this.children||[]).filter((function(e){return!e.isHidden}))},enumerable:!1,configurable:!0}),e.prototype.getFirstChild=function(e){void 0===e&&(e=!1);var t=e?this.visibleChildren:this.children;return null!=t&&t.length?t[0]:null},e.prototype.getLastChild=function(e){void 0===e&&(e=!1);var t=e?this.visibleChildren:this.children;return null!=t&&t.length?t[t.length-1]:null},e.prototype.findNextNode=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!1),e&&this.isExpanded&&this.getFirstChild(t)||this.findNextSibling(t)||this.parent&&this.parent.findNextNode(!1,t)},e.prototype.findPreviousNode=function(e){void 0===e&&(e=!1);var t=this.findPreviousSibling(e);return t?t._getLastOpenDescendant(e):this.realParent},e.prototype._getLastOpenDescendant=function(e){void 0===e&&(e=!1);var t=this.getLastChild(e);return this.isCollapsed||!t?this:t._getLastOpenDescendant(e)},e.prototype._getParentsChildren=function(e){return void 0===e&&(e=!1),this.parent&&(e?this.parent.getVisibleChildren():this.parent.children)||[]},e.prototype.getIndexInParent=function(e){return void 0===e&&(e=!1),this._getParentsChildren(e).indexOf(this)},e.prototype.isDescendantOf=function(e){return this===e||this.parent&&this.parent.isDescendantOf(e)},e.prototype.getNodePadding=function(){return this.options.levelPadding*(this.level-1)+"px"},e.prototype.getClass=function(){return[this.options.nodeClass(this),"tree-node-level-"+this.level].join(" ")},e.prototype.onDrop=function(e){this.mouseAction("drop",e.event,{from:e.element,to:{parent:this,index:0,dropOnNode:!0}})},e.prototype.allowDrag=function(){return this.options.allowDrag(this)},e.prototype.loadNodeChildren=function(){var e=this;return this.options.getChildren?Promise.resolve(this.options.getChildren(this)).then((function(t){t&&(e.setField("children",t),e._initChildren(),e.options.useTriState&&e.treeModel.isSelected(e)&&e.setIsSelected(!0),e.children.forEach((function(e){e.getField("isExpanded")&&e.hasChildren&&e.expand()})))})).then((function(){e.fireEvent({eventName:h.loadNodeChildren,node:e})})):Promise.resolve()},e.prototype.expand=function(){return this.isExpanded||this.toggleExpanded(),this},e.prototype.collapse=function(){return this.isExpanded&&this.toggleExpanded(),this},e.prototype.doForAll=function(e){var t=this;Promise.resolve(e(this)).then((function(){t.children&&t.children.forEach((function(t){return t.doForAll(e)}))}))},e.prototype.expandAll=function(){this.doForAll((function(e){return e.expand()}))},e.prototype.collapseAll=function(){this.doForAll((function(e){return e.collapse()}))},e.prototype.ensureVisible=function(){return this.realParent&&(this.realParent.expand(),this.realParent.ensureVisible()),this},e.prototype.toggleExpanded=function(){return this.setIsExpanded(!this.isExpanded),this},e.prototype.setIsExpanded=function(e){return this.hasChildren&&this.treeModel.setExpandedNode(this,e),this},e.prototype.autoLoadChildren=function(){var e=this;this.handler=o.reaction((function(){return e.isExpanded}),(function(t){!e.children&&e.hasChildren&&t&&e.loadNodeChildren()}),{fireImmediately:!0})},e.prototype.dispose=function(){this.children&&this.children.forEach((function(e){return e.dispose()})),this.handler&&this.handler(),this.parent=null,this.children=null},e.prototype.setIsActive=function(e,t){return void 0===t&&(t=!1),this.treeModel.setActiveNode(this,e,t),e&&this.focus(this.options.scrollOnActivate),this},e.prototype.isSelectable=function(){return this.isLeaf||!this.children||!this.options.useTriState},e.prototype.setIsSelected=function(e){return this.isSelectable()?this.treeModel.setSelectedNode(this,e):this.visibleChildren.forEach((function(t){return t.setIsSelected(e)})),this},e.prototype.toggleSelected=function(){return this.setIsSelected(!this.isSelected),this},e.prototype.toggleActivated=function(e){return void 0===e&&(e=!1),this.setIsActive(!this.isActive,e),this},e.prototype.setActiveAndVisible=function(e){return void 0===e&&(e=!1),this.setIsActive(!0,e).ensureVisible(),setTimeout(this.scrollIntoView.bind(this)),this},e.prototype.scrollIntoView=function(e){void 0===e&&(e=!1),this.treeModel.virtualScroll.scrollIntoView(this,e)},e.prototype.focus=function(e){void 0===e&&(e=!0);var t=this.treeModel.getFocusedNode();return this.treeModel.setFocusedNode(this),e&&this.scrollIntoView(),t&&this.fireEvent({eventName:h.blur,node:t}),this.fireEvent({eventName:h.focus,node:this}),this},e.prototype.blur=function(){var e=this.treeModel.getFocusedNode();return this.treeModel.setFocusedNode(null),e&&this.fireEvent({eventName:h.blur,node:this}),this},e.prototype.setIsHidden=function(e){this.treeModel.setIsHidden(this,e)},e.prototype.hide=function(){this.setIsHidden(!0)},e.prototype.show=function(){this.setIsHidden(!1)},e.prototype.mouseAction=function(e,t,n){void 0===n&&(n=null),this.treeModel.setFocus(!0);var o=this.options.actionMapping.mouse[e];o&&o(this.treeModel,this,t,n)},e.prototype.getSelfHeight=function(){return this.options.nodeHeight(this)},e.prototype._initChildren=function(){var t=this;this.children=this.getField("children").map((function(n,o){return new e(n,t,t.treeModel,o)}))},e}();g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isHidden",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isExpanded",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isActive",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isFocused",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isSelected",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isAllSelected",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"isPartiallySelected",null),g([o.observable,f("design:type",Array)],v.prototype,"children",void 0),g([o.observable,f("design:type",Number)],v.prototype,"index",void 0),g([o.observable,f("design:type",Object)],v.prototype,"position",void 0),g([o.observable,f("design:type",Number)],v.prototype,"height",void 0),g([o.computed,f("design:type",Number),f("design:paramtypes",[])],v.prototype,"level",null),g([o.computed,f("design:type",Array),f("design:paramtypes",[])],v.prototype,"path",null),g([o.computed,f("design:type",Object),f("design:paramtypes",[])],v.prototype,"visibleChildren",null),g([o.action,f("design:type",Function),f("design:paramtypes",[Object]),f("design:returntype",void 0)],v.prototype,"setIsSelected",null),g([o.action,f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",void 0)],v.prototype,"_initChildren",null);var y=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},m=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},b=function(){function e(){this.options=new l,this.eventNames=Object.keys(h),this.expandedNodeIds={},this.selectedLeafNodeIds={},this.activeNodeIds={},this.hiddenNodeIds={},this.focusedNodeId=null,this.firstUpdate=!0,this.subscriptions=[]}return e.prototype.fireEvent=function(e){e.treeModel=this,this.events[e.eventName].emit(e),this.events.event.emit(e)},e.prototype.subscribe=function(e,t){var n=this.events[e].subscribe(t);this.subscriptions.push(n)},e.prototype.getFocusedNode=function(){return this.focusedNode},e.prototype.getActiveNode=function(){return this.activeNodes[0]},e.prototype.getActiveNodes=function(){return this.activeNodes},e.prototype.getVisibleRoots=function(){return this.virtualRoot.visibleChildren},e.prototype.getFirstRoot=function(e){void 0===e&&(e=!1);var t=e?this.getVisibleRoots():this.roots;return null!=t&&t.length?t[0]:null},e.prototype.getLastRoot=function(e){void 0===e&&(e=!1);var t=e?this.getVisibleRoots():this.roots;return null!=t&&t.length?t[t.length-1]:null},Object.defineProperty(e.prototype,"isFocused",{get:function(){return e.focusedTree===this},enumerable:!1,configurable:!0}),e.prototype.isNodeFocused=function(e){return this.focusedNode===e},e.prototype.isEmptyTree=function(){return this.roots&&0===this.roots.length},Object.defineProperty(e.prototype,"focusedNode",{get:function(){return this.focusedNodeId?this.getNodeById(this.focusedNodeId):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"expandedNodes",{get:function(){var e=this;return Object.keys(this.expandedNodeIds).filter((function(t){return e.expandedNodeIds[t]})).map((function(t){return e.getNodeById(t)})).filter(Boolean)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeNodes",{get:function(){var e=this;return Object.keys(this.activeNodeIds).filter((function(t){return e.activeNodeIds[t]})).map((function(t){return e.getNodeById(t)})).filter(Boolean)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hiddenNodes",{get:function(){var e=this;return Object.keys(this.hiddenNodeIds).filter((function(t){return e.hiddenNodeIds[t]})).map((function(t){return e.getNodeById(t)})).filter(Boolean)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedLeafNodes",{get:function(){var e=this;return Object.keys(this.selectedLeafNodeIds).filter((function(t){return e.selectedLeafNodeIds[t]})).map((function(t){return e.getNodeById(t)})).filter(Boolean)},enumerable:!1,configurable:!0}),e.prototype.getNodeByPath=function(e,t){if(void 0===t&&(t=null),!e)return null;if(t=t||this.virtualRoot,0===e.length)return t;if(!t.children)return null;var n=e.shift(),o=t.children.find((function(e){return e.id===n}));return o?this.getNodeByPath(e,o):null},e.prototype.getNodeById=function(e){var t=e.toString();return this.getNodeBy((function(e){return e.id.toString()===t}))},e.prototype.getNodeBy=function(e,t){var n,o;if(void 0===t&&(t=null),!(t=t||this.virtualRoot).children)return null;var i=t.children.find(e);if(i)return i;try{for(var r=p(t.children),s=r.next();!s.done;s=r.next()){var d=s.value,a=this.getNodeBy(e,d);if(a)return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=r.return)&&o.call(r)}finally{if(n)throw n.error}}},e.prototype.isExpanded=function(e){return this.expandedNodeIds[e.id]},e.prototype.isHidden=function(e){return this.hiddenNodeIds[e.id]},e.prototype.isActive=function(e){return this.activeNodeIds[e.id]},e.prototype.isSelected=function(e){return this.selectedLeafNodeIds[e.id]},e.prototype.ngOnDestroy=function(){this.dispose(),this.unsubscribeAll()},e.prototype.dispose=function(){this.virtualRoot&&this.virtualRoot.dispose()},e.prototype.unsubscribeAll=function(){this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions=[]},e.prototype.setData=function(e){var t=e.nodes,n=e.options,o=void 0===n?null:n,i=e.events,r=void 0===i?null:i;o&&(this.options=new l(o)),r&&(this.events=r),t&&(this.nodes=t),this.update()},e.prototype.update=function(){var e,t=((e={id:this.options.rootId,virtual:!0})[this.options.childrenField]=this.nodes,e);this.dispose(),this.virtualRoot=new v(t,null,this,0),this.roots=this.virtualRoot.children,this.firstUpdate?this.roots&&(this.firstUpdate=!1,this._calculateExpandedNodes()):this.fireEvent({eventName:h.updateData})},e.prototype.setFocusedNode=function(e){this.focusedNodeId=e?e.id:null},e.prototype.setFocus=function(t){e.focusedTree=t?this:null},e.prototype.doForAll=function(e){this.roots.forEach((function(t){return t.doForAll(e)}))},e.prototype.focusNextNode=function(){var e=this.getFocusedNode(),t=e?e.findNextNode(!0,!0):this.getFirstRoot(!0);t&&t.focus()},e.prototype.focusPreviousNode=function(){var e=this.getFocusedNode(),t=e?e.findPreviousNode(!0):this.getLastRoot(!0);t&&t.focus()},e.prototype.focusDrillDown=function(){var e=this.getFocusedNode();if(e&&e.isCollapsed&&e.hasChildren)e.toggleExpanded();else{var t=e?e.getFirstChild(!0):this.getFirstRoot(!0);t&&t.focus()}},e.prototype.focusDrillUp=function(){var e=this.getFocusedNode();if(e)if(e.isExpanded)e.toggleExpanded();else{var t=e.realParent;t&&t.focus()}},e.prototype.setActiveNode=function(e,t,n){void 0===n&&(n=!1),n?this._setActiveNodeMulti(e,t):this._setActiveNodeSingle(e,t),t?(e.focus(this.options.scrollOnActivate),this.fireEvent({eventName:h.activate,node:e}),this.fireEvent({eventName:h.nodeActivate,node:e})):(this.fireEvent({eventName:h.deactivate,node:e}),this.fireEvent({eventName:h.nodeDeactivate,node:e}))},e.prototype.setSelectedNode=function(e,t){var n;this.selectedLeafNodeIds=Object.assign({},this.selectedLeafNodeIds,((n={})[e.id]=t,n)),t?(e.focus(),this.fireEvent({eventName:h.select,node:e})):this.fireEvent({eventName:h.deselect,node:e})},e.prototype.setExpandedNode=function(e,t){var n;this.expandedNodeIds=Object.assign({},this.expandedNodeIds,((n={})[e.id]=t,n)),this.fireEvent({eventName:h.toggleExpanded,node:e,isExpanded:t})},e.prototype.expandAll=function(){this.roots.forEach((function(e){return e.expandAll()}))},e.prototype.collapseAll=function(){this.roots.forEach((function(e){return e.collapseAll()}))},e.prototype.setIsHidden=function(e,t){var n;this.hiddenNodeIds=Object.assign({},this.hiddenNodeIds,((n={})[e.id]=t,n))},e.prototype.setHiddenNodeIds=function(e){this.hiddenNodeIds=e.reduce((function(e,t){var n;return Object.assign(e,((n={})[t]=!0,n))}),{})},e.prototype.performKeyAction=function(e,t){var n=this.options.actionMapping.keys[t.keyCode];return!!n&&(t.preventDefault(),n(this,e,t),!0)},e.prototype.filterNodes=function(e,t){var n,o=this;if(void 0===t&&(t=!0),!e)return this.clearFilter();if(e&&"string"==typeof e.valueOf())n=function(t){return-1!==t.displayField.toLowerCase().indexOf(e.toLowerCase())};else{if(!e||"function"!=typeof e)return console.error("Don't know what to do with filter",e),void console.error("Should be either a string or function");n=e}var i={};this.roots.forEach((function(e){return o._filterNode(i,e,n,t)})),this.hiddenNodeIds=i,this.fireEvent({eventName:h.changeFilter})},e.prototype.clearFilter=function(){this.hiddenNodeIds={},this.fireEvent({eventName:h.changeFilter})},e.prototype.moveNode=function(e,t){var n=e.getIndexInParent(),o=e.parent;if(this.canMoveNode(e,t,n)){var i=o.getField("children");t.parent.getField("children")||t.parent.setField("children",[]);var r=t.parent.getField("children"),s=i.splice(n,1)[0],d=o===t.parent&&t.index>n?t.index-1:t.index;r.splice(d,0,s),o.treeModel.update(),t.parent.treeModel!==o.treeModel&&t.parent.treeModel.update(),this.fireEvent({eventName:h.moveNode,node:s,to:{parent:t.parent.data,index:d},from:{parent:o.data,index:n}})}},e.prototype.copyNode=function(e,t){var n=e.getIndexInParent();if(this.canMoveNode(e,t,n)){t.parent.getField("children")||t.parent.setField("children",[]);var o=t.parent.getField("children"),i=this.options.getNodeClone(e);o.splice(t.index,0,i),e.treeModel.update(),t.parent.treeModel!==e.treeModel&&t.parent.treeModel.update(),this.fireEvent({eventName:h.copyNode,node:i,to:{parent:t.parent.data,index:t.index}})}},e.prototype.getState=function(){return{expandedNodeIds:this.expandedNodeIds,selectedLeafNodeIds:this.selectedLeafNodeIds,activeNodeIds:this.activeNodeIds,hiddenNodeIds:this.hiddenNodeIds,focusedNodeId:this.focusedNodeId}},e.prototype.setState=function(e){e&&Object.assign(this,{expandedNodeIds:e.expandedNodeIds||{},selectedLeafNodeIds:e.selectedLeafNodeIds||{},activeNodeIds:e.activeNodeIds||{},hiddenNodeIds:e.hiddenNodeIds||{},focusedNodeId:e.focusedNodeId})},e.prototype.subscribeToState=function(e){var t=this;o.autorun((function(){return e(t.getState())}))},e.prototype.canMoveNode=function(e,t,n){void 0===n&&(n=void 0);n||e.getIndexInParent();return(e.parent!==t.parent||n!==t.index)&&!t.parent.isDescendantOf(e)},e.prototype.calculateExpandedNodes=function(){this._calculateExpandedNodes()},e.prototype._filterNode=function(e,t,n,o){var i=this,r=n(t);return t.children&&t.children.forEach((function(t){i._filterNode(e,t,n,o)&&(r=!0)})),r||(e[t.id]=!0),o&&r&&t.ensureVisible(),r},e.prototype._calculateExpandedNodes=function(e){var t,n=this;void 0===e&&(e=null),(e=e||this.virtualRoot).data[this.options.isExpandedField]&&(this.expandedNodeIds=Object.assign({},this.expandedNodeIds,((t={})[e.id]=!0,t))),e.children&&e.children.forEach((function(e){return n._calculateExpandedNodes(e)}))},e.prototype._setActiveNodeSingle=function(e,t){var n,o=this;this.activeNodes.filter((function(t){return t!==e})).forEach((function(e){o.fireEvent({eventName:h.deactivate,node:e}),o.fireEvent({eventName:h.nodeDeactivate,node:e})})),this.activeNodeIds=t?((n={})[e.id]=!0,n):{}},e.prototype._setActiveNodeMulti=function(e,t){var n;this.activeNodeIds=Object.assign({},this.activeNodeIds,((n={})[e.id]=t,n))},e}();b.focusedTree=null,b.decorators=[{type:t.Injectable}],y([o.observable,m("design:type",Array)],b.prototype,"roots",void 0),y([o.observable,m("design:type",Object)],b.prototype,"expandedNodeIds",void 0),y([o.observable,m("design:type",Object)],b.prototype,"selectedLeafNodeIds",void 0),y([o.observable,m("design:type",Object)],b.prototype,"activeNodeIds",void 0),y([o.observable,m("design:type",Object)],b.prototype,"hiddenNodeIds",void 0),y([o.observable,m("design:type",Object)],b.prototype,"focusedNodeId",void 0),y([o.observable,m("design:type",v)],b.prototype,"virtualRoot",void 0),y([o.computed,m("design:type",Object),m("design:paramtypes",[])],b.prototype,"focusedNode",null),y([o.computed,m("design:type",Object),m("design:paramtypes",[])],b.prototype,"expandedNodes",null),y([o.computed,m("design:type",Object),m("design:paramtypes",[])],b.prototype,"activeNodes",null),y([o.computed,m("design:type",Object),m("design:paramtypes",[])],b.prototype,"hiddenNodes",null),y([o.computed,m("design:type",Object),m("design:paramtypes",[])],b.prototype,"selectedLeafNodes",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],b.prototype,"setData",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"update",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],b.prototype,"setFocusedNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],b.prototype,"setFocus",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],b.prototype,"doForAll",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"focusNextNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"focusPreviousNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"focusDrillDown",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"focusDrillUp",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object,Object]),m("design:returntype",void 0)],b.prototype,"setActiveNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object]),m("design:returntype",void 0)],b.prototype,"setSelectedNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object]),m("design:returntype",void 0)],b.prototype,"setExpandedNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"expandAll",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"collapseAll",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object]),m("design:returntype",void 0)],b.prototype,"setIsHidden",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],b.prototype,"setHiddenNodeIds",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object]),m("design:returntype",void 0)],b.prototype,"filterNodes",null),y([o.action,m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],b.prototype,"clearFilter",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object]),m("design:returntype",void 0)],b.prototype,"moveNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object,Object]),m("design:returntype",void 0)],b.prototype,"copyNode",null),y([o.action,m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",void 0)],b.prototype,"setState",null);var N=function(){function e(){this._draggedElement=null}return e.prototype.set=function(e){this._draggedElement=e},e.prototype.get=function(){return this._draggedElement},e.prototype.isDragging=function(){return!!this.get()},e}();N.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new N},token:N,providedIn:"root"}),N.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var E=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s},O=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},D=150,I=function(){function e(e){var t=this;this.treeModel=e,this.yBlocks=0,this.x=0,this.viewportHeight=null,this.viewport=null,e.virtualScroll=this,this._dispose=[o.autorun((function(){return t.fixScroll()}))]}return Object.defineProperty(e.prototype,"y",{get:function(){return this.yBlocks*D},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"totalHeight",{get:function(){return this.treeModel.virtualRoot?this.treeModel.virtualRoot.height:0},enumerable:!1,configurable:!0}),e.prototype.fireEvent=function(e){this.treeModel.fireEvent(e)},e.prototype.init=function(){var e=this,t=this.recalcPositions.bind(this);t(),this._dispose=u(this._dispose,[o.reaction((function(){return e.treeModel.roots}),t),o.reaction((function(){return e.treeModel.expandedNodeIds}),t),o.reaction((function(){return e.treeModel.hiddenNodeIds}),t)]),this.treeModel.subscribe(h.loadNodeChildren,t)},e.prototype.isEnabled=function(){return this.treeModel.options.useVirtualScroll},e.prototype._setYBlocks=function(e){this.yBlocks=e},e.prototype.recalcPositions=function(){this.treeModel.virtualRoot.height=this._getPositionAfter(this.treeModel.getVisibleRoots(),0)},e.prototype._getPositionAfter=function(e,t){var n=this,o=t;return e.forEach((function(e){e.position=o,o=n._getPositionAfterNode(e,o)})),o},e.prototype._getPositionAfterNode=function(e,t){var n=e.getSelfHeight()+t;return e.children&&e.isExpanded&&(n=this._getPositionAfter(e.visibleChildren,n)),e.height=n-t,n},e.prototype.clear=function(){this._dispose.forEach((function(e){return e()}))},e.prototype.setViewport=function(e){Object.assign(this,{viewport:e,x:e.scrollLeft,yBlocks:Math.round(e.scrollTop/D),viewportHeight:e.getBoundingClientRect?e.getBoundingClientRect().height:0})},e.prototype.scrollIntoView=function(e,t,n){if(void 0===n&&(n=!0),e.options.scrollContainer){var o=e.options.scrollContainer,i=o.getBoundingClientRect().height,r=o.getBoundingClientRect().top,s=this.viewport.getBoundingClientRect().top+e.position-r;(t||s<o.scrollTop||s+e.getSelfHeight()>o.scrollTop+i)&&(o.scrollTop=n?s-i/2:s)}else(t||e.position<this.y||e.position+e.getSelfHeight()>this.y+this.viewportHeight)&&this.viewport&&(this.viewport.scrollTop=n?e.position-this.viewportHeight/2:e.position,this._setYBlocks(Math.floor(this.viewport.scrollTop/D)))},e.prototype.getViewportNodes=function(e){var t=this;if(!e)return[];var n=e.filter((function(e){return!e.isHidden}));if(!this.isEnabled())return n;if(!this.viewportHeight||!n.length)return[];var o=n.slice(-1)[0];if(!o.height&&0===o.position)return[];for(var i=C(n,(function(e){return e.position+500>t.y||e.position+e.height>t.y})),r=C(n,(function(e){return e.position-500>t.y+t.viewportHeight}),i),s=[],d=i;d<=r;d++)s.push(n[d]);return s},e.prototype.fixScroll=function(){var e=Math.max(0,this.totalHeight-this.viewportHeight);this.y<0&&this._setYBlocks(0),this.y>e&&this._setYBlocks(e/D)},e}();function C(e,t,n){void 0===n&&(n=0);for(var o=n,i=e.length-1;o!==i;){var r=Math.floor((o+i)/2);t(e[r])?i=r:o=o===r?i:r}return o}I.decorators=[{type:t.Injectable}],I.ctorParameters=function(){return[{type:b}]},E([o.observable,O("design:type",Object)],I.prototype,"yBlocks",void 0),E([o.observable,O("design:type",Object)],I.prototype,"x",void 0),E([o.observable,O("design:type",Object)],I.prototype,"viewportHeight",void 0),E([o.computed,O("design:type",Object),O("design:paramtypes",[])],I.prototype,"y",null),E([o.computed,O("design:type",Object),O("design:paramtypes",[])],I.prototype,"totalHeight",null),E([o.action,O("design:type",Function),O("design:paramtypes",[Object]),O("design:returntype",void 0)],I.prototype,"_setYBlocks",null),E([o.action,O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",void 0)],I.prototype,"recalcPositions",null),E([o.action,O("design:type",Function),O("design:paramtypes",[Object]),O("design:returntype",void 0)],I.prototype,"setViewport",null),E([o.action,O("design:type",Function),O("design:paramtypes",[Object,Object,Object]),O("design:returntype",void 0)],I.prototype,"scrollIntoView",null);var x=function(){};x.decorators=[{type:t.Component,args:[{encapsulation:t.ViewEncapsulation.None,selector:"tree-loading-component",template:'\n <span *ngIf="!template">loading...</span>\n <ng-container\n [ngTemplateOutlet]="template"\n [ngTemplateOutletContext]="{ $implicit: node }">\n </ng-container>\n '}]}],x.propDecorators={template:[{type:t.Input}],node:[{type:t.Input}]};var w=function(){function e(e,n){var o=this;this.treeModel=e,this.treeDraggedElement=n,e.eventNames.forEach((function(e){return o[e]=new t.EventEmitter})),e.subscribeToState((function(e){return o.stateChange.emit(e)}))}return Object.defineProperty(e.prototype,"nodes",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focused",{set:function(e){this.treeModel.setFocus(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{set:function(e){this.treeModel.setState(e)},enumerable:!1,configurable:!0}),e.prototype.onKeydown=function(e){if(this.treeModel.isFocused&&!["input","textarea"].includes(document.activeElement.tagName.toLowerCase())){var t=this.treeModel.getFocusedNode();this.treeModel.performKeyAction(t,e)}},e.prototype.onMousedown=function(e){(function e(t,n){return!t||t.localName!==n&&e(t.parentElement,n)})(e.target,"tree-root")&&this.treeModel.setFocus(!1)},e.prototype.ngOnChanges=function(e){(e.options||e.nodes)&&this.treeModel.setData({options:e.options&&e.options.currentValue,nodes:e.nodes&&e.nodes.currentValue,events:this.pick(this,this.treeModel.eventNames)})},e.prototype.sizeChanged=function(){this.viewportComponent.setViewport()},e.prototype.pick=function(e,t){return t.reduce((function(t,n){return e&&e.hasOwnProperty(n)&&(t[n]=e[n]),t}),{})},e}();w.decorators=[{type:t.Component,args:[{selector:"Tree, tree-root",providers:[b],template:'\n <tree-viewport #viewport>\n <div\n class="angular-tree-component"\n [class.node-dragging]="treeDraggedElement.isDragging()"\n [class.angular-tree-component-rtl]="treeModel.options.rtl">\n <tree-node-collection\n *ngIf="treeModel.roots"\n [nodes]="treeModel.roots"\n [treeModel]="treeModel"\n [templates]="{\n loadingTemplate: loadingTemplate,\n treeNodeTemplate: treeNodeTemplate,\n treeNodeWrapperTemplate: treeNodeWrapperTemplate,\n treeNodeFullTemplate: treeNodeFullTemplate\n }">\n </tree-node-collection>\n <tree-node-drop-slot\n class="empty-tree-drop-slot"\n *ngIf="treeModel.isEmptyTree()"\n [dropIndex]="0"\n [node]="treeModel.virtualRoot">\n </tree-node-drop-slot>\n </div>\n </tree-viewport>\n '}]}],w.ctorParameters=function(){return[{type:b},{type:N}]},w.propDecorators={loadingTemplate:[{type:t.ContentChild,args:["loadingTemplate",{static:!1}]}],treeNodeTemplate:[{type:t.ContentChild,args:["treeNodeTemplate",{static:!1}]}],treeNodeWrapperTemplate:[{type:t.ContentChild,args:["treeNodeWrapperTemplate",{static:!1}]}],treeNodeFullTemplate:[{type:t.ContentChild,args:["treeNodeFullTemplate",{static:!1}]}],viewportComponent:[{type:t.ViewChild,args:["viewport",{static:!1}]}],nodes:[{type:t.Input}],options:[{type:t.Input}],focused:[{type:t.Input}],state:[{type:t.Input}],toggleExpanded:[{type:t.Output}],activate:[{type:t.Output}],deactivate:[{type:t.Output}],nodeActivate:[{type:t.Output}],nodeDeactivate:[{type:t.Output}],select:[{type:t.Output}],deselect:[{type:t.Output}],focus:[{type:t.Output}],blur:[{type:t.Output}],updateData:[{type:t.Output}],initialized:[{type:t.Output}],moveNode:[{type:t.Output}],copyNode:[{type:t.Output}],loadNodeChildren:[{type:t.Output}],changeFilter:[{type:t.Output}],event:[{type:t.Output}],stateChange:[{type:t.Output}],onKeydown:[{type:t.HostListener,args:["body: keydown",["$event"]]}],onMousedown:[{type:t.HostListener,args:["body: mousedown",["$event"]]}]};var j=function(){};j.decorators=[{type:t.Component,args:[{selector:"TreeNode, tree-node",encapsulation:t.ViewEncapsulation.None,template:'\n <ng-container *treeMobxAutorun="{ dontDetach: true }">\n <div\n *ngIf="!templates.treeNodeFullTemplate"\n [class]="node.getClass()"\n [class.tree-node]="true"\n [class.tree-node-expanded]="node.isExpanded && node.hasChildren"\n [class.tree-node-collapsed]="node.isCollapsed && node.hasChildren"\n [class.tree-node-leaf]="node.isLeaf"\n [class.tree-node-active]="node.isActive"\n [class.tree-node-focused]="node.isFocused"\n >\n <tree-node-drop-slot\n *ngIf="index === 0"\n [dropIndex]="node.index"\n [node]="node.parent"\n ></tree-node-drop-slot>\n\n <tree-node-wrapper\n [node]="node"\n [index]="index"\n [templates]="templates"\n ></tree-node-wrapper>\n\n <tree-node-children\n [node]="node"\n [templates]="templates"\n ></tree-node-children>\n <tree-node-drop-slot\n [dropIndex]="node.index + 1"\n [node]="node.parent"\n ></tree-node-drop-slot>\n </div>\n <ng-container\n [ngTemplateOutlet]="templates.treeNodeFullTemplate"\n [ngTemplateOutletContext]="{\n $implicit: node,\n node: node,\n index: index,\n templates: templates\n }"\n >\n </ng-container>\n </ng-container>\n '}]}],j.propDecorators={node:[{type:t.Input}],index:[{type:t.Input}],templates:[{type:t.Input}]};var A=function(){};A.decorators=[{type:t.Component,args:[{selector:"tree-node-content",encapsulation:t.ViewEncapsulation.None,template:'\n <span *ngIf="!template">{{ node.displayField }}</span>\n <ng-container\n [ngTemplateOutlet]="template"\n [ngTemplateOutletContext]="{ $implicit: node, node: node, index: index }">\n </ng-container>'}]}],A.propDecorators={node:[{type:t.Input}],index:[{type:t.Input}],template:[{type:t.Input}]};var S=function(){function e(){}return e.prototype.onDrop=function(e){this.node.mouseAction("drop",e.event,{from:e.element,to:{parent:this.node,index:this.dropIndex}})},e.prototype.allowDrop=function(e,t){return this.node.options.allowDrop(e,{parent:this.node,index:this.dropIndex},t)},e}();S.decorators=[{type:t.Component,args:[{selector:"TreeNodeDropSlot, tree-node-drop-slot",encapsulation:t.ViewEncapsulation.None,template:'\n <div\n class="node-drop-slot"\n (treeDrop)="onDrop($event)"\n [treeAllowDrop]="allowDrop.bind(this)"\n [allowDragoverStyling]="true">\n </div>\n '}]}],S.propDecorators={node:[{type:t.Input}],dropIndex:[{type:t.Input}]};var P=function(){};P.decorators=[{type:t.Component,args:[{selector:"tree-node-expander",encapsulation:t.ViewEncapsulation.None,template:'\n <ng-container *treeMobxAutorun="{ dontDetach: true }">\n <span\n *ngIf="node.hasChildren"\n [class.toggle-children-wrapper-expanded]="node.isExpanded"\n [class.toggle-children-wrapper-collapsed]="node.isCollapsed"\n class="toggle-children-wrapper"\n (click)="node.mouseAction(\'expanderClick\', $event)"\n >\n <span class="toggle-children"></span>\n </span>\n <span *ngIf="!node.hasChildren" class="toggle-children-placeholder">\n </span>\n </ng-container>\n '}]}],P.propDecorators={node:[{type:t.Input}]};var T=function(){};function M(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.action.apply(void 0,u(e))}T.decorators=[{type:t.Component,args:[{selector:"tree-node-children",encapsulation:t.ViewEncapsulation.None,template:'\n <ng-container *treeMobxAutorun="{ dontDetach: true }">\n <div\n [class.tree-children]="true"\n [class.tree-children-no-padding]="node.options.levelPadding"\n *treeAnimateOpen="\n node.isExpanded;\n speed: node.options.animateSpeed;\n acceleration: node.options.animateAcceleration;\n enabled: node.options.animateExpand\n "\n >\n <tree-node-collection\n *ngIf="node.children"\n [nodes]="node.children"\n [templates]="templates"\n [treeModel]="node.treeModel"\n >\n </tree-node-collection>\n <tree-loading-component\n [style.padding-left]="node.getNodePadding()"\n class="tree-node-loading"\n *ngIf="!node.children"\n [template]="templates.loadingTemplate"\n [node]="node"\n ></tree-loading-component>\n </div>\n </ng-container>\n '}]}],T.propDecorators={node:[{type:t.Input}],templates:[{type:t.Input}]};var F=Object.assign(M,o.action);var _=Object.assign((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.computed.apply(void 0,u(e))}),o.computed);var R=Object.assign((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.observable.apply(void 0,u(e))}),o.observable),L=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==type