@guiexpert/table 1.1.28 → 1.1.29

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,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Qe(c=500){return function(e,t,o){let i=0;const s=o.value;return o.value=function(...r){if(!(Date.now()-i<c))return i=Date.now(),s.apply(this,r)},o}}class P{constructor(){this.alreadySet=!1}static getInstance(){return P.instance||(P.instance=new P),P.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 L(c){return c&&c.type==="TreeRow"}function j(c){return c&&c.type==="AreaModelTree"}function Ce(c){return c&&c.type==="CheckboxColumnDef"}class J{constructor(e=-1,t=-1,o=-1,i=-1,s,r,n,l=0,a=0,d=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=o,this.columnLeft=i,this.areaIdent=s,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=a,this.draggingY=d,this.action=h}clone(){return new J(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class O{constructor(e=">",t="",o=[]){this.content=e,this.style=t,this.classes=o}}class ge{constructor(e=new O(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new O(">","",["ge-table-tree-arrow-collapsed"]),o=new O(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new O("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=o,this.arrowExpandCollapseAll=i}}class pe{constructor(e=new O("↑","",["ge-header-sorted-asc"]),t=new O("↓","",["ge-header-sorted-desc"]),o=new O("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=o}}class ye{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,i])=>this.domService.setStyle(e,o,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",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,i){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.setAttribute(s,"data-area",o),this.domService.setAttribute(s,"data-side",i),this.domService.appendChild(t,s),s}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,i,s,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"&&s==="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",`${o}`),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){const{parent:t,geo:o,rowIndex:i=-1,columnIndex:s=-1,areaIdent:r,sideIdent:n,text:l="",treeArrow:a,tableOptions:d,checkedType:h=void 0,sortState:u}=e,m=d==null?void 0:d.treeOptions,b=d==null?void 0:d.showCheckboxWihoutExtraColumn,f=this.domService.createElement("div");this.domService.addClass(f,"ge-table-col-div"),b&&this.domService.addClass(f,"ge-with-checkbox"),this.domService.addClass(f,`ge-table-col-div-${o.index}`),this.domService.setAttribute(f,"data-col-index",`${o.index}`),this.domService.setAttribute(f,"data-row-index",`${i}`),this.domService.setAttribute(f,"data-area",`${r}`);const g=((o==null?void 0:o.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(f,`ge-table-column-${g}`),this.domService.setStyle(f,"display","clip"),this.domService.setStyle(f,"position","absolute"),this.domService.setStyle(f,"left",`${o.left}px`),this.domService.setStyle(f,"top",`${o.top}px`),this.domService.setStyle(f,"width",`${o.width}px`),this.domService.setStyle(f,"height",`${o.height}px`),a&&a!=="none"&&(this.domService.addClass(f,"ge-table-col-tree"),this.addArrowDiv(f,a,m,i,s,r)),b&&s===0&&h&&this.addCheckboxToDiv(f,h,r,i),l){const p=a!=="none"&&s===0;this.addLabelDiv(f,l,p,i,s,r)}return u&&this.addSortedIcon(f,u,d==null?void 0:d.sortedOptions,s),this.domService.appendChild(t,f),f}addCheckboxToDiv(e,t,o,i){const s=this.domService.createElement("div"),r=t==="full"?"checked":"";return s.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function et(c,e=500){let t=null,o=0;return function(...i){const s=Date.now(),r=e-(s-o);r<=0?(c.apply(this,i),o=s):t||(t=window.setTimeout(()=>{c.apply(this,i),o=Date.now(),t=null},r))}}function Ce(c,e=500){let t=null;return function(...o){t&&window.clearTimeout(t),t=window.setTimeout(()=>{c.apply(this,o),t=null},e)}}function tt(c=500){return function(e,t,o){let i=0;const s=o.value;return o.value=function(...r){if(!(Date.now()-i<c))return i=Date.now(),s.apply(this,r)},o}}class P{constructor(){this.alreadySet=!1}static getInstance(){return P.instance||(P.instance=new P),P.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 L(c){return c&&c.type==="TreeRow"}function j(c){return c&&c.type==="AreaModelTree"}function ye(c){return c&&c.type==="CheckboxColumnDef"}class J{constructor(e=-1,t=-1,o=-1,i=-1,s,r,n,l=0,a=0,d=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=o,this.columnLeft=i,this.areaIdent=s,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=a,this.draggingY=d,this.action=h}clone(){return new J(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class O{constructor(e=">",t="",o=[]){this.content=e,this.style=t,this.classes=o}}class ge{constructor(e=new O(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new O(">","",["ge-table-tree-arrow-collapsed"]),o=new O(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new O("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=o,this.arrowExpandCollapseAll=i}}class pe{constructor(e=new O("↑","",["ge-header-sorted-asc"]),t=new O("↓","",["ge-header-sorted-desc"]),o=new O("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=o}}class ve{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,i])=>this.domService.setStyle(e,o,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",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,i){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.setAttribute(s,"data-area",o),this.domService.setAttribute(s,"data-side",i),this.domService.appendChild(t,s),s}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,i,s,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"&&s==="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",`${o}`),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){const{parent:t,geo:o,rowIndex:i=-1,columnIndex:s=-1,areaIdent:r,sideIdent:n,text:l="",treeArrow:a,tableOptions:d,checkedType:h=void 0,sortState:u}=e,m=d==null?void 0:d.treeOptions,b=d==null?void 0:d.showCheckboxWihoutExtraColumn,f=this.domService.createElement("div");this.domService.addClass(f,"ge-table-col-div"),b&&this.domService.addClass(f,"ge-with-checkbox"),this.domService.addClass(f,`ge-table-col-div-${o.index}`),this.domService.setAttribute(f,"data-col-index",`${o.index}`),this.domService.setAttribute(f,"data-row-index",`${i}`),this.domService.setAttribute(f,"data-area",`${r}`);const g=((o==null?void 0:o.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(f,`ge-table-column-${g}`),this.domService.setStyle(f,"display","clip"),this.domService.setStyle(f,"position","absolute"),this.domService.setStyle(f,"left",`${o.left}px`),this.domService.setStyle(f,"top",`${o.top}px`),this.domService.setStyle(f,"width",`${o.width}px`),this.domService.setStyle(f,"height",`${o.height}px`),a&&a!=="none"&&(this.domService.addClass(f,"ge-table-col-tree"),this.addArrowDiv(f,a,m,i,s,r)),b&&s===0&&h&&this.addCheckboxToDiv(f,h,r,i),l){const p=a!=="none"&&s===0;this.addLabelDiv(f,l,p,i,s,r)}return u&&this.addSortedIcon(f,u,d==null?void 0:d.sortedOptions,s),this.domService.appendChild(t,f),f}addCheckboxToDiv(e,t,o,i){const s=this.domService.createElement("div"),r=t==="full"?"checked":"";return s.innerHTML=`
2
2
  <input
3
3
  type="checkbox"
4
4
  data-area="${o}"
5
5
  data-row-index="${i}"
6
6
  data-input-type="checkbox"
7
7
  ${r}
8
- class="ge-table-row-checkbox"> `,this.domService.setStyle(s,"display","inline"),this.domService.setStyle(s,"width","inherit"),this.domService.setAttribute(s,"data-row-index",`${i}`),this.domService.appendChild(e,s),s}addLabelDiv(e,t="",o=!1,i=-1,s=-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",`${s}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const a=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,a),this.domService.setAttribute(l,"data-row-index",`${i}`),this.domService.setAttribute(l,"data-col-index",`${s}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new pe,i=-1){const s=this.domService.createElement("div");this.domService.addClass(s,"ge-table-sorted-icon-div"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"top","0"),this.domService.setStyle(s,"right","0"),this.domService.setStyle(s,"width","20px"),this.domService.setStyle(s,"background","transparent"),this.domService.setStyle(s,"cursor","pointer"),this.domService.setAttribute(s,"data-col-index",`${i}`),this.domService.setAttribute(s,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(s,l),r.style&&this.applyStyleString(s,r.style);for(const a of r.classes)this.domService.addClass(s,a);return this.domService.appendChild(e,s),s}addArrowDiv(e,t="none",o=new ge,i=-1,s=-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",`${s}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const a=l.content,d=this.domService.createText(a);this.domService.appendChild(n,d),l.style&&this.applyStyleString(n,l.style);for(const h of l.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,i,s){if(e.verticalBorderVisible){const r=`ge-table-${i}-${s}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${i}-${s}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,o),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,o){t={...t,width:t.width+1,height:t.height+1};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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),this.domService.appendChild(e,i),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,o),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,o=""){const i=this.domService.createElement("div");return o&&this.domService.addClass(i,o),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 o=t.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[s,r]=i.split(":");this.domService.setStyle(e,s.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const Q=c=>c==="header"?"header":c==="footer"?"footer":"body";class ve{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=Q(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const i=e;this.value=i.value}}}}class Re{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 ve(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(L(o.row)&&o.areaModel){const i=o.colIdx===this.getArrowColumnIndex()&&e.altKey,s=o.className.includes("ge-table-tree-arrow-div");if(i||s){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 i=this.tableScope.tableOptions.getFocusModel();i==null||i.clear(),i==null||i.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"),i=Q(o),s=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(i);if(o&&i==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,s,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(s);if(o&&i==="body"&&n.isEditable(s,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(s,r)),L(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const a=l;a.expanded=!a.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var o,i,s,r,n;const t=(i=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:i.getRowId;if(t){const l=(s=this.tableScope.storeStateCollapsedExpandService)==null?void 0:s.collapsedExpandedStateGet().mode,a=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,d=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,h=t(e.data);a?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class Ae{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class be{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const o=e;for(const i of[...o]){const[s,r]=i;t[s]=r}}return t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const i=o();if(i){const s=i+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(s,r)}else this.persistItem(s,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 Me extends be{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 i=this.loadFromLocalStorage(o);this.scrollOffset=i||[0,0]}}}}class Ee{constructor(e="collapsed",t=[],o=!1,i=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=i}}class Ie extends be{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new Ee,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,i=this.loadFromLocalStorage(o);i&&(this.collapsedExpandedState=i)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Te extends be{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,i=this.loadFromLocalStorage(o);this.sortItems=i||[]}}}}class F{constructor(e=0,t=0,o=0,i=0,s){this.left=e,this.width=t,this.height=o,this.top=i,this.index=s}}class ke{constructor(e,t,o,i){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=i,this.scrollTop=0,this.areaBodyWestGeo=new F,this.areaBodyCenterGeo=new F,this.areaBodyEastGeo=new F;const s=this.hostElement;s.innerText="",this.dom.setAttribute(s,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",s),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",s)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",s)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",s)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",s,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",s,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",s,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",s,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",s,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",s,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",s,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",s,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",s,"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",s)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",s)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",s)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",s))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class R{constructor(e,t,o,i,s=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=i,this.gammaRange=s}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 De{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 i=0;i<t;i++){let s=this.areaModel.getColspanAt(o,i),r=this.areaModel.getRowspanAt(o,i);if(s>1||r>1){s===0&&(s=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new R(o,i,o+r-1,i+s-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class T{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class _e extends ke{constructor(e,t,o,i){var r,n;super(e,t,o,i),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 T,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),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),j(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new De(t,t.getAreaModel(l)),(a=this.colAndRowspanModels[l])==null||a.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var i;let o=(i=this.tableModel.getColumnDef(t))==null?void 0:i.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 s=document.querySelector("input.ge-table-cell-editor-input");s&&s.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=e||this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(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 F(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 F(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:i,cssClasses:s}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let a;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o?this.editorRenderer:r.getCellRenderer(t,o);if(l.innerText="",this.applyCssClasses(l,s),h)a=h.render(l,t,o,e,r,i,this.dom.domService),a&&this.cleanupFunctions[e].push(a);else{const b=`${i}`;this.dom.addLabelDiv(l,b,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const m=r.getCustomStyleAt(t,o);if(m)for(const b in m)this.dom.setStyle(l,b,m[b])}}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 i=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(i)return Number(i)}return-1}getStringByAttr(e,t){var o;if(e){const i=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(i)return i}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),i=this.getArea(e,"center"),s=this.getArea(e,"east"),r=i.child.clientHeight;o.child.innerText="",i.child.innerText="",s.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),h=d.getRowCount();for(;this.cleanupFunctions[e].length;){const p=this.cleanupFunctions[e].shift();p&&p()}let u=t;const m=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let p=0;p<h;p++){const C=u,y=p===h-1,A=this.tableModel.getRowHeight(e,p);if(C+A>0){this.firstVisibleRowIndex=p;let x={left:n,width:l,height:A,top:C,index:p},w=this.dom.addRowDiv(i,x,p,e,"center");const k=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:x,parent:w,rowIndex:p,columnIndexStart:k,columnIndexEnd:m-b-1,verticalFixed:!1,lastRowOfModel:y}),a.left>0&&(x={left:n,width:this.areaBodyWestGeo.width,height:A,top:C,index:p},w=this.dom.addRowDiv(o,x,p,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:x,parent:w,rowIndex:p,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:y})),a.right>0&&(x={left:n,width:this.areaBodyEastGeo.width,height:A,top:C,index:p},w=this.dom.addRowDiv(s,x,p,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:x,parent:w,rowIndex:p,columnIndexStart:m-b,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:y})),e==="header"&&this.tree&&p===h-1){const M=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(w,new F(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),I=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(I){const N=this.dom.domService.createText(I.content);this.dom.domService.appendChild(M,N),I.style&&this.dom.applyStyleString(M,I.style)}}}if(u=u+A,u>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const p=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(p.length)for(const C of p){let y=0,A=i.child,x="center";if(C.c1<f)A=o.child,x="west";else if(b>0&&C.c1>=m-b)A=s.child,x="east";else{const w=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();y=this.scrollFactorX*w-this.areaBodyWestGeo.width,x="center"}this.drawBigCell(C,y,t,d,A,x)}}}drawBigCell(e,t,o,i,s,r){const n=o+this.getRowHeights(0,e.r1-1,i).reduce((g,p)=>g+p,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let d=0;a>0&&e.c1>=l-a&&(d=l-a);const h=t+this.getColumnWidths(d,e.c1-1).reduce((g,p)=>g+p,0),u=this.getRowHeights(e.r1,e.r2,i).reduce((g,p)=>g+p,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,p)=>g+p,0);let b=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(b=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:s,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:s,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),i.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:m,cellHeight:u,parent:s})}findRowOfImportantRowspanCell(e,t,o){const i=e.getMaxRowspan();for(let s=t-1;s>-1;s--){const r=e.getRowspanAt(s,o);if(r>1&&s+r+1>=t)return s;if(t-s>i)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:i,parent:s,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:d=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!a){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const u=0,m=!!(e==="body"&&t);let b=h;for(let g=n;g<=l;g++){const p=b,C=this.tableModel.getColumnWidth(g);if(C>0&&p+C>0){let y=i.height;const A=o.getRowspanAt(r,g),x=o.getColspanAt(r,g);A>1&&(y=this.getRowHeights(r,r+A-1,o).reduce((M,I)=>M+I,0));let w=C;x>1&&(w=this.getColumnWidths(g,g+x-1).reduce((M,I)=>M+I,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,g)&&(k=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(s,p,u,w,y);const M={left:p,top:u,width:w,height:y};this.dom.addColumnBorderDivs(this.tableOptions,s,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(k,m,t,o,r,g,s,p,u,w,y);"gammaCells"in o&&o.getValueAt(r,g)&&(k=!1),k||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:p,top:u,width:w,height:y,parent:s,cellSelected:M,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:p,cellTop:u,cellWidth:w,cellHeight:y,parent:s})}}if(b=b+C,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new F(b-1,1,i.height,0),s)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:i,index:s,left:r,width:n,height:l,top:a,parent:d,lastRowOfModel:h}){var xe;const m=this.editorRenderer&&this.editorRendererRow===i&&this.editorRendererColumn===s?this.editorRenderer:e.getCellRenderer(i,s),b={left:r,width:n,height:l,top:a,index:s},f=e.getRowByIndex(i);let g="none";if(s===this.getTreeArrowColumnIndex()&&L(f)){const v=f;(xe=v.children)!=null&&xe.length?v.expanded?g="expanded":g="collapsed":g="hidden"}let C;if(t==="header"){const v=this.tableModel.getColumnDef(s);(!(v!=null&&v.sortIconVisible)||v!=null&&v.sortIconVisible())&&(C=v==null?void 0:v.sortState)}const y=e.getValueAt(i,s),A=m?"":`${y}`,x=e.isRowChecked(i),w=this.dom.addColumnDiv({parent:d,geo:b,rowIndex:i,columnIndex:s,areaIdent:t,sideIdent:o,text:A,treeArrow:g,tableOptions:this.tableOptions,checkedType:x,sortState:C}),k=e.getTooltipAt(i,s);k&&this.dom.setAttribute(w,"title",k);const M=this.tableModel.getColumnDef(s);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],w);let I;m&&(I=m.render(w,i,s,t,e,y,this.dom.domService));const N=e.getCustomClassesAt(i,s);if(N.length&&this.dom.addClasses(N,w),this.dom.addColumnBorderDivs(this.tableOptions,d,b,t,o),h&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},d),this.getFocusModel&&t==="body"){const v=this.getFocusModel();v!=null&&v.hasFocus(i,s)&&this.dom.addFocusBorderDivs(d,b,{})}t==="header"&&this.dom.setAttribute(w,"data-ge-action","drag-column");const te=e.getCustomStyleAt(i,s);if(te)for(const v in te)this.dom.setStyle(w,v,te[v]);return[w,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,i])=>{i?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let i=e;i<=t;i++)o.push(this.tableModel.getColumnWidth(i));return o}getRowHeights(e,t,o){const i=[];for(let s=e;s<=t;s++)i.push(o.getRowHeight(s));return i}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=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: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),i=this.areaBodyWestGeo.width,s=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-i;this.dom.applyStyle(this.hoverColumn,{left:s+"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 i,s;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((i=e.originalEvent)!=null&&i.clientX){const d={left:((s=e.originalEvent)==null?void 0:s.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,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 i="center",s=this.tableModel.getAreaModel(t),r=s==null?void 0:s.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let a=0;a<r;a++){const d=o,h=s.getRowHeight(a),u={left:0,width:e.width,height:h,top:d,index:a},m=s.getValueAt(a,n),b=s.getCellRenderer(a,n),f=b?"":`${m}`,g={parent:l,geo:u,rowIndex:a,columnIndex:n,areaIdent:t,sideIdent:i,text:f},p=this.dom.addColumnDiv(g);let C;b&&(C=b.render(p,a,n,t,s,m,this.dom.domService),C&&this.cleanupFunctions[t].push(C));const y=s.getCustomClassesAt(a,n);y.length&&this.dom.addClasses(y,p);const A=this.tableModel.getColumnDef(n);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],p),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,i);const x=s.getCustomStyleAt(a,n);if(x)for(const w in x)this.dom.setStyle(p,w,x[w]);o=o+h}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,i,s){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",`${i}px`),this.dom.setStyle(r,"height",`${s}px`),r}renderSelectedBackgroundDiv(e,t,o,i,s,r,n,l,a,d,h){let u=!1;if(!e&&t&&i.isSelectable(s,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const b=m.getSelectionCount(s,r);u=b>0;for(let f=0;f<b;f++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${a}px`),this.dom.setStyle(g,"width",`${d}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:i,columnIndex:s,left:r,top:n,width:l,height:a,parent:d,cellSelected:h,lastRowOfModel:u}){const[m,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:i,index:s,left:r,width:l,height:a,top:n,parent:d,lastRowOfModel:u});h&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,m),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:i,cellWidth:s,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",`${o+s-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 Fe{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Oe{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),i=t.getAttribute("data-row-index"),s=t.getAttribute("data-col-index");if(o&&i&&s){const r=Q(o),n=Number(i),l=Number(s);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class $e{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Z{constructor(e){this.cells=e}static createSingle(e,t){return new Z([new $e(e,t)])}}class Pe{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 s,r,n,l,a,d,h;let o=!1,i=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),m=this.getFocusModel();u&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(m),o=!0),(s=e.originalEvent)!=null&&s.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),i=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey)?(u.removeSelection(R.singleCell(e.rowIndex,e.columnIndex)),i=!0,o=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(u.addSelection(R.singleCell(e.rowIndex,e.columnIndex)),i=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(u))}return i?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[i,s]=o.getFocus();return t.togglePoint(i,s),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return R.create({rowIndex1:o,columnIndex1:s,rowIndex2:i,columnIndex2:r})}}class Le{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 He{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 Be{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 He().get()):Object.assign(this.shortcutActionIdMapping,new Le().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 i=o.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,i))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 oe{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Ve{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 We{render(e,t,o,i,s,r,n){if(s.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=s.getValueAt(t,o);e.innerHTML=`
8
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(s,"display","inline"),this.domService.setStyle(s,"width","inherit"),this.domService.setAttribute(s,"data-row-index",`${i}`),this.domService.appendChild(e,s),s}addLabelDiv(e,t="",o=!1,i=-1,s=-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",`${s}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const a=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,a),this.domService.setAttribute(l,"data-row-index",`${i}`),this.domService.setAttribute(l,"data-col-index",`${s}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new pe,i=-1){const s=this.domService.createElement("div");this.domService.addClass(s,"ge-table-sorted-icon-div"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"top","0"),this.domService.setStyle(s,"right","0"),this.domService.setStyle(s,"width","20px"),this.domService.setStyle(s,"background","transparent"),this.domService.setStyle(s,"cursor","pointer"),this.domService.setAttribute(s,"data-col-index",`${i}`),this.domService.setAttribute(s,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(s,l),r.style&&this.applyStyleString(s,r.style);for(const a of r.classes)this.domService.addClass(s,a);return this.domService.appendChild(e,s),s}addArrowDiv(e,t="none",o=new ge,i=-1,s=-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",`${s}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const a=l.content,d=this.domService.createText(a);this.domService.appendChild(n,d),l.style&&this.applyStyleString(n,l.style);for(const h of l.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,i,s){if(e.verticalBorderVisible){const r=`ge-table-${i}-${s}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${i}-${s}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,o),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,o){t={...t,width:t.width+1,height:t.height+1};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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),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.domService.setStyle(i,"z-index","9999"),this.applyStyle(i,o),this.domService.appendChild(e,i),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,o),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,o=""){const i=this.domService.createElement("div");return o&&this.domService.addClass(i,o),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 o=t.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[s,r]=i.split(":");this.domService.setStyle(e,s.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const Q=c=>c==="header"?"header":c==="footer"?"footer":"body";class Re{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=Q(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const i=e;this.value=i.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 Re(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(L(o.row)&&o.areaModel){const i=o.colIdx===this.getArrowColumnIndex()&&e.altKey,s=o.className.includes("ge-table-tree-arrow-div");if(i||s){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 i=this.tableScope.tableOptions.getFocusModel();i==null||i.clear(),i==null||i.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"),i=Q(o),s=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(i);if(o&&i==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,s,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(s);if(o&&i==="body"&&n.isEditable(s,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(s,r)),L(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const a=l;a.expanded=!a.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var o,i,s,r,n;const t=(i=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:i.getRowId;if(t){const l=(s=this.tableScope.storeStateCollapsedExpandService)==null?void 0:s.collapsedExpandedStateGet().mode,a=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,d=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,h=t(e.data);a?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class Me{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class be{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const o=e;for(const i of[...o]){const[s,r]=i;t[s]=r}}return t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const i=o();if(i){const s=i+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(s,r)}else this.persistItem(s,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class Ee extends be{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 i=this.loadFromLocalStorage(o);this.scrollOffset=i||[0,0]}}}}class Ie{constructor(e="collapsed",t=[],o=!1,i=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=i}}class Te extends be{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 o=t+this.COLLAPSED_EXPANDED_STATE,i=this.loadFromLocalStorage(o);i&&(this.collapsedExpandedState=i)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class ke extends be{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,i=this.loadFromLocalStorage(o);this.sortItems=i||[]}}}}class F{constructor(e=0,t=0,o=0,i=0,s){this.left=e,this.width=t,this.height=o,this.top=i,this.index=s}}class De{constructor(e,t,o,i){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=i,this.scrollTop=0,this.areaBodyWestGeo=new F,this.areaBodyCenterGeo=new F,this.areaBodyEastGeo=new F;const s=this.hostElement;s.innerText="",this.dom.setAttribute(s,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",s),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",s)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",s)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",s)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",s,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",s,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",s,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",s,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",s,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",s,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",s,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",s,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",s,"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",s)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",s)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",s)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",s))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class R{constructor(e,t,o,i,s=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=i,this.gammaRange=s}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 _e{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 i=0;i<t;i++){let s=this.areaModel.getColspanAt(o,i),r=this.areaModel.getRowspanAt(o,i);if(s>1||r>1){s===0&&(s=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new R(o,i,o+r-1,i+s-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class T{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class Fe extends De{constructor(e,t,o,i){var r,n;super(e,t,o,i),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 T,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),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),j(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new _e(t,t.getAreaModel(l)),(a=this.colAndRowspanModels[l])==null||a.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var i;let o=(i=this.tableModel.getColumnDef(t))==null?void 0:i.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 s=document.querySelector("input.ge-table-cell-editor-input");s&&s.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=e||this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(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 F(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 F(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:i,cssClasses:s}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let a;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o?this.editorRenderer:r.getCellRenderer(t,o);if(l.innerText="",this.applyCssClasses(l,s),h)a=h.render(l,t,o,e,r,i,this.dom.domService),a&&this.cleanupFunctions[e].push(a);else{const b=`${i}`;this.dom.addLabelDiv(l,b,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const m=r.getCustomStyleAt(t,o);if(m)for(const b in m)this.dom.setStyle(l,b,m[b])}}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 i=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(i)return Number(i)}return-1}getStringByAttr(e,t){var o;if(e){const i=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(i)return i}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),i=this.getArea(e,"center"),s=this.getArea(e,"east"),r=i.child.clientHeight;o.child.innerText="",i.child.innerText="",s.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),h=d.getRowCount();for(;this.cleanupFunctions[e].length;){const p=this.cleanupFunctions[e].shift();p&&p()}let u=t;const m=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let p=0;p<h;p++){const C=u,y=p===h-1,A=this.tableModel.getRowHeight(e,p);if(C+A>0){this.firstVisibleRowIndex=p;let x={left:n,width:l,height:A,top:C,index:p},w=this.dom.addRowDiv(i,x,p,e,"center");const k=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:x,parent:w,rowIndex:p,columnIndexStart:k,columnIndexEnd:m-b-1,verticalFixed:!1,lastRowOfModel:y}),a.left>0&&(x={left:n,width:this.areaBodyWestGeo.width,height:A,top:C,index:p},w=this.dom.addRowDiv(o,x,p,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:x,parent:w,rowIndex:p,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:y})),a.right>0&&(x={left:n,width:this.areaBodyEastGeo.width,height:A,top:C,index:p},w=this.dom.addRowDiv(s,x,p,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:x,parent:w,rowIndex:p,columnIndexStart:m-b,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:y})),e==="header"&&this.tree&&p===h-1){const M=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(w,new F(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),I=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(I){const z=this.dom.domService.createText(I.content);this.dom.domService.appendChild(M,z),I.style&&this.dom.applyStyleString(M,I.style)}}}if(u=u+A,u>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const p=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(p.length)for(const C of p){let y=0,A=i.child,x="center";if(C.c1<f)A=o.child,x="west";else if(b>0&&C.c1>=m-b)A=s.child,x="east";else{const w=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();y=this.scrollFactorX*w-this.areaBodyWestGeo.width,x="center"}this.drawBigCell(C,y,t,d,A,x)}}}drawBigCell(e,t,o,i,s,r){const n=o+this.getRowHeights(0,e.r1-1,i).reduce((g,p)=>g+p,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let d=0;a>0&&e.c1>=l-a&&(d=l-a);const h=t+this.getColumnWidths(d,e.c1-1).reduce((g,p)=>g+p,0),u=this.getRowHeights(e.r1,e.r2,i).reduce((g,p)=>g+p,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,p)=>g+p,0);let b=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(b=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:s,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:s,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),i.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:m,cellHeight:u,parent:s})}findRowOfImportantRowspanCell(e,t,o){const i=e.getMaxRowspan();for(let s=t-1;s>-1;s--){const r=e.getRowspanAt(s,o);if(r>1&&s+r+1>=t)return s;if(t-s>i)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:i,parent:s,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:d=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!a){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const u=0,m=!!(e==="body"&&t);let b=h;for(let g=n;g<=l;g++){const p=b,C=this.tableModel.getColumnWidth(g);if(C>0&&p+C>0){let y=i.height;const A=o.getRowspanAt(r,g),x=o.getColspanAt(r,g);A>1&&(y=this.getRowHeights(r,r+A-1,o).reduce((M,I)=>M+I,0));let w=C;x>1&&(w=this.getColumnWidths(g,g+x-1).reduce((M,I)=>M+I,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,g)&&(k=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(s,p,u,w,y);const M={left:p,top:u,width:w,height:y};this.dom.addColumnBorderDivs(this.tableOptions,s,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(k,m,t,o,r,g,s,p,u,w,y);"gammaCells"in o&&o.getValueAt(r,g)&&(k=!1),k||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:p,top:u,width:w,height:y,parent:s,cellSelected:M,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:p,cellTop:u,cellWidth:w,cellHeight:y,parent:s})}}if(b=b+C,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new F(b-1,1,i.height,0),s)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:i,index:s,left:r,width:n,height:l,top:a,parent:d,lastRowOfModel:h}){var xe;const m=this.editorRenderer&&this.editorRendererRow===i&&this.editorRendererColumn===s?this.editorRenderer:e.getCellRenderer(i,s),b={left:r,width:n,height:l,top:a,index:s},f=e.getRowByIndex(i);let g="none";if(s===this.getTreeArrowColumnIndex()&&L(f)){const v=f;(xe=v.children)!=null&&xe.length?v.expanded?g="expanded":g="collapsed":g="hidden"}let C;if(t==="header"){const v=this.tableModel.getColumnDef(s);(!(v!=null&&v.sortIconVisible)||v!=null&&v.sortIconVisible())&&(C=v==null?void 0:v.sortState)}const y=e.getValueAt(i,s),A=m?"":`${y}`,x=e.isRowChecked(i),w=this.dom.addColumnDiv({parent:d,geo:b,rowIndex:i,columnIndex:s,areaIdent:t,sideIdent:o,text:A,treeArrow:g,tableOptions:this.tableOptions,checkedType:x,sortState:C}),k=e.getTooltipAt(i,s);k&&this.dom.setAttribute(w,"title",k);const M=this.tableModel.getColumnDef(s);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],w);let I;m&&(I=m.render(w,i,s,t,e,y,this.dom.domService));const z=e.getCustomClassesAt(i,s);if(z.length&&this.dom.addClasses(z,w),this.dom.addColumnBorderDivs(this.tableOptions,d,b,t,o),h&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},d),this.getFocusModel&&t==="body"){const v=this.getFocusModel();v!=null&&v.hasFocus(i,s)&&this.dom.addFocusBorderDivs(d,b,{})}t==="header"&&this.dom.setAttribute(w,"data-ge-action","drag-column");const te=e.getCustomStyleAt(i,s);if(te)for(const v in te)this.dom.setStyle(w,v,te[v]);return[w,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,i])=>{i?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let i=e;i<=t;i++)o.push(this.tableModel.getColumnWidth(i));return o}getRowHeights(e,t,o){const i=[];for(let s=e;s<=t;s++)i.push(o.getRowHeight(s));return i}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=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: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),i=this.areaBodyWestGeo.width,s=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-i;this.dom.applyStyle(this.hoverColumn,{left:s+"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 i,s;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((i=e.originalEvent)!=null&&i.clientX){const d={left:((s=e.originalEvent)==null?void 0:s.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,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 i="center",s=this.tableModel.getAreaModel(t),r=s==null?void 0:s.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let a=0;a<r;a++){const d=o,h=s.getRowHeight(a),u={left:0,width:e.width,height:h,top:d,index:a},m=s.getValueAt(a,n),b=s.getCellRenderer(a,n),f=b?"":`${m}`,g={parent:l,geo:u,rowIndex:a,columnIndex:n,areaIdent:t,sideIdent:i,text:f},p=this.dom.addColumnDiv(g);let C;b&&(C=b.render(p,a,n,t,s,m,this.dom.domService),C&&this.cleanupFunctions[t].push(C));const y=s.getCustomClassesAt(a,n);y.length&&this.dom.addClasses(y,p);const A=this.tableModel.getColumnDef(n);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],p),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,i);const x=s.getCustomStyleAt(a,n);if(x)for(const w in x)this.dom.setStyle(p,w,x[w]);o=o+h}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,i,s){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",`${i}px`),this.dom.setStyle(r,"height",`${s}px`),r}renderSelectedBackgroundDiv(e,t,o,i,s,r,n,l,a,d,h){let u=!1;if(!e&&t&&i.isSelectable(s,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const b=m.getSelectionCount(s,r);u=b>0;for(let f=0;f<b;f++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${a}px`),this.dom.setStyle(g,"width",`${d}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:i,columnIndex:s,left:r,top:n,width:l,height:a,parent:d,cellSelected:h,lastRowOfModel:u}){const[m,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:i,index:s,left:r,width:l,height:a,top:n,parent:d,lastRowOfModel:u});h&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,m),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:i,cellWidth:s,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",`${o+s-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 Oe{constructor(e,t){this.columnIndex=e,this.sortState=t}}class $e{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"),i=t.getAttribute("data-row-index"),s=t.getAttribute("data-col-index");if(o&&i&&s){const r=Q(o),n=Number(i),l=Number(s);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class Pe{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Z{constructor(e){this.cells=e}static createSingle(e,t){return new Z([new Pe(e,t)])}}class Le{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 s,r,n,l,a,d,h;let o=!1,i=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),m=this.getFocusModel();u&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(m),o=!0),(s=e.originalEvent)!=null&&s.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),i=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey)?(u.removeSelection(R.singleCell(e.rowIndex,e.columnIndex)),i=!0,o=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(u.addSelection(R.singleCell(e.rowIndex,e.columnIndex)),i=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(u))}return i?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[i,s]=o.getFocus();return t.togglePoint(i,s),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return R.create({rowIndex1:o,columnIndex1:s,rowIndex2:i,columnIndex2:r})}}class He{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 Be{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 Ve{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 Be().get()):Object.assign(this.shortcutActionIdMapping,new He().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 i=o.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,i))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 oe{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class We{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 Ge{render(e,t,o,i,s,r,n){if(s.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=s.getValueAt(t,o);e.innerHTML=`
9
9
  <input
10
10
  type="text"
11
11
  value="${l}"
@@ -17,8 +17,8 @@
17
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 fe{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(R.singleRow(e)):this.selectionType==="column"&&this.addRange(R.singleColumn(t))}getSelectionCount(e,t){let o=0;for(const i of this.ranges)i.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,this.fireChangeEvent()}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,this.fireChangeEvent()}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e),this.fireChangeEvent()}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),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(R.singleCell(e,t)):this.addSelection(R.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),this.fireChangeEvent())}}class Ge{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class me{constructor(e=new O("❯","",["gt-table-icon-expanded"]),t=new O("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const Ze=new fe,et=new Ge("cell");class Y{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 ge,this.headerGroupOptions=new me,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new pe,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new We,this.getSelectionModel=()=>Ze,this.getFocusModel=()=>et}}const B=class B{createContent(e,t,o){return new Promise((i,s)=>{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 n=[];for(let l=r.r1;l<=r.r2;l++){const a=[];for(let d=r.c1;d<=r.c2;d++){const h=t.isSelected(l,d)?e.getBodyModel().getTextValueAt(l,d):"";a.push(h)}n.push(a.join(B.columnSeparatorChar))}return i(n.join(B.rowSeparatorChar))}}if(o){const[r,n]=o.getFocus(),l=e.getBodyModel().getTextValueAt(r,n);return i(l)}s("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,o){return new Promise((i,s)=>{this.createContent(e,t,o).then(r=>{r&&this.copyContent(r).then(n=>{i(r)}).catch(n=>{s()})}).catch(r=>{s()})})}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 R(o.r1,o.c1,o.r2,o.c2);return t}};B.columnSeparatorChar=" ",B.rowSeparatorChar=`
21
- `;let G=B;class Se extends _e{constructor(e,t,o,i,s,r=new G){var a;if(super(e,t,new ye(o),i),this.eventListener=s,this.copyService=r,this.licenseManager=P.getInstance(),this.selectionService=new Pe(this),this.api=new Ae(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,s||(this.eventListener=new oe),(a=this.tableOptions)!=null&&a.autoRestoreOptions){const d=this.tableOptions.autoRestoreOptions,h=d.getStorageKeyFn;h&&(d.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Me(h)),d.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Ie(h)),d.autoRestoreSortingState&&(this.storeSortingService=new Te(h)))}this.mouseHandler=new Re(this),this.inputHandler=new Oe(this),this.shortcutService=new Be(this),this.shortcutService.addListener(this.selectionService);const n=this.getSelectionModel?this.getSelectionModel():void 0;n&&n.addEventSelectionChangedListener(this);const l=this.getFocusModel?this.getFocusModel():void 0;l&&l.addEventFocusChangedListener(this)}static create(e,t,o=new Y,i=new oe,s=new Ve,r=new G){return new Se(e,t,s,o,i,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,i]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,i)&&(this.clearSelection(),this.initRenderEditor(o,i))}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(i=>this.copyService.copyContent(i))}return!1}updateModelValueAfterEdit(e,t,o,i){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,i)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(Z.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 J;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 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,s=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(s,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.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();j(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const i=this.tableModel.getAreaModel(o),s=i.isRowChecked(e),r=s===void 0||s==="semi"||s==="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 o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const i=this.getFocusModel();i&&(o=i.hasChanged(),i.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 s,r;const i=this.tableModel.getColumnDef(o);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 Fe(o,a);this.tableModel.doSort([d])&&((s=this.tableModel.getColumnDefs())==null||s.forEach(u=>u.sortState=""),i.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const i=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,i)}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[i,s]=o.getFocus();return o.setFocus(i+t,s+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,i=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&i){const s=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(j(r)){const n=r,l=r.getRowCount();for(let a=0;a<l;a++){const d=r.getRowByIndex(a);if(d)if(s.allExpanded)d.expanded=!0;else if(s.allCollapsed)d.expanded=!1;else{const h=i(d.data);s.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):s.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}}const U=class U{};U.themes=["light","combat","paper","blackboard"],U.vars={light:`html[data-theme="light"] {
20
+ class="ge-table-cell-editor-input">`}}}class fe{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(R.singleRow(e)):this.selectionType==="column"&&this.addRange(R.singleColumn(t))}getSelectionCount(e,t){let o=0;for(const i of this.ranges)i.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,this.fireChangeEvent()}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,this.fireChangeEvent()}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e),this.fireChangeEvent()}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),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(R.singleCell(e,t)):this.addSelection(R.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),this.fireChangeEvent())}}class ze{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class me{constructor(e=new O("❯","",["gt-table-icon-expanded"]),t=new O("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const ot=new fe,it=new ze("cell");class Y{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 ge,this.headerGroupOptions=new me,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new pe,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new Ge,this.getSelectionModel=()=>ot,this.getFocusModel=()=>it}}const B=class B{createContent(e,t,o){return new Promise((i,s)=>{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 n=[];for(let l=r.r1;l<=r.r2;l++){const a=[];for(let d=r.c1;d<=r.c2;d++){const h=t.isSelected(l,d)?e.getBodyModel().getTextValueAt(l,d):"";a.push(h)}n.push(a.join(B.columnSeparatorChar))}return i(n.join(B.rowSeparatorChar))}}if(o){const[r,n]=o.getFocus(),l=e.getBodyModel().getTextValueAt(r,n);return i(l)}s("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,o){return new Promise((i,s)=>{this.createContent(e,t,o).then(r=>{r&&this.copyContent(r).then(n=>{i(r)}).catch(n=>{s()})}).catch(r=>{s()})})}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 R(o.r1,o.c1,o.r2,o.c2);return t}};B.columnSeparatorChar=" ",B.rowSeparatorChar=`
21
+ `;let G=B;class Ne{constructor(e){this.tableScope=e,new ResizeObserver(Ce(this.handleResize.bind(this),500)).observe(this.tableScope.hostElement)}handleResize(e){const t=e[0],{width:o}=t.contentRect;this.tableScope.recalcColumnWidths(o)}}class Se extends Fe{constructor(e,t,o,i,s,r=new G){var a;if(super(e,t,new ve(o),i),this.eventListener=s,this.copyService=r,this.licenseManager=P.getInstance(),this.selectionService=new Le(this),this.api=new Me(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,s||(this.eventListener=new oe),(a=this.tableOptions)!=null&&a.autoRestoreOptions){const d=this.tableOptions.autoRestoreOptions,h=d.getStorageKeyFn;h&&(d.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Ee(h)),d.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Te(h)),d.autoRestoreSortingState&&(this.storeSortingService=new ke(h)))}this.mouseHandler=new Ae(this),this.inputHandler=new $e(this),this.resizeHandler=new Ne(this),this.shortcutService=new Ve(this),this.shortcutService.addListener(this.selectionService);const n=this.getSelectionModel?this.getSelectionModel():void 0;n&&n.addEventSelectionChangedListener(this);const l=this.getFocusModel?this.getFocusModel():void 0;l&&l.addEventFocusChangedListener(this)}static create(e,t,o=new Y,i=new oe,s=new We,r=new G){return new Se(e,t,s,o,i,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,i]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,i)&&(this.clearSelection(),this.initRenderEditor(o,i))}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(i=>this.copyService.copyContent(i))}return!1}updateModelValueAfterEdit(e,t,o,i){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,i)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(Z.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 J;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 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,s=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(s,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.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();j(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const i=this.tableModel.getAreaModel(o),s=i.isRowChecked(e),r=s===void 0||s==="semi"||s==="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 o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const i=this.getFocusModel();i&&(o=i.hasChanged(),i.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 s,r;const i=this.tableModel.getColumnDef(o);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 Oe(o,a);this.tableModel.doSort([d])&&((s=this.tableModel.getColumnDefs())==null||s.forEach(u=>u.sortState=""),i.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const i=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,i)}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[i,s]=o.getFocus();return o.setFocus(i+t,s+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,i=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&i){const s=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(j(r)){const n=r,l=r.getRowCount();for(let a=0;a<l;a++){const d=r.getRowByIndex(a);if(d)if(s.allExpanded)d.expanded=!0;else if(s.allCollapsed)d.expanded=!1;else{const h=i(d.data);s.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):s.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}}const U=class U{};U.themes=["light","combat","paper","blackboard"],U.vars={light:`html[data-theme="light"] {
22
22
  --ge-table-bg: rgba(255,255,255, 0.5);
23
23
  --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
24
24
  --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
@@ -246,7 +246,7 @@
246
246
  --ge-table-column-resize-handle-border: oklch(0% 0 0);
247
247
  --ge-table-dragged-col-div-bg: #2c2e33;
248
248
  --ge-table-drop-zone-bg: #758129;
249
- }`};let ie=U;class se{constructor(e,t=!0,o,i,s=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=o,this.parent=i,this.deep=s,this.checked=r,this.keep=n,this.type="TreeRow"}}class X{static buildTreeRows(e,t="children",o=12){const i=[];for(const s of e)i.push(X.buildTreeRow(s,t,void 0,0,o));return i}static buildTreeRow(e,t="children",o=new se(e,!0,[],void 0,0),i=0,s=12){var n;if(i>s)return console.warn("Max deep limit reached: ",i),o;const r=e[t];if(r)for(const l of r){const a=new se(l,!0,[],o,i+1);if((n=o.children)==null||n.push(a),X.buildTreeRow(l,t,a,i+1),i>s)return console.warn("Max deep limit reached: ",i),o}return o}}class H{constructor(e=34,t=34,o=34){this.header=e,this.body=t,this.footer=o}}class S{constructor(e=100,t="px"){this.value=e,this.unit=t}}const Ne=()=>!0,re=()=>!1;class V{constructor(e,t,o=new S(100,"px"),i=new T,s=new T,r=new S(100,"px"),n=new S(100,"px"),l,a,d,h,u,m,b,f,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=o,this.classes=i,this.rendererMap=s,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=a,this.sortState=d,this.sortStatesOrder=h,this.sortIconVisible=u,this.editable=m,this.getEditRenderer=b,this.editInputPipe=f,this.isVisible=g,this.visible=!0,o.unit!=="px"&&(this.minWidth=new S(0,"px"),this.maxWidth=new S(1e5,"px"))}static bodyRenderer(e){return new T(void 0,e,void 0)}static create(e){const t=new T(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new T(e.headerClasses,e.bodyClasses,e.footerClasses),i=e.sortIconVisible??e.sortable??re,s=e.editable??e.editable??re,r=e.isVisible??e.isVisible??Ne;return new V(e.property??"",e.headerLabel??"",e.width??new S(100,"px"),o,t,e.minWidth??new S(100,"px"),e.maxWidth??new S(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,i,s,e.getEditRenderer,e.editInputPipe,r)}}const tt=new S(300,"px"),ot=new S(290,"px"),it=new S(280,"px"),st=new S(270,"px"),rt=new S(260,"px"),lt=new S(250,"px"),nt=new S(240,"px"),at=new S(230,"px"),dt=new S(220,"px"),ht=new S(210,"px"),le=new S(200,"px"),ct=new S(190,"px"),ut=new S(180,"px"),gt=new S(170,"px"),pt=new S(160,"px"),bt=new S(150,"px"),ft=new S(140,"px"),mt=new S(130,"px"),St=new S(120,"px"),wt=new S(110,"px"),xt=new S(100,"px"),Ct=new S(90,"px"),yt=new S(80,"px"),vt=new S(70,"px"),Rt=new S(60,"px"),At=new S(50,"px"),Mt=new S(40,"px"),Et=new S(30,"px"),It=new S(20,"px"),Tt=new S(10,"px"),kt=new S(0,"px");class ee{constructor(e,t=[],o=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=o,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(i=>i.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var o;const t=this.getRowByIndex(e);return(o=this.rowSelectionModel)==null?void 0:o.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const o=this.getRowByIndex(e);this.rowSelectionModel.checkRow(o,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){var i,s;const o=(i=this.columnDefs)==null?void 0:i[t];return((s=o==null?void 0:o.editable)==null?void 0:s.call(o))??!1}setValue(e,t,o){var n;const i=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;i&&(o=i(o,e,t));const s=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(s,r.split("."),o):(s[r]=o,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,o){const i=t.shift();if(i){const s=e[i];return s&&t.length?this.setPropertyValue(s,t,o):(e[i]=o,!0)}return!1}arrayMove(e,t,o){const i=e.splice(t,1)[0];return e.splice(o,0,i),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class D extends ee{constructor(e,t,o,i=[]){super(e,i,o),this.areaIdent=e,this.arr=t,this.defaultRowHeight=o,this.columnDefs=i,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,o){var s;const i=(s=this.columnDefs[t])==null?void 0:s.editInputPipe;return i&&(o=i(o,e,t)),this.arr[e][t]=o,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}changeColumnOrder(e,t){this.filteredArr.forEach(o=>this.arrayMove(o,e,t)),super.changeColumnOrder(e,t)}}class _{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}getRowCount(){return 0}getValueAt(e,t){return""}getTextValueAt(e,t){return""}getCellRenderer(e,t){}getRowHeight(e){return 0}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!1}isRowChecked(e){}setRowChecked(e,t){}getTooltipAt(e,t){return""}getMaxColspan(){return 0}getMaxRowspan(){return 0}getYPosByRowIndex(e){return 0}init(){}externalFilterChanged(e){}isFilterable(){return!1}doSort(e){return!1}isEditable(e,t){return!1}setValue(e,t,o){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class ze{flattenTree(e,t=[]){var o;for(const i of e)this.isVisible(i)&&t.push(i),(o=i.children)!=null&&o.length&&this.flattenTree(i.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class je{genericSortComparator(e,t,o){if(typeof e=="number"&&typeof t=="number")return o*(e-t);if(typeof e=="string"&&typeof t=="string")return o*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return o*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return o*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const i=e,s=t;if(i.length&&s.length)return this.genericSortComparator(i[0],s[0],o)}return o*(""+e).localeCompare(""+t)}}class ne extends ee{constructor(e,t,o,i=[]){super(e,i,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=i,this.type="AreaModelTree",this.sorterService=new je,this.service=new ze,this.properties=i.map(s=>s.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const o=this.getRowByIndex(e);if(o){const i=this.properties[t];if(i)return i.includes(".")?this.getPropertyValue(o.data,i.split(".")):o.data[i]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:o}=e[e.length-1],i=o==="asc"?1:o==="desc"?-1:0,s=this.properties[t];return this.treeSort(this.rows,s,i),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,o){var r;const i=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;i&&(o=i(o,e,t));const s=this.getRowByIndex(e);if(s){const n=s.data,l=this.columnDefs[t].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),o):(n[l]=o,!0)}return!1}genericTreeTableSortComparator(e,t){return(o,i)=>{const s=this.getValueByT(o.data,e),r=this.getValueByT(i.data,e);return this.sorterService.genericSortComparator(s,r,t)}}expandAllRecursive(e,t){for(const o of e)o.expanded=t,o.children&&this.expandAllRecursive(o.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(o=>{e=Math.max(e,o.deep)});const t=this.flattenRows.filter((o,i,s)=>this.lastPredictFn(o,i,s));this.flattenRows.forEach(o=>o.keep=!1),this.flattenRows.forEach(o=>{t.includes(o)&&(o.keep=!0,this.setAllParentsOk(o))}),this.filteredFlattenRows=this.flattenRows.filter((o,i,s)=>o.keep)}}getPropertyValue(e,t){const o=t.shift();let i=e[o];return i&&t.length?this.getPropertyValue(i,t):i}treeSort(e,t,o){e.sort(this.genericTreeTableSortComparator(t,o));for(const i of e)i.children&&this.treeSort(i.children,t,o)}}class ae{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const o of e.children)this.checkRow(o,t);this.autoCheckParent(e.parent)}checkAll(e){for(const t of this.allRootNodes)t.checked=!1,t.children&&this.checkAll(t.children)}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){if(e.checked)return"full";const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);return!t&&!o?"semi":"none"}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const i of e.children)if(!i.checked||(o=i.children)!=null&&o.length&&!this.areAllChildrenChecked(i))return!1}return!0}areAllChildrenUnchecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const i of e.children)if(i.checked||(o=i.children)!=null&&o.length&&!this.areAllChildrenUnchecked(i))return!1}return!0}addSelectedRecursive(e,t){for(const o of e)o.checked&&t.push(o),o.children&&this.addSelectedRecursive(o.children,t)}}class de{constructor(e=0,t=0,o=0,i=0){this.top=e,this.right=t,this.bottom=o,this.left=i}}class Ye{constructor(){this.checkedRows=[]}getCheckedRows(){return this.checkedRows}setCheckedRows(e){this.checkedRows=e}addCheckedRows(e){this.checkedRows||(this.checkedRows=[]);for(const t of e)this.checkedRows.includes(t)||this.checkedRows.push(t)}checkRow(e,t){this.checkedRows||(this.checkedRows=[]),t?this.checkedRows.includes(e)||this.checkedRows.push(e):this.removeSelectedRow(e)}isRowChecked(e){return this.checkedRows&&this.checkedRows.includes(e)?"full":"none"}checkAll(e){this.checkedRows=[]}removeSelectedRow(e){if(this.checkedRows){const t=this.checkedRows.indexOf(e);t>-1&&this.checkedRows.splice(t,1)}}}class z{constructor(e,t,o,i=0,s=0,r=!1,n=new H,l=[],a=[],d=-1,h=0,u=400,m=()=>{}){var b,f,g,p;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=o,this.fixedLeftColumnCount=i,this.fixedRightColumnCount=s,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=a,this.overridingColumnWidth=d,this.columnCount=h,this.parentSize=u,this.getSelectionModel=m,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new de(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",o.areaIdent="footer",this.columnCount||((b=this.columnDefs)!=null&&b.length?this.columnCount=this.columnDefs.length:(f=this.columnSizes)!=null&&f.length&&(this.columnCount=(g=this.columnSizes)==null?void 0:g.length)),(p=this.columnDefs)!=null&&p.length&&Ce(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new Ye)}init(){this.recalcSize(this.parentSize),this.overridingColumnWidth===-1&&this.calcXPositions(),this.headerAreaModel&&this.headerAreaModel.init(),this.bodyAreaModel&&this.bodyAreaModel.init(),this.footerAreaModel&&this.footerAreaModel.init()}setParentWidth(e){this.parentSize=e}getColumnCount(){return this.columnCount}setColumnWidth(e,t){var o;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var o;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(e){this.recalcColumnWidths(e),this.recalcHeightAndPadding()}recalcHeightAndPadding(){const e=this.getAreaModel("body");this.rowCount=e.getRowCount(),this.contentHeightInPx=this.getAreaHeight("body"),this.recalcContentWidthInPx(),this.recalcPadding()}recalcPadding(){const e=this.getSideAreaWidth("west"),t=this.getSideAreaWidth("east"),o=this.getAreaHeight("header"),i=this.getAreaHeight("footer");this.padding=new de(o,t,i,e)}getPadding(){return this.padding}getContentHeightInPixel(){return this.contentHeightInPx}getContentWidthInPixel(){return this.contentWidthInPx}getRowHeight(e,t){return this.getAreaModel(e).getRowHeight(t)}getModel(e){return this.getAreaModel(e)}getAreaHeight(e){const t=this.getModel(e),o=t.getRowCount();if(this.defaultRowHeights[e])return o*this.defaultRowHeights[e];let i=0;for(let s=0;s<o;s++)i=i+t.getRowHeight(s);return i}getSideAreaWidth(e){const[t,o]=this.getSideStartAndEndColumnIndex(e);let i=0;for(let s=t;s<=o;s++)i=i+this.getColumnWidth(s);return i}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),o=this.getFixedRightColumnCount();let i=0,s=this.columnCount-1;return e==="west"?s=t-1:e==="east"?i=this.columnCount-o:(i=t,s=this.columnCount-o-1),[i,s]}getColumnDef(e){if(e<this.columnDefs.length)return this.columnDefs[e]}getFixedLeftColumnCount(){return this.fixedLeftColumnCount}getFixedRightColumnCount(){return this.fixedRightColumnCount}getAreaModel(e){if(e==="header")return this.headerAreaModel;if(e==="body")return this.bodyAreaModel;if(e==="footer")return this.footerAreaModel;throw new Error("Wrong ident.")}getBodyModel(){return this.bodyAreaModel}isFooterVisibe(){var e;return(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}isRowCheckboxVisible(){return this.rowCheckboxVisible}externalFilterChanged(e){this.getAreaModel("body").externalFilterChanged(e)}doSort(e){return this.getAreaModel("body").doSort(e)}getColumnDefs(){return this.columnDefs}getColumnProperty(e){return this.columnDefs?this.columnDefs[e].property:""}getBodyRowByIndex(e){return this.getBodyModel().getRowByIndex(e)}isSortable(e){var t;if(this.columnDefs&&e<this.columnDefs.length){const o=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof o=="function")return o()}return!1}changeColumnOrder(e,t){var o,i,s;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(o=this.headerAreaModel)==null||o.changeColumnOrder(e,t),(i=this.bodyAreaModel)==null||i.changeColumnOrder(e,t),(s=this.footerAreaModel)==null||s.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,o,i;if(!((t=this.columnDefs)!=null&&t.length)&&!((o=this.columnSizes)!=null&&o.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(i=this.columnDefs)!=null&&i.length){const s=this.columnDefs.filter(l=>{var a;return((a=l.width)==null?void 0:a.unit)==="weight"});this.columnSizes=this.columnDefs.map(l=>{if(l.width.unit==="%"&&e){let a=Math.floor(l.width.value*e/100);if(l.minWidth){const d=this.sizeToPixel(l.minWidth,e);a=Math.max(d,a)}if(l.maxWidth){const d=this.sizeToPixel(l.maxWidth,e);a=Math.min(d,a)}return a}else if(l.width.unit==="px"&&e)return l.width.value;return 0});const r=this.columnSizes.reduce((l,a)=>l+a),n=e-r;if(n>0&&s.length){const l=s.map(a=>a.width.value).reduce((a,d)=>a+d);for(let a=0;a<this.columnDefs.length;a++){const d=this.columnDefs[a];d.width.unit==="weight"&&(this.columnSizes[a]=d.width.value*n/l)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}arrayMove(e,t,o){const i=e.splice(t,1)[0];return e.splice(o,0,i),e}recalcContentWidthInPx(){this.contentWidthInPx=this.getSideAreaWidth("center")}calcXPositions(){const e=this.getColumnCount();this.xPositions=new Array(e+1),this.xPositions[0]=0;for(let t=0;t<e;t++)this.xPositions[t+1]=this.getColumnWidth(t)+this.xPositions[t]}}class Xe extends ee{constructor(e,t,o,i=[]){super(e,i,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=i,this.sorterService=new je,this.filteredRows=[...t],this.properties=i.map(s=>s.property)}setRows(e){this.rows=e,this.filteredRows=[...e]}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const o=this.properties[t];let i=this.filteredRows[e];return L(i)&&(i=i.data),i?this.getValueByT(i,o):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}getRowHeight(e){return this.defaultRowHeight}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[]}doSort(e){for(const t of e){const{columnIndex:o,sortState:i}=t,s=i==="asc"?1:i==="desc"?-1:0,r=this.properties[o];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,s))}return!0}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}genericFlatTableSortComparator(e,t){return(o,i)=>{const s=this.getValueByT(o,e),r=this.getValueByT(i,e);return this.sorterService.genericSortComparator(s,r,t)}}getPropertyValue(e,t){const o=t.shift(),i=e[o];return i&&t.length?this.getPropertyValue(i,t):i}}class he extends Xe{constructor(e,t,o,i){super(e,t,i,o),this.areaIdent=e,this.rows=t,this.columnDefs=o,this.defaultRowHeight=i}}class ${static createTableModel(e){var t,o,i,s,r,n,l,a,d,h,u,m,b,f;if(e.defaultRowHeights===void 0)if((t=e.tableOptions)!=null&&t.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new H,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const g=e.headerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.header=g)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const g=e.bodyAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.body=g)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const g=e.footerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.footer=g)}}if(e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(g=>new V(g,g.toUpperCase(),le)):(i=e.rows)!=null&&i.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new V(g,g.toUpperCase(),le)):e.columnDefs=[]),e.columnCount===void 0&&((s=e.columnDefs)!=null&&s.length?e.columnCount=e.columnDefs.length:(r=e.headerData)!=null&&r.length?e.columnCount=e.headerData[0].length:(n=e.columnSizes)!=null&&n.length?e.columnCount=(l=e.columnSizes)==null?void 0:l.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((a=e.headerData)!=null&&a.length?e.headerAreaModel=new D("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(d=e.columnDefs)!=null&&d.length?e.headerAreaModel=new D("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new _("header")),e.footerAreaModel||((h=e.footerData)!=null&&h.length?e.footerAreaModel=new D("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new _("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&L(e.rows[0])){const g=e.rows;e.bodyAreaModel=new ne("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(m=e.tableOptions)!=null&&m.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new ae(g))}else e.bodyAreaModel=new he("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new D("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new _("body");return e.fixedLeftColumnCount===void 0&&(e.fixedLeftColumnCount=0),e.fixedRightColumnCount===void 0&&(e.fixedRightColumnCount=0),e.rowCheckboxVisible===void 0&&(e.rowCheckboxVisible=!1),e.overridingColumnWidth===void 0&&(e.overridingColumnWidth=-1),!e.getSelectionModel&&((b=e.tableOptions)!=null&&b.getSelectionModel)&&(e.getSelectionModel=(f=e.tableOptions)==null?void 0:f.getSelectionModel),new z(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel,e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static buildByTypedRowsParam(e){return $.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new Y,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,o=new Y,i=0,s=0){const r=o.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&L(e[0])){const l=e,a=new ne("body",l,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(a.rowSelectionModel=new ae(l)),$.createByAreaModelsParam({headerAreaModel:new D("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:a,footerAreaModel:new D("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:i,fixedRightColumnCount:s,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return $.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:i,fixedRightColumnCount:s,defaultRowHeights:o.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return $.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new H,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new _,t,o=new _,i=0,s=0,r=!1,n=new H,l,a=[],d=-1,h){return new z(e,t,o,i,s,r,n,l,a,d,h)}static createByAreaModelsParam(e){return $.createByAreaModels(e.headerAreaModel??new _,e.bodyAreaModel,e.footerAreaModel??new _,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,e.rowCheckboxVisible===void 0?!1:e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs??[],e.columnSizes??[],e.overridingColumnWidth??-1,e.columnCount??0)}static createByObjectArray(e,t=[],o=[],i=0,s=0,r=!1,n=new H,l,a=[]){let d;t!=null&&t.length?d=new D("header",t,n.header,l):l!=null&&l.length?d=new D("header",[l.map(m=>m.headerLabel)],n.header,l):d=new _;const h=o?new D("footer",o,n.footer,l):new _,u=new he("body",e,l,n.body);return new z(d,u,h,i,s,r,n,l,a)}}const Dt=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class _t{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Ke{constructor(e,t,o,i,s,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=o,this.filter=i,this.sorting=s,this.startIndex=r,this.endIndex=n}}class Ft extends Ke{constructor(e,t,o,i,s,r,n,l){super(e,t,o,i,s,r,n),this.rows=l}}class Ue{constructor(e,t){this.value=e,this.label=t}}class Ot{constructor(e,t){this.index=e,this.px=t}}const $t={body:["ge-table-text-align-left"]},Pt={body:["ge-table-text-align-center"]},Lt={body:["ge-table-text-align-right"]},Ht={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Bt={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Vt={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class ce{render(e,t,o,i,s,r,n){if(s.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=s.isRowChecked(t),a=l==="full"?"checked":"",d=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
249
+ }`};let ie=U;class se{constructor(e,t=!0,o,i,s=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=o,this.parent=i,this.deep=s,this.checked=r,this.keep=n,this.type="TreeRow"}}class X{static buildTreeRows(e,t="children",o=12){const i=[];for(const s of e)i.push(X.buildTreeRow(s,t,void 0,0,o));return i}static buildTreeRow(e,t="children",o=new se(e,!0,[],void 0,0),i=0,s=12){var n;if(i>s)return console.warn("Max deep limit reached: ",i),o;const r=e[t];if(r)for(const l of r){const a=new se(l,!0,[],o,i+1);if((n=o.children)==null||n.push(a),X.buildTreeRow(l,t,a,i+1),i>s)return console.warn("Max deep limit reached: ",i),o}return o}}class H{constructor(e=34,t=34,o=34){this.header=e,this.body=t,this.footer=o}}class S{constructor(e=100,t="px"){this.value=e,this.unit=t}}const je=()=>!0,re=()=>!1;class V{constructor(e,t,o=new S(100,"px"),i=new T,s=new T,r=new S(100,"px"),n=new S(100,"px"),l,a,d,h,u,m,b,f,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=o,this.classes=i,this.rendererMap=s,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=a,this.sortState=d,this.sortStatesOrder=h,this.sortIconVisible=u,this.editable=m,this.getEditRenderer=b,this.editInputPipe=f,this.isVisible=g,this.visible=!0,o.unit!=="px"&&(this.minWidth=new S(0,"px"),this.maxWidth=new S(1e5,"px"))}static bodyRenderer(e){return new T(void 0,e,void 0)}static create(e){const t=new T(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new T(e.headerClasses,e.bodyClasses,e.footerClasses),i=e.sortIconVisible??e.sortable??re,s=e.editable??e.editable??re,r=e.isVisible??e.isVisible??je;return new V(e.property??"",e.headerLabel??"",e.width??new S(100,"px"),o,t,e.minWidth??new S(100,"px"),e.maxWidth??new S(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,i,s,e.getEditRenderer,e.editInputPipe,r)}}const st=new S(300,"px"),rt=new S(290,"px"),lt=new S(280,"px"),nt=new S(270,"px"),at=new S(260,"px"),dt=new S(250,"px"),ht=new S(240,"px"),ct=new S(230,"px"),ut=new S(220,"px"),gt=new S(210,"px"),le=new S(200,"px"),pt=new S(190,"px"),bt=new S(180,"px"),ft=new S(170,"px"),mt=new S(160,"px"),St=new S(150,"px"),wt=new S(140,"px"),xt=new S(130,"px"),Ct=new S(120,"px"),yt=new S(110,"px"),vt=new S(100,"px"),Rt=new S(90,"px"),At=new S(80,"px"),Mt=new S(70,"px"),Et=new S(60,"px"),It=new S(50,"px"),Tt=new S(40,"px"),kt=new S(30,"px"),Dt=new S(20,"px"),_t=new S(10,"px"),Ft=new S(0,"px");class ee{constructor(e,t=[],o=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=o,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(i=>i.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var o;const t=this.getRowByIndex(e);return(o=this.rowSelectionModel)==null?void 0:o.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const o=this.getRowByIndex(e);this.rowSelectionModel.checkRow(o,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){var i,s;const o=(i=this.columnDefs)==null?void 0:i[t];return((s=o==null?void 0:o.editable)==null?void 0:s.call(o))??!1}setValue(e,t,o){var n;const i=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;i&&(o=i(o,e,t));const s=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(s,r.split("."),o):(s[r]=o,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,o){const i=t.shift();if(i){const s=e[i];return s&&t.length?this.setPropertyValue(s,t,o):(e[i]=o,!0)}return!1}arrayMove(e,t,o){const i=e.splice(t,1)[0];return e.splice(o,0,i),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class D extends ee{constructor(e,t,o,i=[]){super(e,i,o),this.areaIdent=e,this.arr=t,this.defaultRowHeight=o,this.columnDefs=i,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,o){var s;const i=(s=this.columnDefs[t])==null?void 0:s.editInputPipe;return i&&(o=i(o,e,t)),this.arr[e][t]=o,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}changeColumnOrder(e,t){this.filteredArr.forEach(o=>this.arrayMove(o,e,t)),super.changeColumnOrder(e,t)}}class _{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}getRowCount(){return 0}getValueAt(e,t){return""}getTextValueAt(e,t){return""}getCellRenderer(e,t){}getRowHeight(e){return 0}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!1}isRowChecked(e){}setRowChecked(e,t){}getTooltipAt(e,t){return""}getMaxColspan(){return 0}getMaxRowspan(){return 0}getYPosByRowIndex(e){return 0}init(){}externalFilterChanged(e){}isFilterable(){return!1}doSort(e){return!1}isEditable(e,t){return!1}setValue(e,t,o){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class Ye{flattenTree(e,t=[]){var o;for(const i of e)this.isVisible(i)&&t.push(i),(o=i.children)!=null&&o.length&&this.flattenTree(i.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Xe{genericSortComparator(e,t,o){if(typeof e=="number"&&typeof t=="number")return o*(e-t);if(typeof e=="string"&&typeof t=="string")return o*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return o*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return o*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const i=e,s=t;if(i.length&&s.length)return this.genericSortComparator(i[0],s[0],o)}return o*(""+e).localeCompare(""+t)}}class ne extends ee{constructor(e,t,o,i=[]){super(e,i,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=i,this.type="AreaModelTree",this.sorterService=new Xe,this.service=new Ye,this.properties=i.map(s=>s.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const o=this.getRowByIndex(e);if(o){const i=this.properties[t];if(i)return i.includes(".")?this.getPropertyValue(o.data,i.split(".")):o.data[i]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:o}=e[e.length-1],i=o==="asc"?1:o==="desc"?-1:0,s=this.properties[t];return this.treeSort(this.rows,s,i),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,o){var r;const i=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;i&&(o=i(o,e,t));const s=this.getRowByIndex(e);if(s){const n=s.data,l=this.columnDefs[t].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),o):(n[l]=o,!0)}return!1}genericTreeTableSortComparator(e,t){return(o,i)=>{const s=this.getValueByT(o.data,e),r=this.getValueByT(i.data,e);return this.sorterService.genericSortComparator(s,r,t)}}expandAllRecursive(e,t){for(const o of e)o.expanded=t,o.children&&this.expandAllRecursive(o.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(o=>{e=Math.max(e,o.deep)});const t=this.flattenRows.filter((o,i,s)=>this.lastPredictFn(o,i,s));this.flattenRows.forEach(o=>o.keep=!1),this.flattenRows.forEach(o=>{t.includes(o)&&(o.keep=!0,this.setAllParentsOk(o))}),this.filteredFlattenRows=this.flattenRows.filter((o,i,s)=>o.keep)}}getPropertyValue(e,t){const o=t.shift();let i=e[o];return i&&t.length?this.getPropertyValue(i,t):i}treeSort(e,t,o){e.sort(this.genericTreeTableSortComparator(t,o));for(const i of e)i.children&&this.treeSort(i.children,t,o)}}class ae{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const o of e.children)this.checkRow(o,t);this.autoCheckParent(e.parent)}checkAll(e){for(const t of this.allRootNodes)t.checked=!1,t.children&&this.checkAll(t.children)}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){if(e.checked)return"full";const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);return!t&&!o?"semi":"none"}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const i of e.children)if(!i.checked||(o=i.children)!=null&&o.length&&!this.areAllChildrenChecked(i))return!1}return!0}areAllChildrenUnchecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const i of e.children)if(i.checked||(o=i.children)!=null&&o.length&&!this.areAllChildrenUnchecked(i))return!1}return!0}addSelectedRecursive(e,t){for(const o of e)o.checked&&t.push(o),o.children&&this.addSelectedRecursive(o.children,t)}}class de{constructor(e=0,t=0,o=0,i=0){this.top=e,this.right=t,this.bottom=o,this.left=i}}class Ke{constructor(){this.checkedRows=[]}getCheckedRows(){return this.checkedRows}setCheckedRows(e){this.checkedRows=e}addCheckedRows(e){this.checkedRows||(this.checkedRows=[]);for(const t of e)this.checkedRows.includes(t)||this.checkedRows.push(t)}checkRow(e,t){this.checkedRows||(this.checkedRows=[]),t?this.checkedRows.includes(e)||this.checkedRows.push(e):this.removeSelectedRow(e)}isRowChecked(e){return this.checkedRows&&this.checkedRows.includes(e)?"full":"none"}checkAll(e){this.checkedRows=[]}removeSelectedRow(e){if(this.checkedRows){const t=this.checkedRows.indexOf(e);t>-1&&this.checkedRows.splice(t,1)}}}class N{constructor(e,t,o,i=0,s=0,r=!1,n=new H,l=[],a=[],d=-1,h=0,u=400,m=()=>{}){var b,f,g,p;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=o,this.fixedLeftColumnCount=i,this.fixedRightColumnCount=s,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=a,this.overridingColumnWidth=d,this.columnCount=h,this.parentSize=u,this.getSelectionModel=m,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new de(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",o.areaIdent="footer",this.columnCount||((b=this.columnDefs)!=null&&b.length?this.columnCount=this.columnDefs.length:(f=this.columnSizes)!=null&&f.length&&(this.columnCount=(g=this.columnSizes)==null?void 0:g.length)),(p=this.columnDefs)!=null&&p.length&&ye(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new Ke)}init(){this.recalcSize(this.parentSize),this.overridingColumnWidth===-1&&this.calcXPositions(),this.headerAreaModel&&this.headerAreaModel.init(),this.bodyAreaModel&&this.bodyAreaModel.init(),this.footerAreaModel&&this.footerAreaModel.init()}setParentWidth(e){this.parentSize=e}getColumnCount(){return this.columnCount}setColumnWidth(e,t){var o;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var o;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(e){this.recalcColumnWidths(e),this.recalcHeightAndPadding()}recalcHeightAndPadding(){const e=this.getAreaModel("body");this.rowCount=e.getRowCount(),this.contentHeightInPx=this.getAreaHeight("body"),this.recalcContentWidthInPx(),this.recalcPadding()}recalcPadding(){const e=this.getSideAreaWidth("west"),t=this.getSideAreaWidth("east"),o=this.getAreaHeight("header"),i=this.getAreaHeight("footer");this.padding=new de(o,t,i,e)}getPadding(){return this.padding}getContentHeightInPixel(){return this.contentHeightInPx}getContentWidthInPixel(){return this.contentWidthInPx}getRowHeight(e,t){return this.getAreaModel(e).getRowHeight(t)}getModel(e){return this.getAreaModel(e)}getAreaHeight(e){const t=this.getModel(e),o=t.getRowCount();if(this.defaultRowHeights[e])return o*this.defaultRowHeights[e];let i=0;for(let s=0;s<o;s++)i=i+t.getRowHeight(s);return i}getSideAreaWidth(e){const[t,o]=this.getSideStartAndEndColumnIndex(e);let i=0;for(let s=t;s<=o;s++)i=i+this.getColumnWidth(s);return i}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),o=this.getFixedRightColumnCount();let i=0,s=this.columnCount-1;return e==="west"?s=t-1:e==="east"?i=this.columnCount-o:(i=t,s=this.columnCount-o-1),[i,s]}getColumnDef(e){if(e<this.columnDefs.length)return this.columnDefs[e]}getFixedLeftColumnCount(){return this.fixedLeftColumnCount}getFixedRightColumnCount(){return this.fixedRightColumnCount}getAreaModel(e){if(e==="header")return this.headerAreaModel;if(e==="body")return this.bodyAreaModel;if(e==="footer")return this.footerAreaModel;throw new Error("Wrong ident.")}getBodyModel(){return this.bodyAreaModel}isFooterVisibe(){var e;return(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}isRowCheckboxVisible(){return this.rowCheckboxVisible}externalFilterChanged(e){this.getAreaModel("body").externalFilterChanged(e)}doSort(e){return this.getAreaModel("body").doSort(e)}getColumnDefs(){return this.columnDefs}getColumnProperty(e){return this.columnDefs?this.columnDefs[e].property:""}getBodyRowByIndex(e){return this.getBodyModel().getRowByIndex(e)}isSortable(e){var t;if(this.columnDefs&&e<this.columnDefs.length){const o=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof o=="function")return o()}return!1}changeColumnOrder(e,t){var o,i,s;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(o=this.headerAreaModel)==null||o.changeColumnOrder(e,t),(i=this.bodyAreaModel)==null||i.changeColumnOrder(e,t),(s=this.footerAreaModel)==null||s.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,o,i;if(!((t=this.columnDefs)!=null&&t.length)&&!((o=this.columnSizes)!=null&&o.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(i=this.columnDefs)!=null&&i.length){const s=this.columnDefs.filter(l=>{var a;return((a=l.width)==null?void 0:a.unit)==="weight"});this.columnSizes=this.columnDefs.map(l=>{if(l.width.unit==="%"&&e){let a=Math.floor(l.width.value*e/100);if(l.minWidth){const d=this.sizeToPixel(l.minWidth,e);a=Math.max(d,a)}if(l.maxWidth){const d=this.sizeToPixel(l.maxWidth,e);a=Math.min(d,a)}return a}else if(l.width.unit==="px"&&e)return l.width.value;return 0});const r=this.columnSizes.reduce((l,a)=>l+a),n=e-r;if(n>0&&s.length){const l=s.map(a=>a.width.value).reduce((a,d)=>a+d);for(let a=0;a<this.columnDefs.length;a++){const d=this.columnDefs[a];d.width.unit==="weight"&&(this.columnSizes[a]=d.width.value*n/l)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}arrayMove(e,t,o){const i=e.splice(t,1)[0];return e.splice(o,0,i),e}recalcContentWidthInPx(){this.contentWidthInPx=this.getSideAreaWidth("center")}calcXPositions(){const e=this.getColumnCount();this.xPositions=new Array(e+1),this.xPositions[0]=0;for(let t=0;t<e;t++)this.xPositions[t+1]=this.getColumnWidth(t)+this.xPositions[t]}}class Ue extends ee{constructor(e,t,o,i=[]){super(e,i,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=i,this.sorterService=new Xe,this.filteredRows=[...t],this.properties=i.map(s=>s.property)}setRows(e){this.rows=e,this.filteredRows=[...e]}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const o=this.properties[t];let i=this.filteredRows[e];return L(i)&&(i=i.data),i?this.getValueByT(i,o):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}getRowHeight(e){return this.defaultRowHeight}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[]}doSort(e){for(const t of e){const{columnIndex:o,sortState:i}=t,s=i==="asc"?1:i==="desc"?-1:0,r=this.properties[o];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,s))}return!0}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}genericFlatTableSortComparator(e,t){return(o,i)=>{const s=this.getValueByT(o,e),r=this.getValueByT(i,e);return this.sorterService.genericSortComparator(s,r,t)}}getPropertyValue(e,t){const o=t.shift(),i=e[o];return i&&t.length?this.getPropertyValue(i,t):i}}class he extends Ue{constructor(e,t,o,i){super(e,t,i,o),this.areaIdent=e,this.rows=t,this.columnDefs=o,this.defaultRowHeight=i}}class ${static createTableModel(e){var t,o,i,s,r,n,l,a,d,h,u,m,b,f;if(e.defaultRowHeights===void 0)if((t=e.tableOptions)!=null&&t.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new H,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const g=e.headerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.header=g)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const g=e.bodyAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.body=g)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const g=e.footerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.footer=g)}}if(e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(g=>new V(g,g.toUpperCase(),le)):(i=e.rows)!=null&&i.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new V(g,g.toUpperCase(),le)):e.columnDefs=[]),e.columnCount===void 0&&((s=e.columnDefs)!=null&&s.length?e.columnCount=e.columnDefs.length:(r=e.headerData)!=null&&r.length?e.columnCount=e.headerData[0].length:(n=e.columnSizes)!=null&&n.length?e.columnCount=(l=e.columnSizes)==null?void 0:l.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((a=e.headerData)!=null&&a.length?e.headerAreaModel=new D("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(d=e.columnDefs)!=null&&d.length?e.headerAreaModel=new D("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new _("header")),e.footerAreaModel||((h=e.footerData)!=null&&h.length?e.footerAreaModel=new D("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new _("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&L(e.rows[0])){const g=e.rows;e.bodyAreaModel=new ne("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(m=e.tableOptions)!=null&&m.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new ae(g))}else e.bodyAreaModel=new he("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new D("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new _("body");return e.fixedLeftColumnCount===void 0&&(e.fixedLeftColumnCount=0),e.fixedRightColumnCount===void 0&&(e.fixedRightColumnCount=0),e.rowCheckboxVisible===void 0&&(e.rowCheckboxVisible=!1),e.overridingColumnWidth===void 0&&(e.overridingColumnWidth=-1),!e.getSelectionModel&&((b=e.tableOptions)!=null&&b.getSelectionModel)&&(e.getSelectionModel=(f=e.tableOptions)==null?void 0:f.getSelectionModel),new N(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel,e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static buildByTypedRowsParam(e){return $.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new Y,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,o=new Y,i=0,s=0){const r=o.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&L(e[0])){const l=e,a=new ne("body",l,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(a.rowSelectionModel=new ae(l)),$.createByAreaModelsParam({headerAreaModel:new D("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:a,footerAreaModel:new D("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:i,fixedRightColumnCount:s,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return $.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:i,fixedRightColumnCount:s,defaultRowHeights:o.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return $.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new H,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new _,t,o=new _,i=0,s=0,r=!1,n=new H,l,a=[],d=-1,h){return new N(e,t,o,i,s,r,n,l,a,d,h)}static createByAreaModelsParam(e){return $.createByAreaModels(e.headerAreaModel??new _,e.bodyAreaModel,e.footerAreaModel??new _,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,e.rowCheckboxVisible===void 0?!1:e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs??[],e.columnSizes??[],e.overridingColumnWidth??-1,e.columnCount??0)}static createByObjectArray(e,t=[],o=[],i=0,s=0,r=!1,n=new H,l,a=[]){let d;t!=null&&t.length?d=new D("header",t,n.header,l):l!=null&&l.length?d=new D("header",[l.map(m=>m.headerLabel)],n.header,l):d=new _;const h=o?new D("footer",o,n.footer,l):new _,u=new he("body",e,l,n.body);return new N(d,u,h,i,s,r,n,l,a)}}const Ot=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class $t{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class qe{constructor(e,t,o,i,s,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=o,this.filter=i,this.sorting=s,this.startIndex=r,this.endIndex=n}}class Pt extends qe{constructor(e,t,o,i,s,r,n,l){super(e,t,o,i,s,r,n),this.rows=l}}class Je{constructor(e,t){this.value=e,this.label=t}}class Lt{constructor(e,t){this.index=e,this.px=t}}const Ht={body:["ge-table-text-align-left"]},Bt={body:["ge-table-text-align-center"]},Vt={body:["ge-table-text-align-right"]},Wt={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Gt={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},zt={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class ce{render(e,t,o,i,s,r,n){if(s.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=s.isRowChecked(t),a=l==="full"?"checked":"",d=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
250
250
  <input
251
251
  type="checkbox"
252
252
  data-area="${i}"
@@ -255,7 +255,7 @@
255
255
  data-input-type="checkbox"
256
256
  ${a}
257
257
  class="ge-table-row-checkbox">
258
- ${d} `}}}class Wt{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new S(50,"px"),this.minWidth=new S(50,"px"),this.maxWidth=new S(100,"px"),this.rendererMap=new T(new ce,new ce,void 0),this.classes=new T([],["ge-table-text-align-left"],[])}}class Gt{static body(e){return new T(void 0,e,void 0)}}class Nt{constructor(e="down",t){this.status=e,this.originalEvent=t}}class zt{constructor(e,t,o,i,s={}){this.area=e,this.rowIndex=t,this.columnIndex=o,this.value=i,this.cssClasses=s}}class jt{constructor(){this.autoRestoreSortingState=!1,this.autoRestoreCollapsedExpandedState=!1,this.autoRestoreScrollPosition=!1,this.autoRestoreCheckedState=!1,this.autoRestoreSelectedState=!1,this.getStorageKeyFn=void 0,this.isSame=(e,t,o)=>{if(e&&t&&o.getRowId){const i=o.getRowId(e),s=o.getRowId(t);return i===s}return!1},this.getRowId=e=>{if(e){for(const t of["id","uuid"]){const o=e[t];if(o!=null)return o}try{return JSON.stringify(e)}catch(t){console.error(t)}}return console.warn('One of following options set to true without a valid "getRowId()": autoRestoreExpandedState, autoRestoreCheckedState.'),-1}}}class qe{constructor(e,t,o,i=!1,s="normal",r=void 0){this.data=e,this.property=t,this.toggle=o,this.closed=i,this.visibility=s,this.children=r,this.impl="CellGroup"}}class Je extends qe{constructor(e,t=0,o=0,i){super(e.data,e.property,e.toggle,e.closed,e.visibility,e.children),this.rowIndex=t,this.childIndex=o,this.parent=i,this.impl="CellGroupExt",this.children=void 0,this.leftNeighbour=void 0,this.rightNeighbour=void 0}ownColumn(){return!!this.property}toString(){return this.data+""}getColumnIndex(){return this.parent?this.parent.getColumnIndex()+this.childIndex:(this.leftNeighbour,0)}isVisible(){return this.parent?this.visibility==="always"?this.parent.isVisible():this.visibility==="normal"||!this.visibility?this.parent.isVisible()&&!this.parent.closed:this.visibility==="inverted"?this.parent.isVisible()&&this.parent.closed:!0:!0}claimsSpace(){return this.isVisible()&&(this.ownColumn()||this.closed)}getColumnCount(e=this,t=0){var o;if(e!=null&&e.claimsSpace()&&t++,(o=e==null?void 0:e.children)!=null&&o.length)for(const i of e.children)t=this.getColumnCount(i,t);return t}getRowSpan(e=this,t){return e!=null&&e.claimsSpace()?t-this.getParentCount(e,0):1}getParentCount(e=this,t=0){return e.parent&&(t=t+1+this.getParentCount(e.parent,t)),t}log(e=10){const t=" ".substring(0,2*this.rowIndex),o=`${this.getColumnIndex()}`,i=`${this.getColumnCount(this)}`,s=`${this.getRowSpan(this,e)}`,r=`${this.getParentCount(this)}`,n=`${t+this.data}
258
+ ${d} `}}}class Nt{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new S(50,"px"),this.minWidth=new S(50,"px"),this.maxWidth=new S(100,"px"),this.rendererMap=new T(new ce,new ce,void 0),this.classes=new T([],["ge-table-text-align-left"],[])}}class jt{static body(e){return new T(void 0,e,void 0)}}class Yt{constructor(e="down",t){this.status=e,this.originalEvent=t}}class Xt{constructor(e,t,o,i,s={}){this.area=e,this.rowIndex=t,this.columnIndex=o,this.value=i,this.cssClasses=s}}class Kt{constructor(){this.autoRestoreSortingState=!1,this.autoRestoreCollapsedExpandedState=!1,this.autoRestoreScrollPosition=!1,this.autoRestoreCheckedState=!1,this.autoRestoreSelectedState=!1,this.getStorageKeyFn=void 0,this.isSame=(e,t,o)=>{if(e&&t&&o.getRowId){const i=o.getRowId(e),s=o.getRowId(t);return i===s}return!1},this.getRowId=e=>{if(e){for(const t of["id","uuid"]){const o=e[t];if(o!=null)return o}try{return JSON.stringify(e)}catch(t){console.error(t)}}return console.warn('One of following options set to true without a valid "getRowId()": autoRestoreExpandedState, autoRestoreCheckedState.'),-1}}}class Qe{constructor(e,t,o,i=!1,s="normal",r=void 0){this.data=e,this.property=t,this.toggle=o,this.closed=i,this.visibility=s,this.children=r,this.impl="CellGroup"}}class Ze extends Qe{constructor(e,t=0,o=0,i){super(e.data,e.property,e.toggle,e.closed,e.visibility,e.children),this.rowIndex=t,this.childIndex=o,this.parent=i,this.impl="CellGroupExt",this.children=void 0,this.leftNeighbour=void 0,this.rightNeighbour=void 0}ownColumn(){return!!this.property}toString(){return this.data+""}getColumnIndex(){return this.parent?this.parent.getColumnIndex()+this.childIndex:(this.leftNeighbour,0)}isVisible(){return this.parent?this.visibility==="always"?this.parent.isVisible():this.visibility==="normal"||!this.visibility?this.parent.isVisible()&&!this.parent.closed:this.visibility==="inverted"?this.parent.isVisible()&&this.parent.closed:!0:!0}claimsSpace(){return this.isVisible()&&(this.ownColumn()||this.closed)}getColumnCount(e=this,t=0){var o;if(e!=null&&e.claimsSpace()&&t++,(o=e==null?void 0:e.children)!=null&&o.length)for(const i of e.children)t=this.getColumnCount(i,t);return t}getRowSpan(e=this,t){return e!=null&&e.claimsSpace()?t-this.getParentCount(e,0):1}getParentCount(e=this,t=0){return e.parent&&(t=t+1+this.getParentCount(e.parent,t)),t}log(e=10){const t=" ".substring(0,2*this.rowIndex),o=`${this.getColumnIndex()}`,i=`${this.getColumnCount(this)}`,s=`${this.getRowSpan(this,e)}`,r=`${this.getParentCount(this)}`,n=`${t+this.data}
259
259
  childIndex:${this.childIndex}
260
260
  row:${this.rowIndex}
261
261
  col:${o}
@@ -267,12 +267,12 @@
267
267
  claimsSpace:${this.claimsSpace()}
268
268
  colCount:${i}
269
269
  rowSpan:${s}
270
- pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class E{static buildColumnDefs(e,t=[]){for(const o of e)o.property&&t.push(V.create({property:o.property,headerLabel:o.data?o.data:o.property,isVisible:()=>typeof o.isVisible=="function"?o.isVisible():!0})),o.children&&E.buildColumnDefs(o.children,t);return t}static buildGroupExts(e,t=[],o=0,i){let s;for(let r=0;r<e.length;r++){const n=e[r],l=new Je(n,o,r,i);s&&(l.leftNeighbour=s,s.rightNeighbour=l),t.push(l),n.children&&(l.children=E.buildGroupExts(n.children,[],o+1,l)),s=l}return t}static flattenGroupExts(e,t=[]){for(const o of e)t.push(o),o.children&&E.flattenGroupExts(o.children,t);return t}static buildArrayOfArrays(e,t){var s;let o=-1,i=99999;for(const r of e){if(r.rowIndex<=i){o++;for(let n=0;n<t.length;n++)t[n][o]=null}if(t[r.rowIndex][o]=r,i=r.rowIndex,r.ownColumn()&&((s=r.children)!=null&&s.length)){for(let n=r.rowIndex+1;n<t.length;n++)t[n][o]=void 0;o++;for(let n=0;n<t.length;n++)t[n][o]=null}}return t}static iterateThrowColumns(e=[],t){var o;for(const i of t)e.push(i.data+" rowIndex:"+i.rowIndex),(o=i.children)!=null&&o.length&&E.iterateThrowColumns(e,i.children)}}class Yt{constructor(){this.areaIdent="body",this.rowSelectionModel=void 0}changeColumnOrder(e,t){}doSort(e){return!1}externalFilterChanged(e){}getCellRenderer(e,t){}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 0}getMaxRowspan(){return 0}getRowByIndex(e){}getRowCount(){return 0}getRowHeight(e){return 0}getRowspanAt(e,t){return 0}getTooltipAt(e,t){}getValueAt(e,t){}getTextValueAt(e,t){return""}getYPosByRowIndex(e){return 0}init(){}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!1}setRowChecked(e,t){}setValue(e,t,o){return!1}}const q=class q{constructor(e=new me){this.headerGroupOptions=e}render(e,t,o,i,s,r,n){const l=r!=null&&r.data?r.data:"";if(r){const{toggle:a,visibility:d,closed:h}=r,u=a?q.toggleHeaderGroup:"";this.addText(e,i,t,o,l,u),a&&d!=="always"&&this.addArrowDiv(n,e,!h,t,o,i,u)}else this.addText(e,i,t,o,l,"")}addText(e,t,o,i,s,r){e.innerHTML=`<span
270
+ pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class E{static buildColumnDefs(e,t=[]){for(const o of e)o.property&&t.push(V.create({property:o.property,headerLabel:o.data?o.data:o.property,isVisible:()=>typeof o.isVisible=="function"?o.isVisible():!0})),o.children&&E.buildColumnDefs(o.children,t);return t}static buildGroupExts(e,t=[],o=0,i){let s;for(let r=0;r<e.length;r++){const n=e[r],l=new Ze(n,o,r,i);s&&(l.leftNeighbour=s,s.rightNeighbour=l),t.push(l),n.children&&(l.children=E.buildGroupExts(n.children,[],o+1,l)),s=l}return t}static flattenGroupExts(e,t=[]){for(const o of e)t.push(o),o.children&&E.flattenGroupExts(o.children,t);return t}static buildArrayOfArrays(e,t){var s;let o=-1,i=99999;for(const r of e){if(r.rowIndex<=i){o++;for(let n=0;n<t.length;n++)t[n][o]=null}if(t[r.rowIndex][o]=r,i=r.rowIndex,r.ownColumn()&&((s=r.children)!=null&&s.length)){for(let n=r.rowIndex+1;n<t.length;n++)t[n][o]=void 0;o++;for(let n=0;n<t.length;n++)t[n][o]=null}}return t}static iterateThrowColumns(e=[],t){var o;for(const i of t)e.push(i.data+" rowIndex:"+i.rowIndex),(o=i.children)!=null&&o.length&&E.iterateThrowColumns(e,i.children)}}class Ut{constructor(){this.areaIdent="body",this.rowSelectionModel=void 0}changeColumnOrder(e,t){}doSort(e){return!1}externalFilterChanged(e){}getCellRenderer(e,t){}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 0}getMaxRowspan(){return 0}getRowByIndex(e){}getRowCount(){return 0}getRowHeight(e){return 0}getRowspanAt(e,t){return 0}getTooltipAt(e,t){}getValueAt(e,t){}getTextValueAt(e,t){return""}getYPosByRowIndex(e){return 0}init(){}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!1}setRowChecked(e,t){}setValue(e,t,o){return!1}}const q=class q{constructor(e=new me){this.headerGroupOptions=e}render(e,t,o,i,s,r,n){const l=r!=null&&r.data?r.data:"";if(r){const{toggle:a,visibility:d,closed:h}=r,u=a?q.toggleHeaderGroup:"";this.addText(e,i,t,o,l,u),a&&d!=="always"&&this.addArrowDiv(n,e,!h,t,o,i,u)}else this.addText(e,i,t,o,l,"")}addText(e,t,o,i,s,r){e.innerHTML=`<span
271
271
  data-ge-action="${r}"
272
272
  data-area="${t}"
273
273
  data-row-index="${o}"
274
274
  data-col-index="${i}"
275
- >${s}</span>`}addArrowDiv(e,t,o=!0,i=-1,s=-1,r="header",n){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",`${i}`),e.setAttribute(l,"data-col-index",`${s}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${n}`);let a;o?a=this.headerGroupOptions.iconExpanded:a=this.headerGroupOptions.iconCollapsed;const d=a.content,h=e.createText(d);e.appendChild(l,h),a.style&&this.applyStyleString(e,l,a.style);for(const u of a.classes)e.addClass(l,u);return e.appendChild(t,l),l}applyStyleString(e,t,o){const i=o.split(";").map(s=>s.trim()).filter(s=>s);for(const s of i){const[r,n]=s.split(":");e.setStyle(t,r.trim(),n.trim())}}};q.toggleHeaderGroup="toggleHeaderGroup";let K=q;class Xt{constructor(e="header",t,o=[],i,s=new me){this.areaIdent=e,this.groups=t,this.columnDefs=o,this.defaultRowHeight=i,this.headerGroupOptions=s,this.gammaCells=!0,this.arr=[],this.groupExts=[],this.cellGroupExtCellRenderer=new K(this.headerGroupOptions),this.groupExts=E.buildGroupExts(t),this.init()}init(){var e;for(const t of this.groupExts)t.log(this.getMaxRowCount());this.arr=this.buildArray(),!((e=this.columnDefs)!=null&&e.length)&&this.areaIdent==="header"&&(this.columnDefs=E.buildColumnDefs(this.groups))}getAllLeafs(){return E.flattenGroupExts(this.groupExts).filter(t=>!t.children)}getMaxRowCount(){const e=this.getAllLeafs();return e!=null&&e.length?1+Math.max(...e.map(t=>t.getParentCount(t))):0}buildArray(){const e=E.flattenGroupExts(this.groupExts),t=1+Math.max(...e.map(r=>r.rowIndex)),o=[];E.iterateThrowColumns(o,this.groupExts);const i=Array.from(Array(t).keys()).map(r=>[]),s=E.buildArrayOfArrays(e,i);return console.table(s),s}changeColumnOrder(e,t){}doSort(e){return!1}externalFilterChanged(e){}getCellRenderer(e,t){return this.cellGroupExtCellRenderer}getColspanAt(e,t){const o=this.getValueAt(e,t);return o?o.getColumnCount():0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 12}getMaxRowspan(){return 12}getRowByIndex(e){}getRowCount(){return this.arr?this.arr.length:0}getRowspanAt(e,t){const o=this.getValueAt(e,t);if(o){const i=this.getRowCount();return o.getRowSpan(o,i)}return 0}getTooltipAt(e,t){return""}getValueAt(e,t){return this.arr[e][t]}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getYPosByRowIndex(e){return 0}getRowHeight(e){return this.defaultRowHeight}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!1}setRowChecked(e,t){}setValue(e,t,o){return!1}toggleHeaderGroup(e){const t=this.arr[e.rowIdx][e.colIdx];return t!=null&&t.toggle&&t.visibility!=="always"&&(t.closed=!t.closed,this.init()),E.buildColumnDefs(this.groupExts)}}class Kt{filterPredict(e,t,o=this.objectToString.bind(this)){if(!e)return!1;if(!t)return!0;t=t.toLowerCase();const i="+",s="-",r=t.toLowerCase().split(" ").filter(h=>h!==i&&h!==s&&h!==""),n=r.filter(h=>!h.startsWith(i)&&!h.startsWith(s)),l=r.filter(h=>h.startsWith(i)).map(h=>h.replace(/\+/g,"")),a=r.filter(h=>h.startsWith(s)).map(h=>h.replace(/-/g,""));let d=!n.length;for(let h=0;h<n.length;h++)(d||o(e).includes(n[h]))&&(d=!0);if(!d)return!1;for(let h=0;h<l.length;h++)if(!o(e).includes(l[h]))return!1;for(let h=0;h<a.length;h++)if(o(e).includes(a[h]))return!1;return!0}filterRows(e,t,o=i=>JSON.stringify(i).toLowerCase()){if(!e)return[];if(!t)return[...e];t=t.toLowerCase();const i="+",s="-",r=t.toLowerCase().split(" ").filter(d=>d!==i&&d!==s&&d!==""),n=r.filter(d=>!d.startsWith(i)&&!d.startsWith(s)),l=r.filter(d=>d.startsWith(i)).map(d=>d.replace(/\+/g,"")),a=r.filter(d=>d.startsWith(s)).map(d=>d.replace(/-/g,""));return e==null?void 0:e.filter(d=>{let h=!n.length;for(let u=0;u<n.length;u++)(h||o(d).includes(n[u]))&&(h=!0);if(!h)return!1;for(let u=0;u<l.length;u++)if(!o(d).includes(l[u]))return!1;for(let u=0;u<a.length;u++)if(o(d).includes(a[u]))return!1;return!0})}objectToString(e){if(!e)return"";const t=[],o=Object.keys(e);for(let i=0;i<o.length;i++){const s=o[i];t.push(e[s])}return t.join(" ").toLowerCase()}}class Ut{static bodyRenderer(e){return new T(void 0,e,void 0)}}class qt{constructor(e,t=!0,o=!1){this.property=e,this.skipCheckableCheck=t,this.readonly=o}render(e,t,o,i,s,r,n){if(this.readonly||this.skipCheckableCheck||s.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=s.getRowByIndex(t),d=s.getValueByT(l,this.property)===!0?"checked":"",h=this.readonly?" readonly ":"";if(n.addClass(e,"ge-padding-property-checkbox"),e.innerHTML=`
275
+ >${s}</span>`}addArrowDiv(e,t,o=!0,i=-1,s=-1,r="header",n){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",`${i}`),e.setAttribute(l,"data-col-index",`${s}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${n}`);let a;o?a=this.headerGroupOptions.iconExpanded:a=this.headerGroupOptions.iconCollapsed;const d=a.content,h=e.createText(d);e.appendChild(l,h),a.style&&this.applyStyleString(e,l,a.style);for(const u of a.classes)e.addClass(l,u);return e.appendChild(t,l),l}applyStyleString(e,t,o){const i=o.split(";").map(s=>s.trim()).filter(s=>s);for(const s of i){const[r,n]=s.split(":");e.setStyle(t,r.trim(),n.trim())}}};q.toggleHeaderGroup="toggleHeaderGroup";let K=q;class qt{constructor(e="header",t,o=[],i,s=new me){this.areaIdent=e,this.groups=t,this.columnDefs=o,this.defaultRowHeight=i,this.headerGroupOptions=s,this.gammaCells=!0,this.arr=[],this.groupExts=[],this.cellGroupExtCellRenderer=new K(this.headerGroupOptions),this.groupExts=E.buildGroupExts(t),this.init()}init(){var e;for(const t of this.groupExts)t.log(this.getMaxRowCount());this.arr=this.buildArray(),!((e=this.columnDefs)!=null&&e.length)&&this.areaIdent==="header"&&(this.columnDefs=E.buildColumnDefs(this.groups))}getAllLeafs(){return E.flattenGroupExts(this.groupExts).filter(t=>!t.children)}getMaxRowCount(){const e=this.getAllLeafs();return e!=null&&e.length?1+Math.max(...e.map(t=>t.getParentCount(t))):0}buildArray(){const e=E.flattenGroupExts(this.groupExts),t=1+Math.max(...e.map(r=>r.rowIndex)),o=[];E.iterateThrowColumns(o,this.groupExts);const i=Array.from(Array(t).keys()).map(r=>[]),s=E.buildArrayOfArrays(e,i);return console.table(s),s}changeColumnOrder(e,t){}doSort(e){return!1}externalFilterChanged(e){}getCellRenderer(e,t){return this.cellGroupExtCellRenderer}getColspanAt(e,t){const o=this.getValueAt(e,t);return o?o.getColumnCount():0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 12}getMaxRowspan(){return 12}getRowByIndex(e){}getRowCount(){return this.arr?this.arr.length:0}getRowspanAt(e,t){const o=this.getValueAt(e,t);if(o){const i=this.getRowCount();return o.getRowSpan(o,i)}return 0}getTooltipAt(e,t){return""}getValueAt(e,t){return this.arr[e][t]}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getYPosByRowIndex(e){return 0}getRowHeight(e){return this.defaultRowHeight}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!1}setRowChecked(e,t){}setValue(e,t,o){return!1}toggleHeaderGroup(e){const t=this.arr[e.rowIdx][e.colIdx];return t!=null&&t.toggle&&t.visibility!=="always"&&(t.closed=!t.closed,this.init()),E.buildColumnDefs(this.groupExts)}}class Jt{filterPredict(e,t,o=this.objectToString.bind(this)){if(!e)return!1;if(!t)return!0;t=t.toLowerCase();const i="+",s="-",r=t.toLowerCase().split(" ").filter(h=>h!==i&&h!==s&&h!==""),n=r.filter(h=>!h.startsWith(i)&&!h.startsWith(s)),l=r.filter(h=>h.startsWith(i)).map(h=>h.replace(/\+/g,"")),a=r.filter(h=>h.startsWith(s)).map(h=>h.replace(/-/g,""));let d=!n.length;for(let h=0;h<n.length;h++)(d||o(e).includes(n[h]))&&(d=!0);if(!d)return!1;for(let h=0;h<l.length;h++)if(!o(e).includes(l[h]))return!1;for(let h=0;h<a.length;h++)if(o(e).includes(a[h]))return!1;return!0}filterRows(e,t,o=i=>JSON.stringify(i).toLowerCase()){if(!e)return[];if(!t)return[...e];t=t.toLowerCase();const i="+",s="-",r=t.toLowerCase().split(" ").filter(d=>d!==i&&d!==s&&d!==""),n=r.filter(d=>!d.startsWith(i)&&!d.startsWith(s)),l=r.filter(d=>d.startsWith(i)).map(d=>d.replace(/\+/g,"")),a=r.filter(d=>d.startsWith(s)).map(d=>d.replace(/-/g,""));return e==null?void 0:e.filter(d=>{let h=!n.length;for(let u=0;u<n.length;u++)(h||o(d).includes(n[u]))&&(h=!0);if(!h)return!1;for(let u=0;u<l.length;u++)if(!o(d).includes(l[u]))return!1;for(let u=0;u<a.length;u++)if(o(d).includes(a[u]))return!1;return!0})}objectToString(e){if(!e)return"";const t=[],o=Object.keys(e);for(let i=0;i<o.length;i++){const s=o[i];t.push(e[s])}return t.join(" ").toLowerCase()}}class Qt{static bodyRenderer(e){return new T(void 0,e,void 0)}}class Zt{constructor(e,t=!0,o=!1){this.property=e,this.skipCheckableCheck=t,this.readonly=o}render(e,t,o,i,s,r,n){if(this.readonly||this.skipCheckableCheck||s.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=s.getRowByIndex(t),d=s.getValueByT(l,this.property)===!0?"checked":"",h=this.readonly?" readonly ":"";if(n.addClass(e,"ge-padding-property-checkbox"),e.innerHTML=`
276
276
  <input
277
277
  type="checkbox"
278
278
  data-area="${i}"
@@ -282,10 +282,10 @@
282
282
  data-input-type="checkbox"
283
283
  ${d}
284
284
  ${h}
285
- class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(m,b)=>(l[this.property]=!l[this.property],!0))}}}}class Jt{render(e,t,o,i,s,r,n){r&&(e.innerText=new Date(r).toISOString())}}class Qt{constructor(){this.formatter=new Intl.DateTimeFormat("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"})}render(e,t,o,i,s,r,n){if(r){let l="";try{l=this.formatter.format(new Date(r))}catch{l=r}e.innerHTML=`
285
+ class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(m,b)=>(l[this.property]=!l[this.property],!0))}}}}class eo{render(e,t,o,i,s,r,n){r&&(e.innerText=new Date(r).toISOString())}}class to{constructor(){this.formatter=new Intl.DateTimeFormat("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"})}render(e,t,o,i,s,r,n){if(r){let l="";try{l=this.formatter.format(new Date(r))}catch{l=r}e.innerHTML=`
286
286
  <div class="ge-table-label-div" data-row-index="${t}" data-col-index="${o}" data-area="${i}" style="position: relative; background: transparent; width: 100%; height: 100%;">
287
287
  <div class="ge-table-label" data-row-index="${t}" data-col-index="${o}" data-area="${i}">${l}</div>
288
- </div>`}}}class Zt{render(e,t,o,i,s,r,n){r&&(e.innerText=new Date(r).toLocaleDateString())}}class eo{render(e,t,o,i,s,r,n){r==="male"||r==="m"?e.innerText="♂":(r==="female"||r==="f")&&(e.innerText="♀")}}class to{constructor(e=100,t=!1){this.maxValue=e,this.labelVisible=t}render(e,t,o,i,s,r,n){if(n.addClass(e,"ge-progressbar-div"),!isNaN(r)){const a=Number(r)*100/this.maxValue,d=this.labelVisible?Math.round(a)+"%":"";e.innerHTML=`
288
+ </div>`}}}class oo{render(e,t,o,i,s,r,n){r&&(e.innerText=new Date(r).toLocaleDateString())}}class io{render(e,t,o,i,s,r,n){r==="male"||r==="m"?e.innerText="♂":(r==="female"||r==="f")&&(e.innerText="♀")}}class so{constructor(e=100,t=!1){this.maxValue=e,this.labelVisible=t}render(e,t,o,i,s,r,n){if(n.addClass(e,"ge-progressbar-div"),!isNaN(r)){const a=Number(r)*100/this.maxValue,d=this.labelVisible?Math.round(a)+"%":"";e.innerHTML=`
289
289
  <div class="ge-table-label-div"
290
290
  data-row-index="${t}"
291
291
  data-col-index="${o}"
@@ -304,10 +304,10 @@
304
304
  data-area="${i}">&nbsp;
305
305
  </div>
306
306
  </div>
307
- </div>`}}}class oo{render(e,t,o,i,s,r,n){r==="true"||r===!0?e.innerHTML='<span class="ge-true-text-color">✅</span>':r==="false"||r===!1?e.innerHTML='<span class="ge-false-text-color">❌</span>':e.innerText=""}}class io{render(e,t,o,i,s,r,n){r&&(e.innerText=new Date(r).toISOString().replace(/T/g," ").replace(/\..*/g,""))}}class so{constructor(e=Number.MIN_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER){this.min=e,this.max=t}render(e,t,o,i,s,r,n){r&&(e.innerText=r,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class ro{constructor(e){this.property=e}render(e,t,o,i,s,r,n){n.addClass(e,"ge-star-rating-div");const l=s.getRowByIndex(t),a=+(""+s.getValueByT(l,this.property));if(!isNaN(a)){const d=[];for(let u=0;u<a;u++)d.push("★");const h=d.join(" ");e.innerHTML=`
307
+ </div>`}}}class ro{render(e,t,o,i,s,r,n){r==="true"||r===!0?e.innerHTML='<span class="ge-true-text-color">✅</span>':r==="false"||r===!1?e.innerHTML='<span class="ge-false-text-color">❌</span>':e.innerText=""}}class lo{render(e,t,o,i,s,r,n){r&&(e.innerText=new Date(r).toISOString().replace(/T/g," ").replace(/\..*/g,""))}}class no{constructor(e=Number.MIN_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER){this.min=e,this.max=t}render(e,t,o,i,s,r,n){r&&(e.innerText=r,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class ao{constructor(e){this.property=e}render(e,t,o,i,s,r,n){n.addClass(e,"ge-star-rating-div");const l=s.getRowByIndex(t),a=+(""+s.getValueByT(l,this.property));if(!isNaN(a)){const d=[];for(let u=0;u<a;u++)d.push("★");const h=d.join(" ");e.innerHTML=`
308
308
  <div class="ge-table-label-div" data-row-index="${t}" data-col-index="${o}" data-area="${i}" style="position: relative; background: transparent; width: 100%; height: 100%;">
309
309
  <div class="ge-table-label" data-row-index="${t}" data-col-index="${o}" data-area="${i}">${h}</div>
310
- </div>`}}}class lo{constructor(e,t=100,o=!1){this.property=e,this.maxValue=t,this.labelVisible=o}render(e,t,o,i,s,r,n){n.addClass(e,"ge-star-rating-div");const l=s.getRowByIndex(t),a=+(""+s.getValueByT(l,this.property));if(!isNaN(a)){const d=a*100/this.maxValue,h=this.labelVisible?Math.round(d)+"%":"";e.innerHTML=`
310
+ </div>`}}}class ho{constructor(e,t=100,o=!1){this.property=e,this.maxValue=t,this.labelVisible=o}render(e,t,o,i,s,r,n){n.addClass(e,"ge-star-rating-div");const l=s.getRowByIndex(t),a=+(""+s.getValueByT(l,this.property));if(!isNaN(a)){const d=a*100/this.maxValue,h=this.labelVisible?Math.round(d)+"%":"";e.innerHTML=`
311
311
  <div class="ge-table-label-div"
312
312
  data-row-index="${t}"
313
313
  data-col-index="${o}"
@@ -326,7 +326,7 @@
326
326
  data-area="${i}">&nbsp;
327
327
  </div>
328
328
  </div>
329
- </div>`}}}class no{render(e,t,o,i,s,r,n){if(r){e.innerHTML=`
329
+ </div>`}}}class co{render(e,t,o,i,s,r,n){if(r){e.innerHTML=`
330
330
  <div
331
331
  class="ge-table-label-div"
332
332
  data-row-index=${t}"
@@ -337,7 +337,7 @@
337
337
  class="ge-table-label"
338
338
  data-row-index="${t}"
339
339
  data-col-index="${o}"
340
- data-area="${i}">${r}</div></div>`;const l=Number(r);l>0?n.addClass(e,"ge-positive-text-color"):l<0&&n.addClass(e,"ge-negative-text-color")}}}const ao=function(c,e,t){return c?Number(c):""};class we{constructor(e){this.options=e}static create(e){return new we(e.map(t=>new Ue(t,t)))}render(e,t,o,i,s,r,n){if(s.isEditable(t,o)){n.addClass(e,"ge-table-row-select-div");const l=s.getValueAt(t,o);let a=[];for(let h of this.options){const u=h.value===l?" selected ":"";a.push(`<option value="${h.value}" ${u}>${h.label}</option>`)}const d=a.join("");e.innerHTML=`
340
+ data-area="${i}">${r}</div></div>`;const l=Number(r);l>0?n.addClass(e,"ge-positive-text-color"):l<0&&n.addClass(e,"ge-negative-text-color")}}}const uo=function(c,e,t){return c?Number(c):""};class we{constructor(e){this.options=e}static create(e){return new we(e.map(t=>new Je(t,t)))}render(e,t,o,i,s,r,n){if(s.isEditable(t,o)){n.addClass(e,"ge-table-row-select-div");const l=s.getValueAt(t,o);let a=[];for(let h of this.options){const u=h.value===l?" selected ":"";a.push(`<option value="${h.value}" ${u}>${h.label}</option>`)}const d=a.join("");e.innerHTML=`
341
341
  <select
342
342
  type="text"
343
343
  value="${l}"
@@ -348,4 +348,4 @@
348
348
  data-col-index="${o}"
349
349
  data-input-type="text"
350
350
  style="width:100%;height:100%;border:0;padding:0 0 0 8px;"
351
- class="ge-table-cell-editor-select">${d}</select>`}}}class ho extends fe{constructor(e){super("row","multi"),this.model=e}getSelectedRowItems(e){const t=this.getMergedRowIndices();return this.isAllSelected()?e:e.filter((o,i)=>t.includes(i))}selectRow(e){this.addRange(R.singleRow(e))}unselectRow(e){this.removeSelection(R.singleRow(e))}toggleSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection())this.selectAll();else{const e=this.model.getAllRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleFilteredRowsSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection()){const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.selectRow(t);this.silent=!1,this.fireChangeEvent()}else{const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleRow(e){this.isSelected(e,0)?this.unselectRow(e):this.selectRow(e)}}class co{constructor(e,t,o){this.r=e,this.g=t,this.b=o}}class ue{constructor(e,t,o,i){this.minValue=e,this.minColor=t,this.maxValue=o,this.maxColor=i}}class W{static normalize(e,t,o,i=0,s=1){return(e-t)/(o-t)*(s-i)+i}static getTwoColorGradientRGB(e,t){const o=W.normalize(e,t.minValue,t.maxValue,0,1),i=t.maxColor.r-t.minColor.r,s=t.maxColor.g-t.minColor.g,r=t.maxColor.b-t.minColor.b,n=i*o+t.minColor.r,l=s*o+t.minColor.g,a=r*o+t.minColor.b;return`rgb(${Math.round(n)}, ${Math.round(l)}, ${Math.round(a)})`}static getThreeColorGradientRGB(e,t){return e<t.middleValue?W.getTwoColorGradientRGB(e,new ue(t.minValue,t.minColor,t.middleValue,t.middleColor)):e>t.middleValue?W.getTwoColorGradientRGB(e,new ue(t.middleValue,t.middleColor,t.maxValue,t.maxColor)):`rgb(${t.middleColor.r}, ${t.middleColor.g}, ${t.middleColor.b})`}}class uo{constructor(e,t,o,i,s,r){this.minValue=e,this.minColor=t,this.middleValue=o,this.middleColor=i,this.maxValue=s,this.maxColor=r}}exports.AbstractAreaModel=ee;exports.AreaMapFactory=Gt;exports.AreaModel=Yt;exports.AreaModelArrayOfArrays=D;exports.AreaModelCellGroups=Xt;exports.AreaModelHidden=_;exports.AreaModelObjectArray=Xe;exports.AreaModelObjectArrayWithColumndefs=he;exports.AreaModelTree=ne;exports.AreaObjectMap=T;exports.AutoRestoreOptions=jt;exports.AvoidDoubleExecution=Qe;exports.CellGroup=qe;exports.CellGroupExt=Je;exports.CellGroupExtCellRenderer=K;exports.CellRange=R;exports.CellgroupFactory=E;exports.CheckboxBooleanPropertyCellRenderer=qt;exports.CheckboxCellRenderer=ce;exports.CheckboxColumnDef=Wt;exports.CheckboxModel=Ye;exports.ChunkData=Ft;exports.ColAndRowspanModel=De;exports.CollapsedExpandedData=Ee;exports.ColorRgb=co;exports.ColumnDef=V;exports.ConvenienceDomService=ye;exports.CopyService=G;exports.CssVars=ie;exports.DateToIntlDDMMYYYYCellRenderer=Qt;exports.DateToIsoCellRenderer=Jt;exports.DateToLocaleDateCellRenderer=Zt;exports.DateToTecCellRenderer=io;exports.DefaultRowHeights=H;exports.EleScope=ke;exports.EventAdapter=oe;exports.FalseFn=re;exports.FocusModel=Ge;exports.GeCellIndices=$e;exports.GeCssColorUtil=W;exports.GeFilterService=Kt;exports.GeKeyEvent=Nt;exports.GeModelChangeEvent=Z;exports.GeMouseEvent=J;exports.GeoData=F;exports.Icon=O;exports.IndexAndPx=Ot;exports.InputCellRenderer=We;exports.InputHandler=Oe;exports.LicenseManager=P;exports.MaleFemaleToIconCellRenderer=eo;exports.MouseHandler=Re;exports.MouseTargetData=ve;exports.MultiRowsSelectionModel=ho;exports.NumberCellProgressBarCellRenderer=to;exports.NumberCellRenderer=so;exports.OsxShortcutActionIdMapping=He;exports.Padding=de;exports.PositiveAndNegativeNumberRenderer=no;exports.ProgressBarCellRenderer=lo;exports.RenderScope=_e;exports.Renderer=Ut;exports.RequestChunk=Ke;exports.SelectCellRenderer=we;exports.SelectionModel=fe;exports.SelectionService=Pe;exports.ShortcutService=Be;exports.SimpleDomService=Ve;exports.Size=S;exports.SortItem=Fe;exports.SortedOptions=pe;exports.StarRatingCellRenderer=ro;exports.StoreStateCollapsedExpandService=Ie;exports.StoreStateScrollPosService=Me;exports.StoreStateSortingService=Te;exports.TableApi=Ae;exports.TableCellUpdateEvent=zt;exports.TableFactory=$;exports.TableModel=z;exports.TableModelAndOptions=_t;exports.TableOptions=Y;exports.TableScope=Se;exports.ThreeColorGradientArg=uo;exports.TreeCheckboxModel=ae;exports.TreeFactory=X;exports.TreeOptions=ge;exports.TreeRow=se;exports.TreeRowService=ze;exports.TrueFalseCellRenderer=oo;exports.TrueFn=Ne;exports.TwoColorGradientArg=ue;exports.ValueLabel=Ue;exports.WindowsShortcutActionIdMapping=Le;exports.actionIds=Dt;exports.allCenter=Bt;exports.allLeft=Ht;exports.allRight=Vt;exports.bodyCenter=Pt;exports.bodyLeft=$t;exports.bodyRight=Lt;exports.editInputPipeForNumber=ao;exports.getAreaIdentByString=Q;exports.isAreaModelTree=j;exports.isCheckboxColumnDef=Ce;exports.isTreeRow=L;exports.px0=kt;exports.px10=Tt;exports.px100=xt;exports.px110=wt;exports.px120=St;exports.px130=mt;exports.px140=ft;exports.px150=bt;exports.px160=pt;exports.px170=gt;exports.px180=ut;exports.px190=ct;exports.px20=It;exports.px200=le;exports.px210=ht;exports.px220=dt;exports.px230=at;exports.px240=nt;exports.px250=lt;exports.px260=rt;exports.px270=st;exports.px280=it;exports.px290=ot;exports.px30=Et;exports.px300=tt;exports.px40=Mt;exports.px50=At;exports.px60=Rt;exports.px70=vt;exports.px80=yt;exports.px90=Ct;
351
+ class="ge-table-cell-editor-select">${d}</select>`}}}class go extends fe{constructor(e){super("row","multi"),this.model=e}getSelectedRowItems(e){const t=this.getMergedRowIndices();return this.isAllSelected()?e:e.filter((o,i)=>t.includes(i))}selectRow(e){this.addRange(R.singleRow(e))}unselectRow(e){this.removeSelection(R.singleRow(e))}toggleSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection())this.selectAll();else{const e=this.model.getAllRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleFilteredRowsSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection()){const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.selectRow(t);this.silent=!1,this.fireChangeEvent()}else{const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleRow(e){this.isSelected(e,0)?this.unselectRow(e):this.selectRow(e)}}class po{constructor(e,t,o){this.r=e,this.g=t,this.b=o}}class ue{constructor(e,t,o,i){this.minValue=e,this.minColor=t,this.maxValue=o,this.maxColor=i}}class W{static normalize(e,t,o,i=0,s=1){return(e-t)/(o-t)*(s-i)+i}static getTwoColorGradientRGB(e,t){const o=W.normalize(e,t.minValue,t.maxValue,0,1),i=t.maxColor.r-t.minColor.r,s=t.maxColor.g-t.minColor.g,r=t.maxColor.b-t.minColor.b,n=i*o+t.minColor.r,l=s*o+t.minColor.g,a=r*o+t.minColor.b;return`rgb(${Math.round(n)}, ${Math.round(l)}, ${Math.round(a)})`}static getThreeColorGradientRGB(e,t){return e<t.middleValue?W.getTwoColorGradientRGB(e,new ue(t.minValue,t.minColor,t.middleValue,t.middleColor)):e>t.middleValue?W.getTwoColorGradientRGB(e,new ue(t.middleValue,t.middleColor,t.maxValue,t.maxColor)):`rgb(${t.middleColor.r}, ${t.middleColor.g}, ${t.middleColor.b})`}}class bo{constructor(e,t,o,i,s,r){this.minValue=e,this.minColor=t,this.middleValue=o,this.middleColor=i,this.maxValue=s,this.maxColor=r}}exports.AbstractAreaModel=ee;exports.AreaMapFactory=jt;exports.AreaModel=Ut;exports.AreaModelArrayOfArrays=D;exports.AreaModelCellGroups=qt;exports.AreaModelHidden=_;exports.AreaModelObjectArray=Ue;exports.AreaModelObjectArrayWithColumndefs=he;exports.AreaModelTree=ne;exports.AreaObjectMap=T;exports.AutoRestoreOptions=Kt;exports.AvoidDoubleExecution=tt;exports.CellGroup=Qe;exports.CellGroupExt=Ze;exports.CellGroupExtCellRenderer=K;exports.CellRange=R;exports.CellgroupFactory=E;exports.CheckboxBooleanPropertyCellRenderer=Zt;exports.CheckboxCellRenderer=ce;exports.CheckboxColumnDef=Nt;exports.CheckboxModel=Ke;exports.ChunkData=Pt;exports.ColAndRowspanModel=_e;exports.CollapsedExpandedData=Ie;exports.ColorRgb=po;exports.ColumnDef=V;exports.ConvenienceDomService=ve;exports.CopyService=G;exports.CssVars=ie;exports.DateToIntlDDMMYYYYCellRenderer=to;exports.DateToIsoCellRenderer=eo;exports.DateToLocaleDateCellRenderer=oo;exports.DateToTecCellRenderer=lo;exports.DefaultRowHeights=H;exports.EleScope=De;exports.EventAdapter=oe;exports.FalseFn=re;exports.FocusModel=ze;exports.GeCellIndices=Pe;exports.GeCssColorUtil=W;exports.GeFilterService=Jt;exports.GeKeyEvent=Yt;exports.GeModelChangeEvent=Z;exports.GeMouseEvent=J;exports.GeoData=F;exports.Icon=O;exports.IndexAndPx=Lt;exports.InputCellRenderer=Ge;exports.InputHandler=$e;exports.LicenseManager=P;exports.MaleFemaleToIconCellRenderer=io;exports.MouseHandler=Ae;exports.MouseTargetData=Re;exports.MultiRowsSelectionModel=go;exports.NumberCellProgressBarCellRenderer=so;exports.NumberCellRenderer=no;exports.OsxShortcutActionIdMapping=Be;exports.Padding=de;exports.PositiveAndNegativeNumberRenderer=co;exports.ProgressBarCellRenderer=ho;exports.RenderScope=Fe;exports.Renderer=Qt;exports.RequestChunk=qe;exports.ResizeHandler=Ne;exports.SelectCellRenderer=we;exports.SelectionModel=fe;exports.SelectionService=Le;exports.ShortcutService=Ve;exports.SimpleDomService=We;exports.Size=S;exports.SortItem=Oe;exports.SortedOptions=pe;exports.StarRatingCellRenderer=ao;exports.StoreStateCollapsedExpandService=Te;exports.StoreStateScrollPosService=Ee;exports.StoreStateSortingService=ke;exports.TableApi=Me;exports.TableCellUpdateEvent=Xt;exports.TableFactory=$;exports.TableModel=N;exports.TableModelAndOptions=$t;exports.TableOptions=Y;exports.TableScope=Se;exports.ThreeColorGradientArg=bo;exports.TreeCheckboxModel=ae;exports.TreeFactory=X;exports.TreeOptions=ge;exports.TreeRow=se;exports.TreeRowService=Ye;exports.TrueFalseCellRenderer=ro;exports.TrueFn=je;exports.TwoColorGradientArg=ue;exports.ValueLabel=Je;exports.WindowsShortcutActionIdMapping=He;exports.actionIds=Ot;exports.allCenter=Gt;exports.allLeft=Wt;exports.allRight=zt;exports.bodyCenter=Bt;exports.bodyLeft=Ht;exports.bodyRight=Vt;exports.debounce=Ce;exports.editInputPipeForNumber=uo;exports.getAreaIdentByString=Q;exports.isAreaModelTree=j;exports.isCheckboxColumnDef=ye;exports.isTreeRow=L;exports.px0=Ft;exports.px10=_t;exports.px100=vt;exports.px110=yt;exports.px120=Ct;exports.px130=xt;exports.px140=wt;exports.px150=St;exports.px160=mt;exports.px170=ft;exports.px180=bt;exports.px190=pt;exports.px20=Dt;exports.px200=le;exports.px210=gt;exports.px220=ut;exports.px230=ct;exports.px240=ht;exports.px250=dt;exports.px260=at;exports.px270=nt;exports.px280=lt;exports.px290=rt;exports.px30=kt;exports.px300=st;exports.px40=Tt;exports.px50=It;exports.px60=Et;exports.px70=Mt;exports.px80=At;exports.px90=Rt;exports.throttle=et;