@guiexpert/table 1.1.12 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -5,7 +5,7 @@
5
5
  data-row-index="${s}"
6
6
  data-input-type="checkbox"
7
7
  ${r}
8
- class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const d=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,d),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new he,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const d of r.classes)this.domService.addClass(i,d);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",o=new de,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const d=l.content,a=this.domService.createText(d);this.domService.appendChild(n,a),l.style&&this.applyStyleString(n,l.style);for(const h of l.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const X=c=>c==="header"?"header":c==="footer"?"footer":"body";class xe{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=X(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class Ce{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const o=new xe(e.target,this.tableScope);if(o.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(o.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(o),e.preventDefault(),e.stopPropagation();else if(o.inputType==="checkbox"&&o.areaIdent)this.tableScope.toggleRowCheckbox(o.rowIdx,o.colIdx,o.areaIdent),e.preventDefault(),e.stopPropagation();else if(L(o.row)&&o.areaModel){const s=o.colIdx===this.getArrowColumnIndex()&&e.altKey,i=o.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){e.preventDefault(),e.stopPropagation();const r=o.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in o.areaModel&&o.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(o.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(o.rowIdx,o.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,o=t.getAttribute("data-area"),s=X(o),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(o&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(i);if(o&&s==="body"&&n.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),L(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const d=l;d.expanded=!d.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(d)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var o,s,i,r,n;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,d=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,a=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,h=t(e.data);d?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):a&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class ye{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()}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())}}class ce{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const o=e;for(const s of[...o]){const[i,r]=s;t[i]=r}}return t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class ve extends ce{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class Re{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class Ae extends ce{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new Re,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Me extends ce{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SORTING_STATE;let s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class O{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}class Ee{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class A{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Ie{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(o,s,o+r-1,s+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class T{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class Te extends Ee{constructor(e,t,o,s){var r,n;super(e,t,o,s),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new T,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),N(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var d;this.colAndRowspanModels[l]=new Ie(t,t.getAreaModel(l)),(d=this.colAndRowspanModels[l])==null||d.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}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 O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(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 O(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 O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let d;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o?this.editorRenderer:r.getCellRenderer(t,o);if(l.innerText="",this.applyCssClasses(l,i),h)d=h.render(l,t,o,e,r,s,this.dom.domService),d&&this.cleanupFunctions[e].push(d);else{const b=`${s}`;this.dom.addLabelDiv(l,b,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const m=r.getCustomStyleAt(t,o);if(m)for(const b in m)this.dom.setStyle(l,b,m[b])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,d=this.tableModel.getPadding(),a=this.tableModel.getAreaModel(e),h=a.getRowCount();for(;this.cleanupFunctions[e].length;){const p=this.cleanupFunctions[e].shift();p&&p()}let u=t;const m=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let p=0;p<h;p++){const C=u,y=p===h-1,R=this.tableModel.getRowHeight(e,p);if(C+R>0){this.firstVisibleRowIndex=p;let x={left:n,width:l,height:R,top:C,index:p},w=this.dom.addRowDiv(s,x,p,e,"center");const k=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:a,geo:x,parent:w,rowIndex:p,columnIndexStart:k,columnIndexEnd:m-b-1,verticalFixed:!1,lastRowOfModel:y}),d.left>0&&(x={left:n,width:this.areaBodyWestGeo.width,height:R,top:C,index:p},w=this.dom.addRowDiv(o,x,p,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:a,geo:x,parent:w,rowIndex:p,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:y})),d.right>0&&(x={left:n,width:this.areaBodyEastGeo.width,height:R,top:C,index:p},w=this.dom.addRowDiv(i,x,p,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:a,geo:x,parent:w,rowIndex:p,columnIndexStart:m-b,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:y})),e==="header"&&this.tree&&p===h-1){const M=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(w,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),I=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(I){const W=this.dom.domService.createText(I.content);this.dom.domService.appendChild(M,W),I.style&&this.dom.applyStyleString(M,I.style)}}}if(u=u+R,u>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const p=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(p.length)for(const C of p){let y=0,R=s.child,x="center";if(C.c1<f)R=o.child,x="west";else if(b>0&&C.c1>=m-b)R=i.child,x="east";else{const w=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();y=this.scrollFactorX*w-this.areaBodyWestGeo.width,x="center"}this.drawBigCell(C,y,t,a,R,x)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,p)=>g+p,0),l=this.tableModel.getColumnCount(),d=this.tableModel.getFixedRightColumnCount();let a=0;d>0&&e.c1>=l-d&&(a=l-d);const h=t+this.getColumnWidths(a,e.c1-1).reduce((g,p)=>g+p,0),u=this.getRowHeights(e.r1,e.r2,s).reduce((g,p)=>g+p,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,p)=>g+p,0);let b=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(b=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:m,cellHeight:u,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:d=!1,lastRowOfModel:a=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!d){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const u=0,m=!!(e==="body"&&t);let b=h;for(let g=n;g<=l;g++){const p=b,C=this.tableModel.getColumnWidth(g);if(C>0&&p+C>0){let y=s.height;const R=o.getRowspanAt(r,g),x=o.getColspanAt(r,g);R>1&&(y=this.getRowHeights(r,r+R-1,o).reduce((M,I)=>M+I,0));let w=C;x>1&&(w=this.getColumnWidths(g,g+x-1).reduce((M,I)=>M+I,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,g)&&(k=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,p,u,w,y);const M={left:p,top:u,width:w,height:y};this.dom.addColumnBorderDivs(this.tableOptions,i,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(k,m,t,o,r,g,i,p,u,w,y);"gammaCells"in o&&o.getValueAt(r,g)&&(k=!1),k||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:p,top:u,width:w,height:y,parent:i,cellSelected:M,lastRowOfModel:a,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:p,cellTop:u,cellWidth:w,cellHeight:y,parent:i})}}if(b=b+C,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(b-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:d,parent:a,lastRowOfModel:h}){var me;const m=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),b={left:r,width:n,height:l,top:d,index:i},f=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&L(f)){const v=f;(me=v.children)!=null&&me.length?v.expanded?g="expanded":g="collapsed":g="hidden"}let C;if(t==="header"){const v=this.tableModel.getColumnDef(i);(!(v!=null&&v.sortIconVisible)||v!=null&&v.sortIconVisible())&&(C=v==null?void 0:v.sortState)}const y=e.getValueAt(s,i),R=m?"":`${y}`,x=e.isRowChecked(s),w=this.dom.addColumnDiv({parent:a,geo:b,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:R,treeArrow:g,tableOptions:this.tableOptions,checkedType:x,sortState:C}),k=e.getTooltipAt(s,i);k&&this.dom.setAttribute(w,"title",k);const M=this.tableModel.getColumnDef(i);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],w);let I;m&&(I=m.render(w,s,i,t,e,y,this.dom.domService));const W=e.getCustomClassesAt(s,i);if(W.length&&this.dom.addClasses(W,w),this.dom.addColumnBorderDivs(this.tableOptions,a,b,t,o),h&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:d+l},a),this.getFocusModel&&t==="body"){const v=this.getFocusModel();v!=null&&v.hasFocus(s,i)&&this.dom.addFocusBorderDivs(a,b,{})}t==="header"&&this.dom.setAttribute(w,"data-ge-action","drag-column");const q=e.getCustomStyleAt(s,i);if(q)for(const v in q)this.dom.setStyle(w,v,q[v]);return[w,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const a={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,a),o&&this.renderContentOfDraggingColumn(a)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let d=0;d<r;d++){const a=o,h=i.getRowHeight(d),u={left:0,width:e.width,height:h,top:a,index:d},m=i.getValueAt(d,n),b=i.getCellRenderer(d,n),f=b?"":`${m}`,g={parent:l,geo:u,rowIndex:d,columnIndex:n,areaIdent:t,sideIdent:s,text:f},p=this.dom.addColumnDiv(g);let C;b&&(C=b.render(p,d,n,t,i,m,this.dom.domService),C&&this.cleanupFunctions[t].push(C));const y=i.getCustomClassesAt(d,n);y.length&&this.dom.addClasses(y,p);const R=this.tableModel.getColumnDef(n);R&&R.classes[t]&&this.dom.addClasses(R.classes[t],p),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,s);const x=i.getCustomStyleAt(d,n);if(x)for(const w in x)this.dom.setStyle(p,w,x[w]);o=o+h}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,d,a,h){let u=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const b=m.getSelectionCount(i,r);u=b>0;for(let f=0;f<b;f++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${d}px`),this.dom.setStyle(g,"width",`${a}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:d,parent:a,cellSelected:h,lastRowOfModel:u}){const[m,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:d,top:n,parent:a,lastRowOfModel:u});h&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,m),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,d=this.tableOptions.columnResizeHandleWidthInPx??2,a=l.createElement("div");l.setAttribute(a,"data-col-index",`${t}`),l.setAttribute(a,"data-row-index",`${e}`),l.setAttribute(a,"data-area","header"),l.setAttribute(a,"data-ge-action","resize-column"),l.addClass(a,"ge-table-column-resize-handle"),l.setStyle(a,"display","clip"),l.setStyle(a,"position","absolute"),l.setStyle(a,"cursor","col-resize"),l.setStyle(a,"left",`${o+i-d}px`),l.setStyle(a,"top",`${s}px`),l.setStyle(a,"width",`${d}px`),l.setStyle(a,"height",`${r}px`),l.appendChild(n,a)}}class ke{constructor(e,t){this.columnIndex=e,this.sortState=t}}class De{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=X(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class _e{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class K{constructor(e){this.cells=e}static createSingle(e,t){return new K([new _e(e,t)])}}class Oe{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,l,d,a,h;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),m=this.getFocusModel();u&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(d=e.originalEvent)!=null&&d.metaKey)?(u.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(a=e.originalEvent)!=null&&a.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(u.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class $e{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 Fe{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 Pe{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 Fe().get()):Object.assign(this.shortcutActionIdMapping,new $e().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const o in this.shortcutActionIdMapping){const s=o.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,s))return this.shortcutActionIdMapping[o]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class J{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class Le{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class He{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
8
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const d=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,d),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new he,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const d of r.classes)this.domService.addClass(i,d);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",o=new de,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const d=l.content,a=this.domService.createText(d);this.domService.appendChild(n,a),l.style&&this.applyStyleString(n,l.style);for(const h of l.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const X=c=>c==="header"?"header":c==="footer"?"footer":"body";class xe{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=X(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class Ce{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const o=new xe(e.target,this.tableScope);if(o.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(o.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(o),e.preventDefault(),e.stopPropagation();else if(o.inputType==="checkbox"&&o.areaIdent)this.tableScope.toggleRowCheckbox(o.rowIdx,o.colIdx,o.areaIdent),e.preventDefault(),e.stopPropagation();else if(L(o.row)&&o.areaModel){const s=o.colIdx===this.getArrowColumnIndex()&&e.altKey,i=o.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){e.preventDefault(),e.stopPropagation();const r=o.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in o.areaModel&&o.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(o.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(o.rowIdx,o.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,o=t.getAttribute("data-area"),s=X(o),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(o&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(i);if(o&&s==="body"&&n.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),L(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const d=l;d.expanded=!d.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(d)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var o,s,i,r,n;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,d=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,a=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,h=t(e.data);d?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):a&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class ye{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class ce{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const o=e;for(const s of[...o]){const[i,r]=s;t[i]=r}}return t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class ve extends ce{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class Re{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class Ae extends ce{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new Re,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Me extends ce{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SORTING_STATE;let s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class O{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}class Ee{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class A{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Ie{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(o,s,o+r-1,s+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class T{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class Te extends Ee{constructor(e,t,o,s){var r,n;super(e,t,o,s),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new T,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),N(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var d;this.colAndRowspanModels[l]=new Ie(t,t.getAreaModel(l)),(d=this.colAndRowspanModels[l])==null||d.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(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 O(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 O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let d;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o?this.editorRenderer:r.getCellRenderer(t,o);if(l.innerText="",this.applyCssClasses(l,i),h)d=h.render(l,t,o,e,r,s,this.dom.domService),d&&this.cleanupFunctions[e].push(d);else{const b=`${s}`;this.dom.addLabelDiv(l,b,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const m=r.getCustomStyleAt(t,o);if(m)for(const b in m)this.dom.setStyle(l,b,m[b])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,d=this.tableModel.getPadding(),a=this.tableModel.getAreaModel(e),h=a.getRowCount();for(;this.cleanupFunctions[e].length;){const p=this.cleanupFunctions[e].shift();p&&p()}let u=t;const m=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let p=0;p<h;p++){const C=u,y=p===h-1,R=this.tableModel.getRowHeight(e,p);if(C+R>0){this.firstVisibleRowIndex=p;let x={left:n,width:l,height:R,top:C,index:p},w=this.dom.addRowDiv(s,x,p,e,"center");const k=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:a,geo:x,parent:w,rowIndex:p,columnIndexStart:k,columnIndexEnd:m-b-1,verticalFixed:!1,lastRowOfModel:y}),d.left>0&&(x={left:n,width:this.areaBodyWestGeo.width,height:R,top:C,index:p},w=this.dom.addRowDiv(o,x,p,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:a,geo:x,parent:w,rowIndex:p,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:y})),d.right>0&&(x={left:n,width:this.areaBodyEastGeo.width,height:R,top:C,index:p},w=this.dom.addRowDiv(i,x,p,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:a,geo:x,parent:w,rowIndex:p,columnIndexStart:m-b,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:y})),e==="header"&&this.tree&&p===h-1){const M=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(w,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),I=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(I){const W=this.dom.domService.createText(I.content);this.dom.domService.appendChild(M,W),I.style&&this.dom.applyStyleString(M,I.style)}}}if(u=u+R,u>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const p=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(p.length)for(const C of p){let y=0,R=s.child,x="center";if(C.c1<f)R=o.child,x="west";else if(b>0&&C.c1>=m-b)R=i.child,x="east";else{const w=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();y=this.scrollFactorX*w-this.areaBodyWestGeo.width,x="center"}this.drawBigCell(C,y,t,a,R,x)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,p)=>g+p,0),l=this.tableModel.getColumnCount(),d=this.tableModel.getFixedRightColumnCount();let a=0;d>0&&e.c1>=l-d&&(a=l-d);const h=t+this.getColumnWidths(a,e.c1-1).reduce((g,p)=>g+p,0),u=this.getRowHeights(e.r1,e.r2,s).reduce((g,p)=>g+p,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,p)=>g+p,0);let b=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(b=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:m,height:u,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:m,cellHeight:u,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:d=!1,lastRowOfModel:a=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!d){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*g}const u=0,m=!!(e==="body"&&t);let b=h;for(let g=n;g<=l;g++){const p=b,C=this.tableModel.getColumnWidth(g);if(C>0&&p+C>0){let y=s.height;const R=o.getRowspanAt(r,g),x=o.getColspanAt(r,g);R>1&&(y=this.getRowHeights(r,r+R-1,o).reduce((M,I)=>M+I,0));let w=C;x>1&&(w=this.getColumnWidths(g,g+x-1).reduce((M,I)=>M+I,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,g)&&(k=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,p,u,w,y);const M={left:p,top:u,width:w,height:y};this.dom.addColumnBorderDivs(this.tableOptions,i,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(k,m,t,o,r,g,i,p,u,w,y);"gammaCells"in o&&o.getValueAt(r,g)&&(k=!1),k||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:p,top:u,width:w,height:y,parent:i,cellSelected:M,lastRowOfModel:a,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:p,cellTop:u,cellWidth:w,cellHeight:y,parent:i})}}if(b=b+C,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(b-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:d,parent:a,lastRowOfModel:h}){var me;const m=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),b={left:r,width:n,height:l,top:d,index:i},f=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&L(f)){const v=f;(me=v.children)!=null&&me.length?v.expanded?g="expanded":g="collapsed":g="hidden"}let C;if(t==="header"){const v=this.tableModel.getColumnDef(i);(!(v!=null&&v.sortIconVisible)||v!=null&&v.sortIconVisible())&&(C=v==null?void 0:v.sortState)}const y=e.getValueAt(s,i),R=m?"":`${y}`,x=e.isRowChecked(s),w=this.dom.addColumnDiv({parent:a,geo:b,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:R,treeArrow:g,tableOptions:this.tableOptions,checkedType:x,sortState:C}),k=e.getTooltipAt(s,i);k&&this.dom.setAttribute(w,"title",k);const M=this.tableModel.getColumnDef(i);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],w);let I;m&&(I=m.render(w,s,i,t,e,y,this.dom.domService));const W=e.getCustomClassesAt(s,i);if(W.length&&this.dom.addClasses(W,w),this.dom.addColumnBorderDivs(this.tableOptions,a,b,t,o),h&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:d+l},a),this.getFocusModel&&t==="body"){const v=this.getFocusModel();v!=null&&v.hasFocus(s,i)&&this.dom.addFocusBorderDivs(a,b,{})}t==="header"&&this.dom.setAttribute(w,"data-ge-action","drag-column");const q=e.getCustomStyleAt(s,i);if(q)for(const v in q)this.dom.setStyle(w,v,q[v]);return[w,I]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const a={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,a),o&&this.renderContentOfDraggingColumn(a)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let d=0;d<r;d++){const a=o,h=i.getRowHeight(d),u={left:0,width:e.width,height:h,top:a,index:d},m=i.getValueAt(d,n),b=i.getCellRenderer(d,n),f=b?"":`${m}`,g={parent:l,geo:u,rowIndex:d,columnIndex:n,areaIdent:t,sideIdent:s,text:f},p=this.dom.addColumnDiv(g);let C;b&&(C=b.render(p,d,n,t,i,m,this.dom.domService),C&&this.cleanupFunctions[t].push(C));const y=i.getCustomClassesAt(d,n);y.length&&this.dom.addClasses(y,p);const R=this.tableModel.getColumnDef(n);R&&R.classes[t]&&this.dom.addClasses(R.classes[t],p),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,s);const x=i.getCustomStyleAt(d,n);if(x)for(const w in x)this.dom.setStyle(p,w,x[w]);o=o+h}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,d,a,h){let u=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const b=m.getSelectionCount(i,r);u=b>0;for(let f=0;f<b;f++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${d}px`),this.dom.setStyle(g,"width",`${a}px`),this.dom.setStyle(g,"height",`${h}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:d,parent:a,cellSelected:h,lastRowOfModel:u}){const[m,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:d,top:n,parent:a,lastRowOfModel:u});h&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,m),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,d=this.tableOptions.columnResizeHandleWidthInPx??2,a=l.createElement("div");l.setAttribute(a,"data-col-index",`${t}`),l.setAttribute(a,"data-row-index",`${e}`),l.setAttribute(a,"data-area","header"),l.setAttribute(a,"data-ge-action","resize-column"),l.addClass(a,"ge-table-column-resize-handle"),l.setStyle(a,"display","clip"),l.setStyle(a,"position","absolute"),l.setStyle(a,"cursor","col-resize"),l.setStyle(a,"left",`${o+i-d}px`),l.setStyle(a,"top",`${s}px`),l.setStyle(a,"width",`${d}px`),l.setStyle(a,"height",`${r}px`),l.appendChild(n,a)}}class ke{constructor(e,t){this.columnIndex=e,this.sortState=t}}class De{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=X(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class _e{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class K{constructor(e){this.cells=e}static createSingle(e,t){return new K([new _e(e,t)])}}class Oe{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,l,d,a,h;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),m=this.getFocusModel();u&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(d=e.originalEvent)!=null&&d.metaKey)?(u.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(a=e.originalEvent)!=null&&a.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(u.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class $e{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 Fe{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 Pe{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 Fe().get()):Object.assign(this.shortcutActionIdMapping,new $e().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const o in this.shortcutActionIdMapping){const s=o.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,s))return this.shortcutActionIdMapping[o]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class J{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class Le{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class He{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
9
9
  <input
10
10
  type="text"
11
11
  value="${l}"
package/index.js CHANGED
@@ -516,6 +516,17 @@ class Ae {
516
516
  repaint() {
517
517
  this.tableScope.repaint();
518
518
  }
519
+ /**
520
+ * Repaints the table scope with hard repaint.
521
+ * Repaints the UI by resetting the size of the wrapper div,
522
+ * adjusting the containers and rows, and performing additional adjustments
523
+ * after scrolling.
524
+ *
525
+ * @return {void}
526
+ */
527
+ repaintHard() {
528
+ this.tableScope.repaintHard();
529
+ }
519
530
  /**
520
531
  * Clears the current selection of the table.
521
532
  * The table will be rendered automatically.
@@ -566,6 +577,23 @@ class Ae {
566
577
  this.tableScope.focusModel()
567
578
  );
568
579
  }
580
+ /**
581
+ * Retrieves the current scope of the table.
582
+ *
583
+ * @returns {TableScope} The current scope of the table.
584
+ */
585
+ getTableScope() {
586
+ return this.tableScope;
587
+ }
588
+ /**
589
+ * Retrieves the selection model of the table.
590
+ *
591
+ * @return {SelectionModelIf | undefined} The selection model of the table,
592
+ * or undefined if no selection model is available.
593
+ */
594
+ getSelectionModel() {
595
+ return this.tableScope.selectionModel();
596
+ }
569
597
  }
570
598
  class q {
571
599
  constructor(e) {
@@ -804,6 +832,11 @@ class Te {
804
832
  o.createDivWithClass("ge-table-footer-border", i)
805
833
  );
806
834
  }
835
+ /**
836
+ * Adjusts the containers and rows of the table based on the current state.
837
+ *
838
+ * @return {void}
839
+ */
807
840
  adjustContainersAndRows() {
808
841
  const e = this.tableModel.getPadding(), t = this.hostElement.clientWidth, o = this.hostElement.clientHeight;
809
842
  this.dom.applyStyle(this.scrollViewport, {
@@ -876,8 +909,21 @@ class Te {
876
909
  })
877
910
  ) : this.dom.applyDisplayNoneStyle(this.borderFooterTop), this.adjustAfterScrolling();
878
911
  }
912
+ /**
913
+ * Adjusts the position or appearance of elements after scrolling.
914
+ * This method must be overwritten in child classes.
915
+ *
916
+ * @return {void}
917
+ */
879
918
  adjustAfterScrolling() {
880
919
  }
920
+ /**
921
+ * Resets the size of the wrapper div based on the content dimensions.
922
+ *
923
+ * @protected
924
+ *
925
+ * @returns {void} Returns nothing.
926
+ */
881
927
  resetSizeOfWrapperDiv() {
882
928
  const e = `${this.tableModel.getContentWidthInPixel()}px`, t = `${this.tableModel.getContentHeightInPixel() + 1}px`;
883
929
  this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
@@ -973,6 +1019,14 @@ class _e extends Te {
973
1019
  isEditing() {
974
1020
  return this.editing;
975
1021
  }
1022
+ /**
1023
+ * Resets the editor renderer by clearing its values and state.
1024
+ *
1025
+ * @function resetEditorRenderer
1026
+ * @memberof ClassName
1027
+ *
1028
+ * @returns {void}
1029
+ */
976
1030
  resetEditorRenderer() {
977
1031
  this.editorRenderer = void 0, this.editorRendererRow = -1, this.editorRendererColumn = -1, this.editing = !1;
978
1032
  }
@@ -989,6 +1043,12 @@ class _e extends Te {
989
1043
  t == null || t.clear(), e && this.repaint();
990
1044
  }
991
1045
  }
1046
+ /**
1047
+ * Initializes and renders the editor for a specified row and column index.
1048
+ *
1049
+ * @param {number} rowIdx - The index of the row.
1050
+ * @param {number} colIdx - The index of the column.
1051
+ */
992
1052
  initRenderEditor(e, t) {
993
1053
  var s;
994
1054
  let o = (s = this.tableModel.getColumnDef(t)) == null ? void 0 : s.getEditRenderer;
@@ -1000,9 +1060,28 @@ class _e extends Te {
1000
1060
  } else
1001
1061
  this.resetEditorRenderer();
1002
1062
  }
1063
+ /**
1064
+ * Adjusts the content after scrolling and initiates a repaint of the component.
1065
+ *
1066
+ * @return {void}
1067
+ */
1003
1068
  repaint() {
1004
1069
  this.adjustAfterScrolling();
1005
1070
  }
1071
+ /**
1072
+ * Repaints the UI by resetting the size of the wrapper div,
1073
+ * adjusting the containers and rows, and performing additional adjustments
1074
+ * after scrolling.
1075
+ *
1076
+ * @return {void} This method does not return any value.
1077
+ */
1078
+ repaintHard() {
1079
+ this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.adjustAfterScrolling();
1080
+ }
1081
+ /**
1082
+ * Adjusts the table after scrolling. This method performs various adjustments
1083
+ * to the table's appearance and behavior after a scroll event occurs.
1084
+ */
1006
1085
  adjustAfterScrolling() {
1007
1086
  var e;
1008
1087
  for (const t of this.removables)
@@ -1025,10 +1104,23 @@ class _e extends Te {
1025
1104
  "ge-table-body-west-vertical-border"
1026
1105
  ));
1027
1106
  }
1107
+ /**
1108
+ * Checks if the scroll position should be saved and saves it.
1109
+ *
1110
+ * @return {void}
1111
+ */
1028
1112
  checkForScrollPosSaving() {
1029
1113
  var e, t;
1030
1114
  this.storeScrollPosStateService && ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreScrollPosition) && this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
1031
1115
  }
1116
+ /**
1117
+ * Updates the cells in the table with the provided values and optionally repaints all cells.
1118
+ *
1119
+ * @param {TableCellUpdateEventIf[]} events - The array of events containing information about the cells to update.
1120
+ * @param {boolean} repaintAll - Optional. If true, repaints all cells after updating. Defaults to false.
1121
+ *
1122
+ * @returns {void}
1123
+ */
1032
1124
  updateCells(e, t = !1) {
1033
1125
  e.forEach(
1034
1126
  (o) => {
@@ -1036,6 +1128,15 @@ class _e extends Te {
1036
1128
  }
1037
1129
  ), t && this.repaint();
1038
1130
  }
1131
+ /**
1132
+ * Rerenders the content of a table cell based on the given parameters.
1133
+ *
1134
+ * @param {TableCellUpdateEventIf} area - The area of the table.
1135
+ * @param {number} rowIndex - The index of the row.
1136
+ * @param {number} columnIndex - The index of the column.
1137
+ * @param {any} value - The new value to be displayed in the cell.
1138
+ * @param {string[]} cssClasses - An array of CSS classes to be applied to the cell.
1139
+ */
1039
1140
  rerenderCellContent({ area: e, rowIndex: t, columnIndex: o, value: s, cssClasses: i }) {
1040
1141
  const r = this.tableModel.getAreaModel(e), n = 'div[data-col-index="' + o + '"][data-row-index="' + t + '"][data-area="' + e + '"]', l = document.querySelector(n);
1041
1142
  if (l) {
@@ -1055,6 +1156,13 @@ class _e extends Te {
1055
1156
  this.dom.setStyle(l, b, m[b]);
1056
1157
  }
1057
1158
  }
1159
+ /**
1160
+ * Stores the widths of all columns in the table.
1161
+ *
1162
+ * @protected
1163
+ * @function storeColumnWidths
1164
+ * @returns {void}
1165
+ */
1058
1166
  storeColumnWidths() {
1059
1167
  const e = this.tableModel.getColumnDefs();
1060
1168
  e != null && e.length && (this.storedColumnWidths = e.map((t, o) => this.tableModel.getColumnWidth(o)));
@@ -1067,6 +1175,15 @@ class _e extends Te {
1067
1175
  }
1068
1176
  return [void 0, void 0];
1069
1177
  }
1178
+ /**
1179
+ * Retrieves the specified area from the grid layout.
1180
+ *
1181
+ * @param {string} areaIdent - The identifier for the area ('header', 'body', or 'footer').
1182
+ * @param {string} sideIdent - The identifier for the side of the area ('west', 'center', or 'east').
1183
+ * @protected
1184
+ * @returns {HTMLElement} - The requested area element.
1185
+ * @throws {Error} - If the area identifier or side identifier is incorrect.
1186
+ */
1070
1187
  getArea(e, t) {
1071
1188
  if (e === "header") {
1072
1189
  if (t === "west")
@@ -1092,10 +1209,24 @@ class _e extends Te {
1092
1209
  }
1093
1210
  throw Error(`Wrong area identifier: row:${e}, col:${t}`);
1094
1211
  }
1212
+ /**
1213
+ * Adjusts the body of the table.
1214
+ *
1215
+ * @protected
1216
+ * @return {void}
1217
+ */
1095
1218
  adjustBody() {
1096
1219
  const e = this.areaBodyCenterGeo.height - this.tableModel.getContentHeightInPixel(), t = this.scrollFactorY * e;
1097
1220
  this.dom.setStyle(this.contentDiv, "top", `${this.scrollTop}px`), this.dom.setStyle(this.contentDiv, "left", `${this.scrollViewport.scrollLeft}px`), this.adjustArea("body", t);
1098
1221
  }
1222
+ /**
1223
+ * Returns a number value extracted from the specified attribute of the source element.
1224
+ *
1225
+ * @param {HTMLElement} srcElement - The source element from which to extract the attribute value.
1226
+ * @param {string} key - The attribute key to extract the value from.
1227
+ * @returns {number} - The extracted number value, or -1 if the attribute was not found or not a valid number.
1228
+ * @protected
1229
+ */
1099
1230
  getNumberByAttr(e, t) {
1100
1231
  var o;
1101
1232
  if (e) {
@@ -1105,6 +1236,14 @@ class _e extends Te {
1105
1236
  }
1106
1237
  return -1;
1107
1238
  }
1239
+ /**
1240
+ * Retrieves the value of the specified attribute from the nearest ancestor element that has the attribute.
1241
+ *
1242
+ * @param {HTMLElement} srcElement - The source element from which to start searching for the nearest ancestor element.
1243
+ * @param {string} key - The name of the attribute to retrieve.
1244
+ * @returns {string} The value of the specified attribute, or an empty string if the attribute is not found.
1245
+ * @protected
1246
+ */
1108
1247
  getStringByAttr(e, t) {
1109
1248
  var o;
1110
1249
  if (e) {
@@ -1114,6 +1253,14 @@ class _e extends Te {
1114
1253
  }
1115
1254
  return "";
1116
1255
  }
1256
+ /**
1257
+ * Adjusts the layout and positioning of the specified area in the table.
1258
+ * This method is used internally and should not be called directly.
1259
+ *
1260
+ * @param {AreaIdent} areaIdent - The identifier of the area to adjust (e.g. header, body, footer).
1261
+ * @param {number} [yStart=0] - The starting y-position for the layout adjustments.
1262
+ * @protected
1263
+ */
1117
1264
  adjustArea(e, t = 0) {
1118
1265
  var g;
1119
1266
  const o = this.getArea(e, "west"), s = this.getArea(e, "center"), i = this.getArea(e, "east"), r = s.child.clientHeight;
@@ -1254,6 +1401,15 @@ class _e extends Te {
1254
1401
  parent: i
1255
1402
  });
1256
1403
  }
1404
+ /**
1405
+ * Finds the row index of an important rowspan cell in a given area model.
1406
+ *
1407
+ * @param {AreaModelIf} areaModel - The area model to search in.
1408
+ * @param {number} rowIndex - The current row index.
1409
+ * @param {number} colIndex - The current column index.
1410
+ * @returns {number} - The row index of the important rowspan cell, or -1 if not found.
1411
+ * @protected
1412
+ */
1257
1413
  findRowOfImportantRowspanCell(e, t, o) {
1258
1414
  const s = e.getMaxRowspan();
1259
1415
  for (let i = t - 1; i > -1; i--) {
@@ -1265,6 +1421,13 @@ class _e extends Te {
1265
1421
  }
1266
1422
  return -1;
1267
1423
  }
1424
+ /**
1425
+ * Adjusts the columns to fit the width of the row's parent element.
1426
+ *
1427
+ * @param {ArgsAdjustColumnsToRowParentParams} params - The parameters for adjusting the columns.
1428
+ * @protected
1429
+ * @return {void}
1430
+ */
1268
1431
  adjustColumnsToRowParent({
1269
1432
  areaIdent: e,
1270
1433
  sideIdent: t,
@@ -1331,6 +1494,15 @@ class _e extends Te {
1331
1494
  }
1332
1495
  this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new $(b - 1, 1, s.height, 0), i);
1333
1496
  }
1497
+ /**
1498
+ * Retrieves the column index of the tree arrow column in the table.
1499
+ *
1500
+ * @protected
1501
+ *
1502
+ * @returns {0 | 1} The column index of the tree arrow column.
1503
+ * Returns 0 if the checkbox is not visible,
1504
+ * otherwise returns 1.
1505
+ */
1334
1506
  getTreeArrowColumnIndex() {
1335
1507
  return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
1336
1508
  }
@@ -1391,23 +1563,53 @@ class _e extends Te {
1391
1563
  this.dom.setStyle(S, v, G[v]);
1392
1564
  return [S, E];
1393
1565
  }
1566
+ /**
1567
+ * Applies CSS classes to an HTML element.
1568
+ *
1569
+ * @param {HTMLDivElement} ele - The HTML element to which CSS classes will be applied.
1570
+ * @param {Object.<string, boolean>} cssClasses - An object containing CSS class names as keys and boolean values indicating whether to apply or remove the class.
1571
+ * @protected
1572
+ */
1394
1573
  applyCssClasses(e, t = {}) {
1395
1574
  e && Object.entries(t).forEach(([o, s]) => {
1396
1575
  s ? this.dom.addClass(o, e) : this.dom.removeClass(o, e);
1397
1576
  });
1398
1577
  }
1578
+ /**
1579
+ * Retrieves the column widths of a table within a specified range.
1580
+ *
1581
+ * @param {number} startIndex - The index of the first column to retrieve the width of.
1582
+ * @param {number} endIndex - The index of the last column to retrieve the width of.
1583
+ *
1584
+ * @return {number[]} An array containing the widths of the columns within the specified range.
1585
+ */
1399
1586
  getColumnWidths(e, t) {
1400
1587
  const o = [];
1401
1588
  for (let s = e; s <= t; s++)
1402
1589
  o.push(this.tableModel.getColumnWidth(s));
1403
1590
  return o;
1404
1591
  }
1592
+ /**
1593
+ * Retrieves the heights of rows within a specified range.
1594
+ *
1595
+ * @param {number} startIndex - The index of the first row in the range.
1596
+ * @param {number} endIndex - The index of the last row in the range.
1597
+ * @param {AreaModelIf} areaModel - The area model.
1598
+ * @return {number[]} - An array containing the heights of the rows within the specified range.
1599
+ */
1405
1600
  getRowHeights(e, t, o) {
1406
1601
  const s = [];
1407
1602
  for (let i = e; i <= t; i++)
1408
1603
  s.push(o.getRowHeight(i));
1409
1604
  return s;
1410
1605
  }
1606
+ /**
1607
+ * Adjusts the position and size of the hover row based on the mouse move event.
1608
+ *
1609
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event.
1610
+ *
1611
+ * @return {void}
1612
+ */
1411
1613
  adjustHoverRows(e) {
1412
1614
  if (this.tableOptions.hoverRowVisible && e.rowIndex > -1) {
1413
1615
  const t = this.hostElement.clientWidth, o = this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex), s = e.rowTop + this.areaHeaderCenter.parent.clientHeight - this.scrollTop;
@@ -1421,11 +1623,26 @@ class _e extends Te {
1421
1623
  } else
1422
1624
  this.hideHoverRow();
1423
1625
  }
1626
+ /**
1627
+ * Hides the hover row by applying 'display: none' style to it.
1628
+ *
1629
+ * @protected
1630
+ * @function
1631
+ * @name hideHoverRow
1632
+ * @memberof ClassName
1633
+ *
1634
+ * @returns {void}
1635
+ */
1424
1636
  hideHoverRow() {
1425
1637
  this.dom.applyStyle(this.hoverRow, {
1426
1638
  display: "none"
1427
1639
  });
1428
1640
  }
1641
+ /**
1642
+ * Adjusts the position and size of the hover column based on the mouse move event.
1643
+ *
1644
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
1645
+ */
1429
1646
  adjustHoverColumns(e) {
1430
1647
  if (this.tableOptions.hoverColumnVisible && e.rowIndex > -1) {
1431
1648
  const t = this.hostElement.clientHeight, o = this.tableModel.getColumnWidth(e.columnIndex), s = this.areaBodyWestGeo.width, i = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - s;
@@ -1439,6 +1656,15 @@ class _e extends Te {
1439
1656
  } else
1440
1657
  this.hideHoverColumn();
1441
1658
  }
1659
+ /**
1660
+ * Hide hover column.
1661
+ *
1662
+ * This method hides the hover column by applying a style of 'display: none'
1663
+ * to the element representing the hover column.
1664
+ *
1665
+ * @protected
1666
+ * @memberof ClassName
1667
+ */
1442
1668
  hideHoverColumn() {
1443
1669
  this.dom.applyStyle(this.hoverColumn, {
1444
1670
  display: "none"
@@ -1455,6 +1681,13 @@ class _e extends Te {
1455
1681
  debounce(e, t = 1e3) {
1456
1682
  this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e.bind(this), t);
1457
1683
  }
1684
+ /**
1685
+ * Adjusts the dragging column during a mouse move event.
1686
+ *
1687
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event.
1688
+ * @param {number} sourceColumnIndex - The index of the source column.
1689
+ * @param {boolean} firstDraggingRendering - Indicates if it's the first rendering of the dragging column.
1690
+ */
1458
1691
  adjustDraggingColumn(e, t, o) {
1459
1692
  var s, i;
1460
1693
  if (this.dragging) {
@@ -1470,10 +1703,25 @@ class _e extends Te {
1470
1703
  } else
1471
1704
  this.hideDraggingColumn();
1472
1705
  }
1706
+ /**
1707
+ * Renders the content of a dragging column.
1708
+ *
1709
+ * @param {GeoData} columnGeo - The geographic data of the column.
1710
+ *
1711
+ * @returns {number} The y-coordinate of the rendered content.
1712
+ */
1473
1713
  renderContentOfDraggingColumn(e) {
1474
1714
  const t = this.renderContentOfDraggingColumnForArea(e, "header", 0);
1475
1715
  this.renderContentOfDraggingColumnForArea(e, "body", t);
1476
1716
  }
1717
+ /**
1718
+ * Renders the content of the dragging column for a specific area.
1719
+ *
1720
+ * @param {GeoData} columnGeo - The geometry data of the dragging column.
1721
+ * @param {AreaIdent} areaIdent - The identifier of the area.
1722
+ * @param {number} [y=0] - The starting y-position.
1723
+ * @return {number} The final y-position after rendering all the content.
1724
+ */
1477
1725
  renderContentOfDraggingColumnForArea(e, t, o = 0) {
1478
1726
  const s = "center", i = this.tableModel.getAreaModel(t), r = i == null ? void 0 : i.getRowCount();
1479
1727
  if (r) {
@@ -1503,17 +1751,50 @@ class _e extends Te {
1503
1751
  }
1504
1752
  return o;
1505
1753
  }
1754
+ /**
1755
+ * Hides the dragging column by applying a 'display: none' style to it.
1756
+ * This method is protected and can only be accessed within the class.
1757
+ *
1758
+ * @return {void}
1759
+ */
1506
1760
  hideDraggingColumn() {
1507
1761
  this.dom.applyStyle(this.draggingColumn, {
1508
1762
  display: "none"
1509
1763
  });
1510
1764
  }
1765
+ /**
1766
+ * Renders a draggable target div element.
1767
+ *
1768
+ * @param {HTMLDivElement} parent - The parent element where the target div will be appended to.
1769
+ * @param {number} left - The left position of the target div in pixels.
1770
+ * @param {number} top - The top position of the target div in pixels.
1771
+ * @param {number} width - The width of the target div in pixels.
1772
+ * @param {number} height - The height of the target div in pixels.
1773
+ * @return {HTMLDivElement} - The rendered draggable target div element.
1774
+ */
1511
1775
  renderDragTargetDiv(e, t, o, s, i) {
1512
1776
  const r = this.dom.applyStylePosistionAbsolute(
1513
1777
  this.dom.createDivWithClass("ge-table-drop-zone", e)
1514
1778
  );
1515
1779
  return this.dom.setStyle(r, "left", `${t}px`), this.dom.setStyle(r, "top", `${o}px`), this.dom.setStyle(r, "width", `${s}px`), this.dom.setStyle(r, "height", `${i}px`), r;
1516
1780
  }
1781
+ /**
1782
+ * Render selected background div.
1783
+ *
1784
+ * @private
1785
+ * @param {boolean} skip - Whether to skip rendering.
1786
+ * @param {boolean} renderSelection - Whether to render the selection.
1787
+ * @param {SideIdent} sideIdent - The side identifier.
1788
+ * @param {AreaModelIf} areaModel - The area model.
1789
+ * @param {number} rowIndex - The row index.
1790
+ * @param {number} index - The index.
1791
+ * @param {HTMLDivElement} parent - The parent div element.
1792
+ * @param {number} left - The left position.
1793
+ * @param {number} top - The top position.
1794
+ * @param {number} width - The width of the div.
1795
+ * @param {number} height - The height of the div.
1796
+ * @returns {boolean} - Whether the cell is selected.
1797
+ */
1517
1798
  renderSelectedBackgroundDiv(e, t, o, s, i, r, n, l, d, a, h) {
1518
1799
  let u = !1;
1519
1800
  if (!e && t && s.isSelectable(i, r) && this.getSelectionModel) {
@@ -1532,6 +1813,25 @@ class _e extends Te {
1532
1813
  }
1533
1814
  return u;
1534
1815
  }
1816
+ /**
1817
+ * Renders a cell in the grid.
1818
+ *
1819
+ * @param {ArgsRenderCell} args - The arguments for rendering the cell.
1820
+ * @param {AreaModel} args.areaModel - The area model of the grid.
1821
+ * @param {string} args.areaIdent - The identifier of the area.
1822
+ * @param {string} args.sideIdent - The identifier of the side.
1823
+ * @param {number} args.rowIndex - The index of the row.
1824
+ * @param {number} args.columnIndex - The index of the column.
1825
+ * @param {number} args.left - The left position of the cell.
1826
+ * @param {number} args.top - The top position of the cell.
1827
+ * @param {number} args.width - The width of the cell.
1828
+ * @param {number} args.height - The height of the cell.
1829
+ * @param {HTMLElement} args.parent - The parent element of the cell.
1830
+ * @param {boolean} args.cellSelected - Indicates if the cell is selected.
1831
+ * @param {boolean} args.lastRowOfModel - Indicates if the cell is in the last row of the model.
1832
+ *
1833
+ * @returns {void}
1834
+ */
1535
1835
  renderCell({
1536
1836
  areaModel: e,
1537
1837
  areaIdent: t,
@@ -1561,6 +1861,20 @@ class _e extends Te {
1561
1861
  });
1562
1862
  h && this.dom.addClass(`ge-table-${t}-${o}-selected-range`, m), b && this.cleanupFunctions[t].push(b);
1563
1863
  }
1864
+ /**
1865
+ * Render the header cell resize handle.
1866
+ *
1867
+ * @param {ArgsRenderHeaderCellResizeHandle} args - The arguments for rendering the handle.
1868
+ * @param {number} args.rowIndex - The index of the row.
1869
+ * @param {number} args.columnIndex - The index of the column.
1870
+ * @param {number} args.cellLeft - The left position of the cell.
1871
+ * @param {number} args.cellTop - The top position of the cell.
1872
+ * @param {number} args.cellWidth - The width of the cell.
1873
+ * @param {number} args.cellHeight - The height of the cell.
1874
+ * @param {HTMLElement} args.parent - The parent element to append the handle to.
1875
+ *
1876
+ * @return {void}
1877
+ */
1564
1878
  renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: o, cellTop: s, cellWidth: i, cellHeight: r, parent: n }) {
1565
1879
  const l = this.dom.domService, d = this.tableOptions.columnResizeHandleWidthInPx ?? 2, a = l.createElement("div");
1566
1880
  l.setAttribute(a, "data-col-index", `${t}`), l.setAttribute(a, "data-row-index", `${e}`), l.setAttribute(a, "data-area", "header"), l.setAttribute(a, "data-ge-action", "resize-column"), l.addClass(a, "ge-table-column-resize-handle"), l.setStyle(a, "display", "clip"), l.setStyle(a, "position", "absolute"), l.setStyle(a, "cursor", "col-resize"), l.setStyle(a, "left", `${o + i - d}px`), l.setStyle(a, "top", `${s}px`), l.setStyle(a, "width", `${d}px`), l.setStyle(a, "height", `${r}px`), l.appendChild(n, a);
@@ -36,7 +36,25 @@ export declare class EleScope {
36
36
  protected areaBodyCenterGeo: GeoData;
37
37
  protected areaBodyEastGeo: GeoData;
38
38
  constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, dom: ConvenienceDomService, tableOptions: TableOptionsIf);
39
+ /**
40
+ * Adjusts the containers and rows of the table based on the current state.
41
+ *
42
+ * @return {void}
43
+ */
39
44
  adjustContainersAndRows(): void;
45
+ /**
46
+ * Adjusts the position or appearance of elements after scrolling.
47
+ * This method must be overwritten in child classes.
48
+ *
49
+ * @return {void}
50
+ */
40
51
  adjustAfterScrolling(): void;
52
+ /**
53
+ * Resets the size of the wrapper div based on the content dimensions.
54
+ *
55
+ * @protected
56
+ *
57
+ * @returns {void} Returns nothing.
58
+ */
41
59
  protected resetSizeOfWrapperDiv(): void;
42
60
  }
@@ -47,6 +47,14 @@ export declare class RenderScope extends EleScope {
47
47
  private removables;
48
48
  constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, dom: ConvenienceDomService, tableOptions: TableOptionsIf);
49
49
  isEditing(): boolean;
50
+ /**
51
+ * Resets the editor renderer by clearing its values and state.
52
+ *
53
+ * @function resetEditorRenderer
54
+ * @memberof ClassName
55
+ *
56
+ * @returns {void}
57
+ */
50
58
  resetEditorRenderer(): void;
51
59
  /**
52
60
  * Clears the selection in the component.
@@ -56,18 +64,109 @@ export declare class RenderScope extends EleScope {
56
64
  * @return {void}
57
65
  */
58
66
  clearSelection(rerender?: boolean): void;
67
+ /**
68
+ * Initializes and renders the editor for a specified row and column index.
69
+ *
70
+ * @param {number} rowIdx - The index of the row.
71
+ * @param {number} colIdx - The index of the column.
72
+ */
59
73
  initRenderEditor(rowIdx: number, colIdx: number): void;
74
+ /**
75
+ * Adjusts the content after scrolling and initiates a repaint of the component.
76
+ *
77
+ * @return {void}
78
+ */
60
79
  repaint(): void;
80
+ /**
81
+ * Repaints the UI by resetting the size of the wrapper div,
82
+ * adjusting the containers and rows, and performing additional adjustments
83
+ * after scrolling.
84
+ *
85
+ * @return {void} This method does not return any value.
86
+ */
87
+ repaintHard(): void;
88
+ /**
89
+ * Adjusts the table after scrolling. This method performs various adjustments
90
+ * to the table's appearance and behavior after a scroll event occurs.
91
+ */
61
92
  adjustAfterScrolling(): void;
93
+ /**
94
+ * Checks if the scroll position should be saved and saves it.
95
+ *
96
+ * @return {void}
97
+ */
62
98
  checkForScrollPosSaving(): void;
99
+ /**
100
+ * Updates the cells in the table with the provided values and optionally repaints all cells.
101
+ *
102
+ * @param {TableCellUpdateEventIf[]} events - The array of events containing information about the cells to update.
103
+ * @param {boolean} repaintAll - Optional. If true, repaints all cells after updating. Defaults to false.
104
+ *
105
+ * @returns {void}
106
+ */
63
107
  updateCells(events: TableCellUpdateEventIf[], repaintAll?: boolean): void;
108
+ /**
109
+ * Rerenders the content of a table cell based on the given parameters.
110
+ *
111
+ * @param {TableCellUpdateEventIf} area - The area of the table.
112
+ * @param {number} rowIndex - The index of the row.
113
+ * @param {number} columnIndex - The index of the column.
114
+ * @param {any} value - The new value to be displayed in the cell.
115
+ * @param {string[]} cssClasses - An array of CSS classes to be applied to the cell.
116
+ */
64
117
  rerenderCellContent({ area, rowIndex, columnIndex, value, cssClasses }: TableCellUpdateEventIf): void;
118
+ /**
119
+ * Stores the widths of all columns in the table.
120
+ *
121
+ * @protected
122
+ * @function storeColumnWidths
123
+ * @returns {void}
124
+ */
65
125
  protected storeColumnWidths(): void;
66
126
  protected getAreaAndSideIdentByAttr(srcElement: HTMLElement): [AreaIdent | undefined, SideIdent | undefined];
127
+ /**
128
+ * Retrieves the specified area from the grid layout.
129
+ *
130
+ * @param {string} areaIdent - The identifier for the area ('header', 'body', or 'footer').
131
+ * @param {string} sideIdent - The identifier for the side of the area ('west', 'center', or 'east').
132
+ * @protected
133
+ * @returns {HTMLElement} - The requested area element.
134
+ * @throws {Error} - If the area identifier or side identifier is incorrect.
135
+ */
67
136
  protected getArea(areaIdent: AreaIdent, sideIdent: SideIdent): DivScope;
137
+ /**
138
+ * Adjusts the body of the table.
139
+ *
140
+ * @protected
141
+ * @return {void}
142
+ */
68
143
  protected adjustBody(): void;
144
+ /**
145
+ * Returns a number value extracted from the specified attribute of the source element.
146
+ *
147
+ * @param {HTMLElement} srcElement - The source element from which to extract the attribute value.
148
+ * @param {string} key - The attribute key to extract the value from.
149
+ * @returns {number} - The extracted number value, or -1 if the attribute was not found or not a valid number.
150
+ * @protected
151
+ */
69
152
  protected getNumberByAttr(srcElement: HTMLElement, key: string): number;
153
+ /**
154
+ * Retrieves the value of the specified attribute from the nearest ancestor element that has the attribute.
155
+ *
156
+ * @param {HTMLElement} srcElement - The source element from which to start searching for the nearest ancestor element.
157
+ * @param {string} key - The name of the attribute to retrieve.
158
+ * @returns {string} The value of the specified attribute, or an empty string if the attribute is not found.
159
+ * @protected
160
+ */
70
161
  protected getStringByAttr(srcElement: HTMLElement, key: string): string;
162
+ /**
163
+ * Adjusts the layout and positioning of the specified area in the table.
164
+ * This method is used internally and should not be called directly.
165
+ *
166
+ * @param {AreaIdent} areaIdent - The identifier of the area to adjust (e.g. header, body, footer).
167
+ * @param {number} [yStart=0] - The starting y-position for the layout adjustments.
168
+ * @protected
169
+ */
71
170
  protected adjustArea(areaIdent: AreaIdent, yStart?: number): void;
72
171
  /**
73
172
  * Draws big cells (rowspan and or colspan) in body/center
@@ -80,18 +179,97 @@ export declare class RenderScope extends EleScope {
80
179
  * @protected
81
180
  */
82
181
  protected drawBigCell(range: CellRange, xStart: number, yStart: number, areaModel: AreaModelIf, parentDiv: HTMLDivElement, sideIdent: SideIdent): void;
182
+ /**
183
+ * Finds the row index of an important rowspan cell in a given area model.
184
+ *
185
+ * @param {AreaModelIf} areaModel - The area model to search in.
186
+ * @param {number} rowIndex - The current row index.
187
+ * @param {number} colIndex - The current column index.
188
+ * @returns {number} - The row index of the important rowspan cell, or -1 if not found.
189
+ * @protected
190
+ */
83
191
  protected findRowOfImportantRowspanCell(areaModel: AreaModelIf, rowIndex: number, colIndex: number): number;
192
+ /**
193
+ * Adjusts the columns to fit the width of the row's parent element.
194
+ *
195
+ * @param {ArgsAdjustColumnsToRowParentParams} params - The parameters for adjusting the columns.
196
+ * @protected
197
+ * @return {void}
198
+ */
84
199
  protected adjustColumnsToRowParent({ areaIdent, sideIdent, areaModel, geo, parent, rowIndex, columnIndexStart, columnIndexEnd, verticalFixed, lastRowOfModel }: ArgsAdjustColumnsToRowParentParams): void;
200
+ /**
201
+ * Retrieves the column index of the tree arrow column in the table.
202
+ *
203
+ * @protected
204
+ *
205
+ * @returns {0 | 1} The column index of the tree arrow column.
206
+ * Returns 0 if the checkbox is not visible,
207
+ * otherwise returns 1.
208
+ */
85
209
  protected getTreeArrowColumnIndex(): 0 | 1;
86
210
  protected addAndRenderCellDiv({ areaModel, areaIdent, sideIdent, rowIndex, index, left, width, height, top, parent, lastRowOfModel }: ArgsRenderCellDiv): [HTMLDivElement, RendererCleanupFnType | undefined];
211
+ /**
212
+ * Applies CSS classes to an HTML element.
213
+ *
214
+ * @param {HTMLDivElement} ele - The HTML element to which CSS classes will be applied.
215
+ * @param {Object.<string, boolean>} cssClasses - An object containing CSS class names as keys and boolean values indicating whether to apply or remove the class.
216
+ * @protected
217
+ */
87
218
  protected applyCssClasses(ele: HTMLDivElement, cssClasses?: {
88
219
  [key: string]: boolean;
89
220
  }): void;
221
+ /**
222
+ * Retrieves the column widths of a table within a specified range.
223
+ *
224
+ * @param {number} startIndex - The index of the first column to retrieve the width of.
225
+ * @param {number} endIndex - The index of the last column to retrieve the width of.
226
+ *
227
+ * @return {number[]} An array containing the widths of the columns within the specified range.
228
+ */
90
229
  protected getColumnWidths(startIndex: number, endIndex: number): number[];
230
+ /**
231
+ * Retrieves the heights of rows within a specified range.
232
+ *
233
+ * @param {number} startIndex - The index of the first row in the range.
234
+ * @param {number} endIndex - The index of the last row in the range.
235
+ * @param {AreaModelIf} areaModel - The area model.
236
+ * @return {number[]} - An array containing the heights of the rows within the specified range.
237
+ */
91
238
  protected getRowHeights(startIndex: number, endIndex: number, areaModel: AreaModelIf): number[];
239
+ /**
240
+ * Adjusts the position and size of the hover row based on the mouse move event.
241
+ *
242
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event.
243
+ *
244
+ * @return {void}
245
+ */
92
246
  protected adjustHoverRows(mouseMoveEvent: GeMouseEvent): void;
247
+ /**
248
+ * Hides the hover row by applying 'display: none' style to it.
249
+ *
250
+ * @protected
251
+ * @function
252
+ * @name hideHoverRow
253
+ * @memberof ClassName
254
+ *
255
+ * @returns {void}
256
+ */
93
257
  protected hideHoverRow(): void;
258
+ /**
259
+ * Adjusts the position and size of the hover column based on the mouse move event.
260
+ *
261
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
262
+ */
94
263
  protected adjustHoverColumns(mouseMoveEvent: GeMouseEvent): void;
264
+ /**
265
+ * Hide hover column.
266
+ *
267
+ * This method hides the hover column by applying a style of 'display: none'
268
+ * to the element representing the hover column.
269
+ *
270
+ * @protected
271
+ * @memberof ClassName
272
+ */
95
273
  protected hideHoverColumn(): void;
96
274
  /**
97
275
  * Executes a function after a specified delay, ensuring that the function is called only once within that delay period.
@@ -102,12 +280,100 @@ export declare class RenderScope extends EleScope {
102
280
  * @return {undefined}
103
281
  */
104
282
  protected debounce(fn: () => void, delay?: number): void;
283
+ /**
284
+ * Adjusts the dragging column during a mouse move event.
285
+ *
286
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event.
287
+ * @param {number} sourceColumnIndex - The index of the source column.
288
+ * @param {boolean} firstDraggingRendering - Indicates if it's the first rendering of the dragging column.
289
+ */
105
290
  protected adjustDraggingColumn(mouseMoveEvent: GeMouseEvent, sourceColumnIndex: number, firstDraggingRendering: boolean): void;
291
+ /**
292
+ * Renders the content of a dragging column.
293
+ *
294
+ * @param {GeoData} columnGeo - The geographic data of the column.
295
+ *
296
+ * @returns {number} The y-coordinate of the rendered content.
297
+ */
106
298
  protected renderContentOfDraggingColumn(columnGeo: GeoData): void;
299
+ /**
300
+ * Renders the content of the dragging column for a specific area.
301
+ *
302
+ * @param {GeoData} columnGeo - The geometry data of the dragging column.
303
+ * @param {AreaIdent} areaIdent - The identifier of the area.
304
+ * @param {number} [y=0] - The starting y-position.
305
+ * @return {number} The final y-position after rendering all the content.
306
+ */
107
307
  protected renderContentOfDraggingColumnForArea(columnGeo: GeoData, areaIdent: AreaIdent, y?: number): number;
308
+ /**
309
+ * Hides the dragging column by applying a 'display: none' style to it.
310
+ * This method is protected and can only be accessed within the class.
311
+ *
312
+ * @return {void}
313
+ */
108
314
  protected hideDraggingColumn(): void;
315
+ /**
316
+ * Renders a draggable target div element.
317
+ *
318
+ * @param {HTMLDivElement} parent - The parent element where the target div will be appended to.
319
+ * @param {number} left - The left position of the target div in pixels.
320
+ * @param {number} top - The top position of the target div in pixels.
321
+ * @param {number} width - The width of the target div in pixels.
322
+ * @param {number} height - The height of the target div in pixels.
323
+ * @return {HTMLDivElement} - The rendered draggable target div element.
324
+ */
109
325
  private renderDragTargetDiv;
326
+ /**
327
+ * Render selected background div.
328
+ *
329
+ * @private
330
+ * @param {boolean} skip - Whether to skip rendering.
331
+ * @param {boolean} renderSelection - Whether to render the selection.
332
+ * @param {SideIdent} sideIdent - The side identifier.
333
+ * @param {AreaModelIf} areaModel - The area model.
334
+ * @param {number} rowIndex - The row index.
335
+ * @param {number} index - The index.
336
+ * @param {HTMLDivElement} parent - The parent div element.
337
+ * @param {number} left - The left position.
338
+ * @param {number} top - The top position.
339
+ * @param {number} width - The width of the div.
340
+ * @param {number} height - The height of the div.
341
+ * @returns {boolean} - Whether the cell is selected.
342
+ */
110
343
  private renderSelectedBackgroundDiv;
344
+ /**
345
+ * Renders a cell in the grid.
346
+ *
347
+ * @param {ArgsRenderCell} args - The arguments for rendering the cell.
348
+ * @param {AreaModel} args.areaModel - The area model of the grid.
349
+ * @param {string} args.areaIdent - The identifier of the area.
350
+ * @param {string} args.sideIdent - The identifier of the side.
351
+ * @param {number} args.rowIndex - The index of the row.
352
+ * @param {number} args.columnIndex - The index of the column.
353
+ * @param {number} args.left - The left position of the cell.
354
+ * @param {number} args.top - The top position of the cell.
355
+ * @param {number} args.width - The width of the cell.
356
+ * @param {number} args.height - The height of the cell.
357
+ * @param {HTMLElement} args.parent - The parent element of the cell.
358
+ * @param {boolean} args.cellSelected - Indicates if the cell is selected.
359
+ * @param {boolean} args.lastRowOfModel - Indicates if the cell is in the last row of the model.
360
+ *
361
+ * @returns {void}
362
+ */
111
363
  private renderCell;
364
+ /**
365
+ * Render the header cell resize handle.
366
+ *
367
+ * @param {ArgsRenderHeaderCellResizeHandle} args - The arguments for rendering the handle.
368
+ * @param {number} args.rowIndex - The index of the row.
369
+ * @param {number} args.columnIndex - The index of the column.
370
+ * @param {number} args.cellLeft - The left position of the cell.
371
+ * @param {number} args.cellTop - The top position of the cell.
372
+ * @param {number} args.cellWidth - The width of the cell.
373
+ * @param {number} args.cellHeight - The height of the cell.
374
+ * @param {HTMLElement} args.parent - The parent element to append the handle to.
375
+ *
376
+ * @return {void}
377
+ */
112
378
  private renderHeaderCellResizeHandle;
113
379
  }
@@ -4,8 +4,9 @@ import { TableCellUpdateEventIf } from "./data/common/event/input/table-cell-upd
4
4
  import { SelectionModel } from './selection/selection-model';
5
5
  import { ActionId } from './action/action-id.type';
6
6
  import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type';
7
+ import { SelectionModelIf } from './selection/selection-model.if';
7
8
  export declare class TableApi {
8
- private readonly tableScope;
9
+ readonly tableScope: TableScope;
9
10
  constructor(tableScope: TableScope);
10
11
  /**
11
12
  * Updates the cells in the table based on the provided events.
@@ -90,6 +91,15 @@ export declare class TableApi {
90
91
  * to update and redraw the table based on the latest data.
91
92
  */
92
93
  repaint(): void;
94
+ /**
95
+ * Repaints the table scope with hard repaint.
96
+ * Repaints the UI by resetting the size of the wrapper div,
97
+ * adjusting the containers and rows, and performing additional adjustments
98
+ * after scrolling.
99
+ *
100
+ * @return {void}
101
+ */
102
+ repaintHard(): void;
93
103
  /**
94
104
  * Clears the current selection of the table.
95
105
  * The table will be rendered automatically.
@@ -126,4 +136,17 @@ export declare class TableApi {
126
136
  * @return {Promise<string>} - A promise that resolves with the copied data as a string.
127
137
  */
128
138
  copyToClipboard(): Promise<string>;
139
+ /**
140
+ * Retrieves the current scope of the table.
141
+ *
142
+ * @returns {TableScope} The current scope of the table.
143
+ */
144
+ getTableScope(): TableScope;
145
+ /**
146
+ * Retrieves the selection model of the table.
147
+ *
148
+ * @return {SelectionModelIf | undefined} The selection model of the table,
149
+ * or undefined if no selection model is available.
150
+ */
151
+ getSelectionModel(): SelectionModelIf | undefined;
129
152
  }
@@ -22,12 +22,30 @@ import { MouseTargetData } from './data/event/mouse-target-data';
22
22
  import { SelectionModelIf } from './selection/selection-model.if';
23
23
  import { FocusModelIf } from './focus/focus-model.if';
24
24
  /**
25
- * Creates a TableScope instance.
26
- * @param {HTMLDivElement} hostElement - The host element.
27
- * @param {TableModelIf} tableModel - The table model object.
28
- * @param {TableOptionsIf} [tableOptions=new TableOptions()] - Optional table options object.
29
- * @param {EventListenerIf} [eventListener=new EventAdapter()] - Optional event listener object.
30
- * @param {DomServiceIf} [domService=new SimpleDomService()] - Optional DOM service object.
25
+ * The TableScope class extends the RenderScope class and provides functionality for rendering and interacting with a table.
26
+ *
27
+ * @property {LicenseManager} licenseManager - An instance of LicenseManager.
28
+ * @property {MouseHandler} mouseHandler - An instance of MouseHandler to handle mouse events.
29
+ * @property {InputHandler} inputHandler - An instance of InputHandler to handle keyboard inputs.
30
+ * @property {ShortcutService} shortcutService - An instance of ShortcutService to register and handle shortcuts.
31
+ * @property {StoreStateCollapsedExpandService | undefined} storeStateCollapsedExpandService - A service to manage and restore the collapsed or expanded state of the table's rows.
32
+ * @property {StoreStateSortingService | undefined} storeSortingService - A service to manage and restore the sort state of the table's columns.
33
+ * @property {SelectionService} selectionService - An instance of SelectionService to manage cell selection in the table.
34
+ * @property {GeKeyEvent | undefined} keyEvent - An object representing the last processed keyboard event.
35
+ * @property {TableApi} api - An instance of TableApi, providing an API for table interactions.
36
+ *
37
+ * Additional properties related to the dragging state of the table:
38
+ * - mouseStartAction: The action performed at the start of a mouse drag operation.
39
+ * - mouseStartWidth: The initial width of an element at the start of a resizing drag operation.
40
+ * - mouseStartColumnIndex: The index of the column at the start of a resizing drag operation.
41
+ * - dragFrom: The initial cell index of a drag operation.
42
+ * - dragTo: The current cell index of a drag operation.
43
+ * - lastDragFrom: The previous initial cell index of a drag operation.
44
+ * - lastDragTo: The previous current cell index of a drag operation.
45
+ * - firstDraggingRendering: A boolean indicating if this is the first render during the current drag operation.
46
+ *
47
+ * Methods: Please refer to the documentation of the superclass RenderScope for the inherited methods.
48
+ * The TableScope class introduces additional methods not listed here. Please refer to the source code for further details.
31
49
  */
32
50
  export declare class TableScope extends RenderScope implements OnActionTriggeredIf {
33
51
  protected readonly eventListener: EventListenerIf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0"
6
6
  },