katoikia-app/web-ui/web-react/node_modules/primereact/treetable/treetable.cjs.min.js

2 lines
78 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/utils"),o=require("primereact/paginator"),r=require("primereact/inputtext"),i=require("primereact/overlayservice"),l=require("primereact/ripple");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(e);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function u(e){if(Array.isArray(e))return p(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function d(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e){return u(e)||c(e)||d(e)||h()}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function g(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},b(e,t)}function C(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}function k(e){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(e)}function S(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=O(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function O(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var F=function(t){C(s,e.Component);var o,i,l=(o=s,i=D(),function(){var e,t=w(o);if(i){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function s(e){var t;return y(this,s),(t=l.call(this,e)).state={badgeVisible:!1},t.onFilterInput=t.onFilterInput.bind(v(t)),t}return g(s,[{key:"onHeaderClick",value:function(e,t){if(t.props.sortable){var o=e.target;(n.DomHandler.hasClass(o,"p-sortable-column")||n.DomHandler.hasClass(o,"p-column-title")||n.DomHandler.hasClass(o,"p-sortable-column-icon")||n.DomHandler.hasClass(o.parentElement,"p-sortable-column-icon"))&&(this.props.onSort({originalEvent:e,sortField:t.props.sortField||t.props.field,sortFunction:t.props.sortFunction,sortable:t.props.sortable}),n.DomHandler.clearSelection())}}},{key:"onHeaderMouseDown",value:function(e,t){this.props.reorderableColumns&&t.props.reorderable&&("INPUT"!==e.target.nodeName?e.currentTarget.draggable=!0:"INPUT"===e.target.nodeName&&(e.currentTarget.draggable=!1))}},{key:"onHeaderKeyDown",value:function(e,t){"Enter"===e.key&&(this.onHeaderClick(e,t),e.preventDefault())}},{key:"getMultiSortMetaDataIndex",value:function(e){if(this.props.multiSortMeta)for(var t=0;t<this.props.multiSortMeta.length;t++)if(this.props.multiSortMeta[t].field===e.props.field)return t;return-1}},{key:"onResizerMouseDown",value:function(e,t){this.props.resizableColumns&&this.props.onResizeStart&&this.props.onResizeStart({originalEvent:e,columnEl:e.target.parentElement,column:t})}},{key:"onDragStart",value:function(e,t){this.props.onDragStart&&this.props.onDragStart({originalEvent:e,column:t})}},{key:"onDragOver",value:function(e,t){this.props.onDragOver&&this.props.onDragOver({originalEvent:e,column:t})}},{key:"onDragLeave",value:function(e,t){this.props.onDragLeave&&this.props.onDragLeave({originalEvent:e,column:t})}},{key:"onDrop",value:function(e,t){this.props.onDrop&&this.props.onDrop({originalEvent:e,column:t})}},{key:"onFilterInput",value:function(e,t){var n=this;if(t.props.filter&&this.props.onFilter){this.filterTimeout&&clearTimeout(this.filterTimeout);var o=e.target.value;this.filterTimeout=setTimeout((function(){n.props.onFilter({value:o,field:t.props.field,matchMode:t.props.filterMatchMode||"startsWith"}),n.filterTimeout=null}),this.props.filterDelay)}}},{key:"hasColumnFilter",value:function(e){if(e){var t,n=E(e);try{for(n.s();!(t=n.n()).done;){if(t.value.props.filter)return!0}}catch(e){n.e(e)}finally{n.f()}}return!1}},{key:"renderSortIcon",value:function(e,t,o){if(e.props.sortable){var r=n.classNames("p-sortable-column-icon","pi pi-fw",t?o<0?"pi-sort-amount-down":"pi-sort-amount-up-alt":"pi-sort-alt");return a.default.createElement("span",{className:r})}return null}},{key:"renderResizer",value:function(e){var t=this;return this.props.resizableColumns?a.default.createElement("span",{className:"p-column-resizer p-clickable",onMouseDown:function(n){return t.onResizerMouseDown(n,e)}}):null}},{key:"getAriaSort",value:function(e,t,n){if(e.props.sortable){var o=t?n<0?"pi-sort-down":"pi-sort-up":"pi-sort";return"pi-sort-down"===o?"descending":"pi-sort-up"===o?"ascending":"none"}return null}},{key:"renderSortBadge",value:function(e){return-1!==e&&this.state.badgeVisible?a.default.createElement("span",{className:"p-sortable-column-badge"},e+1):null}},{key:"renderHeaderCell",value:function(e,t){var o,i=this;if(e.props.filter&&t.renderFilter&&(o=e.props.filterElement||a.default.createElement(r.InputText,{onInput:function(t){return i.onFilterInput(t,e)},type:this.props.filterType,defaultValue:this.props.filters&&this.props.filters[e.props.field]?this.props.filters[e.props.field].value:null,className:"p-column-filter",placeholder:e.props.filterPlaceholder,maxLength:e.props.filterMaxLength})),t.filterOnly)return a.default.createElement("th",{key:e.props.columnKey||e.props.field||t.index,className:n.classNames("p-filter-column",e.props.filterHeaderClassName),style:e.props.filterHeaderStyle||e.props.style,rowSpan:e.props.rowSpan,colSpan:e.props.colSpan},o);var l=this.getMultiSortMetaDataIndex(e),s=-1!==l?this.props.multiSortMeta[l]:null,p=e.props.field===this.props.sortField,u=null!==s,c=e.props.sortable&&(p||u),d=0;p?d=this.props.sortOrder:u&&(d=s.order);var h=this.renderSortIcon(e,c,d),f=this.getAriaSort(e,c,d),y=this.renderSortBadge(l),m=n.classNames(e.props.headerClassName||e.props.className,{"p-sortable-column":e.props.sortable,"p-highlight":c,"p-resizable-column":this.props.resizableColumns}),g=this.renderResizer(e);return a.default.createElement("th",{key:e.columnKey||e.field||t.index,className:m,style:e.props.headerStyle||e.props.style,tabIndex:e.props.sortable?this.props.tabIndex:null,onClick:function(t){return i.onHeaderClick(t,e)},onMouseDown:function(t){return i.onHeaderMouseDown(t,e)},onKeyDown:function(t){return i.onHeaderKeyDown(t,e)},rowSpan:e.props.rowSpan,colSpan:e.props.colSpan,"aria-sort":f,onDragStart:function(t){return i.onDragStart(t,e)},onDragOver:function(t){return i.onDragOver(t,e)},onDragLeave:function(t){return i.onDragLeave(t,e)},onDrop:function(t){return i.onDrop(t,e)}},g,a.default.createElement("span",{className:"p-column-title"},e.props.header),h,y,o)}},{key:"renderHeaderRow",value:function(e,t){var n=this,o=a.default.Children.toArray(e.props.children).map((function(e,t){return n.renderHeaderCell(e,{index:t,filterOnly:!1,renderFilter:!0})}));return a.default.createElement("tr",{key:t},o)}},{key:"renderColumnGroup",value:function(){var e=this;return a.default.Children.toArray(this.props.columnGroup.props.children).map((function(t,n){return e.renderHeaderRow(t,n)}))}},{key:"renderColumns",value:function(e){var t=this;return e?this.hasColumnFilter(e)?a.default.createElement(a.default.Fragment,null,a.default.createElement("tr",null,e.map((function(e,n){return t.renderHeaderCell(e,{index:n,filterOnly:!1,renderFilter:!1})}))),a.default.createElement("tr",null,e.map((function(e,n){return t.renderHeaderCell(e,{index:n,filterOnly:!0,renderFilter:!0})})))):a.default.createElement("tr",null,e.map((function(e,n){return t.renderHeaderCell(e,{index:n,filterOnly:!1,renderFilter:!1})}))):null}},{key:"render",value:function(){var e=this.props.columnGroup?this.renderColumnGroup():this.renderColumns(this.props.columns);return a.default.createElement("thead",{className:"p-treetable-thead"},e)}}],[{key:"getDerivedStateFromProps",value:function(e,t){return{badgeVisible:e.multiSortMeta&&e.multiSortMeta.length>1}}}]),s}();function R(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=T(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function T(e,t){if(e){if("string"==typeof e)return H(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(e,t):void 0}}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var P=function(){function e(){y(this,e)}return g(e,null,[{key:"innerWidth",value:function(e){if(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)}return 0}},{key:"width",value:function(e){if(e){var t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),t}return 0}},{key:"getWindowScrollTop",value:function(){var e=document.documentElement;return(window.pageYOffset||e.scrollTop)-(e.clientTop||0)}},{key:"getWindowScrollLeft",value:function(){var e=document.documentElement;return(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}},{key:"getOuterWidth",value:function(e,t){if(e){var n=e.offsetWidth||e.getBoundingClientRect().width;if(t){var o=getComputedStyle(e);n+=parseFloat(o.marginLeft)+parseFloat(o.marginRight)}return n}return 0}},{key:"getOuterHeight",value:function(e,t){if(e){var n=e.offsetHeight||e.getBoundingClientRect().height;if(t){var o=getComputedStyle(e);n+=parseFloat(o.marginTop)+parseFloat(o.marginBottom)}return n}return 0}},{key:"getClientHeight",value:function(e,t){if(e){var n=e.clientHeight;if(t){var o=getComputedStyle(e);n+=parseFloat(o.marginTop)+parseFloat(o.marginBottom)}return n}return 0}},{key:"getClientWidth",value:function(e,t){if(e){var n=e.clientWidth;if(t){var o=getComputedStyle(e);n+=parseFloat(o.marginLeft)+parseFloat(o.marginRight)}return n}return 0}},{key:"getViewport",value:function(){var e=window,t=document,n=t.documentElement,o=t.getElementsByTagName("body")[0];return{width:e.innerWidth||n.clientWidth||o.clientWidth,height:e.innerHeight||n.clientHeight||o.clientHeight}}},{key:"getOffset",value:function(e){if(e){var t=e.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0)}}return{top:"auto",left:"auto"}}},{key:"index",value:function(e){if(e)for(var t=e.parentNode.childNodes,n=0,o=0;o<t.length;o++){if(t[o]===e)return n;1===t[o].nodeType&&n++}return-1}},{key:"addMultipleClasses",value:function(e,t){if(e&&t)if(e.classList)for(var n=t.split(" "),o=0;o<n.length;o++)e.classList.add(n[o]);else for(var r=t.split(" "),i=0;i<r.length;i++)e.className+=" "+r[i]}},{key:"removeMultipleClasses",value:function(e,t){if(e&&t)if(e.classList)for(var n=t.split(" "),o=0;o<n.length;o++)e.classList.remove(n[o]);else for(var r=t.split(" "),i=0;i<r.length;i++)e.className=e.className.replace(new RegExp("(^|\\b)"+r[i].split(" ").join("|")+"(\\b|$)","gi")," ")}},{key:"addClass",value:function(e,t){e&&t&&(e.classList?e.classList.add(t):e.className+=" "+t)}},{key:"removeClass",value:function(e,t){e&&t&&(e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "))}},{key:"hasClass",value:function(e,t){if(e)return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}},{key:"find",value:function(e,t){return e?Array.from(e.querySelectorAll(t)):[]}},{key:"findSingle",value:function(e,t){return e?e.querySelector(t):null}},{key:"getHeight",value:function(e){if(e){var t=e.offsetHeight,n=getComputedStyle(e);return t-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)}return 0}},{key:"getWidth",value:function(e){if(e){var t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth)}return 0}},{key:"alignOverlay",value:function(t,n,o){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];t&&n&&("self"===o?this.relativePosition(t,n):(r&&(t.style.minWidth=e.getOuterWidth(n)+"px"),this.absolutePosition(t,n)))}},{key:"absolutePosition",value:function(e,t){if(e){var n,o,r=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:this.getHiddenElementDimensions(e),i=r.height,l=r.width,s=t.offsetHeight,a=t.offsetWidth,p=t.getBoundingClientRect(),u=this.getWindowScrollTop(),c=this.getWindowScrollLeft(),d=this.getViewport();p.top+s+i>d.height?((n=p.top+u-i)<0&&(n=u),e.style.transformOrigin="bottom"):(n=s+p.top+u,e.style.transformOrigin="top"),o=p.left+a+l>d.width?Math.max(0,p.left+c+a-l):p.left+c,e.style.top=n+"px",e.style.left=o+"px"}}},{key:"relativePosition",value:function(e,t){if(e){var n,o,r=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:this.getHiddenElementDimensions(e),i=t.offsetHeight,l=t.getBoundingClientRect(),s=this.getViewport();l.top+i+r.height>s.height?(l.top+(n=-1*r.height)<0&&(n=-1*l.top),e.style.transformOrigin="bottom"):(n=i,e.style.transformOrigin="top"),o=r.width>s.width?-1*l.left:l.left+r.width>s.width?-1*(l.left+r.width-s.width):0,e.style.top=n+"px",e.style.left=o+"px"}}},{key:"flipfitCollision",value:function(t,n){var o=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left top",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"left bottom",l=arguments.length>4?arguments[4]:void 0,s=n.getBoundingClientRect(),a=this.getViewport(),p=r.split(" "),u=i.split(" "),c=function(e,t){return t?+e.substring(e.search(/(\+|-)/g))||0:e.substring(0,e.search(/(\+|-)/g))||e},d={my:{x:c(p[0]),y:c(p[1]||p[0]),offsetX:c(p[0],!0),offsetY:c(p[1]||p[0],!0)},at:{x:c(u[0]),y:c(u[1]||u[0]),offsetX:c(u[0],!0),offsetY:c(u[1]||u[0],!0)}},h={left:function(){return d.my.offsetX+d.at.offsetX+s.left+("left"===d.my.x?0:-1*("center"===d.my.x?o.getOuterWidth(t)/2:o.getOuterWidth(t)))},top:function(){return d.my.offsetY+d.at.offsetY+s.top+("top"===d.my.y?0:-1*("center"===d.my.y?o.getOuterHeight(t)/2:o.getOuterHeight(t)))}},f={count:{x:0,y:0},left:function(){var n=h.left(),o=e.getWindowScrollLeft();t.style.left=n+o+"px",2===this.count.x?(t.style.left=o+"px",this.count.x=0):n<0&&(this.count.x++,d.my.x="left",d.at.x="right",d.my.offsetX*=-1,d.at.offsetX*=-1,this.right())},right:function(){var o=h.left()+e.getOuterWidth(n),r=e.getWindowScrollLeft();t.style.left=o+r+"px",2===this.count.x?(t.style.left=a.width-e.getOuterWidth(t)+r+"px",this.count.x=0):o+e.getOuterWidth(t)>a.width&&(this.count.x++,d.my.x="right",d.at.x="left",d.my.offsetX*=-1,d.at.offsetX*=-1,this.left())},top:function(){var n=h.top(),o=e.getWindowScrollTop();t.style.top=n+o+"px",2===this.count.y?(t.style.left=o+"px",this.count.y=0):n<0&&(this.count.y++,d.my.y="top",d.at.y="bottom",d.my.offsetY*=-1,d.at.offsetY*=-1,this.bottom())},bottom:function(){var o=h.top()+e.getOuterHeight(n),r=e.getWindowScrollTop();t.style.top=o+r+"px",2===this.count.y?(t.style.left=a.height-e.getOuterHeight(t)+r+"px",this.count.y=0):o+e.getOuterHeight(n)>a.height&&(this.count.y++,d.my.y="bottom",d.at.y="top",d.my.offsetY*=-1,d.at.offsetY*=-1,this.top())},center:function(o){if("y"===o){var r=h.top()+e.getOuterHeight(n)/2;t.style.top=r+e.getWindowScrollTop()+"px",r<0?this.bottom():r+e.getOuterHeight(n)>a.height&&this.top()}else{var i=h.left()+e.getOuterWidth(n)/2;t.style.left=i+e.getWindowScrollLeft()+"px",i<0?this.left():i+e.getOuterWidth(t)>a.width&&this.right()}}};f[d.at.x]("x"),f[d.at.y]("y"),this.isFunction(l)&&l(d)}},{key:"findCollisionPosition",value:function(e){if(e){var t="left"===e?"right":"left";return"top"===e||"bottom"===e?{axis:"y",my:"center ".concat("top"===e?"bottom":"top"),at:"center ".concat(e)}:{axis:"x",my:"".concat(t," center"),at:"".concat(e," center")}}}},{key:"getParents",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return null===e.parentNode?t:this.getParents(e.parentNode,t.concat([e.parentNode]))}},{key:"getScrollableParents",value:function(e){var t=[];if(e){var n,o=this.getParents(e),r=/(auto|scroll)/,i=function(e){var t=e?getComputedStyle(e):null;return t&&(r.test(t.getPropertyValue("overflow"))||r.test(t.getPropertyValue("overflowX"))||r.test(t.getPropertyValue("overflowY")))},l=R(o);try{for(l.s();!(n=l.n()).done;){var s=n.value,a=1===s.nodeType&&s.dataset.scrollselectors;if(a){var p,u=R(a.split(","));try{for(u.s();!(p=u.n()).done;){var c=this.findSingle(s,p.value);c&&i(c)&&t.push(c)}}catch(e){u.e(e)}finally{u.f()}}9!==s.nodeType&&i(s)&&t.push(s)}}catch(e){l.e(e)}finally{l.f()}}return t}},{key:"getHiddenElementOuterHeight",value:function(e){if(e){e.style.visibility="hidden",e.style.display="block";var t=e.offsetHeight;return e.style.display="none",e.style.visibility="visible",t}return 0}},{key:"getHiddenElementOuterWidth",value:function(e){if(e){e.style.visibility="hidden",e.style.display="block";var t=e.offsetWidth;return e.style.display="none",e.style.visibility="visible",t}return 0}},{key:"getHiddenElementDimensions",value:function(e){var t={};return e&&(e.style.visibility="hidden",e.style.display="block",t.width=e.offsetWidth,t.height=e.offsetHeight,e.style.display="none",e.style.visibility="visible"),t}},{key:"fadeIn",value:function(e,t){if(e){e.style.opacity=0;var n=+new Date,o=0;!function r(){o=+e.style.opacity+((new Date).getTime()-n)/t,e.style.opacity=o,n=+new Date,+o<1&&(window.requestAnimationFrame&&requestAnimationFrame(r)||setTimeout(r,16))}()}}},{key:"fadeOut",value:function(e,t){if(e)var n=1,o=50/t,r=setInterval((function(){(n-=o)<=0&&(n=0,clearInterval(r)),e.style.opacity=n}),50)}},{key:"getUserAgent",value:function(){return navigator.userAgent}},{key:"isIOS",value:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}},{key:"isAndroid",value:function(){return/(android)/i.test(navigator.userAgent)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}},{key:"isFunction",value:function(e){return!!(e&&e.constructor&&e.call&&e.apply)}},{key:"appendChild",value:function(e,t){if(this.isElement(t))t.appendChild(e);else{if(!t.el||!t.el.nativeElement)throw new Error("Cannot append "+t+" to "+e);t.el.nativeElement.appendChild(e)}}},{key:"removeChild",value:function(e,t){if(this.isElement(t))t.removeChild(e);else{if(!t.el||!t.el.nativeElement)throw new Error("Cannot remove "+e+" from "+t);t.el.nativeElement.removeChild(e)}}},{key:"isElement",value:function(e){return"object"===("undefined"==typeof HTMLElement?"undefined":k(HTMLElement))?e instanceof HTMLElement:e&&"object"===k(e)&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}},{key:"scrollInView",value:function(e,t){var n=getComputedStyle(e).getPropertyValue("borderTopWidth"),o=n?parseFloat(n):0,r=getComputedStyle(e).getPropertyValue("paddingTop"),i=r?parseFloat(r):0,l=e.getBoundingClientRect(),s=t.getBoundingClientRect().top+document.body.scrollTop-(l.top+document.body.scrollTop)-o-i,a=e.scrollTop,p=e.clientHeight,u=this.getOuterHeight(t);s<0?e.scrollTop=a+s:s+u>p&&(e.scrollTop=a+s-p+u)}},{key:"clearSelection",value:function(){if(window.getSelection)window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().rangeCount>0&&window.getSelection().getRangeAt(0).getClientRects().length>0&&window.getSelection().removeAllRanges();else if(document.selection&&document.selection.empty)try{document.selection.empty()}catch(e){}}},{key:"calculateScrollbarWidth",value:function(e){if(e){var t=getComputedStyle(e);return e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth)}if(null!=this.calculatedScrollbarWidth)return this.calculatedScrollbarWidth;var n=document.createElement("div");n.className="p-scrollbar-measure",document.body.appendChild(n);var o=n.offsetWidth-n.clientWidth;return document.body.removeChild(n),this.calculatedScrollbarWidth=o,o}},{key:"getBrowser",value:function(){if(!this.browser){var e=this.resolveUserAgent();this.browser={},e.browser&&(this.browser[e.browser]=!0,this.browser.version=e.version),this.browser.chrome?this.browser.webkit=!0:this.browser.webkit&&(this.browser.safari=!0)}return this.browser}},{key:"resolveUserAgent",value:function(){var e=navigator.userAgent.toLowerCase(),t=/(chrome)[ ]([\w.]+)/.exec(e)||/(webkit)[ ]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ ]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}}},{key:"isVisible",value:function(e){return e&&null!=e.offsetParent}},{key:"isExist",value:function(e){return null!=e&&e.nodeName&&e.parentNode}},{key:"hasDOM",value:function(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}},{key:"getFocusableElements",value:function(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.find(t,'button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])'.concat(o,',\n [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(o,',\n input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(o,',\n select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(o,',\n textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(o,',\n [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(o,',\n [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(o)),i=[],l=R(r);try{for(l.s();!(n=l.n()).done;){var s=n.value;"none"!==getComputedStyle(s).display&&"hidden"!==getComputedStyle(s).visibility&&i.push(s)}}catch(e){l.e(e)}finally{l.f()}return i}},{key:"getFirstFocusableElement",value:function(t,n){var o=e.getFocusableElements(t,n);return o.length>0?o[0]:null}},{key:"getLastFocusableElement",value:function(t,n){var o=e.getFocusableElements(t,n);return o.length>0?o[o.length-1]:null}},{key:"getCursorOffset",value:function(e,t,n,o){if(e){var r=getComputedStyle(e),i=document.createElement("div");i.style.position="absolute",i.style.top="0px",i.style.left="0px",i.style.visibility="hidden",i.style.pointerEvents="none",i.style.overflow=r.overflow,i.style.width=r.width,i.style.height=r.height,i.style.padding=r.padding,i.style.border=r.border,i.style.overflowWrap=r.overflowWrap,i.style.whiteSpace=r.whiteSpace,i.style.lineHeight=r.lineHeight,i.innerHTML=t.replace(/\r\n|\r|\n/g,"<br />");var l=document.createElement("span");l.textContent=o,i.appendChild(l);var s=document.createTextNode(n);i.appendChild(s),document.body.appendChild(i);var a=l.offsetLeft,p=l.offsetTop,u=l.clientHeight;return document.body.removeChild(i),{left:Math.abs(a-e.scrollLeft),top:Math.abs(p-e.scrollTop)+u}}return{top:"auto",left:"auto"}}},{key:"invokeElementMethod",value:function(e,t,n){e[t].apply(e,n)}},{key:"isClickable",value:function(e){var t=e.nodeName,n=e.parentElement&&e.parentElement.nodeName;return"INPUT"===t||"TEXTAREA"===t||"BUTTON"===t||"A"===t||"INPUT"===n||"TEXTAREA"===n||"BUTTON"===n||"A"===n||this.hasClass(e,"p-button")||this.hasClass(e.parentElement,"p-button")||this.hasClass(e.parentElement,"p-checkbox")||this.hasClass(e.parentElement,"p-radiobutton")}},{key:"applyStyle",value:function(e,t){if("string"==typeof t)e.style.cssText=this.style;else for(var n in this.style)e.style[n]=t[n]}},{key:"exportCSV",value:function(t,n){var o=new Blob([t],{type:"application/csv;charset=utf-8;"});window.navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(o,n+".csv"):e.saveAs({name:n+".csv",src:URL.createObjectURL(o)})||(t="data:text/csv;charset=utf-8,"+t,window.open(encodeURI(t)))}},{key:"saveAs",value:function(e){if(e){var t=document.createElement("a");if(void 0!==t.download){var n=e.name;return t.setAttribute("href",e.src),t.setAttribute("download",n),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t),!0}}return!1}},{key:"createInlineStyle",value:function(e){var t=document.createElement("style");try{e||(e=process.env.REACT_APP_CSS_NONCE)}catch(e){}return e&&t.setAttribute("nonce",e),document.head.appendChild(t),t}},{key:"removeInlineStyle",value:function(e){if(this.isExist(e)){try{document.head.removeChild(e)}catch(e){}e=null}return e}}]),e}();function N(){return N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},N.apply(this,arguments)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var L=function(t){C(s,e.Component);var o,r,l=(o=s,r=z(),function(){var e,t=w(o);if(r){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function s(e){var t;return y(this,s),(t=l.call(this,e)).props.editor&&(t.state={}),t.onClick=t.onClick.bind(v(t)),t.onKeyDown=t.onKeyDown.bind(v(t)),t.onEditorFocus=t.onEditorFocus.bind(v(t)),t}return g(s,[{key:"onClick",value:function(){var e=this;this.props.editor&&!this.state.editing&&(this.props.selectOnEdit||!this.props.selectOnEdit&&this.props.selected)&&(this.selfClick=!0,this.setState({editing:!0},(function(){e.bindDocumentEditListener(),e.overlayEventListener=function(t){e.isOutsideClicked(t.target)||(e.selfClick=!0)},i.OverlayService.on("overlay-click",e.overlayEventListener)})))}},{key:"onKeyDown",value:function(e){13!==e.which&&9!==e.which||this.switchCellToViewMode(e)}},{key:"bindDocumentEditListener",value:function(){var e=this;this.documentEditListener||(this.documentEditListener=function(t){!e.selfClick&&e.isOutsideClicked(t.target)&&e.switchCellToViewMode(t),e.selfClick=!1},document.addEventListener("click",this.documentEditListener))}},{key:"isOutsideClicked",value:function(e){return this.container&&!(this.container.isSameNode(e)||this.container.contains(e))}},{key:"unbindDocumentEditListener",value:function(){this.documentEditListener&&(document.removeEventListener("click",this.documentEditListener),this.documentEditListener=null,this.selfClick=!1)}},{key:"closeCell",value:function(){var e=this;setTimeout((function(){e.setState({editing:!1},(function(){e.unbindDocumentEditListener(),i.OverlayService.off("overlay-click",e.overlayEventListener),e.overlayEventListener=null}))}),1)}},{key:"onEditorFocus",value:function(e){this.onClick(e)}},{key:"switchCellToViewMode",value:function(e){this.props.cellEditValidator?this.props.cellEditValidator({originalEvent:e,columnProps:this.props})&&this.closeCell():this.closeCell()}},{key:"componentDidUpdate",value:function(){var e=this;if(this.container&&this.props.editor)if(clearTimeout(this.tabindexTimeout),this.state&&this.state.editing){var t=n.DomHandler.findSingle(this.container,"input");t&&document.activeElement!==t&&!t.hasAttribute("data-isCellEditing")&&(t.setAttribute("data-isCellEditing",!0),t.focus()),this.keyHelper.tabIndex=-1}else this.tabindexTimeout=setTimeout((function(){e.keyHelper&&e.keyHelper.setAttribute("tabindex",0)}),50)}},{key:"componentWillUnmount",value:function(){this.unbindDocumentEditListener(),this.overlayEventListener&&(i.OverlayService.off("overlay-click",this.overlayEventListener),this.overlayEventListener=null)}},{key:"render",value:function(){var e,t=this,o=n.classNames(this.props.bodyClassName||this.props.className,{"p-editable-column":this.props.editor,"p-cell-editing":!!this.props.editor&&this.state.editing}),r=this.props.bodyStyle||this.props.style;if(this.state&&this.state.editing){if(!this.props.editor)throw new Error("Editor is not found on column.");e=n.ObjectUtils.getJSXElement(this.props.editor,{node:this.props.node,rowData:this.props.node.data,value:n.ObjectUtils.resolveFieldData(this.props.node.data,this.props.field),field:this.props.field,rowIndex:this.props.rowIndex,props:this.props})}else e=this.props.body?n.ObjectUtils.getJSXElement(this.props.body,this.props.node,{field:this.props.field,rowIndex:this.props.rowIndex,props:this.props}):n.ObjectUtils.resolveFieldData(this.props.node.data,this.props.field);return a.default.createElement("td",{ref:function(e){return t.container=e},className:o,style:r,onClick:this.onClick,onKeyDown:this.onKeyDown},this.props.children,this.props.editor&&a.default.createElement("a",{tabIndex:0,ref:function(e){t.keyHelper=e},className:"p-cell-editor-key-helper p-hidden-accessible",onFocus:this.onEditorFocus},a.default.createElement("span",null)),e)}}]),s}();function K(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=I(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function I(e,t){if(e){if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function W(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var B=function(t){C(s,e.Component);var o,r,i=(o=s,r=W(),function(){var e,t=w(o);if(r){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function s(e){var t;return y(this,s),(t=i.call(this,e)).onTogglerClick=t.onTogglerClick.bind(v(t)),t.onClick=t.onClick.bind(v(t)),t.onTouchEnd=t.onTouchEnd.bind(v(t)),t.propagateUp=t.propagateUp.bind(v(t)),t.onCheckboxChange=t.onCheckboxChange.bind(v(t)),t.onCheckboxFocus=t.onCheckboxFocus.bind(v(t)),t.onCheckboxBlur=t.onCheckboxBlur.bind(v(t)),t.onRightClick=t.onRightClick.bind(v(t)),t.onKeyDown=t.onKeyDown.bind(v(t)),t}return g(s,[{key:"isLeaf",value:function(){return!1!==this.props.node.leaf&&!(this.props.node.children&&this.props.node.children.length)}},{key:"onTogglerClick",value:function(e){this.isExpanded()?this.collapse(e):this.expand(e),e.preventDefault(),e.stopPropagation()}},{key:"expand",value:function(e){var t=this.props.expandedKeys?A({},this.props.expandedKeys):{};t[this.props.node.key]=!0,this.props.onToggle({originalEvent:e,value:t}),this.invokeToggleEvents(e,!0)}},{key:"collapse",value:function(e){var t=A({},this.props.expandedKeys);delete t[this.props.node.key],this.props.onToggle({originalEvent:e,value:t}),this.invokeToggleEvents(e,!1)}},{key:"invokeToggleEvents",value:function(e,t){t?this.props.onExpand&&this.props.onExpand({originalEvent:e,node:this.props.node}):this.props.onCollapse&&this.props.onCollapse({originalEvent:e,node:this.props.node})}},{key:"onClick",value:function(e){this.props.onRowClick&&this.props.onRowClick(e,this.props.node),this.nodeTouched=!1}},{key:"onTouchEnd",value:function(){this.nodeTouched=!0}},{key:"onCheckboxChange",value:function(e){var t=this.isChecked(),o=this.props.selectionKeys?A({},this.props.selectionKeys):{};t?(this.props.propagateSelectionDown?this.propagateDown(this.props.node,!1,o):delete o[this.props.node.key],this.props.propagateSelectionUp&&this.props.onPropagateUp&&this.props.onPropagateUp({originalEvent:e,check:!1,selectionKeys:o}),this.props.onUnselect&&this.props.onUnselect({originalEvent:e,node:this.props.node})):(this.props.propagateSelectionDown?this.propagateDown(this.props.node,!0,o):o[this.props.node.key]={checked:!0},this.props.propagateSelectionUp&&this.props.onPropagateUp&&this.props.onPropagateUp({originalEvent:e,check:!0,selectionKeys:o}),this.props.onSelect&&this.props.onSelect({originalEvent:e,node:this.props.node})),this.props.onSelectionChange&&this.props.onSelectionChange({originalEvent:e,value:o}),n.DomHandler.clearSelection()}},{key:"onCheckboxFocus",value:function(){n.DomHandler.addClass(this.checkboxBox,"p-focus"),n.DomHandler.addClass(this.checkboxRef,"p-checkbox-focused")}},{key:"onCheckboxBlur",value:function(){n.DomHandler.removeClass(this.checkboxBox,"p-focus"),n.DomHandler.removeClass(this.checkboxRef,"p-checkbox-focused")}},{key:"propagateUp",value:function(e){var t,n=e.check,o=e.selectionKeys,r=0,i=!1,l=K(this.props.node.children);try{for(l.s();!(t=l.n()).done;){var s=t.value;o[s.key]&&o[s.key].checked?r++:o[s.key]&&o[s.key].partialChecked&&(i=!0)}}catch(e){l.e(e)}finally{l.f()}n&&r===this.props.node.children.length?o[this.props.node.key]={checked:!0,partialChecked:!1}:(n||delete o[this.props.node.key],o[this.props.node.key]=i||r>0&&r!==this.props.node.children.length?{checked:!1,partialChecked:!0}:{checked:!1,partialChecked:!1}),this.props.propagateSelectionUp&&this.props.onPropagateUp&&this.props.onPropagateUp(e)}},{key:"propagateDown",value:function(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(var o=0;o<e.children.length;o++)this.propagateDown(e.children[o],t,n)}},{key:"onRightClick",value:function(e){n.DomHandler.clearSelection(),this.props.onContextMenuSelectionChange&&this.props.onContextMenuSelectionChange({originalEvent:e,value:this.props.node.key}),this.props.onContextMenu&&this.props.onContextMenu({originalEvent:e,node:this.props.node})}},{key:"onKeyDown",value:function(e){if(e.target===this.container){var t=e.currentTarget;switch(e.which){case 40:var n=t.nextElementSibling;n&&n.focus(),e.preventDefault();break;case 38:var o=t.previousElementSibling;o&&o.focus(),e.preventDefault();break;case 39:this.isExpanded()||this.expand(e),e.preventDefault();break;case 37:this.isExpanded()&&this.collapse(e),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}}}},{key:"isExpanded",value:function(){return!!this.props.expandedKeys&&void 0!==this.props.expandedKeys[this.props.node.key]}},{key:"isSelected",value:function(){return!("single"!==this.props.selectionMode&&"multiple"!==this.props.selectionMode||!this.props.selectionKeys)&&("single"===this.props.selectionMode?this.props.selectionKeys===this.props.node.key:void 0!==this.props.selectionKeys[this.props.node.key])}},{key:"isChecked",value:function(){return!!this.props.selectionKeys&&(this.props.selectionKeys[this.props.node.key]&&this.props.selectionKeys[this.props.node.key].checked)}},{key:"isPartialChecked",value:function(){return!!this.props.selectionKeys&&(this.props.selectionKeys[this.props.node.key]&&this.props.selectionKeys[this.props.node.key].partialChecked)}},{key:"renderToggler",value:function(){var e=this.isExpanded(),t=n.classNames('"p-treetable-toggler-icon pi pi-fw',{"pi-chevron-right":!e,"pi-chevron-down":e});return a.default.createElement("button",{type:"button",className:"p-treetable-toggler p-link p-unselectable-text",onClick:this.onTogglerClick,tabIndex:-1,style:{marginLeft:16*this.props.level+"px",visibility:!1===this.props.node.leaf||this.props.node.children&&this.props.node.children.length?"visible":"hidden"}},a.default.createElement("i",{className:t}),a.default.createElement(l.Ripple,null))}},{key:"renderCheckbox",value:function(){var e=this;if("checkbox"===this.props.selectionMode&&!1!==this.props.node.selectable){var t=this.isChecked(),o=this.isPartialChecked(),r=n.classNames("p-checkbox-box",{"p-highlight":t,"p-indeterminate":o}),i=n.classNames("p-checkbox-icon p-c",{"pi pi-check":t,"pi pi-minus":o});return a.default.createElement("div",{className:"p-checkbox p-treetable-checkbox p-component",ref:function(t){return e.checkboxRef=t},onClick:this.onCheckboxChange,role:"checkbox","aria-checked":t},a.default.createElement("div",{className:"p-hidden-accessible"},a.default.createElement("input",{type:"checkbox",onFocus:this.onCheckboxFocus,onBlur:this.onCheckboxBlur})),a.default.createElement("div",{className:r,ref:function(t){return e.checkboxBox=t}},a.default.createElement("span",{className:i})))}return null}},{key:"renderCell",value:function(e){var t,n;return e.props.expander&&(t=this.renderToggler(),n=this.renderCheckbox()),a.default.createElement(L,N({key:e.props.columnKey||e.props.field},e.props,{selectOnEdit:this.props.selectOnEdit,selected:this.isSelected(),node:this.props.node,rowIndex:this.props.rowIndex}),t,n)}},{key:"renderChildren",value:function(){var e=this;return this.isExpanded()&&this.props.node.children?this.props.node.children.map((function(t,n){return a.default.createElement(s,{key:t.key||JSON.stringify(t.data),level:e.props.level+1,rowIndex:e.props.rowIndex+"_"+n,node:t,columns:e.props.columns,expandedKeys:e.props.expandedKeys,selectOnEdit:e.props.selectOnEdit,onToggle:e.props.onToggle,onExpand:e.props.onExpand,onCollapse:e.props.onCollapse,selectionMode:e.props.selectionMode,selectionKeys:e.props.selectionKeys,onSelectionChange:e.props.onSelectionChange,metaKeySelection:e.props.metaKeySelection,onRowClick:e.props.onRowClick,onSelect:e.props.onSelect,onUnselect:e.props.onUnselect,propagateSelectionUp:e.props.propagateSelectionUp,propagateSelectionDown:e.props.propagateSelectionDown,onPropagateUp:e.propagateUp,rowClassName:e.props.rowClassName,contextMenuSelectionKey:e.props.contextMenuSelectionKey,onContextMenuSelectionChange:e.props.onContextMenuSelectionChange,onContextMenu:e.props.onContextMenu})})):null}},{key:"render",value:function(){var e=this,t=this.props.columns.map((function(t){return e.renderCell(t)})),o=this.renderChildren(),r={"p-highlight":this.isSelected(),"p-highlight-contextmenu":this.props.contextMenuSelectionKey&&this.props.contextMenuSelectionKey===this.props.node.key};if(this.props.rowClassName){var i=this.props.rowClassName(this.props.node);r=A(A({},r),i)}return r=n.classNames(r,this.props.node.className),a.default.createElement(a.default.Fragment,null,a.default.createElement("tr",{ref:function(t){return e.container=t},tabIndex:0,className:r,style:this.props.node.style,onClick:this.onClick,onTouchEnd:this.onTouchEnd,onContextMenu:this.onRightClick,onKeyDown:this.onKeyDown},t),o)}}]),s}();function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function X(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function _(e,t){if(e){if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}x(B,"defaultProps",{node:null,level:null,columns:null,expandedKeys:null,contextMenuSelectionKey:null,selectionMode:null,selectionKeys:null,metaKeySelection:!0,propagateSelectionUp:!0,propagateSelectionDown:!0,rowClassName:null,onExpand:null,onCollapse:null,onToggle:null,onRowClick:null,onSelect:null,onUnselect:null,onSelectionChange:null,onPropagateUp:null,onContextMenuSelectionChange:null,onContextMenu:null});var $=function(n){C(l,e.Component);var o,r,i=(o=l,r=Y(),function(){var e,t=w(o);if(r){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function l(e){var t;return y(this,l),(t=i.call(this,e)).onRowClick=t.onRowClick.bind(v(t)),t}return g(l,[{key:"createRow",value:function(e,t){return a.default.createElement(B,{key:e.key||JSON.stringify(e.data),level:0,rowIndex:t,selectOnEdit:this.props.selectOnEdit,node:e,columns:this.props.columns,expandedKeys:this.props.expandedKeys,onToggle:this.props.onToggle,onExpand:this.props.onExpand,onCollapse:this.props.onCollapse,selectionMode:this.props.selectionMode,selectionKeys:this.props.selectionKeys,onSelectionChange:this.props.onSelectionChange,metaKeySelection:this.props.metaKeySelection,onRowClick:this.onRowClick,onSelect:this.props.onSelect,onUnselect:this.props.onUnselect,propagateSelectionUp:this.props.propagateSelectionUp,propagateSelectionDown:this.props.propagateSelectionDown,rowClassName:this.props.rowClassName,contextMenuSelectionKey:this.props.contextMenuSelectionKey,onContextMenuSelectionChange:this.props.onContextMenuSelectionChange,onContextMenu:this.props.onContextMenu})}},{key:"flattenizeTree",value:function(e){var t,n=[],o=X(e=e||this.props.value);try{for(o.s();!(t=o.n()).done;){var r=t.value;n.push(r.key),this.isExpandedKey(r.key)&&(n=n.concat(this.flattenizeTree(r.children)))}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"isExpandedKey",value:function(e){return this.props.expandedKeys&&!!this.props.expandedKeys[e]}},{key:"onRowClick",value:function(e,t){var n=this;this.props.onRowClick&&this.props.onRowClick({originalEvent:e,node:t});var o=e.target.nodeName;if(!("INPUT"===o||"BUTTON"===o||"A"===o||P.hasClass(e.target,"p-clickable")||P.hasClass(e.target,"p-treetable-toggler")||P.hasClass(e.target.parentElement,"p-treetable-toggler"))&&(this.isSingleSelectionMode()||this.isMultipleSelectionMode())&&!1!==t.selectable){var r,i=this.isSelected(t),l=!this.nodeTouched&&this.props.metaKeySelection,s=this.flattenizeTree(),a=s.findIndex((function(e){return e===t.key}));if(this.isMultipleSelectionMode()&&e.shiftKey){P.clearSelection();var p=s.findIndex((function(e){return n.props.selectionKeys[e]})),u=Math.min(a,p),c=Math.max(a,p);r=V({},this.props.selectionKeys);for(var d=u;d<=c;d++){r[s[d]]=!0}}else if(this.anchorRowIndex=a,l){var h=e.metaKey||e.ctrlKey;i&&h?(this.isSingleSelectionMode()?r=null:delete(r=V({},this.props.selectionKeys))[t.key],this.props.onUnselect&&this.props.onUnselect({originalEvent:e,node:t})):(this.isSingleSelectionMode()?r=t.key:this.isMultipleSelectionMode()&&((r=h&&this.props.selectionKeys?V({},this.props.selectionKeys):{})[t.key]=!0),this.props.onSelect&&this.props.onSelect({originalEvent:e,node:t}))}else this.isSingleSelectionMode()?i?(r=null,this.props.onUnselect&&this.props.onUnselect({originalEvent:e,node:t})):(r=t.key,this.props.onSelect&&this.props.onSelect({originalEvent:e,node:t})):i?(delete(r=V({},this.props.selectionKeys))[t.key],this.props.onUnselect&&this.props.onUnselect({originalEvent:e,node:t})):((r=this.props.selectionKeys?V({},this.props.selectionKeys):{})[t.key]=!0,this.props.onSelect&&this.props.onSelect({originalEvent:e,node:t}));this.props.onSelectionChange&&this.props.onSelectionChange({originalEvent:e,value:r})}}},{key:"isSingleSelectionMode",value:function(){return this.props.selectionMode&&"single"===this.props.selectionMode}},{key:"isMultipleSelectionMode",value:function(){return this.props.selectionMode&&"multiple"===this.props.selectionMode}},{key:"isSelected",value:function(e){return!("single"!==this.props.selectionMode&&"multiple"!==this.props.selectionMode||!this.props.selectionKeys)&&("single"===this.props.selectionMode?this.props.selectionKeys===e.key:void 0!==this.props.selectionKeys[e.key])}},{key:"renderRows",value:function(){var e=this;if(this.props.paginator&&!this.props.lazy){for(var t=this.props.first||0,n=t+(this.props.rows||0),o=[],r=t;r<n;r++){if(!this.props.value[r])break;o.push(this.createRow(this.props.value[r]))}return o}return this.props.value.map((function(t,n){return e.createRow(t,n)}))}},{key:"renderEmptyMessage",value:function(){if(this.props.loading)return null;var e=this.props.columns?this.props.columns.length:null,n=this.props.emptyMessage||t.localeOption("emptyMessage");return a.default.createElement("tr",null,a.default.createElement("td",{className:"p-treetable-emptymessage",colSpan:e},n))}},{key:"render",value:function(){var e=this.props.value&&this.props.value.length?this.renderRows():this.renderEmptyMessage();return a.default.createElement("tbody",{className:"p-treetable-tbody"},e)}}]),l}();function J(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}x($,"defaultProps",{value:null,columns:null,expandedKeys:null,contextMenuSelectionKey:null,paginator:!1,first:null,rows:null,selectionMode:null,selectionKeys:null,metaKeySelection:!0,propagateSelectionUp:!0,propagateSelectionDown:!0,lazy:!1,rowClassName:null,emptyMessage:null,loading:!1,onExpand:null,onCollapse:null,onToggle:null,onRowClick:null,onSelect:null,onUnselect:null,onSelectionChange:null,onContextMenuSelectionChange:null,onContextMenu:null});var Q=function(t){C(i,e.Component);var n,o,r=(n=i,o=J(),function(){var e,t=w(n);if(o){var r=w(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return S(this,e)});function i(){return y(this,i),r.apply(this,arguments)}return g(i,[{key:"renderFooterCell",value:function(e,t){return a.default.createElement("td",{key:e.field||t,className:e.props.footerClassName||e.props.className,style:e.props.footerStyle||e.props.style,rowSpan:e.props.rowSpan,colSpan:e.props.colSpan},e.props.footer)}},{key:"renderFooterRow",value:function(e,t){var n=this,o=a.default.Children.toArray(e.props.children).map((function(e,t){return n.renderFooterCell(e,t)}));return a.default.createElement("tr",{key:t},o)}},{key:"renderColumnGroup",value:function(){var e=this;return a.default.Children.toArray(this.props.columnGroup.props.children).map((function(t,n){return e.renderFooterRow(t,n)}))}},{key:"renderColumns",value:function(e){var t=this;if(e){var n=e.map((function(e,n){return t.renderFooterCell(e,n)}));return a.default.createElement("tr",null,n)}return null}},{key:"hasFooter",value:function(){if(this.props.columnGroup)return!0;for(var e=0;e<this.props.columns.length;e++)if(this.props.columns[e].props.footer)return!0;return!1}},{key:"render",value:function(){var e=this.props.columnGroup?this.renderColumnGroup():this.renderColumns(this.props.columns);return this.hasFooter()?a.default.createElement("tfoot",{className:"p-treetable-tfoot"},e):null}}]),i}();function Z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}x(Q,"defaultProps",{columns:null,columnGroup:null});var ee=function(t){C(l,e.Component);var o,r,i=(o=l,r=Z(),function(){var e,t=w(o);if(r){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function l(e){var t;return y(this,l),(t=i.call(this,e)).onHeaderScroll=t.onHeaderScroll.bind(v(t)),t.onBodyScroll=t.onBodyScroll.bind(v(t)),t}return g(l,[{key:"componentDidMount",value:function(){if(this.setScrollHeight(),this.props.frozen)this.scrollBody.style.paddingBottom=n.DomHandler.calculateScrollbarWidth()+"px";else{var e=n.DomHandler.calculateScrollbarWidth();this.scrollHeaderBox.style.marginRight=e+"px",this.scrollFooterBox&&(this.scrollFooterBox.style.marginRight=e+"px")}}},{key:"componentDidUpdate",value:function(){this.setScrollHeight()}},{key:"setScrollHeight",value:function(){if(this.props.scrollHeight)if(-1!==this.props.scrollHeight.indexOf("%")){var e=this.findDataTableContainer(this.container);this.scrollBody.style.visibility="hidden",this.scrollBody.style.height="100px";var t=n.DomHandler.getOuterHeight(e),o=n.DomHandler.getOuterHeight(e.parentElement)*parseInt(this.props.scrollHeight,10)/100-(t-100);this.scrollBody.style.height="auto",this.scrollBody.style.maxHeight=o+"px",this.scrollBody.style.visibility="visible"}else this.scrollBody.style.maxHeight=this.props.scrollHeight}},{key:"findDataTableContainer",value:function(e){if(e){for(var t=e;t&&!n.DomHandler.hasClass(t,"p-treetable");)t=t.parentElement;return t}return null}},{key:"onHeaderScroll",value:function(){this.scrollHeader.scrollLeft=0}},{key:"onBodyScroll",value:function(){var e,t=this.container.previousElementSibling;t&&(e=n.DomHandler.findSingle(t,".p-treetable-scrollable-body")),this.scrollHeaderBox.style.marginLeft=-1*this.scrollBody.scrollLeft+"px",this.scrollFooterBox&&(this.scrollFooterBox.style.marginLeft=-1*this.scrollBody.scrollLeft+"px"),e&&(e.scrollTop=this.scrollBody.scrollTop)}},{key:"calculateRowHeight",value:function(){var e=n.DomHandler.findSingle(this.scrollTable,"tr:not(.p-treetable-emptymessage-row)");e&&(this.rowHeight=n.DomHandler.getOuterHeight(e))}},{key:"renderColGroup",value:function(){return this.props.columns&&this.props.columns.length?a.default.createElement("colgroup",{className:"p-treetable-scrollable-colgroup"},this.props.columns.map((function(e,t){return a.default.createElement("col",{key:e.field+"_"+t})}))):null}},{key:"render",value:function(){var e=this,t=n.classNames("p-treetable-scrollable-view",{"p-treetable-frozen-view":this.props.frozen,"p-treetable-unfrozen-view":!this.props.frozen&&this.props.frozenWidth}),o=this.props.frozen?this.props.frozenWidth:"calc(100% - "+this.props.frozenWidth+")",r=this.props.frozen?null:this.props.frozenWidth,i=this.renderColGroup(),l=!this.props.frozen&&this.props.scrollHeight?{overflowY:"scroll"}:null;return a.default.createElement("div",{className:t,style:{width:o,left:r},ref:function(t){e.container=t}},a.default.createElement("div",{className:"p-treetable-scrollable-header",ref:function(t){e.scrollHeader=t},onScroll:this.onHeaderScroll},a.default.createElement("div",{className:"p-treetable-scrollable-header-box",ref:function(t){e.scrollHeaderBox=t}},a.default.createElement("table",{className:"p-treetable-scrollable-header-table"},i,this.props.header))),a.default.createElement("div",{className:"p-treetable-scrollable-body",ref:function(t){e.scrollBody=t},style:l,onScroll:this.onBodyScroll},a.default.createElement("table",{ref:function(t){e.scrollTable=t},style:{top:"0"},className:"p-treetable-scrollable-body-table"},i,this.props.body)),a.default.createElement("div",{className:"p-treetable-scrollable-footer",ref:function(t){e.scrollFooter=t}},a.default.createElement("div",{className:"p-treetable-scrollable-footer-box",ref:function(t){e.scrollFooterBox=t}},a.default.createElement("table",{className:"p-treetable-scrollable-footer-table"},i,this.props.footer))))}}]),l}();function te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ne(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw i}}}}function ne(e,t){if(e){if("string"==typeof e)return oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oe(e,t):void 0}}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function le(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}x(ee,"defaultProps",{header:null,body:null,footer:null,columns:null,frozen:null,frozenWidth:null,frozenBody:null});var se=function(r){C(p,e.Component);var i,l,s=(i=p,l=le(),function(){var e,t=w(i);if(l){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function p(e){var t;y(this,p);var n={};return(t=s.call(this,e)).props.onToggle||(t.state={expandedKeys:t.props.expandedKeys}),t.props.onPage||(n.first=e.first,n.rows=e.rows),t.props.onSort||(n.sortField=e.sortField,n.sortOrder=e.sortOrder,n.multiSortMeta=e.multiSortMeta),t.props.onFilter||(n.filters=e.filters),Object.keys(n).length&&(t.state=n),t.onToggle=t.onToggle.bind(v(t)),t.onPageChange=t.onPageChange.bind(v(t)),t.onSort=t.onSort.bind(v(t)),t.onFilter=t.onFilter.bind(v(t)),t.onColumnResizeStart=t.onColumnResizeStart.bind(v(t)),t.onColumnDragStart=t.onColumnDragStart.bind(v(t)),t.onColumnDragOver=t.onColumnDragOver.bind(v(t)),t.onColumnDragLeave=t.onColumnDragLeave.bind(v(t)),t.onColumnDrop=t.onColumnDrop.bind(v(t)),t}return g(p,[{key:"onToggle",value:function(e){this.props.onToggle?this.props.onToggle(e):this.setState({expandedKeys:e.value})}},{key:"onPageChange",value:function(e){this.props.onPage?this.props.onPage(e):this.setState({first:e.first,rows:e.rows})}},{key:"onSort",value:function(e){var t,n,o=e.sortField,r=this.props.defaultSortOrder;if(this.columnSortable=e.sortable,this.columnSortFunction=e.sortFunction,this.columnField=e.sortField,"multiple"===this.props.sortMode){var i=e.originalEvent.metaKey||e.originalEvent.ctrlKey;if((t=this.getMultiSortMeta())&&t instanceof Array){var l=t.find((function(e){return e.field===o}));r=l?this.getCalculatedSortOrder(l.order):r}var s={field:o,order:r};r?(t&&i||(t=[]),this.addSortMeta(s,t)):this.props.removableSort&&t&&this.removeSortMeta(s,t),n={multiSortMeta:t}}else r=this.getSortField()===o?this.getCalculatedSortOrder(this.getSortOrder()):r,this.props.removableSort&&(o=r?o:null),n={sortField:o,sortOrder:r};this.props.onSort?this.props.onSort(n):(n.first=0,this.setState(n))}},{key:"getCalculatedSortOrder",value:function(e){return this.props.removableSort?this.props.defaultSortOrder===e?-1*e:0:-1*e}},{key:"addSortMeta",value:function(e,t){for(var n=-1,o=0;o<t.length;o++)if(t[o].field===e.field){n=o;break}n>=0?t[n]=e:t.push(e)}},{key:"removeSortMeta",value:function(e,t){for(var n=-1,o=0;o<t.length;o++)if(t[o].field===e.field){n=o;break}n>=0&&t.splice(n,1),t=t.length>0?t:null}},{key:"sortSingle",value:function(e){return this.sortNodes(e)}},{key:"sortNodes",value:function(e){var t=this,o=f(e);if(this.columnSortable&&"custom"===this.columnSortable&&this.columnSortFunction)o=this.columnSortFunction({field:this.getSortField(),order:this.getSortOrder()});else{o.sort((function(e,o){var r=t.getSortField(),i=n.ObjectUtils.resolveFieldData(e.data,r),l=n.ObjectUtils.resolveFieldData(o.data,r),s=null;return s=null==i&&null!=l?-1:null!=i&&null==l?1:null==i&&null==l?0:"string"==typeof i&&"string"==typeof l?i.localeCompare(l,void 0,{numeric:!0}):i<l?-1:i>l?1:0,t.getSortOrder()*s}));for(var r=0;r<o.length;r++)o[r].children&&o[r].children.length&&(o[r].children=this.sortNodes(o[r].children))}return o}},{key:"sortMultiple",value:function(e){var t=this.getMultiSortMeta();return t?this.sortMultipleNodes(e,t):e}},{key:"sortMultipleNodes",value:function(e,t){var n=this,o=f(e);o.sort((function(e,o){return n.multisortField(e,o,t,0)}));for(var r=0;r<o.length;r++)o[r].children&&o[r].children.length&&(o[r].children=this.sortMultipleNodes(o[r].children,t));return o}},{key:"multisortField",value:function(e,t,o,r){var i=n.ObjectUtils.resolveFieldData(e.data,o[r].field),l=n.ObjectUtils.resolveFieldData(t.data,o[r].field),s=null;if(null==i&&null!=l)s=-1;else if(null!=i&&null==l)s=1;else if(null==i&&null==l)s=0;else{if(i===l)return o.length-1>r?this.multisortField(e,t,o,r+1):0;if(("string"==typeof i||i instanceof String)&&("string"==typeof l||l instanceof String))return o[r].order*i.localeCompare(l,void 0,{numeric:!0});s=i<l?-1:1}return o[r].order*s}},{key:"filter",value:function(e,t,n){this.onFilter({value:e,field:t,matchMode:n})}},{key:"onFilter",value:function(e){var t=this.getFilters(),n=t?ie({},t):{};this.isFilterBlank(e.value)?n[e.field]&&delete n[e.field]:n[e.field]={value:e.value,matchMode:e.matchMode},this.props.onFilter?this.props.onFilter({filters:n}):this.setState({first:0,filters:n})}},{key:"hasFilter",value:function(){var e=this.getFilters();return e&&Object.keys(e).length>0}},{key:"isFilterBlank",value:function(e){return null==e||("string"==typeof e&&0===e.trim().length||e instanceof Array&&0===e.length)}},{key:"onColumnResizeStart",value:function(e){var t=n.DomHandler.getOffset(this.container).left;this.resizeColumn=e.columnEl,this.resizeColumnProps=e.column,this.columnResizing=!0,this.lastResizerHelperX=e.originalEvent.pageX-t+this.container.scrollLeft,this.bindColumnResizeEvents()}},{key:"onColumnResize",value:function(e){var t=n.DomHandler.getOffset(this.container).left;n.DomHandler.addClass(this.container,"p-unselectable-text"),this.resizerHelper.style.height=this.container.offsetHeight+"px",this.resizerHelper.style.top="0px",this.resizerHelper.style.left=e.pageX-t+this.container.scrollLeft+"px",this.resizerHelper.style.display="block"}},{key:"onColumnResizeEnd",value:function(e){var t=this.resizerHelper.offsetLeft-this.lastResizerHelperX,o=this.resizeColumn.offsetWidth,r=o+t;if(o+t>parseInt(this.resizeColumn.style.minWidth||15,10)){if("fit"===this.props.columnResizeMode){var i=this.resizeColumn.nextElementSibling,l=i.offsetWidth-t;if(r>15&&l>15)if(this.props.scrollable){var s=this.findParentScrollableView(this.resizeColumn),a=n.DomHandler.findSingle(s,"table.p-treetable-scrollable-body-table"),p=n.DomHandler.findSingle(s,"table.p-treetable-scrollable-header-table"),u=n.DomHandler.findSingle(s,"table.p-treetable-scrollable-footer-table"),c=n.DomHandler.index(this.resizeColumn);this.resizeColGroup(p,c,r,l),this.resizeColGroup(a,c,r,l),this.resizeColGroup(u,c,r,l)}else this.resizeColumn.style.width=r+"px",i&&(i.style.width=l+"px")}else if("expand"===this.props.columnResizeMode)if(this.props.scrollable){var d=this.findParentScrollableView(this.resizeColumn),h=n.DomHandler.findSingle(d,"table.p-treetable-scrollable-body-table"),f=n.DomHandler.findSingle(d,"table.p-treetable-scrollable-header-table"),y=n.DomHandler.findSingle(d,"table.p-treetable-scrollable-footer-table");h.style.width=h.offsetWidth+t+"px",f.style.width=f.offsetWidth+t+"px",y&&(y.style.width=f.offsetWidth+t+"px");var m=n.DomHandler.index(this.resizeColumn);this.resizeColGroup(f,m,r,null),this.resizeColGroup(h,m,r,null),this.resizeColGroup(y,m,r,null)}else this.table.style.width=this.table.offsetWidth+t+"px",this.resizeColumn.style.width=r+"px";this.props.onColumnResizeEnd&&this.props.onColumnResizeEnd({element:this.resizeColumn,column:this.resizeColumnProps,delta:t})}this.resizerHelper.style.display="none",this.resizeColumn=null,this.resizeColumnProps=null,n.DomHandler.removeClass(this.container,"p-unselectable-text"),this.unbindColumnResizeEvents()}},{key:"findParentScrollableView",value: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}},{key:"resizeColGroup",value:function(e,t,n,o){if(e){var r="COLGROUP"===e.children[0].nodeName?e.children[0]:null;if(!r)throw new Error("Scrollable tables require a colgroup to support resizable columns");var i=r.children[t],l=i.nextElementSibling;i.style.width=n+"px",l&&o&&(l.style.width=o+"px")}}},{key:"bindColumnResizeEvents",value:function(){var e=this;this.documentColumnResizeListener=document.addEventListener("mousemove",(function(t){e.columnResizing&&e.onColumnResize(t)})),this.documentColumnResizeEndListener=document.addEventListener("mouseup",(function(t){e.columnResizing&&(e.columnResizing=!1,e.onColumnResizeEnd(t))}))}},{key:"unbindColumnResizeEvents",value:function(){document.removeEventListener("document",this.documentColumnResizeListener),document.removeEventListener("document",this.documentColumnResizeEndListener)}},{key:"onColumnDragStart",value:function(e){var t=e.originalEvent,o=e.column;this.columnResizing?t.preventDefault():(this.iconWidth=n.DomHandler.getHiddenElementOuterWidth(this.reorderIndicatorUp),this.iconHeight=n.DomHandler.getHiddenElementOuterHeight(this.reorderIndicatorUp),this.draggedColumnEl=this.findParentHeader(t.currentTarget),this.draggedColumn=o,t.dataTransfer.setData("text","b"))}},{key:"onColumnDragOver",value:function(e){var t=e.originalEvent,o=this.findParentHeader(t.currentTarget);if(this.props.reorderableColumns&&this.draggedColumnEl&&o){t.preventDefault();var r=n.DomHandler.getOffset(this.container),i=n.DomHandler.getOffset(o);if(this.draggedColumnEl!==o){var l=i.left-r.left,s=i.left+o.offsetWidth/2;this.reorderIndicatorUp.style.top=i.top-r.top-(this.iconHeight-1)+"px",this.reorderIndicatorDown.style.top=i.top-r.top+o.offsetHeight+"px",t.pageX>s?(this.reorderIndicatorUp.style.left=l+o.offsetWidth-Math.ceil(this.iconWidth/2)+"px",this.reorderIndicatorDown.style.left=l+o.offsetWidth-Math.ceil(this.iconWidth/2)+"px",this.dropPosition=1):(this.reorderIndicatorUp.style.left=l-Math.ceil(this.iconWidth/2)+"px",this.reorderIndicatorDown.style.left=l-Math.ceil(this.iconWidth/2)+"px",this.dropPosition=-1),this.reorderIndicatorUp.style.display="block",this.reorderIndicatorDown.style.display="block"}}}},{key:"onColumnDragLeave",value:function(e){this.props.reorderableColumns&&this.draggedColumnEl&&(e.originalEvent.preventDefault(),this.reorderIndicatorUp.style.display="none",this.reorderIndicatorDown.style.display="none")}},{key:"onColumnDrop",value:function(e){var t=this,o=e.originalEvent,r=e.column;if(o.preventDefault(),this.draggedColumnEl){var i=n.DomHandler.index(this.draggedColumnEl),l=n.DomHandler.index(this.findParentHeader(o.currentTarget)),s=i!==l;if(s&&(l-i==1&&-1===this.dropPosition||i-l==1&&1===this.dropPosition)&&(s=!1),s){var p=this.state.columnOrder?this.getColumns():a.default.Children.toArray(this.props.children),u=function(e,t){return n.ObjectUtils.equals(e,t,e.props.columnKey||t.props.columnKey?"props.columnKey":"props.field")},c=p.findIndex((function(e){return u(e,t.draggedColumn)})),d=p.findIndex((function(e){return u(e,r)}));d<c&&1===this.dropPosition&&d++,d>c&&-1===this.dropPosition&&d--,n.ObjectUtils.reorderArray(p,c,d);var h,f=[],y=te(p);try{for(y.s();!(h=y.n()).done;){var m=h.value;f.push(m.props.columnKey||m.props.field)}}catch(e){y.e(e)}finally{y.f()}this.setState({columnOrder:f}),this.props.onColReorder&&this.props.onColReorder({dragIndex:c,dropIndex:d,columns:p})}this.reorderIndicatorUp.style.display="none",this.reorderIndicatorDown.style.display="none",this.draggedColumnEl.draggable=!1,this.draggedColumnEl=null,this.dropPosition=null}}},{key:"findParentHeader",value:function(e){if("TH"===e.nodeName)return e;for(var t=e.parentElement;"TH"!==t.nodeName&&(t=t.parentElement););return t}},{key:"getExpandedKeys",value:function(){return this.props.onToggle?this.props.expandedKeys:this.state.expandedKeys}},{key:"getFirst",value:function(){return this.props.onPage?this.props.first:this.state.first}},{key:"getRows",value:function(){return this.props.onPage?this.props.rows:this.state.rows}},{key:"getSortField",value:function(){return this.props.onSort?this.props.sortField:this.state.sortField}},{key:"getSortOrder",value:function(){return this.props.onSort?this.props.sortOrder:this.state.sortOrder}},{key:"getMultiSortMeta",value:function(){return this.props.onSort?this.props.multiSortMeta:this.state.multiSortMeta}},{key:"getFilters",value:function(){return this.props.onFilter?this.props.filters:this.state.filters}},{key:"findColumnByKey",value:function(e,t){if(e&&e.length)for(var n=0;n<e.length;n++){var o=e[n];if(o.props.columnKey===t||o.props.field===t)return o}return null}},{key:"getColumns",value:function(){var e=a.default.Children.toArray(this.props.children);if(e&&e.length){if(this.props.reorderableColumns&&this.state.columnOrder){var t,n=[],o=te(this.state.columnOrder);try{for(o.s();!(t=o.n()).done;){var r=this.findColumnByKey(e,t.value);r&&n.push(r)}}catch(e){o.e(e)}finally{o.f()}return[].concat(n,f(e.filter((function(e){return n.indexOf(e)<0}))))}return e}return null}},{key:"getTotalRecords",value:function(e){return this.props.lazy?this.props.totalRecords:e?e.length:0}},{key:"isSingleSelectionMode",value:function(){return this.props.selectionMode&&"single"===this.props.selectionMode}},{key:"isMultipleSelectionMode",value:function(){return this.props.selectionMode&&"multiple"===this.props.selectionMode}},{key:"isRowSelectionMode",value:function(){return this.isSingleSelectionMode()||this.isMultipleSelectionMode()}},{key:"getFrozenColumns",value:function(e){var t,n=null,o=te(e);try{for(o.s();!(t=o.n()).done;){var r=t.value;r.props.frozen&&(n=n||[]).push(r)}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"getScrollableColumns",value:function(e){var t,n=null,o=te(e);try{for(o.s();!(t=o.n()).done;){var r=t.value;r.props.frozen||(n=n||[]).push(r)}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"filterLocal",value:function(e){var n,o=[],r=this.getFilters(),i=a.default.Children.toArray(this.props.children),l="strict"===this.props.filterMode,s=te(e);try{for(s.s();!(n=s.n()).done;){for(var p=n.value,u=ie({},p),c=!0,d=!1,h=0;h<i.length;h++){var f=i[h],y=r?r[f.props.field]:null,m=f.props.field,g=void 0;if(y){var v=y.matchMode||f.props.filterMatchMode||"startsWith";if(g={filterField:m,filterValue:y.value,filterConstraint:"custom"===v?f.props.filterFunction:t.FilterService.filters[v],isStrictMode:l,options:{rowData:p,filters:r,props:this.props,column:{filterMeta:y,filterField:m,props:f.props}}},(!l||this.findFilteredNodes(u,g)||this.isFilterMatched(u,g))&&(l||this.isFilterMatched(u,g)||this.findFilteredNodes(u,g))||(c=!1),!c)break}if(this.props.globalFilter&&!d){var b=ie({},u);g={filterField:m,filterValue:this.props.globalFilter,filterConstraint:t.FilterService.filters.contains,isStrictMode:l},(l&&(this.findFilteredNodes(b,g)||this.isFilterMatched(b,g))||!l&&(this.isFilterMatched(b,g)||this.findFilteredNodes(b,g)))&&(d=!0,u=b)}}var C=c;this.props.globalFilter&&(C=c&&d),C&&o.push(u)}}catch(e){s.e(e)}finally{s.f()}return o}},{key:"findFilteredNodes",value:function(e,t){if(e){var n=!1;if(e.children){var o=f(e.children);e.children=[];var r,i=te(o);try{for(i.s();!(r=i.n()).done;){var l=ie({},r.value);this.isFilterMatched(l,t)&&(n=!0,e.children.push(l))}}catch(e){i.e(e)}finally{i.f()}}if(n)return!0}}},{key:"isFilterMatched",value:function(e,t){var o=t.filterField,r=t.filterValue,i=t.filterConstraint,l=t.isStrictMode,s=t.options,a=!1;return i(n.ObjectUtils.resolveFieldData(e.data,o),r,this.props.filterLocale,s)&&(a=!0),(!a||l&&!this.isNodeLeaf(e))&&(a=this.findFilteredNodes(e,{filterField:o,filterValue:r,filterConstraint:i,isStrictMode:l})||a),a}},{key:"isNodeLeaf",value:function(e){return!1!==e.leaf&&!(e.children&&e.children.length)}},{key:"processValue",value:function(){var e=this.props.value;if(!this.props.lazy&&e&&e.length){(this.getSortField()||this.getMultiSortMeta())&&("single"===this.props.sortMode?e=this.sortSingle(e):"multiple"===this.props.sortMode&&(e=this.sortMultiple(e)));var t=this.getFilters();(t||this.props.globalFilter)&&(e=this.filterLocal(e,t))}return e}},{key:"createTableHeader",value:function(e,t){return a.default.createElement(F,{columns:e,columnGroup:t,tabIndex:this.props.tabIndex,onSort:this.onSort,sortField:this.getSortField(),sortOrder:this.getSortOrder(),multiSortMeta:this.getMultiSortMeta(),resizableColumns:this.props.resizableColumns,onResizeStart:this.onColumnResizeStart,reorderableColumns:this.props.reorderableColumns,onDragStart:this.onColumnDragStart,onDragOver:this.onColumnDragOver,onDragLeave:this.onColumnDragLeave,onDrop:this.onColumnDrop,onFilter:this.onFilter,filters:this.getFilters(),filterDelay:this.props.filterDelay})}},{key:"createTableFooter",value:function(e,t){return a.default.createElement(Q,{columns:e,columnGroup:t})}},{key:"createTableBody",value:function(e,t){return a.default.createElement($,{value:e,columns:t,expandedKeys:this.getExpandedKeys(),selectOnEdit:this.props.selectOnEdit,onToggle:this.onToggle,onExpand:this.props.onExpand,onCollapse:this.props.onCollapse,paginator:this.props.paginator,first:this.getFirst(),rows:this.getRows(),selectionMode:this.props.selectionMode,selectionKeys:this.props.selectionKeys,onSelectionChange:this.props.onSelectionChange,metaKeySelection:this.props.metaKeySelection,onRowClick:this.props.onRowClick,onSelect:this.props.onSelect,onUnselect:this.props.onUnselect,propagateSelectionUp:this.props.propagateSelectionUp,propagateSelectionDown:this.props.propagateSelectionDown,lazy:this.props.lazy,rowClassName:this.props.rowClassName,emptyMessage:this.props.emptyMessage,loading:this.props.loading,contextMenuSelectionKey:this.props.contextMenuSelectionKey,onContextMenuSelectionChange:this.props.onContextMenuSelectionChange,onContextMenu:this.props.onContextMenu})}},{key:"createPaginator",value:function(e,t){var r=n.classNames("p-paginator-"+e,this.props.paginatorClassName);return a.default.createElement(o.Paginator,{first:this.getFirst(),rows:this.getRows(),pageLinkSize:this.props.pageLinkSize,className:r,onPageChange:this.onPageChange,template:this.props.paginatorTemplate,totalRecords:t,rowsPerPageOptions:this.props.rowsPerPageOptions,currentPageReportTemplate:this.props.currentPageReportTemplate,leftContent:this.props.paginatorLeft,rightContent:this.props.paginatorRight,alwaysShow:this.props.alwaysShowPaginator,dropdownAppendTo:this.props.paginatorDropdownAppendTo})}},{key:"createScrollableView",value:function(e,t,n,o,r){var i=this.createTableHeader(t,o),l=this.createTableFooter(t,r),s=this.createTableBody(e,t);return a.default.createElement(ee,{columns:t,header:i,body:s,footer:l,scrollHeight:this.props.scrollHeight,frozen:n,frozenWidth:this.props.frozenWidth})}},{key:"renderScrollableTable",value:function(e){var t,n,o=this.getColumns(),r=this.getFrozenColumns(o),i=r?this.getScrollableColumns(o):o;return r&&(t=this.createScrollableView(e,r,!0,this.props.frozenHeaderColumnGroup,this.props.frozenFooterColumnGroup)),n=this.createScrollableView(e,i,!1,this.props.headerColumnGroup,this.props.footerColumnGroup),a.default.createElement("div",{className:"p-treetable-scrollable-wrapper"},t,n)}},{key:"renderRegularTable",value:function(e){var t=this,n=this.getColumns(),o=this.createTableHeader(n,this.props.headerColumnGroup),r=this.createTableFooter(n,this.props.footerColumnGroup),i=this.createTableBody(e,n);return a.default.createElement("div",{className:"p-treetable-wrapper"},a.default.createElement("table",{style:this.props.tableStyle,className:this.props.tableClassName,ref:function(e){return t.table=e}},o,r,i))}},{key:"renderTable",value:function(e){return this.props.scrollable?this.renderScrollableTable(e):this.renderRegularTable(e)}},{key:"renderLoader",value:function(){if(this.props.loading){var e=n.classNames("p-treetable-loading-icon pi-spin",this.props.loadingIcon);return a.default.createElement("div",{className:"p-treetable-loading"},a.default.createElement("div",{className:"p-treetable-loading-overlay p-component-overlay"},a.default.createElement("i",{className:e})))}return null}},{key:"render",value:function(){var e=this,t=this.processValue(),o=n.classNames("p-treetable p-component",{"p-treetable-hoverable-rows":this.props.rowHover,"p-treetable-selectable":this.isRowSelectionMode(),"p-treetable-resizable":this.props.resizableColumns,"p-treetable-resizable-fit":this.props.resizableColumns&&"fit"===this.props.columnResizeMode,"p-treetable-auto-layout":this.props.autoLayout,"p-treetable-striped":this.props.stripedRows,"p-treetable-gridlines":this.props.showGridlines},this.props.className),r=this.renderTable(t),i=this.getTotalRecords(t),l=this.props.header&&a.default.createElement("div",{className:"p-treetable-header"},this.props.header),s=this.props.footer&&a.default.createElement("div",{className:"p-treetable-footer"},this.props.footer),p=this.props.paginator&&"bottom"!==this.props.paginatorPosition&&this.createPaginator("top",i),u=this.props.paginator&&"top"!==this.props.paginatorPosition&&this.createPaginator("bottom",i),c=this.renderLoader();return a.default.createElement("div",{id:this.props.id,className:o,style:this.props.style,ref:function(t){return e.container=t},"data-scrollselectors":".p-treetable-scrollable-body"},c,l,p,r,u,s,this.props.resizableColumns&&a.default.createElement("div",{ref:function(t){e.resizerHelper=t},className:"p-column-resizer-helper",style:{display:"none"}}),this.props.reorderableColumns&&a.default.createElement("span",{ref:function(t){return e.reorderIndicatorUp=t},className:"pi pi-arrow-down p-datatable-reorder-indicator-up",style:{position:"absolute",display:"none"}}),this.props.reorderableColumns&&a.default.createElement("span",{ref:function(t){return e.reorderIndicatorDown=t},className:"pi pi-arrow-up p-datatable-reorder-indicator-down",style:{position:"absolute",display:"none"}}))}}]),p}();x(se,"defaultProps",{id:null,value:null,header:null,footer:null,style:null,className:null,tableStyle:null,tableClassName:null,expandedKeys:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",first:null,rows:null,totalRecords:null,lazy:!1,sortField:null,sortOrder:null,multiSortMeta:null,sortMode:"single",defaultSortOrder:1,removableSort:!1,selectionMode:null,selectionKeys:null,contextMenuSelectionKey:null,metaKeySelection:!0,selectOnEdit:!0,propagateSelectionUp:!0,propagateSelectionDown:!0,autoLayout:!1,rowClassName:null,loading:!1,loadingIcon:"pi pi-spinner",tabIndex:0,scrollable:!1,scrollHeight:null,reorderableColumns:!1,headerColumnGroup:null,footerColumnGroup:null,frozenHeaderColumnGroup:null,frozenFooterColumnGroup:null,frozenWidth:null,resizableColumns:!1,columnResizeMode:"fit",emptyMessage:null,filters:null,globalFilter:null,filterMode:"lenient",filterDelay:300,filterLocale:void 0,rowHover:!1,showGridlines:!1,stripedRows:!1,onFilter:null,onExpand:null,onCollapse:null,onToggle:null,onPage:null,onSort:null,onSelect:null,onUnselect:null,onRowClick:null,onSelectionChange:null,onContextMenuSelectionChange:null,onColumnResizeEnd:null,onColReorder:null,onContextMenu:null}),exports.TreeTable=se;