@guiexpert/solid-table 1.0.3 → 1.0.6

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