@toolbox-web/grid 1.12.1 → 1.13.0
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/all.js +1160 -1012
- package/all.js.map +1 -1
- package/index.js +727 -736
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/sanitize.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/types.d.ts +4 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.d.ts +1 -1
- package/lib/plugins/editing/index.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +187 -170
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +44 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +9 -9
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +57 -56
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +40 -39
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +51 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +325 -131
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +18 -0
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +2 -0
- package/public.d.ts.map +1 -1
- package/themes/dg-theme-bootstrap.css +192 -8
- package/themes/dg-theme-material.css +243 -0
- package/umd/grid.all.umd.js +42 -42
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +19 -19
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ft, F as M, e as F, s as gt, c as pt, runAggregator as ie, a as et, b as tt, g as he, r as mt, getAggregator as ye, getValueAggregator as wt, d as xe, f as Ce } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Mn, DGEvents as Nn, DataGridElement as qn, FitModeEnum as Hn, GridCSSVars as Kn, GridClasses as zn, GridDataAttrs as On, DataGridElement as Gn, GridSelectors as Bn, PLUGIN_QUERIES as Vn, PluginEvents as Wn, PluginManager as $n, RenderPhase as jn, builtInSort as Un, createGrid as Yn, defaultComparator as Xn, queryGrid as Zn } from "./index.js";
|
|
3
|
+
const it = "__tbw_expander", bt = 32;
|
|
4
|
+
function te(a) {
|
|
5
|
+
return a.field === it;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function K(a) {
|
|
8
|
+
return a.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function vt(
|
|
11
|
-
return
|
|
10
|
+
function vt(a) {
|
|
11
|
+
return a.find(te);
|
|
12
12
|
}
|
|
13
|
-
function yt(
|
|
13
|
+
function yt(a) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: it,
|
|
16
16
|
header: "",
|
|
17
17
|
width: bt,
|
|
18
18
|
resizable: !1,
|
|
@@ -22,32 +22,32 @@ function yt(s) {
|
|
|
22
22
|
lockPosition: !0,
|
|
23
23
|
suppressMovable: !0,
|
|
24
24
|
expanderColumn: !0,
|
|
25
|
-
expanderPlugin:
|
|
25
|
+
expanderPlugin: a,
|
|
26
26
|
utility: !0
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function ne(a) {
|
|
31
31
|
try {
|
|
32
|
-
return await navigator.clipboard.writeText(
|
|
32
|
+
return await navigator.clipboard.writeText(a), !0;
|
|
33
33
|
} catch {
|
|
34
34
|
const e = document.createElement("textarea");
|
|
35
|
-
e.value =
|
|
35
|
+
e.value = a, e.style.position = "fixed", e.style.opacity = "0", e.style.pointerEvents = "none", document.body.appendChild(e), e.select();
|
|
36
36
|
const t = document.execCommand("copy");
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Ee(a, e) {
|
|
41
41
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
42
|
-
`, n =
|
|
42
|
+
`, n = a.replace(/\r\n/g, `
|
|
43
43
|
`).replace(/\r/g, `
|
|
44
44
|
`), r = [];
|
|
45
|
-
let o = [],
|
|
45
|
+
let o = [], s = "", l = !1;
|
|
46
46
|
for (let d = 0; d < n.length; d++) {
|
|
47
47
|
const c = n[d];
|
|
48
|
-
c === '"' && !l ? l = !0 : c === '"' && l ? n[d + 1] === '"' ? (
|
|
48
|
+
c === '"' && !l ? l = !0 : c === '"' && l ? n[d + 1] === '"' ? (s += '"', d++) : l = !1 : c === t && !l ? (o.push(s), s = "") : c === i && !l ? (o.push(s), s = "", (o.length > 1 || o.some((u) => u.trim() !== "")) && r.push(o), o = []) : s += c;
|
|
49
49
|
}
|
|
50
|
-
return o.push(
|
|
50
|
+
return o.push(s), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
|
|
51
51
|
}
|
|
52
52
|
async function xt() {
|
|
53
53
|
try {
|
|
@@ -56,10 +56,10 @@ async function xt() {
|
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function Ct(
|
|
60
|
-
const { rows: t, target: i, fields: n } =
|
|
59
|
+
function Ct(a, e) {
|
|
60
|
+
const { rows: t, target: i, fields: n } = a;
|
|
61
61
|
if (!i) return;
|
|
62
|
-
const r = e.rows, o = e.effectiveConfig.columns ?? [],
|
|
62
|
+
const r = e.rows, o = e.effectiveConfig.columns ?? [], s = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
63
63
|
o.forEach((u) => {
|
|
64
64
|
l.set(u.field, u.editable === !0);
|
|
65
65
|
});
|
|
@@ -72,7 +72,7 @@ function Ct(s, e) {
|
|
|
72
72
|
return;
|
|
73
73
|
} else for (; f >= d.length; ) {
|
|
74
74
|
const g = {};
|
|
75
|
-
|
|
75
|
+
s.forEach((p) => g[p] = ""), d.push(g);
|
|
76
76
|
}
|
|
77
77
|
d[f] = { ...d[f] }, u.forEach((g, p) => {
|
|
78
78
|
const w = n[p];
|
|
@@ -81,7 +81,7 @@ function Ct(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class mn extends _ {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -107,14 +107,14 @@ class pn extends _ {
|
|
|
107
107
|
this.lastCopied = null;
|
|
108
108
|
}
|
|
109
109
|
onKeyDown(e) {
|
|
110
|
-
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#
|
|
110
|
+
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#i(e.target), !0) : !1;
|
|
111
111
|
}
|
|
112
|
-
#
|
|
113
|
-
const t = this.#
|
|
112
|
+
#i(e) {
|
|
113
|
+
const t = this.#r(), i = this.columns.length - 1, n = this.rows.length - 1;
|
|
114
114
|
let r;
|
|
115
115
|
if (t && t.ranges.length > 0) {
|
|
116
|
-
const { mode:
|
|
117
|
-
|
|
116
|
+
const { mode: s, ranges: l } = t, d = l[l.length - 1];
|
|
117
|
+
s === "row" ? r = {
|
|
118
118
|
startRow: d.from.row,
|
|
119
119
|
startCol: 0,
|
|
120
120
|
endRow: d.to.row,
|
|
@@ -128,12 +128,12 @@ class pn extends _ {
|
|
|
128
128
|
} else if (!t)
|
|
129
129
|
r = { startRow: 0, startCol: 0, endRow: n, endCol: i };
|
|
130
130
|
else {
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
r = { startRow:
|
|
131
|
+
const s = this.#n(e);
|
|
132
|
+
if (!s) return;
|
|
133
|
+
r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
|
|
134
134
|
}
|
|
135
|
-
const o = this.#
|
|
136
|
-
|
|
135
|
+
const o = this.#t(r);
|
|
136
|
+
ne(o.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: o.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: o.text,
|
|
139
139
|
rowCount: o.rowCount,
|
|
@@ -145,9 +145,9 @@ class pn extends _ {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
149
|
-
for (let w = 0; w < g &&
|
|
150
|
-
const b = this.columns[
|
|
148
|
+
const i = Ee(t, this.config), n = this.#r(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
|
|
149
|
+
for (let w = 0; w < g && s + w <= c; w++) {
|
|
150
|
+
const b = this.columns[s + w];
|
|
151
151
|
b && !b.hidden && f.push(b.field);
|
|
152
152
|
}
|
|
153
153
|
const p = { rows: i, text: t, target: h, fields: f };
|
|
@@ -159,17 +159,17 @@ class pn extends _ {
|
|
|
159
159
|
if (t === null) return;
|
|
160
160
|
(t ?? Ct)(e, this.grid);
|
|
161
161
|
}
|
|
162
|
-
#
|
|
162
|
+
#r() {
|
|
163
163
|
return this.grid?.query("getSelection", void 0)?.[0];
|
|
164
164
|
}
|
|
165
|
-
#
|
|
166
|
-
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n),
|
|
167
|
-
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !
|
|
165
|
+
#t(e) {
|
|
166
|
+
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), s = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
167
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !K(g));
|
|
168
168
|
if (this.config.includeHeaders) {
|
|
169
169
|
const g = f.map((p) => p.header || p.field);
|
|
170
170
|
h.push(g.join(c));
|
|
171
171
|
}
|
|
172
|
-
for (let g = o; g <=
|
|
172
|
+
for (let g = o; g <= s; g++) {
|
|
173
173
|
const p = this.rows[g];
|
|
174
174
|
if (!p) continue;
|
|
175
175
|
const w = f.map((b) => {
|
|
@@ -180,7 +180,7 @@ class pn extends _ {
|
|
|
180
180
|
}
|
|
181
181
|
return {
|
|
182
182
|
text: h.join(u),
|
|
183
|
-
rowCount:
|
|
183
|
+
rowCount: s - o + 1,
|
|
184
184
|
columnCount: d - l + 1
|
|
185
185
|
};
|
|
186
186
|
}
|
|
@@ -191,11 +191,11 @@ class pn extends _ {
|
|
|
191
191
|
if (!i || !n) return null;
|
|
192
192
|
const r = parseInt(n, 10);
|
|
193
193
|
if (isNaN(r)) return null;
|
|
194
|
-
const o = this.columns.findIndex((
|
|
194
|
+
const o = this.columns.findIndex((s) => s.field === i);
|
|
195
195
|
return o === -1 ? null : { row: r, col: o };
|
|
196
196
|
}
|
|
197
197
|
async copy() {
|
|
198
|
-
const e = this.#
|
|
198
|
+
const e = this.#r(), t = this.columns.length - 1;
|
|
199
199
|
let i = { startRow: 0, startCol: 0, endRow: this.rows.length - 1, endCol: t };
|
|
200
200
|
if (e && e.ranges.length > 0) {
|
|
201
201
|
const r = e.ranges[e.ranges.length - 1];
|
|
@@ -206,59 +206,59 @@ class pn extends _ {
|
|
|
206
206
|
endCol: r.to.col
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
const n = this.#
|
|
210
|
-
return await
|
|
209
|
+
const n = this.#t(i);
|
|
210
|
+
return await ne(n.text), this.lastCopied = { text: n.text, timestamp: Date.now() }, n.text;
|
|
211
211
|
}
|
|
212
212
|
async copyRows(e) {
|
|
213
213
|
if (e.length === 0) return "";
|
|
214
|
-
const t = [...e].sort((o,
|
|
214
|
+
const t = [...e].sort((o, s) => o - s), i = this.columns.length - 1, n = {
|
|
215
215
|
startRow: t[0],
|
|
216
216
|
startCol: 0,
|
|
217
217
|
endRow: t[t.length - 1],
|
|
218
218
|
endCol: i
|
|
219
|
-
}, r = this.#
|
|
220
|
-
return await
|
|
219
|
+
}, r = this.#t(n);
|
|
220
|
+
return await ne(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
223
|
const e = await xt();
|
|
224
|
-
return e ?
|
|
224
|
+
return e ? Ee(e, this.config) : null;
|
|
225
225
|
}
|
|
226
226
|
getLastCopied() {
|
|
227
227
|
return this.lastCopied;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function me(
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
if (typeof
|
|
235
|
-
return
|
|
236
|
-
const e = parseFloat(
|
|
237
|
-
return isNaN(e) ?
|
|
230
|
+
const Re = 100;
|
|
231
|
+
function me(a) {
|
|
232
|
+
if (a == null)
|
|
233
|
+
return Re;
|
|
234
|
+
if (typeof a == "number")
|
|
235
|
+
return a;
|
|
236
|
+
const e = parseFloat(a);
|
|
237
|
+
return isNaN(e) ? Re : e;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return
|
|
239
|
+
function Se(a) {
|
|
240
|
+
return a.map((e) => me(e.width));
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function ke(a) {
|
|
243
243
|
const e = [];
|
|
244
244
|
let t = 0;
|
|
245
|
-
for (const i of
|
|
245
|
+
for (const i of a)
|
|
246
246
|
e.push(t), t += me(i.width);
|
|
247
247
|
return e;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
return
|
|
249
|
+
function Ae(a) {
|
|
250
|
+
return a.reduce((e, t) => e + me(t.width), 0);
|
|
251
251
|
}
|
|
252
|
-
function Et(
|
|
252
|
+
function Et(a, e, t, i, n) {
|
|
253
253
|
const r = t.length;
|
|
254
254
|
if (r === 0)
|
|
255
255
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
256
|
-
let o = Rt(
|
|
256
|
+
let o = Rt(a, t, i);
|
|
257
257
|
o = Math.max(0, o - n);
|
|
258
|
-
const
|
|
258
|
+
const s = a + e;
|
|
259
259
|
let l = o;
|
|
260
260
|
for (let c = o; c < r; c++) {
|
|
261
|
-
if (t[c] >=
|
|
261
|
+
if (t[c] >= s) {
|
|
262
262
|
l = c - 1;
|
|
263
263
|
break;
|
|
264
264
|
}
|
|
@@ -270,18 +270,18 @@ function Et(s, e, t, i, n) {
|
|
|
270
270
|
d.push(c);
|
|
271
271
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
272
272
|
}
|
|
273
|
-
function Rt(
|
|
273
|
+
function Rt(a, e, t) {
|
|
274
274
|
let i = 0, n = e.length - 1;
|
|
275
275
|
for (; i < n; ) {
|
|
276
276
|
const r = Math.floor((i + n) / 2);
|
|
277
|
-
e[r] + t[r] <=
|
|
277
|
+
e[r] + t[r] <= a ? i = r + 1 : n = r;
|
|
278
278
|
}
|
|
279
279
|
return i;
|
|
280
280
|
}
|
|
281
|
-
function St(
|
|
282
|
-
return t ?
|
|
281
|
+
function St(a, e, t) {
|
|
282
|
+
return t ? a > e : !1;
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class wn extends _ {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -301,12 +301,12 @@ class mn extends _ {
|
|
|
301
301
|
attach(e) {
|
|
302
302
|
super.attach(e);
|
|
303
303
|
const t = this.columns;
|
|
304
|
-
this.columnWidths =
|
|
304
|
+
this.columnWidths = Se(t), this.columnOffsets = ke(t), this.totalWidth = Ae(t), this.endCol = t.length - 1;
|
|
305
305
|
}
|
|
306
306
|
detach() {
|
|
307
|
-
this.#
|
|
307
|
+
this.#i(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
308
308
|
}
|
|
309
|
-
#
|
|
309
|
+
#i() {
|
|
310
310
|
const e = this.gridElement;
|
|
311
311
|
if (!e) return;
|
|
312
312
|
const t = e.querySelector(".header-row");
|
|
@@ -319,7 +319,7 @@ class mn extends _ {
|
|
|
319
319
|
r && (r.style.minWidth = "");
|
|
320
320
|
}
|
|
321
321
|
processColumns(e) {
|
|
322
|
-
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths =
|
|
322
|
+
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Se(e), this.columnOffsets = ke(e), this.totalWidth = Ae(e));
|
|
323
323
|
const i = this.originalColumns, n = St(
|
|
324
324
|
i.length,
|
|
325
325
|
this.config.threshold ?? 30,
|
|
@@ -334,15 +334,15 @@ class mn extends _ {
|
|
|
334
334
|
this.columnWidths,
|
|
335
335
|
this.config.overscan ?? 3
|
|
336
336
|
);
|
|
337
|
-
return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((
|
|
337
|
+
return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((s) => i[s]);
|
|
338
338
|
}
|
|
339
339
|
afterRender() {
|
|
340
340
|
if (!this.isVirtualized) return;
|
|
341
341
|
const e = this.gridElement;
|
|
342
342
|
if (!e) return;
|
|
343
343
|
const t = this.columnOffsets[this.startCol] ?? 0, i = e.querySelector(".header-row"), n = e.querySelectorAll(".data-grid-row");
|
|
344
|
-
i && (i.style.paddingLeft = `${t}px`, i.style.minWidth = `${this.totalWidth}px`), n.forEach((
|
|
345
|
-
|
|
344
|
+
i && (i.style.paddingLeft = `${t}px`, i.style.minWidth = `${this.totalWidth}px`), n.forEach((s) => {
|
|
345
|
+
s.style.paddingLeft = `${t}px`;
|
|
346
346
|
});
|
|
347
347
|
const r = e.querySelector(".rows-viewport .rows");
|
|
348
348
|
r && (r.style.width = `${this.totalWidth}px`);
|
|
@@ -369,17 +369,17 @@ class mn extends _ {
|
|
|
369
369
|
return this.totalWidth;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
const
|
|
373
|
-
function
|
|
374
|
-
return (typeof
|
|
372
|
+
const re = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
373
|
+
function fe(a, e) {
|
|
374
|
+
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
375
375
|
}
|
|
376
|
-
function kt(
|
|
377
|
-
return
|
|
376
|
+
function kt(a, e) {
|
|
377
|
+
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function ge(a, e, t, i = ft.submenuArrow) {
|
|
380
380
|
const n = document.createElement("div");
|
|
381
381
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
382
|
-
for (const r of
|
|
382
|
+
for (const r of a) {
|
|
383
383
|
if (r.separator) {
|
|
384
384
|
const d = document.createElement("div");
|
|
385
385
|
d.className = "tbw-context-menu-separator", d.setAttribute("role", "separator"), n.appendChild(d);
|
|
@@ -387,8 +387,8 @@ function fe(s, e, t, i = ht.submenuArrow) {
|
|
|
387
387
|
}
|
|
388
388
|
const o = document.createElement("div");
|
|
389
389
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
390
|
+
const s = kt(r, e);
|
|
391
|
+
if (s && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
392
392
|
const d = document.createElement("span");
|
|
393
393
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
394
394
|
}
|
|
@@ -401,49 +401,49 @@ function fe(s, e, t, i = ht.submenuArrow) {
|
|
|
401
401
|
const d = document.createElement("span");
|
|
402
402
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
403
403
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
404
|
-
const u =
|
|
404
|
+
const u = fe(r.subMenu, e), h = ge(u, e, t, i);
|
|
405
405
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
406
406
|
}), o.addEventListener("mouseleave", () => {
|
|
407
407
|
const c = o.querySelector(".tbw-context-menu");
|
|
408
408
|
c && c.remove();
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
|
-
!
|
|
411
|
+
!s && r.action && !r.subMenu && o.addEventListener("click", (d) => {
|
|
412
412
|
d.stopPropagation(), t(r);
|
|
413
413
|
}), n.appendChild(o);
|
|
414
414
|
}
|
|
415
415
|
return n;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
418
|
-
|
|
419
|
-
const i =
|
|
420
|
-
let o = e,
|
|
421
|
-
e + i.width > n && (o = e - i.width), t + i.height > r && (
|
|
417
|
+
function _e(a, e, t) {
|
|
418
|
+
a.style.position = "fixed", a.style.left = `${e}px`, a.style.top = `${t}px`, a.style.visibility = "hidden", a.style.zIndex = "10000";
|
|
419
|
+
const i = a.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
420
|
+
let o = e, s = t;
|
|
421
|
+
e + i.width > n && (o = e - i.width), t + i.height > r && (s = t - i.height), o = Math.max(0, o), s = Math.max(0, s), a.style.left = `${o}px`, a.style.top = `${s}px`, a.style.visibility = "visible";
|
|
422
422
|
}
|
|
423
|
-
let O = null, G = null, N = null,
|
|
424
|
-
const
|
|
423
|
+
let O = null, G = null, N = null, oe = 0;
|
|
424
|
+
const se = [
|
|
425
425
|
{
|
|
426
426
|
id: "copy",
|
|
427
427
|
name: "Copy",
|
|
428
428
|
shortcut: "Ctrl+C",
|
|
429
|
-
action: (
|
|
430
|
-
|
|
429
|
+
action: (a) => {
|
|
430
|
+
a.grid?.plugins?.clipboard?.copy?.();
|
|
431
431
|
}
|
|
432
432
|
},
|
|
433
433
|
{ separator: !0, id: "sep1", name: "" },
|
|
434
434
|
{
|
|
435
435
|
id: "export-csv",
|
|
436
436
|
name: "Export CSV",
|
|
437
|
-
action: (
|
|
438
|
-
|
|
437
|
+
action: (a) => {
|
|
438
|
+
a.grid?.plugins?.export?.exportCsv?.();
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
];
|
|
442
|
-
class
|
|
442
|
+
class nt extends _ {
|
|
443
443
|
name = "contextMenu";
|
|
444
444
|
get defaultConfig() {
|
|
445
445
|
return {
|
|
446
|
-
items:
|
|
446
|
+
items: se
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
449
|
isOpen = !1;
|
|
@@ -451,7 +451,7 @@ class it extends _ {
|
|
|
451
451
|
params = null;
|
|
452
452
|
menuElement = null;
|
|
453
453
|
attach(e) {
|
|
454
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
454
|
+
super.attach(e), this.installGlobalHandlers(), oe++;
|
|
455
455
|
}
|
|
456
456
|
detach() {
|
|
457
457
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
@@ -496,9 +496,9 @@ class it extends _ {
|
|
|
496
496
|
if (!t) return;
|
|
497
497
|
const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
|
|
498
498
|
r && n.push(`color-scheme: ${r}`);
|
|
499
|
-
for (const o of
|
|
500
|
-
const
|
|
501
|
-
|
|
499
|
+
for (const o of nt.CSS_VARS_TO_COPY) {
|
|
500
|
+
const s = i.getPropertyValue(o).trim();
|
|
501
|
+
s && n.push(`${o}: ${s}`);
|
|
502
502
|
}
|
|
503
503
|
if (n.length > 0) {
|
|
504
504
|
const o = e.getAttribute("style") || "";
|
|
@@ -506,14 +506,14 @@ class it extends _ {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
installGlobalHandlers() {
|
|
509
|
-
!N && typeof document < "u" && typeof
|
|
509
|
+
!N && typeof document < "u" && typeof re == "string" && re && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = re, document.head.appendChild(N)), O || (O = () => {
|
|
510
510
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
511
511
|
}, document.addEventListener("click", O)), G || (G = (e) => {
|
|
512
512
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
513
513
|
}, document.addEventListener("keydown", G));
|
|
514
514
|
}
|
|
515
515
|
uninstallGlobalHandlers() {
|
|
516
|
-
|
|
516
|
+
oe--, !(oe > 0) && (O && (document.removeEventListener("click", O), O = null), G && (document.removeEventListener("keydown", G), G = null), N && (N.remove(), N = null));
|
|
517
517
|
}
|
|
518
518
|
afterRender() {
|
|
519
519
|
const e = this.gridElement;
|
|
@@ -522,7 +522,7 @@ class it extends _ {
|
|
|
522
522
|
t && t.getAttribute("data-context-menu-bound") !== "true" && (t.setAttribute("data-context-menu-bound", "true"), t.addEventListener("contextmenu", (i) => {
|
|
523
523
|
const n = i;
|
|
524
524
|
n.preventDefault();
|
|
525
|
-
const r = n.target, o = r.closest("[data-row][data-col]"),
|
|
525
|
+
const r = n.target, o = r.closest("[data-row][data-col]"), s = r.closest(".header-cell");
|
|
526
526
|
let l;
|
|
527
527
|
if (o) {
|
|
528
528
|
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
|
|
@@ -536,8 +536,8 @@ class it extends _ {
|
|
|
536
536
|
isHeader: !1,
|
|
537
537
|
event: n
|
|
538
538
|
};
|
|
539
|
-
} else if (
|
|
540
|
-
const c = parseInt(
|
|
539
|
+
} else if (s) {
|
|
540
|
+
const c = parseInt(s.getAttribute("data-col") ?? "-1", 10), u = this.columns[c];
|
|
541
541
|
l = {
|
|
542
542
|
row: null,
|
|
543
543
|
rowIndex: -1,
|
|
@@ -551,15 +551,15 @@ class it extends _ {
|
|
|
551
551
|
} else
|
|
552
552
|
return;
|
|
553
553
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
554
|
-
const d =
|
|
555
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
554
|
+
const d = fe(this.config.items ?? se, l);
|
|
555
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
556
556
|
d,
|
|
557
557
|
l,
|
|
558
558
|
(c) => {
|
|
559
559
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
560
560
|
},
|
|
561
561
|
this.gridIcons.submenuArrow
|
|
562
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
562
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), _e(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
563
563
|
}));
|
|
564
564
|
}
|
|
565
565
|
showMenu(e, t, i) {
|
|
@@ -572,15 +572,15 @@ class it extends _ {
|
|
|
572
572
|
value: i.value ?? null,
|
|
573
573
|
isHeader: i.isHeader ?? !1,
|
|
574
574
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
575
|
-
}, r =
|
|
576
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
575
|
+
}, r = fe(this.config.items ?? se, n);
|
|
576
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
577
577
|
r,
|
|
578
578
|
n,
|
|
579
579
|
(o) => {
|
|
580
580
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
581
581
|
},
|
|
582
582
|
this.gridIcons.submenuArrow
|
|
583
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
583
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), _e(this.menuElement, e, t), this.isOpen = !0;
|
|
584
584
|
}
|
|
585
585
|
hideMenu() {
|
|
586
586
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -590,13 +590,13 @@ class it extends _ {
|
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
const At = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;&:not(.tbw-grid-mode) .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171);.data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}}";
|
|
593
|
-
function _t(
|
|
594
|
-
const e =
|
|
593
|
+
function _t(a) {
|
|
594
|
+
const e = a.options;
|
|
595
595
|
return e ? typeof e == "function" ? e() : e : [];
|
|
596
596
|
}
|
|
597
|
-
function Tt(
|
|
597
|
+
function Tt(a) {
|
|
598
598
|
return (e) => {
|
|
599
|
-
const t =
|
|
599
|
+
const t = a.editorParams, i = document.createElement("input");
|
|
600
600
|
i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
|
|
601
601
|
const n = () => e.commit(i.value === "" ? null : Number(i.value));
|
|
602
602
|
return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
|
|
@@ -605,14 +605,14 @@ function Tt(s) {
|
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
607
|
function Lt() {
|
|
608
|
-
return (
|
|
608
|
+
return (a) => {
|
|
609
609
|
const e = document.createElement("input");
|
|
610
|
-
return e.type = "checkbox", e.checked = !!
|
|
610
|
+
return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
|
-
function It(
|
|
613
|
+
function It(a) {
|
|
614
614
|
return (e) => {
|
|
615
|
-
const t =
|
|
615
|
+
const t = a.editorParams, i = document.createElement("input");
|
|
616
616
|
i.type = "date", e.value instanceof Date ? i.valueAsDate = e.value : typeof e.value == "string" && e.value && (i.value = e.value.split("T")[0]), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder);
|
|
617
617
|
const n = () => {
|
|
618
618
|
typeof e.value == "string" ? e.commit(i.value) : e.commit(i.valueAsDate);
|
|
@@ -622,20 +622,20 @@ function It(s) {
|
|
|
622
622
|
}), i;
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function Ft(
|
|
625
|
+
function Ft(a) {
|
|
626
626
|
return (e) => {
|
|
627
|
-
const t =
|
|
628
|
-
if (
|
|
627
|
+
const t = a.editorParams, i = document.createElement("select");
|
|
628
|
+
if (a.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
629
629
|
const o = document.createElement("option");
|
|
630
630
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
631
631
|
}
|
|
632
|
-
_t(
|
|
633
|
-
const
|
|
634
|
-
|
|
632
|
+
_t(a).forEach((o) => {
|
|
633
|
+
const s = document.createElement("option");
|
|
634
|
+
s.value = String(o.value), s.textContent = o.label, (a.multi && Array.isArray(e.value) && e.value.includes(o.value) || !a.multi && e.value === o.value) && (s.selected = !0), i.appendChild(s);
|
|
635
635
|
});
|
|
636
636
|
const r = () => {
|
|
637
|
-
if (
|
|
638
|
-
const o = Array.from(i.selectedOptions).map((
|
|
637
|
+
if (a.multi) {
|
|
638
|
+
const o = Array.from(i.selectedOptions).map((s) => s.value);
|
|
639
639
|
e.commit(o);
|
|
640
640
|
} else
|
|
641
641
|
e.commit(i.value);
|
|
@@ -645,69 +645,69 @@ function Ft(s) {
|
|
|
645
645
|
}), i;
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
|
-
function Pt(
|
|
648
|
+
function Pt(a) {
|
|
649
649
|
return (e) => {
|
|
650
|
-
const t =
|
|
650
|
+
const t = a.editorParams, i = document.createElement("input");
|
|
651
651
|
i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder);
|
|
652
652
|
const n = () => {
|
|
653
653
|
const r = i.value;
|
|
654
|
-
typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r);
|
|
654
|
+
(e.value === null || e.value === void 0) && r === "" || typeof e.value == "string" && r === e.value.replace(/[\n\r]/g, "") || (typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r));
|
|
655
655
|
};
|
|
656
656
|
return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
|
|
657
657
|
r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
|
|
658
658
|
}), i;
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
|
-
function Dt(
|
|
662
|
-
switch (
|
|
661
|
+
function Dt(a) {
|
|
662
|
+
switch (a.type) {
|
|
663
663
|
case "number":
|
|
664
|
-
return Tt(
|
|
664
|
+
return Tt(a);
|
|
665
665
|
case "boolean":
|
|
666
666
|
return Lt();
|
|
667
667
|
case "date":
|
|
668
|
-
return It(
|
|
668
|
+
return It(a);
|
|
669
669
|
case "select":
|
|
670
|
-
return Ft(
|
|
670
|
+
return Ft(a);
|
|
671
671
|
default:
|
|
672
|
-
return Pt(
|
|
672
|
+
return Pt(a);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function Mt(
|
|
675
|
+
function Mt(a, e) {
|
|
676
676
|
if (e.editor) return e.editor;
|
|
677
677
|
if (e.__editorTemplate) return "template";
|
|
678
678
|
if (!e.type) return;
|
|
679
|
-
const i =
|
|
679
|
+
const i = a.effectiveConfig?.typeDefaults;
|
|
680
680
|
if (i?.[e.type]?.editor)
|
|
681
681
|
return i[e.type].editor;
|
|
682
|
-
const n =
|
|
682
|
+
const n = a.__frameworkAdapter;
|
|
683
683
|
if (n?.getTypeDefault) {
|
|
684
684
|
const r = n.getTypeDefault(e.type);
|
|
685
685
|
if (r?.editor)
|
|
686
686
|
return r.editor;
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
function U(
|
|
690
|
-
return !(typeof
|
|
689
|
+
function U(a) {
|
|
690
|
+
return !(typeof a != "string" || a === "__proto__" || a === "constructor" || a === "prototype");
|
|
691
691
|
}
|
|
692
|
-
function Nt(
|
|
693
|
-
const e = (
|
|
694
|
-
|
|
692
|
+
function Nt(a) {
|
|
693
|
+
const e = (a.__editingCellCount ?? 0) + 1;
|
|
694
|
+
a.__editingCellCount = e, a.setAttribute("data-has-editing", "");
|
|
695
695
|
}
|
|
696
|
-
function qt(
|
|
697
|
-
|
|
696
|
+
function qt(a) {
|
|
697
|
+
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
698
698
|
}
|
|
699
|
-
function W(
|
|
700
|
-
return
|
|
699
|
+
function W(a, e, t) {
|
|
700
|
+
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" || typeof t == "string" && a.value === t.replace(/[\n\r]/g, "") ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function Te(a) {
|
|
703
703
|
}
|
|
704
|
-
function Ht(
|
|
705
|
-
const n =
|
|
704
|
+
function Ht(a, e, t, i) {
|
|
705
|
+
const n = a.querySelector("input,textarea,select");
|
|
706
706
|
n && (n.addEventListener("blur", () => {
|
|
707
707
|
t(W(n, e, i));
|
|
708
708
|
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(W(n, e, i))));
|
|
709
709
|
}
|
|
710
|
-
class
|
|
710
|
+
class bn extends _ {
|
|
711
711
|
static manifest = {
|
|
712
712
|
ownedProperties: [
|
|
713
713
|
{
|
|
@@ -748,17 +748,17 @@ class wn extends _ {
|
|
|
748
748
|
editOn: "click"
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
get #
|
|
751
|
+
get #i() {
|
|
752
752
|
return this.config.mode === "grid";
|
|
753
753
|
}
|
|
754
754
|
#e = -1;
|
|
755
755
|
#s = -1;
|
|
756
|
-
#
|
|
757
|
-
#
|
|
756
|
+
#r = /* @__PURE__ */ new Map();
|
|
757
|
+
#t = /* @__PURE__ */ new Set();
|
|
758
758
|
#n = /* @__PURE__ */ new Set();
|
|
759
759
|
#u = !1;
|
|
760
760
|
#l = -1;
|
|
761
|
-
#
|
|
761
|
+
#o = /* @__PURE__ */ new Map();
|
|
762
762
|
#d = !1;
|
|
763
763
|
#f = !1;
|
|
764
764
|
attach(e) {
|
|
@@ -775,7 +775,7 @@ class wn extends _ {
|
|
|
775
775
|
}, document.addEventListener(
|
|
776
776
|
"keydown",
|
|
777
777
|
(n) => {
|
|
778
|
-
if (!this.#
|
|
778
|
+
if (!this.#i && n.key === "Escape" && this.#e !== -1) {
|
|
779
779
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
780
780
|
return;
|
|
781
781
|
this.#a(this.#e, !0);
|
|
@@ -785,14 +785,14 @@ class wn extends _ {
|
|
|
785
785
|
), document.addEventListener(
|
|
786
786
|
"mousedown",
|
|
787
787
|
(n) => {
|
|
788
|
-
if (this.#
|
|
788
|
+
if (this.#i || this.#e === -1) return;
|
|
789
789
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
790
790
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
|
|
791
791
|
this.#e !== -1 && this.#a(this.#e, !1);
|
|
792
792
|
});
|
|
793
793
|
},
|
|
794
794
|
{ signal: t }
|
|
795
|
-
), this.#
|
|
795
|
+
), this.#i && (this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
|
|
796
796
|
"focusin",
|
|
797
797
|
(n) => {
|
|
798
798
|
const r = n.target;
|
|
@@ -830,40 +830,40 @@ class wn extends _ {
|
|
|
830
830
|
));
|
|
831
831
|
}
|
|
832
832
|
detach() {
|
|
833
|
-
this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#s = -1, this.#
|
|
833
|
+
this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#s = -1, this.#r.clear(), this.#t.clear(), this.#n.clear(), this.#d = !1, this.#f = !1, super.detach();
|
|
834
834
|
}
|
|
835
835
|
handleQuery(e) {
|
|
836
836
|
if (e.type === "isEditing")
|
|
837
|
-
return this.#
|
|
837
|
+
return this.#i || this.#e !== -1;
|
|
838
838
|
}
|
|
839
839
|
onCellClick(e) {
|
|
840
|
-
if (this.#
|
|
840
|
+
if (this.#i) return !1;
|
|
841
841
|
const t = this.grid, i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
842
842
|
if (i === !1 || i === "manual" || i !== "click" && i !== "dblclick") return !1;
|
|
843
843
|
const n = e.originalEvent.type === "dblclick";
|
|
844
844
|
if (i === "click" && n || i === "dblclick" && !n) return !1;
|
|
845
845
|
const { rowIndex: r } = e;
|
|
846
|
-
return t._columns?.some((
|
|
846
|
+
return t._columns?.some((s) => s.editable) ? (e.originalEvent.stopPropagation(), this.beginBulkEdit(r), !0) : !1;
|
|
847
847
|
}
|
|
848
848
|
onKeyDown(e) {
|
|
849
849
|
const t = this.grid;
|
|
850
850
|
if (e.key === "Escape") {
|
|
851
|
-
if (this.#
|
|
851
|
+
if (this.#i && this.#d) {
|
|
852
852
|
const i = document.activeElement;
|
|
853
853
|
return i && this.gridElement.contains(i) && i.blur(), this.#d = !1, this.requestAfterRender(), !0;
|
|
854
854
|
}
|
|
855
|
-
if (this.#e !== -1 && !this.#
|
|
855
|
+
if (this.#e !== -1 && !this.#i)
|
|
856
856
|
return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#a(this.#e, !0), !0;
|
|
857
857
|
}
|
|
858
|
-
if (this.#
|
|
858
|
+
if (this.#i && !this.#d && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
|
|
859
859
|
return !1;
|
|
860
|
-
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#
|
|
860
|
+
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#i) {
|
|
861
861
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
862
862
|
return !0;
|
|
863
863
|
const i = t._rows.length - 1, n = this.#e;
|
|
864
864
|
return this.#a(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), F(t), this.requestAfterRender(), !0;
|
|
865
865
|
}
|
|
866
|
-
if (e.key === "Tab" && (this.#e !== -1 || this.#
|
|
866
|
+
if (e.key === "Tab" && (this.#e !== -1 || this.#i)) {
|
|
867
867
|
e.preventDefault();
|
|
868
868
|
const i = !e.shiftKey;
|
|
869
869
|
return this.#w(i), !0;
|
|
@@ -875,9 +875,9 @@ class wn extends _ {
|
|
|
875
875
|
if (i >= 0 && n >= 0) {
|
|
876
876
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
877
877
|
if (r?.editable && r.type === "boolean" && o) {
|
|
878
|
-
const
|
|
879
|
-
if (U(
|
|
880
|
-
const d = !o[
|
|
878
|
+
const s = r.field;
|
|
879
|
+
if (U(s)) {
|
|
880
|
+
const d = !o[s];
|
|
881
881
|
return this.#b(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
882
882
|
}
|
|
883
883
|
}
|
|
@@ -885,15 +885,15 @@ class wn extends _ {
|
|
|
885
885
|
return !1;
|
|
886
886
|
}
|
|
887
887
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
888
|
-
if (this.#
|
|
888
|
+
if (this.#i && !this.#d)
|
|
889
889
|
return this.#h(), !0;
|
|
890
890
|
if (this.#e !== -1)
|
|
891
891
|
return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
|
|
892
892
|
const i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
893
893
|
if (i === !1 || i === "manual") return !1;
|
|
894
894
|
const n = t._focusRow, r = t._focusCol;
|
|
895
|
-
if (n >= 0 && t._columns?.some((
|
|
896
|
-
const
|
|
895
|
+
if (n >= 0 && t._columns?.some((s) => s.editable)) {
|
|
896
|
+
const s = t._visibleColumns[r], l = t._rows[n], d = s?.field ?? "", c = d && l ? l[d] : void 0, u = this.gridElement.querySelector(`[data-row="${n}"][data-col="${r}"]`), h = new CustomEvent("cell-activate", {
|
|
897
897
|
cancelable: !0,
|
|
898
898
|
bubbles: !0,
|
|
899
899
|
detail: {
|
|
@@ -925,8 +925,8 @@ class wn extends _ {
|
|
|
925
925
|
if (!r.type) return r;
|
|
926
926
|
let o;
|
|
927
927
|
if (i?.[r.type]?.editorParams && (o = i[r.type].editorParams), !o && n?.getTypeDefault) {
|
|
928
|
-
const
|
|
929
|
-
|
|
928
|
+
const s = n.getTypeDefault(r.type);
|
|
929
|
+
s?.editorParams && (o = s.editorParams);
|
|
930
930
|
}
|
|
931
931
|
return o ? {
|
|
932
932
|
...r,
|
|
@@ -940,18 +940,18 @@ class wn extends _ {
|
|
|
940
940
|
const t = this.#l;
|
|
941
941
|
this.#l = -1, e.animateRow?.(t, "change");
|
|
942
942
|
}
|
|
943
|
-
if (!this.#
|
|
943
|
+
if (!this.#i && this.#n.size !== 0)
|
|
944
944
|
for (const t of this.#n) {
|
|
945
|
-
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10),
|
|
946
|
-
if (!
|
|
947
|
-
const l =
|
|
945
|
+
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
946
|
+
if (!s) continue;
|
|
947
|
+
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
948
948
|
if (!l || l.classList.contains("editing")) continue;
|
|
949
949
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
950
950
|
d && c && this.#m(d, r, c, o, l, !0);
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
953
|
afterCellRender(e) {
|
|
954
|
-
if (!this.#
|
|
954
|
+
if (!this.#i) return;
|
|
955
955
|
const { row: t, rowIndex: i, column: n, colIndex: r, cellElement: o } = e;
|
|
956
956
|
n.editable && (o.classList.contains("editing") || this.#m(t, i, n, r, o, !0));
|
|
957
957
|
}
|
|
@@ -960,14 +960,14 @@ class wn extends _ {
|
|
|
960
960
|
}
|
|
961
961
|
get changedRows() {
|
|
962
962
|
const e = [];
|
|
963
|
-
for (const t of this.#
|
|
963
|
+
for (const t of this.#t) {
|
|
964
964
|
const i = this.grid.getRow(t);
|
|
965
965
|
i && e.push(i);
|
|
966
966
|
}
|
|
967
967
|
return e;
|
|
968
968
|
}
|
|
969
969
|
get changedRowIds() {
|
|
970
|
-
return Array.from(this.#
|
|
970
|
+
return Array.from(this.#t);
|
|
971
971
|
}
|
|
972
972
|
get activeEditRow() {
|
|
973
973
|
return this.#e;
|
|
@@ -986,94 +986,94 @@ class wn extends _ {
|
|
|
986
986
|
if (!i) return !1;
|
|
987
987
|
try {
|
|
988
988
|
const n = t.getRowId?.(i);
|
|
989
|
-
return n ? this.#
|
|
989
|
+
return n ? this.#t.has(n) : !1;
|
|
990
990
|
} catch {
|
|
991
991
|
return !1;
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
994
|
isRowChangedById(e) {
|
|
995
|
-
return this.#
|
|
995
|
+
return this.#t.has(e);
|
|
996
996
|
}
|
|
997
997
|
setInvalid(e, t, i = "") {
|
|
998
|
-
let n = this.#
|
|
999
|
-
n || (n = /* @__PURE__ */ new Map(), this.#
|
|
998
|
+
let n = this.#o.get(e);
|
|
999
|
+
n || (n = /* @__PURE__ */ new Map(), this.#o.set(e, n)), n.set(t, i), this.#p(e, t, !0);
|
|
1000
1000
|
}
|
|
1001
1001
|
clearInvalid(e, t) {
|
|
1002
|
-
const i = this.#
|
|
1003
|
-
i && (i.delete(t), i.size === 0 && this.#
|
|
1002
|
+
const i = this.#o.get(e);
|
|
1003
|
+
i && (i.delete(t), i.size === 0 && this.#o.delete(e)), this.#p(e, t, !1);
|
|
1004
1004
|
}
|
|
1005
1005
|
clearRowInvalid(e) {
|
|
1006
|
-
const t = this.#
|
|
1006
|
+
const t = this.#o.get(e);
|
|
1007
1007
|
if (t) {
|
|
1008
1008
|
const i = Array.from(t.keys());
|
|
1009
|
-
this.#
|
|
1009
|
+
this.#o.delete(e), i.forEach((n) => this.#p(e, n, !1));
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
1012
|
clearAllInvalid() {
|
|
1013
|
-
const e = Array.from(this.#
|
|
1014
|
-
this.#
|
|
1013
|
+
const e = Array.from(this.#o.entries());
|
|
1014
|
+
this.#o.clear(), e.forEach(([t, i]) => {
|
|
1015
1015
|
i.forEach((n, r) => this.#p(t, r, !1));
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
isCellInvalid(e, t) {
|
|
1019
|
-
return this.#
|
|
1019
|
+
return this.#o.get(e)?.has(t) ?? !1;
|
|
1020
1020
|
}
|
|
1021
1021
|
getInvalidMessage(e, t) {
|
|
1022
|
-
return this.#
|
|
1022
|
+
return this.#o.get(e)?.get(t);
|
|
1023
1023
|
}
|
|
1024
1024
|
hasInvalidCells(e) {
|
|
1025
|
-
const t = this.#
|
|
1025
|
+
const t = this.#o.get(e);
|
|
1026
1026
|
return t ? t.size > 0 : !1;
|
|
1027
1027
|
}
|
|
1028
1028
|
getInvalidFields(e) {
|
|
1029
|
-
return new Map(this.#
|
|
1029
|
+
return new Map(this.#o.get(e) ?? []);
|
|
1030
1030
|
}
|
|
1031
1031
|
#p(e, t, i) {
|
|
1032
1032
|
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
1033
1033
|
if (r === -1 || r === void 0) return;
|
|
1034
|
-
const
|
|
1034
|
+
const s = n._rows?.findIndex((c) => {
|
|
1035
1035
|
try {
|
|
1036
1036
|
return n.getRowId?.(c) === e;
|
|
1037
1037
|
} catch {
|
|
1038
1038
|
return !1;
|
|
1039
1039
|
}
|
|
1040
1040
|
});
|
|
1041
|
-
if (
|
|
1042
|
-
const d = n.findRenderedRowElement?.(
|
|
1041
|
+
if (s === -1 || s === void 0) return;
|
|
1042
|
+
const d = n.findRenderedRowElement?.(s)?.querySelector(`.cell[data-col="${r}"]`);
|
|
1043
1043
|
if (d)
|
|
1044
1044
|
if (i) {
|
|
1045
1045
|
d.setAttribute("data-invalid", "true");
|
|
1046
|
-
const c = this.#
|
|
1046
|
+
const c = this.#o.get(e)?.get(t);
|
|
1047
1047
|
c && d.setAttribute("title", c);
|
|
1048
1048
|
} else
|
|
1049
1049
|
d.removeAttribute("data-invalid"), d.removeAttribute("title");
|
|
1050
1050
|
}
|
|
1051
1051
|
resetChangedRows(e) {
|
|
1052
1052
|
const t = this.changedRows, i = this.changedRowIds;
|
|
1053
|
-
this.#
|
|
1053
|
+
this.#t.clear(), this.#c(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
1054
1054
|
}
|
|
1055
1055
|
beginCellEdit(e, t) {
|
|
1056
1056
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
1057
1057
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1058
|
+
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
1059
|
+
s && this.#v(e, n, s);
|
|
1060
1060
|
}
|
|
1061
1061
|
beginBulkEdit(e) {
|
|
1062
1062
|
const t = this.grid;
|
|
1063
|
-
if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((
|
|
1063
|
+
if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((s) => s.editable)) return;
|
|
1064
1064
|
const r = t.findRenderedRowElement?.(e);
|
|
1065
1065
|
if (!r) return;
|
|
1066
1066
|
const o = t._rows[e];
|
|
1067
|
-
this.#g(e, o), Array.from(r.children).forEach((
|
|
1067
|
+
this.#g(e, o), Array.from(r.children).forEach((s, l) => {
|
|
1068
1068
|
const d = t._visibleColumns[l];
|
|
1069
1069
|
if (d?.editable) {
|
|
1070
|
-
const c =
|
|
1070
|
+
const c = s;
|
|
1071
1071
|
c.classList.contains("editing") || this.#m(o, e, d, l, c, !0);
|
|
1072
1072
|
}
|
|
1073
1073
|
}), setTimeout(() => {
|
|
1074
|
-
let
|
|
1075
|
-
if (
|
|
1076
|
-
const l =
|
|
1074
|
+
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1075
|
+
if (s?.classList.contains("editing") || (s = r.querySelector(".cell.editing")), s?.classList.contains("editing")) {
|
|
1076
|
+
const l = s.querySelector(M);
|
|
1077
1077
|
try {
|
|
1078
1078
|
l?.focus({ preventScroll: !0 });
|
|
1079
1079
|
} catch {
|
|
@@ -1101,35 +1101,47 @@ class wn extends _ {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
#w(e) {
|
|
1104
|
-
const t = this.grid, i = t._rows, n = this.#
|
|
1104
|
+
const t = this.grid, i = t._rows, n = this.#i ? t._focusRow : this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
|
|
1105
1105
|
if (r.length === 0) return;
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1108
|
-
t._focusCol = r[
|
|
1109
|
-
const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[
|
|
1106
|
+
const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
|
|
1107
|
+
if (s >= 0 && s < r.length) {
|
|
1108
|
+
t._focusCol = r[s];
|
|
1109
|
+
const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[s]}"]`);
|
|
1110
1110
|
c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 }), F(t, { forceHorizontalScroll: !0 });
|
|
1111
1111
|
return;
|
|
1112
1112
|
}
|
|
1113
1113
|
const l = n + (e ? 1 : -1);
|
|
1114
|
-
l >= 0 && l < i.length && (this.#
|
|
1114
|
+
l >= 0 && l < i.length && (this.#i ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], F(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
|
|
1115
1115
|
const c = t.findRenderedRowElement?.(l)?.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1116
1116
|
c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 });
|
|
1117
1117
|
}, 0)) : (this.#a(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), F(t, { forceHorizontalScroll: !0 })));
|
|
1118
1118
|
}
|
|
1119
1119
|
#c() {
|
|
1120
1120
|
const e = this.grid;
|
|
1121
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1121
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#r;
|
|
1122
1122
|
}
|
|
1123
1123
|
#g(e, t) {
|
|
1124
|
-
this.#e !== e && (this.#
|
|
1124
|
+
if (this.#e !== e && (this.#r.set(e, { ...t }), this.#e = e, this.#c(), !this.#i)) {
|
|
1125
|
+
const i = this.grid;
|
|
1126
|
+
let n = "";
|
|
1127
|
+
try {
|
|
1128
|
+
n = i.getRowId?.(t) ?? "";
|
|
1129
|
+
} catch {
|
|
1130
|
+
}
|
|
1131
|
+
this.emit("edit-open", {
|
|
1132
|
+
rowIndex: e,
|
|
1133
|
+
rowId: n,
|
|
1134
|
+
row: t
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1125
1137
|
}
|
|
1126
1138
|
#a(e, t) {
|
|
1127
1139
|
if (this.#e !== e) return;
|
|
1128
|
-
const i = this.grid, n = this.#
|
|
1129
|
-
let
|
|
1140
|
+
const i = this.grid, n = this.#r.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
1141
|
+
let s;
|
|
1130
1142
|
if (r)
|
|
1131
1143
|
try {
|
|
1132
|
-
|
|
1144
|
+
s = i.getRowId?.(r);
|
|
1133
1145
|
} catch {
|
|
1134
1146
|
}
|
|
1135
1147
|
if (!t && o && r && o.querySelectorAll(".cell.editing").forEach((d) => {
|
|
@@ -1146,11 +1158,11 @@ class wn extends _ {
|
|
|
1146
1158
|
}), t && n && r)
|
|
1147
1159
|
Object.keys(n).forEach((l) => {
|
|
1148
1160
|
r[l] = n[l];
|
|
1149
|
-
}),
|
|
1161
|
+
}), s && (this.#t.delete(s), this.clearRowInvalid(s));
|
|
1150
1162
|
else if (!t && r) {
|
|
1151
|
-
const l = this.#C(n, r), d =
|
|
1163
|
+
const l = this.#C(n, r), d = s ? this.#t.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
1152
1164
|
rowIndex: e,
|
|
1153
|
-
rowId:
|
|
1165
|
+
rowId: s ?? "",
|
|
1154
1166
|
row: r,
|
|
1155
1167
|
oldValue: n,
|
|
1156
1168
|
newValue: r,
|
|
@@ -1160,27 +1172,32 @@ class wn extends _ {
|
|
|
1160
1172
|
});
|
|
1161
1173
|
c && n ? (Object.keys(n).forEach((u) => {
|
|
1162
1174
|
r[u] = n[u];
|
|
1163
|
-
}),
|
|
1175
|
+
}), s && (this.#t.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#l = e);
|
|
1164
1176
|
}
|
|
1165
|
-
this.#
|
|
1177
|
+
this.#r.delete(e), this.#e = -1, this.#s = -1, this.#c();
|
|
1166
1178
|
for (const l of this.#n)
|
|
1167
1179
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
1168
1180
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
1169
1181
|
l.classList.remove("editing"), qt(l.parentElement);
|
|
1170
|
-
}), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1)
|
|
1182
|
+
}), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1), !this.#i && r && this.emit("edit-close", {
|
|
1183
|
+
rowIndex: e,
|
|
1184
|
+
rowId: s ?? "",
|
|
1185
|
+
row: r,
|
|
1186
|
+
reverted: t
|
|
1187
|
+
});
|
|
1171
1188
|
}
|
|
1172
1189
|
#b(e, t, i, n) {
|
|
1173
1190
|
const r = t.field;
|
|
1174
1191
|
if (!U(r)) return;
|
|
1175
1192
|
const o = n[r];
|
|
1176
1193
|
if (o === i) return;
|
|
1177
|
-
const
|
|
1194
|
+
const s = this.grid;
|
|
1178
1195
|
let l;
|
|
1179
1196
|
try {
|
|
1180
1197
|
l = this.grid.getRowId(n);
|
|
1181
1198
|
} catch {
|
|
1182
1199
|
}
|
|
1183
|
-
const d = l ? !this.#
|
|
1200
|
+
const d = l ? !this.#t.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : Te;
|
|
1184
1201
|
let u = !1;
|
|
1185
1202
|
const h = l ? (p) => {
|
|
1186
1203
|
u = !0, this.setInvalid(l, r, p ?? "");
|
|
@@ -1199,35 +1216,35 @@ class wn extends _ {
|
|
|
1199
1216
|
updateRow: c,
|
|
1200
1217
|
setInvalid: h
|
|
1201
1218
|
})) return;
|
|
1202
|
-
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#
|
|
1219
|
+
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#t.add(l), this.#c(), this.emitPluginEvent("cell-edit-committed", {
|
|
1203
1220
|
rowIndex: e,
|
|
1204
1221
|
field: r,
|
|
1205
1222
|
oldValue: o,
|
|
1206
1223
|
newValue: i
|
|
1207
1224
|
});
|
|
1208
|
-
const g =
|
|
1225
|
+
const g = s.findRenderedRowElement?.(e);
|
|
1209
1226
|
g && g.classList.add("changed");
|
|
1210
1227
|
}
|
|
1211
1228
|
#m(e, t, i, n, r, o) {
|
|
1212
1229
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1213
|
-
let
|
|
1230
|
+
let s;
|
|
1214
1231
|
try {
|
|
1215
|
-
|
|
1232
|
+
s = this.grid.getRowId(e);
|
|
1216
1233
|
} catch {
|
|
1217
1234
|
}
|
|
1218
|
-
const l =
|
|
1235
|
+
const l = s ? (v) => this.grid.updateRow(s, v, "cascade") : Te, d = U(i.field) ? e[i.field] : void 0;
|
|
1219
1236
|
r.classList.add("editing"), this.#n.add(`${t}:${n}`);
|
|
1220
1237
|
const c = r.parentElement;
|
|
1221
1238
|
c && Nt(c);
|
|
1222
1239
|
let u = !1;
|
|
1223
1240
|
const h = (v) => {
|
|
1224
|
-
u || !this.#
|
|
1241
|
+
u || !this.#i && this.#e === -1 || this.#b(t, i, v, e);
|
|
1225
1242
|
}, f = () => {
|
|
1226
1243
|
u = !0, U(i.field) && (e[i.field] = d);
|
|
1227
1244
|
}, g = document.createElement("div");
|
|
1228
1245
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
|
|
1229
1246
|
if (v.key === "Enter") {
|
|
1230
|
-
if (this.#
|
|
1247
|
+
if (this.#i) {
|
|
1231
1248
|
v.stopPropagation(), v.preventDefault();
|
|
1232
1249
|
const E = g.querySelector("input,textarea,select");
|
|
1233
1250
|
E && h(W(E, i, d));
|
|
@@ -1238,7 +1255,7 @@ class wn extends _ {
|
|
|
1238
1255
|
v.stopPropagation(), v.preventDefault(), u = !0, this.#a(t, !1);
|
|
1239
1256
|
}
|
|
1240
1257
|
if (v.key === "Escape") {
|
|
1241
|
-
if (this.#
|
|
1258
|
+
if (this.#i) {
|
|
1242
1259
|
v.stopPropagation(), v.preventDefault();
|
|
1243
1260
|
return;
|
|
1244
1261
|
}
|
|
@@ -1258,7 +1275,7 @@ class wn extends _ {
|
|
|
1258
1275
|
} else if (typeof b == "function") {
|
|
1259
1276
|
const v = {
|
|
1260
1277
|
row: e,
|
|
1261
|
-
rowId:
|
|
1278
|
+
rowId: s ?? "",
|
|
1262
1279
|
value: y,
|
|
1263
1280
|
field: i.field,
|
|
1264
1281
|
column: i,
|
|
@@ -1274,7 +1291,7 @@ class wn extends _ {
|
|
|
1274
1291
|
v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v), r.setAttribute("data-editor-managed", "");
|
|
1275
1292
|
const E = {
|
|
1276
1293
|
row: e,
|
|
1277
|
-
rowId:
|
|
1294
|
+
rowId: s ?? "",
|
|
1278
1295
|
value: y,
|
|
1279
1296
|
field: i.field,
|
|
1280
1297
|
column: i,
|
|
@@ -1294,7 +1311,7 @@ class wn extends _ {
|
|
|
1294
1311
|
);
|
|
1295
1312
|
}
|
|
1296
1313
|
}
|
|
1297
|
-
#y(e, t, i, n, r, o,
|
|
1314
|
+
#y(e, t, i, n, r, o, s, l) {
|
|
1298
1315
|
const d = t.__editorTemplate;
|
|
1299
1316
|
if (!d) return;
|
|
1300
1317
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1332,7 +1349,7 @@ class wn extends _ {
|
|
|
1332
1349
|
return;
|
|
1333
1350
|
p.stopPropagation(), p.preventDefault(), o(), this.#a(l, !0);
|
|
1334
1351
|
}
|
|
1335
|
-
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)),
|
|
1352
|
+
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1336
1353
|
}
|
|
1337
1354
|
e.appendChild(c);
|
|
1338
1355
|
}
|
|
@@ -1360,45 +1377,45 @@ class wn extends _ {
|
|
|
1360
1377
|
});
|
|
1361
1378
|
}
|
|
1362
1379
|
}
|
|
1363
|
-
function
|
|
1364
|
-
if (
|
|
1365
|
-
if (
|
|
1366
|
-
if (typeof
|
|
1367
|
-
const t = String(
|
|
1380
|
+
function Le(a, e = !0) {
|
|
1381
|
+
if (a == null) return "";
|
|
1382
|
+
if (a instanceof Date) return a.toISOString();
|
|
1383
|
+
if (typeof a == "object") return JSON.stringify(a);
|
|
1384
|
+
const t = String(a);
|
|
1368
1385
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1369
1386
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1370
1387
|
}
|
|
1371
|
-
function Kt(
|
|
1388
|
+
function Kt(a, e, t, i = {}) {
|
|
1372
1389
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1373
|
-
`, o = [],
|
|
1390
|
+
`, o = [], s = i.bom ? "\uFEFF" : "";
|
|
1374
1391
|
if (t.includeHeaders !== !1) {
|
|
1375
1392
|
const l = e.map((d) => {
|
|
1376
1393
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1377
|
-
return
|
|
1394
|
+
return Le(u);
|
|
1378
1395
|
});
|
|
1379
1396
|
o.push(l.join(n));
|
|
1380
1397
|
}
|
|
1381
|
-
for (const l of
|
|
1398
|
+
for (const l of a) {
|
|
1382
1399
|
const d = e.map((c) => {
|
|
1383
1400
|
let u = l[c.field];
|
|
1384
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1401
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Le(u);
|
|
1385
1402
|
});
|
|
1386
1403
|
o.push(d.join(n));
|
|
1387
1404
|
}
|
|
1388
|
-
return
|
|
1405
|
+
return s + o.join(r);
|
|
1389
1406
|
}
|
|
1390
|
-
function we(
|
|
1391
|
-
const t = URL.createObjectURL(
|
|
1407
|
+
function we(a, e) {
|
|
1408
|
+
const t = URL.createObjectURL(a), i = document.createElement("a");
|
|
1392
1409
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1393
1410
|
}
|
|
1394
|
-
function zt(
|
|
1395
|
-
const t = new Blob([
|
|
1411
|
+
function zt(a, e) {
|
|
1412
|
+
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1396
1413
|
we(t, e);
|
|
1397
1414
|
}
|
|
1398
|
-
function
|
|
1399
|
-
return
|
|
1415
|
+
function Ie(a) {
|
|
1416
|
+
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1400
1417
|
}
|
|
1401
|
-
function Ot(
|
|
1418
|
+
function Ot(a, e, t) {
|
|
1402
1419
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1403
1420
|
<?mso-application progid="Excel.Sheet"?>
|
|
1404
1421
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1410,18 +1427,18 @@ function Ot(s, e, t) {
|
|
|
1410
1427
|
<Row>`;
|
|
1411
1428
|
for (const n of e) {
|
|
1412
1429
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1413
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1430
|
+
i += `<Cell><Data ss:Type="String">${Ie(o)}</Data></Cell>`;
|
|
1414
1431
|
}
|
|
1415
1432
|
i += "</Row>";
|
|
1416
1433
|
}
|
|
1417
|
-
for (const n of
|
|
1434
|
+
for (const n of a) {
|
|
1418
1435
|
i += `
|
|
1419
1436
|
<Row>`;
|
|
1420
1437
|
for (const r of e) {
|
|
1421
1438
|
let o = n[r.field];
|
|
1422
1439
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1423
|
-
let
|
|
1424
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (
|
|
1440
|
+
let s = "String", l = "";
|
|
1441
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l = Ie(String(o)), i += `<Cell><Data ss:Type="${s}">${l}</Data></Cell>`;
|
|
1425
1442
|
}
|
|
1426
1443
|
i += "</Row>";
|
|
1427
1444
|
}
|
|
@@ -1430,13 +1447,13 @@ function Ot(s, e, t) {
|
|
|
1430
1447
|
</Worksheet>
|
|
1431
1448
|
</Workbook>`, i;
|
|
1432
1449
|
}
|
|
1433
|
-
function Gt(
|
|
1434
|
-
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([
|
|
1450
|
+
function Gt(a, e) {
|
|
1451
|
+
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
|
|
1435
1452
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1436
1453
|
});
|
|
1437
1454
|
we(i, t);
|
|
1438
1455
|
}
|
|
1439
|
-
class
|
|
1456
|
+
class vn extends _ {
|
|
1440
1457
|
name = "export";
|
|
1441
1458
|
get defaultConfig() {
|
|
1442
1459
|
return {
|
|
@@ -1469,17 +1486,17 @@ class bn extends _ {
|
|
|
1469
1486
|
l?.selected?.size && (o = [...l.selected].sort((c, u) => c - u).map((c) => this.rows[c]).filter(Boolean));
|
|
1470
1487
|
}
|
|
1471
1488
|
t?.rowIndices && (o = t.rowIndices.map((l) => this.rows[l]).filter(Boolean)), this.isExportingFlag = !0;
|
|
1472
|
-
let
|
|
1489
|
+
let s = n.fileName;
|
|
1473
1490
|
try {
|
|
1474
1491
|
switch (e) {
|
|
1475
1492
|
case "csv": {
|
|
1476
1493
|
const l = Kt(o, r, n, { bom: !0 });
|
|
1477
|
-
|
|
1494
|
+
s = s.endsWith(".csv") ? s : `${s}.csv`, zt(l, s);
|
|
1478
1495
|
break;
|
|
1479
1496
|
}
|
|
1480
1497
|
case "excel": {
|
|
1481
1498
|
const l = Ot(o, r, n);
|
|
1482
|
-
|
|
1499
|
+
s = s.endsWith(".xls") ? s : `${s}.xls`, Gt(l, s);
|
|
1483
1500
|
break;
|
|
1484
1501
|
}
|
|
1485
1502
|
case "json": {
|
|
@@ -1491,15 +1508,15 @@ class bn extends _ {
|
|
|
1491
1508
|
}
|
|
1492
1509
|
return h;
|
|
1493
1510
|
}), d = JSON.stringify(l, null, 2);
|
|
1494
|
-
|
|
1511
|
+
s = s.endsWith(".json") ? s : `${s}.json`;
|
|
1495
1512
|
const c = new Blob([d], { type: "application/json" });
|
|
1496
|
-
we(c,
|
|
1513
|
+
we(c, s);
|
|
1497
1514
|
break;
|
|
1498
1515
|
}
|
|
1499
1516
|
}
|
|
1500
1517
|
this.lastExportInfo = { format: e, timestamp: /* @__PURE__ */ new Date() }, this.emit("export-complete", {
|
|
1501
1518
|
format: e,
|
|
1502
|
-
fileName:
|
|
1519
|
+
fileName: s,
|
|
1503
1520
|
rowCount: o.length,
|
|
1504
1521
|
columnCount: r.length
|
|
1505
1522
|
});
|
|
@@ -1530,8 +1547,8 @@ class bn extends _ {
|
|
|
1530
1547
|
return this.lastExportInfo;
|
|
1531
1548
|
}
|
|
1532
1549
|
}
|
|
1533
|
-
function Bt(
|
|
1534
|
-
const i =
|
|
1550
|
+
function Bt(a, e, t = !1) {
|
|
1551
|
+
const i = a[e.field];
|
|
1535
1552
|
if (e.operator === "blank")
|
|
1536
1553
|
return i == null || i === "";
|
|
1537
1554
|
if (e.operator === "notBlank")
|
|
@@ -1569,12 +1586,12 @@ function Bt(s, e, t = !1) {
|
|
|
1569
1586
|
return !0;
|
|
1570
1587
|
}
|
|
1571
1588
|
}
|
|
1572
|
-
function Vt(
|
|
1573
|
-
return e.length ?
|
|
1589
|
+
function Vt(a, e, t = !1) {
|
|
1590
|
+
return e.length ? a.filter((i) => e.every((n) => Bt(i, n, t))) : a;
|
|
1574
1591
|
}
|
|
1575
|
-
function Wt(
|
|
1592
|
+
function Wt(a) {
|
|
1576
1593
|
return JSON.stringify(
|
|
1577
|
-
|
|
1594
|
+
a.map((e) => ({
|
|
1578
1595
|
field: e.field,
|
|
1579
1596
|
operator: e.operator,
|
|
1580
1597
|
value: e.value,
|
|
@@ -1582,15 +1599,15 @@ function Wt(s) {
|
|
|
1582
1599
|
}))
|
|
1583
1600
|
);
|
|
1584
1601
|
}
|
|
1585
|
-
function
|
|
1602
|
+
function Fe(a, e) {
|
|
1586
1603
|
const t = /* @__PURE__ */ new Set();
|
|
1587
|
-
for (const i of
|
|
1604
|
+
for (const i of a) {
|
|
1588
1605
|
const n = i[e];
|
|
1589
1606
|
n != null && t.add(n);
|
|
1590
1607
|
}
|
|
1591
1608
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1592
1609
|
}
|
|
1593
|
-
const $t = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', jt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-
|
|
1610
|
+
const $t = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', jt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-actions .tbw-filter-value-item{flex:1}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-range-inputs,.tbw-filter-date-range{display:flex;align-items:flex-end;gap:var(--tbw-spacing-sm, .375rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-group,.tbw-filter-date-group{display:flex;flex-direction:column;gap:var(--tbw-spacing-xs, .25rem);flex:1}.tbw-filter-range-label{font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)))}.tbw-filter-range-input,.tbw-filter-date-input{width:100%;height:var(--tbw-filter-item-height, 28px);padding:var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-sm, .375rem);background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-range-input:focus,.tbw-filter-date-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-range-separator{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding-bottom:var(--tbw-spacing-xs, .25rem)}.tbw-filter-range-slider{position:relative;height:24px;margin:var(--tbw-spacing-md, .5rem) 0 var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-fill{position:absolute;top:50%;height:4px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-thumb{position:absolute;top:0;width:100%;height:100%;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}.tbw-filter-range-thumb::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-moz-range-thumb{width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-webkit-slider-thumb:hover{transform:scale(1.1)}.tbw-filter-range-thumb::-moz-range-thumb:hover{transform:scale(1.1)}}";
|
|
1594
1611
|
class q extends _ {
|
|
1595
1612
|
static manifest = {
|
|
1596
1613
|
events: [
|
|
@@ -1667,22 +1684,22 @@ class q extends _ {
|
|
|
1667
1684
|
const n = i.getAttribute("data-col");
|
|
1668
1685
|
if (n === null) return;
|
|
1669
1686
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1670
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1687
|
+
if (!r || !this.isColumnFilterable(r) || K(r)) return;
|
|
1671
1688
|
const o = r.field;
|
|
1672
1689
|
if (!o) return;
|
|
1673
|
-
const
|
|
1690
|
+
const s = this.filters.has(o);
|
|
1674
1691
|
let l = i.querySelector(".tbw-filter-btn");
|
|
1675
1692
|
if (l) {
|
|
1676
1693
|
const u = l.classList.contains("active");
|
|
1677
|
-
if (l.classList.toggle("active",
|
|
1678
|
-
const h =
|
|
1694
|
+
if (l.classList.toggle("active", s), i.classList.toggle("filtered", s), u !== s) {
|
|
1695
|
+
const h = s ? "filterActive" : "filter";
|
|
1679
1696
|
this.setIcon(l, this.resolveIcon(h));
|
|
1680
1697
|
}
|
|
1681
1698
|
return;
|
|
1682
1699
|
}
|
|
1683
1700
|
l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`);
|
|
1684
|
-
const d =
|
|
1685
|
-
this.setIcon(l, this.resolveIcon(d)),
|
|
1701
|
+
const d = s ? "filterActive" : "filter";
|
|
1702
|
+
this.setIcon(l, this.resolveIcon(d)), s && (l.classList.add("active"), i.classList.add("filtered")), l.addEventListener("click", (u) => {
|
|
1686
1703
|
u.stopPropagation(), this.toggleFilterPanel(o, r, l);
|
|
1687
1704
|
});
|
|
1688
1705
|
const c = i.querySelector(".resize-handle");
|
|
@@ -1735,7 +1752,7 @@ class q extends _ {
|
|
|
1735
1752
|
return this.getFilters();
|
|
1736
1753
|
}
|
|
1737
1754
|
getUniqueValues(e) {
|
|
1738
|
-
return
|
|
1755
|
+
return Fe(this.sourceRows, e);
|
|
1739
1756
|
}
|
|
1740
1757
|
copyGridThemeContext(e) {
|
|
1741
1758
|
const t = this.gridElement;
|
|
@@ -1767,13 +1784,13 @@ class q extends _ {
|
|
|
1767
1784
|
});
|
|
1768
1785
|
return;
|
|
1769
1786
|
}
|
|
1770
|
-
const r =
|
|
1787
|
+
const r = Fe(this.sourceRows, e);
|
|
1771
1788
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1772
1789
|
}
|
|
1773
1790
|
renderPanelContent(e, t, i, n) {
|
|
1774
1791
|
let r = this.excludedValues.get(e);
|
|
1775
1792
|
r || (r = /* @__PURE__ */ new Set(), this.excludedValues.set(e, r));
|
|
1776
|
-
const o = this.searchText.get(e) ?? "",
|
|
1793
|
+
const o = this.searchText.get(e) ?? "", s = {
|
|
1777
1794
|
field: e,
|
|
1778
1795
|
column: t,
|
|
1779
1796
|
uniqueValues: n,
|
|
@@ -1791,13 +1808,13 @@ class q extends _ {
|
|
|
1791
1808
|
closePanel: () => this.closeFilterPanel()
|
|
1792
1809
|
};
|
|
1793
1810
|
let l = !1;
|
|
1794
|
-
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i,
|
|
1811
|
+
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, s), l = i.children.length > 0), !l && t.type) {
|
|
1795
1812
|
const d = this.grid.effectiveConfig.typeDefaults?.[t.type];
|
|
1796
|
-
d?.filterPanelRenderer && (d.filterPanelRenderer(i,
|
|
1813
|
+
d?.filterPanelRenderer && (d.filterPanelRenderer(i, s), l = i.children.length > 0);
|
|
1797
1814
|
}
|
|
1798
1815
|
if (!l) {
|
|
1799
1816
|
const d = t.type;
|
|
1800
|
-
d === "number" ? this.renderNumberFilterPanel(i,
|
|
1817
|
+
d === "number" ? this.renderNumberFilterPanel(i, s, n) : d === "date" ? this.renderDateFilterPanel(i, s, n) : this.renderDefaultFilterPanel(i, s, n, r);
|
|
1801
1818
|
}
|
|
1802
1819
|
}
|
|
1803
1820
|
setupPanelCloseHandler(e, t) {
|
|
@@ -1823,8 +1840,8 @@ class q extends _ {
|
|
|
1823
1840
|
const n = t.closest(".cell") ?? t;
|
|
1824
1841
|
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, q.checkAnchorPositioningSupport()) {
|
|
1825
1842
|
requestAnimationFrame(() => {
|
|
1826
|
-
const o = e.getBoundingClientRect(),
|
|
1827
|
-
o.top <
|
|
1843
|
+
const o = e.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
1844
|
+
o.top < s.top && e.classList.add("tbw-filter-panel-above");
|
|
1828
1845
|
});
|
|
1829
1846
|
return;
|
|
1830
1847
|
}
|
|
@@ -1835,10 +1852,10 @@ class q extends _ {
|
|
|
1835
1852
|
});
|
|
1836
1853
|
}
|
|
1837
1854
|
renderDefaultFilterPanel(e, t, i, n) {
|
|
1838
|
-
const { field: r } = t, o = this.getListItemHeight(),
|
|
1839
|
-
|
|
1855
|
+
const { field: r } = t, o = this.getListItemHeight(), s = document.createElement("div");
|
|
1856
|
+
s.className = "tbw-filter-search";
|
|
1840
1857
|
const l = document.createElement("input");
|
|
1841
|
-
l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "",
|
|
1858
|
+
l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "", s.appendChild(l), e.appendChild(s);
|
|
1842
1859
|
const d = document.createElement("div");
|
|
1843
1860
|
d.className = "tbw-filter-actions";
|
|
1844
1861
|
const c = document.createElement("label");
|
|
@@ -1876,17 +1893,17 @@ class q extends _ {
|
|
|
1876
1893
|
L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
|
|
1877
1894
|
b.set(m, L.checked), f();
|
|
1878
1895
|
});
|
|
1879
|
-
const
|
|
1880
|
-
return
|
|
1896
|
+
const H = document.createElement("span");
|
|
1897
|
+
return H.textContent = T, x.appendChild(L), x.appendChild(H), x;
|
|
1881
1898
|
}, E = () => {
|
|
1882
1899
|
const C = y.length, k = g.clientHeight, T = g.scrollTop;
|
|
1883
|
-
if (p.style.height = `${C * o}px`,
|
|
1900
|
+
if (p.style.height = `${C * o}px`, gt(C, q.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1884
1901
|
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x, L) => {
|
|
1885
1902
|
w.appendChild(v(x, L));
|
|
1886
1903
|
});
|
|
1887
1904
|
return;
|
|
1888
1905
|
}
|
|
1889
|
-
const m =
|
|
1906
|
+
const m = pt({
|
|
1890
1907
|
totalRows: C,
|
|
1891
1908
|
viewportHeight: k,
|
|
1892
1909
|
scrollTop: T,
|
|
@@ -1943,14 +1960,14 @@ class q extends _ {
|
|
|
1943
1960
|
}), I.appendChild(S), e.appendChild(I);
|
|
1944
1961
|
}
|
|
1945
1962
|
renderNumberFilterPanel(e, t, i) {
|
|
1946
|
-
const { field: n, column: r } = t, o = r.filterParams,
|
|
1963
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A, z) => {
|
|
1947
1964
|
if (typeof A == "number") return A;
|
|
1948
1965
|
if (typeof A == "string") {
|
|
1949
1966
|
const j = parseFloat(A);
|
|
1950
1967
|
return isNaN(j) ? z : j;
|
|
1951
1968
|
}
|
|
1952
1969
|
return z;
|
|
1953
|
-
}, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ??
|
|
1970
|
+
}, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), f = l(o?.max ?? s?.max, u), g = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
|
|
1954
1971
|
let w = h, b = f;
|
|
1955
1972
|
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, f));
|
|
1956
1973
|
const y = document.createElement("div");
|
|
@@ -1980,8 +1997,8 @@ class q extends _ {
|
|
|
1980
1997
|
const x = document.createElement("input");
|
|
1981
1998
|
x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(T), C.appendChild(m), C.appendChild(x), e.appendChild(C);
|
|
1982
1999
|
const L = () => {
|
|
1983
|
-
const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100,
|
|
1984
|
-
T.style.left = `${ve}%`, T.style.width = `${
|
|
2000
|
+
const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100, ht = (z - h) / j * 100;
|
|
2001
|
+
T.style.left = `${ve}%`, T.style.width = `${ht - ve}%`;
|
|
1985
2002
|
};
|
|
1986
2003
|
m.addEventListener("input", () => {
|
|
1987
2004
|
const A = Math.min(parseFloat(m.value), parseFloat(x.value));
|
|
@@ -1996,20 +2013,20 @@ class q extends _ {
|
|
|
1996
2013
|
let A = parseFloat(S.value) || f;
|
|
1997
2014
|
A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A), L();
|
|
1998
2015
|
}), L();
|
|
1999
|
-
const
|
|
2000
|
-
|
|
2016
|
+
const H = document.createElement("div");
|
|
2017
|
+
H.className = "tbw-filter-buttons";
|
|
2001
2018
|
const X = document.createElement("button");
|
|
2002
2019
|
X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
|
|
2003
2020
|
const A = parseFloat(R.value), z = parseFloat(S.value);
|
|
2004
2021
|
t.applyTextFilter("between", A, z);
|
|
2005
|
-
}),
|
|
2022
|
+
}), H.appendChild(X);
|
|
2006
2023
|
const Z = document.createElement("button");
|
|
2007
2024
|
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
2008
2025
|
t.clearFilter();
|
|
2009
|
-
}),
|
|
2026
|
+
}), H.appendChild(Z), e.appendChild(H);
|
|
2010
2027
|
}
|
|
2011
2028
|
renderDateFilterPanel(e, t, i) {
|
|
2012
|
-
const { field: n, column: r } = t, o = r.filterParams,
|
|
2029
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
2013
2030
|
let w = "", b = "";
|
|
2014
2031
|
p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
|
|
2015
2032
|
const y = document.createElement("div");
|
|
@@ -2104,28 +2121,28 @@ class q extends _ {
|
|
|
2104
2121
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
2105
2122
|
}
|
|
2106
2123
|
}
|
|
2107
|
-
function
|
|
2108
|
-
if (!
|
|
2109
|
-
const e = /* @__PURE__ */ new Map(), t = [], i = (o,
|
|
2110
|
-
if (!
|
|
2124
|
+
function Pe(a) {
|
|
2125
|
+
if (!a.length) return [];
|
|
2126
|
+
const e = /* @__PURE__ */ new Map(), t = [], i = (o, s) => {
|
|
2127
|
+
if (!s.length) return;
|
|
2111
2128
|
const l = t[t.length - 1];
|
|
2112
2129
|
if (l && l.implicit && l.firstIndex + l.columns.length === o) {
|
|
2113
|
-
l.columns.push(...
|
|
2130
|
+
l.columns.push(...s);
|
|
2114
2131
|
return;
|
|
2115
2132
|
}
|
|
2116
2133
|
t.push({
|
|
2117
2134
|
id: "__implicit__" + o,
|
|
2118
2135
|
label: void 0,
|
|
2119
|
-
columns:
|
|
2136
|
+
columns: s,
|
|
2120
2137
|
firstIndex: o,
|
|
2121
2138
|
implicit: !0
|
|
2122
2139
|
});
|
|
2123
2140
|
};
|
|
2124
2141
|
let n = [], r = 0;
|
|
2125
|
-
return
|
|
2142
|
+
return a.forEach((o, s) => {
|
|
2126
2143
|
const l = o.group;
|
|
2127
2144
|
if (!l) {
|
|
2128
|
-
n.length === 0 && (r =
|
|
2145
|
+
n.length === 0 && (r = s), n.push(o);
|
|
2129
2146
|
return;
|
|
2130
2147
|
}
|
|
2131
2148
|
n.length && (i(r, n.slice()), n = []);
|
|
@@ -2135,43 +2152,43 @@ function Fe(s) {
|
|
|
2135
2152
|
id: d,
|
|
2136
2153
|
label: typeof l == "string" ? void 0 : l.label,
|
|
2137
2154
|
columns: [],
|
|
2138
|
-
firstIndex:
|
|
2155
|
+
firstIndex: s
|
|
2139
2156
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
2140
|
-
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length ===
|
|
2157
|
+
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === a.length ? [] : t;
|
|
2141
2158
|
}
|
|
2142
|
-
function Ut(
|
|
2143
|
-
if (!e.length || !
|
|
2159
|
+
function Ut(a, e, t) {
|
|
2160
|
+
if (!e.length || !a) return;
|
|
2144
2161
|
const i = /* @__PURE__ */ new Map();
|
|
2145
2162
|
for (const r of e)
|
|
2146
2163
|
for (const o of r.columns)
|
|
2147
2164
|
o.field && i.set(o.field, r.id);
|
|
2148
|
-
const n = Array.from(
|
|
2165
|
+
const n = Array.from(a.querySelectorAll(".cell[data-field]"));
|
|
2149
2166
|
n.forEach((r) => {
|
|
2150
|
-
const o = r.getAttribute("data-field") || "",
|
|
2151
|
-
|
|
2167
|
+
const o = r.getAttribute("data-field") || "", s = i.get(o);
|
|
2168
|
+
s && (r.classList.add("grouped"), r.getAttribute("data-group") || r.setAttribute("data-group", s));
|
|
2152
2169
|
});
|
|
2153
2170
|
for (const r of e) {
|
|
2154
|
-
const o = r.columns[r.columns.length - 1],
|
|
2155
|
-
|
|
2171
|
+
const o = r.columns[r.columns.length - 1], s = n.find((l) => l.getAttribute("data-field") === o.field);
|
|
2172
|
+
s && s.classList.add("group-end");
|
|
2156
2173
|
}
|
|
2157
2174
|
}
|
|
2158
|
-
function Yt(
|
|
2159
|
-
if (
|
|
2175
|
+
function Yt(a, e) {
|
|
2176
|
+
if (a.length === 0) return null;
|
|
2160
2177
|
const t = document.createElement("div");
|
|
2161
2178
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
2162
|
-
for (const i of
|
|
2179
|
+
for (const i of a) {
|
|
2163
2180
|
const n = i.columns[0], r = n ? e.findIndex((d) => d.field === n.field) : -1;
|
|
2164
2181
|
if (r === -1) continue;
|
|
2165
|
-
const o = String(i.id).startsWith("__implicit__"),
|
|
2166
|
-
l.className = "cell header-group-cell", o && l.classList.add("implicit-group"), l.setAttribute("data-group", String(i.id)), l.style.gridColumn = `${r + 1} / span ${i.columns.length}`, l.textContent =
|
|
2182
|
+
const o = String(i.id).startsWith("__implicit__"), s = o ? "" : i.label || i.id, l = document.createElement("div");
|
|
2183
|
+
l.className = "cell header-group-cell", o && l.classList.add("implicit-group"), l.setAttribute("data-group", String(i.id)), l.style.gridColumn = `${r + 1} / span ${i.columns.length}`, l.textContent = s, t.appendChild(l);
|
|
2167
2184
|
}
|
|
2168
2185
|
return t;
|
|
2169
2186
|
}
|
|
2170
|
-
function Xt(
|
|
2171
|
-
return
|
|
2187
|
+
function Xt(a) {
|
|
2188
|
+
return a.some((e) => e.group != null);
|
|
2172
2189
|
}
|
|
2173
2190
|
const Zt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
|
|
2174
|
-
class
|
|
2191
|
+
class yn extends _ {
|
|
2175
2192
|
static manifest = {
|
|
2176
2193
|
ownedProperties: [
|
|
2177
2194
|
{
|
|
@@ -2196,9 +2213,9 @@ class vn extends _ {
|
|
|
2196
2213
|
}
|
|
2197
2214
|
groups = [];
|
|
2198
2215
|
isActive = !1;
|
|
2199
|
-
#
|
|
2216
|
+
#i = /* @__PURE__ */ new Set();
|
|
2200
2217
|
detach() {
|
|
2201
|
-
this.groups = [], this.isActive = !1, this.#
|
|
2218
|
+
this.groups = [], this.isActive = !1, this.#i.clear();
|
|
2202
2219
|
}
|
|
2203
2220
|
static detect(e, t) {
|
|
2204
2221
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
@@ -2212,21 +2229,21 @@ class vn extends _ {
|
|
|
2212
2229
|
if (t && Array.isArray(t) && t.length > 0) {
|
|
2213
2230
|
const r = /* @__PURE__ */ new Map();
|
|
2214
2231
|
for (const o of t)
|
|
2215
|
-
for (const
|
|
2216
|
-
r.set(
|
|
2232
|
+
for (const s of o.children)
|
|
2233
|
+
r.set(s, { id: o.id, label: o.header });
|
|
2217
2234
|
i = e.map((o) => {
|
|
2218
|
-
const
|
|
2219
|
-
return
|
|
2235
|
+
const s = r.get(o.field);
|
|
2236
|
+
return s && !o.group ? { ...o, group: s } : o;
|
|
2220
2237
|
});
|
|
2221
2238
|
} else
|
|
2222
2239
|
i = [...e];
|
|
2223
|
-
const n =
|
|
2240
|
+
const n = Pe(i);
|
|
2224
2241
|
if (n.length === 0)
|
|
2225
2242
|
return this.isActive = !1, this.groups = [], i;
|
|
2226
|
-
this.isActive = !0, this.groups = n, this.#
|
|
2243
|
+
this.isActive = !0, this.groups = n, this.#i.clear();
|
|
2227
2244
|
for (const r of n) {
|
|
2228
2245
|
const o = r.columns[r.columns.length - 1];
|
|
2229
|
-
o?.field && this.#
|
|
2246
|
+
o?.field && this.#i.add(o.field);
|
|
2230
2247
|
}
|
|
2231
2248
|
return i;
|
|
2232
2249
|
}
|
|
@@ -2240,19 +2257,19 @@ class vn extends _ {
|
|
|
2240
2257
|
if (!e) return;
|
|
2241
2258
|
const t = e.querySelector(".header-group-row");
|
|
2242
2259
|
t && t.remove();
|
|
2243
|
-
const i = this.columns, n =
|
|
2260
|
+
const i = this.columns, n = Pe(i);
|
|
2244
2261
|
if (n.length === 0) return;
|
|
2245
2262
|
const r = Yt(n, i);
|
|
2246
2263
|
if (r) {
|
|
2247
2264
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2265
|
+
const s = e.querySelector(".header-row");
|
|
2266
|
+
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2250
2267
|
}
|
|
2251
2268
|
const o = e.querySelector(".header-row");
|
|
2252
2269
|
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n));
|
|
2253
2270
|
}
|
|
2254
2271
|
afterCellRender(e) {
|
|
2255
|
-
!this.isActive || !this.config.showGroupBorders || e.cellElement.classList.toggle("group-end", this.#
|
|
2272
|
+
!this.isActive || !this.config.showGroupBorders || e.cellElement.classList.toggle("group-end", this.#i.has(e.column.field));
|
|
2256
2273
|
}
|
|
2257
2274
|
isGroupingActive() {
|
|
2258
2275
|
return this.isActive;
|
|
@@ -2268,12 +2285,12 @@ class vn extends _ {
|
|
|
2268
2285
|
this.requestRender();
|
|
2269
2286
|
}
|
|
2270
2287
|
}
|
|
2271
|
-
function
|
|
2288
|
+
function De({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
2272
2289
|
const n = e.groupOn;
|
|
2273
2290
|
if (typeof n != "function")
|
|
2274
2291
|
return [];
|
|
2275
2292
|
const r = { key: "__root__", value: null, depth: -1, rows: [], children: /* @__PURE__ */ new Map() };
|
|
2276
|
-
if (
|
|
2293
|
+
if (a.forEach((d) => {
|
|
2277
2294
|
let c = n(d);
|
|
2278
2295
|
c == null || c === !1 ? c = ["__ungrouped__"] : Array.isArray(c) || (c = [c]);
|
|
2279
2296
|
let u = r;
|
|
@@ -2282,57 +2299,57 @@ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2282
2299
|
let w = u.children.get(g);
|
|
2283
2300
|
w || (w = { key: p, value: h, depth: f, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(g, w)), u = w;
|
|
2284
2301
|
}), u.rows.push(d);
|
|
2285
|
-
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length ===
|
|
2302
|
+
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === a.length)
|
|
2286
2303
|
return [];
|
|
2287
|
-
const o = /* @__PURE__ */ new Set([...t, ...i ?? []]),
|
|
2304
|
+
const o = /* @__PURE__ */ new Set([...t, ...i ?? []]), s = [], l = (d) => {
|
|
2288
2305
|
if (d === r) {
|
|
2289
2306
|
d.children.forEach((u) => l(u));
|
|
2290
2307
|
return;
|
|
2291
2308
|
}
|
|
2292
2309
|
const c = o.has(d.key);
|
|
2293
|
-
|
|
2310
|
+
s.push({
|
|
2294
2311
|
kind: "group",
|
|
2295
2312
|
key: d.key,
|
|
2296
2313
|
value: d.value,
|
|
2297
2314
|
depth: d.depth,
|
|
2298
2315
|
rows: d.rows,
|
|
2299
2316
|
expanded: c
|
|
2300
|
-
}), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) =>
|
|
2317
|
+
}), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) => s.push({ kind: "data", row: u, rowIndex: a.indexOf(u) })));
|
|
2301
2318
|
};
|
|
2302
|
-
return l(r),
|
|
2319
|
+
return l(r), s;
|
|
2303
2320
|
}
|
|
2304
|
-
function Qt(
|
|
2305
|
-
const t = new Set(
|
|
2321
|
+
function Qt(a, e) {
|
|
2322
|
+
const t = new Set(a);
|
|
2306
2323
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2307
2324
|
}
|
|
2308
|
-
function Jt(
|
|
2325
|
+
function Jt(a) {
|
|
2309
2326
|
const e = /* @__PURE__ */ new Set();
|
|
2310
|
-
for (const t of
|
|
2327
|
+
for (const t of a)
|
|
2311
2328
|
t.kind === "group" && e.add(t.key);
|
|
2312
2329
|
return e;
|
|
2313
2330
|
}
|
|
2314
2331
|
function ei() {
|
|
2315
2332
|
return /* @__PURE__ */ new Set();
|
|
2316
2333
|
}
|
|
2317
|
-
function ti(
|
|
2318
|
-
if (
|
|
2334
|
+
function ti(a, e) {
|
|
2335
|
+
if (a === !0)
|
|
2319
2336
|
return new Set(e);
|
|
2320
|
-
if (
|
|
2337
|
+
if (a === !1 || a == null)
|
|
2321
2338
|
return /* @__PURE__ */ new Set();
|
|
2322
|
-
if (typeof
|
|
2323
|
-
const t = e[
|
|
2339
|
+
if (typeof a == "number") {
|
|
2340
|
+
const t = e[a];
|
|
2324
2341
|
return t ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set();
|
|
2325
2342
|
}
|
|
2326
|
-
return typeof
|
|
2343
|
+
return typeof a == "string" ? /* @__PURE__ */ new Set([a]) : Array.isArray(a) ? new Set(a) : /* @__PURE__ */ new Set();
|
|
2327
2344
|
}
|
|
2328
|
-
function ii(
|
|
2329
|
-
return
|
|
2345
|
+
function ii(a) {
|
|
2346
|
+
return a.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2330
2347
|
}
|
|
2331
|
-
function ni(
|
|
2332
|
-
return
|
|
2348
|
+
function ni(a) {
|
|
2349
|
+
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2333
2350
|
}
|
|
2334
2351
|
const ri = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
2335
|
-
class
|
|
2352
|
+
class xn extends _ {
|
|
2336
2353
|
static manifest = {
|
|
2337
2354
|
events: [
|
|
2338
2355
|
{
|
|
@@ -2397,7 +2414,7 @@ class yn extends _ {
|
|
|
2397
2414
|
const t = this.config;
|
|
2398
2415
|
if (typeof t.groupOn != "function")
|
|
2399
2416
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2400
|
-
const i =
|
|
2417
|
+
const i = De({
|
|
2401
2418
|
rows: [...e],
|
|
2402
2419
|
config: t,
|
|
2403
2420
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -2406,10 +2423,10 @@ class yn extends _ {
|
|
|
2406
2423
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2407
2424
|
let n;
|
|
2408
2425
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2409
|
-
const
|
|
2410
|
-
n = ti(t.defaultExpanded ?? !1,
|
|
2426
|
+
const s = ii(i);
|
|
2427
|
+
n = ti(t.defaultExpanded ?? !1, s), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2411
2428
|
}
|
|
2412
|
-
const r =
|
|
2429
|
+
const r = De({
|
|
2413
2430
|
rows: [...e],
|
|
2414
2431
|
config: t,
|
|
2415
2432
|
expanded: this.expandedKeys,
|
|
@@ -2417,21 +2434,21 @@ class yn extends _ {
|
|
|
2417
2434
|
});
|
|
2418
2435
|
this.isActive = !0, this.flattenedRows = r, this.keysToAnimate.clear();
|
|
2419
2436
|
const o = /* @__PURE__ */ new Set();
|
|
2420
|
-
return r.forEach((
|
|
2421
|
-
if (
|
|
2437
|
+
return r.forEach((s, l) => {
|
|
2438
|
+
if (s.kind === "data") {
|
|
2422
2439
|
const d = `data-${l}`;
|
|
2423
2440
|
o.add(d), this.previousVisibleKeys.has(d) || this.keysToAnimate.add(d);
|
|
2424
2441
|
}
|
|
2425
|
-
}), this.previousVisibleKeys = o, r.map((
|
|
2442
|
+
}), this.previousVisibleKeys = o, r.map((s) => s.kind === "group" ? {
|
|
2426
2443
|
__isGroupRow: !0,
|
|
2427
|
-
__groupKey:
|
|
2428
|
-
__groupValue:
|
|
2429
|
-
__groupDepth:
|
|
2430
|
-
__groupRows:
|
|
2431
|
-
__groupExpanded:
|
|
2432
|
-
__groupRowCount: ni(
|
|
2433
|
-
__rowCacheKey: `group:${
|
|
2434
|
-
} :
|
|
2444
|
+
__groupKey: s.key,
|
|
2445
|
+
__groupValue: s.value,
|
|
2446
|
+
__groupDepth: s.depth,
|
|
2447
|
+
__groupRows: s.rows,
|
|
2448
|
+
__groupExpanded: s.expanded,
|
|
2449
|
+
__groupRowCount: ni(s),
|
|
2450
|
+
__rowCacheKey: `group:${s.key}`
|
|
2451
|
+
} : s.row);
|
|
2435
2452
|
}
|
|
2436
2453
|
onCellClick(e) {
|
|
2437
2454
|
const t = e.row;
|
|
@@ -2449,7 +2466,7 @@ class yn extends _ {
|
|
|
2449
2466
|
return !1;
|
|
2450
2467
|
const n = this.config;
|
|
2451
2468
|
if (n.groupRowRenderer) {
|
|
2452
|
-
const
|
|
2469
|
+
const s = () => {
|
|
2453
2470
|
this.toggle(e.__groupKey);
|
|
2454
2471
|
}, l = n.groupRowRenderer({
|
|
2455
2472
|
key: e.__groupKey,
|
|
@@ -2457,7 +2474,7 @@ class yn extends _ {
|
|
|
2457
2474
|
depth: e.__groupDepth,
|
|
2458
2475
|
rows: e.__groupRows,
|
|
2459
2476
|
expanded: e.__groupExpanded,
|
|
2460
|
-
toggleExpand:
|
|
2477
|
+
toggleExpand: s
|
|
2461
2478
|
});
|
|
2462
2479
|
if (l)
|
|
2463
2480
|
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), typeof l == "string" ? t.innerHTML = l : (t.innerHTML = "", t.appendChild(l)), !0;
|
|
@@ -2490,19 +2507,19 @@ class yn extends _ {
|
|
|
2490
2507
|
return n.formatLabel ? n.formatLabel(e, t, i) : String(e);
|
|
2491
2508
|
}
|
|
2492
2509
|
renderFullWidthGroupRow(e, t, i) {
|
|
2493
|
-
const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [],
|
|
2494
|
-
|
|
2510
|
+
const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [], s = document.createElement("div");
|
|
2511
|
+
s.className = "cell group-full", s.style.gridColumn = "1 / -1", s.setAttribute("role", "gridcell"), s.setAttribute("data-col", "0"), s.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2495
2512
|
const l = document.createElement("span");
|
|
2496
|
-
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey),
|
|
2513
|
+
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), s.appendChild(l), n.showRowCount !== !1) {
|
|
2497
2514
|
const c = document.createElement("span");
|
|
2498
|
-
c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`,
|
|
2515
|
+
c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, s.appendChild(c);
|
|
2499
2516
|
}
|
|
2500
2517
|
const d = Object.entries(r);
|
|
2501
2518
|
if (d.length > 0) {
|
|
2502
2519
|
const c = document.createElement("span");
|
|
2503
2520
|
c.className = "group-aggregates";
|
|
2504
2521
|
for (const [u, h] of d) {
|
|
2505
|
-
const f = this.columns.find((p) => p.field === u), g =
|
|
2522
|
+
const f = this.columns.find((p) => p.field === u), g = ie(h, o, u, f);
|
|
2506
2523
|
if (g != null) {
|
|
2507
2524
|
const p = document.createElement("span");
|
|
2508
2525
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
@@ -2510,24 +2527,24 @@ class yn extends _ {
|
|
|
2510
2527
|
p.textContent = `${w}: ${g}`, c.appendChild(p);
|
|
2511
2528
|
}
|
|
2512
2529
|
}
|
|
2513
|
-
c.children.length > 0 &&
|
|
2530
|
+
c.children.length > 0 && s.appendChild(c);
|
|
2514
2531
|
}
|
|
2515
|
-
t.appendChild(
|
|
2532
|
+
t.appendChild(s);
|
|
2516
2533
|
}
|
|
2517
2534
|
renderPerColumnGroupRow(e, t, i) {
|
|
2518
|
-
const n = this.config, r = n.aggregators ?? {}, o = this.columns,
|
|
2535
|
+
const n = this.config, r = n.aggregators ?? {}, o = this.columns, s = e.__groupRows ?? [], d = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
|
|
2519
2536
|
d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
|
|
2520
2537
|
let c = !1;
|
|
2521
2538
|
o.forEach((u, h) => {
|
|
2522
2539
|
const f = document.createElement("div");
|
|
2523
|
-
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"),
|
|
2540
|
+
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), te(u)) {
|
|
2524
2541
|
f.setAttribute("data-field", u.field), t.appendChild(f);
|
|
2525
2542
|
return;
|
|
2526
2543
|
}
|
|
2527
2544
|
if (c) {
|
|
2528
2545
|
const g = r[u.field];
|
|
2529
2546
|
if (g) {
|
|
2530
|
-
const p =
|
|
2547
|
+
const p = ie(g, s, u.field, u);
|
|
2531
2548
|
f.textContent = p != null ? String(p) : "";
|
|
2532
2549
|
} else
|
|
2533
2550
|
f.textContent = "";
|
|
@@ -2535,13 +2552,13 @@ class yn extends _ {
|
|
|
2535
2552
|
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2536
2553
|
const g = document.createElement("span"), p = r[u.field];
|
|
2537
2554
|
if (p) {
|
|
2538
|
-
const w =
|
|
2555
|
+
const w = ie(p, s, u.field, u);
|
|
2539
2556
|
g.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2540
2557
|
} else
|
|
2541
2558
|
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
2542
2559
|
if (f.appendChild(g), n.showRowCount !== !1) {
|
|
2543
2560
|
const w = document.createElement("span");
|
|
2544
|
-
w.className = "group-count", w.textContent = ` (${
|
|
2561
|
+
w.className = "group-count", w.textContent = ` (${s.length})`, f.appendChild(w);
|
|
2545
2562
|
}
|
|
2546
2563
|
}
|
|
2547
2564
|
t.appendChild(f);
|
|
@@ -2561,8 +2578,8 @@ class yn extends _ {
|
|
|
2561
2578
|
if (e.startsWith(o + "||") || o.startsWith(e + "||"))
|
|
2562
2579
|
e.startsWith(o + "||") && r.add(o);
|
|
2563
2580
|
else {
|
|
2564
|
-
const
|
|
2565
|
-
|
|
2581
|
+
const s = this.flattenedRows.find((l) => l.kind === "group" && l.key === o);
|
|
2582
|
+
s && s.depth !== n.depth && r.add(o);
|
|
2566
2583
|
}
|
|
2567
2584
|
r.add(e), this.expandedKeys = r;
|
|
2568
2585
|
} else
|
|
@@ -2616,31 +2633,31 @@ class yn extends _ {
|
|
|
2616
2633
|
this.config.groupOn = e, this.requestRender();
|
|
2617
2634
|
}
|
|
2618
2635
|
}
|
|
2619
|
-
function
|
|
2620
|
-
const t = new Set(
|
|
2636
|
+
function Me(a, e) {
|
|
2637
|
+
const t = new Set(a);
|
|
2621
2638
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2622
2639
|
}
|
|
2623
|
-
function oi(
|
|
2624
|
-
const t = new Set(
|
|
2640
|
+
function oi(a, e) {
|
|
2641
|
+
const t = new Set(a);
|
|
2625
2642
|
return t.add(e), t;
|
|
2626
2643
|
}
|
|
2627
|
-
function si(
|
|
2628
|
-
const t = new Set(
|
|
2644
|
+
function si(a, e) {
|
|
2645
|
+
const t = new Set(a);
|
|
2629
2646
|
return t.delete(e), t;
|
|
2630
2647
|
}
|
|
2631
|
-
function ai(
|
|
2632
|
-
return
|
|
2648
|
+
function ai(a, e) {
|
|
2649
|
+
return a.has(e);
|
|
2633
2650
|
}
|
|
2634
|
-
function li(
|
|
2651
|
+
function li(a, e, t, i) {
|
|
2635
2652
|
const n = document.createElement("div");
|
|
2636
2653
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2637
2654
|
const r = document.createElement("div");
|
|
2638
2655
|
r.className = "master-detail-cell", r.setAttribute("role", "cell"), r.style.gridColumn = `1 / ${i + 1}`;
|
|
2639
|
-
const o = t(
|
|
2656
|
+
const o = t(a, e);
|
|
2640
2657
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2641
2658
|
}
|
|
2642
2659
|
const di = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
2643
|
-
class
|
|
2660
|
+
class rt extends _ {
|
|
2644
2661
|
name = "masterDetail";
|
|
2645
2662
|
styles = di;
|
|
2646
2663
|
get defaultConfig() {
|
|
@@ -2667,12 +2684,12 @@ class nt extends _ {
|
|
|
2667
2684
|
return;
|
|
2668
2685
|
}
|
|
2669
2686
|
}
|
|
2670
|
-
const n = t.getAttribute("animation"), r = t.getAttribute("show-expand-column"), o = t.getAttribute("expand-on-row-click"),
|
|
2671
|
-
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"),
|
|
2687
|
+
const n = t.getAttribute("animation"), r = t.getAttribute("show-expand-column"), o = t.getAttribute("expand-on-row-click"), s = t.getAttribute("collapse-on-click-outside"), l = t.getAttribute("height"), d = {};
|
|
2688
|
+
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), s !== null && (d.collapseOnClickOutside = s === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
|
|
2672
2689
|
const c = t.innerHTML.trim();
|
|
2673
2690
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2674
|
-
const f =
|
|
2675
|
-
return
|
|
2691
|
+
const f = et(c, { value: u, row: u });
|
|
2692
|
+
return tt(f);
|
|
2676
2693
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2677
2694
|
}
|
|
2678
2695
|
get animationStyle() {
|
|
@@ -2683,7 +2700,7 @@ class nt extends _ {
|
|
|
2683
2700
|
e.classList.add("tbw-expanding");
|
|
2684
2701
|
let n = !1;
|
|
2685
2702
|
const r = () => {
|
|
2686
|
-
n || (n = !0, e.classList.remove("tbw-expanding"), t !== void 0 && i !== void 0 && this.#
|
|
2703
|
+
n || (n = !0, e.classList.remove("tbw-expanding"), t !== void 0 && i !== void 0 && this.#i(e, t, i));
|
|
2687
2704
|
};
|
|
2688
2705
|
return e.addEventListener("animationend", r, { once: !0 }), setTimeout(r, this.animationDuration + 50), !0;
|
|
2689
2706
|
}
|
|
@@ -2698,7 +2715,7 @@ class nt extends _ {
|
|
|
2698
2715
|
};
|
|
2699
2716
|
e.addEventListener("animationend", i, { once: !0 }), setTimeout(i, this.animationDuration + 50);
|
|
2700
2717
|
}
|
|
2701
|
-
#
|
|
2718
|
+
#i(e, t, i) {
|
|
2702
2719
|
if (!e.isConnected) return;
|
|
2703
2720
|
const n = e.offsetHeight;
|
|
2704
2721
|
if (n > 0) {
|
|
@@ -2719,10 +2736,10 @@ class nt extends _ {
|
|
|
2719
2736
|
return this.measuredDetailHeights.set(e, r), r;
|
|
2720
2737
|
}
|
|
2721
2738
|
const i = this.measuredDetailHeights.get(e);
|
|
2722
|
-
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2739
|
+
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : rt.DEFAULT_DETAIL_HEIGHT;
|
|
2723
2740
|
}
|
|
2724
2741
|
toggleAndEmit(e, t) {
|
|
2725
|
-
this.expandedRows =
|
|
2742
|
+
this.expandedRows = Me(this.expandedRows, e);
|
|
2726
2743
|
const i = this.expandedRows.has(e);
|
|
2727
2744
|
i && this.rowsToAnimate.add(e), this.emit("detail-expand", {
|
|
2728
2745
|
rowIndex: t,
|
|
@@ -2741,7 +2758,7 @@ class nt extends _ {
|
|
|
2741
2758
|
return i;
|
|
2742
2759
|
const r = yt(this.name);
|
|
2743
2760
|
return r.viewRenderer = (o) => {
|
|
2744
|
-
const { row:
|
|
2761
|
+
const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
|
|
2745
2762
|
d.className = "master-detail-expander expander-cell";
|
|
2746
2763
|
const c = document.createElement("span");
|
|
2747
2764
|
return c.className = `master-detail-toggle${l ? " expanded" : ""}`, this.setIcon(c, this.resolveIcon(l ? "collapse" : "expand")), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-expanded", String(l)), c.setAttribute("aria-label", l ? "Collapse details" : "Expand details"), d.appendChild(c), d;
|
|
@@ -2759,7 +2776,7 @@ class nt extends _ {
|
|
|
2759
2776
|
onKeyDown(e) {
|
|
2760
2777
|
if (e.key !== " ") return;
|
|
2761
2778
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2762
|
-
if (!n || !
|
|
2779
|
+
if (!n || !te(n)) return;
|
|
2763
2780
|
const r = this.rows[i];
|
|
2764
2781
|
if (r)
|
|
2765
2782
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -2774,12 +2791,12 @@ class nt extends _ {
|
|
|
2774
2791
|
if (!this.config.detailRenderer) return;
|
|
2775
2792
|
const e = this.gridElement?.querySelector(".rows");
|
|
2776
2793
|
if (!e) return;
|
|
2777
|
-
const t = this.grid, i = t._rowPool, n = t._virtualization?.start ?? 0, r = t._virtualization?.end ?? 0, o = this.columns.length,
|
|
2794
|
+
const t = this.grid, i = t._rowPool, n = t._virtualization?.start ?? 0, r = t._virtualization?.end ?? 0, o = this.columns.length, s = n, l = r, d = /* @__PURE__ */ new Map();
|
|
2778
2795
|
if (i) {
|
|
2779
|
-
const c = Math.min(i.length, l -
|
|
2796
|
+
const c = Math.min(i.length, l - s);
|
|
2780
2797
|
for (let u = 0; u < c; u++) {
|
|
2781
2798
|
const h = i[u];
|
|
2782
|
-
h.parentNode === e && d.set(
|
|
2799
|
+
h.parentNode === e && d.set(s + u, h);
|
|
2783
2800
|
}
|
|
2784
2801
|
} else {
|
|
2785
2802
|
const c = e.querySelectorAll(".data-grid-row");
|
|
@@ -2804,7 +2821,7 @@ class nt extends _ {
|
|
|
2804
2821
|
typeof this.config.detailHeight == "number" && (g.style.height = `${this.config.detailHeight}px`), u.after(g), this.detailElements.set(h, g);
|
|
2805
2822
|
const p = this.rowsToAnimate.has(h);
|
|
2806
2823
|
p && this.rowsToAnimate.delete(h), p && this.animateExpand(g, h, c) || requestAnimationFrame(() => {
|
|
2807
|
-
this.#
|
|
2824
|
+
this.#i(g, h, c);
|
|
2808
2825
|
});
|
|
2809
2826
|
}
|
|
2810
2827
|
}
|
|
@@ -2834,9 +2851,9 @@ class nt extends _ {
|
|
|
2834
2851
|
let r = e;
|
|
2835
2852
|
if (n && n.length > 0)
|
|
2836
2853
|
for (const o of this.expandedRows) {
|
|
2837
|
-
const
|
|
2838
|
-
if (
|
|
2839
|
-
n[
|
|
2854
|
+
const s = this.rows.indexOf(o);
|
|
2855
|
+
if (s < 0 || s >= e) continue;
|
|
2856
|
+
n[s].offset + n[s].height > t && s < r && (r = s);
|
|
2840
2857
|
}
|
|
2841
2858
|
else {
|
|
2842
2859
|
const o = [];
|
|
@@ -2845,10 +2862,10 @@ class nt extends _ {
|
|
|
2845
2862
|
d >= 0 && o.push({ index: d, row: l });
|
|
2846
2863
|
}
|
|
2847
2864
|
o.sort((l, d) => l.index - d.index);
|
|
2848
|
-
let
|
|
2865
|
+
let s = 0;
|
|
2849
2866
|
for (const { index: l, row: d } of o) {
|
|
2850
|
-
const c = l * i +
|
|
2851
|
-
|
|
2867
|
+
const c = l * i + s, u = this.getDetailHeight(d), h = c + i + u;
|
|
2868
|
+
s += u, !(l >= e) && h > t && l < r && (r = l);
|
|
2852
2869
|
}
|
|
2853
2870
|
}
|
|
2854
2871
|
return r;
|
|
@@ -2863,7 +2880,7 @@ class nt extends _ {
|
|
|
2863
2880
|
}
|
|
2864
2881
|
toggle(e) {
|
|
2865
2882
|
const t = this.rows[e];
|
|
2866
|
-
t && (this.expandedRows =
|
|
2883
|
+
t && (this.expandedRows = Me(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
|
|
2867
2884
|
}
|
|
2868
2885
|
isExpanded(e) {
|
|
2869
2886
|
const t = this.rows[e];
|
|
@@ -2897,32 +2914,32 @@ class nt extends _ {
|
|
|
2897
2914
|
}
|
|
2898
2915
|
}
|
|
2899
2916
|
}
|
|
2900
|
-
function ci(
|
|
2901
|
-
return e.length ? [...
|
|
2917
|
+
function ci(a, e, t) {
|
|
2918
|
+
return e.length ? [...a].sort((i, n) => {
|
|
2902
2919
|
for (const r of e) {
|
|
2903
|
-
const
|
|
2920
|
+
const s = t.find((u) => u.field === r.field)?.sortComparator ?? ui, l = i[r.field], d = n[r.field], c = s(l, d, i, n);
|
|
2904
2921
|
if (c !== 0)
|
|
2905
2922
|
return r.direction === "asc" ? c : -c;
|
|
2906
2923
|
}
|
|
2907
2924
|
return 0;
|
|
2908
|
-
}) : [...
|
|
2925
|
+
}) : [...a];
|
|
2909
2926
|
}
|
|
2910
|
-
function ui(
|
|
2911
|
-
return
|
|
2927
|
+
function ui(a, e) {
|
|
2928
|
+
return a == null && e == null ? 0 : a == null ? 1 : e == null ? -1 : typeof a == "number" && typeof e == "number" ? a - e : a instanceof Date && e instanceof Date ? a.getTime() - e.getTime() : typeof a == "boolean" && typeof e == "boolean" ? a === e ? 0 : a ? -1 : 1 : String(a).localeCompare(String(e));
|
|
2912
2929
|
}
|
|
2913
|
-
function hi(
|
|
2914
|
-
const n =
|
|
2915
|
-
return t ? n ? n.direction === "asc" ?
|
|
2930
|
+
function hi(a, e, t, i) {
|
|
2931
|
+
const n = a.find((r) => r.field === e);
|
|
2932
|
+
return t ? n ? n.direction === "asc" ? a.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : a.filter((r) => r.field !== e) : a.length < i ? [...a, { field: e, direction: "asc" }] : a : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
|
|
2916
2933
|
}
|
|
2917
|
-
function
|
|
2918
|
-
const t =
|
|
2934
|
+
function Ne(a, e) {
|
|
2935
|
+
const t = a.findIndex((i) => i.field === e);
|
|
2919
2936
|
return t >= 0 ? t + 1 : void 0;
|
|
2920
2937
|
}
|
|
2921
|
-
function
|
|
2922
|
-
return
|
|
2938
|
+
function qe(a, e) {
|
|
2939
|
+
return a.find((t) => t.field === e)?.direction;
|
|
2923
2940
|
}
|
|
2924
2941
|
const fi = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2925
|
-
class
|
|
2942
|
+
class Cn extends _ {
|
|
2926
2943
|
name = "multiSort";
|
|
2927
2944
|
styles = fi;
|
|
2928
2945
|
get defaultConfig() {
|
|
@@ -2950,11 +2967,11 @@ class xn extends _ {
|
|
|
2950
2967
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2951
2968
|
const r = n.getAttribute("data-field");
|
|
2952
2969
|
if (!r) return;
|
|
2953
|
-
const o =
|
|
2954
|
-
if (n.querySelector(".sort-index")?.remove(),
|
|
2955
|
-
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort",
|
|
2970
|
+
const o = Ne(this.sortModel, r), s = qe(this.sortModel, r);
|
|
2971
|
+
if (n.querySelector(".sort-index")?.remove(), s) {
|
|
2972
|
+
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
|
|
2956
2973
|
const c = document.createElement("span");
|
|
2957
|
-
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(
|
|
2974
|
+
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(s === "asc" ? "sortAsc" : "sortDesc"));
|
|
2958
2975
|
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), f = u ?? h;
|
|
2959
2976
|
if (f ? n.insertBefore(c, f) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
|
|
2960
2977
|
const g = document.createElement("span");
|
|
@@ -2974,10 +2991,10 @@ class xn extends _ {
|
|
|
2974
2991
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2975
2992
|
}
|
|
2976
2993
|
getSortIndex(e) {
|
|
2977
|
-
return
|
|
2994
|
+
return Ne(this.sortModel, e);
|
|
2978
2995
|
}
|
|
2979
2996
|
getSortDirection(e) {
|
|
2980
|
-
return
|
|
2997
|
+
return qe(this.sortModel, e);
|
|
2981
2998
|
}
|
|
2982
2999
|
getColumnState(e) {
|
|
2983
3000
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -3000,59 +3017,59 @@ class xn extends _ {
|
|
|
3000
3017
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
3001
3018
|
}
|
|
3002
3019
|
}
|
|
3003
|
-
function
|
|
3004
|
-
return
|
|
3020
|
+
function ot(a, e) {
|
|
3021
|
+
return mt(a, e);
|
|
3005
3022
|
}
|
|
3006
|
-
function
|
|
3007
|
-
const t =
|
|
3008
|
-
return t ?
|
|
3023
|
+
function st(a, e) {
|
|
3024
|
+
const t = a.sticky;
|
|
3025
|
+
return t ? ot(t, e) === "left" : !1;
|
|
3009
3026
|
}
|
|
3010
|
-
function
|
|
3011
|
-
const t =
|
|
3012
|
-
return t ?
|
|
3027
|
+
function at(a, e) {
|
|
3028
|
+
const t = a.sticky;
|
|
3029
|
+
return t ? ot(t, e) === "right" : !1;
|
|
3013
3030
|
}
|
|
3014
|
-
function gi(
|
|
3015
|
-
return
|
|
3031
|
+
function gi(a, e = "ltr") {
|
|
3032
|
+
return a.filter((t) => st(t, e));
|
|
3016
3033
|
}
|
|
3017
|
-
function pi(
|
|
3018
|
-
return
|
|
3034
|
+
function pi(a, e = "ltr") {
|
|
3035
|
+
return a.filter((t) => at(t, e));
|
|
3019
3036
|
}
|
|
3020
|
-
function
|
|
3021
|
-
return
|
|
3037
|
+
function ae(a) {
|
|
3038
|
+
return a.some(
|
|
3022
3039
|
(e) => e.sticky === "left" || e.sticky === "right" || e.sticky === "start" || e.sticky === "end"
|
|
3023
3040
|
);
|
|
3024
3041
|
}
|
|
3025
|
-
function
|
|
3026
|
-
const t = Array.from(
|
|
3042
|
+
function He(a, e) {
|
|
3043
|
+
const t = Array.from(a.querySelectorAll(".header-row .cell"));
|
|
3027
3044
|
if (!t.length) return;
|
|
3028
|
-
const i =
|
|
3029
|
-
e.forEach((
|
|
3030
|
-
|
|
3045
|
+
const i = he(a), n = /* @__PURE__ */ new Map();
|
|
3046
|
+
e.forEach((s, l) => {
|
|
3047
|
+
s.field && n.set(s.field, l);
|
|
3031
3048
|
});
|
|
3032
3049
|
let r = 0;
|
|
3033
|
-
for (const
|
|
3034
|
-
if (
|
|
3035
|
-
const l = n.get(
|
|
3036
|
-
d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 &&
|
|
3050
|
+
for (const s of e)
|
|
3051
|
+
if (st(s, i)) {
|
|
3052
|
+
const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
|
|
3053
|
+
d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 && a.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
|
|
3037
3054
|
c.classList.add("sticky-left"), c.style.position = "sticky", c.style.left = r + "px";
|
|
3038
3055
|
}), r += d.offsetWidth);
|
|
3039
3056
|
}
|
|
3040
3057
|
let o = 0;
|
|
3041
|
-
for (const
|
|
3042
|
-
if (
|
|
3043
|
-
const l = n.get(
|
|
3044
|
-
d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 &&
|
|
3058
|
+
for (const s of [...e].reverse())
|
|
3059
|
+
if (at(s, i)) {
|
|
3060
|
+
const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
|
|
3061
|
+
d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 && a.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
|
|
3045
3062
|
c.classList.add("sticky-right"), c.style.position = "sticky", c.style.right = o + "px";
|
|
3046
3063
|
}), o += d.offsetWidth);
|
|
3047
3064
|
}
|
|
3048
3065
|
}
|
|
3049
|
-
function
|
|
3050
|
-
|
|
3066
|
+
function Ke(a) {
|
|
3067
|
+
a.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
3051
3068
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
3052
3069
|
});
|
|
3053
3070
|
}
|
|
3054
|
-
const
|
|
3055
|
-
class
|
|
3071
|
+
const ze = "canMoveColumn";
|
|
3072
|
+
class En extends _ {
|
|
3056
3073
|
static manifest = {
|
|
3057
3074
|
ownedProperties: [
|
|
3058
3075
|
{
|
|
@@ -3064,7 +3081,7 @@ class Cn extends _ {
|
|
|
3064
3081
|
],
|
|
3065
3082
|
queries: [
|
|
3066
3083
|
{
|
|
3067
|
-
type:
|
|
3084
|
+
type: ze,
|
|
3068
3085
|
description: "Prevents pinned (sticky) columns from being moved/reordered"
|
|
3069
3086
|
},
|
|
3070
3087
|
{
|
|
@@ -3085,26 +3102,26 @@ class Cn extends _ {
|
|
|
3085
3102
|
}
|
|
3086
3103
|
static detect(e, t) {
|
|
3087
3104
|
const i = t?.columns;
|
|
3088
|
-
return Array.isArray(i) ?
|
|
3105
|
+
return Array.isArray(i) ? ae(i) : !1;
|
|
3089
3106
|
}
|
|
3090
3107
|
processColumns(e) {
|
|
3091
|
-
return this.isApplied =
|
|
3108
|
+
return this.isApplied = ae([...e]), [...e];
|
|
3092
3109
|
}
|
|
3093
3110
|
afterRender() {
|
|
3094
3111
|
if (!this.isApplied)
|
|
3095
3112
|
return;
|
|
3096
3113
|
const e = this.grid, t = [...this.columns];
|
|
3097
|
-
if (!
|
|
3098
|
-
|
|
3114
|
+
if (!ae(t)) {
|
|
3115
|
+
Ke(e), this.isApplied = !1;
|
|
3099
3116
|
return;
|
|
3100
3117
|
}
|
|
3101
3118
|
queueMicrotask(() => {
|
|
3102
|
-
|
|
3119
|
+
He(e, t);
|
|
3103
3120
|
});
|
|
3104
3121
|
}
|
|
3105
3122
|
handleQuery(e) {
|
|
3106
3123
|
switch (e.type) {
|
|
3107
|
-
case
|
|
3124
|
+
case ze: {
|
|
3108
3125
|
const t = e.context, i = t.sticky;
|
|
3109
3126
|
if (i === "left" || i === "right" || i === "start" || i === "end")
|
|
3110
3127
|
return !1;
|
|
@@ -3122,28 +3139,28 @@ class Cn extends _ {
|
|
|
3122
3139
|
}
|
|
3123
3140
|
refreshStickyOffsets() {
|
|
3124
3141
|
const e = [...this.columns];
|
|
3125
|
-
|
|
3142
|
+
He(this.grid, e);
|
|
3126
3143
|
}
|
|
3127
3144
|
getLeftPinnedColumns() {
|
|
3128
|
-
const e = [...this.columns], t =
|
|
3145
|
+
const e = [...this.columns], t = he(this.grid);
|
|
3129
3146
|
return gi(e, t);
|
|
3130
3147
|
}
|
|
3131
3148
|
getRightPinnedColumns() {
|
|
3132
|
-
const e = [...this.columns], t =
|
|
3149
|
+
const e = [...this.columns], t = he(this.grid);
|
|
3133
3150
|
return pi(e, t);
|
|
3134
3151
|
}
|
|
3135
3152
|
clearStickyPositions() {
|
|
3136
|
-
|
|
3153
|
+
Ke(this.grid);
|
|
3137
3154
|
}
|
|
3138
3155
|
getHorizontalScrollOffsets(e, t) {
|
|
3139
3156
|
if (!this.isApplied)
|
|
3140
3157
|
return;
|
|
3141
3158
|
let i = 0, n = 0;
|
|
3142
3159
|
if (e) {
|
|
3143
|
-
const o = e.querySelectorAll(".sticky-left"),
|
|
3160
|
+
const o = e.querySelectorAll(".sticky-left"), s = e.querySelectorAll(".sticky-right");
|
|
3144
3161
|
o.forEach((l) => {
|
|
3145
3162
|
i += l.offsetWidth;
|
|
3146
|
-
}),
|
|
3163
|
+
}), s.forEach((l) => {
|
|
3147
3164
|
n += l.offsetWidth;
|
|
3148
3165
|
});
|
|
3149
3166
|
} else
|
|
@@ -3154,10 +3171,10 @@ class Cn extends _ {
|
|
|
3154
3171
|
return { left: i, right: n, skipScroll: r };
|
|
3155
3172
|
}
|
|
3156
3173
|
}
|
|
3157
|
-
function mi(
|
|
3158
|
-
return typeof
|
|
3174
|
+
function mi(a) {
|
|
3175
|
+
return typeof a == "object" && a !== null && "aggFunc" in a;
|
|
3159
3176
|
}
|
|
3160
|
-
function
|
|
3177
|
+
function le(a, e) {
|
|
3161
3178
|
const t = document.createElement("div");
|
|
3162
3179
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
3163
3180
|
const i = document.createElement("div");
|
|
@@ -3165,41 +3182,41 @@ function ae(s, e) {
|
|
|
3165
3182
|
const n = document.createElement("div");
|
|
3166
3183
|
n.className = "tbw-pinned-rows-center";
|
|
3167
3184
|
const r = document.createElement("div");
|
|
3168
|
-
if (r.className = "tbw-pinned-rows-right",
|
|
3185
|
+
if (r.className = "tbw-pinned-rows-right", a.showRowCount !== !1) {
|
|
3169
3186
|
const o = document.createElement("span");
|
|
3170
3187
|
o.className = "tbw-status-panel tbw-status-panel-row-count", o.textContent = `Total: ${e.totalRows} rows`, i.appendChild(o);
|
|
3171
3188
|
}
|
|
3172
|
-
if (
|
|
3189
|
+
if (a.showFilteredCount && e.filteredRows !== e.totalRows) {
|
|
3173
3190
|
const o = document.createElement("span");
|
|
3174
3191
|
o.className = "tbw-status-panel tbw-status-panel-filtered-count", o.textContent = `Filtered: ${e.filteredRows}`, i.appendChild(o);
|
|
3175
3192
|
}
|
|
3176
|
-
if (
|
|
3193
|
+
if (a.showSelectedCount && e.selectedRows > 0) {
|
|
3177
3194
|
const o = document.createElement("span");
|
|
3178
3195
|
o.className = "tbw-status-panel tbw-status-panel-selected-count", o.textContent = `Selected: ${e.selectedRows}`, r.appendChild(o);
|
|
3179
3196
|
}
|
|
3180
|
-
if (
|
|
3181
|
-
for (const o of
|
|
3182
|
-
const
|
|
3197
|
+
if (a.customPanels)
|
|
3198
|
+
for (const o of a.customPanels) {
|
|
3199
|
+
const s = wi(o, e);
|
|
3183
3200
|
switch (o.position) {
|
|
3184
3201
|
case "left":
|
|
3185
|
-
i.appendChild(
|
|
3202
|
+
i.appendChild(s);
|
|
3186
3203
|
break;
|
|
3187
3204
|
case "center":
|
|
3188
|
-
n.appendChild(
|
|
3205
|
+
n.appendChild(s);
|
|
3189
3206
|
break;
|
|
3190
3207
|
case "right":
|
|
3191
|
-
r.appendChild(
|
|
3208
|
+
r.appendChild(s);
|
|
3192
3209
|
break;
|
|
3193
3210
|
}
|
|
3194
3211
|
}
|
|
3195
3212
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
3196
3213
|
}
|
|
3197
|
-
function
|
|
3214
|
+
function Oe(a) {
|
|
3198
3215
|
const e = document.createElement("div");
|
|
3199
|
-
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${
|
|
3216
|
+
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${a}`, e.setAttribute("role", "presentation"), e;
|
|
3200
3217
|
}
|
|
3201
|
-
function
|
|
3202
|
-
|
|
3218
|
+
function Ge(a, e, t, i) {
|
|
3219
|
+
a.innerHTML = "";
|
|
3203
3220
|
for (const n of e) {
|
|
3204
3221
|
const r = document.createElement("div");
|
|
3205
3222
|
if (r.className = "tbw-aggregation-row", r.setAttribute("role", "presentation"), n.id && r.setAttribute("data-aggregation-id", n.id), n.fullWidth) {
|
|
@@ -3207,8 +3224,8 @@ function Oe(s, e, t, i) {
|
|
|
3207
3224
|
o.className = "tbw-aggregation-cell tbw-aggregation-cell-full", o.style.gridColumn = "1 / -1", o.textContent = n.label || "", r.appendChild(o);
|
|
3208
3225
|
} else
|
|
3209
3226
|
for (const o of t) {
|
|
3210
|
-
const
|
|
3211
|
-
|
|
3227
|
+
const s = document.createElement("div");
|
|
3228
|
+
s.className = "tbw-aggregation-cell", s.setAttribute("data-field", o.field);
|
|
3212
3229
|
let l, d;
|
|
3213
3230
|
const c = n.aggregators?.[o.field];
|
|
3214
3231
|
if (c)
|
|
@@ -3223,29 +3240,29 @@ function Oe(s, e, t, i) {
|
|
|
3223
3240
|
const u = n.cells[o.field];
|
|
3224
3241
|
typeof u == "function" ? l = u(i, o.field, o) : l = u;
|
|
3225
3242
|
}
|
|
3226
|
-
l != null ?
|
|
3243
|
+
l != null ? s.textContent = d ? d(l, o.field, o) : String(l) : s.textContent = "", r.appendChild(s);
|
|
3227
3244
|
}
|
|
3228
|
-
|
|
3245
|
+
a.appendChild(r);
|
|
3229
3246
|
}
|
|
3230
3247
|
}
|
|
3231
|
-
function wi(
|
|
3248
|
+
function wi(a, e) {
|
|
3232
3249
|
const t = document.createElement("div");
|
|
3233
|
-
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${
|
|
3234
|
-
const i =
|
|
3250
|
+
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
|
|
3251
|
+
const i = a.render(e);
|
|
3235
3252
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
3236
3253
|
}
|
|
3237
|
-
function
|
|
3254
|
+
function Be(a, e, t, i, n) {
|
|
3238
3255
|
return {
|
|
3239
|
-
totalRows:
|
|
3240
|
-
filteredRows: n?.cachedResult?.length ??
|
|
3256
|
+
totalRows: a.length,
|
|
3257
|
+
filteredRows: n?.cachedResult?.length ?? a.length,
|
|
3241
3258
|
selectedRows: i?.selected?.size ?? 0,
|
|
3242
3259
|
columns: e,
|
|
3243
|
-
rows:
|
|
3260
|
+
rows: a,
|
|
3244
3261
|
grid: t
|
|
3245
3262
|
};
|
|
3246
3263
|
}
|
|
3247
3264
|
const bi = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
3248
|
-
class
|
|
3265
|
+
class Rn extends _ {
|
|
3249
3266
|
name = "pinnedRows";
|
|
3250
3267
|
styles = bi;
|
|
3251
3268
|
get defaultConfig() {
|
|
@@ -3269,22 +3286,22 @@ class En extends _ {
|
|
|
3269
3286
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
3270
3287
|
if (!t) return;
|
|
3271
3288
|
this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
|
|
3272
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
3289
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Be(
|
|
3273
3290
|
this.sourceRows,
|
|
3274
3291
|
this.columns,
|
|
3275
3292
|
this.grid,
|
|
3276
3293
|
i,
|
|
3277
3294
|
n
|
|
3278
|
-
), o = this.config.aggregationRows || [],
|
|
3279
|
-
if (
|
|
3295
|
+
), o = this.config.aggregationRows || [], s = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
3296
|
+
if (s.length > 0) {
|
|
3280
3297
|
if (!this.topAggregationContainer) {
|
|
3281
|
-
this.topAggregationContainer =
|
|
3298
|
+
this.topAggregationContainer = Oe("top");
|
|
3282
3299
|
const h = e.querySelector(".header");
|
|
3283
3300
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
3284
3301
|
}
|
|
3285
|
-
|
|
3302
|
+
Ge(
|
|
3286
3303
|
this.topAggregationContainer,
|
|
3287
|
-
|
|
3304
|
+
s,
|
|
3288
3305
|
this.visibleColumns,
|
|
3289
3306
|
this.sourceRows
|
|
3290
3307
|
);
|
|
@@ -3292,18 +3309,18 @@ class En extends _ {
|
|
|
3292
3309
|
const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && r.selectedRows > 0 || this.config.showFilteredCount && r.filteredRows !== r.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = l.length > 0 || c;
|
|
3293
3310
|
if (d && this.config.position === "top")
|
|
3294
3311
|
if (!this.infoBarElement)
|
|
3295
|
-
this.infoBarElement =
|
|
3312
|
+
this.infoBarElement = le(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
3296
3313
|
else {
|
|
3297
|
-
const h =
|
|
3314
|
+
const h = le(this.config, r);
|
|
3298
3315
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
3299
3316
|
}
|
|
3300
3317
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
3301
|
-
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer =
|
|
3318
|
+
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Oe("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Ge(
|
|
3302
3319
|
this.bottomAggregationContainer,
|
|
3303
3320
|
l,
|
|
3304
3321
|
this.visibleColumns,
|
|
3305
3322
|
this.sourceRows
|
|
3306
|
-
)), c && (this.infoBarElement =
|
|
3323
|
+
)), c && (this.infoBarElement = le(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
3307
3324
|
}
|
|
3308
3325
|
cleanup() {
|
|
3309
3326
|
this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null), this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null), this.bottomAggregationContainer && (this.bottomAggregationContainer.remove(), this.bottomAggregationContainer = null), this.footerWrapper && (this.footerWrapper.remove(), this.footerWrapper = null);
|
|
@@ -3330,7 +3347,7 @@ class En extends _ {
|
|
|
3330
3347
|
}
|
|
3331
3348
|
getContext() {
|
|
3332
3349
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
3333
|
-
return
|
|
3350
|
+
return Be(
|
|
3334
3351
|
this.rows,
|
|
3335
3352
|
this.columns,
|
|
3336
3353
|
this.grid,
|
|
@@ -3351,67 +3368,67 @@ class En extends _ {
|
|
|
3351
3368
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3352
3369
|
}
|
|
3353
3370
|
}
|
|
3354
|
-
const vi =
|
|
3355
|
-
function yi(
|
|
3371
|
+
const vi = wt;
|
|
3372
|
+
function yi(a) {
|
|
3356
3373
|
const e = [];
|
|
3357
|
-
return !
|
|
3374
|
+
return !a.rowGroupFields?.length && !a.columnGroupFields?.length && e.push("At least one row or column group field is required"), a.valueFields?.length || e.push("At least one value field is required"), e;
|
|
3358
3375
|
}
|
|
3359
|
-
function be(
|
|
3360
|
-
return [...
|
|
3376
|
+
function be(a, e) {
|
|
3377
|
+
return [...a, e].join("|");
|
|
3361
3378
|
}
|
|
3362
|
-
function xi(
|
|
3363
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(
|
|
3364
|
-
|
|
3379
|
+
function xi(a, e) {
|
|
3380
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(a, i), o = lt(
|
|
3381
|
+
a,
|
|
3365
3382
|
t,
|
|
3366
3383
|
i,
|
|
3367
3384
|
r,
|
|
3368
3385
|
n,
|
|
3369
3386
|
0,
|
|
3370
3387
|
""
|
|
3371
|
-
),
|
|
3388
|
+
), s = Ri(o, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
|
|
3372
3389
|
return {
|
|
3373
3390
|
rows: o,
|
|
3374
3391
|
columnKeys: r,
|
|
3375
|
-
totals:
|
|
3392
|
+
totals: s,
|
|
3376
3393
|
grandTotal: l
|
|
3377
3394
|
};
|
|
3378
3395
|
}
|
|
3379
|
-
function Ci(
|
|
3396
|
+
function Ci(a, e) {
|
|
3380
3397
|
if (e.length === 0) return ["value"];
|
|
3381
3398
|
const t = /* @__PURE__ */ new Set();
|
|
3382
|
-
for (const i of
|
|
3399
|
+
for (const i of a) {
|
|
3383
3400
|
const n = e.map((r) => String(i[r] ?? "")).join("|");
|
|
3384
3401
|
t.add(n);
|
|
3385
3402
|
}
|
|
3386
3403
|
return [...t].sort();
|
|
3387
3404
|
}
|
|
3388
|
-
function Ei(
|
|
3405
|
+
function Ei(a, e) {
|
|
3389
3406
|
const t = /* @__PURE__ */ new Map();
|
|
3390
|
-
for (const i of
|
|
3407
|
+
for (const i of a) {
|
|
3391
3408
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
3392
3409
|
r ? r.push(i) : t.set(n, [i]);
|
|
3393
3410
|
}
|
|
3394
3411
|
return t;
|
|
3395
3412
|
}
|
|
3396
|
-
function
|
|
3397
|
-
const
|
|
3413
|
+
function lt(a, e, t, i, n, r, o) {
|
|
3414
|
+
const s = [];
|
|
3398
3415
|
if (e.length === 0) {
|
|
3399
|
-
const h =
|
|
3400
|
-
return
|
|
3416
|
+
const h = Ve(a, t, i, n), f = We(h);
|
|
3417
|
+
return s.push({
|
|
3401
3418
|
rowKey: o || "all",
|
|
3402
3419
|
rowLabel: o || "All",
|
|
3403
3420
|
depth: r,
|
|
3404
3421
|
values: h,
|
|
3405
3422
|
total: f,
|
|
3406
3423
|
isGroup: !1,
|
|
3407
|
-
rowCount:
|
|
3408
|
-
}),
|
|
3424
|
+
rowCount: a.length
|
|
3425
|
+
}), s;
|
|
3409
3426
|
}
|
|
3410
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(
|
|
3427
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
|
|
3411
3428
|
for (const [h, f] of u) {
|
|
3412
|
-
const g = o ? `${o}|${h}` : h, p =
|
|
3429
|
+
const g = o ? `${o}|${h}` : h, p = Ve(f, t, i, n), w = We(p);
|
|
3413
3430
|
let b;
|
|
3414
|
-
c && (b =
|
|
3431
|
+
c && (b = lt(
|
|
3415
3432
|
f,
|
|
3416
3433
|
d,
|
|
3417
3434
|
t,
|
|
@@ -3419,7 +3436,7 @@ function at(s, e, t, i, n, r, o) {
|
|
|
3419
3436
|
n,
|
|
3420
3437
|
r + 1,
|
|
3421
3438
|
g
|
|
3422
|
-
)),
|
|
3439
|
+
)), s.push({
|
|
3423
3440
|
rowKey: g,
|
|
3424
3441
|
rowLabel: h || "(blank)",
|
|
3425
3442
|
depth: r,
|
|
@@ -3430,90 +3447,90 @@ function at(s, e, t, i, n, r, o) {
|
|
|
3430
3447
|
rowCount: f.length
|
|
3431
3448
|
});
|
|
3432
3449
|
}
|
|
3433
|
-
return
|
|
3450
|
+
return s;
|
|
3434
3451
|
}
|
|
3435
|
-
function
|
|
3452
|
+
function Ve(a, e, t, i) {
|
|
3436
3453
|
const n = {};
|
|
3437
3454
|
for (const r of t)
|
|
3438
3455
|
for (const o of i) {
|
|
3439
|
-
const l = (e.length > 0 ?
|
|
3456
|
+
const l = (e.length > 0 ? a.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d = vi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
|
|
3440
3457
|
n[u] = c;
|
|
3441
3458
|
}
|
|
3442
3459
|
return n;
|
|
3443
3460
|
}
|
|
3444
|
-
function
|
|
3461
|
+
function We(a) {
|
|
3445
3462
|
let e = 0;
|
|
3446
|
-
for (const t of Object.values(
|
|
3463
|
+
for (const t of Object.values(a))
|
|
3447
3464
|
e += t ?? 0;
|
|
3448
3465
|
return e;
|
|
3449
3466
|
}
|
|
3450
|
-
function Ri(
|
|
3467
|
+
function Ri(a, e, t) {
|
|
3451
3468
|
const i = {};
|
|
3452
3469
|
function n(r) {
|
|
3453
3470
|
for (const o of r)
|
|
3454
3471
|
if (!o.isGroup || !o.children?.length)
|
|
3455
|
-
for (const
|
|
3472
|
+
for (const s of e)
|
|
3456
3473
|
for (const l of t) {
|
|
3457
|
-
const d = be([
|
|
3474
|
+
const d = be([s], l.field);
|
|
3458
3475
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
3459
3476
|
}
|
|
3460
3477
|
else o.children && n(o.children);
|
|
3461
3478
|
}
|
|
3462
|
-
return n(
|
|
3479
|
+
return n(a), i;
|
|
3463
3480
|
}
|
|
3464
|
-
function Si(
|
|
3481
|
+
function Si(a, e, t = !0) {
|
|
3465
3482
|
const i = [];
|
|
3466
3483
|
function n(r) {
|
|
3467
3484
|
i.push(r);
|
|
3468
3485
|
const o = e ? e.has(r.rowKey) : t;
|
|
3469
3486
|
if (r.children && o)
|
|
3470
|
-
for (const
|
|
3471
|
-
n(
|
|
3487
|
+
for (const s of r.children)
|
|
3488
|
+
n(s);
|
|
3472
3489
|
}
|
|
3473
|
-
for (const r of
|
|
3490
|
+
for (const r of a)
|
|
3474
3491
|
n(r);
|
|
3475
3492
|
return i;
|
|
3476
3493
|
}
|
|
3477
|
-
function ki(
|
|
3494
|
+
function ki(a) {
|
|
3478
3495
|
const e = [];
|
|
3479
3496
|
function t(i) {
|
|
3480
3497
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
3481
3498
|
for (const n of i.children)
|
|
3482
3499
|
t(n);
|
|
3483
3500
|
}
|
|
3484
|
-
for (const i of
|
|
3501
|
+
for (const i of a)
|
|
3485
3502
|
t(i);
|
|
3486
3503
|
return e;
|
|
3487
3504
|
}
|
|
3488
3505
|
const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3489
|
-
function _i(
|
|
3506
|
+
function _i(a, e, t, i) {
|
|
3490
3507
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3491
|
-
return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () =>
|
|
3508
|
+
return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () => $e("rowGroups", r))), o.appendChild(Y("Column Groups", () => $e("columnGroups", r))), o.appendChild(Y("Values", () => Li(r))), o.appendChild(Y("Available Fields", () => Fi(r))), a.appendChild(o), () => {
|
|
3492
3509
|
n.abort(), o.remove();
|
|
3493
3510
|
};
|
|
3494
3511
|
}
|
|
3495
|
-
function Y(
|
|
3512
|
+
function Y(a, e) {
|
|
3496
3513
|
const t = document.createElement("div");
|
|
3497
3514
|
t.className = "tbw-pivot-section";
|
|
3498
3515
|
const i = document.createElement("div");
|
|
3499
|
-
i.className = "tbw-pivot-section-header", i.textContent =
|
|
3516
|
+
i.className = "tbw-pivot-section-header", i.textContent = a;
|
|
3500
3517
|
const n = document.createElement("div");
|
|
3501
3518
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3502
3519
|
}
|
|
3503
|
-
function
|
|
3520
|
+
function $e(a, e) {
|
|
3504
3521
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3505
|
-
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone",
|
|
3506
|
-
const o =
|
|
3522
|
+
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", a);
|
|
3523
|
+
const o = a === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
3507
3524
|
if (o.length === 0) {
|
|
3508
|
-
const
|
|
3509
|
-
|
|
3525
|
+
const s = document.createElement("div");
|
|
3526
|
+
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3510
3527
|
} else
|
|
3511
|
-
for (const
|
|
3512
|
-
r.appendChild(Ti(
|
|
3528
|
+
for (const s of o)
|
|
3529
|
+
r.appendChild(Ti(s, a, e));
|
|
3513
3530
|
return r.addEventListener(
|
|
3514
3531
|
"dragover",
|
|
3515
|
-
(
|
|
3516
|
-
|
|
3532
|
+
(s) => {
|
|
3533
|
+
s.preventDefault(), r.classList.add("drag-over");
|
|
3517
3534
|
},
|
|
3518
3535
|
{ signal: n }
|
|
3519
3536
|
), r.addEventListener(
|
|
@@ -3524,30 +3541,30 @@ function We(s, e) {
|
|
|
3524
3541
|
{ signal: n }
|
|
3525
3542
|
), r.addEventListener(
|
|
3526
3543
|
"drop",
|
|
3527
|
-
(
|
|
3528
|
-
|
|
3529
|
-
const l =
|
|
3530
|
-
l && i.onAddFieldToZone(l,
|
|
3544
|
+
(s) => {
|
|
3545
|
+
s.preventDefault(), r.classList.remove("drag-over");
|
|
3546
|
+
const l = s.dataTransfer?.getData("text/plain");
|
|
3547
|
+
l && i.onAddFieldToZone(l, a);
|
|
3531
3548
|
},
|
|
3532
3549
|
{ signal: n }
|
|
3533
3550
|
), r;
|
|
3534
3551
|
}
|
|
3535
|
-
function Ti(
|
|
3552
|
+
function Ti(a, e, t) {
|
|
3536
3553
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3537
3554
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3538
|
-
const o = i.getAvailableFields().find((d) => d.field ===
|
|
3539
|
-
|
|
3555
|
+
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
3556
|
+
s.className = "tbw-pivot-chip-label", s.textContent = o?.header ?? a;
|
|
3540
3557
|
const l = document.createElement("button");
|
|
3541
3558
|
return l.className = "tbw-pivot-chip-remove", l.innerHTML = "×", l.title = "Remove field", l.addEventListener(
|
|
3542
3559
|
"click",
|
|
3543
3560
|
(d) => {
|
|
3544
|
-
d.stopPropagation(), i.onRemoveFieldFromZone(
|
|
3561
|
+
d.stopPropagation(), i.onRemoveFieldFromZone(a, e);
|
|
3545
3562
|
},
|
|
3546
3563
|
{ signal: n }
|
|
3547
|
-
), r.appendChild(
|
|
3564
|
+
), r.appendChild(s), r.appendChild(l), r.addEventListener(
|
|
3548
3565
|
"dragstart",
|
|
3549
3566
|
(d) => {
|
|
3550
|
-
d.dataTransfer?.setData("text/plain",
|
|
3567
|
+
d.dataTransfer?.setData("text/plain", a), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
|
|
3551
3568
|
},
|
|
3552
3569
|
{ signal: n }
|
|
3553
3570
|
), r.addEventListener(
|
|
@@ -3558,8 +3575,8 @@ function Ti(s, e, t) {
|
|
|
3558
3575
|
{ signal: n }
|
|
3559
3576
|
), r;
|
|
3560
3577
|
}
|
|
3561
|
-
function Li(
|
|
3562
|
-
const { config: e, callbacks: t, signal: i } =
|
|
3578
|
+
function Li(a) {
|
|
3579
|
+
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3563
3580
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3564
3581
|
const r = e.valueFields ?? [];
|
|
3565
3582
|
if (r.length === 0) {
|
|
@@ -3567,7 +3584,7 @@ function Li(s) {
|
|
|
3567
3584
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3568
3585
|
} else
|
|
3569
3586
|
for (const o of r)
|
|
3570
|
-
n.appendChild(Ii(o,
|
|
3587
|
+
n.appendChild(Ii(o, a));
|
|
3571
3588
|
return n.addEventListener(
|
|
3572
3589
|
"dragover",
|
|
3573
3590
|
(o) => {
|
|
@@ -3584,29 +3601,29 @@ function Li(s) {
|
|
|
3584
3601
|
"drop",
|
|
3585
3602
|
(o) => {
|
|
3586
3603
|
o.preventDefault(), n.classList.remove("drag-over");
|
|
3587
|
-
const
|
|
3588
|
-
|
|
3604
|
+
const s = o.dataTransfer?.getData("text/plain");
|
|
3605
|
+
s && t.onAddValueField(s, "sum");
|
|
3589
3606
|
},
|
|
3590
3607
|
{ signal: i }
|
|
3591
3608
|
), n;
|
|
3592
3609
|
}
|
|
3593
|
-
function Ii(
|
|
3610
|
+
function Ii(a, e) {
|
|
3594
3611
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3595
3612
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3596
|
-
const r = t.getAvailableFields().find((c) => c.field ===
|
|
3613
|
+
const r = t.getAvailableFields().find((c) => c.field === a.field), o = document.createElement("div");
|
|
3597
3614
|
o.className = "tbw-pivot-value-label-wrapper";
|
|
3598
|
-
const
|
|
3599
|
-
|
|
3615
|
+
const s = document.createElement("span");
|
|
3616
|
+
s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? a.field;
|
|
3600
3617
|
const l = document.createElement("select");
|
|
3601
3618
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3602
3619
|
for (const c of Ai) {
|
|
3603
3620
|
const u = document.createElement("option");
|
|
3604
|
-
u.value = c, u.textContent = c.toUpperCase(), u.selected = c ===
|
|
3621
|
+
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === a.aggFunc, l.appendChild(u);
|
|
3605
3622
|
}
|
|
3606
3623
|
l.addEventListener(
|
|
3607
3624
|
"change",
|
|
3608
3625
|
() => {
|
|
3609
|
-
t.onUpdateValueAggFunc(
|
|
3626
|
+
t.onUpdateValueAggFunc(a.field, l.value);
|
|
3610
3627
|
},
|
|
3611
3628
|
{ signal: i }
|
|
3612
3629
|
);
|
|
@@ -3614,24 +3631,24 @@ function Ii(s, e) {
|
|
|
3614
3631
|
return d.className = "tbw-pivot-chip-remove", d.innerHTML = "×", d.title = "Remove value field", d.addEventListener(
|
|
3615
3632
|
"click",
|
|
3616
3633
|
(c) => {
|
|
3617
|
-
c.stopPropagation(), t.onRemoveValueField(
|
|
3634
|
+
c.stopPropagation(), t.onRemoveValueField(a.field);
|
|
3618
3635
|
},
|
|
3619
3636
|
{ signal: i }
|
|
3620
|
-
), o.appendChild(
|
|
3637
|
+
), o.appendChild(s), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3621
3638
|
}
|
|
3622
|
-
function Fi(
|
|
3623
|
-
const { config: e, callbacks: t, signal: i } =
|
|
3639
|
+
function Fi(a) {
|
|
3640
|
+
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3624
3641
|
n.className = "tbw-pivot-available-fields";
|
|
3625
3642
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
3626
3643
|
...e.rowGroupFields ?? [],
|
|
3627
3644
|
...e.columnGroupFields ?? [],
|
|
3628
3645
|
...e.valueFields?.map((l) => l.field) ?? []
|
|
3629
|
-
]),
|
|
3630
|
-
if (
|
|
3646
|
+
]), s = r.filter((l) => !o.has(l.field));
|
|
3647
|
+
if (s.length === 0) {
|
|
3631
3648
|
const l = document.createElement("div");
|
|
3632
3649
|
l.className = "tbw-pivot-placeholder", l.textContent = "All fields are in use", n.appendChild(l);
|
|
3633
3650
|
} else
|
|
3634
|
-
for (const l of
|
|
3651
|
+
for (const l of s) {
|
|
3635
3652
|
const d = document.createElement("div");
|
|
3636
3653
|
d.className = "tbw-pivot-field-chip available", d.textContent = l.header, d.draggable = !0, d.title = `Drag to add "${l.field}" to a zone`, d.addEventListener(
|
|
3637
3654
|
"dragstart",
|
|
@@ -3649,19 +3666,19 @@ function Fi(s) {
|
|
|
3649
3666
|
}
|
|
3650
3667
|
return n;
|
|
3651
3668
|
}
|
|
3652
|
-
function Pi(
|
|
3669
|
+
function Pi(a, e) {
|
|
3653
3670
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3654
3671
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3655
|
-
|
|
3672
|
+
de(
|
|
3656
3673
|
"Enable Pivot View",
|
|
3657
|
-
|
|
3674
|
+
a,
|
|
3658
3675
|
(o) => {
|
|
3659
3676
|
i.onTogglePivot(o);
|
|
3660
3677
|
},
|
|
3661
3678
|
n
|
|
3662
3679
|
)
|
|
3663
3680
|
), r.appendChild(
|
|
3664
|
-
|
|
3681
|
+
de(
|
|
3665
3682
|
"Show Row Totals",
|
|
3666
3683
|
t.showTotals ?? !0,
|
|
3667
3684
|
(o) => {
|
|
@@ -3670,7 +3687,7 @@ function Pi(s, e) {
|
|
|
3670
3687
|
n
|
|
3671
3688
|
)
|
|
3672
3689
|
), r.appendChild(
|
|
3673
|
-
|
|
3690
|
+
de(
|
|
3674
3691
|
"Show Grand Total",
|
|
3675
3692
|
t.showGrandTotal ?? !0,
|
|
3676
3693
|
(o) => {
|
|
@@ -3680,58 +3697,58 @@ function Pi(s, e) {
|
|
|
3680
3697
|
)
|
|
3681
3698
|
), r;
|
|
3682
3699
|
}
|
|
3683
|
-
function
|
|
3700
|
+
function de(a, e, t, i) {
|
|
3684
3701
|
const n = document.createElement("label");
|
|
3685
3702
|
n.className = "tbw-pivot-checkbox";
|
|
3686
3703
|
const r = document.createElement("input");
|
|
3687
3704
|
r.type = "checkbox", r.checked = e, r.addEventListener("change", () => t(r.checked), { signal: i });
|
|
3688
3705
|
const o = document.createElement("span");
|
|
3689
|
-
return o.textContent =
|
|
3706
|
+
return o.textContent = a, n.appendChild(r), n.appendChild(o), n;
|
|
3690
3707
|
}
|
|
3691
|
-
function Di(
|
|
3692
|
-
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(
|
|
3708
|
+
function Di(a, e, t) {
|
|
3709
|
+
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
|
|
3693
3710
|
const r = document.createElement("div");
|
|
3694
3711
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
3695
|
-
const o = Number(
|
|
3712
|
+
const o = Number(a.__pivotIndent) || 0;
|
|
3696
3713
|
r.style.paddingLeft = `${o}px`;
|
|
3697
|
-
const
|
|
3698
|
-
l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label",
|
|
3699
|
-
u.stopPropagation(), t.onToggle(
|
|
3714
|
+
const s = String(a.__pivotRowKey), l = document.createElement("button");
|
|
3715
|
+
l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label", a.__pivotExpanded ? "Collapse group" : "Expand group"), t.setIcon(l, t.resolveIcon(a.__pivotExpanded ? "collapse" : "expand")), l.addEventListener("click", (u) => {
|
|
3716
|
+
u.stopPropagation(), t.onToggle(s);
|
|
3700
3717
|
}), r.appendChild(l);
|
|
3701
3718
|
const d = document.createElement("span");
|
|
3702
|
-
d.className = "pivot-label", d.textContent = String(
|
|
3719
|
+
d.className = "pivot-label", d.textContent = String(a.__pivotLabel ?? ""), r.appendChild(d);
|
|
3703
3720
|
const c = document.createElement("span");
|
|
3704
|
-
c.className = "pivot-count", c.textContent = ` (${Number(
|
|
3721
|
+
c.className = "pivot-count", c.textContent = ` (${Number(a.__pivotRowCount) || 0})`, r.appendChild(c);
|
|
3705
3722
|
} else {
|
|
3706
|
-
const o =
|
|
3723
|
+
const o = a[i.field];
|
|
3707
3724
|
r.textContent = o != null ? String(o) : "";
|
|
3708
3725
|
}
|
|
3709
3726
|
e.appendChild(r);
|
|
3710
3727
|
}), !0;
|
|
3711
3728
|
}
|
|
3712
|
-
function Mi(
|
|
3713
|
-
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(
|
|
3729
|
+
function Mi(a, e, t, i) {
|
|
3730
|
+
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
|
|
3714
3731
|
const o = document.createElement("div");
|
|
3715
3732
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
3716
|
-
const
|
|
3717
|
-
o.style.paddingLeft = `${
|
|
3733
|
+
const s = Number(a.__pivotIndent) || 0;
|
|
3734
|
+
o.style.paddingLeft = `${s + 20}px`;
|
|
3718
3735
|
const l = document.createElement("span");
|
|
3719
|
-
l.className = "pivot-label", l.textContent = String(
|
|
3736
|
+
l.className = "pivot-label", l.textContent = String(a.__pivotLabel ?? ""), o.appendChild(l);
|
|
3720
3737
|
} else {
|
|
3721
|
-
const
|
|
3722
|
-
o.textContent =
|
|
3738
|
+
const s = a[n.field];
|
|
3739
|
+
o.textContent = s != null ? String(s) : "";
|
|
3723
3740
|
}
|
|
3724
3741
|
e.appendChild(o);
|
|
3725
3742
|
}), !0;
|
|
3726
3743
|
}
|
|
3727
|
-
function Ni(
|
|
3744
|
+
function Ni(a, e, t) {
|
|
3728
3745
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3729
3746
|
const r = document.createElement("div");
|
|
3730
3747
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
3731
3748
|
const o = document.createElement("span");
|
|
3732
3749
|
o.className = "pivot-label", o.textContent = "Grand Total", r.appendChild(o);
|
|
3733
3750
|
} else {
|
|
3734
|
-
const o =
|
|
3751
|
+
const o = a[i.field];
|
|
3735
3752
|
r.textContent = o != null ? String(o) : "";
|
|
3736
3753
|
}
|
|
3737
3754
|
e.appendChild(r);
|
|
@@ -3809,8 +3826,8 @@ class B extends _ {
|
|
|
3809
3826
|
this.keysToAnimate.clear();
|
|
3810
3827
|
const r = /* @__PURE__ */ new Set();
|
|
3811
3828
|
for (const o of n) {
|
|
3812
|
-
const
|
|
3813
|
-
r.add(
|
|
3829
|
+
const s = o.__pivotRowKey;
|
|
3830
|
+
r.add(s), !this.previousVisibleKeys.has(s) && o.__pivotDepth > 0 && this.keysToAnimate.add(s);
|
|
3814
3831
|
}
|
|
3815
3832
|
return this.previousVisibleKeys = r, n;
|
|
3816
3833
|
}
|
|
@@ -3825,10 +3842,10 @@ class B extends _ {
|
|
|
3825
3842
|
});
|
|
3826
3843
|
for (const n of this.pivotResult.columnKeys)
|
|
3827
3844
|
for (const r of this.config.valueFields ?? []) {
|
|
3828
|
-
const o = be([n], r.field),
|
|
3845
|
+
const o = be([n], r.field), s = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3829
3846
|
t.push({
|
|
3830
3847
|
field: o,
|
|
3831
|
-
header: `${n} - ${
|
|
3848
|
+
header: `${n} - ${s} (${r.aggFunc})`,
|
|
3832
3849
|
width: 120,
|
|
3833
3850
|
type: "number"
|
|
3834
3851
|
});
|
|
@@ -4027,18 +4044,18 @@ class B extends _ {
|
|
|
4027
4044
|
}
|
|
4028
4045
|
}
|
|
4029
4046
|
const J = "tbw-print-isolation-style";
|
|
4030
|
-
function Hi(
|
|
4047
|
+
function Hi(a, e) {
|
|
4031
4048
|
const t = document.createElement("style");
|
|
4032
4049
|
return t.id = J, t.textContent = `
|
|
4033
4050
|
/* Print isolation: hide everything except the target grid */
|
|
4034
4051
|
@media print {
|
|
4035
4052
|
/* Hide all body children by default */
|
|
4036
|
-
body > *:not(#${
|
|
4053
|
+
body > *:not(#${a}) {
|
|
4037
4054
|
display: none !important;
|
|
4038
4055
|
}
|
|
4039
4056
|
|
|
4040
4057
|
/* But show the grid and ensure it's not hidden by ancestor rules */
|
|
4041
|
-
#${
|
|
4058
|
+
#${a} {
|
|
4042
4059
|
display: block !important;
|
|
4043
4060
|
position: static !important;
|
|
4044
4061
|
visibility: visible !important;
|
|
@@ -4053,14 +4070,14 @@ function Hi(s, e) {
|
|
|
4053
4070
|
}
|
|
4054
4071
|
|
|
4055
4072
|
/* If grid is nested, we need to show its ancestors too */
|
|
4056
|
-
#${
|
|
4057
|
-
#${
|
|
4073
|
+
#${a},
|
|
4074
|
+
#${a} * {
|
|
4058
4075
|
visibility: visible !important;
|
|
4059
4076
|
}
|
|
4060
4077
|
|
|
4061
4078
|
/* Walk up the DOM and show all ancestors of the grid */
|
|
4062
|
-
body *:has(> #${
|
|
4063
|
-
body *:has(#${
|
|
4079
|
+
body *:has(> #${a}),
|
|
4080
|
+
body *:has(#${a}) {
|
|
4064
4081
|
display: block !important;
|
|
4065
4082
|
visibility: visible !important;
|
|
4066
4083
|
opacity: 1 !important;
|
|
@@ -4075,7 +4092,7 @@ function Hi(s, e) {
|
|
|
4075
4092
|
}
|
|
4076
4093
|
|
|
4077
4094
|
/* Hide siblings of ancestors (everything that's not in the path to the grid) */
|
|
4078
|
-
body *:has(#${
|
|
4095
|
+
body *:has(#${a}) > *:not(:has(#${a})):not(#${a}) {
|
|
4079
4096
|
display: none !important;
|
|
4080
4097
|
}
|
|
4081
4098
|
|
|
@@ -4101,18 +4118,18 @@ function Hi(s, e) {
|
|
|
4101
4118
|
}
|
|
4102
4119
|
`, t;
|
|
4103
4120
|
}
|
|
4104
|
-
async function Ki(
|
|
4105
|
-
const { orientation: t = "landscape" } = e, i =
|
|
4121
|
+
async function Ki(a, e = {}) {
|
|
4122
|
+
const { orientation: t = "landscape" } = e, i = a.id;
|
|
4106
4123
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
4107
4124
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
4108
4125
|
), document.getElementById(J)?.remove();
|
|
4109
4126
|
const r = Hi(i, t);
|
|
4110
4127
|
return document.head.appendChild(r), new Promise((o) => {
|
|
4111
|
-
const
|
|
4112
|
-
window.removeEventListener("afterprint",
|
|
4128
|
+
const s = () => {
|
|
4129
|
+
window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
|
|
4113
4130
|
};
|
|
4114
|
-
window.addEventListener("afterprint",
|
|
4115
|
-
window.removeEventListener("afterprint",
|
|
4131
|
+
window.addEventListener("afterprint", s), window.print(), setTimeout(() => {
|
|
4132
|
+
window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
|
|
4116
4133
|
}, 5e3);
|
|
4117
4134
|
});
|
|
4118
4135
|
}
|
|
@@ -4126,25 +4143,25 @@ const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
4126
4143
|
title: "",
|
|
4127
4144
|
isolate: !1
|
|
4128
4145
|
};
|
|
4129
|
-
class
|
|
4146
|
+
class Sn extends _ {
|
|
4130
4147
|
name = "print";
|
|
4131
4148
|
version = "1.0.0";
|
|
4132
4149
|
styles = zi;
|
|
4133
|
-
#
|
|
4150
|
+
#i = !1;
|
|
4134
4151
|
#e = null;
|
|
4135
4152
|
#s = null;
|
|
4136
|
-
#
|
|
4137
|
-
#
|
|
4153
|
+
#r = null;
|
|
4154
|
+
#t = null;
|
|
4138
4155
|
#n = null;
|
|
4139
4156
|
#u = null;
|
|
4140
4157
|
get #l() {
|
|
4141
4158
|
return this.grid;
|
|
4142
4159
|
}
|
|
4143
4160
|
isPrinting() {
|
|
4144
|
-
return this.#
|
|
4161
|
+
return this.#i;
|
|
4145
4162
|
}
|
|
4146
4163
|
async print(e) {
|
|
4147
|
-
if (this.#
|
|
4164
|
+
if (this.#i) {
|
|
4148
4165
|
console.warn("[PrintPlugin] Print already in progress");
|
|
4149
4166
|
return;
|
|
4150
4167
|
}
|
|
@@ -4154,7 +4171,7 @@ class Rn extends _ {
|
|
|
4154
4171
|
return;
|
|
4155
4172
|
}
|
|
4156
4173
|
const i = { ...Oi, ...this.config, ...e }, r = this.rows.length;
|
|
4157
|
-
let o = r,
|
|
4174
|
+
let o = r, s = !1;
|
|
4158
4175
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
4159
4176
|
const d = i.maxRows > 0 ? `
|
|
4160
4177
|
|
|
@@ -4166,18 +4183,18 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4166
4183
|
))
|
|
4167
4184
|
return;
|
|
4168
4185
|
}
|
|
4169
|
-
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows,
|
|
4186
|
+
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#i = !0;
|
|
4170
4187
|
const l = performance.now();
|
|
4171
4188
|
this.emit("print-start", {
|
|
4172
4189
|
rowCount: o,
|
|
4173
|
-
limitApplied:
|
|
4190
|
+
limitApplied: s,
|
|
4174
4191
|
originalRowCount: r
|
|
4175
4192
|
});
|
|
4176
4193
|
try {
|
|
4177
4194
|
const d = this.#l;
|
|
4178
4195
|
this.#s = {
|
|
4179
4196
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
4180
|
-
}, this.#v(),
|
|
4197
|
+
}, this.#v(), s && (this.#r = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#o(i), await this.#d(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#f(), this.emit("print-complete", {
|
|
4181
4198
|
success: !0,
|
|
4182
4199
|
rowCount: o,
|
|
4183
4200
|
duration: Math.round(performance.now() - l)
|
|
@@ -4189,21 +4206,21 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4189
4206
|
duration: Math.round(performance.now() - l)
|
|
4190
4207
|
});
|
|
4191
4208
|
} finally {
|
|
4192
|
-
this.#w(), this.#
|
|
4209
|
+
this.#w(), this.#i = !1;
|
|
4193
4210
|
}
|
|
4194
4211
|
}
|
|
4195
|
-
#
|
|
4212
|
+
#o(e) {
|
|
4196
4213
|
const t = this.gridElement;
|
|
4197
4214
|
if (t) {
|
|
4198
|
-
if (this.#
|
|
4215
|
+
if (this.#t = document.createElement("div"), this.#t.className = "tbw-print-header", e.includeTitle) {
|
|
4199
4216
|
const i = e.title || this.grid.effectiveConfig?.shell?.header?.title || "Grid Data", n = document.createElement("div");
|
|
4200
|
-
n.className = "tbw-print-header-title", n.textContent = i, this.#
|
|
4217
|
+
n.className = "tbw-print-header-title", n.textContent = i, this.#t.appendChild(n);
|
|
4201
4218
|
}
|
|
4202
4219
|
if (e.includeTimestamp) {
|
|
4203
4220
|
const i = document.createElement("div");
|
|
4204
|
-
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#
|
|
4221
|
+
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#t.appendChild(i);
|
|
4205
4222
|
}
|
|
4206
|
-
t.insertBefore(this.#
|
|
4223
|
+
t.insertBefore(this.#t, t.firstChild), this.#n = document.createElement("div"), this.#n.className = "tbw-print-footer", this.#n.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#n);
|
|
4207
4224
|
}
|
|
4208
4225
|
}
|
|
4209
4226
|
async #d() {
|
|
@@ -4246,9 +4263,9 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4246
4263
|
#w() {
|
|
4247
4264
|
const e = this.gridElement;
|
|
4248
4265
|
if (!e) return;
|
|
4249
|
-
this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#u !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#u = null), this.#
|
|
4266
|
+
this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#u !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#u = null), this.#t && (this.#t.remove(), this.#t = null), this.#n && (this.#n.remove(), this.#n = null);
|
|
4250
4267
|
const t = this.#l;
|
|
4251
|
-
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#
|
|
4268
|
+
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#r !== null && (this.grid.rows = this.#r, this.#r = null);
|
|
4252
4269
|
}
|
|
4253
4270
|
afterRender() {
|
|
4254
4271
|
this.config?.button && !this.#c && (this.#g(), this.#c = !0);
|
|
@@ -4273,17 +4290,17 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4273
4290
|
});
|
|
4274
4291
|
}
|
|
4275
4292
|
}
|
|
4276
|
-
function Gi(
|
|
4277
|
-
const e =
|
|
4293
|
+
function Gi(a) {
|
|
4294
|
+
const e = a.meta ?? {};
|
|
4278
4295
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4279
4296
|
}
|
|
4280
|
-
function
|
|
4281
|
-
if (e === t || e < 0 || e >=
|
|
4282
|
-
const i = [...
|
|
4297
|
+
function je(a, e, t) {
|
|
4298
|
+
if (e === t || e < 0 || e >= a.length || t < 0 || t > a.length) return a;
|
|
4299
|
+
const i = [...a], [n] = i.splice(e, 1);
|
|
4283
4300
|
return i.splice(t, 0, n), i;
|
|
4284
4301
|
}
|
|
4285
4302
|
const Bi = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
|
|
4286
|
-
class
|
|
4303
|
+
class kn extends _ {
|
|
4287
4304
|
name = "reorder";
|
|
4288
4305
|
styles = Bi;
|
|
4289
4306
|
get defaultConfig() {
|
|
@@ -4328,28 +4345,28 @@ class Sn extends _ {
|
|
|
4328
4345
|
e.querySelectorAll(".header-row > .cell").forEach((i) => {
|
|
4329
4346
|
const n = i, r = n.getAttribute("data-field");
|
|
4330
4347
|
if (!r) return;
|
|
4331
|
-
const o = this.columns.find((
|
|
4348
|
+
const o = this.columns.find((s) => s.field === r);
|
|
4332
4349
|
if (!this.canMoveColumnWithPlugins(o)) {
|
|
4333
4350
|
n.draggable = !1;
|
|
4334
4351
|
return;
|
|
4335
4352
|
}
|
|
4336
|
-
n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (
|
|
4353
|
+
n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (s) => {
|
|
4337
4354
|
const d = this.getColumnOrder().indexOf(r);
|
|
4338
|
-
this.isDragging = !0, this.draggedField = r, this.draggedIndex = d,
|
|
4355
|
+
this.isDragging = !0, this.draggedField = r, this.draggedIndex = d, s.dataTransfer && (s.dataTransfer.effectAllowed = "move", s.dataTransfer.setData("text/plain", r)), n.classList.add("dragging");
|
|
4339
4356
|
}), n.addEventListener("dragend", () => {
|
|
4340
4357
|
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses();
|
|
4341
|
-
}), n.addEventListener("dragover", (
|
|
4342
|
-
if (
|
|
4358
|
+
}), n.addEventListener("dragover", (s) => {
|
|
4359
|
+
if (s.preventDefault(), !this.isDragging || this.draggedField === r) return;
|
|
4343
4360
|
const l = n.getBoundingClientRect(), d = l.left + l.width / 2, u = this.getColumnOrder().indexOf(r);
|
|
4344
|
-
this.dropIndex =
|
|
4361
|
+
this.dropIndex = s.clientX < d ? u : u + 1, n.classList.add("drop-target"), n.classList.toggle("drop-before", s.clientX < d), n.classList.toggle("drop-after", s.clientX >= d);
|
|
4345
4362
|
}), n.addEventListener("dragleave", () => {
|
|
4346
4363
|
n.classList.remove("drop-target", "drop-before", "drop-after");
|
|
4347
|
-
}), n.addEventListener("drop", (
|
|
4348
|
-
|
|
4364
|
+
}), n.addEventListener("drop", (s) => {
|
|
4365
|
+
s.preventDefault();
|
|
4349
4366
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4350
4367
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4351
4368
|
return;
|
|
4352
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f =
|
|
4369
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = je(h, d, u), g = {
|
|
4353
4370
|
field: l,
|
|
4354
4371
|
fromIndex: d,
|
|
4355
4372
|
toIndex: u,
|
|
@@ -4366,9 +4383,9 @@ class Sn extends _ {
|
|
|
4366
4383
|
if (i < 0 || i >= n.length) return;
|
|
4367
4384
|
const r = n[i];
|
|
4368
4385
|
if (!this.canMoveColumnWithPlugins(r)) return;
|
|
4369
|
-
const o = this.getColumnOrder(),
|
|
4370
|
-
if (
|
|
4371
|
-
const l = e.key === "ArrowLeft" ?
|
|
4386
|
+
const o = this.getColumnOrder(), s = o.indexOf(r.field);
|
|
4387
|
+
if (s === -1) return;
|
|
4388
|
+
const l = e.key === "ArrowLeft" ? s - 1 : s + 1;
|
|
4372
4389
|
if (l < 0 || l >= o.length) return;
|
|
4373
4390
|
const d = n.find((c) => c.field === o[l]);
|
|
4374
4391
|
if (this.canMoveColumnWithPlugins(d))
|
|
@@ -4380,7 +4397,7 @@ class Sn extends _ {
|
|
|
4380
4397
|
moveColumn(e, t) {
|
|
4381
4398
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
4382
4399
|
if (n === -1) return;
|
|
4383
|
-
const r =
|
|
4400
|
+
const r = je(i, n, t);
|
|
4384
4401
|
this.emitCancelable("column-move", {
|
|
4385
4402
|
field: e,
|
|
4386
4403
|
fromIndex: n,
|
|
@@ -4407,19 +4424,19 @@ class Sn extends _ {
|
|
|
4407
4424
|
if (!t || e.size === 0) return;
|
|
4408
4425
|
const i = /* @__PURE__ */ new Map();
|
|
4409
4426
|
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((o) => {
|
|
4410
|
-
const
|
|
4411
|
-
if (!
|
|
4412
|
-
const l = e.get(
|
|
4427
|
+
const s = o.getAttribute("data-field");
|
|
4428
|
+
if (!s) return;
|
|
4429
|
+
const l = e.get(s);
|
|
4413
4430
|
if (l === void 0) return;
|
|
4414
4431
|
const d = l - o.getBoundingClientRect().left;
|
|
4415
|
-
Math.abs(d) > 1 && i.set(
|
|
4432
|
+
Math.abs(d) > 1 && i.set(s, d);
|
|
4416
4433
|
}), i.size === 0) return;
|
|
4417
4434
|
const n = [];
|
|
4418
4435
|
if (t.querySelectorAll(".cell[data-field]").forEach((o) => {
|
|
4419
|
-
const
|
|
4420
|
-
if (
|
|
4436
|
+
const s = i.get(o.getAttribute("data-field") ?? "");
|
|
4437
|
+
if (s !== void 0) {
|
|
4421
4438
|
const l = o;
|
|
4422
|
-
l.style.transform = `translateX(${
|
|
4439
|
+
l.style.transform = `translateX(${s}px)`, n.push(l);
|
|
4423
4440
|
}
|
|
4424
4441
|
}), n.length === 0) return;
|
|
4425
4442
|
this.gridElement.offsetHeight;
|
|
@@ -4443,25 +4460,25 @@ class Sn extends _ {
|
|
|
4443
4460
|
const i = this.captureHeaderPositions();
|
|
4444
4461
|
e();
|
|
4445
4462
|
const n = /* @__PURE__ */ new Set();
|
|
4446
|
-
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((
|
|
4447
|
-
const l =
|
|
4463
|
+
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((s) => {
|
|
4464
|
+
const l = s.getAttribute("data-field");
|
|
4448
4465
|
if (!l) return;
|
|
4449
4466
|
const d = i.get(l);
|
|
4450
4467
|
if (d === void 0) return;
|
|
4451
|
-
const c =
|
|
4468
|
+
const c = s.getBoundingClientRect().left;
|
|
4452
4469
|
Math.abs(d - c) > 1 && n.add(l);
|
|
4453
4470
|
}), n.size === 0) return;
|
|
4454
4471
|
const r = [];
|
|
4455
|
-
if (t.querySelectorAll(".cell[data-field]").forEach((
|
|
4456
|
-
const l =
|
|
4472
|
+
if (t.querySelectorAll(".cell[data-field]").forEach((s) => {
|
|
4473
|
+
const l = s.getAttribute("data-field");
|
|
4457
4474
|
if (l && n.has(l)) {
|
|
4458
|
-
const d =
|
|
4475
|
+
const d = s;
|
|
4459
4476
|
d.classList.add("fade-animating"), r.push(d);
|
|
4460
4477
|
}
|
|
4461
4478
|
}), r.length === 0) return;
|
|
4462
4479
|
const o = this.animationDuration;
|
|
4463
4480
|
setTimeout(() => {
|
|
4464
|
-
r.forEach((
|
|
4481
|
+
r.forEach((s) => s.classList.remove("fade-animating"));
|
|
4465
4482
|
}, o + 50);
|
|
4466
4483
|
}
|
|
4467
4484
|
updateColumnOrder(e) {
|
|
@@ -4476,7 +4493,7 @@ class Sn extends _ {
|
|
|
4476
4493
|
}
|
|
4477
4494
|
}
|
|
4478
4495
|
const Vi = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-inline-start:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-inline-end:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-inline-end:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
4479
|
-
class
|
|
4496
|
+
class An extends _ {
|
|
4480
4497
|
name = "responsive";
|
|
4481
4498
|
version = "1.0.0";
|
|
4482
4499
|
styles = Vi;
|
|
@@ -4494,44 +4511,44 @@ class kn extends _ {
|
|
|
4494
4511
|
}
|
|
4495
4512
|
]
|
|
4496
4513
|
};
|
|
4497
|
-
#
|
|
4514
|
+
#i;
|
|
4498
4515
|
#e = !1;
|
|
4499
4516
|
#s;
|
|
4500
|
-
#
|
|
4501
|
-
#
|
|
4517
|
+
#r = !1;
|
|
4518
|
+
#t = 0;
|
|
4502
4519
|
#n = /* @__PURE__ */ new Set();
|
|
4503
4520
|
#u = /* @__PURE__ */ new Set();
|
|
4504
4521
|
#l = null;
|
|
4505
|
-
#
|
|
4522
|
+
#o = [];
|
|
4506
4523
|
isResponsive() {
|
|
4507
4524
|
return this.#e;
|
|
4508
4525
|
}
|
|
4509
4526
|
setResponsive(e) {
|
|
4510
4527
|
e !== this.#e && (this.#e = e, this.#w(), this.emit("responsive-change", {
|
|
4511
4528
|
isResponsive: e,
|
|
4512
|
-
width: this.#
|
|
4529
|
+
width: this.#t,
|
|
4513
4530
|
breakpoint: this.config.breakpoint ?? 0
|
|
4514
4531
|
}));
|
|
4515
4532
|
}
|
|
4516
4533
|
setBreakpoint(e) {
|
|
4517
|
-
this.config.breakpoint = e, this.#p(this.#
|
|
4534
|
+
this.config.breakpoint = e, this.#p(this.#t);
|
|
4518
4535
|
}
|
|
4519
4536
|
setCardRenderer(e) {
|
|
4520
4537
|
this.config.cardRenderer = e, this.#e && this.requestRender();
|
|
4521
4538
|
}
|
|
4522
4539
|
getWidth() {
|
|
4523
|
-
return this.#
|
|
4540
|
+
return this.#t;
|
|
4524
4541
|
}
|
|
4525
4542
|
getActiveBreakpoint() {
|
|
4526
4543
|
return this.#l;
|
|
4527
4544
|
}
|
|
4528
4545
|
attach(e) {
|
|
4529
|
-
super.attach(e), this.#d(), this.#f(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#
|
|
4546
|
+
super.attach(e), this.#d(), this.#f(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#o = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#i = new ResizeObserver((t) => {
|
|
4530
4547
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4531
|
-
this.#
|
|
4548
|
+
this.#t = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
4532
4549
|
this.#p(i);
|
|
4533
4550
|
}, this.config.debounceMs ?? 100);
|
|
4534
|
-
}), this.#
|
|
4551
|
+
}), this.#i.observe(this.gridElement);
|
|
4535
4552
|
}
|
|
4536
4553
|
#d() {
|
|
4537
4554
|
const e = this.grid;
|
|
@@ -4543,18 +4560,18 @@ class kn extends _ {
|
|
|
4543
4560
|
const u = i.__frameworkAdapter.parseResponsiveCardElement(t);
|
|
4544
4561
|
u && (this.config = { ...this.config, cardRenderer: u });
|
|
4545
4562
|
}
|
|
4546
|
-
const n = t.getAttribute("breakpoint"), r = t.getAttribute("card-row-height"), o = t.getAttribute("hidden-columns"),
|
|
4563
|
+
const n = t.getAttribute("breakpoint"), r = t.getAttribute("card-row-height"), o = t.getAttribute("hidden-columns"), s = t.getAttribute("hide-header"), l = t.getAttribute("debounce-ms"), d = {};
|
|
4547
4564
|
if (n !== null) {
|
|
4548
4565
|
const u = parseInt(n, 10);
|
|
4549
4566
|
isNaN(u) || (d.breakpoint = u);
|
|
4550
4567
|
}
|
|
4551
|
-
if (r !== null && (d.cardRowHeight = r === "auto" ? "auto" : parseInt(r, 10)), o !== null && (d.hiddenColumns = o.split(",").map((u) => u.trim()).filter((u) => u.length > 0)),
|
|
4568
|
+
if (r !== null && (d.cardRowHeight = r === "auto" ? "auto" : parseInt(r, 10)), o !== null && (d.hiddenColumns = o.split(",").map((u) => u.trim()).filter((u) => u.length > 0)), s !== null && (d.hideHeader = s !== "false"), l !== null) {
|
|
4552
4569
|
const u = parseInt(l, 10);
|
|
4553
4570
|
isNaN(u) || (d.debounceMs = u);
|
|
4554
4571
|
}
|
|
4555
4572
|
const c = t.innerHTML.trim();
|
|
4556
4573
|
c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
|
|
4557
|
-
const h =
|
|
4574
|
+
const h = et(c, { value: u, row: u }), f = tt(h), g = document.createElement("div");
|
|
4558
4575
|
return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
|
|
4559
4576
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4560
4577
|
}
|
|
@@ -4564,14 +4581,14 @@ class kn extends _ {
|
|
|
4564
4581
|
typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#u.add(t.field) : this.#n.add(t.field);
|
|
4565
4582
|
}
|
|
4566
4583
|
detach() {
|
|
4567
|
-
this.#
|
|
4584
|
+
this.#i?.disconnect(), this.#i = void 0, clearTimeout(this.#s), this.#s = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4568
4585
|
}
|
|
4569
4586
|
handleQuery(e) {
|
|
4570
4587
|
if (e.type === "isCardMode")
|
|
4571
4588
|
return this.#e;
|
|
4572
4589
|
}
|
|
4573
4590
|
afterRender() {
|
|
4574
|
-
if (this.#R(), !(this.#
|
|
4591
|
+
if (this.#R(), !(this.#o.length > 0 ? this.#l !== null : this.#e))
|
|
4575
4592
|
return;
|
|
4576
4593
|
const t = this.#n.size > 0, i = this.#u.size > 0;
|
|
4577
4594
|
if (!t && !i)
|
|
@@ -4583,12 +4600,12 @@ class kn extends _ {
|
|
|
4583
4600
|
}
|
|
4584
4601
|
}
|
|
4585
4602
|
#p(e) {
|
|
4586
|
-
if (this.#
|
|
4603
|
+
if (this.#o.length > 0) {
|
|
4587
4604
|
this.#v(e);
|
|
4588
4605
|
return;
|
|
4589
4606
|
}
|
|
4590
4607
|
const t = this.config.breakpoint ?? 0;
|
|
4591
|
-
t === 0 && !this.#
|
|
4608
|
+
t === 0 && !this.#r && (this.#r = !0, console.warn(
|
|
4592
4609
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4593
4610
|
));
|
|
4594
4611
|
const i = t > 0 && e < t;
|
|
@@ -4600,7 +4617,7 @@ class kn extends _ {
|
|
|
4600
4617
|
}
|
|
4601
4618
|
#v(e) {
|
|
4602
4619
|
let t = null;
|
|
4603
|
-
for (const n of this.#
|
|
4620
|
+
for (const n of this.#o)
|
|
4604
4621
|
e <= n.maxWidth && (t = n);
|
|
4605
4622
|
if (t !== this.#l) {
|
|
4606
4623
|
this.#l = t, t?.hiddenColumns ? this.#f(t.hiddenColumns) : this.#f(this.config.hiddenColumns);
|
|
@@ -4693,18 +4710,18 @@ class kn extends _ {
|
|
|
4693
4710
|
getExtraHeight() {
|
|
4694
4711
|
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
4695
4712
|
return 0;
|
|
4696
|
-
const e = this.#h ?? 28, t = this.#m(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e),
|
|
4697
|
-
return o +
|
|
4713
|
+
const e = this.#h ?? 28, t = this.#m(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
|
|
4714
|
+
return o + s;
|
|
4698
4715
|
}
|
|
4699
4716
|
getExtraHeightBefore(e) {
|
|
4700
4717
|
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
4701
4718
|
return 0;
|
|
4702
4719
|
const t = this.#h ?? 28, i = this.#m(), n = this.#b(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
4703
|
-
let
|
|
4720
|
+
let s = 0, l = 0;
|
|
4704
4721
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4705
4722
|
for (let u = 0; u < c; u++)
|
|
4706
|
-
d[u].__isGroupRow ?
|
|
4707
|
-
return
|
|
4723
|
+
d[u].__isGroupRow ? s++ : l++;
|
|
4724
|
+
return s * r + l * o;
|
|
4708
4725
|
}
|
|
4709
4726
|
getRowHeight(e, t) {
|
|
4710
4727
|
if (!(!this.#e || !this.config.cardRenderer))
|
|
@@ -4725,8 +4742,8 @@ class kn extends _ {
|
|
|
4725
4742
|
if (n !== this.#a && (this.#a = n, e = !0), i) {
|
|
4726
4743
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4727
4744
|
if (o) {
|
|
4728
|
-
const
|
|
4729
|
-
|
|
4745
|
+
const s = o.getBoundingClientRect().height;
|
|
4746
|
+
s > 0 && s !== this.#g && (this.#g = s, e = !0);
|
|
4730
4747
|
}
|
|
4731
4748
|
}
|
|
4732
4749
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
@@ -4740,7 +4757,7 @@ class kn extends _ {
|
|
|
4740
4757
|
}
|
|
4741
4758
|
}
|
|
4742
4759
|
const Wi = '@layer tbw-plugins{[data-field=__tbw_row_drag]{display:flex;align-items:center;justify-content:center}.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;min-width:1em;min-height:1em;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', $i = "__tbw_row_drag";
|
|
4743
|
-
class
|
|
4760
|
+
class _n extends _ {
|
|
4744
4761
|
name = "rowReorder";
|
|
4745
4762
|
styles = Wi;
|
|
4746
4763
|
get defaultConfig() {
|
|
@@ -4809,9 +4826,9 @@ class An extends _ {
|
|
|
4809
4826
|
if (i < 0 || i >= n.length) return;
|
|
4810
4827
|
const r = e.key === "ArrowUp" ? "up" : "down", o = r === "up" ? i - 1 : i + 1;
|
|
4811
4828
|
if (o < 0 || o >= n.length) return;
|
|
4812
|
-
const
|
|
4813
|
-
if (!(this.config.canMove && !this.config.canMove(
|
|
4814
|
-
return this.handleKeyboardMove(
|
|
4829
|
+
const s = n[i];
|
|
4830
|
+
if (!(this.config.canMove && !this.config.canMove(s, i, o, r)))
|
|
4831
|
+
return this.handleKeyboardMove(s, i, o, r, t._focusCol), e.preventDefault(), e.stopPropagation(), !0;
|
|
4815
4832
|
}
|
|
4816
4833
|
onCellClick() {
|
|
4817
4834
|
this.flushPendingMove();
|
|
@@ -4851,8 +4868,8 @@ class An extends _ {
|
|
|
4851
4868
|
const i = this.draggedRowIndex;
|
|
4852
4869
|
let n = this.dropRowIndex;
|
|
4853
4870
|
if (!(!this.isDragging || i === null || n === null) && (n > i && n--, i !== n)) {
|
|
4854
|
-
const o = this.sourceRows[i],
|
|
4855
|
-
(!this.config.canMove || this.config.canMove(o, i, n,
|
|
4871
|
+
const o = this.sourceRows[i], s = n < i ? "up" : "down";
|
|
4872
|
+
(!this.config.canMove || this.config.canMove(o, i, n, s)) && this.executeMove(o, i, n, "drag");
|
|
4856
4873
|
}
|
|
4857
4874
|
});
|
|
4858
4875
|
}
|
|
@@ -4862,8 +4879,8 @@ class An extends _ {
|
|
|
4862
4879
|
currentIndex: i,
|
|
4863
4880
|
row: e
|
|
4864
4881
|
}, this.lastFocusCol = r;
|
|
4865
|
-
const o = this.grid,
|
|
4866
|
-
|
|
4882
|
+
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
|
|
4883
|
+
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), F(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
4867
4884
|
this.flushPendingMove();
|
|
4868
4885
|
}, this.config.debounceMs ?? 300);
|
|
4869
4886
|
}
|
|
@@ -4879,8 +4896,8 @@ class An extends _ {
|
|
|
4879
4896
|
source: "keyboard"
|
|
4880
4897
|
};
|
|
4881
4898
|
if (this.emitCancelable("row-move", n)) {
|
|
4882
|
-
const o = [...this.sourceRows], [
|
|
4883
|
-
o.splice(e, 0,
|
|
4899
|
+
const o = [...this.sourceRows], [s] = o.splice(t, 1);
|
|
4900
|
+
o.splice(e, 0, s);
|
|
4884
4901
|
const l = this.grid;
|
|
4885
4902
|
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), F(l);
|
|
4886
4903
|
}
|
|
@@ -4888,14 +4905,14 @@ class An extends _ {
|
|
|
4888
4905
|
executeMove(e, t, i, n) {
|
|
4889
4906
|
const r = [...this.sourceRows], [o] = r.splice(t, 1);
|
|
4890
4907
|
r.splice(i, 0, o);
|
|
4891
|
-
const
|
|
4908
|
+
const s = {
|
|
4892
4909
|
row: e,
|
|
4893
4910
|
fromIndex: t,
|
|
4894
4911
|
toIndex: i,
|
|
4895
4912
|
rows: r,
|
|
4896
4913
|
source: n
|
|
4897
4914
|
};
|
|
4898
|
-
if (!this.emitCancelable("row-move",
|
|
4915
|
+
if (!this.emitCancelable("row-move", s))
|
|
4899
4916
|
if (this.animationType === "flip" && this.gridElement) {
|
|
4900
4917
|
const d = this.captureRowPositions();
|
|
4901
4918
|
this.grid.rows = r, requestAnimationFrame(() => {
|
|
@@ -4914,7 +4931,7 @@ class An extends _ {
|
|
|
4914
4931
|
animateFLIP(e, t, i) {
|
|
4915
4932
|
const n = this.gridElement;
|
|
4916
4933
|
if (!n || e.size === 0) return;
|
|
4917
|
-
const r = Math.min(t, i), o = Math.max(t, i),
|
|
4934
|
+
const r = Math.min(t, i), o = Math.max(t, i), s = [];
|
|
4918
4935
|
if (n.querySelectorAll(".data-grid-row").forEach((d) => {
|
|
4919
4936
|
const c = d, u = this.getRowIndex(c);
|
|
4920
4937
|
if (u < 0 || u < r || u > o) return;
|
|
@@ -4923,17 +4940,17 @@ class An extends _ {
|
|
|
4923
4940
|
const f = e.get(h);
|
|
4924
4941
|
if (f === void 0) return;
|
|
4925
4942
|
const g = c.getBoundingClientRect().top, p = f - g;
|
|
4926
|
-
Math.abs(p) > 1 &&
|
|
4927
|
-
}),
|
|
4928
|
-
|
|
4943
|
+
Math.abs(p) > 1 && s.push({ el: c, deltaY: p });
|
|
4944
|
+
}), s.length === 0) return;
|
|
4945
|
+
s.forEach(({ el: d, deltaY: c }) => {
|
|
4929
4946
|
d.style.transform = `translateY(${c}px)`;
|
|
4930
4947
|
}), n.offsetHeight;
|
|
4931
4948
|
const l = this.animationDuration;
|
|
4932
4949
|
requestAnimationFrame(() => {
|
|
4933
|
-
|
|
4950
|
+
s.forEach(({ el: d }) => {
|
|
4934
4951
|
d.classList.add("flip-animating"), d.style.transform = "";
|
|
4935
4952
|
}), setTimeout(() => {
|
|
4936
|
-
|
|
4953
|
+
s.forEach(({ el: d }) => {
|
|
4937
4954
|
d.style.transform = "", d.classList.remove("flip-animating");
|
|
4938
4955
|
});
|
|
4939
4956
|
}, l + 50);
|
|
@@ -4952,62 +4969,62 @@ class An extends _ {
|
|
|
4952
4969
|
this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
|
|
4953
4970
|
}
|
|
4954
4971
|
}
|
|
4955
|
-
function $(
|
|
4972
|
+
function $(a) {
|
|
4956
4973
|
return {
|
|
4957
|
-
startRow: Math.min(
|
|
4958
|
-
startCol: Math.min(
|
|
4959
|
-
endRow: Math.max(
|
|
4960
|
-
endCol: Math.max(
|
|
4974
|
+
startRow: Math.min(a.startRow, a.endRow),
|
|
4975
|
+
startCol: Math.min(a.startCol, a.endCol),
|
|
4976
|
+
endRow: Math.max(a.startRow, a.endRow),
|
|
4977
|
+
endCol: Math.max(a.startCol, a.endCol)
|
|
4961
4978
|
};
|
|
4962
4979
|
}
|
|
4963
|
-
function ji(
|
|
4964
|
-
const e = $(
|
|
4980
|
+
function ji(a) {
|
|
4981
|
+
const e = $(a);
|
|
4965
4982
|
return {
|
|
4966
4983
|
from: { row: e.startRow, col: e.startCol },
|
|
4967
4984
|
to: { row: e.endRow, col: e.endCol }
|
|
4968
4985
|
};
|
|
4969
4986
|
}
|
|
4970
|
-
function
|
|
4971
|
-
return
|
|
4987
|
+
function dt(a) {
|
|
4988
|
+
return a.map(ji);
|
|
4972
4989
|
}
|
|
4973
|
-
function Ui(
|
|
4990
|
+
function Ui(a, e, t) {
|
|
4974
4991
|
const i = $(t);
|
|
4975
|
-
return
|
|
4992
|
+
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4976
4993
|
}
|
|
4977
|
-
function
|
|
4978
|
-
return t.some((i) => Ui(
|
|
4994
|
+
function Yi(a, e, t) {
|
|
4995
|
+
return t.some((i) => Ui(a, e, i));
|
|
4979
4996
|
}
|
|
4980
|
-
function
|
|
4981
|
-
const e = [], t = $(
|
|
4997
|
+
function Xi(a) {
|
|
4998
|
+
const e = [], t = $(a);
|
|
4982
4999
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4983
5000
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4984
5001
|
e.push({ row: i, col: n });
|
|
4985
5002
|
return e;
|
|
4986
5003
|
}
|
|
4987
|
-
function
|
|
5004
|
+
function Zi(a) {
|
|
4988
5005
|
const e = /* @__PURE__ */ new Map();
|
|
4989
|
-
for (const t of
|
|
4990
|
-
for (const i of
|
|
5006
|
+
for (const t of a)
|
|
5007
|
+
for (const i of Xi(t))
|
|
4991
5008
|
e.set(`${i.row},${i.col}`, i);
|
|
4992
5009
|
return [...e.values()];
|
|
4993
5010
|
}
|
|
4994
|
-
function
|
|
5011
|
+
function ce(a, e) {
|
|
4995
5012
|
return {
|
|
4996
|
-
startRow:
|
|
4997
|
-
startCol:
|
|
5013
|
+
startRow: a.row,
|
|
5014
|
+
startCol: a.col,
|
|
4998
5015
|
endRow: e.row,
|
|
4999
5016
|
endCol: e.col
|
|
5000
5017
|
};
|
|
5001
5018
|
}
|
|
5002
|
-
function Q(
|
|
5003
|
-
const t = $(
|
|
5019
|
+
function Q(a, e) {
|
|
5020
|
+
const t = $(a), i = $(e);
|
|
5004
5021
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
5005
5022
|
}
|
|
5006
|
-
const
|
|
5007
|
-
function
|
|
5008
|
-
if (
|
|
5023
|
+
const Qi = '@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%));outline:none;position:relative;&:after{content:"";position:absolute;inset:0;pointer-events:none;border:0 solid var(--tbw-range-border-color, var(--tbw-color-accent));border-top-width:2px;border-bottom-width:2px;z-index:1}+.data-grid-row.row-focus:after{border-top-width:0}&:has(+.data-grid-row.row-focus):after{border-bottom-width:0}}&[data-selection-mode=row] .cell-focus,&[data-selection-mode=row] .row-focus,&[data-selection-mode=range] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);position:relative;&:after{content:"";position:absolute;inset:0;pointer-events:none;border:0 solid var(--tbw-range-border-color);z-index:1}&.top:after{border-top-width:2px}&.bottom:after{border-bottom-width:2px}&.first:after{border-left-width:2px}&.last:after{border-right-width:2px}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}.data-grid-row>.cell[data-field=__tbw_checkbox],.header-row>.cell[data-field=__tbw_checkbox]{text-align:center;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center}.tbw-select-row-checkbox{pointer-events:none;margin:0;cursor:pointer}.tbw-checkbox-header{display:flex;justify-content:center;align-items:center;height:100%}.tbw-select-all-checkbox{margin:0;cursor:pointer}}}', Ue = "__tbw_checkbox";
|
|
5024
|
+
function Ji(a, e, t) {
|
|
5025
|
+
if (a === "cell" && e.selectedCell)
|
|
5009
5026
|
return {
|
|
5010
|
-
mode:
|
|
5027
|
+
mode: a,
|
|
5011
5028
|
ranges: [
|
|
5012
5029
|
{
|
|
5013
5030
|
from: { row: e.selectedCell.row, col: e.selectedCell.col },
|
|
@@ -5015,16 +5032,16 @@ function Qi(s, e, t) {
|
|
|
5015
5032
|
}
|
|
5016
5033
|
]
|
|
5017
5034
|
};
|
|
5018
|
-
if (
|
|
5019
|
-
const i = [...e.selected].
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
return { mode:
|
|
5035
|
+
if (a === "row" && e.selected.size > 0) {
|
|
5036
|
+
const i = [...e.selected].sort((s, l) => s - l), n = [];
|
|
5037
|
+
let r = i[0], o = r;
|
|
5038
|
+
for (let s = 1; s < i.length; s++)
|
|
5039
|
+
i[s] === o + 1 ? o = i[s] : (n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), r = i[s], o = r);
|
|
5040
|
+
return n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), { mode: a, ranges: n };
|
|
5024
5041
|
}
|
|
5025
|
-
return
|
|
5042
|
+
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: dt(e.ranges) } : { mode: a, ranges: [] };
|
|
5026
5043
|
}
|
|
5027
|
-
class
|
|
5044
|
+
class Tn extends _ {
|
|
5028
5045
|
static manifest = {
|
|
5029
5046
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
5030
5047
|
configRules: [
|
|
@@ -5039,7 +5056,7 @@ class _n extends _ {
|
|
|
5039
5056
|
]
|
|
5040
5057
|
};
|
|
5041
5058
|
name = "selection";
|
|
5042
|
-
styles =
|
|
5059
|
+
styles = Qi;
|
|
5043
5060
|
get defaultConfig() {
|
|
5044
5061
|
return {
|
|
5045
5062
|
mode: "cell",
|
|
@@ -5056,6 +5073,9 @@ class _n extends _ {
|
|
|
5056
5073
|
isDragging = !1;
|
|
5057
5074
|
pendingKeyboardUpdate = null;
|
|
5058
5075
|
selectedCell = null;
|
|
5076
|
+
lastSyncedFocusRow = -1;
|
|
5077
|
+
lastSyncedFocusCol = -1;
|
|
5078
|
+
explicitSelection = !1;
|
|
5059
5079
|
isSelectionEnabled() {
|
|
5060
5080
|
return this.config.enabled === !1 ? !1 : this.grid.effectiveConfig?.selectable !== !1;
|
|
5061
5081
|
}
|
|
@@ -5081,31 +5101,47 @@ class _n extends _ {
|
|
|
5081
5101
|
return this.getSelection();
|
|
5082
5102
|
}
|
|
5083
5103
|
detach() {
|
|
5084
|
-
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
|
|
5104
|
+
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null, this.lastSyncedFocusRow = -1, this.lastSyncedFocusCol = -1;
|
|
5085
5105
|
}
|
|
5086
5106
|
clearSelectionSilent() {
|
|
5087
|
-
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.requestAfterRender();
|
|
5107
|
+
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.lastSyncedFocusRow = -1, this.lastSyncedFocusCol = -1, this.requestAfterRender();
|
|
5088
5108
|
}
|
|
5089
5109
|
onCellClick(e) {
|
|
5090
5110
|
if (!this.isSelectionEnabled()) return !1;
|
|
5091
5111
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
5092
5112
|
if (n.type !== o)
|
|
5093
5113
|
return !1;
|
|
5094
|
-
const
|
|
5114
|
+
const s = this.columns[i], l = s && K(s);
|
|
5095
5115
|
if (r === "cell") {
|
|
5096
5116
|
if (l || !this.isCellSelectable(t, i))
|
|
5097
5117
|
return !1;
|
|
5098
5118
|
const d = this.selectedCell;
|
|
5099
|
-
return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#
|
|
5119
|
+
return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
5120
|
+
}
|
|
5121
|
+
if (r === "row") {
|
|
5122
|
+
if (!this.isRowSelectable(t))
|
|
5123
|
+
return !1;
|
|
5124
|
+
const d = n.shiftKey, c = n.ctrlKey || n.metaKey, u = s?.meta?.checkboxColumn === !0;
|
|
5125
|
+
if (d && this.anchor !== null) {
|
|
5126
|
+
const h = Math.min(this.anchor, t), f = Math.max(this.anchor, t);
|
|
5127
|
+
c || this.selected.clear();
|
|
5128
|
+
for (let g = h; g <= f; g++)
|
|
5129
|
+
this.isRowSelectable(g) && this.selected.add(g);
|
|
5130
|
+
} else if (c || u)
|
|
5131
|
+
this.selected.has(t) ? this.selected.delete(t) : this.selected.add(t), this.anchor = t;
|
|
5132
|
+
else {
|
|
5133
|
+
if (this.selected.size === 1 && this.selected.has(t))
|
|
5134
|
+
return !1;
|
|
5135
|
+
this.selected.clear(), this.selected.add(t), this.anchor = t;
|
|
5136
|
+
}
|
|
5137
|
+
return this.lastSelected = t, this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
|
|
5100
5138
|
}
|
|
5101
|
-
if (r === "row")
|
|
5102
|
-
return !this.isRowSelectable(t) || this.selected.size === 1 && this.selected.has(t) || (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
|
|
5103
5139
|
if (r === "range") {
|
|
5104
5140
|
if (l || !this.isCellSelectable(t, i))
|
|
5105
5141
|
return !1;
|
|
5106
5142
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
5107
5143
|
if (d && this.cellAnchor) {
|
|
5108
|
-
const u =
|
|
5144
|
+
const u = ce(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5109
5145
|
if (h && Q(h, u))
|
|
5110
5146
|
return !1;
|
|
5111
5147
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
@@ -5128,7 +5164,7 @@ class _n extends _ {
|
|
|
5128
5164
|
return !1;
|
|
5129
5165
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
5130
5166
|
}
|
|
5131
|
-
return this.emit("selection-change", this.#
|
|
5167
|
+
return this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
|
|
5132
5168
|
}
|
|
5133
5169
|
return !1;
|
|
5134
5170
|
}
|
|
@@ -5136,40 +5172,40 @@ class _n extends _ {
|
|
|
5136
5172
|
if (!this.isSelectionEnabled()) return !1;
|
|
5137
5173
|
const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
|
|
5138
5174
|
if (e.key === "Escape")
|
|
5139
|
-
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#
|
|
5175
|
+
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
|
|
5140
5176
|
if (t === "cell" && n)
|
|
5141
5177
|
return queueMicrotask(() => {
|
|
5142
5178
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
5143
|
-
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#
|
|
5144
|
-
}), !1;
|
|
5145
|
-
if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
5146
|
-
return queueMicrotask(() => {
|
|
5147
|
-
const r = this.grid._focusRow;
|
|
5148
|
-
this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#e()), this.requestAfterRender();
|
|
5179
|
+
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5149
5180
|
}), !1;
|
|
5181
|
+
if (t === "row") {
|
|
5182
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
5183
|
+
const r = e.shiftKey;
|
|
5184
|
+
return r && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
|
|
5185
|
+
const o = this.grid._focusRow;
|
|
5186
|
+
if (r && this.anchor !== null) {
|
|
5187
|
+
this.selected.clear();
|
|
5188
|
+
const s = Math.min(this.anchor, o), l = Math.max(this.anchor, o);
|
|
5189
|
+
for (let d = s; d <= l; d++)
|
|
5190
|
+
this.isRowSelectable(d) && this.selected.add(d);
|
|
5191
|
+
} else
|
|
5192
|
+
this.isRowSelectable(o) ? (this.selected.clear(), this.selected.add(o), this.anchor = o) : this.selected.clear();
|
|
5193
|
+
this.lastSelected = o, this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5194
|
+
}), !1;
|
|
5195
|
+
}
|
|
5196
|
+
if (e.key === "a" && (e.ctrlKey || e.metaKey))
|
|
5197
|
+
return e.preventDefault(), e.stopPropagation(), this.selectAll(), !0;
|
|
5198
|
+
}
|
|
5150
5199
|
if (t === "range" && n) {
|
|
5151
5200
|
const r = e.key === "Tab", o = e.shiftKey && !r;
|
|
5152
5201
|
return o && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: o }, queueMicrotask(() => this.requestAfterRender()), !1;
|
|
5153
5202
|
}
|
|
5154
|
-
|
|
5155
|
-
const r = this.rows.length, o = this.columns.length;
|
|
5156
|
-
if (r > 0 && o > 0) {
|
|
5157
|
-
e.preventDefault(), e.stopPropagation();
|
|
5158
|
-
const a = {
|
|
5159
|
-
startRow: 0,
|
|
5160
|
-
startCol: 0,
|
|
5161
|
-
endRow: r - 1,
|
|
5162
|
-
endCol: o - 1
|
|
5163
|
-
};
|
|
5164
|
-
return this.ranges = [a], this.activeRange = a, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
|
|
5165
|
-
}
|
|
5166
|
-
}
|
|
5167
|
-
return !1;
|
|
5203
|
+
return t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey) ? (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0) : !1;
|
|
5168
5204
|
}
|
|
5169
5205
|
onCellMouseDown(e) {
|
|
5170
5206
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5171
5207
|
const t = this.columns[e.colIndex];
|
|
5172
|
-
if (t &&
|
|
5208
|
+
if (t && K(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
5173
5209
|
return;
|
|
5174
5210
|
this.isDragging = !0;
|
|
5175
5211
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -5178,24 +5214,104 @@ class _n extends _ {
|
|
|
5178
5214
|
endRow: i,
|
|
5179
5215
|
endCol: n
|
|
5180
5216
|
};
|
|
5181
|
-
return !r && this.ranges.length === 1 && Q(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#
|
|
5217
|
+
return !r && this.ranges.length === 1 && Q(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
|
|
5182
5218
|
}
|
|
5183
5219
|
onCellMouseMove(e) {
|
|
5184
5220
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5185
5221
|
let t = e.colIndex;
|
|
5186
5222
|
const i = this.columns[t];
|
|
5187
|
-
if (i &&
|
|
5188
|
-
const o = this.columns.findIndex((
|
|
5223
|
+
if (i && K(i)) {
|
|
5224
|
+
const o = this.columns.findIndex((s) => !K(s));
|
|
5189
5225
|
o >= 0 && (t = o);
|
|
5190
5226
|
}
|
|
5191
|
-
const n =
|
|
5192
|
-
return r && Q(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#
|
|
5227
|
+
const n = ce(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5228
|
+
return r && Q(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
|
|
5193
5229
|
}
|
|
5194
5230
|
onCellMouseUp(e) {
|
|
5195
5231
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
5196
5232
|
return this.isDragging = !1, !0;
|
|
5197
5233
|
}
|
|
5198
|
-
|
|
5234
|
+
processColumns(e) {
|
|
5235
|
+
if (this.config.checkbox && this.config.mode === "row") {
|
|
5236
|
+
if (e.some((r) => r.field === Ue))
|
|
5237
|
+
return e;
|
|
5238
|
+
const t = this.#i(), i = e.findIndex(te), n = i >= 0 ? i + 1 : 0;
|
|
5239
|
+
return [...e.slice(0, n), t, ...e.slice(n)];
|
|
5240
|
+
}
|
|
5241
|
+
return e;
|
|
5242
|
+
}
|
|
5243
|
+
#i() {
|
|
5244
|
+
return {
|
|
5245
|
+
field: Ue,
|
|
5246
|
+
header: "",
|
|
5247
|
+
width: 32,
|
|
5248
|
+
resizable: !1,
|
|
5249
|
+
sortable: !1,
|
|
5250
|
+
meta: {
|
|
5251
|
+
lockPosition: !0,
|
|
5252
|
+
suppressMovable: !0,
|
|
5253
|
+
utility: !0,
|
|
5254
|
+
checkboxColumn: !0
|
|
5255
|
+
},
|
|
5256
|
+
headerRenderer: () => {
|
|
5257
|
+
const e = document.createElement("div");
|
|
5258
|
+
e.className = "tbw-checkbox-header";
|
|
5259
|
+
const t = document.createElement("input");
|
|
5260
|
+
return t.type = "checkbox", t.className = "tbw-select-all-checkbox", t.addEventListener("click", (i) => {
|
|
5261
|
+
i.stopPropagation(), i.target.checked ? this.selectAll() : this.clearSelection();
|
|
5262
|
+
}), e.appendChild(t), e;
|
|
5263
|
+
},
|
|
5264
|
+
renderer: (e) => {
|
|
5265
|
+
const t = document.createElement("input");
|
|
5266
|
+
t.type = "checkbox", t.className = "tbw-select-row-checkbox";
|
|
5267
|
+
const i = e.cellEl;
|
|
5268
|
+
if (i) {
|
|
5269
|
+
const n = parseInt(i.getAttribute("data-row") ?? "-1", 10);
|
|
5270
|
+
n >= 0 && (t.checked = this.selected.has(n));
|
|
5271
|
+
}
|
|
5272
|
+
return t;
|
|
5273
|
+
}
|
|
5274
|
+
};
|
|
5275
|
+
}
|
|
5276
|
+
#e(e) {
|
|
5277
|
+
e.querySelectorAll(".tbw-select-row-checkbox").forEach((n) => {
|
|
5278
|
+
const r = n.closest(".cell"), o = r ? xe(r) : -1;
|
|
5279
|
+
o >= 0 && (n.checked = this.selected.has(o));
|
|
5280
|
+
});
|
|
5281
|
+
const i = e.querySelector(".tbw-select-all-checkbox");
|
|
5282
|
+
if (i) {
|
|
5283
|
+
const n = this.rows.length;
|
|
5284
|
+
let r = 0;
|
|
5285
|
+
if (this.config.isSelectable)
|
|
5286
|
+
for (let l = 0; l < n; l++)
|
|
5287
|
+
this.isRowSelectable(l) && r++;
|
|
5288
|
+
else
|
|
5289
|
+
r = n;
|
|
5290
|
+
const o = r > 0 && this.selected.size >= r, s = this.selected.size > 0;
|
|
5291
|
+
i.checked = o, i.indeterminate = s && !o;
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
#s(e) {
|
|
5295
|
+
const t = this.grid._focusRow, i = this.grid._focusCol;
|
|
5296
|
+
if (e === "row") {
|
|
5297
|
+
if (this.explicitSelection) {
|
|
5298
|
+
this.explicitSelection = !1, this.lastSyncedFocusRow = t;
|
|
5299
|
+
return;
|
|
5300
|
+
}
|
|
5301
|
+
t !== this.lastSyncedFocusRow && (this.lastSyncedFocusRow = t, this.isRowSelectable(t) && (!this.selected.has(t) || this.selected.size !== 1) && (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.anchor = t, this.emit("selection-change", this.#t())));
|
|
5302
|
+
}
|
|
5303
|
+
if (e === "cell") {
|
|
5304
|
+
if (this.explicitSelection) {
|
|
5305
|
+
this.explicitSelection = !1, this.lastSyncedFocusRow = t, this.lastSyncedFocusCol = i;
|
|
5306
|
+
return;
|
|
5307
|
+
}
|
|
5308
|
+
if ((t !== this.lastSyncedFocusRow || i !== this.lastSyncedFocusCol) && (this.lastSyncedFocusRow = t, this.lastSyncedFocusCol = i, this.isCellSelectable(t, i))) {
|
|
5309
|
+
const n = this.selectedCell;
|
|
5310
|
+
(!n || n.row !== t || n.col !== i) && (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()));
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
#r() {
|
|
5199
5315
|
const e = this.gridElement;
|
|
5200
5316
|
if (!e) return;
|
|
5201
5317
|
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
@@ -5205,26 +5321,27 @@ class _n extends _ {
|
|
|
5205
5321
|
const r = e.querySelectorAll(".data-grid-row");
|
|
5206
5322
|
if (r.forEach((o) => {
|
|
5207
5323
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
5208
|
-
}), t === "row" && (
|
|
5209
|
-
const
|
|
5324
|
+
}), t === "row" && (Ce(e), r.forEach((o) => {
|
|
5325
|
+
const s = o.querySelector(".cell[data-row]"), l = xe(s);
|
|
5210
5326
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
5211
|
-
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((
|
|
5212
|
-
const l = parseInt(
|
|
5213
|
-
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) ||
|
|
5327
|
+
}), this.config.checkbox && this.#e(e)), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5328
|
+
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
5329
|
+
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
|
|
5214
5330
|
}), t === "range" && this.ranges.length > 0) {
|
|
5215
|
-
|
|
5216
|
-
const o = this.
|
|
5217
|
-
|
|
5331
|
+
Ce(e);
|
|
5332
|
+
const o = this.ranges.map($), s = (d, c) => {
|
|
5333
|
+
for (const u of o)
|
|
5334
|
+
if (d >= u.startRow && d <= u.endRow && c >= u.startCol && c <= u.endCol)
|
|
5335
|
+
return !0;
|
|
5336
|
+
return !1;
|
|
5337
|
+
};
|
|
5338
|
+
e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
5218
5339
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
5219
5340
|
if (c >= 0 && u >= 0) {
|
|
5220
5341
|
const h = this.columns[u];
|
|
5221
|
-
if (h &&
|
|
5342
|
+
if (h && K(h))
|
|
5222
5343
|
return;
|
|
5223
|
-
|
|
5224
|
-
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
5225
|
-
const g = Math.max(o.startCol, a);
|
|
5226
|
-
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
5227
|
-
}
|
|
5344
|
+
s(c, u) && (d.classList.add("selected"), s(c - 1, u) || d.classList.add("top"), s(c + 1, u) || d.classList.add("bottom"), s(c, u - 1) || d.classList.add("first"), s(c, u + 1) || d.classList.add("last"));
|
|
5228
5345
|
}
|
|
5229
5346
|
});
|
|
5230
5347
|
}
|
|
@@ -5239,28 +5356,59 @@ class _n extends _ {
|
|
|
5239
5356
|
this.pendingKeyboardUpdate = null;
|
|
5240
5357
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
5241
5358
|
if (n && this.cellAnchor) {
|
|
5242
|
-
const
|
|
5243
|
-
this.ranges = [
|
|
5359
|
+
const s = ce(this.cellAnchor, { row: r, col: o });
|
|
5360
|
+
this.ranges = [s], this.activeRange = s;
|
|
5244
5361
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
5245
|
-
this.emit("selection-change", this.#
|
|
5362
|
+
this.emit("selection-change", this.#t());
|
|
5246
5363
|
}
|
|
5247
|
-
this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#
|
|
5364
|
+
this.#s(i), this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#r();
|
|
5248
5365
|
}
|
|
5249
5366
|
onScrollRender() {
|
|
5250
|
-
this.isSelectionEnabled() && this.#
|
|
5367
|
+
this.isSelectionEnabled() && this.#r();
|
|
5251
5368
|
}
|
|
5252
5369
|
getSelection() {
|
|
5253
5370
|
return {
|
|
5254
5371
|
mode: this.config.mode,
|
|
5255
|
-
ranges: this.#
|
|
5372
|
+
ranges: this.#t().ranges,
|
|
5256
5373
|
anchor: this.cellAnchor
|
|
5257
5374
|
};
|
|
5258
5375
|
}
|
|
5259
5376
|
getSelectedCells() {
|
|
5260
|
-
return
|
|
5377
|
+
return Zi(this.ranges);
|
|
5261
5378
|
}
|
|
5262
5379
|
isCellSelected(e, t) {
|
|
5263
|
-
return
|
|
5380
|
+
return Yi(e, t, this.ranges);
|
|
5381
|
+
}
|
|
5382
|
+
selectAll() {
|
|
5383
|
+
const { mode: e } = this.config;
|
|
5384
|
+
if (e === "row") {
|
|
5385
|
+
this.selected.clear();
|
|
5386
|
+
for (let t = 0; t < this.rows.length; t++)
|
|
5387
|
+
this.isRowSelectable(t) && this.selected.add(t);
|
|
5388
|
+
this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5389
|
+
} else if (e === "range") {
|
|
5390
|
+
const t = this.rows.length, i = this.columns.length;
|
|
5391
|
+
if (t > 0 && i > 0) {
|
|
5392
|
+
const n = {
|
|
5393
|
+
startRow: 0,
|
|
5394
|
+
startCol: 0,
|
|
5395
|
+
endRow: t - 1,
|
|
5396
|
+
endCol: i - 1
|
|
5397
|
+
};
|
|
5398
|
+
this.ranges = [n], this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5399
|
+
}
|
|
5400
|
+
}
|
|
5401
|
+
}
|
|
5402
|
+
selectRows(e) {
|
|
5403
|
+
if (this.config.mode === "row") {
|
|
5404
|
+
this.selected.clear();
|
|
5405
|
+
for (const t of e)
|
|
5406
|
+
t >= 0 && t < this.rows.length && this.isRowSelectable(t) && this.selected.add(t);
|
|
5407
|
+
this.anchor = e.length > 0 ? e[e.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
getSelectedRowIndices() {
|
|
5411
|
+
return [...this.selected].sort((e, t) => e - t);
|
|
5264
5412
|
}
|
|
5265
5413
|
clearSelection() {
|
|
5266
5414
|
this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
|
|
@@ -5273,11 +5421,11 @@ class _n extends _ {
|
|
|
5273
5421
|
endCol: t.to.col
|
|
5274
5422
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
5275
5423
|
mode: this.config.mode,
|
|
5276
|
-
ranges:
|
|
5424
|
+
ranges: dt(this.ranges)
|
|
5277
5425
|
}), this.requestAfterRender();
|
|
5278
5426
|
}
|
|
5279
|
-
#
|
|
5280
|
-
return
|
|
5427
|
+
#t() {
|
|
5428
|
+
return Ji(
|
|
5281
5429
|
this.config.mode,
|
|
5282
5430
|
{
|
|
5283
5431
|
selectedCell: this.selectedCell,
|
|
@@ -5288,38 +5436,38 @@ class _n extends _ {
|
|
|
5288
5436
|
);
|
|
5289
5437
|
}
|
|
5290
5438
|
}
|
|
5291
|
-
function ee(
|
|
5292
|
-
return Math.floor(
|
|
5439
|
+
function ee(a, e) {
|
|
5440
|
+
return Math.floor(a / e);
|
|
5293
5441
|
}
|
|
5294
|
-
function
|
|
5442
|
+
function en(a, e) {
|
|
5295
5443
|
return {
|
|
5296
|
-
start:
|
|
5297
|
-
end: (
|
|
5444
|
+
start: a * e,
|
|
5445
|
+
end: (a + 1) * e
|
|
5298
5446
|
};
|
|
5299
5447
|
}
|
|
5300
|
-
function
|
|
5301
|
-
const i = ee(
|
|
5448
|
+
function tn(a, e, t) {
|
|
5449
|
+
const i = ee(a, t), n = ee(e - 1, t), r = [];
|
|
5302
5450
|
for (let o = i; o <= n; o++)
|
|
5303
5451
|
r.push(o);
|
|
5304
5452
|
return r;
|
|
5305
5453
|
}
|
|
5306
|
-
async function
|
|
5307
|
-
const n =
|
|
5308
|
-
return
|
|
5454
|
+
async function Ye(a, e, t, i) {
|
|
5455
|
+
const n = en(e, t);
|
|
5456
|
+
return a.getRows({
|
|
5309
5457
|
startRow: n.start,
|
|
5310
5458
|
endRow: n.end,
|
|
5311
5459
|
sortModel: i.sortModel,
|
|
5312
5460
|
filterModel: i.filterModel
|
|
5313
5461
|
});
|
|
5314
5462
|
}
|
|
5315
|
-
function
|
|
5316
|
-
const i = ee(
|
|
5463
|
+
function nn(a, e, t) {
|
|
5464
|
+
const i = ee(a, e), n = t.get(i);
|
|
5317
5465
|
if (!n) return;
|
|
5318
|
-
const r =
|
|
5466
|
+
const r = a % e;
|
|
5319
5467
|
return n[r];
|
|
5320
5468
|
}
|
|
5321
|
-
const
|
|
5322
|
-
class
|
|
5469
|
+
const rn = 100;
|
|
5470
|
+
class Ln extends _ {
|
|
5323
5471
|
name = "serverSide";
|
|
5324
5472
|
get defaultConfig() {
|
|
5325
5473
|
return {
|
|
@@ -5339,12 +5487,12 @@ class Tn extends _ {
|
|
|
5339
5487
|
}
|
|
5340
5488
|
loadRequiredBlocks() {
|
|
5341
5489
|
if (!this.dataSource) return;
|
|
5342
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
5490
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = tn(i.startRow, i.endRow, t);
|
|
5343
5491
|
for (const r of n)
|
|
5344
5492
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
5345
5493
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
5346
5494
|
break;
|
|
5347
|
-
this.loadingBlocks.add(r),
|
|
5495
|
+
this.loadingBlocks.add(r), Ye(this.dataSource, r, t, {}).then((o) => {
|
|
5348
5496
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
5349
5497
|
}).catch(() => {
|
|
5350
5498
|
this.loadingBlocks.delete(r);
|
|
@@ -5355,7 +5503,7 @@ class Tn extends _ {
|
|
|
5355
5503
|
if (!this.dataSource) return [...e];
|
|
5356
5504
|
const t = [];
|
|
5357
5505
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
5358
|
-
const n =
|
|
5506
|
+
const n = nn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
5359
5507
|
t.push(n ?? { __loading: !0, __index: i });
|
|
5360
5508
|
}
|
|
5361
5509
|
return t;
|
|
@@ -5363,12 +5511,12 @@ class Tn extends _ {
|
|
|
5363
5511
|
onScroll(e) {
|
|
5364
5512
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
5365
5513
|
this.loadRequiredBlocks();
|
|
5366
|
-
},
|
|
5514
|
+
}, rn));
|
|
5367
5515
|
}
|
|
5368
5516
|
setDataSource(e) {
|
|
5369
5517
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
5370
5518
|
const t = this.config.cacheBlockSize ?? 100;
|
|
5371
|
-
|
|
5519
|
+
Ye(e, 0, t, {}).then((i) => {
|
|
5372
5520
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
5373
5521
|
});
|
|
5374
5522
|
}
|
|
@@ -5389,54 +5537,54 @@ class Tn extends _ {
|
|
|
5389
5537
|
return this.loadedBlocks.size;
|
|
5390
5538
|
}
|
|
5391
5539
|
}
|
|
5392
|
-
function
|
|
5393
|
-
return
|
|
5540
|
+
function ct(a, e, t) {
|
|
5541
|
+
return a.id !== void 0 ? String(a.id) : t ? `${t}-${e}` : String(e);
|
|
5394
5542
|
}
|
|
5395
|
-
function
|
|
5396
|
-
const t = new Set(
|
|
5543
|
+
function ue(a, e) {
|
|
5544
|
+
const t = new Set(a);
|
|
5397
5545
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5398
5546
|
}
|
|
5399
|
-
function
|
|
5547
|
+
function pe(a, e, t = null, i = 0) {
|
|
5400
5548
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5401
|
-
for (let o = 0; o <
|
|
5402
|
-
const
|
|
5549
|
+
for (let o = 0; o < a.length; o++) {
|
|
5550
|
+
const s = a[o], l = ct(s, o, t), d = s[n];
|
|
5403
5551
|
if (Array.isArray(d) && d.length > 0) {
|
|
5404
5552
|
r.add(l);
|
|
5405
|
-
const c =
|
|
5553
|
+
const c = pe(d, e, l, i + 1);
|
|
5406
5554
|
for (const u of c) r.add(u);
|
|
5407
5555
|
}
|
|
5408
5556
|
}
|
|
5409
5557
|
return r;
|
|
5410
5558
|
}
|
|
5411
|
-
function
|
|
5559
|
+
function on() {
|
|
5412
5560
|
return /* @__PURE__ */ new Set();
|
|
5413
5561
|
}
|
|
5414
|
-
function
|
|
5562
|
+
function ut(a, e, t, i = null, n = 0) {
|
|
5415
5563
|
const r = t.childrenField ?? "children";
|
|
5416
|
-
for (let o = 0; o <
|
|
5417
|
-
const
|
|
5564
|
+
for (let o = 0; o < a.length; o++) {
|
|
5565
|
+
const s = a[o], l = ct(s, o, i);
|
|
5418
5566
|
if (l === e)
|
|
5419
5567
|
return [l];
|
|
5420
|
-
const d =
|
|
5568
|
+
const d = s[r];
|
|
5421
5569
|
if (Array.isArray(d) && d.length > 0) {
|
|
5422
|
-
const c =
|
|
5570
|
+
const c = ut(d, e, t, l, n + 1);
|
|
5423
5571
|
if (c)
|
|
5424
5572
|
return [l, ...c];
|
|
5425
5573
|
}
|
|
5426
5574
|
}
|
|
5427
5575
|
return null;
|
|
5428
5576
|
}
|
|
5429
|
-
function
|
|
5430
|
-
const n =
|
|
5577
|
+
function sn(a, e, t, i) {
|
|
5578
|
+
const n = ut(a, e, t);
|
|
5431
5579
|
if (!n) return i;
|
|
5432
5580
|
const r = new Set(i);
|
|
5433
5581
|
for (let o = 0; o < n.length - 1; o++)
|
|
5434
5582
|
r.add(n[o]);
|
|
5435
5583
|
return r;
|
|
5436
5584
|
}
|
|
5437
|
-
function
|
|
5438
|
-
if (!Array.isArray(
|
|
5439
|
-
for (const t of
|
|
5585
|
+
function Xe(a, e = "children") {
|
|
5586
|
+
if (!Array.isArray(a) || a.length === 0) return !1;
|
|
5587
|
+
for (const t of a) {
|
|
5440
5588
|
if (!t) continue;
|
|
5441
5589
|
const i = t[e];
|
|
5442
5590
|
if (Array.isArray(i) && i.length > 0)
|
|
@@ -5444,10 +5592,10 @@ function Ye(s, e = "children") {
|
|
|
5444
5592
|
}
|
|
5445
5593
|
return !1;
|
|
5446
5594
|
}
|
|
5447
|
-
function
|
|
5448
|
-
if (!Array.isArray(
|
|
5595
|
+
function an(a) {
|
|
5596
|
+
if (!Array.isArray(a) || a.length === 0) return null;
|
|
5449
5597
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
5450
|
-
for (const t of
|
|
5598
|
+
for (const t of a)
|
|
5451
5599
|
if (!(!t || typeof t != "object"))
|
|
5452
5600
|
for (const i of e) {
|
|
5453
5601
|
const n = t[i];
|
|
@@ -5456,8 +5604,8 @@ function sn(s) {
|
|
|
5456
5604
|
}
|
|
5457
5605
|
return null;
|
|
5458
5606
|
}
|
|
5459
|
-
const
|
|
5460
|
-
class
|
|
5607
|
+
const ln = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-inline-start:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
5608
|
+
class In extends _ {
|
|
5461
5609
|
static manifest = {
|
|
5462
5610
|
events: [
|
|
5463
5611
|
{
|
|
@@ -5473,7 +5621,7 @@ class Ln extends _ {
|
|
|
5473
5621
|
]
|
|
5474
5622
|
};
|
|
5475
5623
|
name = "tree";
|
|
5476
|
-
styles =
|
|
5624
|
+
styles = ln;
|
|
5477
5625
|
get defaultConfig() {
|
|
5478
5626
|
return {
|
|
5479
5627
|
childrenField: "children",
|
|
@@ -5506,15 +5654,15 @@ class Ln extends _ {
|
|
|
5506
5654
|
}
|
|
5507
5655
|
detect(e) {
|
|
5508
5656
|
if (!this.config.autoDetect) return !1;
|
|
5509
|
-
const t = e, i = this.config.childrenField ??
|
|
5510
|
-
return
|
|
5657
|
+
const t = e, i = this.config.childrenField ?? an(t) ?? "children";
|
|
5658
|
+
return Xe(t, i);
|
|
5511
5659
|
}
|
|
5512
5660
|
processRows(e) {
|
|
5513
5661
|
const t = this.config.childrenField ?? "children", i = e;
|
|
5514
|
-
if (!
|
|
5662
|
+
if (!Xe(i, t))
|
|
5515
5663
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5516
5664
|
let n = this.withStableKeys(i);
|
|
5517
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5665
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = pe(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5518
5666
|
const r = /* @__PURE__ */ new Set();
|
|
5519
5667
|
for (const o of this.flattenedRows)
|
|
5520
5668
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5529,11 +5677,11 @@ class Ln extends _ {
|
|
|
5529
5677
|
withStableKeys(e, t = null) {
|
|
5530
5678
|
const i = this.config.childrenField ?? "children";
|
|
5531
5679
|
return e.map((n, r) => {
|
|
5532
|
-
const o = n.__stableKey,
|
|
5680
|
+
const o = n.__stableKey, s = n.id !== void 0 ? String(n.id) : o ?? (t ? `${t}-${r}` : String(r)), l = n[i], d = Array.isArray(l) && l.length > 0;
|
|
5533
5681
|
return {
|
|
5534
5682
|
...n,
|
|
5535
|
-
__stableKey:
|
|
5536
|
-
...d ? { [i]: this.withStableKeys(l,
|
|
5683
|
+
__stableKey: s,
|
|
5684
|
+
...d ? { [i]: this.withStableKeys(l, s) } : {}
|
|
5537
5685
|
};
|
|
5538
5686
|
});
|
|
5539
5687
|
}
|
|
@@ -5554,24 +5702,24 @@ class Ln extends _ {
|
|
|
5554
5702
|
}
|
|
5555
5703
|
sortTree(e, t, i) {
|
|
5556
5704
|
const n = this.config.childrenField ?? "children";
|
|
5557
|
-
return [...e].sort((o,
|
|
5558
|
-
const l = o[t], d =
|
|
5705
|
+
return [...e].sort((o, s) => {
|
|
5706
|
+
const l = o[t], d = s[t];
|
|
5559
5707
|
return l == null && d == null ? 0 : l == null ? -1 : d == null ? 1 : l > d ? i : l < d ? -i : 0;
|
|
5560
5708
|
}).map((o) => {
|
|
5561
|
-
const
|
|
5562
|
-
return Array.isArray(
|
|
5709
|
+
const s = o[n];
|
|
5710
|
+
return Array.isArray(s) && s.length > 0 ? { ...o, [n]: this.sortTree(s, t, i) } : o;
|
|
5563
5711
|
});
|
|
5564
5712
|
}
|
|
5565
5713
|
processColumns(e) {
|
|
5566
5714
|
if (this.flattenedRows.length === 0) return [...e];
|
|
5567
5715
|
const t = [...e];
|
|
5568
5716
|
if (t.length === 0) return t;
|
|
5569
|
-
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this),
|
|
5717
|
+
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), s = this.resolveIcon.bind(this), l = (d) => {
|
|
5570
5718
|
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, w = document.createElement("span");
|
|
5571
5719
|
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
|
|
5572
5720
|
if (g.__treeHasChildren) {
|
|
5573
5721
|
const y = document.createElement("span");
|
|
5574
|
-
y.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(y,
|
|
5722
|
+
y.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(y, s(g.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(y);
|
|
5575
5723
|
} else {
|
|
5576
5724
|
const y = document.createElement("span");
|
|
5577
5725
|
y.className = "tree-spacer", w.appendChild(y);
|
|
@@ -5592,7 +5740,7 @@ class Ln extends _ {
|
|
|
5592
5740
|
const i = t.getAttribute("data-tree-key");
|
|
5593
5741
|
if (!i) return !1;
|
|
5594
5742
|
const n = this.rowKeyMap.get(i);
|
|
5595
|
-
return n ? (this.expandedKeys =
|
|
5743
|
+
return n ? (this.expandedKeys = ue(this.expandedKeys, i), this.emit("tree-expand", {
|
|
5596
5744
|
key: i,
|
|
5597
5745
|
row: n.data,
|
|
5598
5746
|
expanded: this.expandedKeys.has(i),
|
|
@@ -5603,7 +5751,7 @@ class Ln extends _ {
|
|
|
5603
5751
|
if (e.key !== " ") return;
|
|
5604
5752
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
5605
5753
|
if (i?.hasChildren)
|
|
5606
|
-
return e.preventDefault(), this.expandedKeys =
|
|
5754
|
+
return e.preventDefault(), this.expandedKeys = ue(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
5607
5755
|
key: i.key,
|
|
5608
5756
|
row: i.data,
|
|
5609
5757
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -5624,8 +5772,8 @@ class Ln extends _ {
|
|
|
5624
5772
|
if (!t) return;
|
|
5625
5773
|
const i = e === "fade" ? "tbw-tree-fade-in" : "tbw-tree-slide-in";
|
|
5626
5774
|
for (const n of t.querySelectorAll(".data-grid-row")) {
|
|
5627
|
-
const r = n.querySelector(".cell[data-row]"), o = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1,
|
|
5628
|
-
|
|
5775
|
+
const r = n.querySelector(".cell[data-row]"), o = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1, s = this.flattenedRows[o]?.key;
|
|
5776
|
+
s && this.keysToAnimate.has(s) && (n.classList.add(i), n.addEventListener("animationend", () => n.classList.remove(i), { once: !0 }));
|
|
5629
5777
|
}
|
|
5630
5778
|
this.keysToAnimate.clear();
|
|
5631
5779
|
}
|
|
@@ -5636,13 +5784,13 @@ class Ln extends _ {
|
|
|
5636
5784
|
this.expandedKeys.delete(e), this.requestRender();
|
|
5637
5785
|
}
|
|
5638
5786
|
toggle(e) {
|
|
5639
|
-
this.expandedKeys =
|
|
5787
|
+
this.expandedKeys = ue(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5640
5788
|
}
|
|
5641
5789
|
expandAll() {
|
|
5642
|
-
this.expandedKeys =
|
|
5790
|
+
this.expandedKeys = pe(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5643
5791
|
}
|
|
5644
5792
|
collapseAll() {
|
|
5645
|
-
this.expandedKeys =
|
|
5793
|
+
this.expandedKeys = on(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5646
5794
|
}
|
|
5647
5795
|
isExpanded(e) {
|
|
5648
5796
|
return this.expandedKeys.has(e);
|
|
@@ -5657,11 +5805,11 @@ class Ln extends _ {
|
|
|
5657
5805
|
return this.rowKeyMap.get(e)?.data;
|
|
5658
5806
|
}
|
|
5659
5807
|
expandToKey(e) {
|
|
5660
|
-
this.expandedKeys =
|
|
5808
|
+
this.expandedKeys = sn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5661
5809
|
}
|
|
5662
5810
|
}
|
|
5663
|
-
function
|
|
5664
|
-
const i = [...
|
|
5811
|
+
function dn(a, e, t) {
|
|
5812
|
+
const i = [...a.undoStack, e];
|
|
5665
5813
|
for (; i.length > t; )
|
|
5666
5814
|
i.shift();
|
|
5667
5815
|
return {
|
|
@@ -5669,50 +5817,50 @@ function ln(s, e, t) {
|
|
|
5669
5817
|
redoStack: []
|
|
5670
5818
|
};
|
|
5671
5819
|
}
|
|
5672
|
-
function
|
|
5673
|
-
if (
|
|
5674
|
-
return { newState:
|
|
5675
|
-
const e = [...
|
|
5820
|
+
function Ze(a) {
|
|
5821
|
+
if (a.undoStack.length === 0)
|
|
5822
|
+
return { newState: a, action: null };
|
|
5823
|
+
const e = [...a.undoStack], t = e.pop();
|
|
5676
5824
|
return t ? {
|
|
5677
5825
|
newState: {
|
|
5678
5826
|
undoStack: e,
|
|
5679
|
-
redoStack: [...
|
|
5827
|
+
redoStack: [...a.redoStack, t]
|
|
5680
5828
|
},
|
|
5681
5829
|
action: t
|
|
5682
|
-
} : { newState:
|
|
5830
|
+
} : { newState: a, action: null };
|
|
5683
5831
|
}
|
|
5684
|
-
function
|
|
5685
|
-
if (
|
|
5686
|
-
return { newState:
|
|
5687
|
-
const e = [...
|
|
5832
|
+
function Qe(a) {
|
|
5833
|
+
if (a.redoStack.length === 0)
|
|
5834
|
+
return { newState: a, action: null };
|
|
5835
|
+
const e = [...a.redoStack], t = e.pop();
|
|
5688
5836
|
return t ? {
|
|
5689
5837
|
newState: {
|
|
5690
|
-
undoStack: [...
|
|
5838
|
+
undoStack: [...a.undoStack, t],
|
|
5691
5839
|
redoStack: e
|
|
5692
5840
|
},
|
|
5693
5841
|
action: t
|
|
5694
|
-
} : { newState:
|
|
5842
|
+
} : { newState: a, action: null };
|
|
5695
5843
|
}
|
|
5696
|
-
function
|
|
5697
|
-
return
|
|
5844
|
+
function cn(a) {
|
|
5845
|
+
return a.undoStack.length > 0;
|
|
5698
5846
|
}
|
|
5699
|
-
function
|
|
5700
|
-
return
|
|
5847
|
+
function un(a) {
|
|
5848
|
+
return a.redoStack.length > 0;
|
|
5701
5849
|
}
|
|
5702
|
-
function
|
|
5850
|
+
function hn() {
|
|
5703
5851
|
return { undoStack: [], redoStack: [] };
|
|
5704
5852
|
}
|
|
5705
|
-
function
|
|
5853
|
+
function fn(a, e, t, i) {
|
|
5706
5854
|
return {
|
|
5707
5855
|
type: "cell-edit",
|
|
5708
|
-
rowIndex:
|
|
5856
|
+
rowIndex: a,
|
|
5709
5857
|
field: e,
|
|
5710
5858
|
oldValue: t,
|
|
5711
5859
|
newValue: i,
|
|
5712
5860
|
timestamp: Date.now()
|
|
5713
5861
|
};
|
|
5714
5862
|
}
|
|
5715
|
-
class
|
|
5863
|
+
class Fn extends _ {
|
|
5716
5864
|
static dependencies = [
|
|
5717
5865
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5718
5866
|
];
|
|
@@ -5738,7 +5886,7 @@ class In extends _ {
|
|
|
5738
5886
|
onKeyDown(e) {
|
|
5739
5887
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5740
5888
|
if (t) {
|
|
5741
|
-
const n =
|
|
5889
|
+
const n = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5742
5890
|
if (n.action) {
|
|
5743
5891
|
const r = this.rows;
|
|
5744
5892
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
|
|
@@ -5749,7 +5897,7 @@ class In extends _ {
|
|
|
5749
5897
|
return !0;
|
|
5750
5898
|
}
|
|
5751
5899
|
if (i) {
|
|
5752
|
-
const n =
|
|
5900
|
+
const n = Qe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5753
5901
|
if (n.action) {
|
|
5754
5902
|
const r = this.rows;
|
|
5755
5903
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
|
|
@@ -5762,7 +5910,7 @@ class In extends _ {
|
|
|
5762
5910
|
return !1;
|
|
5763
5911
|
}
|
|
5764
5912
|
recordEdit(e, t, i, n) {
|
|
5765
|
-
const r =
|
|
5913
|
+
const r = fn(e, t, i, n), o = dn(
|
|
5766
5914
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5767
5915
|
r,
|
|
5768
5916
|
this.config.maxHistorySize ?? 100
|
|
@@ -5770,7 +5918,7 @@ class In extends _ {
|
|
|
5770
5918
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5771
5919
|
}
|
|
5772
5920
|
undo() {
|
|
5773
|
-
const e =
|
|
5921
|
+
const e = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5774
5922
|
if (e.action) {
|
|
5775
5923
|
const t = this.rows;
|
|
5776
5924
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5778,7 +5926,7 @@ class In extends _ {
|
|
|
5778
5926
|
return e.action;
|
|
5779
5927
|
}
|
|
5780
5928
|
redo() {
|
|
5781
|
-
const e =
|
|
5929
|
+
const e = Qe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5782
5930
|
if (e.action) {
|
|
5783
5931
|
const t = this.rows;
|
|
5784
5932
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5786,13 +5934,13 @@ class In extends _ {
|
|
|
5786
5934
|
return e.action;
|
|
5787
5935
|
}
|
|
5788
5936
|
canUndo() {
|
|
5789
|
-
return
|
|
5937
|
+
return cn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5790
5938
|
}
|
|
5791
5939
|
canRedo() {
|
|
5792
|
-
return
|
|
5940
|
+
return un({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5793
5941
|
}
|
|
5794
5942
|
clearHistory() {
|
|
5795
|
-
const e =
|
|
5943
|
+
const e = hn();
|
|
5796
5944
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5797
5945
|
}
|
|
5798
5946
|
getUndoStack() {
|
|
@@ -5802,9 +5950,9 @@ class In extends _ {
|
|
|
5802
5950
|
return [...this.redoStack];
|
|
5803
5951
|
}
|
|
5804
5952
|
}
|
|
5805
|
-
const
|
|
5806
|
-
function
|
|
5807
|
-
const e =
|
|
5953
|
+
const gn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
|
|
5954
|
+
function Je(a) {
|
|
5955
|
+
const e = a.meta ?? {};
|
|
5808
5956
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5809
5957
|
}
|
|
5810
5958
|
class V extends _ {
|
|
@@ -5813,7 +5961,7 @@ class V extends _ {
|
|
|
5813
5961
|
];
|
|
5814
5962
|
name = "visibility";
|
|
5815
5963
|
static PANEL_ID = "columns";
|
|
5816
|
-
styles =
|
|
5964
|
+
styles = gn;
|
|
5817
5965
|
get defaultConfig() {
|
|
5818
5966
|
return {
|
|
5819
5967
|
allowHideAll: !1
|
|
@@ -5902,8 +6050,8 @@ class V extends _ {
|
|
|
5902
6050
|
e.innerHTML = "";
|
|
5903
6051
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5904
6052
|
for (let n = 0; n < i.length; n++) {
|
|
5905
|
-
const r = i[n], o = r.header || r.field,
|
|
5906
|
-
|
|
6053
|
+
const r = i[n], o = r.header || r.field, s = document.createElement("div");
|
|
6054
|
+
s.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", s.setAttribute("data-field", r.field), s.setAttribute("data-index", String(n)), t && Je(r) && (s.draggable = !0, s.classList.add("reorderable"), this.setupDragListeners(s, r.field, n, e));
|
|
5907
6055
|
const l = document.createElement("label");
|
|
5908
6056
|
l.className = "tbw-visibility-label";
|
|
5909
6057
|
const d = document.createElement("input");
|
|
@@ -5911,11 +6059,11 @@ class V extends _ {
|
|
|
5911
6059
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5912
6060
|
});
|
|
5913
6061
|
const c = document.createElement("span");
|
|
5914
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
6062
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Je(r)) {
|
|
5915
6063
|
const u = document.createElement("span");
|
|
5916
|
-
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder",
|
|
6064
|
+
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", s.appendChild(u);
|
|
5917
6065
|
}
|
|
5918
|
-
|
|
6066
|
+
s.appendChild(l), e.appendChild(s);
|
|
5919
6067
|
}
|
|
5920
6068
|
}
|
|
5921
6069
|
setupDragListeners(e, t, i, n) {
|
|
@@ -5925,22 +6073,22 @@ class V extends _ {
|
|
|
5925
6073
|
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses(n);
|
|
5926
6074
|
}), e.addEventListener("dragover", (r) => {
|
|
5927
6075
|
if (r.preventDefault(), !this.isDragging || this.draggedField === t) return;
|
|
5928
|
-
const o = e.getBoundingClientRect(),
|
|
5929
|
-
this.dropIndex = r.clientY <
|
|
6076
|
+
const o = e.getBoundingClientRect(), s = o.top + o.height / 2;
|
|
6077
|
+
this.dropIndex = r.clientY < s ? i : i + 1, n.querySelectorAll(".tbw-visibility-row").forEach((l) => {
|
|
5930
6078
|
l !== e && l.classList.remove("drop-target", "drop-before", "drop-after");
|
|
5931
|
-
}), e.classList.add("drop-target"), e.classList.toggle("drop-before", r.clientY <
|
|
6079
|
+
}), e.classList.add("drop-target"), e.classList.toggle("drop-before", r.clientY < s), e.classList.toggle("drop-after", r.clientY >= s);
|
|
5932
6080
|
}), e.addEventListener("dragleave", () => {
|
|
5933
6081
|
e.classList.remove("drop-target", "drop-before", "drop-after");
|
|
5934
6082
|
}), e.addEventListener("drop", (r) => {
|
|
5935
6083
|
r.preventDefault();
|
|
5936
|
-
const o = this.draggedField,
|
|
5937
|
-
if (!this.isDragging || o === null ||
|
|
6084
|
+
const o = this.draggedField, s = this.draggedIndex, l = this.dropIndex;
|
|
6085
|
+
if (!this.isDragging || o === null || s === null || l === null)
|
|
5938
6086
|
return;
|
|
5939
|
-
const d = l >
|
|
5940
|
-
if (d !==
|
|
6087
|
+
const d = l > s ? l - 1 : l;
|
|
6088
|
+
if (d !== s) {
|
|
5941
6089
|
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, f = h ? c.findIndex((p) => p.field === h) : c.length, g = {
|
|
5942
6090
|
field: o,
|
|
5943
|
-
fromIndex:
|
|
6091
|
+
fromIndex: s,
|
|
5944
6092
|
toIndex: f
|
|
5945
6093
|
};
|
|
5946
6094
|
this.emit("column-reorder-request", g), setTimeout(() => {
|
|
@@ -5952,49 +6100,49 @@ class V extends _ {
|
|
|
5952
6100
|
}
|
|
5953
6101
|
export {
|
|
5954
6102
|
_ as BaseGridPlugin,
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
6103
|
+
mn as ClipboardPlugin,
|
|
6104
|
+
wn as ColumnVirtualizationPlugin,
|
|
6105
|
+
nt as ContextMenuPlugin,
|
|
6106
|
+
Mn as DEFAULT_ANIMATION_CONFIG,
|
|
6107
|
+
ft as DEFAULT_GRID_ICONS,
|
|
6108
|
+
Nn as DGEvents,
|
|
6109
|
+
qn as DataGridElement,
|
|
6110
|
+
bn as EditingPlugin,
|
|
6111
|
+
vn as ExportPlugin,
|
|
5964
6112
|
q as FilteringPlugin,
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
6113
|
+
Hn as FitModeEnum,
|
|
6114
|
+
Kn as GridCSSVars,
|
|
6115
|
+
zn as GridClasses,
|
|
6116
|
+
On as GridDataAttrs,
|
|
6117
|
+
Gn as GridElement,
|
|
6118
|
+
Bn as GridSelectors,
|
|
6119
|
+
yn as GroupingColumnsPlugin,
|
|
6120
|
+
xn as GroupingRowsPlugin,
|
|
6121
|
+
rt as MasterDetailPlugin,
|
|
6122
|
+
Cn as MultiSortPlugin,
|
|
6123
|
+
Vn as PLUGIN_QUERIES,
|
|
6124
|
+
En as PinnedColumnsPlugin,
|
|
6125
|
+
Rn as PinnedRowsPlugin,
|
|
5978
6126
|
B as PivotPlugin,
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
6127
|
+
Wn as PluginEvents,
|
|
6128
|
+
$n as PluginManager,
|
|
6129
|
+
Sn as PrintPlugin,
|
|
5982
6130
|
$i as ROW_DRAG_HANDLE_FIELD,
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6131
|
+
jn as RenderPhase,
|
|
6132
|
+
kn as ReorderPlugin,
|
|
6133
|
+
An as ResponsivePlugin,
|
|
6134
|
+
_n as RowReorderPlugin,
|
|
6135
|
+
Tn as SelectionPlugin,
|
|
6136
|
+
Ln as ServerSidePlugin,
|
|
6137
|
+
In as TreePlugin,
|
|
6138
|
+
Fn as UndoRedoPlugin,
|
|
5991
6139
|
V as VisibilityPlugin,
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
6140
|
+
Un as builtInSort,
|
|
6141
|
+
Yn as createGrid,
|
|
6142
|
+
Xn as defaultComparator,
|
|
5995
6143
|
Dt as defaultEditorFor,
|
|
5996
6144
|
Ct as defaultPasteHandler,
|
|
5997
6145
|
Ki as printGridIsolated,
|
|
5998
|
-
|
|
6146
|
+
Zn as queryGrid
|
|
5999
6147
|
};
|
|
6000
6148
|
//# sourceMappingURL=all.js.map
|