@guiexpert/react-table 18.0.26 → 18.1.56
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 +142 -139
- package/package.json +3 -3
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 se=require("react/jsx-runtime"),j=require("react"),oe=require("react-dom");function ie(f,e=500){let t=null;return function(...s){t&&window.clearTimeout(t),t=window.setTimeout(()=>{f.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 $(f){return f&&f.type==="TreeRow"}function H(f){return f&&f.type==="AreaModelTree"}class V{constructor(e=-1,t=-1,s=-1,o=-1,i,a,l,r=0,n=0,c=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=a,this.originalEvent=l,this.clickCount=r,this.draggingX=n,this.draggingY=c,this.action=h}clone(){return new V(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 J{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 Z{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 ae{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,a=""){const l=t.index??-1,r=this.getDivOrCreateDiv(l,e);if(this.domService.addClass(r,"ge-table-row-div"),this.domService.addClass(r,`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(r,`ge-table-row-${n}`)}if(this.domService.setStyle(r,"display","clip"),this.domService.setStyle(r,"position","absolute"),this.domService.setStyle(r,"left",`${t.left}px`),this.domService.setStyle(r,"top",`${t.top}px`),this.domService.setStyle(r,"width",`${t.width}px`),this.domService.setStyle(r,"height",`${t.height}px`),this.domService.setAttribute(r,"data-row-index",`${s}`),this.domService.setAttribute(r,"data-area",`${o}`),a){const n=this.domService.createText(a);this.domService.appendChild(r,n)}return this.domService.appendChild(e.child,r),r}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:a,sideIdent:l,text:r="",treeArrow:n,tableOptions:c,checkedType:h=void 0,sortState:d}=e,m=c==null?void 0:c.treeOptions,p=c==null?void 0:c.showCheckboxWihoutExtraColumn,b=this.domService.createElement("div");this.domService.addClass(b,"ge-table-col-div"),p&&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",`${a}`);const g=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(a==="body"&&l==="center"&&this.domService.addClass(b,`ge-table-column-${g}`),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,m,o,i,a)),p&&i===0&&h&&this.addCheckboxToDiv(b,h,a,o),r){const u=n!=="none"&&i===0;this.addLabelDiv(b,r,u,o,i,a)}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"),a=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
|
${a}
|
|
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,a="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",`${a}`),t)if(s){const r=this.domService.createText(t);this.domService.appendChild(l,r)}else{const r=this.domService.createElement("div");this.domService.appendChild(l,r);const n=this.domService.createText(t);this.domService.addClass(r,"ge-table-label"),this.domService.appendChild(r,n),this.domService.setAttribute(r,"data-row-index",`${o}`),this.domService.setAttribute(r,"data-col-index",`${i}`),this.domService.setAttribute(r,"data-area",`${a}`)}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 a;t==="asc"?a=s.iconAsc:t==="desc"?a=s.iconDesc:a=s.iconPlaceholder;const l=a.content,r=this.domService.createText(l);this.domService.appendChild(i,r),a.style&&this.applyStyleString(i,a.style);for(const n of a.classes)this.domService.addClass(i,n);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Z,o=-1,i=-1,a="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",`${a}`);let r;t==="expanded"?r=s.arrowExpanded:t==="collapsed"?r=s.arrowCollapsed:r=s.arrowPlaceholder;const n=r.content,c=this.domService.createText(n);this.domService.appendChild(l,c),r.style&&this.applyStyleString(l,r.style);for(const h of r.classes)this.domService.addClass(l,h);return this.domService.appendChild(e,l),l}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const a=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,a)}if(e.horizontalBorderVisible){const a=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,a)}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,a]=o.split(":");this.domService.setStyle(e,i.trim(),a.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 G=f=>f==="header"?"header":f==="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=G(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(t-this.lastClicked<this.doubleClickDelay)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($(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 a=s.row;a.expanded=!a.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}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=G(s),i=Number(t.getAttribute("data-row-index")),a=Number(t.getAttribute("data-col-index")),l=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(a)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,a));else if(t.getAttribute("data-row-index")){const r=l.getRowByIndex(i);if(s&&o==="body"&&l.isEditable(i,a)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,a)),$(r)&&a===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const n=r;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,a,l;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const r=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,n=r==="collapsed"&&!e.expanded||r==="expanded"&&e.expanded,c=r==="collapsed"&&e.expanded||r==="expanded"&&!e.expanded,h=t(e.data);n?(a=this.tableScope.storeStateCollapsedExpandService)==null||a.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){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 a of i){const l=this.tableScope.tableModel.getAreaModel(a),r=(l==null?void 0:l.getRowCount())??0;for(let n=0;n<r;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}}class z{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 a=this.autoConvertMapToObject(t);this.persistItem(i,a)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class de extends z{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class he{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class pe extends z{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new he,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 ge extends z{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class R{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 fe{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new R,this.areaBodyCenterGeo=new R,this.areaBodyEastGeo=new R;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 me{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),a=this.areaModel.getRowspanAt(s,o);if(i>1||a>1){i===0&&(i=1),a===0&&(a=1);const l="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new E(s,o,s+a-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 ue{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class be extends fe{constructor(e,t,s,o){var a,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 ue,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(a=this.tableOptions)!=null&&a.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(l=this.tableOptions)!=null&&l.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),H(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(r=>{var n;this.colAndRowspanModels[r]=new me(t,t.getAreaModel(r)),(n=this.colAndRowspanModels[r])==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 R(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new R(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 R(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 R(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 a=this.tableModel.getAreaModel(e),l='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',r=document.querySelector(l);if(r){let n;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let h;if(c?h=this.editorRenderer:h=a.getCellRenderer(t,s),r.innerText="",this.applyCssClasses(r,i),h)n=h.render(r,t,s,e,a,o,this.dom.domService),n&&this.cleanupFunctions[e].push(n);else{const p=`${o}`;this.dom.addLabelDiv(r,p,!1,t,s,e)}const d=a.getCustomClassesAt(t,s);d.length&&this.dom.addClasses(d,r);const m=a.getCustomStyleAt(t,s);if(m)for(const p in m)this.dom.setStyle(r,p,m[p])}}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 g;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),a=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const l=0,r=this.areaBodyCenterGeo.width,n=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),h=c.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let d=t;const m=this.tableModel.getColumnCount(),p=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<h;u++){const x=d,S=u===h-1,w=this.tableModel.getRowHeight(e,u);if(x+w>0){this.firstVisibleRowIndex=u;let v={left:l,width:r,height:w,top:x,index:u},y=this.dom.addRowDiv(o,v,u,e,"center");const T=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:v,parent:y,rowIndex:u,columnIndexStart:T,columnIndexEnd:m-p-1,verticalFixed:!1,lastRowOfModel:S}),n.left>0&&(v={left:l,width:this.areaBodyWestGeo.width,height:w,top:x,index:u},y=this.dom.addRowDiv(s,v,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:v,parent:y,rowIndex:u,columnIndexStart:0,columnIndexEnd:T-1,verticalFixed:!0,lastRowOfModel:S})),n.right>0&&(v={left:l,width:this.areaBodyEastGeo.width,height:w,top:x,index:u},y=this.dom.addRowDiv(i,v,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:v,parent:y,rowIndex:u,columnIndexStart:m-p,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:S})),e==="header"&&this.tree&&u===h-1){const A=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(y,new R(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),M=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(M){const I=this.dom.domService.createText(M.content);this.dom.domService.appendChild(A,I),M.style&&this.dom.applyStyleString(A,M.style)}}}if(d=d+w,d>a)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(u.length)for(const x of u){let S=0,w=o.child,v="center";if(x.c1<b)w=s.child,v="west";else if(p>0&&x.c1>=m-p)w=i.child,v="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*y-this.areaBodyWestGeo.width,v="center"}this.drawBigCell(x,S,t,c,w,v)}}}drawBigCell(e,t,s,o,i,a){const l=s+this.getRowHeights(0,e.r1-1,o).reduce((g,u)=>g+u,0),r=this.tableModel.getColumnCount(),n=this.tableModel.getFixedRightColumnCount();let c=0;n>0&&e.c1>=r-n&&(c=r-n);const h=t+this.getColumnWidths(c,e.c1-1).reduce((g,u)=>g+u,0),d=this.getRowHeights(e.r1,e.r2,o).reduce((g,u)=>g+u,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,u)=>g+u,0);let p=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(p=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:a,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:m,height:d,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:a,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:m,height:d,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:l,cellWidth:m,cellHeight:d,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const a=e.getRowspanAt(i,s);if(a>1&&i+a+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:a,columnIndexStart:l,columnIndexEnd:r,verticalFixed:n=!1,lastRowOfModel:c=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!n){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const d=0,m=!!(e==="body"&&t);let p=h;for(let g=l;g<=r;g++){const u=p,x=this.tableModel.getColumnWidth(g);if(x>0&&u+x>0){let S=o.height;const w=s.getRowspanAt(a,g),v=s.getColspanAt(a,g);w>1&&(S=this.getRowHeights(a,a+w-1,s).reduce((A,M)=>A+M,0));let y=x;v>1&&(y=this.getColumnWidths(g,g+v-1).reduce((A,M)=>A+M,0));let T=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(a,g)&&(T=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,u,d,y,S);const A={left:u,top:d,width:y,height:S};this.dom.addColumnBorderDivs(this.tableOptions,i,A,e,t)}else{const A=this.renderSelectedBackgroundDiv(T,m,t,s,a,g,i,u,d,y,S);"gammaCells"in s&&s.getValueAt(a,g)&&(T=!1),T||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:a,columnIndex:g,left:u,top:d,width:y,height:S,parent:i,cellSelected:A,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:a,columnIndex:g,cellLeft:u,cellTop:d,cellWidth:y,cellHeight:S,parent:i})}}if(p=p+x,p>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new R(p-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:a,width:l,height:r,top:n,parent:c,lastRowOfModel:h}){var j;const m=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),p={left:a,width:l,height:r,top:n,index:i},b=e.getRowByIndex(o);let g="none";if(i===this.getTreeArrowColumnIndex()&&$(b)){const C=b;(j=C.children)!=null&&j.length?C.expanded?g="expanded":g="collapsed":g="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),w=m?"":`${S}`,v=e.isRowChecked(o),y=this.dom.addColumnDiv({parent:c,geo:p,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:w,treeArrow:g,tableOptions:this.tableOptions,checkedType:v,sortState:x}),T=e.getTooltipAt(o,i);T&&this.dom.setAttribute(y,"title",T);const A=this.tableModel.getColumnDef(i);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],y);let M;m&&(M=m.render(y,o,i,t,e,S,this.dom.domService));const I=e.getCustomClassesAt(o,i);if(I.length&&this.dom.addClasses(I,y),this.dom.addColumnBorderDivs(this.tableOptions,c,p,t,s),h&&this.dom.addHorizontalBorder({left:a,width:l,height:r,top:n+r},c),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(o,i)&&this.dom.addFocusBorderDivs(c,p,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const W=e.getCustomStyleAt(o,i);if(W)for(const C in W)this.dom.setStyle(y,C,W[C]);return[y,M]}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 a=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:a,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),a=i==null?void 0:i.getRowCount();if(a){const l=e.index??0,r=this.draggingColumn;for(let n=0;n<a;n++){const c=s,h=i.getRowHeight(n),d={left:0,width:e.width,height:h,top:c,index:n},m=i.getValueAt(n,l),p=i.getCellRenderer(n,l),b=p?"":`${m}`,g={parent:r,geo:d,rowIndex:n,columnIndex:l,areaIdent:t,sideIdent:o,text:b},u=this.dom.addColumnDiv(g);let x;p&&(x=p.render(u,n,l,t,i,m,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const S=i.getCustomClassesAt(n,l);S.length&&this.dom.addClasses(S,u);const w=this.tableModel.getColumnDef(l);w&&w.classes[t]&&this.dom.addClasses(w.classes[t],u),this.dom.addColumnBorderDivs(this.tableOptions,r,d,t,o);const v=i.getCustomStyleAt(n,l);if(v)for(const y in v)this.dom.setStyle(u,y,v[y]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const a=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(a,"left",`${t}px`),this.dom.setStyle(a,"top",`${s}px`),this.dom.setStyle(a,"width",`${o}px`),this.dom.setStyle(a,"height",`${i}px`),a}renderSelectedBackgroundDiv(e,t,s,o,i,a,l,r,n,c,h){let d=!1;if(!e&&t&&o.isSelectable(i,a)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const p=m.getSelectionCount(i,a);d=p>0;for(let b=0;b<p;b++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,l));this.dom.setStyle(g,"left",`${r}px`),this.dom.setStyle(g,"top",`${n}px`),this.dom.setStyle(g,"width",`${c}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return d}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:a,top:l,width:r,height:n,parent:c,cellSelected:h,lastRowOfModel:d}){const[m,p]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:a,width:r,height:n,top:l,parent:c,lastRowOfModel:d});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,m),p&&this.cleanupFunctions[t].push(p)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:a,parent:l}){const r=this.dom.domService,n=this.tableOptions.columnResizeHandleWidthInPx??2,c=r.createElement("div");r.setAttribute(c,"data-col-index",`${t}`),r.setAttribute(c,"data-row-index",`${e}`),r.setAttribute(c,"data-area","header"),r.setAttribute(c,"data-ge-action","resize-column"),r.addClass(c,"ge-table-column-resize-handle"),r.setStyle(c,"display","clip"),r.setStyle(c,"position","absolute"),r.setStyle(c,"cursor","col-resize"),r.setStyle(c,"left",`${s+i-n}px`),r.setStyle(c,"top",`${o}px`),r.setStyle(c,"width",`${n}px`),r.setStyle(c,"height",`${a}px`),r.appendChild(l,c)}}class Se{constructor(e,t){this.columnIndex=e,this.sortState=t}}class ye{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 a=G(s),l=Number(o),r=Number(i);this.tableScope.updateModelValueAfterEdit(a,l,r,t.value)}}}}class xe{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class _{constructor(e){this.cells=e}static createSingle(e,t){return new _([new xe(e,t)])}}class ve{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,a,l,r,n,c,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const d=this.getSelectionModel(),m=this.getFocusModel();d&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(m),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||d.hasSelection()&&(d.clear(),s=!0),(a=e.originalEvent)!=null&&a.shiftKey&&this.previousEvt?(d.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(l=e.originalEvent)!=null&&l.altKey&&((r=e.originalEvent)!=null&&r.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),a=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:a})}}class Ce{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 we{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class Ee{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new we().get()):Object.assign(this.shortcutActionIdMapping,new Ce().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=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const s in this.shortcutActionIdMapping){const o=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,o))return this.shortcutActionIdMapping[s]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}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 Ae{render(e,t,s,o,i,a,l){if(i.isEditable(t,s)){l.addClass(e,"ge-table-row-input-div");const r=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,a="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",`${a}`),t)if(s){const r=this.domService.createText(t);this.domService.appendChild(l,r)}else{const r=this.domService.createElement("div");this.domService.appendChild(l,r);const n=this.domService.createText(t);this.domService.addClass(r,"ge-table-label"),this.domService.appendChild(r,n),this.domService.setAttribute(r,"data-row-index",`${o}`),this.domService.setAttribute(r,"data-col-index",`${i}`),this.domService.setAttribute(r,"data-area",`${a}`)}return this.domService.appendChild(e,l),l}addSortedIcon(e,t="",s=new Z,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 a;t==="asc"?a=s.iconAsc:t==="desc"?a=s.iconDesc:a=s.iconPlaceholder;const l=a.content,r=this.domService.createText(l);this.domService.appendChild(i,r),a.style&&this.applyStyleString(i,a.style);for(const n of a.classes)this.domService.addClass(i,n);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new J,o=-1,i=-1,a="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",`${a}`);let r;t==="expanded"?r=s.arrowExpanded:t==="collapsed"?r=s.arrowCollapsed:r=s.arrowPlaceholder;const n=r.content,c=this.domService.createText(n);this.domService.appendChild(l,c),r.style&&this.applyStyleString(l,r.style);for(const h of r.classes)this.domService.addClass(l,h);return this.domService.appendChild(e,l),l}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const a=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,a)}if(e.horizontalBorderVisible){const a=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,a)}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,a]=o.split(":");this.domService.setStyle(e,i.trim(),a.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=f=>f==="header"?"header":f==="footer"?"footer":"body";class re{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const 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 le{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const s=new re(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($(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 a=s.row;a.expanded=!a.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}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")),a=Number(t.getAttribute("data-col-index")),l=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(a)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,a));else if(t.getAttribute("data-row-index")){const r=l.getRowByIndex(i);if(s&&o==="body"&&l.isEditable(i,a)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,a)),$(r)&&a===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const n=r;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,a,l;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const r=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,n=r==="collapsed"&&!e.expanded||r==="expanded"&&e.expanded,c=r==="collapsed"&&e.expanded||r==="expanded"&&!e.expanded,h=t(e.data);n?(a=this.tableScope.storeStateCollapsedExpandService)==null||a.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 ne{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}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 a of i){const l=this.tableScope.tableModel.getAreaModel(a),r=(l==null?void 0:l.getRowCount())??0;for(let n=0;n<r;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}}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 a=this.autoConvertMapToObject(t);this.persistItem(i,a)}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 ce 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 de{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class he extends G{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new de,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 pe 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 ge{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 fe{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),a=this.areaModel.getRowspanAt(s,o);if(i>1||a>1){i===0&&(i=1),a===0&&(a=1);const l="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new E(s,o,s+a-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 me{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class ue extends ge{constructor(e,t,s,o){var a,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 me,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(a=this.tableOptions)!=null&&a.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(l=this.tableOptions)!=null&&l.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),H(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(r=>{var n;this.colAndRowspanModels[r]=new fe(t,t.getAreaModel(r)),(n=this.colAndRowspanModels[r])==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 a=this.tableModel.getAreaModel(e),l='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',r=document.querySelector(l);if(r){let n;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let h;if(c?h=this.editorRenderer:h=a.getCellRenderer(t,s),r.innerText="",this.applyCssClasses(r,i),h)n=h.render(r,t,s,e,a,o,this.dom.domService),n&&this.cleanupFunctions[e].push(n);else{const p=`${o}`;this.dom.addLabelDiv(r,p,!1,t,s,e)}const d=a.getCustomClassesAt(t,s);d.length&&this.dom.addClasses(d,r);const m=a.getCustomStyleAt(t,s);if(m)for(const p in m)this.dom.setStyle(r,p,m[p])}}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 g;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),a=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const l=0,r=this.areaBodyCenterGeo.width,n=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),h=c.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let d=t;const m=this.tableModel.getColumnCount(),p=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<h;u++){const x=d,S=u===h-1,w=this.tableModel.getRowHeight(e,u);if(x+w>0){this.firstVisibleRowIndex=u;let v={left:l,width:r,height:w,top:x,index:u},y=this.dom.addRowDiv(o,v,u,e,"center");const R=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:v,parent:y,rowIndex:u,columnIndexStart:R,columnIndexEnd:m-p-1,verticalFixed:!1,lastRowOfModel:S}),n.left>0&&(v={left:l,width:this.areaBodyWestGeo.width,height:w,top:x,index:u},y=this.dom.addRowDiv(s,v,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:v,parent:y,rowIndex:u,columnIndexStart:0,columnIndexEnd:R-1,verticalFixed:!0,lastRowOfModel:S})),n.right>0&&(v={left:l,width:this.areaBodyEastGeo.width,height:w,top:x,index:u},y=this.dom.addRowDiv(i,v,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:v,parent:y,rowIndex:u,columnIndexStart:m-p,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:S})),e==="header"&&this.tree&&u===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"}),M=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(M){const L=this.dom.domService.createText(M.content);this.dom.domService.appendChild(A,L),M.style&&this.dom.applyStyleString(A,M.style)}}}if(d=d+w,d>a)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(u.length)for(const x of u){let S=0,w=o.child,v="center";if(x.c1<b)w=s.child,v="west";else if(p>0&&x.c1>=m-p)w=i.child,v="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*y-this.areaBodyWestGeo.width,v="center"}this.drawBigCell(x,S,t,c,w,v)}}}drawBigCell(e,t,s,o,i,a){const l=s+this.getRowHeights(0,e.r1-1,o).reduce((g,u)=>g+u,0),r=this.tableModel.getColumnCount(),n=this.tableModel.getFixedRightColumnCount();let c=0;n>0&&e.c1>=r-n&&(c=r-n);const h=t+this.getColumnWidths(c,e.c1-1).reduce((g,u)=>g+u,0),d=this.getRowHeights(e.r1,e.r2,o).reduce((g,u)=>g+u,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,u)=>g+u,0);let p=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(p=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:a,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:m,height:d,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:a,rowIndex:e.r1,columnIndex:e.c1,left:h,top:l,width:m,height:d,parent:i,cellSelected:p,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:l,cellWidth:m,cellHeight:d,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const a=e.getRowspanAt(i,s);if(a>1&&i+a+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:a,columnIndexStart:l,columnIndexEnd:r,verticalFixed:n=!1,lastRowOfModel:c=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!n){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const d=0,m=!!(e==="body"&&t);let p=h;for(let g=l;g<=r;g++){const u=p,x=this.tableModel.getColumnWidth(g);if(x>0&&u+x>0){let S=o.height;const w=s.getRowspanAt(a,g),v=s.getColspanAt(a,g);w>1&&(S=this.getRowHeights(a,a+w-1,s).reduce((A,M)=>A+M,0));let y=x;v>1&&(y=this.getColumnWidths(g,g+v-1).reduce((A,M)=>A+M,0));let R=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(a,g)&&(R=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,u,d,y,S);const A={left:u,top:d,width:y,height:S};this.dom.addColumnBorderDivs(this.tableOptions,i,A,e,t)}else{const A=this.renderSelectedBackgroundDiv(R,m,t,s,a,g,i,u,d,y,S);"gammaCells"in s&&s.getValueAt(a,g)&&(R=!1),R||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:a,columnIndex:g,left:u,top:d,width:y,height:S,parent:i,cellSelected:A,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:a,columnIndex:g,cellLeft:u,cellTop:d,cellWidth:y,cellHeight:S,parent:i})}}if(p=p+x,p>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(p-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:a,width:l,height:r,top:n,parent:c,lastRowOfModel:h}){var U;const m=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),p={left:a,width:l,height:r,top:n,index:i},b=e.getRowByIndex(o);let g="none";if(i===this.getTreeArrowColumnIndex()&&$(b)){const C=b;(U=C.children)!=null&&U.length?C.expanded?g="expanded":g="collapsed":g="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),w=m?"":`${S}`,v=e.isRowChecked(o),y=this.dom.addColumnDiv({parent:c,geo:p,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:w,treeArrow:g,tableOptions:this.tableOptions,checkedType:v,sortState:x}),R=e.getTooltipAt(o,i);R&&this.dom.setAttribute(y,"title",R);const A=this.tableModel.getColumnDef(i);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],y);let M;m&&(M=m.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,p,t,s),h&&this.dom.addHorizontalBorder({left:a,width:l,height:r,top:n+r},c),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(o,i)&&this.dom.addFocusBorderDivs(c,p,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const W=e.getCustomStyleAt(o,i);if(W)for(const C in W)this.dom.setStyle(y,C,W[C]);return[y,M]}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 a=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:a,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),a=i==null?void 0:i.getRowCount();if(a){const l=e.index??0,r=this.draggingColumn;for(let n=0;n<a;n++){const c=s,h=i.getRowHeight(n),d={left:0,width:e.width,height:h,top:c,index:n},m=i.getValueAt(n,l),p=i.getCellRenderer(n,l),b=p?"":`${m}`,g={parent:r,geo:d,rowIndex:n,columnIndex:l,areaIdent:t,sideIdent:o,text:b},u=this.dom.addColumnDiv(g);let x;p&&(x=p.render(u,n,l,t,i,m,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const S=i.getCustomClassesAt(n,l);S.length&&this.dom.addClasses(S,u);const w=this.tableModel.getColumnDef(l);w&&w.classes[t]&&this.dom.addClasses(w.classes[t],u),this.dom.addColumnBorderDivs(this.tableOptions,r,d,t,o);const v=i.getCustomStyleAt(n,l);if(v)for(const y in v)this.dom.setStyle(u,y,v[y]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const a=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(a,"left",`${t}px`),this.dom.setStyle(a,"top",`${s}px`),this.dom.setStyle(a,"width",`${o}px`),this.dom.setStyle(a,"height",`${i}px`),a}renderSelectedBackgroundDiv(e,t,s,o,i,a,l,r,n,c,h){let d=!1;if(!e&&t&&o.isSelectable(i,a)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const p=m.getSelectionCount(i,a);d=p>0;for(let b=0;b<p;b++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,l));this.dom.setStyle(g,"left",`${r}px`),this.dom.setStyle(g,"top",`${n}px`),this.dom.setStyle(g,"width",`${c}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return d}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:a,top:l,width:r,height:n,parent:c,cellSelected:h,lastRowOfModel:d}){const[m,p]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:a,width:r,height:n,top:l,parent:c,lastRowOfModel:d});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,m),p&&this.cleanupFunctions[t].push(p)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:a,parent:l}){const r=this.dom.domService,n=this.tableOptions.columnResizeHandleWidthInPx??2,c=r.createElement("div");r.setAttribute(c,"data-col-index",`${t}`),r.setAttribute(c,"data-row-index",`${e}`),r.setAttribute(c,"data-area","header"),r.setAttribute(c,"data-ge-action","resize-column"),r.addClass(c,"ge-table-column-resize-handle"),r.setStyle(c,"display","clip"),r.setStyle(c,"position","absolute"),r.setStyle(c,"cursor","col-resize"),r.setStyle(c,"left",`${s+i-n}px`),r.setStyle(c,"top",`${o}px`),r.setStyle(c,"width",`${n}px`),r.setStyle(c,"height",`${a}px`),r.appendChild(l,c)}}class be{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Se{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 a=N(s),l=Number(o),r=Number(i);this.tableScope.updateModelValueAfterEdit(a,l,r,t.value)}}}}class ye{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 ye(e,t)])}}class xe{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,a,l,r,n,c,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const d=this.getSelectionModel(),m=this.getFocusModel();d&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(m),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||d.hasSelection()&&(d.clear(),s=!0),(a=e.originalEvent)!=null&&a.shiftKey&&this.previousEvt?(d.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(l=e.originalEvent)!=null&&l.altKey&&((r=e.originalEvent)!=null&&r.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),a=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:a})}}class ve{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class Ce{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class we{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new Ce().get()):Object.assign(this.shortcutActionIdMapping,new ve().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=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const s in this.shortcutActionIdMapping){const o=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,o))return this.shortcutActionIdMapping[s]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class X{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Q{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 Ee{render(e,t,s,o,i,a,l){if(i.isEditable(t,s)){l.addClass(e,"ge-table-row-input-div");const r=i.getValueAt(t,s);e.innerHTML=`
|
|
9
9
|
<input
|
|
10
10
|
type="text"
|
|
11
11
|
value="${r}"
|
|
@@ -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
|
|
21
|
-
`;let O=
|
|
20
|
+
class="ge-table-cell-editor-input">`}}}class Ae{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,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 Me{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 ee{constructor(e=new D("❯","",["gt-table-icon-expanded"]),t=new D("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const Re=new Ae,Te=new Me("cell");class te{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 J,this.headerGroupOptions=new ee,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Z,this.sortOrder=["asc","desc"],this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new Ee,this.getSelectionModel=()=>Re,this.getFocusModel=()=>Te}}const I=class I{createContent(e,t,s){return new Promise((o,i)=>{if(t!=null&&t.hasSelection()){const a=this.mergeRanges(t.getRanges());if(a){a.c2=Math.min(a.c2,e.getColumnCount()-1),a.r2=Math.min(a.r2,e.getBodyModel().getRowCount()-1);const l=[];for(let r=a.r1;r<=a.r2;r++){const n=[];for(let c=a.c1;c<=a.c2;c++){const h=t.isSelected(r,c)?e.getBodyModel().getTextValueAt(r,c):"";n.push(h)}l.push(n.join(I.columnSeparatorChar))}return o(l.join(I.rowSeparatorChar))}}if(s){const[a,l]=s.getFocus(),r=e.getBodyModel().getTextValueAt(a,l);return o(r)}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(a=>{a&&this.copyContent(a).then(l=>{o(a)}).catch(l=>{i()})}).catch(a=>{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}};I.columnSeparatorChar=" ",I.rowSeparatorChar=`
|
|
21
|
+
`;let O=I;class De{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,new ResizeObserver(ie(this.handleResize.bind(this),t)).observe(this.tableScope.hostElement)}handleResize(e){const t=e[0],{width:s}=t.contentRect;this.tableScope.recalcColumnWidths(s)}}class ke{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"}),a=document.createElement("a");a.href=URL.createObjectURL(i),a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a)}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>`,a=`<?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 a=o[i],l=this.getCellAddress(s,i);if(typeof a=="number")t.push(`<c r="${l}"><v>${a}</v></c>`);else if(a instanceof Date){const r=a;t.push(`<c r="${l}" t="inlineStr"><is><t>${r.toISOString()}</t></is></c>`)}else{const r=a!=null?this.escapeXml(String(a)):"";t.push(`<c r="${l}" t="inlineStr"><is><t>${r}</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 m=new TextEncoder().encode(d),p=new TextEncoder().encode(h),b=new Uint8Array(30+m.length),g=new DataView(b.buffer);b.set([80,75,3,4],0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,0,!0),g.setUint32(18,p.length,!0),g.setUint32(22,p.length,!0),g.setUint16(26,m.length,!0),g.setUint16(28,0,!0),b.set(m,30),t.push(b,p),o.push({path:d,offset:s,contentSize:p.length}),s+=b.length+p.length});const i=s;o.forEach(h=>{const d=new TextEncoder().encode(h.path),m=new Uint8Array(46+d.length),p=new DataView(m.buffer);m.set([80,75,1,2],0),p.setUint16(4,20,!0),p.setUint16(6,20,!0),p.setUint16(8,0,!0),p.setUint16(10,0,!0),p.setUint16(12,0,!0),p.setUint16(14,0,!0),p.setUint32(16,0,!0),p.setUint32(20,h.contentSize,!0),p.setUint32(24,h.contentSize,!0),p.setUint16(28,d.length,!0),p.setUint16(30,0,!0),p.setUint16(32,0,!0),p.setUint16(34,0,!0),p.setUint16(36,0,!0),p.setUint32(38,0,!0),p.setUint32(42,h.offset,!0),m.set(d,46),t.push(m),s+=m.length});const a=new Uint8Array(22),l=new DataView(a.buffer);a.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(a);const r=t.reduce((h,d)=>h+d.length,0),n=new Uint8Array(r);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 be{constructor(e,t,s,o,i,a=new O,l=new Fe){var c;if(super(e,t,new re(s),o),this.eventListener=i,this.copyService=a,this.excelService=l,this.licenseManager=k.getInstance(),this.selectionService=new ve(this),this.api=new ce(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,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 de(d)),h.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new pe(d)),h.autoRestoreSortingState&&(this.storeSortingService=new ge(d)))}this.mouseHandler=new ne(this),this.inputHandler=new ye(this),this.resizeHandler=new ke(this,o.resizeEventDebounceDelay),this.shortcutService=new Ee(this),this.shortcutService.addListener(this.selectionService);const r=this.getSelectionModel?this.getSelectionModel():void 0;r&&r.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,a=new O){return new U(e,t,i,s,o,a)}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(_.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 N;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){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();H(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var r;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),a=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,a),this.repaint();const l=(r=o.rowSelectionModel)==null?void 0:r.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,a;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,r=o.sortState??"",n=l[(l.indexOf(r)+1)%l.length],c=new Se(s,n);this.tableModel.doSort([c])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),(a=this.storeSortingService)==null||a.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(),a=this.tableModel.getAreaModel("body");if(H(a)){const l=a,r=a.getRowCount();for(let n=0;n<r;n++){const c=a.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 a=0;a<t;a++){const l=e.getValueAt(i,a),r=(l==null?void 0:l.toString().length)||0;r>o[a]&&(o[a]=r)}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()}}const B=class B{};B.themes=["light","combat","paper","blackboard"],B.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 m=new TextEncoder().encode(d),p=new TextEncoder().encode(h),b=new Uint8Array(30+m.length),g=new DataView(b.buffer);b.set([80,75,3,4],0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,0,!0),g.setUint32(18,p.length,!0),g.setUint32(22,p.length,!0),g.setUint16(26,m.length,!0),g.setUint16(28,0,!0),b.set(m,30),t.push(b,p),o.push({path:d,offset:s,contentSize:p.length}),s+=b.length+p.length});const i=s;o.forEach(h=>{const d=new TextEncoder().encode(h.path),m=new Uint8Array(46+d.length),p=new DataView(m.buffer);m.set([80,75,1,2],0),p.setUint16(4,20,!0),p.setUint16(6,20,!0),p.setUint16(8,0,!0),p.setUint16(10,0,!0),p.setUint16(12,0,!0),p.setUint16(14,0,!0),p.setUint32(16,0,!0),p.setUint32(20,h.contentSize,!0),p.setUint32(24,h.contentSize,!0),p.setUint16(28,d.length,!0),p.setUint16(30,0,!0),p.setUint16(32,0,!0),p.setUint16(34,0,!0),p.setUint16(36,0,!0),p.setUint32(38,0,!0),p.setUint32(42,h.offset,!0),m.set(d,46),t.push(m),s+=m.length});const a=new Uint8Array(22),l=new DataView(a.buffer);a.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(a);const r=t.reduce((h,d)=>h+d.length,0),n=new Uint8Array(r);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 _ extends ue{constructor(e,t,s,o,i,a=new O,l=new ke){var c;if(super(e,t,new ae(s),o),this.eventListener=i,this.copyService=a,this.excelService=l,this.licenseManager=k.getInstance(),this.selectionService=new xe(this),this.api=new ne(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,t.setTableScope(this),i||(this.eventListener=new X),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const h=this.tableOptions.autoRestoreOptions,d=h.getStorageKeyFn;d&&(h.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new ce(d)),h.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new he(d)),h.autoRestoreSortingState&&(this.storeSortingService=new pe(d)))}this.mouseHandler=new le(this),this.inputHandler=new Se(this),this.resizeHandler=new De(this,o.resizeEventDebounceDelay),this.shortcutService=new we(this),this.shortcutService.addListener(this.selectionService);const r=this.getSelectionModel?this.getSelectionModel():void 0;r&&r.addEventSelectionChangedListener(this);const n=this.getFocusModel?this.getFocusModel():void 0;n&&n.addEventFocusChangedListener(this)}static create(e,t,s=new te,o=new X,i=new Q,a=new O){return new _(e,t,i,s,o,a)}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 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){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();H(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var r;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),a=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,a),this.repaint();const l=(r=o.rowSelectionModel)==null?void 0:r.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,a;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,r=o.sortState??"",n=l[(l.indexOf(r)+1)%l.length],c=new be(s,n);this.tableModel.doSort([c])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),(a=this.storeSortingService)==null||a.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(),a=this.tableModel.getAreaModel("body");if(H(a)){const l=a,r=a.getRowCount();for(let n=0;n<r;n++){const c=a.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 a=0;a<t;a++){const l=e.getValueAt(i,a),r=(l==null?void 0:l.toString().length)||0;r>o[a]&&(o[a]=r)}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()}}const B=class B{};B.themes=["light","combat","paper","blackboard"],B.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 K=B;const P=class P{constructor(e=new ee){this.headerGroupOptions=e}render(e,t,s,o,i,a,l){const r=a!=null&&a.data?a.data:"";if(a){const{toggle:n,visibility:c,closed:h}=a,d=n?P.toggleHeaderGroup:"";this.addText(e,o,t,s,r,d),n&&c!=="always"&&this.addArrowDiv(l,e,!h,t,s,o,d)}else this.addText(e,o,t,s,r,"")}addText(e,t,s,o,i,a){e.innerHTML=`<span
|
|
266
266
|
data-ge-action="${a}"
|
|
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,a="header",l){const r=e.createElement("div");e.addClass(r,"ge-table-toggle-icon-div"),e.setStyle(r,"display","inline-block"),e.setStyle(r,"position",""),e.setStyle(r,"width","20px"),e.setStyle(r,"background","transparent"),e.setStyle(r,"cursor","pointer"),e.setAttribute(r,"data-row-index",`${o}`),e.setAttribute(r,"data-col-index",`${i}`),e.setAttribute(r,"data-area",`${a}`),e.setAttribute(r,"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(r,h),n.style&&this.applyStyleString(e,r,n.style);for(const d of n.classes)e.addClass(r,d);return e.appendChild(t,r),r}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[a,l]=i.split(":");e.setStyle(t,a.trim(),l.trim())}}};P.toggleHeaderGroup="toggleHeaderGroup";let
|
|
270
|
+
>${i}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,a="header",l){const r=e.createElement("div");e.addClass(r,"ge-table-toggle-icon-div"),e.setStyle(r,"display","inline-block"),e.setStyle(r,"position",""),e.setStyle(r,"width","20px"),e.setStyle(r,"background","transparent"),e.setStyle(r,"cursor","pointer"),e.setAttribute(r,"data-row-index",`${o}`),e.setAttribute(r,"data-col-index",`${i}`),e.setAttribute(r,"data-area",`${a}`),e.setAttribute(r,"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(r,h),n.style&&this.applyStyleString(e,r,n.style);for(const d of n.classes)e.addClass(r,d);return e.appendChild(t,r),r}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[a,l]=i.split(":");e.setStyle(t,a.trim(),l.trim())}}};P.toggleHeaderGroup="toggleHeaderGroup";let Y=P;function Fe({tableModel:f,tableOptions:e=new te,mouseMoved:t,checkboxChanged:s,contextmenu:o,modelChanged:i,mouseClicked:a,mouseDragging:l,mouseDraggingEnd:r,selectionChanged:n,focusChanged:c,tableReady:h,licenseKey:d}){const m=j.useRef(null);let p=!1;j.useEffect(()=>{m.current&&!p&&(b(m.current),p=!0)});const b=g=>{const u={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=>{a&&a(S)},onMouseDragging:S=>{l&&l(S)},onMouseDraggingEnd:S=>{r&&r(S)},onMouseMoved:S=>{t&&t(S)}},x=new _(g,f,new Q,e,u);x.firstInit(),h&&h(x.getApi()),d&&k.getInstance().setLicenseKey(d)};return se.jsx("div",{ref:m,className:"container-div",style:{width:"100%",height:"100%",background:"transparent",padding:"0",margin:"0"}})}var F={},q;function Ie(){if(q)return F;q=1;var f=oe;if(process.env.NODE_ENV==="production")F.createRoot=f.createRoot,F.hydrateRoot=f.hydrateRoot;else{var e=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;F.createRoot=function(t,s){e.usingClientEntryPoint=!0;try{return f.createRoot(t,s)}finally{e.usingClientEntryPoint=!1}},F.hydrateRoot=function(t,s,o){e.usingClientEntryPoint=!0;try{return f.hydrateRoot(t,s,o)}finally{e.usingClientEntryPoint=!1}}}return F}var Le=Ie();class Oe{constructor(e){this.Component=e,console.info(e)}render(e,t,s,o,i,a,l){const r={cellDiv:e,rowIndex:t,columnIndex:s,areaIdent:o,areaModel:i,cellValue:a},n=Le.createRoot(e,{});return n.render(this.Component(r)),()=>{n.unmount()}}}exports.ComponentRendererWrapper=Oe;exports.GuiexpertTable=Fe;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsx as te } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as se, useEffect as oe } from "react";
|
|
3
|
+
import ie from "react-dom";
|
|
4
|
+
function ae(f, e = 500) {
|
|
5
5
|
let t = null;
|
|
6
6
|
return function(...s) {
|
|
7
7
|
t && window.clearTimeout(t), t = window.setTimeout(() => {
|
|
@@ -40,12 +40,12 @@ function $(f) {
|
|
|
40
40
|
function H(f) {
|
|
41
41
|
return f && f.type === "AreaModelTree";
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class V {
|
|
44
44
|
constructor(e = -1, t = -1, s = -1, o = -1, i, a, l, r = 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 = a, this.originalEvent = l, this.clickCount = r, this.draggingX = n, this.draggingY = c, this.action = h;
|
|
46
46
|
}
|
|
47
47
|
clone() {
|
|
48
|
-
return new
|
|
48
|
+
return new V(
|
|
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 q {
|
|
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 J {
|
|
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 re {
|
|
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 J(), 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 a;
|
|
@@ -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 q(), o = -1, i = -1, a = "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", `${a}`);
|
|
228
228
|
let r;
|
|
@@ -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 = (f) => f === "header" ? "header" : f === "footer" ? "footer" : "body";
|
|
277
|
+
class le {
|
|
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 ne {
|
|
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))
|
|
@@ -316,7 +316,7 @@ class ce {
|
|
|
316
316
|
if (t - this.lastClicked < this.doubleClickDelay)
|
|
317
317
|
return;
|
|
318
318
|
this.lastClicked = t;
|
|
319
|
-
const s = new
|
|
319
|
+
const s = new le(e.target, this.tableScope);
|
|
320
320
|
if (s.action === "toggleExpandCollapseAll")
|
|
321
321
|
this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
|
|
322
322
|
else if (s.action === "toggleHeaderGroup")
|
|
@@ -345,7 +345,7 @@ class ce {
|
|
|
345
345
|
*/
|
|
346
346
|
onHostElementDblClicked(e) {
|
|
347
347
|
if (this.lastClicked = Date.now(), e.target instanceof HTMLElement) {
|
|
348
|
-
const t = e.target, s = t.getAttribute("data-area"), o =
|
|
348
|
+
const t = e.target, s = t.getAttribute("data-area"), o = N(s), i = Number(t.getAttribute("data-row-index")), a = Number(t.getAttribute("data-col-index")), l = this.tableScope.tableModel.getAreaModel(o);
|
|
349
349
|
if (s && o === "header")
|
|
350
350
|
this.tableScope.tableModel.isSortable(a) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, i, a));
|
|
351
351
|
else if (t.getAttribute("data-row-index")) {
|
|
@@ -418,7 +418,7 @@ class ce {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
class
|
|
421
|
+
class ce {
|
|
422
422
|
constructor(e) {
|
|
423
423
|
this.tableScope = e;
|
|
424
424
|
}
|
|
@@ -645,7 +645,7 @@ class de {
|
|
|
645
645
|
return this.tableScope.tableModel;
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
class
|
|
648
|
+
class G {
|
|
649
649
|
constructor(e) {
|
|
650
650
|
this.getStorageKeyFn = e;
|
|
651
651
|
}
|
|
@@ -712,7 +712,7 @@ class z {
|
|
|
712
712
|
// }
|
|
713
713
|
// }
|
|
714
714
|
}
|
|
715
|
-
class
|
|
715
|
+
class de extends G {
|
|
716
716
|
constructor(e) {
|
|
717
717
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
718
718
|
}
|
|
@@ -734,14 +734,14 @@ class he extends z {
|
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
class
|
|
737
|
+
class he {
|
|
738
738
|
constructor(e = "collapsed", t = [], s = !1, o = !1) {
|
|
739
739
|
this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = o;
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
|
-
class
|
|
742
|
+
class pe extends G {
|
|
743
743
|
constructor(e) {
|
|
744
|
-
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new
|
|
744
|
+
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new he(), this.load();
|
|
745
745
|
}
|
|
746
746
|
collapsedExpandedStateGet() {
|
|
747
747
|
return this.collapsedExpandedState;
|
|
@@ -773,7 +773,7 @@ class ge extends z {
|
|
|
773
773
|
this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
|
-
class
|
|
776
|
+
class ge extends G {
|
|
777
777
|
constructor(e) {
|
|
778
778
|
super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
|
|
779
779
|
}
|
|
@@ -794,14 +794,14 @@ class fe extends z {
|
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
class
|
|
797
|
+
class T {
|
|
798
798
|
constructor(e = 0, t = 0, s = 0, o = 0, i) {
|
|
799
799
|
this.left = e, this.width = t, this.height = s, this.top = o, this.index = i;
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
|
-
class
|
|
802
|
+
class fe {
|
|
803
803
|
constructor(e, t, s, o) {
|
|
804
|
-
this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = o, this.scrollTop = 0, this.areaBodyWestGeo = new
|
|
804
|
+
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();
|
|
805
805
|
const i = this.hostElement;
|
|
806
806
|
i.innerText = "", this.dom.setAttribute(i, "tabindex", "0"), this.dom.setStyle(
|
|
807
807
|
this.dom.addClass("ge-table", i),
|
|
@@ -1005,7 +1005,7 @@ class E {
|
|
|
1005
1005
|
return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
class
|
|
1008
|
+
class me {
|
|
1009
1009
|
constructor(e, t) {
|
|
1010
1010
|
this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
|
|
1011
1011
|
}
|
|
@@ -1038,22 +1038,22 @@ class ue {
|
|
|
1038
1038
|
return !1;
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
class
|
|
1041
|
+
class ue {
|
|
1042
1042
|
constructor(e, t, s) {
|
|
1043
1043
|
this.header = e, this.body = t, this.footer = s;
|
|
1044
1044
|
}
|
|
1045
1045
|
}
|
|
1046
|
-
class
|
|
1046
|
+
class be extends fe {
|
|
1047
1047
|
constructor(e, t, s, o) {
|
|
1048
1048
|
var a, l;
|
|
1049
1049
|
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 = {
|
|
1050
1050
|
header: [],
|
|
1051
1051
|
body: [],
|
|
1052
1052
|
footer: []
|
|
1053
|
-
}, this.tree = !1, this.colAndRowspanModels = new
|
|
1053
|
+
}, this.tree = !1, this.colAndRowspanModels = new ue(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (a = this.tableOptions) != null && a.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (l = this.tableOptions) != null && l.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), H(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
1054
1054
|
(r) => {
|
|
1055
1055
|
var n;
|
|
1056
|
-
this.colAndRowspanModels[r] = new
|
|
1056
|
+
this.colAndRowspanModels[r] = new me(t, t.getAreaModel(r)), (n = this.colAndRowspanModels[r]) == null || n.init();
|
|
1057
1057
|
}
|
|
1058
1058
|
);
|
|
1059
1059
|
}
|
|
@@ -1139,19 +1139,19 @@ class Se extends me {
|
|
|
1139
1139
|
for (const t of this.removables)
|
|
1140
1140
|
t.remove();
|
|
1141
1141
|
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(
|
|
1142
|
-
new
|
|
1142
|
+
new T(0, this.hostElement.clientWidth, 1, 0),
|
|
1143
1143
|
this.hostElement,
|
|
1144
1144
|
"ge-table-border"
|
|
1145
1145
|
)), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
|
|
1146
|
-
new
|
|
1146
|
+
new T(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
|
|
1147
1147
|
this.hostElement,
|
|
1148
1148
|
"ge-table-border"
|
|
1149
1149
|
)), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
|
|
1150
|
-
new
|
|
1150
|
+
new T(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
|
|
1151
1151
|
this.hostElement,
|
|
1152
1152
|
"ge-table-body-west-vertical-border"
|
|
1153
1153
|
)), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
|
|
1154
|
-
new
|
|
1154
|
+
new T(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
|
|
1155
1155
|
this.hostElement,
|
|
1156
1156
|
"ge-table-body-west-vertical-border"
|
|
1157
1157
|
));
|
|
@@ -1239,26 +1239,17 @@ class Se extends me {
|
|
|
1239
1239
|
*/
|
|
1240
1240
|
getArea(e, t) {
|
|
1241
1241
|
if (e === "header") {
|
|
1242
|
-
if (t === "west")
|
|
1243
|
-
|
|
1244
|
-
if (t === "
|
|
1245
|
-
return this.areaHeaderCenter;
|
|
1246
|
-
if (t === "east")
|
|
1247
|
-
return this.areaHeaderEast;
|
|
1242
|
+
if (t === "west") return this.areaHeaderWest;
|
|
1243
|
+
if (t === "center") return this.areaHeaderCenter;
|
|
1244
|
+
if (t === "east") return this.areaHeaderEast;
|
|
1248
1245
|
} else if (e === "body") {
|
|
1249
|
-
if (t === "west")
|
|
1250
|
-
|
|
1251
|
-
if (t === "
|
|
1252
|
-
return this.areaBodyCenter;
|
|
1253
|
-
if (t === "east")
|
|
1254
|
-
return this.areaBodyEast;
|
|
1246
|
+
if (t === "west") return this.areaBodyWest;
|
|
1247
|
+
if (t === "center") return this.areaBodyCenter;
|
|
1248
|
+
if (t === "east") return this.areaBodyEast;
|
|
1255
1249
|
} else if (e === "footer") {
|
|
1256
|
-
if (t === "west")
|
|
1257
|
-
|
|
1258
|
-
if (t === "
|
|
1259
|
-
return this.areaFooterCenter;
|
|
1260
|
-
if (t === "east")
|
|
1261
|
-
return this.areaFooterEast;
|
|
1250
|
+
if (t === "west") return this.areaFooterWest;
|
|
1251
|
+
if (t === "center") return this.areaFooterCenter;
|
|
1252
|
+
if (t === "east") return this.areaFooterEast;
|
|
1262
1253
|
}
|
|
1263
1254
|
throw Error(`Wrong area identifier: row:${e}, col:${t}`);
|
|
1264
1255
|
}
|
|
@@ -1284,8 +1275,7 @@ class Se extends me {
|
|
|
1284
1275
|
var s;
|
|
1285
1276
|
if (e) {
|
|
1286
1277
|
const o = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
|
|
1287
|
-
if (o)
|
|
1288
|
-
return Number(o);
|
|
1278
|
+
if (o) return Number(o);
|
|
1289
1279
|
}
|
|
1290
1280
|
return -1;
|
|
1291
1281
|
}
|
|
@@ -1301,8 +1291,7 @@ class Se extends me {
|
|
|
1301
1291
|
var s;
|
|
1302
1292
|
if (e) {
|
|
1303
1293
|
const o = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
|
|
1304
|
-
if (o)
|
|
1305
|
-
return o;
|
|
1294
|
+
if (o) return o;
|
|
1306
1295
|
}
|
|
1307
1296
|
return "";
|
|
1308
1297
|
}
|
|
@@ -1330,7 +1319,7 @@ class Se extends me {
|
|
|
1330
1319
|
if (x + w > 0) {
|
|
1331
1320
|
this.firstVisibleRowIndex = u;
|
|
1332
1321
|
let v = { left: l, width: r, height: w, top: x, index: u }, y = this.dom.addRowDiv(o, v, u, e, "center");
|
|
1333
|
-
const
|
|
1322
|
+
const R = b;
|
|
1334
1323
|
if (this.adjustColumnsToRowParent({
|
|
1335
1324
|
areaIdent: e,
|
|
1336
1325
|
sideIdent: "center",
|
|
@@ -1338,7 +1327,7 @@ class Se extends me {
|
|
|
1338
1327
|
geo: v,
|
|
1339
1328
|
parent: y,
|
|
1340
1329
|
rowIndex: u,
|
|
1341
|
-
columnIndexStart:
|
|
1330
|
+
columnIndexStart: R,
|
|
1342
1331
|
columnIndexEnd: m - p - 1,
|
|
1343
1332
|
verticalFixed: !1,
|
|
1344
1333
|
lastRowOfModel: S
|
|
@@ -1350,7 +1339,7 @@ class Se extends me {
|
|
|
1350
1339
|
parent: y,
|
|
1351
1340
|
rowIndex: u,
|
|
1352
1341
|
columnIndexStart: 0,
|
|
1353
|
-
columnIndexEnd:
|
|
1342
|
+
columnIndexEnd: R - 1,
|
|
1354
1343
|
verticalFixed: !0,
|
|
1355
1344
|
lastRowOfModel: S
|
|
1356
1345
|
})), n.right > 0 && (v = { left: l, width: this.areaBodyEastGeo.width, height: w, top: x, index: u }, y = this.dom.addRowDiv(i, v, u, e, "east"), this.adjustColumnsToRowParent({
|
|
@@ -1367,15 +1356,15 @@ class Se extends me {
|
|
|
1367
1356
|
})), e === "header" && this.tree && u === h - 1) {
|
|
1368
1357
|
const A = this.dom.applyStyle(
|
|
1369
1358
|
this.dom.setAttribute(
|
|
1370
|
-
this.dom.addDiv(y, new
|
|
1359
|
+
this.dom.addDiv(y, new T(16, 20, 20, 8)),
|
|
1371
1360
|
"data-ge-action",
|
|
1372
1361
|
"toggleExpandCollapseAll"
|
|
1373
1362
|
),
|
|
1374
1363
|
{ cursor: "pointer" }
|
|
1375
1364
|
), M = this.tableOptions.treeOptions.arrowExpandCollapseAll;
|
|
1376
1365
|
if (M) {
|
|
1377
|
-
const
|
|
1378
|
-
this.dom.domService.appendChild(A,
|
|
1366
|
+
const L = this.dom.domService.createText(M.content);
|
|
1367
|
+
this.dom.domService.appendChild(A, L), M.style && this.dom.applyStyleString(A, M.style);
|
|
1379
1368
|
}
|
|
1380
1369
|
}
|
|
1381
1370
|
}
|
|
@@ -1510,14 +1499,14 @@ class Se extends me {
|
|
|
1510
1499
|
w > 1 && (S = this.getRowHeights(a, a + w - 1, s).reduce((A, M) => A + M, 0));
|
|
1511
1500
|
let y = x;
|
|
1512
1501
|
v > 1 && (y = this.getColumnWidths(g, g + v - 1).reduce((A, M) => A + M, 0));
|
|
1513
|
-
let
|
|
1514
|
-
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(a, g) && (
|
|
1502
|
+
let R = !1;
|
|
1503
|
+
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(a, g) && (R = !0), this.draggingTargetColumnIndex === g && e !== "header") {
|
|
1515
1504
|
this.renderDragTargetDiv(i, u, d, y, S);
|
|
1516
1505
|
const A = { left: u, top: d, width: y, height: S };
|
|
1517
1506
|
this.dom.addColumnBorderDivs(this.tableOptions, i, A, e, t);
|
|
1518
1507
|
} else {
|
|
1519
|
-
const A = this.renderSelectedBackgroundDiv(
|
|
1520
|
-
"gammaCells" in s && s.getValueAt(a, g) && (
|
|
1508
|
+
const A = this.renderSelectedBackgroundDiv(R, m, t, s, a, g, i, u, d, y, S);
|
|
1509
|
+
"gammaCells" in s && s.getValueAt(a, g) && (R = !1), R || this.renderCell({
|
|
1521
1510
|
areaModel: s,
|
|
1522
1511
|
areaIdent: e,
|
|
1523
1512
|
sideIdent: t,
|
|
@@ -1545,7 +1534,7 @@ class Se extends me {
|
|
|
1545
1534
|
if (p = p + x, p > this.areaBodyCenterGeo.width)
|
|
1546
1535
|
break;
|
|
1547
1536
|
}
|
|
1548
|
-
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new
|
|
1537
|
+
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(p - 1, 1, o.height, 0), i);
|
|
1549
1538
|
}
|
|
1550
1539
|
/**
|
|
1551
1540
|
* Retrieves the column index of the tree arrow column in the table.
|
|
@@ -1572,12 +1561,12 @@ class Se extends me {
|
|
|
1572
1561
|
parent: c,
|
|
1573
1562
|
lastRowOfModel: h
|
|
1574
1563
|
}) {
|
|
1575
|
-
var
|
|
1564
|
+
var U;
|
|
1576
1565
|
const m = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), p = { left: a, width: l, height: r, top: n, index: i }, b = e.getRowByIndex(o);
|
|
1577
1566
|
let g = "none";
|
|
1578
1567
|
if (i === this.getTreeArrowColumnIndex() && $(b)) {
|
|
1579
1568
|
const C = b;
|
|
1580
|
-
(
|
|
1569
|
+
(U = C.children) != null && U.length ? C.expanded ? g = "expanded" : g = "collapsed" : g = "hidden";
|
|
1581
1570
|
}
|
|
1582
1571
|
let x;
|
|
1583
1572
|
if (t === "header") {
|
|
@@ -1598,14 +1587,14 @@ class Se extends me {
|
|
|
1598
1587
|
checkedType: v,
|
|
1599
1588
|
sortState: x
|
|
1600
1589
|
}
|
|
1601
|
-
),
|
|
1602
|
-
|
|
1590
|
+
), R = e.getTooltipAt(o, i);
|
|
1591
|
+
R && this.dom.setAttribute(y, "title", R);
|
|
1603
1592
|
const A = this.tableModel.getColumnDef(i);
|
|
1604
1593
|
A && A.classes[t] && this.dom.addClasses(A.classes[t], y);
|
|
1605
1594
|
let M;
|
|
1606
1595
|
m && (M = m.render(y, o, i, t, e, S, this.dom.domService));
|
|
1607
|
-
const
|
|
1608
|
-
if (
|
|
1596
|
+
const L = e.getCustomClassesAt(o, i);
|
|
1597
|
+
if (L.length && this.dom.addClasses(L, y), this.dom.addColumnBorderDivs(this.tableOptions, c, p, t, s), h && this.dom.addHorizontalBorder({ left: a, width: l, height: r, top: n + r }, c), this.getFocusModel && t === "body") {
|
|
1609
1598
|
const C = this.getFocusModel();
|
|
1610
1599
|
C != null && C.hasFocus(o, i) && this.dom.addFocusBorderDivs(c, p, {});
|
|
1611
1600
|
}
|
|
@@ -1933,12 +1922,12 @@ class Se extends me {
|
|
|
1933
1922
|
r.setAttribute(c, "data-col-index", `${t}`), r.setAttribute(c, "data-row-index", `${e}`), r.setAttribute(c, "data-area", "header"), r.setAttribute(c, "data-ge-action", "resize-column"), r.addClass(c, "ge-table-column-resize-handle"), r.setStyle(c, "display", "clip"), r.setStyle(c, "position", "absolute"), r.setStyle(c, "cursor", "col-resize"), r.setStyle(c, "left", `${s + i - n}px`), r.setStyle(c, "top", `${o}px`), r.setStyle(c, "width", `${n}px`), r.setStyle(c, "height", `${a}px`), r.appendChild(l, c);
|
|
1934
1923
|
}
|
|
1935
1924
|
}
|
|
1936
|
-
class
|
|
1925
|
+
class Se {
|
|
1937
1926
|
constructor(e, t) {
|
|
1938
1927
|
this.columnIndex = e, this.sortState = t;
|
|
1939
1928
|
}
|
|
1940
1929
|
}
|
|
1941
|
-
class
|
|
1930
|
+
class ye {
|
|
1942
1931
|
constructor(e) {
|
|
1943
1932
|
this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
|
|
1944
1933
|
}
|
|
@@ -1954,26 +1943,26 @@ class xe {
|
|
|
1954
1943
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
|
|
1955
1944
|
const t = e.target, s = t.getAttribute("data-area"), o = t.getAttribute("data-row-index"), i = t.getAttribute("data-col-index");
|
|
1956
1945
|
if (s && o && i) {
|
|
1957
|
-
const a =
|
|
1946
|
+
const a = N(s), l = Number(o), r = Number(i);
|
|
1958
1947
|
this.tableScope.updateModelValueAfterEdit(a, l, r, t.value);
|
|
1959
1948
|
}
|
|
1960
1949
|
}
|
|
1961
1950
|
}
|
|
1962
1951
|
}
|
|
1963
|
-
class
|
|
1952
|
+
class xe {
|
|
1964
1953
|
constructor(e = -1, t = -1) {
|
|
1965
1954
|
this.rowIndex = e, this.columnIndex = t;
|
|
1966
1955
|
}
|
|
1967
1956
|
}
|
|
1968
|
-
class
|
|
1957
|
+
class z {
|
|
1969
1958
|
constructor(e) {
|
|
1970
1959
|
this.cells = e;
|
|
1971
1960
|
}
|
|
1972
1961
|
static createSingle(e, t) {
|
|
1973
|
-
return new
|
|
1962
|
+
return new z([new xe(e, t)]);
|
|
1974
1963
|
}
|
|
1975
1964
|
}
|
|
1976
|
-
class
|
|
1965
|
+
class ve {
|
|
1977
1966
|
constructor(e) {
|
|
1978
1967
|
var t, s;
|
|
1979
1968
|
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);
|
|
@@ -2014,7 +2003,7 @@ class Ce {
|
|
|
2014
2003
|
});
|
|
2015
2004
|
}
|
|
2016
2005
|
}
|
|
2017
|
-
class
|
|
2006
|
+
class Ce {
|
|
2018
2007
|
get() {
|
|
2019
2008
|
return {
|
|
2020
2009
|
f2: "START_EDITING",
|
|
@@ -2034,7 +2023,7 @@ class we {
|
|
|
2034
2023
|
};
|
|
2035
2024
|
}
|
|
2036
2025
|
}
|
|
2037
|
-
class
|
|
2026
|
+
class we {
|
|
2038
2027
|
get() {
|
|
2039
2028
|
return {
|
|
2040
2029
|
f2: "START_EDITING",
|
|
@@ -2056,7 +2045,7 @@ class Ee {
|
|
|
2056
2045
|
};
|
|
2057
2046
|
}
|
|
2058
2047
|
}
|
|
2059
|
-
class
|
|
2048
|
+
class Ee {
|
|
2060
2049
|
constructor(e) {
|
|
2061
2050
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
2062
2051
|
}
|
|
@@ -2077,7 +2066,7 @@ class Ae {
|
|
|
2077
2066
|
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));
|
|
2078
2067
|
}
|
|
2079
2068
|
assignPredefinedSystemShortcutMappings() {
|
|
2080
|
-
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new
|
|
2069
|
+
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new we().get()) : Object.assign(this.shortcutActionIdMapping, new Ce().get());
|
|
2081
2070
|
}
|
|
2082
2071
|
isMacintosh() {
|
|
2083
2072
|
return navigator.platform.indexOf("Mac") > -1;
|
|
@@ -2129,7 +2118,7 @@ class Ae {
|
|
|
2129
2118
|
return this.shortcutActionIdMapping;
|
|
2130
2119
|
}
|
|
2131
2120
|
}
|
|
2132
|
-
class
|
|
2121
|
+
class X {
|
|
2133
2122
|
onCheckboxChanged(e) {
|
|
2134
2123
|
}
|
|
2135
2124
|
onContextmenu(e) {
|
|
@@ -2149,7 +2138,7 @@ class j {
|
|
|
2149
2138
|
onFocusChanged(e) {
|
|
2150
2139
|
}
|
|
2151
2140
|
}
|
|
2152
|
-
class
|
|
2141
|
+
class Z {
|
|
2153
2142
|
setStyle(e, t, s) {
|
|
2154
2143
|
return e.style[t] = s, e;
|
|
2155
2144
|
}
|
|
@@ -2176,7 +2165,7 @@ class Q {
|
|
|
2176
2165
|
e.setAttribute(t, s);
|
|
2177
2166
|
}
|
|
2178
2167
|
}
|
|
2179
|
-
class
|
|
2168
|
+
class Ae {
|
|
2180
2169
|
render(e, t, s, o, i, a, l) {
|
|
2181
2170
|
if (i.isEditable(t, s)) {
|
|
2182
2171
|
l.addClass(e, "ge-table-row-input-div");
|
|
@@ -2197,7 +2186,7 @@ class Me {
|
|
|
2197
2186
|
}
|
|
2198
2187
|
}
|
|
2199
2188
|
}
|
|
2200
|
-
class
|
|
2189
|
+
class Me {
|
|
2201
2190
|
constructor(e = "none", t = "single") {
|
|
2202
2191
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.silent = !1, this.listenerArr = [];
|
|
2203
2192
|
}
|
|
@@ -2316,7 +2305,7 @@ class Re {
|
|
|
2316
2305
|
return [this.rowIndex, this.columnIndex];
|
|
2317
2306
|
}
|
|
2318
2307
|
}
|
|
2319
|
-
class
|
|
2308
|
+
class Q {
|
|
2320
2309
|
constructor(e = new D(
|
|
2321
2310
|
"❯",
|
|
2322
2311
|
"",
|
|
@@ -2330,17 +2319,17 @@ class ee {
|
|
|
2330
2319
|
}
|
|
2331
2320
|
// `⊖ `, `⊕ `;
|
|
2332
2321
|
}
|
|
2333
|
-
const
|
|
2334
|
-
class
|
|
2322
|
+
const Te = new Me(), De = new Re("cell");
|
|
2323
|
+
class ee {
|
|
2335
2324
|
constructor() {
|
|
2336
2325
|
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 = {
|
|
2337
2326
|
header: 34,
|
|
2338
2327
|
body: 34,
|
|
2339
2328
|
footer: 34
|
|
2340
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new
|
|
2329
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new q(), this.headerGroupOptions = new Q(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new J(), this.sortOrder = ["asc", "desc"], this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new Ae(), this.getSelectionModel = () => Te, this.getFocusModel = () => De;
|
|
2341
2330
|
}
|
|
2342
2331
|
}
|
|
2343
|
-
const
|
|
2332
|
+
const I = class I {
|
|
2344
2333
|
/**
|
|
2345
2334
|
* Returns the content to be copied based on the provided table model, selection model, and focus model.
|
|
2346
2335
|
*
|
|
@@ -2363,9 +2352,9 @@ const F = class F {
|
|
|
2363
2352
|
const h = t.isSelected(r, c) ? e.getBodyModel().getTextValueAt(r, c) : "";
|
|
2364
2353
|
n.push(h);
|
|
2365
2354
|
}
|
|
2366
|
-
l.push(n.join(
|
|
2355
|
+
l.push(n.join(I.columnSeparatorChar));
|
|
2367
2356
|
}
|
|
2368
|
-
return o(l.join(
|
|
2357
|
+
return o(l.join(I.rowSeparatorChar));
|
|
2369
2358
|
}
|
|
2370
2359
|
}
|
|
2371
2360
|
if (s) {
|
|
@@ -2422,19 +2411,19 @@ const F = class F {
|
|
|
2422
2411
|
return t;
|
|
2423
2412
|
}
|
|
2424
2413
|
};
|
|
2425
|
-
|
|
2414
|
+
I.columnSeparatorChar = " ", I.rowSeparatorChar = `
|
|
2426
2415
|
`;
|
|
2427
|
-
let O =
|
|
2428
|
-
class
|
|
2416
|
+
let O = I;
|
|
2417
|
+
class ke {
|
|
2429
2418
|
constructor(e, t = 500) {
|
|
2430
|
-
this.tableScope = e, this.debounceDelay = t, new ResizeObserver(
|
|
2419
|
+
this.tableScope = e, this.debounceDelay = t, new ResizeObserver(ae(this.handleResize.bind(this), t)).observe(this.tableScope.hostElement);
|
|
2431
2420
|
}
|
|
2432
2421
|
handleResize(e) {
|
|
2433
2422
|
const t = e[0], { width: s } = t.contentRect;
|
|
2434
2423
|
this.tableScope.recalcColumnWidths(s);
|
|
2435
2424
|
}
|
|
2436
2425
|
}
|
|
2437
|
-
class
|
|
2426
|
+
class Fe {
|
|
2438
2427
|
/**
|
|
2439
2428
|
* Downloads a matrix data as an Excel file.
|
|
2440
2429
|
*
|
|
@@ -2540,14 +2529,14 @@ class Ie {
|
|
|
2540
2529
|
return this.createZip(s);
|
|
2541
2530
|
}
|
|
2542
2531
|
}
|
|
2543
|
-
class
|
|
2544
|
-
constructor(e, t, s, o, i, a = new O(), l = new
|
|
2532
|
+
class _ extends be {
|
|
2533
|
+
constructor(e, t, s, o, i, a = new O(), l = new Fe()) {
|
|
2545
2534
|
var c;
|
|
2546
|
-
if (super(e, t, new
|
|
2535
|
+
if (super(e, t, new re(s), o), this.eventListener = i, this.copyService = a, this.excelService = l, this.licenseManager = k.getInstance(), this.selectionService = new ve(this), this.api = new ce(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, t.setTableScope(this), i || (this.eventListener = new X()), (c = this.tableOptions) != null && c.autoRestoreOptions) {
|
|
2547
2536
|
const h = this.tableOptions.autoRestoreOptions, d = h.getStorageKeyFn;
|
|
2548
|
-
d && (h.autoRestoreScrollPosition && (this.storeScrollPosStateService = new
|
|
2537
|
+
d && (h.autoRestoreScrollPosition && (this.storeScrollPosStateService = new de(d)), h.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new pe(d)), h.autoRestoreSortingState && (this.storeSortingService = new ge(d)));
|
|
2549
2538
|
}
|
|
2550
|
-
this.mouseHandler = new
|
|
2539
|
+
this.mouseHandler = new ne(this), this.inputHandler = new ye(this), this.resizeHandler = new ke(this, o.resizeEventDebounceDelay), this.shortcutService = new Ee(this), this.shortcutService.addListener(this.selectionService);
|
|
2551
2540
|
const r = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
2552
2541
|
r && r.addEventSelectionChangedListener(this);
|
|
2553
2542
|
const n = this.getFocusModel ? this.getFocusModel() : void 0;
|
|
@@ -2565,8 +2554,8 @@ class U extends Se {
|
|
|
2565
2554
|
*
|
|
2566
2555
|
* @return {TableScope} - The newly created TableScope instance.
|
|
2567
2556
|
*/
|
|
2568
|
-
static create(e, t, s = new
|
|
2569
|
-
return new
|
|
2557
|
+
static create(e, t, s = new ee(), o = new X(), i = new Z(), a = new O()) {
|
|
2558
|
+
return new _(e, t, i, s, o, a);
|
|
2570
2559
|
}
|
|
2571
2560
|
/**
|
|
2572
2561
|
* Triggers an action based on the provided actionId.
|
|
@@ -2594,7 +2583,7 @@ class U extends Se {
|
|
|
2594
2583
|
return !1;
|
|
2595
2584
|
}
|
|
2596
2585
|
updateModelValueAfterEdit(e, t, s, o) {
|
|
2597
|
-
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, o) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(
|
|
2586
|
+
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, o) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(z.createSingle(t, s)), this.hostElement.focus());
|
|
2598
2587
|
}
|
|
2599
2588
|
/**
|
|
2600
2589
|
* Retrieves the TableApi object.
|
|
@@ -2623,7 +2612,7 @@ class U extends Se {
|
|
|
2623
2612
|
* @return {GeMouseEvent} - The created GeMouseEvent object.
|
|
2624
2613
|
*/
|
|
2625
2614
|
createGeMouseEvent(e) {
|
|
2626
|
-
const t = new
|
|
2615
|
+
const t = new V();
|
|
2627
2616
|
if (t.originalEvent = e, e) {
|
|
2628
2617
|
const s = e.target;
|
|
2629
2618
|
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) {
|
|
@@ -2763,7 +2752,7 @@ class U extends Se {
|
|
|
2763
2752
|
const o = this.tableModel.getColumnDef(s);
|
|
2764
2753
|
if (o != null && o.sortable && o.sortable()) {
|
|
2765
2754
|
e.preventDefault(), e.stopPropagation();
|
|
2766
|
-
const l = o.sortStatesOrder ? o.sortStatesOrder : this.tableOptions.sortOrder, r = o.sortState ?? "", n = l[(l.indexOf(r) + 1) % l.length], c = new
|
|
2755
|
+
const l = o.sortStatesOrder ? o.sortStatesOrder : this.tableOptions.sortOrder, r = o.sortState ?? "", n = l[(l.indexOf(r) + 1) % l.length], c = new Se(s, n);
|
|
2767
2756
|
this.tableModel.doSort([c]) && ((i = this.tableModel.getColumnDefs()) == null || i.forEach((d) => d.sortState = ""), o.sortState = n), this.repaint(), (a = this.storeSortingService) == null || a.setSortItems([c]);
|
|
2768
2757
|
}
|
|
2769
2758
|
}
|
|
@@ -3191,9 +3180,9 @@ B.themes = ["light", "combat", "paper", "blackboard"], B.vars = {
|
|
|
3191
3180
|
--ge-table-drop-zone-bg: #758129;
|
|
3192
3181
|
}`
|
|
3193
3182
|
};
|
|
3194
|
-
let
|
|
3183
|
+
let j = B;
|
|
3195
3184
|
const P = class P {
|
|
3196
|
-
constructor(e = new
|
|
3185
|
+
constructor(e = new Q()) {
|
|
3197
3186
|
this.headerGroupOptions = e;
|
|
3198
3187
|
}
|
|
3199
3188
|
render(e, t, s, o, i, a, l) {
|
|
@@ -3232,10 +3221,10 @@ const P = class P {
|
|
|
3232
3221
|
}
|
|
3233
3222
|
};
|
|
3234
3223
|
P.toggleHeaderGroup = "toggleHeaderGroup";
|
|
3235
|
-
let
|
|
3236
|
-
function
|
|
3224
|
+
let K = P;
|
|
3225
|
+
function We({
|
|
3237
3226
|
tableModel: f,
|
|
3238
|
-
tableOptions: e = new
|
|
3227
|
+
tableOptions: e = new ee(),
|
|
3239
3228
|
mouseMoved: t,
|
|
3240
3229
|
checkboxChanged: s,
|
|
3241
3230
|
contextmenu: o,
|
|
@@ -3248,9 +3237,9 @@ function Pe({
|
|
|
3248
3237
|
tableReady: h,
|
|
3249
3238
|
licenseKey: d
|
|
3250
3239
|
}) {
|
|
3251
|
-
const m =
|
|
3240
|
+
const m = se(null);
|
|
3252
3241
|
let p = !1;
|
|
3253
|
-
|
|
3242
|
+
oe(() => {
|
|
3254
3243
|
m.current && !p && (b(m.current), p = !0);
|
|
3255
3244
|
});
|
|
3256
3245
|
const b = (g) => {
|
|
@@ -3282,16 +3271,16 @@ function Pe({
|
|
|
3282
3271
|
onMouseMoved: (S) => {
|
|
3283
3272
|
t && t(S);
|
|
3284
3273
|
}
|
|
3285
|
-
}, x = new
|
|
3274
|
+
}, x = new _(
|
|
3286
3275
|
g,
|
|
3287
3276
|
f,
|
|
3288
|
-
new
|
|
3277
|
+
new Z(),
|
|
3289
3278
|
e,
|
|
3290
3279
|
u
|
|
3291
3280
|
);
|
|
3292
3281
|
x.firstInit(), h && h(x.getApi()), d && k.getInstance().setLicenseKey(d);
|
|
3293
3282
|
};
|
|
3294
|
-
return /* @__PURE__ */
|
|
3283
|
+
return /* @__PURE__ */ te(
|
|
3295
3284
|
"div",
|
|
3296
3285
|
{
|
|
3297
3286
|
ref: m,
|
|
@@ -3306,21 +3295,35 @@ function Pe({
|
|
|
3306
3295
|
}
|
|
3307
3296
|
);
|
|
3308
3297
|
}
|
|
3309
|
-
var
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
var
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3298
|
+
var F = {}, Y;
|
|
3299
|
+
function Ie() {
|
|
3300
|
+
if (Y) return F;
|
|
3301
|
+
Y = 1;
|
|
3302
|
+
var f = ie;
|
|
3303
|
+
if (process.env.NODE_ENV === "production")
|
|
3304
|
+
F.createRoot = f.createRoot, F.hydrateRoot = f.hydrateRoot;
|
|
3305
|
+
else {
|
|
3306
|
+
var e = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3307
|
+
F.createRoot = function(t, s) {
|
|
3308
|
+
e.usingClientEntryPoint = !0;
|
|
3309
|
+
try {
|
|
3310
|
+
return f.createRoot(t, s);
|
|
3311
|
+
} finally {
|
|
3312
|
+
e.usingClientEntryPoint = !1;
|
|
3313
|
+
}
|
|
3314
|
+
}, F.hydrateRoot = function(t, s, o) {
|
|
3315
|
+
e.usingClientEntryPoint = !0;
|
|
3316
|
+
try {
|
|
3317
|
+
return f.hydrateRoot(t, s, o);
|
|
3318
|
+
} finally {
|
|
3319
|
+
e.usingClientEntryPoint = !1;
|
|
3320
|
+
}
|
|
3321
|
+
};
|
|
3322
|
+
}
|
|
3323
|
+
return F;
|
|
3322
3324
|
}
|
|
3323
|
-
|
|
3325
|
+
var Le = Ie();
|
|
3326
|
+
class $e {
|
|
3324
3327
|
constructor(e) {
|
|
3325
3328
|
this.Component = e, console.info(e);
|
|
3326
3329
|
}
|
|
@@ -3332,13 +3335,13 @@ class We {
|
|
|
3332
3335
|
areaIdent: o,
|
|
3333
3336
|
areaModel: i,
|
|
3334
3337
|
cellValue: a
|
|
3335
|
-
}, n =
|
|
3338
|
+
}, n = Le.createRoot(e, {});
|
|
3336
3339
|
return n.render(this.Component(r)), () => {
|
|
3337
3340
|
n.unmount();
|
|
3338
3341
|
};
|
|
3339
3342
|
}
|
|
3340
3343
|
}
|
|
3341
3344
|
export {
|
|
3342
|
-
|
|
3343
|
-
|
|
3345
|
+
$e as ComponentRendererWrapper,
|
|
3346
|
+
We as GuiexpertTable
|
|
3344
3347
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/react-table",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.1.56",
|
|
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.56"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@vitejs/plugin-react": "^4.1.1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/react-dom": "^18.2.15",
|
|
29
29
|
"@testing-library/react": "^14.1.0",
|
|
30
30
|
"@types/node": "^20.11.17",
|
|
31
|
-
"vite": "
|
|
31
|
+
"vite": "6.3.4",
|
|
32
32
|
"vite-plugin-dts": "^3.7.2",
|
|
33
33
|
"vite-plugin-eslint": "^1.8.1",
|
|
34
34
|
"vite-plugin-static-copy": "^0.17.0",
|