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