@guiexpert/table 1.1.55 → 1.1.57
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 +1 -1
- package/index.js +31 -61
- package/lib/table/data/tablemodel/column/column-def.if.d.ts +2 -4
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -302,7 +302,7 @@ export class ${t} implements CellRendererIf {
|
|
|
302
302
|
--ge-table-column-resize-handle-border: oklch(0% 0 0);
|
|
303
303
|
--ge-table-dragged-col-div-bg: #2c2e33;
|
|
304
304
|
--ge-table-drop-zone-bg: #758129;
|
|
305
|
-
}`};let me=re;class be{constructor(e,t=!0,s,o,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=s,this.parent=o,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class oe{static buildTreeRows(e,t="children",s=12){const o=[];for(const i of e)o.push(oe.buildTreeRow(i,t,void 0,0,s));return o}static buildTreeRow(e,t="children",s=new be(e,!0,[],void 0,0),o=0,i=12){var n;if(o>i)return console.warn("Max deep limit reached: ",o),s;const r=e[t];if(r)for(const l of r){const a=new be(l,!0,[],s,o+1);if((n=s.children)==null||n.push(a),oe.buildTreeRow(l,t,a,o+1),o>i)return console.warn("Max deep limit reached: ",o),s}return s}}class N{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class y{constructor(e=100,t="px"){this.value=e,this.unit=t}}const xt=()=>!0,ye=()=>!1;class H{constructor(e,t,s=new y(100,"px"),o=new M,i=new M,r=new y(100,"px"),n=new y(100,"px"),l,a,c,d,u,f,p,m,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=s,this.classes=o,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=a,this.sortState=c,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=f,this.getEditRenderer=p,this.editInputPipe=m,this.isVisible=g,this.visible=!0,s.unit!=="px"&&(this.minWidth=new y(0,"px"),this.maxWidth=new y(1e5,"px"))}static bodyRenderer(e){return new M(void 0,e,void 0)}static create(e){const t=new M(e.headerRenderer,e.bodyRenderer,e.footerRenderer),s=new M(e.headerClasses,e.bodyClasses,e.footerClasses),o=e.sortIconVisible??e.sortable??ye,i=e.editable??e.editable??ye,r=e.isVisible??e.isVisible??xt;return new H(e.property??"",e.headerLabel??"",e.width??new y(100,"px"),s,t,e.minWidth??new y(100,"px"),e.maxWidth??new y(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r)}}const Nt=new y(500,"px"),Gt=new y(400,"px"),St=new y(300,"px"),zt=new y(290,"px"),jt=new y(280,"px"),Yt=new y(270,"px"),Ut=new y(260,"px"),Kt=new y(250,"px"),Xt=new y(240,"px"),Jt=new y(230,"px"),qt=new y(220,"px"),Zt=new y(210,"px"),xe=new y(200,"px"),Qt=new y(190,"px"),es=new y(180,"px"),ts=new y(170,"px"),ss=new y(160,"px"),os=new y(150,"px"),is=new y(140,"px"),rs=new y(130,"px"),ns=new y(120,"px"),ls=new y(110,"px"),as=new y(100,"px"),cs=new y(90,"px"),ds=new y(80,"px"),hs=new y(70,"px"),us=new y(60,"px"),ps=new y(50,"px"),gs=new y(40,"px"),fs=new y(30,"px"),ms=new y(20,"px"),bs=new y(10,"px"),ys=new y(0,"px");class ue{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(o=>o.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}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){var s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){var o,i;const s=(o=this.columnDefs)==null?void 0:o[t];return((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var n;const o=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),s):(i[r]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const o=t.shift();if(o){const i=e[o];return i&&t.length?this.setPropertyValue(i,t,s):(e[o]=s,!0)}return!1}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class P extends ue{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.arr=t,this.defaultRowHeight=s,this.columnDefs=o,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,s){var i;const o=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return o&&(s=o(s,e,t)),this.arr[e][t]=s,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}changeColumnOrder(e,t){this.filteredArr.forEach(s=>this.arrayMove(s,e,t)),super.changeColumnOrder(e,t)}}class F{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}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,s){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class wt{flattenTree(e,t=[]){var s;for(const o of e)this.isVisible(o)&&t.push(o),(s=o.children)!=null&&s.length&&this.flattenTree(o.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Ct{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const o=e,i=t;if(o.length&&i.length)return this.genericSortComparator(o[0],i[0],s)}return s*(""+e).localeCompare(""+t)}}class Se extends ue{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.type="AreaModelTree",this.sorterService=new Ct,this.service=new wt,this.properties=o.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 s=this.getRowByIndex(e);if(s){const o=this.properties[t];if(o)return o.includes(".")?this.getPropertyValue(s.data,o.split(".")):s.data[o]}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){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:s}=e[e.length-1],o=s==="asc"?1:s==="desc"?-1:0,i=this.properties[t];return this.treeSort(this.rows,i,o),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,s){var r;const o=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;o&&(s=o(s,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("."),s):(n[l]=s,!0)}return!1}genericTreeTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{if(s!=null&&s.sortComparator){const l=this.getValueByT(o.data,e),a=this.getValueByT(i.data,e);return t*s.sortComparator(l,a,o.data,i.data)}const r=this.getValueByT(o.data,e),n=this.getValueByT(i.data,e);return this.sorterService.genericSortComparator(r,n,t)}}expandAllRecursive(e,t){for(const s of e)s.expanded=t,s.children&&this.expandAllRecursive(s.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(s=>{e=Math.max(e,s.deep)});const t=this.flattenRows.filter((s,o,i)=>this.lastPredictFn(s,o,i));this.flattenRows.forEach(s=>s.keep=!1),this.flattenRows.forEach(s=>{t.includes(s)&&(s.keep=!0,this.setAllParentsOk(s))}),this.filteredFlattenRows=this.flattenRows.filter((s,o,i)=>s.keep)}}getPropertyValue(e,t){const s=t.shift();let o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}treeSort(e,t,s){e.sort(this.genericTreeTableSortComparator(t,s));for(const o of e)o.children&&this.treeSort(o.children,t,s)}}class we{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const s of e.children)this.checkRow(s,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),s=this.areAllChildrenUnchecked(e);return!t&&!s?"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),s=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(!o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenChecked(o))return!1}return!0}areAllChildrenUnchecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenUnchecked(o))return!1}return!0}addSelectedRecursive(e,t){for(const s of e)s.checked&&t.push(s),s.children&&this.addSelectedRecursive(s.children,t)}}class Ce{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class vt{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 Q{constructor(e,t,s,o=0,i=0,r=!1,n=new N,l=[],a=[],c=-1,d=0,u=400,f=()=>{}){var p,m,g,b;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=s,this.fixedLeftColumnCount=o,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=a,this.overridingColumnWidth=c,this.columnCount=d,this.parentSize=u,this.getSelectionModel=f,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new Ce(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",s.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&&Xe(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new vt)}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 s;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((s=this.columnSizes)==null?void 0:s.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var s;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((s=this.columnSizes)==null?void 0:s.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"),s=this.getAreaHeight("header"),o=this.getAreaHeight("footer");this.padding=new Ce(s,t,o,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),s=t.getRowCount();if(this.defaultRowHeights[e])return s*this.defaultRowHeights[e];let o=0;for(let i=0;i<s;i++)o=o+t.getRowHeight(i);return o}getSideAreaWidth(e){const[t,s]=this.getSideStartAndEndColumnIndex(e);let o=0;for(let i=t;i<=s;i++)o=o+this.getColumnWidth(i);return o}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),s=this.getFixedRightColumnCount();let o=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?o=this.columnCount-s:(o=t,i=this.columnCount-s-1),[o,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)}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 s=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof s=="function")return s()}return!1}changeColumnOrder(e,t){var s,o,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(s=this.headerAreaModel)==null||s.changeColumnOrder(e,t),(o=this.bodyAreaModel)==null||o.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,s,o;if(!((t=this.columnDefs)!=null&&t.length)&&!((s=this.columnSizes)!=null&&s.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(o=this.columnDefs)!=null&&o.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 c=this.sizeToPixel(l.minWidth,e);a=Math.max(c,a)}if(l.maxWidth){const c=this.sizeToPixel(l.maxWidth,e);a=Math.min(c,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,c)=>a+c);for(let a=0;a<this.columnDefs.length;a++){const c=this.columnDefs[a];c.width.unit==="weight"&&(this.columnSizes[a]=c.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,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),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 Rt extends ue{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.sorterService=new Ct,this.filteredRows=[...t],this.properties=o.map(i=>i.property)}setRows(e){this.rows=e,this.filteredRows=[...e]}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];return W(o)&&(o=o.data),o?this.getValueByT(o,s):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}getRowHeight(e){return this.defaultRowHeight}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[]}doSort(e){for(const t of e){const{columnIndex:s,sortState:o}=t,i=o==="asc"?1:o==="desc"?-1:0,r=this.properties[s];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!0}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{if(s!=null&&s.sortComparator){const l=this.getValueByT(o,e),a=this.getValueByT(i,e);return t*s.sortComparator(l,a,o,i)}const r=this.getValueByT(o,e),n=this.getValueByT(i,e);return this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class ve extends Rt{constructor(e,t,s,o){super(e,t,o,s),this.areaIdent=e,this.rows=t,this.columnDefs=s,this.defaultRowHeight=o}}class ${static createTableModel(e){var t,s,o,i,r,n,l,a,c,d,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 N,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&&((s=e.properties)!=null&&s.length?e.columnDefs=e.properties.map(g=>new H(g,g.toUpperCase(),xe)):(o=e.rows)!=null&&o.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new H(g,g.toUpperCase(),xe)):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 P("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(c=e.columnDefs)!=null&&c.length?e.headerAreaModel=new P("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new F("header")),e.footerAreaModel||((d=e.footerData)!=null&&d.length?e.footerAreaModel=new P("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new F("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&W(e.rows[0])){const g=e.rows;e.bodyAreaModel=new Se("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(f=e.tableOptions)!=null&&f.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new we(g))}else e.bodyAreaModel=new ve("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new P("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new F("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 Q(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 $.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new K,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,s=new K,o=0,i=0){const r=s.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&W(e[0])){const a=e,c=new Se("body",a,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new we(a)),$.createByAreaModelsParam({headerAreaModel:new P("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:c,footerAreaModel:new P("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return $.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return $.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new N,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new F,t,s=new F,o=0,i=0,r=!1,n=new N,l,a=[],c=-1,d){return new Q(e,t,s,o,i,r,n,l,a,c,d)}static createByAreaModelsParam(e){return $.createByAreaModels(e.headerAreaModel??new F,e.bodyAreaModel,e.footerAreaModel??new F,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=[],s=[],o=0,i=0,r=!1,n=new N,l,a=[]){let c;t!=null&&t.length?c=new P("header",t,n.header,l):l!=null&&l.length?c=new P("header",[l.map(f=>f.headerLabel)],n.header,l):c=new F;const d=s?new P("footer",s,n.footer,l):new F,u=new ve("body",e,l,n.body);return new Q(c,u,d,o,i,r,n,l,a)}}const xs=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class At{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Et{constructor(e,t,s,o,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=s,this.filter=o,this.sorting=i,this.startIndex=r,this.endIndex=n}}class Ss extends Et{constructor(e,t,s,o,i,r,n,l){super(e,t,s,o,i,r,n),this.rows=l}}class Tt{constructor(e,t){this.value=e,this.label=t}}class ws{constructor(e,t){this.index=e,this.px=t}}const Cs={body:["ge-table-text-align-left"]},vs={body:["ge-table-text-align-center"]},Rs={body:["ge-table-text-align-right"]},As={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Es={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Ts={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Re{render(e,t,s,o,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.isRowChecked(t),a=l==="full"?"checked":"",c=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
|
|
305
|
+
}`};let me=re;class be{constructor(e,t=!0,s,o,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=s,this.parent=o,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class oe{static buildTreeRows(e,t="children",s=12){const o=[];for(const i of e)o.push(oe.buildTreeRow(i,t,void 0,0,s));return o}static buildTreeRow(e,t="children",s=new be(e,!0,[],void 0,0),o=0,i=12){var n;if(o>i)return console.warn("Max deep limit reached: ",o),s;const r=e[t];if(r)for(const l of r){const a=new be(l,!0,[],s,o+1);if((n=s.children)==null||n.push(a),oe.buildTreeRow(l,t,a,o+1),o>i)return console.warn("Max deep limit reached: ",o),s}return s}}class N{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class y{constructor(e=100,t="px"){this.value=e,this.unit=t}}const xt=()=>!0,ye=()=>!1;class H{constructor(e,t,s=new y(100,"px"),o=new M,i=new M,r=new y(100,"px"),n=new y(100,"px"),l,a,c,d,u,f,p,m,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=s,this.classes=o,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=a,this.sortState=c,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=f,this.getEditRenderer=p,this.editInputPipe=m,this.isVisible=g,this.visible=!0,s.unit!=="px"&&(this.minWidth=new y(0,"px"),this.maxWidth=new y(1e5,"px"))}static bodyRenderer(e){return new M(void 0,e,void 0)}static create(e){const t=new M(e.headerRenderer,e.bodyRenderer,e.footerRenderer),s=new M(e.headerClasses,e.bodyClasses,e.footerClasses),o=e.sortIconVisible??e.sortable??ye,i=e.editable??e.editable??ye,r=e.isVisible??e.isVisible??xt;return new H(e.property??"",e.headerLabel??"",e.width??new y(100,"px"),s,t,e.minWidth??new y(100,"px"),e.maxWidth??new y(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r)}}const Nt=new y(500,"px"),Gt=new y(400,"px"),St=new y(300,"px"),zt=new y(290,"px"),jt=new y(280,"px"),Yt=new y(270,"px"),Ut=new y(260,"px"),Kt=new y(250,"px"),Xt=new y(240,"px"),Jt=new y(230,"px"),qt=new y(220,"px"),Zt=new y(210,"px"),xe=new y(200,"px"),Qt=new y(190,"px"),es=new y(180,"px"),ts=new y(170,"px"),ss=new y(160,"px"),os=new y(150,"px"),is=new y(140,"px"),rs=new y(130,"px"),ns=new y(120,"px"),ls=new y(110,"px"),as=new y(100,"px"),cs=new y(90,"px"),ds=new y(80,"px"),hs=new y(70,"px"),us=new y(60,"px"),ps=new y(50,"px"),gs=new y(40,"px"),fs=new y(30,"px"),ms=new y(20,"px"),bs=new y(10,"px"),ys=new y(0,"px");class ue{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(o=>o.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}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){var s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){var o,i;const s=(o=this.columnDefs)==null?void 0:o[t];return((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var n;const o=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),s):(i[r]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const o=t.shift();if(o){const i=e[o];return i&&t.length?this.setPropertyValue(i,t,s):(e[o]=s,!0)}return!1}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class P extends ue{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.arr=t,this.defaultRowHeight=s,this.columnDefs=o,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,s){var i;const o=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return o&&(s=o(s,e,t)),this.arr[e][t]=s,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}changeColumnOrder(e,t){this.filteredArr.forEach(s=>this.arrayMove(s,e,t)),super.changeColumnOrder(e,t)}}class F{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}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,s){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class wt{flattenTree(e,t=[]){var s;for(const o of e)this.isVisible(o)&&t.push(o),(s=o.children)!=null&&s.length&&this.flattenTree(o.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Ct{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const o=e,i=t;if(o.length&&i.length)return this.genericSortComparator(o[0],i[0],s)}return s*(""+e).localeCompare(""+t)}}class Se extends ue{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.type="AreaModelTree",this.sorterService=new Ct,this.service=new wt,this.properties=o.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 s=this.getRowByIndex(e);if(s){const o=this.properties[t];if(o)return o.includes(".")?this.getPropertyValue(s.data,o.split(".")):s.data[o]}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){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:s}=e[e.length-1],o=s==="asc"?1:s==="desc"?-1:0,i=this.properties[t];return this.treeSort(this.rows,i,o),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,s){var r;const o=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;o&&(s=o(s,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("."),s):(n[l]=s,!0)}return!1}genericTreeTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o.data,e),n=this.getValueByT(i.data,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,n,o.data,i.data,t):this.sorterService.genericSortComparator(r,n,t)}}expandAllRecursive(e,t){for(const s of e)s.expanded=t,s.children&&this.expandAllRecursive(s.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(s=>{e=Math.max(e,s.deep)});const t=this.flattenRows.filter((s,o,i)=>this.lastPredictFn(s,o,i));this.flattenRows.forEach(s=>s.keep=!1),this.flattenRows.forEach(s=>{t.includes(s)&&(s.keep=!0,this.setAllParentsOk(s))}),this.filteredFlattenRows=this.flattenRows.filter((s,o,i)=>s.keep)}}getPropertyValue(e,t){const s=t.shift();let o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}treeSort(e,t,s){e.sort(this.genericTreeTableSortComparator(t,s));for(const o of e)o.children&&this.treeSort(o.children,t,s)}}class we{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const s of e.children)this.checkRow(s,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),s=this.areAllChildrenUnchecked(e);return!t&&!s?"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),s=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(!o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenChecked(o))return!1}return!0}areAllChildrenUnchecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenUnchecked(o))return!1}return!0}addSelectedRecursive(e,t){for(const s of e)s.checked&&t.push(s),s.children&&this.addSelectedRecursive(s.children,t)}}class Ce{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class vt{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 Q{constructor(e,t,s,o=0,i=0,r=!1,n=new N,l=[],a=[],c=-1,d=0,u=400,f=()=>{}){var p,m,g,b;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=s,this.fixedLeftColumnCount=o,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=a,this.overridingColumnWidth=c,this.columnCount=d,this.parentSize=u,this.getSelectionModel=f,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new Ce(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",s.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&&Xe(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new vt)}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 s;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((s=this.columnSizes)==null?void 0:s.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var s;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((s=this.columnSizes)==null?void 0:s.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"),s=this.getAreaHeight("header"),o=this.getAreaHeight("footer");this.padding=new Ce(s,t,o,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),s=t.getRowCount();if(this.defaultRowHeights[e])return s*this.defaultRowHeights[e];let o=0;for(let i=0;i<s;i++)o=o+t.getRowHeight(i);return o}getSideAreaWidth(e){const[t,s]=this.getSideStartAndEndColumnIndex(e);let o=0;for(let i=t;i<=s;i++)o=o+this.getColumnWidth(i);return o}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),s=this.getFixedRightColumnCount();let o=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?o=this.columnCount-s:(o=t,i=this.columnCount-s-1),[o,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)}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 s=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof s=="function")return s()}return!1}changeColumnOrder(e,t){var s,o,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(s=this.headerAreaModel)==null||s.changeColumnOrder(e,t),(o=this.bodyAreaModel)==null||o.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,s,o;if(!((t=this.columnDefs)!=null&&t.length)&&!((s=this.columnSizes)!=null&&s.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(o=this.columnDefs)!=null&&o.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 c=this.sizeToPixel(l.minWidth,e);a=Math.max(c,a)}if(l.maxWidth){const c=this.sizeToPixel(l.maxWidth,e);a=Math.min(c,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,c)=>a+c);for(let a=0;a<this.columnDefs.length;a++){const c=this.columnDefs[a];c.width.unit==="weight"&&(this.columnSizes[a]=c.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,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),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 Rt extends ue{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.sorterService=new Ct,this.filteredRows=[...t],this.properties=o.map(i=>i.property)}setRows(e){this.rows=e,this.filteredRows=[...e]}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];return W(o)&&(o=o.data),o?this.getValueByT(o,s):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}getRowHeight(e){return this.defaultRowHeight}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[]}doSort(e){for(const t of e){const{columnIndex:s,sortState:o}=t,i=o==="asc"?1:o==="desc"?-1:0,r=this.properties[s];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!0}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o,e),n=this.getValueByT(i,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,n,o,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class ve extends Rt{constructor(e,t,s,o){super(e,t,o,s),this.areaIdent=e,this.rows=t,this.columnDefs=s,this.defaultRowHeight=o}}class ${static createTableModel(e){var t,s,o,i,r,n,l,a,c,d,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 N,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&&((s=e.properties)!=null&&s.length?e.columnDefs=e.properties.map(g=>new H(g,g.toUpperCase(),xe)):(o=e.rows)!=null&&o.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new H(g,g.toUpperCase(),xe)):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 P("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(c=e.columnDefs)!=null&&c.length?e.headerAreaModel=new P("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new F("header")),e.footerAreaModel||((d=e.footerData)!=null&&d.length?e.footerAreaModel=new P("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new F("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&W(e.rows[0])){const g=e.rows;e.bodyAreaModel=new Se("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(f=e.tableOptions)!=null&&f.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new we(g))}else e.bodyAreaModel=new ve("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new P("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new F("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 Q(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 $.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new K,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,s=new K,o=0,i=0){const r=s.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&W(e[0])){const a=e,c=new Se("body",a,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new we(a)),$.createByAreaModelsParam({headerAreaModel:new P("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:c,footerAreaModel:new P("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return $.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return $.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new N,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new F,t,s=new F,o=0,i=0,r=!1,n=new N,l,a=[],c=-1,d){return new Q(e,t,s,o,i,r,n,l,a,c,d)}static createByAreaModelsParam(e){return $.createByAreaModels(e.headerAreaModel??new F,e.bodyAreaModel,e.footerAreaModel??new F,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=[],s=[],o=0,i=0,r=!1,n=new N,l,a=[]){let c;t!=null&&t.length?c=new P("header",t,n.header,l):l!=null&&l.length?c=new P("header",[l.map(f=>f.headerLabel)],n.header,l):c=new F;const d=s?new P("footer",s,n.footer,l):new F,u=new ve("body",e,l,n.body);return new Q(c,u,d,o,i,r,n,l,a)}}const xs=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class At{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Et{constructor(e,t,s,o,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=s,this.filter=o,this.sorting=i,this.startIndex=r,this.endIndex=n}}class Ss extends Et{constructor(e,t,s,o,i,r,n,l){super(e,t,s,o,i,r,n),this.rows=l}}class Tt{constructor(e,t){this.value=e,this.label=t}}class ws{constructor(e,t){this.index=e,this.px=t}}const Cs={body:["ge-table-text-align-left"]},vs={body:["ge-table-text-align-center"]},Rs={body:["ge-table-text-align-right"]},As={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Es={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Ts={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Re{render(e,t,s,o,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.isRowChecked(t),a=l==="full"?"checked":"",c=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
|
|
306
306
|
<input
|
|
307
307
|
type="checkbox"
|
|
308
308
|
data-area="${o}"
|
package/index.js
CHANGED
|
@@ -132,8 +132,7 @@ class Bt {
|
|
|
132
132
|
} else
|
|
133
133
|
u = " bodyRenderer: new SimpleArrayCellRenderer(),";
|
|
134
134
|
d = 250;
|
|
135
|
-
} else
|
|
136
|
-
n.type === ae ? (u = " bodyRenderer: new NumberCellRenderer(),", f = "ge-table-text-align-right") : n.type === ce && (u = " bodyRenderer: new TrueFalseCellRenderer(),", f = "ge-table-text-align-center", d = 80);
|
|
135
|
+
} else n.type === ae ? (u = " bodyRenderer: new NumberCellRenderer(),", f = "ge-table-text-align-right") : n.type === ce && (u = " bodyRenderer: new TrueFalseCellRenderer(),", f = "ge-table-text-align-center", d = 80);
|
|
137
136
|
e.push(` ColumnDef.create({
|
|
138
137
|
property: "${l}",
|
|
139
138
|
headerLabel: "${c}",
|
|
@@ -276,8 +275,7 @@ function Ye(h) {
|
|
|
276
275
|
return e.includes(ye) || (e = e + ye), e;
|
|
277
276
|
}
|
|
278
277
|
function Ke(h) {
|
|
279
|
-
if (!h || h.length === 0)
|
|
280
|
-
return h;
|
|
278
|
+
if (!h || h.length === 0) return h;
|
|
281
279
|
const e = ["Array", "Arr", "List", "s"];
|
|
282
280
|
for (const t of e)
|
|
283
281
|
if (h.endsWith(t))
|
|
@@ -521,8 +519,7 @@ class Ht {
|
|
|
521
519
|
n = !0;
|
|
522
520
|
for (const c of o.propertyItem.types)
|
|
523
521
|
a.items.push(c);
|
|
524
|
-
} else
|
|
525
|
-
a instanceof D && (n = !0, a.properties.push(o.propertyItem));
|
|
522
|
+
} else a instanceof D && (n = !0, a.properties.push(o.propertyItem));
|
|
526
523
|
}
|
|
527
524
|
if (!n)
|
|
528
525
|
for (const a of o.propertyItem.types)
|
|
@@ -589,11 +586,10 @@ class Ht {
|
|
|
589
586
|
const d = r ? `${r}/${c}` : c;
|
|
590
587
|
o(i[c], d, a);
|
|
591
588
|
}
|
|
592
|
-
} else
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
});
|
|
589
|
+
} else Array.isArray(i) && i.forEach((c, d) => {
|
|
590
|
+
const u = `${r}/[]`;
|
|
591
|
+
o(c, u, a);
|
|
592
|
+
});
|
|
597
593
|
};
|
|
598
594
|
return o(e, "root", t), s.sort((i, r) => i.path.localeCompare(r.path));
|
|
599
595
|
}
|
|
@@ -623,8 +619,7 @@ class Vt {
|
|
|
623
619
|
}
|
|
624
620
|
}
|
|
625
621
|
renderTypeScriptInterfacesRecursive(e = this.rootPropertyType, t = [], s = this.rootName) {
|
|
626
|
-
if (!e)
|
|
627
|
-
return t;
|
|
622
|
+
if (!e) return t;
|
|
628
623
|
if (e instanceof B) {
|
|
629
624
|
for (const o of e.items)
|
|
630
625
|
if (this.renderTypeScriptInterfacesRecursive(o, t, s), o instanceof D) {
|
|
@@ -654,10 +649,8 @@ class Vt {
|
|
|
654
649
|
}
|
|
655
650
|
propertyItem2InterfaceDateType(e) {
|
|
656
651
|
var s, o;
|
|
657
|
-
if (((s = e.types) == null ? void 0 : s.length) === 0)
|
|
658
|
-
|
|
659
|
-
if (((o = e.types) == null ? void 0 : o.length) === 1)
|
|
660
|
-
return this.renderType(e.types[0], e);
|
|
652
|
+
if (((s = e.types) == null ? void 0 : s.length) === 0) return "any";
|
|
653
|
+
if (((o = e.types) == null ? void 0 : o.length) === 1) return this.renderType(e.types[0], e);
|
|
661
654
|
const t = e.types.map((i) => this.renderType(i, e)).filter((i) => i !== z).sort((i, r) => K.includes(i) ? 100 : K.includes(r) ? -100 : i.localeCompare(r)).join(this.orOperator);
|
|
662
655
|
return t.includes(this.orOperator) ? "(" + t + ")" : t;
|
|
663
656
|
}
|
|
@@ -670,8 +663,7 @@ class Vt {
|
|
|
670
663
|
}
|
|
671
664
|
containsUndefinedPropertyType(e) {
|
|
672
665
|
for (const t of e.types)
|
|
673
|
-
if (t.type === z)
|
|
674
|
-
return !0;
|
|
666
|
+
if (t.type === z) return !0;
|
|
675
667
|
return !1;
|
|
676
668
|
}
|
|
677
669
|
}
|
|
@@ -1908,26 +1900,17 @@ class lt extends rt {
|
|
|
1908
1900
|
*/
|
|
1909
1901
|
getArea(e, t) {
|
|
1910
1902
|
if (e === "header") {
|
|
1911
|
-
if (t === "west")
|
|
1912
|
-
|
|
1913
|
-
if (t === "
|
|
1914
|
-
return this.areaHeaderCenter;
|
|
1915
|
-
if (t === "east")
|
|
1916
|
-
return this.areaHeaderEast;
|
|
1903
|
+
if (t === "west") return this.areaHeaderWest;
|
|
1904
|
+
if (t === "center") return this.areaHeaderCenter;
|
|
1905
|
+
if (t === "east") return this.areaHeaderEast;
|
|
1917
1906
|
} else if (e === "body") {
|
|
1918
|
-
if (t === "west")
|
|
1919
|
-
|
|
1920
|
-
if (t === "
|
|
1921
|
-
return this.areaBodyCenter;
|
|
1922
|
-
if (t === "east")
|
|
1923
|
-
return this.areaBodyEast;
|
|
1907
|
+
if (t === "west") return this.areaBodyWest;
|
|
1908
|
+
if (t === "center") return this.areaBodyCenter;
|
|
1909
|
+
if (t === "east") return this.areaBodyEast;
|
|
1924
1910
|
} else if (e === "footer") {
|
|
1925
|
-
if (t === "west")
|
|
1926
|
-
|
|
1927
|
-
if (t === "
|
|
1928
|
-
return this.areaFooterCenter;
|
|
1929
|
-
if (t === "east")
|
|
1930
|
-
return this.areaFooterEast;
|
|
1911
|
+
if (t === "west") return this.areaFooterWest;
|
|
1912
|
+
if (t === "center") return this.areaFooterCenter;
|
|
1913
|
+
if (t === "east") return this.areaFooterEast;
|
|
1931
1914
|
}
|
|
1932
1915
|
throw Error(`Wrong area identifier: row:${e}, col:${t}`);
|
|
1933
1916
|
}
|
|
@@ -1953,8 +1936,7 @@ class lt extends rt {
|
|
|
1953
1936
|
var s;
|
|
1954
1937
|
if (e) {
|
|
1955
1938
|
const o = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
|
|
1956
|
-
if (o)
|
|
1957
|
-
return Number(o);
|
|
1939
|
+
if (o) return Number(o);
|
|
1958
1940
|
}
|
|
1959
1941
|
return -1;
|
|
1960
1942
|
}
|
|
@@ -1970,8 +1952,7 @@ class lt extends rt {
|
|
|
1970
1952
|
var s;
|
|
1971
1953
|
if (e) {
|
|
1972
1954
|
const o = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
|
|
1973
|
-
if (o)
|
|
1974
|
-
return o;
|
|
1955
|
+
if (o) return o;
|
|
1975
1956
|
}
|
|
1976
1957
|
return "";
|
|
1977
1958
|
}
|
|
@@ -4244,12 +4225,8 @@ class ve extends fe {
|
|
|
4244
4225
|
genericTreeTableSortComparator(e, t) {
|
|
4245
4226
|
const s = this.columnDefs.find((o) => o.property === e);
|
|
4246
4227
|
return (o, i) => {
|
|
4247
|
-
if (s != null && s.sortComparator) {
|
|
4248
|
-
const l = this.getValueByT(o.data, e), a = this.getValueByT(i.data, e);
|
|
4249
|
-
return t * s.sortComparator(l, a, o.data, i.data);
|
|
4250
|
-
}
|
|
4251
4228
|
const r = this.getValueByT(o.data, e), n = this.getValueByT(i.data, e);
|
|
4252
|
-
return this.sorterService.genericSortComparator(r, n, t);
|
|
4229
|
+
return s != null && s.sortComparator ? t * s.sortComparator(r, n, o.data, i.data, t) : this.sorterService.genericSortComparator(r, n, t);
|
|
4253
4230
|
};
|
|
4254
4231
|
}
|
|
4255
4232
|
expandAllRecursive(e, t) {
|
|
@@ -4822,12 +4799,8 @@ class Et extends fe {
|
|
|
4822
4799
|
genericFlatTableSortComparator(e, t) {
|
|
4823
4800
|
const s = this.columnDefs.find((o) => o.property === e);
|
|
4824
4801
|
return (o, i) => {
|
|
4825
|
-
if (s != null && s.sortComparator) {
|
|
4826
|
-
const l = this.getValueByT(o, e), a = this.getValueByT(i, e);
|
|
4827
|
-
return t * s.sortComparator(l, a, o, i);
|
|
4828
|
-
}
|
|
4829
4802
|
const r = this.getValueByT(o, e), n = this.getValueByT(i, e);
|
|
4830
|
-
return this.sorterService.genericSortComparator(r, n, t);
|
|
4803
|
+
return s != null && s.sortComparator ? t * s.sortComparator(r, n, o, i, t) : this.sorterService.genericSortComparator(r, n, t);
|
|
4831
4804
|
};
|
|
4832
4805
|
}
|
|
4833
4806
|
getPropertyValue(e, t) {
|
|
@@ -4933,12 +4906,11 @@ class _ {
|
|
|
4933
4906
|
e.columnDefs,
|
|
4934
4907
|
e.defaultRowHeights.body
|
|
4935
4908
|
);
|
|
4936
|
-
else
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
) : e.bodyAreaModel = new F("body");
|
|
4909
|
+
else e.bodyData ? e.bodyAreaModel = new P(
|
|
4910
|
+
"body",
|
|
4911
|
+
e.bodyData,
|
|
4912
|
+
e.defaultRowHeights.body
|
|
4913
|
+
) : e.bodyAreaModel = new F("body");
|
|
4942
4914
|
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 se(
|
|
4943
4915
|
e.headerAreaModel,
|
|
4944
4916
|
e.bodyAreaModel,
|
|
@@ -6328,8 +6300,7 @@ class Lt {
|
|
|
6328
6300
|
<td>${r ?? ""}</td>
|
|
6329
6301
|
</tr>`;
|
|
6330
6302
|
for (const i in e) {
|
|
6331
|
-
if (!e.hasOwnProperty(i))
|
|
6332
|
-
continue;
|
|
6303
|
+
if (!e.hasOwnProperty(i)) continue;
|
|
6333
6304
|
const r = e[i], n = this.getCombinedKey(t, i), l = this.getLabel(n);
|
|
6334
6305
|
typeof r == "object" && r !== null ? (s.push(o(l, null, !0)), s.push(this.generateTableRows(r, n))) : s.push(o(l, String(r)));
|
|
6335
6306
|
}
|
|
@@ -6365,8 +6336,7 @@ class oe {
|
|
|
6365
6336
|
generateForm(e, t = "") {
|
|
6366
6337
|
const s = [];
|
|
6367
6338
|
for (const o in e) {
|
|
6368
|
-
if (!e.hasOwnProperty(o) || this.idKey === o)
|
|
6369
|
-
continue;
|
|
6339
|
+
if (!e.hasOwnProperty(o) || this.idKey === o) continue;
|
|
6370
6340
|
const i = this.getCombinedKey(t, o), r = this.getLabel(i), n = e[o];
|
|
6371
6341
|
if (typeof n == "object" && n !== null)
|
|
6372
6342
|
s.push(this.generateForm(n, i));
|
|
@@ -13,17 +13,15 @@ import { editInputPipe } from "../../../renderer/edit/edit-input-pipe.if";
|
|
|
13
13
|
* If the result is positive, it means 'valueB' comes before 'valueA' in the sorted order.
|
|
14
14
|
* If the result is zero, it means the two values are considered equal for sorting purposes.
|
|
15
15
|
*
|
|
16
|
-
* @typeparam T The type of values being compared.
|
|
17
|
-
* @typeparam U The type of row objects that contain the values.
|
|
18
|
-
*
|
|
19
16
|
* @param valueA The first value to be compared.
|
|
20
17
|
* @param valueB The second value to be compared.
|
|
21
18
|
* @param rowA Optional. The row object containing valueA.
|
|
22
19
|
* @param rowB Optional. The row object containing valueB.
|
|
20
|
+
* @param f Optional. The direction. It is not necessary to use this value in the comparator, as this number is used as a factor (1 or -1) in the outer sort method.
|
|
23
21
|
*
|
|
24
22
|
* @returns A number indicating the relative order of 'valueA' and 'valueB'.
|
|
25
23
|
*/
|
|
26
|
-
export type ValueRowSortComparator =
|
|
24
|
+
export type ValueRowSortComparator = (valueA: any, valueB: any, rowA?: any, rowB?: any, f?: number) => number;
|
|
27
25
|
/**
|
|
28
26
|
* Represents a column definition of one table column.
|
|
29
27
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/table",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.57",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^20.11.17",
|
|
25
|
-
"vite": "
|
|
25
|
+
"vite": "6.3.4",
|
|
26
26
|
"vite-plugin-dts": "^3.7.2",
|
|
27
27
|
"vite-plugin-eslint": "^1.8.1",
|
|
28
28
|
"vite-plugin-static-copy": "^0.17.0",
|