@guiexpert/solid-table 1.1.78 → 1.1.80
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.cjs +9 -6
- package/index.js +1194 -194
- package/package.json +5 -3
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
equals:
|
|
1
|
+
const Ie = (l, e) => l === e, oe = Symbol("solid-proxy"), ke = typeof Proxy == "function", fe = {
|
|
2
|
+
equals: Ie
|
|
3
3
|
};
|
|
4
|
-
let we =
|
|
4
|
+
let we = ve;
|
|
5
5
|
const B = 1, z = 2, xe = {
|
|
6
6
|
owned: null,
|
|
7
7
|
cleanups: null,
|
|
@@ -16,7 +16,7 @@ function Le(l, e) {
|
|
|
16
16
|
cleanups: null,
|
|
17
17
|
context: i ? i.context : null,
|
|
18
18
|
owner: i
|
|
19
|
-
}, a = o ? l : () => l(() => Q(() =>
|
|
19
|
+
}, a = o ? l : () => l(() => Q(() => H(r)));
|
|
20
20
|
M = r, x = null;
|
|
21
21
|
try {
|
|
22
22
|
return _(a, !0);
|
|
@@ -26,17 +26,17 @@ function Le(l, e) {
|
|
|
26
26
|
}
|
|
27
27
|
function ie(l, e, t) {
|
|
28
28
|
const s = ae(l, e, !1, B);
|
|
29
|
-
|
|
29
|
+
$(s);
|
|
30
30
|
}
|
|
31
31
|
function Be(l, e, t) {
|
|
32
32
|
we = Ne;
|
|
33
33
|
const s = ae(l, e, !1, B);
|
|
34
|
-
s.user = !0, O ? O.push(s) :
|
|
34
|
+
s.user = !0, O ? O.push(s) : $(s);
|
|
35
35
|
}
|
|
36
36
|
function Pe(l, e, t) {
|
|
37
37
|
t = t ? Object.assign({}, fe, t) : fe;
|
|
38
38
|
const s = ae(l, e, !0, 0);
|
|
39
|
-
return s.observers = null, s.observerSlots = null, s.comparator = t.equals || void 0,
|
|
39
|
+
return s.observers = null, s.observerSlots = null, s.comparator = t.equals || void 0, $(s), We.bind(s);
|
|
40
40
|
}
|
|
41
41
|
function Q(l) {
|
|
42
42
|
if (x === null) return l();
|
|
@@ -48,12 +48,12 @@ function Q(l) {
|
|
|
48
48
|
x = e;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Ve(l) {
|
|
52
52
|
Be(() => Q(l));
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function We() {
|
|
55
55
|
if (this.sources && this.state)
|
|
56
|
-
if (this.state === B)
|
|
56
|
+
if (this.state === B) $(this);
|
|
57
57
|
else {
|
|
58
58
|
const l = R;
|
|
59
59
|
R = null, _(() => j(this), !1), R = l;
|
|
@@ -64,39 +64,39 @@ function He() {
|
|
|
64
64
|
}
|
|
65
65
|
return this.value;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function He(l, e, t) {
|
|
68
68
|
let s = l.value;
|
|
69
69
|
return (!l.comparator || !l.comparator(s, e)) && (l.value = e, l.observers && l.observers.length && _(() => {
|
|
70
70
|
for (let o = 0; o < l.observers.length; o += 1) {
|
|
71
71
|
const i = l.observers[o], r = te && te.running;
|
|
72
|
-
r && te.disposed.has(i), (r ? !i.tState : !i.state) && (i.pure ? R.push(i) : O.push(i), i.observers &&
|
|
72
|
+
r && te.disposed.has(i), (r ? !i.tState : !i.state) && (i.pure ? R.push(i) : O.push(i), i.observers && Ce(i)), r || (i.state = B);
|
|
73
73
|
}
|
|
74
74
|
if (R.length > 1e6)
|
|
75
75
|
throw R = [], new Error();
|
|
76
76
|
}, !1)), e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function $(l) {
|
|
79
79
|
if (!l.fn) return;
|
|
80
|
-
|
|
80
|
+
H(l);
|
|
81
81
|
const e = Z;
|
|
82
|
-
|
|
82
|
+
$e(
|
|
83
83
|
l,
|
|
84
84
|
l.value,
|
|
85
85
|
e
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function $e(l, e, t) {
|
|
89
89
|
let s;
|
|
90
90
|
const o = M, i = x;
|
|
91
91
|
x = M = l;
|
|
92
92
|
try {
|
|
93
93
|
s = l.fn(e);
|
|
94
94
|
} catch (r) {
|
|
95
|
-
return l.pure && (l.state = B, l.owned && l.owned.forEach(
|
|
95
|
+
return l.pure && (l.state = B, l.owned && l.owned.forEach(H), l.owned = null), l.updatedAt = t + 1, Ae(r);
|
|
96
96
|
} finally {
|
|
97
97
|
x = i, M = o;
|
|
98
98
|
}
|
|
99
|
-
(!l.updatedAt || l.updatedAt <= t) && (l.updatedAt != null && "observers" in l ?
|
|
99
|
+
(!l.updatedAt || l.updatedAt <= t) && (l.updatedAt != null && "observers" in l ? He(l, s) : l.value = s, l.updatedAt = t);
|
|
100
100
|
}
|
|
101
101
|
function ae(l, e, t, s = B, o) {
|
|
102
102
|
const i = {
|
|
@@ -123,7 +123,7 @@ function U(l) {
|
|
|
123
123
|
l.state && e.push(l);
|
|
124
124
|
for (let t = e.length - 1; t >= 0; t--)
|
|
125
125
|
if (l = e[t], l.state === B)
|
|
126
|
-
|
|
126
|
+
$(l);
|
|
127
127
|
else if (l.state === z) {
|
|
128
128
|
const s = R;
|
|
129
129
|
R = null, _(() => j(l, e[0]), !1), R = s;
|
|
@@ -141,11 +141,11 @@ function _(l, e) {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
function _e(l) {
|
|
144
|
-
if (R && (
|
|
144
|
+
if (R && (ve(R), R = null), l) return;
|
|
145
145
|
const e = O;
|
|
146
146
|
O = null, e.length && _(() => we(e), !1);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function ve(l) {
|
|
149
149
|
for (let e = 0; e < l.length; e++) U(l[e]);
|
|
150
150
|
}
|
|
151
151
|
function Ne(l) {
|
|
@@ -166,13 +166,13 @@ function j(l, e) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function Ce(l) {
|
|
170
170
|
for (let e = 0; e < l.observers.length; e += 1) {
|
|
171
171
|
const t = l.observers[e];
|
|
172
|
-
t.state || (t.state = z, t.pure ? R.push(t) : O.push(t), t.observers &&
|
|
172
|
+
t.state || (t.state = z, t.pure ? R.push(t) : O.push(t), t.observers && Ce(t));
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function H(l) {
|
|
176
176
|
let e;
|
|
177
177
|
if (l.sources)
|
|
178
178
|
for (; l.sources.length; ) {
|
|
@@ -183,11 +183,11 @@ function $(l) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
if (l.tOwned) {
|
|
186
|
-
for (e = l.tOwned.length - 1; e >= 0; e--)
|
|
186
|
+
for (e = l.tOwned.length - 1; e >= 0; e--) H(l.tOwned[e]);
|
|
187
187
|
delete l.tOwned;
|
|
188
188
|
}
|
|
189
189
|
if (l.owned) {
|
|
190
|
-
for (e = l.owned.length - 1; e >= 0; e--)
|
|
190
|
+
for (e = l.owned.length - 1; e >= 0; e--) H(l.owned[e]);
|
|
191
191
|
l.owned = null;
|
|
192
192
|
}
|
|
193
193
|
if (l.cleanups) {
|
|
@@ -246,7 +246,7 @@ function Ee(...l) {
|
|
|
246
246
|
const a = l[r];
|
|
247
247
|
e = e || !!a && oe in a, l[r] = typeof a == "function" ? (e = !0, Pe(a)) : a;
|
|
248
248
|
}
|
|
249
|
-
if (
|
|
249
|
+
if (ke && e)
|
|
250
250
|
return new Proxy(
|
|
251
251
|
{
|
|
252
252
|
get(r) {
|
|
@@ -324,8 +324,8 @@ function je(l, e, t) {
|
|
|
324
324
|
const c = d.get(e[r]);
|
|
325
325
|
if (c != null)
|
|
326
326
|
if (a < c && c < i) {
|
|
327
|
-
let h = r, p = 1,
|
|
328
|
-
for (; ++h < o && h < i && !((
|
|
327
|
+
let h = r, p = 1, m;
|
|
328
|
+
for (; ++h < o && h < i && !((m = d.get(e[h])) == null || m !== c + p); )
|
|
329
329
|
p++;
|
|
330
330
|
if (p > c - a) {
|
|
331
331
|
const g = e[r];
|
|
@@ -368,11 +368,11 @@ function X(l, e, t, s, o) {
|
|
|
368
368
|
return t;
|
|
369
369
|
if (r) {
|
|
370
370
|
let a = t[0];
|
|
371
|
-
a && a.nodeType === 3 ? a.data !== e && (a.data = e) : a = document.createTextNode(e), t =
|
|
371
|
+
a && a.nodeType === 3 ? a.data !== e && (a.data = e) : a = document.createTextNode(e), t = V(l, t, s, a);
|
|
372
372
|
} else
|
|
373
373
|
t !== "" && typeof t == "string" ? t = l.firstChild.data = e : t = l.textContent = e;
|
|
374
374
|
} else if (e == null || i === "boolean")
|
|
375
|
-
t =
|
|
375
|
+
t = V(l, t, s);
|
|
376
376
|
else {
|
|
377
377
|
if (i === "function")
|
|
378
378
|
return ie(() => {
|
|
@@ -385,13 +385,13 @@ function X(l, e, t, s, o) {
|
|
|
385
385
|
if (re(a, e, t, o))
|
|
386
386
|
return ie(() => t = X(l, a, t, s, !0)), () => t;
|
|
387
387
|
if (a.length === 0) {
|
|
388
|
-
if (t =
|
|
389
|
-
} else n ? t.length === 0 ? ue(l, a, s) : je(l, t, a) : (t &&
|
|
388
|
+
if (t = V(l, t, s), r) return t;
|
|
389
|
+
} else n ? t.length === 0 ? ue(l, a, s) : je(l, t, a) : (t && V(l), ue(l, a));
|
|
390
390
|
t = a;
|
|
391
391
|
} else if (e.nodeType) {
|
|
392
392
|
if (Array.isArray(t)) {
|
|
393
|
-
if (r) return t =
|
|
394
|
-
|
|
393
|
+
if (r) return t = V(l, t, s, e);
|
|
394
|
+
V(l, t, null, e);
|
|
395
395
|
} else t == null || t === "" || !l.firstChild ? l.appendChild(e) : l.replaceChild(e, l.firstChild);
|
|
396
396
|
t = e;
|
|
397
397
|
}
|
|
@@ -426,7 +426,7 @@ function re(l, e, t, s) {
|
|
|
426
426
|
function ue(l, e, t = null) {
|
|
427
427
|
for (let s = 0, o = e.length; s < o; s++) l.insertBefore(e[s], t);
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function V(l, e, t, s) {
|
|
430
430
|
if (t === void 0) return l.textContent = "";
|
|
431
431
|
const o = s || document.createTextNode("");
|
|
432
432
|
if (e.length) {
|
|
@@ -521,25 +521,25 @@ class ne {
|
|
|
521
521
|
);
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
class
|
|
524
|
+
class k {
|
|
525
525
|
constructor(e = ">", t = "", s = []) {
|
|
526
526
|
this.content = e, this.style = t, this.classes = s;
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
529
|
class Re {
|
|
530
|
-
constructor(e = new
|
|
530
|
+
constructor(e = new k(
|
|
531
531
|
">",
|
|
532
532
|
"transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
|
|
533
533
|
["gt-table-tree-arrow-expanded"]
|
|
534
|
-
), t = new
|
|
534
|
+
), t = new k(
|
|
535
535
|
">",
|
|
536
536
|
"",
|
|
537
537
|
["ge-table-tree-arrow-collapsed"]
|
|
538
|
-
), s = new
|
|
538
|
+
), s = new k(
|
|
539
539
|
">",
|
|
540
540
|
"color:transparent;",
|
|
541
541
|
["gt-table-tree-arrow-hidden"]
|
|
542
|
-
), o = new
|
|
542
|
+
), o = new k(
|
|
543
543
|
"↕",
|
|
544
544
|
"",
|
|
545
545
|
["gt-table-tree-arrow-expanded-all"]
|
|
@@ -548,7 +548,7 @@ class Re {
|
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
class Me {
|
|
551
|
-
constructor(e = new
|
|
551
|
+
constructor(e = new k("↑", "", ["ge-header-sorted-asc"]), t = new k("↓", "", ["ge-header-sorted-desc"]), s = new k("↑", "color:transparent;", [])) {
|
|
552
552
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
553
553
|
}
|
|
554
554
|
}
|
|
@@ -638,12 +638,12 @@ class Ze {
|
|
|
638
638
|
return this.domService.appendChild(e.child, n), n;
|
|
639
639
|
}
|
|
640
640
|
addColumnDiv(e) {
|
|
641
|
-
const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: a, text: n = "", treeArrow: d, tableOptions: c, checkedType: h = void 0, sortState: p } = e,
|
|
641
|
+
const { parent: t, geo: s, rowIndex: o = -1, columnIndex: i = -1, areaIdent: r, sideIdent: a, text: n = "", treeArrow: d, tableOptions: c, checkedType: h = void 0, sortState: p } = e, m = c == null ? void 0 : c.treeOptions, g = c == null ? void 0 : c.showCheckboxWihoutExtraColumn, b = this.domService.createElement("div");
|
|
642
642
|
this.domService.addClass(b, "ge-table-col-div"), g && this.domService.addClass(b, "ge-with-checkbox"), this.domService.addClass(b, `ge-table-col-div-${s.index}`), this.domService.setAttribute(b, "data-col-index", `${s.index}`), this.domService.setAttribute(b, "data-row-index", `${o}`), this.domService.setAttribute(b, "data-area", `${r}`);
|
|
643
643
|
const f = ((s == null ? void 0 : s.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
644
|
-
if (r === "body" && a === "center" && this.domService.addClass(b, `ge-table-column-${f}`), this.domService.setStyle(b, "display", "clip"), this.domService.setStyle(b, "position", "absolute"), this.domService.setStyle(b, "left", `${s.left}px`), this.domService.setStyle(b, "top", `${s.top}px`), this.domService.setStyle(b, "width", `${s.width}px`), this.domService.setStyle(b, "height", `${s.height}px`), d && d !== "none" && (this.domService.addClass(b, "ge-table-col-tree"), this.addArrowDiv(b, d,
|
|
645
|
-
const
|
|
646
|
-
this.addLabelDiv(b, n,
|
|
644
|
+
if (r === "body" && a === "center" && this.domService.addClass(b, `ge-table-column-${f}`), this.domService.setStyle(b, "display", "clip"), this.domService.setStyle(b, "position", "absolute"), this.domService.setStyle(b, "left", `${s.left}px`), this.domService.setStyle(b, "top", `${s.top}px`), this.domService.setStyle(b, "width", `${s.width}px`), this.domService.setStyle(b, "height", `${s.height}px`), d && d !== "none" && (this.domService.addClass(b, "ge-table-col-tree"), this.addArrowDiv(b, d, m, o, i, r)), g && i === 0 && h && this.addCheckboxToDiv(b, h, r, o), n) {
|
|
645
|
+
const u = d !== "none" && i === 0;
|
|
646
|
+
this.addLabelDiv(b, n, u, o, i, r);
|
|
647
647
|
}
|
|
648
648
|
return p && this.addSortedIcon(b, p, c == null ? void 0 : c.sortedOptions, i), this.domService.appendChild(t, b), b;
|
|
649
649
|
}
|
|
@@ -998,28 +998,128 @@ class st {
|
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
class L extends tt {
|
|
1001
|
+
/**
|
|
1002
|
+
* Creates an instance of AreaModelObjectArray.
|
|
1003
|
+
*
|
|
1004
|
+
* @param {AreaIdent} areaIdent - Identifies which area of the table this model represents ('header', 'body', or 'footer')
|
|
1005
|
+
* @param {T[]} rows - The array of objects that represent the rows in this area
|
|
1006
|
+
* @param {number} defaultRowHeight - The default height for rows in this area (in pixels)
|
|
1007
|
+
* @param {ColumnDefIf[]} [columnDefs=[]] - Definitions for the columns in this area
|
|
1008
|
+
* @param {string} [selectedRowClass='ge-selected-row'] - CSS class to apply to selected rows
|
|
1009
|
+
* @param {string} [focusedRowClass='ge-focused-row'] - CSS class to apply to the focused row
|
|
1010
|
+
*
|
|
1011
|
+
* @example
|
|
1012
|
+
* const rows = [
|
|
1013
|
+
* { id: 1, name: 'John', age: 30 },
|
|
1014
|
+
* { id: 2, name: 'Jane', age: 25 }
|
|
1015
|
+
* ];
|
|
1016
|
+
*
|
|
1017
|
+
* const columnDefs = [
|
|
1018
|
+
* { property: 'id', headerLabel: 'ID', width: 50 },
|
|
1019
|
+
* { property: 'name', headerLabel: 'Name', width: 150 },
|
|
1020
|
+
* { property: 'age', headerLabel: 'Age', width: 100 }
|
|
1021
|
+
* ];
|
|
1022
|
+
*
|
|
1023
|
+
* const bodyAreaModel = new AreaModelObjectArray(
|
|
1024
|
+
* 'body',
|
|
1025
|
+
* rows,
|
|
1026
|
+
* 30,
|
|
1027
|
+
* columnDefs
|
|
1028
|
+
* );
|
|
1029
|
+
*/
|
|
1001
1030
|
constructor(e, t, s, o = [], i = "ge-selected-row", r = "ge-focused-row") {
|
|
1002
1031
|
super(e, o, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = o, this.selectedRowClass = i, this.focusedRowClass = r, this.sorterService = new st(), this._focusedRowIndex = 0, this.filteredRows = [...t], this.properties = o.map((a) => a.property);
|
|
1003
1032
|
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Gets the index of the currently focused row.
|
|
1035
|
+
*
|
|
1036
|
+
* @returns {number} The index of the focused row
|
|
1037
|
+
*
|
|
1038
|
+
* @example
|
|
1039
|
+
* const focusedRowIndex = bodyAreaModel.getFocusedRowIndex();
|
|
1040
|
+
* console.log(`The focused row is at index ${focusedRowIndex}`);
|
|
1041
|
+
*/
|
|
1004
1042
|
getFocusedRowIndex() {
|
|
1005
1043
|
return this._focusedRowIndex;
|
|
1006
1044
|
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Sets the index of the focused row.
|
|
1047
|
+
* This will apply the focused row styling to the specified row.
|
|
1048
|
+
*
|
|
1049
|
+
* @param {number} value - The index of the row to focus
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* // Focus the second row (index 1)
|
|
1053
|
+
* bodyAreaModel.setFocusedRowIndex(1);
|
|
1054
|
+
*/
|
|
1007
1055
|
setFocusedRowIndex(e) {
|
|
1008
1056
|
this._focusedRowIndex = e;
|
|
1009
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Replaces the current rows array with a new one.
|
|
1060
|
+
* This also resets the filtered rows to match the new rows array.
|
|
1061
|
+
*
|
|
1062
|
+
* @param {T[]} rows - The new array of row objects
|
|
1063
|
+
*
|
|
1064
|
+
* @example
|
|
1065
|
+
* // Replace the current rows with new data
|
|
1066
|
+
* const newRows = [
|
|
1067
|
+
* { id: 4, name: 'Alice', age: 35 },
|
|
1068
|
+
* { id: 5, name: 'Charlie', age: 45 }
|
|
1069
|
+
* ];
|
|
1070
|
+
* bodyAreaModel.setRows(newRows);
|
|
1071
|
+
*/
|
|
1010
1072
|
setRows(e) {
|
|
1011
1073
|
this.rows = e, this.filteredRows = [...e];
|
|
1012
1074
|
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Filters both the original rows and filtered rows arrays using the provided predicate function.
|
|
1077
|
+
* Unlike `externalFilterChanged`, this method permanently modifies the original rows array.
|
|
1078
|
+
*
|
|
1079
|
+
* @param {(row: T) => boolean} predict - A function that returns true for rows to keep and false for rows to filter out
|
|
1080
|
+
*
|
|
1081
|
+
* @example
|
|
1082
|
+
* // Remove all rows where age is less than 30
|
|
1083
|
+
* bodyAreaModel.filterRowsByPredict(row => row.age >= 30);
|
|
1084
|
+
*/
|
|
1013
1085
|
filterRowsByPredict(e) {
|
|
1014
1086
|
this.rows = this.rows.filter(e), this.filteredRows = this.filteredRows.filter(e);
|
|
1015
1087
|
}
|
|
1016
1088
|
/**
|
|
1017
|
-
*
|
|
1089
|
+
* Returns the number of rows in the filtered rows array.
|
|
1090
|
+
* This is used to determine how many rows should be rendered in the table.
|
|
1091
|
+
*
|
|
1092
|
+
* @returns {number} The number of rows in the filtered rows array
|
|
1093
|
+
*
|
|
1094
|
+
* @example
|
|
1095
|
+
* const rowCount = bodyAreaModel.getRowCount();
|
|
1096
|
+
* console.log(`The table has ${rowCount} rows`);
|
|
1018
1097
|
*/
|
|
1019
1098
|
getRowCount() {
|
|
1020
1099
|
var e;
|
|
1021
1100
|
return ((e = this.filteredRows) == null ? void 0 : e.length) ?? 0;
|
|
1022
1101
|
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Gets the value at the specified row and column indices.
|
|
1104
|
+
* This method handles tree rows and nested properties.
|
|
1105
|
+
*
|
|
1106
|
+
* @param {number} rowIndex - The index of the row
|
|
1107
|
+
* @param {number} columnIndex - The index of the column
|
|
1108
|
+
* @returns {any} The value at the specified cell, or an empty string if not found
|
|
1109
|
+
*
|
|
1110
|
+
* @example
|
|
1111
|
+
* // Get the value in the first row, second column
|
|
1112
|
+
* const value = bodyAreaModel.getValueAt(0, 1);
|
|
1113
|
+
* console.log(`The value is: ${value}`);
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* // Iterate through all cells in a row
|
|
1117
|
+
* const rowIndex = 0;
|
|
1118
|
+
* for (let colIndex = 0; colIndex < columnDefs.length; colIndex++) {
|
|
1119
|
+
* const value = bodyAreaModel.getValueAt(rowIndex, colIndex);
|
|
1120
|
+
* console.log(`Cell (${rowIndex}, ${colIndex}): ${value}`);
|
|
1121
|
+
* }
|
|
1122
|
+
*/
|
|
1023
1123
|
getValueAt(e, t) {
|
|
1024
1124
|
const s = this.properties[t];
|
|
1025
1125
|
let o = this.filteredRows[e];
|
|
@@ -1028,46 +1128,176 @@ class L extends tt {
|
|
|
1028
1128
|
/**
|
|
1029
1129
|
* Retrieves the filtered and sorted rows from the dataset.
|
|
1030
1130
|
* These rows are used for rendering the table.
|
|
1131
|
+
* Unlike `getAllRows()`, this method returns only the rows that match any applied filters.
|
|
1031
1132
|
*
|
|
1032
|
-
* @
|
|
1133
|
+
* @returns {T[]} An array containing the filtered (and sorted) rows
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* // Get all filtered rows
|
|
1137
|
+
* const filteredRows = bodyAreaModel.getFilteredRows();
|
|
1138
|
+
*
|
|
1139
|
+
* // Count rows that match a certain condition
|
|
1140
|
+
* const adultsCount = filteredRows.filter(row => row.age >= 18).length;
|
|
1033
1141
|
*/
|
|
1034
1142
|
getFilteredRows() {
|
|
1035
1143
|
return this.filteredRows;
|
|
1036
1144
|
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Returns the original, unfiltered array of rows.
|
|
1147
|
+
* This can be useful when you need to access all data regardless of any applied filters.
|
|
1148
|
+
*
|
|
1149
|
+
* @returns {T[]} The original array of row objects
|
|
1150
|
+
*
|
|
1151
|
+
* @example
|
|
1152
|
+
* // Get all rows, including those filtered out
|
|
1153
|
+
* const allRows = bodyAreaModel.getAllRows();
|
|
1154
|
+
*
|
|
1155
|
+
* // Calculate average age across all rows
|
|
1156
|
+
* const totalAge = allRows.reduce((sum, row) => sum + row.age, 0);
|
|
1157
|
+
* const averageAge = totalAge / allRows.length;
|
|
1158
|
+
*/
|
|
1037
1159
|
getAllRows() {
|
|
1038
1160
|
return this.rows;
|
|
1039
1161
|
}
|
|
1040
1162
|
/**
|
|
1041
1163
|
* Returns the first row from the filtered rows that matches the given criteria based on the provided predicate function.
|
|
1164
|
+
* This method only searches within the filtered rows, not the original rows array.
|
|
1042
1165
|
*
|
|
1043
1166
|
* @param {Partial<T>} criteria - A partial object containing the search criteria
|
|
1044
1167
|
* @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
|
|
1045
1168
|
* and returns true if the row matches the criteria
|
|
1046
1169
|
* @returns {T | undefined} The first matching row, or undefined if no match is found
|
|
1170
|
+
*
|
|
1171
|
+
* @example
|
|
1172
|
+
* // Find a user by name in the filtered rows
|
|
1173
|
+
* const criteria = { name: 'John' };
|
|
1174
|
+
* const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
|
|
1175
|
+
* criteria,
|
|
1176
|
+
* (criteria, row) => row.name === criteria.name
|
|
1177
|
+
* );
|
|
1178
|
+
*
|
|
1179
|
+
* @example
|
|
1180
|
+
* // Find a user by age range in the filtered rows
|
|
1181
|
+
* const criteria = { minAge: 25, maxAge: 35 };
|
|
1182
|
+
* const user = bodyAreaModel.findRowFromFilteredRowsByAllCriteria(
|
|
1183
|
+
* criteria,
|
|
1184
|
+
* (criteria, row) => row.age >= criteria.minAge && row.age <= criteria.maxAge
|
|
1185
|
+
* );
|
|
1047
1186
|
*/
|
|
1048
1187
|
findRowFromFilteredRowsByAllCriteria(e, t) {
|
|
1049
1188
|
return this.getFilteredRows().find((s) => t(e, s));
|
|
1050
1189
|
}
|
|
1051
1190
|
/**
|
|
1052
1191
|
* Searches through all rows to find a row that matches the given criteria based on the predicate function.
|
|
1192
|
+
* This method searches within the original rows array, including rows that may have been filtered out.
|
|
1053
1193
|
*
|
|
1054
1194
|
* @param {Partial<T>} criteria - A partial object containing the search criteria
|
|
1055
1195
|
* @param {(criteria: Partial<T>, row: T) => boolean} predicate - A function that takes the search criteria and a row,
|
|
1056
1196
|
* and returns true if the row matches the criteria
|
|
1057
1197
|
* @returns {T | undefined} The first matching row from all rows, or undefined if no match is found
|
|
1198
|
+
*
|
|
1199
|
+
* @example
|
|
1200
|
+
* // Find a user by ID in all rows
|
|
1201
|
+
* const criteria = { id: 42 };
|
|
1202
|
+
* const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
|
|
1203
|
+
* criteria,
|
|
1204
|
+
* (criteria, row) => row.id === criteria.id
|
|
1205
|
+
* );
|
|
1206
|
+
*
|
|
1207
|
+
* @example
|
|
1208
|
+
* // Find a user with a specific property value in all rows
|
|
1209
|
+
* const criteria = { department: 'Engineering', role: 'Manager' };
|
|
1210
|
+
* const user = bodyAreaModel.findRowFromAllRowsByAllCriteria(
|
|
1211
|
+
* criteria,
|
|
1212
|
+
* (criteria, row) => row.department === criteria.department && row.role === criteria.role
|
|
1213
|
+
* );
|
|
1058
1214
|
*/
|
|
1059
1215
|
findRowFromAllRowsByAllCriteria(e, t) {
|
|
1060
1216
|
return this.getAllRows().find((s) => t(e, s));
|
|
1061
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Returns the height of the row at the specified index.
|
|
1220
|
+
* This implementation always returns the default row height.
|
|
1221
|
+
* Override this method in subclasses to support variable row heights.
|
|
1222
|
+
*
|
|
1223
|
+
* @param {number} _rowIndex - The index of the row (unused in this implementation)
|
|
1224
|
+
* @returns {number} The height of the row in pixels
|
|
1225
|
+
*
|
|
1226
|
+
* @example
|
|
1227
|
+
* const rowHeight = bodyAreaModel.getRowHeight(0);
|
|
1228
|
+
* console.log(`The first row has a height of ${rowHeight}px`);
|
|
1229
|
+
*/
|
|
1062
1230
|
getRowHeight(e) {
|
|
1063
1231
|
return this.defaultRowHeight;
|
|
1064
1232
|
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Returns the row object at the specified index from the filtered rows array.
|
|
1235
|
+
* This method overrides the parent class implementation.
|
|
1236
|
+
*
|
|
1237
|
+
* @param {number} rowIndex - The index of the row to retrieve
|
|
1238
|
+
* @returns {any} The row object at the specified index, or undefined if the index is out of bounds
|
|
1239
|
+
*
|
|
1240
|
+
* @example
|
|
1241
|
+
* // Get the first row object
|
|
1242
|
+
* const row = bodyAreaModel.getRowByIndex(0);
|
|
1243
|
+
* console.log('First row:', row);
|
|
1244
|
+
*
|
|
1245
|
+
* @example
|
|
1246
|
+
* // Iterate through all rows
|
|
1247
|
+
* for (let i = 0; i < bodyAreaModel.getRowCount(); i++) {
|
|
1248
|
+
* const row = bodyAreaModel.getRowByIndex(i);
|
|
1249
|
+
* console.log(`Row ${i}:`, row);
|
|
1250
|
+
* }
|
|
1251
|
+
*/
|
|
1065
1252
|
getRowByIndex(e) {
|
|
1066
1253
|
return this.filteredRows[e];
|
|
1067
1254
|
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Applies an external filter function to the rows array.
|
|
1257
|
+
* This method updates the filtered rows array without modifying the original rows array.
|
|
1258
|
+
*
|
|
1259
|
+
* @param {FilterFunction<any>} predictFn - A function that returns true for rows to keep and false for rows to filter out
|
|
1260
|
+
*
|
|
1261
|
+
* @example
|
|
1262
|
+
* // Filter rows where age is greater than 30
|
|
1263
|
+
* bodyAreaModel.externalFilterChanged(row => row.age > 30);
|
|
1264
|
+
*
|
|
1265
|
+
* @example
|
|
1266
|
+
* // Filter rows based on a search term
|
|
1267
|
+
* const searchTerm = 'john';
|
|
1268
|
+
* bodyAreaModel.externalFilterChanged(row =>
|
|
1269
|
+
* row.name.toLowerCase().includes(searchTerm.toLowerCase())
|
|
1270
|
+
* );
|
|
1271
|
+
*
|
|
1272
|
+
* @example
|
|
1273
|
+
* // Clear all filters
|
|
1274
|
+
* bodyAreaModel.externalFilterChanged(() => true);
|
|
1275
|
+
*/
|
|
1068
1276
|
externalFilterChanged(e) {
|
|
1069
1277
|
this.filteredRows = this.rows ? this.rows.filter(e) : [];
|
|
1070
1278
|
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Sorts the filtered rows based on the provided sort items.
|
|
1281
|
+
* This method supports sorting by multiple columns with different sort directions.
|
|
1282
|
+
*
|
|
1283
|
+
* @param {SortItem[]} sortItems - An array of sort items, each containing a column index and sort state
|
|
1284
|
+
* @returns {boolean} Always returns true to indicate sorting was performed
|
|
1285
|
+
*
|
|
1286
|
+
* @example
|
|
1287
|
+
* // Sort by age in ascending order
|
|
1288
|
+
* bodyAreaModel.doSort([{ columnIndex: 2, sortState: 'asc' }]);
|
|
1289
|
+
*
|
|
1290
|
+
* @example
|
|
1291
|
+
* // Sort by name in descending order, then by age in ascending order
|
|
1292
|
+
* bodyAreaModel.doSort([
|
|
1293
|
+
* { columnIndex: 1, sortState: 'desc' },
|
|
1294
|
+
* { columnIndex: 2, sortState: 'asc' }
|
|
1295
|
+
* ]);
|
|
1296
|
+
*
|
|
1297
|
+
* @example
|
|
1298
|
+
* // Clear sorting
|
|
1299
|
+
* bodyAreaModel.doSort([{ columnIndex: 0, sortState: 'none' }]);
|
|
1300
|
+
*/
|
|
1071
1301
|
doSort(e) {
|
|
1072
1302
|
for (const t of e) {
|
|
1073
1303
|
const { columnIndex: s, sortState: o } = t, i = o === "asc" ? 1 : o === "desc" ? -1 : 0, r = this.properties[s];
|
|
@@ -1075,20 +1305,110 @@ class L extends tt {
|
|
|
1075
1305
|
}
|
|
1076
1306
|
return !0;
|
|
1077
1307
|
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Sorts the filtered rows using a custom comparator function.
|
|
1310
|
+
* This method provides more flexibility than `doSort()` for complex sorting logic.
|
|
1311
|
+
*
|
|
1312
|
+
* @param {(a: T, b: T) => number} compareFn - A function that compares two rows and returns a number:
|
|
1313
|
+
* - Negative if a should come before b
|
|
1314
|
+
* - Positive if a should come after b
|
|
1315
|
+
* - Zero if they are equivalent for sorting purposes
|
|
1316
|
+
*
|
|
1317
|
+
* @example
|
|
1318
|
+
* // Sort by name length
|
|
1319
|
+
* bodyAreaModel.sort((a, b) => a.name.length - b.name.length);
|
|
1320
|
+
*
|
|
1321
|
+
* @example
|
|
1322
|
+
* // Sort by a computed value
|
|
1323
|
+
* bodyAreaModel.sort((a, b) => {
|
|
1324
|
+
* const scoreA = a.wins * 3 + a.draws;
|
|
1325
|
+
* const scoreB = b.wins * 3 + b.draws;
|
|
1326
|
+
* return scoreB - scoreA; // Descending order
|
|
1327
|
+
* });
|
|
1328
|
+
*/
|
|
1078
1329
|
sort(e) {
|
|
1079
1330
|
this.filteredRows = this.filteredRows.sort(e);
|
|
1080
1331
|
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Gets a value from an object using a property path.
|
|
1334
|
+
* This method supports accessing nested properties using dot notation (e.g., 'person.name').
|
|
1335
|
+
*
|
|
1336
|
+
* @param {T} t - The object to get the value from
|
|
1337
|
+
* @param {string} property - The property path to access (e.g., 'name' or 'person.contact.email')
|
|
1338
|
+
* @returns {any} The value at the specified property path, or undefined if not found
|
|
1339
|
+
*
|
|
1340
|
+
* @example
|
|
1341
|
+
* const user = { id: 1, name: 'John', contact: { email: 'john@example.com' } };
|
|
1342
|
+
*
|
|
1343
|
+
* // Access simple property
|
|
1344
|
+
* const name = bodyAreaModel.getValueByT(user, 'name');
|
|
1345
|
+
* console.log(name); // 'John'
|
|
1346
|
+
*
|
|
1347
|
+
* // Access nested property
|
|
1348
|
+
* const email = bodyAreaModel.getValueByT(user, 'contact.email');
|
|
1349
|
+
* console.log(email); // 'john@example.com'
|
|
1350
|
+
*/
|
|
1081
1351
|
getValueByT(e, t) {
|
|
1082
1352
|
if (e && t)
|
|
1083
1353
|
return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
|
|
1084
1354
|
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Changes the order of columns by moving a column from one position to another.
|
|
1357
|
+
* This method updates both the properties array and calls the parent class implementation.
|
|
1358
|
+
*
|
|
1359
|
+
* @param {number} sourceColumnIndex - The index of the column to move
|
|
1360
|
+
* @param {number} targetColumnIndex - The index where the column should be moved to
|
|
1361
|
+
*
|
|
1362
|
+
* @example
|
|
1363
|
+
* // Move the second column (index 1) to the fourth position (index 3)
|
|
1364
|
+
* bodyAreaModel.changeColumnOrder(1, 3);
|
|
1365
|
+
*
|
|
1366
|
+
* @example
|
|
1367
|
+
* // Move the last column to the first position
|
|
1368
|
+
* const lastIndex = bodyAreaModel.columnDefs.length - 1;
|
|
1369
|
+
* bodyAreaModel.changeColumnOrder(lastIndex, 0);
|
|
1370
|
+
*/
|
|
1085
1371
|
changeColumnOrder(e, t) {
|
|
1086
1372
|
this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
|
|
1087
1373
|
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Gets the custom CSS classes that should be applied to a cell.
|
|
1376
|
+
* This method extends the parent class implementation to add selection and focus classes.
|
|
1377
|
+
*
|
|
1378
|
+
* @param {number} rowIndex - The index of the row
|
|
1379
|
+
* @param {number} _columnIndex - The index of the column (unused in this implementation)
|
|
1380
|
+
* @returns {string[]} An array of CSS class names to apply to the cell
|
|
1381
|
+
*
|
|
1382
|
+
* @example
|
|
1383
|
+
* // Get the CSS classes for a cell
|
|
1384
|
+
* const classes = bodyAreaModel.getCustomClassesAt(1, 2);
|
|
1385
|
+
* console.log('CSS classes:', classes);
|
|
1386
|
+
*
|
|
1387
|
+
* @example
|
|
1388
|
+
* // Apply the classes to a cell element
|
|
1389
|
+
* const cellElement = document.createElement('div');
|
|
1390
|
+
* const classes = bodyAreaModel.getCustomClassesAt(rowIndex, columnIndex);
|
|
1391
|
+
* cellElement.classList.add(...classes);
|
|
1392
|
+
*/
|
|
1088
1393
|
getCustomClassesAt(e, t) {
|
|
1089
1394
|
const s = super.getCustomClassesAt(e, t);
|
|
1090
1395
|
return this.getRowByIndex(e).selected && s.push(this.selectedRowClass), this._focusedRowIndex === e && s.push(this.focusedRowClass), s;
|
|
1091
1396
|
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Creates a comparator function for sorting rows based on a property and sort direction.
|
|
1399
|
+
* This method supports custom sort comparators defined in column definitions.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {string} property - The property to sort by
|
|
1402
|
+
* @param {number} f - The sort direction factor: 1 for ascending, -1 for descending, 0 for no sorting
|
|
1403
|
+
* @returns {(a: T, b: T) => number} A comparator function that compares two rows
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* // Create a comparator for sorting by name in ascending order
|
|
1407
|
+
* const comparator = bodyAreaModel.genericFlatTableSortComparator('name', 1);
|
|
1408
|
+
*
|
|
1409
|
+
* // Sort the rows using the comparator
|
|
1410
|
+
* const sortedRows = [...bodyAreaModel.getFilteredRows()].sort(comparator);
|
|
1411
|
+
*/
|
|
1092
1412
|
genericFlatTableSortComparator(e, t) {
|
|
1093
1413
|
const s = this.columnDefs.find((o) => o.property === e);
|
|
1094
1414
|
return (o, i) => {
|
|
@@ -1096,6 +1416,16 @@ class L extends tt {
|
|
|
1096
1416
|
return s != null && s.sortComparator ? t * s.sortComparator(r, a, o, i, t) : this.sorterService.genericSortComparator(r, a, t);
|
|
1097
1417
|
};
|
|
1098
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Recursively gets a value from an object using an array of property names.
|
|
1421
|
+
* This is a helper method used by `getValueByT` to access nested properties.
|
|
1422
|
+
*
|
|
1423
|
+
* @param {any} o - The object to get the value from
|
|
1424
|
+
* @param {string[]} props - An array of property names representing the path to the value
|
|
1425
|
+
* @returns {any} The value at the specified property path, or undefined if not found
|
|
1426
|
+
*
|
|
1427
|
+
* @private
|
|
1428
|
+
*/
|
|
1099
1429
|
getPropertyValue(e, t) {
|
|
1100
1430
|
const s = t.shift(), o = e[s];
|
|
1101
1431
|
return o && t.length ? this.getPropertyValue(o, t) : o;
|
|
@@ -1106,41 +1436,302 @@ class ot {
|
|
|
1106
1436
|
this.tableScope = e;
|
|
1107
1437
|
}
|
|
1108
1438
|
/**
|
|
1109
|
-
* Updates the cells in the table
|
|
1439
|
+
* Updates the cells in the table with the provided cell update events.
|
|
1110
1440
|
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1441
|
+
* This method allows you to update specific cells in the table without requiring a full table repaint,
|
|
1442
|
+
* which can significantly improve performance when updating large tables frequently.
|
|
1113
1443
|
*
|
|
1114
|
-
* @
|
|
1444
|
+
* @param {TableCellUpdateEventIf[]} events - An array of cell update events, each defining a single cell update operation.
|
|
1445
|
+
* Each event must specify:
|
|
1446
|
+
* - area: The table area to update ('header', 'body', or 'footer')
|
|
1447
|
+
* - rowIndex: The row index of the cell to update
|
|
1448
|
+
* - columnIndex: The column index of the cell to update
|
|
1449
|
+
* - value: The new value to set for the cell
|
|
1450
|
+
* - cssClasses: Optional object mapping CSS class names to boolean values
|
|
1451
|
+
* (true to add the class, false to remove it)
|
|
1452
|
+
*
|
|
1453
|
+
* @param {boolean} [repaintAll=false] - Whether to repaint the entire table after updating cells.
|
|
1454
|
+
* - If true: All cells will be repainted after updating (slower but ensures visual consistency)
|
|
1455
|
+
* - If false: Only the modified cells will be repainted (faster, recommended for frequent updates)
|
|
1456
|
+
*
|
|
1457
|
+
* @returns {void}
|
|
1458
|
+
*
|
|
1459
|
+
* @example
|
|
1460
|
+
* // Update a single cell with a new value and CSS classes
|
|
1461
|
+
* tableApi.updateCells([{
|
|
1462
|
+
* area: 'body',
|
|
1463
|
+
* rowIndex: 3,
|
|
1464
|
+
* columnIndex: 2,
|
|
1465
|
+
* value: 42,
|
|
1466
|
+
* cssClasses: {
|
|
1467
|
+
* 'highlight': true, // Add 'highlight' class
|
|
1468
|
+
* 'error': false // Remove 'error' class if present
|
|
1469
|
+
* }
|
|
1470
|
+
* }]);
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* // Update multiple cells at once
|
|
1474
|
+
* tableApi.updateCells([
|
|
1475
|
+
* {
|
|
1476
|
+
* area: 'body',
|
|
1477
|
+
* rowIndex: 1,
|
|
1478
|
+
* columnIndex: 1,
|
|
1479
|
+
* value: 'New Value 1',
|
|
1480
|
+
* cssClasses: { 'updated': true }
|
|
1481
|
+
* },
|
|
1482
|
+
* {
|
|
1483
|
+
* area: 'body',
|
|
1484
|
+
* rowIndex: 2,
|
|
1485
|
+
* columnIndex: 3,
|
|
1486
|
+
* value: 'New Value 2',
|
|
1487
|
+
* cssClasses: { 'updated': true }
|
|
1488
|
+
* }
|
|
1489
|
+
* ]);
|
|
1490
|
+
*
|
|
1491
|
+
* @example
|
|
1492
|
+
* // Update cells and repaint the entire table
|
|
1493
|
+
* tableApi.updateCells([
|
|
1494
|
+
* { area: 'body', rowIndex: 0, columnIndex: 0, value: 'Hello', cssClasses: { 'bg-green-0': true } },
|
|
1495
|
+
* { area: 'body', rowIndex: 1, columnIndex: 1, value: 'World', cssClasses: { 'bg-red-0': true } }
|
|
1496
|
+
* ], true);
|
|
1497
|
+
*
|
|
1498
|
+
* @example
|
|
1499
|
+
* // High-performance animation example (update without full repaint)
|
|
1500
|
+
* function animateCell() {
|
|
1501
|
+
* const value = Math.sin(Date.now() / 1000) * 50;
|
|
1502
|
+
* const cssClasses = {
|
|
1503
|
+
* 'positive': value > 0,
|
|
1504
|
+
* 'negative': value < 0
|
|
1505
|
+
* };
|
|
1506
|
+
*
|
|
1507
|
+
* tableApi.updateCells([{
|
|
1508
|
+
* area: 'body',
|
|
1509
|
+
* rowIndex: 0,
|
|
1510
|
+
* columnIndex: 0,
|
|
1511
|
+
* value: Math.round(value),
|
|
1512
|
+
* cssClasses
|
|
1513
|
+
* }]);
|
|
1514
|
+
*
|
|
1515
|
+
* requestAnimationFrame(animateCell);
|
|
1516
|
+
* }
|
|
1517
|
+
* animateCell();
|
|
1115
1518
|
*/
|
|
1116
1519
|
updateCells(e, t = !1) {
|
|
1117
1520
|
this.tableScope.updateCells(e, t);
|
|
1118
1521
|
}
|
|
1119
1522
|
/**
|
|
1120
|
-
* Notifies that
|
|
1523
|
+
* Notifies the table that an external filter has been changed and needs to be applied.
|
|
1121
1524
|
*
|
|
1122
|
-
*
|
|
1525
|
+
* This method is used when an external filter condition (defined by `tableOptions.externalFilterFunction`)
|
|
1526
|
+
* has changed and the table needs to refresh its display to reflect the new filtering criteria.
|
|
1527
|
+
*
|
|
1528
|
+
* When called, this method:
|
|
1529
|
+
* 1. Applies the external filter function to all rows
|
|
1530
|
+
* 2. Clears the current selection (by default)
|
|
1531
|
+
* 3. Scrolls to the top of the table
|
|
1532
|
+
* 4. Recalculates table dimensions
|
|
1533
|
+
* 5. Repaints the table to display only the filtered rows
|
|
1534
|
+
*
|
|
1535
|
+
* @example
|
|
1536
|
+
* ```typescript
|
|
1537
|
+
* // Define an external filter function in your table options
|
|
1538
|
+
* const tableOptions = {
|
|
1539
|
+
* externalFilterFunction: (row: MyRowType) => {
|
|
1540
|
+
* // Return true to include the row, false to filter it out
|
|
1541
|
+
* return row.status === 'active';
|
|
1542
|
+
* }
|
|
1543
|
+
* };
|
|
1544
|
+
*
|
|
1545
|
+
* // Initialize your table with these options
|
|
1546
|
+
* const tableApi = new TableApi(tableScope);
|
|
1547
|
+
*
|
|
1548
|
+
* // Later, when filter criteria change (e.g., in a search input handler)
|
|
1549
|
+
* function onFilterTextChanged() {
|
|
1550
|
+
* // Update the filter function if needed
|
|
1551
|
+
* tableOptions.externalFilterFunction = (row: MyRowType) => {
|
|
1552
|
+
* return row.name.includes(searchText);
|
|
1553
|
+
* };
|
|
1554
|
+
*
|
|
1555
|
+
* // Apply the updated filter
|
|
1556
|
+
* tableApi.externalFilterChanged();
|
|
1557
|
+
* }
|
|
1558
|
+
* ```
|
|
1559
|
+
*
|
|
1560
|
+
* @returns {void}
|
|
1561
|
+
* @see TableScope.externalFilterChanged
|
|
1123
1562
|
*/
|
|
1124
1563
|
externalFilterChanged() {
|
|
1125
1564
|
this.tableScope.externalFilterChanged();
|
|
1126
1565
|
}
|
|
1127
1566
|
/**
|
|
1128
|
-
* Scrolls the table
|
|
1567
|
+
* Scrolls the table content to the specified pixel coordinates.
|
|
1129
1568
|
*
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1569
|
+
* This method allows programmatic scrolling of the table viewport to exact pixel positions.
|
|
1570
|
+
* It delegates the scrolling operation to the underlying TableScope instance.
|
|
1571
|
+
*
|
|
1572
|
+
* @param {number} px - The horizontal pixel coordinate to scroll to. Defaults to 0 (leftmost position).
|
|
1573
|
+
* @param {number} py - The vertical pixel coordinate to scroll to. Defaults to 0 (topmost position).
|
|
1574
|
+
* @returns {void}
|
|
1575
|
+
*
|
|
1576
|
+
* @example
|
|
1577
|
+
* // Scroll to the top-left corner of the table
|
|
1578
|
+
* tableApi.scrollToPixel(0, 0);
|
|
1579
|
+
*
|
|
1580
|
+
* @example
|
|
1581
|
+
* // Scroll 200 pixels horizontally and 150 pixels vertically
|
|
1582
|
+
* tableApi.scrollToPixel(200, 150);
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* // Scroll only vertically, keeping the current horizontal position
|
|
1586
|
+
* tableApi.scrollToPixel(undefined, 300);
|
|
1587
|
+
*
|
|
1588
|
+
* @example
|
|
1589
|
+
* // Example in a component that needs precise scrolling control
|
|
1590
|
+
* class TableScroller {
|
|
1591
|
+
* private tableApi: TableApi;
|
|
1592
|
+
*
|
|
1593
|
+
* constructor(tableApi: TableApi) {
|
|
1594
|
+
* this.tableApi = tableApi;
|
|
1595
|
+
* }
|
|
1596
|
+
*
|
|
1597
|
+
* scrollToPosition(x: number, y: number) {
|
|
1598
|
+
* // Scroll to exact pixel coordinates
|
|
1599
|
+
* this.tableApi.scrollToPixel(x, y);
|
|
1600
|
+
* }
|
|
1601
|
+
*
|
|
1602
|
+
* scrollHalfway() {
|
|
1603
|
+
* const tableModel = this.tableApi.getTableModel();
|
|
1604
|
+
* const totalWidth = tableModel.getContentWidthInPixel();
|
|
1605
|
+
* const totalHeight = tableModel.getContentHeightInPixel();
|
|
1606
|
+
*
|
|
1607
|
+
* // Scroll to the middle of the table content
|
|
1608
|
+
* this.tableApi.scrollToPixel(totalWidth / 2, totalHeight / 2);
|
|
1609
|
+
* }
|
|
1610
|
+
* }
|
|
1611
|
+
*
|
|
1612
|
+
* @example
|
|
1613
|
+
* // Advanced usage with animated scrolling
|
|
1614
|
+
* class SmoothScroller {
|
|
1615
|
+
* private tableApi: TableApi;
|
|
1616
|
+
* private animationFrameId: number | null = null;
|
|
1617
|
+
*
|
|
1618
|
+
* constructor(tableApi: TableApi) {
|
|
1619
|
+
* this.tableApi = tableApi;
|
|
1620
|
+
* }
|
|
1621
|
+
*
|
|
1622
|
+
* smoothScrollTo(targetX: number, targetY: number, duration: number = 500) {
|
|
1623
|
+
* // Cancel any ongoing animation
|
|
1624
|
+
* if (this.animationFrameId !== null) {
|
|
1625
|
+
* cancelAnimationFrame(this.animationFrameId);
|
|
1626
|
+
* }
|
|
1627
|
+
*
|
|
1628
|
+
* const startTime = performance.now();
|
|
1629
|
+
* const startX = this.tableApi.getTableScope().getScrollLeft();
|
|
1630
|
+
* const startY = this.tableApi.getTableScope().getScrollTop();
|
|
1631
|
+
* const distanceX = targetX - startX;
|
|
1632
|
+
* const distanceY = targetY - startY;
|
|
1633
|
+
*
|
|
1634
|
+
* const step = (currentTime: number) => {
|
|
1635
|
+
* const elapsed = currentTime - startTime;
|
|
1636
|
+
* const progress = Math.min(elapsed / duration, 1);
|
|
1637
|
+
*
|
|
1638
|
+
* // Use easing function for smooth animation
|
|
1639
|
+
* const easeProgress = 1 - Math.pow(1 - progress, 3); // Cubic ease-out
|
|
1640
|
+
*
|
|
1641
|
+
* const currentX = startX + distanceX * easeProgress;
|
|
1642
|
+
* const currentY = startY + distanceY * easeProgress;
|
|
1643
|
+
*
|
|
1644
|
+
* this.tableApi.scrollToPixel(currentX, currentY);
|
|
1645
|
+
*
|
|
1646
|
+
* if (progress < 1) {
|
|
1647
|
+
* this.animationFrameId = requestAnimationFrame(step);
|
|
1648
|
+
* } else {
|
|
1649
|
+
* this.animationFrameId = null;
|
|
1650
|
+
* }
|
|
1651
|
+
* };
|
|
1652
|
+
*
|
|
1653
|
+
* this.animationFrameId = requestAnimationFrame(step);
|
|
1654
|
+
* }
|
|
1655
|
+
*
|
|
1656
|
+
* cancelAnimation() {
|
|
1657
|
+
* if (this.animationFrameId !== null) {
|
|
1658
|
+
* cancelAnimationFrame(this.animationFrameId);
|
|
1659
|
+
* this.animationFrameId = null;
|
|
1660
|
+
* }
|
|
1661
|
+
* }
|
|
1662
|
+
* }
|
|
1663
|
+
*
|
|
1664
|
+
* @see {@link scrollToIndex} - For scrolling based on row and column indices
|
|
1665
|
+
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
1133
1666
|
*/
|
|
1134
1667
|
scrollToPixel(e = 0, t = 0) {
|
|
1135
1668
|
this.tableScope.scrollToPixel(e, t);
|
|
1136
1669
|
}
|
|
1137
1670
|
/**
|
|
1138
|
-
* Scrolls to the specified
|
|
1671
|
+
* Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
|
|
1139
1672
|
*
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1673
|
+
* This method allows programmatic scrolling to a specific position in the table grid based on row and column indices.
|
|
1674
|
+
* It uses the underlying TableScope's scrolling mechanism to navigate to the target location.
|
|
1142
1675
|
*
|
|
1143
|
-
* @
|
|
1676
|
+
* @param {number} indexX - The horizontal index (column) to scroll to. Defaults to 0 (leftmost column).
|
|
1677
|
+
* @param {number} indexY - The vertical index (row) to scroll to. Defaults to 0 (topmost row).
|
|
1678
|
+
* @returns {void}
|
|
1679
|
+
*
|
|
1680
|
+
* @example
|
|
1681
|
+
* // Scroll to the 5th row, keeping the current horizontal scroll position
|
|
1682
|
+
* tableApi.scrollToIndex(0, 5);
|
|
1683
|
+
*
|
|
1684
|
+
* @example
|
|
1685
|
+
* // Scroll to column 3, row 10
|
|
1686
|
+
* tableApi.scrollToIndex(3, 10);
|
|
1687
|
+
*
|
|
1688
|
+
* @example
|
|
1689
|
+
* // Example in a component that needs to navigate to specific content
|
|
1690
|
+
* class TableNavigator {
|
|
1691
|
+
* private tableApi: TableApi;
|
|
1692
|
+
*
|
|
1693
|
+
* constructor(tableApi: TableApi) {
|
|
1694
|
+
* this.tableApi = tableApi;
|
|
1695
|
+
* }
|
|
1696
|
+
*
|
|
1697
|
+
* goToCell(columnIndex: number, rowIndex: number) {
|
|
1698
|
+
* // Navigate directly to the specified cell position
|
|
1699
|
+
* this.tableApi.scrollToIndex(columnIndex, rowIndex);
|
|
1700
|
+
*
|
|
1701
|
+
* // Optional: Select the cell after navigating to it
|
|
1702
|
+
* const selectionModel = this.tableApi.getSelectionModel();
|
|
1703
|
+
* if (selectionModel) {
|
|
1704
|
+
* selectionModel.selectCell(rowIndex, columnIndex);
|
|
1705
|
+
* }
|
|
1706
|
+
* }
|
|
1707
|
+
* }
|
|
1708
|
+
*
|
|
1709
|
+
* @example
|
|
1710
|
+
* // Advanced usage with search functionality
|
|
1711
|
+
* class TableSearcher {
|
|
1712
|
+
* findAndScrollToMatch(searchTerm: string) {
|
|
1713
|
+
* const tableModel = this.tableApi.getTableModel();
|
|
1714
|
+
* const bodyModel = tableModel.getAreaModel('body');
|
|
1715
|
+
*
|
|
1716
|
+
* // Search for the term in the table data
|
|
1717
|
+
* for (let row = 0; row < bodyModel.getRowCount(); row++) {
|
|
1718
|
+
* for (let col = 0; col < tableModel.getColumnCount(); col++) {
|
|
1719
|
+
* const cellContent = bodyModel.getValueAt(row, col)?.toString() || '';
|
|
1720
|
+
*
|
|
1721
|
+
* if (cellContent.includes(searchTerm)) {
|
|
1722
|
+
* // Found a match, scroll to it
|
|
1723
|
+
* this.tableApi.scrollToIndex(col, row);
|
|
1724
|
+
* return true;
|
|
1725
|
+
* }
|
|
1726
|
+
* }
|
|
1727
|
+
* }
|
|
1728
|
+
*
|
|
1729
|
+
* return false; // No match found
|
|
1730
|
+
* }
|
|
1731
|
+
* }
|
|
1732
|
+
*
|
|
1733
|
+
* @see {@link scrollToPixel} - For scrolling to specific pixel coordinates
|
|
1734
|
+
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
1144
1735
|
*/
|
|
1145
1736
|
scrollToIndex(e = 0, t = 0) {
|
|
1146
1737
|
this.tableScope.scrollToIndex(e, t);
|
|
@@ -1201,19 +1792,71 @@ class ot {
|
|
|
1201
1792
|
/**
|
|
1202
1793
|
* Repaints the table.
|
|
1203
1794
|
*
|
|
1204
|
-
* This method
|
|
1205
|
-
*
|
|
1795
|
+
* This method refreshes the visual representation of the table by delegating to the
|
|
1796
|
+
* tableScope's repaint functionality. Use this method whenever the table's visual state
|
|
1797
|
+
* needs to be updated after data changes, selection changes, or any modifications that
|
|
1798
|
+
* affect the rendered output.
|
|
1799
|
+
*
|
|
1800
|
+
* Repainting the table ensures that all visible cells, rows, and styling reflect the
|
|
1801
|
+
* current state of the underlying data model and configuration settings.
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* // Update data and repaint the table
|
|
1805
|
+
* const tableApi = new TableApi(tableScope);
|
|
1806
|
+
* tableApi.setRows(newData);
|
|
1807
|
+
* tableApi.repaint();
|
|
1808
|
+
*
|
|
1809
|
+
* @example
|
|
1810
|
+
* // Update selection and repaint to show the visual change
|
|
1811
|
+
* tableApi.getSelectionModel().selectCell(2, 3);
|
|
1812
|
+
* tableApi.repaint();
|
|
1813
|
+
*
|
|
1814
|
+
* @example
|
|
1815
|
+
* // After changing column visibility, repaint to reflect changes
|
|
1816
|
+
* tableApi.setColumnVisible(0, false);
|
|
1817
|
+
* tableApi.repaint();
|
|
1818
|
+
*
|
|
1819
|
+
* @returns {void}
|
|
1206
1820
|
*/
|
|
1207
1821
|
repaint() {
|
|
1208
1822
|
this.tableScope.repaint();
|
|
1209
1823
|
}
|
|
1210
1824
|
/**
|
|
1211
|
-
*
|
|
1212
|
-
* Repaints the UI by resetting the size of the wrapper div,
|
|
1213
|
-
* adjusting the containers and rows, and performing additional adjustments
|
|
1214
|
-
* after scrolling.
|
|
1825
|
+
* Performs a complete repaint of the table by triggering a hard repaint on the underlying table scope.
|
|
1215
1826
|
*
|
|
1216
|
-
*
|
|
1827
|
+
* A hard repaint is more thorough than a regular repaint and performs the following operations:
|
|
1828
|
+
* - Recalculates the height and padding of the table model
|
|
1829
|
+
* - Resets the size of the wrapper div elements
|
|
1830
|
+
* - Adjusts containers and rows positioning
|
|
1831
|
+
* - Makes additional adjustments after scrolling
|
|
1832
|
+
*
|
|
1833
|
+
* Use this method when regular repaint isn't sufficient, such as when:
|
|
1834
|
+
* - Table dimensions have significantly changed
|
|
1835
|
+
* - The structure of data has been modified (rows/columns added or removed)
|
|
1836
|
+
* - The table layout needs complete recalculation
|
|
1837
|
+
* - After major DOM changes affecting the table's container
|
|
1838
|
+
*
|
|
1839
|
+
* @example
|
|
1840
|
+
* // Example 1: Basic usage
|
|
1841
|
+
* tableApi.repaintHard();
|
|
1842
|
+
*
|
|
1843
|
+
* @example
|
|
1844
|
+
* // Example 2: Using after major data changes
|
|
1845
|
+
* tableApi.setRows(newDataSet);
|
|
1846
|
+
* tableApi.repaintHard();
|
|
1847
|
+
*
|
|
1848
|
+
* @example
|
|
1849
|
+
* // Example 3: Using after resizing a container
|
|
1850
|
+
* window.addEventListener('resize', () => {
|
|
1851
|
+
* tableApi.repaintHard();
|
|
1852
|
+
* });
|
|
1853
|
+
*
|
|
1854
|
+
* @example
|
|
1855
|
+
* // Example 4: Using after changing column visibility
|
|
1856
|
+
* tableApi.setColumnVisible(2, false);
|
|
1857
|
+
* tableApi.repaintHard();
|
|
1858
|
+
*
|
|
1859
|
+
* @returns {void} This method doesn't return a value
|
|
1217
1860
|
*/
|
|
1218
1861
|
repaintHard() {
|
|
1219
1862
|
this.tableScope.repaintHard();
|
|
@@ -1229,8 +1872,30 @@ class ot {
|
|
|
1229
1872
|
this.tableScope.recalcColumnWidths(e);
|
|
1230
1873
|
}
|
|
1231
1874
|
/**
|
|
1232
|
-
* Clears the current selection
|
|
1233
|
-
*
|
|
1875
|
+
* Clears the current selection in the table.
|
|
1876
|
+
*
|
|
1877
|
+
* This method removes any selected cells, rows, or columns in the table.
|
|
1878
|
+
* It provides a convenient way to programmatically clear all selections in the table
|
|
1879
|
+
* without having to access the underlying selection model directly.
|
|
1880
|
+
*
|
|
1881
|
+
* When called, this method delegates to the table scope's clearSelection method with
|
|
1882
|
+
* a parameter value of true, which ensures the table is automatically repainted after
|
|
1883
|
+
* the selection is cleared.
|
|
1884
|
+
*
|
|
1885
|
+
* @example
|
|
1886
|
+
* // Clear all selections in the table
|
|
1887
|
+
* tableApi.clearSelection();
|
|
1888
|
+
*
|
|
1889
|
+
* // Example usage in a component
|
|
1890
|
+
* class MyComponent {
|
|
1891
|
+
* @ViewChild('tableComponent') tableComponent: TableComponent;
|
|
1892
|
+
*
|
|
1893
|
+
* resetTableSelection(): void {
|
|
1894
|
+
* if (this.tableComponent?.api) {
|
|
1895
|
+
* this.tableComponent.api.clearSelection();
|
|
1896
|
+
* }
|
|
1897
|
+
* }
|
|
1898
|
+
* }
|
|
1234
1899
|
*
|
|
1235
1900
|
* @returns {void}
|
|
1236
1901
|
*/
|
|
@@ -1238,12 +1903,31 @@ class ot {
|
|
|
1238
1903
|
this.tableScope.clearSelection(!0);
|
|
1239
1904
|
}
|
|
1240
1905
|
/**
|
|
1241
|
-
* Sets the selection model for the table
|
|
1906
|
+
* Sets the selection model for the table.
|
|
1242
1907
|
*
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1908
|
+
* This method allows you to replace the current selection model with a new one,
|
|
1909
|
+
* which controls how cells, rows, or columns can be selected in the table.
|
|
1245
1910
|
*
|
|
1246
|
-
* @
|
|
1911
|
+
* @param {SelectionModel} sm - The new selection model to be set. This model defines
|
|
1912
|
+
* the selection behavior including selection type (none, cell, row, column),
|
|
1913
|
+
* selection mode (single, multi), and manages the selected ranges.
|
|
1914
|
+
* @param {boolean} [repaint=true] - Whether to repaint the table after changing the selection model.
|
|
1915
|
+
* Default is true, which immediately reflects the change visually.
|
|
1916
|
+
* Set to false if you want to avoid immediate repainting.
|
|
1917
|
+
*
|
|
1918
|
+
* @example
|
|
1919
|
+
* // Create a new selection model with row selection and multi-select mode
|
|
1920
|
+
* const selectionModel = new SelectionModel("row", "multi");
|
|
1921
|
+
*
|
|
1922
|
+
* // Set the new selection model and repaint the table
|
|
1923
|
+
* tableApi.setSelectionModel(selectionModel);
|
|
1924
|
+
*
|
|
1925
|
+
* // Set a selection model without repainting (if you plan to make more changes)
|
|
1926
|
+
* tableApi.setSelectionModel(selectionModel, false);
|
|
1927
|
+
* // ... make other changes ...
|
|
1928
|
+
* tableApi.repaint(); // Now repaint once
|
|
1929
|
+
*
|
|
1930
|
+
* @returns {void}
|
|
1247
1931
|
*/
|
|
1248
1932
|
setSelectionModel(e, t = !0) {
|
|
1249
1933
|
this.tableScope.setSelectionModel(e, t);
|
|
@@ -1259,9 +1943,36 @@ class ot {
|
|
|
1259
1943
|
this.tableScope.onActionTriggered(e);
|
|
1260
1944
|
}
|
|
1261
1945
|
/**
|
|
1262
|
-
* Retrieves the
|
|
1946
|
+
* Retrieves the shortcut action mapping from the table's shortcut service.
|
|
1947
|
+
*
|
|
1948
|
+
* This method provides access to the keyboard shortcut configuration that defines
|
|
1949
|
+
* which keys trigger specific actions in the table. The mapping contains key-value
|
|
1950
|
+
* pairs where:
|
|
1951
|
+
* - Keys are string representations of keyboard shortcuts (e.g., "ctrl+c", "shift+arrow_down")
|
|
1952
|
+
* - Values are ActionId values representing the corresponding table actions
|
|
1953
|
+
*
|
|
1954
|
+
* This mapping can be useful for:
|
|
1955
|
+
* - Displaying available shortcuts to users
|
|
1956
|
+
* - Creating custom shortcut documentation
|
|
1957
|
+
* - Dynamically checking which actions are available via keyboard
|
|
1958
|
+
* - Extending or integrating with the table's shortcut system
|
|
1959
|
+
*
|
|
1960
|
+
* @returns {ShortcutActionIdMapping} An object mapping shortcut key combinations to their corresponding action IDs.
|
|
1961
|
+
* For example: { "ctrl+c": "COPY_2_CLIPBOARD", "arrow_down": "NAVIGATE_DOWN" }
|
|
1962
|
+
*
|
|
1963
|
+
* @example
|
|
1964
|
+
* // Get all available shortcuts in the table
|
|
1965
|
+
* const shortcuts = tableApi.getShortcutActionMapping();
|
|
1966
|
+
*
|
|
1967
|
+
* // Check if a specific shortcut exists
|
|
1968
|
+
* if (shortcuts["ctrl+c"]) {
|
|
1969
|
+
* console.log("Copy shortcut is available with action:", shortcuts["ctrl+c"]);
|
|
1970
|
+
* }
|
|
1263
1971
|
*
|
|
1264
|
-
*
|
|
1972
|
+
* // Display available shortcuts in the UI
|
|
1973
|
+
* Object.entries(shortcuts).forEach(([key, actionId]) => {
|
|
1974
|
+
* console.log(`${key}: ${actionId}`);
|
|
1975
|
+
* });
|
|
1265
1976
|
*/
|
|
1266
1977
|
getShortcutActionMapping() {
|
|
1267
1978
|
return this.tableScope.shortcutService.getShortcutActionMapping();
|
|
@@ -1269,7 +1980,35 @@ class ot {
|
|
|
1269
1980
|
/**
|
|
1270
1981
|
* Copies the selected data from the table to the clipboard.
|
|
1271
1982
|
*
|
|
1272
|
-
*
|
|
1983
|
+
* This method leverages the copyService to extract and copy the currently selected data
|
|
1984
|
+
* from the table. It works with the current selection state and focus position to determine
|
|
1985
|
+
* what content should be copied.
|
|
1986
|
+
*
|
|
1987
|
+
* The copied data is formatted as tab-separated text that can be pasted into spreadsheet
|
|
1988
|
+
* applications like Excel or text editors while maintaining the tabular structure.
|
|
1989
|
+
*
|
|
1990
|
+
* @example
|
|
1991
|
+
* // Copy the currently selected data to clipboard
|
|
1992
|
+
* tableApi.copyToClipboard().then(content => {
|
|
1993
|
+
* console.log('Copied to clipboard:', content);
|
|
1994
|
+
* });
|
|
1995
|
+
*
|
|
1996
|
+
* // Using with a button click handler
|
|
1997
|
+
* function onCopyButtonClick() {
|
|
1998
|
+
* if (tableApi) {
|
|
1999
|
+
* tableApi.copyToClipboard()
|
|
2000
|
+
* .then(content => {
|
|
2001
|
+
* console.log('Successfully copied data to clipboard');
|
|
2002
|
+
* // Optionally do something with the copied content
|
|
2003
|
+
* })
|
|
2004
|
+
* .catch(error => {
|
|
2005
|
+
* console.error('Failed to copy to clipboard:', error);
|
|
2006
|
+
* });
|
|
2007
|
+
* }
|
|
2008
|
+
* }
|
|
2009
|
+
*
|
|
2010
|
+
* @returns {Promise<string>} A promise that resolves with the copied data as a string.
|
|
2011
|
+
* The string contains the tab-separated representation of the selected table data.
|
|
1273
2012
|
*/
|
|
1274
2013
|
copyToClipboard() {
|
|
1275
2014
|
return this.tableScope.copyService.copyToClipboard(
|
|
@@ -1279,11 +2018,33 @@ class ot {
|
|
|
1279
2018
|
);
|
|
1280
2019
|
}
|
|
1281
2020
|
/**
|
|
1282
|
-
*
|
|
2021
|
+
* Downloads the current table data as an Excel file.
|
|
2022
|
+
*
|
|
2023
|
+
* This method extracts all visible data from the table (including header, body, and footer areas),
|
|
2024
|
+
* converts it into a matrix format, and triggers a download of an Excel file containing this data.
|
|
2025
|
+
*
|
|
2026
|
+
* The method works by:
|
|
2027
|
+
* 1. Creating an empty matrix to hold all table data
|
|
2028
|
+
* 2. Iterating through each area of the table (header, body, footer)
|
|
2029
|
+
* 3. For each area, iterating through all rows and columns to extract cell values
|
|
2030
|
+
* 4. Passing the complete data matrix to the Excel service for file generation and download
|
|
2031
|
+
*
|
|
2032
|
+
* @param {string} fileName - The name of the Excel file to be downloaded (default: 'table.xlsx')
|
|
2033
|
+
* @param {string} author - Optional metadata for the Excel file to specify the author (default: '')
|
|
1283
2034
|
*
|
|
1284
|
-
* @
|
|
1285
|
-
*
|
|
1286
|
-
* @
|
|
2035
|
+
* @returns {void} The result of the excelService.downloadExcel method call
|
|
2036
|
+
*
|
|
2037
|
+
* @example
|
|
2038
|
+
* // Download table data with default filename
|
|
2039
|
+
* tableApi.downloadExcel();
|
|
2040
|
+
*
|
|
2041
|
+
* @example
|
|
2042
|
+
* // Download table data with custom filename and author
|
|
2043
|
+
* tableApi.downloadExcel('sales-report.xlsx', 'John Doe');
|
|
2044
|
+
*
|
|
2045
|
+
* @example
|
|
2046
|
+
* // Download table data with custom filename only
|
|
2047
|
+
* tableApi.downloadExcel('quarterly-data.xlsx');
|
|
1287
2048
|
*/
|
|
1288
2049
|
downloadExcel(e = "table.xlsx", t = "") {
|
|
1289
2050
|
const s = [], o = this.tableScope.tableModel.getColumnCount(), i = ["header", "body", "footer"];
|
|
@@ -1299,18 +2060,66 @@ class ot {
|
|
|
1299
2060
|
return this.tableScope.excelService.downloadExcel(s, e, t);
|
|
1300
2061
|
}
|
|
1301
2062
|
/**
|
|
1302
|
-
*
|
|
2063
|
+
* Returns the TableScope instance associated with this TableApi.
|
|
2064
|
+
*
|
|
2065
|
+
* The TableScope provides access to the core functionality and internal state of the table component,
|
|
2066
|
+
* including rendering, event handling, selection, and other low-level operations.
|
|
1303
2067
|
*
|
|
1304
|
-
*
|
|
2068
|
+
* This method is useful for advanced customization scenarios where you need direct access
|
|
2069
|
+
* to the table's internal structure and behaviors.
|
|
2070
|
+
*
|
|
2071
|
+
* @returns {TableScope} The TableScope instance that controls this table component
|
|
2072
|
+
*
|
|
2073
|
+
* @example
|
|
2074
|
+
* // Access the TableScope to perform a custom operation
|
|
2075
|
+
* const tableApi = new TableApi(myTableScope);
|
|
2076
|
+
* const tableScope = tableApi.getTableScope();
|
|
2077
|
+
*
|
|
2078
|
+
* // Example: Manually trigger a context menu at a specific location
|
|
2079
|
+
* const mouseEvent = new MouseEvent('contextmenu');
|
|
2080
|
+
* const geMouseEvent = tableScope.createGeMouseEvent(mouseEvent);
|
|
2081
|
+
* tableScope.contextmenu(geMouseEvent);
|
|
1305
2082
|
*/
|
|
1306
2083
|
getTableScope() {
|
|
1307
2084
|
return this.tableScope;
|
|
1308
2085
|
}
|
|
1309
2086
|
/**
|
|
1310
|
-
*
|
|
2087
|
+
* Returns the current selection model for the table.
|
|
1311
2088
|
*
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
2089
|
+
* The selection model manages cell selection state, including single cells, ranges, rows, and columns.
|
|
2090
|
+
* This method provides access to the selection model instance, allowing operations like:
|
|
2091
|
+
* - Checking if cells are selected
|
|
2092
|
+
* - Getting selection ranges
|
|
2093
|
+
* - Modifying selections
|
|
2094
|
+
* - Adding/removing selection event listeners
|
|
2095
|
+
*
|
|
2096
|
+
* @returns {SelectionModelIf | undefined} The current selection model if available, otherwise undefined.
|
|
2097
|
+
*
|
|
2098
|
+
* @example
|
|
2099
|
+
* // Get the selection model
|
|
2100
|
+
* const selectionModel = tableApi.getSelectionModel();
|
|
2101
|
+
*
|
|
2102
|
+
* // Check if a specific cell is selected
|
|
2103
|
+
* if (selectionModel?.isSelected(3, 2)) {
|
|
2104
|
+
* console.log('Cell at row 3, column 2 is selected');
|
|
2105
|
+
* }
|
|
2106
|
+
*
|
|
2107
|
+
* // Get all selected ranges
|
|
2108
|
+
* const ranges = selectionModel?.getRanges();
|
|
2109
|
+
* console.log('Selected ranges:', ranges);
|
|
2110
|
+
*
|
|
2111
|
+
* // Clear all selections
|
|
2112
|
+
* selectionModel?.clear();
|
|
2113
|
+
*
|
|
2114
|
+
* // Toggle selection of a cell
|
|
2115
|
+
* selectionModel?.togglePoint(5, 1);
|
|
2116
|
+
*
|
|
2117
|
+
* // Add a selection change listener
|
|
2118
|
+
* selectionModel?.addEventSelectionChangedListener({
|
|
2119
|
+
* selectionChanged: () => {
|
|
2120
|
+
* console.log('Selection has changed');
|
|
2121
|
+
* }
|
|
2122
|
+
* });
|
|
1314
2123
|
*/
|
|
1315
2124
|
getSelectionModel() {
|
|
1316
2125
|
return this.tableScope.selectionModel();
|
|
@@ -1791,6 +2600,184 @@ class ot {
|
|
|
1791
2600
|
getFirstVisibleRowIndex() {
|
|
1792
2601
|
return this.tableScope.getFirstVisibleRowIndex();
|
|
1793
2602
|
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Retrieves the index of the first fully visible row in the table's viewport.
|
|
2605
|
+
*
|
|
2606
|
+
* A row is considered "fully visible" when it's completely within the visible area of the table.
|
|
2607
|
+
* This differs from the regular "visible" row, which might be partially visible at the edges of the viewport.
|
|
2608
|
+
*
|
|
2609
|
+
* This method is useful for:
|
|
2610
|
+
* - Determining which rows are completely in view for operations that require full visibility
|
|
2611
|
+
* - Implementing pagination or virtualization logic that needs to know complete row visibility
|
|
2612
|
+
* - Supporting keyboard navigation that should skip partially visible rows
|
|
2613
|
+
*
|
|
2614
|
+
* @returns {number} The index of the first fully visible row, or -1 if no rows are fully visible
|
|
2615
|
+
*
|
|
2616
|
+
* @example
|
|
2617
|
+
* // Get the first fully visible row index
|
|
2618
|
+
* const firstFullVisibleRow = tableApi.getFirstFullVisibleRowIndex();
|
|
2619
|
+
*
|
|
2620
|
+
* // Check if a specific row is fully visible
|
|
2621
|
+
* const isRowFullyVisible = (rowIndex) => {
|
|
2622
|
+
* const firstFullVisible = tableApi.getFirstFullVisibleRowIndex();
|
|
2623
|
+
* const lastFullVisible = tableApi.getLastFullVisibleRowIndex();
|
|
2624
|
+
* return rowIndex >= firstFullVisible && rowIndex <= lastFullVisible;
|
|
2625
|
+
* };
|
|
2626
|
+
*/
|
|
2627
|
+
getFirstFullVisibleRowIndex() {
|
|
2628
|
+
return this.tableScope.getFirstFullVisibleRowIndex();
|
|
2629
|
+
}
|
|
2630
|
+
/**
|
|
2631
|
+
* Returns the index of the last row that is visible in the table's viewport.
|
|
2632
|
+
*
|
|
2633
|
+
* This method retrieves the last visible row index from the table scope, which keeps
|
|
2634
|
+
* track of which rows are currently visible as the user scrolls through the table.
|
|
2635
|
+
*
|
|
2636
|
+
* This can be useful for:
|
|
2637
|
+
* - Implementing virtualized scrolling optimizations
|
|
2638
|
+
* - Determining if specific rows are currently in view
|
|
2639
|
+
* - Implementing features that need to know the visible range of rows
|
|
2640
|
+
*
|
|
2641
|
+
* @returns {number} The index of the last visible row in the table viewport
|
|
2642
|
+
*
|
|
2643
|
+
* @example
|
|
2644
|
+
* // Check if a specific row is currently visible in the viewport
|
|
2645
|
+
* const lastVisibleIndex = tableApi.getLastVisibleRowIndex();
|
|
2646
|
+
* const firstVisibleIndex = tableApi.getFirstVisibleRowIndex();
|
|
2647
|
+
* const isRowVisible = rowIndex >= firstVisibleIndex && rowIndex <= lastVisibleIndex;
|
|
2648
|
+
*
|
|
2649
|
+
* @example
|
|
2650
|
+
* // Get the range of visible rows
|
|
2651
|
+
* const visibleRowsRange = {
|
|
2652
|
+
* first: tableApi.getFirstVisibleRowIndex(),
|
|
2653
|
+
* last: tableApi.getLastVisibleRowIndex()
|
|
2654
|
+
* };
|
|
2655
|
+
* console.log(`Visible rows: ${visibleRowsRange.first} to ${visibleRowsRange.last}`);
|
|
2656
|
+
*/
|
|
2657
|
+
getLastVisibleRowIndex() {
|
|
2658
|
+
return this.tableScope.getLastVisibleRowIndex();
|
|
2659
|
+
}
|
|
2660
|
+
/**
|
|
2661
|
+
* Returns the index of the last fully visible row in the table's viewport.
|
|
2662
|
+
*
|
|
2663
|
+
* This method retrieves the last row that is completely visible within the current
|
|
2664
|
+
* viewport of the table. A row is considered "fully visible" when its entire height
|
|
2665
|
+
* is visible without any portion being cut off by the viewport boundaries.
|
|
2666
|
+
*
|
|
2667
|
+
* The distinction between "visible" and "fully visible" is important when scrolling:
|
|
2668
|
+
* - A row can be partially visible (some portion is in view)
|
|
2669
|
+
* - A row can be fully visible (the entire row is in view)
|
|
2670
|
+
*
|
|
2671
|
+
* @returns {number} The index of the last fully visible row in the table.
|
|
2672
|
+
* If no row is fully visible or the table is empty, the method might return -1.
|
|
2673
|
+
*
|
|
2674
|
+
* @example
|
|
2675
|
+
* ```typescript
|
|
2676
|
+
* // Get the index of the last fully visible row
|
|
2677
|
+
* const lastVisibleRowIndex = tableApi.getLastFullVisibleRowIndex();
|
|
2678
|
+
*
|
|
2679
|
+
* // Use this information to determine if a specific row is fully visible
|
|
2680
|
+
* const isRowFullyVisible = rowIndex <= lastVisibleRowIndex && rowIndex >= tableApi.getFirstFullVisibleRowIndex();
|
|
2681
|
+
*
|
|
2682
|
+
* // Can be used with scrolling operations to ensure certain rows are visible
|
|
2683
|
+
* if (rowIndex > lastVisibleRowIndex) {
|
|
2684
|
+
* tableApi.ensureRowIsVisible(rowIndex);
|
|
2685
|
+
* }
|
|
2686
|
+
* ```
|
|
2687
|
+
*/
|
|
2688
|
+
getLastFullVisibleRowIndex() {
|
|
2689
|
+
return this.tableScope.getLastFullVisibleRowIndex();
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Checks whether logging is currently active for the table component.
|
|
2693
|
+
*
|
|
2694
|
+
* This method returns the current state of logging for the table. When logging is active,
|
|
2695
|
+
* the table outputs detailed information about its operations to the console, including:
|
|
2696
|
+
*
|
|
2697
|
+
* - Rendering processes and lifecycle events
|
|
2698
|
+
* - Data modifications and updates
|
|
2699
|
+
* - Event handling and user interactions
|
|
2700
|
+
* - Performance metrics and state changes
|
|
2701
|
+
*
|
|
2702
|
+
* Logging can be toggled using the `setLoggingActive(boolean)` method.
|
|
2703
|
+
*
|
|
2704
|
+
* @returns {boolean} True if logging is currently enabled, false otherwise.
|
|
2705
|
+
*
|
|
2706
|
+
* @example
|
|
2707
|
+
* // Check if logging is enabled
|
|
2708
|
+
* if (tableApi.isLoggingActive()) {
|
|
2709
|
+
* console.log("Table logging is currently active");
|
|
2710
|
+
* }
|
|
2711
|
+
*
|
|
2712
|
+
* // Conditionally enable logging only if it's not already active
|
|
2713
|
+
* if (!tableApi.isLoggingActive()) {
|
|
2714
|
+
* tableApi.setLoggingActive(true);
|
|
2715
|
+
*
|
|
2716
|
+
* // Perform operations that need debugging
|
|
2717
|
+
* tableApi.updateCells([
|
|
2718
|
+
* {
|
|
2719
|
+
* area: "body",
|
|
2720
|
+
* rowIndex: 2,
|
|
2721
|
+
* columnIndex: 3,
|
|
2722
|
+
* value: "New Value",
|
|
2723
|
+
* cssClasses: { "highlight": true }
|
|
2724
|
+
* }
|
|
2725
|
+
* ]);
|
|
2726
|
+
*
|
|
2727
|
+
* // Run some additional operations...
|
|
2728
|
+
*
|
|
2729
|
+
* // Disable logging when finished
|
|
2730
|
+
* tableApi.setLoggingActive(false);
|
|
2731
|
+
* }
|
|
2732
|
+
*/
|
|
2733
|
+
setLoggingActive(e) {
|
|
2734
|
+
this.tableScope.loggingActive = e;
|
|
2735
|
+
}
|
|
2736
|
+
/**
|
|
2737
|
+
* Checks whether logging is currently active for the table component.
|
|
2738
|
+
*
|
|
2739
|
+
* This method returns the current state of logging for the table. When logging is active,
|
|
2740
|
+
* the table outputs detailed information about its operations to the console, including:
|
|
2741
|
+
*
|
|
2742
|
+
* - Rendering processes and lifecycle events
|
|
2743
|
+
* - Data modifications and updates
|
|
2744
|
+
* - Event handling and user interactions
|
|
2745
|
+
* - Performance metrics and state changes
|
|
2746
|
+
*
|
|
2747
|
+
* Logging can be toggled using the `setLoggingActive(boolean)` method.
|
|
2748
|
+
*
|
|
2749
|
+
* @returns {boolean} True if logging is currently enabled, false otherwise.
|
|
2750
|
+
*
|
|
2751
|
+
* @example
|
|
2752
|
+
* // Check if logging is enabled
|
|
2753
|
+
* if (tableApi.isLoggingActive()) {
|
|
2754
|
+
* console.log("Table logging is currently active");
|
|
2755
|
+
* }
|
|
2756
|
+
*
|
|
2757
|
+
* // Conditionally enable logging only if it's not already active
|
|
2758
|
+
* if (!tableApi.isLoggingActive()) {
|
|
2759
|
+
* tableApi.setLoggingActive(true);
|
|
2760
|
+
*
|
|
2761
|
+
* // Perform operations that need debugging
|
|
2762
|
+
* tableApi.updateCells([
|
|
2763
|
+
* {
|
|
2764
|
+
* area: "body",
|
|
2765
|
+
* rowIndex: 2,
|
|
2766
|
+
* columnIndex: 3,
|
|
2767
|
+
* value: "New Value",
|
|
2768
|
+
* cssClasses: { "highlight": true }
|
|
2769
|
+
* }
|
|
2770
|
+
* ]);
|
|
2771
|
+
*
|
|
2772
|
+
* // Run some additional operations...
|
|
2773
|
+
*
|
|
2774
|
+
* // Disable logging when finished
|
|
2775
|
+
* tableApi.setLoggingActive(false);
|
|
2776
|
+
* }
|
|
2777
|
+
*/
|
|
2778
|
+
isLoggingActive() {
|
|
2779
|
+
return this.tableScope.loggingActive;
|
|
2780
|
+
}
|
|
1794
2781
|
}
|
|
1795
2782
|
class de {
|
|
1796
2783
|
constructor(e) {
|
|
@@ -1941,14 +2928,14 @@ class at extends de {
|
|
|
1941
2928
|
}
|
|
1942
2929
|
}
|
|
1943
2930
|
}
|
|
1944
|
-
class
|
|
2931
|
+
class I {
|
|
1945
2932
|
constructor(e = 0, t = 0, s = 0, o = 0, i) {
|
|
1946
2933
|
this.left = e, this.width = t, this.height = s, this.top = o, this.index = i;
|
|
1947
2934
|
}
|
|
1948
2935
|
}
|
|
1949
2936
|
class nt {
|
|
1950
2937
|
constructor(e, t, s, o) {
|
|
1951
|
-
this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = o, this.scrollTop = 0, this.areaBodyWestGeo = new
|
|
2938
|
+
this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = o, this.scrollTop = 0, this.areaBodyWestGeo = new I(), this.areaBodyCenterGeo = new I(), this.areaBodyEastGeo = new I();
|
|
1952
2939
|
const i = this.hostElement;
|
|
1953
2940
|
i.innerText = "", this.dom.setAttribute(i, "tabindex", "0"), this.dom.setStyle(
|
|
1954
2941
|
this.dom.addClass("ge-table", i),
|
|
@@ -2193,11 +3180,11 @@ class dt {
|
|
|
2193
3180
|
class ht extends nt {
|
|
2194
3181
|
constructor(e, t, s, o) {
|
|
2195
3182
|
var r, a;
|
|
2196
|
-
super(e, t, s, o), this.dragging = !1, this.editing = !1, this.storedColumnWidths = [], this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
3183
|
+
super(e, t, s, o), this.firstVisibleRowIndex = -1, this.lastVisibleRowIndex = -1, this.firstFullVisibleRowIndex = -1, this.lastFullVisibleRowIndex = -1, this.displayedRowCount = 0, this.pixelLimitForFullVisible = 5, this.loggingActive = !1, this.dragging = !1, this.editing = !1, this.storedColumnWidths = [], this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
2197
3184
|
header: [],
|
|
2198
3185
|
body: [],
|
|
2199
3186
|
footer: []
|
|
2200
|
-
}, this.tree = !1, this.colAndRowspanModels = new dt(), this.
|
|
3187
|
+
}, this.tree = !1, this.colAndRowspanModels = new dt(), this.draggingTargetColumnIndex = -1, this.removables = [], this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (a = this.tableOptions) != null && a.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), le(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
2201
3188
|
(n) => {
|
|
2202
3189
|
var d;
|
|
2203
3190
|
this.colAndRowspanModels[n] = new ct(t, t.getAreaModel(n)), (d = this.colAndRowspanModels[n]) == null || d.init();
|
|
@@ -2286,19 +3273,19 @@ class ht extends nt {
|
|
|
2286
3273
|
for (const t of this.removables)
|
|
2287
3274
|
t.remove();
|
|
2288
3275
|
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(
|
|
2289
|
-
new
|
|
3276
|
+
new I(0, this.hostElement.clientWidth, 1, 0),
|
|
2290
3277
|
this.hostElement,
|
|
2291
3278
|
"ge-table-border"
|
|
2292
3279
|
)), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
|
|
2293
|
-
new
|
|
3280
|
+
new I(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
|
|
2294
3281
|
this.hostElement,
|
|
2295
3282
|
"ge-table-border"
|
|
2296
3283
|
)), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
|
|
2297
|
-
new
|
|
3284
|
+
new I(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
|
|
2298
3285
|
this.hostElement,
|
|
2299
3286
|
"ge-table-body-west-vertical-border"
|
|
2300
3287
|
)), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
|
|
2301
|
-
new
|
|
3288
|
+
new I(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
|
|
2302
3289
|
this.hostElement,
|
|
2303
3290
|
"ge-table-body-west-vertical-border"
|
|
2304
3291
|
));
|
|
@@ -2350,12 +3337,27 @@ class ht extends nt {
|
|
|
2350
3337
|
}
|
|
2351
3338
|
const p = r.getCustomClassesAt(t, s);
|
|
2352
3339
|
p.length && this.dom.addClasses(p, n);
|
|
2353
|
-
const
|
|
2354
|
-
if (
|
|
2355
|
-
for (const g in
|
|
2356
|
-
this.dom.setStyle(n, g,
|
|
3340
|
+
const m = r.getCustomStyleAt(t, s);
|
|
3341
|
+
if (m)
|
|
3342
|
+
for (const g in m)
|
|
3343
|
+
this.dom.setStyle(n, g, m[g]);
|
|
2357
3344
|
}
|
|
2358
3345
|
}
|
|
3346
|
+
getFirstVisibleRowIndex() {
|
|
3347
|
+
return this.firstVisibleRowIndex;
|
|
3348
|
+
}
|
|
3349
|
+
getLastVisibleRowIndex() {
|
|
3350
|
+
return this.lastVisibleRowIndex;
|
|
3351
|
+
}
|
|
3352
|
+
getFirstFullVisibleRowIndex() {
|
|
3353
|
+
return this.firstFullVisibleRowIndex;
|
|
3354
|
+
}
|
|
3355
|
+
getLastFullVisibleRowIndex() {
|
|
3356
|
+
return this.lastFullVisibleRowIndex;
|
|
3357
|
+
}
|
|
3358
|
+
getDisplayedRowCount() {
|
|
3359
|
+
return this.displayedRowCount;
|
|
3360
|
+
}
|
|
2359
3361
|
/**
|
|
2360
3362
|
* Stores the widths of all columns in the table.
|
|
2361
3363
|
*
|
|
@@ -2456,16 +3458,17 @@ class ht extends nt {
|
|
|
2456
3458
|
s.child.innerText = "", o.child.innerText = "", i.child.innerText = "";
|
|
2457
3459
|
const a = 0, n = this.areaBodyCenterGeo.width, d = this.tableModel.getPadding(), c = this.tableModel.getAreaModel(e), h = c.getRowCount();
|
|
2458
3460
|
for (; this.cleanupFunctions[e].length; ) {
|
|
2459
|
-
const
|
|
2460
|
-
|
|
3461
|
+
const u = this.cleanupFunctions[e].shift();
|
|
3462
|
+
u && u();
|
|
2461
3463
|
}
|
|
2462
3464
|
let p = t;
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2465
|
-
|
|
3465
|
+
const m = this.tableModel.getColumnCount(), g = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
|
|
3466
|
+
e === "body" && (this.firstVisibleRowIndex = -1, this.firstFullVisibleRowIndex = -1, this.lastVisibleRowIndex = -1, this.lastFullVisibleRowIndex = -1);
|
|
3467
|
+
for (let u = 0; u < h; u++) {
|
|
3468
|
+
const w = p, v = u === h - 1, A = this.tableModel.getRowHeight(e, u);
|
|
2466
3469
|
if (w + A > 0) {
|
|
2467
|
-
this.firstVisibleRowIndex =
|
|
2468
|
-
let y = { left: a, width: n, height: A, top: w, index:
|
|
3470
|
+
e === "body" && this.firstVisibleRowIndex === -1 && (this.firstVisibleRowIndex = u, this.firstFullVisibleRowIndex = w < -this.pixelLimitForFullVisible ? this.firstVisibleRowIndex + 1 : this.firstVisibleRowIndex);
|
|
3471
|
+
let y = { left: a, width: n, height: A, top: w, index: u }, S = this.dom.addRowDiv(o, y, u, e, "center");
|
|
2469
3472
|
const F = b;
|
|
2470
3473
|
if (this.adjustColumnsToRowParent({
|
|
2471
3474
|
areaIdent: e,
|
|
@@ -2473,37 +3476,37 @@ class ht extends nt {
|
|
|
2473
3476
|
areaModel: c,
|
|
2474
3477
|
geo: y,
|
|
2475
3478
|
parent: S,
|
|
2476
|
-
rowIndex:
|
|
3479
|
+
rowIndex: u,
|
|
2477
3480
|
columnIndexStart: F,
|
|
2478
|
-
columnIndexEnd:
|
|
3481
|
+
columnIndexEnd: m - g - 1,
|
|
2479
3482
|
verticalFixed: !1,
|
|
2480
|
-
lastRowOfModel:
|
|
2481
|
-
}), d.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: A, top: w, index:
|
|
3483
|
+
lastRowOfModel: v
|
|
3484
|
+
}), d.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: A, top: w, index: u }, S = this.dom.addRowDiv(s, y, u, e, "west"), this.adjustColumnsToRowParent({
|
|
2482
3485
|
areaIdent: e,
|
|
2483
3486
|
sideIdent: "west",
|
|
2484
3487
|
areaModel: c,
|
|
2485
3488
|
geo: y,
|
|
2486
3489
|
parent: S,
|
|
2487
|
-
rowIndex:
|
|
3490
|
+
rowIndex: u,
|
|
2488
3491
|
columnIndexStart: 0,
|
|
2489
3492
|
columnIndexEnd: F - 1,
|
|
2490
3493
|
verticalFixed: !0,
|
|
2491
|
-
lastRowOfModel:
|
|
2492
|
-
})), d.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: A, top: w, index:
|
|
3494
|
+
lastRowOfModel: v
|
|
3495
|
+
})), d.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: A, top: w, index: u }, S = this.dom.addRowDiv(i, y, u, e, "east"), this.adjustColumnsToRowParent({
|
|
2493
3496
|
areaIdent: e,
|
|
2494
3497
|
sideIdent: "east",
|
|
2495
3498
|
areaModel: c,
|
|
2496
3499
|
geo: y,
|
|
2497
3500
|
parent: S,
|
|
2498
|
-
rowIndex:
|
|
2499
|
-
columnIndexStart:
|
|
2500
|
-
columnIndexEnd:
|
|
3501
|
+
rowIndex: u,
|
|
3502
|
+
columnIndexStart: m - g,
|
|
3503
|
+
columnIndexEnd: m - 1,
|
|
2501
3504
|
verticalFixed: !0,
|
|
2502
|
-
lastRowOfModel:
|
|
2503
|
-
})), e === "header" && this.tree &&
|
|
3505
|
+
lastRowOfModel: v
|
|
3506
|
+
})), e === "header" && this.tree && u === h - 1) {
|
|
2504
3507
|
const T = this.dom.applyStyle(
|
|
2505
3508
|
this.dom.setAttribute(
|
|
2506
|
-
this.dom.addDiv(S, new
|
|
3509
|
+
this.dom.addDiv(S, new I(16, 20, 20, 8)),
|
|
2507
3510
|
"data-ge-action",
|
|
2508
3511
|
"toggleExpandCollapseAll"
|
|
2509
3512
|
),
|
|
@@ -2516,24 +3519,27 @@ class ht extends nt {
|
|
|
2516
3519
|
}
|
|
2517
3520
|
}
|
|
2518
3521
|
if (p = p + A, p > r) {
|
|
2519
|
-
e === "body" && (this.displayedRowCount = this.
|
|
3522
|
+
e === "body" && (this.lastVisibleRowIndex = u, this.lastFullVisibleRowIndex = r - p < -this.pixelLimitForFullVisible ? u - 1 : u, this.displayedRowCount = this.lastFullVisibleRowIndex - this.firstFullVisibleRowIndex + 1);
|
|
2520
3523
|
break;
|
|
2521
3524
|
}
|
|
2522
3525
|
}
|
|
2523
|
-
if (this.
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
3526
|
+
if (this.loggingActive && e === "body" && console.log("render scope: this.firstVisibleRowIndex <- " + this.firstVisibleRowIndex + `
|
|
3527
|
+
render scope: this.firstFullVisibleRowIndex <- ` + this.firstFullVisibleRowIndex + `
|
|
3528
|
+
render scope: this.lastVisibleRowIndex <- ` + this.lastVisibleRowIndex + `
|
|
3529
|
+
render scope: this.lastFullVisibleRowIndex <- ` + this.lastFullVisibleRowIndex), this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
3530
|
+
const u = ((f = this.colAndRowspanModels[e]) == null ? void 0 : f.getRanges()) ?? [];
|
|
3531
|
+
if (u.length)
|
|
3532
|
+
for (const w of u) {
|
|
3533
|
+
let v = 0, A = o.child, y = "center";
|
|
2528
3534
|
if (w.c1 < b)
|
|
2529
3535
|
A = s.child, y = "west";
|
|
2530
|
-
else if (g > 0 && w.c1 >=
|
|
3536
|
+
else if (g > 0 && w.c1 >= m - g)
|
|
2531
3537
|
A = i.child, y = "east";
|
|
2532
3538
|
else {
|
|
2533
3539
|
const S = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
2534
|
-
|
|
3540
|
+
v = this.scrollFactorX * S - this.areaBodyWestGeo.width, y = "center";
|
|
2535
3541
|
}
|
|
2536
|
-
this.drawBigCell(w,
|
|
3542
|
+
this.drawBigCell(w, v, t, c, A, y);
|
|
2537
3543
|
}
|
|
2538
3544
|
}
|
|
2539
3545
|
}
|
|
@@ -2548,10 +3554,10 @@ class ht extends nt {
|
|
|
2548
3554
|
* @protected
|
|
2549
3555
|
*/
|
|
2550
3556
|
drawBigCell(e, t, s, o, i, r) {
|
|
2551
|
-
const a = s + this.getRowHeights(0, e.r1 - 1, o).reduce((f,
|
|
3557
|
+
const a = s + this.getRowHeights(0, e.r1 - 1, o).reduce((f, u) => f + u, 0), n = this.tableModel.getColumnCount(), d = this.tableModel.getFixedRightColumnCount();
|
|
2552
3558
|
let c = 0;
|
|
2553
3559
|
d > 0 && e.c1 >= n - d && (c = n - d);
|
|
2554
|
-
const h = t + this.getColumnWidths(c, e.c1 - 1).reduce((f,
|
|
3560
|
+
const h = t + this.getColumnWidths(c, e.c1 - 1).reduce((f, u) => f + u, 0), p = this.getRowHeights(e.r1, e.r2, o).reduce((f, u) => f + u, 0), m = this.getColumnWidths(e.c1, e.c2).reduce((f, u) => f + u, 0);
|
|
2555
3561
|
let g = !1;
|
|
2556
3562
|
const b = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
2557
3563
|
b && (g = b.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? this.renderCell({
|
|
@@ -2562,7 +3568,7 @@ class ht extends nt {
|
|
|
2562
3568
|
columnIndex: e.c1,
|
|
2563
3569
|
left: h,
|
|
2564
3570
|
top: a,
|
|
2565
|
-
width:
|
|
3571
|
+
width: m,
|
|
2566
3572
|
height: p,
|
|
2567
3573
|
parent: i,
|
|
2568
3574
|
cellSelected: g,
|
|
@@ -2576,7 +3582,7 @@ class ht extends nt {
|
|
|
2576
3582
|
columnIndex: e.c1,
|
|
2577
3583
|
left: h,
|
|
2578
3584
|
top: a,
|
|
2579
|
-
width:
|
|
3585
|
+
width: m,
|
|
2580
3586
|
height: p,
|
|
2581
3587
|
parent: i,
|
|
2582
3588
|
cellSelected: g,
|
|
@@ -2587,7 +3593,7 @@ class ht extends nt {
|
|
|
2587
3593
|
columnIndex: e.c1,
|
|
2588
3594
|
cellLeft: h,
|
|
2589
3595
|
cellTop: a,
|
|
2590
|
-
cellWidth:
|
|
3596
|
+
cellWidth: m,
|
|
2591
3597
|
cellHeight: p,
|
|
2592
3598
|
parent: i
|
|
2593
3599
|
});
|
|
@@ -2638,33 +3644,33 @@ class ht extends nt {
|
|
|
2638
3644
|
const f = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
2639
3645
|
h = this.scrollFactorX * f;
|
|
2640
3646
|
}
|
|
2641
|
-
const p = 0,
|
|
3647
|
+
const p = 0, m = !!(e === "body" && t);
|
|
2642
3648
|
let g = h;
|
|
2643
3649
|
for (let f = a; f <= n; f++) {
|
|
2644
|
-
const
|
|
2645
|
-
if (w > 0 &&
|
|
2646
|
-
let
|
|
3650
|
+
const u = g, w = this.tableModel.getColumnWidth(f);
|
|
3651
|
+
if (w > 0 && u + w > 0) {
|
|
3652
|
+
let v = o.height;
|
|
2647
3653
|
const A = s.getRowspanAt(r, f), y = s.getColspanAt(r, f);
|
|
2648
|
-
A > 1 && (
|
|
3654
|
+
A > 1 && (v = this.getRowHeights(r, r + A - 1, s).reduce((T, D) => T + D, 0));
|
|
2649
3655
|
let S = w;
|
|
2650
3656
|
y > 1 && (S = this.getColumnWidths(f, f + y - 1).reduce((T, D) => T + D, 0));
|
|
2651
3657
|
let F = !1;
|
|
2652
3658
|
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r, f) && (F = !0), this.draggingTargetColumnIndex === f && e !== "header") {
|
|
2653
|
-
this.renderDragTargetDiv(i,
|
|
2654
|
-
const T = { left:
|
|
3659
|
+
this.renderDragTargetDiv(i, u, p, S, v);
|
|
3660
|
+
const T = { left: u, top: p, width: S, height: v };
|
|
2655
3661
|
this.dom.addColumnBorderDivs(this.tableOptions, i, T, e, t);
|
|
2656
3662
|
} else {
|
|
2657
|
-
const T = this.renderSelectedBackgroundDiv(F,
|
|
3663
|
+
const T = this.renderSelectedBackgroundDiv(F, m, t, s, r, f, i, u, p, S, v);
|
|
2658
3664
|
"gammaCells" in s && s.getValueAt(r, f) && (F = !1), F || this.renderCell({
|
|
2659
3665
|
areaModel: s,
|
|
2660
3666
|
areaIdent: e,
|
|
2661
3667
|
sideIdent: t,
|
|
2662
3668
|
rowIndex: r,
|
|
2663
3669
|
columnIndex: f,
|
|
2664
|
-
left:
|
|
3670
|
+
left: u,
|
|
2665
3671
|
top: p,
|
|
2666
3672
|
width: S,
|
|
2667
|
-
height:
|
|
3673
|
+
height: v,
|
|
2668
3674
|
parent: i,
|
|
2669
3675
|
cellSelected: T,
|
|
2670
3676
|
lastRowOfModel: c,
|
|
@@ -2672,10 +3678,10 @@ class ht extends nt {
|
|
|
2672
3678
|
}), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
2673
3679
|
rowIndex: r,
|
|
2674
3680
|
columnIndex: f,
|
|
2675
|
-
cellLeft:
|
|
3681
|
+
cellLeft: u,
|
|
2676
3682
|
cellTop: p,
|
|
2677
3683
|
cellWidth: S,
|
|
2678
|
-
cellHeight:
|
|
3684
|
+
cellHeight: v,
|
|
2679
3685
|
parent: i
|
|
2680
3686
|
});
|
|
2681
3687
|
}
|
|
@@ -2683,7 +3689,7 @@ class ht extends nt {
|
|
|
2683
3689
|
if (g = g + w, g > this.areaBodyCenterGeo.width)
|
|
2684
3690
|
break;
|
|
2685
3691
|
}
|
|
2686
|
-
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new
|
|
3692
|
+
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new I(g - 1, 1, o.height, 0), i);
|
|
2687
3693
|
}
|
|
2688
3694
|
/**
|
|
2689
3695
|
* Retrieves the column index of the tree arrow column in the table.
|
|
@@ -2711,18 +3717,18 @@ class ht extends nt {
|
|
|
2711
3717
|
lastRowOfModel: h
|
|
2712
3718
|
}) {
|
|
2713
3719
|
var ge;
|
|
2714
|
-
const
|
|
3720
|
+
const m = this.editorRenderer && this.editorRendererRow === o && this.editorRendererColumn === i ? this.editorRenderer : e.getCellRenderer(o, i), g = { left: r, width: a, height: n, top: d, index: i }, b = e.getRowByIndex(o);
|
|
2715
3721
|
let f = "none";
|
|
2716
3722
|
if (i === this.getTreeArrowColumnIndex() && K(b)) {
|
|
2717
|
-
const
|
|
2718
|
-
(ge =
|
|
3723
|
+
const C = b;
|
|
3724
|
+
(ge = C.children) != null && ge.length ? C.expanded ? f = "expanded" : f = "collapsed" : f = "hidden";
|
|
2719
3725
|
}
|
|
2720
3726
|
let w;
|
|
2721
3727
|
if (t === "header") {
|
|
2722
|
-
const
|
|
2723
|
-
(!(
|
|
3728
|
+
const C = this.tableModel.getColumnDef(i);
|
|
3729
|
+
(!(C != null && C.sortIconVisible) || C != null && C.sortIconVisible()) && (w = C == null ? void 0 : C.sortState);
|
|
2724
3730
|
}
|
|
2725
|
-
const
|
|
3731
|
+
const v = e.getValueAt(o, i), A = m ? "" : `${v}`, y = e.isRowChecked(o), S = this.dom.addColumnDiv(
|
|
2726
3732
|
{
|
|
2727
3733
|
parent: c,
|
|
2728
3734
|
geo: g,
|
|
@@ -2741,17 +3747,17 @@ class ht extends nt {
|
|
|
2741
3747
|
const T = this.tableModel.getColumnDef(i);
|
|
2742
3748
|
T && T.classes[t] && this.dom.addClasses(T.classes[t], S);
|
|
2743
3749
|
let D;
|
|
2744
|
-
|
|
3750
|
+
m && (D = m.render(S, o, i, t, e, v, this.dom.domService));
|
|
2745
3751
|
const N = e.getCustomClassesAt(o, i);
|
|
2746
3752
|
if (N.length && this.dom.addClasses(N, S), this.dom.addColumnBorderDivs(this.tableOptions, c, g, t, s), h && this.dom.addHorizontalBorder({ left: r, width: a, height: n, top: d + n }, c), this.getFocusModel && t === "body") {
|
|
2747
|
-
const
|
|
2748
|
-
|
|
3753
|
+
const C = this.getFocusModel();
|
|
3754
|
+
C != null && C.hasFocus(o, i) && this.dom.addFocusBorderDivs(c, g, {});
|
|
2749
3755
|
}
|
|
2750
3756
|
t === "header" && this.dom.setAttribute(S, "data-ge-action", "drag-column");
|
|
2751
3757
|
const ee = e.getCustomStyleAt(o, i);
|
|
2752
3758
|
if (ee)
|
|
2753
|
-
for (const
|
|
2754
|
-
this.dom.setStyle(S,
|
|
3759
|
+
for (const C in ee)
|
|
3760
|
+
this.dom.setStyle(S, C, ee[C]);
|
|
2755
3761
|
return [S, D];
|
|
2756
3762
|
}
|
|
2757
3763
|
/**
|
|
@@ -2918,7 +3924,7 @@ class ht extends nt {
|
|
|
2918
3924
|
if (r) {
|
|
2919
3925
|
const a = e.index ?? 0, n = this.draggingColumn;
|
|
2920
3926
|
for (let d = 0; d < r; d++) {
|
|
2921
|
-
const c = s, h = i.getRowHeight(d), p = { left: 0, width: e.width, height: h, top: c, index: d },
|
|
3927
|
+
const c = s, h = i.getRowHeight(d), p = { left: 0, width: e.width, height: h, top: c, index: d }, m = i.getValueAt(d, a), g = i.getCellRenderer(d, a), b = g ? "" : `${m}`, f = {
|
|
2922
3928
|
parent: n,
|
|
2923
3929
|
geo: p,
|
|
2924
3930
|
rowIndex: d,
|
|
@@ -2926,17 +3932,17 @@ class ht extends nt {
|
|
|
2926
3932
|
areaIdent: t,
|
|
2927
3933
|
sideIdent: o,
|
|
2928
3934
|
text: b
|
|
2929
|
-
},
|
|
3935
|
+
}, u = this.dom.addColumnDiv(f);
|
|
2930
3936
|
let w;
|
|
2931
|
-
g && (w = g.render(
|
|
2932
|
-
const
|
|
2933
|
-
|
|
3937
|
+
g && (w = g.render(u, d, a, t, i, m, this.dom.domService), w && this.cleanupFunctions[t].push(w));
|
|
3938
|
+
const v = i.getCustomClassesAt(d, a);
|
|
3939
|
+
v.length && this.dom.addClasses(v, u);
|
|
2934
3940
|
const A = this.tableModel.getColumnDef(a);
|
|
2935
|
-
A && A.classes[t] && this.dom.addClasses(A.classes[t],
|
|
3941
|
+
A && A.classes[t] && this.dom.addClasses(A.classes[t], u), this.dom.addColumnBorderDivs(this.tableOptions, n, p, t, o);
|
|
2936
3942
|
const y = i.getCustomStyleAt(d, a);
|
|
2937
3943
|
if (y)
|
|
2938
3944
|
for (const S in y)
|
|
2939
|
-
this.dom.setStyle(
|
|
3945
|
+
this.dom.setStyle(u, S, y[S]);
|
|
2940
3946
|
s = s + h;
|
|
2941
3947
|
}
|
|
2942
3948
|
}
|
|
@@ -2989,9 +3995,9 @@ class ht extends nt {
|
|
|
2989
3995
|
renderSelectedBackgroundDiv(e, t, s, o, i, r, a, n, d, c, h) {
|
|
2990
3996
|
let p = !1;
|
|
2991
3997
|
if (!e && t && o.isSelectable(i, r) && this.getSelectionModel) {
|
|
2992
|
-
const
|
|
2993
|
-
if (
|
|
2994
|
-
const g =
|
|
3998
|
+
const m = this.getSelectionModel();
|
|
3999
|
+
if (m) {
|
|
4000
|
+
const g = m.getSelectionCount(i, r);
|
|
2995
4001
|
p = g > 0;
|
|
2996
4002
|
for (let b = 0; b < g; b++) {
|
|
2997
4003
|
const f = this.dom.applyStylePosistionAbsolute(
|
|
@@ -3037,7 +4043,7 @@ class ht extends nt {
|
|
|
3037
4043
|
cellSelected: h,
|
|
3038
4044
|
lastRowOfModel: p
|
|
3039
4045
|
}) {
|
|
3040
|
-
const [
|
|
4046
|
+
const [m, g] = this.addAndRenderCellDiv({
|
|
3041
4047
|
areaModel: e,
|
|
3042
4048
|
areaIdent: t,
|
|
3043
4049
|
sideIdent: s,
|
|
@@ -3050,7 +4056,7 @@ class ht extends nt {
|
|
|
3050
4056
|
parent: c,
|
|
3051
4057
|
lastRowOfModel: p
|
|
3052
4058
|
});
|
|
3053
|
-
h && this.dom.addClass(`ge-table-${t}-${s}-selected-range`,
|
|
4059
|
+
h && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, m), g && this.cleanupFunctions[t].push(g);
|
|
3054
4060
|
}
|
|
3055
4061
|
/**
|
|
3056
4062
|
* Render the header cell resize handle.
|
|
@@ -3120,8 +4126,8 @@ class ut {
|
|
|
3120
4126
|
var i, r, a, n, d, c, h;
|
|
3121
4127
|
let s = !1, o = !1;
|
|
3122
4128
|
if (this.getSelectionModel && this.getFocusModel) {
|
|
3123
|
-
const p = this.getSelectionModel(),
|
|
3124
|
-
p &&
|
|
4129
|
+
const p = this.getSelectionModel(), m = this.getFocusModel();
|
|
4130
|
+
p && m && (m.hasFocus(e.rowIndex, e.columnIndex) || (m.setFocus(e.rowIndex, e.columnIndex), this.tableScope.onFocusChanged(m), s = !0), (i = e.originalEvent) != null && i.shiftKey || p.hasSelection() && (p.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (p.addSelection(this.createRangeByEvents(e, this.previousEvt)), o = !0, s = !0) : (a = e.originalEvent) != null && a.altKey && ((n = e.originalEvent) != null && n.ctrlKey || (d = e.originalEvent) != null && d.metaKey) ? (p.removeSelection(E.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (c = e.originalEvent) != null && c.ctrlKey || (h = e.originalEvent) != null && h.metaKey ? (p.addSelection(E.singleCell(e.rowIndex, e.columnIndex)), o = !0, s = !0) : (p.firstClick(e.rowIndex, e.columnIndex), s = !0), this.tableScope.onSelectionChanged(p));
|
|
3125
4131
|
}
|
|
3126
4132
|
return o ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
|
|
3127
4133
|
}
|
|
@@ -3455,7 +4461,7 @@ class xt {
|
|
|
3455
4461
|
this.selectionType !== "none" && (this.allSelected = !1, this.selectionMode === "single" && (this.ranges = []), this.selectionType === "row" ? (e.c1 = 0, e.c2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "column" ? (e.r1 = 0, e.r2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "cell" ? (e.r2 = e.r1, e.c2 = e.c1) : this.selectionType, this.ranges.push(e), this.fireChangeEvent());
|
|
3456
4462
|
}
|
|
3457
4463
|
}
|
|
3458
|
-
class
|
|
4464
|
+
class vt {
|
|
3459
4465
|
constructor(e = "none") {
|
|
3460
4466
|
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1, this.listenerArr = [];
|
|
3461
4467
|
}
|
|
@@ -3493,11 +4499,11 @@ class Ct {
|
|
|
3493
4499
|
}
|
|
3494
4500
|
}
|
|
3495
4501
|
class De {
|
|
3496
|
-
constructor(e = new
|
|
4502
|
+
constructor(e = new k(
|
|
3497
4503
|
"❯",
|
|
3498
4504
|
"",
|
|
3499
4505
|
["gt-table-icon-expanded"]
|
|
3500
|
-
), t = new
|
|
4506
|
+
), t = new k(
|
|
3501
4507
|
"❯",
|
|
3502
4508
|
"transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",
|
|
3503
4509
|
["ge-table-icon-collapsed"]
|
|
@@ -3506,17 +4512,17 @@ class De {
|
|
|
3506
4512
|
}
|
|
3507
4513
|
// `⊖ `, `⊕ `;
|
|
3508
4514
|
}
|
|
3509
|
-
const
|
|
4515
|
+
const Ct = new xt(), At = new vt("cell");
|
|
3510
4516
|
class Fe {
|
|
3511
4517
|
constructor() {
|
|
3512
4518
|
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 = {
|
|
3513
4519
|
header: 34,
|
|
3514
4520
|
body: 34,
|
|
3515
4521
|
footer: 34
|
|
3516
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new Re(), this.headerGroupOptions = new De(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Me(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new wt(), this.getSelectionModel = () =>
|
|
4522
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new Re(), this.headerGroupOptions = new De(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Me(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new wt(), this.getSelectionModel = () => Ct, this.getFocusModel = () => At;
|
|
3517
4523
|
}
|
|
3518
4524
|
}
|
|
3519
|
-
const
|
|
4525
|
+
const W = class W {
|
|
3520
4526
|
/**
|
|
3521
4527
|
* Returns the content to be copied based on the provided table model, selection model, and focus model.
|
|
3522
4528
|
*
|
|
@@ -3539,9 +4545,9 @@ const H = class H {
|
|
|
3539
4545
|
const h = t.isSelected(n, c) ? e.getBodyModel().getTextValueAt(n, c) : "";
|
|
3540
4546
|
d.push(h);
|
|
3541
4547
|
}
|
|
3542
|
-
a.push(d.join(
|
|
4548
|
+
a.push(d.join(W.columnSeparatorChar));
|
|
3543
4549
|
}
|
|
3544
|
-
return o(a.join(
|
|
4550
|
+
return o(a.join(W.rowSeparatorChar));
|
|
3545
4551
|
}
|
|
3546
4552
|
}
|
|
3547
4553
|
if (s) {
|
|
@@ -3598,9 +4604,9 @@ const H = class H {
|
|
|
3598
4604
|
return t;
|
|
3599
4605
|
}
|
|
3600
4606
|
};
|
|
3601
|
-
|
|
4607
|
+
W.columnSeparatorChar = " ", W.rowSeparatorChar = `
|
|
3602
4608
|
`;
|
|
3603
|
-
let Y =
|
|
4609
|
+
let Y = W;
|
|
3604
4610
|
class Et {
|
|
3605
4611
|
constructor(e, t = 500) {
|
|
3606
4612
|
this.tableScope = e, this.debounceDelay = t, new ResizeObserver(qe(this.handleResize.bind(this), t)).observe(this.tableScope.hostElement);
|
|
@@ -3691,8 +4697,8 @@ class Rt {
|
|
|
3691
4697
|
let s = 0;
|
|
3692
4698
|
const o = [];
|
|
3693
4699
|
e.forEach((h, p) => {
|
|
3694
|
-
const
|
|
3695
|
-
b.set([80, 75, 3, 4], 0), f.setUint16(4, 20, !0), f.setUint16(6, 0, !0), f.setUint16(8, 0, !0), f.setUint16(10, 0, !0), f.setUint16(12, 0, !0), f.setUint32(14, 0, !0), f.setUint32(18, g.length, !0), f.setUint32(22, g.length, !0), f.setUint16(26,
|
|
4700
|
+
const m = new TextEncoder().encode(p), g = new TextEncoder().encode(h), b = new Uint8Array(30 + m.length), f = new DataView(b.buffer);
|
|
4701
|
+
b.set([80, 75, 3, 4], 0), f.setUint16(4, 20, !0), f.setUint16(6, 0, !0), f.setUint16(8, 0, !0), f.setUint16(10, 0, !0), f.setUint16(12, 0, !0), f.setUint32(14, 0, !0), f.setUint32(18, g.length, !0), f.setUint32(22, g.length, !0), f.setUint16(26, m.length, !0), f.setUint16(28, 0, !0), b.set(m, 30), t.push(b, g), o.push({
|
|
3696
4702
|
path: p,
|
|
3697
4703
|
offset: s,
|
|
3698
4704
|
contentSize: g.length
|
|
@@ -3700,8 +4706,8 @@ class Rt {
|
|
|
3700
4706
|
});
|
|
3701
4707
|
const i = s;
|
|
3702
4708
|
o.forEach((h) => {
|
|
3703
|
-
const p = new TextEncoder().encode(h.path),
|
|
3704
|
-
|
|
4709
|
+
const p = new TextEncoder().encode(h.path), m = new Uint8Array(46 + p.length), g = new DataView(m.buffer);
|
|
4710
|
+
m.set([80, 75, 1, 2], 0), g.setUint16(4, 20, !0), g.setUint16(6, 20, !0), g.setUint16(8, 0, !0), g.setUint16(10, 0, !0), g.setUint16(12, 0, !0), g.setUint16(14, 0, !0), g.setUint32(16, 0, !0), g.setUint32(20, h.contentSize, !0), g.setUint32(24, h.contentSize, !0), g.setUint16(28, p.length, !0), g.setUint16(30, 0, !0), g.setUint16(32, 0, !0), g.setUint16(34, 0, !0), g.setUint16(36, 0, !0), g.setUint32(38, 0, !0), g.setUint32(42, h.offset, !0), m.set(p, 46), t.push(m), s += m.length;
|
|
3705
4711
|
});
|
|
3706
4712
|
const r = new Uint8Array(22), a = new DataView(r.buffer);
|
|
3707
4713
|
r.set([80, 75, 5, 6], 0), a.setUint16(4, 0, !0), a.setUint16(6, 0, !0), a.setUint16(8, o.length, !0), a.setUint16(10, o.length, !0), a.setUint32(12, s - i, !0), a.setUint32(16, i, !0), a.setUint16(20, 0, !0), t.push(r);
|
|
@@ -4144,9 +5150,6 @@ class pe extends ht {
|
|
|
4144
5150
|
sort(e) {
|
|
4145
5151
|
this.tableModel.sort(e);
|
|
4146
5152
|
}
|
|
4147
|
-
getDisplayedRowCount() {
|
|
4148
|
-
return this.displayedRowCount;
|
|
4149
|
-
}
|
|
4150
5153
|
/**
|
|
4151
5154
|
* Ensures that a specific row is visible in the viewport by scrolling if necessary.
|
|
4152
5155
|
* This method checks if the target row is within the currently visible range and
|
|
@@ -4199,11 +5202,8 @@ class pe extends ht {
|
|
|
4199
5202
|
* @see {@link getDisplayedRowCount} - Related method for getting visible row count
|
|
4200
5203
|
*/
|
|
4201
5204
|
ensureRowIsVisible(e) {
|
|
4202
|
-
const t = this.
|
|
4203
|
-
return e < t ? (this.scrollToIndex(0, e
|
|
4204
|
-
}
|
|
4205
|
-
getFirstVisibleRowIndex() {
|
|
4206
|
-
return this.firstVisibleRowIndex;
|
|
5205
|
+
const t = this.getFirstFullVisibleRowIndex(), s = this.getLastFullVisibleRowIndex(), o = this.getDisplayedRowCount();
|
|
5206
|
+
return e < t ? (this.scrollToIndex(0, e), !0) : e > s ? (this.scrollToIndex(0, e - o + 1), !0) : !1;
|
|
4207
5207
|
}
|
|
4208
5208
|
}
|
|
4209
5209
|
const J = class J {
|
|
@@ -4491,7 +5491,7 @@ const Ft = (l) => {
|
|
|
4491
5491
|
tableModel: null,
|
|
4492
5492
|
tableOptions: new Fe()
|
|
4493
5493
|
}, l);
|
|
4494
|
-
return
|
|
5494
|
+
return Ve(() => {
|
|
4495
5495
|
const s = {
|
|
4496
5496
|
onSelectionChanged(r) {
|
|
4497
5497
|
const a = new CustomEvent("selectionChanged", {
|