primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("primeng/api"),require("primeng/utils"),require("primeng/dom")):"function"==typeof define&&define.amd?define("primeng/tree",["exports","@angular/core","@angular/common","primeng/api","primeng/utils","primeng/dom"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.tree={}),e.ng.core,e.ng.common,e.primeng.api,e.primeng.utils,e.primeng.dom)}(this,(function(e,t,n,o,i,r){"use strict";var d=this&&this.__assign||function(){return(d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,d=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(d=(r<3?i(d):r>3?i(t,n,d):i(t,n))||d);return r>3&&d&&Object.defineProperty(t,n,d),d},a=this&&this.__param||function(e,t){return function(n,o){t(n,o,e)}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,r=n.call(e),d=[];try{for(;(void 0===t||t-- >0)&&!(o=r.next()).done;)d.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 d},p=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},c=this&&this.__values||function(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.")},h=function(){function e(e){this.tree=e}var n;return n=e,e.prototype.ngOnInit=function(){this.node.parent=this.parentNode,this.parentNode&&this.tree.syncNodeOption(this.node,this.tree.value,"parent",this.tree.getNodeWithKey(this.parentNode.key,this.tree.value))},e.prototype.getIcon=function(){var e;return e=this.node.icon?this.node.icon:this.node.expanded&&this.node.children&&this.node.children.length?this.node.expandedIcon:this.node.collapsedIcon,n.ICON_CLASS+" "+e},e.prototype.isLeaf=function(){return this.tree.isNodeLeaf(this.node)},e.prototype.toggle=function(e){this.node.expanded?this.collapse(e):this.expand(e)},e.prototype.expand=function(e){this.node.expanded=!0,this.tree.onNodeExpand.emit({originalEvent:e,node:this.node})},e.prototype.collapse=function(e){this.node.expanded=!1,this.tree.onNodeCollapse.emit({originalEvent:e,node:this.node})},e.prototype.onNodeClick=function(e){this.tree.onNodeClick(e,this.node)},e.prototype.onNodeKeydown=function(e){13===e.which&&this.tree.onNodeClick(e,this.node)},e.prototype.onNodeTouchEnd=function(){this.tree.onNodeTouchEnd()},e.prototype.onNodeRightClick=function(e){this.tree.onNodeRightClick(e,this.node)},e.prototype.isSelected=function(){return this.tree.isSelected(this.node)},e.prototype.onDropPoint=function(e,t){var n=this;e.preventDefault();var o=this.tree.dragNode,i=this.tree.dragNodeIndex,r=this.tree.dragNodeScope,d=this.tree.dragNodeTree!==this.tree||(1===t||i!==this.index-1);this.tree.allowDrop(o,this.node,r)&&d&&(this.tree.validateDrop?this.tree.onNodeDrop.emit({originalEvent:e,dragNode:o,dropNode:this.node,dropIndex:this.index,accept:function(){n.processPointDrop(o,i,t)}}):(this.processPointDrop(o,i,t),this.tree.onNodeDrop.emit({originalEvent:e,dragNode:o,dropNode:this.node,dropIndex:this.index}))),this.draghoverPrev=!1,this.draghoverNext=!1},e.prototype.processPointDrop=function(e,t,n){var o=this.node.parent?this.node.parent.children:this.tree.value;this.tree.dragNodeSubNodes.splice(t,1);var i=this.index;n<0?(i=this.tree.dragNodeSubNodes===o?this.tree.dragNodeIndex>this.index?this.index:this.index-1:this.index,o.splice(i,0,e)):(i=o.length,o.push(e)),this.tree.dragDropService.stopDrag({node:e,subNodes:this.node.parent?this.node.parent.children:this.tree.value,index:t})},e.prototype.onDropPointDragOver=function(e){e.dataTransfer.dropEffect="move",e.preventDefault()},e.prototype.onDropPointDragEnter=function(e,t){this.tree.allowDrop(this.tree.dragNode,this.node,this.tree.dragNodeScope)&&(t<0?this.draghoverPrev=!0:this.draghoverNext=!0)},e.prototype.onDropPointDragLeave=function(e){this.draghoverPrev=!1,this.draghoverNext=!1},e.prototype.onDragStart=function(e){this.tree.draggableNodes&&!1!==this.node.draggable?(e.dataTransfer.setData("text","data"),this.tree.dragDropService.startDrag({tree:this,node:this.node,subNodes:this.node.parent?this.node.parent.children:this.tree.value,index:this.index,scope:this.tree.draggableScope})):e.preventDefault()},e.prototype.onDragStop=function(e){this.tree.dragDropService.stopDrag({node:this.node,subNodes:this.node.parent?this.node.parent.children:this.tree.value,index:this.index})},e.prototype.onDropNodeDragOver=function(e){e.dataTransfer.dropEffect="move",this.tree.droppableNodes&&(e.preventDefault(),e.stopPropagation())},e.prototype.onDropNode=function(e){var t=this;if(this.tree.droppableNodes&&!1!==this.node.droppable){e.preventDefault(),e.stopPropagation();var n=this.tree.dragNode;this.tree.allowDrop(n,this.node,this.tree.dragNodeScope)&&(this.tree.validateDrop?this.tree.onNodeDrop.emit({originalEvent:e,dragNode:n,dropNode:this.node,index:this.index,accept:function(){t.processNodeDrop(n)}}):(this.processNodeDrop(n),this.tree.onNodeDrop.emit({originalEvent:e,dragNode:n,dropNode:this.node,index:this.index})))}this.draghoverNode=!1},e.prototype.processNodeDrop=function(e){var t=this.tree.dragNodeIndex;this.tree.dragNodeSubNodes.splice(t,1),this.node.children?this.node.children.push(e):this.node.children=[e],this.tree.dragDropService.stopDrag({node:e,subNodes:this.node.parent?this.node.parent.children:this.tree.value,index:this.tree.dragNodeIndex})},e.prototype.onDropNodeDragEnter=function(e){this.tree.droppableNodes&&!1!==this.node.droppable&&this.tree.allowDrop(this.tree.dragNode,this.node,this.tree.dragNodeScope)&&(this.draghoverNode=!0)},e.prototype.onDropNodeDragLeave=function(e){if(this.tree.droppableNodes){var t=e.currentTarget.getBoundingClientRect();(e.x>t.left+t.width||e.x<t.left||e.y>=Math.floor(t.top+t.height)||e.y<t.top)&&(this.draghoverNode=!1)}},e.prototype.onKeyDown=function(e){var t=e.target.parentElement.parentElement;if("P-TREENODE"===t.nodeName)switch(e.which){case 40:var n=this.tree.droppableNodes?t.children[1].children[1]:t.children[0].children[1];if(n&&n.children.length>0)this.focusNode(n.children[0]);else{var o=t.nextElementSibling;if(o)this.focusNode(o);else{var i=this.findNextSiblingOfAncestor(t);i&&this.focusNode(i)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else(r=this.getParentNodeElement(t))&&this.focusNode(r);e.preventDefault();break;case 39:this.node.expanded||this.expand(e),e.preventDefault();break;case 37:var r;if(this.node.expanded)this.collapse(e);else(r=this.getParentNodeElement(t))&&this.focusNode(r);e.preventDefault();break;case 13:this.tree.onNodeClick(e,this.node),e.preventDefault()}},e.prototype.findNextSiblingOfAncestor=function(e){var t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},e.prototype.findLastVisibleDescendant=function(e){var t=e.children[0].children[1];if(t&&t.children.length>0){var n=t.children[t.children.length-1];return this.findLastVisibleDescendant(n)}return e},e.prototype.getParentNodeElement=function(e){var t=e.parentElement.parentElement.parentElement;return"P-TREENODE"===t.tagName?t:null},e.prototype.focusNode=function(e){this.tree.droppableNodes?e.children[1].children[0].focus():e.children[0].children[0].focus()},e.ICON_CLASS="ui-treenode-icon ",e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[t.forwardRef((function(){return u}))]}]}]},l([t.Input()],e.prototype,"node",void 0),l([t.Input()],e.prototype,"parentNode",void 0),l([t.Input()],e.prototype,"root",void 0),l([t.Input()],e.prototype,"index",void 0),l([t.Input()],e.prototype,"firstChild",void 0),l([t.Input()],e.prototype,"lastChild",void 0),e=n=l([t.Component({selector:"p-treeNode",template:'\n <ng-template [ngIf]="node">\n <li *ngIf="tree.droppableNodes" class="ui-treenode-droppoint" [ngClass]="{\'ui-treenode-droppoint-active ui-state-highlight\':draghoverPrev}"\n (drop)="onDropPoint($event,-1)" (dragover)="onDropPointDragOver($event)" (dragenter)="onDropPointDragEnter($event,-1)" (dragleave)="onDropPointDragLeave($event)"></li>\n <li *ngIf="!tree.horizontal" role="treeitem" [ngClass]="[\'ui-treenode\',node.styleClass||\'\', isLeaf() ? \'ui-treenode-leaf\': \'\']">\n <div class="ui-treenode-content" (click)="onNodeClick($event)" (contextmenu)="onNodeRightClick($event)" (touchend)="onNodeTouchEnd()"\n (drop)="onDropNode($event)" (dragover)="onDropNodeDragOver($event)" (dragenter)="onDropNodeDragEnter($event)" (dragleave)="onDropNodeDragLeave($event)"\n [draggable]="tree.draggableNodes" (dragstart)="onDragStart($event)" (dragend)="onDragStop($event)" [attr.tabindex]="0"\n [ngClass]="{\'ui-treenode-selectable\':tree.selectionMode && node.selectable !== false,\'ui-treenode-dragover\':draghoverNode, \'ui-treenode-content-selected\':isSelected()}" \n (keydown)="onKeyDown($event)" [attr.aria-posinset]="this.index + 1" [attr.aria-expanded]="this.node.expanded" [attr.aria-selected]="isSelected()" [attr.aria-label]="node.label">\n <span class="ui-tree-toggler pi pi-fw ui-unselectable-text" [ngClass]="{\'pi-caret-right\':!node.expanded,\'pi-caret-down\':node.expanded}"\n (click)="toggle($event)"></span\n ><div class="ui-chkbox" *ngIf="tree.selectionMode == \'checkbox\'" [attr.aria-checked]="isSelected()"><div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default" [ngClass]="{\'ui-state-disabled\': node.selectable === false}">\n <span class="ui-chkbox-icon ui-clickable pi"\n [ngClass]="{\'pi-check\':isSelected(),\'pi-minus\':node.partialSelected}"></span></div></div\n ><span [class]="getIcon()" *ngIf="node.icon||node.expandedIcon||node.collapsedIcon"></span\n ><span class="ui-treenode-label ui-corner-all"\n [ngClass]="{\'ui-state-highlight\':isSelected()}">\n <span *ngIf="!tree.getTemplateForNode(node)">{{node.label}}</span>\n <span *ngIf="tree.getTemplateForNode(node)">\n <ng-container *ngTemplateOutlet="tree.getTemplateForNode(node); context: {$implicit: node}"></ng-container>\n </span>\n </span>\n </div>\n <ul class="ui-treenode-children" style="display: none;" *ngIf="node.children && node.expanded" [style.display]="node.expanded ? \'block\' : \'none\'" role="group">\n <p-treeNode *ngFor="let childNode of node.children;let firstChild=first;let lastChild=last; let index=index; trackBy: tree.nodeTrackBy" [node]="childNode" [parentNode]="node"\n [firstChild]="firstChild" [lastChild]="lastChild" [index]="index"></p-treeNode>\n </ul>\n </li>\n <li *ngIf="tree.droppableNodes&&lastChild" class="ui-treenode-droppoint" [ngClass]="{\'ui-treenode-droppoint-active ui-state-highlight\':draghoverNext}"\n (drop)="onDropPoint($event,1)" (dragover)="onDropPointDragOver($event)" (dragenter)="onDropPointDragEnter($event,1)" (dragleave)="onDropPointDragLeave($event)"></li>\n <table *ngIf="tree.horizontal" [class]="node.styleClass">\n <tbody>\n <tr>\n <td class="ui-treenode-connector" *ngIf="!root">\n <table class="ui-treenode-connector-table">\n <tbody>\n <tr>\n <td [ngClass]="{\'ui-treenode-connector-line\':!firstChild}"></td>\n </tr>\n <tr>\n <td [ngClass]="{\'ui-treenode-connector-line\':!lastChild}"></td>\n </tr>\n </tbody>\n </table>\n </td>\n <td class="ui-treenode" [ngClass]="{\'ui-treenode-collapsed\':!node.expanded}">\n <div class="ui-treenode-content ui-state-default ui-corner-all" tabindex="0"\n [ngClass]="{\'ui-treenode-selectable\':tree.selectionMode,\'ui-state-highlight\':isSelected()}" (click)="onNodeClick($event)" (contextmenu)="onNodeRightClick($event)"\n (touchend)="onNodeTouchEnd()" (keydown)="onNodeKeydown($event)">\n <span class="ui-tree-toggler pi pi-fw ui-unselectable-text" [ngClass]="{\'pi-plus\':!node.expanded,\'pi-minus\':node.expanded}" *ngIf="!isLeaf()"\n (click)="toggle($event)"></span\n ><span [class]="getIcon()" *ngIf="node.icon||node.expandedIcon||node.collapsedIcon"></span\n ><span class="ui-treenode-label ui-corner-all">\n <span *ngIf="!tree.getTemplateForNode(node)">{{node.label}}</span>\n <span *ngIf="tree.getTemplateForNode(node)">\n <ng-container *ngTemplateOutlet="tree.getTemplateForNode(node); context: {$implicit: node}"></ng-container>\n </span>\n </span>\n </div>\n </td>\n <td class="ui-treenode-children-container" *ngIf="node.children && node.expanded" [style.display]="node.expanded ? \'table-cell\' : \'none\'">\n <div class="ui-treenode-children">\n <p-treeNode *ngFor="let childNode of node.children;let firstChild=first;let lastChild=last; trackBy: tree.nodeTrackBy" [node]="childNode"\n [firstChild]="firstChild" [lastChild]="lastChild"></p-treeNode>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </ng-template>\n '}),a(0,t.Inject(t.forwardRef((function(){return u}))))],e)}(),u=function(){function e(e,n){this.el=e,this.dragDropService=n,this.selectionChange=new t.EventEmitter,this.onNodeSelect=new t.EventEmitter,this.onNodeUnselect=new t.EventEmitter,this.onNodeExpand=new t.EventEmitter,this.onNodeCollapse=new t.EventEmitter,this.onNodeContextMenuSelect=new t.EventEmitter,this.onNodeDrop=new t.EventEmitter,this.layout="vertical",this.metaKeySelection=!0,this.propagateSelectionUp=!0,this.propagateSelectionDown=!0,this.loadingIcon="pi pi-spinner",this.emptyMessage="No records found",this.filterBy="label",this.filterMode="lenient",this.nodeTrackBy=function(e,t){return t}}return e.prototype.ngOnInit=function(){var e=this;this.droppableNodes&&(this.dragStartSubscription=this.dragDropService.dragStart$.subscribe((function(t){e.dragNodeTree=t.tree,e.dragNode=t.node,e.dragNodeSubNodes=t.subNodes,e.dragNodeIndex=t.index,e.dragNodeScope=t.scope})),this.dragStopSubscription=this.dragDropService.dragStop$.subscribe((function(t){e.dragNodeTree=null,e.dragNode=null,e.dragNodeSubNodes=null,e.dragNodeIndex=null,e.dragNodeScope=null,e.dragHover=!1})))},Object.defineProperty(e.prototype,"horizontal",{get:function(){return"horizontal"==this.layout},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){var e=this;this.templates.length&&(this.templateMap={}),this.templates.forEach((function(t){e.templateMap[t.name]=t.template}))},e.prototype.onNodeClick=function(e,t){var n=e.target;if(!r.DomHandler.hasClass(n,"ui-tree-toggler")){if(this.selectionMode){if(!1===t.selectable)return;if(this.hasFilteredNodes()&&!(t=this.getNodeWithKey(t.key,this.value)))return;var o=this.findIndexInSelection(t),i=o>=0;if(this.isCheckboxSelectionMode())i?(this.propagateSelectionDown?this.propagateDown(t,!1):this.selection=this.selection.filter((function(e,t){return t!=o})),this.propagateSelectionUp&&t.parent&&this.propagateUp(t.parent,!1),this.selectionChange.emit(this.selection),this.onNodeUnselect.emit({originalEvent:e,node:t})):(this.propagateSelectionDown?this.propagateDown(t,!0):this.selection=p(this.selection||[],[t]),this.propagateSelectionUp&&t.parent&&this.propagateUp(t.parent,!0),this.selectionChange.emit(this.selection),this.onNodeSelect.emit({originalEvent:e,node:t}));else if(!this.nodeTouched&&this.metaKeySelection){var d=e.metaKey||e.ctrlKey;i&&d?(this.isSingleSelectionMode()?this.selectionChange.emit(null):(this.selection=this.selection.filter((function(e,t){return t!=o})),this.selectionChange.emit(this.selection)),this.onNodeUnselect.emit({originalEvent:e,node:t})):(this.isSingleSelectionMode()?this.selectionChange.emit(t):this.isMultipleSelectionMode()&&(this.selection=d&&this.selection||[],this.selection=p(this.selection,[t]),this.selectionChange.emit(this.selection)),this.onNodeSelect.emit({originalEvent:e,node:t}))}else this.isSingleSelectionMode()?i?(this.selection=null,this.onNodeUnselect.emit({originalEvent:e,node:t})):(this.selection=t,this.onNodeSelect.emit({originalEvent:e,node:t})):i?(this.selection=this.selection.filter((function(e,t){return t!=o})),this.onNodeUnselect.emit({originalEvent:e,node:t})):(this.selection=p(this.selection||[],[t]),this.onNodeSelect.emit({originalEvent:e,node:t})),this.selectionChange.emit(this.selection)}this.nodeTouched=!1}},e.prototype.onNodeTouchEnd=function(){this.nodeTouched=!0},e.prototype.onNodeRightClick=function(e,t){if(this.contextMenu){var n=e.target;if(n.className&&0===n.className.indexOf("ui-tree-toggler"))return;this.findIndexInSelection(t)>=0||(this.isSingleSelectionMode()?this.selectionChange.emit(t):this.selectionChange.emit([t])),this.contextMenu.show(e),this.onNodeContextMenuSelect.emit({originalEvent:e,node:t})}},e.prototype.findIndexInSelection=function(e){var t=-1;if(this.selectionMode&&this.selection)if(this.isSingleSelectionMode())t=this.selection.key&&this.selection.key===e.key||this.selection==e?0:-1;else for(var n=0;n<this.selection.length;n++){var o=this.selection[n];if(o.key&&o.key===e.key||o==e){t=n;break}}return t},e.prototype.syncNodeOption=function(e,t,n,o){var i=this.hasFilteredNodes()?this.getNodeWithKey(e.key,t):null;i&&(i[n]=o||e[n])},e.prototype.hasFilteredNodes=function(){return this.filter&&this.filteredNodes&&this.filteredNodes.length},e.prototype.getNodeWithKey=function(e,t){var n,o;try{for(var i=c(t),r=i.next();!r.done;r=i.next()){var d=r.value;if(d.key===e)return d;if(d.children){var l=this.getNodeWithKey(e,d.children);if(l)return l}}}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}},e.prototype.propagateUp=function(e,t){var n,o;if(e.children&&e.children.length){var i=0,r=!1;try{for(var d=c(e.children),l=d.next();!l.done;l=d.next()){var a=l.value;this.isSelected(a)?i++:a.partialSelected&&(r=!0)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}if(t&&i==e.children.length)this.selection=p(this.selection||[],[e]),e.partialSelected=!1;else{if(!t){var s=this.findIndexInSelection(e);s>=0&&(this.selection=this.selection.filter((function(e,t){return t!=s})))}r||i>0&&i!=e.children.length?e.partialSelected=!0:e.partialSelected=!1}this.syncNodeOption(e,this.filteredNodes,"partialSelected")}var h=e.parent;h&&this.propagateUp(h,t)},e.prototype.propagateDown=function(e,t){var n,o,i=this.findIndexInSelection(e);if(t&&-1==i?this.selection=p(this.selection||[],[e]):!t&&i>-1&&(this.selection=this.selection.filter((function(e,t){return t!=i}))),e.partialSelected=!1,this.syncNodeOption(e,this.filteredNodes,"partialSelected"),e.children&&e.children.length)try{for(var r=c(e.children),d=r.next();!d.done;d=r.next()){var l=d.value;this.propagateDown(l,t)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(o=r.return)&&o.call(r)}finally{if(n)throw n.error}}},e.prototype.isSelected=function(e){return-1!=this.findIndexInSelection(e)},e.prototype.isSingleSelectionMode=function(){return this.selectionMode&&"single"==this.selectionMode},e.prototype.isMultipleSelectionMode=function(){return this.selectionMode&&"multiple"==this.selectionMode},e.prototype.isCheckboxSelectionMode=function(){return this.selectionMode&&"checkbox"==this.selectionMode},e.prototype.isNodeLeaf=function(e){return 0!=e.leaf&&!(e.children&&e.children.length)},e.prototype.getRootNode=function(){return this.filteredNodes?this.filteredNodes:this.value},e.prototype.getTemplateForNode=function(e){return this.templateMap?e.type?this.templateMap[e.type]:this.templateMap.default:null},e.prototype.onDragOver=function(e){!this.droppableNodes||this.value&&0!==this.value.length||(e.dataTransfer.dropEffect="move",e.preventDefault())},e.prototype.onDrop=function(e){if(this.droppableNodes&&(!this.value||0===this.value.length)){e.preventDefault();var t=this.dragNode;if(this.allowDrop(t,null,this.dragNodeScope)){var n=this.dragNodeIndex;this.dragNodeSubNodes.splice(n,1),this.value=this.value||[],this.value.push(t),this.dragDropService.stopDrag({node:t})}}},e.prototype.onDragEnter=function(e){this.droppableNodes&&this.allowDrop(this.dragNode,null,this.dragNodeScope)&&(this.dragHover=!0)},e.prototype.onDragLeave=function(e){if(this.droppableNodes){var t=e.currentTarget.getBoundingClientRect();(e.x>t.left+t.width||e.x<t.left||e.y>t.top+t.height||e.y<t.top)&&(this.dragHover=!1)}},e.prototype.allowDrop=function(e,t,n){if(e){if(this.isValidDragScope(n)){var o=!0;if(t)if(e===t)o=!1;else for(var i=t.parent;null!=i;){if(i===e){o=!1;break}i=i.parent}return o}return!1}return!1},e.prototype.isValidDragScope=function(e){var t,n,o,i,r=this.droppableScope;if(r){if("string"==typeof r){if("string"==typeof e)return r===e;if(e instanceof Array)return-1!=e.indexOf(r)}else if(r instanceof Array){if("string"==typeof e)return-1!=r.indexOf(e);if(e instanceof Array)try{for(var d=c(r),l=d.next();!l.done;l=d.next()){var a=l.value;try{for(var s=(o=void 0,c(e)),p=s.next();!p.done;p=s.next()){if(a===p.value)return!0}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}}return!1}return!0},e.prototype.onFilter=function(e){var t,n,o=e.target.value;if(""===o)this.filteredNodes=null;else{this.filteredNodes=[];var r=this.filterBy.split(","),l=i.ObjectUtils.removeAccents(o).toLowerCase(),a="strict"===this.filterMode;try{for(var s=c(this.value),p=s.next();!p.done;p=s.next()){var h=p.value,u=d({},h),g={searchFields:r,filterText:l,isStrictMode:a};(a&&(this.findFilteredNodes(u,g)||this.isFilterMatched(u,g))||!a&&(this.isFilterMatched(u,g)||this.findFilteredNodes(u,g)))&&this.filteredNodes.push(u)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}}},e.prototype.findFilteredNodes=function(e,t){var n,o;if(e){var i=!1;if(e.children){var r=p(e.children);e.children=[];try{for(var l=c(r),a=l.next();!a.done;a=l.next()){var s=a.value,h=d({},s);this.isFilterMatched(h,t)&&(i=!0,e.children.push(h))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}}if(i)return e.expanded=!0,!0}},e.prototype.isFilterMatched=function(e,t){var n,o,r=t.searchFields,d=t.filterText,l=t.isStrictMode,a=!1;try{for(var s=c(r),p=s.next();!p.done;p=s.next()){var h=p.value;i.ObjectUtils.removeAccents(String(i.ObjectUtils.resolveFieldData(e,h))).toLowerCase().indexOf(d)>-1&&(a=!0)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return(!a||l&&!this.isNodeLeaf(e))&&(a=this.findFilteredNodes(e,{searchFields:r,filterText:d,isStrictMode:l})||a),a},e.prototype.getBlockableElement=function(){return this.el.nativeElement.children[0]},e.prototype.ngOnDestroy=function(){this.dragStartSubscription&&this.dragStartSubscription.unsubscribe(),this.dragStopSubscription&&this.dragStopSubscription.unsubscribe()},e.ctorParameters=function(){return[{type:t.ElementRef},{type:o.TreeDragDropService,decorators:[{type:t.Optional}]}]},l([t.Input()],e.prototype,"value",void 0),l([t.Input()],e.prototype,"selectionMode",void 0),l([t.Input()],e.prototype,"selection",void 0),l([t.Output()],e.prototype,"selectionChange",void 0),l([t.Output()],e.prototype,"onNodeSelect",void 0),l([t.Output()],e.prototype,"onNodeUnselect",void 0),l([t.Output()],e.prototype,"onNodeExpand",void 0),l([t.Output()],e.prototype,"onNodeCollapse",void 0),l([t.Output()],e.prototype,"onNodeContextMenuSelect",void 0),l([t.Output()],e.prototype,"onNodeDrop",void 0),l([t.Input()],e.prototype,"style",void 0),l([t.Input()],e.prototype,"styleClass",void 0),l([t.Input()],e.prototype,"contextMenu",void 0),l([t.Input()],e.prototype,"layout",void 0),l([t.Input()],e.prototype,"draggableScope",void 0),l([t.Input()],e.prototype,"droppableScope",void 0),l([t.Input()],e.prototype,"draggableNodes",void 0),l([t.Input()],e.prototype,"droppableNodes",void 0),l([t.Input()],e.prototype,"metaKeySelection",void 0),l([t.Input()],e.prototype,"propagateSelectionUp",void 0),l([t.Input()],e.prototype,"propagateSelectionDown",void 0),l([t.Input()],e.prototype,"loading",void 0),l([t.Input()],e.prototype,"loadingIcon",void 0),l([t.Input()],e.prototype,"emptyMessage",void 0),l([t.Input()],e.prototype,"ariaLabel",void 0),l([t.Input()],e.prototype,"ariaLabelledBy",void 0),l([t.Input()],e.prototype,"validateDrop",void 0),l([t.Input()],e.prototype,"filter",void 0),l([t.Input()],e.prototype,"filterBy",void 0),l([t.Input()],e.prototype,"filterMode",void 0),l([t.Input()],e.prototype,"filterPlaceholder",void 0),l([t.Input()],e.prototype,"nodeTrackBy",void 0),l([t.ContentChildren(o.PrimeTemplate)],e.prototype,"templates",void 0),e=l([t.Component({selector:"p-tree",template:'\n <div [ngClass]="{\'ui-tree ui-widget ui-widget-content ui-corner-all\':true,\'ui-tree-selectable\':selectionMode,\'ui-treenode-dragover\':dragHover,\'ui-tree-loading\': loading}" [ngStyle]="style" [class]="styleClass" *ngIf="!horizontal"\n (drop)="onDrop($event)" (dragover)="onDragOver($event)" (dragenter)="onDragEnter($event)" (dragleave)="onDragLeave($event)">\n <div class="ui-tree-loading-mask ui-widget-overlay" *ngIf="loading"></div>\n <div class="ui-tree-loading-content" *ngIf="loading">\n <i [class]="\'ui-tree-loading-icon pi-spin \' + loadingIcon"></i>\n </div>\n <div *ngIf="filter" class="ui-tree-filter-container">\n <input #filter type="text" autocomplete="off" class="ui-tree-filter ui-inputtext ui-widget ui-state-default ui-corner-all" [attr.placeholder]="filterPlaceholder"\n (keydown.enter)="$event.preventDefault()" (input)="onFilter($event)">\n <span class="ui-tree-filter-icon pi pi-search"></span>\n </div>\n <ul class="ui-tree-container" *ngIf="getRootNode()" role="tree" [attr.aria-label]="ariaLabel" [attr.aria-labelledby]="ariaLabelledBy">\n <p-treeNode *ngFor="let node of getRootNode(); let firstChild=first;let lastChild=last; let index=index; trackBy: nodeTrackBy" [node]="node"\n [firstChild]="firstChild" [lastChild]="lastChild" [index]="index"></p-treeNode>\n </ul>\n <div class="ui-tree-empty-message" *ngIf="!loading && (value == null || value.length === 0)">{{emptyMessage}}</div>\n </div>\n <div [ngClass]="{\'ui-tree ui-tree-horizontal ui-widget ui-widget-content ui-corner-all\':true,\'ui-tree-selectable\':selectionMode}" [ngStyle]="style" [class]="styleClass" *ngIf="horizontal">\n <div class="ui-tree-loading ui-widget-overlay" *ngIf="loading"></div>\n <div class="ui-tree-loading-content" *ngIf="loading">\n <i [class]="\'ui-tree-loading-icon pi-spin \' + loadingIcon"></i>\n </div>\n <table *ngIf="value&&value[0]">\n <p-treeNode [node]="value[0]" [root]="true"></p-treeNode>\n </table>\n <div class="ui-tree-empty-message" *ngIf="!loading && (value == null || value.length === 0)">{{emptyMessage}}</div>\n </div>\n ',changeDetection:t.ChangeDetectionStrategy.Default}),a(1,t.Optional())],e)}(),g=function(){function e(){}return e=l([t.NgModule({imports:[n.CommonModule],exports:[u,o.SharedModule],declarations:[u,h]})],e)}();e.Tree=u,e.TreeModule=g,e.UITreeNode=h,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-tree.umd.min.js.map