@guiexpert/solid-table 1.0.13 → 1.0.15

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