@guiexpert/table 1.1.81 → 1.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs
CHANGED
|
@@ -305,7 +305,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
305
305
|
--ge-table-column-resize-handle-border: oklch(0% 0 0);
|
|
306
306
|
--ge-table-dragged-col-div-bg: #2c2e33;
|
|
307
307
|
--ge-table-drop-zone-bg: #758129;
|
|
308
|
-
}`};let we=le;class xe{constructor(e,t=!0,o,s,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=o,this.parent=s,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class ie{static buildTreeRows(e,t="children",o=12){const s=[];for(const i of e)s.push(ie.buildTreeRow(i,t,void 0,0,o));return s}static buildTreeRow(e,t="children",o=new xe(e,!0,[],void 0,0),s=0,i=12){var n;if(s>i)return console.warn("Max deep limit reached: ",s),o;const r=e[t];if(r)for(const l of r){const a=new xe(l,!0,[],o,s+1);if((n=o.children)==null||n.push(a),ie.buildTreeRow(l,t,a,s+1),s>i)return console.warn("Max deep limit reached: ",s),o}return o}}class G{constructor(e=34,t=34,o=34){this.header=e,this.body=t,this.footer=o}}class y{constructor(e=100,t="px"){this.value=e,this.unit=t}}const vt=()=>!0,Se=()=>!1;class H{constructor(e,t,o=new y(100,"px"),s=new T,i=new T,r=new y(100,"px"),n=new y(100,"px"),l,a,d,h,u,f,p,m,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=o,this.classes=s,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=a,this.sortState=d,this.sortStatesOrder=h,this.sortIconVisible=u,this.editable=f,this.getEditRenderer=p,this.editInputPipe=m,this.isVisible=g,this.visible=!0,o.unit!=="px"&&(this.minWidth=new y(0,"px"),this.maxWidth=new y(1e5,"px"))}static bodyRenderer(e){return new T(void 0,e,void 0)}static create(e){const t=new T(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new T(e.headerClasses,e.bodyClasses,e.footerClasses),s=e.sortIconVisible??e.sortable??Se,i=e.editable??e.editable??Se,r=e.isVisible??e.isVisible??vt;return new H(e.property??"",e.headerLabel??"",e.width??new y(100,"px"),o,t,e.minWidth??new y(100,"px"),e.maxWidth??new y(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,s,i,e.getEditRenderer,e.editInputPipe,r)}}const Yt=new y(500,"px"),Ut=new y(400,"px"),Rt=new y(300,"px"),Kt=new y(290,"px"),Xt=new y(280,"px"),Jt=new y(270,"px"),qt=new y(260,"px"),Zt=new y(250,"px"),Qt=new y(240,"px"),eo=new y(230,"px"),to=new y(220,"px"),oo=new y(210,"px"),Ce=new y(200,"px"),so=new y(190,"px"),io=new y(180,"px"),ro=new y(170,"px"),no=new y(160,"px"),lo=new y(150,"px"),ao=new y(140,"px"),co=new y(130,"px"),ho=new y(120,"px"),uo=new y(110,"px"),po=new y(100,"px"),go=new y(90,"px"),fo=new y(80,"px"),mo=new y(70,"px"),bo=new y(60,"px"),yo=new y(50,"px"),wo=new y(40,"px"),xo=new y(30,"px"),So=new y(20,"px"),Co=new y(10,"px"),vo=new y(0,"px");class F extends ue{constructor(e,t,o,s=[]){super(e,s,o),this.areaIdent=e,this.arr=t,this.defaultRowHeight=o,this.columnDefs=s,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,o){var i;const s=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return s&&(o=s(o,e,t)),this.arr[e][t]=o,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}changeColumnOrder(e,t){this.filteredArr.forEach(o=>this.arrayMove(o,e,t)),super.changeColumnOrder(e,t)}}class k{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}sort(e){}getRowCount(){return 0}getValueAt(e,t){return""}getTextValueAt(e,t){return""}getCellRenderer(e,t){}getRowHeight(e){return 0}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!1}isRowChecked(e){}setRowChecked(e,t){}getTooltipAt(e,t){return""}getMaxColspan(){return 0}getMaxRowspan(){return 0}getYPosByRowIndex(e){return 0}init(){}externalFilterChanged(e){}isFilterable(){return!1}doSort(e){return!1}isEditable(e,t){return!1}setValue(e,t,o){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class At{flattenTree(e,t=[]){var o;for(const s of e)this.isVisible(s)&&t.push(s),(o=s.children)!=null&&o.length&&this.flattenTree(s.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class ve extends ue{constructor(e,t,o,s=[]){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.type="AreaModelTree",this.sorterService=new Le,this.service=new At,this.properties=s.map(i=>i.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const o=this.getRowByIndex(e);if(o){const s=this.properties[t];if(s)return s.includes(".")?this.getPropertyValue(o.data,s.split(".")):o.data[s]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){if(e&&t)return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:o}=e[e.length-1],s=o==="asc"?1:o==="desc"?-1:0,i=this.properties[t];return this.treeSort(this.rows,i,s),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,o){var r;const s=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;s&&(o=s(o,e,t));const i=this.getRowByIndex(e);if(i){const n=i.data,l=this.columnDefs[t].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),o):(n[l]=o,!0)}return!1}genericTreeTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s.data,e),n=this.getValueByT(i.data,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s.data,i.data,t):this.sorterService.genericSortComparator(r,n,t)}}expandAllRecursive(e,t){for(const o of e)o.expanded=t,o.children&&this.expandAllRecursive(o.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(o=>{e=Math.max(e,o.deep)});const t=this.flattenRows.filter((o,s,i)=>this.lastPredictFn(o,s,i));this.flattenRows.forEach(o=>o.keep=!1),this.flattenRows.forEach(o=>{t.includes(o)&&(o.keep=!0,this.setAllParentsOk(o))}),this.filteredFlattenRows=this.flattenRows.filter((o,s,i)=>o.keep)}}getPropertyValue(e,t){const o=t.shift();let s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}treeSort(e,t,o){e.sort(this.genericTreeTableSortComparator(t,o));for(const s of e)s.children&&this.treeSort(s.children,t,o)}}class Re{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const o of e.children)this.checkRow(o,t);this.autoCheckParent(e.parent)}checkAll(e){for(const t of this.allRootNodes)t.checked=!1,t.children&&this.checkAll(t.children)}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){if(e.checked)return"full";const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);return!t&&!o?"semi":"none"}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const s of e.children)if(!s.checked||(o=s.children)!=null&&o.length&&!this.areAllChildrenChecked(s))return!1}return!0}areAllChildrenUnchecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const s of e.children)if(s.checked||(o=s.children)!=null&&o.length&&!this.areAllChildrenUnchecked(s))return!1}return!0}addSelectedRecursive(e,t){for(const o of e)o.checked&&t.push(o),o.children&&this.addSelectedRecursive(o.children,t)}}class re{constructor(e=0,t=0,o=0,s=0){this.top=e,this.right=t,this.bottom=o,this.left=s}}class Mt{constructor(){this.checkedRows=[]}getCheckedRows(){return this.checkedRows}setCheckedRows(e){this.checkedRows=e}addCheckedRows(e){this.checkedRows||(this.checkedRows=[]);for(const t of e)this.checkedRows.includes(t)||this.checkedRows.push(t)}checkRow(e,t){this.checkedRows||(this.checkedRows=[]),t?this.checkedRows.includes(e)||this.checkedRows.push(e):this.removeSelectedRow(e)}isRowChecked(e){return this.checkedRows&&this.checkedRows.includes(e)?"full":"none"}checkAll(e){this.checkedRows=[]}removeSelectedRow(e){if(this.checkedRows){const t=this.checkedRows.indexOf(e);t>-1&&this.checkedRows.splice(t,1)}}}class ee{constructor(e,t,o,s=0,i=0,r=!1,n=new G,l=[],a=[],d=-1,h=0,u=400,f=()=>{}){var p,m,g,b;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=o,this.fixedLeftColumnCount=s,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=a,this.overridingColumnWidth=d,this.columnCount=h,this.parentSize=u,this.getSelectionModel=f,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new re(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",o.areaIdent="footer",this.columnCount||((p=this.columnDefs)!=null&&p.length?this.columnCount=this.columnDefs.length:(m=this.columnSizes)!=null&&m.length&&(this.columnCount=(g=this.columnSizes)==null?void 0:g.length)),(b=this.columnDefs)!=null&&b.length&&Ze(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new Mt)}init(){this.recalcSize(this.parentSize),this.overridingColumnWidth===-1&&this.calcXPositions(),this.headerAreaModel&&this.headerAreaModel.init(),this.bodyAreaModel&&this.bodyAreaModel.init(),this.footerAreaModel&&this.footerAreaModel.init()}setParentWidth(e){this.parentSize=e}getColumnCount(){return this.columnCount}setColumnWidth(e,t){var o;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var o;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(e){this.recalcColumnWidths(e),this.recalcHeightAndPadding()}recalcHeightAndPadding(){const e=this.getAreaModel("body");this.rowCount=e.getRowCount(),this.contentHeightInPx=this.getAreaHeight("body"),this.recalcContentWidthInPx(),this.recalcPadding()}recalcPadding(){const e=this.getSideAreaWidth("west"),t=this.getSideAreaWidth("east"),o=this.getAreaHeight("header"),s=this.getAreaHeight("footer");this.padding=new re(o,t,s,e)}getPadding(){return this.padding}getContentHeightInPixel(){return this.contentHeightInPx}getContentWidthInPixel(){return this.contentWidthInPx}getRowHeight(e,t){return this.getAreaModel(e).getRowHeight(t)}getModel(e){return this.getAreaModel(e)}getAreaHeight(e){const t=this.getModel(e),o=t.getRowCount();if(this.defaultRowHeights[e])return o*this.defaultRowHeights[e];let s=0;for(let i=0;i<o;i++)s=s+t.getRowHeight(i);return s}getSideAreaWidth(e){const[t,o]=this.getSideStartAndEndColumnIndex(e);let s=0;for(let i=t;i<=o;i++)s=s+this.getColumnWidth(i);return s}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),o=this.getFixedRightColumnCount();let s=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?s=this.columnCount-o:(s=t,i=this.columnCount-o-1),[s,i]}getColumnDef(e){if(e<this.columnDefs.length)return this.columnDefs[e]}getFixedLeftColumnCount(){return this.fixedLeftColumnCount}getFixedRightColumnCount(){return this.fixedRightColumnCount}getAreaModel(e){if(e==="header")return this.headerAreaModel;if(e==="body")return this.bodyAreaModel;if(e==="footer")return this.footerAreaModel;throw new Error("Wrong ident.")}getBodyModel(){return this.bodyAreaModel}isFooterVisibe(){var e;return(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}isRowCheckboxVisible(){return this.rowCheckboxVisible}externalFilterChanged(e){this.getAreaModel("body").externalFilterChanged(e)}doSort(e){return this.getAreaModel("body").doSort(e)}sort(e){return this.getAreaModel("body").sort(e)}getColumnDefs(){return this.columnDefs}getColumnProperty(e){return this.columnDefs?this.columnDefs[e].property:""}getBodyRowByIndex(e){return this.getBodyModel().getRowByIndex(e)}isSortable(e){var t;if(this.columnDefs&&e<this.columnDefs.length){const o=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof o=="function")return o()}return!1}changeColumnOrder(e,t){var o,s,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(o=this.headerAreaModel)==null||o.changeColumnOrder(e,t),(s=this.bodyAreaModel)==null||s.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,o,s;if(!((t=this.columnDefs)!=null&&t.length)&&!((o=this.columnSizes)!=null&&o.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(s=this.columnDefs)!=null&&s.length){const i=this.columnDefs.filter(l=>{var a;return((a=l.width)==null?void 0:a.unit)==="weight"});this.columnSizes=this.columnDefs.map(l=>{if(l.width.unit==="%"&&e){let a=Math.floor(l.width.value*e/100);if(l.minWidth){const d=this.sizeToPixel(l.minWidth,e);a=Math.max(d,a)}if(l.maxWidth){const d=this.sizeToPixel(l.maxWidth,e);a=Math.min(d,a)}return a}else if(l.width.unit==="px"&&e)return l.width.value;return 0});const r=this.columnSizes.reduce((l,a)=>l+a),n=e-r;if(n>0&&i.length){const l=i.map(a=>a.width.value).reduce((a,d)=>a+d);for(let a=0;a<this.columnDefs.length;a++){const d=this.columnDefs[a];d.width.unit==="weight"&&(this.columnSizes[a]=d.width.value*n/l)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),e}recalcContentWidthInPx(){this.contentWidthInPx=this.getSideAreaWidth("center")}calcXPositions(){const e=this.getColumnCount();this.xPositions=new Array(e+1),this.xPositions[0]=0;for(let t=0;t<e;t++)this.xPositions[t+1]=this.getColumnWidth(t)+this.xPositions[t]}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Ae extends _{constructor(e,t,o,s,i="ge-selected-row",r="ge-focused-row"){super(e,t,s,o,i,r),this.areaIdent=e,this.rows=t,this.columnDefs=o,this.defaultRowHeight=s}}class V{static createTableModel(e){var t,o,s,i,r,n,l,a,d,h,u,f,p,m;if(e.defaultRowHeights===void 0)if((t=e.tableOptions)!=null&&t.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new G,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const g=e.headerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.header=g)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const g=e.bodyAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.body=g)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const g=e.footerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.footer=g)}}if(e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(g=>new H(g,g.toUpperCase(),Ce)):(s=e.rows)!=null&&s.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new H(g,g.toUpperCase(),Ce)):e.columnDefs=[]),e.columnCount===void 0&&((i=e.columnDefs)!=null&&i.length?e.columnCount=e.columnDefs.length:(r=e.headerData)!=null&&r.length?e.columnCount=e.headerData[0].length:(n=e.columnSizes)!=null&&n.length?e.columnCount=(l=e.columnSizes)==null?void 0:l.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((a=e.headerData)!=null&&a.length?e.headerAreaModel=new F("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(d=e.columnDefs)!=null&&d.length?e.headerAreaModel=new F("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new k("header")),e.footerAreaModel||((h=e.footerData)!=null&&h.length?e.footerAreaModel=new F("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new k("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&N(e.rows[0])){const g=e.rows;e.bodyAreaModel=new ve("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(f=e.tableOptions)!=null&&f.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new Re(g))}else e.bodyAreaModel=new Ae("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new F("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new k("body");return e.fixedLeftColumnCount===void 0&&(e.fixedLeftColumnCount=0),e.fixedRightColumnCount===void 0&&(e.fixedRightColumnCount=0),e.rowCheckboxVisible===void 0&&(e.rowCheckboxVisible=!1),e.overridingColumnWidth===void 0&&(e.overridingColumnWidth=-1),!e.getSelectionModel&&((p=e.tableOptions)!=null&&p.getSelectionModel)&&(e.getSelectionModel=(m=e.tableOptions)==null?void 0:m.getSelectionModel),new ee(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel,e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static buildByTypedRowsParam(e){return V.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new X,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,o=new X,s=0,i=0){const r=o.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&N(e[0])){const a=e,d=new ve("body",a,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(d.rowSelectionModel=new Re(a)),V.createByAreaModelsParam({headerAreaModel:new F("header",[t.map(h=>h.headerLabel)],r.header),bodyAreaModel:d,footerAreaModel:new F("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return V.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return V.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new G,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new k,t,o=new k,s=0,i=0,r=!1,n=new G,l,a=[],d=-1,h){return new ee(e,t,o,s,i,r,n,l,a,d,h)}static createByAreaModelsParam(e){return V.createByAreaModels(e.headerAreaModel??new k,e.bodyAreaModel,e.footerAreaModel??new k,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,e.rowCheckboxVisible===void 0?!1:e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs??[],e.columnSizes??[],e.overridingColumnWidth??-1,e.columnCount??0)}static createByObjectArray(e,t=[],o=[],s=0,i=0,r=!1,n=new G,l,a=[]){let d;t!=null&&t.length?d=new F("header",t,n.header,l):l!=null&&l.length?d=new F("header",[l.map(f=>f.headerLabel)],n.header,l):d=new k;const h=o?new F("footer",o,n.footer,l):new k,u=new Ae("body",e,l,n.body);return new ee(d,u,h,s,i,r,n,l,a)}}class Et{constructor(e,t,o=200,s=300,i=0,r=0){this.items=e,this.cellRenderer=t,this.coverWidth=o,this.coverHeight=s,this.width=i,this.firstRowPaddingTop=r,this.rowSelectionModel=void 0,this.areaIdent="body",this.filteredItems=[],this.sorterService=new Le,this.filteredItems=e}getRowCount(){var e;return(e=this.filteredItems)!=null&&e.length?Math.floor(this.filteredItems.length/this.getColumnCount())+1:0}getColumnCount(){return this.width?Math.floor(this.width/this.coverWidth):1}getValueAt(e,t){var o;return(o=this.filteredItems)==null?void 0:o[e*this.getColumnCount()+t]}getTextValueAt(e,t){return""}getTooltipAt(e,t){return""}getRowHeight(e){return e===0&&this.firstRowPaddingTop>0?this.firstRowPaddingTop+this.coverHeight:this.coverHeight}getCellRenderer(e,t){return this.cellRenderer}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){}setRowChecked(e,t){}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){const t=this.firstRowPaddingTop>0?this.firstRowPaddingTop:0;return this.coverHeight*e+t}init(){}externalFilterChanged(e){this.filteredItems=this.items.filter(e)}isFilterable(){return!1}doSort(e){if(!this.filteredItems)return!1;for(const t of e){const{sortState:o}=t,s=o==="asc"?1:o==="desc"?-1:0;this.filteredItems=this.filteredItems.sort((i,r)=>this.sorterService.genericSortComparator(i,r,s))}return!0}sort(e){this.filteredItems=this.filteredItems.sort(e)}isEditable(e,t){return!1}setValue(e,t,o){return!0}isSelectable(e,t){return!1}changeColumnOrder(e,t){}setPropertyValue(e,t,o){return!1}arrayMove(e,t,o){}}class Tt{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new k,this.footerAreaModel=new k}changeColumnOrder(e,t){}isSortable(e){return!1}init(){}setParentWidth(e){}getColumnCount(){return this.bodyModel.getColumnCount()}getXPosByColumnIndex(e){return e*this.getColumnWidth(e)}getAreaModel(e){return e==="header"?this.headerAreaModel:e==="footer"?this.footerAreaModel:this.bodyModel}getBodyModel(){return this.bodyModel}getFixedLeftColumnCount(){return 0}getFixedRightColumnCount(){return 0}isHeaderVisibe(){return!1}isFooterVisibe(){return!1}isRowCheckboxVisible(){return!1}getRowHeight(e,t){return this.bodyModel.getRowHeight(t)}getColumnDef(e){}getColumnDefs(){}getColumnProperty(e){return""}getBodyRowByIndex(e){return this.bodyModel.getRowByIndex(e)}getColumnWidth(e){return this.bodyModel.coverWidth}setColumnWidth(e,t){}recalcSize(e){}recalcPadding(){}recalcHeightAndPadding(){}getPadding(){return new re(0,0,0,0)}getContentHeightInPixel(){return this.paddingTop+this.bodyModel.getRowCount()*this.bodyModel.coverHeight}getContentWidthInPixel(){return this.bodyModel.getColumnCount()*this.bodyModel.coverWidth}externalFilterChanged(e){this.bodyModel.externalFilterChanged(e)}doSort(e){return this.bodyModel.doSort(e)}sort(e){this.bodyModel.sort(e)}getSelectionModel(){}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Ro{static createCoverGridModel(e,t,o=200,s=300,i=0,r=0){const n=new Et(e,t,o,s,i,r);return new Tt(n,r)}}const Ao=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class It{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class kt{constructor(e,t,o,s,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=o,this.filter=s,this.sorting=i,this.startIndex=r,this.endIndex=n}}class Mo extends kt{constructor(e,t,o,s,i,r,n,l){super(e,t,o,s,i,r,n),this.rows=l}}class Dt{constructor(e,t){this.value=e,this.label=t}}class Eo{constructor(e,t){this.index=e,this.px=t}}const To={body:["ge-table-text-align-left"]},Io={body:["ge-table-text-align-center"]},ko={body:["ge-table-text-align-right"]},Do={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Po={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Fo={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Me{render(e,t,o,s,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.isRowChecked(t),a=l==="full"?"checked":"",d=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
|
|
308
|
+
}`};let we=le;class xe{constructor(e,t=!0,o,s,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=o,this.parent=s,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class ie{static buildTreeRows(e,t="children",o=12){const s=[];for(const i of e)s.push(ie.buildTreeRow(i,t,void 0,0,o));return s}static buildTreeRow(e,t="children",o=new xe(e,!0,[],void 0,0),s=0,i=12){var n;if(s>i)return console.warn("Max deep limit reached: ",s),o;const r=e[t];if(r)for(const l of r){const a=new xe(l,!0,[],o,s+1);if((n=o.children)==null||n.push(a),ie.buildTreeRow(l,t,a,s+1),s>i)return console.warn("Max deep limit reached: ",s),o}return o}}class G{constructor(e=34,t=34,o=34){this.header=e,this.body=t,this.footer=o}}class y{constructor(e=100,t="px"){this.value=e,this.unit=t}}const vt=()=>!0,Se=()=>!1;class H{constructor(e,t,o=new y(100,"px"),s=new T,i=new T,r=new y(100,"px"),n=new y(100,"px"),l,a,d,h,u,f,p,m,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=o,this.classes=s,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=a,this.sortState=d,this.sortStatesOrder=h,this.sortIconVisible=u,this.editable=f,this.getEditRenderer=p,this.editInputPipe=m,this.isVisible=g,this.visible=!0,o.unit!=="px"&&(this.minWidth=new y(0,"px"),this.maxWidth=new y(1e5,"px"))}static bodyRenderer(e){return new T(void 0,e,void 0)}static create(e){const t=new T(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new T(e.headerClasses,e.bodyClasses,e.footerClasses),s=e.sortIconVisible??e.sortable??Se,i=e.editable??e.editable??Se,r=e.isVisible??e.isVisible??vt;return new H(e.property??"",e.headerLabel??"",e.width??new y(100,"px"),o,t,e.minWidth??new y(100,"px"),e.maxWidth??new y(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,s,i,e.getEditRenderer,e.editInputPipe,r)}}const Yt=new y(500,"px"),Ut=new y(400,"px"),Rt=new y(300,"px"),Kt=new y(290,"px"),Xt=new y(280,"px"),Jt=new y(270,"px"),qt=new y(260,"px"),Zt=new y(250,"px"),Qt=new y(240,"px"),eo=new y(230,"px"),to=new y(220,"px"),oo=new y(210,"px"),Ce=new y(200,"px"),so=new y(190,"px"),io=new y(180,"px"),ro=new y(170,"px"),no=new y(160,"px"),lo=new y(150,"px"),ao=new y(140,"px"),co=new y(130,"px"),ho=new y(120,"px"),uo=new y(110,"px"),po=new y(100,"px"),go=new y(90,"px"),fo=new y(80,"px"),mo=new y(70,"px"),bo=new y(60,"px"),yo=new y(50,"px"),wo=new y(40,"px"),xo=new y(30,"px"),So=new y(20,"px"),Co=new y(10,"px"),vo=new y(0,"px");class F extends ue{constructor(e,t,o,s=[]){super(e,s,o),this.areaIdent=e,this.arr=t,this.defaultRowHeight=o,this.columnDefs=s,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,o){var i;const s=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return s&&(o=s(o,e,t)),this.arr[e][t]=o,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}changeColumnOrder(e,t){this.filteredArr.forEach(o=>this.arrayMove(o,e,t)),super.changeColumnOrder(e,t)}}class k{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}sort(e){}getRowCount(){return 0}getValueAt(e,t){return""}getTextValueAt(e,t){return""}getCellRenderer(e,t){}getRowHeight(e){return 0}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!1}isRowChecked(e){}setRowChecked(e,t){}getTooltipAt(e,t){return""}getMaxColspan(){return 0}getMaxRowspan(){return 0}getYPosByRowIndex(e){return 0}init(){}externalFilterChanged(e){}isFilterable(){return!1}doSort(e){return!1}isEditable(e,t){return!1}setValue(e,t,o){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class At{flattenTree(e,t=[]){var o;for(const s of e)this.isVisible(s)&&t.push(s),(o=s.children)!=null&&o.length&&this.flattenTree(s.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class ve extends ue{constructor(e,t,o,s=[]){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.type="AreaModelTree",this.sorterService=new Le,this.service=new At,this.properties=s.map(i=>i.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const o=this.getRowByIndex(e);if(o){const s=this.properties[t];if(s)return s.includes(".")?this.getPropertyValue(o.data,s.split(".")):o.data[s]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){if(e&&t)return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:o}=e[e.length-1],s=o==="asc"?1:o==="desc"?-1:0,i=this.properties[t];return this.treeSort(this.rows,i,s),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,o){var r;const s=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;s&&(o=s(o,e,t));const i=this.getRowByIndex(e);if(i){const n=i.data,l=this.columnDefs[t].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),o):(n[l]=o,!0)}return!1}genericTreeTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s.data,e),n=this.getValueByT(i.data,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s.data,i.data,t):this.sorterService.genericSortComparator(r,n,t)}}expandAllRecursive(e,t){for(const o of e)o.expanded=t,o.children&&this.expandAllRecursive(o.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(o=>{e=Math.max(e,o.deep)});const t=this.flattenRows.filter((o,s,i)=>this.lastPredictFn(o,s,i));this.flattenRows.forEach(o=>o.keep=!1),this.flattenRows.forEach(o=>{t.includes(o)&&(o.keep=!0,this.setAllParentsOk(o))}),this.filteredFlattenRows=this.flattenRows.filter((o,s,i)=>o.keep)}}getPropertyValue(e,t){const o=t.shift();let s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}treeSort(e,t,o){e.sort(this.genericTreeTableSortComparator(t,o));for(const s of e)s.children&&this.treeSort(s.children,t,o)}}class Re{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const o of e.children)this.checkRow(o,t);this.autoCheckParent(e.parent)}checkAll(e){for(const t of this.allRootNodes)t.checked=!1,t.children&&this.checkAll(t.children)}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){if(e.checked)return"full";const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);return!t&&!o?"semi":"none"}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const s of e.children)if(!s.checked||(o=s.children)!=null&&o.length&&!this.areAllChildrenChecked(s))return!1}return!0}areAllChildrenUnchecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const s of e.children)if(s.checked||(o=s.children)!=null&&o.length&&!this.areAllChildrenUnchecked(s))return!1}return!0}addSelectedRecursive(e,t){for(const o of e)o.checked&&t.push(o),o.children&&this.addSelectedRecursive(o.children,t)}}class re{constructor(e=0,t=0,o=0,s=0){this.top=e,this.right=t,this.bottom=o,this.left=s}}class Mt{constructor(){this.checkedRows=[]}getCheckedRows(){return this.checkedRows}setCheckedRows(e){this.checkedRows=e}addCheckedRows(e){this.checkedRows||(this.checkedRows=[]);for(const t of e)this.checkedRows.includes(t)||this.checkedRows.push(t)}checkRow(e,t){this.checkedRows||(this.checkedRows=[]),t?this.checkedRows.includes(e)||this.checkedRows.push(e):this.removeSelectedRow(e)}isRowChecked(e){return this.checkedRows&&this.checkedRows.includes(e)?"full":"none"}checkAll(e){this.checkedRows=[]}removeSelectedRow(e){if(this.checkedRows){const t=this.checkedRows.indexOf(e);t>-1&&this.checkedRows.splice(t,1)}}}class ee{constructor(e,t,o,s=0,i=0,r=!1,n=new G,l=[],a=[],d=-1,h=0,u=400,f=()=>{}){var p,m,g,b;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=o,this.fixedLeftColumnCount=s,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=a,this.overridingColumnWidth=d,this.columnCount=h,this.parentSize=u,this.getSelectionModel=f,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new re(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",o.areaIdent="footer",this.columnCount||((p=this.columnDefs)!=null&&p.length?this.columnCount=this.columnDefs.length:(m=this.columnSizes)!=null&&m.length&&(this.columnCount=(g=this.columnSizes)==null?void 0:g.length)),(b=this.columnDefs)!=null&&b.length&&Ze(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new Mt)}init(){this.recalcSize(this.parentSize),this.overridingColumnWidth===-1&&this.calcXPositions(),this.headerAreaModel&&this.headerAreaModel.init(),this.bodyAreaModel&&this.bodyAreaModel.init(),this.footerAreaModel&&this.footerAreaModel.init()}setParentWidth(e){this.parentSize=e}getColumnCount(){return this.columnCount}setColumnWidth(e,t){var o;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var o;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(e){this.recalcColumnWidths(e),this.recalcHeightAndPadding()}recalcHeightAndPadding(){const e=this.getAreaModel("body");this.rowCount=e.getRowCount(),this.contentHeightInPx=this.getAreaHeight("body"),this.recalcContentWidthInPx(),this.recalcPadding()}recalcPadding(){const e=this.getSideAreaWidth("west"),t=this.getSideAreaWidth("east"),o=this.getAreaHeight("header"),s=this.getAreaHeight("footer");this.padding=new re(o,t,s,e)}getPadding(){return this.padding}getContentHeightInPixel(){return this.contentHeightInPx}getContentWidthInPixel(){return this.contentWidthInPx}getRowHeight(e,t){return this.getAreaModel(e).getRowHeight(t)}getModel(e){return this.getAreaModel(e)}getAreaHeight(e){const t=this.getModel(e),o=t.getRowCount();if(this.defaultRowHeights[e])return o*this.defaultRowHeights[e];let s=0;for(let i=0;i<o;i++)s=s+t.getRowHeight(i);return s}getSideAreaWidth(e){const[t,o]=this.getSideStartAndEndColumnIndex(e);let s=0;for(let i=t;i<=o;i++)s=s+this.getColumnWidth(i);return s}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),o=this.getFixedRightColumnCount();let s=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?s=this.columnCount-o:(s=t,i=this.columnCount-o-1),[s,i]}getColumnDef(e){if(e<this.columnDefs.length)return this.columnDefs[e]}getFixedLeftColumnCount(){return this.fixedLeftColumnCount}getFixedRightColumnCount(){return this.fixedRightColumnCount}getAreaModel(e){if(e==="header")return this.headerAreaModel;if(e==="body")return this.bodyAreaModel;if(e==="footer")return this.footerAreaModel;throw new Error("Wrong ident.")}getBodyModel(){return this.bodyAreaModel}isFooterVisibe(){var e;return(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}isRowCheckboxVisible(){return this.rowCheckboxVisible}externalFilterChanged(e){this.getAreaModel("body").externalFilterChanged(e)}doSort(e){return this.getAreaModel("body").doSort(e)}sort(e){return this.getAreaModel("body").sort(e)}getColumnDefs(){return this.columnDefs}getColumnProperty(e){return this.columnDefs?this.columnDefs[e].property:""}getBodyRowByIndex(e){return this.getBodyModel().getRowByIndex(e)}isSortable(e){var t;if(this.columnDefs&&e<this.columnDefs.length){const o=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof o=="function")return o()}return!1}changeColumnOrder(e,t){var o,s,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(o=this.headerAreaModel)==null||o.changeColumnOrder(e,t),(s=this.bodyAreaModel)==null||s.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,o,s;if(!((t=this.columnDefs)!=null&&t.length)&&!((o=this.columnSizes)!=null&&o.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(s=this.columnDefs)!=null&&s.length){const i=this.columnDefs.filter(l=>{var a;return((a=l.width)==null?void 0:a.unit)==="weight"});this.columnSizes=this.columnDefs.map(l=>{if(l.width.unit==="%"&&e){let a=Math.floor(l.width.value*e/100);if(l.minWidth){const d=this.sizeToPixel(l.minWidth,e);a=Math.max(d,a)}if(l.maxWidth){const d=this.sizeToPixel(l.maxWidth,e);a=Math.min(d,a)}return a}else if(l.width.unit==="px"&&e)return l.width.value;return 0});const r=this.columnSizes.reduce((l,a)=>l+a),n=e-r;if(n>0&&i.length){const l=i.map(a=>a.width.value).reduce((a,d)=>a+d);for(let a=0;a<this.columnDefs.length;a++){const d=this.columnDefs[a];d.width.unit==="weight"&&(this.columnSizes[a]=d.width.value*n/l)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),e}recalcContentWidthInPx(){this.contentWidthInPx=this.getSideAreaWidth("center")}calcXPositions(){const e=this.getColumnCount();this.xPositions=new Array(e+1),this.xPositions[0]=0;for(let t=0;t<e;t++)this.xPositions[t+1]=this.getColumnWidth(t)+this.xPositions[t]}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Ae extends _{constructor(e,t,o,s,i="ge-selected-row",r="ge-focused-row"){super(e,t,s,o,i,r),this.areaIdent=e,this.rows=t,this.columnDefs=o,this.defaultRowHeight=s}}class V{static createTableModel(e){var t,o,s,i,r,n,l,a,d,h,u,f,p,m;if(e.defaultRowHeights===void 0)if((t=e.tableOptions)!=null&&t.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new G,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const g=e.headerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.header=g)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const g=e.bodyAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.body=g)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const g=e.footerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.footer=g)}}if(e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(g=>new H(g,g.toUpperCase(),Ce)):(s=e.rows)!=null&&s.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new H(g,g.toUpperCase(),Ce)):e.columnDefs=[]),e.columnCount===void 0&&((i=e.columnDefs)!=null&&i.length?e.columnCount=e.columnDefs.length:(r=e.headerData)!=null&&r.length?e.columnCount=e.headerData[0].length:(n=e.columnSizes)!=null&&n.length?e.columnCount=(l=e.columnSizes)==null?void 0:l.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((a=e.headerData)!=null&&a.length?e.headerAreaModel=new F("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(d=e.columnDefs)!=null&&d.length?e.headerAreaModel=new F("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new k("header")),e.footerAreaModel||((h=e.footerData)!=null&&h.length?e.footerAreaModel=new F("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new k("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&N(e.rows[0])){const g=e.rows;e.bodyAreaModel=new ve("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(f=e.tableOptions)!=null&&f.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new Re(g))}else e.bodyAreaModel=new Ae("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new F("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new k("body");return e.fixedLeftColumnCount===void 0&&(e.fixedLeftColumnCount=0),e.fixedRightColumnCount===void 0&&(e.fixedRightColumnCount=0),e.rowCheckboxVisible===void 0&&(e.rowCheckboxVisible=!1),e.overridingColumnWidth===void 0&&(e.overridingColumnWidth=-1),!e.getSelectionModel&&((p=e.tableOptions)!=null&&p.getSelectionModel)&&(e.getSelectionModel=(m=e.tableOptions)==null?void 0:m.getSelectionModel),new ee(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel,e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static buildByTypedRowsParam(e){return V.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new X,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,o=new X,s=0,i=0){const r=o.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&N(e[0])){const a=e,d=new ve("body",a,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(d.rowSelectionModel=new Re(a)),V.createByAreaModelsParam({headerAreaModel:new F("header",[t.map(h=>h.headerLabel)],r.header),bodyAreaModel:d,footerAreaModel:new F("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return V.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return V.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new G,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new k,t,o=new k,s=0,i=0,r=!1,n=new G,l,a=[],d=-1,h){return new ee(e,t,o,s,i,r,n,l,a,d,h)}static createByAreaModelsParam(e){return V.createByAreaModels(e.headerAreaModel??new k,e.bodyAreaModel,e.footerAreaModel??new k,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,e.rowCheckboxVisible===void 0?!1:e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs??[],e.columnSizes??[],e.overridingColumnWidth??-1,e.columnCount??0)}static createByObjectArray(e,t=[],o=[],s=0,i=0,r=!1,n=new G,l,a=[]){let d;t!=null&&t.length?d=new F("header",t,n.header,l):l!=null&&l.length?d=new F("header",[l.map(f=>f.headerLabel)],n.header,l):d=new k;const h=o?new F("footer",o,n.footer,l):new k,u=new Ae("body",e,l,n.body);return new ee(d,u,h,s,i,r,n,l,a)}}class Et{constructor(e,t,o=200,s=300,i=0,r=0){this.items=e,this.cellRenderer=t,this.coverWidth=o,this.coverHeight=s,this.width=i,this.firstRowPaddingTop=r,this.rowSelectionModel=void 0,this.areaIdent="body",this.filteredItems=[],this.sorterService=new Le,this.filteredItems=e}setParentWidth(e){this.width=e}getRowCount(){var e;return(e=this.filteredItems)!=null&&e.length?Math.floor(this.filteredItems.length/this.getColumnCount())+1:0}getColumnCount(){return this.width?Math.floor(this.width/this.coverWidth):1}getValueAt(e,t){var o;return(o=this.filteredItems)==null?void 0:o[e*this.getColumnCount()+t]}getTextValueAt(e,t){return""}getTooltipAt(e,t){return""}getRowHeight(e){return e===0&&this.firstRowPaddingTop>0?this.firstRowPaddingTop+this.coverHeight:this.coverHeight}getCellRenderer(e,t){return this.cellRenderer}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){}setRowChecked(e,t){}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){const t=this.firstRowPaddingTop>0?this.firstRowPaddingTop:0;return this.coverHeight*e+t}init(){}externalFilterChanged(e){this.filteredItems=this.items.filter(e)}isFilterable(){return!0}doSort(e){if(!this.filteredItems)return!1;for(const t of e){const{sortState:o}=t,s=o==="asc"?1:o==="desc"?-1:0;this.filteredItems=this.filteredItems.sort((i,r)=>this.sorterService.genericSortComparator(i,r,s))}return!0}sort(e){this.filteredItems=this.filteredItems.sort(e)}isEditable(e,t){return!1}setValue(e,t,o){return!0}isSelectable(e,t){return!1}changeColumnOrder(e,t){}setPropertyValue(e,t,o){return!1}arrayMove(e,t,o){}}class Tt{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new k,this.footerAreaModel=new k}changeColumnOrder(e,t){}isSortable(e){return!1}init(){}setParentWidth(e){this.bodyModel.width=e}getColumnCount(){return this.bodyModel.getColumnCount()}getXPosByColumnIndex(e){return e*this.getColumnWidth(e)}getAreaModel(e){return e==="header"?this.headerAreaModel:e==="footer"?this.footerAreaModel:this.bodyModel}getBodyModel(){return this.bodyModel}getFixedLeftColumnCount(){return 0}getFixedRightColumnCount(){return 0}isHeaderVisibe(){return!1}isFooterVisibe(){return!1}isRowCheckboxVisible(){return!1}getRowHeight(e,t){return this.bodyModel.getRowHeight(t)}getColumnDef(e){}getColumnDefs(){}getColumnProperty(e){return""}getBodyRowByIndex(e){return this.bodyModel.getRowByIndex(e)}getColumnWidth(e){return this.bodyModel.coverWidth}setColumnWidth(e,t){this.bodyModel.coverWidth=t}recalcSize(e){}recalcPadding(){}recalcHeightAndPadding(){}getPadding(){return new re(0,0,0,0)}getContentHeightInPixel(){return this.paddingTop+this.bodyModel.getRowCount()*this.bodyModel.coverHeight}getContentWidthInPixel(){return this.bodyModel.getColumnCount()*this.bodyModel.coverWidth}externalFilterChanged(e){this.bodyModel.externalFilterChanged(e)}doSort(e){return this.bodyModel.doSort(e)}sort(e){this.bodyModel.sort(e)}getSelectionModel(){}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Ro{static createCoverGridModel(e,t,o=200,s=300,i=0,r=0){const n=new Et(e,t,o,s,i,r);return new Tt(n,r)}}const Ao=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class It{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class kt{constructor(e,t,o,s,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=o,this.filter=s,this.sorting=i,this.startIndex=r,this.endIndex=n}}class Mo extends kt{constructor(e,t,o,s,i,r,n,l){super(e,t,o,s,i,r,n),this.rows=l}}class Dt{constructor(e,t){this.value=e,this.label=t}}class Eo{constructor(e,t){this.index=e,this.px=t}}const To={body:["ge-table-text-align-left"]},Io={body:["ge-table-text-align-center"]},ko={body:["ge-table-text-align-right"]},Do={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Po={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Fo={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Me{render(e,t,o,s,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.isRowChecked(t),a=l==="full"?"checked":"",d=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
|
|
309
309
|
<input
|
|
310
310
|
type="checkbox"
|
|
311
311
|
data-area="${s}"
|
package/index.js
CHANGED
|
@@ -6919,6 +6919,9 @@ class Tt {
|
|
|
6919
6919
|
constructor(e, t, s = 200, o = 300, i = 0, r = 0) {
|
|
6920
6920
|
this.items = e, this.cellRenderer = t, this.coverWidth = s, this.coverHeight = o, this.width = i, this.firstRowPaddingTop = r, this.rowSelectionModel = void 0, this.areaIdent = "body", this.filteredItems = [], this.sorterService = new ge(), this.filteredItems = e;
|
|
6921
6921
|
}
|
|
6922
|
+
setParentWidth(e) {
|
|
6923
|
+
this.width = e;
|
|
6924
|
+
}
|
|
6922
6925
|
getRowCount() {
|
|
6923
6926
|
var e;
|
|
6924
6927
|
return (e = this.filteredItems) != null && e.length ? Math.floor(this.filteredItems.length / this.getColumnCount()) + 1 : 0;
|
|
@@ -6978,7 +6981,7 @@ class Tt {
|
|
|
6978
6981
|
this.filteredItems = this.items.filter(e);
|
|
6979
6982
|
}
|
|
6980
6983
|
isFilterable() {
|
|
6981
|
-
return !
|
|
6984
|
+
return !0;
|
|
6982
6985
|
}
|
|
6983
6986
|
doSort(e) {
|
|
6984
6987
|
if (!this.filteredItems) return !1;
|
|
@@ -7020,6 +7023,7 @@ class kt {
|
|
|
7020
7023
|
init() {
|
|
7021
7024
|
}
|
|
7022
7025
|
setParentWidth(e) {
|
|
7026
|
+
this.bodyModel.width = e;
|
|
7023
7027
|
}
|
|
7024
7028
|
getColumnCount() {
|
|
7025
7029
|
return this.bodyModel.getColumnCount();
|
|
@@ -7065,6 +7069,7 @@ class kt {
|
|
|
7065
7069
|
return this.bodyModel.coverWidth;
|
|
7066
7070
|
}
|
|
7067
7071
|
setColumnWidth(e, t) {
|
|
7072
|
+
this.bodyModel.coverWidth = t;
|
|
7068
7073
|
}
|
|
7069
7074
|
recalcSize(e) {
|
|
7070
7075
|
}
|
|
@@ -18,6 +18,7 @@ export declare class CoverGridBodyModel<T> implements AreaModelIf {
|
|
|
18
18
|
filteredItems: T[];
|
|
19
19
|
protected sorterService: SorterService;
|
|
20
20
|
constructor(items: T[], cellRenderer: CellRendererIf, coverWidth?: number, coverHeight?: number, width?: number, firstRowPaddingTop?: number);
|
|
21
|
+
setParentWidth(widthInPixel: number): void;
|
|
21
22
|
getRowCount(): number;
|
|
22
23
|
getColumnCount(): number;
|
|
23
24
|
getValueAt(rowIndex: number, columnIndex: number): T | undefined;
|
|
@@ -18,7 +18,7 @@ export declare class CoverGridTableModel<T> implements TableModelIf {
|
|
|
18
18
|
changeColumnOrder(_sourceColumnIndex: number, _targetColumnIndex: number): void;
|
|
19
19
|
isSortable(_colIdx: number): boolean;
|
|
20
20
|
init(): void;
|
|
21
|
-
setParentWidth(
|
|
21
|
+
setParentWidth(widthInPixel: number): void;
|
|
22
22
|
getColumnCount(): number;
|
|
23
23
|
getXPosByColumnIndex(columnIndex: number): number;
|
|
24
24
|
getAreaModel(rowAreaIdent: AreaIdent): AreaModelIf;
|
|
@@ -34,7 +34,7 @@ export declare class CoverGridTableModel<T> implements TableModelIf {
|
|
|
34
34
|
getColumnProperty(_columnIndex: number): string;
|
|
35
35
|
getBodyRowByIndex(rowIndex: number): any;
|
|
36
36
|
getColumnWidth(_columnIndex: number): number;
|
|
37
|
-
setColumnWidth(_columnIndex: number,
|
|
37
|
+
setColumnWidth(_columnIndex: number, width: number): void;
|
|
38
38
|
recalcSize(_clientWidth: number): void;
|
|
39
39
|
recalcPadding(): void;
|
|
40
40
|
recalcHeightAndPadding(): void;
|