@guiexpert/react-table 0.0.1 → 1.0.2

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