@guiexpert/react-table 1.0.3 → 1.0.4

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.js CHANGED
@@ -1,11 +1,1841 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),k=require("react"),X=require("react-dom");class P{constructor(e=-1,t=-1,i=-1,s=-1,o,r,n,l=0,a=0,d=0,S=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=i,this.columnLeft=s,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=a,this.draggingY=d,this.action=S}clone(){return new P(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class I{constructor(e=">",t="",i=[]){this.content=e,this.style=t,this.classes=i}}class N{constructor(e=new I(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new I(">","",["ge-table-tree-arrow-collapsed"]),i=new I(">","color:transparent;",["gt-table-tree-arrow-hidden"]),s=new I("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=i,this.arrowExpandCollapseAll=s}}class j{constructor(e=new I("↑","",["ge-header-sorted-asc"]),t=new I("↓","",["ge-header-sorted-desc"]),i=new I("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=i}}class K{constructor(e){this.domService=e}setStyle(e,t,i){return this.domService.setStyle(e,t,i),e}applyStyle(e,t){for(const i in t)this.domService.setStyle(e,i,t[i]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([i,s])=>this.domService.setStyle(e,i,s+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",i){return this.domService.setStyle(i,"overflow-x",e),this.domService.setStyle(i,"overflow-y",t),i}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const i=this.domService.createText(t);return this.domService.appendChild(e,i),i}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(i=>this.domService.addClass(t,i)):this.domService.addClass(t,e),t}addClasses(e,t){if(e)for(const i of e)this.domService.addClass(t,i);return t}setAttribute(e,t,i){return t&&i&&this.domService.setAttribute(e,t,i),e}createAreaDivWithClass(e,t,i,s){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",i),this.domService.setAttribute(o,"data-side",s),this.domService.appendChild(t,o),o}createDivWithClass(e,t){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.appendChild(t,i),i}addRowDiv(e,t,i=-1,s,o,r=""){const n=t.index??-1,l=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(l,"ge-table-row-div"),this.domService.addClass(l,`ge-table-row-div-${t.index}`),s==="body"&&o==="center"){const a=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(l,`ge-table-row-${a}`)}if(this.domService.setStyle(l,"display","clip"),this.domService.setStyle(l,"position","absolute"),this.domService.setStyle(l,"left",`${t.left}px`),this.domService.setStyle(l,"top",`${t.top}px`),this.domService.setStyle(l,"width",`${t.width}px`),this.domService.setStyle(l,"height",`${t.height}px`),this.domService.setAttribute(l,"data-row-index",`${i}`),this.domService.setAttribute(l,"data-area",`${s}`),r){const a=this.domService.createText(r);this.domService.appendChild(l,a)}return this.domService.appendChild(e.child,l),l}addColumnDiv(e,t,i=-1,s=-1,o,r,n="",l,a,d=void 0,S){const g=a==null?void 0:a.treeOptions,f=a==null?void 0:a.showCheckboxWihoutExtraColumn,c=this.domService.createElement("div");this.domService.addClass(c,"ge-table-col-div"),this.domService.addClass(c,`ge-table-col-div-${t.index}`),this.domService.setAttribute(c,"data-col-index",`${t.index}`),this.domService.setAttribute(c,"data-row-index",`${i}`),this.domService.setAttribute(c,"data-area",`${o}`);const b=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(c,`ge-table-column-${b}`),this.domService.setStyle(c,"display","clip"),this.domService.setStyle(c,"position","absolute"),this.domService.setStyle(c,"left",`${t.left}px`),this.domService.setStyle(c,"top",`${t.top}px`),this.domService.setStyle(c,"width",`${t.width}px`),this.domService.setStyle(c,"height",`${t.height}px`),l&&l!=="none"&&(this.domService.addClass(c,"ge-table-col-tree"),this.addArrowDiv(c,l,g,i,s,o)),f&&s===0&&d&&this.addCheckboxToDiv(c,d,o,i),n){const h=l!=="none"&&s===0;this.addLabelDiv(c,n,h,i,s,o)}return S&&this.addSortedIcon(c,S,a==null?void 0:a.sortedOptions,s),this.domService.appendChild(e,c),c}addCheckboxToDiv(e,t,i,s){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
1
+ import { jsx as z } from "react/jsx-runtime";
2
+ import { useRef as j, useEffect as X } from "react";
3
+ import K from "react-dom";
4
+ class P {
5
+ constructor(e = -1, t = -1, i = -1, s = -1, o, r, n, l = 0, a = 0, d = 0, S = "") {
6
+ this.rowIndex = e, this.rowTop = t, this.columnIndex = i, this.columnLeft = s, this.areaIdent = o, this.sideIdent = r, this.originalEvent = n, this.clickCount = l, this.draggingX = a, this.draggingY = d, this.action = S;
7
+ }
8
+ clone() {
9
+ return new P(
10
+ this.rowIndex,
11
+ this.rowTop,
12
+ this.columnIndex,
13
+ this.columnLeft,
14
+ this.areaIdent,
15
+ this.sideIdent,
16
+ this.originalEvent,
17
+ this.clickCount,
18
+ this.draggingX,
19
+ this.draggingY,
20
+ this.action
21
+ );
22
+ }
23
+ }
24
+ class I {
25
+ constructor(e = ">", t = "", i = []) {
26
+ this.content = e, this.style = t, this.classes = i;
27
+ }
28
+ }
29
+ class G {
30
+ constructor(e = new I(
31
+ ">",
32
+ "transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
33
+ ["gt-table-tree-arrow-expanded"]
34
+ ), t = new I(
35
+ ">",
36
+ "",
37
+ ["ge-table-tree-arrow-collapsed"]
38
+ ), i = new I(
39
+ ">",
40
+ "color:transparent;",
41
+ ["gt-table-tree-arrow-hidden"]
42
+ ), s = new I(
43
+ "↕",
44
+ "",
45
+ ["gt-table-tree-arrow-expanded-all"]
46
+ )) {
47
+ this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = i, this.arrowExpandCollapseAll = s;
48
+ }
49
+ }
50
+ class N {
51
+ constructor(e = new I("↑", "", ["ge-header-sorted-asc"]), t = new I("↓", "", ["ge-header-sorted-desc"]), i = new I("↑", "color:transparent;", [])) {
52
+ this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = i;
53
+ }
54
+ }
55
+ class Y {
56
+ constructor(e) {
57
+ this.domService = e;
58
+ }
59
+ setStyle(e, t, i) {
60
+ return this.domService.setStyle(e, t, i), e;
61
+ }
62
+ applyStyle(e, t) {
63
+ for (const i in t)
64
+ this.domService.setStyle(e, i, t[i]);
65
+ return e;
66
+ }
67
+ applyDisplayNoneStyle(e) {
68
+ return this.domService.setStyle(e, "display", "none"), e;
69
+ }
70
+ applyDisplayBlockStyle(e) {
71
+ return this.domService.setStyle(e, "display", "block"), e;
72
+ }
73
+ applyStyleInPx(e, t) {
74
+ return Object.entries(t).forEach(([i, s]) => this.domService.setStyle(e, i, s + "px")), e;
75
+ }
76
+ applyStylePosistionRelative(e) {
77
+ return this.domService.setStyle(e, "position", "relative"), this.domService.setStyle(e, "overflow", "clip"), e;
78
+ }
79
+ applyStylePosistionAbsolute(e) {
80
+ return this.domService.setStyle(e, "position", "absolute"), e;
81
+ }
82
+ applyStyleFullSize(e) {
83
+ return this.domService.setStyle(e, "width", "100%"), this.domService.setStyle(e, "height", "100%"), e;
84
+ }
85
+ applyStyleOverflowAuto(e = "auto", t = "auto", i) {
86
+ return this.domService.setStyle(i, "overflow-x", e), this.domService.setStyle(i, "overflow-y", t), i;
87
+ }
88
+ applyStyleNoPadding(e) {
89
+ return this.domService.setStyle(e, "padding", "0"), this.domService.setStyle(e, "margin", "0"), this.domService.setStyle(e, "border", "0"), e;
90
+ }
91
+ appendRelativeChildDiv(e) {
92
+ const t = this.applyStylePosistionRelative(
93
+ this.applyStyleFullSize(
94
+ this.applyStyleNoPadding(
95
+ this.domService.createElement("div")
96
+ )
97
+ )
98
+ );
99
+ return this.domService.appendChild(e, t), this.applyStylePosistionAbsolute(e), { parent: e, child: t, cache: {} };
100
+ }
101
+ appendText(e, t) {
102
+ const i = this.domService.createText(t);
103
+ return this.domService.appendChild(e, i), i;
104
+ }
105
+ addClass(e, t) {
106
+ return e.includes(" ") ? e.split(" ").forEach((i) => this.domService.addClass(t, i)) : this.domService.addClass(t, e), t;
107
+ }
108
+ addClasses(e, t) {
109
+ if (e)
110
+ for (const i of e)
111
+ this.domService.addClass(t, i);
112
+ return t;
113
+ }
114
+ setAttribute(e, t, i) {
115
+ return t && i && this.domService.setAttribute(e, t, i), e;
116
+ }
117
+ createAreaDivWithClass(e, t, i, s) {
118
+ const o = this.domService.createElement("div");
119
+ return this.addClass(e, o), this.domService.setAttribute(o, "data-area", i), this.domService.setAttribute(o, "data-side", s), this.domService.appendChild(t, o), o;
120
+ }
121
+ createDivWithClass(e, t) {
122
+ const i = this.domService.createElement("div");
123
+ return this.addClass(e, i), this.domService.appendChild(t, i), i;
124
+ }
125
+ addRowDiv(e, t, i = -1, s, o, r = "") {
126
+ const n = t.index ?? -1, l = this.getDivOrCreateDiv(n, e);
127
+ if (this.domService.addClass(l, "ge-table-row-div"), this.domService.addClass(l, `ge-table-row-div-${t.index}`), s === "body" && o === "center") {
128
+ const a = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
129
+ this.domService.addClass(l, `ge-table-row-${a}`);
130
+ }
131
+ if (this.domService.setStyle(l, "display", "clip"), this.domService.setStyle(l, "position", "absolute"), this.domService.setStyle(l, "left", `${t.left}px`), this.domService.setStyle(l, "top", `${t.top}px`), this.domService.setStyle(l, "width", `${t.width}px`), this.domService.setStyle(l, "height", `${t.height}px`), this.domService.setAttribute(l, "data-row-index", `${i}`), this.domService.setAttribute(l, "data-area", `${s}`), r) {
132
+ const a = this.domService.createText(r);
133
+ this.domService.appendChild(l, a);
134
+ }
135
+ return this.domService.appendChild(e.child, l), l;
136
+ }
137
+ addColumnDiv(e, t, i = -1, s = -1, o, r, n = "", l, a, d = void 0, S) {
138
+ const g = a == null ? void 0 : a.treeOptions, f = a == null ? void 0 : a.showCheckboxWihoutExtraColumn, c = this.domService.createElement("div");
139
+ this.domService.addClass(c, "ge-table-col-div"), this.domService.addClass(c, `ge-table-col-div-${t.index}`), this.domService.setAttribute(c, "data-col-index", `${t.index}`), this.domService.setAttribute(c, "data-row-index", `${i}`), this.domService.setAttribute(c, "data-area", `${o}`);
140
+ const b = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
141
+ if (o === "body" && r === "center" && this.domService.addClass(c, `ge-table-column-${b}`), this.domService.setStyle(c, "display", "clip"), this.domService.setStyle(c, "position", "absolute"), this.domService.setStyle(c, "left", `${t.left}px`), this.domService.setStyle(c, "top", `${t.top}px`), this.domService.setStyle(c, "width", `${t.width}px`), this.domService.setStyle(c, "height", `${t.height}px`), l && l !== "none" && (this.domService.addClass(c, "ge-table-col-tree"), this.addArrowDiv(c, l, g, i, s, o)), f && s === 0 && d && this.addCheckboxToDiv(c, d, o, i), n) {
142
+ const h = l !== "none" && s === 0;
143
+ this.addLabelDiv(c, n, h, i, s, o);
144
+ }
145
+ return S && this.addSortedIcon(c, S, a == null ? void 0 : a.sortedOptions, s), this.domService.appendChild(e, c), c;
146
+ }
147
+ addCheckboxToDiv(e, t, i, s) {
148
+ const o = this.domService.createElement("div"), r = t === "full" ? "checked" : "";
149
+ return o.innerHTML = `
2
150
  <input
3
151
  type="checkbox"
4
152
  data-area="${i}"
5
153
  data-row-index="${s}"
6
154
  data-input-type="checkbox"
7
155
  ${r}
8
- class="ge-table-row-checkbox"> `,this.domService.setStyle(o,"display","inline"),this.domService.setStyle(o,"width","inherit"),this.domService.setAttribute(o,"data-row-index",`${s}`),this.domService.appendChild(e,o),o}addLabelDiv(e,t="",i=!1,s=-1,o=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(i){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const a=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,a),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${o}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",i=new j,s=-1){const o=this.domService.createElement("div");this.domService.addClass(o,"ge-table-sorted-icon-div"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"top","0"),this.domService.setStyle(o,"right","0"),this.domService.setStyle(o,"width","20px"),this.domService.setStyle(o,"background","transparent"),this.domService.setStyle(o,"cursor","pointer"),this.domService.setAttribute(o,"data-col-index",`${s}`),this.domService.setAttribute(o,"data-area","header");let r;t==="asc"?r=i.iconAsc:t==="desc"?r=i.iconDesc:r=i.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(o,l),r.style&&this.applyStyleString(o,r.style);for(const a of r.classes)this.domService.addClass(o,a);return this.domService.appendChild(e,o),o}addArrowDiv(e,t="none",i=new N,s=-1,o=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=i.arrowExpanded:t==="collapsed"?l=i.arrowCollapsed:l=i.arrowPlaceholder;const a=l.content,d=this.domService.createText(a);this.domService.appendChild(n,d),l.style&&this.applyStyleString(n,l.style);for(const S of l.classes)this.domService.addClass(n,S);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,i,s,o){if(e.verticalBorderVisible){const r=`ge-table-${s}-${o}-vertical-border`;this.addVerticalBorder(i,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${o}-horizontal-border`;this.addHorizontalBorder(i,t,r)}return t}addHorizontalBorder(e,t,i="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,i),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,i){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.applyStyle(s,i),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.applyStyle(s,i),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.applyStyle(s,i),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.applyStyle(s,i),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,i="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,i),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,i=""){const s=this.domService.createElement("div");return i&&this.domService.addClass(s,i),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 i=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of i){const[o,r]=s.split(":");this.domService.setStyle(e,o.trim(),r.trim())}}getDivOrCreateDiv(e,t){let i=t.cache[e];return i?(i.innerText="",i):(i=this.domService.createElement("div"),t.cache[e]=i,i)}}class L{constructor(e,t=!0,i,s,o=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=i,this.parent=s,this.deep=o,this.checked=r,this.keep=n}}const V=p=>p==="header"?"header":p==="footer"?"footer":"body";class Y{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 i=e.getAttribute("data-area");if(i&&(this.areaIdent=V(i),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 q{constructor(e){this.tableScope=e,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=new Y(e.target,this.tableScope);if(t.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(t.inputType==="checkbox"&&t.areaIdent)this.tableScope.toggleRowCheckbox(t.rowIdx,t.colIdx,t.areaIdent),e.preventDefault(),e.stopPropagation();else if(t.row instanceof L&&t.areaModel){const i=t.colIdx===this.getArrowColumnIndex()&&e.altKey,s=t.className.includes("ge-table-tree-arrow-div");if(console.info(s,i),i||s){e.preventDefault(),e.stopPropagation();const o=t.row;o.expanded=!o.expanded,"recalcVisibleTreeRows"in t.areaModel&&t.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(o)}}if(t.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const i=this.tableScope.tableOptions.getFocusModel();i==null||i.clear(),i==null||i.setFocus(t.rowIdx,t.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(e.target instanceof HTMLElement){const t=e.target,i=t.getAttribute("data-area"),s=V(i),o=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(i&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,o,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(o);if(i&&s==="body"&&n.isEditable(o,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(o,r)),l instanceof L&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const a=l;a.expanded=!a.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(a)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var i;this.mouseEvent=e,this.geMouseEventOld=(i=this.geMouseEvent)==null?void 0:i.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld)}updateCollapsedExpandedState(e){var i,s,o,r,n;const t=(s=(i=this.tableScope.tableOptions)==null?void 0:i.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(o=this.tableScope.storeStateCollapsedExpandService)==null?void 0:o.collapsedExpandedStateGet().mode,a=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,d=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,S=t(e.data);a?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(S):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(S))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging=!0,requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class U{constructor(e){this.tableScope=e}updateCells(e){this.tableScope.updateCells(e)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){}scrollToIndex(e=0,t=0){}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}}class J{flattenTree(e,t=[]){var i;for(const s of e)this.isVisible(s)&&t.push(s),(i=s.children)!=null&&i.length&&this.flattenTree(s.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Q{constructor(e,t=[],i=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=i,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(s=>s.rendererMap[e])}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var i;const t=this.getRowByIndex(e);return(i=this.rowSelectionModel)==null?void 0:i.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const i=this.getRowByIndex(e);this.rowSelectionModel.checkRow(i,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){return this.columnDefs&&t<this.columnDefs.length&&this.columnDefs[t].editable?this.columnDefs[t].editable():!1}setValue(e,t,i){var n;const s=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;s&&(i=s(i,e,t));const o=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(o,r.split("."),i):(o[r]=i,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,i){const s=t.shift();if(s){let o=e[s];return o&&t.length?this.setPropertyValue(o,t,i):(e[s]=i,!0)}return!1}arrayMove(e,t,i){const s=e.splice(t,1)[0];return e.splice(i,0,s),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class Z{genericSortComparator(e,t,i){if(typeof e=="number"&&typeof t=="number")return i*(e-t);if(typeof e=="string"&&typeof t=="string")return i*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return i*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return i*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const s=e,o=t;if(s.length&&o.length)return this.genericSortComparator(s[0],o[0],i)}return i*(""+e).localeCompare(""+t)}}class B extends Q{constructor(e,t,i,s=[]){super(e,s,i),this.areaIdent=e,this.rows=t,this.defaultRowHeight=i,this.columnDefs=s,this.sorterService=new Z,this.service=new J,this.properties=s.map(o=>o.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const i=this.getRowByIndex(e);if(i){const s=this.properties[t];if(s)return s.includes(".")?this.getPropertyValue(i.data,s.split(".")):i.data[s]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:i}=e[e.length-1],s=i==="asc"?1:i==="desc"?-1:0,o=this.properties[t];return this.treeSort(this.rows,o,s),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,i){var r;const s=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;s&&(i=s(i,e,t));const o=this.getRowByIndex(e);if(o){const n=o.data,l=this.columnDefs[t].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),i):(n[l]=i,!0)}return!1}genericTreeTableSortComparator(e,t){return(i,s)=>{const o=this.getValueByT(i.data,e),r=this.getValueByT(s.data,e);return this.sorterService.genericSortComparator(o,r,t)}}expandAllRecursive(e,t){for(const i of e)i.expanded=t,i.children&&this.expandAllRecursive(i.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(i=>{e=Math.max(e,i.deep)});const t=this.flattenRows.filter((i,s,o)=>this.lastPredictFn(i,s,o));this.flattenRows.forEach(i=>i.keep=!1),this.flattenRows.forEach(i=>{t.includes(i)&&(i.keep=!0,this.setAllParentsOk(i))}),this.filteredFlattenRows=this.flattenRows.filter((i,s,o)=>i.keep)}}getPropertyValue(e,t){const i=t.shift();let s=e[i];return s&&t.length?this.getPropertyValue(s,t):s}treeSort(e,t,i){e.sort(this.genericTreeTableSortComparator(t,i));for(const s of e)s.children&&this.treeSort(s.children,t,i)}}class H{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const i=e;for(const s of[...i]){const[o,r]=s;t[o]=r}}return t}checkAndPersistItem(e,t){const i=this.getStorageKeyFn;if(i){const s=i();if(s){const o=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(o,r)}else this.persistItem(o,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class ee extends H{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 i=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(i);this.scrollOffset=s||[0,0]}}}}class te{constructor(e="collapsed",t=[],i=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=i,this.allExpanded=s}}class ie extends H{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new te,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 i=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(i);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class se extends H{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 i=t+this.SORTING_STATE;let s=this.loadFromLocalStorage(i);this.sortItems=s||[]}}}}class T{constructor(e=0,t=0,i=0,s=0,o){this.left=e,this.width=t,this.height=i,this.top=s,this.index=o}}class oe{constructor(e,t,i,s){this.hostElement=e,this.tableModel=t,this.dom=i,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new T,this.areaBodyCenterGeo=new T,this.areaBodyEastGeo=new T;const o=this.hostElement;o.innerText="",this.dom.setAttribute(o,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",o),"position","relative"),this.hoverRow=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-hover-row",o)),this.hoverColumn=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-hover-column",o)),this.areaHeaderWest=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-header ge-table-header-west",o,"header","west"))),this.areaHeaderCenter=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-header ge-table-header-center",o,"header","center"))),this.areaHeaderEast=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-header ge-table-header-east",o,"body","east"))),this.areaBodyWest=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-body ge-table-body-west",o,"body","west"))),this.areaBodyEast=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-body ge-table-body-east",o,"body","east"))),this.areaFooterWest=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-footer ge-table-footer-west",o,"footer","west"))),this.areaFooterCenter=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-footer ge-table-footer-center",o,"footer","center"))),this.areaFooterEast=i.appendRelativeChildDiv(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-footer ge-table-footer-east",o,"footer","east"))),this.scrollViewport=i.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",i.applyStyleNoPadding(i.applyStylePosistionAbsolute(i.createAreaDivWithClass("ge-table-scroll-viewport",o,"body","center")))),this.contentWrapperDiv=i.applyStyleNoPadding(i.applyStylePosistionRelative(i.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=i.applyStyleNoPadding(i.applyStylePosistionRelative(i.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=i.appendRelativeChildDiv(i.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-header-border",o)),this.borderFixedWest=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-west-fixed-column-border",o)),this.borderFixedEast=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-east-fixed-column-border",o)),this.borderFooterTop=i.applyStylePosistionAbsolute(i.createDivWithClass("ge-table-footer-border",o))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,i=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${i-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=i-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=i-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=i-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:`${i-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${i-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${i-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:`${i-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,i,s,o=!1){this.r1=e,this.c1=t,this.r2=i,this.c2=s,this.gammaRange=o}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 re{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 i=0;i<e;i++)for(let s=0;s<t;s++){let o=this.areaModel.getColspanAt(i,s),r=this.areaModel.getRowspanAt(i,s);if(o>1||r>1){o===0&&(o=1),r===0&&(r=1);const n=this.areaModel.hasOwnProperty("gammaCells");this.colAndRowspanRanges.push(new A(i,s,i+r-1,s+o-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const i of this.colAndRowspanRanges)if(i.isInRange(e,t))return!0}return!1}}class le{constructor(e,t,i){this.header=e,this.body=t,this.footer=i}}class ne extends oe{constructor(e,t,i,s){var r,n;super(e,t,i,s),this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new le,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.editing=!1,this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),t.getAreaModel("body")instanceof B&&(this.tree=!0),["header","body","footer"].forEach(l=>{var a;this.colAndRowspanModels[l]=new re(t,t.getAreaModel(l)),(a=this.colAndRowspanModels[l])==null||a.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(){if(this.getSelectionModel){const e=this.getSelectionModel();e==null||e.clear()}}initRenderEditor(e,t){var s;let i=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(i||(i=this.tableOptions.getEditRenderer),i)if(this.editorRenderer=i(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const o=document.querySelector("input.ge-table-cell-editor-input");o&&o.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new T(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new T(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e){e.forEach(t=>this.tableModel.getAreaModel(t.area).setValue(t.rowIndex,t.columnIndex,t.value)),this.repaint()}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),i=this.getStringByAttr(e,"data-side");if(i&&t)return[t,i]}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 i;if(e){const s=(i=e.closest("["+t+"]"))==null?void 0:i.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var i;if(e){const s=(i=e.closest("["+t+"]"))==null?void 0:i.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var h;const i=this.getArea(e,"west"),s=this.getArea(e,"center"),o=this.getArea(e,"east"),r=s.child.clientHeight;i.child.innerText="",s.child.innerText="",o.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),S=d.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let g=t;const f=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<S;u++){const v=g,x=u===S-1,C=this.tableModel.getRowHeight(e,u);if(v+C>0){this.firstVisibleRowIndex=u;let w={left:n,width:l,height:C,top:v,index:u},m=this.dom.addRowDiv(s,w,u,e,"center");const M=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:w,parent:m,rowIndex:u,columnIndexStart:M,columnIndexEnd:f-c-1,verticalFixed:!1,lastRowOfModel:x}),a.left>0&&(w={left:n,width:this.areaBodyWestGeo.width,height:C,top:v,index:u},m=this.dom.addRowDiv(i,w,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:w,parent:m,rowIndex:u,columnIndexStart:0,columnIndexEnd:M-1,verticalFixed:!0,lastRowOfModel:x})),a.right>0&&(w={left:n,width:this.areaBodyEastGeo.width,height:C,top:v,index:u},m=this.dom.addRowDiv(o,w,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:w,parent:m,rowIndex:u,columnIndexStart:f-c,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:x})),e==="header"&&this.tree&&u===S-1){const E=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new T(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),R=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(R){const D=this.dom.domService.createText(R.content);this.dom.domService.appendChild(E,D),R.style&&this.dom.applyStyleString(E,R.style)}}}if(g=g+C,g>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((h=this.colAndRowspanModels[e])==null?void 0:h.getRanges())??[];if(u.length)for(const v of u){let x=0,C=s.child,w="center";if(v.c1<b)C=i.child,w="west";else if(c>0&&v.c1>=f-c)C=o.child,w="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();x=this.scrollFactorX*m-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(v,x,t,d,C,w)}}}drawBigCell(e,t,i,s,o,r){const n=i+this.getRowHeights(0,e.r1-1,s).reduce((h,u)=>h+u,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let d=0;a>0&&e.c1>=l-a&&(d=l-a);const S=t+this.getColumnWidths(d,e.c1-1).reduce((h,u)=>h+u,0),g=this.getRowHeights(e.r1,e.r2,s).reduce((h,u)=>h+u,0),f=this.getColumnWidths(e.c1,e.c2).reduce((h,u)=>h+u,0);let c=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(c=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?(console.info("TODO here",e),this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:S,top:n,width:f,height:g,parent:o,cellSelected:c,lastRowOfModel:!0,gammaRange:e.gammaRange})):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:S,top:n,width:f,height:g,parent:o,cellSelected:c,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:S,cellTop:n,cellWidth:f,cellHeight:g,parent:o})}findRowOfImportantRowspanCell(e,t,i){const s=e.getMaxRowspan();for(let o=t-1;o>-1;o--){const r=e.getRowspanAt(o,i);if(r>1&&o+r+1>=t)return o;if(t-o>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:i,geo:s,parent:o,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:a=!1,lastRowOfModel:d=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let S=0;if(!a){const h=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();S=this.scrollFactorX*h}const g=0,f=!!(e==="body"&&t);let c=S;for(let h=n;h<=l;h++){const u=c,v=this.tableModel.getColumnWidth(h);if(v>0&&u+v>0){let x=s.height;const C=i.getRowspanAt(r,h),w=i.getColspanAt(r,h);C>1&&(x=this.getRowHeights(r,r+C-1,i).reduce((E,R)=>E+R,0));let m=v;w>1&&(m=this.getColumnWidths(h,h+w-1).reduce((E,R)=>E+R,0));let M=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(r,h)&&(M=!0),this.draggingTargetColumnIndex===h&&e!=="header"){this.renderDragTargetDiv(o,u,g,m,x);const E={left:u,top:g,width:m,height:x};this.dom.addColumnBorderDivs(this.tableOptions,o,E,e,t)}else{const E=this.renderSelectedBackgroundDiv(M,f,t,i,r,h,o,u,g,m,x);M||this.renderCell({areaModel:i,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:h,left:u,top:g,width:m,height:x,parent:o,cellSelected:E,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:h,cellLeft:u,cellTop:g,cellWidth:m,cellHeight:x,parent:o})}}if(c=c+v,c>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new T(c-1,1,s.height,0),o)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:i,rowIndex:s,index:o,left:r,width:n,height:l,top:a,parent:d,lastRowOfModel:S}){var W;const f=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===o?this.editorRenderer:e.getCellRenderer(s,o),c={left:r,width:n,height:l,top:a,index:o},b=e.getRowByIndex(s);let h="none";if(o===this.getTreeArrowColumnIndex()&&b instanceof L){const y=b;(W=y.children)!=null&&W.length?y.expanded?h="expanded":h="collapsed":h="hidden"}let v;if(t==="header"){const y=this.tableModel.getColumnDef(o);(!(y!=null&&y.sortIconVisible)||y!=null&&y.sortIconVisible())&&(v=y==null?void 0:y.sortState)}const x=e.getValueAt(s,o),C=f?"":`${x}`,w=e.isRowChecked(s),m=this.dom.addColumnDiv(d,c,s,o,t,i,C,h,this.tableOptions,w,v),M=e.getTooltipAt(s,o);M&&this.dom.setAttribute(m,"title",M);const E=this.tableModel.getColumnDef(o);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],m);let R;f&&(R=f.render(m,s,o,t,e,x,this.dom.domService));const D=e.getCustomClassesAt(s,o);if(D.length&&this.dom.addClasses(D,m),this.dom.addColumnBorderDivs(this.tableOptions,d,c,t,i),S&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},d),this.getFocusModel&&t==="body"){const y=this.getFocusModel();y!=null&&y.hasFocus(s,o)&&this.dom.addFocusBorderDivs(d,c,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const O=e.getCustomStyleAt(s,o);if(O)for(const y in O)this.dom.setStyle(m,y,O[y]);return[m,R]}getColumnWidths(e,t){const i=[];for(let s=e;s<=t;s++)i.push(this.tableModel.getColumnWidth(s));return i}getRowHeights(e,t,i){const s=[];for(let o=e;o<=t;o++)s.push(i.getRowHeight(o));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,i=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:i+"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,i=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,o=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:o+"px",top:"0px",width:i+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}renderDragTargetDiv(e,t,i,s,o){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${i}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${o}px`),r}renderSelectedBackgroundDiv(e,t,i,s,o,r,n,l,a,d,S){let g=!1;if(!e&&t&&s.isSelectable(o,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const c=f.getSelectionCount(o,r);g=c>0;for(let b=0;b<c;b++){const h=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${i}-selected-range`,n));this.dom.setStyle(h,"left",`${l}px`),this.dom.setStyle(h,"top",`${a}px`),this.dom.setStyle(h,"width",`${d}px`),this.dom.setStyle(h,"height",`${S}px`)}}}return g}renderCell({areaModel:e,areaIdent:t,sideIdent:i,rowIndex:s,columnIndex:o,left:r,top:n,width:l,height:a,parent:d,cellSelected:S,lastRowOfModel:g,gammaRange:f}){const[c,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:i,rowIndex:s,index:o,left:r,width:l,height:a,top:n,parent:d,lastRowOfModel:g,gammaRange:f});S&&this.dom.addClass(`ge-table-${t}-${i}-selected-range`,c),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:i,cellTop:s,cellWidth:o,cellHeight:r,parent:n}){const l=this.dom.domService,a=this.tableOptions.columnResizeHandleWidthInPx??2,d=l.createElement("div");l.setAttribute(d,"data-col-index",`${t}`),l.setAttribute(d,"data-row-index",`${e}`),l.setAttribute(d,"data-area","header"),l.setAttribute(d,"data-ge-action","resize-column"),l.addClass(d,"ge-table-column-resize-handle"),l.setStyle(d,"display","clip"),l.setStyle(d,"position","absolute"),l.setStyle(d,"cursor","col-resize"),l.setStyle(d,"left",`${i+o-a}px`),l.setStyle(d,"top",`${s}px`),l.setStyle(d,"width",`${a}px`),l.setStyle(d,"height",`${r}px`),l.appendChild(n,d)}}class ae{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,i=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),o=t.getAttribute("data-col-index");if(i&&s&&o){const r=V(i),n=Number(s),l=Number(o);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class he{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class _{constructor(e){this.cells=e}static createSingle(e,t){return new _([new he(e,t)])}}class ce{constructor(e){var t,i;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(i=this.tableScope.tableOptions)!=null&&i.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var o,r,n,l,a,d,S;let i=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const g=this.getSelectionModel(),f=this.getFocusModel();g&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),i=!0),(o=e.originalEvent)!=null&&o.shiftKey||g.hasSelection()&&(g.clear(),i=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(g.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,i=!0):(n=e.originalEvent)!=null&&n.ctrlKey||(l=e.originalEvent)!=null&&l.metaKey?(g.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,i=!0):(a=e.originalEvent)!=null&&a.altKey&&((d=e.originalEvent)!=null&&d.ctrlKey||(S=e.originalEvent)!=null&&S.metaKey)&&(g.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),s=!0,i=!0))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),i}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),i=this.getFocusModel();if(t&&i){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,o]=i.getFocus();return t.togglePoint(s,o),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const i=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:i,columnIndex1:o,rowIndex2:s,columnIndex2:r})}}class pe{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","cmd -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class ue{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","cmd+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","cmd+x":"DESELECT_ALL","cmd+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class Se{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ue().get()):Object.assign(this.shortcutActionIdMapping,new pe().get()),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEnty(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit:",e);let t=!1;for(const i of this.listener)i.onActionTriggered(e)&&(t=!0);return t}findEnty(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens:",t);for(const i in this.shortcutActionIdMapping){const s=i.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[\+ ]/g).sort();if(this.areTokensEquals(t,s))return this.shortcutActionIdMapping[i]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}}class ge{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class fe extends ne{constructor(e,t,i,s,o){var r;if(super(e,t,new K(i),s),this.eventListener=o,this.selectionService=new ce(this),this.api=new U(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,o||(this.eventListener=new ge),(r=this.tableOptions)!=null&&r.autoRestoreOptions){const n=this.tableOptions.autoRestoreOptions,l=n.getStorageKeyFn;l&&(n.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new ee(l)),n.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new ie(l)),n.autoRestoreSortingState&&(this.storeSortingService=new se(l)))}this.mouseHandler=new q(this),this.inputHandler=new de(this),this.shortcutService=new Se(this),this.shortcutService.addListener(this.selectionService)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[i,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(i,s)&&(this.clearSelection(),this.initRenderEditor(i,s))}return!0}return!1}updateModelValueAfterEdit(e,t,i,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,i,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(_.createSingle(t,i)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition()}createGeMouseEvent(e){const t=new P;if(t.originalEvent=e,e){const i=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(i),t.rowIndex=this.getNumberByAttr(i,"data-row-index"),t.columnIndex=this.getNumberByAttr(i,"data-col-index"),t.action=this.getStringByAttr(i,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,o=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(o,s)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&this.repaint(),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var i;const t=this.tableModel.getBodyModel();t instanceof B&&(t.toggleExpandCollapseAll(e),this.repaint(),(i=this.storeStateCollapsedExpandService)==null||i.collapsedStateAll(e))}toggleRowCheckbox(e,t,i){var l;const s=this.tableModel.getAreaModel(i),o=s.isRowChecked(e),r=o===void 0||o==="semi"||o==="none";s.setRowChecked(e,r),this.repaint();const n=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let i=this.selectionService.onMouseClicked(e,t);if(!i&&this.getFocusModel){const s=this.getFocusModel();s&&(i=s.hasChanged(),s.clearChanged(),i&&this.resetEditorRenderer())}this.eventListener.onMouseClicked(e),i&&this.debounce(this.repaint.bind(this),10)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,i){var o,r;const s=this.tableModel.getColumnDef(i);if(s!=null&&s.sortable&&s.sortable()){e.preventDefault(),e.stopPropagation();const n=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,l=s.sortState??"",a=n[(n.indexOf(l)+1)%n.length],d=new ae(i,a);this.tableModel.doSort([d])&&((o=this.tableModel.getColumnDefs())==null||o.forEach(g=>g.sortState=""),s.sortState=a),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const i=this.getFocusModel();if(i){const[s,o]=i.getFocus();return i.setFocus(s+t,o+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var i;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(i=this.mouseHandler.mouseEvent)==null?void 0:i.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const i=this.storeScrollPosStateService.getScrollOffset();i&&this.scrollViewport.scrollTo(...i)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const i=this.storeSortingService.getSortItems();i!=null&&i.length&&this.tableModel.getBodyModel().doSort(i)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const i=this.tableOptions.autoRestoreOptions,s=i.getRowId;if(i.autoRestoreCollapsedExpandedState&&s){const o=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(r instanceof B){const n=r,l=r.getRowCount();for(let a=0;a<l;a++){const d=r.getRowByIndex(a);if(d)if(o.allExpanded)d.expanded=!0;else if(o.allCollapsed)d.expanded=!1;else{const S=s(d.data);o.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S):o.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S))}}n.recalcVisibleTreeRows()}}}}}class me{render(e,t,i,s,o,r,n){if(o.isEditable(t,i)){n.addClass(e,"ge-table-row-input-div");const l=o.getValueAt(t,i);e.innerHTML=`
156
+ class="ge-table-row-checkbox"> `, this.domService.setStyle(o, "display", "inline"), this.domService.setStyle(o, "width", "inherit"), this.domService.setAttribute(o, "data-row-index", `${s}`), this.domService.appendChild(e, o), o;
157
+ }
158
+ addLabelDiv(e, t = "", i = !1, s = -1, o = -1, r = "body") {
159
+ const n = this.domService.createElement("div");
160
+ 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", `${o}`), this.domService.setAttribute(n, "data-area", `${r}`), t)
161
+ if (i) {
162
+ const l = this.domService.createText(t);
163
+ this.domService.appendChild(n, l);
164
+ } else {
165
+ const l = this.domService.createElement("div");
166
+ this.domService.appendChild(n, l);
167
+ const a = this.domService.createText(t);
168
+ this.domService.addClass(l, "ge-table-label"), this.domService.appendChild(l, a), this.domService.setAttribute(l, "data-row-index", `${s}`), this.domService.setAttribute(l, "data-col-index", `${o}`), this.domService.setAttribute(l, "data-area", `${r}`);
169
+ }
170
+ return this.domService.appendChild(e, n), n;
171
+ }
172
+ addSortedIcon(e, t = "", i = new N(), s = -1) {
173
+ const o = this.domService.createElement("div");
174
+ this.domService.addClass(o, "ge-table-sorted-icon-div"), this.domService.setStyle(o, "position", "absolute"), this.domService.setStyle(o, "top", "0"), this.domService.setStyle(o, "right", "0"), this.domService.setStyle(o, "width", "20px"), this.domService.setStyle(o, "background", "transparent"), this.domService.setStyle(o, "cursor", "pointer"), this.domService.setAttribute(o, "data-col-index", `${s}`), this.domService.setAttribute(o, "data-area", "header");
175
+ let r;
176
+ t === "asc" ? r = i.iconAsc : t === "desc" ? r = i.iconDesc : r = i.iconPlaceholder;
177
+ const n = r.content, l = this.domService.createText(n);
178
+ this.domService.appendChild(o, l), r.style && this.applyStyleString(o, r.style);
179
+ for (const a of r.classes)
180
+ this.domService.addClass(o, a);
181
+ return this.domService.appendChild(e, o), o;
182
+ }
183
+ addArrowDiv(e, t = "none", i = new G(), s = -1, o = -1, r = "body") {
184
+ const n = this.domService.createElement("div");
185
+ 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", `${o}`), this.domService.setAttribute(n, "data-area", `${r}`);
186
+ let l;
187
+ t === "expanded" ? l = i.arrowExpanded : t === "collapsed" ? l = i.arrowCollapsed : l = i.arrowPlaceholder;
188
+ const a = l.content, d = this.domService.createText(a);
189
+ this.domService.appendChild(n, d), l.style && this.applyStyleString(n, l.style);
190
+ for (const S of l.classes)
191
+ this.domService.addClass(n, S);
192
+ return this.domService.appendChild(e, n), n;
193
+ }
194
+ addColumnBorderDivs(e, t, i, s, o) {
195
+ if (e.verticalBorderVisible) {
196
+ const r = `ge-table-${s}-${o}-vertical-border`;
197
+ this.addVerticalBorder(i, t, r);
198
+ }
199
+ if (e.horizontalBorderVisible) {
200
+ const r = `ge-table-${s}-${o}-horizontal-border`;
201
+ this.addHorizontalBorder(i, t, r);
202
+ }
203
+ return t;
204
+ }
205
+ addHorizontalBorder(e, t, i = "ge-table-body-center-horizontal-border") {
206
+ const s = this.domService.createElement("div");
207
+ return this.domService.addClass(s, i), 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;
208
+ }
209
+ addFocusBorderDivs(e, t, i) {
210
+ let s = this.domService.createElement("div");
211
+ 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.applyStyle(s, i), 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.applyStyle(s, i), 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.applyStyle(s, i), 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.applyStyle(s, i), this.domService.appendChild(e, s), e;
212
+ }
213
+ addVerticalBorder(e, t, i = "ge-table-body-center-vertical-border") {
214
+ const s = this.domService.createElement("div");
215
+ return this.domService.addClass(s, i), 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;
216
+ }
217
+ addDiv(e, t, i = "") {
218
+ const s = this.domService.createElement("div");
219
+ return i && this.domService.addClass(s, i), 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;
220
+ }
221
+ applyStyleString(e, t) {
222
+ const i = t.split(";").map((s) => s.trim()).filter((s) => s);
223
+ for (const s of i) {
224
+ const [o, r] = s.split(":");
225
+ this.domService.setStyle(e, o.trim(), r.trim());
226
+ }
227
+ }
228
+ getDivOrCreateDiv(e, t) {
229
+ let i = t.cache[e];
230
+ return i ? (i.innerText = "", i) : (i = this.domService.createElement("div"), t.cache[e] = i, i);
231
+ }
232
+ }
233
+ class L {
234
+ constructor(e, t = !0, i, s, o = 0, r = !1, n = !1) {
235
+ this.data = e, this.expanded = t, this.children = i, this.parent = s, this.deep = o, this.checked = r, this.keep = n;
236
+ }
237
+ }
238
+ const V = (p) => p === "header" ? "header" : p === "footer" ? "footer" : "body";
239
+ class q {
240
+ constructor(e, t) {
241
+ 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)) {
242
+ 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"));
243
+ const i = e.getAttribute("data-area");
244
+ if (i && (this.areaIdent = V(i), this.areaModel = t.tableModel.getAreaModel(this.areaIdent), this.row = this.areaModel.getRowByIndex(this.rowIdx)), e instanceof HTMLInputElement) {
245
+ const s = e;
246
+ this.value = s.value;
247
+ }
248
+ }
249
+ }
250
+ }
251
+ class U {
252
+ constructor(e) {
253
+ this.tableScope = e, this.expandedAll = !0, this.mouseDown = !1, this.dragging = !1, this.tableScope.hostElement.addEventListener("click", this.onHostElementClicked.bind(this)), this.tableScope.hostElement.addEventListener("dblclick", this.onHostElementDblClicked.bind(this)), this.tableScope.hostElement.addEventListener("mousedown", this.onMouseDown.bind(this)), this.tableScope.hostElement.addEventListener("mousemove", this.onMouseMove.bind(this)), this.tableScope.hostElement.addEventListener("mouseup", this.onMouseUp.bind(this)), this.tableScope.hostElement.addEventListener("contextmenu", this.onContextmenu.bind(this)), this.tableScope.hostElement._MouseHandler = "true", this.tableScope.scrollViewport.addEventListener("scroll", this.tableScope.adjustAfterScrolling.bind(this.tableScope)), [window, this.tableScope.hostElement].forEach(
254
+ (t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
255
+ );
256
+ }
257
+ onContextmenu(e) {
258
+ this.mouseEvent = e;
259
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
260
+ this.tableScope.contextmenu(t);
261
+ }
262
+ onHostElementClicked(e) {
263
+ const t = new q(e.target, this.tableScope);
264
+ if (t.action === "toggleExpandCollapseAll")
265
+ this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
266
+ else if (t.inputType === "checkbox" && t.areaIdent)
267
+ this.tableScope.toggleRowCheckbox(t.rowIdx, t.colIdx, t.areaIdent), e.preventDefault(), e.stopPropagation();
268
+ else if (t.row instanceof L && t.areaModel) {
269
+ const i = t.colIdx === this.getArrowColumnIndex() && e.altKey, s = t.className.includes("ge-table-tree-arrow-div");
270
+ if (console.info(s, i), i || s) {
271
+ e.preventDefault(), e.stopPropagation();
272
+ const o = t.row;
273
+ o.expanded = !o.expanded, "recalcVisibleTreeRows" in t.areaModel && t.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(o);
274
+ }
275
+ }
276
+ if (t.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
277
+ const i = this.tableScope.tableOptions.getFocusModel();
278
+ i == null || i.clear(), i == null || i.setFocus(t.rowIdx, t.colIdx);
279
+ }
280
+ this.publishGeMouseEvent(e, 1);
281
+ }
282
+ onHostElementDblClicked(e) {
283
+ if (e.target instanceof HTMLElement) {
284
+ const t = e.target, i = t.getAttribute("data-area"), s = V(i), o = Number(t.getAttribute("data-row-index")), r = Number(t.getAttribute("data-col-index")), n = this.tableScope.tableModel.getAreaModel(s);
285
+ if (i && s === "header")
286
+ this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, o, r));
287
+ else if (t.getAttribute("data-row-index")) {
288
+ const l = n.getRowByIndex(o);
289
+ if (i && s === "body" && n.isEditable(o, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(o, r)), l instanceof L && r === this.getArrowColumnIndex()) {
290
+ e.preventDefault(), e.stopPropagation();
291
+ const a = l;
292
+ a.expanded = !a.expanded, "recalcVisibleTreeRows" in n && n.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(a);
293
+ }
294
+ }
295
+ }
296
+ this.publishGeMouseEvent(e, 2);
297
+ }
298
+ publishGeMouseEvent(e, t) {
299
+ var i;
300
+ this.mouseEvent = e, this.geMouseEventOld = (i = this.geMouseEvent) == null ? void 0 : i.clone(), this.geMouseEvent = this.tableScope.createGeMouseEvent(e), this.geMouseEvent && (this.geMouseEvent.clickCount = t), this.tableScope.onMouseClicked(this.geMouseEvent, this.geMouseEventOld);
301
+ }
302
+ updateCollapsedExpandedState(e) {
303
+ var i, s, o, r, n;
304
+ const t = (s = (i = this.tableScope.tableOptions) == null ? void 0 : i.autoRestoreOptions) == null ? void 0 : s.getRowId;
305
+ if (t) {
306
+ const l = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode, a = l === "collapsed" && !e.expanded || l === "expanded" && e.expanded, d = l === "collapsed" && e.expanded || l === "expanded" && !e.expanded, S = t(e.data);
307
+ a ? (r = this.tableScope.storeStateCollapsedExpandService) == null || r.collapsedStateIdsPush(S) : d && ((n = this.tableScope.storeStateCollapsedExpandService) == null || n.collapsedStateIdsRemove(S));
308
+ }
309
+ }
310
+ getArrowColumnIndex() {
311
+ return this.tableScope.tableModel.isRowCheckboxVisible() ? 1 : 0;
312
+ }
313
+ onMouseDown(e) {
314
+ this.mouseEvent = e, this.startMouseEvent = this.tableScope.createGeMouseEvent(this.mouseEvent), this.tableScope.onMouseDown(this.startMouseEvent), this.mouseDown = !0;
315
+ }
316
+ onMouseMove(e) {
317
+ this.mouseEvent = e, this.mouseDown ? (this.dragging = !0, requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))) : requestAnimationFrame(this.mouseMoveOnFrame.bind(this));
318
+ }
319
+ onMouseUp(e) {
320
+ this.mouseEvent = e, this.dragging && requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)), this.mouseDown = !1, this.dragging = !1;
321
+ }
322
+ mouseDraggingOnFrame() {
323
+ var e;
324
+ if (this.mouseEvent) {
325
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
326
+ (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);
327
+ }
328
+ }
329
+ mouseDraggingEndOnFrame() {
330
+ var e;
331
+ if (this.mouseEvent) {
332
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
333
+ (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);
334
+ }
335
+ }
336
+ mouseMoveOnFrame() {
337
+ if (this.mouseEvent) {
338
+ const e = this.tableScope.createGeMouseEvent(this.mouseEvent);
339
+ this.tableScope.mouseMove(e);
340
+ }
341
+ }
342
+ }
343
+ class J {
344
+ constructor(e) {
345
+ this.tableScope = e;
346
+ }
347
+ updateCells(e) {
348
+ this.tableScope.updateCells(e);
349
+ }
350
+ externalFilterChanged() {
351
+ this.tableScope.externalFilterChanged();
352
+ }
353
+ scrollToPixel(e = 0, t = 0) {
354
+ }
355
+ scrollToIndex(e = 0, t = 0) {
356
+ }
357
+ setHeaderVisible(e = !0) {
358
+ }
359
+ setColumnVisible(e, t = !0) {
360
+ }
361
+ isColumnVisible(e) {
362
+ return !0;
363
+ }
364
+ isHeaderVisible() {
365
+ return !0;
366
+ }
367
+ setFooterVisible(e = !0) {
368
+ }
369
+ isFooterVisible() {
370
+ return !0;
371
+ }
372
+ repaint() {
373
+ this.tableScope.repaint();
374
+ }
375
+ }
376
+ class Q {
377
+ flattenTree(e, t = []) {
378
+ var i;
379
+ for (const s of e)
380
+ this.isVisible(s) && t.push(s), (i = s.children) != null && i.length && this.flattenTree(s.children, t);
381
+ return t;
382
+ }
383
+ isVisible(e) {
384
+ return e.parent ? e.parent.expanded ? this.isVisible(e.parent) : !1 : !0;
385
+ }
386
+ }
387
+ class Z {
388
+ constructor(e, t = [], i = -1) {
389
+ this.areaIdent = e, this.columnDefs = t, this.defaultRowHeight = i, this.rowSelectionModel = void 0, this.yPositions = [], this.cellRenderers = t.map((s) => s.rendererMap[e]);
390
+ }
391
+ getTooltipAt(e, t) {
392
+ return "";
393
+ }
394
+ getCellRenderer(e, t) {
395
+ if (t < this.cellRenderers.length)
396
+ return this.cellRenderers[t];
397
+ }
398
+ getColspanAt(e, t) {
399
+ return 0;
400
+ }
401
+ getCustomClassesAt(e, t) {
402
+ return [];
403
+ }
404
+ getCustomStyleAt(e, t) {
405
+ }
406
+ getRowspanAt(e, t) {
407
+ return 0;
408
+ }
409
+ getRowByIndex(e) {
410
+ }
411
+ isRowCheckable(e) {
412
+ return !0;
413
+ }
414
+ isRowChecked(e) {
415
+ var i;
416
+ const t = this.getRowByIndex(e);
417
+ return (i = this.rowSelectionModel) == null ? void 0 : i.isRowChecked(t);
418
+ }
419
+ setRowChecked(e, t) {
420
+ if (this.rowSelectionModel) {
421
+ const i = this.getRowByIndex(e);
422
+ this.rowSelectionModel.checkRow(i, t);
423
+ }
424
+ }
425
+ getMaxColspan() {
426
+ return 31;
427
+ }
428
+ getMaxRowspan() {
429
+ return 31;
430
+ }
431
+ getYPosByRowIndex(e) {
432
+ return this.defaultRowHeight > 0 ? this.defaultRowHeight * e : this.yPositions[e];
433
+ }
434
+ init() {
435
+ !this.yPositions.length && this.getRowCount() !== void 0 && this.defaultRowHeight === -1 && this.calcYPositions();
436
+ }
437
+ isFilterable() {
438
+ return this.areaIdent === "body";
439
+ }
440
+ doSort(e) {
441
+ return !1;
442
+ }
443
+ isEditable(e, t) {
444
+ return this.columnDefs && t < this.columnDefs.length && this.columnDefs[t].editable ? this.columnDefs[t].editable() : !1;
445
+ }
446
+ setValue(e, t, i) {
447
+ var n;
448
+ const s = (n = this.columnDefs[t]) == null ? void 0 : n.editInputPipe;
449
+ s && (i = s(i, e, t));
450
+ const o = this.getRowByIndex(e), r = this.columnDefs[t].property;
451
+ return r.includes(".") ? this.setPropertyValue(o, r.split("."), i) : (o[r] = i, !0);
452
+ }
453
+ isSelectable(e, t) {
454
+ return !0;
455
+ }
456
+ changeColumnOrder(e, t) {
457
+ this.arrayMove(this.cellRenderers, e, t);
458
+ }
459
+ setPropertyValue(e, t, i) {
460
+ const s = t.shift();
461
+ if (s) {
462
+ let o = e[s];
463
+ return o && t.length ? this.setPropertyValue(o, t, i) : (e[s] = i, !0);
464
+ }
465
+ return !1;
466
+ }
467
+ arrayMove(e, t, i) {
468
+ const s = e.splice(t, 1)[0];
469
+ return e.splice(i, 0, s), e;
470
+ }
471
+ calcYPositions() {
472
+ const e = this.getRowCount();
473
+ this.yPositions = new Array(e + 1), this.yPositions[0] = 0;
474
+ for (let t = 0; t < e; t++)
475
+ this.yPositions[t + 1] = this.getRowHeight(t) + this.yPositions[t];
476
+ }
477
+ }
478
+ class ee {
479
+ genericSortComparator(e, t, i) {
480
+ if (typeof e == "number" && typeof t == "number")
481
+ return i * (e - t);
482
+ if (typeof e == "string" && typeof t == "string")
483
+ return i * e.localeCompare(t);
484
+ if (typeof e == "boolean" && typeof t == "boolean")
485
+ return i * ((e ? -1 : 1) - (t ? -1 : 1));
486
+ if (e instanceof Date && t instanceof Date)
487
+ return i * (e.getTime() - t.getTime());
488
+ if (e instanceof Array && t instanceof Array) {
489
+ const s = e, o = t;
490
+ if (s.length && o.length)
491
+ return this.genericSortComparator(s[0], o[0], i);
492
+ }
493
+ return i * ("" + e).localeCompare("" + t);
494
+ }
495
+ }
496
+ class B extends Z {
497
+ constructor(e, t, i, s = []) {
498
+ super(e, s, i), this.areaIdent = e, this.rows = t, this.defaultRowHeight = i, this.columnDefs = s, this.sorterService = new ee(), this.service = new Q(), this.properties = s.map((o) => o.property), this.flattenRows = this.service.flattenTree(t), this.filteredFlattenRows = [...this.flattenRows];
499
+ }
500
+ changeColumnOrder(e, t) {
501
+ this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
502
+ }
503
+ recalcVisibleTreeRows() {
504
+ this.filteredFlattenRows = this.service.flattenTree(this.rows);
505
+ }
506
+ getFilteredFlattenRows() {
507
+ return this.filteredFlattenRows;
508
+ }
509
+ getRowCount() {
510
+ let e = 0;
511
+ for (const t of this.filteredFlattenRows)
512
+ this.service.isVisible(t) && e++;
513
+ return e;
514
+ }
515
+ getValueAt(e, t) {
516
+ const i = this.getRowByIndex(e);
517
+ if (i) {
518
+ const s = this.properties[t];
519
+ if (s)
520
+ return s.includes(".") ? this.getPropertyValue(i.data, s.split(".")) : i.data[s];
521
+ }
522
+ return "";
523
+ }
524
+ getRowHeight(e) {
525
+ return this.defaultRowHeight;
526
+ }
527
+ getCustomClassesAt(e, t) {
528
+ return ["ge-table-tree-cell", "ge-table-tree-deep-" + this.filteredFlattenRows[e].deep];
529
+ }
530
+ getRowByIndex(e) {
531
+ return this.filteredFlattenRows[e];
532
+ }
533
+ getValueByT(e, t) {
534
+ return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
535
+ }
536
+ externalFilterChanged(e) {
537
+ this.lastPredictFn = e, this.doFiltering();
538
+ }
539
+ doSort(e) {
540
+ const { columnIndex: t, sortState: i } = e[e.length - 1], s = i === "asc" ? 1 : i === "desc" ? -1 : 0, o = this.properties[t];
541
+ return this.treeSort(this.rows, o, s), this.flattenRows = this.service.flattenTree(this.rows), this.filteredFlattenRows = [...this.flattenRows], !0;
542
+ }
543
+ toggleExpandCollapseAll(e) {
544
+ this.expandAllRecursive(this.rows, e), this.flattenRows = this.service.flattenTree(this.rows), this.doFiltering();
545
+ }
546
+ setAllParentsOk(e) {
547
+ return e.parent && (e.parent.keep = !0, this.setAllParentsOk(e.parent)), !1;
548
+ }
549
+ setValue(e, t, i) {
550
+ var r;
551
+ const s = (r = this.columnDefs[t]) == null ? void 0 : r.editInputPipe;
552
+ s && (i = s(i, e, t));
553
+ const o = this.getRowByIndex(e);
554
+ if (o) {
555
+ const n = o.data, l = this.columnDefs[t].property;
556
+ return l.includes(".") ? this.setPropertyValue(n, l.split("."), i) : (n[l] = i, !0);
557
+ }
558
+ return !1;
559
+ }
560
+ genericTreeTableSortComparator(e, t) {
561
+ return (i, s) => {
562
+ const o = this.getValueByT(i.data, e), r = this.getValueByT(s.data, e);
563
+ return this.sorterService.genericSortComparator(o, r, t);
564
+ };
565
+ }
566
+ expandAllRecursive(e, t) {
567
+ for (const i of e)
568
+ i.expanded = t, i.children && this.expandAllRecursive(i.children, t);
569
+ }
570
+ doFiltering() {
571
+ if (!this.lastPredictFn)
572
+ this.filteredFlattenRows = [...this.flattenRows ? this.flattenRows : []];
573
+ else {
574
+ this.flattenRows || (this.flattenRows = []);
575
+ let e = 0;
576
+ this.flattenRows.forEach((i) => {
577
+ e = Math.max(e, i.deep);
578
+ });
579
+ const t = this.flattenRows.filter(
580
+ (i, s, o) => this.lastPredictFn(i, s, o)
581
+ );
582
+ this.flattenRows.forEach((i) => i.keep = !1), this.flattenRows.forEach((i) => {
583
+ t.includes(i) && (i.keep = !0, this.setAllParentsOk(i));
584
+ }), this.filteredFlattenRows = this.flattenRows.filter(
585
+ (i, s, o) => i.keep
586
+ );
587
+ }
588
+ }
589
+ getPropertyValue(e, t) {
590
+ const i = t.shift();
591
+ let s = e[i];
592
+ return s && t.length ? this.getPropertyValue(s, t) : s;
593
+ }
594
+ treeSort(e, t, i) {
595
+ e.sort(this.genericTreeTableSortComparator(t, i));
596
+ for (const s of e)
597
+ s.children && this.treeSort(s.children, t, i);
598
+ }
599
+ }
600
+ class H {
601
+ constructor(e) {
602
+ this.getStorageKeyFn = e;
603
+ }
604
+ autoConvertMapToObject(e) {
605
+ const t = {};
606
+ if (e instanceof Map) {
607
+ const i = e;
608
+ for (const s of [...i]) {
609
+ const [
610
+ o,
611
+ r
612
+ ] = s;
613
+ t[o] = r;
614
+ }
615
+ }
616
+ return t;
617
+ }
618
+ checkAndPersistItem(e, t) {
619
+ const i = this.getStorageKeyFn;
620
+ if (i) {
621
+ const s = i();
622
+ if (s) {
623
+ const o = s + e;
624
+ if ((t + "").includes("Map")) {
625
+ const r = this.autoConvertMapToObject(t);
626
+ this.persistItem(o, r);
627
+ } else
628
+ this.persistItem(o, t);
629
+ }
630
+ }
631
+ }
632
+ persistItem(e, t) {
633
+ t ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
634
+ }
635
+ loadFromLocalStorage(e) {
636
+ const t = localStorage.getItem(e);
637
+ return t ? JSON.parse(t) : null;
638
+ }
639
+ // private loadItems() {
640
+ // const fn = this.getStorageKeyFn;
641
+ // if (fn) {
642
+ // const key = fn();
643
+ // if (key) {
644
+ // // A main key is given by function from options
645
+ // const subKey = key + this.CHECKED_STATE;
646
+ // const arr = this.loadFromLocalStorage<Array<string | number>>(subKey);
647
+ // if (arr) {
648
+ // this.checkedStateIds.length = 0;
649
+ // arr.forEach(a => this.checkedStateIds.push(a));
650
+ // }
651
+ //
652
+ // const subKey2 = key + this.COLLAPSED_EXPANDED_STATE;
653
+ // const data = this.loadFromLocalStorage<CollapsedExpandedData>(subKey2);
654
+ // if (data) {
655
+ // this.collapsedExpandedState = data;
656
+ // }
657
+ //
658
+ // const subKey3 = key + this.SELECTED_STATE;
659
+ // const arr3 = this.loadFromLocalStorage<object>(subKey3);
660
+ // if (arr3) {
661
+ // const map: Map<string | number, string[]> = new Map(Object.entries(arr3));
662
+ // if (map) {
663
+ // this.selectedStateIds.clear();
664
+ // map.forEach((col, k) => this.selectedStateIds.set(k, col));
665
+ // }
666
+ // }
667
+ //
668
+ // const subKey4 = key + this.SCROLL_STATE;
669
+ // let scrollOffset = this.loadFromLocalStorage<[number, number]>(subKey4);
670
+ // this.scrollOffset = scrollOffset ? scrollOffset : [0, 0];
671
+ // }
672
+ // }
673
+ // }
674
+ }
675
+ class te extends H {
676
+ constructor(e) {
677
+ super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
678
+ }
679
+ getScrollOffset() {
680
+ return this.scrollOffset;
681
+ }
682
+ updateScrollOffset(e) {
683
+ this.scrollOffset = e, this.checkAndPersistItem(this.SCROLL_STATE, this.scrollOffset);
684
+ }
685
+ load() {
686
+ const e = this.getStorageKeyFn;
687
+ if (e) {
688
+ const t = e();
689
+ if (t) {
690
+ const i = t + this.SCROLL_STATE;
691
+ let s = this.loadFromLocalStorage(i);
692
+ this.scrollOffset = s || [0, 0];
693
+ }
694
+ }
695
+ }
696
+ }
697
+ class ie {
698
+ constructor(e = "collapsed", t = [], i = !1, s = !1) {
699
+ this.mode = e, this.rowIds = t, this.allCollapsed = i, this.allExpanded = s;
700
+ }
701
+ }
702
+ class se extends H {
703
+ constructor(e) {
704
+ super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new ie(), this.load();
705
+ }
706
+ collapsedExpandedStateGet() {
707
+ return this.collapsedExpandedState;
708
+ }
709
+ collapsedExpandedStateIncludes(e) {
710
+ return this.collapsedExpandedState.rowIds.includes(e);
711
+ }
712
+ collapsedStateIdsPush(e) {
713
+ this.collapsedExpandedState.rowIds.includes(e) || (this.collapsedExpandedState.rowIds.push(e), this.collapsedExpandedState.allCollapsed = !1, this.collapsedExpandedState.allExpanded = !1, this.persist());
714
+ }
715
+ collapsedStateIdsRemove(e) {
716
+ const t = this.collapsedExpandedState.rowIds.indexOf(e);
717
+ t !== -1 && (this.collapsedExpandedState.rowIds.splice(t, 1), this.collapsedExpandedState.allCollapsed = !1, this.collapsedExpandedState.allExpanded = !1, this.persist());
718
+ }
719
+ collapsedStateAll(e) {
720
+ this.collapsedExpandedState.rowIds = [], this.collapsedExpandedState.mode = e ? "collapsed" : "expanded", this.collapsedExpandedState.allCollapsed = !e, this.collapsedExpandedState.allExpanded = e, this.persist();
721
+ }
722
+ load() {
723
+ const e = this.getStorageKeyFn;
724
+ if (e) {
725
+ const t = e();
726
+ if (t) {
727
+ const i = t + this.COLLAPSED_EXPANDED_STATE, s = this.loadFromLocalStorage(i);
728
+ s && (this.collapsedExpandedState = s);
729
+ }
730
+ }
731
+ }
732
+ persist() {
733
+ this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
734
+ }
735
+ }
736
+ class oe extends H {
737
+ constructor(e) {
738
+ super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
739
+ }
740
+ getSortItems() {
741
+ return this.sortItems;
742
+ }
743
+ setSortItems(e) {
744
+ this.sortItems = e, this.checkAndPersistItem(this.SORTING_STATE, this.sortItems);
745
+ }
746
+ load() {
747
+ const e = this.getStorageKeyFn;
748
+ if (e) {
749
+ const t = e();
750
+ if (t) {
751
+ const i = t + this.SORTING_STATE;
752
+ let s = this.loadFromLocalStorage(i);
753
+ this.sortItems = s || [];
754
+ }
755
+ }
756
+ }
757
+ }
758
+ class T {
759
+ constructor(e = 0, t = 0, i = 0, s = 0, o) {
760
+ this.left = e, this.width = t, this.height = i, this.top = s, this.index = o;
761
+ }
762
+ }
763
+ class re {
764
+ constructor(e, t, i, s) {
765
+ this.hostElement = e, this.tableModel = t, this.dom = i, this.tableOptions = s, this.scrollTop = 0, this.areaBodyWestGeo = new T(), this.areaBodyCenterGeo = new T(), this.areaBodyEastGeo = new T();
766
+ const o = this.hostElement;
767
+ o.innerText = "", this.dom.setAttribute(o, "tabindex", "0"), this.dom.setStyle(
768
+ this.dom.addClass("ge-table", o),
769
+ "position",
770
+ "relative"
771
+ ), this.hoverRow = i.applyStylePosistionAbsolute(
772
+ i.createDivWithClass("ge-table-hover-row", o)
773
+ ), this.hoverColumn = i.applyStylePosistionAbsolute(
774
+ i.createDivWithClass("ge-table-hover-column", o)
775
+ ), this.areaHeaderWest = i.appendRelativeChildDiv(
776
+ i.applyStylePosistionAbsolute(
777
+ i.createAreaDivWithClass("ge-table-header ge-table-header-west", o, "header", "west")
778
+ )
779
+ ), this.areaHeaderCenter = i.appendRelativeChildDiv(
780
+ i.applyStylePosistionAbsolute(
781
+ i.createAreaDivWithClass("ge-table-header ge-table-header-center", o, "header", "center")
782
+ )
783
+ ), this.areaHeaderEast = i.appendRelativeChildDiv(
784
+ i.applyStylePosistionAbsolute(
785
+ i.createAreaDivWithClass("ge-table-header ge-table-header-east", o, "body", "east")
786
+ )
787
+ ), this.areaBodyWest = i.appendRelativeChildDiv(
788
+ i.applyStylePosistionAbsolute(
789
+ i.createAreaDivWithClass("ge-table-body ge-table-body-west", o, "body", "west")
790
+ )
791
+ ), this.areaBodyEast = i.appendRelativeChildDiv(
792
+ i.applyStylePosistionAbsolute(
793
+ i.createAreaDivWithClass("ge-table-body ge-table-body-east", o, "body", "east")
794
+ )
795
+ ), this.areaFooterWest = i.appendRelativeChildDiv(
796
+ i.applyStylePosistionAbsolute(
797
+ i.createAreaDivWithClass("ge-table-footer ge-table-footer-west", o, "footer", "west")
798
+ )
799
+ ), this.areaFooterCenter = i.appendRelativeChildDiv(
800
+ i.applyStylePosistionAbsolute(
801
+ i.createAreaDivWithClass("ge-table-footer ge-table-footer-center", o, "footer", "center")
802
+ )
803
+ ), this.areaFooterEast = i.appendRelativeChildDiv(
804
+ i.applyStylePosistionAbsolute(
805
+ i.createAreaDivWithClass("ge-table-footer ge-table-footer-east", o, "footer", "east")
806
+ )
807
+ ), this.scrollViewport = i.applyStyleOverflowAuto(
808
+ this.tableOptions.overflowX ?? "auto",
809
+ this.tableOptions.overflowY ?? "auto",
810
+ i.applyStyleNoPadding(
811
+ i.applyStylePosistionAbsolute(
812
+ i.createAreaDivWithClass("ge-table-scroll-viewport", o, "body", "center")
813
+ )
814
+ )
815
+ ), this.contentWrapperDiv = i.applyStyleNoPadding(
816
+ i.applyStylePosistionRelative(
817
+ i.createDivWithClass("ge-table-scroll-content-wrapper", this.scrollViewport)
818
+ )
819
+ ), this.contentDiv = i.applyStyleNoPadding(
820
+ i.applyStylePosistionRelative(
821
+ i.createDivWithClass("ge-table-scroll-content", this.contentWrapperDiv)
822
+ )
823
+ ), this.areaBodyCenter = i.appendRelativeChildDiv(
824
+ i.createDivWithClass("ge-table-body-center", this.contentDiv)
825
+ ), this.borderHeaderBottom = i.applyStylePosistionAbsolute(
826
+ i.createDivWithClass("ge-table-header-border", o)
827
+ ), this.borderFixedWest = i.applyStylePosistionAbsolute(
828
+ i.createDivWithClass("ge-table-west-fixed-column-border", o)
829
+ ), this.borderFixedEast = i.applyStylePosistionAbsolute(
830
+ i.createDivWithClass("ge-table-east-fixed-column-border", o)
831
+ ), this.borderFooterTop = i.applyStylePosistionAbsolute(
832
+ i.createDivWithClass("ge-table-footer-border", o)
833
+ );
834
+ }
835
+ adjustContainersAndRows() {
836
+ const e = this.tableModel.getPadding(), t = this.hostElement.clientWidth, i = this.hostElement.clientHeight;
837
+ this.dom.applyStyle(this.scrollViewport, {
838
+ width: `${t - e.left}px`,
839
+ height: `${i - e.top}px`,
840
+ top: `${e.top}px`,
841
+ left: `${e.left}px`
842
+ }), this.scrollTop = this.scrollViewport.scrollTop, this.dom.applyStyle(this.contentDiv, {
843
+ width: `${this.scrollViewport.clientWidth}px`,
844
+ height: `${this.scrollViewport.clientHeight}px`,
845
+ top: `${this.scrollTop}px`,
846
+ left: `${this.scrollViewport.scrollLeft}px`
847
+ }), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height = i - 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(
848
+ this.dom.applyStyle(this.borderFixedWest, {
849
+ width: "1px",
850
+ height: `${this.areaBodyWestGeo.height}px`,
851
+ top: `${this.areaBodyWestGeo.top}px`,
852
+ left: `${this.areaBodyWestGeo.width}px`
853
+ })
854
+ ) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height = i - 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(
855
+ this.dom.applyStyle(this.borderFixedEast, {
856
+ width: "1px",
857
+ height: `${this.areaBodyEastGeo.height}px`,
858
+ top: `${this.areaBodyEastGeo.top}px`,
859
+ left: `${this.areaBodyEastGeo.left}px`
860
+ })
861
+ ) : this.dom.applyDisplayNoneStyle(this.borderFixedEast), this.areaBodyCenterGeo.width = t - e.left - e.right, this.areaBodyCenterGeo.height = i - 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, {
862
+ width: `${t - e.left - e.right}px`,
863
+ height: `${e.top}px`,
864
+ top: "0",
865
+ left: `${e.left}px`
866
+ }), this.dom.applyStyle(this.areaHeaderWest.parent, {
867
+ width: `${e.left}px`,
868
+ height: `${e.top}px`,
869
+ top: "0",
870
+ left: "0"
871
+ }), this.dom.applyStyle(this.areaHeaderEast.parent, {
872
+ width: `${e.right}px`,
873
+ height: `${e.top}px`,
874
+ top: "0",
875
+ left: `${t - e.right}px`
876
+ }), this.tableOptions.headerSeparatorBorderVisible && this.tableModel.isHeaderVisibe() ? this.dom.applyDisplayBlockStyle(
877
+ this.dom.applyStyle(this.borderHeaderBottom, {
878
+ width: `${t}px`,
879
+ height: "1px",
880
+ top: `${e.top}px`,
881
+ left: "0px"
882
+ })
883
+ ) : this.dom.applyDisplayNoneStyle(this.borderHeaderBottom), this.dom.applyStyle(this.areaFooterWest.parent, {
884
+ width: `${e.left}px`,
885
+ height: `${e.bottom}px`,
886
+ top: `${i - e.bottom}px`,
887
+ left: "0"
888
+ }), this.dom.applyStyle(this.areaFooterCenter.parent, {
889
+ width: `${t - e.left - e.right}px`,
890
+ height: `${e.bottom}px`,
891
+ top: `${i - e.bottom}px`,
892
+ left: `${e.left}px`
893
+ }), this.dom.applyStyle(this.areaFooterEast.parent, {
894
+ width: `${e.right}px`,
895
+ height: `${e.bottom}px`,
896
+ top: `${i - e.bottom}px`,
897
+ left: `${t - e.right}px`
898
+ }), this.tableOptions.footerSeparatorBorderVisible && this.tableModel.isFooterVisibe() ? this.dom.applyDisplayBlockStyle(
899
+ this.dom.applyStyle(this.borderFooterTop, {
900
+ width: `${t}px`,
901
+ height: "1px",
902
+ top: `${i - e.bottom}px`,
903
+ left: "0px"
904
+ })
905
+ ) : this.dom.applyDisplayNoneStyle(this.borderFooterTop), this.adjustAfterScrolling();
906
+ }
907
+ adjustAfterScrolling() {
908
+ }
909
+ resetSizeOfWrapperDiv() {
910
+ const e = `${this.tableModel.getContentWidthInPixel()}px`, t = `${this.tableModel.getContentHeightInPixel() + 1}px`;
911
+ this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
912
+ }
913
+ }
914
+ class A {
915
+ constructor(e, t, i, s, o = !1) {
916
+ this.r1 = e, this.c1 = t, this.r2 = i, this.c2 = s, this.gammaRange = o;
917
+ }
918
+ static create(e) {
919
+ return e.gammaRange === void 0 && (e.gammaRange = !1), new A(
920
+ e.rowIndex1,
921
+ e.columnIndex1,
922
+ e.rowIndex2,
923
+ e.columnIndex2,
924
+ e.gammaRange
925
+ );
926
+ }
927
+ static singleCell(e, t) {
928
+ return new A(e, t, e, t);
929
+ }
930
+ static singleRow(e) {
931
+ return new A(e, 0, e, Number.MAX_SAFE_INTEGER);
932
+ }
933
+ static singleColumn(e) {
934
+ return new A(0, e, Number.MAX_SAFE_INTEGER, e);
935
+ }
936
+ isInRange(e, t) {
937
+ return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
938
+ }
939
+ }
940
+ class le {
941
+ constructor(e, t) {
942
+ this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
943
+ }
944
+ init() {
945
+ if (this.areaModel.getMaxColspan() < 2 && this.areaModel.getMaxRowspan() < 2)
946
+ return;
947
+ this.colAndRowspanRanges = [];
948
+ const e = this.areaModel.getRowCount(), t = this.tableModel.getColumnCount();
949
+ for (let i = 0; i < e; i++)
950
+ for (let s = 0; s < t; s++) {
951
+ let o = this.areaModel.getColspanAt(i, s), r = this.areaModel.getRowspanAt(i, s);
952
+ if (o > 1 || r > 1) {
953
+ o === 0 && (o = 1), r === 0 && (r = 1);
954
+ const n = this.areaModel.hasOwnProperty("gammaCells");
955
+ this.colAndRowspanRanges.push(
956
+ new A(i, s, i + r - 1, s + o - 1, n)
957
+ );
958
+ }
959
+ }
960
+ }
961
+ getRanges() {
962
+ return this.colAndRowspanRanges ? this.colAndRowspanRanges : [];
963
+ }
964
+ isInRange(e, t) {
965
+ if (this.colAndRowspanRanges) {
966
+ for (const i of this.colAndRowspanRanges)
967
+ if (i.isInRange(e, t))
968
+ return !0;
969
+ }
970
+ return !1;
971
+ }
972
+ }
973
+ class ne {
974
+ constructor(e, t, i) {
975
+ this.header = e, this.body = t, this.footer = i;
976
+ }
977
+ }
978
+ class ae extends re {
979
+ constructor(e, t, i, s) {
980
+ var r, n;
981
+ super(e, t, i, s), this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
982
+ header: [],
983
+ body: [],
984
+ footer: []
985
+ }, this.tree = !1, this.colAndRowspanModels = new ne(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.editing = !1, this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (n = this.tableOptions) != null && n.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), t.getAreaModel("body") instanceof B && (this.tree = !0), ["header", "body", "footer"].forEach(
986
+ (l) => {
987
+ var a;
988
+ this.colAndRowspanModels[l] = new le(t, t.getAreaModel(l)), (a = this.colAndRowspanModels[l]) == null || a.init();
989
+ }
990
+ );
991
+ }
992
+ isEditing() {
993
+ return this.editing;
994
+ }
995
+ resetEditorRenderer() {
996
+ this.editorRenderer = void 0, this.editorRendererRow = -1, this.editorRendererColumn = -1, this.editing = !1;
997
+ }
998
+ clearSelection() {
999
+ if (this.getSelectionModel) {
1000
+ const e = this.getSelectionModel();
1001
+ e == null || e.clear();
1002
+ }
1003
+ }
1004
+ initRenderEditor(e, t) {
1005
+ var s;
1006
+ let i = (s = this.tableModel.getColumnDef(t)) == null ? void 0 : s.getEditRenderer;
1007
+ if (i || (i = this.tableOptions.getEditRenderer), i)
1008
+ if (this.editorRenderer = i(e, t), this.editorRenderer) {
1009
+ this.editorRendererRow = e, this.editorRendererColumn = t, this.editing = !0, this.repaint();
1010
+ const o = document.querySelector("input.ge-table-cell-editor-input");
1011
+ o && o.focus();
1012
+ } else
1013
+ this.resetEditorRenderer();
1014
+ }
1015
+ repaint() {
1016
+ this.adjustAfterScrolling();
1017
+ }
1018
+ adjustAfterScrolling() {
1019
+ var e;
1020
+ for (const t of this.removables)
1021
+ t.remove();
1022
+ 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(
1023
+ new T(0, this.hostElement.clientWidth, 1, 0),
1024
+ this.hostElement,
1025
+ "ge-table-border"
1026
+ )), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
1027
+ new T(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
1028
+ this.hostElement,
1029
+ "ge-table-border"
1030
+ )), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
1031
+ new T(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
1032
+ this.hostElement,
1033
+ "ge-table-body-west-vertical-border"
1034
+ )), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
1035
+ new T(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
1036
+ this.hostElement,
1037
+ "ge-table-body-west-vertical-border"
1038
+ ));
1039
+ }
1040
+ checkForScrollPosSaving() {
1041
+ var e, t;
1042
+ this.storeScrollPosStateService && ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreScrollPosition) && this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
1043
+ }
1044
+ updateCells(e) {
1045
+ e.forEach(
1046
+ (t) => this.tableModel.getAreaModel(t.area).setValue(t.rowIndex, t.columnIndex, t.value)
1047
+ ), this.repaint();
1048
+ }
1049
+ getAreaAndSideIdentByAttr(e) {
1050
+ if (e) {
1051
+ const t = this.getStringByAttr(e, "data-area"), i = this.getStringByAttr(e, "data-side");
1052
+ if (i && t)
1053
+ return [t, i];
1054
+ }
1055
+ return [void 0, void 0];
1056
+ }
1057
+ getArea(e, t) {
1058
+ if (e === "header") {
1059
+ if (t === "west")
1060
+ return this.areaHeaderWest;
1061
+ if (t === "center")
1062
+ return this.areaHeaderCenter;
1063
+ if (t === "east")
1064
+ return this.areaHeaderEast;
1065
+ } else if (e === "body") {
1066
+ if (t === "west")
1067
+ return this.areaBodyWest;
1068
+ if (t === "center")
1069
+ return this.areaBodyCenter;
1070
+ if (t === "east")
1071
+ return this.areaBodyEast;
1072
+ } else if (e === "footer") {
1073
+ if (t === "west")
1074
+ return this.areaFooterWest;
1075
+ if (t === "center")
1076
+ return this.areaFooterCenter;
1077
+ if (t === "east")
1078
+ return this.areaFooterEast;
1079
+ }
1080
+ throw Error(`Wrong area identifier: row:${e}, col:${t}`);
1081
+ }
1082
+ adjustBody() {
1083
+ const e = this.areaBodyCenterGeo.height - this.tableModel.getContentHeightInPixel(), t = this.scrollFactorY * e;
1084
+ this.dom.setStyle(this.contentDiv, "top", `${this.scrollTop}px`), this.dom.setStyle(this.contentDiv, "left", `${this.scrollViewport.scrollLeft}px`), this.adjustArea("body", t);
1085
+ }
1086
+ getNumberByAttr(e, t) {
1087
+ var i;
1088
+ if (e) {
1089
+ const s = (i = e.closest("[" + t + "]")) == null ? void 0 : i.getAttribute(t);
1090
+ if (s)
1091
+ return Number(s);
1092
+ }
1093
+ return -1;
1094
+ }
1095
+ getStringByAttr(e, t) {
1096
+ var i;
1097
+ if (e) {
1098
+ const s = (i = e.closest("[" + t + "]")) == null ? void 0 : i.getAttribute(t);
1099
+ if (s)
1100
+ return s;
1101
+ }
1102
+ return "";
1103
+ }
1104
+ adjustArea(e, t = 0) {
1105
+ var h;
1106
+ const i = this.getArea(e, "west"), s = this.getArea(e, "center"), o = this.getArea(e, "east"), r = s.child.clientHeight;
1107
+ i.child.innerText = "", s.child.innerText = "", o.child.innerText = "";
1108
+ const n = 0, l = this.areaBodyCenterGeo.width, a = this.tableModel.getPadding(), d = this.tableModel.getAreaModel(e), S = d.getRowCount();
1109
+ for (; this.cleanupFunctions[e].length; ) {
1110
+ const u = this.cleanupFunctions[e].shift();
1111
+ u && u();
1112
+ }
1113
+ let g = t;
1114
+ const f = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
1115
+ for (let u = 0; u < S; u++) {
1116
+ const v = g, x = u === S - 1, C = this.tableModel.getRowHeight(e, u);
1117
+ if (v + C > 0) {
1118
+ this.firstVisibleRowIndex = u;
1119
+ let w = { left: n, width: l, height: C, top: v, index: u }, m = this.dom.addRowDiv(s, w, u, e, "center");
1120
+ const M = b;
1121
+ if (this.adjustColumnsToRowParent({
1122
+ areaIdent: e,
1123
+ sideIdent: "center",
1124
+ areaModel: d,
1125
+ geo: w,
1126
+ parent: m,
1127
+ rowIndex: u,
1128
+ columnIndexStart: M,
1129
+ columnIndexEnd: f - c - 1,
1130
+ verticalFixed: !1,
1131
+ lastRowOfModel: x
1132
+ }), a.left > 0 && (w = { left: n, width: this.areaBodyWestGeo.width, height: C, top: v, index: u }, m = this.dom.addRowDiv(i, w, u, e, "west"), this.adjustColumnsToRowParent({
1133
+ areaIdent: e,
1134
+ sideIdent: "west",
1135
+ areaModel: d,
1136
+ geo: w,
1137
+ parent: m,
1138
+ rowIndex: u,
1139
+ columnIndexStart: 0,
1140
+ columnIndexEnd: M - 1,
1141
+ verticalFixed: !0,
1142
+ lastRowOfModel: x
1143
+ })), a.right > 0 && (w = { left: n, width: this.areaBodyEastGeo.width, height: C, top: v, index: u }, m = this.dom.addRowDiv(o, w, u, e, "east"), this.adjustColumnsToRowParent({
1144
+ areaIdent: e,
1145
+ sideIdent: "east",
1146
+ areaModel: d,
1147
+ geo: w,
1148
+ parent: m,
1149
+ rowIndex: u,
1150
+ columnIndexStart: f - c,
1151
+ columnIndexEnd: f - 1,
1152
+ verticalFixed: !0,
1153
+ lastRowOfModel: x
1154
+ })), e === "header" && this.tree && u === S - 1) {
1155
+ const E = this.dom.applyStyle(
1156
+ this.dom.setAttribute(
1157
+ this.dom.addDiv(m, new T(16, 20, 20, 8)),
1158
+ "data-ge-action",
1159
+ "toggleExpandCollapseAll"
1160
+ ),
1161
+ { cursor: "pointer" }
1162
+ ), R = this.tableOptions.treeOptions.arrowExpandCollapseAll;
1163
+ if (R) {
1164
+ const D = this.dom.domService.createText(R.content);
1165
+ this.dom.domService.appendChild(E, D), R.style && this.dom.applyStyleString(E, R.style);
1166
+ }
1167
+ }
1168
+ }
1169
+ if (g = g + C, g > r)
1170
+ break;
1171
+ }
1172
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
1173
+ const u = ((h = this.colAndRowspanModels[e]) == null ? void 0 : h.getRanges()) ?? [];
1174
+ if (u.length)
1175
+ for (const v of u) {
1176
+ let x = 0, C = s.child, w = "center";
1177
+ if (v.c1 < b)
1178
+ C = i.child, w = "west";
1179
+ else if (c > 0 && v.c1 >= f - c)
1180
+ C = o.child, w = "east";
1181
+ else {
1182
+ const m = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1183
+ x = this.scrollFactorX * m - this.areaBodyWestGeo.width, w = "center";
1184
+ }
1185
+ this.drawBigCell(v, x, t, d, C, w);
1186
+ }
1187
+ }
1188
+ }
1189
+ /**
1190
+ * Draws big cells (rowspan and or colspan) in body/center
1191
+ * @param range CellRange
1192
+ * @param xStart X position in pixel for top left corner
1193
+ * @param yStart Y position in pixel for top left corner
1194
+ * @param areaModel AreaModelIf
1195
+ * @param parentDiv Parent div as HTMLDivElement
1196
+ * @param sideIdent SideIdent (west,center,east)
1197
+ * @protected
1198
+ */
1199
+ drawBigCell(e, t, i, s, o, r) {
1200
+ const n = i + this.getRowHeights(0, e.r1 - 1, s).reduce((h, u) => h + u, 0), l = this.tableModel.getColumnCount(), a = this.tableModel.getFixedRightColumnCount();
1201
+ let d = 0;
1202
+ a > 0 && e.c1 >= l - a && (d = l - a);
1203
+ const S = t + this.getColumnWidths(d, e.c1 - 1).reduce((h, u) => h + u, 0), g = this.getRowHeights(e.r1, e.r2, s).reduce((h, u) => h + u, 0), f = this.getColumnWidths(e.c1, e.c2).reduce((h, u) => h + u, 0);
1204
+ let c = !1;
1205
+ const b = this.getSelectionModel ? this.getSelectionModel() : void 0;
1206
+ b && (c = b.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? (console.info("TODO here", e), this.renderCell({
1207
+ areaModel: s,
1208
+ areaIdent: s.areaIdent,
1209
+ sideIdent: r,
1210
+ rowIndex: e.r1,
1211
+ columnIndex: e.c1,
1212
+ left: S,
1213
+ top: n,
1214
+ width: f,
1215
+ height: g,
1216
+ parent: o,
1217
+ cellSelected: c,
1218
+ lastRowOfModel: !0,
1219
+ gammaRange: e.gammaRange
1220
+ })) : this.renderCell({
1221
+ areaModel: s,
1222
+ areaIdent: s.areaIdent,
1223
+ sideIdent: r,
1224
+ rowIndex: e.r1,
1225
+ columnIndex: e.c1,
1226
+ left: S,
1227
+ top: n,
1228
+ width: f,
1229
+ height: g,
1230
+ parent: o,
1231
+ cellSelected: c,
1232
+ lastRowOfModel: !0,
1233
+ gammaRange: e.gammaRange
1234
+ }), s.areaIdent === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
1235
+ rowIndex: e.r1,
1236
+ columnIndex: e.c1,
1237
+ cellLeft: S,
1238
+ cellTop: n,
1239
+ cellWidth: f,
1240
+ cellHeight: g,
1241
+ parent: o
1242
+ });
1243
+ }
1244
+ findRowOfImportantRowspanCell(e, t, i) {
1245
+ const s = e.getMaxRowspan();
1246
+ for (let o = t - 1; o > -1; o--) {
1247
+ const r = e.getRowspanAt(o, i);
1248
+ if (r > 1 && o + r + 1 >= t)
1249
+ return o;
1250
+ if (t - o > s)
1251
+ return -1;
1252
+ }
1253
+ return -1;
1254
+ }
1255
+ adjustColumnsToRowParent({
1256
+ areaIdent: e,
1257
+ sideIdent: t,
1258
+ areaModel: i,
1259
+ geo: s,
1260
+ parent: o,
1261
+ rowIndex: r,
1262
+ columnIndexStart: n,
1263
+ columnIndexEnd: l,
1264
+ verticalFixed: a = !1,
1265
+ lastRowOfModel: d = !1
1266
+ }) {
1267
+ var b;
1268
+ this.scrollViewportLeft = this.scrollViewport.scrollLeft;
1269
+ let S = 0;
1270
+ if (!a) {
1271
+ const h = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1272
+ S = this.scrollFactorX * h;
1273
+ }
1274
+ const g = 0, f = !!(e === "body" && t);
1275
+ let c = S;
1276
+ for (let h = n; h <= l; h++) {
1277
+ const u = c, v = this.tableModel.getColumnWidth(h);
1278
+ if (v > 0 && u + v > 0) {
1279
+ let x = s.height;
1280
+ const C = i.getRowspanAt(r, h), w = i.getColspanAt(r, h);
1281
+ C > 1 && (x = this.getRowHeights(r, r + C - 1, i).reduce((E, R) => E + R, 0));
1282
+ let m = v;
1283
+ w > 1 && (m = this.getColumnWidths(h, h + w - 1).reduce((E, R) => E + R, 0));
1284
+ let M = !1;
1285
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r, h) && (M = !0), this.draggingTargetColumnIndex === h && e !== "header") {
1286
+ this.renderDragTargetDiv(o, u, g, m, x);
1287
+ const E = { left: u, top: g, width: m, height: x };
1288
+ this.dom.addColumnBorderDivs(this.tableOptions, o, E, e, t);
1289
+ } else {
1290
+ const E = this.renderSelectedBackgroundDiv(M, f, t, i, r, h, o, u, g, m, x);
1291
+ M || this.renderCell({
1292
+ areaModel: i,
1293
+ areaIdent: e,
1294
+ sideIdent: t,
1295
+ rowIndex: r,
1296
+ columnIndex: h,
1297
+ left: u,
1298
+ top: g,
1299
+ width: m,
1300
+ height: x,
1301
+ parent: o,
1302
+ cellSelected: E,
1303
+ lastRowOfModel: d,
1304
+ gammaRange: !0
1305
+ }), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
1306
+ rowIndex: r,
1307
+ columnIndex: h,
1308
+ cellLeft: u,
1309
+ cellTop: g,
1310
+ cellWidth: m,
1311
+ cellHeight: x,
1312
+ parent: o
1313
+ });
1314
+ }
1315
+ }
1316
+ if (c = c + v, c > this.areaBodyCenterGeo.width)
1317
+ break;
1318
+ }
1319
+ this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(c - 1, 1, s.height, 0), o);
1320
+ }
1321
+ getTreeArrowColumnIndex() {
1322
+ return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
1323
+ }
1324
+ addAndRenderCellDiv({
1325
+ areaModel: e,
1326
+ areaIdent: t,
1327
+ sideIdent: i,
1328
+ rowIndex: s,
1329
+ index: o,
1330
+ left: r,
1331
+ width: n,
1332
+ height: l,
1333
+ top: a,
1334
+ parent: d,
1335
+ lastRowOfModel: S
1336
+ }) {
1337
+ var W;
1338
+ const f = this.editorRenderer && this.editorRendererRow === s && this.editorRendererColumn === o ? this.editorRenderer : e.getCellRenderer(s, o), c = { left: r, width: n, height: l, top: a, index: o }, b = e.getRowByIndex(s);
1339
+ let h = "none";
1340
+ if (o === this.getTreeArrowColumnIndex() && b instanceof L) {
1341
+ const y = b;
1342
+ (W = y.children) != null && W.length ? y.expanded ? h = "expanded" : h = "collapsed" : h = "hidden";
1343
+ }
1344
+ let v;
1345
+ if (t === "header") {
1346
+ const y = this.tableModel.getColumnDef(o);
1347
+ (!(y != null && y.sortIconVisible) || y != null && y.sortIconVisible()) && (v = y == null ? void 0 : y.sortState);
1348
+ }
1349
+ const x = e.getValueAt(s, o), C = f ? "" : `${x}`, w = e.isRowChecked(s), m = this.dom.addColumnDiv(
1350
+ d,
1351
+ c,
1352
+ s,
1353
+ o,
1354
+ t,
1355
+ i,
1356
+ C,
1357
+ h,
1358
+ this.tableOptions,
1359
+ w,
1360
+ v
1361
+ ), M = e.getTooltipAt(s, o);
1362
+ M && this.dom.setAttribute(m, "title", M);
1363
+ const E = this.tableModel.getColumnDef(o);
1364
+ E && E.classes[t] && this.dom.addClasses(E.classes[t], m);
1365
+ let R;
1366
+ f && (R = f.render(m, s, o, t, e, x, this.dom.domService));
1367
+ const D = e.getCustomClassesAt(s, o);
1368
+ if (D.length && this.dom.addClasses(D, m), this.dom.addColumnBorderDivs(this.tableOptions, d, c, t, i), S && this.dom.addHorizontalBorder({ left: r, width: n, height: l, top: a + l }, d), this.getFocusModel && t === "body") {
1369
+ const y = this.getFocusModel();
1370
+ y != null && y.hasFocus(s, o) && this.dom.addFocusBorderDivs(d, c, {});
1371
+ }
1372
+ t === "header" && this.dom.setAttribute(m, "data-ge-action", "drag-column");
1373
+ const O = e.getCustomStyleAt(s, o);
1374
+ if (O)
1375
+ for (const y in O)
1376
+ this.dom.setStyle(m, y, O[y]);
1377
+ return [m, R];
1378
+ }
1379
+ getColumnWidths(e, t) {
1380
+ const i = [];
1381
+ for (let s = e; s <= t; s++)
1382
+ i.push(this.tableModel.getColumnWidth(s));
1383
+ return i;
1384
+ }
1385
+ getRowHeights(e, t, i) {
1386
+ const s = [];
1387
+ for (let o = e; o <= t; o++)
1388
+ s.push(i.getRowHeight(o));
1389
+ return s;
1390
+ }
1391
+ adjustHoverRows(e) {
1392
+ if (this.tableOptions.hoverRowVisible && e.rowIndex > -1) {
1393
+ const t = this.hostElement.clientWidth, i = this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex), s = e.rowTop + this.areaHeaderCenter.parent.clientHeight - this.scrollTop;
1394
+ this.dom.applyStyle(this.hoverRow, {
1395
+ left: "0",
1396
+ top: s + "px",
1397
+ width: t + "px",
1398
+ height: i + "px",
1399
+ display: "block"
1400
+ });
1401
+ } else
1402
+ this.hideHoverRow();
1403
+ }
1404
+ hideHoverRow() {
1405
+ this.dom.applyStyle(this.hoverRow, {
1406
+ display: "none"
1407
+ });
1408
+ }
1409
+ adjustHoverColumns(e) {
1410
+ if (this.tableOptions.hoverColumnVisible && e.rowIndex > -1) {
1411
+ const t = this.hostElement.clientHeight, i = this.tableModel.getColumnWidth(e.columnIndex), s = this.areaBodyWestGeo.width, o = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - s;
1412
+ this.dom.applyStyle(this.hoverColumn, {
1413
+ left: o + "px",
1414
+ top: "0px",
1415
+ width: i + "px",
1416
+ height: t + "px",
1417
+ display: "block"
1418
+ });
1419
+ } else
1420
+ this.hideHoverColumn();
1421
+ }
1422
+ hideHoverColumn() {
1423
+ this.dom.applyStyle(this.hoverColumn, {
1424
+ display: "none"
1425
+ });
1426
+ }
1427
+ debounce(e, t = 1e3) {
1428
+ this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e.bind(this), t);
1429
+ }
1430
+ renderDragTargetDiv(e, t, i, s, o) {
1431
+ const r = this.dom.applyStylePosistionAbsolute(
1432
+ this.dom.createDivWithClass("ge-table-drop-zone", e)
1433
+ );
1434
+ return this.dom.setStyle(r, "left", `${t}px`), this.dom.setStyle(r, "top", `${i}px`), this.dom.setStyle(r, "width", `${s}px`), this.dom.setStyle(r, "height", `${o}px`), r;
1435
+ }
1436
+ renderSelectedBackgroundDiv(e, t, i, s, o, r, n, l, a, d, S) {
1437
+ let g = !1;
1438
+ if (!e && t && s.isSelectable(o, r) && this.getSelectionModel) {
1439
+ const f = this.getSelectionModel();
1440
+ if (f) {
1441
+ const c = f.getSelectionCount(o, r);
1442
+ g = c > 0;
1443
+ for (let b = 0; b < c; b++) {
1444
+ const h = this.dom.applyStylePosistionAbsolute(
1445
+ // ge-table-body-west-selected-range
1446
+ this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${i}-selected-range`, n)
1447
+ );
1448
+ this.dom.setStyle(h, "left", `${l}px`), this.dom.setStyle(h, "top", `${a}px`), this.dom.setStyle(h, "width", `${d}px`), this.dom.setStyle(h, "height", `${S}px`);
1449
+ }
1450
+ }
1451
+ }
1452
+ return g;
1453
+ }
1454
+ renderCell({
1455
+ areaModel: e,
1456
+ areaIdent: t,
1457
+ sideIdent: i,
1458
+ rowIndex: s,
1459
+ columnIndex: o,
1460
+ left: r,
1461
+ top: n,
1462
+ width: l,
1463
+ height: a,
1464
+ parent: d,
1465
+ cellSelected: S,
1466
+ lastRowOfModel: g,
1467
+ gammaRange: f
1468
+ }) {
1469
+ const [c, b] = this.addAndRenderCellDiv({
1470
+ areaModel: e,
1471
+ areaIdent: t,
1472
+ sideIdent: i,
1473
+ rowIndex: s,
1474
+ index: o,
1475
+ left: r,
1476
+ width: l,
1477
+ height: a,
1478
+ top: n,
1479
+ parent: d,
1480
+ lastRowOfModel: g,
1481
+ gammaRange: f
1482
+ });
1483
+ S && this.dom.addClass(`ge-table-${t}-${i}-selected-range`, c), b && this.cleanupFunctions[t].push(b);
1484
+ }
1485
+ renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: i, cellTop: s, cellWidth: o, cellHeight: r, parent: n }) {
1486
+ const l = this.dom.domService, a = this.tableOptions.columnResizeHandleWidthInPx ?? 2, d = l.createElement("div");
1487
+ l.setAttribute(d, "data-col-index", `${t}`), l.setAttribute(d, "data-row-index", `${e}`), l.setAttribute(d, "data-area", "header"), l.setAttribute(d, "data-ge-action", "resize-column"), l.addClass(d, "ge-table-column-resize-handle"), l.setStyle(d, "display", "clip"), l.setStyle(d, "position", "absolute"), l.setStyle(d, "cursor", "col-resize"), l.setStyle(d, "left", `${i + o - a}px`), l.setStyle(d, "top", `${s}px`), l.setStyle(d, "width", `${a}px`), l.setStyle(d, "height", `${r}px`), l.appendChild(n, d);
1488
+ }
1489
+ }
1490
+ class de {
1491
+ constructor(e, t) {
1492
+ this.columnIndex = e, this.sortState = t;
1493
+ }
1494
+ }
1495
+ class he {
1496
+ constructor(e) {
1497
+ this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
1498
+ }
1499
+ onHostElementChanged(e) {
1500
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
1501
+ const t = e.target, i = t.getAttribute("data-area"), s = t.getAttribute("data-row-index"), o = t.getAttribute("data-col-index");
1502
+ if (i && s && o) {
1503
+ const r = V(i), n = Number(s), l = Number(o);
1504
+ this.tableScope.updateModelValueAfterEdit(r, n, l, t.value);
1505
+ }
1506
+ }
1507
+ }
1508
+ }
1509
+ class ce {
1510
+ constructor(e = -1, t = -1) {
1511
+ this.rowIndex = e, this.columnIndex = t;
1512
+ }
1513
+ }
1514
+ class _ {
1515
+ constructor(e) {
1516
+ this.cells = e;
1517
+ }
1518
+ static createSingle(e, t) {
1519
+ return new _([new ce(e, t)]);
1520
+ }
1521
+ }
1522
+ class pe {
1523
+ constructor(e) {
1524
+ var t, i;
1525
+ this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (i = this.tableScope.tableOptions) != null && i.getFocusModel && (this.getFocusModel = this.tableScope.tableOptions.getFocusModel);
1526
+ }
1527
+ onMouseClicked(e, t) {
1528
+ var o, r, n, l, a, d, S;
1529
+ let i = !1, s = !1;
1530
+ if (this.getSelectionModel && this.getFocusModel) {
1531
+ const g = this.getSelectionModel(), f = this.getFocusModel();
1532
+ g && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), i = !0), (o = e.originalEvent) != null && o.shiftKey || g.hasSelection() && (g.clear(), i = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (g.addSelection(this.createRangeByEvents(e, this.previousEvt)), s = !0, i = !0) : (n = e.originalEvent) != null && n.ctrlKey || (l = e.originalEvent) != null && l.metaKey ? (g.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), s = !0, i = !0) : (a = e.originalEvent) != null && a.altKey && ((d = e.originalEvent) != null && d.ctrlKey || (S = e.originalEvent) != null && S.metaKey) && (g.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), s = !0, i = !0));
1533
+ }
1534
+ return s ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), i;
1535
+ }
1536
+ onActionTriggered(e) {
1537
+ if (this.getSelectionModel && this.getFocusModel) {
1538
+ const t = this.getSelectionModel(), i = this.getFocusModel();
1539
+ if (t && i) {
1540
+ if (e === "SELECT_ALL")
1541
+ return t.selectAll(), this.tableScope.repaint(), !0;
1542
+ if (e === "DESELECT_ALL")
1543
+ return t.clear(), this.tableScope.repaint(), !0;
1544
+ if (e === "TOGGLE_SELECTION") {
1545
+ const [s, o] = i.getFocus();
1546
+ return t.togglePoint(s, o), this.tableScope.repaint(), !0;
1547
+ }
1548
+ }
1549
+ }
1550
+ return !1;
1551
+ }
1552
+ createRangeByEvents(e, t) {
1553
+ t || (t = e);
1554
+ const i = Math.min(e.rowIndex, t == null ? void 0 : t.rowIndex), s = Math.max(e.rowIndex, t == null ? void 0 : t.rowIndex), o = Math.min(e.columnIndex, t == null ? void 0 : t.columnIndex), r = Math.max(e.columnIndex, t == null ? void 0 : t.columnIndex);
1555
+ return A.create({
1556
+ rowIndex1: i,
1557
+ columnIndex1: o,
1558
+ rowIndex2: s,
1559
+ columnIndex2: r
1560
+ });
1561
+ }
1562
+ }
1563
+ class ue {
1564
+ get() {
1565
+ return {
1566
+ f2: "START_EDITING",
1567
+ space: "TOGGLE_SELECTION",
1568
+ "ctrl+num_add": "SELECT_ALL",
1569
+ "ctrl+a": "SELECT_ALL",
1570
+ "ctrl+shift+a": "DESELECT_ALL",
1571
+ "ctrl+x": "DESELECT_ALL",
1572
+ "ctrl+num_subtract": "DESELECT_ALL",
1573
+ "cmd -": "DESELECT_ALL",
1574
+ arrowup: "NAVIGATE_UP",
1575
+ arrowdown: "NAVIGATE_DOWN",
1576
+ arrowleft: "NAVIGATE_LEFT",
1577
+ arrowright: "NAVIGATE_RIGHT"
1578
+ };
1579
+ }
1580
+ }
1581
+ class Se {
1582
+ get() {
1583
+ return {
1584
+ f2: "START_EDITING",
1585
+ space: "TOGGLE_SELECTION",
1586
+ "ctrl+num_add": "SELECT_ALL",
1587
+ "cmd+a": "SELECT_ALL",
1588
+ "ctrl+a": "SELECT_ALL",
1589
+ "cmd+x": "DESELECT_ALL",
1590
+ "cmd+shift+a": "DESELECT_ALL",
1591
+ "ctrl+shift+a": "DESELECT_ALL",
1592
+ "ctrl+num_subtract": "DESELECT_ALL",
1593
+ "ctrl -": "DESELECT_ALL",
1594
+ arrowup: "NAVIGATE_UP",
1595
+ arrowdown: "NAVIGATE_DOWN",
1596
+ arrowleft: "NAVIGATE_LEFT",
1597
+ arrowright: "NAVIGATE_RIGHT"
1598
+ };
1599
+ }
1600
+ }
1601
+ class ge {
1602
+ constructor(e) {
1603
+ this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
1604
+ }
1605
+ addListener(e) {
1606
+ this.listener.includes(e) || this.listener.push(e);
1607
+ }
1608
+ init() {
1609
+ this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new Se().get()) : Object.assign(this.shortcutActionIdMapping, new ue().get()), Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping), this.isDebug() && console.debug("ShortcutService", this.shortcutActionIdMapping), this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this));
1610
+ }
1611
+ isMacintosh() {
1612
+ return navigator.platform.indexOf("Mac") > -1;
1613
+ }
1614
+ isDebug() {
1615
+ return this.isLocalhost();
1616
+ }
1617
+ isLocalhost() {
1618
+ return location.hostname === "localhost" || location.hostname === "127.0.0.1";
1619
+ }
1620
+ onKeyDown(e) {
1621
+ const t = this.findEnty(e);
1622
+ t && this.emit(t) && (e.preventDefault(), e.stopPropagation());
1623
+ }
1624
+ emit(e) {
1625
+ this.isDebug() && console.debug("ShortcutService emit:", e);
1626
+ let t = !1;
1627
+ for (const i of this.listener)
1628
+ i.onActionTriggered(e) && (t = !0);
1629
+ return t;
1630
+ }
1631
+ findEnty(e) {
1632
+ const t = this.getTokenByEvent(e);
1633
+ this.isDebug() && console.debug("ShortcutService tokens:", t);
1634
+ for (const i in this.shortcutActionIdMapping) {
1635
+ const s = i.replace(/opt/g, "alt").replace(/cmd/g, "meta").split(/[\+ ]/g).sort();
1636
+ if (this.areTokensEquals(t, s))
1637
+ return this.shortcutActionIdMapping[i];
1638
+ }
1639
+ }
1640
+ areTokensEquals(e, t) {
1641
+ if (e.length !== t.length || e.length === 0)
1642
+ return !1;
1643
+ for (let i = 0; i < e.length; i++)
1644
+ if (e[i] !== t[i])
1645
+ return !1;
1646
+ return !0;
1647
+ }
1648
+ getTokenByEvent(e) {
1649
+ const t = [];
1650
+ 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();
1651
+ }
1652
+ }
1653
+ class fe {
1654
+ onCheckboxChanged(e) {
1655
+ }
1656
+ onContextmenu(e) {
1657
+ }
1658
+ onModelChanged(e) {
1659
+ }
1660
+ onMouseClicked(e) {
1661
+ }
1662
+ onMouseDragging(e) {
1663
+ }
1664
+ onMouseDraggingEnd(e) {
1665
+ }
1666
+ onMouseMoved(e) {
1667
+ }
1668
+ }
1669
+ class me extends ae {
1670
+ constructor(e, t, i, s, o) {
1671
+ var r;
1672
+ if (super(
1673
+ e,
1674
+ t,
1675
+ new Y(i),
1676
+ s
1677
+ ), this.eventListener = o, this.selectionService = new pe(this), this.api = new J(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, o || (this.eventListener = new fe()), (r = this.tableOptions) != null && r.autoRestoreOptions) {
1678
+ const n = this.tableOptions.autoRestoreOptions, l = n.getStorageKeyFn;
1679
+ l && (n.autoRestoreScrollPosition && (this.storeScrollPosStateService = new te(l)), n.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new se(l)), n.autoRestoreSortingState && (this.storeSortingService = new oe(l)));
1680
+ }
1681
+ this.mouseHandler = new U(this), this.inputHandler = new he(this), this.shortcutService = new ge(this), this.shortcutService.addListener(this.selectionService);
1682
+ }
1683
+ onActionTriggered(e) {
1684
+ if (e === "NAVIGATE_DOWN" && this.changeFocusCell(0, 1) || e === "NAVIGATE_UP" && this.changeFocusCell(0, -1) || e === "NAVIGATE_LEFT" && this.changeFocusCell(-1, 0) || e === "NAVIGATE_RIGHT" && this.changeFocusCell(1, 0))
1685
+ return !0;
1686
+ if (e === "START_EDITING" && this.getFocusModel) {
1687
+ const t = this.getFocusModel();
1688
+ if (t) {
1689
+ const [i, s] = t.getFocus();
1690
+ this.tableModel.getBodyModel().isEditable(i, s) && (this.clearSelection(), this.initRenderEditor(i, s));
1691
+ }
1692
+ return !0;
1693
+ }
1694
+ return !1;
1695
+ }
1696
+ updateModelValueAfterEdit(e, t, i, s) {
1697
+ e === "body" && this.tableModel.getAreaModel(e).setValue(t, i, s) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(_.createSingle(t, i)), this.hostElement.focus());
1698
+ }
1699
+ getApi() {
1700
+ return this.api;
1701
+ }
1702
+ /*
1703
+ * Called by the table component
1704
+ */
1705
+ firstInit() {
1706
+ var e;
1707
+ this.tableModel.init(), (e = this.tableOptions) != null && e.externalFilterFunction && this.externalFilterChanged(!1), this.autoRestoreCollapsedExpandedState(), this.autoRestoreSortingState(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.autoRestoreScrollPosition();
1708
+ }
1709
+ createGeMouseEvent(e) {
1710
+ const t = new P();
1711
+ if (t.originalEvent = e, e) {
1712
+ const i = e.target;
1713
+ if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(i), t.rowIndex = this.getNumberByAttr(i, "data-row-index"), t.columnIndex = this.getNumberByAttr(i, "data-col-index"), t.action = this.getStringByAttr(i, "data-ge-action"), t.areaIdent) {
1714
+ const s = this.tableModel.getAreaModel(t.areaIdent);
1715
+ t.rowTop = s.getYPosByRowIndex(t.rowIndex);
1716
+ }
1717
+ if (t.columnLeft = this.tableModel.getXPosByColumnIndex(t.columnIndex), e.ctrlKey && e.altKey) {
1718
+ const s = e.clientY - this.hostElement.offsetTop - this.areaHeaderCenter.parent.clientHeight, o = e.clientX - this.hostElement.offsetLeft - this.areaBodyWestGeo.width;
1719
+ this.debugOnce(o, s);
1720
+ }
1721
+ }
1722
+ return t;
1723
+ }
1724
+ onMouseDown(e) {
1725
+ e.columnIndex > -1 && e.action && ["resize-column", "drag-column"].includes(e.action) && (this.mouseStartWidth = this.tableModel.getColumnWidth(e.columnIndex), this.mouseStartAction = e.action, this.mouseStartColumnIndex = e.columnIndex, this.mouseStartAction === "drag-column" && (this.dragFrom = this.mouseStartColumnIndex));
1726
+ }
1727
+ mouseDraggingOnFrame(e) {
1728
+ this.eventListener.onMouseDragging(e), this.mouseEvent = e, this.mouseStartColumnIndex > -1 && this.mouseStartAction === "resize-column" && this.tableOptions.columnsResizable ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && e.columnIndex > -1 && this.tableOptions.columnsDraggable && (this.draggingTargetColumnIndex = e.columnIndex, this.dragTo = this.draggingTargetColumnIndex, this.dragFrom > -1 && this.dragTo > -1 && this.dragFrom !== this.dragTo && (this.tableModel.changeColumnOrder(this.dragFrom, this.dragTo), this.dragFrom = this.dragTo, this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows()), this.repaint());
1729
+ }
1730
+ mouseDraggingEndOnFrame(e) {
1731
+ this.eventListener.onMouseDraggingEnd(e), this.draggingTargetColumnIndex = -1, this.mouseStartAction === "resize-column" ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && this.repaint(), this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.mouseStartAction = "";
1732
+ }
1733
+ mouseMove(e) {
1734
+ this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
1735
+ }
1736
+ contextmenu(e) {
1737
+ this.eventListener.onContextmenu(e);
1738
+ }
1739
+ toggleExpandCollapseAll(e = !0) {
1740
+ var i;
1741
+ const t = this.tableModel.getBodyModel();
1742
+ t instanceof B && (t.toggleExpandCollapseAll(e), this.repaint(), (i = this.storeStateCollapsedExpandService) == null || i.collapsedStateAll(e));
1743
+ }
1744
+ toggleRowCheckbox(e, t, i) {
1745
+ var l;
1746
+ const s = this.tableModel.getAreaModel(i), o = s.isRowChecked(e), r = o === void 0 || o === "semi" || o === "none";
1747
+ s.setRowChecked(e, r), this.repaint();
1748
+ const n = (l = s.rowSelectionModel) == null ? void 0 : l.getCheckedRows();
1749
+ this.eventListener.onCheckboxChanged(n || []);
1750
+ }
1751
+ onMouseClicked(e, t) {
1752
+ let i = this.selectionService.onMouseClicked(e, t);
1753
+ if (!i && this.getFocusModel) {
1754
+ const s = this.getFocusModel();
1755
+ s && (i = s.hasChanged(), s.clearChanged(), i && this.resetEditorRenderer());
1756
+ }
1757
+ this.eventListener.onMouseClicked(e), i && this.debounce(this.repaint.bind(this), 10);
1758
+ }
1759
+ externalFilterChanged(e = !0) {
1760
+ const t = this.tableOptions.externalFilterFunction;
1761
+ t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
1762
+ }
1763
+ onHeaderDblClicked(e, t, i) {
1764
+ var o, r;
1765
+ const s = this.tableModel.getColumnDef(i);
1766
+ if (s != null && s.sortable && s.sortable()) {
1767
+ e.preventDefault(), e.stopPropagation();
1768
+ const n = s.sortStatesOrder ? s.sortStatesOrder : this.tableOptions.sortOrder, l = s.sortState ?? "", a = n[(n.indexOf(l) + 1) % n.length], d = new de(i, a);
1769
+ this.tableModel.doSort([d]) && ((o = this.tableModel.getColumnDefs()) == null || o.forEach((g) => g.sortState = ""), s.sortState = a), this.repaint(), (r = this.storeSortingService) == null || r.setSortItems([d]);
1770
+ }
1771
+ }
1772
+ changeFocusCell(e, t) {
1773
+ if (!this.isEditing() && this.getFocusModel) {
1774
+ const i = this.getFocusModel();
1775
+ if (i) {
1776
+ const [s, o] = i.getFocus();
1777
+ return i.setFocus(s + t, o + e), this.repaint(), !0;
1778
+ }
1779
+ }
1780
+ return !1;
1781
+ }
1782
+ resizeColumn(e) {
1783
+ this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
1784
+ }
1785
+ clearSelectionModel() {
1786
+ var e;
1787
+ this.getSelectionModel && ((e = this.getSelectionModel()) == null || e.clear());
1788
+ }
1789
+ debugOnce(e, t) {
1790
+ var i;
1791
+ console.clear(), console.info("this.hostElement.offsetTop", this.hostElement.offsetTop), console.info("this.hostElement.scrollHeight", this.hostElement.scrollHeight), console.info("this.scrollViewportTop", this.scrollTop), console.info("this.areaHeaderCenter.parent.clientHeight", this.areaHeaderCenter.parent.clientHeight), console.info("bodyY", t), console.info("bodyX", e), console.info("rows", this.firstVisibleRowIndex), console.info(""), console.info("this.tableModel", this.tableModel), console.info(""), console.info("this.mouseMoveEvent.clientX", (i = this.mouseHandler.mouseEvent) == null ? void 0 : i.clientX), console.info("this.hostElement.offsetLeft", this.hostElement.offsetLeft), console.info("this.areaBodyWestGeo.width", this.areaBodyWestGeo.width);
1792
+ }
1793
+ autoRestoreScrollPosition() {
1794
+ var e;
1795
+ if ((e = this.tableOptions) != null && e.autoRestoreOptions && this.storeScrollPosStateService && this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition) {
1796
+ const i = this.storeScrollPosStateService.getScrollOffset();
1797
+ i && this.scrollViewport.scrollTo(...i);
1798
+ }
1799
+ }
1800
+ autoRestoreSortingState() {
1801
+ var e, t;
1802
+ if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreSortingState && this.storeSortingService) {
1803
+ const i = this.storeSortingService.getSortItems();
1804
+ i != null && i.length && this.tableModel.getBodyModel().doSort(i);
1805
+ }
1806
+ }
1807
+ autoRestoreCollapsedExpandedState() {
1808
+ var e, t;
1809
+ if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
1810
+ const i = this.tableOptions.autoRestoreOptions, s = i.getRowId;
1811
+ if (i.autoRestoreCollapsedExpandedState && s) {
1812
+ const o = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), r = this.tableModel.getAreaModel("body");
1813
+ if (r instanceof B) {
1814
+ const n = r, l = r.getRowCount();
1815
+ for (let a = 0; a < l; a++) {
1816
+ const d = r.getRowByIndex(a);
1817
+ if (d)
1818
+ if (o.allExpanded)
1819
+ d.expanded = !0;
1820
+ else if (o.allCollapsed)
1821
+ d.expanded = !1;
1822
+ else {
1823
+ const S = s(d.data);
1824
+ o.mode === "expanded" ? d.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S) : o.mode === "collapsed" && (d.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S));
1825
+ }
1826
+ }
1827
+ n.recalcVisibleTreeRows();
1828
+ }
1829
+ }
1830
+ }
1831
+ }
1832
+ }
1833
+ class be {
1834
+ render(e, t, i, s, o, r, n) {
1835
+ if (o.isEditable(t, i)) {
1836
+ n.addClass(e, "ge-table-row-input-div");
1837
+ const l = o.getValueAt(t, i);
1838
+ e.innerHTML = `
9
1839
  <input
10
1840
  type="text"
11
1841
  value="${l}"
@@ -17,4 +1847,208 @@
17
1847
  data-col-index="${i}"
18
1848
  data-input-type="text"
19
1849
  style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
20
- class="ge-table-cell-editor-input">`}}}class be{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1}getSelectionCount(e,t){let i=0;for(const s of this.ranges)s.isInRange(e,t)&&i++;return this.allSelected&&i++,this.isInNegativeRange(e,t)&&(i=0),i}isInNegativeRange(e,t){for(const i of this.negativeRanges)if(i.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1}hasSelection(){return!!this.ranges.length}selectAll(){this.allSelected=!0}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=A.singleRow(e.r1):this.selectionType==="column"&&(t=A.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.addSelection(A.singleCell(e,t))}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e))}}class ye{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0)}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}const we=new be,ve=new ye("cell");class xe{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new N,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new j,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new me,this.getSelectionModel=()=>we,this.getFocusModel=()=>ve}}class Ce{setStyle(e,t,i){return e.style[t]=i,e}appendText(e,t){const i=this.createText(t);return this.appendChild(e,i),i}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(i=>e.classList.add(i)):e.classList.add(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,i){e.setAttribute(t,i)}}function Ee({tableModel:p,tableOptions:e=new xe,mouseMoved:t,checkboxChanged:i,contextmenu:s,modelChanged:o,mouseClicked:r,mouseDragging:n,mouseDraggingEnd:l,tableReady:a}){const d=k.useRef(null);let S=!1;k.useEffect(()=>{d.current&&!S&&(g(d.current),S=!0)});const g=f=>{const c={onCheckboxChanged:h=>{i&&i(h)},onContextmenu:h=>{s&&s(h)},onModelChanged:h=>{o&&o(h)},onMouseClicked:h=>{r&&r(h)},onMouseDragging:h=>{n&&n(h)},onMouseDraggingEnd:h=>{l&&l(h)},onMouseMoved:h=>{t&&t(h)}},b=new fe(f,p,new Ce,e,c);b.firstInit(),a&&a(b.getApi())};return z.jsx("div",{ref:d,className:"container-div",style:{width:"100%",height:"100%",backgroundColor:"transparent",padding:"0",margin:"0"}})}var $,F=X;if(process.env.NODE_ENV==="production")$=F.createRoot,F.hydrateRoot;else{var G=F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;$=function(p,e){G.usingClientEntryPoint=!0;try{return F.createRoot(p,e)}finally{G.usingClientEntryPoint=!1}}}class Ae{constructor(e){this.Component=e,console.info(e)}render(e,t,i,s,o,r,n){const l={cellDiv:e,rowIndex:t,columnIndex:i,areaIdent:s,areaModel:o,cellValue:r},a=$(e,{});return a.render(this.Component(l)),()=>{a.unmount()}}}exports.ComponentRendererWrapper=Ae;exports.GuiexpertTable=Ee;
1850
+ class="ge-table-cell-editor-input">`;
1851
+ }
1852
+ }
1853
+ }
1854
+ class ye {
1855
+ constructor(e = "none", t = "single") {
1856
+ this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
1857
+ }
1858
+ getSelectionCount(e, t) {
1859
+ let i = 0;
1860
+ for (const s of this.ranges)
1861
+ s.isInRange(e, t) && i++;
1862
+ return this.allSelected && i++, this.isInNegativeRange(e, t) && (i = 0), i;
1863
+ }
1864
+ isInNegativeRange(e, t) {
1865
+ for (const i of this.negativeRanges)
1866
+ if (i.isInRange(e, t))
1867
+ return !0;
1868
+ return !1;
1869
+ }
1870
+ getRanges() {
1871
+ return this.ranges;
1872
+ }
1873
+ clear() {
1874
+ this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
1875
+ }
1876
+ hasSelection() {
1877
+ return !!this.ranges.length;
1878
+ }
1879
+ selectAll() {
1880
+ this.allSelected = !0;
1881
+ }
1882
+ addSelection(e) {
1883
+ this.addRange(e);
1884
+ }
1885
+ removeSelection(e) {
1886
+ if (this.selectionType === "none")
1887
+ return;
1888
+ let t = e;
1889
+ this.selectionType === "row" ? t = A.singleRow(e.r1) : this.selectionType === "column" && (t = A.singleColumn(e.c1)), this.negativeRanges.push(t);
1890
+ }
1891
+ togglePoint(e, t) {
1892
+ this.getSelectionCount(e, t) > 0 ? this.removeSelection(A.singleCell(e, t)) : this.addSelection(A.singleCell(e, t));
1893
+ }
1894
+ addRange(e) {
1895
+ this.selectionType !== "none" && (this.allSelected = !1, this.selectionMode === "single" && (this.ranges = []), this.selectionType === "row" ? (e.c1 = 0, e.c2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "column" ? (e.r1 = 0, e.r2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "cell" ? (e.r2 = e.r1, e.c2 = e.c1) : this.selectionType, this.ranges.push(e));
1896
+ }
1897
+ }
1898
+ class we {
1899
+ constructor(e = "none") {
1900
+ this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1;
1901
+ }
1902
+ clearChanged() {
1903
+ this.changed = !1;
1904
+ }
1905
+ hasChanged() {
1906
+ return this.changed;
1907
+ }
1908
+ clear() {
1909
+ this.rowIndex = -1, this.columnIndex = -1;
1910
+ }
1911
+ setFocus(e, t) {
1912
+ (this.rowIndex !== e || this.columnIndex !== t) && (this.rowIndex = e, this.columnIndex = t, this.changed = !0);
1913
+ }
1914
+ hasFocus(e, t) {
1915
+ return this.rowIndex === e && this.columnIndex === t;
1916
+ }
1917
+ getFocus() {
1918
+ return [this.rowIndex, this.columnIndex];
1919
+ }
1920
+ }
1921
+ const ve = new ye(), xe = new we("cell");
1922
+ class Ce {
1923
+ constructor() {
1924
+ this.overflowX = "auto", this.overflowY = "auto", this.horizontalBorderVisible = !0, this.verticalBorderVisible = !0, this.footerSeparatorBorderVisible = !0, this.headerSeparatorBorderVisible = !0, this.fixedEastSeparatorBorderVisible = !0, this.fixedWestSeparatorBorderVisible = !0, this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
1925
+ header: 34,
1926
+ body: 34,
1927
+ footer: 34
1928
+ }, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new G(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new N(), this.sortOrder = ["asc", "desc"], this.getEditRenderer = (e, t) => new be(), this.getSelectionModel = () => ve, this.getFocusModel = () => xe;
1929
+ }
1930
+ }
1931
+ class Ee {
1932
+ setStyle(e, t, i) {
1933
+ return e.style[t] = i, e;
1934
+ }
1935
+ appendText(e, t) {
1936
+ const i = this.createText(t);
1937
+ return this.appendChild(e, i), i;
1938
+ }
1939
+ addClass(e, t) {
1940
+ return t.includes(" ") ? t.split(" ").forEach((i) => e.classList.add(i)) : e.classList.add(t), e;
1941
+ }
1942
+ appendChild(e, t) {
1943
+ e.appendChild(t);
1944
+ }
1945
+ createElement(e) {
1946
+ return document.createElement(e);
1947
+ }
1948
+ createText(e) {
1949
+ return document.createTextNode(e);
1950
+ }
1951
+ setAttribute(e, t, i) {
1952
+ e.setAttribute(t, i);
1953
+ }
1954
+ }
1955
+ function Te({
1956
+ tableModel: p,
1957
+ tableOptions: e = new Ce(),
1958
+ mouseMoved: t,
1959
+ checkboxChanged: i,
1960
+ contextmenu: s,
1961
+ modelChanged: o,
1962
+ mouseClicked: r,
1963
+ mouseDragging: n,
1964
+ mouseDraggingEnd: l,
1965
+ tableReady: a
1966
+ }) {
1967
+ const d = j(null);
1968
+ let S = !1;
1969
+ X(() => {
1970
+ d.current && !S && (g(d.current), S = !0);
1971
+ });
1972
+ const g = (f) => {
1973
+ const c = {
1974
+ onCheckboxChanged: (h) => {
1975
+ i && i(h);
1976
+ },
1977
+ onContextmenu: (h) => {
1978
+ s && s(h);
1979
+ },
1980
+ onModelChanged: (h) => {
1981
+ o && o(h);
1982
+ },
1983
+ onMouseClicked: (h) => {
1984
+ r && r(h);
1985
+ },
1986
+ onMouseDragging: (h) => {
1987
+ n && n(h);
1988
+ },
1989
+ onMouseDraggingEnd: (h) => {
1990
+ l && l(h);
1991
+ },
1992
+ onMouseMoved: (h) => {
1993
+ t && t(h);
1994
+ }
1995
+ }, b = new me(
1996
+ f,
1997
+ p,
1998
+ new Ee(),
1999
+ e,
2000
+ c
2001
+ );
2002
+ b.firstInit(), a && a(b.getApi());
2003
+ };
2004
+ return /* @__PURE__ */ z(
2005
+ "div",
2006
+ {
2007
+ ref: d,
2008
+ className: "container-div",
2009
+ style: {
2010
+ width: "100%",
2011
+ height: "100%",
2012
+ backgroundColor: "transparent",
2013
+ padding: "0",
2014
+ margin: "0"
2015
+ }
2016
+ }
2017
+ );
2018
+ }
2019
+ var $, F = K;
2020
+ if (process.env.NODE_ENV === "production")
2021
+ $ = F.createRoot, F.hydrateRoot;
2022
+ else {
2023
+ var k = F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2024
+ $ = function(p, e) {
2025
+ k.usingClientEntryPoint = !0;
2026
+ try {
2027
+ return F.createRoot(p, e);
2028
+ } finally {
2029
+ k.usingClientEntryPoint = !1;
2030
+ }
2031
+ };
2032
+ }
2033
+ class Ie {
2034
+ constructor(e) {
2035
+ this.Component = e, console.info(e);
2036
+ }
2037
+ render(e, t, i, s, o, r, n) {
2038
+ const l = {
2039
+ cellDiv: e,
2040
+ rowIndex: t,
2041
+ columnIndex: i,
2042
+ areaIdent: s,
2043
+ areaModel: o,
2044
+ cellValue: r
2045
+ }, a = $(e, {});
2046
+ return a.render(this.Component(l)), () => {
2047
+ a.unmount();
2048
+ };
2049
+ }
2050
+ }
2051
+ export {
2052
+ Ie as ComponentRendererWrapper,
2053
+ Te as GuiexpertTable
2054
+ };