import e,{Component as t}from"react";import{Paginator as o}from"primereact/paginator";import{classNames as n,ObjectUtils as r,DomHandler as i,ZIndexUtils as s,ConnectedOverlayScrollHandler as l,UniqueComponentId as a}from"primereact/utils";import p,{localeOption as u,FilterMatchMode as c,FilterOperator as h,FilterService as d}from"primereact/api";import{OverlayService as f}from"primereact/overlayservice";import{Ripple as g}from"primereact/ripple";import{CSSTransition as m}from"primereact/csstransition";import{Portal as v}from"primereact/portal";import{InputText as y}from"primereact/inputtext";import{Dropdown as b}from"primereact/dropdown";import{Button as w}from"primereact/button";import{VirtualScroller as C}from"primereact/virtualscroller";function S(){return S=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var o=0,n=new Array(t);o=0||(r[o]=e[o]);return r}function U(e,t){if(null==e)return{};var o,n,r=G(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function V(){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 W=function(o){j(l,t);var r,i,s=(r=l,i=V(),function(){var e,t=A(r);if(i){var o=A(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return H(this,e)});function l(e){var t;return F(this,l),(t=s.call(this,e)).state={focused:!1},t.onClick=t.onClick.bind(L(t)),t.onFocus=t.onFocus.bind(L(t)),t.onBlur=t.onBlur.bind(L(t)),t.onChange=t.onChange.bind(L(t)),t.onKeyDown=t.onKeyDown.bind(L(t)),t}return T(l,[{key:"onClick",value:function(e){this.props.disabled||(this.props.onChange(e),this.input.focus())}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onChange",value:function(e){this.onClick(e)}},{key:"onKeyDown",value:function(e){"Space"===e.code&&(this.onClick(e),e.preventDefault())}},{key:"render",value:function(){var t=this,o=n("p-radiobutton p-component",{"p-radiobutton-focused":this.state.focused}),r=n("p-radiobutton-box p-component",{"p-highlight":this.props.checked,"p-focus":this.state.focused,"p-disabled":this.props.disabled}),i="".concat(this.props.tableSelector,"_dt_radio");return e.createElement("div",{className:o},e.createElement("div",{className:"p-hidden-accessible"},e.createElement("input",{name:i,ref:function(e){return t.input=e},type:"radio",checked:this.props.checked,onFocus:this.onFocus,onBlur:this.onBlur,onChange:this.onChange,onKeyDown:this.onKeyDown})),e.createElement("div",{className:r,onClick:this.onClick,role:"radio","aria-checked":this.props.checked},e.createElement("div",{className:"p-radiobutton-icon"})))}}]),l}();function _(){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 X=function(o){j(l,t);var r,i,s=(r=l,i=_(),function(){var e,t=A(r);if(i){var o=A(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return H(this,e)});function l(e){var t;return F(this,l),(t=s.call(this,e)).state={focused:!1},t.onClick=t.onClick.bind(L(t)),t.onFocus=t.onFocus.bind(L(t)),t.onBlur=t.onBlur.bind(L(t)),t.onKeyDown=t.onKeyDown.bind(L(t)),t}return T(l,[{key:"onClick",value:function(e){this.props.disabled||(this.setState({focused:!0}),this.props.onChange(e))}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onKeyDown",value:function(e){"Space"===e.code&&(this.onClick(e),e.preventDefault())}},{key:"render",value:function(){var t=n("p-checkbox p-component",{"p-checkbox-focused":this.state.focused}),o=n("p-checkbox-box p-component",{"p-highlight":this.props.checked,"p-disabled":this.props.disabled,"p-focus":this.state.focused}),r=n("p-checkbox-icon",{"pi pi-check":this.props.checked});return e.createElement("div",{className:t,onClick:this.onClick},e.createElement("div",{className:o,role:"checkbox","aria-checked":this.props.checked,tabIndex:this.props.disabled?null:"0",onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur},e.createElement("span",{className:r})))}}]),l}();function q(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function J(e){for(var t=1;t-1:this.equals(this.props.selection))}},{key:"equalsData",value:function(e){return"equals"===this.props.compareSelectionBy?e===this.props.rowData:r.equals(e,this.props.rowData,this.props.dataKey)}},{key:"equals",value:function(e){return(e.rowIndex===this.props.rowIndex||this.equalsData(e.rowData))&&(e.field===this.field||e.cellIndex===this.props.index)}},{key:"isOutsideClicked",value:function(e){return this.el&&!(this.el.isSameNode(e)||this.el.contains(e))}},{key:"getColumnProp",value:function(e){return this.props.column?this.props.column.props[e]:null}},{key:"getVirtualScrollerOption",value:function(e){return this.props.virtualScrollerOptions?this.props.virtualScrollerOptions[e]:null}},{key:"getStyle",value:function(){var e=this.getColumnProp("bodyStyle"),t=this.getColumnProp("style");return this.getColumnProp("frozen")?Object.assign({},t,e,this.state.styleObject):Object.assign({},t,e)}},{key:"getCellParams",value:function(){return{value:this.resolveFieldData(),field:this.field,rowData:this.props.rowData,rowIndex:this.props.rowIndex,cellIndex:this.props.index,selected:this.isSelected(),column:this.props.column,props:this.props}}},{key:"getCellCallbackParams",value:function(e){return J({originalEvent:e},this.getCellParams())}},{key:"resolveFieldData",value:function(e){return r.resolveFieldData(e||this.props.rowData,this.field)}},{key:"getEditingRowData",value:function(){return this.props.editingMeta&&this.props.editingMeta[this.props.rowIndex]?this.props.editingMeta[this.props.rowIndex].data:this.props.rowData}},{key:"getTabIndex",value:function(e){return this.props.allowCellSelection?e?0:0===this.props.rowIndex&&0===this.props.index?this.props.tabIndex:-1:null}},{key:"findIndex",value:function(e){var t=this;return(e||[]).findIndex((function(e){return t.equals(e)}))}},{key:"closeCell",value:function(e){var t=this,o=this.getCellCallbackParams(e),n=this.getColumnProp("onBeforeCellEditHide");n&&n(o),setTimeout((function(){t.setState({editing:!1},(function(){t.unbindDocumentEditListener(),f.off("overlay-click",t.overlayEventListener),t.overlayEventListener=null}))}),1)}},{key:"switchCellToViewMode",value:function(e,t){var o=this.getCellCallbackParams(e),n=this.state.editingRowData,r=this.resolveFieldData(n),i=J(J({},o),{},{newRowData:n,newValue:r}),s=this.getColumnProp("onCellEditCancel"),l=this.getColumnProp("cellEditValidator"),a=this.getColumnProp("onCellEditComplete");!t&&s&&s(i);var p=!0;l&&(p=l(i)),p?(t&&a&&a(i),this.closeCell(e)):e.preventDefault()}},{key:"findNextSelectableCell",value:function(e){var t=e.nextElementSibling;return t?i.hasClass(t,"p-selectable-cell")?t:this.findNextSelectableCell(t):null}},{key:"findPrevSelectableCell",value:function(e){var t=e.previousElementSibling;return t?i.hasClass(t,"p-selectable-cell")?t:this.findPrevSelectableCell(t):null}},{key:"findDownSelectableCell",value:function(e){var t=e.parentElement.nextElementSibling,o=t?t.children[this.props.index]:null;return t&&o?i.hasClass(t,"p-selectable-row")&&i.hasClass(o,"p-selectable-cell")?o:this.findDownSelectableCell(o):null}},{key:"findUpSelectableCell",value:function(e){var t=e.parentElement.previousElementSibling,o=t?t.children[this.props.index]:null;return t&&o?i.hasClass(t,"p-selectable-row")&&i.hasClass(o,"p-selectable-cell")?o:this.findUpSelectableCell(o):null}},{key:"changeTabIndex",value:function(e,t){e&&t&&(e.tabIndex=-1,t.tabIndex=this.props.tabIndex)}},{key:"focusOnElement",value:function(){var e=this;clearTimeout(this.tabindexTimeout),this.tabindexTimeout=setTimeout((function(){if(e.state.editing){var t="cell"===e.props.editMode?i.getFirstFocusableElement(e.el,":not(.p-cell-editor-key-helper)"):i.findSingle(e.el,".p-row-editor-save");t&&t.focus()}e.keyHelper&&(e.keyHelper.tabIndex=e.state.editing?-1:0)}),1)}},{key:"focusOnInit",value:function(){var e=this;clearTimeout(this.initFocusTimeout),this.initFocusTimeout=setTimeout((function(){var t="row"===e.props.editMode?i.findSingle(e.el,".p-row-editor-init"):null;t&&t.focus()}),1)}},{key:"updateStickyPosition",value:function(){if(this.getColumnProp("frozen")){var e=J({},this.state.styleObject);if("right"===this.getColumnProp("alignFrozen")){var t=0,o=this.el.nextElementSibling;o&&(t=i.getOuterWidth(o)+parseFloat(o.style.right||0)),e.right=t+"px"}else{var n=0,r=this.el.previousElementSibling;r&&(n=i.getOuterWidth(r)+parseFloat(r.style.left||0)),e.left=n+"px"}!(this.state.styleObject.left===e.left&&this.state.styleObject.right===e.right)&&this.setState({styleObject:e})}}},{key:"editorCallback",value:function(e){var t=J({},this.state.editingRowData);t[this.field]=e,this.setState({editingRowData:t}),this.props.editingMeta[this.props.rowIndex].data[this.field]=e}},{key:"onClick",value:function(e){var t=this,o=this.getCellCallbackParams(e);if("row"!==this.props.editMode&&this.isEditable()&&!this.state.editing&&(this.props.selectOnEdit||!this.props.selectOnEdit&&this.props.selected)){this.selfClick=!0;var n=this.getColumnProp("onBeforeCellEditShow"),r=this.getColumnProp("onCellEditInit"),i=this.getColumnProp("cellEditValidatorEvent");n&&n(o),setTimeout((function(){t.setState({editing:!0},(function(){r&&r(o),"click"===i&&(t.bindDocumentEditListener(),t.overlayEventListener=function(e){t.isOutsideClicked(e.target)||(t.selfClick=!0)},f.on("overlay-click",t.overlayEventListener))}))}),1)}this.props.allowCellSelection&&this.props.onClick&&this.props.onClick(o)}},{key:"onMouseDown",value:function(e){var t=this.getCellCallbackParams(e);this.props.onMouseDown&&this.props.onMouseDown(t)}},{key:"onMouseUp",value:function(e){var t=this.getCellCallbackParams(e);this.props.onMouseUp&&this.props.onMouseUp(t)}},{key:"onKeyDown",value:function(e){if("row"!==this.props.editMode&&(13!==e.which&&9!==e.which||this.switchCellToViewMode(e,!0),27===e.which&&this.switchCellToViewMode(e,!1)),this.props.allowCellSelection){var t=e.target,o=e.currentTarget;switch(e.which){case 37:var n=this.findPrevSelectableCell(o);n&&(this.changeTabIndex(o,n),n.focus()),e.preventDefault();break;case 39:var r=this.findNextSelectableCell(o);r&&(this.changeTabIndex(o,r),r.focus()),e.preventDefault();break;case 38:var s=this.findUpSelectableCell(o);s&&(this.changeTabIndex(o,s),s.focus()),e.preventDefault();break;case 40:var l=this.findDownSelectableCell(o);l&&(this.changeTabIndex(o,l),l.focus()),e.preventDefault();break;case 13:i.isClickable(t)||(this.onClick(e),e.preventDefault());break;case 32:i.isClickable(t)||t.readOnly||(this.onClick(e),e.preventDefault())}}}},{key:"onBlur",value:function(e){this.selfClick=!1,"row"!==this.props.editMode&&this.state.editing&&"blur"===this.getColumnProp("cellEditValidatorEvent")&&this.switchCellToViewMode(e,!0)}},{key:"onEditorFocus",value:function(e){this.onClick(e)}},{key:"onRadioChange",value:function(e){this.props.onRadioChange({originalEvent:e,data:this.props.rowData,index:this.props.rowIndex})}},{key:"onCheckboxChange",value:function(e){this.props.onCheckboxChange({originalEvent:e,data:this.props.rowData,index:this.props.rowIndex})}},{key:"onRowToggle",value:function(e){this.props.onRowToggle({originalEvent:e,data:this.props.rowData}),e.preventDefault()}},{key:"onRowEditInit",value:function(e){this.props.onRowEditInit({originalEvent:e,data:this.props.rowData,newData:this.getEditingRowData(),field:this.field,index:this.props.rowIndex})}},{key:"onRowEditSave",value:function(e){this.props.onRowEditSave({originalEvent:e,data:this.props.rowData,newData:this.getEditingRowData(),field:this.field,index:this.props.rowIndex}),this.focusOnInit()}},{key:"onRowEditCancel",value:function(e){this.props.onRowEditCancel({originalEvent:e,data:this.props.rowData,newData:this.getEditingRowData(),field:this.field,index:this.props.rowIndex}),this.focusOnInit()}},{key:"bindDocumentEditListener",value:function(){var e=this;this.documentEditListener||(this.documentEditListener=function(t){!e.selfClick&&e.isOutsideClicked(t.target)&&e.switchCellToViewMode(t,!0),e.selfClick=!1},document.addEventListener("click",this.documentEditListener,!0))}},{key:"unbindDocumentEditListener",value:function(){this.documentEditListener&&(document.removeEventListener("click",this.documentEditListener,!0),this.documentEditListener=null,this.selfClick=!1)}},{key:"componentDidMount",value:function(){this.getColumnProp("frozen")&&this.updateStickyPosition()}},{key:"componentDidUpdate",value:function(e,t){if(this.getColumnProp("frozen")&&this.updateStickyPosition(),("cell"===this.props.editMode||"row"===this.props.editMode)&&(this.focusOnElement(),e.editingMeta!==this.props.editingMeta&&this.setState({editingRowData:this.getEditingRowData()}),t.editing!==this.state.editing)){var o=J(J({},this.getCellCallbackParams()),{},{editing:this.state.editing});this.props.onEditingMetaChange(o)}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentEditListener(),this.overlayEventListener&&(f.off("overlay-click",this.overlayEventListener),this.overlayEventListener=null)}},{key:"renderLoading",value:function(){var t=this.getVirtualScrollerOption("getLoaderOptions")(this.props.rowIndex,{cellIndex:this.props.index,cellFirst:0===this.props.index,cellLast:this.props.index===this.getVirtualScrollerOption("columns").length-1,cellEven:this.props.index%2==0,cellOdd:this.props.index%2!=0,column:this.props.column,field:this.field}),o=r.getJSXElement(this.getVirtualScrollerOption("loadingTemplate"),t);return e.createElement("td",null,o)}},{key:"renderElement",value:function(){var t,o,i=this,s=this.props.allowCellSelection&&this.isSelected(),l="row"===this.props.editMode,a=this.getTabIndex(s),p=this.getColumnProp("selectionMode"),u=this.getColumnProp("rowReorder"),c=this.getColumnProp("expander"),h=this.getColumnProp("rowEditor"),d=this.getColumnProp("header"),f=this.getColumnProp("body"),m=this.getColumnProp("editor"),v=this.getColumnProp("frozen"),y=this.getColumnProp("align"),b=this.resolveFieldData(),w=r.getPropValue(this.props.cellClassName,b,{props:this.props.tableProps,rowData:this.props.rowData,column:this.props.column}),C=n(this.getColumnProp("bodyClassName"),this.getColumnProp("className"),w,K({"p-selection-column":null!==p,"p-editable-column":m,"p-cell-editing":m&&this.state.editing,"p-frozen-column":v,"p-selectable-cell":this.props.allowCellSelection&&this.props.isSelectable({data:this.getCellParams(),index:this.props.rowIndex}),"p-highlight":s},"p-align-".concat(y),!!y)),S=this.getStyle(),k="stack"===this.props.responsiveLayout&&e.createElement("span",{className:"p-column-title"},r.getJSXElement(d,{props:this.props.tableProps}));if(p)t=(!this.props.showSelectionElement||this.props.showSelectionElement(this.props.rowData,{rowIndex:this.props.rowIndex,props:this.props.tableProps}))&&e.createElement(e.Fragment,null,"single"===p&&e.createElement(W,{checked:this.props.selected,onChange:this.onRadioChange,tabIndex:this.props.tabIndex,tableSelector:this.props.tableSelector}),"multiple"===p&&e.createElement(X,{checked:this.props.selected,onChange:this.onCheckboxChange,tabIndex:this.props.tabIndex}));else if(u){t=(!this.props.showRowReorderElement||this.props.showRowReorderElement(this.props.rowData,{rowIndex:this.props.rowIndex,props:this.props.tableProps}))&&e.createElement("i",{className:n("p-datatable-reorderablerow-handle",this.getColumnProp("rowReorderIcon"))})}else if(c){var R=n("p-row-toggler-icon",this.props.expanded?this.props.expandedRowIcon:this.props.collapsedRowIcon),E="".concat(this.props.tableSelector,"_content_").concat(this.props.rowIndex,"_expanded"),x={onClick:this.onRowToggle,className:"p-row-toggler p-link",iconClassName:R};t=e.createElement("button",{className:x.className,onClick:x.onClick,type:"button","aria-expanded":this.props.expanded,"aria-controls":E,tabIndex:this.props.tabIndex},e.createElement("span",{className:x.iconClassName}),e.createElement(g,null)),f&&(x.element=t,t=r.getJSXElement(f,this.props.rowData,{column:this.props.column,field:this.field,rowIndex:this.props.rowIndex,frozenRow:this.props.frozenRow,props:this.props.tableProps,expander:x}))}else if(l&&h){var D={};t=this.state.editing?e.createElement(e.Fragment,null,e.createElement("button",{type:"button",onClick:(D={editing:!0,onSaveClick:this.onRowEditSave,saveClassName:"p-row-editor-save p-link",saveIconClassName:"p-row-editor-save-icon pi pi-fw pi-check",onCancelClick:this.onRowEditCancel,cancelClassName:"p-row-editor-cancel p-link",cancelIconClassName:"p-row-editor-cancel-icon pi pi-fw pi-times"}).onSaveClick,className:D.saveClassName,tabIndex:this.props.tabIndex},e.createElement("span",{className:D.saveIconClassName}),e.createElement(g,null)),e.createElement("button",{type:"button",onClick:D.onCancelClick,className:D.cancelClassName,tabIndex:this.props.tabIndex},e.createElement("span",{className:D.cancelIconClassName}),e.createElement(g,null))):e.createElement("button",{type:"button",onClick:(D={editing:!1,onInitClick:this.onRowEditInit,initClassName:"p-row-editor-init p-link",initIconClassName:"p-row-editor-init-icon pi pi-fw pi-pencil"}).onInitClick,className:D.initClassName,tabIndex:this.props.tabIndex},e.createElement("span",{className:D.initIconClassName}),e.createElement(g,null)),f&&(D.element=t,t=r.getJSXElement(f,this.props.rowData,{column:this.props.column,field:this.field,rowIndex:this.props.rowIndex,frozenRow:this.props.frozenRow,props:this.props.tableProps,rowEditor:D}))}else t=f&&!this.state.editing?f?r.getJSXElement(f,this.props.rowData,{column:this.props.column,field:this.field,rowIndex:this.props.rowIndex,frozenRow:this.props.frozenRow,props:this.props.tableProps}):b:m&&this.state.editing?r.getJSXElement(m,{rowData:this.state.editingRowData,value:this.resolveFieldData(this.state.editingRowData),column:this.props.column,field:this.field,rowIndex:this.props.rowIndex,frozenRow:this.props.frozenRow,props:this.props.tableProps,editorCallback:this.editorCallback}):b;return!l&&m&&(o=e.createElement("a",{tabIndex:"0",ref:function(e){return i.keyHelper=e},className:"p-cell-editor-key-helper p-hidden-accessible",onFocus:this.onEditorFocus},e.createElement("span",null))),e.createElement("td",{ref:function(e){return i.el=e},style:S,className:C,rowSpan:this.props.rowSpan,tabIndex:a,role:"cell",onClick:this.onClick,onKeyDown:this.onKeyDown,onBlur:this.onBlur,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},o,k,t)}},{key:"render",value:function(){return this.getVirtualScrollerOption("loading")?this.renderLoading():this.renderElement()}}],[{key:"getDerivedStateFromProps",value:function(e,t){return"row"===e.editMode&&e.editing!==t.editing?{editing:e.editing}:null}}]),p}();function $(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function Q(e){for(var t=1;t-1:this.props.groupRowsBy===e.props.field)}},{key:"equals",value:function(e,t){return"equals"===this.props.compareSelectionBy?e===t:r.equals(e,t,this.props.dataKey)}},{key:"getColumnProp",value:function(e,t){return e?e.props[t]:null}},{key:"getEditing",value:function(){return this.props.onRowEditChange?this.props.editing:this.state.editing}},{key:"getTabIndex",value:function(){return this.isFocusable()&&!this.props.allowCellSelection?0===this.props.index?this.props.tabIndex:-1:null}},{key:"findIndex",value:function(e,t){var o=this;return(e||[]).findIndex((function(e){return o.equals(t,e)}))}},{key:"changeTabIndex",value:function(e,t){e&&t&&(e.tabIndex=-1,t.tabIndex=this.props.tabIndex)}},{key:"findNextSelectableRow",value:function(e){var t=e.nextElementSibling;return t?i.hasClass(t,"p-selectable-row")?t:this.findNextSelectableRow(t):null}},{key:"findPrevSelectableRow",value:function(e){var t=e.previousElementSibling;return t?i.hasClass(t,"p-selectable-row")?t:this.findPrevSelectableRow(t):null}},{key:"shouldRenderBodyCell",value:function(e,t,o){if(this.getColumnProp(t,"hidden"))return!1;if(this.props.rowGroupMode&&"rowspan"===this.props.rowGroupMode&&this.isGrouped(t)){var n=e[o-1];if(n)return r.resolveFieldData(e[o],this.getColumnProp(t,"field"))!==r.resolveFieldData(n,this.getColumnProp(t,"field"))}return!0}},{key:"calculateRowGroupSize",value:function(e,t,o){if(this.isGrouped(t)){for(var n=r.resolveFieldData(e[o],this.getColumnProp(t,"field")),i=n,s=0;n===i;){s++;var l=e[++o];if(!l)break;i=r.resolveFieldData(l,this.getColumnProp(t,"field"))}return 1===s?null:s}return null}},{key:"onClick",value:function(e){this.props.onRowClick({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onDoubleClick",value:function(e){this.props.onRowDoubleClick({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onRightClick",value:function(e){this.props.onRowRightClick({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onTouchEnd",value:function(e){this.props.onRowTouchEnd(e)}},{key:"onKeyDown",value:function(e){if(this.isFocusable()&&!this.props.allowCellSelection){var t=e.target,o=e.currentTarget;switch(e.which){case 40:var n=this.findNextSelectableRow(o);n&&(this.changeTabIndex(o,n),n.focus()),e.preventDefault();break;case 38:var r=this.findPrevSelectableRow(o);r&&(this.changeTabIndex(o,r),r.focus()),e.preventDefault();break;case 13:i.isClickable(t)||(this.onClick(e),e.preventDefault());break;case 32:i.isClickable(t)||t.readOnly||(this.onClick(e),e.preventDefault())}}}},{key:"onMouseDown",value:function(e){this.props.onRowMouseDown({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onMouseUp",value:function(e){this.props.onRowMouseUp({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onDragStart",value:function(e){this.props.onRowDragStart({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onDragOver",value:function(e){this.props.onRowDragOver({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onDragLeave",value:function(e){this.props.onRowDragLeave({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onDragEnd",value:function(e){this.props.onRowDragEnd({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onDrop",value:function(e){this.props.onRowDrop({originalEvent:e,data:this.props.rowData,index:this.props.index})}},{key:"onEditChange",value:function(e,t){if(this.props.onRowEditChange){var o,n=this.props.dataKey,i=e.originalEvent,s=e.data,l=e.index;if(n){var a=String(r.resolveFieldData(s,n));null!=(o=this.props.editingRows?Q({},this.props.editingRows):{})[a]?delete o[a]:o[a]=!0}else{var p=this.findIndex(this.props.editingRows,s);o=this.props.editingRows?I(this.props.editingRows):[],-1!==p?o=o.filter((function(e,t){return t!==p})):o.push(s)}this.props.onRowEditChange({originalEvent:i,data:o,index:l})}else this.setState({editing:t})}},{key:"onEditInit",value:function(e){var t=e.originalEvent;this.props.onRowEditInit&&this.props.onRowEditInit({originalEvent:t,data:this.props.rowData,index:this.props.index}),this.onEditChange(e,!0),t.preventDefault()}},{key:"onEditSave",value:function(e){var t=e.originalEvent,o=!this.props.rowEditValidator||this.props.rowEditValidator(this.props.rowData,{props:this.props.tableProps});this.props.onRowEditSave&&this.props.onRowEditSave({originalEvent:t,data:this.props.rowData,index:this.props.index,valid:o}),o&&(this.props.onRowEditComplete&&this.props.onRowEditComplete(e),this.onEditChange(e,!1)),t.preventDefault()}},{key:"onEditCancel",value:function(e){var t=e.originalEvent;this.props.onRowEditCancel&&this.props.onRowEditCancel({originalEvent:t,data:this.props.rowData,index:this.props.index}),this.onEditChange(e,!1),t.preventDefault()}},{key:"renderContent",value:function(){var t=this;return this.props.columns.map((function(o,n){if(t.shouldRenderBodyCell(t.props.value,o,t.props.index)){var r="".concat(t.getColumnProp(o,"columnKey")||t.getColumnProp(o,"field"),"_").concat(n),i="rowspan"===t.props.rowGroupMode?t.calculateRowGroupSize(t.props.value,o,t.props.index):null,s=t.getEditing();return e.createElement(Z,{key:r,value:t.props.value,tableProps:t.props.tableProps,tableSelector:t.props.tableSelector,column:o,rowData:t.props.rowData,rowIndex:t.props.index,index:n,rowSpan:i,dataKey:t.props.dataKey,editing:s,editingMeta:t.props.editingMeta,editMode:t.props.editMode,onRowEditInit:t.onEditInit,onRowEditSave:t.onEditSave,onRowEditCancel:t.onEditCancel,onEditingMetaChange:t.props.onEditingMetaChange,onRowToggle:t.props.onRowToggle,selection:t.props.selection,allowCellSelection:t.props.allowCellSelection,compareSelectionBy:t.props.compareSelectionBy,selectOnEdit:t.props.selectOnEdit,selected:t.props.selected,onClick:t.props.onCellClick,onMouseDown:t.props.onCellMouseDown,onMouseUp:t.props.onCellMouseUp,tabIndex:t.props.tabIndex,cellClassName:t.props.cellClassName,responsiveLayout:t.props.responsiveLayout,frozenRow:t.props.frozenRow,isSelectable:t.props.isSelectable,showSelectionElement:t.props.showSelectionElement,showRowReorderElement:t.props.showRowReorderElement,onRadioChange:t.props.onRadioChange,onCheckboxChange:t.props.onCheckboxChange,expanded:t.props.expanded,expandedRowIcon:t.props.expandedRowIcon,collapsedRowIcon:t.props.collapsedRowIcon,virtualScrollerOptions:t.props.virtualScrollerOptions})}return null}))}},{key:"render",value:function(){var t=this,o=r.getPropValue(this.props.rowClassName,this.props.rowData,{props:this.props.tableProps}),i=n(o,{"p-highlight":!this.props.allowCellSelection&&this.props.selected,"p-highlight-contextmenu":this.props.contextMenuSelected,"p-selectable-row":this.props.allowRowSelection&&this.props.isSelectable({data:this.props.rowData,index:this.props.index}),"p-row-odd":this.props.index%2!=0}),s=this.renderContent(),l=this.getTabIndex();return e.createElement("tr",{ref:function(e){return t.el=e},role:"row",tabIndex:l,className:i,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onClick:this.onClick,onDoubleClick:this.onDoubleClick,onContextMenu:this.onRightClick,onTouchEnd:this.onTouchEnd,onKeyDown:this.onKeyDown,onDragStart:this.onDragStart,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDragEnd:this.onDragEnd,onDrop:this.onDrop},s)}}]),p}();function oe(){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 ne=function(o){j(l,t);var r,i,s=(r=l,i=oe(),function(){var e,t=A(r);if(i){var o=A(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return H(this,e)});function l(e){var t;return F(this,l),(t=s.call(this,e)).onClick=t.onClick.bind(L(t)),t}return T(l,[{key:"onClick",value:function(e){this.props.onClick({originalEvent:e,data:this.props.rowData})}},{key:"render",value:function(){var t=n("p-row-toggler-icon",this.props.expanded?this.props.expandedRowIcon:this.props.collapsedRowIcon);return e.createElement("button",{type:"button",onClick:this.onClick,className:"p-row-toggler p-link",tabIndex:this.props.tabIndex},e.createElement("span",{className:t}),e.createElement(g,null))}}]),l}(),re=["originalEvent"];function ie(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function se(e){for(var t=1;t-1:this.equals(e,this.props.selection))}},{key:"isContextMenuSelected",value:function(e){return!(!e||!this.props.contextMenuSelection)&&this.equals(e,this.props.contextMenuSelection)}},{key:"isSelectable",value:function(e){return!this.props.isDataSelectable||this.props.isDataSelectable(e)}},{key:"isRowExpanded",value:function(e){return!(!e||!this.props.expandedRows)&&(this.isSubheaderGrouping()&&this.props.expandableRowGroups?this.isRowGroupExpanded(e):this.props.dataKey?!!this.props.expandedRows&&void 0!==this.props.expandedRows[r.resolveFieldData(e,this.props.dataKey)]:-1!==this.findIndex(this.props.expandedRows,e))}},{key:"isRowGroupExpanded",value:function(e){var t=this;return this.props.dataKey===this.props.groupRowsBy?Object.keys(this.props.expandedRows).some((function(o){return r.equals(o,r.resolveFieldData(e,t.props.dataKey))})):this.props.expandedRows.some((function(o){return r.equals(o,e,t.props.groupRowsBy)}))}},{key:"isRowEditing",value:function(e){return!("row"!==this.props.editMode||!e||!this.props.editingRows)&&(this.props.dataKey?!!this.props.editingRows&&void 0!==this.props.editingRows[r.resolveFieldData(e,this.props.dataKey)]:-1!==this.findIndex(this.props.editingRows,e))}},{key:"allowDrag",value:function(e){return this.props.dragSelection&&this.isMultipleSelection()&&!e.originalEvent.shiftKey}},{key:"allowRowDrag",value:function(e){return!this.allowCellSelection()&&this.allowDrag(e)}},{key:"allowCellDrag",value:function(e){return this.allowCellSelection()&&this.allowDrag(e)}},{key:"allowSelection",value:function(e){return!i.isClickable(e.originalEvent.target)}},{key:"allowMetaKeySelection",value:function(e){return!this.rowTouched&&(!this.props.metaKeySelection||this.props.metaKeySelection&&(e.originalEvent.metaKey||e.originalEvent.ctrlKey))}},{key:"allowRangeSelection",value:function(e){return this.isMultipleSelection()&&e.originalEvent.shiftKey&&null!==this.anchorRowIndex}},{key:"allowRowSelection",value:function(){return(this.props.selectionMode||this.props.selectionModeInColumn)&&!this.isRadioOnlySelection()&&!this.isCheckboxOnlySelection()}},{key:"allowCellSelection",value:function(){return this.props.cellSelection&&!this.isRadioSelectionModeInColumn()&&!this.isCheckboxSelectionModeInColumn()}},{key:"getColumnsLength",value:function(){return this.props.columns?this.props.columns.length:0}},{key:"getVirtualScrollerOption",value:function(e,t){return(t=t||this.props.virtualScrollerOptions)?t[e]:null}},{key:"findIndex",value:function(e,t){var o=this;return(e||[]).findIndex((function(e){return o.equals(t,e)}))}},{key:"rowGroupHeaderStyle",value:function(){return this.props.scrollable?{top:this.state.rowGroupHeaderStyleObject.top}:null}},{key:"getRowKey",value:function(e,t){return this.props.dataKey?r.resolveFieldData(e,this.props.dataKey)+"_"+t:t}},{key:"shouldRenderRowGroupHeader",value:function(e,t,o){var n=r.resolveFieldData(t,this.props.groupRowsBy),i=e[o-1];return!i||n!==r.resolveFieldData(i,this.props.groupRowsBy)}},{key:"shouldRenderRowGroupFooter",value:function(e,t,o,n){if(this.props.expandableRowGroups&&!n)return!1;var i=r.resolveFieldData(t,this.props.groupRowsBy),s=e[o+1];return!s||i!==r.resolveFieldData(s,this.props.groupRowsBy)}},{key:"updateFrozenRowStickyPosition",value:function(){this.el.style.top=i.getOuterHeight(this.el.previousElementSibling)+"px"}},{key:"updateFrozenRowGroupHeaderStickyPosition",value:function(){var e=i.getOuterHeight(this.el.previousElementSibling)+"px";this.state.rowGroupHeaderStyleObject&&this.state.rowGroupHeaderStyleObject.top!==e&&this.setState({rowGroupHeaderStyleObject:{top:e}})}},{key:"updateVirtualScrollerPosition",value:function(){var e=i.getOuterHeight(this.el.previousElementSibling);this.el.style.top=(this.el.style.top||0)+e+"px"}},{key:"onSingleSelection",value:function(e){var t=e.originalEvent,o=e.data,n=e.toggleable,r=e.type;if(this.isSelectable({data:o,index:e.index})){var i=this.isSelected(o),s=this.props.selection;i?n&&(s=null,this.onUnselect({originalEvent:t,data:o,type:r})):(s=o,this.onSelect({originalEvent:t,data:o,type:r})),this.focusOnElement(t,!0),this.props.onSelectionChange&&s!==this.props.selection&&this.props.onSelectionChange({originalEvent:t,value:s,type:r})}}},{key:"onMultipleSelection",value:function(e){var t=this,o=e.originalEvent,n=e.data,r=e.toggleable,i=e.type;if(this.isSelectable({data:n,index:e.index})){var s=this.isSelected(n),l=this.props.selection||[];if(s)if(r){var a=this.findIndex(l,n);l=this.props.selection.filter((function(e,t){return t!==a})),this.onUnselect({originalEvent:o,data:n,type:i})}else l.length&&(this.props.selection.forEach((function(e){return t.onUnselect({originalEvent:o,data:e,type:i})})),l=[n],this.onSelect({originalEvent:o,data:n,type:i}));else l=r&&this.isMultipleSelection()?[].concat(I(l),[n]):[n],this.onSelect({originalEvent:o,data:n,type:i});this.focusOnElement(o,!0),this.props.onSelectionChange&&l!==this.props.selection&&this.props.onSelectionChange({originalEvent:o,value:l,type:i})}}},{key:"onRangeSelection",value:function(e,t){i.clearSelection(),this.rangeRowIndex=this.allowCellSelection()?e.rowIndex:e.index;var o=this.selectRange(e),n=this.isMultipleSelection()?I(new Set([].concat(I(this.props.selection||[]),I(o)))):o;this.props.onSelectionChange&&n!==this.props.selection&&this.props.onSelectionChange({originalEvent:e.originalEvent,value:n,type:t}),this.anchorRowIndex=this.rangeRowIndex,this.anchorCellIndex=e.cellIndex,this.focusOnElement(e.originalEvent,!1)}},{key:"selectRange",value:function(e){var t,o,n=this.props.lazy&&this.props.paginator;return n&&(this.anchorRowIndex+=this.anchorRowFirst,this.rangeRowIndex+=this.props.first),this.rangeRowIndex>this.anchorRowIndex?(t=this.anchorRowIndex,o=this.rangeRowIndex):this.rangeRowIndexthis.anchorCellIndex?(n=this.anchorCellIndex,i=s):s td":"tr",'[tabindex="').concat(this.props.tabIndex,'"]'));n&&o&&(n.tabIndex=-1,o.tabIndex=this.props.tabIndex)}}},{key:"onRowClick",value:function(e){if(!this.allowCellSelection()&&this.allowSelection(e)){if(this.props.onRowClick&&this.props.onRowClick(e),this.allowRowSelection()){if(this.allowRangeSelection(e))this.onRangeSelection(e,"row");else{var t=this.isRadioSelectionModeInColumn()||this.isCheckboxSelectionModeInColumn()||this.allowMetaKeySelection(e);this.anchorRowIndex=e.index,this.rangeRowIndex=e.index,this.anchorRowFirst=this.props.first,this.isSingleSelection()?this.onSingleSelection(se(se({},e),{},{toggleable:t,type:"row"})):this.onMultipleSelection(se(se({},e),{},{toggleable:t,type:"row"}))}this.changeTabIndex(e.originalEvent,"row")}else this.focusOnElement(e.originalEvent);this.rowTouched=!1}}},{key:"onRowDoubleClick",value:function(e){i.isClickable(e.originalEvent.target)||this.props.onRowDoubleClick&&this.props.onRowDoubleClick(e)}},{key:"onRowRightClick",value:function(e){(this.props.onContextMenu||this.props.onContextMenuSelectionChange)&&(i.clearSelection(),this.props.onContextMenuSelectionChange&&this.props.onContextMenuSelectionChange({originalEvent:e.originalEvent,value:e.data}),this.props.onContextMenu&&this.props.onContextMenu({originalEvent:e.originalEvent,data:e.data}),e.originalEvent.preventDefault())}},{key:"onRowTouchEnd",value:function(){this.rowTouched=!0}},{key:"onRowMouseDown",value:function(e){i.clearSelection();var t=e.originalEvent;t.currentTarget.draggable=!!i.hasClass(t.target,"p-datatable-reorderablerow-handle"),this.allowRowDrag(e)&&(this.enableDragSelection(t,"row"),this.anchorRowIndex=e.index,this.rangeRowIndex=e.index,this.anchorRowFirst=this.props.first)}},{key:"onRowMouseUp",value:function(e){var t=e.index===this.anchorRowIndex;this.allowRowDrag(e)&&!t&&this.onRangeSelection(e,"row")}},{key:"onRowToggle",value:function(e){var t,o=this.props.dataKey;if(this.props.groupRowsBy?o===this.props.groupRowsBy:!!o){var n=String(r.resolveFieldData(e.data,o));null!=(t=this.props.expandedRows?se({},this.props.expandedRows):{})[n]?(delete t[n],this.props.onRowCollapse&&this.props.onRowCollapse({originalEvent:e,data:e.data})):(t[n]=!0,this.props.onRowExpand&&this.props.onRowExpand({originalEvent:e,data:e.data}))}else{var i=this.findIndex(this.props.expandedRows,e.data);t=this.props.expandedRows?I(this.props.expandedRows):[],-1!==i?(t=t.filter((function(e,t){return t!==i})),this.props.onRowCollapse&&this.props.onRowCollapse({originalEvent:e,data:e.data})):(t.push(e.data),this.props.onRowExpand&&this.props.onRowExpand({originalEvent:e,data:e.data}))}this.props.onRowToggle&&this.props.onRowToggle({data:t})}},{key:"onRowDragStart",value:function(e){var t=e.originalEvent,o=e.index;this.rowDragging=!0,this.draggedRowIndex=o,t.dataTransfer.setData("text","b")}},{key:"onRowDragOver",value:function(e){var t=e.originalEvent,o=e.index;if(this.rowDragging&&this.draggedRowIndex!==o){var n=t.currentTarget,r=i.getOffset(n).top+i.getWindowScrollTop(),s=t.pageY,l=r+i.getOuterHeight(n)/2,a=n.previousElementSibling;sthis.droppedRowIndex?this.droppedRowIndex:0===this.droppedRowIndex?0:this.droppedRowIndex-1,n=I(this.props.value);r.reorderArray(n,this.draggedRowIndex,o),this.props.onRowReorder&&this.props.onRowReorder({originalEvent:t,value:n,dragIndex:this.draggedRowIndex,dropIndex:this.droppedRowIndex})}this.onRowDragLeave(e),this.onRowDragEnd(e),t.preventDefault()}},{key:"onRadioChange",value:function(e){this.onSingleSelection(se(se({},e),{},{toggleable:!0,type:"radio"}))}},{key:"onCheckboxChange",value:function(e){this.onMultipleSelection(se(se({},e),{},{toggleable:!0,type:"checkbox"}))}},{key:"onDragSelectionMouseMove",value:function(e){var t=this.initialDragPosition,o=e.clientX-t.x,n=e.clientY-t.y;n<0&&(this.dragSelectionHelper.style.top="".concat(e.pageY+5,"px")),o<0&&(this.dragSelectionHelper.style.left="".concat(e.pageX+5,"px")),this.dragSelectionHelper.style.height="".concat(Math.abs(n),"px"),this.dragSelectionHelper.style.width="".concat(Math.abs(o),"px"),e.preventDefault()}},{key:"onDragSelectionMouseUp",value:function(){this.dragSelectionHelper&&(this.dragSelectionHelper.remove(),this.dragSelectionHelper=null),document.removeEventListener("mousemove",this.onDragSelectionMouseMove),document.removeEventListener("mouseup",this.onDragSelectionMouseUp)}},{key:"onCellClick",value:function(e){if(this.allowSelection(e)){if(this.props.onCellClick&&this.props.onCellClick(e),this.allowCellSelection()){if(this.allowRangeSelection(e))this.onRangeSelection(e,"cell");else{var t=this.allowMetaKeySelection(e),o=e.originalEvent,n=U(e,re);this.anchorRowIndex=e.rowIndex,this.rangeRowIndex=e.rowIndex,this.anchorRowFirst=this.props.first,this.anchorCellIndex=e.cellIndex,this.isSingleSelection()?this.onSingleSelection({originalEvent:o,data:n,index:e.rowIndex,toggleable:t,type:"cell"}):this.onMultipleSelection({originalEvent:o,data:n,index:e.rowIndex,toggleable:t,type:"cell"})}this.changeTabIndex(e.originalEvent,"cell")}this.rowTouched=!1}}},{key:"onCellMouseDown",value:function(e){this.allowCellDrag(e)&&(this.enableDragSelection(e.originalEvent),this.anchorRowIndex=e.rowIndex,this.rangeRowIndex=e.rowIndex,this.anchorRowFirst=this.props.first,this.anchorCellIndex=e.cellIndex)}},{key:"onCellMouseUp",value:function(e){var t=e.rowIndex===this.anchorRowIndex&&e.cellIndex===this.anchorCellIndex;this.allowCellDrag(e)&&!t&&this.onRangeSelection(e,"cell")}},{key:"bindDragSelectionEvents",value:function(){document.addEventListener("mousemove",this.onDragSelectionMouseMove),document.addEventListener("mouseup",this.onDragSelectionMouseUp),document.body.appendChild(this.dragSelectionHelper)}},{key:"unbindDragSelectionEvents",value:function(){this.onDragSelectionMouseUp()}},{key:"componentDidMount",value:function(){this.props.frozenRow&&this.updateFrozenRowStickyPosition(),this.props.scrollable&&"subheader"===this.props.rowGroupMode&&this.updateFrozenRowGroupHeaderStickyPosition(),!this.props.isVirtualScrollerDisabled&&this.getVirtualScrollerOption("vertical")&&this.updateVirtualScrollerPosition()}},{key:"componentDidUpdate",value:function(e,t){this.props.frozenRow&&this.updateFrozenRowStickyPosition(),this.props.scrollable&&"subheader"===this.props.rowGroupMode&&this.updateFrozenRowGroupHeaderStickyPosition(),!this.props.isVirtualScrollerDisabled&&this.getVirtualScrollerOption("vertical")&&this.getVirtualScrollerOption("itemSize",e.virtualScrollerOptions)!==this.getVirtualScrollerOption("itemSize")&&this.updateVirtualScrollerPosition()}},{key:"componentWillUnmount",value:function(){this.props.dragSelection&&this.unbindDragSelectionEvents()}},{key:"renderEmptyContent",value:function(){if(!this.props.loading){var t=this.getColumnsLength(),o=r.getJSXElement(this.props.emptyMessage,{props:this.props,frozen:this.props.frozenRow})||u("emptyMessage");return e.createElement("tr",{className:"p-datatable-emptymessage",role:"row"},e.createElement("td",{colSpan:t,role:"cell"},o))}return null}},{key:"renderGroupHeader",value:function(t,o,n,i,s){if(i&&this.shouldRenderRowGroupHeader(this.props.value,t,o-this.props.first)){var l=this.rowGroupHeaderStyle(),a=this.props.expandableRowGroups&&e.createElement(ne,{onClick:this.onRowToggle,rowData:t,expanded:n,expandedRowIcon:this.props.expandedRowIcon,collapsedRowIcon:this.props.collapsedRowIcon}),p=r.getJSXElement(this.props.rowGroupHeaderTemplate,t,{index:o,props:this.props.tableProps});return e.createElement("tr",{className:"p-rowgroup-header",style:l,role:"row"},e.createElement("td",{colSpan:s},a,e.createElement("span",{className:"p-rowgroup-header-name"},p)))}return null}},{key:"renderRow",value:function(t,o,n){if(!this.props.expandableRowGroups||n){var r=!!this.isSelectionEnabled()&&this.isSelected(t),i=this.isContextMenuSelected(t),s=this.allowRowSelection(),l=this.allowCellSelection(),a=this.isRowEditing(t);return e.createElement(te,{tableProps:this.props.tableProps,tableSelector:this.props.tableSelector,value:this.props.value,columns:this.props.columns,rowData:t,index:o,selected:r,contextMenuSelected:i,onRowClick:this.onRowClick,onRowDoubleClick:this.onRowDoubleClick,onRowRightClick:this.onRowRightClick,tabIndex:this.props.tabIndex,isSelectable:this.isSelectable,onRowTouchEnd:this.onRowTouchEnd,onRowMouseDown:this.onRowMouseDown,onRowMouseUp:this.onRowMouseUp,onRowToggle:this.onRowToggle,onRowDragStart:this.onRowDragStart,onRowDragOver:this.onRowDragOver,onRowDragLeave:this.onRowDragLeave,onRowDragEnd:this.onRowDragEnd,onRowDrop:this.onRowDrop,onRadioChange:this.onRadioChange,onCheckboxChange:this.onCheckboxChange,onCellClick:this.onCellClick,onCellMouseDown:this.onCellMouseDown,onCellMouseUp:this.onCellMouseUp,editing:a,editingRows:this.props.editingRows,editingMeta:this.props.editingMeta,editMode:this.props.editMode,onRowEditChange:this.props.onRowEditChange,onEditingMetaChange:this.props.onEditingMetaChange,groupRowsBy:this.props.groupRowsBy,compareSelectionBy:this.props.compareSelectionBy,dataKey:this.props.dataKey,rowGroupMode:this.props.rowGroupMode,onRowEditInit:this.props.onRowEditInit,rowEditValidator:this.props.rowEditValidator,onRowEditSave:this.props.onRowEditSave,onRowEditComplete:this.props.onRowEditComplete,onRowEditCancel:this.props.onRowEditCancel,selection:this.props.selection,allowRowSelection:s,allowCellSelection:l,selectOnEdit:this.props.selectOnEdit,selectionMode:this.props.selectionMode,selectionModeInColumn:this.props.selectionModeInColumn,cellClassName:this.props.cellClassName,responsiveLayout:this.props.responsiveLayout,frozenRow:this.props.frozenRow,showSelectionElement:this.props.showSelectionElement,showRowReorderElement:this.props.showRowReorderElement,expanded:n,expandedRowIcon:this.props.expandedRowIcon,collapsedRowIcon:this.props.collapsedRowIcon,rowClassName:this.props.rowClassName,virtualScrollerOptions:this.props.virtualScrollerOptions})}}},{key:"renderExpansion",value:function(t,o,n,i,s){if(n&&(!i||!this.props.expandableRowGroups)){var l=r.getJSXElement(this.props.rowExpansionTemplate,t,{index:o}),a="".concat(this.props.tableSelector,"_content_").concat(o,"_expanded");return e.createElement("tr",{id:a,className:"p-datatable-row-expansion",role:"row"},e.createElement("td",{role:"cell",colSpan:s},l))}return null}},{key:"renderGroupFooter",value:function(t,o,n,i,s){if(i&&this.shouldRenderRowGroupFooter(this.props.value,t,o-this.props.first,n)){var l=r.getJSXElement(this.props.rowGroupFooterTemplate,t,{index:o,colSpan:s,props:this.props.tableProps});return e.createElement("tr",{className:"p-rowgroup-footer",role:"row"},l)}return null}},{key:"renderContent",value:function(){var t=this;return this.props.value.map((function(o,n){var r=t.getVirtualScrollerOption("getItemOptions")?t.getVirtualScrollerOption("getItemOptions")(n).index:t.props.first+n,i=t.getRowKey(o,r),s=t.isRowExpanded(o),l=t.isSubheaderGrouping(),a=t.getColumnsLength(),p=t.renderGroupHeader(o,r,s,l,a),u=t.renderRow(o,r,s),c=t.renderExpansion(o,r,s,l,a),h=t.renderGroupFooter(o,r,s,l,a);return e.createElement(e.Fragment,{key:i},p,u,c,h)}))}},{key:"render",value:function(){var t=n("p-datatable-tbody",this.props.className),o=this.props.empty?this.renderEmptyContent():this.renderContent();return e.createElement("tbody",{ref:this.ref,className:t},o)}}]),p}();function pe(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function ue(e){for(var t=1;t1}},{key:"isShowAddConstraint",value:function(){return this.getColumnProp("showAddButton")&&this.filterModel&&this.filterModel.operator&&this.fieldConstraints()&&this.fieldConstraints().length1&&void 0!==arguments[1]?arguments[1]:0,o=ye({},this.props.filters),n=o[this.field];"menu"===this.props.display&&n&&n.operator?o[this.field].constraints[t].value=e:o[this.field].value=e,this.props.onFilterChange(o)}},{key:"filterApplyCallback",value:function(){for(var e=arguments.length,t=new Array(e),o=0;o1}},{key:"isSortableDisabled",value:function(){return!this.getColumnProp("sortable")||this.getColumnProp("sortable")&&(this.props.allSortableDisabled||this.getColumnProp("sortableDisabled"))}},{key:"getColumnProp",value:function(){for(var e=arguments.length,t=new Array(e),o=0;o-1&&(e=!0,t=this.props.multiSortMeta[o].order),{sorted:e,sortOrder:t,metaIndex:o}}},{key:"getAriaSort",value:function(e){var t=e.sorted,o=e.sortOrder;if(this.getColumnProp("sortable")){var n=t?o<0?"pi-sort-amount-down":"pi-sort-amount-up-alt":"pi-sort-alt";return"pi-sort-amount-down"===n?"descending":"pi-sort-amount-up-alt"===n?"ascending":"none"}return null}},{key:"updateStickyPosition",value:function(){if(this.getColumnProp("frozen")){var e=Se({},this.state.styleObject);if("right"===this.getColumnProp("alignFrozen")){var t=0,o=this.el.nextElementSibling;o&&(t=i.getOuterWidth(o)+parseFloat(o.style.right||0)),e.right=t+"px"}else{var n=0,r=this.el.previousElementSibling;r&&(n=i.getOuterWidth(r)+parseFloat(r.style.left||0)),e.left=n+"px"}var s=this.el.parentElement.nextElementSibling;if(s){var l=i.index(this.el);s.children[l].style.left=e.left,s.children[l].style.right=e.right}!(this.state.styleObject.left===e.left&&this.state.styleObject.right===e.right)&&this.setState({styleObject:e})}}},{key:"updateSortableDisabled",value:function(e){this.getColumnProp(e,"sortableDisabled")===this.getColumnProp("sortableDisabled")&&this.getColumnProp(e,"sortable")===this.getColumnProp("sortable")||this.props.onSortableChange()}},{key:"onClick",value:function(e){if(!this.isSortableDisabled()){var t=e.target;(i.hasClass(t,"p-sortable-column")||i.hasClass(t,"p-column-title")||i.hasClass(t,"p-column-header-content")||i.hasClass(t,"p-sortable-column-icon")||i.hasClass(t.parentElement,"p-sortable-column-icon"))&&(i.clearSelection(),this.props.onSortChange({originalEvent:e,column:this.props.column,sortableDisabledFields:this.props.sortableDisabledFields}))}}},{key:"onMouseDown",value:function(e){this.props.onColumnMouseDown({originalEvent:e,column:this.props.column})}},{key:"onKeyDown",value:function(e){"Enter"===e.key&&e.currentTarget===this.el&&i.hasClass(e.currentTarget,"p-sortable-column")&&(this.onClick(e),e.preventDefault())}},{key:"onDragStart",value:function(e){this.props.onColumnDragStart({originalEvent:e,column:this.props.column})}},{key:"onDragOver",value:function(e){this.props.onColumnDragOver({originalEvent:e,column:this.props.column})}},{key:"onDragLeave",value:function(e){this.props.onColumnDragLeave({originalEvent:e,column:this.props.column})}},{key:"onDrop",value:function(e){this.props.onColumnDrop({originalEvent:e,column:this.props.column})}},{key:"onResizerMouseDown",value:function(e){this.props.onColumnResizeStart({originalEvent:e,column:this.props.column})}},{key:"onResizerClick",value:function(e){this.props.onColumnResizerClick&&(this.props.onColumnResizerClick({originalEvent:e,element:e.currentTarget.parentElement,column:this.props.column}),e.preventDefault())}},{key:"onResizerDoubleClick",value:function(e){this.props.onColumnResizerDoubleClick&&(this.props.onColumnResizerDoubleClick({originalEvent:e,element:e.currentTarget.parentElement,column:this.props.column}),e.preventDefault())}},{key:"componentDidMount",value:function(){this.getColumnProp("frozen")&&this.updateStickyPosition()}},{key:"componentDidUpdate",value:function(e){this.getColumnProp("frozen")&&this.updateStickyPosition(),this.updateSortableDisabled(e.column)}},{key:"renderResizer",value:function(){return this.props.resizableColumns&&!this.getColumnProp("frozen")?e.createElement("span",{className:"p-column-resizer",onMouseDown:this.onResizerMouseDown,onClick:this.onResizerClick,onDoubleClick:this.onResizerDoubleClick}):null}},{key:"renderTitle",value:function(){var t=r.getJSXElement(this.getColumnProp("header"),{props:this.props.tableProps});return e.createElement("span",{className:"p-column-title"},t)}},{key:"renderSortIcon",value:function(t){var o=t.sorted,r=t.sortOrder;if(this.getColumnProp("sortable")){var i=n("p-sortable-column-icon pi pi-fw",o?r<0?"pi-sort-amount-down":"pi-sort-amount-up-alt":"pi-sort-alt");return e.createElement("span",{className:i})}return null}},{key:"renderBadge",value:function(t){var o=t.metaIndex;return-1!==o&&this.isBadgeVisible()?e.createElement("span",{className:"p-sortable-column-badge"},this.props.groupRowsBy&&this.props.groupRowsBy===this.props.groupRowSortField?o:o+1):null}},{key:"renderCheckbox",value:function(){if(this.props.showSelectAll&&"multiple"===this.getColumnProp("selectionMode")&&"row"!==this.props.filterDisplay){var t=this.props.allRowsSelected(this.props.value);return e.createElement(me,{checked:t,onChange:this.props.onColumnCheckboxChange,disabled:this.props.empty})}return null}},{key:"renderFilter",value:function(){return"menu"===this.props.filterDisplay&&this.getColumnProp("filter")?e.createElement(we,{display:"menu",column:this.props.column,filters:this.props.filters,onFilterChange:this.props.onFilterChange,onFilterApply:this.props.onFilterApply,filtersStore:this.props.filtersStore}):null}},{key:"renderHeader",value:function(t){var o=this.renderTitle(),n=this.renderSortIcon(t),r=this.renderBadge(t),i=this.renderCheckbox(),s=this.renderFilter();return e.createElement("div",{className:"p-column-header-content"},o,n,r,i,s)}},{key:"renderElement",value:function(){var t=this,o=this.isSortableDisabled(),r=this.getSortMeta(),i=this.getStyle(),s=this.getColumnProp("alignHeader")||this.getColumnProp("align"),l=n(this.getColumnProp("headerClassName"),this.getColumnProp("className"),K({"p-sortable-column":this.getColumnProp("sortable"),"p-resizable-column":this.props.resizableColumns,"p-highlight":r.sorted,"p-frozen-column":this.getColumnProp("frozen"),"p-selection-column":this.getColumnProp("selectionMode"),"p-sortable-disabled":this.getColumnProp("sortable")&&o,"p-reorderable-column":this.props.reorderableColumns&&this.getColumnProp("reorderable")},"p-align-".concat(s),!!s)),a=this.getColumnProp("sortable")&&!o?this.props.tabIndex:null,p=this.getColumnProp("colSpan"),u=this.getColumnProp("rowSpan"),c=this.getAriaSort(r),h=this.renderResizer(),d=this.renderHeader(r);return e.createElement("th",{ref:function(e){return t.el=e},style:i,className:l,tabIndex:a,role:"columnheader",onClick:this.onClick,onKeyDown:this.onKeyDown,onMouseDown:this.onMouseDown,onDragStart:this.onDragStart,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop,colSpan:p,rowSpan:u,"aria-sort":c},h,d)}},{key:"render",value:function(){return this.renderElement()}}]),p}();function Ee(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function xe(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};if(r.isNotEmpty(e)){if(this.props.paginator)if(this.props.onPage){var n=function(e,o){var n=t.getTotalRecords(t.processedData()),r=Math.ceil(n/o)||1;return{first:e,rows:o,page:Math.floor(e/o),pageCount:r}};this.props.onPage(this.createEvent(n(e.first,e.rows)))}else o.first=e.first,o.rows=e.rows;e.sortField&&(this.props.onSort?this.props.onSort(this.createEvent({sortField:e.sortField,sortOrder:e.sortOrder})):(o.sortField=e.sortField,o.sortOrder=e.sortOrder)),e.multiSortMeta&&(this.props.onSort?this.props.onSort(this.createEvent({multiSortMeta:e.multiSortMeta})):o.multiSortMeta=e.multiSortMeta),e.filters&&(o.d_filters=this.cloneFilters(e.filters),this.props.onFilter?this.props.onFilter(this.createEvent({filters:e.filters})):o.filters=this.cloneFilters(e.filters)),this.props.resizableColumns&&(this.columnWidthsState=e.columnWidths,this.tableWidthState=e.tableWidth),this.props.reorderableColumns&&(o.columnOrder=e.columnOrder),e.expandedRows&&this.props.onRowToggle&&this.props.onRowToggle({data:e.expandedRows}),e.selection&&this.props.onSelectionChange&&this.props.onSelectionChange({value:e.selection}),this.props.onStateRestore&&this.props.onStateRestore(e)}return o}},{key:"saveColumnWidths",value:function(e){var t=[];i.find(this.el,".p-datatable-thead > tr > th").forEach((function(e){return t.push(i.getOuterWidth(e))})),e.columnWidths=t.join(","),"expand"===this.props.columnResizeMode&&(e.tableWidth=i.getOuterWidth(this.table)+"px")}},{key:"restoreColumnWidths",value:function(){var e=this;if(this.columnWidthsState){var t=this.columnWidthsState.split(",");if("expand"===this.props.columnResizeMode&&this.tableWidthState&&(this.table.style.width=this.tableWidthState,this.table.style.minWidth=this.tableWidthState,this.el.style.width=this.tableWidthState),r.isNotEmpty(t)){this.createStyleElement();var o="";t.forEach((function(t,n){var r=e.props.scrollable?"flex: 1 1 ".concat(t,"px !important"):"width: ".concat(t,"px !important");o+="\n .p-datatable[".concat(e.state.attributeSelector,"] .p-datatable-thead > tr > th:nth-child(").concat(n+1,"),\n .p-datatable[").concat(e.state.attributeSelector,"] .p-datatable-tbody > tr > td:nth-child(").concat(n+1,"),\n .p-datatable[").concat(e.state.attributeSelector,"] .p-datatable-tfoot > tr > td:nth-child(").concat(n+1,") {\n ").concat(r,"\n }\n ")})),this.styleElement.innerHTML=o}}}},{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:"getGroupRowSortField",value:function(){return"single"===this.props.sortMode?this.props.sortField:this.state.groupRowsSortMeta?this.state.groupRowsSortMeta.field:null}},{key:"getSelectableData",value:function(e){var t=this;return this.props.showSelectionElement||this.props.isDataSelectable?e.filter((function(e,o){var n=!0;return t.props.showSelectionElement&&(n=t.props.showSelectionElement({rowIndex:o,props:t.props})),t.props.isDataSelectable&&n&&(n=t.props.isDataSelectable({data:e,index:o})),n})):e}},{key:"allRowsSelected",value:function(e){var t=this;if(this.props.onSelectAllChange)return this.props.selectAll;var o=this.props.selectionPageOnly?this.dataToRender(e):e,n=this.props.frozenValue?[].concat(I(this.props.frozenValue),I(o)):o,r=this.getSelectableData(n);return r&&this.props.selection&&r.every((function(e){return t.props.selection.some((function(o){return t.isEquals(o,e)}))}))}},{key:"getSelectionModeInColumn",value:function(e){if(e){var t=e.find((function(e){return!!e.props.selectionMode}));return t?t.props.selectionMode:null}return null}},{key:"findColumnByKey",value:function(e,t){return r.isNotEmpty(e)?e.find((function(e){return e.props.columnKey===t||e.props.field===t})):null}},{key:"getTotalRecords",value:function(e){return this.props.lazy?this.props.totalRecords:e?e.length:0}},{key:"onEditingMetaChange",value:function(e){var t=e.rowData,o=e.field,n=e.rowIndex,r=e.editing,i=Pe({},this.state.editingMeta),s=i[n];if(r)!s&&(s=i[n]={data:Pe({},t),fields:[]}),s.fields.push(o);else if(s){var l=s.fields.filter((function(e){return e!==o}));l.length?s.fields=l:delete i[n]}this.setState({editingMeta:i})}},{key:"clearEditingMetaData",value:function(){this.props.editMode&&r.isNotEmpty(this.state.editingMeta)&&this.setState({editingMeta:{}})}},{key:"onColumnResizeStart",value:function(e){var t=e.originalEvent,o=e.column,n=i.getOffset(this.el).left;this.resizeColumn=o,this.resizeColumnElement=t.currentTarget.parentElement,this.columnResizing=!0,this.lastResizeHelperX=t.pageX-n+this.el.scrollLeft,this.bindColumnResizeEvents()}},{key:"onColumnResize",value:function(e){var t=i.getOffset(this.el).left;i.addClass(this.el,"p-unselectable-text"),this.resizeHelper.style.height=this.el.offsetHeight+"px",this.resizeHelper.style.top="0px",this.resizeHelper.style.left=e.pageX-t+this.el.scrollLeft+"px",this.resizeHelper.style.display="block"}},{key:"onColumnResizeEnd",value:function(){var e=this.resizeHelper.offsetLeft-this.lastResizeHelperX,t=this.resizeColumnElement.offsetWidth,o=t+e;if(t+e>parseInt(this.resizeColumnElement.style.minWidth||15,10)){if("fit"===this.props.columnResizeMode){var n=this.resizeColumnElement.nextElementSibling.offsetWidth-e;o>15&&n>15&&this.resizeTableCells(o,n)}else if("expand"===this.props.columnResizeMode){var r=this.table.offsetWidth+e+"px";this.table.style.width=r,this.table.style.minWidth=r,this.resizeTableCells(o)}this.props.onColumnResizeEnd&&this.props.onColumnResizeEnd({element:this.resizeColumnElement,column:this.resizeColumn,delta:e}),this.isStateful()&&this.saveState()}this.resizeHelper.style.display="none",this.resizeColumn=null,this.resizeColumnElement=null,i.removeClass(this.el,"p-unselectable-text"),this.unbindColumnResizeEvents()}},{key:"resizeTableCells",value:function(e,t){var o=this,n=[],r=i.index(this.resizeColumnElement);i.find(this.table,".p-datatable-thead > tr > th").forEach((function(e){return n.push(i.getOuterWidth(e))})),this.destroyStyleElement(),this.createStyleElement();var s="";n.forEach((function(n,i){var l=i===r?e:t&&i===r+1?t:n,a=o.props.scrollable?"flex: 1 1 ".concat(l,"px !important"):"width: ".concat(l,"px !important");s+="\n .p-datatable[".concat(o.state.attributeSelector,"] .p-datatable-thead > tr > th:nth-child(").concat(i+1,"),\n .p-datatable[").concat(o.state.attributeSelector,"] .p-datatable-tbody > tr > td:nth-child(").concat(i+1,"),\n .p-datatable[").concat(o.state.attributeSelector,"] .p-datatable-tfoot > tr > td:nth-child(").concat(i+1,") {\n ").concat(a,"\n }\n ")})),this.styleElement.innerHTML=s}},{key:"bindColumnResizeEvents",value:function(){var e=this;this.documentColumnResizeListener||(this.documentColumnResizeListener=document.addEventListener("mousemove",(function(t){e.columnResizing&&e.onColumnResize(t)}))),this.documentColumnResizeEndListener||(this.documentColumnResizeEndListener=document.addEventListener("mouseup",(function(){e.columnResizing&&(e.columnResizing=!1,e.onColumnResizeEnd())})))}},{key:"unbindColumnResizeEvents",value:function(){this.documentColumnResizeListener&&(document.removeEventListener("document",this.documentColumnResizeListener),this.documentColumnResizeListener=null),this.documentColumnResizeEndListener&&(document.removeEventListener("document",this.documentColumnResizeEndListener),this.documentColumnResizeEndListener=null)}},{key:"onColumnHeaderMouseDown",value:function(e){i.clearSelection();var t=e.originalEvent;this.props.reorderableColumns&&!1!==this.getColumnProp(e.column,"reorderable")&&(t.currentTarget.draggable="INPUT"!==t.target.nodeName&&"TEXTAREA"!==t.target.nodeName&&!i.hasClass(t.target,"p-column-resizer"))}},{key:"onColumnHeaderCheckboxChange",value:function(e,t){var o=this;if(this.props.onSelectAllChange)this.props.onSelectAllChange(e);else{var n=e.originalEvent,r=e.checked,i=this.props.selectionPageOnly?this.dataToRender(t):t,s=this.props.selectionPageOnly&&this.props.selection?this.props.selection.filter((function(e){return!i.some((function(t){return o.isEquals(e,t)}))})):[];r?(s=this.props.frozenValue?[].concat(I(s),I(this.props.frozenValue),I(i)):[].concat(I(s),I(i)),s=this.getSelectableData(s),this.props.onAllRowsSelect&&this.props.onAllRowsSelect({originalEvent:n,data:s,type:"all"})):this.props.onAllRowsUnselect&&this.props.onAllRowsUnselect({originalEvent:n,data:s,type:"all"}),this.props.onSelectionChange&&this.props.onSelectionChange({originalEvent:n,value:s,type:"all"})}}},{key:"onColumnHeaderDragStart",value:function(e){var t=e.originalEvent,o=e.column;this.columnResizing?t.preventDefault():(this.colReorderIconWidth=i.getHiddenElementOuterWidth(this.reorderIndicatorUp),this.colReorderIconHeight=i.getHiddenElementOuterHeight(this.reorderIndicatorUp),this.draggedColumn=o,this.draggedColumnElement=this.findParentHeader(t.currentTarget),t.dataTransfer.setData("text","b"))}},{key:"onColumnHeaderDragOver",value:function(e){var t=e.originalEvent,o=this.findParentHeader(t.currentTarget);if(this.props.reorderableColumns&&this.draggedColumnElement&&o&&(t.preventDefault(),this.draggedColumnElement!==o)){var n=i.getOffset(this.el),r=i.getOffset(o),s=r.left-n.left,l=r.left+o.offsetWidth/2;this.reorderIndicatorUp.style.top=r.top-n.top-(this.colReorderIconHeight-1)+"px",this.reorderIndicatorDown.style.top=r.top-n.top+o.offsetHeight+"px",t.pageX>l?(this.reorderIndicatorUp.style.left=s+o.offsetWidth-Math.ceil(this.colReorderIconWidth/2)+"px",this.reorderIndicatorDown.style.left=s+o.offsetWidth-Math.ceil(this.colReorderIconWidth/2)+"px",this.dropPosition=1):(this.reorderIndicatorUp.style.left=s-Math.ceil(this.colReorderIconWidth/2)+"px",this.reorderIndicatorDown.style.left=s-Math.ceil(this.colReorderIconWidth/2)+"px",this.dropPosition=-1),this.reorderIndicatorUp.style.display="block",this.reorderIndicatorDown.style.display="block"}}},{key:"onColumnHeaderDragLeave",value:function(e){this.props.reorderableColumns&&this.draggedColumnElement&&(e.originalEvent.preventDefault(),this.reorderIndicatorUp.style.display="none",this.reorderIndicatorDown.style.display="none")}},{key:"onColumnHeaderDrop",value:function(e){var t=this,o=e.originalEvent,n=e.column;if(o.preventDefault(),this.draggedColumnElement){var s=i.index(this.draggedColumnElement),l=i.index(this.findParentHeader(o.currentTarget)),a=s!==l;if(a&&(l-s==1&&-1===this.dropPosition||s-l==1&&1===this.dropPosition)&&(a=!1),a){var p=this.getColumns(),u=function(e,t){return r.equals(e.props,t.props,e.props.columnKey||t.props.columnKey?"columnKey":"field")},c=p.findIndex((function(e){return u(e,t.draggedColumn)})),h=p.findIndex((function(e){return u(e,n)}));hc&&-1===this.dropPosition&&h--,r.reorderArray(p,c,h);var d=p.reduce((function(e,t){return e.push(t.props.columnKey||t.props.field),e}),[]);this.setState({columnOrder:d}),this.props.onColReorder&&this.props.onColReorder({originalEvent:o,dragIndex:c,dropIndex:h,columns:p})}this.reorderIndicatorUp.style.display="none",this.reorderIndicatorDown.style.display="none",this.draggedColumnElement.draggable=!1,this.draggedColumnElement=null,this.draggedColumn=null,this.dropPosition=null}}},{key:"createStyleElement",value:function(){this.styleElement=i.createInlineStyle(p.nonce)}},{key:"createResponsiveStyle",value:function(){if(!this.responsiveStyleElement){this.responsiveStyleElement=i.createInlineStyle(p.nonce);var e="\n@media screen and (max-width: ".concat(this.props.breakpoint,") {\n .p-datatable[").concat(this.state.attributeSelector,"] .p-datatable-thead > tr > th,\n .p-datatable[").concat(this.state.attributeSelector,"] .p-datatable-tfoot > tr > td {\n display: none !important;\n }\n\n .p-datatable[").concat(this.state.attributeSelector,"] .p-datatable-tbody > tr > td {\n display: flex;\n width: 100% !important;\n align-items: center;\n justify-content: space-between;\n }\n\n .p-datatable[").concat(this.state.attributeSelector,"] .p-datatable-tbody > tr > td:not(:last-child) {\n border: 0 none;\n }\n\n .p-datatable[").concat(this.state.attributeSelector,"].p-datatable-gridlines .p-datatable-tbody > tr > td:last-child {\n border-top: 0;\n border-right: 0;\n border-left: 0;\n }\n\n .p-datatable[").concat(this.state.attributeSelector,"] .p-datatable-tbody > tr > td > .p-column-title {\n display: block;\n }\n}\n");this.responsiveStyleElement.innerHTML=e}}},{key:"destroyResponsiveStyle",value:function(){this.responsiveStyleElement=i.removeInlineStyle(this.responsiveStyleElement)}},{key:"destroyStyleElement",value:function(){this.styleElement=i.removeInlineStyle(this.styleElement)}},{key:"onPageChange",value:function(e){this.clearEditingMetaData(),this.props.onPage?this.props.onPage(this.createEvent(e)):this.setState({first:e.first,rows:e.rows}),this.props.onValueChange&&this.props.onValueChange(this.processedData())}},{key:"onSortChange",value:function(e){this.clearEditingMetaData();var t,o,n=e.originalEvent,r=e.column,i=e.sortableDisabledFields,s=r.props.sortField||r.props.field,l=this.props.defaultSortOrder;if(this.columnSortable=r.props.sortable,this.columnSortFunction=r.props.sortFunction,this.columnField=r.props.sortField,"multiple"===this.props.sortMode){var a=n.metaKey||n.ctrlKey,p=(t=I(this.getMultiSortMeta())).find((function(e){return e.field===s}));l=p?this.getCalculatedSortOrder(p.order):l;var u={field:s,order:l};l?(t=a?t:t.filter((function(e){return i.some((function(t){return t===e.field}))})),this.addSortMeta(u,t)):this.props.removableSort&&this.removeSortMeta(u,t),o={multiSortMeta:t}}else l=this.getSortField()===s?this.getCalculatedSortOrder(this.getSortOrder()):l,this.props.removableSort&&(s=l?s:null),o={sortField:s,sortOrder:l};this.props.onSort?this.props.onSort(this.createEvent(o)):(o.first=0,this.setState(o)),this.props.onValueChange&&this.props.onValueChange(this.processedData({sortField:s,sortOrder:l,multiSortMeta:t}))}},{key:"getCalculatedSortOrder",value:function(e){return this.props.removableSort?this.props.defaultSortOrder===e?-1*e:0:-1*e}},{key:"compareValuesOnSort",value:function(e,t){return null==e&&null!=t?-1:null!=e&&null==t?1:null==e&&null==t?0:"string"==typeof e&&"string"==typeof t?e.localeCompare(t,void 0,{numeric:!0}):et?1:0}},{key:"addSortMeta",value:function(e,t){var o=t.findIndex((function(t){return t.field===e.field}));o>=0?t[o]=e:t.push(e)}},{key:"removeSortMeta",value:function(e,t){var o=t.findIndex((function(t){return t.field===e.field}));o>=0&&t.splice(o,1),t=t.length>0?t:null}},{key:"sortSingle",value:function(e,t,o){var n=this;if(this.props.groupRowsBy&&this.props.groupRowsBy===this.props.sortField){var i=[{field:this.props.sortField,order:this.props.sortOrder||this.props.defaultSortOrder}];return this.props.sortField!==t&&i.push({field:t,order:o}),this.sortMultiple(e,i)}var s=I(e);return this.columnSortable&&this.columnSortFunction?s=this.columnSortFunction({field:t,order:o}):s.sort((function(e,i){var s=r.resolveFieldData(e,t),l=r.resolveFieldData(i,t),a=n.compareValuesOnSort(s,l);return o*a})),s}},{key:"sortMultiple",value:function(e){var t=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(this.props.groupRowsBy&&(this.groupRowsSortMeta||o.length&&this.props.groupRowsBy===o[0].field)){var n=o[0];!this.groupRowsSortMeta&&(this.groupRowsSortMeta=n),n.field!==this.groupRowsSortMeta.field&&(o=[this.groupRowsSortMeta].concat(I(o)))}var r=I(e);if(this.columnSortable&&this.columnSortFunction){var i=o.find((function(e){return e.field===t.columnField})),s=this.columnField,l=i?i.order:this.defaultSortOrder;r=this.columnSortFunction({field:s,order:l})}else r.sort((function(e,n){return t.multisortField(e,n,o,0)}));return r}},{key:"multisortField",value:function(e,t,o,n){var i=r.resolveFieldData(e,o[n].field),s=r.resolveFieldData(t,o[n].field);if(i===s)return o.length-1>n?this.multisortField(e,t,o,n+1):0;var l=this.compareValuesOnSort(i,s);return o[n].order*l}},{key:"onFilterChange",value:function(e){this.clearEditingMetaData(),this.setState({d_filters:e})}},{key:"onFilterApply",value:function(){var e=this;clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout((function(){var t=e.cloneFilters(e.state.d_filters);e.props.onFilter?e.props.onFilter(e.createEvent({filters:t})):e.setState({first:0,filters:t}),e.props.onValueChange&&e.props.onValueChange(e.processedData({filters:t}))}),this.props.filterDelay)}},{key:"filterLocal",value:function(e,t){if(e){t=t||{};var o,n=this.getColumns(),i=[],s=t.global||this.props.globalFilter;s&&(o=this.props.globalFilterFields||n.filter((function(e){return!e.props.excludeGlobalFilter})).map((function(e){return e.props.filterField||e.props.field})));for(var l=0;l3&&void 0!==arguments[3]?arguments[3]:0,r=Pe({},this.state.d_filters),i=r[t],s=i&&i.operator?i.constraints[n]:i;s=i?{value:e,matchMode:o||s.matchMode}:{value:e,matchMode:o},"menu"===this.props.filterDisplay&&i&&i.operator?r[t].constraints[n]=s:r[t]=s,this.setState({d_filters:r},this.onFilterApply)}},{key:"reset",value:function(){var e={d_rows:this.props.rows,d_filters:this.cloneFilters(this.props.filters),groupRowsSortMeta:null,editingMeta:{}};this.props.onPage||(e.first=this.props.first,e.rows=this.props.rows),this.props.onSort||(e.sortField=this.props.sortField,e.sortOrder=this.props.sortOrder,e.multiSortMeta=this.props.multiSortMeta),this.props.onFilter||(e.filters=this.props.filters),this.resetColumnOrder(),this.setState(e)}},{key:"resetColumnOrder",value:function(){var e=this.getColumns(!0),t=[];e&&(t=e.reduce((function(e,t){return e.push(t.props.columnKey||t.props.field),e}),[])),this.setState({columnOrder:t})}},{key:"exportCSV",value:function(e){var t,o=this,n="\ufeff",s=this.getColumns();t=e&&e.selectionOnly?this.props.selection||[]:[].concat(I(this.props.frozenValue||[]),I(this.processedData()||[])),s.forEach((function(e,t){var r=e.props,i=r.field;r.exportable&&i&&(n+='"'+(r.header||i)+'"',t