@guiexpert/svelte-table 1.0.10 → 4.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/dist/index.js ADDED
@@ -0,0 +1,3331 @@
1
+ var me = Object.defineProperty;
2
+ var ye = (a, e, t) => e in a ? me(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var N = (a, e, t) => (ye(a, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { createEventDispatcher as ve, onMount as we } from "svelte";
5
+ function L() {
6
+ }
7
+ function de(a) {
8
+ return a();
9
+ }
10
+ function ie() {
11
+ return /* @__PURE__ */ Object.create(null);
12
+ }
13
+ function V(a) {
14
+ a.forEach(de);
15
+ }
16
+ function ce(a) {
17
+ return typeof a == "function";
18
+ }
19
+ function Ce(a, e) {
20
+ return a != a ? e == e : a !== e || a && typeof a == "object" || typeof a == "function";
21
+ }
22
+ function xe(a) {
23
+ return Object.keys(a).length === 0;
24
+ }
25
+ function Ee(a, e, t) {
26
+ a.insertBefore(e, t || null);
27
+ }
28
+ function he(a) {
29
+ a.parentNode && a.parentNode.removeChild(a);
30
+ }
31
+ function Ae(a) {
32
+ return document.createElement(a);
33
+ }
34
+ function Me(a, e, t) {
35
+ t == null ? a.removeAttribute(e) : a.getAttribute(e) !== t && a.setAttribute(e, t);
36
+ }
37
+ function Re(a) {
38
+ return Array.from(a.childNodes);
39
+ }
40
+ function _(a, e, t, o) {
41
+ t == null ? a.style.removeProperty(e) : a.style.setProperty(e, t, o ? "important" : "");
42
+ }
43
+ let J;
44
+ function B(a) {
45
+ J = a;
46
+ }
47
+ const I = [], X = [];
48
+ let $ = [];
49
+ const re = [], Te = /* @__PURE__ */ Promise.resolve();
50
+ let K = !1;
51
+ function De() {
52
+ K || (K = !0, Te.then(ge));
53
+ }
54
+ function Y(a) {
55
+ $.push(a);
56
+ }
57
+ const j = /* @__PURE__ */ new Set();
58
+ let O = 0;
59
+ function ge() {
60
+ if (O !== 0)
61
+ return;
62
+ const a = J;
63
+ do {
64
+ try {
65
+ for (; O < I.length; ) {
66
+ const e = I[O];
67
+ O++, B(e), ke(e.$$);
68
+ }
69
+ } catch (e) {
70
+ throw I.length = 0, O = 0, e;
71
+ }
72
+ for (B(null), I.length = 0, O = 0; X.length; )
73
+ X.pop()();
74
+ for (let e = 0; e < $.length; e += 1) {
75
+ const t = $[e];
76
+ j.has(t) || (j.add(t), t());
77
+ }
78
+ $.length = 0;
79
+ } while (I.length);
80
+ for (; re.length; )
81
+ re.pop()();
82
+ K = !1, j.clear(), B(a);
83
+ }
84
+ function ke(a) {
85
+ if (a.fragment !== null) {
86
+ a.update(), V(a.before_update);
87
+ const e = a.dirty;
88
+ a.dirty = [-1], a.fragment && a.fragment.p(a.ctx, e), a.after_update.forEach(Y);
89
+ }
90
+ }
91
+ function Oe(a) {
92
+ const e = [], t = [];
93
+ $.forEach((o) => a.indexOf(o) === -1 ? e.push(o) : t.push(o)), t.forEach((o) => o()), $ = e;
94
+ }
95
+ const Ie = /* @__PURE__ */ new Set();
96
+ function Fe(a, e) {
97
+ a && a.i && (Ie.delete(a), a.i(e));
98
+ }
99
+ function Le(a, e, t) {
100
+ const { fragment: o, after_update: s } = a.$$;
101
+ o && o.m(e, t), Y(() => {
102
+ const i = a.$$.on_mount.map(de).filter(ce);
103
+ a.$$.on_destroy ? a.$$.on_destroy.push(...i) : V(i), a.$$.on_mount = [];
104
+ }), s.forEach(Y);
105
+ }
106
+ function $e(a, e) {
107
+ const t = a.$$;
108
+ t.fragment !== null && (Oe(t.after_update), V(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
109
+ }
110
+ function _e(a, e) {
111
+ a.$$.dirty[0] === -1 && (I.push(a), De(), a.$$.dirty.fill(0)), a.$$.dirty[e / 31 | 0] |= 1 << e % 31;
112
+ }
113
+ function Be(a, e, t, o, s, i, r = null, n = [-1]) {
114
+ const l = J;
115
+ B(a);
116
+ const d = a.$$ = {
117
+ fragment: null,
118
+ ctx: [],
119
+ // state
120
+ props: i,
121
+ update: L,
122
+ not_equal: s,
123
+ bound: ie(),
124
+ // lifecycle
125
+ on_mount: [],
126
+ on_destroy: [],
127
+ on_disconnect: [],
128
+ before_update: [],
129
+ after_update: [],
130
+ context: new Map(e.context || (l ? l.$$.context : [])),
131
+ // everything else
132
+ callbacks: ie(),
133
+ dirty: n,
134
+ skip_bound: !1,
135
+ root: e.target || l.$$.root
136
+ };
137
+ r && r(d.root);
138
+ let c = !1;
139
+ if (d.ctx = t ? t(a, e.props || {}, (h, g, ...f) => {
140
+ const b = f.length ? f[0] : g;
141
+ return d.ctx && s(d.ctx[h], d.ctx[h] = b) && (!d.skip_bound && d.bound[h] && d.bound[h](b), c && _e(a, h)), g;
142
+ }) : [], d.update(), c = !0, V(d.before_update), d.fragment = o ? o(d.ctx) : !1, e.target) {
143
+ if (e.hydrate) {
144
+ const h = Re(e.target);
145
+ d.fragment && d.fragment.l(h), h.forEach(he);
146
+ } else
147
+ d.fragment && d.fragment.c();
148
+ e.intro && Fe(a.$$.fragment), Le(a, e.target, e.anchor), ge();
149
+ }
150
+ B(l);
151
+ }
152
+ class Pe {
153
+ constructor() {
154
+ /**
155
+ * ### PRIVATE API
156
+ *
157
+ * Do not use, may change at any time
158
+ *
159
+ * @type {any}
160
+ */
161
+ N(this, "$$");
162
+ /**
163
+ * ### PRIVATE API
164
+ *
165
+ * Do not use, may change at any time
166
+ *
167
+ * @type {any}
168
+ */
169
+ N(this, "$$set");
170
+ }
171
+ /** @returns {void} */
172
+ $destroy() {
173
+ $e(this, 1), this.$destroy = L;
174
+ }
175
+ /**
176
+ * @template {Extract<keyof Events, string>} K
177
+ * @param {K} type
178
+ * @param {((e: Events[K]) => void) | null | undefined} callback
179
+ * @returns {() => void}
180
+ */
181
+ $on(e, t) {
182
+ if (!ce(t))
183
+ return L;
184
+ const o = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
185
+ return o.push(t), () => {
186
+ const s = o.indexOf(t);
187
+ s !== -1 && o.splice(s, 1);
188
+ };
189
+ }
190
+ /**
191
+ * @param {Partial<Props>} props
192
+ * @returns {void}
193
+ */
194
+ $set(e) {
195
+ this.$$set && !xe(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
196
+ }
197
+ }
198
+ const He = "4";
199
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(He);
200
+ class k {
201
+ // The constructor is private to prevent direct construction calls
202
+ // with the `new` operator
203
+ constructor() {
204
+ this.alreadySet = !1;
205
+ }
206
+ static getInstance() {
207
+ return k.instance || (k.instance = new k()), k.instance;
208
+ }
209
+ /**
210
+ * Method to set the license key for the application.
211
+ * A 'meta' element is created with content as 'guiexperttable=<license key>'
212
+ * and appended into the head section of the document
213
+ *
214
+ * @param {string} key - The license key to set for the application.
215
+ *
216
+ * @return {void} - This method does not return anything
217
+ */
218
+ setLicenseKey(e) {
219
+ if (e && !this.alreadySet) {
220
+ const t = document.createElement("meta");
221
+ t.content = "license=" + e, t.name = "guiexperttable", document.getElementsByTagName("head")[0].appendChild(t), this.alreadySet = !0;
222
+ }
223
+ }
224
+ }
225
+ function q(a) {
226
+ return a && a.type === "TreeRow";
227
+ }
228
+ function U(a) {
229
+ return a && a.type === "AreaModelTree";
230
+ }
231
+ class Q {
232
+ constructor(e = -1, t = -1, o = -1, s = -1, i, r, n, l = 0, d = 0, c = 0, h = "") {
233
+ this.rowIndex = e, this.rowTop = t, this.columnIndex = o, this.columnLeft = s, this.areaIdent = i, this.sideIdent = r, this.originalEvent = n, this.clickCount = l, this.draggingX = d, this.draggingY = c, this.action = h;
234
+ }
235
+ clone() {
236
+ return new Q(
237
+ this.rowIndex,
238
+ this.rowTop,
239
+ this.columnIndex,
240
+ this.columnLeft,
241
+ this.areaIdent,
242
+ this.sideIdent,
243
+ this.originalEvent,
244
+ this.clickCount,
245
+ this.draggingX,
246
+ this.draggingY,
247
+ this.action
248
+ );
249
+ }
250
+ }
251
+ class D {
252
+ constructor(e = ">", t = "", o = []) {
253
+ this.content = e, this.style = t, this.classes = o;
254
+ }
255
+ }
256
+ class pe {
257
+ constructor(e = new D(
258
+ ">",
259
+ "transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
260
+ ["gt-table-tree-arrow-expanded"]
261
+ ), t = new D(
262
+ ">",
263
+ "",
264
+ ["ge-table-tree-arrow-collapsed"]
265
+ ), o = new D(
266
+ ">",
267
+ "color:transparent;",
268
+ ["gt-table-tree-arrow-hidden"]
269
+ ), s = new D(
270
+ "↕",
271
+ "",
272
+ ["gt-table-tree-arrow-expanded-all"]
273
+ )) {
274
+ this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = o, this.arrowExpandCollapseAll = s;
275
+ }
276
+ }
277
+ class ue {
278
+ constructor(e = new D("↑", "", ["ge-header-sorted-asc"]), t = new D("↓", "", ["ge-header-sorted-desc"]), o = new D("↑", "color:transparent;", [])) {
279
+ this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = o;
280
+ }
281
+ }
282
+ class We {
283
+ constructor(e) {
284
+ this.domService = e;
285
+ }
286
+ setStyle(e, t, o) {
287
+ return this.domService.setStyle(e, t, o), e;
288
+ }
289
+ applyStyle(e, t) {
290
+ for (const o in t)
291
+ this.domService.setStyle(e, o, t[o]);
292
+ return e;
293
+ }
294
+ applyDisplayNoneStyle(e) {
295
+ return this.domService.setStyle(e, "display", "none"), e;
296
+ }
297
+ applyDisplayBlockStyle(e) {
298
+ return this.domService.setStyle(e, "display", "block"), e;
299
+ }
300
+ applyStyleInPx(e, t) {
301
+ return Object.entries(t).forEach(([o, s]) => this.domService.setStyle(e, o, s + "px")), e;
302
+ }
303
+ applyStylePosistionRelative(e) {
304
+ return this.domService.setStyle(e, "position", "relative"), this.domService.setStyle(e, "overflow", "clip"), e;
305
+ }
306
+ applyStylePosistionAbsolute(e) {
307
+ return this.domService.setStyle(e, "position", "absolute"), e;
308
+ }
309
+ applyStyleFullSize(e) {
310
+ return this.domService.setStyle(e, "width", "100%"), this.domService.setStyle(e, "height", "100%"), e;
311
+ }
312
+ applyStyleOverflowAuto(e = "auto", t = "auto", o) {
313
+ return this.domService.setStyle(o, "overflow-x", e), this.domService.setStyle(o, "overflow-y", t), o;
314
+ }
315
+ applyStyleNoPadding(e) {
316
+ return this.domService.setStyle(e, "padding", "0"), this.domService.setStyle(e, "margin", "0"), this.domService.setStyle(e, "border", "0"), e;
317
+ }
318
+ appendRelativeChildDiv(e) {
319
+ const t = this.applyStylePosistionRelative(
320
+ this.applyStyleFullSize(
321
+ this.applyStyleNoPadding(
322
+ this.domService.createElement("div")
323
+ )
324
+ )
325
+ );
326
+ return this.domService.appendChild(e, t), this.applyStylePosistionAbsolute(e), { parent: e, child: t, cache: {} };
327
+ }
328
+ appendText(e, t) {
329
+ const o = this.domService.createText(t);
330
+ return this.domService.appendChild(e, o), o;
331
+ }
332
+ addClass(e, t) {
333
+ return e.includes(" ") ? e.split(" ").forEach((o) => this.domService.addClass(t, o)) : this.domService.addClass(t, e), t;
334
+ }
335
+ removeClass(e, t) {
336
+ return e.includes(" ") ? e.split(" ").forEach((o) => this.domService.removeClass(t, o)) : this.domService.removeClass(t, e), t;
337
+ }
338
+ addClasses(e, t) {
339
+ if (e)
340
+ for (const o of e)
341
+ this.domService.addClass(t, o);
342
+ return t;
343
+ }
344
+ setAttribute(e, t, o) {
345
+ return t && o && this.domService.setAttribute(e, t, o), e;
346
+ }
347
+ createAreaDivWithClass(e, t, o, s) {
348
+ const i = this.domService.createElement("div");
349
+ return this.addClass(e, i), this.domService.setAttribute(i, "data-area", o), this.domService.setAttribute(i, "data-side", s), this.domService.appendChild(t, i), i;
350
+ }
351
+ createDivWithClass(e, t) {
352
+ const o = this.domService.createElement("div");
353
+ return this.addClass(e, o), this.domService.appendChild(t, o), o;
354
+ }
355
+ addRowDiv(e, t, o = -1, s, i, r = "") {
356
+ const n = t.index ?? -1, l = this.getDivOrCreateDiv(n, e);
357
+ if (this.domService.addClass(l, "ge-table-row-div"), this.domService.addClass(l, `ge-table-row-div-${t.index}`), s === "body" && i === "center") {
358
+ const d = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
359
+ this.domService.addClass(l, `ge-table-row-${d}`);
360
+ }
361
+ if (this.domService.setStyle(l, "display", "clip"), this.domService.setStyle(l, "position", "absolute"), this.domService.setStyle(l, "left", `${t.left}px`), this.domService.setStyle(l, "top", `${t.top}px`), this.domService.setStyle(l, "width", `${t.width}px`), this.domService.setStyle(l, "height", `${t.height}px`), this.domService.setAttribute(l, "data-row-index", `${o}`), this.domService.setAttribute(l, "data-area", `${s}`), r) {
362
+ const d = this.domService.createText(r);
363
+ this.domService.appendChild(l, d);
364
+ }
365
+ return this.domService.appendChild(e.child, l), l;
366
+ }
367
+ addColumnDiv(e) {
368
+ const { parent: t, geo: o, rowIndex: s = -1, columnIndex: i = -1, areaIdent: r, sideIdent: n, text: l = "", treeArrow: d, tableOptions: c, checkedType: h = void 0, sortState: g } = e, f = c == null ? void 0 : c.treeOptions, b = c == null ? void 0 : c.showCheckboxWihoutExtraColumn, S = this.domService.createElement("div");
369
+ this.domService.addClass(S, "ge-table-col-div"), this.domService.addClass(S, `ge-table-col-div-${o.index}`), this.domService.setAttribute(S, "data-col-index", `${o.index}`), this.domService.setAttribute(S, "data-row-index", `${s}`), this.domService.setAttribute(S, "data-area", `${r}`);
370
+ const u = ((o == null ? void 0 : o.index) ?? 0) % 2 === 0 ? "even" : "odd";
371
+ if (r === "body" && n === "center" && this.domService.addClass(S, `ge-table-column-${u}`), this.domService.setStyle(S, "display", "clip"), this.domService.setStyle(S, "position", "absolute"), this.domService.setStyle(S, "left", `${o.left}px`), this.domService.setStyle(S, "top", `${o.top}px`), this.domService.setStyle(S, "width", `${o.width}px`), this.domService.setStyle(S, "height", `${o.height}px`), d && d !== "none" && (this.domService.addClass(S, "ge-table-col-tree"), this.addArrowDiv(S, d, f, s, i, r)), b && i === 0 && h && this.addCheckboxToDiv(S, h, r, s), l) {
372
+ const p = d !== "none" && i === 0;
373
+ this.addLabelDiv(S, l, p, s, i, r);
374
+ }
375
+ return g && this.addSortedIcon(S, g, c == null ? void 0 : c.sortedOptions, i), this.domService.appendChild(t, S), S;
376
+ }
377
+ addCheckboxToDiv(e, t, o, s) {
378
+ const i = this.domService.createElement("div"), r = t === "full" ? "checked" : "";
379
+ return i.innerHTML = `
380
+ <input
381
+ type="checkbox"
382
+ data-area="${o}"
383
+ data-row-index="${s}"
384
+ data-input-type="checkbox"
385
+ ${r}
386
+ class="ge-table-row-checkbox"> `, this.domService.setStyle(i, "display", "inline"), this.domService.setStyle(i, "width", "inherit"), this.domService.setAttribute(i, "data-row-index", `${s}`), this.domService.appendChild(e, i), i;
387
+ }
388
+ addLabelDiv(e, t = "", o = !1, s = -1, i = -1, r = "body") {
389
+ const n = this.domService.createElement("div");
390
+ if (this.domService.addClass(n, "ge-table-label-div"), this.domService.setStyle(n, "position", "relative"), this.domService.setStyle(n, "background", "transparent"), this.domService.setStyle(n, "width", "100%"), this.domService.setStyle(n, "height", "100%"), this.domService.setAttribute(n, "data-row-index", `${s}`), this.domService.setAttribute(n, "data-col-index", `${i}`), this.domService.setAttribute(n, "data-area", `${r}`), t)
391
+ if (o) {
392
+ const l = this.domService.createText(t);
393
+ this.domService.appendChild(n, l);
394
+ } else {
395
+ const l = this.domService.createElement("div");
396
+ this.domService.appendChild(n, l);
397
+ const d = this.domService.createText(t);
398
+ this.domService.addClass(l, "ge-table-label"), this.domService.appendChild(l, d), this.domService.setAttribute(l, "data-row-index", `${s}`), this.domService.setAttribute(l, "data-col-index", `${i}`), this.domService.setAttribute(l, "data-area", `${r}`);
399
+ }
400
+ return this.domService.appendChild(e, n), n;
401
+ }
402
+ addSortedIcon(e, t = "", o = new ue(), s = -1) {
403
+ const i = this.domService.createElement("div");
404
+ this.domService.addClass(i, "ge-table-sorted-icon-div"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "top", "0"), this.domService.setStyle(i, "right", "0"), this.domService.setStyle(i, "width", "20px"), this.domService.setStyle(i, "background", "transparent"), this.domService.setStyle(i, "cursor", "pointer"), this.domService.setAttribute(i, "data-col-index", `${s}`), this.domService.setAttribute(i, "data-area", "header");
405
+ let r;
406
+ t === "asc" ? r = o.iconAsc : t === "desc" ? r = o.iconDesc : r = o.iconPlaceholder;
407
+ const n = r.content, l = this.domService.createText(n);
408
+ this.domService.appendChild(i, l), r.style && this.applyStyleString(i, r.style);
409
+ for (const d of r.classes)
410
+ this.domService.addClass(i, d);
411
+ return this.domService.appendChild(e, i), i;
412
+ }
413
+ addArrowDiv(e, t = "none", o = new pe(), s = -1, i = -1, r = "body") {
414
+ const n = this.domService.createElement("div");
415
+ this.domService.addClass(n, "ge-table-tree-arrow-div"), this.domService.setStyle(n, "display", "inline-block"), this.domService.setStyle(n, "position", ""), this.domService.setStyle(n, "width", "20px"), this.domService.setStyle(n, "background", "transparent"), this.domService.setStyle(n, "cursor", "pointer"), this.domService.setAttribute(n, "data-row-index", `${s}`), this.domService.setAttribute(n, "data-col-index", `${i}`), this.domService.setAttribute(n, "data-area", `${r}`);
416
+ let l;
417
+ t === "expanded" ? l = o.arrowExpanded : t === "collapsed" ? l = o.arrowCollapsed : l = o.arrowPlaceholder;
418
+ const d = l.content, c = this.domService.createText(d);
419
+ this.domService.appendChild(n, c), l.style && this.applyStyleString(n, l.style);
420
+ for (const h of l.classes)
421
+ this.domService.addClass(n, h);
422
+ return this.domService.appendChild(e, n), n;
423
+ }
424
+ addColumnBorderDivs(e, t, o, s, i) {
425
+ if (e.verticalBorderVisible) {
426
+ const r = `ge-table-${s}-${i}-vertical-border`;
427
+ this.addVerticalBorder(o, t, r);
428
+ }
429
+ if (e.horizontalBorderVisible) {
430
+ const r = `ge-table-${s}-${i}-horizontal-border`;
431
+ this.addHorizontalBorder(o, t, r);
432
+ }
433
+ return t;
434
+ }
435
+ addHorizontalBorder(e, t, o = "ge-table-body-center-horizontal-border") {
436
+ const s = this.domService.createElement("div");
437
+ return this.domService.addClass(s, o), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${e.left}px`), this.domService.setStyle(s, "top", `${e.top}px`), this.domService.setStyle(s, "width", `${e.width}px`), this.domService.setStyle(s, "height", "1px"), this.domService.appendChild(t, s), s;
438
+ }
439
+ addFocusBorderDivs(e, t, o) {
440
+ t = { ...t, width: t.width + 1, height: t.height + 1 };
441
+ let s = this.domService.createElement("div");
442
+ return this.domService.addClass(s, "ge-table-focus-border"), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${t.left}px`), this.domService.setStyle(s, "top", `${t.top}px`), this.domService.setStyle(s, "width", "1px"), this.domService.setStyle(s, "height", `${t.height}px`), this.domService.setStyle(s, "z-index", "9999"), this.applyStyle(s, o), this.domService.appendChild(e, s), s = this.domService.createElement("div"), this.domService.addClass(s, "ge-table-focus-border"), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${t.left + t.width - 1}px`), this.domService.setStyle(s, "top", `${t.top}px`), this.domService.setStyle(s, "width", "1px"), this.domService.setStyle(s, "height", `${t.height}px`), this.domService.setStyle(s, "z-index", "9999"), this.applyStyle(s, o), this.domService.appendChild(e, s), s = this.domService.createElement("div"), this.domService.addClass(s, "ge-table-focus-border"), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${t.left}px`), this.domService.setStyle(s, "top", `${t.top}px`), this.domService.setStyle(s, "width", `${t.width}px`), this.domService.setStyle(s, "height", "1px"), this.domService.setStyle(s, "z-index", "9999"), this.applyStyle(s, o), this.domService.appendChild(e, s), s = this.domService.createElement("div"), this.domService.addClass(s, "ge-table-focus-border"), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${t.left}px`), this.domService.setStyle(s, "top", `${t.top + t.height - 1}px`), this.domService.setStyle(s, "width", `${t.width}px`), this.domService.setStyle(s, "height", "1px"), this.domService.setStyle(s, "z-index", "9999"), this.applyStyle(s, o), this.domService.appendChild(e, s), e;
443
+ }
444
+ addVerticalBorder(e, t, o = "ge-table-body-center-vertical-border") {
445
+ const s = this.domService.createElement("div");
446
+ return this.domService.addClass(s, o), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${e.left}px`), this.domService.setStyle(s, "top", `${e.top}px`), this.domService.setStyle(s, "width", "1px"), this.domService.setStyle(s, "height", `${e.height}px`), this.domService.appendChild(t, s), s;
447
+ }
448
+ addDiv(e, t, o = "") {
449
+ const s = this.domService.createElement("div");
450
+ return o && this.domService.addClass(s, o), this.domService.setStyle(s, "display", "clip"), this.domService.setStyle(s, "position", "absolute"), this.domService.setStyle(s, "left", `${t.left}px`), this.domService.setStyle(s, "top", `${t.top}px`), this.domService.setStyle(s, "width", `${t.width}px`), this.domService.setStyle(s, "height", `${t.height}px`), this.domService.appendChild(e, s), s;
451
+ }
452
+ applyStyleString(e, t) {
453
+ const o = t.split(";").map((s) => s.trim()).filter((s) => s);
454
+ for (const s of o) {
455
+ const [i, r] = s.split(":");
456
+ this.domService.setStyle(e, i.trim(), r.trim());
457
+ }
458
+ }
459
+ getDivOrCreateDiv(e, t) {
460
+ let o = t.cache[e];
461
+ return o ? (o.innerText = "", o) : (o = this.domService.createElement("div"), t.cache[e] = o, o);
462
+ }
463
+ }
464
+ const Z = (a) => a === "header" ? "header" : a === "footer" ? "footer" : "body";
465
+ class Ge {
466
+ constructor(e, t) {
467
+ if (this.rowIdx = -1, this.colIdx = -1, this.action = null, this.inputType = null, this.className = "", e !== null && (e instanceof HTMLDivElement || e instanceof HTMLSpanElement || e instanceof HTMLInputElement)) {
468
+ this.className = e.className, this.action = e.getAttribute("data-ge-action"), this.inputType = e.getAttribute("data-input-type"), this.rowIdx = Number(e.getAttribute("data-row-index")), this.colIdx = Number(e.getAttribute("data-col-index"));
469
+ const o = e.getAttribute("data-area");
470
+ if (o && (this.areaIdent = Z(o), this.areaModel = t.tableModel.getAreaModel(this.areaIdent), this.row = this.areaModel.getRowByIndex(this.rowIdx)), e instanceof HTMLInputElement) {
471
+ const s = e;
472
+ this.value = s.value;
473
+ }
474
+ }
475
+ }
476
+ }
477
+ class Ve {
478
+ constructor(e) {
479
+ this.tableScope = e, this.doubleClickDelay = 500, this.expandedAll = !0, this.mouseDown = !1, this.dragging = !1, this.lastClicked = 0, this.tableScope.hostElement.addEventListener("click", this.onHostElementClicked.bind(this)), this.tableScope.hostElement.addEventListener("dblclick", this.onHostElementDblClicked.bind(this)), this.tableScope.hostElement.addEventListener("mousedown", this.onMouseDown.bind(this)), this.tableScope.hostElement.addEventListener("mousemove", this.onMouseMove.bind(this)), this.tableScope.hostElement.addEventListener("mouseup", this.onMouseUp.bind(this)), this.tableScope.hostElement.addEventListener("contextmenu", this.onContextmenu.bind(this)), this.tableScope.hostElement._MouseHandler = "true", this.tableScope.scrollViewport.addEventListener("scroll", this.tableScope.adjustAfterScrolling.bind(this.tableScope)), [window, this.tableScope.hostElement].forEach(
480
+ (t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
481
+ );
482
+ }
483
+ /**
484
+ * Handles the "contextmenu" event.
485
+ *
486
+ * @private
487
+ * @param {MouseEvent} evt - The mouse event object.
488
+ * @return {void}
489
+ */
490
+ onContextmenu(e) {
491
+ this.mouseEvent = e;
492
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
493
+ this.tableScope.contextmenu(t);
494
+ }
495
+ /**
496
+ * Handles the click event on the host element.
497
+ *
498
+ * @param {MouseEvent} event - The click event.
499
+ *
500
+ * @return {void}
501
+ */
502
+ onHostElementClicked(e) {
503
+ const t = Date.now();
504
+ if (t - this.lastClicked < this.doubleClickDelay)
505
+ return;
506
+ this.lastClicked = t;
507
+ const o = new Ge(e.target, this.tableScope);
508
+ if (o.action === "toggleExpandCollapseAll")
509
+ this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
510
+ else if (o.action === "toggleHeaderGroup")
511
+ this.tableScope.toggleHeaderGroup(o), e.preventDefault(), e.stopPropagation();
512
+ else if (o.inputType === "checkbox" && o.areaIdent)
513
+ this.tableScope.toggleRowCheckbox(o.rowIdx, o.colIdx, o.areaIdent), e.preventDefault(), e.stopPropagation();
514
+ else if (q(o.row) && o.areaModel) {
515
+ const s = o.colIdx === this.getArrowColumnIndex() && e.altKey, i = o.className.includes("ge-table-tree-arrow-div");
516
+ if (s || i) {
517
+ e.preventDefault(), e.stopPropagation();
518
+ const r = o.row;
519
+ r.expanded = !r.expanded, "recalcVisibleTreeRows" in o.areaModel && o.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(r);
520
+ }
521
+ }
522
+ if (o.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
523
+ const s = this.tableScope.tableOptions.getFocusModel();
524
+ s == null || s.clear(), s == null || s.setFocus(o.rowIdx, o.colIdx);
525
+ }
526
+ this.publishGeMouseEvent(e, 1);
527
+ }
528
+ /**
529
+ * Handles the double click event on the host element.
530
+ * This method is private.
531
+ *
532
+ * @param {MouseEvent} event - The double click event.
533
+ */
534
+ onHostElementDblClicked(e) {
535
+ if (this.lastClicked = Date.now(), e.target instanceof HTMLElement) {
536
+ const t = e.target, o = t.getAttribute("data-area"), s = Z(o), i = Number(t.getAttribute("data-row-index")), r = Number(t.getAttribute("data-col-index")), n = this.tableScope.tableModel.getAreaModel(s);
537
+ if (o && s === "header")
538
+ this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, i, r));
539
+ else if (t.getAttribute("data-row-index")) {
540
+ const l = n.getRowByIndex(i);
541
+ if (o && s === "body" && n.isEditable(i, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(i, r)), q(l) && r === this.getArrowColumnIndex()) {
542
+ e.preventDefault(), e.stopPropagation();
543
+ const d = l;
544
+ d.expanded = !d.expanded, "recalcVisibleTreeRows" in n && n.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(d);
545
+ }
546
+ }
547
+ }
548
+ this.publishGeMouseEvent(e, 2);
549
+ }
550
+ /**
551
+ * Publishes a GeMouseEvent.
552
+ *
553
+ * @param {MouseEvent} event - The MouseEvent to publish.
554
+ * @param {number} clickCount - The number of clicks for the GeMouseEvent.
555
+ *
556
+ * @return {void}
557
+ */
558
+ publishGeMouseEvent(e, t) {
559
+ var o;
560
+ this.mouseEvent = e, this.geMouseEventOld = (o = this.geMouseEvent) == null ? void 0 : o.clone(), this.geMouseEvent = this.tableScope.createGeMouseEvent(e), this.geMouseEvent && (this.geMouseEvent.clickCount = t), this.tableScope.onMouseClicked(this.geMouseEvent, this.geMouseEventOld), this.tableScope.publishGeMouseEvent(this.geMouseEvent), t === 1 && this.tableScope.debounceRepaint();
561
+ }
562
+ /**
563
+ * Update the collapsed/expanded state of a tree row.
564
+ *
565
+ * @param {TreeRowIf<any>} tr - The tree row object.
566
+ * @returns {void}
567
+ */
568
+ updateCollapsedExpandedState(e) {
569
+ var o, s, i, r, n;
570
+ const t = (s = (o = this.tableScope.tableOptions) == null ? void 0 : o.autoRestoreOptions) == null ? void 0 : s.getRowId;
571
+ if (t) {
572
+ const l = (i = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : i.collapsedExpandedStateGet().mode, d = l === "collapsed" && !e.expanded || l === "expanded" && e.expanded, c = l === "collapsed" && e.expanded || l === "expanded" && !e.expanded, h = t(e.data);
573
+ d ? (r = this.tableScope.storeStateCollapsedExpandService) == null || r.collapsedStateIdsPush(h) : c && ((n = this.tableScope.storeStateCollapsedExpandService) == null || n.collapsedStateIdsRemove(h));
574
+ }
575
+ }
576
+ getArrowColumnIndex() {
577
+ return this.tableScope.tableModel.isRowCheckboxVisible() ? 1 : 0;
578
+ }
579
+ onMouseDown(e) {
580
+ this.dragging || (this.mouseEvent = e, this.startMouseEvent = this.tableScope.createGeMouseEvent(this.mouseEvent), this.tableScope.onMouseDown(this.startMouseEvent), this.mouseDown = !0);
581
+ }
582
+ onMouseMove(e) {
583
+ this.mouseEvent = e, this.mouseDown ? (this.dragging || (this.dragging = !0, this.tableScope.setDragging(!0)), requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))) : requestAnimationFrame(this.mouseMoveOnFrame.bind(this));
584
+ }
585
+ onMouseUp(e) {
586
+ this.mouseEvent = e, this.dragging && requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)), this.mouseDown = !1, this.dragging = !1, this.tableScope.setDragging(!1);
587
+ }
588
+ mouseDraggingOnFrame() {
589
+ var e;
590
+ if (this.mouseEvent) {
591
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
592
+ (e = this.startMouseEvent) != null && e.originalEvent && (t.draggingX = this.mouseEvent.clientX - this.startMouseEvent.originalEvent.clientX, t.draggingY = this.mouseEvent.clientY - this.startMouseEvent.originalEvent.clientY), this.tableScope.mouseDraggingOnFrame(t, this.startMouseEvent);
593
+ }
594
+ }
595
+ mouseDraggingEndOnFrame() {
596
+ var e;
597
+ if (this.mouseEvent) {
598
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
599
+ (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);
600
+ }
601
+ }
602
+ mouseMoveOnFrame() {
603
+ if (this.mouseEvent) {
604
+ const e = this.tableScope.createGeMouseEvent(this.mouseEvent);
605
+ this.tableScope.mouseMove(e);
606
+ }
607
+ }
608
+ }
609
+ class ze {
610
+ constructor(e) {
611
+ this.tableScope = e;
612
+ }
613
+ /**
614
+ * Updates the cells in the table based on the provided events.
615
+ *
616
+ * @param {TableCellUpdateEventIf[]} events - The array of events representing the updates to perform on the cells.
617
+ * @param {boolean} [repaintAll=false] - Optional parameter indicating whether to repaint all cells or not. Default value is false. If true, the full table will be rendered. If false, the table cell will be rendered immediately.
618
+ *
619
+ * @return {void} - This method doesn't return anything.
620
+ */
621
+ updateCells(e, t = !1) {
622
+ this.tableScope.updateCells(e, t);
623
+ }
624
+ /**
625
+ * Notifies that the external filter has changed.
626
+ *
627
+ * @return {void}
628
+ */
629
+ externalFilterChanged() {
630
+ this.tableScope.externalFilterChanged();
631
+ }
632
+ /**
633
+ * Scrolls the table body to the specified pixel coordinates.
634
+ *
635
+ * @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0.
636
+ * @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0.
637
+ * @return {void}
638
+ */
639
+ scrollToPixel(e = 0, t = 0) {
640
+ this.tableScope.scrollToPixel(e, t);
641
+ }
642
+ /**
643
+ * Scrolls to the specified index in both horizontal and vertical directions.
644
+ *
645
+ * @param {number} indexX - The index of the column to scroll to in the horizontal direction. Default is 0.
646
+ * @param {number} indexY - The index of the row to scroll to in the vertical direction. Default is 0.
647
+ *
648
+ * @return undefined
649
+ */
650
+ scrollToIndex(e = 0, t = 0) {
651
+ this.tableScope.scrollToIndex(e, t);
652
+ }
653
+ /**
654
+ * Sets whether the header is visible or not.
655
+ *
656
+ * @param _visible - A boolean value indicating whether the header should be visible. Default value is true.
657
+ *
658
+ * @return undefined
659
+ */
660
+ setHeaderVisible(e = !0) {
661
+ }
662
+ /**
663
+ * Sets the visibility of a column in the table.
664
+ *
665
+ * @param {_column} - The column index or column definition to set visibility for.
666
+ * @param {_visible=true} - The flag to set visibility to. true for visible, false for hidden.
667
+ *
668
+ * @return {void} - There is no return value.
669
+ */
670
+ setColumnVisible(e, t = !0) {
671
+ }
672
+ /**
673
+ * Returns whether a column is visible or not.
674
+ *
675
+ * @param {number | ColumnDefIf} _column - The column index or the column definition.
676
+ * @return {boolean} - True if the column is visible, false otherwise.
677
+ */
678
+ isColumnVisible(e) {
679
+ return !0;
680
+ }
681
+ /**
682
+ * Checks if the header is visible.
683
+ *
684
+ * @return {boolean} - Returns true if the header is visible, otherwise returns false.
685
+ */
686
+ isHeaderVisible() {
687
+ return !0;
688
+ }
689
+ /**
690
+ * Sets the visibility of the footer.
691
+ *
692
+ * @param {boolean} _visible - Indicates whether the footer should be visible or not. Default value is true.
693
+ *
694
+ * @return {void} - This method does not return any value.
695
+ */
696
+ setFooterVisible(e = !0) {
697
+ }
698
+ /**
699
+ * Determines if the footer is visible.
700
+ *
701
+ * @returns {boolean} True if the footer is visible, false otherwise.
702
+ */
703
+ isFooterVisible() {
704
+ return !0;
705
+ }
706
+ /**
707
+ * Repaints the table.
708
+ *
709
+ * This method calls the repaint method of the tableScope object
710
+ * to update and redraw the table based on the latest data.
711
+ */
712
+ repaint() {
713
+ this.tableScope.repaint();
714
+ }
715
+ /**
716
+ * Repaints the table scope with hard repaint.
717
+ * Repaints the UI by resetting the size of the wrapper div,
718
+ * adjusting the containers and rows, and performing additional adjustments
719
+ * after scrolling.
720
+ *
721
+ * @return {void}
722
+ */
723
+ repaintHard() {
724
+ this.tableScope.repaintHard();
725
+ }
726
+ /**
727
+ * Clears the current selection of the table.
728
+ * The table will be rendered automatically.
729
+ *
730
+ * @returns {void}
731
+ */
732
+ clearSelection() {
733
+ this.tableScope.clearSelection(!0);
734
+ }
735
+ /**
736
+ * Sets the selection model for the table scope.
737
+ *
738
+ * @param {SelectionModel} sm - The selection model to be set.
739
+ * @param {boolean} [repaint=true] - Indicates whether the table should be repainted after setting the selection model. Default value is true.
740
+ *
741
+ * @return {void}
742
+ */
743
+ setSelectionModel(e, t = !0) {
744
+ this.tableScope.setSelectionModel(e, t);
745
+ }
746
+ /**
747
+ * Triggers the action with the given action ID.
748
+ * This function can be invoked programmatically.
749
+ *
750
+ * @param {ActionId} actionId - The ID of the action to trigger.
751
+ * @return {void}
752
+ */
753
+ triggerAction(e) {
754
+ this.tableScope.onActionTriggered(e);
755
+ }
756
+ /**
757
+ * Retrieves the mapping of shortcuts to corresponding action in the current table scope.
758
+ *
759
+ * @return {ShortcutActionIdMapping} The mapping of shortcuts to corresponding action.
760
+ */
761
+ getShortcutActionMapping() {
762
+ return this.tableScope.shortcutService.getShortcutActionMapping();
763
+ }
764
+ /**
765
+ * Copies the selected data from the table to the clipboard.
766
+ *
767
+ * @return {Promise<string>} - A promise that resolves with the copied data as a string.
768
+ */
769
+ copyToClipboard() {
770
+ return this.tableScope.copyService.copyToClipboard(
771
+ this.tableScope.tableModel,
772
+ this.tableScope.selectionModel(),
773
+ this.tableScope.focusModel()
774
+ );
775
+ }
776
+ /**
777
+ * Retrieves the current scope of the table.
778
+ *
779
+ * @returns {TableScope} The current scope of the table.
780
+ */
781
+ getTableScope() {
782
+ return this.tableScope;
783
+ }
784
+ /**
785
+ * Retrieves the selection model of the table.
786
+ *
787
+ * @return {SelectionModelIf | undefined} The selection model of the table,
788
+ * or undefined if no selection model is available.
789
+ */
790
+ getSelectionModel() {
791
+ return this.tableScope.selectionModel();
792
+ }
793
+ }
794
+ class ee {
795
+ constructor(e) {
796
+ this.getStorageKeyFn = e;
797
+ }
798
+ autoConvertMapToObject(e) {
799
+ const t = {};
800
+ if (e instanceof Map) {
801
+ const o = e;
802
+ for (const s of [...o]) {
803
+ const [
804
+ i,
805
+ r
806
+ ] = s;
807
+ t[i] = r;
808
+ }
809
+ }
810
+ return t;
811
+ }
812
+ checkAndPersistItem(e, t) {
813
+ const o = this.getStorageKeyFn;
814
+ if (o) {
815
+ const s = o();
816
+ if (s) {
817
+ const i = s + e;
818
+ if ((t + "").includes("Map")) {
819
+ const r = this.autoConvertMapToObject(t);
820
+ this.persistItem(i, r);
821
+ } else
822
+ this.persistItem(i, t);
823
+ }
824
+ }
825
+ }
826
+ persistItem(e, t) {
827
+ t ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
828
+ }
829
+ loadFromLocalStorage(e) {
830
+ const t = localStorage.getItem(e);
831
+ return t ? JSON.parse(t) : null;
832
+ }
833
+ // private loadItems() {
834
+ // const fn = this.getStorageKeyFn;
835
+ // if (fn) {
836
+ // const key = fn();
837
+ // if (key) {
838
+ // // A main key is given by function from options
839
+ // const subKey = key + this.CHECKED_STATE;
840
+ // const arr = this.loadFromLocalStorage<Array<string | number>>(subKey);
841
+ // if (arr) {
842
+ // this.checkedStateIds.length = 0;
843
+ // arr.forEach(a => this.checkedStateIds.push(a));
844
+ // }
845
+ //
846
+ // const subKey2 = key + this.COLLAPSED_EXPANDED_STATE;
847
+ // const data = this.loadFromLocalStorage<CollapsedExpandedData>(subKey2);
848
+ // if (data) {
849
+ // this.collapsedExpandedState = data;
850
+ // }
851
+ //
852
+ // const subKey3 = key + this.SELECTED_STATE;
853
+ // const arr3 = this.loadFromLocalStorage<object>(subKey3);
854
+ // if (arr3) {
855
+ // const map: Map<string | number, string[]> = new Map(Object.entries(arr3));
856
+ // if (map) {
857
+ // this.selectedStateIds.clear();
858
+ // map.forEach((col, k) => this.selectedStateIds.set(k, col));
859
+ // }
860
+ // }
861
+ //
862
+ // const subKey4 = key + this.SCROLL_STATE;
863
+ // let scrollOffset = this.loadFromLocalStorage<[number, number]>(subKey4);
864
+ // this.scrollOffset = scrollOffset ? scrollOffset : [0, 0];
865
+ // }
866
+ // }
867
+ // }
868
+ }
869
+ class Ne extends ee {
870
+ constructor(e) {
871
+ super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
872
+ }
873
+ getScrollOffset() {
874
+ return this.scrollOffset;
875
+ }
876
+ updateScrollOffset(e) {
877
+ this.scrollOffset = e, this.checkAndPersistItem(this.SCROLL_STATE, this.scrollOffset);
878
+ }
879
+ load() {
880
+ const e = this.getStorageKeyFn;
881
+ if (e) {
882
+ const t = e();
883
+ if (t) {
884
+ const o = t + this.SCROLL_STATE;
885
+ let s = this.loadFromLocalStorage(o);
886
+ this.scrollOffset = s || [0, 0];
887
+ }
888
+ }
889
+ }
890
+ }
891
+ class je {
892
+ constructor(e = "collapsed", t = [], o = !1, s = !1) {
893
+ this.mode = e, this.rowIds = t, this.allCollapsed = o, this.allExpanded = s;
894
+ }
895
+ }
896
+ class Xe extends ee {
897
+ constructor(e) {
898
+ super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new je(), this.load();
899
+ }
900
+ collapsedExpandedStateGet() {
901
+ return this.collapsedExpandedState;
902
+ }
903
+ collapsedExpandedStateIncludes(e) {
904
+ return this.collapsedExpandedState.rowIds.includes(e);
905
+ }
906
+ collapsedStateIdsPush(e) {
907
+ this.collapsedExpandedState.rowIds.includes(e) || (this.collapsedExpandedState.rowIds.push(e), this.collapsedExpandedState.allCollapsed = !1, this.collapsedExpandedState.allExpanded = !1, this.persist());
908
+ }
909
+ collapsedStateIdsRemove(e) {
910
+ const t = this.collapsedExpandedState.rowIds.indexOf(e);
911
+ t !== -1 && (this.collapsedExpandedState.rowIds.splice(t, 1), this.collapsedExpandedState.allCollapsed = !1, this.collapsedExpandedState.allExpanded = !1, this.persist());
912
+ }
913
+ collapsedStateAll(e) {
914
+ this.collapsedExpandedState.rowIds = [], this.collapsedExpandedState.mode = e ? "collapsed" : "expanded", this.collapsedExpandedState.allCollapsed = !e, this.collapsedExpandedState.allExpanded = e, this.persist();
915
+ }
916
+ load() {
917
+ const e = this.getStorageKeyFn;
918
+ if (e) {
919
+ const t = e();
920
+ if (t) {
921
+ const o = t + this.COLLAPSED_EXPANDED_STATE, s = this.loadFromLocalStorage(o);
922
+ s && (this.collapsedExpandedState = s);
923
+ }
924
+ }
925
+ }
926
+ persist() {
927
+ this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
928
+ }
929
+ }
930
+ class Ke extends ee {
931
+ constructor(e) {
932
+ super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
933
+ }
934
+ getSortItems() {
935
+ return this.sortItems;
936
+ }
937
+ setSortItems(e) {
938
+ this.sortItems = e, this.checkAndPersistItem(this.SORTING_STATE, this.sortItems);
939
+ }
940
+ load() {
941
+ const e = this.getStorageKeyFn;
942
+ if (e) {
943
+ const t = e();
944
+ if (t) {
945
+ const o = t + this.SORTING_STATE, s = this.loadFromLocalStorage(o);
946
+ this.sortItems = s || [];
947
+ }
948
+ }
949
+ }
950
+ }
951
+ class T {
952
+ constructor(e = 0, t = 0, o = 0, s = 0, i) {
953
+ this.left = e, this.width = t, this.height = o, this.top = s, this.index = i;
954
+ }
955
+ }
956
+ class Ye {
957
+ constructor(e, t, o, s) {
958
+ this.hostElement = e, this.tableModel = t, this.dom = o, this.tableOptions = s, this.scrollTop = 0, this.areaBodyWestGeo = new T(), this.areaBodyCenterGeo = new T(), this.areaBodyEastGeo = new T();
959
+ const i = this.hostElement;
960
+ i.innerText = "", this.dom.setAttribute(i, "tabindex", "0"), this.dom.setStyle(
961
+ this.dom.addClass("ge-table", i),
962
+ "position",
963
+ "relative"
964
+ ), this.hoverRow = o.applyStylePosistionAbsolute(
965
+ o.createDivWithClass("ge-table-hover-row", i)
966
+ ), this.hoverColumn = o.applyStylePosistionAbsolute(
967
+ o.createDivWithClass("ge-table-hover-column", i)
968
+ ), this.draggingColumn = o.applyStylePosistionAbsolute(
969
+ o.createDivWithClass("ge-table-dragging-column", i)
970
+ ), this.areaHeaderWest = o.appendRelativeChildDiv(
971
+ o.applyStylePosistionAbsolute(
972
+ o.createAreaDivWithClass("ge-table-header ge-table-header-west", i, "header", "west")
973
+ )
974
+ ), this.areaHeaderCenter = o.appendRelativeChildDiv(
975
+ o.applyStylePosistionAbsolute(
976
+ o.createAreaDivWithClass("ge-table-header ge-table-header-center", i, "header", "center")
977
+ )
978
+ ), this.areaHeaderEast = o.appendRelativeChildDiv(
979
+ o.applyStylePosistionAbsolute(
980
+ o.createAreaDivWithClass("ge-table-header ge-table-header-east", i, "body", "east")
981
+ )
982
+ ), this.areaBodyWest = o.appendRelativeChildDiv(
983
+ o.applyStylePosistionAbsolute(
984
+ o.createAreaDivWithClass("ge-table-body ge-table-body-west", i, "body", "west")
985
+ )
986
+ ), this.areaBodyEast = o.appendRelativeChildDiv(
987
+ o.applyStylePosistionAbsolute(
988
+ o.createAreaDivWithClass("ge-table-body ge-table-body-east", i, "body", "east")
989
+ )
990
+ ), this.areaFooterWest = o.appendRelativeChildDiv(
991
+ o.applyStylePosistionAbsolute(
992
+ o.createAreaDivWithClass("ge-table-footer ge-table-footer-west", i, "footer", "west")
993
+ )
994
+ ), this.areaFooterCenter = o.appendRelativeChildDiv(
995
+ o.applyStylePosistionAbsolute(
996
+ o.createAreaDivWithClass("ge-table-footer ge-table-footer-center", i, "footer", "center")
997
+ )
998
+ ), this.areaFooterEast = o.appendRelativeChildDiv(
999
+ o.applyStylePosistionAbsolute(
1000
+ o.createAreaDivWithClass("ge-table-footer ge-table-footer-east", i, "footer", "east")
1001
+ )
1002
+ ), this.scrollViewport = o.applyStyleOverflowAuto(
1003
+ this.tableOptions.overflowX ?? "auto",
1004
+ this.tableOptions.overflowY ?? "auto",
1005
+ o.applyStyleNoPadding(
1006
+ o.applyStylePosistionAbsolute(
1007
+ o.createAreaDivWithClass("ge-table-scroll-viewport", i, "body", "center")
1008
+ )
1009
+ )
1010
+ ), this.contentWrapperDiv = o.applyStyleNoPadding(
1011
+ o.applyStylePosistionRelative(
1012
+ o.createDivWithClass("ge-table-scroll-content-wrapper", this.scrollViewport)
1013
+ )
1014
+ ), this.contentDiv = o.applyStyleNoPadding(
1015
+ o.applyStylePosistionRelative(
1016
+ o.createDivWithClass("ge-table-scroll-content", this.contentWrapperDiv)
1017
+ )
1018
+ ), this.areaBodyCenter = o.appendRelativeChildDiv(
1019
+ o.createDivWithClass("ge-table-body-center", this.contentDiv)
1020
+ ), this.borderHeaderBottom = o.applyStylePosistionAbsolute(
1021
+ o.createDivWithClass("ge-table-header-border", i)
1022
+ ), this.borderFixedWest = o.applyStylePosistionAbsolute(
1023
+ o.createDivWithClass("ge-table-west-fixed-column-border", i)
1024
+ ), this.borderFixedEast = o.applyStylePosistionAbsolute(
1025
+ o.createDivWithClass("ge-table-east-fixed-column-border", i)
1026
+ ), this.borderFooterTop = o.applyStylePosistionAbsolute(
1027
+ o.createDivWithClass("ge-table-footer-border", i)
1028
+ );
1029
+ }
1030
+ /**
1031
+ * Adjusts the containers and rows of the table based on the current state.
1032
+ *
1033
+ * @return {void}
1034
+ */
1035
+ adjustContainersAndRows() {
1036
+ const e = this.tableModel.getPadding(), t = this.hostElement.clientWidth, o = this.hostElement.clientHeight;
1037
+ this.dom.applyStyle(this.scrollViewport, {
1038
+ width: `${t - e.left}px`,
1039
+ height: `${o - e.top}px`,
1040
+ top: `${e.top}px`,
1041
+ left: `${e.left}px`
1042
+ }), this.scrollTop = this.scrollViewport.scrollTop, this.dom.applyStyle(this.contentDiv, {
1043
+ width: `${this.scrollViewport.clientWidth}px`,
1044
+ height: `${this.scrollViewport.clientHeight}px`,
1045
+ top: `${this.scrollTop}px`,
1046
+ left: `${this.scrollViewport.scrollLeft}px`
1047
+ }), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height = o - e.top - e.bottom, this.areaBodyWestGeo.top = e.top, this.areaBodyWestGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyWest.parent, this.areaBodyWestGeo), this.tableOptions.fixedWestSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
1048
+ this.dom.applyStyle(this.borderFixedWest, {
1049
+ width: "1px",
1050
+ height: `${this.areaBodyWestGeo.height}px`,
1051
+ top: `${this.areaBodyWestGeo.top}px`,
1052
+ left: `${this.areaBodyWestGeo.width}px`
1053
+ })
1054
+ ) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height = o - e.top - e.bottom, this.areaBodyEastGeo.top = e.top, this.areaBodyEastGeo.left = t - e.right, this.dom.applyStyleInPx(this.areaBodyEast.parent, this.areaBodyEastGeo), this.tableOptions.fixedEastSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
1055
+ this.dom.applyStyle(this.borderFixedEast, {
1056
+ width: "1px",
1057
+ height: `${this.areaBodyEastGeo.height}px`,
1058
+ top: `${this.areaBodyEastGeo.top}px`,
1059
+ left: `${this.areaBodyEastGeo.left}px`
1060
+ })
1061
+ ) : this.dom.applyDisplayNoneStyle(this.borderFixedEast), this.areaBodyCenterGeo.width = t - e.left - e.right, this.areaBodyCenterGeo.height = o - e.top - e.bottom, this.areaBodyCenterGeo.top = 0, this.areaBodyCenterGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyCenter.parent, this.areaBodyCenterGeo), this.dom.applyStyle(this.areaHeaderCenter.parent, {
1062
+ width: `${t - e.left - e.right}px`,
1063
+ height: `${e.top}px`,
1064
+ top: "0",
1065
+ left: `${e.left}px`
1066
+ }), this.dom.applyStyle(this.areaHeaderWest.parent, {
1067
+ width: `${e.left}px`,
1068
+ height: `${e.top}px`,
1069
+ top: "0",
1070
+ left: "0"
1071
+ }), this.dom.applyStyle(this.areaHeaderEast.parent, {
1072
+ width: `${e.right}px`,
1073
+ height: `${e.top}px`,
1074
+ top: "0",
1075
+ left: `${t - e.right}px`
1076
+ }), this.tableOptions.headerSeparatorBorderVisible && this.tableModel.isHeaderVisibe() ? this.dom.applyDisplayBlockStyle(
1077
+ this.dom.applyStyle(this.borderHeaderBottom, {
1078
+ width: `${t}px`,
1079
+ height: "1px",
1080
+ top: `${e.top}px`,
1081
+ left: "0px"
1082
+ })
1083
+ ) : this.dom.applyDisplayNoneStyle(this.borderHeaderBottom), this.dom.applyStyle(this.areaFooterWest.parent, {
1084
+ width: `${e.left}px`,
1085
+ height: `${e.bottom}px`,
1086
+ top: `${o - e.bottom}px`,
1087
+ left: "0"
1088
+ }), this.dom.applyStyle(this.areaFooterCenter.parent, {
1089
+ width: `${t - e.left - e.right}px`,
1090
+ height: `${e.bottom}px`,
1091
+ top: `${o - e.bottom}px`,
1092
+ left: `${e.left}px`
1093
+ }), this.dom.applyStyle(this.areaFooterEast.parent, {
1094
+ width: `${e.right}px`,
1095
+ height: `${e.bottom}px`,
1096
+ top: `${o - e.bottom}px`,
1097
+ left: `${t - e.right}px`
1098
+ }), this.tableOptions.footerSeparatorBorderVisible && this.tableModel.isFooterVisibe() ? this.dom.applyDisplayBlockStyle(
1099
+ this.dom.applyStyle(this.borderFooterTop, {
1100
+ width: `${t}px`,
1101
+ height: "1px",
1102
+ top: `${o - e.bottom}px`,
1103
+ left: "0px"
1104
+ })
1105
+ ) : this.dom.applyDisplayNoneStyle(this.borderFooterTop), this.adjustAfterScrolling();
1106
+ }
1107
+ /**
1108
+ * Adjusts the position or appearance of elements after scrolling.
1109
+ * This method must be overwritten in child classes.
1110
+ *
1111
+ * @return {void}
1112
+ */
1113
+ adjustAfterScrolling() {
1114
+ }
1115
+ /**
1116
+ * Resets the size of the wrapper div based on the content dimensions.
1117
+ *
1118
+ * @protected
1119
+ *
1120
+ * @returns {void} Returns nothing.
1121
+ */
1122
+ resetSizeOfWrapperDiv() {
1123
+ const e = `${this.tableModel.getContentWidthInPixel()}px`, t = `${this.tableModel.getContentHeightInPixel() + 1}px`;
1124
+ this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
1125
+ }
1126
+ }
1127
+ class E {
1128
+ /**
1129
+ * Represents a constructor for a class.
1130
+ * @constructor
1131
+ * @param {number} r1 - The value for r1.
1132
+ * @param {number} c1 - The value for c1.
1133
+ * @param {number} r2 - The value for r2.
1134
+ * @param {number} c2 - The value for c2.
1135
+ * @param {boolean} [gammaRange=false] - The value for gammaRange. Defaults to false. gammaRange will be used for AreaModelCellGroups, but it's not implemented yet!
1136
+ */
1137
+ constructor(e, t, o, s, i = !1) {
1138
+ this.r1 = e, this.c1 = t, this.r2 = o, this.c2 = s, this.gammaRange = i;
1139
+ }
1140
+ static create(e) {
1141
+ return e.gammaRange === void 0 && (e.gammaRange = !1), new E(
1142
+ e.rowIndex1,
1143
+ e.columnIndex1,
1144
+ e.rowIndex2,
1145
+ e.columnIndex2,
1146
+ e.gammaRange
1147
+ );
1148
+ }
1149
+ static singleCell(e, t) {
1150
+ return new E(e, t, e, t);
1151
+ }
1152
+ static singleRow(e) {
1153
+ return new E(e, 0, e, Number.MAX_SAFE_INTEGER);
1154
+ }
1155
+ static singleColumn(e) {
1156
+ return new E(0, e, Number.MAX_SAFE_INTEGER, e);
1157
+ }
1158
+ isInRange(e, t) {
1159
+ return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
1160
+ }
1161
+ }
1162
+ class qe {
1163
+ constructor(e, t) {
1164
+ this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
1165
+ }
1166
+ init() {
1167
+ if (this.areaModel.getMaxColspan() < 2 && this.areaModel.getMaxRowspan() < 2)
1168
+ return;
1169
+ this.colAndRowspanRanges = [];
1170
+ const e = this.areaModel.getRowCount(), t = this.tableModel.getColumnCount();
1171
+ for (let o = 0; o < e; o++)
1172
+ for (let s = 0; s < t; s++) {
1173
+ let i = this.areaModel.getColspanAt(o, s), r = this.areaModel.getRowspanAt(o, s);
1174
+ if (i > 1 || r > 1) {
1175
+ i === 0 && (i = 1), r === 0 && (r = 1);
1176
+ const n = "gammaCells" in this.areaModel;
1177
+ this.colAndRowspanRanges.push(
1178
+ new E(o, s, o + r - 1, s + i - 1, n)
1179
+ );
1180
+ }
1181
+ }
1182
+ }
1183
+ getRanges() {
1184
+ return this.colAndRowspanRanges ? this.colAndRowspanRanges : [];
1185
+ }
1186
+ isInRange(e, t) {
1187
+ if (this.colAndRowspanRanges) {
1188
+ for (const o of this.colAndRowspanRanges)
1189
+ if (o.isInRange(e, t))
1190
+ return !0;
1191
+ }
1192
+ return !1;
1193
+ }
1194
+ }
1195
+ class Ue {
1196
+ constructor(e, t, o) {
1197
+ this.header = e, this.body = t, this.footer = o;
1198
+ }
1199
+ }
1200
+ class Je extends Ye {
1201
+ constructor(e, t, o, s) {
1202
+ var r, n;
1203
+ super(e, t, o, s), this.dragging = !1, this.editing = !1, this.storedColumnWidths = [], this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
1204
+ header: [],
1205
+ body: [],
1206
+ footer: []
1207
+ }, this.tree = !1, this.colAndRowspanModels = new Ue(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (n = this.tableOptions) != null && n.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), U(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
1208
+ (l) => {
1209
+ var d;
1210
+ this.colAndRowspanModels[l] = new qe(t, t.getAreaModel(l)), (d = this.colAndRowspanModels[l]) == null || d.init();
1211
+ }
1212
+ );
1213
+ }
1214
+ isEditing() {
1215
+ return this.editing;
1216
+ }
1217
+ /**
1218
+ * Resets the editor renderer by clearing its values and state.
1219
+ *
1220
+ * @function resetEditorRenderer
1221
+ * @memberof ClassName
1222
+ *
1223
+ * @returns {void}
1224
+ */
1225
+ resetEditorRenderer() {
1226
+ this.editorRenderer = void 0, this.editorRendererRow = -1, this.editorRendererColumn = -1, this.editing = !1;
1227
+ }
1228
+ /**
1229
+ * Clears the selection in the component.
1230
+ *
1231
+ * @param {boolean} rerender - Indicates whether to rerender the component after clearing the selection. Default value is false.
1232
+ *
1233
+ * @return {void}
1234
+ */
1235
+ clearSelection(e = !1) {
1236
+ if (this.getSelectionModel) {
1237
+ const t = this.getSelectionModel();
1238
+ t == null || t.clear(), e && this.repaint();
1239
+ }
1240
+ }
1241
+ /**
1242
+ * Initializes and renders the editor for a specified row and column index.
1243
+ *
1244
+ * @param {number} rowIdx - The index of the row.
1245
+ * @param {number} colIdx - The index of the column.
1246
+ */
1247
+ initRenderEditor(e, t) {
1248
+ var s;
1249
+ let o = (s = this.tableModel.getColumnDef(t)) == null ? void 0 : s.getEditRenderer;
1250
+ if (o || (o = this.tableOptions.getEditRenderer), o)
1251
+ if (this.editorRenderer = o(e, t), this.editorRenderer) {
1252
+ this.editorRendererRow = e, this.editorRendererColumn = t, this.editing = !0, this.repaint();
1253
+ const i = document.querySelector("input.ge-table-cell-editor-input");
1254
+ i && i.focus();
1255
+ } else
1256
+ this.resetEditorRenderer();
1257
+ }
1258
+ /**
1259
+ * Adjusts the content after scrolling and initiates a repaint of the component.
1260
+ *
1261
+ * @return {void}
1262
+ */
1263
+ repaint() {
1264
+ this.adjustAfterScrolling();
1265
+ }
1266
+ /**
1267
+ * Repaints the UI by resetting the size of the wrapper div,
1268
+ * adjusting the containers and rows, and performing additional adjustments
1269
+ * after scrolling.
1270
+ *
1271
+ * @return {void} This method does not return any value.
1272
+ */
1273
+ repaintHard() {
1274
+ this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.adjustAfterScrolling();
1275
+ }
1276
+ /**
1277
+ * Adjusts the table after scrolling. This method performs various adjustments
1278
+ * to the table's appearance and behavior after a scroll event occurs.
1279
+ */
1280
+ adjustAfterScrolling() {
1281
+ var e;
1282
+ for (const t of this.removables)
1283
+ t.remove();
1284
+ 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(
1285
+ new T(0, this.hostElement.clientWidth, 1, 0),
1286
+ this.hostElement,
1287
+ "ge-table-border"
1288
+ )), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
1289
+ new T(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
1290
+ this.hostElement,
1291
+ "ge-table-border"
1292
+ )), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
1293
+ new T(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
1294
+ this.hostElement,
1295
+ "ge-table-body-west-vertical-border"
1296
+ )), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
1297
+ new T(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
1298
+ this.hostElement,
1299
+ "ge-table-body-west-vertical-border"
1300
+ ));
1301
+ }
1302
+ /**
1303
+ * Checks if the scroll position should be saved and saves it.
1304
+ *
1305
+ * @return {void}
1306
+ */
1307
+ checkForScrollPosSaving() {
1308
+ var e, t;
1309
+ this.storeScrollPosStateService && ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreScrollPosition) && this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
1310
+ }
1311
+ /**
1312
+ * Updates the cells in the table with the provided values and optionally repaints all cells.
1313
+ *
1314
+ * @param {TableCellUpdateEventIf[]} events - The array of events containing information about the cells to update.
1315
+ * @param {boolean} repaintAll - Optional. If true, repaints all cells after updating. Defaults to false.
1316
+ *
1317
+ * @returns {void}
1318
+ */
1319
+ updateCells(e, t = !1) {
1320
+ e.forEach(
1321
+ (o) => {
1322
+ this.tableModel.getAreaModel(o.area).setValue(o.rowIndex, o.columnIndex, o.value), t || this.rerenderCellContent(o);
1323
+ }
1324
+ ), t && this.repaint();
1325
+ }
1326
+ /**
1327
+ * Rerenders the content of a table cell based on the given parameters.
1328
+ *
1329
+ * @param {TableCellUpdateEventIf} area - The area of the table.
1330
+ * @param {number} rowIndex - The index of the row.
1331
+ * @param {number} columnIndex - The index of the column.
1332
+ * @param {any} value - The new value to be displayed in the cell.
1333
+ * @param {string[]} cssClasses - An array of CSS classes to be applied to the cell.
1334
+ */
1335
+ rerenderCellContent({ area: e, rowIndex: t, columnIndex: o, value: s, cssClasses: i }) {
1336
+ const r = this.tableModel.getAreaModel(e), n = 'div[data-col-index="' + o + '"][data-row-index="' + t + '"][data-area="' + e + '"]', l = document.querySelector(n);
1337
+ if (l) {
1338
+ let d;
1339
+ const h = this.editorRenderer && this.editorRendererRow === t && this.editorRendererColumn === o ? this.editorRenderer : r.getCellRenderer(t, o);
1340
+ if (l.innerText = "", this.applyCssClasses(l, i), h)
1341
+ d = h.render(l, t, o, e, r, s, this.dom.domService), d && this.cleanupFunctions[e].push(d);
1342
+ else {
1343
+ const b = `${s}`;
1344
+ this.dom.addLabelDiv(l, b, !1, t, o, e);
1345
+ }
1346
+ const g = r.getCustomClassesAt(t, o);
1347
+ g.length && this.dom.addClasses(g, l);
1348
+ const f = r.getCustomStyleAt(t, o);
1349
+ if (f)
1350
+ for (const b in f)
1351
+ this.dom.setStyle(l, b, f[b]);
1352
+ }
1353
+ }
1354
+ /**
1355
+ * Stores the widths of all columns in the table.
1356
+ *
1357
+ * @protected
1358
+ * @function storeColumnWidths
1359
+ * @returns {void}
1360
+ */
1361
+ storeColumnWidths() {
1362
+ const e = this.tableModel.getColumnDefs();
1363
+ e != null && e.length && (this.storedColumnWidths = e.map((t, o) => this.tableModel.getColumnWidth(o)));
1364
+ }
1365
+ getAreaAndSideIdentByAttr(e) {
1366
+ if (e) {
1367
+ const t = this.getStringByAttr(e, "data-area"), o = this.getStringByAttr(e, "data-side");
1368
+ if (o && t)
1369
+ return [t, o];
1370
+ }
1371
+ return [void 0, void 0];
1372
+ }
1373
+ /**
1374
+ * Retrieves the specified area from the grid layout.
1375
+ *
1376
+ * @param {string} areaIdent - The identifier for the area ('header', 'body', or 'footer').
1377
+ * @param {string} sideIdent - The identifier for the side of the area ('west', 'center', or 'east').
1378
+ * @protected
1379
+ * @returns {HTMLElement} - The requested area element.
1380
+ * @throws {Error} - If the area identifier or side identifier is incorrect.
1381
+ */
1382
+ getArea(e, t) {
1383
+ if (e === "header") {
1384
+ if (t === "west")
1385
+ return this.areaHeaderWest;
1386
+ if (t === "center")
1387
+ return this.areaHeaderCenter;
1388
+ if (t === "east")
1389
+ return this.areaHeaderEast;
1390
+ } else if (e === "body") {
1391
+ if (t === "west")
1392
+ return this.areaBodyWest;
1393
+ if (t === "center")
1394
+ return this.areaBodyCenter;
1395
+ if (t === "east")
1396
+ return this.areaBodyEast;
1397
+ } else if (e === "footer") {
1398
+ if (t === "west")
1399
+ return this.areaFooterWest;
1400
+ if (t === "center")
1401
+ return this.areaFooterCenter;
1402
+ if (t === "east")
1403
+ return this.areaFooterEast;
1404
+ }
1405
+ throw Error(`Wrong area identifier: row:${e}, col:${t}`);
1406
+ }
1407
+ /**
1408
+ * Adjusts the body of the table.
1409
+ *
1410
+ * @protected
1411
+ * @return {void}
1412
+ */
1413
+ adjustBody() {
1414
+ const e = this.areaBodyCenterGeo.height - this.tableModel.getContentHeightInPixel(), t = this.scrollFactorY * e;
1415
+ this.dom.setStyle(this.contentDiv, "top", `${this.scrollTop}px`), this.dom.setStyle(this.contentDiv, "left", `${this.scrollViewport.scrollLeft}px`), this.adjustArea("body", t);
1416
+ }
1417
+ /**
1418
+ * Returns a number value extracted from the specified attribute of the source element.
1419
+ *
1420
+ * @param {HTMLElement} srcElement - The source element from which to extract the attribute value.
1421
+ * @param {string} key - The attribute key to extract the value from.
1422
+ * @returns {number} - The extracted number value, or -1 if the attribute was not found or not a valid number.
1423
+ * @protected
1424
+ */
1425
+ getNumberByAttr(e, t) {
1426
+ var o;
1427
+ if (e) {
1428
+ const s = (o = e.closest("[" + t + "]")) == null ? void 0 : o.getAttribute(t);
1429
+ if (s)
1430
+ return Number(s);
1431
+ }
1432
+ return -1;
1433
+ }
1434
+ /**
1435
+ * Retrieves the value of the specified attribute from the nearest ancestor element that has the attribute.
1436
+ *
1437
+ * @param {HTMLElement} srcElement - The source element from which to start searching for the nearest ancestor element.
1438
+ * @param {string} key - The name of the attribute to retrieve.
1439
+ * @returns {string} The value of the specified attribute, or an empty string if the attribute is not found.
1440
+ * @protected
1441
+ */
1442
+ getStringByAttr(e, t) {
1443
+ var o;
1444
+ if (e) {
1445
+ const s = (o = e.closest("[" + t + "]")) == null ? void 0 : o.getAttribute(t);
1446
+ if (s)
1447
+ return s;
1448
+ }
1449
+ return "";
1450
+ }
1451
+ /**
1452
+ * Adjusts the layout and positioning of the specified area in the table.
1453
+ * This method is used internally and should not be called directly.
1454
+ *
1455
+ * @param {AreaIdent} areaIdent - The identifier of the area to adjust (e.g. header, body, footer).
1456
+ * @param {number} [yStart=0] - The starting y-position for the layout adjustments.
1457
+ * @protected
1458
+ */
1459
+ adjustArea(e, t = 0) {
1460
+ var u;
1461
+ const o = this.getArea(e, "west"), s = this.getArea(e, "center"), i = this.getArea(e, "east"), r = s.child.clientHeight;
1462
+ o.child.innerText = "", s.child.innerText = "", i.child.innerText = "";
1463
+ const n = 0, l = this.areaBodyCenterGeo.width, d = this.tableModel.getPadding(), c = this.tableModel.getAreaModel(e), h = c.getRowCount();
1464
+ for (; this.cleanupFunctions[e].length; ) {
1465
+ const p = this.cleanupFunctions[e].shift();
1466
+ p && p();
1467
+ }
1468
+ let g = t;
1469
+ const f = this.tableModel.getColumnCount(), b = this.tableModel.getFixedRightColumnCount(), S = this.tableModel.getFixedLeftColumnCount();
1470
+ for (let p = 0; p < h; p++) {
1471
+ const v = g, w = p === h - 1, x = this.tableModel.getRowHeight(e, p);
1472
+ if (v + x > 0) {
1473
+ this.firstVisibleRowIndex = p;
1474
+ let y = { left: n, width: l, height: x, top: v, index: p }, m = this.dom.addRowDiv(s, y, p, e, "center");
1475
+ const R = S;
1476
+ if (this.adjustColumnsToRowParent({
1477
+ areaIdent: e,
1478
+ sideIdent: "center",
1479
+ areaModel: c,
1480
+ geo: y,
1481
+ parent: m,
1482
+ rowIndex: p,
1483
+ columnIndexStart: R,
1484
+ columnIndexEnd: f - b - 1,
1485
+ verticalFixed: !1,
1486
+ lastRowOfModel: w
1487
+ }), d.left > 0 && (y = { left: n, width: this.areaBodyWestGeo.width, height: x, top: v, index: p }, m = this.dom.addRowDiv(o, y, p, e, "west"), this.adjustColumnsToRowParent({
1488
+ areaIdent: e,
1489
+ sideIdent: "west",
1490
+ areaModel: c,
1491
+ geo: y,
1492
+ parent: m,
1493
+ rowIndex: p,
1494
+ columnIndexStart: 0,
1495
+ columnIndexEnd: R - 1,
1496
+ verticalFixed: !0,
1497
+ lastRowOfModel: w
1498
+ })), d.right > 0 && (y = { left: n, width: this.areaBodyEastGeo.width, height: x, top: v, index: p }, m = this.dom.addRowDiv(i, y, p, e, "east"), this.adjustColumnsToRowParent({
1499
+ areaIdent: e,
1500
+ sideIdent: "east",
1501
+ areaModel: c,
1502
+ geo: y,
1503
+ parent: m,
1504
+ rowIndex: p,
1505
+ columnIndexStart: f - b,
1506
+ columnIndexEnd: f - 1,
1507
+ verticalFixed: !0,
1508
+ lastRowOfModel: w
1509
+ })), e === "header" && this.tree && p === h - 1) {
1510
+ const A = this.dom.applyStyle(
1511
+ this.dom.setAttribute(
1512
+ this.dom.addDiv(m, new T(16, 20, 20, 8)),
1513
+ "data-ge-action",
1514
+ "toggleExpandCollapseAll"
1515
+ ),
1516
+ { cursor: "pointer" }
1517
+ ), M = this.tableOptions.treeOptions.arrowExpandCollapseAll;
1518
+ if (M) {
1519
+ const P = this.dom.domService.createText(M.content);
1520
+ this.dom.domService.appendChild(A, P), M.style && this.dom.applyStyleString(A, M.style);
1521
+ }
1522
+ }
1523
+ }
1524
+ if (g = g + x, g > r)
1525
+ break;
1526
+ }
1527
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
1528
+ const p = ((u = this.colAndRowspanModels[e]) == null ? void 0 : u.getRanges()) ?? [];
1529
+ if (p.length)
1530
+ for (const v of p) {
1531
+ let w = 0, x = s.child, y = "center";
1532
+ if (v.c1 < S)
1533
+ x = o.child, y = "west";
1534
+ else if (b > 0 && v.c1 >= f - b)
1535
+ x = i.child, y = "east";
1536
+ else {
1537
+ const m = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1538
+ w = this.scrollFactorX * m - this.areaBodyWestGeo.width, y = "center";
1539
+ }
1540
+ this.drawBigCell(v, w, t, c, x, y);
1541
+ }
1542
+ }
1543
+ }
1544
+ /**
1545
+ * Draws big cells (rowspan and or colspan) in body/center
1546
+ * @param range CellRange
1547
+ * @param xStart X position in pixel for top left corner
1548
+ * @param yStart Y position in pixel for top left corner
1549
+ * @param areaModel AreaModelIf
1550
+ * @param parentDiv Parent div as HTMLDivElement
1551
+ * @param sideIdent SideIdent (west,center,east)
1552
+ * @protected
1553
+ */
1554
+ drawBigCell(e, t, o, s, i, r) {
1555
+ const n = o + this.getRowHeights(0, e.r1 - 1, s).reduce((u, p) => u + p, 0), l = this.tableModel.getColumnCount(), d = this.tableModel.getFixedRightColumnCount();
1556
+ let c = 0;
1557
+ d > 0 && e.c1 >= l - d && (c = l - d);
1558
+ const h = t + this.getColumnWidths(c, e.c1 - 1).reduce((u, p) => u + p, 0), g = this.getRowHeights(e.r1, e.r2, s).reduce((u, p) => u + p, 0), f = this.getColumnWidths(e.c1, e.c2).reduce((u, p) => u + p, 0);
1559
+ let b = !1;
1560
+ const S = this.getSelectionModel ? this.getSelectionModel() : void 0;
1561
+ S && (b = S.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? this.renderCell({
1562
+ areaModel: s,
1563
+ areaIdent: s.areaIdent,
1564
+ sideIdent: r,
1565
+ rowIndex: e.r1,
1566
+ columnIndex: e.c1,
1567
+ left: h,
1568
+ top: n,
1569
+ width: f,
1570
+ height: g,
1571
+ parent: i,
1572
+ cellSelected: b,
1573
+ lastRowOfModel: !0,
1574
+ gammaRange: e.gammaRange
1575
+ }) : this.renderCell({
1576
+ areaModel: s,
1577
+ areaIdent: s.areaIdent,
1578
+ sideIdent: r,
1579
+ rowIndex: e.r1,
1580
+ columnIndex: e.c1,
1581
+ left: h,
1582
+ top: n,
1583
+ width: f,
1584
+ height: g,
1585
+ parent: i,
1586
+ cellSelected: b,
1587
+ lastRowOfModel: !0,
1588
+ gammaRange: e.gammaRange
1589
+ }), s.areaIdent === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
1590
+ rowIndex: e.r1,
1591
+ columnIndex: e.c1,
1592
+ cellLeft: h,
1593
+ cellTop: n,
1594
+ cellWidth: f,
1595
+ cellHeight: g,
1596
+ parent: i
1597
+ });
1598
+ }
1599
+ /**
1600
+ * Finds the row index of an important rowspan cell in a given area model.
1601
+ *
1602
+ * @param {AreaModelIf} areaModel - The area model to search in.
1603
+ * @param {number} rowIndex - The current row index.
1604
+ * @param {number} colIndex - The current column index.
1605
+ * @returns {number} - The row index of the important rowspan cell, or -1 if not found.
1606
+ * @protected
1607
+ */
1608
+ findRowOfImportantRowspanCell(e, t, o) {
1609
+ const s = e.getMaxRowspan();
1610
+ for (let i = t - 1; i > -1; i--) {
1611
+ const r = e.getRowspanAt(i, o);
1612
+ if (r > 1 && i + r + 1 >= t)
1613
+ return i;
1614
+ if (t - i > s)
1615
+ return -1;
1616
+ }
1617
+ return -1;
1618
+ }
1619
+ /**
1620
+ * Adjusts the columns to fit the width of the row's parent element.
1621
+ *
1622
+ * @param {ArgsAdjustColumnsToRowParentParams} params - The parameters for adjusting the columns.
1623
+ * @protected
1624
+ * @return {void}
1625
+ */
1626
+ adjustColumnsToRowParent({
1627
+ areaIdent: e,
1628
+ sideIdent: t,
1629
+ areaModel: o,
1630
+ geo: s,
1631
+ parent: i,
1632
+ rowIndex: r,
1633
+ columnIndexStart: n,
1634
+ columnIndexEnd: l,
1635
+ verticalFixed: d = !1,
1636
+ lastRowOfModel: c = !1
1637
+ }) {
1638
+ var S;
1639
+ this.scrollViewportLeft = this.scrollViewport.scrollLeft;
1640
+ let h = 0;
1641
+ if (!d) {
1642
+ const u = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1643
+ h = this.scrollFactorX * u;
1644
+ }
1645
+ const g = 0, f = !!(e === "body" && t);
1646
+ let b = h;
1647
+ for (let u = n; u <= l; u++) {
1648
+ const p = b, v = this.tableModel.getColumnWidth(u);
1649
+ if (v > 0 && p + v > 0) {
1650
+ let w = s.height;
1651
+ const x = o.getRowspanAt(r, u), y = o.getColspanAt(r, u);
1652
+ x > 1 && (w = this.getRowHeights(r, r + x - 1, o).reduce((A, M) => A + M, 0));
1653
+ let m = v;
1654
+ y > 1 && (m = this.getColumnWidths(u, u + y - 1).reduce((A, M) => A + M, 0));
1655
+ let R = !1;
1656
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (S = this.colAndRowspanModels[e]) != null && S.isInRange(r, u) && (R = !0), this.draggingTargetColumnIndex === u && e !== "header") {
1657
+ this.renderDragTargetDiv(i, p, g, m, w);
1658
+ const A = { left: p, top: g, width: m, height: w };
1659
+ this.dom.addColumnBorderDivs(this.tableOptions, i, A, e, t);
1660
+ } else {
1661
+ const A = this.renderSelectedBackgroundDiv(R, f, t, o, r, u, i, p, g, m, w);
1662
+ "gammaCells" in o && o.getValueAt(r, u) && (R = !1), R || this.renderCell({
1663
+ areaModel: o,
1664
+ areaIdent: e,
1665
+ sideIdent: t,
1666
+ rowIndex: r,
1667
+ columnIndex: u,
1668
+ left: p,
1669
+ top: g,
1670
+ width: m,
1671
+ height: w,
1672
+ parent: i,
1673
+ cellSelected: A,
1674
+ lastRowOfModel: c,
1675
+ gammaRange: !0
1676
+ }), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
1677
+ rowIndex: r,
1678
+ columnIndex: u,
1679
+ cellLeft: p,
1680
+ cellTop: g,
1681
+ cellWidth: m,
1682
+ cellHeight: w,
1683
+ parent: i
1684
+ });
1685
+ }
1686
+ }
1687
+ if (b = b + v, b > this.areaBodyCenterGeo.width)
1688
+ break;
1689
+ }
1690
+ this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(b - 1, 1, s.height, 0), i);
1691
+ }
1692
+ /**
1693
+ * Retrieves the column index of the tree arrow column in the table.
1694
+ *
1695
+ * @protected
1696
+ *
1697
+ * @returns {0 | 1} The column index of the tree arrow column.
1698
+ * Returns 0 if the checkbox is not visible,
1699
+ * otherwise returns 1.
1700
+ */
1701
+ getTreeArrowColumnIndex() {
1702
+ return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
1703
+ }
1704
+ addAndRenderCellDiv({
1705
+ areaModel: e,
1706
+ areaIdent: t,
1707
+ sideIdent: o,
1708
+ rowIndex: s,
1709
+ index: i,
1710
+ left: r,
1711
+ width: n,
1712
+ height: l,
1713
+ top: d,
1714
+ parent: c,
1715
+ lastRowOfModel: h
1716
+ }) {
1717
+ var se;
1718
+ const f = this.editorRenderer && this.editorRendererRow === s && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(s, i), b = { left: r, width: n, height: l, top: d, index: i }, S = e.getRowByIndex(s);
1719
+ let u = "none";
1720
+ if (i === this.getTreeArrowColumnIndex() && q(S)) {
1721
+ const C = S;
1722
+ (se = C.children) != null && se.length ? C.expanded ? u = "expanded" : u = "collapsed" : u = "hidden";
1723
+ }
1724
+ let v;
1725
+ if (t === "header") {
1726
+ const C = this.tableModel.getColumnDef(i);
1727
+ (!(C != null && C.sortIconVisible) || C != null && C.sortIconVisible()) && (v = C == null ? void 0 : C.sortState);
1728
+ }
1729
+ const w = e.getValueAt(s, i), x = f ? "" : `${w}`, y = e.isRowChecked(s), m = this.dom.addColumnDiv(
1730
+ {
1731
+ parent: c,
1732
+ geo: b,
1733
+ rowIndex: s,
1734
+ columnIndex: i,
1735
+ areaIdent: t,
1736
+ sideIdent: o,
1737
+ text: x,
1738
+ treeArrow: u,
1739
+ tableOptions: this.tableOptions,
1740
+ checkedType: y,
1741
+ sortState: v
1742
+ }
1743
+ ), R = e.getTooltipAt(s, i);
1744
+ R && this.dom.setAttribute(m, "title", R);
1745
+ const A = this.tableModel.getColumnDef(i);
1746
+ A && A.classes[t] && this.dom.addClasses(A.classes[t], m);
1747
+ let M;
1748
+ f && (M = f.render(m, s, i, t, e, w, this.dom.domService));
1749
+ const P = e.getCustomClassesAt(s, i);
1750
+ if (P.length && this.dom.addClasses(P, m), this.dom.addColumnBorderDivs(this.tableOptions, c, b, t, o), h && this.dom.addHorizontalBorder({ left: r, width: n, height: l, top: d + l }, c), this.getFocusModel && t === "body") {
1751
+ const C = this.getFocusModel();
1752
+ C != null && C.hasFocus(s, i) && this.dom.addFocusBorderDivs(c, b, {});
1753
+ }
1754
+ t === "header" && this.dom.setAttribute(m, "data-ge-action", "drag-column");
1755
+ const z = e.getCustomStyleAt(s, i);
1756
+ if (z)
1757
+ for (const C in z)
1758
+ this.dom.setStyle(m, C, z[C]);
1759
+ return [m, M];
1760
+ }
1761
+ /**
1762
+ * Applies CSS classes to an HTML element.
1763
+ *
1764
+ * @param {HTMLDivElement} ele - The HTML element to which CSS classes will be applied.
1765
+ * @param {Object.<string, boolean>} cssClasses - An object containing CSS class names as keys and boolean values indicating whether to apply or remove the class.
1766
+ * @protected
1767
+ */
1768
+ applyCssClasses(e, t = {}) {
1769
+ e && Object.entries(t).forEach(([o, s]) => {
1770
+ s ? this.dom.addClass(o, e) : this.dom.removeClass(o, e);
1771
+ });
1772
+ }
1773
+ /**
1774
+ * Retrieves the column widths of a table within a specified range.
1775
+ *
1776
+ * @param {number} startIndex - The index of the first column to retrieve the width of.
1777
+ * @param {number} endIndex - The index of the last column to retrieve the width of.
1778
+ *
1779
+ * @return {number[]} An array containing the widths of the columns within the specified range.
1780
+ */
1781
+ getColumnWidths(e, t) {
1782
+ const o = [];
1783
+ for (let s = e; s <= t; s++)
1784
+ o.push(this.tableModel.getColumnWidth(s));
1785
+ return o;
1786
+ }
1787
+ /**
1788
+ * Retrieves the heights of rows within a specified range.
1789
+ *
1790
+ * @param {number} startIndex - The index of the first row in the range.
1791
+ * @param {number} endIndex - The index of the last row in the range.
1792
+ * @param {AreaModelIf} areaModel - The area model.
1793
+ * @return {number[]} - An array containing the heights of the rows within the specified range.
1794
+ */
1795
+ getRowHeights(e, t, o) {
1796
+ const s = [];
1797
+ for (let i = e; i <= t; i++)
1798
+ s.push(o.getRowHeight(i));
1799
+ return s;
1800
+ }
1801
+ /**
1802
+ * Adjusts the position and size of the hover row based on the mouse move event.
1803
+ *
1804
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event.
1805
+ *
1806
+ * @return {void}
1807
+ */
1808
+ adjustHoverRows(e) {
1809
+ if (this.tableOptions.hoverRowVisible && e.rowIndex > -1) {
1810
+ const t = this.hostElement.clientWidth, o = this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex), s = e.rowTop + this.areaHeaderCenter.parent.clientHeight - this.scrollTop;
1811
+ this.dom.applyStyle(this.hoverRow, {
1812
+ left: "0",
1813
+ top: s + "px",
1814
+ width: t + "px",
1815
+ height: o + "px",
1816
+ display: "block"
1817
+ });
1818
+ } else
1819
+ this.hideHoverRow();
1820
+ }
1821
+ /**
1822
+ * Hides the hover row by applying 'display: none' style to it.
1823
+ *
1824
+ * @protected
1825
+ * @function
1826
+ * @name hideHoverRow
1827
+ * @memberof ClassName
1828
+ *
1829
+ * @returns {void}
1830
+ */
1831
+ hideHoverRow() {
1832
+ this.dom.applyStyle(this.hoverRow, {
1833
+ display: "none"
1834
+ });
1835
+ }
1836
+ /**
1837
+ * Adjusts the position and size of the hover column based on the mouse move event.
1838
+ *
1839
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
1840
+ */
1841
+ adjustHoverColumns(e) {
1842
+ if (this.tableOptions.hoverColumnVisible && e.rowIndex > -1) {
1843
+ const t = this.hostElement.clientHeight, o = this.tableModel.getColumnWidth(e.columnIndex), s = this.areaBodyWestGeo.width, i = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - s;
1844
+ this.dom.applyStyle(this.hoverColumn, {
1845
+ left: i + "px",
1846
+ top: "0px",
1847
+ width: o + "px",
1848
+ height: t + "px",
1849
+ display: "block"
1850
+ });
1851
+ } else
1852
+ this.hideHoverColumn();
1853
+ }
1854
+ /**
1855
+ * Hide hover column.
1856
+ *
1857
+ * This method hides the hover column by applying a style of 'display: none'
1858
+ * to the element representing the hover column.
1859
+ *
1860
+ * @protected
1861
+ * @memberof ClassName
1862
+ */
1863
+ hideHoverColumn() {
1864
+ this.dom.applyStyle(this.hoverColumn, {
1865
+ display: "none"
1866
+ });
1867
+ }
1868
+ /**
1869
+ * Executes a function after a specified delay, ensuring that the function is called only once within that delay period.
1870
+ *
1871
+ * @param {() => void} fn - The function to be executed.
1872
+ * @param {number} [delay=1000] - The delay in milliseconds before executing the function.
1873
+ *
1874
+ * @return {undefined}
1875
+ */
1876
+ debounce(e, t = 1e3) {
1877
+ this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e.bind(this), t);
1878
+ }
1879
+ /**
1880
+ * Adjusts the dragging column during a mouse move event.
1881
+ *
1882
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event.
1883
+ * @param {number} sourceColumnIndex - The index of the source column.
1884
+ * @param {boolean} firstDraggingRendering - Indicates if it's the first rendering of the dragging column.
1885
+ */
1886
+ adjustDraggingColumn(e, t, o) {
1887
+ var s, i;
1888
+ if (this.dragging) {
1889
+ const r = this.hostElement.clientHeight, n = this.storedColumnWidths[t];
1890
+ if ((s = e.originalEvent) != null && s.clientX) {
1891
+ const c = { left: ((i = e.originalEvent) == null ? void 0 : i.clientX) - n / 2, width: n, height: r, top: 0, index: t };
1892
+ this.dom.applyStyle(this.draggingColumn, {
1893
+ background: "rgba(128,128,128,0.2)",
1894
+ display: "block",
1895
+ overfllow: "clip"
1896
+ }), this.dom.applyStyleInPx(this.draggingColumn, c), o && this.renderContentOfDraggingColumn(c);
1897
+ }
1898
+ } else
1899
+ this.hideDraggingColumn();
1900
+ }
1901
+ /**
1902
+ * Renders the content of a dragging column.
1903
+ *
1904
+ * @param {GeoData} columnGeo - The geographic data of the column.
1905
+ *
1906
+ * @returns {number} The y-coordinate of the rendered content.
1907
+ */
1908
+ renderContentOfDraggingColumn(e) {
1909
+ const t = this.renderContentOfDraggingColumnForArea(e, "header", 0);
1910
+ this.renderContentOfDraggingColumnForArea(e, "body", t);
1911
+ }
1912
+ /**
1913
+ * Renders the content of the dragging column for a specific area.
1914
+ *
1915
+ * @param {GeoData} columnGeo - The geometry data of the dragging column.
1916
+ * @param {AreaIdent} areaIdent - The identifier of the area.
1917
+ * @param {number} [y=0] - The starting y-position.
1918
+ * @return {number} The final y-position after rendering all the content.
1919
+ */
1920
+ renderContentOfDraggingColumnForArea(e, t, o = 0) {
1921
+ const s = "center", i = this.tableModel.getAreaModel(t), r = i == null ? void 0 : i.getRowCount();
1922
+ if (r) {
1923
+ const n = e.index ?? 0, l = this.draggingColumn;
1924
+ for (let d = 0; d < r; d++) {
1925
+ const c = o, h = i.getRowHeight(d), g = { left: 0, width: e.width, height: h, top: c, index: d }, f = i.getValueAt(d, n), b = i.getCellRenderer(d, n), S = b ? "" : `${f}`, u = {
1926
+ parent: l,
1927
+ geo: g,
1928
+ rowIndex: d,
1929
+ columnIndex: n,
1930
+ areaIdent: t,
1931
+ sideIdent: s,
1932
+ text: S
1933
+ }, p = this.dom.addColumnDiv(u);
1934
+ let v;
1935
+ b && (v = b.render(p, d, n, t, i, f, this.dom.domService), v && this.cleanupFunctions[t].push(v));
1936
+ const w = i.getCustomClassesAt(d, n);
1937
+ w.length && this.dom.addClasses(w, p);
1938
+ const x = this.tableModel.getColumnDef(n);
1939
+ x && x.classes[t] && this.dom.addClasses(x.classes[t], p), this.dom.addColumnBorderDivs(this.tableOptions, l, g, t, s);
1940
+ const y = i.getCustomStyleAt(d, n);
1941
+ if (y)
1942
+ for (const m in y)
1943
+ this.dom.setStyle(p, m, y[m]);
1944
+ o = o + h;
1945
+ }
1946
+ }
1947
+ return o;
1948
+ }
1949
+ /**
1950
+ * Hides the dragging column by applying a 'display: none' style to it.
1951
+ * This method is protected and can only be accessed within the class.
1952
+ *
1953
+ * @return {void}
1954
+ */
1955
+ hideDraggingColumn() {
1956
+ this.dom.applyStyle(this.draggingColumn, {
1957
+ display: "none"
1958
+ });
1959
+ }
1960
+ /**
1961
+ * Renders a draggable target div element.
1962
+ *
1963
+ * @param {HTMLDivElement} parent - The parent element where the target div will be appended to.
1964
+ * @param {number} left - The left position of the target div in pixels.
1965
+ * @param {number} top - The top position of the target div in pixels.
1966
+ * @param {number} width - The width of the target div in pixels.
1967
+ * @param {number} height - The height of the target div in pixels.
1968
+ * @return {HTMLDivElement} - The rendered draggable target div element.
1969
+ */
1970
+ renderDragTargetDiv(e, t, o, s, i) {
1971
+ const r = this.dom.applyStylePosistionAbsolute(
1972
+ this.dom.createDivWithClass("ge-table-drop-zone", e)
1973
+ );
1974
+ return this.dom.setStyle(r, "left", `${t}px`), this.dom.setStyle(r, "top", `${o}px`), this.dom.setStyle(r, "width", `${s}px`), this.dom.setStyle(r, "height", `${i}px`), r;
1975
+ }
1976
+ /**
1977
+ * Render selected background div.
1978
+ *
1979
+ * @private
1980
+ * @param {boolean} skip - Whether to skip rendering.
1981
+ * @param {boolean} renderSelection - Whether to render the selection.
1982
+ * @param {SideIdent} sideIdent - The side identifier.
1983
+ * @param {AreaModelIf} areaModel - The area model.
1984
+ * @param {number} rowIndex - The row index.
1985
+ * @param {number} index - The index.
1986
+ * @param {HTMLDivElement} parent - The parent div element.
1987
+ * @param {number} left - The left position.
1988
+ * @param {number} top - The top position.
1989
+ * @param {number} width - The width of the div.
1990
+ * @param {number} height - The height of the div.
1991
+ * @returns {boolean} - Whether the cell is selected.
1992
+ */
1993
+ renderSelectedBackgroundDiv(e, t, o, s, i, r, n, l, d, c, h) {
1994
+ let g = !1;
1995
+ if (!e && t && s.isSelectable(i, r) && this.getSelectionModel) {
1996
+ const f = this.getSelectionModel();
1997
+ if (f) {
1998
+ const b = f.getSelectionCount(i, r);
1999
+ g = b > 0;
2000
+ for (let S = 0; S < b; S++) {
2001
+ const u = this.dom.applyStylePosistionAbsolute(
2002
+ // ge-table-body-west-selected-range
2003
+ this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`, n)
2004
+ );
2005
+ this.dom.setStyle(u, "left", `${l}px`), this.dom.setStyle(u, "top", `${d}px`), this.dom.setStyle(u, "width", `${c}px`), this.dom.setStyle(u, "height", `${h}px`);
2006
+ }
2007
+ }
2008
+ }
2009
+ return g;
2010
+ }
2011
+ /**
2012
+ * Renders a cell in the grid.
2013
+ *
2014
+ * @param {ArgsRenderCell} args - The arguments for rendering the cell.
2015
+ * @param {AreaModel} args.areaModel - The area model of the grid.
2016
+ * @param {string} args.areaIdent - The identifier of the area.
2017
+ * @param {string} args.sideIdent - The identifier of the side.
2018
+ * @param {number} args.rowIndex - The index of the row.
2019
+ * @param {number} args.columnIndex - The index of the column.
2020
+ * @param {number} args.left - The left position of the cell.
2021
+ * @param {number} args.top - The top position of the cell.
2022
+ * @param {number} args.width - The width of the cell.
2023
+ * @param {number} args.height - The height of the cell.
2024
+ * @param {HTMLElement} args.parent - The parent element of the cell.
2025
+ * @param {boolean} args.cellSelected - Indicates if the cell is selected.
2026
+ * @param {boolean} args.lastRowOfModel - Indicates if the cell is in the last row of the model.
2027
+ *
2028
+ * @returns {void}
2029
+ */
2030
+ renderCell({
2031
+ areaModel: e,
2032
+ areaIdent: t,
2033
+ sideIdent: o,
2034
+ rowIndex: s,
2035
+ columnIndex: i,
2036
+ left: r,
2037
+ top: n,
2038
+ width: l,
2039
+ height: d,
2040
+ parent: c,
2041
+ cellSelected: h,
2042
+ lastRowOfModel: g
2043
+ }) {
2044
+ const [f, b] = this.addAndRenderCellDiv({
2045
+ areaModel: e,
2046
+ areaIdent: t,
2047
+ sideIdent: o,
2048
+ rowIndex: s,
2049
+ index: i,
2050
+ left: r,
2051
+ width: l,
2052
+ height: d,
2053
+ top: n,
2054
+ parent: c,
2055
+ lastRowOfModel: g
2056
+ });
2057
+ h && this.dom.addClass(`ge-table-${t}-${o}-selected-range`, f), b && this.cleanupFunctions[t].push(b);
2058
+ }
2059
+ /**
2060
+ * Render the header cell resize handle.
2061
+ *
2062
+ * @param {ArgsRenderHeaderCellResizeHandle} args - The arguments for rendering the handle.
2063
+ * @param {number} args.rowIndex - The index of the row.
2064
+ * @param {number} args.columnIndex - The index of the column.
2065
+ * @param {number} args.cellLeft - The left position of the cell.
2066
+ * @param {number} args.cellTop - The top position of the cell.
2067
+ * @param {number} args.cellWidth - The width of the cell.
2068
+ * @param {number} args.cellHeight - The height of the cell.
2069
+ * @param {HTMLElement} args.parent - The parent element to append the handle to.
2070
+ *
2071
+ * @return {void}
2072
+ */
2073
+ renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: o, cellTop: s, cellWidth: i, cellHeight: r, parent: n }) {
2074
+ const l = this.dom.domService, d = this.tableOptions.columnResizeHandleWidthInPx ?? 2, c = l.createElement("div");
2075
+ l.setAttribute(c, "data-col-index", `${t}`), l.setAttribute(c, "data-row-index", `${e}`), l.setAttribute(c, "data-area", "header"), l.setAttribute(c, "data-ge-action", "resize-column"), l.addClass(c, "ge-table-column-resize-handle"), l.setStyle(c, "display", "clip"), l.setStyle(c, "position", "absolute"), l.setStyle(c, "cursor", "col-resize"), l.setStyle(c, "left", `${o + i - d}px`), l.setStyle(c, "top", `${s}px`), l.setStyle(c, "width", `${d}px`), l.setStyle(c, "height", `${r}px`), l.appendChild(n, c);
2076
+ }
2077
+ }
2078
+ class Qe {
2079
+ constructor(e, t) {
2080
+ this.columnIndex = e, this.sortState = t;
2081
+ }
2082
+ }
2083
+ class Ze {
2084
+ constructor(e) {
2085
+ this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
2086
+ }
2087
+ /**
2088
+ * Handles the onHostElementChanged event.
2089
+ * In case that the element is an input field, the tableScope.updateModelValueAfterEdit() method is triggered.
2090
+ *
2091
+ * @param {Event} event - The event object.
2092
+ *
2093
+ * @return {void}
2094
+ */
2095
+ onHostElementChanged(e) {
2096
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
2097
+ const t = e.target, o = t.getAttribute("data-area"), s = t.getAttribute("data-row-index"), i = t.getAttribute("data-col-index");
2098
+ if (o && s && i) {
2099
+ const r = Z(o), n = Number(s), l = Number(i);
2100
+ this.tableScope.updateModelValueAfterEdit(r, n, l, t.value);
2101
+ }
2102
+ }
2103
+ }
2104
+ }
2105
+ class et {
2106
+ constructor(e = -1, t = -1) {
2107
+ this.rowIndex = e, this.columnIndex = t;
2108
+ }
2109
+ }
2110
+ class te {
2111
+ constructor(e) {
2112
+ this.cells = e;
2113
+ }
2114
+ static createSingle(e, t) {
2115
+ return new te([new et(e, t)]);
2116
+ }
2117
+ }
2118
+ class tt {
2119
+ constructor(e) {
2120
+ var t, o;
2121
+ this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (o = this.tableScope.tableOptions) != null && o.getFocusModel && (this.getFocusModel = this.tableScope.tableOptions.getFocusModel);
2122
+ }
2123
+ onMouseClicked(e, t) {
2124
+ var i, r, n, l, d, c, h;
2125
+ let o = !1, s = !1;
2126
+ if (this.getSelectionModel && this.getFocusModel) {
2127
+ const g = this.getSelectionModel(), f = this.getFocusModel();
2128
+ g && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), this.tableScope.onFocusChanged(f), o = !0), (i = e.originalEvent) != null && i.shiftKey || g.hasSelection() && (g.clear(), o = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (g.addSelection(this.createRangeByEvents(e, this.previousEvt)), s = !0, o = !0) : (n = e.originalEvent) != null && n.altKey && ((l = e.originalEvent) != null && l.ctrlKey || (d = e.originalEvent) != null && d.metaKey) ? (g.removeSelection(E.singleCell(e.rowIndex, e.columnIndex)), s = !0, o = !0) : (c = e.originalEvent) != null && c.ctrlKey || (h = e.originalEvent) != null && h.metaKey ? (g.addSelection(E.singleCell(e.rowIndex, e.columnIndex)), s = !0, o = !0) : (g.firstClick(e.rowIndex, e.columnIndex), o = !0), this.tableScope.onSelectionChanged(g));
2129
+ }
2130
+ return s ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), o;
2131
+ }
2132
+ onActionTriggered(e) {
2133
+ if (this.getSelectionModel && this.getFocusModel) {
2134
+ const t = this.getSelectionModel(), o = this.getFocusModel();
2135
+ if (t && o) {
2136
+ if (e === "SELECT_ALL")
2137
+ return t.selectAll(), this.tableScope.repaint(), !0;
2138
+ if (e === "DESELECT_ALL")
2139
+ return t.clear(), this.tableScope.repaint(), !0;
2140
+ if (e === "TOGGLE_SELECTION") {
2141
+ const [s, i] = o.getFocus();
2142
+ return t.togglePoint(s, i), this.tableScope.repaint(), !0;
2143
+ }
2144
+ }
2145
+ }
2146
+ return !1;
2147
+ }
2148
+ createRangeByEvents(e, t) {
2149
+ t || (t = e);
2150
+ const o = Math.min(e.rowIndex, t == null ? void 0 : t.rowIndex), s = Math.max(e.rowIndex, t == null ? void 0 : t.rowIndex), i = Math.min(e.columnIndex, t == null ? void 0 : t.columnIndex), r = Math.max(e.columnIndex, t == null ? void 0 : t.columnIndex);
2151
+ return E.create({
2152
+ rowIndex1: o,
2153
+ columnIndex1: i,
2154
+ rowIndex2: s,
2155
+ columnIndex2: r
2156
+ });
2157
+ }
2158
+ }
2159
+ class ot {
2160
+ get() {
2161
+ return {
2162
+ f2: "START_EDITING",
2163
+ space: "TOGGLE_SELECTION",
2164
+ "ctrl+num_add": "SELECT_ALL",
2165
+ "ctrl+a": "SELECT_ALL",
2166
+ "ctrl+shift+a": "DESELECT_ALL",
2167
+ "ctrl+x": "DESELECT_ALL",
2168
+ "ctrl+num_subtract": "DESELECT_ALL",
2169
+ "meta -": "DESELECT_ALL",
2170
+ arrowup: "NAVIGATE_UP",
2171
+ arrowdown: "NAVIGATE_DOWN",
2172
+ arrowleft: "NAVIGATE_LEFT",
2173
+ arrowright: "NAVIGATE_RIGHT",
2174
+ "meta+c": "COPY_2_CLIPBOARD",
2175
+ "ctrl+c": "COPY_2_CLIPBOARD"
2176
+ };
2177
+ }
2178
+ }
2179
+ class st {
2180
+ get() {
2181
+ return {
2182
+ f2: "START_EDITING",
2183
+ space: "TOGGLE_SELECTION",
2184
+ "ctrl+num_add": "SELECT_ALL",
2185
+ "meta+a": "SELECT_ALL",
2186
+ "ctrl+a": "SELECT_ALL",
2187
+ "meta+x": "DESELECT_ALL",
2188
+ "meta+shift+a": "DESELECT_ALL",
2189
+ "ctrl+shift+a": "DESELECT_ALL",
2190
+ "ctrl+num_subtract": "DESELECT_ALL",
2191
+ "ctrl -": "DESELECT_ALL",
2192
+ arrowup: "NAVIGATE_UP",
2193
+ arrowdown: "NAVIGATE_DOWN",
2194
+ arrowleft: "NAVIGATE_LEFT",
2195
+ arrowright: "NAVIGATE_RIGHT",
2196
+ "meta+c": "COPY_2_CLIPBOARD",
2197
+ "ctrl+c": "COPY_2_CLIPBOARD"
2198
+ };
2199
+ }
2200
+ }
2201
+ class it {
2202
+ constructor(e) {
2203
+ this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
2204
+ }
2205
+ /**
2206
+ * Adds a listener to the list of listeners.
2207
+ *
2208
+ * @param {OnActionTriggeredIf} listener - The listener to be added.
2209
+ * @returns {void}
2210
+ */
2211
+ addListener(e) {
2212
+ this.listener.includes(e) || this.listener.push(e);
2213
+ }
2214
+ /**
2215
+ * Initializes the ShortcutService by assigning shortcut action id mappings based on the current operating system.
2216
+ * Also adds key down event listener to the table host element.
2217
+ */
2218
+ init() {
2219
+ this.assignPredefinedSystemShortcutMappings(), Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping), this.isDebug() && console.debug("ShortcutService", this.shortcutActionIdMapping), this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this));
2220
+ }
2221
+ assignPredefinedSystemShortcutMappings() {
2222
+ this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new st().get()) : Object.assign(this.shortcutActionIdMapping, new ot().get());
2223
+ }
2224
+ isMacintosh() {
2225
+ return navigator.platform.indexOf("Mac") > -1;
2226
+ }
2227
+ isDebug() {
2228
+ return this.isLocalhost();
2229
+ }
2230
+ isLocalhost() {
2231
+ return location.hostname === "localhost" || location.hostname === "127.0.0.1";
2232
+ }
2233
+ onKeyDown(e) {
2234
+ const t = this.findEntity(e);
2235
+ t && this.emit(t) && (e.preventDefault(), e.stopPropagation());
2236
+ }
2237
+ emit(e) {
2238
+ this.isDebug() && console.debug("ShortcutService emit :", e);
2239
+ let t = !1;
2240
+ for (const o of this.listener)
2241
+ o.onActionTriggered(e) && (t = !0);
2242
+ return t;
2243
+ }
2244
+ findEntity(e) {
2245
+ const t = this.getTokenByEvent(e);
2246
+ this.isDebug() && console.debug("ShortcutService tokens :", t);
2247
+ for (const o in this.shortcutActionIdMapping) {
2248
+ const s = o.replace(/opt/g, "alt").replace(/cmd/g, "meta").split(/[+ ]/g).sort();
2249
+ if (this.areTokensEquals(t, s))
2250
+ return this.shortcutActionIdMapping[o];
2251
+ }
2252
+ }
2253
+ areTokensEquals(e, t) {
2254
+ if (e.length !== t.length || e.length === 0)
2255
+ return !1;
2256
+ for (let o = 0; o < e.length; o++)
2257
+ if (e[o] !== t[o])
2258
+ return !1;
2259
+ return !0;
2260
+ }
2261
+ getTokenByEvent(e) {
2262
+ const t = [];
2263
+ 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();
2264
+ }
2265
+ /**
2266
+ * Retrieves the shortcut action mapping object.
2267
+ *
2268
+ * @returns {ShortcutActionIdMapping} - The shortcut action mapping object.
2269
+ */
2270
+ getShortcutActionMapping() {
2271
+ return this.shortcutActionIdMapping;
2272
+ }
2273
+ }
2274
+ class le {
2275
+ onCheckboxChanged(e) {
2276
+ }
2277
+ onContextmenu(e) {
2278
+ }
2279
+ onModelChanged(e) {
2280
+ }
2281
+ onMouseClicked(e) {
2282
+ }
2283
+ onMouseDragging(e) {
2284
+ }
2285
+ onMouseDraggingEnd(e) {
2286
+ }
2287
+ onMouseMoved(e) {
2288
+ }
2289
+ onSelectionChanged(e) {
2290
+ }
2291
+ onFocusChanged(e) {
2292
+ }
2293
+ }
2294
+ class be {
2295
+ setStyle(e, t, o) {
2296
+ return e.style[t] = o, e;
2297
+ }
2298
+ appendText(e, t) {
2299
+ const o = this.createText(t);
2300
+ return this.appendChild(e, o), o;
2301
+ }
2302
+ addClass(e, t) {
2303
+ return t.includes(" ") ? t.split(" ").forEach((o) => e.classList.add(o)) : e.classList.add(t), e;
2304
+ }
2305
+ removeClass(e, t) {
2306
+ return t.includes(" ") ? t.split(" ").forEach((o) => e.classList.remove(o)) : e.classList.remove(t), e;
2307
+ }
2308
+ appendChild(e, t) {
2309
+ e.appendChild(t);
2310
+ }
2311
+ createElement(e) {
2312
+ return document.createElement(e);
2313
+ }
2314
+ createText(e) {
2315
+ return document.createTextNode(e);
2316
+ }
2317
+ setAttribute(e, t, o) {
2318
+ e.setAttribute(t, o);
2319
+ }
2320
+ }
2321
+ class rt {
2322
+ render(e, t, o, s, i, r, n) {
2323
+ if (i.isEditable(t, o)) {
2324
+ n.addClass(e, "ge-table-row-input-div");
2325
+ const l = i.getValueAt(t, o);
2326
+ e.innerHTML = `
2327
+ <input
2328
+ type="text"
2329
+ value="${l}"
2330
+ autofocus
2331
+ onfocus="this.setSelectionRange(0, this.value.length)"
2332
+ data-listen="change"
2333
+ data-area="${s}"
2334
+ data-row-index="${t}"
2335
+ data-col-index="${o}"
2336
+ data-input-type="text"
2337
+ style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
2338
+ class="ge-table-cell-editor-input">`;
2339
+ }
2340
+ }
2341
+ }
2342
+ class lt {
2343
+ constructor(e = "none", t = "single") {
2344
+ this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.silent = !1, this.listenerArr = [];
2345
+ }
2346
+ getEventSelectionChangedListeners() {
2347
+ return this.listenerArr;
2348
+ }
2349
+ addEventSelectionChangedListener(e) {
2350
+ this.listenerArr.includes(e) || this.listenerArr.push(e);
2351
+ }
2352
+ removeEventSelectionChangedListener(e) {
2353
+ const t = this.listenerArr.indexOf(e, 0);
2354
+ t > -1 && this.listenerArr.splice(t, 1);
2355
+ }
2356
+ //@AvoidDoubleExecution(100)
2357
+ fireChangeEvent() {
2358
+ this.silent || this.listenerArr.forEach((e) => e.onSelectionChanged(this));
2359
+ }
2360
+ firstClick(e, t) {
2361
+ this.selectionType === "row" ? this.addRange(E.singleRow(e)) : this.selectionType === "column" && this.addRange(E.singleColumn(t));
2362
+ }
2363
+ getSelectionCount(e, t) {
2364
+ let o = 0;
2365
+ for (const s of this.ranges)
2366
+ s.isInRange(e, t) && o++;
2367
+ return this.allSelected && o++, this.isInNegativeRange(e, t) && (o = 0), o;
2368
+ }
2369
+ isInNegativeRange(e, t) {
2370
+ for (const o of this.negativeRanges)
2371
+ if (o.isInRange(e, t))
2372
+ return !0;
2373
+ return !1;
2374
+ }
2375
+ getRanges() {
2376
+ return this.ranges;
2377
+ }
2378
+ clear() {
2379
+ this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.fireChangeEvent();
2380
+ }
2381
+ hasSelection() {
2382
+ return this.allSelected || !!this.ranges.length;
2383
+ }
2384
+ hasNoSelection() {
2385
+ return !this.hasSelection();
2386
+ }
2387
+ /**
2388
+ * Retrieves the merged row indices from the given range selection.
2389
+ *
2390
+ * @returns {number[]} Array of merged row indices
2391
+ */
2392
+ getMergedRowIndices() {
2393
+ const e = /* @__PURE__ */ new Set();
2394
+ for (const t of this.ranges)
2395
+ for (let o = t.r1; o <= t.r2; o++)
2396
+ !e.has(o) && !this.isInNegativeRange(o, 0) && e.add(o);
2397
+ return Array.from(e);
2398
+ }
2399
+ selectAll() {
2400
+ this.allSelected = !0, this.fireChangeEvent();
2401
+ }
2402
+ isAllSelected() {
2403
+ return this.allSelected;
2404
+ }
2405
+ addSelection(e) {
2406
+ this.addRange(e), this.fireChangeEvent();
2407
+ }
2408
+ removeSelection(e) {
2409
+ if (this.selectionType === "none")
2410
+ return;
2411
+ let t = e;
2412
+ this.selectionType === "row" ? t = E.singleRow(e.r1) : this.selectionType === "column" && (t = E.singleColumn(e.c1)), this.negativeRanges.push(t), this.fireChangeEvent();
2413
+ }
2414
+ togglePoint(e, t) {
2415
+ this.getSelectionCount(e, t) > 0 ? this.removeSelection(E.singleCell(e, t)) : this.addSelection(E.singleCell(e, t));
2416
+ }
2417
+ isSelected(e, t) {
2418
+ return this.getSelectionCount(e, t) > 0;
2419
+ }
2420
+ addRange(e) {
2421
+ this.selectionType !== "none" && (this.allSelected = !1, this.selectionMode === "single" && (this.ranges = []), this.selectionType === "row" ? (e.c1 = 0, e.c2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "column" ? (e.r1 = 0, e.r2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "cell" ? (e.r2 = e.r1, e.c2 = e.c1) : this.selectionType, this.ranges.push(e), this.fireChangeEvent());
2422
+ }
2423
+ }
2424
+ class at {
2425
+ constructor(e = "none") {
2426
+ this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1, this.listenerArr = [];
2427
+ }
2428
+ getEventFocusChangedListeners() {
2429
+ return this.listenerArr;
2430
+ }
2431
+ addEventFocusChangedListener(e) {
2432
+ this.listenerArr.includes(e) || this.listenerArr.push(e);
2433
+ }
2434
+ removeEventFocusChangedListener(e) {
2435
+ const t = this.listenerArr.indexOf(e, 0);
2436
+ t > -1 && this.listenerArr.splice(t, 1);
2437
+ }
2438
+ //@AvoidDoubleExecution(100)
2439
+ fireChangeEvent() {
2440
+ this.listenerArr.forEach((e) => e.onFocusChanged(this));
2441
+ }
2442
+ clearChanged() {
2443
+ this.changed = !1;
2444
+ }
2445
+ hasChanged() {
2446
+ return this.changed;
2447
+ }
2448
+ clear() {
2449
+ this.rowIndex = -1, this.columnIndex = -1, this.fireChangeEvent();
2450
+ }
2451
+ setFocus(e, t) {
2452
+ (this.rowIndex !== e || this.columnIndex !== t) && (this.rowIndex = e, this.columnIndex = t, this.changed = !0, this.fireChangeEvent());
2453
+ }
2454
+ hasFocus(e, t) {
2455
+ return this.rowIndex === e && this.columnIndex === t;
2456
+ }
2457
+ getFocus() {
2458
+ return [this.rowIndex, this.columnIndex];
2459
+ }
2460
+ }
2461
+ class fe {
2462
+ constructor(e = new D(
2463
+ "❯",
2464
+ "",
2465
+ ["gt-table-icon-expanded"]
2466
+ ), t = new D(
2467
+ "❯",
2468
+ "transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",
2469
+ ["ge-table-icon-collapsed"]
2470
+ )) {
2471
+ this.iconExpanded = e, this.iconCollapsed = t;
2472
+ }
2473
+ // `⊖ `, `⊕ `;
2474
+ }
2475
+ const nt = new lt(), dt = new at("cell");
2476
+ class Se {
2477
+ constructor() {
2478
+ this.overflowX = "auto", this.overflowY = "auto", this.horizontalBorderVisible = !0, this.verticalBorderVisible = !0, this.footerSeparatorBorderVisible = !0, this.headerSeparatorBorderVisible = !0, this.fixedEastSeparatorBorderVisible = !0, this.fixedWestSeparatorBorderVisible = !0, this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
2479
+ header: 34,
2480
+ body: 34,
2481
+ footer: 34
2482
+ }, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new pe(), this.headerGroupOptions = new fe(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new ue(), this.sortOrder = ["asc", "desc"], this.getEditRenderer = (e, t) => new rt(), this.getSelectionModel = () => nt, this.getFocusModel = () => dt;
2483
+ }
2484
+ }
2485
+ const F = class F {
2486
+ /**
2487
+ * Returns the content to be copied based on the provided table model, selection model, and focus model.
2488
+ *
2489
+ * @param {TableModelIf} tableModel - The table model for data retrieval.
2490
+ * @param {SelectionModelIf} selectionModel - The selection model to determine the selected range.
2491
+ * @param {FocusModelIf} focusModel - The focus model to determine the focused cell.
2492
+ * @return {Promise<string>} A promise that resolves to the copied content as a string.
2493
+ * @throws {string} Throws an error if neither selection nor focus is defined.
2494
+ */
2495
+ createContent(e, t, o) {
2496
+ return new Promise((s, i) => {
2497
+ if (t != null && t.hasSelection()) {
2498
+ const r = this.mergeRanges(t.getRanges());
2499
+ if (r) {
2500
+ r.c2 = Math.min(r.c2, e.getColumnCount() - 1), r.r2 = Math.min(r.r2, e.getBodyModel().getRowCount() - 1);
2501
+ const n = [];
2502
+ for (let l = r.r1; l <= r.r2; l++) {
2503
+ const d = [];
2504
+ for (let c = r.c1; c <= r.c2; c++) {
2505
+ const h = t.isSelected(l, c) ? e.getBodyModel().getTextValueAt(l, c) : "";
2506
+ d.push(h);
2507
+ }
2508
+ n.push(d.join(F.columnSeparatorChar));
2509
+ }
2510
+ return s(n.join(F.rowSeparatorChar));
2511
+ }
2512
+ }
2513
+ if (o) {
2514
+ const [r, n] = o.getFocus(), l = e.getBodyModel().getTextValueAt(r, n);
2515
+ return s(l);
2516
+ }
2517
+ i("Cannot copy, neither selection nor focus defined.");
2518
+ });
2519
+ }
2520
+ /**
2521
+ * Copy the provided content to the clipboard.
2522
+ *
2523
+ * @param {string} content - The content to be copied.
2524
+ * @return {Promise<void>} A promise that resolves when the content has been successfully copied to the clipboard.
2525
+ */
2526
+ copyContent(e) {
2527
+ return navigator.clipboard.writeText(e);
2528
+ }
2529
+ /**
2530
+ * Asynchronously copies the content of a table to the clipboard.
2531
+ *
2532
+ * @param {TableModelIf} tableModel - The table model to copy from.
2533
+ * @param {SelectionModelIf} selectionModel - The selection model of the table.
2534
+ * @param {FocusModelIf} focusModel - The focus model of the table.
2535
+ * @returns {Promise<string>} A promise that resolves with the copied text if successful, or rejects if an error occurs.
2536
+ */
2537
+ copyToClipboard(e, t, o) {
2538
+ return new Promise((s, i) => {
2539
+ this.createContent(
2540
+ e,
2541
+ t,
2542
+ o
2543
+ ).then((r) => {
2544
+ r && this.copyContent(r).then((n) => {
2545
+ s(r);
2546
+ }).catch((n) => {
2547
+ i();
2548
+ });
2549
+ }).catch((r) => {
2550
+ i();
2551
+ });
2552
+ });
2553
+ }
2554
+ /**
2555
+ * Merges an array of CellRanges into a single merged CellRange.
2556
+ *
2557
+ * @param {CellRange[]} ranges - The array of CellRanges to be merged.
2558
+ * @return {CellRange | undefined} - The merged CellRange, or undefined if the ranges array is empty.
2559
+ */
2560
+ mergeRanges(e) {
2561
+ let t;
2562
+ for (const o of e)
2563
+ t ? (t.r1 = Math.min(t.r1, o.r1), t.c1 = Math.min(t.c1, o.c1), t.r2 = Math.max(t.r2, o.r2), t.c2 = Math.max(t.c2, o.c2)) : t = new E(o.r1, o.c1, o.r2, o.c2);
2564
+ return t;
2565
+ }
2566
+ };
2567
+ F.columnSeparatorChar = " ", F.rowSeparatorChar = `
2568
+ `;
2569
+ let H = F;
2570
+ class oe extends Je {
2571
+ constructor(e, t, o, s, i, r = new H()) {
2572
+ var d;
2573
+ if (super(e, t, new We(o), s), this.eventListener = i, this.copyService = r, this.licenseManager = k.getInstance(), this.selectionService = new tt(this), this.api = new ze(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, i || (this.eventListener = new le()), (d = this.tableOptions) != null && d.autoRestoreOptions) {
2574
+ const c = this.tableOptions.autoRestoreOptions, h = c.getStorageKeyFn;
2575
+ h && (c.autoRestoreScrollPosition && (this.storeScrollPosStateService = new Ne(h)), c.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new Xe(h)), c.autoRestoreSortingState && (this.storeSortingService = new Ke(h)));
2576
+ }
2577
+ this.mouseHandler = new Ve(this), this.inputHandler = new Ze(this), this.shortcutService = new it(this), this.shortcutService.addListener(this.selectionService);
2578
+ const n = this.getSelectionModel ? this.getSelectionModel() : void 0;
2579
+ n && n.addEventSelectionChangedListener(this);
2580
+ const l = this.getFocusModel ? this.getFocusModel() : void 0;
2581
+ l && l.addEventFocusChangedListener(this);
2582
+ }
2583
+ /**
2584
+ * Creates a TableScope instance.
2585
+ *
2586
+ * @param {HTMLDivElement} hostElement - The HTML div element that will contain the table.
2587
+ * @param {TableModelIf} tableModel - The table model object.
2588
+ * @param {TableOptionsIf} [tableOptions=new TableOptions()] - The optional table options object.
2589
+ * @param {EventListenerIf} [eventListener=new EventAdapter()] - The optional event listener object.
2590
+ * @param {DomServiceIf} [domService=new SimpleDomService()] - The optional DOM service object.
2591
+ * @param {CopyServiceIf} [copyService=new CopyService()] - The optional copy service object.
2592
+ *
2593
+ * @return {TableScope} - The newly created TableScope instance.
2594
+ */
2595
+ static create(e, t, o = new Se(), s = new le(), i = new be(), r = new H()) {
2596
+ return new oe(e, t, i, o, s, r);
2597
+ }
2598
+ /**
2599
+ * Triggers an action based on the provided actionId.
2600
+ *
2601
+ * This function can be invoked manually via the table API or by keyboard shortcuts.
2602
+ *
2603
+ * @param {ActionId} actionId - The identifier of the action to be triggered.
2604
+ * @return {boolean} - Returns true if the action was triggered successfully, false otherwise.
2605
+ */
2606
+ onActionTriggered(e) {
2607
+ if (e === "NAVIGATE_DOWN" && this.changeFocusCell(0, 1) || e === "NAVIGATE_UP" && this.changeFocusCell(0, -1) || e === "NAVIGATE_LEFT" && this.changeFocusCell(-1, 0) || e === "NAVIGATE_RIGHT" && this.changeFocusCell(1, 0))
2608
+ return !0;
2609
+ if (e === "START_EDITING" && this.getFocusModel) {
2610
+ const t = this.getFocusModel();
2611
+ if (t) {
2612
+ const [o, s] = t.getFocus();
2613
+ this.tableModel.getBodyModel().isEditable(o, s) && (this.clearSelection(), this.initRenderEditor(o, s));
2614
+ }
2615
+ return !0;
2616
+ }
2617
+ if (e === "COPY_2_CLIPBOARD") {
2618
+ const t = this.getSelectionModel ? this.getSelectionModel() : void 0, o = this.getFocusModel ? this.getFocusModel() : void 0;
2619
+ this.copyService.createContent(this.tableModel, t, o).then((s) => this.copyService.copyContent(s));
2620
+ }
2621
+ return !1;
2622
+ }
2623
+ updateModelValueAfterEdit(e, t, o, s) {
2624
+ e === "body" && this.tableModel.getAreaModel(e).setValue(t, o, s) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(te.createSingle(t, o)), this.hostElement.focus());
2625
+ }
2626
+ /**
2627
+ * Retrieves the TableApi object.
2628
+ *
2629
+ * @return {TableApi} The TableApi object.
2630
+ */
2631
+ getApi() {
2632
+ return this.api;
2633
+ }
2634
+ /**
2635
+ * Initializes the table. Called by the table component.
2636
+ *
2637
+ * @function firstInit
2638
+ * @memberof TableScope
2639
+ *
2640
+ * @returns {TableScope} This instance of the table scope.
2641
+ */
2642
+ firstInit() {
2643
+ var e;
2644
+ return this.tableModel.init(), (e = this.tableOptions) != null && e.externalFilterFunction && this.externalFilterChanged(!1), this.autoRestoreCollapsedExpandedState(), this.autoRestoreSortingState(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.autoRestoreScrollPosition(), this;
2645
+ }
2646
+ /**
2647
+ * Creates a GeMouseEvent object based on a MouseEvent.
2648
+ *
2649
+ * @param {MouseEvent} mouseEvent - The MouseEvent object to create the GeMouseEvent from.
2650
+ * @return {GeMouseEvent} - The created GeMouseEvent object.
2651
+ */
2652
+ createGeMouseEvent(e) {
2653
+ const t = new Q();
2654
+ if (t.originalEvent = e, e) {
2655
+ const o = e.target;
2656
+ if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(o), t.rowIndex = this.getNumberByAttr(o, "data-row-index"), t.columnIndex = this.getNumberByAttr(o, "data-col-index"), t.action = this.getStringByAttr(o, "data-ge-action"), t.areaIdent) {
2657
+ const s = this.tableModel.getAreaModel(t.areaIdent);
2658
+ t.rowTop = s.getYPosByRowIndex(t.rowIndex);
2659
+ }
2660
+ if (t.columnLeft = this.tableModel.getXPosByColumnIndex(t.columnIndex), e.ctrlKey && e.altKey) {
2661
+ const s = e.clientY - this.hostElement.offsetTop - this.areaHeaderCenter.parent.clientHeight, i = e.clientX - this.hostElement.offsetLeft - this.areaBodyWestGeo.width;
2662
+ this.debugOnce(i, s);
2663
+ }
2664
+ }
2665
+ return t;
2666
+ }
2667
+ /**
2668
+ * Handles the mouse down event.
2669
+ *
2670
+ * @param {GeMouseEvent} mouseEvent - The mouse event object.
2671
+ * @return {void}
2672
+ */
2673
+ onMouseDown(e) {
2674
+ e.columnIndex > -1 && e.action && ["resize-column", "drag-column"].includes(e.action) && (this.mouseStartWidth = this.tableModel.getColumnWidth(e.columnIndex), this.mouseStartAction = e.action, this.mouseStartColumnIndex = e.columnIndex, this.mouseStartAction === "drag-column" && (this.firstDraggingRendering = !0, this.dragFrom = this.mouseStartColumnIndex));
2675
+ }
2676
+ /**
2677
+ * Handles mouse dragging on the frame.
2678
+ *
2679
+ * @param {GeMouseEvent} mouseEvent - The mouse event object.
2680
+ * @param startMouseEvent
2681
+ */
2682
+ mouseDraggingOnFrame(e, t) {
2683
+ this.eventListener.onMouseDragging(e), this.mouseEvent = e, this.mouseStartColumnIndex > -1 && this.mouseStartAction === "resize-column" && this.tableOptions.columnsResizable ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && e.columnIndex > -1 && this.tableOptions.columnsDraggable && (this.draggingTargetColumnIndex = e.columnIndex, this.dragTo = this.draggingTargetColumnIndex, this.dragFrom > -1 && this.dragTo > -1 && this.dragFrom !== this.dragTo && (this.lastDragFrom === this.dragTo && this.lastDragTo === this.dragFrom || (this.tableModel.changeColumnOrder(this.dragFrom, this.dragTo), this.lastDragFrom = this.dragFrom, this.lastDragTo = this.dragTo, this.dragFrom = this.dragTo, this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows())), t && (this.adjustDraggingColumn(e, t.columnIndex, this.firstDraggingRendering), this.firstDraggingRendering = !1), this.repaint());
2684
+ }
2685
+ /**
2686
+ * Handles the end of mouse dragging event on a frame.
2687
+ *
2688
+ * @param {GeMouseEvent} mouseEvent - The mouse event object.
2689
+ *
2690
+ * @returns {void}
2691
+ */
2692
+ mouseDraggingEndOnFrame(e) {
2693
+ this.eventListener.onMouseDraggingEnd(e), this.draggingTargetColumnIndex = -1, this.mouseStartAction === "resize-column" ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && (this.hideDraggingColumn(), this.repaint()), this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.firstDraggingRendering = !0, this.mouseStartAction = "";
2694
+ }
2695
+ /**
2696
+ * Handles the mouse move event.
2697
+ *
2698
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
2699
+ * @return {void}
2700
+ */
2701
+ mouseMove(e) {
2702
+ this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
2703
+ }
2704
+ /**
2705
+ * Triggers the context menu event based on the mouse move event.
2706
+ *
2707
+ * @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
2708
+ * @return {void}
2709
+ */
2710
+ contextmenu(e) {
2711
+ this.eventListener.onContextmenu(e);
2712
+ }
2713
+ /**
2714
+ * Toggles the expand or collapse state of all items in the body area model.
2715
+ *
2716
+ * @param {boolean} [expand=true] - Whether to expand or collapse all items. Default is true.
2717
+ *
2718
+ * @return {void}
2719
+ */
2720
+ toggleExpandCollapseAll(e = !0) {
2721
+ var o;
2722
+ const t = this.tableModel.getBodyModel();
2723
+ U(t) && (t.toggleExpandCollapseAll(e), this.repaint(), (o = this.storeStateCollapsedExpandService) == null || o.collapsedStateAll(e));
2724
+ }
2725
+ /**
2726
+ * Toggles the checkbox state of a specific row in a table.
2727
+ *
2728
+ * @param {number} rowIdx - The index of the row to toggle the checkbox state.
2729
+ * @param {number} _colIdx - The index of the column. This parameter is unused.
2730
+ * @param {AreaIdent} areaIdent - The identifier of the table area.
2731
+ *
2732
+ * @return {void} - This method does not return anything.
2733
+ */
2734
+ toggleRowCheckbox(e, t, o) {
2735
+ var l;
2736
+ const s = this.tableModel.getAreaModel(o), i = s.isRowChecked(e), r = i === void 0 || i === "semi" || i === "none";
2737
+ s.setRowChecked(e, r), this.repaint();
2738
+ const n = (l = s.rowSelectionModel) == null ? void 0 : l.getCheckedRows();
2739
+ this.eventListener.onCheckboxChanged(n || []);
2740
+ }
2741
+ /**
2742
+ * Handle mouse click events.
2743
+ *
2744
+ * @param {GeMouseEvent} evt - The mouse click event.
2745
+ * @param {GeMouseEvent | undefined} previousEvt - The previous mouse click event, if any.
2746
+ * @returns {void}
2747
+ */
2748
+ onMouseClicked(e, t) {
2749
+ let o = this.selectionService.onMouseClicked(e, t);
2750
+ if (!o && this.getFocusModel) {
2751
+ this.resetEditorRenderer();
2752
+ const s = this.getFocusModel();
2753
+ s && (o = s.hasChanged(), s.clearChanged());
2754
+ }
2755
+ return o;
2756
+ }
2757
+ debounceRepaint() {
2758
+ this.debounce(this.repaint.bind(this), 1);
2759
+ }
2760
+ publishGeMouseEvent(e) {
2761
+ this.eventListener.onMouseClicked(e);
2762
+ }
2763
+ onFocusChanged(e) {
2764
+ this.eventListener.onFocusChanged(e);
2765
+ }
2766
+ onSelectionChanged(e) {
2767
+ this.eventListener.onSelectionChanged(e);
2768
+ }
2769
+ /**
2770
+ * Updates the table (repaint) when an external filter is changed.
2771
+ *
2772
+ * @param {boolean} clearSelection - Indicates whether to clear the selection model or not. Default value is true.
2773
+ * @return {void}
2774
+ */
2775
+ externalFilterChanged(e = !0) {
2776
+ const t = this.tableOptions.externalFilterFunction;
2777
+ t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
2778
+ }
2779
+ /**
2780
+ * Handle the double click event on the table header.
2781
+ *
2782
+ * @param {MouseEvent} event - The mouse event that triggered the double click.
2783
+ * @param {number} _rowIdx - The row index of the header.
2784
+ * @param {number} colIdx - The column index of the header.
2785
+ *
2786
+ * @return {void}
2787
+ */
2788
+ onHeaderDblClicked(e, t, o) {
2789
+ var i, r;
2790
+ const s = this.tableModel.getColumnDef(o);
2791
+ if (s != null && s.sortable && s.sortable()) {
2792
+ e.preventDefault(), e.stopPropagation();
2793
+ const n = s.sortStatesOrder ? s.sortStatesOrder : this.tableOptions.sortOrder, l = s.sortState ?? "", d = n[(n.indexOf(l) + 1) % n.length], c = new Qe(o, d);
2794
+ this.tableModel.doSort([c]) && ((i = this.tableModel.getColumnDefs()) == null || i.forEach((g) => g.sortState = ""), s.sortState = d), this.repaint(), (r = this.storeSortingService) == null || r.setSortItems([c]);
2795
+ }
2796
+ }
2797
+ /**
2798
+ * Scrolls the viewport to the specified pixel coordinates.
2799
+ *
2800
+ * @param {number} px - The horizontal pixel coordinate to scroll to.
2801
+ * @param {number} py - The vertical pixel coordinate to scroll to.
2802
+ *
2803
+ * @return {void}
2804
+ */
2805
+ scrollToPixel(e, t) {
2806
+ this.scrollViewport.scrollTo(e, t);
2807
+ }
2808
+ /**
2809
+ * Scrolls to the specified index in the table.
2810
+ *
2811
+ * @param {number} _indexX - The horizontal index of the table where scrolling is needed.
2812
+ * @param {number} indexY - The vertical index of the table where scrolling is needed.
2813
+ * @return {void}
2814
+ */
2815
+ scrollToIndex(e, t) {
2816
+ const s = this.tableModel.getAreaModel("body").getYPosByRowIndex(t);
2817
+ this.scrollToPixel(0, s);
2818
+ }
2819
+ /**
2820
+ * Sets the selection model for the table.
2821
+ *
2822
+ * @param {SelectionModel} sm - The selection model to be set.
2823
+ * @param {boolean} rerender - Optional parameter indicating whether to rerender the table after setting the selection model. Default value is false.
2824
+ *
2825
+ * @return {void} - This method does not return any value.
2826
+ */
2827
+ setSelectionModel(e, t = !1) {
2828
+ const o = () => e;
2829
+ this.tableOptions.getSelectionModel = o, this.getSelectionModel = o, this.selectionService.getSelectionModel = o, t && this.repaint();
2830
+ }
2831
+ toggleHeaderGroup(e) {
2832
+ const t = this.tableModel.getAreaModel("header");
2833
+ "columnDefs" in this.tableModel && (this.tableModel.columnDefs = t.toggleHeaderGroup(e), console.info("####### !!!!!! *******, this.tableModel.columnDefs")), this.firstInit();
2834
+ }
2835
+ /**
2836
+ * Retrieves the selection model.
2837
+ * @returns {SelectionModelIf | undefined} The selection model if available, otherwise undefined.
2838
+ */
2839
+ selectionModel() {
2840
+ if (this != null && this.getSelectionModel)
2841
+ return this.getSelectionModel();
2842
+ }
2843
+ /**
2844
+ * Retrieves the focus model.
2845
+ *
2846
+ * @returns {FocusModelIf | undefined} The focus model if it exists, or undefined otherwise.
2847
+ */
2848
+ focusModel() {
2849
+ if (this != null && this.getFocusModel)
2850
+ return this.getFocusModel();
2851
+ }
2852
+ setDragging(e) {
2853
+ this.dragging = e, this.dragging ? (this.storeColumnWidths(), this.lastDragFrom = -1, this.lastDragTo = -1) : this.storedColumnWidths = [];
2854
+ }
2855
+ /**
2856
+ * Changes the focus cell using the specified deltas.
2857
+ *
2858
+ * @param {number} dx - The delta for the column index.
2859
+ * @param {number} dy - The delta for the row index.
2860
+ * @return {boolean} - True if the focus cell was changed, false otherwise.
2861
+ */
2862
+ changeFocusCell(e, t) {
2863
+ if (!this.isEditing() && this.getFocusModel) {
2864
+ const o = this.getFocusModel();
2865
+ if (o) {
2866
+ const [s, i] = o.getFocus();
2867
+ return o.setFocus(s + t, i + e), this.repaint(), !0;
2868
+ }
2869
+ }
2870
+ return !1;
2871
+ }
2872
+ /**
2873
+ * Resizes the column based on the mouse event.
2874
+ *
2875
+ * @param {GeMouseEvent} mouseEvent - The mouse event that triggered the resize.
2876
+ */
2877
+ resizeColumn(e) {
2878
+ this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
2879
+ }
2880
+ /**
2881
+ * Clears the selection model, if available.
2882
+ *
2883
+ * @return {void}
2884
+ */
2885
+ clearSelectionModel() {
2886
+ var e;
2887
+ this.getSelectionModel && ((e = this.getSelectionModel()) == null || e.clear());
2888
+ }
2889
+ debugOnce(e, t) {
2890
+ var o;
2891
+ 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", (o = this.mouseHandler.mouseEvent) == null ? void 0 : o.clientX), console.info("this.hostElement.offsetLeft", this.hostElement.offsetLeft), console.info("this.areaBodyWestGeo.width", this.areaBodyWestGeo.width);
2892
+ }
2893
+ /**
2894
+ * Restores the scroll position of the table if auto restore options are enabled.
2895
+ *
2896
+ *
2897
+ * @returns {void}
2898
+ */
2899
+ autoRestoreScrollPosition() {
2900
+ var e;
2901
+ if ((e = this.tableOptions) != null && e.autoRestoreOptions && this.storeScrollPosStateService && this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition) {
2902
+ const o = this.storeScrollPosStateService.getScrollOffset();
2903
+ o && this.scrollViewport.scrollTo(...o);
2904
+ }
2905
+ }
2906
+ /**
2907
+ * Automatically restores the sorting state of the table.
2908
+ *
2909
+ * @private
2910
+ * @function autoRestoreSortingState
2911
+ * @memberof ClassName
2912
+ *
2913
+ * @description
2914
+ * This method checks if the autoRestoreSortingState option is enabled in the tableOptions.
2915
+ * If enabled, it uses the storeSortingService to retrieve the sort items array.
2916
+ * If there are sort items present, it applies them to the table's body model using the doSort method.
2917
+ *
2918
+ * @returns {void}
2919
+ */
2920
+ autoRestoreSortingState() {
2921
+ var e, t;
2922
+ if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreSortingState && this.storeSortingService) {
2923
+ const o = this.storeSortingService.getSortItems();
2924
+ o != null && o.length && this.tableModel.getBodyModel().doSort(o);
2925
+ }
2926
+ }
2927
+ /**
2928
+ * Restores the collapsed/expanded state of the rows in the table based on the autoRestoreOptions
2929
+ * specified in the tableOptions. This method is private and should not be called directly.
2930
+ *
2931
+ * @private
2932
+ */
2933
+ autoRestoreCollapsedExpandedState() {
2934
+ var e, t;
2935
+ if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
2936
+ const o = this.tableOptions.autoRestoreOptions, s = o.getRowId;
2937
+ if (o.autoRestoreCollapsedExpandedState && s) {
2938
+ const i = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), r = this.tableModel.getAreaModel("body");
2939
+ if (U(r)) {
2940
+ const n = r, l = r.getRowCount();
2941
+ for (let d = 0; d < l; d++) {
2942
+ const c = r.getRowByIndex(d);
2943
+ if (c)
2944
+ if (i.allExpanded)
2945
+ c.expanded = !0;
2946
+ else if (i.allCollapsed)
2947
+ c.expanded = !1;
2948
+ else {
2949
+ const h = s(c.data);
2950
+ i.mode === "expanded" ? c.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h) : i.mode === "collapsed" && (c.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h));
2951
+ }
2952
+ }
2953
+ n.recalcVisibleTreeRows();
2954
+ }
2955
+ }
2956
+ }
2957
+ }
2958
+ }
2959
+ const W = class W {
2960
+ };
2961
+ W.themes = ["light", "combat", "paper", "blackboard"], W.vars = {
2962
+ light: `html[data-theme="light"] {
2963
+ --ge-table-bg: rgba(255,255,255, 0.5);
2964
+ --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
2965
+ --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
2966
+ --ge-table-header-east-bg: rgba(233, 233, 233, 0.5);
2967
+ --ge-table-header-west-text: #000;
2968
+ --ge-table-header-center-text: #000;
2969
+ --ge-table-header-east-text: #000;
2970
+ --ge-table-header-west-horizontal-border: #ddd;
2971
+ --ge-table-header-west-vertical-border: #ccc;
2972
+ --ge-table-header-center-horizontal-border: #ddd;
2973
+ --ge-table-header-center-vertical-border: #ccc;
2974
+ --ge-table-header-east-horizontal-border: #ddd;
2975
+ --ge-table-header-east-vertical-border: #ccc;
2976
+ --ge-table-body-west-bg: rgba(233, 233, 233, 0.5);
2977
+ --ge-table-body-center-bg: rgba(255,255,255, 0.5);
2978
+ --ge-table-body-east-bg: rgba(233, 233, 233, 0.5);
2979
+ --ge-table-body-west-text: #000;
2980
+ --ge-table-body-center-text: #000;
2981
+ --ge-table-body-east-text: #000;
2982
+ --ge-table-body-west-horizontal-border: #ddd;
2983
+ --ge-table-body-west-vertical-border: #ccc;
2984
+ --ge-table-body-center-horizontal-border: #bbb;
2985
+ --ge-table-body-center-vertical-border: #ddd;
2986
+ --ge-table-body-east-horizontal-border: #ddd;
2987
+ --ge-table-body-east-vertical-border: #ccc;
2988
+ --ge-table-body-west-selected-range-bg: rgba(0, 152, 219, 0.4);
2989
+ --ge-table-body-center-selected-range-bg: rgba(0, 152, 219, 0.4);
2990
+ --ge-table-body-east-selected-range-bg: rgba(0, 152, 219, 0.4);
2991
+ --ge-table-body-west-selected-range-text: #000;
2992
+ --ge-table-body-center-selected-range-text: #000;
2993
+ --ge-table-body-east-selected-range-text: #000;
2994
+ --ge-table-footer-west-bg: rgba(233, 233, 233, 0.5);
2995
+ --ge-table-footer-center-bg: rgba(233, 233, 233, 0.5);
2996
+ --ge-table-footer-east-bg: rgba(233, 233, 233, 0.5);
2997
+ --ge-table-footer-west-text: #000;
2998
+ --ge-table-footer-center-text: #000;
2999
+ --ge-table-footer-east-text: #000;
3000
+ --ge-table-footer-west-horizontal-border: #ddd;
3001
+ --ge-table-footer-west-vertical-border: #ccc;
3002
+ --ge-table-footer-center-horizontal-border: #ddd;
3003
+ --ge-table-footer-center-vertical-border: #ccc;
3004
+ --ge-table-footer-east-horizontal-border: #ddd;
3005
+ --ge-table-footer-east-vertical-border: #ccc;
3006
+ --ge-table-border: #ccc;
3007
+ --ge-table-row-odd-bg: transparent;
3008
+ --ge-table-row-even-bg: transparent;
3009
+ --ge-table-column-odd-bg: transparent;
3010
+ --ge-table-column-even-bg: transparent;
3011
+ --ge-table-hover-column-bg: rgba(0, 224, 255, 0.27);
3012
+ --ge-table-hover-row-bg: rgba(0, 224, 255, 0.27);
3013
+ --ge-table-focus-border: rgb(0, 255, 255);
3014
+ --ge-table-color-error-text: #e00034;
3015
+ --ge-table-tree-arrow-collapsed-color: #e00034;
3016
+ --ge-table-column-resize-handle-border: rgb(0, 255, 255);
3017
+ --ge-table-dragged-col-div-bg: lightcyan;
3018
+ --ge-table-drop-zone-bg: rgba(244, 255, 242, 0.6);
3019
+ }`,
3020
+ combat: `html[data-theme="combat"] {
3021
+ --ge-table-bg: #101010;
3022
+ --ge-table-header-west-bg: #101010;
3023
+ --ge-table-header-center-bg: #101010;
3024
+ --ge-table-header-east-bg: #101010;
3025
+ --ge-table-header-west-text: oklch(100% 0 0);
3026
+ --ge-table-header-center-text: oklch(100% 0 0);
3027
+ --ge-table-header-east-text: oklch(100% 0 0);
3028
+ --ge-table-header-west-horizontal-border: oklch(100% 0 0 / 0%);
3029
+ --ge-table-header-west-vertical-border: oklch(100% 0 0 / 0%);
3030
+ --ge-table-header-center-horizontal-border: oklch(100% 0 0 / 0%);
3031
+ --ge-table-header-center-vertical-border: oklch(100% 0 0 / 0%);
3032
+ --ge-table-header-east-horizontal-border: oklch(100% 0 0 / 0%);
3033
+ --ge-table-header-east-vertical-border: oklch(100% 0 0 / 0%);
3034
+ --ge-table-body-west-bg: #101010;
3035
+ --ge-table-body-center-bg: #101010;
3036
+ --ge-table-body-east-bg: #101010;
3037
+ --ge-table-body-west-text: #b6b4b4;
3038
+ --ge-table-body-center-text: #b6b4b4;
3039
+ --ge-table-body-east-text: #b6b4b4;
3040
+ --ge-table-body-west-horizontal-border: oklch(100% 0 0 / 0%);
3041
+ --ge-table-body-west-vertical-border: oklch(100% 0 0 / 0%);
3042
+ --ge-table-body-center-horizontal-border: oklch(100% 0 0 / 0%);
3043
+ --ge-table-body-center-vertical-border: oklch(100% 0 0 / 0%);
3044
+ --ge-table-body-east-horizontal-border: oklch(100% 0 0 / 0%);
3045
+ --ge-table-body-east-vertical-border: oklch(100% 0 0 / 0%);
3046
+ --ge-table-body-west-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
3047
+ --ge-table-body-center-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
3048
+ --ge-table-body-east-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
3049
+ --ge-table-body-west-selected-range-text: #f00032;
3050
+ --ge-table-body-center-selected-range-text: #f00032;
3051
+ --ge-table-body-east-selected-range-text: #f00032;
3052
+ --ge-table-footer-west-bg: #101010;
3053
+ --ge-table-footer-center-bg: #101010;
3054
+ --ge-table-footer-east-bg: #101010;
3055
+ --ge-table-footer-west-text: oklch(100% 0 0);
3056
+ --ge-table-footer-center-text: oklch(100% 0 0);
3057
+ --ge-table-footer-east-text: oklch(100% 0 0);
3058
+ --ge-table-footer-west-horizontal-border: oklch(100% 0 0 / 0%);
3059
+ --ge-table-footer-west-vertical-border: oklch(100% 0 0 / 0%);
3060
+ --ge-table-footer-center-horizontal-border: oklch(100% 0 0 / 0%);
3061
+ --ge-table-footer-center-vertical-border: oklch(100% 0 0 / 0%);
3062
+ --ge-table-footer-east-horizontal-border: oklch(100% 0 0 / 0%);
3063
+ --ge-table-footer-east-vertical-border: oklch(100% 0 0 / 0%);
3064
+ --ge-table-border: oklch(100% 0 0 / 0%);
3065
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
3066
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
3067
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
3068
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
3069
+ --ge-table-hover-column-bg: oklch(34% 0.25 3.6 / 27%);
3070
+ --ge-table-hover-row-bg: oklch(34% 0.25 3.6 / 27%);
3071
+ --ge-table-focus-border: oklch(40% 0.25 3.6);
3072
+ --ge-table-color-error-text: oklch(65% 0.31 43.2);
3073
+ --ge-table-tree-arrow-collapsed-color: #e00034;
3074
+ --ge-table-column-resize-handle-border: oklch(63% 0.31 43.2);
3075
+ --ge-table-dragged-col-div-bg: #2c2e33;
3076
+ --ge-table-drop-zone-bg: #101010;
3077
+ }`,
3078
+ paper: `html[data-theme="paper"] {
3079
+ --ge-table-bg: #e7e5df;
3080
+ --ge-table-header-west-bg: oklch(80% 0.02 99 / 48%);
3081
+ --ge-table-header-center-bg: oklch(80% 0.02 99 / 48%);
3082
+ --ge-table-header-east-bg: oklch(80% 0.02 99 / 48%);
3083
+ --ge-table-header-west-text: #111;
3084
+ --ge-table-header-center-text: #111;
3085
+ --ge-table-header-east-text: #111;
3086
+ --ge-table-header-west-horizontal-border: oklch(100% 0 0 / 0%);
3087
+ --ge-table-header-west-vertical-border: oklch(100% 0 0 / 0%);
3088
+ --ge-table-header-center-horizontal-border: oklch(100% 0 0 / 0%);
3089
+ --ge-table-header-center-vertical-border: oklch(100% 0 0 / 0%);
3090
+ --ge-table-header-east-horizontal-border: oklch(100% 0 0 / 0%);
3091
+ --ge-table-header-east-vertical-border: oklch(100% 0 0 / 0%);
3092
+ --ge-table-body-west-bg: oklch(80% 0.02 99 / 48%);
3093
+ --ge-table-body-center-bg: #e7e5df;
3094
+ --ge-table-body-east-bg: oklch(80% 0.02 99 / 48%);
3095
+ --ge-table-body-west-text: #000;
3096
+ --ge-table-body-center-text: #000;
3097
+ --ge-table-body-east-text: #000;
3098
+ --ge-table-body-west-horizontal-border: oklch(100% 0 0 / 0%);
3099
+ --ge-table-body-west-vertical-border: oklch(100% 0 0 / 0%);
3100
+ --ge-table-body-center-horizontal-border: oklch(100% 0 0 / 0%);
3101
+ --ge-table-body-center-vertical-border: oklch(100% 0 0 / 0%);
3102
+ --ge-table-body-east-horizontal-border: oklch(100% 0 0 / 0%);
3103
+ --ge-table-body-east-vertical-border: oklch(100% 0 0 / 0%);
3104
+ --ge-table-body-west-selected-range-bg: #cfcdc2;
3105
+ --ge-table-body-center-selected-range-bg: #cfcdc2;
3106
+ --ge-table-body-east-selected-range-bg: #cfcdc2;
3107
+ --ge-table-body-west-selected-range-text: #000;
3108
+ --ge-table-body-center-selected-range-text: #000;
3109
+ --ge-table-body-east-selected-range-text: #000;
3110
+ --ge-table-footer-west-bg: oklch(80% 0.02 99 / 48%);
3111
+ --ge-table-footer-center-bg: oklch(80% 0.02 99 / 48%);
3112
+ --ge-table-footer-east-bg: oklch(80% 0.02 99 / 48%);
3113
+ --ge-table-footer-west-text: #111;
3114
+ --ge-table-footer-center-text: #111;
3115
+ --ge-table-footer-east-text: #111;
3116
+ --ge-table-footer-west-horizontal-border: oklch(100% 0 0 / 0%);
3117
+ --ge-table-footer-west-vertical-border: oklch(100% 0 0 / 0%);
3118
+ --ge-table-footer-center-horizontal-border: oklch(100% 0 0 / 0%);
3119
+ --ge-table-footer-center-vertical-border: oklch(100% 0 0 / 0%);
3120
+ --ge-table-footer-east-horizontal-border: oklch(100% 0 0 / 0%);
3121
+ --ge-table-footer-east-vertical-border: oklch(100% 0 0 / 0%);
3122
+ --ge-table-border: oklch(100% 0 0 / 0%);
3123
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
3124
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
3125
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
3126
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
3127
+ --ge-table-hover-column-bg: oklch(5% 0.2 266.40000000000003 / 9%);
3128
+ --ge-table-hover-row-bg: oklch(5% 0.2 266.40000000000003 / 9%);
3129
+ --ge-table-focus-border: oklch(100% 0.19 205.20000000000002);
3130
+ --ge-table-color-error-text: oklch(45% 0.25 43.2);
3131
+ --ge-table-tree-arrow-collapsed-color: #e00034;
3132
+ --ge-table-column-resize-handle-border: oklch(100% 0.19 205.20000000000002 / 71%);
3133
+ --ge-table-dragged-col-div-bg: #2c2e33;
3134
+ --ge-table-drop-zone-bg: #e7e5df;
3135
+ }`,
3136
+ blackboard: `html[data-theme="dark"] {
3137
+ --ge-table-bg: #0c1021;
3138
+ --ge-table-header-west-bg: #0c1021;
3139
+ --ge-table-header-center-bg: #0c1021;
3140
+ --ge-table-header-east-bg: #0c1021;
3141
+ --ge-table-header-west-text: #e0df85;
3142
+ --ge-table-header-center-text: #e0df85;
3143
+ --ge-table-header-east-text: #e0df85;
3144
+ --ge-table-header-west-horizontal-border: transparent;
3145
+ --ge-table-header-west-vertical-border: transparent;
3146
+ --ge-table-header-center-horizontal-border: transparent;
3147
+ --ge-table-header-center-vertical-border: transparent;
3148
+ --ge-table-header-east-horizontal-border: transparent;
3149
+ --ge-table-header-east-vertical-border: transparent;
3150
+ --ge-table-body-west-bg: #0c1021;
3151
+ --ge-table-body-center-bg: #0c1021;
3152
+ --ge-table-body-east-bg: #0c1021;
3153
+ --ge-table-body-west-text: #a7a7a7;
3154
+ --ge-table-body-center-text: #a7a7a7;
3155
+ --ge-table-body-east-text: #a7a7a7;
3156
+ --ge-table-body-west-horizontal-border: transparent;
3157
+ --ge-table-body-west-vertical-border: transparent;
3158
+ --ge-table-body-center-horizontal-border: transparent;
3159
+ --ge-table-body-center-vertical-border: transparent;
3160
+ --ge-table-body-east-horizontal-border: transparent;
3161
+ --ge-table-body-east-vertical-border: transparent;
3162
+ --ge-table-body-west-selected-range-bg: #758129;
3163
+ --ge-table-body-center-selected-range-bg: #758129;
3164
+ --ge-table-body-east-selected-range-bg: #758129;
3165
+ --ge-table-body-west-selected-range-text: oklch(100% 0 0);
3166
+ --ge-table-body-center-selected-range-text: oklch(100% 0 0);
3167
+ --ge-table-body-east-selected-range-text: oklch(100% 0 0);
3168
+ --ge-table-footer-west-bg: #0c1021;
3169
+ --ge-table-footer-center-bg: #0c1021;
3170
+ --ge-table-footer-east-bg: #0c1021;
3171
+ --ge-table-footer-west-text: #e0df85;
3172
+ --ge-table-footer-center-text: #e0df85;
3173
+ --ge-table-footer-east-text: #e0df85;
3174
+ --ge-table-footer-west-horizontal-border: transparent;
3175
+ --ge-table-footer-west-vertical-border: transparent;
3176
+ --ge-table-footer-center-horizontal-border: transparent;
3177
+ --ge-table-footer-center-vertical-border: otransparent;
3178
+ --ge-table-footer-east-horizontal-border: transparent;
3179
+ --ge-table-footer-east-vertical-border: transparent;
3180
+ --ge-table-border: oklch(0% 0 0);
3181
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
3182
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
3183
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
3184
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
3185
+ --ge-table-hover-column-bg: #a9a9a9;
3186
+ --ge-table-hover-row-bg: #a9a9a9;
3187
+ --ge-table-focus-border: #e1ff00;
3188
+ --ge-table-color-error-text: #ff0040;
3189
+ --ge-table-tree-arrow-collapsed-color: #e00034;
3190
+ --ge-table-column-resize-handle-border: oklch(0% 0 0);
3191
+ --ge-table-dragged-col-div-bg: #2c2e33;
3192
+ --ge-table-drop-zone-bg: #758129;
3193
+ }`
3194
+ };
3195
+ let ae = W;
3196
+ const G = class G {
3197
+ constructor(e = new fe()) {
3198
+ this.headerGroupOptions = e;
3199
+ }
3200
+ render(e, t, o, s, i, r, n) {
3201
+ const l = r != null && r.data ? r.data : "";
3202
+ if (r) {
3203
+ const { toggle: d, visibility: c, closed: h } = r, g = d ? G.toggleHeaderGroup : "";
3204
+ this.addText(e, s, t, o, l, g), d && c !== "always" && this.addArrowDiv(n, e, !h, t, o, s, g);
3205
+ } else
3206
+ this.addText(e, s, t, o, l, "");
3207
+ }
3208
+ addText(e, t, o, s, i, r) {
3209
+ e.innerHTML = `<span
3210
+ data-ge-action="${r}"
3211
+ data-area="${t}"
3212
+ data-row-index="${o}"
3213
+ data-col-index="${s}"
3214
+ >${i}</span>`;
3215
+ }
3216
+ addArrowDiv(e, t, o = !0, s = -1, i = -1, r = "header", n) {
3217
+ const l = e.createElement("div");
3218
+ e.addClass(l, "ge-table-toggle-icon-div"), e.setStyle(l, "display", "inline-block"), e.setStyle(l, "position", ""), e.setStyle(l, "width", "20px"), e.setStyle(l, "background", "transparent"), e.setStyle(l, "cursor", "pointer"), e.setAttribute(l, "data-row-index", `${s}`), e.setAttribute(l, "data-col-index", `${i}`), e.setAttribute(l, "data-area", `${r}`), e.setAttribute(l, "data-ge-action", `${n}`);
3219
+ let d;
3220
+ o ? d = this.headerGroupOptions.iconExpanded : d = this.headerGroupOptions.iconCollapsed;
3221
+ const c = d.content, h = e.createText(c);
3222
+ e.appendChild(l, h), d.style && this.applyStyleString(e, l, d.style);
3223
+ for (const g of d.classes)
3224
+ e.addClass(l, g);
3225
+ return e.appendChild(t, l), l;
3226
+ }
3227
+ applyStyleString(e, t, o) {
3228
+ const s = o.split(";").map((i) => i.trim()).filter((i) => i);
3229
+ for (const i of s) {
3230
+ const [r, n] = i.split(":");
3231
+ e.setStyle(t, r.trim(), n.trim());
3232
+ }
3233
+ }
3234
+ };
3235
+ G.toggleHeaderGroup = "toggleHeaderGroup";
3236
+ let ne = G;
3237
+ function ct(a) {
3238
+ let e;
3239
+ return {
3240
+ c() {
3241
+ e = Ae("div"), Me(e, "class", "ge-table"), _(e, "width", "100%"), _(e, "height", "100%"), _(e, "background-color", "transparent"), _(e, "padding", "0"), _(e, "margin", "0");
3242
+ },
3243
+ m(t, o) {
3244
+ Ee(t, e, o), a[4](e);
3245
+ },
3246
+ p: L,
3247
+ i: L,
3248
+ o: L,
3249
+ d(t) {
3250
+ t && he(e), a[4](null);
3251
+ }
3252
+ };
3253
+ }
3254
+ function ht(a, e, t) {
3255
+ let { tableModel: o } = e, { tableOptions: s = new Se() } = e, { licenseKey: i } = e, r;
3256
+ const n = ve();
3257
+ we(() => {
3258
+ const d = {
3259
+ onSelectionChanged(h) {
3260
+ n("selectionChanged", h);
3261
+ },
3262
+ onFocusChanged(h) {
3263
+ n("focusChanged", h);
3264
+ },
3265
+ onCheckboxChanged: (h) => {
3266
+ n("checkboxChanged", h);
3267
+ },
3268
+ onContextmenu: (h) => {
3269
+ n("contextmenu", h);
3270
+ },
3271
+ onModelChanged: (h) => {
3272
+ n("modelChanged", h);
3273
+ },
3274
+ onMouseClicked: (h) => {
3275
+ n("mouseClicked", h);
3276
+ },
3277
+ onMouseDragging: (h) => {
3278
+ n("mouseDragging", h);
3279
+ },
3280
+ onMouseDraggingEnd: (h) => {
3281
+ n("mouseDraggingEnd", h);
3282
+ },
3283
+ onMouseMoved: (h) => {
3284
+ n("mouseMoved", h);
3285
+ }
3286
+ }, c = new oe(r, o, new be(), s, d);
3287
+ c.firstInit(), n("tableReady", c.getApi()), i && k.getInstance().setLicenseKey(i);
3288
+ });
3289
+ function l(d) {
3290
+ X[d ? "unshift" : "push"](() => {
3291
+ r = d, t(0, r);
3292
+ });
3293
+ }
3294
+ return a.$$set = (d) => {
3295
+ "tableModel" in d && t(1, o = d.tableModel), "tableOptions" in d && t(2, s = d.tableOptions), "licenseKey" in d && t(3, i = d.licenseKey);
3296
+ }, [r, o, s, i, l];
3297
+ }
3298
+ class ut extends Pe {
3299
+ constructor(e) {
3300
+ super(), Be(this, e, ht, ct, Ce, {
3301
+ tableModel: 1,
3302
+ tableOptions: 2,
3303
+ licenseKey: 3
3304
+ });
3305
+ }
3306
+ }
3307
+ class bt {
3308
+ constructor(e) {
3309
+ this.Component = e;
3310
+ }
3311
+ render(e, t, o, s, i, r, n) {
3312
+ const l = new this.Component({
3313
+ target: e,
3314
+ props: {
3315
+ cellDiv: e,
3316
+ rowIndex: t,
3317
+ columnIndex: o,
3318
+ areaIdent: s,
3319
+ areaModel: i,
3320
+ cellValue: r
3321
+ }
3322
+ });
3323
+ return () => {
3324
+ l.$destroy();
3325
+ };
3326
+ }
3327
+ }
3328
+ export {
3329
+ bt as ComponentRendererWrapper,
3330
+ ut as GuiexpertTable
3331
+ };