UNPKG

primeng

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primeng.svg)](https://badge.fury.io/js/primeng) [![Discord](https://img.shields.io/discord/557940238991753

15 lines (13 loc) 74.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("primeng/dom"),require("primeng/paginator"),require("primeng/api"),require("primeng/utils"),require("primeng/ripple"),require("@angular/cdk/scrolling")):"function"==typeof define&&define.amd?define("primeng/treetable",["exports","@angular/core","@angular/common","rxjs","primeng/dom","primeng/paginator","primeng/api","primeng/utils","primeng/ripple","@angular/cdk/scrolling"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.treetable={}),e.ng.core,e.ng.common,e.rxjs,e.primeng.dom,e.primeng.paginator,e.primeng.api,e.primeng.utils,e.primeng.ripple,e.ng.cdk.scrolling)}(this,(function(e,t,i,o,n,l,r,s,a,d){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */Object.create;function c(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.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 p(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var o,n,l=i.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=l.next()).done;)r.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return r}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}Object.create;var u=function(){function e(){this.sortSource=new o.Subject,this.selectionSource=new o.Subject,this.contextMenuSource=new o.Subject,this.uiUpdateSource=new o.Subject,this.totalRecordsSource=new o.Subject,this.sortSource$=this.sortSource.asObservable(),this.selectionSource$=this.selectionSource.asObservable(),this.contextMenuSource$=this.contextMenuSource.asObservable(),this.uiUpdateSource$=this.uiUpdateSource.asObservable(),this.totalRecordsSource$=this.totalRecordsSource.asObservable()}return e.prototype.onSort=function(e){this.sortSource.next(e)},e.prototype.onSelectionChange=function(){this.selectionSource.next()},e.prototype.onContextMenu=function(e){this.contextMenuSource.next(e)},e.prototype.onUIUpdate=function(e){this.uiUpdateSource.next(e)},e.prototype.onTotalRecordsChange=function(e){this.totalRecordsSource.next(e)},e}();u.decorators=[{type:t.Injectable}];var f=function(){function e(e,i,o,n){this.el=e,this.zone=i,this.tableService=o,this.filterService=n,this.lazy=!1,this.lazyLoadOnInit=!0,this.first=0,this.pageLinks=5,this.alwaysShowPaginator=!0,this.paginatorPosition="bottom",this.currentPageReportTemplate="{currentPage} of {totalPages}",this.showFirstLastIcon=!0,this.showPageLinks=!0,this.defaultSortOrder=1,this.sortMode="single",this.resetPageOnSort=!0,this.selectionChange=new t.EventEmitter,this.contextMenuSelectionChange=new t.EventEmitter,this.contextMenuSelectionMode="separate",this.compareSelectionBy="deepEquals",this.loadingIcon="pi pi-spinner",this.showLoader=!0,this.virtualScrollDelay=150,this.virtualRowHeight=28,this.columnResizeMode="fit",this.rowTrackBy=function(e,t){return t},this.filters={},this.filterDelay=300,this.filterMode="lenient",this.onFilter=new t.EventEmitter,this.onNodeExpand=new t.EventEmitter,this.onNodeCollapse=new t.EventEmitter,this.onPage=new t.EventEmitter,this.onSort=new t.EventEmitter,this.onLazyLoad=new t.EventEmitter,this.sortFunction=new t.EventEmitter,this.onColResize=new t.EventEmitter,this.onColReorder=new t.EventEmitter,this.onNodeSelect=new t.EventEmitter,this.onNodeUnselect=new t.EventEmitter,this.onContextMenuSelect=new t.EventEmitter,this.onHeaderCheckboxToggle=new t.EventEmitter,this.onEditInit=new t.EventEmitter,this.onEditComplete=new t.EventEmitter,this.onEditCancel=new t.EventEmitter,this._value=[],this._totalRecords=0,this._sortOrder=1,this.selectionKeys={}}return e.prototype.ngOnInit=function(){this.lazy&&this.lazyLoadOnInit&&this.onLazyLoad.emit(this.createLazyLoadMetadata()),this.initialized=!0},e.prototype.ngAfterContentInit=function(){var e=this;this.templates.forEach((function(t){switch(t.getType()){case"caption":e.captionTemplate=t.template;break;case"header":e.headerTemplate=t.template;break;case"body":e.bodyTemplate=t.template;break;case"loadingbody":e.loadingBodyTemplate=t.template;break;case"footer":e.footerTemplate=t.template;break;case"summary":e.summaryTemplate=t.template;break;case"colgroup":e.colGroupTemplate=t.template;break;case"emptymessage":e.emptyMessageTemplate=t.template;break;case"paginatorleft":e.paginatorLeftTemplate=t.template;break;case"paginatorright":e.paginatorRightTemplate=t.template;break;case"paginatordropdownitem":e.paginatorDropdownItemTemplate=t.template;break;case"frozenheader":e.frozenHeaderTemplate=t.template;break;case"frozenbody":e.frozenBodyTemplate=t.template;break;case"frozenfooter":e.frozenFooterTemplate=t.template;break;case"frozencolgroup":e.frozenColGroupTemplate=t.template}}))},e.prototype.ngOnChanges=function(e){e.value&&(this._value=e.value.currentValue,this.lazy||(this.totalRecords=this._value?this._value.length:0,"single"==this.sortMode&&this.sortField?this.sortSingle():"multiple"==this.sortMode&&this.multiSortMeta?this.sortMultiple():this.hasFilter()&&this._filter()),this.updateSerializedValue(),this.tableService.onUIUpdate(this.value)),e.sortField&&(this._sortField=e.sortField.currentValue,this.lazy&&!this.initialized||"single"===this.sortMode&&this.sortSingle()),e.sortOrder&&(this._sortOrder=e.sortOrder.currentValue,this.lazy&&!this.initialized||"single"===this.sortMode&&this.sortSingle()),e.multiSortMeta&&(this._multiSortMeta=e.multiSortMeta.currentValue,"multiple"===this.sortMode&&this.sortMultiple()),e.selection&&(this._selection=e.selection.currentValue,this.preventSelectionSetterPropagation||(this.updateSelectionKeys(),this.tableService.onSelectionChange()),this.preventSelectionSetterPropagation=!1)},Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),e.prototype.updateSerializedValue=function(){this.serializedValue=[],this.paginator?this.serializePageNodes():this.serializeNodes(null,this.filteredNodes||this.value,0,!0)},e.prototype.serializeNodes=function(e,t,i,o){var n,l;if(t&&t.length)try{for(var r=c(t),s=r.next();!s.done;s=r.next()){var a=s.value;a.parent=e;var d={node:a,parent:e,level:i,visible:o&&(!e||e.expanded)};this.serializedValue.push(d),d.visible&&a.expanded&&this.serializeNodes(a,a.children,i+1,d.visible)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(l=r.return)&&l.call(r)}finally{if(n)throw n.error}}},e.prototype.serializePageNodes=function(){var e=this.filteredNodes||this.value;if(this.serializedValue=[],e&&e.length)for(var t=this.lazy?0:this.first,i=t;i<t+this.rows;i++){var o=e[i];o&&(this.serializedValue.push({node:o,parent:null,level:0,visible:!0}),this.serializeNodes(o,o.children,1,!0))}},Object.defineProperty(e.prototype,"totalRecords",{get:function(){return this._totalRecords},set:function(e){this._totalRecords=e,this.tableService.onTotalRecordsChange(this._totalRecords)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sortField",{get:function(){return this._sortField},set:function(e){this._sortField=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sortOrder",{get:function(){return this._sortOrder},set:function(e){this._sortOrder=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multiSortMeta",{get:function(){return this._multiSortMeta},set:function(e){this._multiSortMeta=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){return this._selection},set:function(e){this._selection=e},enumerable:!1,configurable:!0}),e.prototype.updateSelectionKeys=function(){var e,t;if(this.dataKey&&this._selection)if(this.selectionKeys={},Array.isArray(this._selection))try{for(var i=c(this._selection),o=i.next();!o.done;o=i.next()){var n=o.value;this.selectionKeys[String(s.ObjectUtils.resolveFieldData(n.data,this.dataKey))]=1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else this.selectionKeys[String(s.ObjectUtils.resolveFieldData(this._selection.data,this.dataKey))]=1},e.prototype.onPageChange=function(e){this.first=e.first,this.rows=e.rows,this.lazy?this.onLazyLoad.emit(this.createLazyLoadMetadata()):this.serializePageNodes(),this.onPage.emit({first:this.first,rows:this.rows}),this.tableService.onUIUpdate(this.value),this.scrollable&&this.resetScrollTop()},e.prototype.sort=function(e){var t=e.originalEvent;if("single"===this.sortMode&&(this._sortOrder=this.sortField===e.field?-1*this.sortOrder:this.defaultSortOrder,this._sortField=e.field,this.sortSingle(),this.resetPageOnSort&&this.scrollable&&this.resetScrollTop()),"multiple"===this.sortMode){var i=t.metaKey||t.ctrlKey,o=this.getSortMeta(e.field);o?i?o.order=-1*o.order:(this._multiSortMeta=[{field:e.field,order:-1*o.order}],this.resetPageOnSort&&this.scrollable&&this.resetScrollTop()):(i&&this.multiSortMeta||(this._multiSortMeta=[],this.resetPageOnSort&&this.scrollable&&this.resetScrollTop()),this.multiSortMeta.push({field:e.field,order:this.defaultSortOrder})),this.sortMultiple()}},e.prototype.sortSingle=function(){if(this.sortField&&this.sortOrder){this.lazy?this.onLazyLoad.emit(this.createLazyLoadMetadata()):this.value&&(this.sortNodes(this.value),this.hasFilter()&&this._filter());var e={field:this.sortField,order:this.sortOrder};this.onSort.emit(e),this.tableService.onSort(e),this.updateSerializedValue()}},e.prototype.sortNodes=function(e){var t,i,o=this;if(e&&0!==e.length){this.customSort?this.sortFunction.emit({data:e,mode:this.sortMode,field:this.sortField,order:this.sortOrder}):e.sort((function(e,t){var i=s.ObjectUtils.resolveFieldData(e.data,o.sortField),n=s.ObjectUtils.resolveFieldData(t.data,o.sortField),l=null;return l=null==i&&null!=n?-1:null!=i&&null==n?1:null==i&&null==n?0:"string"==typeof i&&"string"==typeof n?i.localeCompare(n,void 0,{numeric:!0}):i<n?-1:i>n?1:0,o.sortOrder*l}));try{for(var n=c(e),l=n.next();!l.done;l=n.next()){var r=l.value;this.sortNodes(r.children)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}},e.prototype.sortMultiple=function(){this.multiSortMeta&&(this.lazy?this.onLazyLoad.emit(this.createLazyLoadMetadata()):this.value&&(this.sortMultipleNodes(this.value),this.hasFilter()&&this._filter()),this.onSort.emit({multisortmeta:this.multiSortMeta}),this.updateSerializedValue(),this.tableService.onSort(this.multiSortMeta))},e.prototype.sortMultipleNodes=function(e){var t,i,o=this;if(e&&0!==e.length){this.customSort?this.sortFunction.emit({data:this.value,mode:this.sortMode,multiSortMeta:this.multiSortMeta}):e.sort((function(e,t){return o.multisortField(e,t,o.multiSortMeta,0)}));try{for(var n=c(e),l=n.next();!l.done;l=n.next()){var r=l.value;this.sortMultipleNodes(r.children)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}},e.prototype.multisortField=function(e,t,i,o){var n=s.ObjectUtils.resolveFieldData(e.data,i[o].field),l=s.ObjectUtils.resolveFieldData(t.data,i[o].field),r=null;if(null==n&&null!=l?r=-1:null!=n&&null==l?r=1:null==n&&null==l&&(r=0),"string"==typeof n||n instanceof String){if(n.localeCompare&&n!=l)return i[o].order*n.localeCompare(l,void 0,{numeric:!0})}else r=n<l?-1:1;return n==l?i.length-1>o?this.multisortField(e,t,i,o+1):0:i[o].order*r},e.prototype.getSortMeta=function(e){if(this.multiSortMeta&&this.multiSortMeta.length)for(var t=0;t<this.multiSortMeta.length;t++)if(this.multiSortMeta[t].field===e)return this.multiSortMeta[t];return null},e.prototype.isSorted=function(e){if("single"===this.sortMode)return this.sortField&&this.sortField===e;if("multiple"===this.sortMode){var t=!1;if(this.multiSortMeta)for(var i=0;i<this.multiSortMeta.length;i++)if(this.multiSortMeta[i].field==e){t=!0;break}return t}},e.prototype.createLazyLoadMetadata=function(){return{first:this.first,rows:this.rows,sortField:this.sortField,sortOrder:this.sortOrder,filters:this.filters,globalFilter:this.filters&&this.filters.global?this.filters.global.value:null,multiSortMeta:this.multiSortMeta}},e.prototype.resetScrollTop=function(){this.virtualScroll?this.scrollToVirtualIndex(0):this.scrollTo({top:0})},e.prototype.scrollToVirtualIndex=function(e){this.scrollableViewChild&&this.scrollableViewChild.scrollToVirtualIndex(e),this.scrollableFrozenViewChild&&this.scrollableFrozenViewChild.scrollToVirtualIndex(e)},e.prototype.scrollTo=function(e){this.scrollableViewChild&&this.scrollableViewChild.scrollTo(e),this.scrollableFrozenViewChild&&this.scrollableFrozenViewChild.scrollTo(e)},e.prototype.isEmpty=function(){var e=this.filteredNodes||this.value;return null==e||0==e.length},e.prototype.getBlockableElement=function(){return this.el.nativeElement.children[0]},e.prototype.onColumnResizeBegin=function(e){var t=n.DomHandler.getOffset(this.containerViewChild.nativeElement).left;this.lastResizerHelperX=e.pageX-t+this.containerViewChild.nativeElement.scrollLeft,e.preventDefault()},e.prototype.onColumnResize=function(e){var t=n.DomHandler.getOffset(this.containerViewChild.nativeElement).left;n.DomHandler.addClass(this.containerViewChild.nativeElement,"p-unselectable-text"),this.resizeHelperViewChild.nativeElement.style.height=this.containerViewChild.nativeElement.offsetHeight+"px",this.resizeHelperViewChild.nativeElement.style.top="0px",this.resizeHelperViewChild.nativeElement.style.left=e.pageX-t+this.containerViewChild.nativeElement.scrollLeft+"px",this.resizeHelperViewChild.nativeElement.style.display="block"},e.prototype.onColumnResizeEnd=function(e,t){var i=this.resizeHelperViewChild.nativeElement.offsetLeft-this.lastResizerHelperX,o=t.offsetWidth,l=o+i,r=t.style.minWidth||15;if(o+i>parseInt(r)){if("fit"===this.columnResizeMode){for(var s=t.nextElementSibling;!s.offsetParent;)s=s.nextElementSibling;if(s){var a=s.offsetWidth-i,d=s.style.minWidth||15;if(l>15&&a>parseInt(d))if(this.scrollable){var c=this.findParentScrollableView(t),p=n.DomHandler.findSingle(c,".p-treetable-scrollable-body table")||n.DomHandler.findSingle(c,".p-treetable-virtual-scrollable-body table"),h=n.DomHandler.findSingle(c,"table.p-treetable-scrollable-header-table"),u=n.DomHandler.findSingle(c,"table.p-treetable-scrollable-footer-table"),f=n.DomHandler.index(t);this.resizeColGroup(h,f,l,a),this.resizeColGroup(p,f,l,a),this.resizeColGroup(u,f,l,a)}else t.style.width=l+"px",s&&(s.style.width=a+"px")}}else if("expand"===this.columnResizeMode)if(this.scrollable){c=this.findParentScrollableView(t);var g=n.DomHandler.findSingle(c,".p-treetable-scrollable-body")||n.DomHandler.findSingle(c,"cdk-virtual-scroll-viewport"),m=n.DomHandler.findSingle(c,".p-treetable-scrollable-header"),b=n.DomHandler.findSingle(c,".p-treetable-scrollable-footer");p=n.DomHandler.findSingle(c,".p-treetable-scrollable-body table")||n.DomHandler.findSingle(c,"cdk-virtual-scroll-viewport table"),h=n.DomHandler.findSingle(c,"table.p-treetable-scrollable-header-table"),u=n.DomHandler.findSingle(c,"table.p-treetable-scrollable-footer-table");p.style.width=p.offsetWidth+i+"px",h.style.width=h.offsetWidth+i+"px",u&&(u.style.width=u.offsetWidth+i+"px");f=n.DomHandler.index(t);var y=t?p.offsetWidth+i:l,v=t?h.offsetWidth+i:l,w=this.containerViewChild.nativeElement.offsetWidth>=y,C=function(e,t,i,o){e&&t&&(e.style.width=o?i+n.DomHandler.calculateScrollbarWidth(g)+"px":"auto",t.style.width=i+"px")};C(g,p,y,w),C(m,h,v,w),C(b,u,v,w),this.resizeColGroup(h,f,l,null),this.resizeColGroup(p,f,l,null),this.resizeColGroup(u,f,l,null)}else{this.tableViewChild.nativeElement.style.width=this.tableViewChild.nativeElement.offsetWidth+i+"px",t.style.width=l+"px";var S=this.tableViewChild.nativeElement.style.width;this.containerViewChild.nativeElement.style.width=S+"px"}this.onColResize.emit({element:t,delta:i})}this.resizeHelperViewChild.nativeElement.style.display="none",n.DomHandler.removeClass(this.containerViewChild.nativeElement,"p-unselectable-text")},e.prototype.findParentScrollableView=function(e){if(e){for(var t=e.parentElement;t&&!n.DomHandler.hasClass(t,"p-treetable-scrollable-view");)t=t.parentElement;return t}return null},e.prototype.resizeColGroup=function(e,t,i,o){if(e){var n="COLGROUP"===e.children[0].nodeName?e.children[0]:null;if(!n)throw"Scrollable tables require a colgroup to support resizable columns";var l=n.children[t],r=l.nextElementSibling;l.style.width=i+"px",r&&o&&(r.style.width=o+"px")}},e.prototype.onColumnDragStart=function(e,t){this.reorderIconWidth=n.DomHandler.getHiddenElementOuterWidth(this.reorderIndicatorUpViewChild.nativeElement),this.reorderIconHeight=n.DomHandler.getHiddenElementOuterHeight(this.reorderIndicatorDownViewChild.nativeElement),this.draggedColumn=t,e.dataTransfer.setData("text","b")},e.prototype.onColumnDragEnter=function(e,t){if(this.reorderableColumns&&this.draggedColumn&&t){e.preventDefault();var i=n.DomHandler.getOffset(this.containerViewChild.nativeElement),o=n.DomHandler.getOffset(t);if(this.draggedColumn!=t){var l=o.left-i.left,r=(i.top,o.top,o.left+t.offsetWidth/2);this.reorderIndicatorUpViewChild.nativeElement.style.top=o.top-i.top-(this.reorderIconHeight-1)+"px",this.reorderIndicatorDownViewChild.nativeElement.style.top=o.top-i.top+t.offsetHeight+"px",e.pageX>r?(this.reorderIndicatorUpViewChild.nativeElement.style.left=l+t.offsetWidth-Math.ceil(this.reorderIconWidth/2)+"px",this.reorderIndicatorDownViewChild.nativeElement.style.left=l+t.offsetWidth-Math.ceil(this.reorderIconWidth/2)+"px",this.dropPosition=1):(this.reorderIndicatorUpViewChild.nativeElement.style.left=l-Math.ceil(this.reorderIconWidth/2)+"px",this.reorderIndicatorDownViewChild.nativeElement.style.left=l-Math.ceil(this.reorderIconWidth/2)+"px",this.dropPosition=-1),this.reorderIndicatorUpViewChild.nativeElement.style.display="block",this.reorderIndicatorDownViewChild.nativeElement.style.display="block"}else e.dataTransfer.dropEffect="none"}},e.prototype.onColumnDragLeave=function(e){this.reorderableColumns&&this.draggedColumn&&(e.preventDefault(),this.reorderIndicatorUpViewChild.nativeElement.style.display="none",this.reorderIndicatorDownViewChild.nativeElement.style.display="none")},e.prototype.onColumnDrop=function(e,t){if(e.preventDefault(),this.draggedColumn){var i=n.DomHandler.indexWithinGroup(this.draggedColumn,"ttreorderablecolumn"),o=n.DomHandler.indexWithinGroup(t,"ttreorderablecolumn"),l=i!=o;l&&(o-i==1&&-1===this.dropPosition||i-o==1&&1===this.dropPosition)&&(l=!1),l&&o<i&&1===this.dropPosition&&(o+=1),l&&o>i&&-1===this.dropPosition&&(o-=1),l&&(s.ObjectUtils.reorderArray(this.columns,i,o),this.onColReorder.emit({dragIndex:i,dropIndex:o,columns:this.columns})),this.reorderIndicatorUpViewChild.nativeElement.style.display="none",this.reorderIndicatorDownViewChild.nativeElement.style.display="none",this.draggedColumn.draggable=!1,this.draggedColumn=null,this.dropPosition=null}},e.prototype.handleRowClick=function(e){var t=e.originalEvent.target.nodeName;if("INPUT"!=t&&"BUTTON"!=t&&"A"!=t&&!n.DomHandler.hasClass(e.originalEvent.target,"p-clickable")){if(this.selectionMode){this.preventSelectionSetterPropagation=!0;var i=e.rowNode,o=this.isSelected(i.node),l=!this.rowTouched&&this.metaKeySelection,r=this.dataKey?String(s.ObjectUtils.resolveFieldData(i.node.data,this.dataKey)):null;if(l){var a=e.originalEvent.metaKey||e.originalEvent.ctrlKey;if(o&&a){if(this.isSingleSelectionMode())this._selection=null,this.selectionKeys={},this.selectionChange.emit(null);else{var d=this.findIndexInSelection(i.node);this._selection=this.selection.filter((function(e,t){return t!=d})),this.selectionChange.emit(this.selection),r&&delete this.selectionKeys[r]}this.onNodeUnselect.emit({originalEvent:e.originalEvent,node:i.node,type:"row"})}else this.isSingleSelectionMode()?(this._selection=i.node,this.selectionChange.emit(i.node),r&&(this.selectionKeys={},this.selectionKeys[r]=1)):this.isMultipleSelectionMode()&&(a?this._selection=this.selection||[]:(this._selection=[],this.selectionKeys={}),this._selection=h(this.selection,[i.node]),this.selectionChange.emit(this.selection),r&&(this.selectionKeys[r]=1)),this.onNodeSelect.emit({originalEvent:e.originalEvent,node:i.node,type:"row",index:e.rowIndex})}else if("single"===this.selectionMode)o?(this._selection=null,this.selectionKeys={},this.selectionChange.emit(this.selection),this.onNodeUnselect.emit({originalEvent:e.originalEvent,node:i.node,type:"row"})):(this._selection=i.node,this.selectionChange.emit(this.selection),this.onNodeSelect.emit({originalEvent:e.originalEvent,node:i.node,type:"row",index:e.rowIndex}),r&&(this.selectionKeys={},this.selectionKeys[r]=1));else if("multiple"===this.selectionMode)if(o){var c=this.findIndexInSelection(i.node);this._selection=this.selection.filter((function(e,t){return t!=c})),this.selectionChange.emit(this.selection),this.onNodeUnselect.emit({originalEvent:e.originalEvent,node:i.node,type:"row"}),r&&delete this.selectionKeys[r]}else this._selection=this.selection?h(this.selection,[i.node]):[i.node],this.selectionChange.emit(this.selection),this.onNodeSelect.emit({originalEvent:e.originalEvent,node:i.node,type:"row",index:e.rowIndex}),r&&(this.selectionKeys[r]=1);this.tableService.onSelectionChange()}this.rowTouched=!1}},e.prototype.handleRowTouchEnd=function(e){this.rowTouched=!0},e.prototype.handleRowRightClick=function(e){if(this.contextMenu){var t=e.rowNode.node;if("separate"===this.contextMenuSelectionMode)this.contextMenuSelection=t,this.contextMenuSelectionChange.emit(t),this.onContextMenuSelect.emit({originalEvent:e.originalEvent,node:t}),this.contextMenu.show(e.originalEvent),this.tableService.onContextMenu(t);else if("joint"===this.contextMenuSelectionMode){this.preventSelectionSetterPropagation=!0;var i=this.isSelected(t),o=this.dataKey?String(s.ObjectUtils.resolveFieldData(t.data,this.dataKey)):null;i||(this.isSingleSelectionMode()?(this.selection=t,this.selectionChange.emit(t)):this.isMultipleSelectionMode()&&(this.selection=[t],this.selectionChange.emit(this.selection)),o&&(this.selectionKeys[o]=1)),this.contextMenu.show(e.originalEvent),this.onContextMenuSelect.emit({originalEvent:e.originalEvent,node:t})}}},e.prototype.toggleNodeWithCheckbox=function(e){this.selection=this.selection||[],this.preventSelectionSetterPropagation=!0;var t=e.rowNode.node;this.isSelected(t)?(this.propagateSelectionDown(t,!1),e.rowNode.parent&&this.propagateSelectionUp(t.parent,!1),this.selectionChange.emit(this.selection),this.onNodeUnselect.emit({originalEvent:e,node:t})):(this.propagateSelectionDown(t,!0),e.rowNode.parent&&this.propagateSelectionUp(t.parent,!0),this.selectionChange.emit(this.selection),this.onNodeSelect.emit({originalEvent:e,node:t})),this.tableService.onSelectionChange()},e.prototype.toggleNodesWithCheckbox=function(e,t){var i,o,n=this.filteredNodes||this.value;if(this._selection=t&&n?n.slice():[],t){if(n&&n.length)try{for(var l=c(n),r=l.next();!r.done;r=l.next()){var s=r.value;this.propagateSelectionDown(s,!0)}}catch(e){i={error:e}}finally{try{r&&!r.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}}else this._selection=[],this.selectionKeys={};this.preventSelectionSetterPropagation=!0,this.selectionChange.emit(this._selection),this.tableService.onSelectionChange(),this.onHeaderCheckboxToggle.emit({originalEvent:e,checked:t})},e.prototype.propagateSelectionUp=function(e,t){var i,o;if(e.children&&e.children.length){var n=0,l=!1,r=this.dataKey?String(s.ObjectUtils.resolveFieldData(e.data,this.dataKey)):null;try{for(var a=c(e.children),d=a.next();!d.done;d=a.next()){var p=d.value;this.isSelected(p)?n++:p.partialSelected&&(l=!0)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}if(t&&n==e.children.length)this._selection=h(this.selection||[],[e]),e.partialSelected=!1,r&&(this.selectionKeys[r]=1);else{if(!t){var u=this.findIndexInSelection(e);u>=0&&(this._selection=this.selection.filter((function(e,t){return t!=u})),r&&delete this.selectionKeys[r])}l||n>0&&n!=e.children.length?e.partialSelected=!0:e.partialSelected=!1}}var f=e.parent;f&&this.propagateSelectionUp(f,t)},e.prototype.propagateSelectionDown=function(e,t){var i,o,n=this.findIndexInSelection(e),l=this.dataKey?String(s.ObjectUtils.resolveFieldData(e.data,this.dataKey)):null;if(t&&-1==n?(this._selection=h(this.selection||[],[e]),l&&(this.selectionKeys[l]=1)):!t&&n>-1&&(this._selection=this.selection.filter((function(e,t){return t!=n})),l&&delete this.selectionKeys[l]),e.partialSelected=!1,e.children&&e.children.length)try{for(var r=c(e.children),a=r.next();!a.done;a=r.next()){var d=a.value;this.propagateSelectionDown(d,t)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=r.return)&&o.call(r)}finally{if(i)throw i.error}}},e.prototype.isSelected=function(e){return!(!e||!this.selection)&&(this.dataKey?void 0!==this.selectionKeys[s.ObjectUtils.resolveFieldData(e.data,this.dataKey)]:this.selection instanceof Array?this.findIndexInSelection(e)>-1:this.equals(e,this.selection))},e.prototype.findIndexInSelection=function(e){var t=-1;if(this.selection&&this.selection.length)for(var i=0;i<this.selection.length;i++)if(this.equals(e,this.selection[i])){t=i;break}return t},e.prototype.isSingleSelectionMode=function(){return"single"===this.selectionMode},e.prototype.isMultipleSelectionMode=function(){return"multiple"===this.selectionMode},e.prototype.equals=function(e,t){return"equals"===this.compareSelectionBy?e===t:s.ObjectUtils.equals(e.data,t.data,this.dataKey)},e.prototype.filter=function(e,t,i){var o=this;this.filterTimeout&&clearTimeout(this.filterTimeout),this.isFilterBlank(e)?this.filters[t]&&delete this.filters[t]:this.filters[t]={value:e,matchMode:i},this.filterTimeout=setTimeout((function(){o._filter(),o.filterTimeout=null}),this.filterDelay)},e.prototype.filterGlobal=function(e,t){this.filter(e,"global",t)},e.prototype.isFilterBlank=function(e){return null==e||("string"==typeof e&&0==e.trim().length||e instanceof Array&&0==e.length)},e.prototype._filter=function(){var e,t;if(this.lazy)this.onLazyLoad.emit(this.createLazyLoadMetadata());else{if(!this.value)return;if(this.hasFilter()){var i=void 0;if(this.filters.global){if(!this.columns&&!this.globalFilterFields)throw new Error("Global filtering requires dynamic columns or globalFilterFields to be defined.");i=this.globalFilterFields||this.columns}this.filteredNodes=[];var o="strict"===this.filterMode,n=!1;try{for(var l=c(this.value),r=l.next();!r.done;r=l.next()){var s=r.value,a=Object.assign({},s),d=!0,p=!1,h=void 0;for(var u in this.filters)if(this.filters.hasOwnProperty(u)&&"global"!==u){var f=this.filters[u],g=u,m=f.value,b=f.matchMode||"startsWith";if(h={filterField:g,filterValue:m,filterConstraint:this.filterService.filters[b],isStrictMode:o},(!o||this.findFilteredNodes(a,h)||this.isFilterMatched(a,h))&&(o||this.isFilterMatched(a,h)||this.findFilteredNodes(a,h))||(d=!1),!d)break}if(this.filters.global&&!p&&i)for(var y=0;y<i.length;y++){var v=Object.assign({},a);h={filterField:g=i[y].field||i[y],filterValue:m=this.filters.global.value,filterConstraint:this.filterService.filters[this.filters.global.matchMode],isStrictMode:o},(o&&(this.findFilteredNodes(v,h)||this.isFilterMatched(v,h))||!o&&(this.isFilterMatched(v,h)||this.findFilteredNodes(v,h)))&&(p=!0,a=v)}var w=d;this.filters.global&&(w=d&&p),w&&this.filteredNodes.push(a),n=n||!d||p||d&&this.filteredNodes.length>0||!p&&0===this.filteredNodes.length}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}n||(this.filteredNodes=null),this.paginator&&(this.totalRecords=this.filteredNodes?this.filteredNodes.length:this.value?this.value.length:0)}else this.filteredNodes=null,this.paginator&&(this.totalRecords=this.value?this.value.length:0)}this.first=0;var C=this.filteredNodes||this.value;this.onFilter.emit({filters:this.filters,filteredValue:C}),this.tableService.onUIUpdate(C),this.updateSerializedValue(),this.scrollable&&this.resetScrollTop()},e.prototype.findFilteredNodes=function(e,t){var i,o;if(e){var n=!1;if(e.children){var l=h(e.children);e.children=[];try{for(var r=c(l),s=r.next();!s.done;s=r.next()){var a=s.value,d=Object.assign({},a);this.isFilterMatched(d,t)&&(n=!0,e.children.push(d))}}catch(e){i={error:e}}finally{try{s&&!s.done&&(o=r.return)&&o.call(r)}finally{if(i)throw i.error}}}if(n)return!0}},e.prototype.isFilterMatched=function(e,t){var i=t.filterField,o=t.filterValue,n=t.filterConstraint,l=t.isStrictMode,r=!1;return n(s.ObjectUtils.resolveFieldData(e.data,i),o,this.filterLocale)&&(r=!0),(!r||l&&!this.isNodeLeaf(e))&&(r=this.findFilteredNodes(e,{filterField:i,filterValue:o,filterConstraint:n,isStrictMode:l})||r),r},e.prototype.isNodeLeaf=function(e){return!1!==e.leaf&&!(e.children&&e.children.length)},e.prototype.hasFilter=function(){var e=!0;for(var t in this.filters)if(this.filters.hasOwnProperty(t)){e=!1;break}return!e},e.prototype.reset=function(){this._sortField=null,this._sortOrder=1,this._multiSortMeta=null,this.tableService.onSort(null),this.filteredNodes=null,this.filters={},this.first=0,this.lazy?this.onLazyLoad.emit(this.createLazyLoadMetadata()):this.totalRecords=this._value?this._value.length:0},e.prototype.updateEditingCell=function(e){this.editingCell=e,this.bindDocumentEditListener()},e.prototype.isEditingCellValid=function(){return this.editingCell&&0===n.DomHandler.find(this.editingCell,".ng-invalid.ng-dirty").length},e.prototype.bindDocumentEditListener=function(){var e=this;this.documentEditListener||(this.documentEditListener=function(t){e.editingCell&&!e.editingCellClick&&e.isEditingCellValid()&&(n.DomHandler.removeClass(e.editingCell,"p-cell-editing"),e.editingCell=null,e.unbindDocumentEditListener()),e.editingCellClick=!1},document.addEventListener("click",this.documentEditListener))},e.prototype.unbindDocumentEditListener=function(){this.documentEditListener&&(document.removeEventListener("click",this.documentEditListener),this.documentEditListener=null)},e.prototype.ngOnDestroy=function(){this.unbindDocumentEditListener(),this.editingCell=null,this.initialized=null},e}();f.decorators=[{type:t.Component,args:[{selector:"p-treeTable",template:'\n <div #container [ngStyle]="style" [class]="styleClass" data-scrollselectors=".p-treetable-scrollable-body"\n [ngClass]="{\'p-treetable p-component\': true,\n \'p-treetable-hoverable-rows\': (rowHover||(selectionMode === \'single\' || selectionMode === \'multiple\')),\n \'p-treetable-auto-layout\': autoLayout,\n \'p-treetable-resizable\': resizableColumns,\n \'p-treetable-resizable-fit\': (resizableColumns && columnResizeMode === \'fit\'),\n \'p-treetable-flex-scrollable\': (scrollable && scrollHeight === \'flex\')}">\n <div class="p-treetable-loading" *ngIf="loading && showLoader">\n <div class="p-treetable-loading-overlay p-component-overlay">\n <i [class]="\'p-treetable-loading-icon pi-spin \' + loadingIcon"></i>\n </div>\n </div>\n <div *ngIf="captionTemplate" class="p-treetable-header">\n <ng-container *ngTemplateOutlet="captionTemplate"></ng-container>\n </div>\n <p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" styleClass="p-paginator-top" [alwaysShow]="alwaysShowPaginator"\n (onPageChange)="onPageChange($event)" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && (paginatorPosition === \'top\' || paginatorPosition ==\'both\')"\n [templateLeft]="paginatorLeftTemplate" [templateRight]="paginatorRightTemplate" [dropdownAppendTo]="paginatorDropdownAppendTo"\n [currentPageReportTemplate]="currentPageReportTemplate" [showFirstLastIcon]="showFirstLastIcon" [dropdownItemTemplate]="paginatorDropdownItemTemplate" [showCurrentPageReport]="showCurrentPageReport" [showJumpToPageDropdown]="showJumpToPageDropdown" [showPageLinks]="showPageLinks"></p-paginator>\n\n <div class="p-treetable-wrapper" *ngIf="!scrollable">\n <table #table [ngClass]="tableStyleClass" [ngStyle]="tableStyle">\n <ng-container *ngTemplateOutlet="colGroupTemplate; context {$implicit: columns}"></ng-container>\n <thead class="p-treetable-thead">\n <ng-container *ngTemplateOutlet="headerTemplate; context: {$implicit: columns}"></ng-container>\n </thead>\n <tbody class="p-treetable-tbody" [pTreeTableBody]="columns" [pTreeTableBodyTemplate]="bodyTemplate"></tbody>\n <tfoot class="p-treetable-tfoot">\n <ng-container *ngTemplateOutlet="footerTemplate; context {$implicit: columns}"></ng-container>\n </tfoot>\n </table>\n </div>\n\n <div class="p-treetable-scrollable-wrapper" *ngIf="scrollable">\n <div class="p-treetable-scrollable-view p-treetable-frozen-view" *ngIf="frozenColumns||frozenBodyTemplate" #scrollableFrozenView [ttScrollableView]="frozenColumns" [frozen]="true" [ngStyle]="{width: frozenWidth}" [scrollHeight]="scrollHeight"></div>\n <div class="p-treetable-scrollable-view" #scrollableView [ttScrollableView]="columns" [frozen]="false" [scrollHeight]="scrollHeight" [ngStyle]="{left: frozenWidth, width: \'calc(100% - \'+frozenWidth+\')\'}"></div>\n </div>\n\n <p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" styleClass="p-paginator-bottom" [alwaysShow]="alwaysShowPaginator"\n (onPageChange)="onPageChange($event)" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && (paginatorPosition === \'bottom\' || paginatorPosition ==\'both\')"\n [templateLeft]="paginatorLeftTemplate" [templateRight]="paginatorRightTemplate" [dropdownAppendTo]="paginatorDropdownAppendTo"\n [currentPageReportTemplate]="currentPageReportTemplate" [showFirstLastIcon]="showFirstLastIcon" [dropdownItemTemplate]="paginatorDropdownItemTemplate" [showCurrentPageReport]="showCurrentPageReport" [showJumpToPageDropdown]="showJumpToPageDropdown" [showPageLinks]="showPageLinks"></p-paginator>\n <div *ngIf="summaryTemplate" class="p-treetable-footer">\n <ng-container *ngTemplateOutlet="summaryTemplate"></ng-container>\n </div>\n\n <div #resizeHelper class="p-column-resizer-helper" style="display:none" *ngIf="resizableColumns"></div>\n\n <span #reorderIndicatorUp class="pi pi-arrow-down p-treetable-reorder-indicator-up" *ngIf="reorderableColumns"></span>\n <span #reorderIndicatorDown class="pi pi-arrow-up p-treetable-reorder-indicator-down" *ngIf="reorderableColumns"></span>\n </div>\n ',providers:[u],encapsulation:t.ViewEncapsulation.None,styles:[".p-treetable{position:relative}.p-treetable table{border-collapse:collapse;table-layout:fixed;width:100%}.p-treetable .p-sortable-column{-ms-user-select:none;-webkit-user-select:none;cursor:pointer;user-select:none}.p-treetable .p-sortable-column .p-column-title,.p-treetable .p-sortable-column .p-sortable-column-badge,.p-treetable .p-sortable-column .p-sortable-column-icon{vertical-align:middle}.p-treetable .p-sortable-column .p-sortable-column-badge{align-items:center;display:inline-flex;justify-content:center}.p-treetable-auto-layout>.p-treetable-wrapper{overflow-x:auto}.p-treetable-auto-layout>.p-treetable-wrapper>table{table-layout:auto}.p-treetable-hoverable-rows .p-treetable-tbody>tr{cursor:pointer}.p-treetable-toggler{-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:inline-flex;justify-content:center;overflow:hidden;position:relative;user-select:none}.p-treetable-toggler,p-treetabletoggler+p-treetablecheckbox+span,p-treetabletoggler+p-treetablecheckbox .p-checkbox{vertical-align:middle}.p-treetable-scrollable-wrapper{position:relative}.p-treetable-scrollable-footer,.p-treetable-scrollable-header{overflow:hidden}.p-treetable-scrollable-body{overflow:auto;position:relative}.p-treetable-scrollable-body>table>.p-treetable-tbody>tr:first-child>td{border-top:0}.p-treetable-virtual-table{position:absolute}.p-treetable-frozen-view .p-treetable-scrollable-body{overflow:hidden}.p-treetable-frozen-view>.p-treetable-scrollable-body>table>.p-treetable-tbody>tr>td:last-child{border-right:0}.p-treetable-unfrozen-view{position:absolute;top:0}.p-treetable-flex-scrollable,.p-treetable-flex-scrollable .p-treetable-scrollable-view,.p-treetable-flex-scrollable .p-treetable-scrollable-wrapper{display:flex;flex:1;flex-direction:column;height:100%}.p-treetable-flex-scrollable .p-treetable-scrollable-body{flex:1}.p-treetable-resizable>.p-treetable-wrapper{overflow-x:auto}.p-treetable-resizable .p-treetable-tbody>tr>td,.p-treetable-resizable .p-treetable-tfoot>tr>td,.p-treetable-resizable .p-treetable-thead>tr>th{overflow:hidden}.p-treetable-resizable .p-resizable-column{background-clip:padding-box;position:relative}.p-treetable-resizable-fit .p-resizable-column:last-child .p-column-resizer{display:none}.p-treetable .p-column-resizer{border:1px solid transparent;cursor:col-resize;display:block;height:100%;margin:0;padding:0;position:absolute!important;right:0;top:0;width:.5rem}.p-treetable .p-column-resizer-helper{display:none;position:absolute;width:1px;z-index:10}.p-treetable .p-row-editor-cancel,.p-treetable .p-row-editor-init,.p-treetable .p-row-editor-save,.p-treetable .p-row-toggler{align-items:center;display:inline-flex;justify-content:center;overflow:hidden;position:relative}.p-treetable-reorder-indicator-down,.p-treetable-reorder-indicator-up{display:none;position:absolute}[ttReorderableColumn]{cursor:move}.p-treetable .p-treetable-loading-overlay{align-items:center;display:flex;justify-content:center;position:absolute;z-index:2}"]}]}],f.ctorParameters=function(){return[{type:t.ElementRef},{type:t.NgZone},{type:u},{type:r.FilterService}]},f.propDecorators={columns:[{type:t.Input}],style:[{type:t.Input}],styleClass:[{type:t.Input}],tableStyle:[{type:t.Input}],tableStyleClass:[{type:t.Input}],autoLayout:[{type:t.Input}],lazy:[{type:t.Input}],lazyLoadOnInit:[{type:t.Input}],paginator:[{type:t.Input}],rows:[{type:t.Input}],first:[{type:t.Input}],pageLinks:[{type:t.Input}],rowsPerPageOptions:[{type:t.Input}],alwaysShowPaginator:[{type:t.Input}],paginatorPosition:[{type:t.Input}],paginatorDropdownAppendTo:[{type:t.Input}],currentPageReportTemplate:[{type:t.Input}],showCurrentPageReport:[{type:t.Input}],showJumpToPageDropdown:[{type:t.Input}],showFirstLastIcon:[{type:t.Input}],showPageLinks:[{type:t.Input}],defaultSortOrder:[{type:t.Input}],sortMode:[{type:t.Input}],resetPageOnSort:[{type:t.Input}],customSort:[{type:t.Input}],selectionMode:[{type:t.Input}],selectionChange:[{type:t.Output}],contextMenuSelection:[{type:t.Input}],contextMenuSelectionChange:[{type:t.Output}],contextMenuSelectionMode:[{type:t.Input}],dataKey:[{type:t.Input}],metaKeySelection:[{type:t.Input}],compareSelectionBy:[{type:t.Input}],rowHover:[{type:t.Input}],loading:[{type:t.Input}],loadingIcon:[{type:t.Input}],showLoader:[{type:t.Input}],scrollable:[{type:t.Input}],scrollHeight:[{type:t.Input}],virtualScroll:[{type:t.Input}],virtualScrollDelay:[{type:t.Input}],virtualRowHeight:[{type:t.Input}],minBufferPx:[{type:t.Input}],maxBufferPx:[{type:t.Input}],frozenWidth:[{type:t.Input}],frozenColumns:[{type:t.Input}],resizableColumns:[{type:t.Input}],columnResizeMode:[{type:t.Input}],reorderableColumns:[{type:t.Input}],contextMenu:[{type:t.Input}],rowTrackBy:[{type:t.Input}],filters:[{type:t.Input}],globalFilterFields:[{type:t.Input}],filterDelay:[{type:t.Input}],filterMode:[{type:t.Input}],filterLocale:[{type:t.Input}],onFilter:[{type:t.Output}],onNodeExpand:[{type:t.Output}],onNodeCollapse:[{type:t.Output}],onPage:[{type:t.Output}],onSort:[{type:t.Output}],onLazyLoad:[{type:t.Output}],sortFunction:[{type:t.Output}],onColResize:[{type:t.Output}],onColReorder:[{type:t.Output}],onNodeSelect:[{type:t.Output}],onNodeUnselect:[{type:t.Output}],onContextMenuSelect:[{type:t.Output}],onHeaderCheckboxToggle:[{type:t.Output}],onEditInit:[{type:t.Output}],onEditComplete:[{type:t.Output}],onEditCancel:[{type:t.Output}],containerViewChild:[{type:t.ViewChild,args:["container"]}],resizeHelperViewChild:[{type:t.ViewChild,args:["resizeHelper"]}],reorderIndicatorUpViewChild:[{type:t.ViewChild,args:["reorderIndicatorUp"]}],reorderIndicatorDownViewChild:[{type:t.ViewChild,args:["reorderIndicatorDown"]}],tableViewChild:[{type:t.ViewChild,args:["table"]}],scrollableViewChild:[{type:t.ViewChild,args:["scrollableView"]}],scrollableFrozenViewChild:[{type:t.ViewChild,args:["scrollableFrozenView"]}],templates:[{type:t.ContentChildren,args:[r.PrimeTemplate]}],value:[{type:t.Input}],totalRecords:[{type:t.Input}],sortField:[{type:t.Input}],sortOrder:[{type:t.Input}],multiSortMeta:[{type:t.Input}],selection:[{type:t.Input}]};var g=function(){function e(e,t,i){var o=this;this.tt=e,this.treeTableService=t,this.cd=i,this.subscription=this.tt.tableService.uiUpdateSource$.subscribe((function(){o.tt.virtualScroll&&o.cd.detectChanges()}))}return e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},e}();g.decorators=[{type:t.Component,args:[{selector:"[pTreeTableBody]",template:'\n <ng-container *ngIf="!tt.virtualScroll">\n <ng-template ngFor let-serializedNode let-rowIndex="index" [ngForOf]="tt.serializedValue" [ngForTrackBy]="tt.rowTrackBy">\n <ng-container *ngIf="serializedNode.visible">\n <ng-container *ngTemplateOutlet="template; context: {$implicit: serializedNode, node: serializedNode.node, rowData: serializedNode.node.data, columns: columns}"></ng-container>\n </ng-container>\n </ng-template>\n </ng-container>\n <ng-container *ngIf="tt.virtualScroll">\n <ng-template cdkVirtualFor let-serializedNode let-rowIndex="index" [cdkVirtualForOf]="tt.serializedValue" [cdkVirtualForTrackBy]="tt.rowTrackBy" [cdkVirtualForTemplateCacheSize]="0">\n <ng-container *ngIf="serializedNode.visible">\n <ng-container *ngTemplateOutlet="template; context: {$implicit: serializedNode, node: serializedNode.node, rowData: serializedNode.node.data, columns: columns}"></ng-container>\n </ng-container>\n </ng-template>\n </ng-container>\n <ng-container *ngIf="tt.isEmpty()">\n <ng-container *ngTemplateOutlet="tt.emptyMessageTemplate; context: {$implicit: columns, frozen: frozen}"></ng-container>\n </ng-container>\n ',encapsulation:t.ViewEncapsulation.None}]}],g.ctorParameters=function(){return[{type:f},{type:u},{type:t.ChangeDetectorRef}]},g.propDecorators={columns:[{type:t.Input,args:["pTreeTableBody"]}],template:[{type:t.Input,args:["pTreeTableBodyTemplate"]}],frozen:[{type:t.Input}]};var m=function(){function e(e,t,i){this.tt=e,this.el=t,this.zone=i}return Object.defineProperty(e.prototype,"scrollHeight",{get:function(){return this._scrollHeight},set:function(e){this._scrollHeight=e,null!=e&&(e.includes("%")||e.includes("calc"))&&console.log('Percentage scroll height calculation is removed in favor of the more performant CSS based flex mode, use scrollHeight="flex" instead.'),this.tt.virtualScroll&&this.virtualScrollBody&&this.virtualScrollBody.ngOnInit()},enumerable:!1,configurable:!0}),e.prototype.ngAfterViewInit=function(){if(this.frozen)this.scrollableAlignerViewChild&&this.scrollableAlignerViewChild.nativeElement&&(this.scrollableAlignerViewChild.nativeElement.style.height=n.DomHandler.calculateScrollbarHeight()+"px");else{(this.tt.frozenColumns||this.tt.frozenBodyTemplate)&&n.DomHandler.addClass(this.el.nativeElement,"p-treetable-unfrozen-view");var e=this.el.nativeElement.previousElementSibling;e&&(this.tt.virtualScroll?this.frozenSiblingBody=n.DomHandler.findSingle(e,".p-treetable-virtual-scrollable-body"):this.frozenSiblingBody=n.DomHandler.findSingle(e,".p-treetable-scrollable-body"));var t=n.DomHandler.calculateScrollbarWidth();this.scrollHeaderBoxViewChild.nativeElement.style.paddingRight=t+"px",this.scrollFooterBoxViewChild&&this.scrollFooterBoxViewChild.nativeElement&&(this.scrollFooterBoxViewChild.nativeElement.style.paddingRight=t+"px")}this.bindEvents()},e.prototype.bindEvents=function(){var e=this;this.zone.runOutsideAngular((function(){e.scrollHeaderViewChild&&e.scrollHeaderViewChild.nativeElement&&(e.headerScrollListener=e.onHeaderScroll.bind(e),e.scrollHeaderBoxViewChild.nativeElement.addEventListener("scroll",e.headerScrollListener)),e.scrollFooterViewChild&&e.scrollFooterViewChild.nativeElement&&(e.footerScrollListener=e.onFooterScroll.bind(e),e.scrollFooterViewChild.nativeElement.addEventListener("scroll",e.footerScrollListener)),e.frozen||(e.bodyScrollListener=e.onBodyScroll.bind(e),e.tt.virtualScroll?e.virtualScrollBody.getElementRef().nativeElement.addEventListener("scroll",e.bodyScrollListener):e.scrollBodyViewChild.nativeElement.addEventListener("scroll",e.bodyScrollListener))}))},e.prototype.unbindEvents=function(){this.scrollHeaderViewChild&&this.scrollHeaderViewChild.nativeElement&&this.scrollHeaderBoxViewChild.nativeElement.removeEventListener("scroll",this.headerScrollListener),this.scrollFooterViewChild&&this.scrollFooterViewChild.nativeElement&&this.scrollFooterViewChild.nativeElement.removeEventListener("scroll",this.footerScrollListener),this.scrollBodyViewChild&&this.scrollBodyViewChild.nativeElement&&this.scrollBodyViewChild.nativeElement.removeEventListener("scroll",this.bodyScrollListener),this.virtualScrollBody&&this.virtualScrollBody.getElementRef()&&this.virtualScrollBody.getElementRef().nativeElement.removeEventListener("scroll",this.bodyScrollListener)},e.prototype.onHeaderScroll=function(){var e=this.scrollHeaderViewChild.nativeElement.scrollLeft;this.scrollBodyViewChild.nativeElement.scrollLeft=e,this.scrollFooterViewChild&&this.scrollFooterViewChild.nativeElement&&(this.scrollFooterViewChild.nativeElement.scrollLeft=e),this.preventBodyScrollPropagation=!0},e.prototype.onFooterScroll=function(){var e=this.scrollFooterViewChild.nativeElement.scrollLeft;this.scrollBodyViewChild.nativeElement.scrollLeft=e,this.scrollHeaderViewChild&&this.scrollHeaderViewChild.nativeElement&&(this.scrollHeaderViewChild.nativeElement.scrollLeft=e),this.preventBodyScrollPropagation=!0},e.prototype.onBodyScroll=function(e){this.preventBodyScrollPropagation?this.preventBodyScrollPropagation=!1:(this.scrollHeaderViewChild&&this.scrollHeaderViewChild.nativeElement&&(this.scrollHeaderBoxViewChild.nativeElement.style.marginLeft=-1*e.target.scrollLeft+"px"),this.scrollFooterViewChild&&this.scrollFooterViewChild.nativeElement&&(this.scrollFooterBoxViewChild.nativeElement.style.marginLeft=-1*e.target.scrollLeft+"px"),this.frozenSiblingBody&&(this.frozenSiblingBody.scrollTop=e.target.scrollTop))},e.prototype.scrollToVirtualIndex=function(e){this.virtualScrollBody&&this.virtualScrollBody.scrollToIndex(e)},e.prototype.scrollTo=function(e){this.virtualScrollBody?this.virtualScrollBody.scrollTo(e):this.scrollBodyViewChild.nativeElement.scrollTo?this.scrollBodyViewChild.nativeElement.scrollTo(e):(this.scrollBodyViewChild.nativeElement.scrollLeft=e.left,this.scrollBodyViewChild.nativeElement.scrollTop=e.top)},e.prototype.ngOnDestroy=function(){this.unbindEvents(),this.frozenSiblingBody=null},e}();m.decorators=[{type:t.Component,args:[{selector:"[ttScrollableView]",template:'\n <div #scrollHeader class="p-treetable-scrollable-header">\n <div #scrollHeaderBox class="p-treetable-scrollable-header-box">\n <table class="p-treetable-scrollable-header-table" [ngClass]="tt.tableStyleClass" [ngStyle]="tt.tableStyle">\n <ng-container *ngTemplateOutlet="frozen ? tt.frozenColGroupTemplate||tt.colGroupTemplate : tt.colGroupTemplate; context {$implicit: columns}"></ng-container>\n <thead class="p-treetable-thead">\n <ng-container *ngTemplateOutlet="frozen ? tt.frozenHeaderTemplate||tt.headerTemplate : tt.headerTemplate; context {$implicit: columns}"></ng-container>\n </thead>\n </table>\n </div>\n </div>\n <ng-container *ngIf="!tt.virtualScroll; else virtualScrollTemplate">\n <div #scrollBody class="p-treetable-scrollable-body" [ngStyle]="{\'max-height\': tt.scrollHeight !== \'flex\' ? scrollHeight : undefined, \'overflow-y\': !frozen && tt.scrollHeight ? \'scroll\' : undefined}">\n <table #scrollTable [class]="tt.tableStyleClass" [ngStyle]="tt.tableStyle">\n <ng-container *ngTemplateOutlet="frozen ? tt.frozenColGroupTemplate||tt.colGroupTemplate : tt.colGroupTemplate; context {$implicit: columns}"></ng-container>\n <tbody class