@guiexpert/react-table 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ This is the react component of the GuiExpert Table Project.
7
7
 
8
8
  This is the UI-agnostic table component for your next web app. 😊
9
9
 
10
- <img src="https://raw.githubusercontent.com/guiexperttable/table-website/main/src/assets/screens/heatmap.png" width="50%">
10
+ <img src="https://raw.githubusercontent.com/guiexperttable/ge-table/main/apps/table-website/src/assets/screens/heatmap.png" width="50%">
11
11
 
12
12
  ### Features
13
13
  - Handle large datasets easily
package/index.cjs ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),k=require("react"),X=require("react-dom");class P{constructor(e=-1,t=-1,i=-1,s=-1,o,r,n,l=0,a=0,d=0,S=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=i,this.columnLeft=s,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=a,this.draggingY=d,this.action=S}clone(){return new P(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class I{constructor(e=">",t="",i=[]){this.content=e,this.style=t,this.classes=i}}class N{constructor(e=new I(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new I(">","",["ge-table-tree-arrow-collapsed"]),i=new I(">","color:transparent;",["gt-table-tree-arrow-hidden"]),s=new I("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=i,this.arrowExpandCollapseAll=s}}class j{constructor(e=new I("↑","",["ge-header-sorted-asc"]),t=new I("↓","",["ge-header-sorted-desc"]),i=new I("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=i}}class K{constructor(e){this.domService=e}setStyle(e,t,i){return this.domService.setStyle(e,t,i),e}applyStyle(e,t){for(const i in t)this.domService.setStyle(e,i,t[i]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([i,s])=>this.domService.setStyle(e,i,s+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",i){return this.domService.setStyle(i,"overflow-x",e),this.domService.setStyle(i,"overflow-y",t),i}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const i=this.domService.createText(t);return this.domService.appendChild(e,i),i}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(i=>this.domService.addClass(t,i)):this.domService.addClass(t,e),t}addClasses(e,t){if(e)for(const i of e)this.domService.addClass(t,i);return t}setAttribute(e,t,i){return t&&i&&this.domService.setAttribute(e,t,i),e}createAreaDivWithClass(e,t,i,s){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",i),this.domService.setAttribute(o,"data-side",s),this.domService.appendChild(t,o),o}createDivWithClass(e,t){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.appendChild(t,i),i}addRowDiv(e,t,i=-1,s,o,r=""){const n=t.index??-1,l=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(l,"ge-table-row-div"),this.domService.addClass(l,`ge-table-row-div-${t.index}`),s==="body"&&o==="center"){const a=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(l,`ge-table-row-${a}`)}if(this.domService.setStyle(l,"display","clip"),this.domService.setStyle(l,"position","absolute"),this.domService.setStyle(l,"left",`${t.left}px`),this.domService.setStyle(l,"top",`${t.top}px`),this.domService.setStyle(l,"width",`${t.width}px`),this.domService.setStyle(l,"height",`${t.height}px`),this.domService.setAttribute(l,"data-row-index",`${i}`),this.domService.setAttribute(l,"data-area",`${s}`),r){const a=this.domService.createText(r);this.domService.appendChild(l,a)}return this.domService.appendChild(e.child,l),l}addColumnDiv(e,t,i=-1,s=-1,o,r,n="",l,a,d=void 0,S){const g=a==null?void 0:a.treeOptions,f=a==null?void 0:a.showCheckboxWihoutExtraColumn,c=this.domService.createElement("div");this.domService.addClass(c,"ge-table-col-div"),this.domService.addClass(c,`ge-table-col-div-${t.index}`),this.domService.setAttribute(c,"data-col-index",`${t.index}`),this.domService.setAttribute(c,"data-row-index",`${i}`),this.domService.setAttribute(c,"data-area",`${o}`);const b=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(c,`ge-table-column-${b}`),this.domService.setStyle(c,"display","clip"),this.domService.setStyle(c,"position","absolute"),this.domService.setStyle(c,"left",`${t.left}px`),this.domService.setStyle(c,"top",`${t.top}px`),this.domService.setStyle(c,"width",`${t.width}px`),this.domService.setStyle(c,"height",`${t.height}px`),l&&l!=="none"&&(this.domService.addClass(c,"ge-table-col-tree"),this.addArrowDiv(c,l,g,i,s,o)),f&&s===0&&d&&this.addCheckboxToDiv(c,d,o,i),n){const h=l!=="none"&&s===0;this.addLabelDiv(c,n,h,i,s,o)}return S&&this.addSortedIcon(c,S,a==null?void 0:a.sortedOptions,s),this.domService.appendChild(e,c),c}addCheckboxToDiv(e,t,i,s){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
2
+ <input
3
+ type="checkbox"
4
+ data-area="${i}"
5
+ data-row-index="${s}"
6
+ data-input-type="checkbox"
7
+ ${r}
8
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(o,"display","inline"),this.domService.setStyle(o,"width","inherit"),this.domService.setAttribute(o,"data-row-index",`${s}`),this.domService.appendChild(e,o),o}addLabelDiv(e,t="",i=!1,s=-1,o=-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",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(i){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",`${o}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",i=new j,s=-1){const o=this.domService.createElement("div");this.domService.addClass(o,"ge-table-sorted-icon-div"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"top","0"),this.domService.setStyle(o,"right","0"),this.domService.setStyle(o,"width","20px"),this.domService.setStyle(o,"background","transparent"),this.domService.setStyle(o,"cursor","pointer"),this.domService.setAttribute(o,"data-col-index",`${s}`),this.domService.setAttribute(o,"data-area","header");let r;t==="asc"?r=i.iconAsc:t==="desc"?r=i.iconDesc:r=i.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(o,l),r.style&&this.applyStyleString(o,r.style);for(const a of r.classes)this.domService.addClass(o,a);return this.domService.appendChild(e,o),o}addArrowDiv(e,t="none",i=new N,s=-1,o=-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",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=i.arrowExpanded:t==="collapsed"?l=i.arrowCollapsed:l=i.arrowPlaceholder;const a=l.content,d=this.domService.createText(a);this.domService.appendChild(n,d),l.style&&this.applyStyleString(n,l.style);for(const S of l.classes)this.domService.addClass(n,S);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,i,s,o){if(e.verticalBorderVisible){const r=`ge-table-${s}-${o}-vertical-border`;this.addVerticalBorder(i,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${o}-horizontal-border`;this.addHorizontalBorder(i,t,r)}return t}addHorizontalBorder(e,t,i="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,i),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,i){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.applyStyle(s,i),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.applyStyle(s,i),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.applyStyle(s,i),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.applyStyle(s,i),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,i="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,i),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,i=""){const s=this.domService.createElement("div");return i&&this.domService.addClass(s,i),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 i=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of i){const[o,r]=s.split(":");this.domService.setStyle(e,o.trim(),r.trim())}}getDivOrCreateDiv(e,t){let i=t.cache[e];return i?(i.innerText="",i):(i=this.domService.createElement("div"),t.cache[e]=i,i)}}class L{constructor(e,t=!0,i,s,o=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=i,this.parent=s,this.deep=o,this.checked=r,this.keep=n}}const V=p=>p==="header"?"header":p==="footer"?"footer":"body";class Y{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 i=e.getAttribute("data-area");if(i&&(this.areaIdent=V(i),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 q{constructor(e){this.tableScope=e,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,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=new Y(e.target,this.tableScope);if(t.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(t.inputType==="checkbox"&&t.areaIdent)this.tableScope.toggleRowCheckbox(t.rowIdx,t.colIdx,t.areaIdent),e.preventDefault(),e.stopPropagation();else if(t.row instanceof L&&t.areaModel){const i=t.colIdx===this.getArrowColumnIndex()&&e.altKey,s=t.className.includes("ge-table-tree-arrow-div");if(console.info(s,i),i||s){e.preventDefault(),e.stopPropagation();const o=t.row;o.expanded=!o.expanded,"recalcVisibleTreeRows"in t.areaModel&&t.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(o)}}if(t.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const i=this.tableScope.tableOptions.getFocusModel();i==null||i.clear(),i==null||i.setFocus(t.rowIdx,t.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(e.target instanceof HTMLElement){const t=e.target,i=t.getAttribute("data-area"),s=V(i),o=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(i&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,o,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(o);if(i&&s==="body"&&n.isEditable(o,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(o,r)),l instanceof 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 i;this.mouseEvent=e,this.geMouseEventOld=(i=this.geMouseEvent)==null?void 0:i.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld)}updateCollapsedExpandedState(e){var i,s,o,r,n;const t=(s=(i=this.tableScope.tableOptions)==null?void 0:i.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(o=this.tableScope.storeStateCollapsedExpandService)==null?void 0:o.collapsedExpandedStateGet().mode,a=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,d=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,S=t(e.data);a?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(S):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(S))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){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=!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}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)}}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 U{constructor(e){this.tableScope=e}updateCells(e){this.tableScope.updateCells(e)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){}scrollToIndex(e=0,t=0){}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}}class J{flattenTree(e,t=[]){var i;for(const s of e)this.isVisible(s)&&t.push(s),(i=s.children)!=null&&i.length&&this.flattenTree(s.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Q{constructor(e,t=[],i=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=i,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(s=>s.rendererMap[e])}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 i;const t=this.getRowByIndex(e);return(i=this.rowSelectionModel)==null?void 0:i.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const i=this.getRowByIndex(e);this.rowSelectionModel.checkRow(i,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){return this.columnDefs&&t<this.columnDefs.length&&this.columnDefs[t].editable?this.columnDefs[t].editable():!1}setValue(e,t,i){var n;const s=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;s&&(i=s(i,e,t));const o=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(o,r.split("."),i):(o[r]=i,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,i){const s=t.shift();if(s){let o=e[s];return o&&t.length?this.setPropertyValue(o,t,i):(e[s]=i,!0)}return!1}arrayMove(e,t,i){const s=e.splice(t,1)[0];return e.splice(i,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 Z{genericSortComparator(e,t,i){if(typeof e=="number"&&typeof t=="number")return i*(e-t);if(typeof e=="string"&&typeof t=="string")return i*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return i*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return i*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const s=e,o=t;if(s.length&&o.length)return this.genericSortComparator(s[0],o[0],i)}return i*(""+e).localeCompare(""+t)}}class B extends Q{constructor(e,t,i,s=[]){super(e,s,i),this.areaIdent=e,this.rows=t,this.defaultRowHeight=i,this.columnDefs=s,this.sorterService=new Z,this.service=new J,this.properties=s.map(o=>o.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 i=this.getRowByIndex(e);if(i){const s=this.properties[t];if(s)return s.includes(".")?this.getPropertyValue(i.data,s.split(".")):i.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:i}=e[e.length-1],s=i==="asc"?1:i==="desc"?-1:0,o=this.properties[t];return this.treeSort(this.rows,o,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,i){var r;const s=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;s&&(i=s(i,e,t));const o=this.getRowByIndex(e);if(o){const n=o.data,l=this.columnDefs[t].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),i):(n[l]=i,!0)}return!1}genericTreeTableSortComparator(e,t){return(i,s)=>{const o=this.getValueByT(i.data,e),r=this.getValueByT(s.data,e);return this.sorterService.genericSortComparator(o,r,t)}}expandAllRecursive(e,t){for(const i of e)i.expanded=t,i.children&&this.expandAllRecursive(i.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(i=>{e=Math.max(e,i.deep)});const t=this.flattenRows.filter((i,s,o)=>this.lastPredictFn(i,s,o));this.flattenRows.forEach(i=>i.keep=!1),this.flattenRows.forEach(i=>{t.includes(i)&&(i.keep=!0,this.setAllParentsOk(i))}),this.filteredFlattenRows=this.flattenRows.filter((i,s,o)=>i.keep)}}getPropertyValue(e,t){const i=t.shift();let s=e[i];return s&&t.length?this.getPropertyValue(s,t):s}treeSort(e,t,i){e.sort(this.genericTreeTableSortComparator(t,i));for(const s of e)s.children&&this.treeSort(s.children,t,i)}}class H{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const i=e;for(const s of[...i]){const[o,r]=s;t[o]=r}}return t}checkAndPersistItem(e,t){const i=this.getStorageKeyFn;if(i){const s=i();if(s){const o=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(o,r)}else this.persistItem(o,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 ee extends H{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 i=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(i);this.scrollOffset=s||[0,0]}}}}class te{constructor(e="collapsed",t=[],i=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=i,this.allExpanded=s}}class ie extends H{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new te,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 i=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(i);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class se extends H{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 i=t+this.SORTING_STATE;let s=this.loadFromLocalStorage(i);this.sortItems=s||[]}}}}class T{constructor(e=0,t=0,i=0,s=0,o){this.left=e,this.width=t,this.height=i,this.top=s,this.index=o}}class oe{constructor(e,t,i,s){this.hostElement=e,this.tableModel=t,this.dom=i,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new T,this.areaBodyCenterGeo=new T,this.areaBodyEastGeo=new T;const o=this.hostElement;o.innerText="",this.dom.setAttribute(o,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",o),"position","relative"),this.hoverRow=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-hover-row",o)),this.hoverColumn=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-hover-column",o)),this.areaHeaderWest=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-header ge-table-header-west",o,"header","west"))),this.areaHeaderCenter=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-header ge-table-header-center",o,"header","center"))),this.areaHeaderEast=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-header ge-table-header-east",o,"body","east"))),this.areaBodyWest=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-body ge-table-body-west",o,"body","west"))),this.areaBodyEast=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-body ge-table-body-east",o,"body","east"))),this.areaFooterWest=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-footer ge-table-footer-west",o,"footer","west"))),this.areaFooterCenter=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-footer ge-table-footer-center",o,"footer","center"))),this.areaFooterEast=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-footer ge-table-footer-east",o,"footer","east"))),this.scrollViewport=i.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",i.applyStyleNoPadding(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-scroll-viewport",o,"body","center")))),this.contentWrapperDiv=i.applyStyleNoPadding(i.applyStylePosistionRelative(i.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=i.applyStyleNoPadding(i.applyStylePosistionRelative(i.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=i.appendRelativeChildDiv(i.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-header-border",o)),this.borderFixedWest=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-west-fixed-column-border",o)),this.borderFixedEast=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-east-fixed-column-border",o)),this.borderFooterTop=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-footer-border",o))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,i=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${i-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=i-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=i-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=i-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:`${i-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${i-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${i-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:`${i-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 A{constructor(e,t,i,s,o=!1){this.r1=e,this.c1=t,this.r2=i,this.c2=s,this.gammaRange=o}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class re{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 i=0;i<e;i++)for(let s=0;s<t;s++){let o=this.areaModel.getColspanAt(i,s),r=this.areaModel.getRowspanAt(i,s);if(o>1||r>1){o===0&&(o=1),r===0&&(r=1);const n=this.areaModel.hasOwnProperty("gammaCells");this.colAndRowspanRanges.push(new A(i,s,i+r-1,s+o-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const i of this.colAndRowspanRanges)if(i.isInRange(e,t))return!0}return!1}}class le{constructor(e,t,i){this.header=e,this.body=t,this.footer=i}}class ne extends oe{constructor(e,t,i,s){var r,n;super(e,t,i,s),this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new le,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.editing=!1,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),t.getAreaModel("body")instanceof B&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new re(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(){if(this.getSelectionModel){const e=this.getSelectionModel();e==null||e.clear()}}initRenderEditor(e,t){var s;let i=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(i||(i=this.tableOptions.getEditRenderer),i)if(this.editorRenderer=i(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const o=document.querySelector("input.ge-table-cell-editor-input");o&&o.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}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 T(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new T(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 T(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 T(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){e.forEach(t=>this.tableModel.getAreaModel(t.area).setValue(t.rowIndex,t.columnIndex,t.value)),this.repaint()}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),i=this.getStringByAttr(e,"data-side");if(i&&t)return[t,i]}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 i;if(e){const s=(i=e.closest("["+t+"]"))==null?void 0:i.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var i;if(e){const s=(i=e.closest("["+t+"]"))==null?void 0:i.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var h;const i=this.getArea(e,"west"),s=this.getArea(e,"center"),o=this.getArea(e,"east"),r=s.child.clientHeight;i.child.innerText="",s.child.innerText="",o.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),S=d.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let g=t;const f=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<S;u++){const v=g,x=u===S-1,C=this.tableModel.getRowHeight(e,u);if(v+C>0){this.firstVisibleRowIndex=u;let w={left:n,width:l,height:C,top:v,index:u},m=this.dom.addRowDiv(s,w,u,e,"center");const M=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:w,parent:m,rowIndex:u,columnIndexStart:M,columnIndexEnd:f-c-1,verticalFixed:!1,lastRowOfModel:x}),a.left>0&&(w={left:n,width:this.areaBodyWestGeo.width,height:C,top:v,index:u},m=this.dom.addRowDiv(i,w,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:w,parent:m,rowIndex:u,columnIndexStart:0,columnIndexEnd:M-1,verticalFixed:!0,lastRowOfModel:x})),a.right>0&&(w={left:n,width:this.areaBodyEastGeo.width,height:C,top:v,index:u},m=this.dom.addRowDiv(o,w,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:w,parent:m,rowIndex:u,columnIndexStart:f-c,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:x})),e==="header"&&this.tree&&u===S-1){const E=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new T(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),R=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(R){const D=this.dom.domService.createText(R.content);this.dom.domService.appendChild(E,D),R.style&&this.dom.applyStyleString(E,R.style)}}}if(g=g+C,g>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((h=this.colAndRowspanModels[e])==null?void 0:h.getRanges())??[];if(u.length)for(const v of u){let x=0,C=s.child,w="center";if(v.c1<b)C=i.child,w="west";else if(c>0&&v.c1>=f-c)C=o.child,w="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();x=this.scrollFactorX*m-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(v,x,t,d,C,w)}}}drawBigCell(e,t,i,s,o,r){const n=i+this.getRowHeights(0,e.r1-1,s).reduce((h,u)=>h+u,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let d=0;a>0&&e.c1>=l-a&&(d=l-a);const S=t+this.getColumnWidths(d,e.c1-1).reduce((h,u)=>h+u,0),g=this.getRowHeights(e.r1,e.r2,s).reduce((h,u)=>h+u,0),f=this.getColumnWidths(e.c1,e.c2).reduce((h,u)=>h+u,0);let c=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(c=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?(console.info("TODO here",e),this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:S,top:n,width:f,height:g,parent:o,cellSelected:c,lastRowOfModel:!0,gammaRange:e.gammaRange})):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:S,top:n,width:f,height:g,parent:o,cellSelected:c,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:S,cellTop:n,cellWidth:f,cellHeight:g,parent:o})}findRowOfImportantRowspanCell(e,t,i){const s=e.getMaxRowspan();for(let o=t-1;o>-1;o--){const r=e.getRowspanAt(o,i);if(r>1&&o+r+1>=t)return o;if(t-o>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:i,geo:s,parent:o,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:d=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let S=0;if(!a){const h=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*h}const g=0,f=!!(e==="body"&&t);let c=S;for(let h=n;h<=l;h++){const u=c,v=this.tableModel.getColumnWidth(h);if(v>0&&u+v>0){let x=s.height;const C=i.getRowspanAt(r,h),w=i.getColspanAt(r,h);C>1&&(x=this.getRowHeights(r,r+C-1,i).reduce((E,R)=>E+R,0));let m=v;w>1&&(m=this.getColumnWidths(h,h+w-1).reduce((E,R)=>E+R,0));let M=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(r,h)&&(M=!0),this.draggingTargetColumnIndex===h&&e!=="header"){this.renderDragTargetDiv(o,u,g,m,x);const E={left:u,top:g,width:m,height:x};this.dom.addColumnBorderDivs(this.tableOptions,o,E,e,t)}else{const E=this.renderSelectedBackgroundDiv(M,f,t,i,r,h,o,u,g,m,x);M||this.renderCell({areaModel:i,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:h,left:u,top:g,width:m,height:x,parent:o,cellSelected:E,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:h,cellLeft:u,cellTop:g,cellWidth:m,cellHeight:x,parent:o})}}if(c=c+v,c>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(c-1,1,s.height,0),o)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:i,rowIndex:s,index:o,left:r,width:n,height:l,top:a,parent:d,lastRowOfModel:S}){var W;const f=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===o?this.editorRenderer:e.getCellRenderer(s,o),c={left:r,width:n,height:l,top:a,index:o},b=e.getRowByIndex(s);let h="none";if(o===this.getTreeArrowColumnIndex()&&b instanceof L){const y=b;(W=y.children)!=null&&W.length?y.expanded?h="expanded":h="collapsed":h="hidden"}let v;if(t==="header"){const y=this.tableModel.getColumnDef(o);(!(y!=null&&y.sortIconVisible)||y!=null&&y.sortIconVisible())&&(v=y==null?void 0:y.sortState)}const x=e.getValueAt(s,o),C=f?"":`${x}`,w=e.isRowChecked(s),m=this.dom.addColumnDiv(d,c,s,o,t,i,C,h,this.tableOptions,w,v),M=e.getTooltipAt(s,o);M&&this.dom.setAttribute(m,"title",M);const E=this.tableModel.getColumnDef(o);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],m);let R;f&&(R=f.render(m,s,o,t,e,x,this.dom.domService));const D=e.getCustomClassesAt(s,o);if(D.length&&this.dom.addClasses(D,m),this.dom.addColumnBorderDivs(this.tableOptions,d,c,t,i),S&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},d),this.getFocusModel&&t==="body"){const y=this.getFocusModel();y!=null&&y.hasFocus(s,o)&&this.dom.addFocusBorderDivs(d,c,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const O=e.getCustomStyleAt(s,o);if(O)for(const y in O)this.dom.setStyle(m,y,O[y]);return[m,R]}getColumnWidths(e,t){const i=[];for(let s=e;s<=t;s++)i.push(this.tableModel.getColumnWidth(s));return i}getRowHeights(e,t,i){const s=[];for(let o=e;o<=t;o++)s.push(i.getRowHeight(o));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,i=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:i+"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,i=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,o=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:o+"px",top:"0px",width:i+"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)}renderDragTargetDiv(e,t,i,s,o){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",`${i}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${o}px`),r}renderSelectedBackgroundDiv(e,t,i,s,o,r,n,l,a,d,S){let g=!1;if(!e&&t&&s.isSelectable(o,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const c=f.getSelectionCount(o,r);g=c>0;for(let b=0;b<c;b++){const h=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${i}-selected-range`,n));this.dom.setStyle(h,"left",`${l}px`),this.dom.setStyle(h,"top",`${a}px`),this.dom.setStyle(h,"width",`${d}px`),this.dom.setStyle(h,"height",`${S}px`)}}}return g}renderCell({areaModel:e,areaIdent:t,sideIdent:i,rowIndex:s,columnIndex:o,left:r,top:n,width:l,height:a,parent:d,cellSelected:S,lastRowOfModel:g,gammaRange:f}){const[c,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:i,rowIndex:s,index:o,left:r,width:l,height:a,top:n,parent:d,lastRowOfModel:g,gammaRange:f});S&&this.dom.addClass(`ge-table-${t}-${i}-selected-range`,c),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:i,cellTop:s,cellWidth:o,cellHeight:r,parent:n}){const l=this.dom.domService,a=this.tableOptions.columnResizeHandleWidthInPx??2,d=l.createElement("div");l.setAttribute(d,"data-col-index",`${t}`),l.setAttribute(d,"data-row-index",`${e}`),l.setAttribute(d,"data-area","header"),l.setAttribute(d,"data-ge-action","resize-column"),l.addClass(d,"ge-table-column-resize-handle"),l.setStyle(d,"display","clip"),l.setStyle(d,"position","absolute"),l.setStyle(d,"cursor","col-resize"),l.setStyle(d,"left",`${i+o-a}px`),l.setStyle(d,"top",`${s}px`),l.setStyle(d,"width",`${a}px`),l.setStyle(d,"height",`${r}px`),l.appendChild(n,d)}}class ae{constructor(e,t){this.columnIndex=e,this.sortState=t}}class de{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,i=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),o=t.getAttribute("data-col-index");if(i&&s&&o){const r=V(i),n=Number(s),l=Number(o);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class he{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class _{constructor(e){this.cells=e}static createSingle(e,t){return new _([new he(e,t)])}}class ce{constructor(e){var t,i;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(i=this.tableScope.tableOptions)!=null&&i.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var o,r,n,l,a,d,S;let i=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const g=this.getSelectionModel(),f=this.getFocusModel();g&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),i=!0),(o=e.originalEvent)!=null&&o.shiftKey||g.hasSelection()&&(g.clear(),i=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(g.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,i=!0):(n=e.originalEvent)!=null&&n.ctrlKey||(l=e.originalEvent)!=null&&l.metaKey?(g.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,i=!0):(a=e.originalEvent)!=null&&a.altKey&&((d=e.originalEvent)!=null&&d.ctrlKey||(S=e.originalEvent)!=null&&S.metaKey)&&(g.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,i=!0))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),i}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),i=this.getFocusModel();if(t&&i){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,o]=i.getFocus();return t.togglePoint(s,o),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const i=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:i,columnIndex1:o,rowIndex2:s,columnIndex2:r})}}class pe{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","cmd -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class ue{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","cmd+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","cmd+x":"DESELECT_ALL","cmd+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"}}}class Se{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(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ue().get()):Object.assign(this.shortcutActionIdMapping,new pe().get()),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}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.findEnty(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit:",e);let t=!1;for(const i of this.listener)i.onActionTriggered(e)&&(t=!0);return t}findEnty(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens:",t);for(const i in this.shortcutActionIdMapping){const s=i.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[\+ ]/g).sort();if(this.areTokensEquals(t,s))return this.shortcutActionIdMapping[i]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}}class ge{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class fe extends ne{constructor(e,t,i,s,o){var r;if(super(e,t,new K(i),s),this.eventListener=o,this.selectionService=new ce(this),this.api=new U(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,o||(this.eventListener=new ge),(r=this.tableOptions)!=null&&r.autoRestoreOptions){const n=this.tableOptions.autoRestoreOptions,l=n.getStorageKeyFn;l&&(n.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new ee(l)),n.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new ie(l)),n.autoRestoreSortingState&&(this.storeSortingService=new se(l)))}this.mouseHandler=new q(this),this.inputHandler=new de(this),this.shortcutService=new Se(this),this.shortcutService.addListener(this.selectionService)}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[i,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(i,s)&&(this.clearSelection(),this.initRenderEditor(i,s))}return!0}return!1}updateModelValueAfterEdit(e,t,i,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,i,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(_.createSingle(t,i)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition()}createGeMouseEvent(e){const t=new P;if(t.originalEvent=e,e){const i=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(i),t.rowIndex=this.getNumberByAttr(i,"data-row-index"),t.columnIndex=this.getNumberByAttr(i,"data-col-index"),t.action=this.getStringByAttr(i,"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,o=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(o,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.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e){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.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&this.repaint(),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var i;const t=this.tableModel.getBodyModel();t instanceof B&&(t.toggleExpandCollapseAll(e),this.repaint(),(i=this.storeStateCollapsedExpandService)==null||i.collapsedStateAll(e))}toggleRowCheckbox(e,t,i){var l;const s=this.tableModel.getAreaModel(i),o=s.isRowChecked(e),r=o===void 0||o==="semi"||o==="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 i=this.selectionService.onMouseClicked(e,t);if(!i&&this.getFocusModel){const s=this.getFocusModel();s&&(i=s.hasChanged(),s.clearChanged(),i&&this.resetEditorRenderer())}this.eventListener.onMouseClicked(e),i&&this.debounce(this.repaint.bind(this),10)}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,i){var o,r;const s=this.tableModel.getColumnDef(i);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],d=new ae(i,a);this.tableModel.doSort([d])&&((o=this.tableModel.getColumnDefs())==null||o.forEach(g=>g.sortState=""),s.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const i=this.getFocusModel();if(i){const[s,o]=i.getFocus();return i.setFocus(s+t,o+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 i;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",(i=this.mouseHandler.mouseEvent)==null?void 0:i.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 i=this.storeScrollPosStateService.getScrollOffset();i&&this.scrollViewport.scrollTo(...i)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const i=this.storeSortingService.getSortItems();i!=null&&i.length&&this.tableModel.getBodyModel().doSort(i)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const i=this.tableOptions.autoRestoreOptions,s=i.getRowId;if(i.autoRestoreCollapsedExpandedState&&s){const o=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(r instanceof B){const n=r,l=r.getRowCount();for(let a=0;a<l;a++){const d=r.getRowByIndex(a);if(d)if(o.allExpanded)d.expanded=!0;else if(o.allCollapsed)d.expanded=!1;else{const S=s(d.data);o.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S):o.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S))}}n.recalcVisibleTreeRows()}}}}}class me{render(e,t,i,s,o,r,n){if(o.isEditable(t,i)){n.addClass(e,"ge-table-row-input-div");const l=o.getValueAt(t,i);e.innerHTML=`
9
+ <input
10
+ type="text"
11
+ value="${l}"
12
+ autofocus
13
+ onfocus="this.setSelectionRange(0, this.value.length)"
14
+ data-listen="change"
15
+ data-area="${s}"
16
+ data-row-index="${t}"
17
+ data-col-index="${i}"
18
+ data-input-type="text"
19
+ style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
20
+ class="ge-table-cell-editor-input">`}}}class be{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1}getSelectionCount(e,t){let i=0;for(const s of this.ranges)s.isInRange(e,t)&&i++;return this.allSelected&&i++,this.isInNegativeRange(e,t)&&(i=0),i}isInNegativeRange(e,t){for(const i of this.negativeRanges)if(i.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1}hasSelection(){return!!this.ranges.length}selectAll(){this.allSelected=!0}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=A.singleRow(e.r1):this.selectionType==="column"&&(t=A.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.addSelection(A.singleCell(e,t))}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e))}}class ye{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0)}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}const we=new be,ve=new ye("cell");class xe{constructor(){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={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new N,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new j,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new me,this.getSelectionModel=()=>we,this.getFocusModel=()=>ve}}class Ce{setStyle(e,t,i){return e.style[t]=i,e}appendText(e,t){const i=this.createText(t);return this.appendChild(e,i),i}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(i=>e.classList.add(i)):e.classList.add(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,i){e.setAttribute(t,i)}}function Ee({tableModel:p,tableOptions:e=new xe,mouseMoved:t,checkboxChanged:i,contextmenu:s,modelChanged:o,mouseClicked:r,mouseDragging:n,mouseDraggingEnd:l,tableReady:a}){const d=k.useRef(null);let S=!1;k.useEffect(()=>{d.current&&!S&&(g(d.current),S=!0)});const g=f=>{const c={onCheckboxChanged:h=>{i&&i(h)},onContextmenu:h=>{s&&s(h)},onModelChanged:h=>{o&&o(h)},onMouseClicked:h=>{r&&r(h)},onMouseDragging:h=>{n&&n(h)},onMouseDraggingEnd:h=>{l&&l(h)},onMouseMoved:h=>{t&&t(h)}},b=new fe(f,p,new Ce,e,c);b.firstInit(),a&&a(b.getApi())};return z.jsx("div",{ref:d,className:"container-div",style:{width:"100%",height:"100%",backgroundColor:"transparent",padding:"0",margin:"0"}})}var $,F=X;if(process.env.NODE_ENV==="production")$=F.createRoot,F.hydrateRoot;else{var G=F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;$=function(p,e){G.usingClientEntryPoint=!0;try{return F.createRoot(p,e)}finally{G.usingClientEntryPoint=!1}}}class Ae{constructor(e){this.Component=e,console.info(e)}render(e,t,i,s,o,r,n){const l={cellDiv:e,rowIndex:t,columnIndex:i,areaIdent:s,areaModel:o,cellValue:r},a=$(e,{});return a.render(this.Component(l)),()=>{a.unmount()}}}exports.ComponentRendererWrapper=Ae;exports.GuiexpertTable=Ee;