@guiexpert/react-table 18.1.66 → 18.1.68
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 +7 -7
- package/index.js +140 -98
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("react/jsx-runtime"),X=require("react"),re=require("react-dom");function ae(p,e=500){let t=null;return function(...s){t&&window.clearTimeout(t),t=window.setTimeout(()=>{p.apply(this,s),t=null},e)}}class k{constructor(){this.alreadySet=!1}static getInstance(){return k.instance||(k.instance=new k),k.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function B(p){return p&&p.type==="TreeRow"}function V(p){return p&&p.type==="AreaModelTree"}class _{constructor(e=-1,t=-1,s=-1,o=-1,i,r,l,a=0,n=0,c=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=r,this.originalEvent=l,this.clickCount=a,this.draggingX=n,this.draggingY=c,this.action=h}clone(){return new _(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class D{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class Q{constructor(e=new D(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new D(">","",["ge-table-tree-arrow-collapsed"]),s=new D(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new D("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class ee{constructor(e=new D("↑","",["ge-header-sorted-asc"]),t=new D("↓","",["ge-header-sorted-desc"]),s=new D("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class le{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,o])=>this.domService.setStyle(e,s,o+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,o){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",s),this.domService.setAttribute(i,"data-side",o),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,o,i,r=""){const l=t.index??-1,a=this.getDivOrCreateDiv(l,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),o==="body"&&i==="center"){const n=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${n}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${o}`),r){const n=this.domService.createText(r);this.domService.appendChild(a,n)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:r,sideIdent:l,text:a="",treeArrow:n,tableOptions:c,checkedType:h=void 0,sortState:d}=e,u=c==null?void 0:c.treeOptions,g=c==null?void 0:c.showCheckboxWihoutExtraColumn,b=this.domService.createElement("div");this.domService.addClass(b,"ge-table-col-div"),g&&this.domService.addClass(b,"ge-with-checkbox"),this.domService.addClass(b,`ge-table-col-div-${s.index}`),this.domService.setAttribute(b,"data-col-index",`${s.index}`),this.domService.setAttribute(b,"data-row-index",`${o}`),this.domService.setAttribute(b,"data-area",`${r}`);const f=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&l==="center"&&this.domService.addClass(b,`ge-table-column-${f}`),this.domService.setStyle(b,"display","clip"),this.domService.setStyle(b,"position","absolute"),this.domService.setStyle(b,"left",`${s.left}px`),this.domService.setStyle(b,"top",`${s.top}px`),this.domService.setStyle(b,"width",`${s.width}px`),this.domService.setStyle(b,"height",`${s.height}px`),n&&n!=="none"&&(this.domService.addClass(b,"ge-table-col-tree"),this.addArrowDiv(b,n,u,o,i,r)),g&&i===0&&h&&this.addCheckboxToDiv(b,h,r,o),a){const m=n!=="none"&&i===0;this.addLabelDiv(b,a,m,o,i,r)}return d&&this.addSortedIcon(b,d,c==null?void 0:c.sortedOptions,i),this.domService.appendChild(t,b),b}addCheckboxToDiv(e,t,s,o){const i=this.domService.createElement("div"),r=t==="full"?"checked":"";return i.innerHTML=`
|
|
2
2
|
<input
|
|
3
3
|
type="checkbox"
|
|
4
4
|
data-area="${s}"
|
|
5
5
|
data-row-index="${o}"
|
|
6
6
|
data-input-type="checkbox"
|
|
7
7
|
${r}
|
|
8
|
-
class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${o}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",s=!1,o=-1,i=-1,r="body"){const l=this.domService.createElement("div");if(this.domService.addClass(l,"ge-table-label-div"),this.domService.setStyle(l,"position","relative"),this.domService.setStyle(l,"background","transparent"),this.domService.setStyle(l,"width","100%"),this.domService.setStyle(l,"height","100%"),this.domService.setAttribute(l,"data-row-index",`${o}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(l,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(l,a);const n=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,n),this.domService.setAttribute(a,"data-row-index",`${o}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,l),l}addSortedIcon(e,t="",s=new Q,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=s.iconAsc:t==="desc"?r=s.iconDesc:r=s.iconPlaceholder;const l=r.content,a=this.domService.createText(l);this.domService.appendChild(i,a),r.style&&this.applyStyleString(i,r.style);for(const n of r.classes)this.domService.addClass(i,n);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Z,o=-1,i=-1,r="body"){const l=this.domService.createElement("div");this.domService.addClass(l,"ge-table-tree-arrow-div"),this.domService.setStyle(l,"display","inline-block"),this.domService.setStyle(l,"position",""),this.domService.setStyle(l,"width","20px"),this.domService.setStyle(l,"background","transparent"),this.domService.setStyle(l,"cursor","pointer"),this.domService.setAttribute(l,"data-row-index",`${o}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const n=a.content,c=this.domService.createText(n);this.domService.appendChild(l,c),a.style&&this.applyStyleString(l,a.style);for(const h of a.classes)this.domService.addClass(l,h);return this.domService.appendChild(e,l),l}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const r=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};let o=this.domService.createElement("div");return this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left+t.width-1}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top+t.height-1}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,r]=o.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}}const _=p=>p==="header"?"header":p==="footer"?"footer":"body";class le{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=_(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class ne{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(console.info("onHostElementClicked",t-this.lastClicked<this.doubleClickDelay),t-this.lastClicked<this.doubleClickDelay){this.lastClicked=t,this.publishGeMouseEvent(e,2);return}this.lastClicked=t;const s=new le(e.target,this.tableScope);if(s.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(s.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(s),e.preventDefault(),e.stopPropagation();else if(s.inputType==="checkbox"&&s.areaIdent)this.tableScope.toggleRowCheckbox(s.rowIdx,s.colIdx,s.areaIdent),e.preventDefault(),e.stopPropagation();else if(O(s.row)&&s.areaModel){const o=s.colIdx===this.getArrowColumnIndex()&&e.altKey,i=s.className.includes("ge-table-tree-arrow-div");if(o||i){e.preventDefault(),e.stopPropagation();const r=s.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(s.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const o=this.tableScope.tableOptions.getFocusModel();o==null||o.clear(),o==null||o.setFocus(s.rowIdx,s.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(console.info("ONHOSTELEMENTDBLCLICKED",e),this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),o=_(s),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),l=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const a=l.getRowByIndex(i);if(s&&o==="body"&&l.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),O(a)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const n=a;n.expanded=!n.expanded,"recalcVisibleTreeRows"in l&&l.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(n)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent)}updateCollapsedExpandedState(e){var s,o,i,r,l;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const a=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,n=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,c=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,h=t(e.data);n?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):c&&((l=this.tableScope.storeStateCollapsedExpandService)==null||l.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 ce{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(o=>o.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 s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.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 o,i;const s=(o=this.columnDefs)==null?void 0:o[t];return((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var l;const o=(l=this.columnDefs[t])==null?void 0:l.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),s):(i[r]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const o=t.shift();if(o){const i=e[o];return i&&t.length?this.setPropertyValue(i,t,s):(e[o]=s,!0)}return!1}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),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 de{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const o=e,i=t;if(o.length&&i.length)return this.genericSortComparator(o[0],i[0],s)}return s*(""+e).localeCompare(""+t)}}class he extends ce{constructor(e,t,s,o=[],i="ge-selected-row",r="ge-focused-row"){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.selectedRowClass=i,this.focusedRowClass=r,this.focusedRowIndex=0,this.sorterService=new de,this.filteredRows=[...t],this.properties=o.map(l=>l.property)}setRows(e){this.rows=e,this.filteredRows=[...e]}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];return O(o)&&(o=o.data),o?this.getValueByT(o,s):""}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:s,sortState:o}=t,i=o==="asc"?1:o==="desc"?-1:0,r=this.properties[s];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!0}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&s.push(this.selectedRowClass),this.focusedRowIndex===e&&s.push(this.focusedRowClass),s}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o,e),l=this.getValueByT(i,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,l,o,i,t):this.sorterService.genericSortComparator(r,l,t)}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class pe{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}downloadExcel(e="table.xlsx",t=""){const s=[],o=this.tableScope.tableModel.getColumnCount(),i=["header","body","footer"];for(const r of i){const l=this.tableScope.tableModel.getAreaModel(r),a=(l==null?void 0:l.getRowCount())??0;for(let n=0;n<a;n++){const c=[];s.push(c);for(let h=0;h<o;h++)c.push(l.getValueAt(n,h))}}return this.tableScope.excelService.downloadExcel(s,e,t)}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){const t=this.getBodyModel();t instanceof he?t.setRows(e):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t)}reSort(){this.tableScope.reSort()}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}}class N{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((o,i)=>{t[o]=i}),t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const o=s();if(o){const i=o+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class ge extends N{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class ue{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class fe extends N{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new ue,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,o=this.loadFromLocalStorage(s);o&&(this.collapsedExpandedState=o)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class me extends N{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class T{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}class be{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new T,this.areaBodyCenterGeo=new T,this.areaBodyEastGeo=new T;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class E{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new E(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new E(e,t,e,t)}static singleRow(e){return new E(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new E(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Se{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),r=this.areaModel.getRowspanAt(s,o);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const l="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new E(s,o,s+r-1,o+i-1,l))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class ye{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class xe extends be{constructor(e,t,s,o){var r,l;super(e,t,s,o),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 ye,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.displayedRowCount=0,this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(l=this.tableOptions)!=null&&l.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),$(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var n;this.colAndRowspanModels[a]=new Se(t,t.getAreaModel(a)),(n=this.colAndRowspanModels[a])==null||n.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=e||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 T(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new T(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const r=this.tableModel.getAreaModel(e),l='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=document.querySelector(l);if(a){let n;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let h;if(c?h=this.editorRenderer:h=r.getCellRenderer(t,s),a.innerText="",this.applyCssClasses(a,i),h)n=h.render(a,t,s,e,r,o,this.dom.domService),n&&this.cleanupFunctions[e].push(n);else{const g=`${o}`;this.dom.addLabelDiv(a,g,!1,t,s,e)}const d=r.getCustomClassesAt(t,s);d.length&&this.dom.addClasses(d,a);const f=r.getCustomStyleAt(t,s);if(f)for(const g in f)this.dom.setStyle(a,g,f[g])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var u;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const l=0,a=this.areaBodyCenterGeo.width,n=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),h=c.getRowCount();for(;this.cleanupFunctions[e].length;){const m=this.cleanupFunctions[e].shift();m&&m()}let d=t;const f=this.tableModel.getColumnCount(),g=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();for(let m=0;m<h;m++){const x=d,S=m===h-1,v=this.tableModel.getRowHeight(e,m);if(x+v>0){this.firstVisibleRowIndex=m;let w={left:l,width:a,height:v,top:x,index:m},y=this.dom.addRowDiv(o,w,m,e,"center");const M=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:w,parent:y,rowIndex:m,columnIndexStart:M,columnIndexEnd:f-g-1,verticalFixed:!1,lastRowOfModel:S}),n.left>0&&(w={left:l,width:this.areaBodyWestGeo.width,height:v,top:x,index:m},y=this.dom.addRowDiv(s,w,m,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:w,parent:y,rowIndex:m,columnIndexStart:0,columnIndexEnd:M-1,verticalFixed:!0,lastRowOfModel:S})),n.right>0&&(w={left:l,width:this.areaBodyEastGeo.width,height:v,top:x,index:m},y=this.dom.addRowDiv(i,w,m,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:w,parent:y,rowIndex:m,columnIndexStart:f-g,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:S})),e==="header"&&this.tree&&m===h-1){const A=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(y,new T(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),R=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(R){const L=this.dom.domService.createText(R.content);this.dom.domService.appendChild(A,L),R.style&&this.dom.applyStyleString(A,R.style)}}}if(d=d+v,d>r){e==="body"&&(this.displayedRowCount=this.firstVisibleRowIndex-m);break}}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const m=((u=this.colAndRowspanModels[e])==null?void 0:u.getRanges())??[];if(m.length)for(const x of m){let S=0,v=o.child,w="center";if(x.c1<b)v=s.child,w="west";else if(g>0&&x.c1>=f-g)v=i.child,w="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*y-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(x,S,t,c,v,w)}}}drawBigCell(e,t,s,o,i,r){const l=s+this.getRowHeights(0,e.r1-1,o).reduce((u,m)=>u+m,0),a=this.tableModel.getColumnCount(),n=this.tableModel.getFixedRightColumnCount();let c=0;n>0&&e.c1>=a-n&&(c=a-n);const h=t+this.getColumnWidths(c,e.c1-1).reduce((u,m)=>u+m,0),d=this.getRowHeights(e.r1,e.r2,o).reduce((u,m)=>u+m,0),f=this.getColumnWidths(e.c1,e.c2).reduce((u,m)=>u+m,0);let g=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(g=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:f,height:d,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:f,height:d,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:l,cellWidth:f,cellHeight:d,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,s);if(r>1&&i+r+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:r,columnIndexStart:l,columnIndexEnd:a,verticalFixed:n=!1,lastRowOfModel:c=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!n){const u=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*u}const d=0,f=!!(e==="body"&&t);let g=h;for(let u=l;u<=a;u++){const m=g,x=this.tableModel.getColumnWidth(u);if(x>0&&m+x>0){let S=o.height;const v=s.getRowspanAt(r,u),w=s.getColspanAt(r,u);v>1&&(S=this.getRowHeights(r,r+v-1,s).reduce((A,R)=>A+R,0));let y=x;w>1&&(y=this.getColumnWidths(u,u+w-1).reduce((A,R)=>A+R,0));let M=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(r,u)&&(M=!0),this.draggingTargetColumnIndex===u&&e!=="header"){this.renderDragTargetDiv(i,m,d,y,S);const A={left:m,top:d,width:y,height:S};this.dom.addColumnBorderDivs(this.tableOptions,i,A,e,t)}else{const A=this.renderSelectedBackgroundDiv(M,f,t,s,r,u,i,m,d,y,S);"gammaCells"in s&&s.getValueAt(r,u)&&(M=!1),M||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:u,left:m,top:d,width:y,height:S,parent:i,cellSelected:A,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:u,cellLeft:m,cellTop:d,cellWidth:y,cellHeight:S,parent:i})}}if(g=g+x,g>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(g-1,1,o.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:l,height:a,top:n,parent:c,lastRowOfModel:h}){var U;const f=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),g={left:r,width:l,height:a,top:n,index:i},b=e.getRowByIndex(o);let u="none";if(i===this.getTreeArrowColumnIndex()&&O(b)){const C=b;(U=C.children)!=null&&U.length?C.expanded?u="expanded":u="collapsed":u="hidden"}let x;if(t==="header"){const C=this.tableModel.getColumnDef(i);(!(C!=null&&C.sortIconVisible)||C!=null&&C.sortIconVisible())&&(x=C==null?void 0:C.sortState)}const S=e.getValueAt(o,i),v=f?"":`${S}`,w=e.isRowChecked(o),y=this.dom.addColumnDiv({parent:c,geo:g,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:v,treeArrow:u,tableOptions:this.tableOptions,checkedType:w,sortState:x}),M=e.getTooltipAt(o,i);M&&this.dom.setAttribute(y,"title",M);const A=this.tableModel.getColumnDef(i);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],y);let R;f&&(R=f.render(y,o,i,t,e,S,this.dom.domService));const L=e.getCustomClassesAt(o,i);if(L.length&&this.dom.addClasses(L,y),this.dom.addColumnBorderDivs(this.tableOptions,c,g,t,s),h&&this.dom.addHorizontalBorder({left:r,width:l,height:a,top:n+a},c),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(o,i)&&this.dom.addFocusBorderDivs(c,g,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const H=e.getCustomStyleAt(o,i);if(H)for(const C in H)this.dom.setStyle(y,C,H[C]);return[y,R]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:o+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-o;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,s){var o,i;if(this.dragging){const r=this.hostElement.clientHeight,l=this.storedColumnWidths[t];if((o=e.originalEvent)!=null&&o.clientX){const c={left:((i=e.originalEvent)==null?void 0:i.clientX)-l/2,width:l,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,c),s&&this.renderContentOfDraggingColumn(c)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,s=0){const o="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const l=e.index??0,a=this.draggingColumn;for(let n=0;n<r;n++){const c=s,h=i.getRowHeight(n),d={left:0,width:e.width,height:h,top:c,index:n},f=i.getValueAt(n,l),g=i.getCellRenderer(n,l),b=g?"":`${f}`,u={parent:a,geo:d,rowIndex:n,columnIndex:l,areaIdent:t,sideIdent:o,text:b},m=this.dom.addColumnDiv(u);let x;g&&(x=g.render(m,n,l,t,i,f,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const S=i.getCustomClassesAt(n,l);S.length&&this.dom.addClasses(S,m);const v=this.tableModel.getColumnDef(l);v&&v.classes[t]&&this.dom.addClasses(v.classes[t],m),this.dom.addColumnBorderDivs(this.tableOptions,a,d,t,o);const w=i.getCustomStyleAt(n,l);if(w)for(const y in w)this.dom.setStyle(m,y,w[y]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${s}px`),this.dom.setStyle(r,"width",`${o}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,s,o,i,r,l,a,n,c,h){let d=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const g=f.getSelectionCount(i,r);d=g>0;for(let b=0;b<g;b++){const u=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,l));this.dom.setStyle(u,"left",`${a}px`),this.dom.setStyle(u,"top",`${n}px`),this.dom.setStyle(u,"width",`${c}px`),this.dom.setStyle(u,"height",`${h}px`)}}}return d}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:r,top:l,width:a,height:n,parent:c,cellSelected:h,lastRowOfModel:d}){const[f,g]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:a,height:n,top:l,parent:c,lastRowOfModel:d});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,f),g&&this.cleanupFunctions[t].push(g)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:r,parent:l}){const a=this.dom.domService,n=this.tableOptions.columnResizeHandleWidthInPx??2,c=a.createElement("div");a.setAttribute(c,"data-col-index",`${t}`),a.setAttribute(c,"data-row-index",`${e}`),a.setAttribute(c,"data-area","header"),a.setAttribute(c,"data-ge-action","resize-column"),a.addClass(c,"ge-table-column-resize-handle"),a.setStyle(c,"display","clip"),a.setStyle(c,"position","absolute"),a.setStyle(c,"cursor","col-resize"),a.setStyle(c,"left",`${s+i-n}px`),a.setStyle(c,"top",`${o}px`),a.setStyle(c,"width",`${n}px`),a.setStyle(c,"height",`${r}px`),a.appendChild(l,c)}}class we{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Ce{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),o=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(s&&o&&i){const r=_(s),l=Number(o),a=Number(i);this.tableScope.updateModelValueAfterEdit(r,l,a,t.value)}}}}class ve{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class G{constructor(e){this.cells=e}static createSingle(e,t){return new G([new ve(e,t)])}}class Ee{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,l,a,n,c,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const d=this.getSelectionModel(),f=this.getFocusModel();d&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(f),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||d.hasSelection()&&(d.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(d.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(l=e.originalEvent)!=null&&l.altKey&&((a=e.originalEvent)!=null&&a.ctrlKey||(n=e.originalEvent)!=null&&n.metaKey)?(d.removeSelection(E.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(c=e.originalEvent)!=null&&c.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(d.addSelection(E.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(d.firstClick(e.rowIndex,e.columnIndex),s=!0),this.tableScope.onSelectionChanged(d))}return o?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),s}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),s=this.getFocusModel();if(t&&s){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[o,i]=s.getFocus();return t.togglePoint(o,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class Ae{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 Re{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}function Me(p){return p.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).sort((e,t)=>{const s={cmd:1,ctrl:2,alt:3,shift:4},o=s[e]||5,i=s[t]||5;return o!==i?o-i:e.localeCompare(t)}).join(" ")}function X(p){let e=p.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&p.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),p.code.startsWith("Numpad")){const s=p.code.replace("Numpad","").toLowerCase();s==="add"?e="num_add":s==="subtract"?e="num_subtract":s==="multiply"?e="num_multiply":s==="divide"?e="num_divide":s==="decimal"?e="num_decimal":s==="enter"?e="num_enter":e="num_"+s}p.code.match(/^F\d+$/)&&(e=p.code.toLowerCase()),p.code.match(/^Digit\d+$/)&&(e=p.code.replace(/Digit/g,""));let t="";return p.ctrlKey&&(t+=" ctrl"),p.altKey&&(t+=t+" alt"),p.shiftKey&&(t+=t+" shift"),p.metaKey&&(t+=t+" cmd"),Me(t+" "+e)}class Te{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this)))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new Re().get()):Object.assign(this.shortcutActionIdMapping,new Ae().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 s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=X(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const s in this.shortcutActionIdMapping)if(X(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[s]),this.shortcutActionIdMapping[s]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class K{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class ee{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class De{render(e,t,s,o,i,r,l){if(i.isEditable(t,s)){l.addClass(e,"ge-table-row-input-div");const a=i.getValueAt(t,s);e.innerHTML=`
|
|
8
|
+
class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${o}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",s=!1,o=-1,i=-1,r="body"){const l=this.domService.createElement("div");if(this.domService.addClass(l,"ge-table-label-div"),this.domService.setStyle(l,"position","relative"),this.domService.setStyle(l,"background","transparent"),this.domService.setStyle(l,"width","100%"),this.domService.setStyle(l,"height","100%"),this.domService.setAttribute(l,"data-row-index",`${o}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(l,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(l,a);const n=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,n),this.domService.setAttribute(a,"data-row-index",`${o}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,l),l}addSortedIcon(e,t="",s=new ee,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=s.iconAsc:t==="desc"?r=s.iconDesc:r=s.iconPlaceholder;const l=r.content,a=this.domService.createText(l);this.domService.appendChild(i,a),r.style&&this.applyStyleString(i,r.style);for(const n of r.classes)this.domService.addClass(i,n);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Q,o=-1,i=-1,r="body"){const l=this.domService.createElement("div");this.domService.addClass(l,"ge-table-tree-arrow-div"),this.domService.setStyle(l,"display","inline-block"),this.domService.setStyle(l,"position",""),this.domService.setStyle(l,"width","20px"),this.domService.setStyle(l,"background","transparent"),this.domService.setStyle(l,"cursor","pointer"),this.domService.setAttribute(l,"data-row-index",`${o}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const n=a.content,c=this.domService.createText(n);this.domService.appendChild(l,c),a.style&&this.applyStyleString(l,a.style);for(const h of a.classes)this.domService.addClass(l,h);return this.domService.appendChild(e,l),l}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const r=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};let o=this.domService.createElement("div");return this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left+t.width-1}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top+t.height-1}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,r]=o.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}}const N=p=>p==="header"?"header":p==="footer"?"footer":"body";class ne{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=N(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class ce{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay){this.lastClicked=t,this.publishGeMouseEvent(e,2);return}this.lastClicked=t;const s=new ne(e.target,this.tableScope);if(s.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(s.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(s),e.preventDefault(),e.stopPropagation();else if(s.inputType==="checkbox"&&s.areaIdent)this.tableScope.toggleRowCheckbox(s.rowIdx,s.colIdx,s.areaIdent),e.preventDefault(),e.stopPropagation();else if(B(s.row)&&s.areaModel){const o=s.colIdx===this.getArrowColumnIndex()&&e.altKey,i=s.className.includes("ge-table-tree-arrow-div");if(o||i){e.preventDefault(),e.stopPropagation();const r=s.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),console.info("this.tableScope.hostElement",this.tableScope.hostElement),console.info("this.tableScope.hostElement.clientWidth",this.tableScope.hostElement.clientWidth),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(s.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const o=this.tableScope.tableOptions.getFocusModel();o==null||o.clear(),o==null||o.setFocus(s.rowIdx,s.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),o=N(s),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),l=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const a=l.getRowByIndex(i);if(s&&o==="body"&&l.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),B(a)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const n=a;n.expanded=!n.expanded,"recalcVisibleTreeRows"in l&&l.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(n)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent)}updateCollapsedExpandedState(e){var s,o,i,r,l;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const a=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,n=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,c=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,h=t(e.data);n?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):c&&((l=this.tableScope.storeStateCollapsedExpandService)==null||l.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 de{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(o=>o.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 s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.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 o,i;const s=(o=this.columnDefs)==null?void 0:o[t];return((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var l;const o=(l=this.columnDefs[t])==null?void 0:l.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),s):(i[r]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const o=t.shift();if(o){const i=e[o];return i&&t.length?this.setPropertyValue(i,t,s):(e[o]=s,!0)}return!1}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),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 he{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const o=e,i=t;if(o.length&&i.length)return this.genericSortComparator(o[0],i[0],s)}return s*(""+e).localeCompare(""+t)}}class F extends de{constructor(e,t,s,o=[],i="ge-selected-row",r="ge-focused-row"){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.selectedRowClass=i,this.focusedRowClass=r,this.focusedRowIndex=0,this.sorterService=new he,this.filteredRows=[...t],this.properties=o.map(l=>l.property)}setRows(e){this.rows=e,this.filteredRows=[...e]}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];return B(o)&&(o=o.data),o?this.getValueByT(o,s):""}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:s,sortState:o}=t,i=o==="asc"?1:o==="desc"?-1:0,r=this.properties[s];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!0}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&s.push(this.selectedRowClass),this.focusedRowIndex===e&&s.push(this.focusedRowClass),s}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o,e),l=this.getValueByT(i,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,l,o,i,t):this.sorterService.genericSortComparator(r,l,t)}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class pe{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}downloadExcel(e="table.xlsx",t=""){const s=[],o=this.tableScope.tableModel.getColumnCount(),i=["header","body","footer"];for(const r of i){const l=this.tableScope.tableModel.getAreaModel(r),a=(l==null?void 0:l.getRowCount())??0;for(let n=0;n<a;n++){const c=[];s.push(c);for(let h=0;h<o;h++)c.push(l.getValueAt(n,h))}}return this.tableScope.excelService.downloadExcel(s,e,t)}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){const t=this.getBodyModel();t instanceof F?t.setRows(e):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRows(e){const t=this.getBodyModel();if(t instanceof F){const s=t;let o=s.getAllRows();s.setRows([...o,...e])}else console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRowsAt(e,t){const s=this.getBodyModel();if(s instanceof F){const o=s;let i=o.getAllRows();o.setRows([...i.slice(0,t),...e,...i.slice(t)])}else console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}removeRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();if(s instanceof F){const o=s,i=o.getAllRows().filter(r=>!e.some(l=>t(r,l)));o.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}findRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();return s instanceof F?s.getAllRows().filter(i=>!e.some(r=>t(i,r))):(console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s),[])}updateRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();if(s instanceof F){let i=s.getAllRows();for(const r of i)for(const l of e)if(t(r,l))for(const a of Object.keys(l))r[a]=l[a]}else console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}reSort(){this.tableScope.reSort()}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}}class G{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((o,i)=>{t[o]=i}),t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const o=s();if(o){const i=o+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class ge extends G{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class fe{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class ue extends G{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new fe,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,o=this.loadFromLocalStorage(s);o&&(this.collapsedExpandedState=o)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class me extends G{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class T{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}class be{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new T,this.areaBodyCenterGeo=new T,this.areaBodyEastGeo=new T;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class E{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new E(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new E(e,t,e,t)}static singleRow(e){return new E(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new E(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Se{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),r=this.areaModel.getRowspanAt(s,o);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const l="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new E(s,o,s+r-1,o+i-1,l))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class ye{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class xe extends be{constructor(e,t,s,o){var r,l;super(e,t,s,o),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 ye,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.displayedRowCount=0,this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(l=this.tableOptions)!=null&&l.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),V(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var n;this.colAndRowspanModels[a]=new Se(t,t.getAreaModel(a)),(n=this.colAndRowspanModels[a])==null||n.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=(!e||e>this.scrollViewport.offsetWidth)&&this.scrollViewport.offsetWidth>100?this.scrollViewport.offsetWidth:this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new T(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const r=this.tableModel.getAreaModel(e),l='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=document.querySelector(l);if(a){let n;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let h;if(c?h=this.editorRenderer:h=r.getCellRenderer(t,s),a.innerText="",this.applyCssClasses(a,i),h)n=h.render(a,t,s,e,r,o,this.dom.domService),n&&this.cleanupFunctions[e].push(n);else{const g=`${o}`;this.dom.addLabelDiv(a,g,!1,t,s,e)}const d=r.getCustomClassesAt(t,s);d.length&&this.dom.addClasses(d,a);const u=r.getCustomStyleAt(t,s);if(u)for(const g in u)this.dom.setStyle(a,g,u[g])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var f;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const l=0,a=this.areaBodyCenterGeo.width,n=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),h=c.getRowCount();for(;this.cleanupFunctions[e].length;){const m=this.cleanupFunctions[e].shift();m&&m()}let d=t;const u=this.tableModel.getColumnCount(),g=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();for(let m=0;m<h;m++){const x=d,S=m===h-1,v=this.tableModel.getRowHeight(e,m);if(x+v>0){this.firstVisibleRowIndex=m;let w={left:l,width:a,height:v,top:x,index:m},y=this.dom.addRowDiv(o,w,m,e,"center");const M=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:w,parent:y,rowIndex:m,columnIndexStart:M,columnIndexEnd:u-g-1,verticalFixed:!1,lastRowOfModel:S}),n.left>0&&(w={left:l,width:this.areaBodyWestGeo.width,height:v,top:x,index:m},y=this.dom.addRowDiv(s,w,m,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:w,parent:y,rowIndex:m,columnIndexStart:0,columnIndexEnd:M-1,verticalFixed:!0,lastRowOfModel:S})),n.right>0&&(w={left:l,width:this.areaBodyEastGeo.width,height:v,top:x,index:m},y=this.dom.addRowDiv(i,w,m,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:w,parent:y,rowIndex:m,columnIndexStart:u-g,columnIndexEnd:u-1,verticalFixed:!0,lastRowOfModel:S})),e==="header"&&this.tree&&m===h-1){const A=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(y,new T(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),R=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(R){const O=this.dom.domService.createText(R.content);this.dom.domService.appendChild(A,O),R.style&&this.dom.applyStyleString(A,R.style)}}}if(d=d+v,d>r){e==="body"&&(this.displayedRowCount=this.firstVisibleRowIndex-m);break}}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const m=((f=this.colAndRowspanModels[e])==null?void 0:f.getRanges())??[];if(m.length)for(const x of m){let S=0,v=o.child,w="center";if(x.c1<b)v=s.child,w="west";else if(g>0&&x.c1>=u-g)v=i.child,w="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*y-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(x,S,t,c,v,w)}}}drawBigCell(e,t,s,o,i,r){const l=s+this.getRowHeights(0,e.r1-1,o).reduce((f,m)=>f+m,0),a=this.tableModel.getColumnCount(),n=this.tableModel.getFixedRightColumnCount();let c=0;n>0&&e.c1>=a-n&&(c=a-n);const h=t+this.getColumnWidths(c,e.c1-1).reduce((f,m)=>f+m,0),d=this.getRowHeights(e.r1,e.r2,o).reduce((f,m)=>f+m,0),u=this.getColumnWidths(e.c1,e.c2).reduce((f,m)=>f+m,0);let g=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(g=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:u,height:d,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:u,height:d,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:l,cellWidth:u,cellHeight:d,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,s);if(r>1&&i+r+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:r,columnIndexStart:l,columnIndexEnd:a,verticalFixed:n=!1,lastRowOfModel:c=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!n){const f=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*f}const d=0,u=!!(e==="body"&&t);let g=h;for(let f=l;f<=a;f++){const m=g,x=this.tableModel.getColumnWidth(f);if(x>0&&m+x>0){let S=o.height;const v=s.getRowspanAt(r,f),w=s.getColspanAt(r,f);v>1&&(S=this.getRowHeights(r,r+v-1,s).reduce((A,R)=>A+R,0));let y=x;w>1&&(y=this.getColumnWidths(f,f+w-1).reduce((A,R)=>A+R,0));let M=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(r,f)&&(M=!0),this.draggingTargetColumnIndex===f&&e!=="header"){this.renderDragTargetDiv(i,m,d,y,S);const A={left:m,top:d,width:y,height:S};this.dom.addColumnBorderDivs(this.tableOptions,i,A,e,t)}else{const A=this.renderSelectedBackgroundDiv(M,u,t,s,r,f,i,m,d,y,S);"gammaCells"in s&&s.getValueAt(r,f)&&(M=!1),M||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:f,left:m,top:d,width:y,height:S,parent:i,cellSelected:A,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:f,cellLeft:m,cellTop:d,cellWidth:y,cellHeight:S,parent:i})}}if(g=g+x,g>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(g-1,1,o.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:l,height:a,top:n,parent:c,lastRowOfModel:h}){var j;const u=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),g={left:r,width:l,height:a,top:n,index:i},b=e.getRowByIndex(o);let f="none";if(i===this.getTreeArrowColumnIndex()&&B(b)){const C=b;(j=C.children)!=null&&j.length?C.expanded?f="expanded":f="collapsed":f="hidden"}let x;if(t==="header"){const C=this.tableModel.getColumnDef(i);(!(C!=null&&C.sortIconVisible)||C!=null&&C.sortIconVisible())&&(x=C==null?void 0:C.sortState)}const S=e.getValueAt(o,i),v=u?"":`${S}`,w=e.isRowChecked(o),y=this.dom.addColumnDiv({parent:c,geo:g,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:v,treeArrow:f,tableOptions:this.tableOptions,checkedType:w,sortState:x}),M=e.getTooltipAt(o,i);M&&this.dom.setAttribute(y,"title",M);const A=this.tableModel.getColumnDef(i);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],y);let R;u&&(R=u.render(y,o,i,t,e,S,this.dom.domService));const O=e.getCustomClassesAt(o,i);if(O.length&&this.dom.addClasses(O,y),this.dom.addColumnBorderDivs(this.tableOptions,c,g,t,s),h&&this.dom.addHorizontalBorder({left:r,width:l,height:a,top:n+a},c),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(o,i)&&this.dom.addFocusBorderDivs(c,g,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const $=e.getCustomStyleAt(o,i);if($)for(const C in $)this.dom.setStyle(y,C,$[C]);return[y,R]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:o+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-o;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,s){var o,i;if(this.dragging){const r=this.hostElement.clientHeight,l=this.storedColumnWidths[t];if((o=e.originalEvent)!=null&&o.clientX){const c={left:((i=e.originalEvent)==null?void 0:i.clientX)-l/2,width:l,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,c),s&&this.renderContentOfDraggingColumn(c)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,s=0){const o="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const l=e.index??0,a=this.draggingColumn;for(let n=0;n<r;n++){const c=s,h=i.getRowHeight(n),d={left:0,width:e.width,height:h,top:c,index:n},u=i.getValueAt(n,l),g=i.getCellRenderer(n,l),b=g?"":`${u}`,f={parent:a,geo:d,rowIndex:n,columnIndex:l,areaIdent:t,sideIdent:o,text:b},m=this.dom.addColumnDiv(f);let x;g&&(x=g.render(m,n,l,t,i,u,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const S=i.getCustomClassesAt(n,l);S.length&&this.dom.addClasses(S,m);const v=this.tableModel.getColumnDef(l);v&&v.classes[t]&&this.dom.addClasses(v.classes[t],m),this.dom.addColumnBorderDivs(this.tableOptions,a,d,t,o);const w=i.getCustomStyleAt(n,l);if(w)for(const y in w)this.dom.setStyle(m,y,w[y]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${s}px`),this.dom.setStyle(r,"width",`${o}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,s,o,i,r,l,a,n,c,h){let d=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const u=this.getSelectionModel();if(u){const g=u.getSelectionCount(i,r);d=g>0;for(let b=0;b<g;b++){const f=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,l));this.dom.setStyle(f,"left",`${a}px`),this.dom.setStyle(f,"top",`${n}px`),this.dom.setStyle(f,"width",`${c}px`),this.dom.setStyle(f,"height",`${h}px`)}}}return d}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:r,top:l,width:a,height:n,parent:c,cellSelected:h,lastRowOfModel:d}){const[u,g]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:a,height:n,top:l,parent:c,lastRowOfModel:d});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,u),g&&this.cleanupFunctions[t].push(g)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:r,parent:l}){const a=this.dom.domService,n=this.tableOptions.columnResizeHandleWidthInPx??2,c=a.createElement("div");a.setAttribute(c,"data-col-index",`${t}`),a.setAttribute(c,"data-row-index",`${e}`),a.setAttribute(c,"data-area","header"),a.setAttribute(c,"data-ge-action","resize-column"),a.addClass(c,"ge-table-column-resize-handle"),a.setStyle(c,"display","clip"),a.setStyle(c,"position","absolute"),a.setStyle(c,"cursor","col-resize"),a.setStyle(c,"left",`${s+i-n}px`),a.setStyle(c,"top",`${o}px`),a.setStyle(c,"width",`${n}px`),a.setStyle(c,"height",`${r}px`),a.appendChild(l,c)}}class we{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Ce{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),o=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(s&&o&&i){const r=N(s),l=Number(o),a=Number(i);this.tableScope.updateModelValueAfterEdit(r,l,a,t.value)}}}}class ve{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 ve(e,t)])}}class Ee{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,l,a,n,c,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const d=this.getSelectionModel(),u=this.getFocusModel();d&&u&&(u.hasFocus(e.rowIndex,e.columnIndex)||(u.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(u),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||d.hasSelection()&&(d.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(d.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(l=e.originalEvent)!=null&&l.altKey&&((a=e.originalEvent)!=null&&a.ctrlKey||(n=e.originalEvent)!=null&&n.metaKey)?(d.removeSelection(E.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(c=e.originalEvent)!=null&&c.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(d.addSelection(E.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(d.firstClick(e.rowIndex,e.columnIndex),s=!0),this.tableScope.onSelectionChanged(d))}return o?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),s}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),s=this.getFocusModel();if(t&&s){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[o,i]=s.getFocus();return t.togglePoint(o,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class Ae{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 Re{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}function Me(p){return p.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).filter((e,t,s)=>s.indexOf(e)===t).sort((e,t)=>{const s={cmd:1,ctrl:2,alt:3,shift:4},o=s[e]||5,i=s[t]||5;return o!==i?o-i:e.localeCompare(t)}).join(" ")}function K(p){let e=p.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&p.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),p.code.startsWith("Numpad")){const s=p.code.replace("Numpad","").toLowerCase();s==="add"?e="num_add":s==="subtract"?e="num_subtract":s==="multiply"?e="num_multiply":s==="divide"?e="num_divide":s==="decimal"?e="num_decimal":s==="enter"?e="num_enter":e="num_"+s}p.code.match(/^F\d+$/)&&(e=p.code.toLowerCase()),p.code.match(/^Digit\d+$/)&&(e=p.code.replace(/Digit/g,""));let t="";return p.ctrlKey&&(t+=" ctrl"),p.altKey&&(t+=t+" alt"),p.shiftKey&&(t+=t+" shift"),p.metaKey&&(t+=t+" cmd"),Me(t+" "+e)}class Te{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this)))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new Re().get()):Object.assign(this.shortcutActionIdMapping,new Ae().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 s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=K(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const s in this.shortcutActionIdMapping)if(K(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[s]),this.shortcutActionIdMapping[s]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class Y{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class te{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class De{render(e,t,s,o,i,r,l){if(i.isEditable(t,s)){l.addClass(e,"ge-table-row-input-div");const a=i.getValueAt(t,s);e.innerHTML=`
|
|
9
9
|
<input
|
|
10
10
|
type="text"
|
|
11
11
|
value="${a}"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
data-col-index="${s}"
|
|
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 ke{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(E.singleRow(e)):this.selectionType==="column"&&this.addRange(E.singleColumn(t))}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,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 s=t.r1;s<=t.r2;s++)!e.has(s)&&!this.isInNegativeRange(s,0)&&e.add(s);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=E.singleRow(e.r1):this.selectionType==="column"&&(t=E.singleColumn(e.c1)),this.negativeRanges.push(t),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(E.singleCell(e,t)):this.addSelection(E.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e),this.fireChangeEvent())}}class Fe{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
|
|
21
|
-
`;let
|
|
20
|
+
class="ge-table-cell-editor-input">`}}}class ke{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(E.singleRow(e)):this.selectionType==="column"&&this.addRange(E.singleColumn(t))}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,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 s=t.r1;s<=t.r2;s++)!e.has(s)&&!this.isInNegativeRange(s,0)&&e.add(s);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=E.singleRow(e.r1):this.selectionType==="column"&&(t=E.singleColumn(e.c1)),this.negativeRanges.push(t),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(E.singleCell(e,t)):this.addSelection(E.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e),this.fireChangeEvent())}}class Fe{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 se{constructor(e=new D("❯","",["gt-table-icon-expanded"]),t=new D("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const Ie=new ke,Le=new Fe("cell");class oe{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new Q,this.headerGroupOptions=new se,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new ee,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new De,this.getSelectionModel=()=>Ie,this.getFocusModel=()=>Le}}const L=class L{createContent(e,t,s){return new Promise((o,i)=>{if(t!=null&&t.hasSelection()){const r=this.mergeRanges(t.getRanges());if(r){r.c2=Math.min(r.c2,e.getColumnCount()-1),r.r2=Math.min(r.r2,e.getBodyModel().getRowCount()-1);const l=[];for(let a=r.r1;a<=r.r2;a++){const n=[];for(let c=r.c1;c<=r.c2;c++){const h=t.isSelected(a,c)?e.getBodyModel().getTextValueAt(a,c):"";n.push(h)}l.push(n.join(L.columnSeparatorChar))}return o(l.join(L.rowSeparatorChar))}}if(s){const[r,l]=s.getFocus(),a=e.getBodyModel().getTextValueAt(r,l);return o(a)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,s){return new Promise((o,i)=>{this.createContent(e,t,s).then(r=>{r&&this.copyContent(r).then(l=>{o(r)}).catch(l=>{i()})}).catch(r=>{i()})})}mergeRanges(e){let t;for(const s of e)t?(t.r1=Math.min(t.r1,s.r1),t.c1=Math.min(t.c1,s.c1),t.r2=Math.max(t.r2,s.r2),t.c2=Math.max(t.c2,s.c2)):t=new E(s.r1,s.c1,s.r2,s.c2);return t}};L.columnSeparatorChar=" ",L.rowSeparatorChar=`
|
|
21
|
+
`;let P=L;class Oe{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,new ResizeObserver(ae(this.handleResize.bind(this),t)).observe(this.tableScope.hostElement)}handleResize(e){const t=e[0],{width:s}=t.contentRect;this.tableScope.recalcColumnWidths(s)}}class Be{downloadExcel(e,t="file.xlsx",s=""){if(!Array.isArray(e)||e.some(o=>!Array.isArray(o)))throw new Error("Invalid matrix format. Expected a 2D array.");if((t==null?void 0:t.trim())==="")throw new Error("Invalid filename. Filename must be a non-empty string.");try{const o=this.generateBuffer(e,s),i=new Blob([o],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(o){throw console.error("Error generating Excel file:",o),new Error("Failed to download Excel file.")}}generateMap(e,t=""){const s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
22
22
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
23
23
|
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>Microsoft Macintosh Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="1" baseType="lpstr"><vt:lpstr>Sheet1</vt:lpstr></vt:vector></TitlesOfParts><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0300</AppVersion></Properties>`,i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
24
24
|
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>${t}</dc:creator><cp:lastModifiedBy>${t}</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">2024-12-13T19:45:08Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2024-12-13T19:45:35Z</dcterms:modified></cp:coreProperties>`,r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<sheetView tabSelected="1" workbookViewId="0"/></sheetViews>
|
|
35
35
|
<sheetFormatPr baseColWidth="10" defaultRowHeight="16" x14ac:dyDescent="0.2"/>
|
|
36
36
|
<sheetData>`);for(let s=0;s<e.length;s++){const o=e[s];t.push('<row r="${r + 1}" spans="1:2" x14ac:dyDescent="0.2">');for(let i=0;i<o.length;i++){const r=o[i],l=this.getCellAddress(s,i);if(typeof r=="number")t.push(`<c r="${l}"><v>${r}</v></c>`);else if(r instanceof Date){const a=r;t.push(`<c r="${l}" t="inlineStr"><is><t>${a.toISOString()}</t></is></c>`)}else{const a=r!=null?this.escapeXml(String(r)):"";t.push(`<c r="${l}" t="inlineStr"><is><t>${a}</t></is></c>`)}}t.push("</row>")}return t.push(""),t.push(""),t.push('</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'),t.push("</worksheet>"),t.join(`
|
|
37
|
-
`)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getCellAddress(e,t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let o="";for(;t>=0;)o=s[t%26]+o,t=Math.floor(t/26)-1;return`${o}${e+1}`}createZip(e){const t=[];let s=0;const o=[];e.forEach((h,d)=>{const f=new TextEncoder().encode(d),g=new TextEncoder().encode(h),b=new Uint8Array(30+f.length),u=new DataView(b.buffer);b.set([80,75,3,4],0),u.setUint16(4,20,!0),u.setUint16(6,0,!0),u.setUint16(8,0,!0),u.setUint16(10,0,!0),u.setUint16(12,0,!0),u.setUint32(14,0,!0),u.setUint32(18,g.length,!0),u.setUint32(22,g.length,!0),u.setUint16(26,f.length,!0),u.setUint16(28,0,!0),b.set(f,30),t.push(b,g),o.push({path:d,offset:s,contentSize:g.length}),s+=b.length+g.length});const i=s;o.forEach(h=>{const d=new TextEncoder().encode(h.path),f=new Uint8Array(46+d.length),g=new DataView(f.buffer);f.set([80,75,1,2],0),g.setUint16(4,20,!0),g.setUint16(6,20,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint16(14,0,!0),g.setUint32(16,0,!0),g.setUint32(20,h.contentSize,!0),g.setUint32(24,h.contentSize,!0),g.setUint16(28,d.length,!0),g.setUint16(30,0,!0),g.setUint16(32,0,!0),g.setUint16(34,0,!0),g.setUint16(36,0,!0),g.setUint32(38,0,!0),g.setUint32(42,h.offset,!0),f.set(d,46),t.push(f),s+=f.length});const r=new Uint8Array(22),l=new DataView(r.buffer);r.set([80,75,5,6],0),l.setUint16(4,0,!0),l.setUint16(6,0,!0),l.setUint16(8,o.length,!0),l.setUint16(10,o.length,!0),l.setUint32(12,s-i,!0),l.setUint32(16,i,!0),l.setUint16(20,0,!0),t.push(r);const a=t.reduce((h,d)=>h+d.length,0),n=new Uint8Array(a);let c=0;for(const h of t)n.set(h,c),c+=h.length;return n}generateBuffer(e,t=""){const s=this.generateMap(e,t);return this.createZip(s)}}class z extends xe{constructor(e,t,s,o,i,r=new B,l=new Be){var c;if(super(e,t,new ae(s),o),this.eventListener=i,this.copyService=r,this.excelService=l,this.licenseManager=k.getInstance(),this.selectionService=new Ee(this),this.api=new pe(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new K),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const h=this.tableOptions.autoRestoreOptions,d=h.getStorageKeyFn;d&&(h.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new ge(d)),h.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new fe(d)),h.autoRestoreSortingState&&(this.storeSortingService=new me(d)))}this.mouseHandler=new ne(this),this.inputHandler=new Ce(this),this.resizeHandler=new Oe(this,o.resizeEventDebounceDelay),this.shortcutService=new Te(this),this.shortcutService.addListener(this.selectionService);const a=this.getSelectionModel?this.getSelectionModel():void 0;a&&a.addEventSelectionChangedListener(this);const n=this.getFocusModel?this.getFocusModel():void 0;n&&n.addEventFocusChangedListener(this)}static create(e,t,s=new se,o=new K,i=new ee,r=new B){return new z(e,t,i,s,o,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[s,o]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,o)&&(this.clearSelection(),this.initRenderEditor(s,o))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,s=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,s).then(o=>this.copyService.copyContent(o))}return!1}updateModelValueAfterEdit(e,t,s,o){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(G.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new V;if(t.originalEvent=e,e){const s=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=o.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const o=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,o)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var s,o;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(s=e.originalEvent)==null||s.preventDefault(),(o=e.originalEvent)==null||o.stopImmediatePropagation();return}this.lastContextmenu=t,this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();$(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,r),this.repaint();const l=(a=o.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(l||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}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,s){var i,r;const o=this.tableModel.getColumnDef(s);if(o!=null&&o.sortable&&o.sortable()){e.preventDefault(),e.stopPropagation();const l=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,a=o.sortState??"",n=l[(l.indexOf(a)+1)%l.length],c=new we(s,n);this.tableModel.doSort([c])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([c])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const o=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,o)}setSelectionModel(e,t=!1){const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,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 s=this.getFocusModel();if(s){const[o,i]=s.getFocus();return s.setFocus(o+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var s;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(s=this.mouseHandler.mouseEvent)==null?void 0:s.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,o=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&o){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if($(r)){const l=r,a=r.getRowCount();for(let n=0;n<a;n++){const c=r.getRowByIndex(n);if(c)if(i.allExpanded)c.expanded=!0;else if(i.allCollapsed)c.expanded=!1;else{const h=o(c.data);i.mode==="expanded"?c.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(c.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}l.recalcVisibleTreeRows()}}}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount(),s=(e==null?void 0:e.getRowCount())??0;if(!e)return console.warn("Body model is not available."),[];const o=new Array(t).fill(0);for(let i=0;i<s;i++)for(let r=0;r<t;r++){const l=e.getValueAt(i,r),a=(l==null?void 0:l.toString().length)||0;a>o[r]&&(o[r]=a)}return o.map(i=>Math.max(i*10,50))}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let s=0;s<t.length;s++){const o=t[s];this.tableModel.setColumnWidth(s,o)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e)}getDisplayedRowCount(){return this.displayedRowCount}}const P=class P{};P.themes=["light","combat","paper","blackboard"],P.vars={light:`html[data-theme="light"] {
|
|
37
|
+
`)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getCellAddress(e,t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let o="";for(;t>=0;)o=s[t%26]+o,t=Math.floor(t/26)-1;return`${o}${e+1}`}createZip(e){const t=[];let s=0;const o=[];e.forEach((h,d)=>{const u=new TextEncoder().encode(d),g=new TextEncoder().encode(h),b=new Uint8Array(30+u.length),f=new DataView(b.buffer);b.set([80,75,3,4],0),f.setUint16(4,20,!0),f.setUint16(6,0,!0),f.setUint16(8,0,!0),f.setUint16(10,0,!0),f.setUint16(12,0,!0),f.setUint32(14,0,!0),f.setUint32(18,g.length,!0),f.setUint32(22,g.length,!0),f.setUint16(26,u.length,!0),f.setUint16(28,0,!0),b.set(u,30),t.push(b,g),o.push({path:d,offset:s,contentSize:g.length}),s+=b.length+g.length});const i=s;o.forEach(h=>{const d=new TextEncoder().encode(h.path),u=new Uint8Array(46+d.length),g=new DataView(u.buffer);u.set([80,75,1,2],0),g.setUint16(4,20,!0),g.setUint16(6,20,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint16(14,0,!0),g.setUint32(16,0,!0),g.setUint32(20,h.contentSize,!0),g.setUint32(24,h.contentSize,!0),g.setUint16(28,d.length,!0),g.setUint16(30,0,!0),g.setUint16(32,0,!0),g.setUint16(34,0,!0),g.setUint16(36,0,!0),g.setUint32(38,0,!0),g.setUint32(42,h.offset,!0),u.set(d,46),t.push(u),s+=u.length});const r=new Uint8Array(22),l=new DataView(r.buffer);r.set([80,75,5,6],0),l.setUint16(4,0,!0),l.setUint16(6,0,!0),l.setUint16(8,o.length,!0),l.setUint16(10,o.length,!0),l.setUint32(12,s-i,!0),l.setUint32(16,i,!0),l.setUint16(20,0,!0),t.push(r);const a=t.reduce((h,d)=>h+d.length,0),n=new Uint8Array(a);let c=0;for(const h of t)n.set(h,c),c+=h.length;return n}generateBuffer(e,t=""){const s=this.generateMap(e,t);return this.createZip(s)}}class U extends xe{constructor(e,t,s,o,i,r=new P,l=new Be){var c;if(super(e,t,new le(s),o),this.eventListener=i,this.copyService=r,this.excelService=l,this.licenseManager=k.getInstance(),this.selectionService=new Ee(this),this.api=new pe(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new Y),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const h=this.tableOptions.autoRestoreOptions,d=h.getStorageKeyFn;d&&(h.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new ge(d)),h.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new ue(d)),h.autoRestoreSortingState&&(this.storeSortingService=new me(d)))}this.mouseHandler=new ce(this),this.inputHandler=new Ce(this),this.resizeHandler=new Oe(this,o.resizeEventDebounceDelay),this.shortcutService=new Te(this),this.shortcutService.addListener(this.selectionService);const a=this.getSelectionModel?this.getSelectionModel():void 0;a&&a.addEventSelectionChangedListener(this);const n=this.getFocusModel?this.getFocusModel():void 0;n&&n.addEventFocusChangedListener(this),console.log("TableScope created")}static create(e,t,s=new oe,o=new Y,i=new te,r=new P){return new U(e,t,i,s,o,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[s,o]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,o)&&(this.clearSelection(),this.initRenderEditor(s,o))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,s=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,s).then(o=>this.copyService.copyContent(o))}return!1}updateModelValueAfterEdit(e,t,s,o){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(z.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new _;if(t.originalEvent=e,e){const s=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=o.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const o=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,o)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var s,o;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(s=e.originalEvent)==null||s.preventDefault(),(o=e.originalEvent)==null||o.stopImmediatePropagation();return}this.lastContextmenu=t,this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();V(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,r),this.repaint();const l=(a=o.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(l||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}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,s){var i,r;const o=this.tableModel.getColumnDef(s);if(o!=null&&o.sortable&&o.sortable()){e.preventDefault(),e.stopPropagation();const l=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,a=o.sortState??"",n=l[(l.indexOf(a)+1)%l.length],c=new we(s,n);this.tableModel.doSort([c])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([c])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const o=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,o)}setSelectionModel(e,t=!1){const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,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 s=this.getFocusModel();if(s){const[o,i]=s.getFocus();return s.setFocus(o+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var s;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(s=this.mouseHandler.mouseEvent)==null?void 0:s.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,o=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&o){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(V(r)){const l=r,a=r.getRowCount();for(let n=0;n<a;n++){const c=r.getRowByIndex(n);if(c)if(i.allExpanded)c.expanded=!0;else if(i.allCollapsed)c.expanded=!1;else{const h=o(c.data);i.mode==="expanded"?c.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(c.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}l.recalcVisibleTreeRows()}}}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount(),s=(e==null?void 0:e.getRowCount())??0;if(!e)return console.warn("Body model is not available."),[];const o=new Array(t).fill(0);for(let i=0;i<s;i++)for(let r=0;r<t;r++){const l=e.getValueAt(i,r),a=(l==null?void 0:l.toString().length)||0;a>o[r]&&(o[r]=a)}return o.map(i=>Math.max(i*10,50))}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let s=0;s<t.length;s++){const o=t[s];this.tableModel.setColumnWidth(s,o)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e)}getDisplayedRowCount(){return this.displayedRowCount}}const W=class W{};W.themes=["light","combat","paper","blackboard"],W.vars={light:`html[data-theme="light"] {
|
|
38
38
|
--ge-table-bg: rgba(255,255,255, 0.5);
|
|
39
39
|
--ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
|
|
40
40
|
--ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
|
|
@@ -262,9 +262,9 @@
|
|
|
262
262
|
--ge-table-column-resize-handle-border: oklch(0% 0 0);
|
|
263
263
|
--ge-table-dragged-col-div-bg: #2c2e33;
|
|
264
264
|
--ge-table-drop-zone-bg: #758129;
|
|
265
|
-
}`};let
|
|
265
|
+
}`};let q=W;const H=class H{constructor(e=new se){this.headerGroupOptions=e}render(e,t,s,o,i,r,l){const a=r!=null&&r.data?r.data:"";if(r){const{toggle:n,visibility:c,closed:h}=r,d=n?H.toggleHeaderGroup:"";this.addText(e,o,t,s,a,d),n&&c!=="always"&&this.addArrowDiv(l,e,!h,t,s,o,d)}else this.addText(e,o,t,s,a,"")}addText(e,t,s,o,i,r){e.innerHTML=`<span
|
|
266
266
|
data-ge-action="${r}"
|
|
267
267
|
data-area="${t}"
|
|
268
268
|
data-row-index="${s}"
|
|
269
269
|
data-col-index="${o}"
|
|
270
|
-
>${i}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,r="header",l){const a=e.createElement("div");e.addClass(a,"ge-table-toggle-icon-div"),e.setStyle(a,"display","inline-block"),e.setStyle(a,"position",""),e.setStyle(a,"width","20px"),e.setStyle(a,"background","transparent"),e.setStyle(a,"cursor","pointer"),e.setAttribute(a,"data-row-index",`${o}`),e.setAttribute(a,"data-col-index",`${i}`),e.setAttribute(a,"data-area",`${r}`),e.setAttribute(a,"data-ge-action",`${l}`);let n;s?n=this.headerGroupOptions.iconExpanded:n=this.headerGroupOptions.iconCollapsed;const c=n.content,h=e.createText(c);e.appendChild(a,h),n.style&&this.applyStyleString(e,a,n.style);for(const d of n.classes)e.addClass(a,d);return e.appendChild(t,a),a}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[r,l]=i.split(":");e.setStyle(t,r.trim(),l.trim())}}};
|
|
270
|
+
>${i}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,r="header",l){const a=e.createElement("div");e.addClass(a,"ge-table-toggle-icon-div"),e.setStyle(a,"display","inline-block"),e.setStyle(a,"position",""),e.setStyle(a,"width","20px"),e.setStyle(a,"background","transparent"),e.setStyle(a,"cursor","pointer"),e.setAttribute(a,"data-row-index",`${o}`),e.setAttribute(a,"data-col-index",`${i}`),e.setAttribute(a,"data-area",`${r}`),e.setAttribute(a,"data-ge-action",`${l}`);let n;s?n=this.headerGroupOptions.iconExpanded:n=this.headerGroupOptions.iconCollapsed;const c=n.content,h=e.createText(c);e.appendChild(a,h),n.style&&this.applyStyleString(e,a,n.style);for(const d of n.classes)e.addClass(a,d);return e.appendChild(t,a),a}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[r,l]=i.split(":");e.setStyle(t,r.trim(),l.trim())}}};H.toggleHeaderGroup="toggleHeaderGroup";let J=H;function Pe({tableModel:p,tableOptions:e=new oe,mouseMoved:t,checkboxChanged:s,contextmenu:o,modelChanged:i,mouseClicked:r,mouseDragging:l,mouseDraggingEnd:a,selectionChanged:n,focusChanged:c,tableReady:h,licenseKey:d}){const u=X.useRef(null);let g=!1;X.useEffect(()=>{u.current&&!g&&(b(u.current),g=!0)});const b=f=>{const m={onSelectionChanged(S){n&&n(S)},onFocusChanged(S){c&&c(S)},onCheckboxChanged:S=>{s&&s(S)},onContextmenu:S=>{o&&o(S)},onModelChanged:S=>{i&&i(S)},onMouseClicked:S=>{r&&r(S)},onMouseDragging:S=>{l&&l(S)},onMouseDraggingEnd:S=>{a&&a(S)},onMouseMoved:S=>{t&&t(S)}},x=new U(f,p,new te,e,m);x.firstInit(),h&&h(x.getApi()),d&&k.getInstance().setLicenseKey(d)};return ie.jsx("div",{ref:u,className:"container-div",style:{width:"100%",height:"100%",background:"transparent",padding:"0",margin:"0"}})}var I={},Z;function We(){if(Z)return I;Z=1;var p=re;if(process.env.NODE_ENV==="production")I.createRoot=p.createRoot,I.hydrateRoot=p.hydrateRoot;else{var e=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;I.createRoot=function(t,s){e.usingClientEntryPoint=!0;try{return p.createRoot(t,s)}finally{e.usingClientEntryPoint=!1}},I.hydrateRoot=function(t,s,o){e.usingClientEntryPoint=!0;try{return p.hydrateRoot(t,s,o)}finally{e.usingClientEntryPoint=!1}}}return I}var He=We();class $e{constructor(e){this.Component=e,console.info(e)}render(e,t,s,o,i,r,l){const a={cellDiv:e,rowIndex:t,columnIndex:s,areaIdent:o,areaModel:i,cellValue:r},n=He.createRoot(e,{});return n.render(this.Component(a)),()=>{n.unmount()}}}exports.ComponentRendererWrapper=$e;exports.GuiexpertTable=Pe;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsx as oe } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as ie, useEffect as re } from "react";
|
|
3
|
+
import ae from "react-dom";
|
|
4
|
+
function le(p, e = 500) {
|
|
5
5
|
let t = null;
|
|
6
6
|
return function(...s) {
|
|
7
7
|
t && window.clearTimeout(t), t = window.setTimeout(() => {
|
|
@@ -34,18 +34,18 @@ class k {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function B(p) {
|
|
38
38
|
return p && p.type === "TreeRow";
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function V(p) {
|
|
41
41
|
return p && p.type === "AreaModelTree";
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class _ {
|
|
44
44
|
constructor(e = -1, t = -1, s = -1, o = -1, i, r, l, a = 0, n = 0, c = 0, h = "") {
|
|
45
45
|
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = o, this.areaIdent = i, this.sideIdent = r, this.originalEvent = l, this.clickCount = a, this.draggingX = n, this.draggingY = c, this.action = h;
|
|
46
46
|
}
|
|
47
47
|
clone() {
|
|
48
|
-
return new
|
|
48
|
+
return new _(
|
|
49
49
|
this.rowIndex,
|
|
50
50
|
this.rowTop,
|
|
51
51
|
this.columnIndex,
|
|
@@ -65,7 +65,7 @@ class D {
|
|
|
65
65
|
this.content = e, this.style = t, this.classes = s;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class Z {
|
|
69
69
|
constructor(e = new D(
|
|
70
70
|
">",
|
|
71
71
|
"transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
|
|
@@ -86,12 +86,12 @@ class J {
|
|
|
86
86
|
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = o;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
class
|
|
89
|
+
class Q {
|
|
90
90
|
constructor(e = new D("↑", "", ["ge-header-sorted-asc"]), t = new D("↓", "", ["ge-header-sorted-desc"]), s = new D("↑", "color:transparent;", [])) {
|
|
91
91
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class ne {
|
|
95
95
|
constructor(e) {
|
|
96
96
|
this.domService = e;
|
|
97
97
|
}
|
|
@@ -211,7 +211,7 @@ class le {
|
|
|
211
211
|
}
|
|
212
212
|
return this.domService.appendChild(e, l), l;
|
|
213
213
|
}
|
|
214
|
-
addSortedIcon(e, t = "", s = new
|
|
214
|
+
addSortedIcon(e, t = "", s = new Q(), o = -1) {
|
|
215
215
|
const i = this.domService.createElement("div");
|
|
216
216
|
this.domService.addClass(i, "ge-table-sorted-icon-div"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "top", "0"), this.domService.setStyle(i, "right", "0"), this.domService.setStyle(i, "width", "20px"), this.domService.setStyle(i, "background", "transparent"), this.domService.setStyle(i, "cursor", "pointer"), this.domService.setAttribute(i, "data-col-index", `${o}`), this.domService.setAttribute(i, "data-area", "header");
|
|
217
217
|
let r;
|
|
@@ -222,7 +222,7 @@ class le {
|
|
|
222
222
|
this.domService.addClass(i, n);
|
|
223
223
|
return this.domService.appendChild(e, i), i;
|
|
224
224
|
}
|
|
225
|
-
addArrowDiv(e, t = "none", s = new
|
|
225
|
+
addArrowDiv(e, t = "none", s = new Z(), o = -1, i = -1, r = "body") {
|
|
226
226
|
const l = this.domService.createElement("div");
|
|
227
227
|
this.domService.addClass(l, "ge-table-tree-arrow-div"), this.domService.setStyle(l, "display", "inline-block"), this.domService.setStyle(l, "position", ""), this.domService.setStyle(l, "width", "20px"), this.domService.setStyle(l, "background", "transparent"), this.domService.setStyle(l, "cursor", "pointer"), this.domService.setAttribute(l, "data-row-index", `${o}`), this.domService.setAttribute(l, "data-col-index", `${i}`), this.domService.setAttribute(l, "data-area", `${r}`);
|
|
228
228
|
let a;
|
|
@@ -273,20 +273,20 @@ class le {
|
|
|
273
273
|
return s ? (s.innerText = "", s) : (s = this.domService.createElement("div"), t.cache[e] = s, s);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
const
|
|
277
|
-
class
|
|
276
|
+
const N = (p) => p === "header" ? "header" : p === "footer" ? "footer" : "body";
|
|
277
|
+
class ce {
|
|
278
278
|
constructor(e, t) {
|
|
279
279
|
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)) {
|
|
280
280
|
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"));
|
|
281
281
|
const s = e.getAttribute("data-area");
|
|
282
|
-
if (s && (this.areaIdent =
|
|
282
|
+
if (s && (this.areaIdent = N(s), this.areaModel = t.tableModel.getAreaModel(this.areaIdent), this.row = this.areaModel.getRowByIndex(this.rowIdx)), e instanceof HTMLInputElement) {
|
|
283
283
|
const o = e;
|
|
284
284
|
this.value = o.value;
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
class
|
|
289
|
+
class de {
|
|
290
290
|
constructor(e) {
|
|
291
291
|
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(
|
|
292
292
|
(t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
|
|
@@ -313,24 +313,24 @@ class ce {
|
|
|
313
313
|
*/
|
|
314
314
|
onHostElementClicked(e) {
|
|
315
315
|
const t = Date.now();
|
|
316
|
-
if (
|
|
316
|
+
if (t - this.lastClicked < this.doubleClickDelay) {
|
|
317
317
|
this.lastClicked = t, this.publishGeMouseEvent(e, 2);
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
320
|
this.lastClicked = t;
|
|
321
|
-
const s = new
|
|
321
|
+
const s = new ce(e.target, this.tableScope);
|
|
322
322
|
if (s.action === "toggleExpandCollapseAll")
|
|
323
323
|
this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
|
|
324
324
|
else if (s.action === "toggleHeaderGroup")
|
|
325
325
|
this.tableScope.toggleHeaderGroup(s), e.preventDefault(), e.stopPropagation();
|
|
326
326
|
else if (s.inputType === "checkbox" && s.areaIdent)
|
|
327
327
|
this.tableScope.toggleRowCheckbox(s.rowIdx, s.colIdx, s.areaIdent), e.preventDefault(), e.stopPropagation();
|
|
328
|
-
else if (
|
|
328
|
+
else if (B(s.row) && s.areaModel) {
|
|
329
329
|
const o = s.colIdx === this.getArrowColumnIndex() && e.altKey, i = s.className.includes("ge-table-tree-arrow-div");
|
|
330
330
|
if (o || i) {
|
|
331
331
|
e.preventDefault(), e.stopPropagation();
|
|
332
332
|
const r = s.row;
|
|
333
|
-
r.expanded = !r.expanded, "recalcVisibleTreeRows" in s.areaModel && s.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(r);
|
|
333
|
+
r.expanded = !r.expanded, "recalcVisibleTreeRows" in s.areaModel && s.areaModel.recalcVisibleTreeRows(), console.info("this.tableScope.hostElement", this.tableScope.hostElement), console.info("this.tableScope.hostElement.clientWidth", this.tableScope.hostElement.clientWidth), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(r);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
if (s.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
|
|
@@ -346,13 +346,13 @@ class ce {
|
|
|
346
346
|
* @param {MouseEvent} event - The double click event.
|
|
347
347
|
*/
|
|
348
348
|
onHostElementDblClicked(e) {
|
|
349
|
-
if (
|
|
350
|
-
const t = e.target, s = t.getAttribute("data-area"), o =
|
|
349
|
+
if (this.lastClicked = Date.now(), e.target instanceof HTMLElement) {
|
|
350
|
+
const t = e.target, s = t.getAttribute("data-area"), o = N(s), i = Number(t.getAttribute("data-row-index")), r = Number(t.getAttribute("data-col-index")), l = this.tableScope.tableModel.getAreaModel(o);
|
|
351
351
|
if (s && o === "header")
|
|
352
352
|
this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, i, r));
|
|
353
353
|
else if (t.getAttribute("data-row-index")) {
|
|
354
354
|
const a = l.getRowByIndex(i);
|
|
355
|
-
if (s && o === "body" && l.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)),
|
|
355
|
+
if (s && o === "body" && l.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)), B(a) && r === this.getArrowColumnIndex()) {
|
|
356
356
|
e.preventDefault(), e.stopPropagation();
|
|
357
357
|
const n = a;
|
|
358
358
|
n.expanded = !n.expanded, "recalcVisibleTreeRows" in l && l.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(n);
|
|
@@ -420,7 +420,7 @@ class ce {
|
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
class
|
|
423
|
+
class he {
|
|
424
424
|
constructor(e, t = [], s = -1) {
|
|
425
425
|
this.areaIdent = e, this.columnDefs = t, this.defaultRowHeight = s, this.rowSelectionModel = void 0, this.yPositions = [], this.cellRenderers = t.map((o) => o.rendererMap[e]);
|
|
426
426
|
}
|
|
@@ -516,7 +516,7 @@ class de {
|
|
|
516
516
|
this.yPositions[t + 1] = this.getRowHeight(t) + this.yPositions[t];
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
class
|
|
519
|
+
class pe {
|
|
520
520
|
genericSortComparator(e, t, s) {
|
|
521
521
|
if (typeof e == "number" && typeof t == "number")
|
|
522
522
|
return s * (e - t);
|
|
@@ -534,9 +534,9 @@ class he {
|
|
|
534
534
|
return s * ("" + e).localeCompare("" + t);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
class
|
|
537
|
+
class F extends he {
|
|
538
538
|
constructor(e, t, s, o = [], i = "ge-selected-row", r = "ge-focused-row") {
|
|
539
|
-
super(e, o, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = o, this.selectedRowClass = i, this.focusedRowClass = r, this.focusedRowIndex = 0, this.sorterService = new
|
|
539
|
+
super(e, o, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = o, this.selectedRowClass = i, this.focusedRowClass = r, this.focusedRowIndex = 0, this.sorterService = new pe(), this.filteredRows = [...t], this.properties = o.map((l) => l.property);
|
|
540
540
|
}
|
|
541
541
|
setRows(e) {
|
|
542
542
|
this.rows = e, this.filteredRows = [...e];
|
|
@@ -554,7 +554,7 @@ class pe extends de {
|
|
|
554
554
|
getValueAt(e, t) {
|
|
555
555
|
const s = this.properties[t];
|
|
556
556
|
let o = this.filteredRows[e];
|
|
557
|
-
return
|
|
557
|
+
return B(o) && (o = o.data), o ? this.getValueByT(o, s) : "";
|
|
558
558
|
}
|
|
559
559
|
/**
|
|
560
560
|
* Retrieves the filtered and sorted rows from the dataset.
|
|
@@ -837,7 +837,49 @@ class ge {
|
|
|
837
837
|
}
|
|
838
838
|
setRows(e) {
|
|
839
839
|
const t = this.getBodyModel();
|
|
840
|
-
t instanceof
|
|
840
|
+
t instanceof F ? t.setRows(e) : console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof t, t);
|
|
841
|
+
}
|
|
842
|
+
addRows(e) {
|
|
843
|
+
const t = this.getBodyModel();
|
|
844
|
+
if (t instanceof F) {
|
|
845
|
+
const s = t;
|
|
846
|
+
let o = s.getAllRows();
|
|
847
|
+
s.setRows([...o, ...e]);
|
|
848
|
+
} else
|
|
849
|
+
console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof t, t);
|
|
850
|
+
}
|
|
851
|
+
addRowsAt(e, t) {
|
|
852
|
+
const s = this.getBodyModel();
|
|
853
|
+
if (s instanceof F) {
|
|
854
|
+
const o = s;
|
|
855
|
+
let i = o.getAllRows();
|
|
856
|
+
o.setRows([...i.slice(0, t), ...e, ...i.slice(t)]);
|
|
857
|
+
} else
|
|
858
|
+
console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
859
|
+
}
|
|
860
|
+
removeRows(e, t = (s, o) => s === o) {
|
|
861
|
+
const s = this.getBodyModel();
|
|
862
|
+
if (s instanceof F) {
|
|
863
|
+
const o = s, i = o.getAllRows().filter((r) => !e.some((l) => t(r, l)));
|
|
864
|
+
o.setRows(i);
|
|
865
|
+
} else
|
|
866
|
+
console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
867
|
+
}
|
|
868
|
+
findRows(e, t = (s, o) => s === o) {
|
|
869
|
+
const s = this.getBodyModel();
|
|
870
|
+
return s instanceof F ? s.getAllRows().filter((i) => !e.some((r) => t(i, r))) : (console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s), []);
|
|
871
|
+
}
|
|
872
|
+
updateRows(e, t = (s, o) => s === o) {
|
|
873
|
+
const s = this.getBodyModel();
|
|
874
|
+
if (s instanceof F) {
|
|
875
|
+
let i = s.getAllRows();
|
|
876
|
+
for (const r of i)
|
|
877
|
+
for (const l of e)
|
|
878
|
+
if (t(r, l))
|
|
879
|
+
for (const a of Object.keys(l))
|
|
880
|
+
r[a] = l[a];
|
|
881
|
+
} else
|
|
882
|
+
console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ", typeof s, s);
|
|
841
883
|
}
|
|
842
884
|
reSort() {
|
|
843
885
|
this.tableScope.reSort();
|
|
@@ -846,7 +888,7 @@ class ge {
|
|
|
846
888
|
return this.tableScope.getDisplayedRowCount();
|
|
847
889
|
}
|
|
848
890
|
}
|
|
849
|
-
class
|
|
891
|
+
class z {
|
|
850
892
|
constructor(e) {
|
|
851
893
|
this.getStorageKeyFn = e;
|
|
852
894
|
}
|
|
@@ -913,7 +955,7 @@ class N {
|
|
|
913
955
|
// }
|
|
914
956
|
// }
|
|
915
957
|
}
|
|
916
|
-
class fe extends
|
|
958
|
+
class fe extends z {
|
|
917
959
|
constructor(e) {
|
|
918
960
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
919
961
|
}
|
|
@@ -940,7 +982,7 @@ class ue {
|
|
|
940
982
|
this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = o;
|
|
941
983
|
}
|
|
942
984
|
}
|
|
943
|
-
class me extends
|
|
985
|
+
class me extends z {
|
|
944
986
|
constructor(e) {
|
|
945
987
|
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new ue(), this.load();
|
|
946
988
|
}
|
|
@@ -974,7 +1016,7 @@ class me extends N {
|
|
|
974
1016
|
this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
|
|
975
1017
|
}
|
|
976
1018
|
}
|
|
977
|
-
class be extends
|
|
1019
|
+
class be extends z {
|
|
978
1020
|
constructor(e) {
|
|
979
1021
|
super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
|
|
980
1022
|
}
|
|
@@ -1251,7 +1293,7 @@ class we extends Se {
|
|
|
1251
1293
|
header: [],
|
|
1252
1294
|
body: [],
|
|
1253
1295
|
footer: []
|
|
1254
|
-
}, this.tree = !1, this.colAndRowspanModels = new xe(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.displayedRowCount = 0, this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (l = this.tableOptions) != null && l.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel),
|
|
1296
|
+
}, this.tree = !1, this.colAndRowspanModels = new xe(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.displayedRowCount = 0, this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (l = this.tableOptions) != null && l.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), V(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
1255
1297
|
(a) => {
|
|
1256
1298
|
var n;
|
|
1257
1299
|
this.colAndRowspanModels[a] = new ye(t, t.getAreaModel(a)), (n = this.colAndRowspanModels[a]) == null || n.init();
|
|
@@ -1328,7 +1370,7 @@ class we extends Se {
|
|
|
1328
1370
|
* @return {undefined}
|
|
1329
1371
|
*/
|
|
1330
1372
|
recalcColumnWidths(e) {
|
|
1331
|
-
let t = e || this.scrollViewport.clientWidth;
|
|
1373
|
+
let t = (!e || e > this.scrollViewport.offsetWidth) && this.scrollViewport.offsetWidth > 100 ? this.scrollViewport.offsetWidth : this.scrollViewport.clientWidth;
|
|
1332
1374
|
this.tableModel.setParentWidth(t), this.tableModel.init(), this.repaintHard();
|
|
1333
1375
|
}
|
|
1334
1376
|
/**
|
|
@@ -1564,8 +1606,8 @@ class we extends Se {
|
|
|
1564
1606
|
{ cursor: "pointer" }
|
|
1565
1607
|
), R = this.tableOptions.treeOptions.arrowExpandCollapseAll;
|
|
1566
1608
|
if (R) {
|
|
1567
|
-
const
|
|
1568
|
-
this.dom.domService.appendChild(A,
|
|
1609
|
+
const O = this.dom.domService.createText(R.content);
|
|
1610
|
+
this.dom.domService.appendChild(A, O), R.style && this.dom.applyStyleString(A, R.style);
|
|
1569
1611
|
}
|
|
1570
1612
|
}
|
|
1571
1613
|
}
|
|
@@ -1764,12 +1806,12 @@ class we extends Se {
|
|
|
1764
1806
|
parent: c,
|
|
1765
1807
|
lastRowOfModel: h
|
|
1766
1808
|
}) {
|
|
1767
|
-
var
|
|
1809
|
+
var j;
|
|
1768
1810
|
const u = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), g = { left: r, width: l, height: a, top: n, index: i }, b = e.getRowByIndex(o);
|
|
1769
1811
|
let f = "none";
|
|
1770
|
-
if (i === this.getTreeArrowColumnIndex() &&
|
|
1812
|
+
if (i === this.getTreeArrowColumnIndex() && B(b)) {
|
|
1771
1813
|
const C = b;
|
|
1772
|
-
(
|
|
1814
|
+
(j = C.children) != null && j.length ? C.expanded ? f = "expanded" : f = "collapsed" : f = "hidden";
|
|
1773
1815
|
}
|
|
1774
1816
|
let x;
|
|
1775
1817
|
if (t === "header") {
|
|
@@ -1796,16 +1838,16 @@ class we extends Se {
|
|
|
1796
1838
|
A && A.classes[t] && this.dom.addClasses(A.classes[t], y);
|
|
1797
1839
|
let R;
|
|
1798
1840
|
u && (R = u.render(y, o, i, t, e, S, this.dom.domService));
|
|
1799
|
-
const
|
|
1800
|
-
if (
|
|
1841
|
+
const O = e.getCustomClassesAt(o, i);
|
|
1842
|
+
if (O.length && this.dom.addClasses(O, y), this.dom.addColumnBorderDivs(this.tableOptions, c, g, t, s), h && this.dom.addHorizontalBorder({ left: r, width: l, height: a, top: n + a }, c), this.getFocusModel && t === "body") {
|
|
1801
1843
|
const C = this.getFocusModel();
|
|
1802
1844
|
C != null && C.hasFocus(o, i) && this.dom.addFocusBorderDivs(c, g, {});
|
|
1803
1845
|
}
|
|
1804
1846
|
t === "header" && this.dom.setAttribute(y, "data-ge-action", "drag-column");
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1807
|
-
for (const C in
|
|
1808
|
-
this.dom.setStyle(y, C,
|
|
1847
|
+
const $ = e.getCustomStyleAt(o, i);
|
|
1848
|
+
if ($)
|
|
1849
|
+
for (const C in $)
|
|
1850
|
+
this.dom.setStyle(y, C, $[C]);
|
|
1809
1851
|
return [y, R];
|
|
1810
1852
|
}
|
|
1811
1853
|
/**
|
|
@@ -2146,7 +2188,7 @@ class ve {
|
|
|
2146
2188
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
|
|
2147
2189
|
const t = e.target, s = t.getAttribute("data-area"), o = t.getAttribute("data-row-index"), i = t.getAttribute("data-col-index");
|
|
2148
2190
|
if (s && o && i) {
|
|
2149
|
-
const r =
|
|
2191
|
+
const r = N(s), l = Number(o), a = Number(i);
|
|
2150
2192
|
this.tableScope.updateModelValueAfterEdit(r, l, a, t.value);
|
|
2151
2193
|
}
|
|
2152
2194
|
}
|
|
@@ -2157,12 +2199,12 @@ class Ee {
|
|
|
2157
2199
|
this.rowIndex = e, this.columnIndex = t;
|
|
2158
2200
|
}
|
|
2159
2201
|
}
|
|
2160
|
-
class
|
|
2202
|
+
class G {
|
|
2161
2203
|
constructor(e) {
|
|
2162
2204
|
this.cells = e;
|
|
2163
2205
|
}
|
|
2164
2206
|
static createSingle(e, t) {
|
|
2165
|
-
return new
|
|
2207
|
+
return new G([new Ee(e, t)]);
|
|
2166
2208
|
}
|
|
2167
2209
|
}
|
|
2168
2210
|
class Ae {
|
|
@@ -2249,12 +2291,12 @@ class Me {
|
|
|
2249
2291
|
}
|
|
2250
2292
|
}
|
|
2251
2293
|
function Te(p) {
|
|
2252
|
-
return p.trim().replace(/\+/g, " ").replace(/ +/g, " ").replace(/⌫/g, "backspace").replace(/↩/g, "enter").replace(/⇧/g, "shift").replace(/⌥/g, "alt").replace(/option/g, "alt").replace(/opt/g, "alt").replace(/⌃/g, "ctrl").replace(/control/g, "ctrl").replace(/command/g, "cmd").replace(/meta/g, "cmd").replace(/escape/g, "esc").replace(/⌘/g, "cmd").replace(/\*/g, "multiply").split(" ").filter((e) => e).sort((e, t) => {
|
|
2294
|
+
return p.trim().replace(/\+/g, " ").replace(/ +/g, " ").replace(/⌫/g, "backspace").replace(/↩/g, "enter").replace(/⇧/g, "shift").replace(/⌥/g, "alt").replace(/option/g, "alt").replace(/opt/g, "alt").replace(/⌃/g, "ctrl").replace(/control/g, "ctrl").replace(/command/g, "cmd").replace(/meta/g, "cmd").replace(/escape/g, "esc").replace(/⌘/g, "cmd").replace(/\*/g, "multiply").split(" ").filter((e) => e).filter((e, t, s) => s.indexOf(e) === t).sort((e, t) => {
|
|
2253
2295
|
const s = { cmd: 1, ctrl: 2, alt: 3, shift: 4 }, o = s[e] || 5, i = s[t] || 5;
|
|
2254
2296
|
return o !== i ? o - i : e.localeCompare(t);
|
|
2255
2297
|
}).join(" ");
|
|
2256
2298
|
}
|
|
2257
|
-
function
|
|
2299
|
+
function X(p) {
|
|
2258
2300
|
let e = p.key.toLowerCase();
|
|
2259
2301
|
if (e === " " && (e = "space"), e === "arrowleft" && (e = "left"), e === "arrowright" && (e = "right"), e === "arrowup" && (e = "up"), e === "arrowdown" && (e = "down"), e === "delete" && p.code === "Delete" && (e = "delete"), e === "backspace" && (e = "backspace"), e === "escape" && (e = "esc"), e === "return" && (e = "enter"), p.code.startsWith("Numpad")) {
|
|
2260
2302
|
const s = p.code.replace("Numpad", "").toLowerCase();
|
|
@@ -2309,10 +2351,10 @@ class De {
|
|
|
2309
2351
|
return t;
|
|
2310
2352
|
}
|
|
2311
2353
|
findEntity(e) {
|
|
2312
|
-
const t =
|
|
2354
|
+
const t = X(e);
|
|
2313
2355
|
this.isDebug() && console.debug("ShortcutService shortcut :", t);
|
|
2314
2356
|
for (const s in this.shortcutActionIdMapping)
|
|
2315
|
-
if (
|
|
2357
|
+
if (X(e) === t)
|
|
2316
2358
|
return this.isDebug() && console.debug("ShortcutService action :", this.shortcutActionIdMapping[s]), this.shortcutActionIdMapping[s];
|
|
2317
2359
|
}
|
|
2318
2360
|
// private areTokensEquals(tokens1: string[], tokens2: string[]): boolean {
|
|
@@ -2359,7 +2401,7 @@ class De {
|
|
|
2359
2401
|
return this.shortcutActionIdMapping;
|
|
2360
2402
|
}
|
|
2361
2403
|
}
|
|
2362
|
-
class
|
|
2404
|
+
class K {
|
|
2363
2405
|
onCheckboxChanged(e) {
|
|
2364
2406
|
}
|
|
2365
2407
|
onContextmenu(e) {
|
|
@@ -2379,7 +2421,7 @@ class X {
|
|
|
2379
2421
|
onFocusChanged(e) {
|
|
2380
2422
|
}
|
|
2381
2423
|
}
|
|
2382
|
-
class
|
|
2424
|
+
class ee {
|
|
2383
2425
|
setStyle(e, t, s) {
|
|
2384
2426
|
return e.style[t] = s, e;
|
|
2385
2427
|
}
|
|
@@ -2546,7 +2588,7 @@ class Ie {
|
|
|
2546
2588
|
return [this.rowIndex, this.columnIndex];
|
|
2547
2589
|
}
|
|
2548
2590
|
}
|
|
2549
|
-
class
|
|
2591
|
+
class te {
|
|
2550
2592
|
constructor(e = new D(
|
|
2551
2593
|
"❯",
|
|
2552
2594
|
"",
|
|
@@ -2561,16 +2603,16 @@ class ee {
|
|
|
2561
2603
|
// `⊖ `, `⊕ `;
|
|
2562
2604
|
}
|
|
2563
2605
|
const Le = new Fe(), Oe = new Ie("cell");
|
|
2564
|
-
class
|
|
2606
|
+
class se {
|
|
2565
2607
|
constructor() {
|
|
2566
2608
|
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 = {
|
|
2567
2609
|
header: 34,
|
|
2568
2610
|
body: 34,
|
|
2569
2611
|
footer: 34
|
|
2570
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new
|
|
2612
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new Z(), this.headerGroupOptions = new te(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Q(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new ke(), this.getSelectionModel = () => Le, this.getFocusModel = () => Oe;
|
|
2571
2613
|
}
|
|
2572
2614
|
}
|
|
2573
|
-
const
|
|
2615
|
+
const L = class L {
|
|
2574
2616
|
/**
|
|
2575
2617
|
* Returns the content to be copied based on the provided table model, selection model, and focus model.
|
|
2576
2618
|
*
|
|
@@ -2593,9 +2635,9 @@ const I = class I {
|
|
|
2593
2635
|
const h = t.isSelected(a, c) ? e.getBodyModel().getTextValueAt(a, c) : "";
|
|
2594
2636
|
n.push(h);
|
|
2595
2637
|
}
|
|
2596
|
-
l.push(n.join(
|
|
2638
|
+
l.push(n.join(L.columnSeparatorChar));
|
|
2597
2639
|
}
|
|
2598
|
-
return o(l.join(
|
|
2640
|
+
return o(l.join(L.rowSeparatorChar));
|
|
2599
2641
|
}
|
|
2600
2642
|
}
|
|
2601
2643
|
if (s) {
|
|
@@ -2652,12 +2694,12 @@ const I = class I {
|
|
|
2652
2694
|
return t;
|
|
2653
2695
|
}
|
|
2654
2696
|
};
|
|
2655
|
-
|
|
2697
|
+
L.columnSeparatorChar = " ", L.rowSeparatorChar = `
|
|
2656
2698
|
`;
|
|
2657
|
-
let
|
|
2699
|
+
let P = L;
|
|
2658
2700
|
class Be {
|
|
2659
2701
|
constructor(e, t = 500) {
|
|
2660
|
-
this.tableScope = e, this.debounceDelay = t, new ResizeObserver(
|
|
2702
|
+
this.tableScope = e, this.debounceDelay = t, new ResizeObserver(le(this.handleResize.bind(this), t)).observe(this.tableScope.hostElement);
|
|
2661
2703
|
}
|
|
2662
2704
|
handleResize(e) {
|
|
2663
2705
|
const t = e[0], { width: s } = t.contentRect;
|
|
@@ -2770,18 +2812,18 @@ class Pe {
|
|
|
2770
2812
|
return this.createZip(s);
|
|
2771
2813
|
}
|
|
2772
2814
|
}
|
|
2773
|
-
class
|
|
2774
|
-
constructor(e, t, s, o, i, r = new
|
|
2815
|
+
class U extends we {
|
|
2816
|
+
constructor(e, t, s, o, i, r = new P(), l = new Pe()) {
|
|
2775
2817
|
var c;
|
|
2776
|
-
if (super(e, t, new
|
|
2818
|
+
if (super(e, t, new ne(s), o), this.eventListener = i, this.copyService = r, this.excelService = l, this.licenseManager = k.getInstance(), this.selectionService = new Ae(this), this.api = new ge(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, this.lastContextmenu = Date.now(), t.setTableScope(this), i || (this.eventListener = new K()), (c = this.tableOptions) != null && c.autoRestoreOptions) {
|
|
2777
2819
|
const h = this.tableOptions.autoRestoreOptions, d = h.getStorageKeyFn;
|
|
2778
2820
|
d && (h.autoRestoreScrollPosition && (this.storeScrollPosStateService = new fe(d)), h.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new me(d)), h.autoRestoreSortingState && (this.storeSortingService = new be(d)));
|
|
2779
2821
|
}
|
|
2780
|
-
this.mouseHandler = new
|
|
2822
|
+
this.mouseHandler = new de(this), this.inputHandler = new ve(this), this.resizeHandler = new Be(this, o.resizeEventDebounceDelay), this.shortcutService = new De(this), this.shortcutService.addListener(this.selectionService);
|
|
2781
2823
|
const a = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
2782
2824
|
a && a.addEventSelectionChangedListener(this);
|
|
2783
2825
|
const n = this.getFocusModel ? this.getFocusModel() : void 0;
|
|
2784
|
-
n && n.addEventFocusChangedListener(this);
|
|
2826
|
+
n && n.addEventFocusChangedListener(this), console.log("TableScope created");
|
|
2785
2827
|
}
|
|
2786
2828
|
/**
|
|
2787
2829
|
* Creates a TableScope instance.
|
|
@@ -2795,8 +2837,8 @@ class G extends we {
|
|
|
2795
2837
|
*
|
|
2796
2838
|
* @return {TableScope} - The newly created TableScope instance.
|
|
2797
2839
|
*/
|
|
2798
|
-
static create(e, t, s = new
|
|
2799
|
-
return new
|
|
2840
|
+
static create(e, t, s = new se(), o = new K(), i = new ee(), r = new P()) {
|
|
2841
|
+
return new U(e, t, i, s, o, r);
|
|
2800
2842
|
}
|
|
2801
2843
|
/**
|
|
2802
2844
|
* Triggers an action based on the provided actionId.
|
|
@@ -2824,7 +2866,7 @@ class G extends we {
|
|
|
2824
2866
|
return !1;
|
|
2825
2867
|
}
|
|
2826
2868
|
updateModelValueAfterEdit(e, t, s, o) {
|
|
2827
|
-
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, o) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(
|
|
2869
|
+
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, o) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(G.createSingle(t, s)), this.hostElement.focus());
|
|
2828
2870
|
}
|
|
2829
2871
|
/**
|
|
2830
2872
|
* Retrieves the TableApi object.
|
|
@@ -2853,7 +2895,7 @@ class G extends we {
|
|
|
2853
2895
|
* @return {GeMouseEvent} - The created GeMouseEvent object.
|
|
2854
2896
|
*/
|
|
2855
2897
|
createGeMouseEvent(e) {
|
|
2856
|
-
const t = new
|
|
2898
|
+
const t = new _();
|
|
2857
2899
|
if (t.originalEvent = e, e) {
|
|
2858
2900
|
const s = e.target;
|
|
2859
2901
|
if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(s), t.rowIndex = this.getNumberByAttr(s, "data-row-index"), t.columnIndex = this.getNumberByAttr(s, "data-col-index"), t.action = this.getStringByAttr(s, "data-ge-action"), t.areaIdent) {
|
|
@@ -2929,7 +2971,7 @@ class G extends we {
|
|
|
2929
2971
|
toggleExpandCollapseAll(e = !0) {
|
|
2930
2972
|
var s;
|
|
2931
2973
|
const t = this.tableModel.getBodyModel();
|
|
2932
|
-
|
|
2974
|
+
V(t) && (t.toggleExpandCollapseAll(e), this.repaint(), (s = this.storeStateCollapsedExpandService) == null || s.collapsedStateAll(e));
|
|
2933
2975
|
}
|
|
2934
2976
|
/**
|
|
2935
2977
|
* Toggles the checkbox state of a specific row in a table.
|
|
@@ -3145,7 +3187,7 @@ class G extends we {
|
|
|
3145
3187
|
const s = this.tableOptions.autoRestoreOptions, o = s.getRowId;
|
|
3146
3188
|
if (s.autoRestoreCollapsedExpandedState && o) {
|
|
3147
3189
|
const i = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), r = this.tableModel.getAreaModel("body");
|
|
3148
|
-
if (
|
|
3190
|
+
if (V(r)) {
|
|
3149
3191
|
const l = r, a = r.getRowCount();
|
|
3150
3192
|
for (let n = 0; n < a; n++) {
|
|
3151
3193
|
const c = r.getRowByIndex(n);
|
|
@@ -3199,9 +3241,9 @@ class G extends we {
|
|
|
3199
3241
|
return this.displayedRowCount;
|
|
3200
3242
|
}
|
|
3201
3243
|
}
|
|
3202
|
-
const
|
|
3244
|
+
const W = class W {
|
|
3203
3245
|
};
|
|
3204
|
-
|
|
3246
|
+
W.themes = ["light", "combat", "paper", "blackboard"], W.vars = {
|
|
3205
3247
|
light: `html[data-theme="light"] {
|
|
3206
3248
|
--ge-table-bg: rgba(255,255,255, 0.5);
|
|
3207
3249
|
--ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
|
|
@@ -3435,15 +3477,15 @@ P.themes = ["light", "combat", "paper", "blackboard"], P.vars = {
|
|
|
3435
3477
|
--ge-table-drop-zone-bg: #758129;
|
|
3436
3478
|
}`
|
|
3437
3479
|
};
|
|
3438
|
-
let
|
|
3439
|
-
const
|
|
3440
|
-
constructor(e = new
|
|
3480
|
+
let Y = W;
|
|
3481
|
+
const H = class H {
|
|
3482
|
+
constructor(e = new te()) {
|
|
3441
3483
|
this.headerGroupOptions = e;
|
|
3442
3484
|
}
|
|
3443
3485
|
render(e, t, s, o, i, r, l) {
|
|
3444
3486
|
const a = r != null && r.data ? r.data : "";
|
|
3445
3487
|
if (r) {
|
|
3446
|
-
const { toggle: n, visibility: c, closed: h } = r, d = n ?
|
|
3488
|
+
const { toggle: n, visibility: c, closed: h } = r, d = n ? H.toggleHeaderGroup : "";
|
|
3447
3489
|
this.addText(e, o, t, s, a, d), n && c !== "always" && this.addArrowDiv(l, e, !h, t, s, o, d);
|
|
3448
3490
|
} else
|
|
3449
3491
|
this.addText(e, o, t, s, a, "");
|
|
@@ -3475,11 +3517,11 @@ const W = class W {
|
|
|
3475
3517
|
}
|
|
3476
3518
|
}
|
|
3477
3519
|
};
|
|
3478
|
-
|
|
3479
|
-
let
|
|
3520
|
+
H.toggleHeaderGroup = "toggleHeaderGroup";
|
|
3521
|
+
let q = H;
|
|
3480
3522
|
function Ne({
|
|
3481
3523
|
tableModel: p,
|
|
3482
|
-
tableOptions: e = new
|
|
3524
|
+
tableOptions: e = new se(),
|
|
3483
3525
|
mouseMoved: t,
|
|
3484
3526
|
checkboxChanged: s,
|
|
3485
3527
|
contextmenu: o,
|
|
@@ -3492,9 +3534,9 @@ function Ne({
|
|
|
3492
3534
|
tableReady: h,
|
|
3493
3535
|
licenseKey: d
|
|
3494
3536
|
}) {
|
|
3495
|
-
const u =
|
|
3537
|
+
const u = ie(null);
|
|
3496
3538
|
let g = !1;
|
|
3497
|
-
|
|
3539
|
+
re(() => {
|
|
3498
3540
|
u.current && !g && (b(u.current), g = !0);
|
|
3499
3541
|
});
|
|
3500
3542
|
const b = (f) => {
|
|
@@ -3526,16 +3568,16 @@ function Ne({
|
|
|
3526
3568
|
onMouseMoved: (S) => {
|
|
3527
3569
|
t && t(S);
|
|
3528
3570
|
}
|
|
3529
|
-
}, x = new
|
|
3571
|
+
}, x = new U(
|
|
3530
3572
|
f,
|
|
3531
3573
|
p,
|
|
3532
|
-
new
|
|
3574
|
+
new ee(),
|
|
3533
3575
|
e,
|
|
3534
3576
|
m
|
|
3535
3577
|
);
|
|
3536
3578
|
x.firstInit(), h && h(x.getApi()), d && k.getInstance().setLicenseKey(d);
|
|
3537
3579
|
};
|
|
3538
|
-
return /* @__PURE__ */
|
|
3580
|
+
return /* @__PURE__ */ oe(
|
|
3539
3581
|
"div",
|
|
3540
3582
|
{
|
|
3541
3583
|
ref: u,
|
|
@@ -3550,23 +3592,23 @@ function Ne({
|
|
|
3550
3592
|
}
|
|
3551
3593
|
);
|
|
3552
3594
|
}
|
|
3553
|
-
var
|
|
3595
|
+
var I = {}, J;
|
|
3554
3596
|
function We() {
|
|
3555
|
-
if (
|
|
3556
|
-
|
|
3557
|
-
var p =
|
|
3597
|
+
if (J) return I;
|
|
3598
|
+
J = 1;
|
|
3599
|
+
var p = ae;
|
|
3558
3600
|
if (process.env.NODE_ENV === "production")
|
|
3559
|
-
|
|
3601
|
+
I.createRoot = p.createRoot, I.hydrateRoot = p.hydrateRoot;
|
|
3560
3602
|
else {
|
|
3561
3603
|
var e = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3562
|
-
|
|
3604
|
+
I.createRoot = function(t, s) {
|
|
3563
3605
|
e.usingClientEntryPoint = !0;
|
|
3564
3606
|
try {
|
|
3565
3607
|
return p.createRoot(t, s);
|
|
3566
3608
|
} finally {
|
|
3567
3609
|
e.usingClientEntryPoint = !1;
|
|
3568
3610
|
}
|
|
3569
|
-
},
|
|
3611
|
+
}, I.hydrateRoot = function(t, s, o) {
|
|
3570
3612
|
e.usingClientEntryPoint = !0;
|
|
3571
3613
|
try {
|
|
3572
3614
|
return p.hydrateRoot(t, s, o);
|
|
@@ -3575,7 +3617,7 @@ function We() {
|
|
|
3575
3617
|
}
|
|
3576
3618
|
};
|
|
3577
3619
|
}
|
|
3578
|
-
return
|
|
3620
|
+
return I;
|
|
3579
3621
|
}
|
|
3580
3622
|
var He = We();
|
|
3581
3623
|
class ze {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/react-table",
|
|
3
|
-
"version": "18.1.
|
|
3
|
+
"version": "18.1.68",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"tslib": "^2.3.0",
|
|
21
21
|
"react": "18.2.0",
|
|
22
22
|
"react-dom": "18.2.0",
|
|
23
|
-
"@guiexpert/table": "^1.1.
|
|
23
|
+
"@guiexpert/table": "^1.1.68"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@vitejs/plugin-react": "^4.1.1",
|