@guiexpert/solid-table 1.0.2

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