@guiexpert/react-table 0.0.1

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