@guiexpert/react-table 18.0.0 → 18.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.cjs CHANGED
@@ -1,20 +1,254 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react/jsx-runtime"),N=require("react"),J=require("react-dom");function O(p){return p&&p.type==="TreeRow"}function $(p){return p&&p.type==="AreaModelTree"}class W{constructor(e=-1,t=-1,s=-1,i=-1,o,r,n,l=0,a=0,d=0,S=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=i,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=a,this.draggingY=d,this.action=S}clone(){return new W(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class D{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class z{constructor(e=new D(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new D(">","",["ge-table-tree-arrow-collapsed"]),s=new D(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new D("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=i}}class K{constructor(e=new D("↑","",["ge-header-sorted-asc"]),t=new D("↓","",["ge-header-sorted-desc"]),s=new D("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class Q{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}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(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,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}`),i==="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",`${s}`),this.domService.setAttribute(l,"data-area",`${i}`),r){const a=this.domService.createText(r);this.domService.appendChild(l,a)}return this.domService.appendChild(e.child,l),l}addColumnDiv(e,t,s=-1,i=-1,o,r,n="",l,a,d=void 0,S){const g=a==null?void 0:a.treeOptions,m=a==null?void 0:a.showCheckboxWihoutExtraColumn,h=this.domService.createElement("div");this.domService.addClass(h,"ge-table-col-div"),this.domService.addClass(h,`ge-table-col-div-${t.index}`),this.domService.setAttribute(h,"data-col-index",`${t.index}`),this.domService.setAttribute(h,"data-row-index",`${s}`),this.domService.setAttribute(h,"data-area",`${o}`);const f=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(h,`ge-table-column-${f}`),this.domService.setStyle(h,"display","clip"),this.domService.setStyle(h,"position","absolute"),this.domService.setStyle(h,"left",`${t.left}px`),this.domService.setStyle(h,"top",`${t.top}px`),this.domService.setStyle(h,"width",`${t.width}px`),this.domService.setStyle(h,"height",`${t.height}px`),l&&l!=="none"&&(this.domService.addClass(h,"ge-table-col-tree"),this.addArrowDiv(h,l,g,s,i,o)),m&&i===0&&d&&this.addCheckboxToDiv(h,d,o,s),n){const c=l!=="none"&&i===0;this.addLabelDiv(h,n,c,s,i,o)}return S&&this.addSortedIcon(h,S,a==null?void 0:a.sortedOptions,i),this.domService.appendChild(e,h),h}addCheckboxToDiv(e,t,s,i){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("react/jsx-runtime"),K=require("react"),ie=require("react-dom");class k{constructor(){this.alreadySet=!1}static getInstance(){return k.instance||(k.instance=new k),k.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function H(p){return p&&p.type==="TreeRow"}function W(p){return p&&p.type==="AreaModelTree"}class _{constructor(e=-1,t=-1,o=-1,s=-1,i,r,a,l=0,n=0,d=0,c=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=o,this.columnLeft=s,this.areaIdent=i,this.sideIdent=r,this.originalEvent=a,this.clickCount=l,this.draggingX=n,this.draggingY=d,this.action=c}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 D{constructor(e=">",t="",o=[]){this.content=e,this.style=t,this.classes=o}}class Q{constructor(e=new D(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new D(">","",["ge-table-tree-arrow-collapsed"]),o=new D(">","color:transparent;",["gt-table-tree-arrow-hidden"]),s=new D("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=o,this.arrowExpandCollapseAll=s}}class Z{constructor(e=new D("↑","",["ge-header-sorted-asc"]),t=new D("↓","",["ge-header-sorted-desc"]),o=new D("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=o}}class re{constructor(e){this.domService=e}setStyle(e,t,o){return this.domService.setStyle(e,t,o),e}applyStyle(e,t){for(const o in t)this.domService.setStyle(e,o,t[o]);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(([o,s])=>this.domService.setStyle(e,o,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",o){return this.domService.setStyle(o,"overflow-x",e),this.domService.setStyle(o,"overflow-y",t),o}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 o=this.domService.createText(t);return this.domService.appendChild(e,o),o}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(o=>this.domService.addClass(t,o)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(o=>this.domService.removeClass(t,o)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const o of e)this.domService.addClass(t,o);return t}setAttribute(e,t,o){return t&&o&&this.domService.setAttribute(e,t,o),e}createAreaDivWithClass(e,t,o,s){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",o),this.domService.setAttribute(i,"data-side",s),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.appendChild(t,o),o}addRowDiv(e,t,o=-1,s,i,r=""){const a=t.index??-1,l=this.getDivOrCreateDiv(a,e);if(this.domService.addClass(l,"ge-table-row-div"),this.domService.addClass(l,`ge-table-row-div-${t.index}`),s==="body"&&i==="center"){const n=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(l,`ge-table-row-${n}`)}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",`${o}`),this.domService.setAttribute(l,"data-area",`${s}`),r){const n=this.domService.createText(r);this.domService.appendChild(l,n)}return this.domService.appendChild(e.child,l),l}addColumnDiv(e){const{parent:t,geo:o,rowIndex:s=-1,columnIndex:i=-1,areaIdent:r,sideIdent:a,text:l="",treeArrow:n,tableOptions:d,checkedType:c=void 0,sortState:h}=e,f=d==null?void 0:d.treeOptions,u=d==null?void 0:d.showCheckboxWihoutExtraColumn,S=this.domService.createElement("div");this.domService.addClass(S,"ge-table-col-div"),this.domService.addClass(S,`ge-table-col-div-${o.index}`),this.domService.setAttribute(S,"data-col-index",`${o.index}`),this.domService.setAttribute(S,"data-row-index",`${s}`),this.domService.setAttribute(S,"data-area",`${r}`);const b=((o==null?void 0:o.index)??0)%2===0?"even":"odd";if(r==="body"&&a==="center"&&this.domService.addClass(S,`ge-table-column-${b}`),this.domService.setStyle(S,"display","clip"),this.domService.setStyle(S,"position","absolute"),this.domService.setStyle(S,"left",`${o.left}px`),this.domService.setStyle(S,"top",`${o.top}px`),this.domService.setStyle(S,"width",`${o.width}px`),this.domService.setStyle(S,"height",`${o.height}px`),n&&n!=="none"&&(this.domService.addClass(S,"ge-table-col-tree"),this.addArrowDiv(S,n,f,s,i,r)),u&&i===0&&c&&this.addCheckboxToDiv(S,c,r,s),l){const g=n!=="none"&&i===0;this.addLabelDiv(S,l,g,s,i,r)}return h&&this.addSortedIcon(S,h,d==null?void 0:d.sortedOptions,i),this.domService.appendChild(t,S),S}addCheckboxToDiv(e,t,o,s){const i=this.domService.createElement("div"),r=t==="full"?"checked":"";return i.innerHTML=`
2
2
  <input
3
3
  type="checkbox"
4
- data-area="${s}"
5
- data-row-index="${i}"
4
+ data-area="${o}"
5
+ data-row-index="${s}"
6
6
  data-input-type="checkbox"
7
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 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",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(s){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",`${i}`),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="",s=new K,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 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",s=new z,i=-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",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=s.arrowExpanded:t==="collapsed"?l=s.arrowCollapsed:l=s.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,s,i,o){if(e.verticalBorderVisible){const r=`ge-table-${i}-${o}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${i}-${o}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-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-body-center-vertical-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)}}const H=p=>p==="header"?"header":p==="footer"?"footer":"body";class Z{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 s=e.getAttribute("data-area");if(s&&(this.areaIdent=H(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const i=e;this.value=i.value}}}}class ee{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 Z(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(O(t.row)&&t.areaModel){const s=t.colIdx===this.getArrowColumnIndex()&&e.altKey,i=t.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){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 s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(t.rowIdx,t.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),i=H(s),o=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=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 l=n.getRowByIndex(o);if(s&&i==="body"&&n.isEditable(o,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(o,r)),O(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 s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld)}updateCollapsedExpandedState(e){var s,i,o,r,n;const t=(i=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:i.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 te{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}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 P{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 se extends P{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 ie{constructor(e="collapsed",t=[],s=!1,i=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=i}}class oe extends P{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new ie,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 le extends P{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 T{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 re{constructor(e,t,s,i){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=i,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=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.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=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.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=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.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:`${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.tableOptions.footerSeparatorBorderVisible&&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()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class R{constructor(e,t,s,i,o=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=i,this.gammaRange=o}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new R(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new R(e,t,e,t)}static singleRow(e){return new R(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new R(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class ne{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);if(o>1||r>1){o===0&&(o=1),r===0&&(r=1);const n=this.areaModel.hasOwnProperty("gammaCells");this.colAndRowspanRanges.push(new R(s,i,s+r-1,i+o-1,n))}}}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 ae{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class de extends re{constructor(e,t,s,i){var r,n;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.colAndRowspanModels=new ae,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"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new ne(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 i;let s=(i=this.tableModel.getColumnDef(t))==null?void 0:i.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(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,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}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){var s;if(e){const i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return Number(i)}return-1}getStringByAttr(e,t){var s;if(e){const i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return i}return""}adjustArea(e,t=0){var c;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 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 m=this.tableModel.getColumnCount(),h=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<S;u++){const w=g,C=u===S-1,x=this.tableModel.getRowHeight(e,u);if(w+x>0){this.firstVisibleRowIndex=u;let y={left:n,width:l,height:x,top:w,index:u},v=this.dom.addRowDiv(i,y,u,e,"center");const E=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:y,parent:v,rowIndex:u,columnIndexStart:E,columnIndexEnd:m-h-1,verticalFixed:!1,lastRowOfModel:C}),a.left>0&&(y={left:n,width:this.areaBodyWestGeo.width,height:x,top:w,index:u},v=this.dom.addRowDiv(s,y,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:y,parent:v,rowIndex:u,columnIndexStart:0,columnIndexEnd:E-1,verticalFixed:!0,lastRowOfModel:C})),a.right>0&&(y={left:n,width:this.areaBodyEastGeo.width,height:x,top:w,index:u},v=this.dom.addRowDiv(o,y,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:y,parent:v,rowIndex:u,columnIndexStart:m-h,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&u===S-1){const A=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(v,new T(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),M=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(M){const I=this.dom.domService.createText(M.content);this.dom.domService.appendChild(A,I),M.style&&this.dom.applyStyleString(A,M.style)}}}if(g=g+x,g>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((c=this.colAndRowspanModels[e])==null?void 0:c.getRanges())??[];if(u.length)for(const w of u){let C=0,x=i.child,y="center";if(w.c1<f)x=s.child,y="west";else if(h>0&&w.c1>=m-h)x=o.child,y="east";else{const v=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*v-this.areaBodyWestGeo.width,y="center"}this.drawBigCell(w,C,t,d,x,y)}}}drawBigCell(e,t,s,i,o,r){const n=s+this.getRowHeights(0,e.r1-1,i).reduce((c,u)=>c+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((c,u)=>c+u,0),g=this.getRowHeights(e.r1,e.r2,i).reduce((c,u)=>c+u,0),m=this.getColumnWidths(e.c1,e.c2).reduce((c,u)=>c+u,0);let h=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(h=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?(console.info("TODO here",e),this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:S,top:n,width:m,height:g,parent:o,cellSelected:h,lastRowOfModel:!0,gammaRange:e.gammaRange})):this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:S,top:n,width:m,height:g,parent:o,cellSelected:h,lastRowOfModel:!0,gammaRange:e.gammaRange}),i.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:S,cellTop:n,cellWidth:m,cellHeight:g,parent: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:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:d=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let S=0;if(!a){const c=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*c}const g=0,m=!!(e==="body"&&t);let h=S;for(let c=n;c<=l;c++){const u=h,w=this.tableModel.getColumnWidth(c);if(w>0&&u+w>0){let C=i.height;const x=s.getRowspanAt(r,c),y=s.getColspanAt(r,c);x>1&&(C=this.getRowHeights(r,r+x-1,s).reduce((A,M)=>A+M,0));let v=w;y>1&&(v=this.getColumnWidths(c,c+y-1).reduce((A,M)=>A+M,0));let E=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,c)&&(E=!0),this.draggingTargetColumnIndex===c&&e!=="header"){this.renderDragTargetDiv(o,u,g,v,C);const A={left:u,top:g,width:v,height:C};this.dom.addColumnBorderDivs(this.tableOptions,o,A,e,t)}else{const A=this.renderSelectedBackgroundDiv(E,m,t,s,r,c,o,u,g,v,C);E||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:c,left:u,top:g,width:v,height:C,parent:o,cellSelected:A,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:c,cellLeft:u,cellTop:g,cellWidth:v,cellHeight:C,parent:o})}}if(h=h+w,h>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(h-1,1,i.height,0),o)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:n,height:l,top:a,parent:d,lastRowOfModel:S,gammaRange:g}){var k;const h=this.editorRenderer&&this.editorRendererRow===i&&this.editorRendererColumn===o?this.editorRenderer:e.getCellRenderer(i,o),f={left:r,width:n,height:l,top:a,index:o},c=e.getRowByIndex(i);let u="none";if(o===this.getTreeArrowColumnIndex()&&O(c)){const b=c;(k=b.children)!=null&&k.length?b.expanded?u="expanded":u="collapsed":u="hidden"}let C;if(t==="header"){const b=this.tableModel.getColumnDef(o);(!(b!=null&&b.sortIconVisible)||b!=null&&b.sortIconVisible())&&(C=b==null?void 0:b.sortState)}const x=e.getValueAt(i,o),y=h?"":`${x}`,v=e.isRowChecked(i),E=this.dom.addColumnDiv(d,f,i,o,t,s,y,u,this.tableOptions,v,C),A=e.getTooltipAt(i,o);A&&this.dom.setAttribute(E,"title",A);const M=this.tableModel.getColumnDef(o);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],E);let I;h&&(I=h.render(E,i,o,t,e,x,this.dom.domService));const G=e.getCustomClassesAt(i,o);if(G.length&&this.dom.addClasses(G,E),this.dom.addColumnBorderDivs(this.tableOptions,d,f,t,s),S&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},d),this.getFocusModel&&t==="body"){const b=this.getFocusModel();b!=null&&b.hasFocus(i,o)&&this.dom.addFocusBorderDivs(d,f,{})}t==="header"&&this.dom.setAttribute(E,"data-ge-action","drag-column");const L=e.getCustomStyleAt(i,o);if(L)for(const b in L)this.dom.setStyle(E,b,L[b]);return[E,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,i])=>{i?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:i,cssClasses:o}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let a;const S=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s?this.editorRenderer:r.getCellRenderer(t,s);if(l.innerText="",this.applyCssClasses(l,o),S)a=S.render(l,t,s,e,r,i,this.dom.domService),a&&this.cleanupFunctions[e].push(a);else{const h=`${i}`;this.dom.addLabelDiv(l,h,!1,t,s,e)}const g=r.getCustomClassesAt(t,s);g.length&&this.dom.addClasses(g,l);const m=r.getCustomStyleAt(t,s);if(m)for(const h in m)this.dom.setStyle(l,h,m[h])}}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=this.areaBodyWestGeo.width,o=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-i;this.dom.applyStyle(this.hoverColumn,{left:o+"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,n,l,a,d,S){let g=!1;if(!e&&t&&i.isSelectable(o,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const h=m.getSelectionCount(o,r);g=h>0;for(let f=0;f<h;f++){const c=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(c,"left",`${l}px`),this.dom.setStyle(c,"top",`${a}px`),this.dom.setStyle(c,"width",`${d}px`),this.dom.setStyle(c,"height",`${S}px`)}}}return g}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,columnIndex:o,left:r,top:n,width:l,height:a,parent:d,cellSelected:S,lastRowOfModel:g,gammaRange:m}){const[h,f]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:l,height:a,top:n,parent:d,lastRowOfModel:g,gammaRange:m});S&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,h),f&&this.cleanupFunctions[t].push(f)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:i,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",`${s+o-a}px`),l.setStyle(d,"top",`${i}px`),l.setStyle(d,"width",`${a}px`),l.setStyle(d,"height",`${r}px`),l.appendChild(n,d)}}class he{constructor(e,t){this.columnIndex=e,this.sortState=t}}class ce{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=H(s),n=Number(i),l=Number(o);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class pe{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class V{constructor(e){this.cells=e}static createSingle(e,t){return new V([new pe(e,t)])}}class ue{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var o,r,n,l,a,d,S;let s=!1,i=!1;if(this.getSelectionModel&&this.getFocusModel){const g=this.getSelectionModel(),m=this.getFocusModel();g&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),s=!0),(o=e.originalEvent)!=null&&o.shiftKey||g.hasSelection()&&(g.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(g.addSelection(this.createRangeByEvents(e,this.previousEvt)),i=!0,s=!0):(n=e.originalEvent)!=null&&n.ctrlKey||(l=e.originalEvent)!=null&&l.metaKey?(g.addSelection(R.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0):(a=e.originalEvent)!=null&&a.altKey&&((d=e.originalEvent)!=null&&d.ctrlKey||(S=e.originalEvent)!=null&&S.metaKey)&&(g.removeSelection(R.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0))}return i?this.previousEvt=void 0:this.previousEvt=e==null?void 0: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==null?void 0:t.rowIndex),i=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 R.create({rowIndex1:s,columnIndex1:o,rowIndex2:i,columnIndex2:r})}}class Se{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 ge{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 me{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 ge().get()):Object.assign(this.shortcutActionIdMapping,new Se().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 s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEnty(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens:",t);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 j{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class Y{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}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class fe{render(e,t,s,i,o,r,n){if(o.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const l=o.getValueAt(t,s);e.innerHTML=`
8
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-1,i=-1,r="body"){const a=this.domService.createElement("div");if(this.domService.addClass(a,"ge-table-label-div"),this.domService.setStyle(a,"position","relative"),this.domService.setStyle(a,"background","transparent"),this.domService.setStyle(a,"width","100%"),this.domService.setStyle(a,"height","100%"),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(a,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(a,l);const n=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,n),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,a),a}addSortedIcon(e,t="",o=new Z,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const a=r.content,l=this.domService.createText(a);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const n of r.classes)this.domService.addClass(i,n);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",o=new Q,s=-1,i=-1,r="body"){const a=this.domService.createElement("div");this.domService.addClass(a,"ge-table-tree-arrow-div"),this.domService.setStyle(a,"display","inline-block"),this.domService.setStyle(a,"position",""),this.domService.setStyle(a,"width","20px"),this.domService.setStyle(a,"background","transparent"),this.domService.setStyle(a,"cursor","pointer"),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const n=l.content,d=this.domService.createText(n);this.domService.appendChild(a,d),l.style&&this.applyStyleString(a,l.style);for(const c of l.classes)this.domService.addClass(a,c);return this.domService.appendChild(e,a),a}addColumnBorderDivs(e,t,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const V=p=>p==="header"?"header":p==="footer"?"footer":"body";class le{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=V(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class ae{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const o=new le(e.target,this.tableScope);if(o.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(o.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(o),e.preventDefault(),e.stopPropagation();else if(o.inputType==="checkbox"&&o.areaIdent)this.tableScope.toggleRowCheckbox(o.rowIdx,o.colIdx,o.areaIdent),e.preventDefault(),e.stopPropagation();else if(H(o.row)&&o.areaModel){const s=o.colIdx===this.getArrowColumnIndex()&&e.altKey,i=o.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){e.preventDefault(),e.stopPropagation();const r=o.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in o.areaModel&&o.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(o.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(o.rowIdx,o.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,o=t.getAttribute("data-area"),s=V(o),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),a=this.tableScope.tableModel.getAreaModel(s);if(o&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const l=a.getRowByIndex(i);if(o&&s==="body"&&a.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),H(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const n=l;n.expanded=!n.expanded,"recalcVisibleTreeRows"in a&&a.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(n)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var o,s,i,r,a;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,n=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,d=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,c=t(e.data);n?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(c):d&&((a=this.tableScope.storeStateCollapsedExpandService)==null||a.collapsedStateIdsRemove(c))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class ne{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class z{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const o=e;for(const s of[...o]){const[i,r]=s;t[i]=r}}return t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class de extends z{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class ce{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class he extends z{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new ce,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class ge extends z{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SORTING_STATE,s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class T{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}class pe{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new T,this.areaBodyCenterGeo=new T,this.areaBodyEastGeo=new T;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class E{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new E(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new E(e,t,e,t)}static singleRow(e){return new E(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new E(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class be{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const a="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new E(o,s,o+r-1,s+i-1,a))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class ue{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class Se extends pe{constructor(e,t,o,s){var r,a;super(e,t,o,s),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new ue,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(a=this.tableOptions)!=null&&a.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),W(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var n;this.colAndRowspanModels[l]=new be(t,t.getAreaModel(l)),(n=this.colAndRowspanModels[l])==null||n.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),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,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),a='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(a);if(l){let n;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o?this.editorRenderer:r.getCellRenderer(t,o);if(l.innerText="",this.applyCssClasses(l,i),c)n=c.render(l,t,o,e,r,s,this.dom.domService),n&&this.cleanupFunctions[e].push(n);else{const u=`${s}`;this.dom.addLabelDiv(l,u,!1,t,o,e)}const h=r.getCustomClassesAt(t,o);h.length&&this.dom.addClasses(h,l);const f=r.getCustomStyleAt(t,o);if(f)for(const u in f)this.dom.setStyle(l,u,f[u])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var b;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const a=0,l=this.areaBodyCenterGeo.width,n=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),c=d.getRowCount();for(;this.cleanupFunctions[e].length;){const g=this.cleanupFunctions[e].shift();g&&g()}let h=t;const f=this.tableModel.getColumnCount(),u=this.tableModel.getFixedRightColumnCount(),S=this.tableModel.getFixedLeftColumnCount();for(let g=0;g<c;g++){const v=h,m=g===c-1,x=this.tableModel.getRowHeight(e,g);if(v+x>0){this.firstVisibleRowIndex=g;let w={left:a,width:l,height:x,top:v,index:g},y=this.dom.addRowDiv(s,w,g,e,"center");const R=S;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:w,parent:y,rowIndex:g,columnIndexStart:R,columnIndexEnd:f-u-1,verticalFixed:!1,lastRowOfModel:m}),n.left>0&&(w={left:a,width:this.areaBodyWestGeo.width,height:x,top:v,index:g},y=this.dom.addRowDiv(o,w,g,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:w,parent:y,rowIndex:g,columnIndexStart:0,columnIndexEnd:R-1,verticalFixed:!0,lastRowOfModel:m})),n.right>0&&(w={left:a,width:this.areaBodyEastGeo.width,height:x,top:v,index:g},y=this.dom.addRowDiv(i,w,g,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:w,parent:y,rowIndex:g,columnIndexStart:f-u,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:m})),e==="header"&&this.tree&&g===c-1){const A=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(y,new T(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),M=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(M){const O=this.dom.domService.createText(M.content);this.dom.domService.appendChild(A,O),M.style&&this.dom.applyStyleString(A,M.style)}}}if(h=h+x,h>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const g=((b=this.colAndRowspanModels[e])==null?void 0:b.getRanges())??[];if(g.length)for(const v of g){let m=0,x=s.child,w="center";if(v.c1<S)x=o.child,w="west";else if(u>0&&v.c1>=f-u)x=i.child,w="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();m=this.scrollFactorX*y-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(v,m,t,d,x,w)}}}drawBigCell(e,t,o,s,i,r){const a=o+this.getRowHeights(0,e.r1-1,s).reduce((b,g)=>b+g,0),l=this.tableModel.getColumnCount(),n=this.tableModel.getFixedRightColumnCount();let d=0;n>0&&e.c1>=l-n&&(d=l-n);const c=t+this.getColumnWidths(d,e.c1-1).reduce((b,g)=>b+g,0),h=this.getRowHeights(e.r1,e.r2,s).reduce((b,g)=>b+g,0),f=this.getColumnWidths(e.c1,e.c2).reduce((b,g)=>b+g,0);let u=!1;const S=this.getSelectionModel?this.getSelectionModel():void 0;S&&(u=S.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:a,width:f,height:h,parent:i,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:a,width:f,height:h,parent:i,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:c,cellTop:a,cellWidth:f,cellHeight:h,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:a,columnIndexEnd:l,verticalFixed:n=!1,lastRowOfModel:d=!1}){var S;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let c=0;if(!n){const b=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();c=this.scrollFactorX*b}const h=0,f=!!(e==="body"&&t);let u=c;for(let b=a;b<=l;b++){const g=u,v=this.tableModel.getColumnWidth(b);if(v>0&&g+v>0){let m=s.height;const x=o.getRowspanAt(r,b),w=o.getColspanAt(r,b);x>1&&(m=this.getRowHeights(r,r+x-1,o).reduce((A,M)=>A+M,0));let y=v;w>1&&(y=this.getColumnWidths(b,b+w-1).reduce((A,M)=>A+M,0));let R=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(S=this.colAndRowspanModels[e])!=null&&S.isInRange(r,b)&&(R=!0),this.draggingTargetColumnIndex===b&&e!=="header"){this.renderDragTargetDiv(i,g,h,y,m);const A={left:g,top:h,width:y,height:m};this.dom.addColumnBorderDivs(this.tableOptions,i,A,e,t)}else{const A=this.renderSelectedBackgroundDiv(R,f,t,o,r,b,i,g,h,y,m);"gammaCells"in o&&o.getValueAt(r,b)&&(R=!1),R||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:b,left:g,top:h,width:y,height:m,parent:i,cellSelected:A,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:b,cellLeft:g,cellTop:h,cellWidth:y,cellHeight:m,parent:i})}}if(u=u+v,u>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(u-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:a,height:l,top:n,parent:d,lastRowOfModel:c}){var X;const f=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),u={left:r,width:a,height:l,top:n,index:i},S=e.getRowByIndex(s);let b="none";if(i===this.getTreeArrowColumnIndex()&&H(S)){const C=S;(X=C.children)!=null&&X.length?C.expanded?b="expanded":b="collapsed":b="hidden"}let v;if(t==="header"){const C=this.tableModel.getColumnDef(i);(!(C!=null&&C.sortIconVisible)||C!=null&&C.sortIconVisible())&&(v=C==null?void 0:C.sortState)}const m=e.getValueAt(s,i),x=f?"":`${m}`,w=e.isRowChecked(s),y=this.dom.addColumnDiv({parent:d,geo:u,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:x,treeArrow:b,tableOptions:this.tableOptions,checkedType:w,sortState:v}),R=e.getTooltipAt(s,i);R&&this.dom.setAttribute(y,"title",R);const A=this.tableModel.getColumnDef(i);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],y);let M;f&&(M=f.render(y,s,i,t,e,m,this.dom.domService));const O=e.getCustomClassesAt(s,i);if(O.length&&this.dom.addClasses(O,y),this.dom.addColumnBorderDivs(this.tableOptions,d,u,t,o),c&&this.dom.addHorizontalBorder({left:r,width:a,height:l,top:n+l},d),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(s,i)&&this.dom.addFocusBorderDivs(d,u,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const P=e.getCustomStyleAt(s,i);if(P)for(const C in P)this.dom.setStyle(y,C,P[C]);return[y,M]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,a=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const d={left:((i=e.originalEvent)==null?void 0:i.clientX)-a/2,width:a,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,d),o&&this.renderContentOfDraggingColumn(d)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const a=e.index??0,l=this.draggingColumn;for(let n=0;n<r;n++){const d=o,c=i.getRowHeight(n),h={left:0,width:e.width,height:c,top:d,index:n},f=i.getValueAt(n,a),u=i.getCellRenderer(n,a),S=u?"":`${f}`,b={parent:l,geo:h,rowIndex:n,columnIndex:a,areaIdent:t,sideIdent:s,text:S},g=this.dom.addColumnDiv(b);let v;u&&(v=u.render(g,n,a,t,i,f,this.dom.domService),v&&this.cleanupFunctions[t].push(v));const m=i.getCustomClassesAt(n,a);m.length&&this.dom.addClasses(m,g);const x=this.tableModel.getColumnDef(a);x&&x.classes[t]&&this.dom.addClasses(x.classes[t],g),this.dom.addColumnBorderDivs(this.tableOptions,l,h,t,s);const w=i.getCustomStyleAt(n,a);if(w)for(const y in w)this.dom.setStyle(g,y,w[y]);o=o+c}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,a,l,n,d,c){let h=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const u=f.getSelectionCount(i,r);h=u>0;for(let S=0;S<u;S++){const b=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,a));this.dom.setStyle(b,"left",`${l}px`),this.dom.setStyle(b,"top",`${n}px`),this.dom.setStyle(b,"width",`${d}px`),this.dom.setStyle(b,"height",`${c}px`)}}}return h}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:a,width:l,height:n,parent:d,cellSelected:c,lastRowOfModel:h}){const[f,u]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:n,top:a,parent:d,lastRowOfModel:h});c&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,f),u&&this.cleanupFunctions[t].push(u)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:a}){const l=this.dom.domService,n=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",`${o+i-n}px`),l.setStyle(d,"top",`${s}px`),l.setStyle(d,"width",`${n}px`),l.setStyle(d,"height",`${r}px`),l.appendChild(a,d)}}class fe{constructor(e,t){this.columnIndex=e,this.sortState=t}}class me{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=V(o),a=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,a,l,t.value)}}}}class ye{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class N{constructor(e){this.cells=e}static createSingle(e,t){return new N([new ye(e,t)])}}class ve{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,a,l,n,d,c;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const h=this.getSelectionModel(),f=this.getFocusModel();h&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(f),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||h.hasSelection()&&(h.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(h.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(a=e.originalEvent)!=null&&a.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(n=e.originalEvent)!=null&&n.metaKey)?(h.removeSelection(E.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey?(h.addSelection(E.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(h.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(h))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class we{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class Ce{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class xe{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.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new Ce().get()):Object.assign(this.shortcutActionIdMapping,new we().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const o in this.shortcutActionIdMapping){const s=o.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,s))return this.shortcutActionIdMapping[o]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])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()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class Y{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class ee{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class Ee{render(e,t,o,s,i,r,a){if(i.isEditable(t,o)){a.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
9
9
  <input
10
10
  type="text"
11
11
  value="${l}"
12
12
  autofocus
13
13
  onfocus="this.setSelectionRange(0, this.value.length)"
14
14
  data-listen="change"
15
- data-area="${i}"
15
+ data-area="${s}"
16
16
  data-row-index="${t}"
17
- data-col-index="${s}"
17
+ data-col-index="${o}"
18
18
  data-input-type="text"
19
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 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=R.singleRow(e.r1):this.selectionType==="column"&&(t=R.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(R.singleCell(e,t)):this.addSelection(R.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 ve=new be,Ce=new ye("cell");class q{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 z,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new K,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new fe,this.getSelectionModel=()=>ve,this.getFocusModel=()=>Ce}}class _ extends de{constructor(e,t,s,i,o){var r;if(super(e,t,new Q(s),i),this.eventListener=o,this.selectionService=new ue(this),this.api=new te(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,o||(this.eventListener=new j),(r=this.tableOptions)!=null&&r.autoRestoreOptions){const n=this.tableOptions.autoRestoreOptions,l=n.getStorageKeyFn;l&&(n.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new se(l)),n.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new oe(l)),n.autoRestoreSortingState&&(this.storeSortingService=new le(l)))}this.mouseHandler=new ee(this),this.inputHandler=new ce(this),this.shortcutService=new me(this),this.shortcutService.addListener(this.selectionService)}static create(e,t,s=new q,i=new j,o=new Y){return new _(e,t,o,s,i)}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[s,i]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,i)&&(this.clearSelection(),this.initRenderEditor(s,i))}return!0}return!1}updateModelValueAfterEdit(e,t,s,i){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,i)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(V.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new W;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"),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=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();$(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var l;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 n=(l=i.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){const i=this.getFocusModel();i&&(s=i.hasChanged(),i.clearChanged(),s&&this.resetEditorRenderer())}this.eventListener.onMouseClicked(e),s&&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,s){var o,r;const i=this.tableModel.getColumnDef(s);if(i!=null&&i.sortable&&i.sortable()){e.preventDefault(),e.stopPropagation();const n=i.sortStatesOrder?i.sortStatesOrder:this.tableOptions.sortOrder,l=i.sortState??"",a=n[(n.indexOf(l)+1)%n.length],d=new he(s,a);this.tableModel.doSort([d])&&((o=this.tableModel.getColumnDefs())==null||o.forEach(g=>g.sortState=""),i.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[i,o]=s.getFocus();return s.setFocus(i+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 s;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",(s=this.mouseHandler.mouseEvent)==null?void 0:s.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 s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,i=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&i){const o=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if($(r)){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=i(d.data);o.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S):o.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S))}}n.recalcVisibleTreeRows()}}}}}function xe({tableModel:p,tableOptions:e=new q,mouseMoved:t,checkboxChanged:s,contextmenu:i,modelChanged:o,mouseClicked:r,mouseDragging:n,mouseDraggingEnd:l,tableReady:a}){const d=N.useRef(null);let S=!1;N.useEffect(()=>{d.current&&!S&&(g(d.current),S=!0)});const g=m=>{const h={onCheckboxChanged:c=>{s&&s(c)},onContextmenu:c=>{i&&i(c)},onModelChanged:c=>{o&&o(c)},onMouseClicked:c=>{r&&r(c)},onMouseDragging:c=>{n&&n(c)},onMouseDraggingEnd:c=>{l&&l(c)},onMouseMoved:c=>{t&&t(c)}},f=new _(m,p,new Y,e,h);f.firstInit(),a&&a(f.getApi())};return U.jsx("div",{ref:d,className:"container-div",style:{width:"100%",height:"100%",background:"transparent",padding:"0",margin:"0"}})}var B,F=J;if(process.env.NODE_ENV==="production")B=F.createRoot,F.hydrateRoot;else{var X=F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;B=function(p,e){X.usingClientEntryPoint=!0;try{return F.createRoot(p,e)}finally{X.usingClientEntryPoint=!1}}}class we{constructor(e){this.Component=e,console.info(e)}render(e,t,s,i,o,r,n){const l={cellDiv:e,rowIndex:t,columnIndex:s,areaIdent:i,areaModel:o,cellValue:r},a=B(e,{});return a.render(this.Component(l)),()=>{a.unmount()}}}exports.ComponentRendererWrapper=we;exports.GuiexpertTable=xe;
20
+ class="ge-table-cell-editor-input">`}}}class Ae{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1}firstClick(e,t){this.selectionType==="row"?this.addRange(E.singleRow(e)):this.selectionType==="column"&&this.addRange(E.singleColumn(t))}getSelectionCount(e,t){let o=0;for(const s of this.ranges)s.isInRange(e,t)&&o++;return this.allSelected&&o++,this.isInNegativeRange(e,t)&&(o=0),o}isInNegativeRange(e,t){for(const o of this.negativeRanges)if(o.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(){const e=new Set;for(const t of this.ranges)for(let o=t.r1;o<=t.r2;o++)!e.has(o)&&!this.isInNegativeRange(o,0)&&e.add(o);return Array.from(e)}selectAll(){this.allSelected=!0}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=E.singleRow(e.r1):this.selectionType==="column"&&(t=E.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(E.singleCell(e,t)):this.addSelection(E.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}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 Me{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]}}class te{constructor(e=new D("❯","",["gt-table-icon-expanded"]),t=new D("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const Re=new Ae,Te=new Me("cell");class oe{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 Q,this.headerGroupOptions=new te,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Z,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new Ee,this.getSelectionModel=()=>Re,this.getFocusModel=()=>Te}}const I=class I{createContent(e,t,o){return new Promise((s,i)=>{if(t!=null&&t.hasSelection()){const r=this.mergeRanges(t.getRanges());if(r){r.c2=Math.min(r.c2,e.getColumnCount()-1),r.r2=Math.min(r.r2,e.getBodyModel().getRowCount()-1);const a=[];for(let l=r.r1;l<=r.r2;l++){const n=[];for(let d=r.c1;d<=r.c2;d++){const c=t.isSelected(l,d)?e.getBodyModel().getTextValueAt(l,d):"";n.push(c)}a.push(n.join(I.columnSeparatorChar))}return s(a.join(I.rowSeparatorChar))}}if(o){const[r,a]=o.getFocus(),l=e.getBodyModel().getTextValueAt(r,a);return s(l)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,o){return new Promise((s,i)=>{this.createContent(e,t,o).then(r=>{r&&this.copyContent(r).then(a=>{s(r)}).catch(a=>{i()})}).catch(r=>{i()})})}mergeRanges(e){let t;for(const o of e)t?(t.r1=Math.min(t.r1,o.r1),t.c1=Math.min(t.c1,o.c1),t.r2=Math.max(t.r2,o.r2),t.c2=Math.max(t.c2,o.c2)):t=new E(o.r1,o.c1,o.r2,o.c2);return t}};I.columnSeparatorChar=" ",I.rowSeparatorChar=`
21
+ `;let L=I;class j extends Se{constructor(e,t,o,s,i,r=new L){var a;if(super(e,t,new re(o),s),this.eventListener=i,this.copyService=r,this.licenseManager=k.getInstance(),this.selectionService=new ve(this),this.api=new ne(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,i||(this.eventListener=new Y),(a=this.tableOptions)!=null&&a.autoRestoreOptions){const l=this.tableOptions.autoRestoreOptions,n=l.getStorageKeyFn;n&&(l.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new de(n)),l.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new he(n)),l.autoRestoreSortingState&&(this.storeSortingService=new ge(n)))}this.mouseHandler=new ae(this),this.inputHandler=new me(this),this.shortcutService=new xe(this),this.shortcutService.addListener(this.selectionService)}static create(e,t,o=new oe,s=new Y,i=new ee,r=new L){return new j(e,t,i,o,s,r)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[o,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,s)&&(this.clearSelection(),this.initRenderEditor(o,s))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,o).then(s=>this.copyService.copyContent(s))}return!1}updateModelValueAfterEdit(e,t,o,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(N.createSingle(t,o)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new _;if(t.originalEvent=e,e){const o=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(o),t.rowIndex=this.getNumberByAttr(o,"data-row-index"),t.columnIndex=this.getNumberByAttr(o,"data-col-index"),t.action=this.getStringByAttr(o,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,s)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var o;const t=this.tableModel.getBodyModel();W(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const s=this.tableModel.getAreaModel(o),i=s.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";s.setRowChecked(e,r),this.repaint();const a=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(a||[])}onMouseClicked(e,t){let o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const s=this.getFocusModel();s&&(o=s.hasChanged(),s.clearChanged())}return o}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,o){var i,r;const s=this.tableModel.getColumnDef(o);if(s!=null&&s.sortable&&s.sortable()){e.preventDefault(),e.stopPropagation();const a=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,l=s.sortState??"",n=a[(a.indexOf(l)+1)%a.length],d=new fe(o,n);this.tableModel.doSort([d])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(h=>h.sortState=""),s.sortState=n),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const s=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,s)}setSelectionModel(e,t=!1){const o=()=>e;this.tableOptions.getSelectionModel=o,this.getSelectionModel=o,this.selectionService.getSelectionModel=o,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const o=this.getFocusModel();if(o){const[s,i]=o.getFocus();return o.setFocus(s+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var o;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(o=this.mouseHandler.mouseEvent)==null?void 0:o.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const o=this.storeScrollPosStateService.getScrollOffset();o&&this.scrollViewport.scrollTo(...o)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const o=this.storeSortingService.getSortItems();o!=null&&o.length&&this.tableModel.getBodyModel().doSort(o)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const o=this.tableOptions.autoRestoreOptions,s=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&s){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(W(r)){const a=r,l=r.getRowCount();for(let n=0;n<l;n++){const d=r.getRowByIndex(n);if(d)if(i.allExpanded)d.expanded=!0;else if(i.allCollapsed)d.expanded=!1;else{const c=s(d.data);i.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c):i.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c))}}a.recalcVisibleTreeRows()}}}}}const $=class ${};$.themes=["light","combat","paper","blackboard"],$.vars={light:`html[data-theme="light"] {
22
+ --ge-table-bg: rgba(255,255,255, 0.5);
23
+ --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
24
+ --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
25
+ --ge-table-header-east-bg: rgba(233, 233, 233, 0.5);
26
+ --ge-table-header-west-text: #000;
27
+ --ge-table-header-center-text: #000;
28
+ --ge-table-header-east-text: #000;
29
+ --ge-table-header-west-horizontal-border: #ddd;
30
+ --ge-table-header-west-vertical-border: #ccc;
31
+ --ge-table-header-center-horizontal-border: #ddd;
32
+ --ge-table-header-center-vertical-border: #ccc;
33
+ --ge-table-header-east-horizontal-border: #ddd;
34
+ --ge-table-header-east-vertical-border: #ccc;
35
+ --ge-table-body-west-bg: rgba(233, 233, 233, 0.5);
36
+ --ge-table-body-center-bg: rgba(255,255,255, 0.5);
37
+ --ge-table-body-east-bg: rgba(233, 233, 233, 0.5);
38
+ --ge-table-body-west-text: #000;
39
+ --ge-table-body-center-text: #000;
40
+ --ge-table-body-east-text: #000;
41
+ --ge-table-body-west-horizontal-border: #ddd;
42
+ --ge-table-body-west-vertical-border: #ccc;
43
+ --ge-table-body-center-horizontal-border: #bbb;
44
+ --ge-table-body-center-vertical-border: #ddd;
45
+ --ge-table-body-east-horizontal-border: #ddd;
46
+ --ge-table-body-east-vertical-border: #ccc;
47
+ --ge-table-body-west-selected-range-bg: rgba(0, 152, 219, 0.4);
48
+ --ge-table-body-center-selected-range-bg: rgba(0, 152, 219, 0.4);
49
+ --ge-table-body-east-selected-range-bg: rgba(0, 152, 219, 0.4);
50
+ --ge-table-body-west-selected-range-text: #000;
51
+ --ge-table-body-center-selected-range-text: #000;
52
+ --ge-table-body-east-selected-range-text: #000;
53
+ --ge-table-footer-west-bg: rgba(233, 233, 233, 0.5);
54
+ --ge-table-footer-center-bg: rgba(233, 233, 233, 0.5);
55
+ --ge-table-footer-east-bg: rgba(233, 233, 233, 0.5);
56
+ --ge-table-footer-west-text: #000;
57
+ --ge-table-footer-center-text: #000;
58
+ --ge-table-footer-east-text: #000;
59
+ --ge-table-footer-west-horizontal-border: #ddd;
60
+ --ge-table-footer-west-vertical-border: #ccc;
61
+ --ge-table-footer-center-horizontal-border: #ddd;
62
+ --ge-table-footer-center-vertical-border: #ccc;
63
+ --ge-table-footer-east-horizontal-border: #ddd;
64
+ --ge-table-footer-east-vertical-border: #ccc;
65
+ --ge-table-border: #ccc;
66
+ --ge-table-row-odd-bg: transparent;
67
+ --ge-table-row-even-bg: transparent;
68
+ --ge-table-column-odd-bg: transparent;
69
+ --ge-table-column-even-bg: transparent;
70
+ --ge-table-hover-column-bg: rgba(0, 224, 255, 0.27);
71
+ --ge-table-hover-row-bg: rgba(0, 224, 255, 0.27);
72
+ --ge-table-focus-border: rgb(0, 255, 255);
73
+ --ge-table-color-error-text: #e00034;
74
+ --ge-table-tree-arrow-collapsed-color: #e00034;
75
+ --ge-table-column-resize-handle-border: rgb(0, 255, 255);
76
+ --ge-table-dragged-col-div-bg: lightcyan;
77
+ --ge-table-drop-zone-bg: rgba(244, 255, 242, 0.6);
78
+ }`,combat:`html[data-theme="combat"] {
79
+ --ge-table-bg: #101010;
80
+ --ge-table-header-west-bg: #101010;
81
+ --ge-table-header-center-bg: #101010;
82
+ --ge-table-header-east-bg: #101010;
83
+ --ge-table-header-west-text: oklch(100% 0 0);
84
+ --ge-table-header-center-text: oklch(100% 0 0);
85
+ --ge-table-header-east-text: oklch(100% 0 0);
86
+ --ge-table-header-west-horizontal-border: oklch(100% 0 0 / 0%);
87
+ --ge-table-header-west-vertical-border: oklch(100% 0 0 / 0%);
88
+ --ge-table-header-center-horizontal-border: oklch(100% 0 0 / 0%);
89
+ --ge-table-header-center-vertical-border: oklch(100% 0 0 / 0%);
90
+ --ge-table-header-east-horizontal-border: oklch(100% 0 0 / 0%);
91
+ --ge-table-header-east-vertical-border: oklch(100% 0 0 / 0%);
92
+ --ge-table-body-west-bg: #101010;
93
+ --ge-table-body-center-bg: #101010;
94
+ --ge-table-body-east-bg: #101010;
95
+ --ge-table-body-west-text: #b6b4b4;
96
+ --ge-table-body-center-text: #b6b4b4;
97
+ --ge-table-body-east-text: #b6b4b4;
98
+ --ge-table-body-west-horizontal-border: oklch(100% 0 0 / 0%);
99
+ --ge-table-body-west-vertical-border: oklch(100% 0 0 / 0%);
100
+ --ge-table-body-center-horizontal-border: oklch(100% 0 0 / 0%);
101
+ --ge-table-body-center-vertical-border: oklch(100% 0 0 / 0%);
102
+ --ge-table-body-east-horizontal-border: oklch(100% 0 0 / 0%);
103
+ --ge-table-body-east-vertical-border: oklch(100% 0 0 / 0%);
104
+ --ge-table-body-west-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
105
+ --ge-table-body-center-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
106
+ --ge-table-body-east-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
107
+ --ge-table-body-west-selected-range-text: #f00032;
108
+ --ge-table-body-center-selected-range-text: #f00032;
109
+ --ge-table-body-east-selected-range-text: #f00032;
110
+ --ge-table-footer-west-bg: #101010;
111
+ --ge-table-footer-center-bg: #101010;
112
+ --ge-table-footer-east-bg: #101010;
113
+ --ge-table-footer-west-text: oklch(100% 0 0);
114
+ --ge-table-footer-center-text: oklch(100% 0 0);
115
+ --ge-table-footer-east-text: oklch(100% 0 0);
116
+ --ge-table-footer-west-horizontal-border: oklch(100% 0 0 / 0%);
117
+ --ge-table-footer-west-vertical-border: oklch(100% 0 0 / 0%);
118
+ --ge-table-footer-center-horizontal-border: oklch(100% 0 0 / 0%);
119
+ --ge-table-footer-center-vertical-border: oklch(100% 0 0 / 0%);
120
+ --ge-table-footer-east-horizontal-border: oklch(100% 0 0 / 0%);
121
+ --ge-table-footer-east-vertical-border: oklch(100% 0 0 / 0%);
122
+ --ge-table-border: oklch(100% 0 0 / 0%);
123
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
124
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
125
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
126
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
127
+ --ge-table-hover-column-bg: oklch(34% 0.25 3.6 / 27%);
128
+ --ge-table-hover-row-bg: oklch(34% 0.25 3.6 / 27%);
129
+ --ge-table-focus-border: oklch(40% 0.25 3.6);
130
+ --ge-table-color-error-text: oklch(65% 0.31 43.2);
131
+ --ge-table-tree-arrow-collapsed-color: #e00034;
132
+ --ge-table-column-resize-handle-border: oklch(63% 0.31 43.2);
133
+ --ge-table-dragged-col-div-bg: #2c2e33;
134
+ --ge-table-drop-zone-bg: #101010;
135
+ }`,paper:`html[data-theme="paper"] {
136
+ --ge-table-bg: #e7e5df;
137
+ --ge-table-header-west-bg: oklch(80% 0.02 99 / 48%);
138
+ --ge-table-header-center-bg: oklch(80% 0.02 99 / 48%);
139
+ --ge-table-header-east-bg: oklch(80% 0.02 99 / 48%);
140
+ --ge-table-header-west-text: #111;
141
+ --ge-table-header-center-text: #111;
142
+ --ge-table-header-east-text: #111;
143
+ --ge-table-header-west-horizontal-border: oklch(100% 0 0 / 0%);
144
+ --ge-table-header-west-vertical-border: oklch(100% 0 0 / 0%);
145
+ --ge-table-header-center-horizontal-border: oklch(100% 0 0 / 0%);
146
+ --ge-table-header-center-vertical-border: oklch(100% 0 0 / 0%);
147
+ --ge-table-header-east-horizontal-border: oklch(100% 0 0 / 0%);
148
+ --ge-table-header-east-vertical-border: oklch(100% 0 0 / 0%);
149
+ --ge-table-body-west-bg: oklch(80% 0.02 99 / 48%);
150
+ --ge-table-body-center-bg: #e7e5df;
151
+ --ge-table-body-east-bg: oklch(80% 0.02 99 / 48%);
152
+ --ge-table-body-west-text: #000;
153
+ --ge-table-body-center-text: #000;
154
+ --ge-table-body-east-text: #000;
155
+ --ge-table-body-west-horizontal-border: oklch(100% 0 0 / 0%);
156
+ --ge-table-body-west-vertical-border: oklch(100% 0 0 / 0%);
157
+ --ge-table-body-center-horizontal-border: oklch(100% 0 0 / 0%);
158
+ --ge-table-body-center-vertical-border: oklch(100% 0 0 / 0%);
159
+ --ge-table-body-east-horizontal-border: oklch(100% 0 0 / 0%);
160
+ --ge-table-body-east-vertical-border: oklch(100% 0 0 / 0%);
161
+ --ge-table-body-west-selected-range-bg: #cfcdc2;
162
+ --ge-table-body-center-selected-range-bg: #cfcdc2;
163
+ --ge-table-body-east-selected-range-bg: #cfcdc2;
164
+ --ge-table-body-west-selected-range-text: #000;
165
+ --ge-table-body-center-selected-range-text: #000;
166
+ --ge-table-body-east-selected-range-text: #000;
167
+ --ge-table-footer-west-bg: oklch(80% 0.02 99 / 48%);
168
+ --ge-table-footer-center-bg: oklch(80% 0.02 99 / 48%);
169
+ --ge-table-footer-east-bg: oklch(80% 0.02 99 / 48%);
170
+ --ge-table-footer-west-text: #111;
171
+ --ge-table-footer-center-text: #111;
172
+ --ge-table-footer-east-text: #111;
173
+ --ge-table-footer-west-horizontal-border: oklch(100% 0 0 / 0%);
174
+ --ge-table-footer-west-vertical-border: oklch(100% 0 0 / 0%);
175
+ --ge-table-footer-center-horizontal-border: oklch(100% 0 0 / 0%);
176
+ --ge-table-footer-center-vertical-border: oklch(100% 0 0 / 0%);
177
+ --ge-table-footer-east-horizontal-border: oklch(100% 0 0 / 0%);
178
+ --ge-table-footer-east-vertical-border: oklch(100% 0 0 / 0%);
179
+ --ge-table-border: oklch(100% 0 0 / 0%);
180
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
181
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
182
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
183
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
184
+ --ge-table-hover-column-bg: oklch(5% 0.2 266.40000000000003 / 9%);
185
+ --ge-table-hover-row-bg: oklch(5% 0.2 266.40000000000003 / 9%);
186
+ --ge-table-focus-border: oklch(100% 0.19 205.20000000000002);
187
+ --ge-table-color-error-text: oklch(45% 0.25 43.2);
188
+ --ge-table-tree-arrow-collapsed-color: #e00034;
189
+ --ge-table-column-resize-handle-border: oklch(100% 0.19 205.20000000000002 / 71%);
190
+ --ge-table-dragged-col-div-bg: #2c2e33;
191
+ --ge-table-drop-zone-bg: #e7e5df;
192
+ }`,blackboard:`html[data-theme="dark"] {
193
+ --ge-table-bg: #0c1021;
194
+ --ge-table-header-west-bg: #0c1021;
195
+ --ge-table-header-center-bg: #0c1021;
196
+ --ge-table-header-east-bg: #0c1021;
197
+ --ge-table-header-west-text: #e0df85;
198
+ --ge-table-header-center-text: #e0df85;
199
+ --ge-table-header-east-text: #e0df85;
200
+ --ge-table-header-west-horizontal-border: transparent;
201
+ --ge-table-header-west-vertical-border: transparent;
202
+ --ge-table-header-center-horizontal-border: transparent;
203
+ --ge-table-header-center-vertical-border: transparent;
204
+ --ge-table-header-east-horizontal-border: transparent;
205
+ --ge-table-header-east-vertical-border: transparent;
206
+ --ge-table-body-west-bg: #0c1021;
207
+ --ge-table-body-center-bg: #0c1021;
208
+ --ge-table-body-east-bg: #0c1021;
209
+ --ge-table-body-west-text: #a7a7a7;
210
+ --ge-table-body-center-text: #a7a7a7;
211
+ --ge-table-body-east-text: #a7a7a7;
212
+ --ge-table-body-west-horizontal-border: transparent;
213
+ --ge-table-body-west-vertical-border: transparent;
214
+ --ge-table-body-center-horizontal-border: transparent;
215
+ --ge-table-body-center-vertical-border: transparent;
216
+ --ge-table-body-east-horizontal-border: transparent;
217
+ --ge-table-body-east-vertical-border: transparent;
218
+ --ge-table-body-west-selected-range-bg: #758129;
219
+ --ge-table-body-center-selected-range-bg: #758129;
220
+ --ge-table-body-east-selected-range-bg: #758129;
221
+ --ge-table-body-west-selected-range-text: oklch(100% 0 0);
222
+ --ge-table-body-center-selected-range-text: oklch(100% 0 0);
223
+ --ge-table-body-east-selected-range-text: oklch(100% 0 0);
224
+ --ge-table-footer-west-bg: #0c1021;
225
+ --ge-table-footer-center-bg: #0c1021;
226
+ --ge-table-footer-east-bg: #0c1021;
227
+ --ge-table-footer-west-text: #e0df85;
228
+ --ge-table-footer-center-text: #e0df85;
229
+ --ge-table-footer-east-text: #e0df85;
230
+ --ge-table-footer-west-horizontal-border: transparent;
231
+ --ge-table-footer-west-vertical-border: transparent;
232
+ --ge-table-footer-center-horizontal-border: transparent;
233
+ --ge-table-footer-center-vertical-border: otransparent;
234
+ --ge-table-footer-east-horizontal-border: transparent;
235
+ --ge-table-footer-east-vertical-border: transparent;
236
+ --ge-table-border: oklch(0% 0 0);
237
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
238
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
239
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
240
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
241
+ --ge-table-hover-column-bg: #a9a9a9;
242
+ --ge-table-hover-row-bg: #a9a9a9;
243
+ --ge-table-focus-border: #e1ff00;
244
+ --ge-table-color-error-text: #ff0040;
245
+ --ge-table-tree-arrow-collapsed-color: #e00034;
246
+ --ge-table-column-resize-handle-border: oklch(0% 0 0);
247
+ --ge-table-dragged-col-div-bg: #2c2e33;
248
+ --ge-table-drop-zone-bg: #758129;
249
+ }`};let q=$;const B=class B{constructor(e=new te){this.headerGroupOptions=e}render(e,t,o,s,i,r,a){const l=r!=null&&r.data?r.data:"";if(r){const{toggle:n,visibility:d,closed:c}=r,h=n?B.toggleHeaderGroup:"";this.addText(e,s,t,o,l,h),n&&d!=="always"&&this.addArrowDiv(a,e,!c,t,o,s,h)}else this.addText(e,s,t,o,l,"")}addText(e,t,o,s,i,r){e.innerHTML=`<span
250
+ data-ge-action="${r}"
251
+ data-area="${t}"
252
+ data-row-index="${o}"
253
+ data-col-index="${s}"
254
+ >${i}</span>`}addArrowDiv(e,t,o=!0,s=-1,i=-1,r="header",a){const l=e.createElement("div");e.addClass(l,"ge-table-toggle-icon-div"),e.setStyle(l,"display","inline-block"),e.setStyle(l,"position",""),e.setStyle(l,"width","20px"),e.setStyle(l,"background","transparent"),e.setStyle(l,"cursor","pointer"),e.setAttribute(l,"data-row-index",`${s}`),e.setAttribute(l,"data-col-index",`${i}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${a}`);let n;o?n=this.headerGroupOptions.iconExpanded:n=this.headerGroupOptions.iconCollapsed;const d=n.content,c=e.createText(d);e.appendChild(l,c),n.style&&this.applyStyleString(e,l,n.style);for(const h of n.classes)e.addClass(l,h);return e.appendChild(t,l),l}applyStyleString(e,t,o){const s=o.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[r,a]=i.split(":");e.setStyle(t,r.trim(),a.trim())}}};B.toggleHeaderGroup="toggleHeaderGroup";let U=B;function De({tableModel:p,tableOptions:e=new oe,mouseMoved:t,checkboxChanged:o,contextmenu:s,modelChanged:i,mouseClicked:r,mouseDragging:a,mouseDraggingEnd:l,selectionChanged:n,focusChanged:d,tableReady:c,licenseKey:h}){const f=K.useRef(null);let u=!1;K.useEffect(()=>{f.current&&!u&&(S(f.current),u=!0)});const S=b=>{const g={onSelectionChanged(m){n&&n(m)},onFocusChanged(m){d&&d(m)},onCheckboxChanged:m=>{o&&o(m)},onContextmenu:m=>{s&&s(m)},onModelChanged:m=>{i&&i(m)},onMouseClicked:m=>{r&&r(m)},onMouseDragging:m=>{a&&a(m)},onMouseDraggingEnd:m=>{l&&l(m)},onMouseMoved:m=>{t&&t(m)}},v=new j(b,p,new ee,e,g);v.firstInit(),c&&c(v.getApi()),h&&k.getInstance().setLicenseKey(h)};return se.jsx("div",{ref:f,className:"container-div",style:{width:"100%",height:"100%",background:"transparent",padding:"0",margin:"0"}})}var G,F=ie;if(process.env.NODE_ENV==="production")G=F.createRoot,F.hydrateRoot;else{var J=F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;G=function(p,e){J.usingClientEntryPoint=!0;try{return F.createRoot(p,e)}finally{J.usingClientEntryPoint=!1}}}class ke{constructor(e){this.Component=e,console.info(e)}render(e,t,o,s,i,r,a){const l={cellDiv:e,rowIndex:t,columnIndex:o,areaIdent:s,areaModel:i,cellValue:r},n=G(e,{});return n.render(this.Component(l)),()=>{n.unmount()}}}exports.ComponentRendererWrapper=ke;exports.GuiexpertTable=De;