@guiexpert/table 1.1.69 → 1.1.74

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.
Files changed (3) hide show
  1. package/index.cjs +3 -3
  2. package/index.js +106 -104
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -45,7 +45,7 @@ export class ${t} implements CellRendererIf {
45
45
  data-row-index="${s}"
46
46
  data-input-type="checkbox"
47
47
  ${r}
48
- class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const a=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,a),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new Le,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const a of r.classes)this.domService.addClass(i,a);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",o=new Oe,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const a=l.content,c=this.domService.createText(a);this.domService.appendChild(n,c),l.style&&this.applyStyleString(n,l.style);for(const h of l.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const q=d=>d==="header"?"header":d==="footer"?"footer":"body";class Qe{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=q(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class et{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay){this.lastClicked=t,this.publishGeMouseEvent(e,2);return}this.lastClicked=t;const o=new Qe(e.target,this.tableScope);if(o.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(o.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(o),e.preventDefault(),e.stopPropagation();else if(o.inputType==="checkbox"&&o.areaIdent)this.tableScope.toggleRowCheckbox(o.rowIdx,o.colIdx,o.areaIdent),e.preventDefault(),e.stopPropagation();else if(N(o.row)&&o.areaModel){const s=o.colIdx===this.getArrowColumnIndex()&&e.altKey,i=o.className.includes("ge-table-tree-arrow-div");if(s||i){e.preventDefault(),e.stopPropagation();const r=o.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in o.areaModel&&o.areaModel.recalcVisibleTreeRows(),console.info("this.tableScope.hostElement",this.tableScope.hostElement),console.info("this.tableScope.hostElement.clientWidth",this.tableScope.hostElement.clientWidth),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(o.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(o.rowIdx,o.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,o=t.getAttribute("data-area"),s=q(o),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(o&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(i);if(o&&s==="body"&&n.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),N(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const a=l;a.expanded=!a.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent)}updateCollapsedExpandedState(e){var o,s,i,r,n;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,a=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,c=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,h=t(e.data);a?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):c&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class he{constructor(e,t=[],o=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=o,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(s=>s.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 o;const t=this.getRowByIndex(e);return(o=this.rowSelectionModel)==null?void 0:o.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const o=this.getRowByIndex(e);this.rowSelectionModel.checkRow(o,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 s,i;const o=(s=this.columnDefs)==null?void 0:s[t];return((i=o==null?void 0:o.editable)==null?void 0:i.call(o))??!1}setValue(e,t,o){var n;const s=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;s&&(o=s(o,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),o):(i[r]=o,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,o){const s=t.shift();if(s){const i=e[s];return i&&t.length?this.setPropertyValue(i,t,o):(e[s]=o,!0)}return!1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),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 tt{genericSortComparator(e,t,o){if(typeof e=="number"&&typeof t=="number")return o*(e-t);if(typeof e=="string"&&typeof t=="string")return o*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return o*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return o*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const s=e,i=t;if(s.length&&i.length)return this.genericSortComparator(s[0],i[0],o)}return o*(""+e).localeCompare(""+t)}}class _ extends he{constructor(e,t,o,s=[],i="ge-selected-row",r="ge-focused-row"){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.selectedRowClass=i,this.focusedRowClass=r,this.focusedRowIndex=0,this.sorterService=new tt,this.filteredRows=[...t],this.properties=s.map(n=>n.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 o=this.properties[t];let s=this.filteredRows[e];return N(s)&&(s=s.data),s?this.getValueByT(s,o):""}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:o,sortState:s}=t,i=s==="asc"?1:s==="desc"?-1:0,r=this.properties[o];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)}getCustomClassesAt(e,t){const o=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&o.push(this.selectedRowClass),this.focusedRowIndex===e&&o.push(this.focusedRowClass),o}genericFlatTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s,e),n=this.getValueByT(i,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const o=t.shift(),s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}}class ot{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}downloadExcel(e="table.xlsx",t=""){const o=[],s=this.tableScope.tableModel.getColumnCount(),i=["header","body","footer"];for(const r of i){const n=this.tableScope.tableModel.getAreaModel(r),l=(n==null?void 0:n.getRowCount())??0;for(let a=0;a<l;a++){const c=[];o.push(c);for(let h=0;h<s;h++)c.push(n.getValueAt(a,h))}}return this.tableScope.excelService.downloadExcel(o,e,t)}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){const t=this.getBodyModel();t instanceof _?t.setRows(e):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRows(e){const t=this.getBodyModel();if(t instanceof _){const o=t;let s=o.getAllRows();o.setRows([...s,...e])}else console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRowsAt(e,t){const o=this.getBodyModel();if(o instanceof _){const s=o;let i=s.getAllRows();s.setRows([...i.slice(0,t),...e,...i.slice(t)])}else console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}removeRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof _){const s=o,i=s.getAllRows().filter(r=>!e.some(n=>t(r,n)));s.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}findRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();return o instanceof _?o.getAllRows().filter(i=>e.some(r=>t(i,r))):(console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o),[])}updateRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof _){let i=o.getAllRows();for(const r of i)for(const n of e)if(t(r,n))for(const l of Object.keys(n))r[l]=n[l]}else console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}reSort(){this.tableScope.reSort()}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}}class _e{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((s,i)=>{t[s]=i}),t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class st extends _e{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class it{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class rt extends _e{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new it,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class nt extends _e{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SORTING_STATE,s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class O{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}class lt{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class R{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new R(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new R(e,t,e,t)}static singleRow(e){return new R(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new R(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class at{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new R(o,s,o+r-1,s+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class M{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class ct extends lt{constructor(e,t,o,s){var r,n;super(e,t,o,s),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new M,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.displayedRowCount=0,this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),oe(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new at(t,t.getAreaModel(l)),(a=this.colAndRowspanModels[l])==null||a.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=(!e||e>this.scrollViewport.offsetWidth)&&this.scrollViewport.offsetWidth>100?this.scrollViewport.offsetWidth:this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new O(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let a;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o;let h;if(c?h=this.editorRenderer:h=r.getCellRenderer(t,o),l.innerText="",this.applyCssClasses(l,i),h)a=h.render(l,t,o,e,r,s,this.dom.domService),a&&this.cleanupFunctions[e].push(a);else{const p=`${s}`;this.dom.addLabelDiv(l,p,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const f=r.getCustomStyleAt(t,o);if(f)for(const p in f)this.dom.setStyle(l,p,f[p])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),h=c.getRowCount();for(;this.cleanupFunctions[e].length;){const b=this.cleanupFunctions[e].shift();b&&b()}let u=t;const f=this.tableModel.getColumnCount(),p=this.tableModel.getFixedRightColumnCount(),m=this.tableModel.getFixedLeftColumnCount();for(let b=0;b<h;b++){const w=u,S=b===h-1,A=this.tableModel.getRowHeight(e,b);if(w+A>0){this.firstVisibleRowIndex=b;let C={left:n,width:l,height:A,top:w,index:b},x=this.dom.addRowDiv(s,C,b,e,"center");const D=m;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:C,parent:x,rowIndex:b,columnIndexStart:D,columnIndexEnd:f-p-1,verticalFixed:!1,lastRowOfModel:S}),a.left>0&&(C={left:n,width:this.areaBodyWestGeo.width,height:A,top:w,index:b},x=this.dom.addRowDiv(o,C,b,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:C,parent:x,rowIndex:b,columnIndexStart:0,columnIndexEnd:D-1,verticalFixed:!0,lastRowOfModel:S})),a.right>0&&(C={left:n,width:this.areaBodyEastGeo.width,height:A,top:w,index:b},x=this.dom.addRowDiv(i,C,b,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:C,parent:x,rowIndex:b,columnIndexStart:f-p,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:S})),e==="header"&&this.tree&&b===h-1){const E=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(x,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),I=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(I){const Z=this.dom.domService.createText(I.content);this.dom.domService.appendChild(E,Z),I.style&&this.dom.applyStyleString(E,I.style)}}}if(u=u+A,u>r){e==="body"&&(this.displayedRowCount=this.firstVisibleRowIndex-b);break}}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const b=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(b.length)for(const w of b){let S=0,A=s.child,C="center";if(w.c1<m)A=o.child,C="west";else if(p>0&&w.c1>=f-p)A=i.child,C="east";else{const x=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*x-this.areaBodyWestGeo.width,C="center"}this.drawBigCell(w,S,t,c,A,C)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,b)=>g+b,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let c=0;a>0&&e.c1>=l-a&&(c=l-a);const h=t+this.getColumnWidths(c,e.c1-1).reduce((g,b)=>g+b,0),u=this.getRowHeights(e.r1,e.r2,s).reduce((g,b)=>g+b,0),f=this.getColumnWidths(e.c1,e.c2).reduce((g,b)=>g+b,0);let p=!1;const m=this.getSelectionModel?this.getSelectionModel():void 0;m&&(p=m.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:f,height:u,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:f,height:u,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:f,cellHeight:u,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:c=!1}){var m;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!a){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const u=0,f=!!(e==="body"&&t);let p=h;for(let g=n;g<=l;g++){const b=p,w=this.tableModel.getColumnWidth(g);if(w>0&&b+w>0){let S=s.height;const A=o.getRowspanAt(r,g),C=o.getColspanAt(r,g);A>1&&(S=this.getRowHeights(r,r+A-1,o).reduce((E,I)=>E+I,0));let x=w;C>1&&(x=this.getColumnWidths(g,g+C-1).reduce((E,I)=>E+I,0));let D=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(m=this.colAndRowspanModels[e])!=null&&m.isInRange(r,g)&&(D=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,b,u,x,S);const E={left:b,top:u,width:x,height:S};this.dom.addColumnBorderDivs(this.tableOptions,i,E,e,t)}else{const E=this.renderSelectedBackgroundDiv(D,f,t,o,r,g,i,b,u,x,S);"gammaCells"in o&&o.getValueAt(r,g)&&(D=!1),D||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:b,top:u,width:x,height:S,parent:i,cellSelected:E,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:b,cellTop:u,cellWidth:x,cellHeight:S,parent:i})}}if(p=p+w,p>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(p-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:a,parent:c,lastRowOfModel:h}){var We;const f=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),p={left:r,width:n,height:l,top:a,index:i},m=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&N(m)){const v=m;(We=v.children)!=null&&We.length?v.expanded?g="expanded":g="collapsed":g="hidden"}let w;if(t==="header"){const v=this.tableModel.getColumnDef(i);(!(v!=null&&v.sortIconVisible)||v!=null&&v.sortIconVisible())&&(w=v==null?void 0:v.sortState)}const S=e.getValueAt(s,i),A=f?"":`${S}`,C=e.isRowChecked(s),x=this.dom.addColumnDiv({parent:c,geo:p,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:A,treeArrow:g,tableOptions:this.tableOptions,checkedType:C,sortState:w}),D=e.getTooltipAt(s,i);D&&this.dom.setAttribute(x,"title",D);const E=this.tableModel.getColumnDef(i);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],x);let I;f&&(I=f.render(x,s,i,t,e,S,this.dom.domService));const Z=e.getCustomClassesAt(s,i);if(Z.length&&this.dom.addClasses(Z,x),this.dom.addColumnBorderDivs(this.tableOptions,c,p,t,o),h&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},c),this.getFocusModel&&t==="body"){const v=this.getFocusModel();v!=null&&v.hasFocus(s,i)&&this.dom.addFocusBorderDivs(c,p,{})}t==="header"&&this.dom.setAttribute(x,"data-ge-action","drag-column");const ge=e.getCustomStyleAt(s,i);if(ge)for(const v in ge)this.dom.setStyle(x,v,ge[v]);return[x,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const c={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,c),o&&this.renderContentOfDraggingColumn(c)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let a=0;a<r;a++){const c=o,h=i.getRowHeight(a),u={left:0,width:e.width,height:h,top:c,index:a},f=i.getValueAt(a,n),p=i.getCellRenderer(a,n),m=p?"":`${f}`,g={parent:l,geo:u,rowIndex:a,columnIndex:n,areaIdent:t,sideIdent:s,text:m},b=this.dom.addColumnDiv(g);let w;p&&(w=p.render(b,a,n,t,i,f,this.dom.domService),w&&this.cleanupFunctions[t].push(w));const S=i.getCustomClassesAt(a,n);S.length&&this.dom.addClasses(S,b);const A=this.tableModel.getColumnDef(n);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],b),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,s);const C=i.getCustomStyleAt(a,n);if(C)for(const x in C)this.dom.setStyle(b,x,C[x]);o=o+h}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,a,c,h){let u=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const p=f.getSelectionCount(i,r);u=p>0;for(let m=0;m<p;m++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${a}px`),this.dom.setStyle(g,"width",`${c}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:a,parent:c,cellSelected:h,lastRowOfModel:u}){const[f,p]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:a,top:n,parent:c,lastRowOfModel:u});h&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,f),p&&this.cleanupFunctions[t].push(p)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,a=this.tableOptions.columnResizeHandleWidthInPx??2,c=l.createElement("div");l.setAttribute(c,"data-col-index",`${t}`),l.setAttribute(c,"data-row-index",`${e}`),l.setAttribute(c,"data-area","header"),l.setAttribute(c,"data-ge-action","resize-column"),l.addClass(c,"ge-table-column-resize-handle"),l.setStyle(c,"display","clip"),l.setStyle(c,"position","absolute"),l.setStyle(c,"cursor","col-resize"),l.setStyle(c,"left",`${o+i-a}px`),l.setStyle(c,"top",`${s}px`),l.setStyle(c,"width",`${a}px`),l.setStyle(c,"height",`${r}px`),l.appendChild(n,c)}}class dt{constructor(e,t){this.columnIndex=e,this.sortState=t}}class ht{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=q(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class ut{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class ue{constructor(e){this.cells=e}static createSingle(e,t){return new ue([new ut(e,t)])}}class pt{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,l,a,c,h;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),f=this.getFocusModel();u&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(f),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey)?(u.removeSelection(R.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(c=e.originalEvent)!=null&&c.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(u.addSelection(R.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(u))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return R.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class gt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class ft{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}function mt(d){return d.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).filter((e,t,o)=>o.indexOf(e)===t).sort((e,t)=>{const o={cmd:1,ctrl:2,alt:3,shift:4},s=o[e]||5,i=o[t]||5;return s!==i?s-i:e.localeCompare(t)}).join(" ")}function be(d){let e=d.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&d.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),d.code.startsWith("Numpad")){const o=d.code.replace("Numpad","").toLowerCase();o==="add"?e="num_add":o==="subtract"?e="num_subtract":o==="multiply"?e="num_multiply":o==="divide"?e="num_divide":o==="decimal"?e="num_decimal":o==="enter"?e="num_enter":e="num_"+o}d.code.match(/^F\d+$/)&&(e=d.code.toLowerCase()),d.code.match(/^Digit\d+$/)&&(e=d.code.replace(/Digit/g,""));let t="";return d.ctrlKey&&(t+=" ctrl"),d.altKey&&(t+=t+" alt"),d.shiftKey&&(t+=t+" shift"),d.metaKey&&(t+=t+" cmd"),mt(t+" "+e)}class bt{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this)))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ft().get()):Object.assign(this.shortcutActionIdMapping,new gt().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=be(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const o in this.shortcutActionIdMapping)if(be(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[o]),this.shortcutActionIdMapping[o]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class se{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class yt{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class wt{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
48
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const a=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,a),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new Le,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const a of r.classes)this.domService.addClass(i,a);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",o=new Oe,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const a=l.content,c=this.domService.createText(a);this.domService.appendChild(n,c),l.style&&this.applyStyleString(n,l.style);for(const h of l.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const q=d=>d==="header"?"header":d==="footer"?"footer":"body";class Qe{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=q(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class et{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay){this.lastClicked=t,this.publishGeMouseEvent(e,2);return}this.lastClicked=t;const o=new Qe(e.target,this.tableScope);if(o.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(o.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(o),e.preventDefault(),e.stopPropagation();else if(o.inputType==="checkbox"&&o.areaIdent)this.tableScope.toggleRowCheckbox(o.rowIdx,o.colIdx,o.areaIdent),e.preventDefault(),e.stopPropagation();else if(N(o.row)&&o.areaModel){const s=o.colIdx===this.getArrowColumnIndex()&&e.altKey,i=o.className.includes("ge-table-tree-arrow-div");if(s||i){e.preventDefault(),e.stopPropagation();const r=o.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in o.areaModel&&o.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(o.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(o.rowIdx,o.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,o=t.getAttribute("data-area"),s=q(o),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(o&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(i);if(o&&s==="body"&&n.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),N(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const a=l;a.expanded=!a.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent)}updateCollapsedExpandedState(e){var o,s,i,r,n;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,a=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,c=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,h=t(e.data);a?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):c&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class he{constructor(e,t=[],o=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=o,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(s=>s.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 o;const t=this.getRowByIndex(e);return(o=this.rowSelectionModel)==null?void 0:o.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const o=this.getRowByIndex(e);this.rowSelectionModel.checkRow(o,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 s,i;const o=(s=this.columnDefs)==null?void 0:s[t];return((i=o==null?void 0:o.editable)==null?void 0:i.call(o))??!1}setValue(e,t,o){var n;const s=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;s&&(o=s(o,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),o):(i[r]=o,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,o){const s=t.shift();if(s){const i=e[s];return i&&t.length?this.setPropertyValue(i,t,o):(e[s]=o,!0)}return!1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),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 tt{genericSortComparator(e,t,o){if(typeof e=="number"&&typeof t=="number")return o*(e-t);if(typeof e=="string"&&typeof t=="string")return o*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return o*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return o*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const s=e,i=t;if(s.length&&i.length)return this.genericSortComparator(s[0],i[0],o)}return o*(""+e).localeCompare(""+t)}}class _ extends he{constructor(e,t,o,s=[],i="ge-selected-row",r="ge-focused-row"){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.selectedRowClass=i,this.focusedRowClass=r,this.focusedRowIndex=0,this.sorterService=new tt,this.filteredRows=[...t],this.properties=s.map(n=>n.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 o=this.properties[t];let s=this.filteredRows[e];return N(s)&&(s=s.data),s?this.getValueByT(s,o):""}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:o,sortState:s}=t,i=s==="asc"?1:s==="desc"?-1:0,r=this.properties[o];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!0}getValueByT(e,t){if(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)}getCustomClassesAt(e,t){const o=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&o.push(this.selectedRowClass),this.focusedRowIndex===e&&o.push(this.focusedRowClass),o}genericFlatTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s,e),n=this.getValueByT(i,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const o=t.shift(),s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}}class ot{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}downloadExcel(e="table.xlsx",t=""){const o=[],s=this.tableScope.tableModel.getColumnCount(),i=["header","body","footer"];for(const r of i){const n=this.tableScope.tableModel.getAreaModel(r),l=(n==null?void 0:n.getRowCount())??0;for(let a=0;a<l;a++){const c=[];o.push(c);for(let h=0;h<s;h++)c.push(n.getValueAt(a,h))}}return this.tableScope.excelService.downloadExcel(o,e,t)}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){const t=this.getBodyModel();t instanceof _?t.setRows(e):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRows(e){const t=this.getBodyModel();if(t instanceof _){const o=t;let s=o.getAllRows();o.setRows([...s,...e])}else console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRowsAt(e,t){const o=this.getBodyModel();if(o instanceof _){const s=o;let i=s.getAllRows();s.setRows([...i.slice(0,t),...e,...i.slice(t)])}else console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}removeRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof _){const s=o,i=s.getAllRows().filter(r=>!e.some(n=>t(r,n)));s.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}findRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();return o instanceof _?o.getAllRows().filter(i=>e.some(r=>t(i,r))):(console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o),[])}updateRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof _){let i=o.getAllRows();for(const r of i)for(const n of e)if(t(r,n))for(const l of Object.keys(n))r[l]=n[l]}else console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}reSort(){this.tableScope.reSort()}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}}class _e{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((s,i)=>{t[s]=i}),t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class st extends _e{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class it{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class rt extends _e{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new it,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class nt extends _e{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SORTING_STATE,s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class O{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}class lt{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class R{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new R(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new R(e,t,e,t)}static singleRow(e){return new R(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new R(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class at{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new R(o,s,o+r-1,s+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class M{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class ct extends lt{constructor(e,t,o,s){var r,n;super(e,t,o,s),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new M,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.displayedRowCount=0,this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),oe(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new at(t,t.getAreaModel(l)),(a=this.colAndRowspanModels[l])==null||a.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=(!e||e>this.scrollViewport.offsetWidth)&&this.scrollViewport.offsetWidth>100?this.scrollViewport.offsetWidth:this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new O(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let a;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o;let h;if(c?h=this.editorRenderer:h=r.getCellRenderer(t,o),l.innerText="",this.applyCssClasses(l,i),h)a=h.render(l,t,o,e,r,s,this.dom.domService),a&&this.cleanupFunctions[e].push(a);else{const p=`${s}`;this.dom.addLabelDiv(l,p,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const f=r.getCustomStyleAt(t,o);if(f)for(const p in f)this.dom.setStyle(l,p,f[p])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),h=c.getRowCount();for(;this.cleanupFunctions[e].length;){const b=this.cleanupFunctions[e].shift();b&&b()}let u=t;const f=this.tableModel.getColumnCount(),p=this.tableModel.getFixedRightColumnCount(),m=this.tableModel.getFixedLeftColumnCount();for(let b=0;b<h;b++){const w=u,S=b===h-1,A=this.tableModel.getRowHeight(e,b);if(w+A>0){this.firstVisibleRowIndex=b;let C={left:n,width:l,height:A,top:w,index:b},x=this.dom.addRowDiv(s,C,b,e,"center");const D=m;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:C,parent:x,rowIndex:b,columnIndexStart:D,columnIndexEnd:f-p-1,verticalFixed:!1,lastRowOfModel:S}),a.left>0&&(C={left:n,width:this.areaBodyWestGeo.width,height:A,top:w,index:b},x=this.dom.addRowDiv(o,C,b,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:C,parent:x,rowIndex:b,columnIndexStart:0,columnIndexEnd:D-1,verticalFixed:!0,lastRowOfModel:S})),a.right>0&&(C={left:n,width:this.areaBodyEastGeo.width,height:A,top:w,index:b},x=this.dom.addRowDiv(i,C,b,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:C,parent:x,rowIndex:b,columnIndexStart:f-p,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:S})),e==="header"&&this.tree&&b===h-1){const E=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(x,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),I=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(I){const Z=this.dom.domService.createText(I.content);this.dom.domService.appendChild(E,Z),I.style&&this.dom.applyStyleString(E,I.style)}}}if(u=u+A,u>r){e==="body"&&(this.displayedRowCount=this.firstVisibleRowIndex-b);break}}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const b=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(b.length)for(const w of b){let S=0,A=s.child,C="center";if(w.c1<m)A=o.child,C="west";else if(p>0&&w.c1>=f-p)A=i.child,C="east";else{const x=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*x-this.areaBodyWestGeo.width,C="center"}this.drawBigCell(w,S,t,c,A,C)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,b)=>g+b,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let c=0;a>0&&e.c1>=l-a&&(c=l-a);const h=t+this.getColumnWidths(c,e.c1-1).reduce((g,b)=>g+b,0),u=this.getRowHeights(e.r1,e.r2,s).reduce((g,b)=>g+b,0),f=this.getColumnWidths(e.c1,e.c2).reduce((g,b)=>g+b,0);let p=!1;const m=this.getSelectionModel?this.getSelectionModel():void 0;m&&(p=m.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:f,height:u,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:f,height:u,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:f,cellHeight:u,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:c=!1}){var m;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!a){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const u=0,f=!!(e==="body"&&t);let p=h;for(let g=n;g<=l;g++){const b=p,w=this.tableModel.getColumnWidth(g);if(w>0&&b+w>0){let S=s.height;const A=o.getRowspanAt(r,g),C=o.getColspanAt(r,g);A>1&&(S=this.getRowHeights(r,r+A-1,o).reduce((E,I)=>E+I,0));let x=w;C>1&&(x=this.getColumnWidths(g,g+C-1).reduce((E,I)=>E+I,0));let D=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(m=this.colAndRowspanModels[e])!=null&&m.isInRange(r,g)&&(D=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,b,u,x,S);const E={left:b,top:u,width:x,height:S};this.dom.addColumnBorderDivs(this.tableOptions,i,E,e,t)}else{const E=this.renderSelectedBackgroundDiv(D,f,t,o,r,g,i,b,u,x,S);"gammaCells"in o&&o.getValueAt(r,g)&&(D=!1),D||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:b,top:u,width:x,height:S,parent:i,cellSelected:E,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:b,cellTop:u,cellWidth:x,cellHeight:S,parent:i})}}if(p=p+w,p>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(p-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:a,parent:c,lastRowOfModel:h}){var We;const f=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),p={left:r,width:n,height:l,top:a,index:i},m=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&N(m)){const v=m;(We=v.children)!=null&&We.length?v.expanded?g="expanded":g="collapsed":g="hidden"}let w;if(t==="header"){const v=this.tableModel.getColumnDef(i);(!(v!=null&&v.sortIconVisible)||v!=null&&v.sortIconVisible())&&(w=v==null?void 0:v.sortState)}const S=e.getValueAt(s,i),A=f?"":`${S}`,C=e.isRowChecked(s),x=this.dom.addColumnDiv({parent:c,geo:p,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:A,treeArrow:g,tableOptions:this.tableOptions,checkedType:C,sortState:w}),D=e.getTooltipAt(s,i);D&&this.dom.setAttribute(x,"title",D);const E=this.tableModel.getColumnDef(i);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],x);let I;f&&(I=f.render(x,s,i,t,e,S,this.dom.domService));const Z=e.getCustomClassesAt(s,i);if(Z.length&&this.dom.addClasses(Z,x),this.dom.addColumnBorderDivs(this.tableOptions,c,p,t,o),h&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},c),this.getFocusModel&&t==="body"){const v=this.getFocusModel();v!=null&&v.hasFocus(s,i)&&this.dom.addFocusBorderDivs(c,p,{})}t==="header"&&this.dom.setAttribute(x,"data-ge-action","drag-column");const ge=e.getCustomStyleAt(s,i);if(ge)for(const v in ge)this.dom.setStyle(x,v,ge[v]);return[x,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const c={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,c),o&&this.renderContentOfDraggingColumn(c)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let a=0;a<r;a++){const c=o,h=i.getRowHeight(a),u={left:0,width:e.width,height:h,top:c,index:a},f=i.getValueAt(a,n),p=i.getCellRenderer(a,n),m=p?"":`${f}`,g={parent:l,geo:u,rowIndex:a,columnIndex:n,areaIdent:t,sideIdent:s,text:m},b=this.dom.addColumnDiv(g);let w;p&&(w=p.render(b,a,n,t,i,f,this.dom.domService),w&&this.cleanupFunctions[t].push(w));const S=i.getCustomClassesAt(a,n);S.length&&this.dom.addClasses(S,b);const A=this.tableModel.getColumnDef(n);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],b),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,s);const C=i.getCustomStyleAt(a,n);if(C)for(const x in C)this.dom.setStyle(b,x,C[x]);o=o+h}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,a,c,h){let u=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const p=f.getSelectionCount(i,r);u=p>0;for(let m=0;m<p;m++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${a}px`),this.dom.setStyle(g,"width",`${c}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:a,parent:c,cellSelected:h,lastRowOfModel:u}){const[f,p]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:a,top:n,parent:c,lastRowOfModel:u});h&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,f),p&&this.cleanupFunctions[t].push(p)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,a=this.tableOptions.columnResizeHandleWidthInPx??2,c=l.createElement("div");l.setAttribute(c,"data-col-index",`${t}`),l.setAttribute(c,"data-row-index",`${e}`),l.setAttribute(c,"data-area","header"),l.setAttribute(c,"data-ge-action","resize-column"),l.addClass(c,"ge-table-column-resize-handle"),l.setStyle(c,"display","clip"),l.setStyle(c,"position","absolute"),l.setStyle(c,"cursor","col-resize"),l.setStyle(c,"left",`${o+i-a}px`),l.setStyle(c,"top",`${s}px`),l.setStyle(c,"width",`${a}px`),l.setStyle(c,"height",`${r}px`),l.appendChild(n,c)}}class dt{constructor(e,t){this.columnIndex=e,this.sortState=t}}class ht{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=q(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class ut{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class ue{constructor(e){this.cells=e}static createSingle(e,t){return new ue([new ut(e,t)])}}class pt{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,l,a,c,h;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),f=this.getFocusModel();u&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(f),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey)?(u.removeSelection(R.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(c=e.originalEvent)!=null&&c.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(u.addSelection(R.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(u))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return R.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class gt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class ft{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}function mt(d){return d.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).filter((e,t,o)=>o.indexOf(e)===t).sort((e,t)=>{const o={cmd:1,ctrl:2,alt:3,shift:4},s=o[e]||5,i=o[t]||5;return s!==i?s-i:e.localeCompare(t)}).join(" ")}function be(d){let e=d.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&d.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),d.code.startsWith("Numpad")){const o=d.code.replace("Numpad","").toLowerCase();o==="add"?e="num_add":o==="subtract"?e="num_subtract":o==="multiply"?e="num_multiply":o==="divide"?e="num_divide":o==="decimal"?e="num_decimal":o==="enter"?e="num_enter":e="num_"+o}d.code.match(/^F\d+$/)&&(e=d.code.toLowerCase()),d.code.match(/^Digit\d+$/)&&(e=d.code.replace(/Digit/g,""));let t="";return d.ctrlKey&&(t+=" ctrl"),d.altKey&&(t+=t+" alt"),d.shiftKey&&(t+=t+" shift"),d.metaKey&&(t+=t+" cmd"),mt(t+" "+e)}class bt{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this)))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ft().get()):Object.assign(this.shortcutActionIdMapping,new gt().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=be(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const o in this.shortcutActionIdMapping)if(be(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[o]),this.shortcutActionIdMapping[o]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class se{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class yt{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class wt{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
49
49
  <input
50
50
  type="text"
51
51
  value="${l}"
@@ -74,7 +74,7 @@ export class ${t} implements CellRendererIf {
74
74
  <sheetView tabSelected="1" workbookViewId="0"/></sheetViews>
75
75
  <sheetFormatPr baseColWidth="10" defaultRowHeight="16" x14ac:dyDescent="0.2"/>
76
76
  <sheetData>`);for(let o=0;o<e.length;o++){const s=e[o];t.push('<row r="${r + 1}" spans="1:2" x14ac:dyDescent="0.2">');for(let i=0;i<s.length;i++){const r=s[i],n=this.getCellAddress(o,i);if(typeof r=="number")t.push(`<c r="${n}"><v>${r}</v></c>`);else if(r instanceof Date){const l=r;t.push(`<c r="${n}" t="inlineStr"><is><t>${l.toISOString()}</t></is></c>`)}else{const l=r!=null?this.escapeXml(String(r)):"";t.push(`<c r="${n}" t="inlineStr"><is><t>${l}</t></is></c>`)}}t.push("</row>")}return t.push(""),t.push(""),t.push('</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'),t.push("</worksheet>"),t.join(`
77
- `)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}getCellAddress(e,t){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let s="";for(;t>=0;)s=o[t%26]+s,t=Math.floor(t/26)-1;return`${s}${e+1}`}createZip(e){const t=[];let o=0;const s=[];e.forEach((h,u)=>{const f=new TextEncoder().encode(u),p=new TextEncoder().encode(h),m=new Uint8Array(30+f.length),g=new DataView(m.buffer);m.set([80,75,3,4],0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,0,!0),g.setUint32(18,p.length,!0),g.setUint32(22,p.length,!0),g.setUint16(26,f.length,!0),g.setUint16(28,0,!0),m.set(f,30),t.push(m,p),s.push({path:u,offset:o,contentSize:p.length}),o+=m.length+p.length});const i=o;s.forEach(h=>{const u=new TextEncoder().encode(h.path),f=new Uint8Array(46+u.length),p=new DataView(f.buffer);f.set([80,75,1,2],0),p.setUint16(4,20,!0),p.setUint16(6,20,!0),p.setUint16(8,0,!0),p.setUint16(10,0,!0),p.setUint16(12,0,!0),p.setUint16(14,0,!0),p.setUint32(16,0,!0),p.setUint32(20,h.contentSize,!0),p.setUint32(24,h.contentSize,!0),p.setUint16(28,u.length,!0),p.setUint16(30,0,!0),p.setUint16(32,0,!0),p.setUint16(34,0,!0),p.setUint16(36,0,!0),p.setUint32(38,0,!0),p.setUint32(42,h.offset,!0),f.set(u,46),t.push(f),o+=f.length});const r=new Uint8Array(22),n=new DataView(r.buffer);r.set([80,75,5,6],0),n.setUint16(4,0,!0),n.setUint16(6,0,!0),n.setUint16(8,s.length,!0),n.setUint16(10,s.length,!0),n.setUint32(12,o-i,!0),n.setUint32(16,i,!0),n.setUint16(20,0,!0),t.push(r);const l=t.reduce((h,u)=>h+u.length,0),a=new Uint8Array(l);let c=0;for(const h of t)a.set(h,c),c+=h.length;return a}generateBuffer(e,t=""){const o=this.generateMap(e,t);return this.createZip(o)}}class Be extends ct{constructor(e,t,o,s,i,r=new J,n=new Ct){var c;if(super(e,t,new Ze(o),s),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=W.getInstance(),this.selectionService=new pt(this),this.api=new ot(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new se),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const h=this.tableOptions.autoRestoreOptions,u=h.getStorageKeyFn;u&&(h.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new st(u)),h.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new rt(u)),h.autoRestoreSortingState&&(this.storeSortingService=new nt(u)))}this.mouseHandler=new et(this),this.inputHandler=new ht(this),this.resizeHandler=new St(this,s.resizeEventDebounceDelay),this.shortcutService=new bt(this),this.shortcutService.addListener(this.selectionService);const l=this.getSelectionModel?this.getSelectionModel():void 0;l&&l.addEventSelectionChangedListener(this);const a=this.getFocusModel?this.getFocusModel():void 0;a&&a.addEventFocusChangedListener(this),console.log("TableScope created")}static create(e,t,o=new X,s=new se,i=new yt,r=new J){return new Be(e,t,i,o,s,r)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[o,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,s)&&(this.clearSelection(),this.initRenderEditor(o,s))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,o).then(s=>this.copyService.copyContent(s))}return!1}updateModelValueAfterEdit(e,t,o,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(ue.createSingle(t,o)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new de;if(t.originalEvent=e,e){const o=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(o),t.rowIndex=this.getNumberByAttr(o,"data-row-index"),t.columnIndex=this.getNumberByAttr(o,"data-col-index"),t.action=this.getStringByAttr(o,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,s)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var o,s;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(o=e.originalEvent)==null||o.preventDefault(),(s=e.originalEvent)==null||s.stopImmediatePropagation();return}this.lastContextmenu=t,this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var o;const t=this.tableModel.getBodyModel();oe(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const s=this.tableModel.getAreaModel(o),i=s.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";s.setRowChecked(e,r),this.repaint();const n=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const s=this.getFocusModel();s&&(o=s.hasChanged(),s.clearChanged())}return o}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,o){var i,r;const s=this.tableModel.getColumnDef(o);if(s!=null&&s.sortable&&s.sortable()){e.preventDefault(),e.stopPropagation();const n=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,l=s.sortState??"",a=n[(n.indexOf(l)+1)%n.length],c=new dt(o,a);this.tableModel.doSort([c])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(u=>u.sortState=""),s.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([c])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const s=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,s)}setSelectionModel(e,t=!1){const o=()=>e;this.tableOptions.getSelectionModel=o,this.getSelectionModel=o,this.selectionService.getSelectionModel=o,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const o=this.getFocusModel();if(o){const[s,i]=o.getFocus();return o.setFocus(s+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var o;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(o=this.mouseHandler.mouseEvent)==null?void 0:o.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const o=this.storeScrollPosStateService.getScrollOffset();o&&this.scrollViewport.scrollTo(...o)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const o=this.storeSortingService.getSortItems();o!=null&&o.length&&this.tableModel.getBodyModel().doSort(o)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const o=this.tableOptions.autoRestoreOptions,s=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&s){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(oe(r)){const n=r,l=r.getRowCount();for(let a=0;a<l;a++){const c=r.getRowByIndex(a);if(c)if(i.allExpanded)c.expanded=!0;else if(i.allCollapsed)c.expanded=!1;else{const h=s(c.data);i.mode==="expanded"?c.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(c.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount(),o=(e==null?void 0:e.getRowCount())??0;if(!e)return console.warn("Body model is not available."),[];const s=new Array(t).fill(0);for(let i=0;i<o;i++)for(let r=0;r<t;r++){const n=e.getValueAt(i,r),l=(n==null?void 0:n.toString().length)||0;l>s[r]&&(s[r]=l)}return s.map(i=>Math.max(i*10,50))}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let o=0;o<t.length;o++){const s=t[o];this.tableModel.setColumnWidth(o,s)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e)}getDisplayedRowCount(){return this.displayedRowCount}}class Gt extends se{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const ne=class ne{};ne.themes=["light","combat","paper","blackboard"],ne.vars={light:`html[data-theme="light"] {
77
+ `)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}getCellAddress(e,t){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let s="";for(;t>=0;)s=o[t%26]+s,t=Math.floor(t/26)-1;return`${s}${e+1}`}createZip(e){const t=[];let o=0;const s=[];e.forEach((h,u)=>{const f=new TextEncoder().encode(u),p=new TextEncoder().encode(h),m=new Uint8Array(30+f.length),g=new DataView(m.buffer);m.set([80,75,3,4],0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,0,!0),g.setUint32(18,p.length,!0),g.setUint32(22,p.length,!0),g.setUint16(26,f.length,!0),g.setUint16(28,0,!0),m.set(f,30),t.push(m,p),s.push({path:u,offset:o,contentSize:p.length}),o+=m.length+p.length});const i=o;s.forEach(h=>{const u=new TextEncoder().encode(h.path),f=new Uint8Array(46+u.length),p=new DataView(f.buffer);f.set([80,75,1,2],0),p.setUint16(4,20,!0),p.setUint16(6,20,!0),p.setUint16(8,0,!0),p.setUint16(10,0,!0),p.setUint16(12,0,!0),p.setUint16(14,0,!0),p.setUint32(16,0,!0),p.setUint32(20,h.contentSize,!0),p.setUint32(24,h.contentSize,!0),p.setUint16(28,u.length,!0),p.setUint16(30,0,!0),p.setUint16(32,0,!0),p.setUint16(34,0,!0),p.setUint16(36,0,!0),p.setUint32(38,0,!0),p.setUint32(42,h.offset,!0),f.set(u,46),t.push(f),o+=f.length});const r=new Uint8Array(22),n=new DataView(r.buffer);r.set([80,75,5,6],0),n.setUint16(4,0,!0),n.setUint16(6,0,!0),n.setUint16(8,s.length,!0),n.setUint16(10,s.length,!0),n.setUint32(12,o-i,!0),n.setUint32(16,i,!0),n.setUint16(20,0,!0),t.push(r);const l=t.reduce((h,u)=>h+u.length,0),a=new Uint8Array(l);let c=0;for(const h of t)a.set(h,c),c+=h.length;return a}generateBuffer(e,t=""){const o=this.generateMap(e,t);return this.createZip(o)}}class Be extends ct{constructor(e,t,o,s,i,r=new J,n=new Ct){var c;if(super(e,t,new Ze(o),s),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=W.getInstance(),this.selectionService=new pt(this),this.api=new ot(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new se),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const h=this.tableOptions.autoRestoreOptions,u=h.getStorageKeyFn;u&&(h.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new st(u)),h.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new rt(u)),h.autoRestoreSortingState&&(this.storeSortingService=new nt(u)))}this.mouseHandler=new et(this),this.inputHandler=new ht(this),this.resizeHandler=new St(this,s.resizeEventDebounceDelay),this.shortcutService=new bt(this),this.shortcutService.addListener(this.selectionService);const l=this.getSelectionModel?this.getSelectionModel():void 0;l&&l.addEventSelectionChangedListener(this);const a=this.getFocusModel?this.getFocusModel():void 0;a&&a.addEventFocusChangedListener(this)}static create(e,t,o=new X,s=new se,i=new yt,r=new J){return new Be(e,t,i,o,s,r)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[o,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,s)&&(this.clearSelection(),this.initRenderEditor(o,s))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,o).then(s=>this.copyService.copyContent(s))}return!1}updateModelValueAfterEdit(e,t,o,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(ue.createSingle(t,o)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new de;if(t.originalEvent=e,e){const o=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(o),t.rowIndex=this.getNumberByAttr(o,"data-row-index"),t.columnIndex=this.getNumberByAttr(o,"data-col-index"),t.action=this.getStringByAttr(o,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,s)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var o,s;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(o=e.originalEvent)==null||o.preventDefault(),(s=e.originalEvent)==null||s.stopImmediatePropagation();return}this.lastContextmenu=t,this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var o;const t=this.tableModel.getBodyModel();oe(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const s=this.tableModel.getAreaModel(o),i=s.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";s.setRowChecked(e,r),this.repaint();const n=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const s=this.getFocusModel();s&&(o=s.hasChanged(),s.clearChanged())}return o}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,o){var i,r;const s=this.tableModel.getColumnDef(o);if(s!=null&&s.sortable&&s.sortable()){e.preventDefault(),e.stopPropagation();const n=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,l=s.sortState??"",a=n[(n.indexOf(l)+1)%n.length],c=new dt(o,a);this.tableModel.doSort([c])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(u=>u.sortState=""),s.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([c])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const s=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,s)}setSelectionModel(e,t=!1){const o=()=>e;this.tableOptions.getSelectionModel=o,this.getSelectionModel=o,this.selectionService.getSelectionModel=o,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const o=this.getFocusModel();if(o){const[s,i]=o.getFocus();return o.setFocus(s+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var o;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(o=this.mouseHandler.mouseEvent)==null?void 0:o.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const o=this.storeScrollPosStateService.getScrollOffset();o&&this.scrollViewport.scrollTo(...o)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const o=this.storeSortingService.getSortItems();o!=null&&o.length&&this.tableModel.getBodyModel().doSort(o)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const o=this.tableOptions.autoRestoreOptions,s=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&s){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(oe(r)){const n=r,l=r.getRowCount();for(let a=0;a<l;a++){const c=r.getRowByIndex(a);if(c)if(i.allExpanded)c.expanded=!0;else if(i.allCollapsed)c.expanded=!1;else{const h=s(c.data);i.mode==="expanded"?c.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(c.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount(),o=(e==null?void 0:e.getRowCount())??0;if(!e)return console.warn("Body model is not available."),[];const s=new Array(t).fill(0);for(let i=0;i<o;i++)for(let r=0;r<t;r++){const n=e.getValueAt(i,r),l=(n==null?void 0:n.toString().length)||0;l>s[r]&&(s[r]=l)}return s.map(i=>Math.max(i*10,50))}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let o=0;o<t.length;o++){const s=t[o];this.tableModel.setColumnWidth(o,s)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e)}getDisplayedRowCount(){return this.displayedRowCount}}class Gt extends se{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const ne=class ne{};ne.themes=["light","combat","paper","blackboard"],ne.vars={light:`html[data-theme="light"] {
78
78
  --ge-table-bg: rgba(255,255,255, 0.5);
79
79
  --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
80
80
  --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
@@ -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 ye=ne;class we{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 we(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 we(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,xe=()=>!1;class V{constructor(e,t,o=new y(100,"px"),s=new M,i=new M,r=new y(100,"px"),n=new y(100,"px"),l,a,c,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=c,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 M(void 0,e,void 0)}static create(e){const t=new M(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new M(e.headerClasses,e.bodyClasses,e.footerClasses),s=e.sortIconVisible??e.sortable??xe,i=e.editable??e.editable??xe,r=e.isVisible??e.isVisible??vt;return new V(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 zt=new y(500,"px"),jt=new y(400,"px"),Rt=new y(300,"px"),Yt=new y(290,"px"),Ut=new y(280,"px"),Kt=new y(270,"px"),Xt=new y(260,"px"),Jt=new y(250,"px"),qt=new y(240,"px"),Zt=new y(230,"px"),Qt=new y(220,"px"),eo=new y(210,"px"),Se=new y(200,"px"),to=new y(190,"px"),oo=new y(180,"px"),so=new y(170,"px"),io=new y(160,"px"),ro=new y(150,"px"),no=new y(140,"px"),lo=new y(130,"px"),ao=new y(120,"px"),co=new y(110,"px"),ho=new y(100,"px"),uo=new y(90,"px"),po=new y(80,"px"),go=new y(70,"px"),fo=new y(60,"px"),mo=new y(50,"px"),bo=new y(40,"px"),yo=new y(30,"px"),wo=new y(20,"px"),xo=new y(10,"px"),So=new y(0,"px");class P extends he{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 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,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 Ce extends he{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 tt,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){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 ve{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 Et{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=[],c=-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=c,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&&qe(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new Et)}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)}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 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,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 B{static createTableModel(e){var t,o,s,i,r,n,l,a,c,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 V(g,g.toUpperCase(),Se)):(s=e.rows)!=null&&s.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new V(g,g.toUpperCase(),Se)):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||((h=e.footerData)!=null&&h.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&&N(e.rows[0])){const g=e.rows;e.bodyAreaModel=new Ce("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(f=e.tableOptions)!=null&&f.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new ve(g))}else e.bodyAreaModel=new Ae("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 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 B.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,c=new Ce("body",a,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new ve(a)),B.createByAreaModelsParam({headerAreaModel:new P("header",[t.map(h=>h.headerLabel)],r.header),bodyAreaModel:c,footerAreaModel:new P("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return B.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 B.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 F,t,o=new F,s=0,i=0,r=!1,n=new G,l,a=[],c=-1,h){return new ee(e,t,o,s,i,r,n,l,a,c,h)}static createByAreaModelsParam(e){return B.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=[],o=[],s=0,i=0,r=!1,n=new G,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 h=o?new P("footer",o,n.footer,l):new F,u=new Ae("body",e,l,n.body);return new ee(c,u,h,s,i,r,n,l,a)}}const Co=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class Tt{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Mt{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 vo extends Mt{constructor(e,t,o,s,i,r,n,l){super(e,t,o,s,i,r,n),this.rows=l}}class It{constructor(e,t){this.value=e,this.label=t}}class Ro{constructor(e,t){this.index=e,this.px=t}}const Ao={body:["ge-table-text-align-left"]},Eo={body:["ge-table-text-align-center"]},To={body:["ge-table-text-align-right"]},Mo={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Io={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},ko={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Ee{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":"",c=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
305
+ }`};let ye=ne;class we{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 we(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 we(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,xe=()=>!1;class V{constructor(e,t,o=new y(100,"px"),s=new M,i=new M,r=new y(100,"px"),n=new y(100,"px"),l,a,c,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=c,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 M(void 0,e,void 0)}static create(e){const t=new M(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new M(e.headerClasses,e.bodyClasses,e.footerClasses),s=e.sortIconVisible??e.sortable??xe,i=e.editable??e.editable??xe,r=e.isVisible??e.isVisible??vt;return new V(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 zt=new y(500,"px"),jt=new y(400,"px"),Rt=new y(300,"px"),Yt=new y(290,"px"),Ut=new y(280,"px"),Kt=new y(270,"px"),Xt=new y(260,"px"),Jt=new y(250,"px"),qt=new y(240,"px"),Zt=new y(230,"px"),Qt=new y(220,"px"),eo=new y(210,"px"),Se=new y(200,"px"),to=new y(190,"px"),oo=new y(180,"px"),so=new y(170,"px"),io=new y(160,"px"),ro=new y(150,"px"),no=new y(140,"px"),lo=new y(130,"px"),ao=new y(120,"px"),co=new y(110,"px"),ho=new y(100,"px"),uo=new y(90,"px"),po=new y(80,"px"),go=new y(70,"px"),fo=new y(60,"px"),mo=new y(50,"px"),bo=new y(40,"px"),yo=new y(30,"px"),wo=new y(20,"px"),xo=new y(10,"px"),So=new y(0,"px");class P extends he{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 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,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 Ce extends he{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 tt,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 ve{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 Et{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=[],c=-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=c,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&&qe(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new Et)}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)}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 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,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 B{static createTableModel(e){var t,o,s,i,r,n,l,a,c,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 V(g,g.toUpperCase(),Se)):(s=e.rows)!=null&&s.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new V(g,g.toUpperCase(),Se)):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||((h=e.footerData)!=null&&h.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&&N(e.rows[0])){const g=e.rows;e.bodyAreaModel=new Ce("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(f=e.tableOptions)!=null&&f.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new ve(g))}else e.bodyAreaModel=new Ae("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 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 B.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,c=new Ce("body",a,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new ve(a)),B.createByAreaModelsParam({headerAreaModel:new P("header",[t.map(h=>h.headerLabel)],r.header),bodyAreaModel:c,footerAreaModel:new P("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return B.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 B.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 F,t,o=new F,s=0,i=0,r=!1,n=new G,l,a=[],c=-1,h){return new ee(e,t,o,s,i,r,n,l,a,c,h)}static createByAreaModelsParam(e){return B.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=[],o=[],s=0,i=0,r=!1,n=new G,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 h=o?new P("footer",o,n.footer,l):new F,u=new Ae("body",e,l,n.body);return new ee(c,u,h,s,i,r,n,l,a)}}const Co=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class Tt{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Mt{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 vo extends Mt{constructor(e,t,o,s,i,r,n,l){super(e,t,o,s,i,r,n),this.rows=l}}class It{constructor(e,t){this.value=e,this.label=t}}class Ro{constructor(e,t){this.index=e,this.px=t}}const Ao={body:["ge-table-text-align-left"]},Eo={body:["ge-table-text-align-center"]},To={body:["ge-table-text-align-right"]},Mo={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Io={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},ko={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Ee{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":"",c=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
306
306
  <input
307
307
  type="checkbox"
308
308
  data-area="${s}"
package/index.js CHANGED
@@ -124,21 +124,21 @@ class Vt {
124
124
  p && p instanceof D && (a = p.className);
125
125
  }
126
126
  const c = this.getReadableColumnLabel(l);
127
- let h = 100, u = "", f = "ge-table-text-align-left";
127
+ let h = 100, u = "", g = "ge-table-text-align-left";
128
128
  if (n.type === Le) {
129
129
  if (this.allowCustomRenderer && a) {
130
130
  const p = `${a}ArrayCellRenderer`;
131
- u = ` bodyRenderer: new ${p}(),`, f = "", this.renderCumstomCellRenderer(a, p);
131
+ u = ` bodyRenderer: new ${p}(),`, g = "", this.renderCumstomCellRenderer(a, p);
132
132
  } else
133
133
  u = " bodyRenderer: new SimpleArrayCellRenderer(),";
134
134
  h = 250;
135
- } else n.type === ce ? (u = " bodyRenderer: new NumberCellRenderer(),", f = "ge-table-text-align-right") : n.type === de && (u = " bodyRenderer: new TrueFalseCellRenderer(),", f = "ge-table-text-align-center", h = 80);
135
+ } else n.type === ce ? (u = " bodyRenderer: new NumberCellRenderer(),", g = "ge-table-text-align-right") : n.type === de && (u = " bodyRenderer: new TrueFalseCellRenderer(),", g = "ge-table-text-align-center", h = 80);
136
136
  e.push(` ColumnDef.create({
137
137
  property: "${l}",
138
138
  headerLabel: "${c}",
139
139
  width: new Size(${h}, "px"),
140
- bodyClasses: ["${f}"],
141
- headerClasses: ["${f}"],`), u && e.push(u), e.push(" }),");
140
+ bodyClasses: ["${g}"],
141
+ headerClasses: ["${g}"],`), u && e.push(u), e.push(" }),");
142
142
  }
143
143
  }
144
144
  }
@@ -838,10 +838,10 @@ class Qe {
838
838
  return this.domService.appendChild(e.child, l), l;
839
839
  }
840
840
  addColumnDiv(e) {
841
- const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: n, text: l = "", treeArrow: a, tableOptions: c, checkedType: h = void 0, sortState: u } = e, f = c == null ? void 0 : c.treeOptions, p = c == null ? void 0 : c.showCheckboxWihoutExtraColumn, m = this.domService.createElement("div");
841
+ const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: n, text: l = "", treeArrow: a, tableOptions: c, checkedType: h = void 0, sortState: u } = e, g = c == null ? void 0 : c.treeOptions, p = c == null ? void 0 : c.showCheckboxWihoutExtraColumn, m = this.domService.createElement("div");
842
842
  this.domService.addClass(m, "ge-table-col-div"), p && this.domService.addClass(m, "ge-with-checkbox"), this.domService.addClass(m, `ge-table-col-div-${s.index}`), this.domService.setAttribute(m, "data-col-index", `${s.index}`), this.domService.setAttribute(m, "data-row-index", `${o}`), this.domService.setAttribute(m, "data-area", `${r}`);
843
- const g = ((s == null ? void 0 : s.index) ?? 0) % 2 === 0 ? "even" : "odd";
844
- if (r === "body" && n === "center" && this.domService.addClass(m, `ge-table-column-${g}`), this.domService.setStyle(m, "display", "clip"), this.domService.setStyle(m, "position", "absolute"), this.domService.setStyle(m, "left", `${s.left}px`), this.domService.setStyle(m, "top", `${s.top}px`), this.domService.setStyle(m, "width", `${s.width}px`), this.domService.setStyle(m, "height", `${s.height}px`), a && a !== "none" && (this.domService.addClass(m, "ge-table-col-tree"), this.addArrowDiv(m, a, f, o, i, r)), p && i === 0 && h && this.addCheckboxToDiv(m, h, r, o), l) {
843
+ const f = ((s == null ? void 0 : s.index) ?? 0) % 2 === 0 ? "even" : "odd";
844
+ if (r === "body" && n === "center" && this.domService.addClass(m, `ge-table-column-${f}`), this.domService.setStyle(m, "display", "clip"), this.domService.setStyle(m, "position", "absolute"), this.domService.setStyle(m, "left", `${s.left}px`), this.domService.setStyle(m, "top", `${s.top}px`), this.domService.setStyle(m, "width", `${s.width}px`), this.domService.setStyle(m, "height", `${s.height}px`), a && a !== "none" && (this.domService.addClass(m, "ge-table-col-tree"), this.addArrowDiv(m, a, g, o, i, r)), p && i === 0 && h && this.addCheckboxToDiv(m, h, r, o), l) {
845
845
  const b = a !== "none" && i === 0;
846
846
  this.addLabelDiv(m, l, b, o, i, r);
847
847
  }
@@ -991,7 +991,7 @@ class tt {
991
991
  if (o || i) {
992
992
  e.preventDefault(), e.stopPropagation();
993
993
  const r = s.row;
994
- r.expanded = !r.expanded, "recalcVisibleTreeRows" in s.areaModel && s.areaModel.recalcVisibleTreeRows(), console.info("this.tableScope.hostElement", this.tableScope.hostElement), console.info("this.tableScope.hostElement.clientWidth", this.tableScope.hostElement.clientWidth), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(r);
994
+ r.expanded = !r.expanded, "recalcVisibleTreeRows" in s.areaModel && s.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(r);
995
995
  }
996
996
  }
997
997
  if (s.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
@@ -1246,7 +1246,8 @@ class $ extends ue {
1246
1246
  return !0;
1247
1247
  }
1248
1248
  getValueByT(e, t) {
1249
- return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
1249
+ if (e && t)
1250
+ return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
1250
1251
  }
1251
1252
  changeColumnOrder(e, t) {
1252
1253
  this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
@@ -2107,10 +2108,10 @@ class ct extends lt {
2107
2108
  }
2108
2109
  const u = r.getCustomClassesAt(t, s);
2109
2110
  u.length && this.dom.addClasses(u, l);
2110
- const f = r.getCustomStyleAt(t, s);
2111
- if (f)
2112
- for (const p in f)
2113
- this.dom.setStyle(l, p, f[p]);
2111
+ const g = r.getCustomStyleAt(t, s);
2112
+ if (g)
2113
+ for (const p in g)
2114
+ this.dom.setStyle(l, p, g[p]);
2114
2115
  }
2115
2116
  }
2116
2117
  /**
@@ -2208,7 +2209,7 @@ class ct extends lt {
2208
2209
  * @protected
2209
2210
  */
2210
2211
  adjustArea(e, t = 0) {
2211
- var g;
2212
+ var f;
2212
2213
  const s = this.getArea(e, "west"), o = this.getArea(e, "center"), i = this.getArea(e, "east"), r = o.child.clientHeight;
2213
2214
  s.child.innerText = "", o.child.innerText = "", i.child.innerText = "";
2214
2215
  const n = 0, l = this.areaBodyCenterGeo.width, a = this.tableModel.getPadding(), c = this.tableModel.getAreaModel(e), h = c.getRowCount();
@@ -2217,7 +2218,7 @@ class ct extends lt {
2217
2218
  b && b();
2218
2219
  }
2219
2220
  let u = t;
2220
- const f = this.tableModel.getColumnCount(), p = this.tableModel.getFixedRightColumnCount(), m = this.tableModel.getFixedLeftColumnCount();
2221
+ const g = this.tableModel.getColumnCount(), p = this.tableModel.getFixedRightColumnCount(), m = this.tableModel.getFixedLeftColumnCount();
2221
2222
  for (let b = 0; b < h; b++) {
2222
2223
  const w = u, S = b === h - 1, R = this.tableModel.getRowHeight(e, b);
2223
2224
  if (w + R > 0) {
@@ -2232,7 +2233,7 @@ class ct extends lt {
2232
2233
  parent: x,
2233
2234
  rowIndex: b,
2234
2235
  columnIndexStart: k,
2235
- columnIndexEnd: f - p - 1,
2236
+ columnIndexEnd: g - p - 1,
2236
2237
  verticalFixed: !1,
2237
2238
  lastRowOfModel: S
2238
2239
  }), a.left > 0 && (C = { left: n, width: this.areaBodyWestGeo.width, height: R, top: w, index: b }, x = this.dom.addRowDiv(s, C, b, e, "west"), this.adjustColumnsToRowParent({
@@ -2253,8 +2254,8 @@ class ct extends lt {
2253
2254
  geo: C,
2254
2255
  parent: x,
2255
2256
  rowIndex: b,
2256
- columnIndexStart: f - p,
2257
- columnIndexEnd: f - 1,
2257
+ columnIndexStart: g - p,
2258
+ columnIndexEnd: g - 1,
2258
2259
  verticalFixed: !0,
2259
2260
  lastRowOfModel: S
2260
2261
  })), e === "header" && this.tree && b === h - 1) {
@@ -2278,13 +2279,13 @@ class ct extends lt {
2278
2279
  }
2279
2280
  }
2280
2281
  if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
2281
- const b = ((g = this.colAndRowspanModels[e]) == null ? void 0 : g.getRanges()) ?? [];
2282
+ const b = ((f = this.colAndRowspanModels[e]) == null ? void 0 : f.getRanges()) ?? [];
2282
2283
  if (b.length)
2283
2284
  for (const w of b) {
2284
2285
  let S = 0, R = o.child, C = "center";
2285
2286
  if (w.c1 < m)
2286
2287
  R = s.child, C = "west";
2287
- else if (p > 0 && w.c1 >= f - p)
2288
+ else if (p > 0 && w.c1 >= g - p)
2288
2289
  R = i.child, C = "east";
2289
2290
  else {
2290
2291
  const x = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
@@ -2305,10 +2306,10 @@ class ct extends lt {
2305
2306
  * @protected
2306
2307
  */
2307
2308
  drawBigCell(e, t, s, o, i, r) {
2308
- const n = s + this.getRowHeights(0, e.r1 - 1, o).reduce((g, b) => g + b, 0), l = this.tableModel.getColumnCount(), a = this.tableModel.getFixedRightColumnCount();
2309
+ const n = s + this.getRowHeights(0, e.r1 - 1, o).reduce((f, b) => f + b, 0), l = this.tableModel.getColumnCount(), a = this.tableModel.getFixedRightColumnCount();
2309
2310
  let c = 0;
2310
2311
  a > 0 && e.c1 >= l - a && (c = l - a);
2311
- const h = t + this.getColumnWidths(c, e.c1 - 1).reduce((g, b) => g + b, 0), u = this.getRowHeights(e.r1, e.r2, o).reduce((g, b) => g + b, 0), f = this.getColumnWidths(e.c1, e.c2).reduce((g, b) => g + b, 0);
2312
+ const h = t + this.getColumnWidths(c, e.c1 - 1).reduce((f, b) => f + b, 0), u = this.getRowHeights(e.r1, e.r2, o).reduce((f, b) => f + b, 0), g = this.getColumnWidths(e.c1, e.c2).reduce((f, b) => f + b, 0);
2312
2313
  let p = !1;
2313
2314
  const m = this.getSelectionModel ? this.getSelectionModel() : void 0;
2314
2315
  m && (p = m.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? this.renderCell({
@@ -2319,7 +2320,7 @@ class ct extends lt {
2319
2320
  columnIndex: e.c1,
2320
2321
  left: h,
2321
2322
  top: n,
2322
- width: f,
2323
+ width: g,
2323
2324
  height: u,
2324
2325
  parent: i,
2325
2326
  cellSelected: p,
@@ -2333,7 +2334,7 @@ class ct extends lt {
2333
2334
  columnIndex: e.c1,
2334
2335
  left: h,
2335
2336
  top: n,
2336
- width: f,
2337
+ width: g,
2337
2338
  height: u,
2338
2339
  parent: i,
2339
2340
  cellSelected: p,
@@ -2344,7 +2345,7 @@ class ct extends lt {
2344
2345
  columnIndex: e.c1,
2345
2346
  cellLeft: h,
2346
2347
  cellTop: n,
2347
- cellWidth: f,
2348
+ cellWidth: g,
2348
2349
  cellHeight: u,
2349
2350
  parent: i
2350
2351
  });
@@ -2392,32 +2393,32 @@ class ct extends lt {
2392
2393
  this.scrollViewportLeft = this.scrollViewport.scrollLeft;
2393
2394
  let h = 0;
2394
2395
  if (!a) {
2395
- const g = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
2396
- h = this.scrollFactorX * g;
2396
+ const f = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
2397
+ h = this.scrollFactorX * f;
2397
2398
  }
2398
- const u = 0, f = !!(e === "body" && t);
2399
+ const u = 0, g = !!(e === "body" && t);
2399
2400
  let p = h;
2400
- for (let g = n; g <= l; g++) {
2401
- const b = p, w = this.tableModel.getColumnWidth(g);
2401
+ for (let f = n; f <= l; f++) {
2402
+ const b = p, w = this.tableModel.getColumnWidth(f);
2402
2403
  if (w > 0 && b + w > 0) {
2403
2404
  let S = o.height;
2404
- const R = s.getRowspanAt(r, g), C = s.getColspanAt(r, g);
2405
+ const R = s.getRowspanAt(r, f), C = s.getColspanAt(r, f);
2405
2406
  R > 1 && (S = this.getRowHeights(r, r + R - 1, s).reduce((E, M) => E + M, 0));
2406
2407
  let x = w;
2407
- C > 1 && (x = this.getColumnWidths(g, g + C - 1).reduce((E, M) => E + M, 0));
2408
+ C > 1 && (x = this.getColumnWidths(f, f + C - 1).reduce((E, M) => E + M, 0));
2408
2409
  let k = !1;
2409
- if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (m = this.colAndRowspanModels[e]) != null && m.isInRange(r, g) && (k = !0), this.draggingTargetColumnIndex === g && e !== "header") {
2410
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (m = this.colAndRowspanModels[e]) != null && m.isInRange(r, f) && (k = !0), this.draggingTargetColumnIndex === f && e !== "header") {
2410
2411
  this.renderDragTargetDiv(i, b, u, x, S);
2411
2412
  const E = { left: b, top: u, width: x, height: S };
2412
2413
  this.dom.addColumnBorderDivs(this.tableOptions, i, E, e, t);
2413
2414
  } else {
2414
- const E = this.renderSelectedBackgroundDiv(k, f, t, s, r, g, i, b, u, x, S);
2415
- "gammaCells" in s && s.getValueAt(r, g) && (k = !1), k || this.renderCell({
2415
+ const E = this.renderSelectedBackgroundDiv(k, g, t, s, r, f, i, b, u, x, S);
2416
+ "gammaCells" in s && s.getValueAt(r, f) && (k = !1), k || this.renderCell({
2416
2417
  areaModel: s,
2417
2418
  areaIdent: e,
2418
2419
  sideIdent: t,
2419
2420
  rowIndex: r,
2420
- columnIndex: g,
2421
+ columnIndex: f,
2421
2422
  left: b,
2422
2423
  top: u,
2423
2424
  width: x,
@@ -2428,7 +2429,7 @@ class ct extends lt {
2428
2429
  gammaRange: !0
2429
2430
  }), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
2430
2431
  rowIndex: r,
2431
- columnIndex: g,
2432
+ columnIndex: f,
2432
2433
  cellLeft: b,
2433
2434
  cellTop: u,
2434
2435
  cellWidth: x,
@@ -2468,18 +2469,18 @@ class ct extends lt {
2468
2469
  lastRowOfModel: h
2469
2470
  }) {
2470
2471
  var be;
2471
- const f = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), p = { left: r, width: n, height: l, top: a, index: i }, m = e.getRowByIndex(o);
2472
- let g = "none";
2472
+ const g = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), p = { left: r, width: n, height: l, top: a, index: i }, m = e.getRowByIndex(o);
2473
+ let f = "none";
2473
2474
  if (i === this.getTreeArrowColumnIndex() && G(m)) {
2474
2475
  const v = m;
2475
- (be = v.children) != null && be.length ? v.expanded ? g = "expanded" : g = "collapsed" : g = "hidden";
2476
+ (be = v.children) != null && be.length ? v.expanded ? f = "expanded" : f = "collapsed" : f = "hidden";
2476
2477
  }
2477
2478
  let w;
2478
2479
  if (t === "header") {
2479
2480
  const v = this.tableModel.getColumnDef(i);
2480
2481
  (!(v != null && v.sortIconVisible) || v != null && v.sortIconVisible()) && (w = v == null ? void 0 : v.sortState);
2481
2482
  }
2482
- const S = e.getValueAt(o, i), R = f ? "" : `${S}`, C = e.isRowChecked(o), x = this.dom.addColumnDiv(
2483
+ const S = e.getValueAt(o, i), R = g ? "" : `${S}`, C = e.isRowChecked(o), x = this.dom.addColumnDiv(
2483
2484
  {
2484
2485
  parent: c,
2485
2486
  geo: p,
@@ -2488,7 +2489,7 @@ class ct extends lt {
2488
2489
  areaIdent: t,
2489
2490
  sideIdent: s,
2490
2491
  text: R,
2491
- treeArrow: g,
2492
+ treeArrow: f,
2492
2493
  tableOptions: this.tableOptions,
2493
2494
  checkedType: C,
2494
2495
  sortState: w
@@ -2498,7 +2499,7 @@ class ct extends lt {
2498
2499
  const E = this.tableModel.getColumnDef(i);
2499
2500
  E && E.classes[t] && this.dom.addClasses(E.classes[t], x);
2500
2501
  let M;
2501
- f && (M = f.render(x, o, i, t, e, S, this.dom.domService));
2502
+ g && (M = g.render(x, o, i, t, e, S, this.dom.domService));
2502
2503
  const Y = e.getCustomClassesAt(o, i);
2503
2504
  if (Y.length && this.dom.addClasses(Y, x), this.dom.addColumnBorderDivs(this.tableOptions, c, p, t, s), h && this.dom.addHorizontalBorder({ left: r, width: n, height: l, top: a + l }, c), this.getFocusModel && t === "body") {
2504
2505
  const v = this.getFocusModel();
@@ -2675,7 +2676,7 @@ class ct extends lt {
2675
2676
  if (r) {
2676
2677
  const n = e.index ?? 0, l = this.draggingColumn;
2677
2678
  for (let a = 0; a < r; a++) {
2678
- const c = s, h = i.getRowHeight(a), u = { left: 0, width: e.width, height: h, top: c, index: a }, f = i.getValueAt(a, n), p = i.getCellRenderer(a, n), m = p ? "" : `${f}`, g = {
2679
+ const c = s, h = i.getRowHeight(a), u = { left: 0, width: e.width, height: h, top: c, index: a }, g = i.getValueAt(a, n), p = i.getCellRenderer(a, n), m = p ? "" : `${g}`, f = {
2679
2680
  parent: l,
2680
2681
  geo: u,
2681
2682
  rowIndex: a,
@@ -2683,9 +2684,9 @@ class ct extends lt {
2683
2684
  areaIdent: t,
2684
2685
  sideIdent: o,
2685
2686
  text: m
2686
- }, b = this.dom.addColumnDiv(g);
2687
+ }, b = this.dom.addColumnDiv(f);
2687
2688
  let w;
2688
- p && (w = p.render(b, a, n, t, i, f, this.dom.domService), w && this.cleanupFunctions[t].push(w));
2689
+ p && (w = p.render(b, a, n, t, i, g, this.dom.domService), w && this.cleanupFunctions[t].push(w));
2689
2690
  const S = i.getCustomClassesAt(a, n);
2690
2691
  S.length && this.dom.addClasses(S, b);
2691
2692
  const R = this.tableModel.getColumnDef(n);
@@ -2746,16 +2747,16 @@ class ct extends lt {
2746
2747
  renderSelectedBackgroundDiv(e, t, s, o, i, r, n, l, a, c, h) {
2747
2748
  let u = !1;
2748
2749
  if (!e && t && o.isSelectable(i, r) && this.getSelectionModel) {
2749
- const f = this.getSelectionModel();
2750
- if (f) {
2751
- const p = f.getSelectionCount(i, r);
2750
+ const g = this.getSelectionModel();
2751
+ if (g) {
2752
+ const p = g.getSelectionCount(i, r);
2752
2753
  u = p > 0;
2753
2754
  for (let m = 0; m < p; m++) {
2754
- const g = this.dom.applyStylePosistionAbsolute(
2755
+ const f = this.dom.applyStylePosistionAbsolute(
2755
2756
  // ge-table-body-west-selected-range
2756
2757
  this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`, n)
2757
2758
  );
2758
- this.dom.setStyle(g, "left", `${l}px`), this.dom.setStyle(g, "top", `${a}px`), this.dom.setStyle(g, "width", `${c}px`), this.dom.setStyle(g, "height", `${h}px`);
2759
+ this.dom.setStyle(f, "left", `${l}px`), this.dom.setStyle(f, "top", `${a}px`), this.dom.setStyle(f, "width", `${c}px`), this.dom.setStyle(f, "height", `${h}px`);
2759
2760
  }
2760
2761
  }
2761
2762
  }
@@ -2794,7 +2795,7 @@ class ct extends lt {
2794
2795
  cellSelected: h,
2795
2796
  lastRowOfModel: u
2796
2797
  }) {
2797
- const [f, p] = this.addAndRenderCellDiv({
2798
+ const [g, p] = this.addAndRenderCellDiv({
2798
2799
  areaModel: e,
2799
2800
  areaIdent: t,
2800
2801
  sideIdent: s,
@@ -2807,7 +2808,7 @@ class ct extends lt {
2807
2808
  parent: c,
2808
2809
  lastRowOfModel: u
2809
2810
  });
2810
- h && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, f), p && this.cleanupFunctions[t].push(p);
2811
+ h && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, g), p && this.cleanupFunctions[t].push(p);
2811
2812
  }
2812
2813
  /**
2813
2814
  * Render the header cell resize handle.
@@ -2860,12 +2861,12 @@ class ut {
2860
2861
  this.rowIndex = e, this.columnIndex = t;
2861
2862
  }
2862
2863
  }
2863
- class ge {
2864
+ class fe {
2864
2865
  constructor(e) {
2865
2866
  this.cells = e;
2866
2867
  }
2867
2868
  static createSingle(e, t) {
2868
- return new ge([new ut(e, t)]);
2869
+ return new fe([new ut(e, t)]);
2869
2870
  }
2870
2871
  }
2871
2872
  class pt {
@@ -2877,8 +2878,8 @@ class pt {
2877
2878
  var i, r, n, l, a, c, h;
2878
2879
  let s = !1, o = !1;
2879
2880
  if (this.getSelectionModel && this.getFocusModel) {
2880
- const u = this.getSelectionModel(), f = this.getFocusModel();
2881
- u && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), this.tableScope.onFocusChanged(f), s = !0), (i = e.originalEvent) != null && i.shiftKey || u.hasSelection() && (u.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (u.addSelection(this.createRangeByEvents(e, this.previousEvt)), o = !0, s = !0) : (n = e.originalEvent) != null && n.altKey && ((l = e.originalEvent) != null && l.ctrlKey || (a = e.originalEvent) != null && a.metaKey) ? (u.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (c = e.originalEvent) != null && c.ctrlKey || (h = e.originalEvent) != null && h.metaKey ? (u.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (u.firstClick(e.rowIndex, e.columnIndex), s = !0), this.tableScope.onSelectionChanged(u));
2881
+ const u = this.getSelectionModel(), g = this.getFocusModel();
2882
+ u && g && (g.hasFocus(e.rowIndex, e.columnIndex) || (g.setFocus(e.rowIndex, e.columnIndex), this.tableScope.onFocusChanged(g), s = !0), (i = e.originalEvent) != null && i.shiftKey || u.hasSelection() && (u.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (u.addSelection(this.createRangeByEvents(e, this.previousEvt)), o = !0, s = !0) : (n = e.originalEvent) != null && n.altKey && ((l = e.originalEvent) != null && l.ctrlKey || (a = e.originalEvent) != null && a.metaKey) ? (u.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (c = e.originalEvent) != null && c.ctrlKey || (h = e.originalEvent) != null && h.metaKey ? (u.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (u.firstClick(e.rowIndex, e.columnIndex), s = !0), this.tableScope.onSelectionChanged(u));
2882
2883
  }
2883
2884
  return o ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
2884
2885
  }
@@ -2909,7 +2910,7 @@ class pt {
2909
2910
  });
2910
2911
  }
2911
2912
  }
2912
- class gt {
2913
+ class ft {
2913
2914
  get() {
2914
2915
  return {
2915
2916
  f2: "START_EDITING",
@@ -2929,7 +2930,7 @@ class gt {
2929
2930
  };
2930
2931
  }
2931
2932
  }
2932
- class ft {
2933
+ class gt {
2933
2934
  get() {
2934
2935
  return {
2935
2936
  f2: "START_EDITING",
@@ -2989,7 +2990,7 @@ class bt {
2989
2990
  (t = (e = this.tableScope) == null ? void 0 : e.tableOptions) != null && t.shortcutActionsDisabled ? this.isDebug() && console.debug("ShortcutService skipped.") : (this.assignPredefinedSystemShortcutMappings(), Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping), this.isDebug() && console.debug("ShortcutService", this.shortcutActionIdMapping), this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this)));
2990
2991
  }
2991
2992
  assignPredefinedSystemShortcutMappings() {
2992
- this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new ft().get()) : Object.assign(this.shortcutActionIdMapping, new gt().get());
2993
+ this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new gt().get()) : Object.assign(this.shortcutActionIdMapping, new ft().get());
2993
2994
  }
2994
2995
  isMacintosh() {
2995
2996
  return navigator.platform.indexOf("Mac") > -1;
@@ -3130,7 +3131,7 @@ class wt {
3130
3131
  }
3131
3132
  }
3132
3133
  }
3133
- class fe {
3134
+ class ge {
3134
3135
  constructor(e = "none", t = "single") {
3135
3136
  this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.silent = !1, this.listenerArr = [];
3136
3137
  }
@@ -3263,7 +3264,7 @@ class me {
3263
3264
  }
3264
3265
  // `⊖ `, `⊕ `;
3265
3266
  }
3266
- const St = new fe(), Ct = new xt("cell");
3267
+ const St = new ge(), Ct = new xt("cell");
3267
3268
  class J {
3268
3269
  constructor() {
3269
3270
  this.overflowX = "auto", this.overflowY = "auto", this.horizontalBorderVisible = !0, this.verticalBorderVisible = !0, this.footerSeparatorBorderVisible = !0, this.headerSeparatorBorderVisible = !0, this.fixedEastSeparatorBorderVisible = !0, this.fixedWestSeparatorBorderVisible = !0, this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
@@ -3448,8 +3449,8 @@ class Rt {
3448
3449
  let s = 0;
3449
3450
  const o = [];
3450
3451
  e.forEach((h, u) => {
3451
- const f = new TextEncoder().encode(u), p = new TextEncoder().encode(h), m = new Uint8Array(30 + f.length), g = new DataView(m.buffer);
3452
- m.set([80, 75, 3, 4], 0), g.setUint16(4, 20, !0), g.setUint16(6, 0, !0), g.setUint16(8, 0, !0), g.setUint16(10, 0, !0), g.setUint16(12, 0, !0), g.setUint32(14, 0, !0), g.setUint32(18, p.length, !0), g.setUint32(22, p.length, !0), g.setUint16(26, f.length, !0), g.setUint16(28, 0, !0), m.set(f, 30), t.push(m, p), o.push({
3452
+ const g = new TextEncoder().encode(u), p = new TextEncoder().encode(h), m = new Uint8Array(30 + g.length), f = new DataView(m.buffer);
3453
+ m.set([80, 75, 3, 4], 0), f.setUint16(4, 20, !0), f.setUint16(6, 0, !0), f.setUint16(8, 0, !0), f.setUint16(10, 0, !0), f.setUint16(12, 0, !0), f.setUint32(14, 0, !0), f.setUint32(18, p.length, !0), f.setUint32(22, p.length, !0), f.setUint16(26, g.length, !0), f.setUint16(28, 0, !0), m.set(g, 30), t.push(m, p), o.push({
3453
3454
  path: u,
3454
3455
  offset: s,
3455
3456
  contentSize: p.length
@@ -3457,8 +3458,8 @@ class Rt {
3457
3458
  });
3458
3459
  const i = s;
3459
3460
  o.forEach((h) => {
3460
- const u = new TextEncoder().encode(h.path), f = new Uint8Array(46 + u.length), p = new DataView(f.buffer);
3461
- f.set([80, 75, 1, 2], 0), p.setUint16(4, 20, !0), p.setUint16(6, 20, !0), p.setUint16(8, 0, !0), p.setUint16(10, 0, !0), p.setUint16(12, 0, !0), p.setUint16(14, 0, !0), p.setUint32(16, 0, !0), p.setUint32(20, h.contentSize, !0), p.setUint32(24, h.contentSize, !0), p.setUint16(28, u.length, !0), p.setUint16(30, 0, !0), p.setUint16(32, 0, !0), p.setUint16(34, 0, !0), p.setUint16(36, 0, !0), p.setUint32(38, 0, !0), p.setUint32(42, h.offset, !0), f.set(u, 46), t.push(f), s += f.length;
3461
+ const u = new TextEncoder().encode(h.path), g = new Uint8Array(46 + u.length), p = new DataView(g.buffer);
3462
+ g.set([80, 75, 1, 2], 0), p.setUint16(4, 20, !0), p.setUint16(6, 20, !0), p.setUint16(8, 0, !0), p.setUint16(10, 0, !0), p.setUint16(12, 0, !0), p.setUint16(14, 0, !0), p.setUint32(16, 0, !0), p.setUint32(20, h.contentSize, !0), p.setUint32(24, h.contentSize, !0), p.setUint16(28, u.length, !0), p.setUint16(30, 0, !0), p.setUint16(32, 0, !0), p.setUint16(34, 0, !0), p.setUint16(36, 0, !0), p.setUint32(38, 0, !0), p.setUint32(42, h.offset, !0), g.set(u, 46), t.push(g), s += g.length;
3462
3463
  });
3463
3464
  const r = new Uint8Array(22), n = new DataView(r.buffer);
3464
3465
  r.set([80, 75, 5, 6], 0), n.setUint16(4, 0, !0), n.setUint16(6, 0, !0), n.setUint16(8, o.length, !0), n.setUint16(10, o.length, !0), n.setUint32(12, s - i, !0), n.setUint32(16, i, !0), n.setUint16(20, 0, !0), t.push(r);
@@ -3484,7 +3485,7 @@ class Ve extends ct {
3484
3485
  const l = this.getSelectionModel ? this.getSelectionModel() : void 0;
3485
3486
  l && l.addEventSelectionChangedListener(this);
3486
3487
  const a = this.getFocusModel ? this.getFocusModel() : void 0;
3487
- a && a.addEventFocusChangedListener(this), console.log("TableScope created");
3488
+ a && a.addEventFocusChangedListener(this);
3488
3489
  }
3489
3490
  /**
3490
3491
  * Creates a TableScope instance.
@@ -3527,7 +3528,7 @@ class Ve extends ct {
3527
3528
  return !1;
3528
3529
  }
3529
3530
  updateModelValueAfterEdit(e, t, s, o) {
3530
- e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, o) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(ge.createSingle(t, s)), this.hostElement.focus());
3531
+ e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, o) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(fe.createSingle(t, s)), this.hostElement.focus());
3531
3532
  }
3532
3533
  /**
3533
3534
  * Retrieves the TableApi object.
@@ -4189,8 +4190,8 @@ class y {
4189
4190
  }
4190
4191
  const At = () => !0, ve = () => !1;
4191
4192
  class V {
4192
- constructor(e, t, s = new y(100, "px"), o = new I(), i = new I(), r = new y(100, "px"), n = new y(100, "px"), l, a, c, h, u, f, p, m, g = () => this.visible) {
4193
- 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 = h, 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"));
4193
+ constructor(e, t, s = new y(100, "px"), o = new I(), i = new I(), r = new y(100, "px"), n = new y(100, "px"), l, a, c, h, u, g, p, m, f = () => this.visible) {
4194
+ 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 = h, this.sortIconVisible = u, this.editable = g, this.getEditRenderer = p, this.editInputPipe = m, this.isVisible = f, this.visible = !0, s.unit !== "px" && (this.minWidth = new y(0, "px"), this.maxWidth = new y(1e5, "px"));
4194
4195
  }
4195
4196
  static bodyRenderer(e) {
4196
4197
  return new I(
@@ -4229,7 +4230,7 @@ class V {
4229
4230
  );
4230
4231
  }
4231
4232
  }
4232
- const zt = new y(500, "px"), jt = new y(400, "px"), Et = new y(300, "px"), Ut = new y(290, "px"), Yt = new y(280, "px"), Kt = new y(270, "px"), Xt = new y(260, "px"), Jt = new y(250, "px"), qt = new y(240, "px"), Zt = new y(230, "px"), Qt = new y(220, "px"), es = new y(210, "px"), Re = new y(200, "px"), ts = new y(190, "px"), ss = new y(180, "px"), os = new y(170, "px"), is = new y(160, "px"), rs = new y(150, "px"), ns = new y(140, "px"), ls = new y(130, "px"), as = new y(120, "px"), cs = new y(110, "px"), ds = new y(100, "px"), hs = new y(90, "px"), us = new y(80, "px"), ps = new y(70, "px"), gs = new y(60, "px"), fs = new y(50, "px"), ms = new y(40, "px"), bs = new y(30, "px"), ys = new y(20, "px"), ws = new y(10, "px"), xs = new y(0, "px");
4233
+ const zt = new y(500, "px"), jt = new y(400, "px"), Et = new y(300, "px"), Ut = new y(290, "px"), Yt = new y(280, "px"), Kt = new y(270, "px"), Xt = new y(260, "px"), Jt = new y(250, "px"), qt = new y(240, "px"), Zt = new y(230, "px"), Qt = new y(220, "px"), es = new y(210, "px"), Re = new y(200, "px"), ts = new y(190, "px"), ss = new y(180, "px"), os = new y(170, "px"), is = new y(160, "px"), rs = new y(150, "px"), ns = new y(140, "px"), ls = new y(130, "px"), as = new y(120, "px"), cs = new y(110, "px"), ds = new y(100, "px"), hs = new y(90, "px"), us = new y(80, "px"), ps = new y(70, "px"), fs = new y(60, "px"), gs = new y(50, "px"), ms = new y(40, "px"), bs = new y(30, "px"), ys = new y(20, "px"), ws = new y(10, "px"), xs = new y(0, "px");
4233
4234
  class P extends ue {
4234
4235
  constructor(e, t, s, o = []) {
4235
4236
  super(e, o, s), this.areaIdent = e, this.arr = t, this.defaultRowHeight = s, this.columnDefs = o, this.filteredArr = [...t];
@@ -4379,7 +4380,8 @@ class Ae extends ue {
4379
4380
  return this.filteredFlattenRows[e];
4380
4381
  }
4381
4382
  getValueByT(e, t) {
4382
- return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
4383
+ if (e && t)
4384
+ return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
4383
4385
  }
4384
4386
  externalFilterChanged(e) {
4385
4387
  this.lastPredictFn = e, this.doFiltering();
@@ -4543,10 +4545,10 @@ class Tt {
4543
4545
  }
4544
4546
  }
4545
4547
  class oe {
4546
- constructor(e, t, s, o = 0, i = 0, r = !1, n = new z(), l = [], a = [], c = -1, h = 0, u = 400, f = () => {
4548
+ constructor(e, t, s, o = 0, i = 0, r = !1, n = new z(), l = [], a = [], c = -1, h = 0, u = 400, g = () => {
4547
4549
  }) {
4548
- var p, m, g, b;
4549
- 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 = h, this.parentSize = u, this.getSelectionModel = f, this.rowCount = 0, this.contentHeightInPx = 0, this.contentWidthInPx = 0, this.padding = new Me(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 && Ze(this.columnDefs[0]) && !t.rowSelectionModel && (t.rowSelectionModel = new Tt());
4550
+ var p, m, f, b;
4551
+ 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 = h, this.parentSize = u, this.getSelectionModel = g, this.rowCount = 0, this.contentHeightInPx = 0, this.contentWidthInPx = 0, this.padding = new Me(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 = (f = this.columnSizes) == null ? void 0 : f.length)), (b = this.columnDefs) != null && b.length && Ze(this.columnDefs[0]) && !t.rowSelectionModel && (t.rowSelectionModel = new Tt());
4550
4552
  }
4551
4553
  init() {
4552
4554
  this.recalcSize(this.parentSize), this.overridingColumnWidth === -1 && this.calcXPositions(), this.headerAreaModel && this.headerAreaModel.init(), this.bodyAreaModel && this.bodyAreaModel.init(), this.footerAreaModel && this.footerAreaModel.init();
@@ -4982,32 +4984,32 @@ class B {
4982
4984
  * Please consult each method's documentation for detailed explanation of their functionality.
4983
4985
  */
4984
4986
  static createTableModel(e) {
4985
- var t, s, o, i, r, n, l, a, c, h, u, f, p, m;
4987
+ var t, s, o, i, r, n, l, a, c, h, u, g, p, m;
4986
4988
  if (e.defaultRowHeights === void 0)
4987
4989
  if ((t = e.tableOptions) != null && t.defaultRowHeights)
4988
4990
  e.defaultRowHeights = e.tableOptions.defaultRowHeights;
4989
4991
  else {
4990
4992
  if (e.defaultRowHeights = new z(), e.headerAreaModel && "defaultRowHeight" in e.headerAreaModel) {
4991
- const g = e.headerAreaModel.defaultRowHeight;
4992
- g > -1 && (e.defaultRowHeights.header = g);
4993
+ const f = e.headerAreaModel.defaultRowHeight;
4994
+ f > -1 && (e.defaultRowHeights.header = f);
4993
4995
  }
4994
4996
  if (e.bodyAreaModel && "defaultRowHeight" in e.bodyAreaModel) {
4995
- const g = e.bodyAreaModel.defaultRowHeight;
4996
- g > -1 && (e.defaultRowHeights.body = g);
4997
+ const f = e.bodyAreaModel.defaultRowHeight;
4998
+ f > -1 && (e.defaultRowHeights.body = f);
4997
4999
  }
4998
5000
  if (e.footerAreaModel && "defaultRowHeight" in e.footerAreaModel) {
4999
- const g = e.footerAreaModel.defaultRowHeight;
5000
- g > -1 && (e.defaultRowHeights.footer = g);
5001
+ const f = e.footerAreaModel.defaultRowHeight;
5002
+ f > -1 && (e.defaultRowHeights.footer = f);
5001
5003
  }
5002
5004
  }
5003
- if (e.columnDefs === void 0 && ((s = e.properties) != null && s.length ? e.columnDefs = e.properties.map((g) => new V(g, g.toUpperCase(), Re)) : (o = e.rows) != null && o.length ? e.columnDefs = Object.keys(e.rows[0]).map((g) => new V(g, g.toUpperCase(), Re)) : 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(
5005
+ if (e.columnDefs === void 0 && ((s = e.properties) != null && s.length ? e.columnDefs = e.properties.map((f) => new V(f, f.toUpperCase(), Re)) : (o = e.rows) != null && o.length ? e.columnDefs = Object.keys(e.rows[0]).map((f) => new V(f, f.toUpperCase(), Re)) : 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(
5004
5006
  "header",
5005
5007
  e.headerData,
5006
5008
  e.defaultRowHeights.header,
5007
5009
  e.columnDefs
5008
5010
  ) : (c = e.columnDefs) != null && c.length ? e.headerAreaModel = new P(
5009
5011
  "header",
5010
- [e.columnDefs.map((g) => g.headerLabel)],
5012
+ [e.columnDefs.map((f) => f.headerLabel)],
5011
5013
  e.defaultRowHeights.header,
5012
5014
  e.columnDefs
5013
5015
  ) : e.headerAreaModel = new F("header")), e.footerAreaModel || ((h = e.footerData) != null && h.length ? e.footerAreaModel = new P(
@@ -5018,13 +5020,13 @@ class B {
5018
5020
  ) : e.footerAreaModel = new F("footer")), !e.bodyAreaModel)
5019
5021
  if (e.rows)
5020
5022
  if ((u = e.rows) != null && u.length && G(e.rows[0])) {
5021
- const g = e.rows;
5023
+ const f = e.rows;
5022
5024
  e.bodyAreaModel = new Ae(
5023
5025
  "body",
5024
- g,
5026
+ f,
5025
5027
  e.defaultRowHeights.body,
5026
5028
  e.columnDefs
5027
- ), (e.columnDefs[0].property === "CheckboxColumn" || (f = e.tableOptions) != null && f.showCheckboxWihoutExtraColumn) && (e.bodyAreaModel.rowSelectionModel = new Ee(g));
5029
+ ), (e.columnDefs[0].property === "CheckboxColumn" || (g = e.tableOptions) != null && g.showCheckboxWihoutExtraColumn) && (e.bodyAreaModel.rowSelectionModel = new Ee(f));
5028
5030
  } else
5029
5031
  e.bodyAreaModel = new Te(
5030
5032
  "body",
@@ -5361,7 +5363,7 @@ class B {
5361
5363
  */
5362
5364
  static createByObjectArray(e, t = [], s = [], o = 0, i = 0, r = !1, n = new z(), l, a = []) {
5363
5365
  let c;
5364
- 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();
5366
+ t != null && t.length ? c = new P("header", t, n.header, l) : l != null && l.length ? c = new P("header", [l.map((g) => g.headerLabel)], n.header, l) : c = new F();
5365
5367
  const h = s ? new P("footer", s, n.footer, l) : new F(), u = new Te("body", e, l, n.body);
5366
5368
  return new oe(
5367
5369
  c,
@@ -5979,7 +5981,7 @@ class Hs {
5979
5981
  ${h}
5980
5982
  class="ge-input-checkbox">`, !this.readonly) {
5981
5983
  const u = e.querySelector(".ge-input-checkbox");
5982
- u && u.addEventListener("click", (f, p) => (l[this.property] = !l[this.property], !0));
5984
+ u && u.addEventListener("click", (g, p) => (l[this.property] = !l[this.property], !0));
5983
5985
  }
5984
5986
  }
5985
5987
  }
@@ -6267,7 +6269,7 @@ class Ne {
6267
6269
  }
6268
6270
  }
6269
6271
  }
6270
- class Qs extends fe {
6272
+ class Qs extends ge {
6271
6273
  constructor(e) {
6272
6274
  super("row", "multi"), this.model = e;
6273
6275
  }
@@ -6592,18 +6594,18 @@ class so {
6592
6594
  this.crudOptions = e, this.listenActionEvent = o, e.fetchList(e).then((i) => {
6593
6595
  var r, n, l, a;
6594
6596
  if (t.rows = i, i != null && i.length) {
6595
- const c = (r = t.columnDefs) != null && r.length ? t.columnDefs.map((w) => w.property) : this.extractProperties(i[0]), h = new fe("row", "multi"), u = () => h;
6597
+ const c = (r = t.columnDefs) != null && r.length ? t.columnDefs.map((w) => w.property) : this.extractProperties(i[0]), h = new ge("row", "multi"), u = () => h;
6596
6598
  this.tableOptions = {
6597
6599
  ...new J(),
6598
6600
  ...t.tableOptions,
6599
6601
  hoverColumnVisible: !1,
6600
6602
  getSelectionModel: u
6601
6603
  };
6602
- const f = this.calcAutoColumnWidths(i, c), p = (n = t.columnDefs) != null && n.length ? t.columnDefs : c.map((w, S) => new V(w, w.toUpperCase(), new y(f[S], "px")));
6604
+ const g = this.calcAutoColumnWidths(i, c), p = (n = t.columnDefs) != null && n.length ? t.columnDefs : c.map((w, S) => new V(w, w.toUpperCase(), new y(g[S], "px")));
6603
6605
  if ((l = e == null ? void 0 : e.columnWidths) != null && l.autoCalc)
6604
6606
  for (let w = 0; w < p.length; w++) {
6605
6607
  const S = p[w];
6606
- S.width = new y(f[w], "px");
6608
+ S.width = new y(g[w], "px");
6607
6609
  }
6608
6610
  if (e.autoAddActionColumn) {
6609
6611
  let w = new V(
@@ -6618,13 +6620,13 @@ class so {
6618
6620
  void 0
6619
6621
  ), p.push(w);
6620
6622
  }
6621
- const m = 0, g = e.calcFixedRightColumnCount(p.length);
6623
+ const m = 0, f = e.calcFixedRightColumnCount(p.length);
6622
6624
  this.tableModel = B.buildByTypedRowsParam({
6623
6625
  rows: i,
6624
6626
  columnDefs: p,
6625
6627
  tableOptions: this.tableOptions,
6626
6628
  fixedLeftColumnCount: m,
6627
- fixedRightColumnCount: g
6629
+ fixedRightColumnCount: f
6628
6630
  }), this.tableModel.getSelectionModel = u, this.bodyModel = (a = this.tableModel) == null ? void 0 : a.getBodyModel();
6629
6631
  const b = new It(this.tableModel, this.tableOptions);
6630
6632
  s(b);
@@ -6677,7 +6679,7 @@ class so {
6677
6679
  let r = e.id;
6678
6680
  (i = this.crudOptions) == null || i.deleteItem(this.crudOptions, r).then((n) => {
6679
6681
  var l, a, c, h, u;
6680
- return (l = this.bodyModel) == null || l.filterRowsByPredict((f) => f.id != r), (c = (a = this.tableModel) == null ? void 0 : a.getTableScope()) == null || c.clearSelection(!0), (u = (h = this.tableModel) == null ? void 0 : h.getTableScope()) == null || u.repaintHard(), n;
6682
+ return (l = this.bodyModel) == null || l.filterRowsByPredict((g) => g.id != r), (c = (a = this.tableModel) == null ? void 0 : a.getTableScope()) == null || c.clearSelection(!0), (u = (h = this.tableModel) == null ? void 0 : h.getTableScope()) == null || u.repaintHard(), n;
6681
6683
  });
6682
6684
  }
6683
6685
  }
@@ -6689,7 +6691,7 @@ class so {
6689
6691
  const i = e.length ?? 0, r = new Array(o).fill(0);
6690
6692
  for (let c = 0; c < i; c++)
6691
6693
  for (let h = 0; h < o; h++) {
6692
- const u = t[h], f = this.getValueByT(e[c], u), p = (f == null ? void 0 : f.toString().length) || 0;
6694
+ const u = t[h], g = this.getValueByT(e[c], u), p = (g == null ? void 0 : g.toString().length) || 0;
6693
6695
  p > r[h] && (r[h] = p);
6694
6696
  }
6695
6697
  if (this.crudOptions.columnWidths.takeHeaderLabelsIntoAccount)
@@ -6784,7 +6786,7 @@ export {
6784
6786
  K as GeCssColorUtil,
6785
6787
  _s as GeFilterService,
6786
6788
  Ps as GeKeyEvent,
6787
- ge as GeModelChangeEvent,
6789
+ fe as GeModelChangeEvent,
6788
6790
  he as GeMouseEvent,
6789
6791
  L as GeoData,
6790
6792
  O as Icon,
@@ -6802,7 +6804,7 @@ export {
6802
6804
  Ys as NumberCellRenderer,
6803
6805
  Ue as NumberPropertyType,
6804
6806
  D as ObjectPropertyType,
6805
- ft as OsxShortcutActionIdMapping,
6807
+ gt as OsxShortcutActionIdMapping,
6806
6808
  De as PROPERTY_TYPE_KEY_ANY,
6807
6809
  Le as PROPERTY_TYPE_KEY_ARRAY,
6808
6810
  de as PROPERTY_TYPE_KEY_BOOLEAN,
@@ -6822,7 +6824,7 @@ export {
6822
6824
  vt as ResizeHandler,
6823
6825
  Nt as SchemeGenerator,
6824
6826
  Ne as SelectCellRenderer,
6825
- fe as SelectionModel,
6827
+ ge as SelectionModel,
6826
6828
  pt as SelectionService,
6827
6829
  bt as ShortcutService,
6828
6830
  Xs as SimpleArrayCellRenderer,
@@ -6856,7 +6858,7 @@ export {
6856
6858
  oo as UrlInfo,
6857
6859
  Ke as ValueInfo,
6858
6860
  Dt as ValueLabel,
6859
- gt as WindowsShortcutActionIdMapping,
6861
+ ft as WindowsShortcutActionIdMapping,
6860
6862
  Ss as actionIds,
6861
6863
  Ts as allCenter,
6862
6864
  Ms as allLeft,
@@ -6902,9 +6904,9 @@ export {
6902
6904
  Et as px300,
6903
6905
  ms as px40,
6904
6906
  jt as px400,
6905
- fs as px50,
6907
+ gs as px50,
6906
6908
  zt as px500,
6907
- gs as px60,
6909
+ fs as px60,
6908
6910
  ps as px70,
6909
6911
  us as px80,
6910
6912
  hs as px90,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.69",
3
+ "version": "1.1.74",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./index.js",