@toolbox-web/grid 1.9.1 → 1.10.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 +1082 -975
- package/all.js.map +1 -1
- package/index.js +350 -324
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +40 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +11 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/types.d.ts +0 -64
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +9 -0
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +3 -0
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +90 -57
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +9 -0
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +69 -0
- 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 +435 -293
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +117 -1
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js +38 -29
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +14 -5
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +9 -0
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +63 -54
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +25 -16
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +13 -4
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +13 -4
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +16 -7
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +13 -4
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +9 -0
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +13 -4
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +42 -33
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +9 -0
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +9 -0
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +29 -20
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +20 -11
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +15 -6
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +9 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +20 -20
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +14 -14
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js +1 -1
- package/umd/plugins/column-virtualization.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/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as ht,
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const tt = "__tbw_expander",
|
|
4
|
-
function pe(
|
|
5
|
-
return
|
|
1
|
+
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as ht, runAggregator as ee, e as Je, s as et, g as ue, r as gt, getAggregator as ye, getValueAggregator as ft, a as D, c as xe, b as pt } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Dn, DGEvents as Mn, DataGridElement as Nn, FitModeEnum as qn, GridCSSVars as Hn, GridClasses as Kn, GridDataAttrs as zn, DataGridElement as On, GridSelectors as Gn, PLUGIN_QUERIES as Bn, PluginEvents as Vn, PluginManager as Wn, RenderPhase as $n, builtInSort as jn, createGrid as Un, defaultComparator as Yn, queryGrid as Xn } from "./index.js";
|
|
3
|
+
const tt = "__tbw_expander", mt = 32;
|
|
4
|
+
function pe(a) {
|
|
5
|
+
return a.field === tt;
|
|
6
6
|
}
|
|
7
|
-
function q(
|
|
8
|
-
return
|
|
7
|
+
function q(a) {
|
|
8
|
+
return a.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function wt(a) {
|
|
11
|
+
return a.find(pe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function bt(a) {
|
|
14
14
|
return {
|
|
15
15
|
field: tt,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: mt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -22,44 +22,44 @@ function vt(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 te(
|
|
30
|
+
async function te(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 Ce(
|
|
40
|
+
function Ce(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
|
-
async function
|
|
52
|
+
async function vt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
const { rows: t, target: i, fields: n } =
|
|
59
|
+
function yt(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 xt(s, e) {
|
|
|
72
72
|
return;
|
|
73
73
|
} else for (; g >= d.length; ) {
|
|
74
74
|
const f = {};
|
|
75
|
-
|
|
75
|
+
s.forEach((p) => f[p] = ""), d.push(f);
|
|
76
76
|
}
|
|
77
77
|
d[g] = { ...d[g] }, u.forEach((f, p) => {
|
|
78
78
|
const w = n[p];
|
|
@@ -81,7 +81,7 @@ function xt(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class pn extends A {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -113,8 +113,8 @@ class mn extends A {
|
|
|
113
113
|
const t = this.#n(), 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,9 +128,9 @@ class mn extends A {
|
|
|
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.#o(e);
|
|
132
|
+
if (!s) return;
|
|
133
|
+
r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
|
|
134
134
|
}
|
|
135
135
|
const o = this.#i(r);
|
|
136
136
|
te(o.text).then(() => {
|
|
@@ -145,31 +145,31 @@ class mn extends A {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i = Ce(t, this.config), n = this.#n(), r = n?.ranges?.[0], o = r?.from.row ?? 0,
|
|
149
|
-
for (let w = 0; w < f &&
|
|
150
|
-
const b = this.columns[
|
|
148
|
+
const i = Ce(t, this.config), n = this.#n(), 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, g = [], f = i[0]?.length ?? 0;
|
|
149
|
+
for (let w = 0; w < f && s + w <= c; w++) {
|
|
150
|
+
const b = this.columns[s + w];
|
|
151
151
|
b && !b.hidden && g.push(b.field);
|
|
152
152
|
}
|
|
153
153
|
const p = { rows: i, text: t, target: h, fields: g };
|
|
154
|
-
this.emit("paste", p), this.#
|
|
154
|
+
this.emit("paste", p), this.#s(p);
|
|
155
155
|
}
|
|
156
|
-
#
|
|
156
|
+
#s(e) {
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? yt)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#n() {
|
|
163
163
|
return this.grid?.query("getSelection", void 0)?.[0];
|
|
164
164
|
}
|
|
165
165
|
#i(e) {
|
|
166
|
-
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n),
|
|
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
167
|
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !q(f));
|
|
168
168
|
if (this.config.includeHeaders) {
|
|
169
169
|
const f = g.map((p) => p.header || p.field);
|
|
170
170
|
h.push(f.join(c));
|
|
171
171
|
}
|
|
172
|
-
for (let f = o; f <=
|
|
172
|
+
for (let f = o; f <= s; f++) {
|
|
173
173
|
const p = this.rows[f];
|
|
174
174
|
if (!p) continue;
|
|
175
175
|
const w = g.map((b) => {
|
|
@@ -180,18 +180,18 @@ class mn extends A {
|
|
|
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
|
}
|
|
187
|
-
#
|
|
187
|
+
#o(e) {
|
|
188
188
|
const t = e.closest("[data-field-cache]");
|
|
189
189
|
if (!t) return null;
|
|
190
190
|
const i = t.dataset.fieldCache, n = t.dataset.row;
|
|
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() {
|
|
@@ -211,7 +211,7 @@ class mn extends A {
|
|
|
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],
|
|
@@ -220,7 +220,7 @@ class mn extends A {
|
|
|
220
220
|
return await te(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
|
-
const e = await
|
|
223
|
+
const e = await vt();
|
|
224
224
|
return e ? Ce(e, this.config) : null;
|
|
225
225
|
}
|
|
226
226
|
getLastCopied() {
|
|
@@ -228,37 +228,37 @@ class mn extends A {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
const Ee = 100;
|
|
231
|
-
function me(
|
|
232
|
-
if (
|
|
231
|
+
function me(a) {
|
|
232
|
+
if (a == null)
|
|
233
233
|
return Ee;
|
|
234
|
-
if (typeof
|
|
235
|
-
return
|
|
236
|
-
const e = parseFloat(
|
|
234
|
+
if (typeof a == "number")
|
|
235
|
+
return a;
|
|
236
|
+
const e = parseFloat(a);
|
|
237
237
|
return isNaN(e) ? Ee : e;
|
|
238
238
|
}
|
|
239
|
-
function Re(
|
|
240
|
-
return
|
|
239
|
+
function Re(a) {
|
|
240
|
+
return a.map((e) => me(e.width));
|
|
241
241
|
}
|
|
242
|
-
function Se(
|
|
242
|
+
function Se(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 ke(
|
|
250
|
-
return
|
|
249
|
+
function ke(a) {
|
|
250
|
+
return a.reduce((e, t) => e + me(t.width), 0);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function xt(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 =
|
|
256
|
+
let o = Ct(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 Ct(s, e, t, i, n) {
|
|
|
270
270
|
d.push(c);
|
|
271
271
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Ct(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
|
|
282
|
-
return t ?
|
|
281
|
+
function Et(a, e, t) {
|
|
282
|
+
return t ? a > e : !1;
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class mn extends A {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -297,40 +297,60 @@ class wn extends A {
|
|
|
297
297
|
totalWidth = 0;
|
|
298
298
|
columnWidths = [];
|
|
299
299
|
columnOffsets = [];
|
|
300
|
+
originalColumns = [];
|
|
300
301
|
attach(e) {
|
|
301
302
|
super.attach(e);
|
|
302
303
|
const t = this.columns;
|
|
303
304
|
this.columnWidths = Re(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
|
|
304
305
|
}
|
|
305
306
|
detach() {
|
|
306
|
-
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
307
|
+
this.#e(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
308
|
+
}
|
|
309
|
+
#e() {
|
|
310
|
+
const e = this.gridElement;
|
|
311
|
+
if (!e) return;
|
|
312
|
+
const t = e.querySelector(".header-row");
|
|
313
|
+
t && (t.style.paddingLeft = "", t.style.minWidth = ""), e.querySelectorAll(".data-grid-row").forEach((o) => {
|
|
314
|
+
o.style.paddingLeft = "";
|
|
315
|
+
});
|
|
316
|
+
const n = e.querySelector(".rows-viewport .rows");
|
|
317
|
+
n && (n.style.width = "");
|
|
318
|
+
const r = e.querySelector(".rows-body");
|
|
319
|
+
r && (r.style.minWidth = "");
|
|
307
320
|
}
|
|
308
321
|
processColumns(e) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
322
|
+
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(e));
|
|
323
|
+
const i = this.originalColumns, n = Et(
|
|
324
|
+
i.length,
|
|
325
|
+
this.config.threshold ?? 30,
|
|
326
|
+
this.config.autoEnable ?? !0
|
|
327
|
+
);
|
|
328
|
+
if (this.isVirtualized = n ?? !1, !n)
|
|
329
|
+
return this.startCol = 0, this.endCol = i.length - 1, [...i];
|
|
330
|
+
const r = this.grid.clientWidth || 800, o = xt(
|
|
313
331
|
this.scrollLeft,
|
|
314
|
-
|
|
332
|
+
r,
|
|
315
333
|
this.columnOffsets,
|
|
316
334
|
this.columnWidths,
|
|
317
335
|
this.config.overscan ?? 3
|
|
318
336
|
);
|
|
319
|
-
return this.startCol =
|
|
337
|
+
return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((s) => i[s]);
|
|
320
338
|
}
|
|
321
339
|
afterRender() {
|
|
322
340
|
if (!this.isVirtualized) return;
|
|
323
341
|
const e = this.gridElement;
|
|
324
342
|
if (!e) return;
|
|
325
343
|
const t = this.columnOffsets[this.startCol] ?? 0, i = e.querySelector(".header-row"), n = e.querySelectorAll(".data-grid-row");
|
|
326
|
-
i && (i.style.paddingLeft = `${t}px`), n.forEach((
|
|
327
|
-
|
|
344
|
+
i && (i.style.paddingLeft = `${t}px`, i.style.minWidth = `${this.totalWidth}px`), n.forEach((s) => {
|
|
345
|
+
s.style.paddingLeft = `${t}px`;
|
|
328
346
|
});
|
|
329
347
|
const r = e.querySelector(".rows-viewport .rows");
|
|
330
348
|
r && (r.style.width = `${this.totalWidth}px`);
|
|
349
|
+
const o = e.querySelector(".rows-body");
|
|
350
|
+
o && (o.style.minWidth = `${this.totalWidth}px`);
|
|
331
351
|
}
|
|
332
352
|
onScroll(e) {
|
|
333
|
-
!this.isVirtualized || Math.abs(e.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = e.scrollLeft, this.
|
|
353
|
+
!this.isVirtualized || Math.abs(e.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = e.scrollLeft, this.requestColumnsRender());
|
|
334
354
|
}
|
|
335
355
|
getIsVirtualized() {
|
|
336
356
|
return this.isVirtualized;
|
|
@@ -350,16 +370,16 @@ class wn extends A {
|
|
|
350
370
|
}
|
|
351
371
|
}
|
|
352
372
|
const ie = "@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}}";
|
|
353
|
-
function he(
|
|
354
|
-
return (typeof
|
|
373
|
+
function he(a, e) {
|
|
374
|
+
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
355
375
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
376
|
+
function Rt(a, e) {
|
|
377
|
+
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
358
378
|
}
|
|
359
|
-
function ge(
|
|
379
|
+
function ge(a, e, t, i = ht.submenuArrow) {
|
|
360
380
|
const n = document.createElement("div");
|
|
361
381
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
362
|
-
for (const r of
|
|
382
|
+
for (const r of a) {
|
|
363
383
|
if (r.separator) {
|
|
364
384
|
const d = document.createElement("div");
|
|
365
385
|
d.className = "tbw-context-menu-separator", d.setAttribute("role", "separator"), n.appendChild(d);
|
|
@@ -367,8 +387,8 @@ function ge(s, e, t, i = ht.submenuArrow) {
|
|
|
367
387
|
}
|
|
368
388
|
const o = document.createElement("div");
|
|
369
389
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
390
|
+
const s = Rt(r, e);
|
|
391
|
+
if (s && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
372
392
|
const d = document.createElement("span");
|
|
373
393
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
374
394
|
}
|
|
@@ -388,17 +408,17 @@ function ge(s, e, t, i = ht.submenuArrow) {
|
|
|
388
408
|
c && c.remove();
|
|
389
409
|
});
|
|
390
410
|
}
|
|
391
|
-
!
|
|
411
|
+
!s && r.action && !r.subMenu && o.addEventListener("click", (d) => {
|
|
392
412
|
d.stopPropagation(), t(r);
|
|
393
413
|
}), n.appendChild(o);
|
|
394
414
|
}
|
|
395
415
|
return n;
|
|
396
416
|
}
|
|
397
|
-
function Ae(
|
|
398
|
-
|
|
399
|
-
const i =
|
|
400
|
-
let o = e,
|
|
401
|
-
e + i.width > n && (o = e - i.width), t + i.height > r && (
|
|
417
|
+
function Ae(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";
|
|
402
422
|
}
|
|
403
423
|
let z = null, O = null, M = null, ne = 0;
|
|
404
424
|
const re = [
|
|
@@ -406,16 +426,16 @@ const re = [
|
|
|
406
426
|
id: "copy",
|
|
407
427
|
name: "Copy",
|
|
408
428
|
shortcut: "Ctrl+C",
|
|
409
|
-
action: (
|
|
410
|
-
|
|
429
|
+
action: (a) => {
|
|
430
|
+
a.grid?.plugins?.clipboard?.copy?.();
|
|
411
431
|
}
|
|
412
432
|
},
|
|
413
433
|
{ separator: !0, id: "sep1", name: "" },
|
|
414
434
|
{
|
|
415
435
|
id: "export-csv",
|
|
416
436
|
name: "Export CSV",
|
|
417
|
-
action: (
|
|
418
|
-
|
|
437
|
+
action: (a) => {
|
|
438
|
+
a.grid?.plugins?.export?.exportCsv?.();
|
|
419
439
|
}
|
|
420
440
|
}
|
|
421
441
|
];
|
|
@@ -477,8 +497,8 @@ class it extends A {
|
|
|
477
497
|
const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
|
|
478
498
|
r && n.push(`color-scheme: ${r}`);
|
|
479
499
|
for (const o of it.CSS_VARS_TO_COPY) {
|
|
480
|
-
const
|
|
481
|
-
|
|
500
|
+
const s = i.getPropertyValue(o).trim();
|
|
501
|
+
s && n.push(`${o}: ${s}`);
|
|
482
502
|
}
|
|
483
503
|
if (n.length > 0) {
|
|
484
504
|
const o = e.getAttribute("style") || "";
|
|
@@ -502,7 +522,7 @@ class it extends A {
|
|
|
502
522
|
t && t.getAttribute("data-context-menu-bound") !== "true" && (t.setAttribute("data-context-menu-bound", "true"), t.addEventListener("contextmenu", (i) => {
|
|
503
523
|
const n = i;
|
|
504
524
|
n.preventDefault();
|
|
505
|
-
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");
|
|
506
526
|
let l;
|
|
507
527
|
if (o) {
|
|
508
528
|
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], g = this.rows[c];
|
|
@@ -516,8 +536,8 @@ class it extends A {
|
|
|
516
536
|
isHeader: !1,
|
|
517
537
|
event: n
|
|
518
538
|
};
|
|
519
|
-
} else if (
|
|
520
|
-
const c = parseInt(
|
|
539
|
+
} else if (s) {
|
|
540
|
+
const c = parseInt(s.getAttribute("data-col") ?? "-1", 10), u = this.columns[c];
|
|
521
541
|
l = {
|
|
522
542
|
row: null,
|
|
523
543
|
rowIndex: -1,
|
|
@@ -569,14 +589,14 @@ class it extends A {
|
|
|
569
589
|
return this.isOpen;
|
|
570
590
|
}
|
|
571
591
|
}
|
|
572
|
-
const
|
|
573
|
-
function
|
|
574
|
-
const e =
|
|
592
|
+
const St = "@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;.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 kt(a) {
|
|
594
|
+
const e = a.options;
|
|
575
595
|
return e ? typeof e == "function" ? e() : e : [];
|
|
576
596
|
}
|
|
577
|
-
function
|
|
597
|
+
function At(a) {
|
|
578
598
|
return (e) => {
|
|
579
|
-
const t =
|
|
599
|
+
const t = a.editorParams, i = document.createElement("input");
|
|
580
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);
|
|
581
601
|
const n = () => e.commit(i.value === "" ? null : Number(i.value));
|
|
582
602
|
return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
|
|
@@ -584,34 +604,38 @@ function _t(s) {
|
|
|
584
604
|
}), i;
|
|
585
605
|
};
|
|
586
606
|
}
|
|
587
|
-
function
|
|
588
|
-
return (
|
|
607
|
+
function _t() {
|
|
608
|
+
return (a) => {
|
|
589
609
|
const e = document.createElement("input");
|
|
590
|
-
return e.type = "checkbox", e.checked = !!
|
|
610
|
+
return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
|
|
591
611
|
};
|
|
592
612
|
}
|
|
593
|
-
function
|
|
613
|
+
function Tt(a) {
|
|
594
614
|
return (e) => {
|
|
595
|
-
const t =
|
|
596
|
-
|
|
597
|
-
|
|
615
|
+
const t = a.editorParams, i = document.createElement("input");
|
|
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
|
+
const n = () => {
|
|
618
|
+
typeof e.value == "string" ? e.commit(i.value) : e.commit(i.valueAsDate);
|
|
619
|
+
};
|
|
620
|
+
return i.addEventListener("change", n), i.addEventListener("keydown", (r) => {
|
|
621
|
+
r.key === "Escape" && e.cancel();
|
|
598
622
|
}), i;
|
|
599
623
|
};
|
|
600
624
|
}
|
|
601
|
-
function
|
|
625
|
+
function Lt(a) {
|
|
602
626
|
return (e) => {
|
|
603
|
-
const t =
|
|
604
|
-
if (
|
|
627
|
+
const t = a.editorParams, i = document.createElement("select");
|
|
628
|
+
if (a.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
605
629
|
const o = document.createElement("option");
|
|
606
630
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
607
631
|
}
|
|
608
|
-
|
|
609
|
-
const
|
|
610
|
-
|
|
632
|
+
kt(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);
|
|
611
635
|
});
|
|
612
636
|
const r = () => {
|
|
613
|
-
if (
|
|
614
|
-
const o = Array.from(i.selectedOptions).map((
|
|
637
|
+
if (a.multi) {
|
|
638
|
+
const o = Array.from(i.selectedOptions).map((s) => s.value);
|
|
615
639
|
e.commit(o);
|
|
616
640
|
} else
|
|
617
641
|
e.commit(i.value);
|
|
@@ -621,65 +645,70 @@ function Ft(s) {
|
|
|
621
645
|
}), i;
|
|
622
646
|
};
|
|
623
647
|
}
|
|
624
|
-
function It(
|
|
648
|
+
function It(a) {
|
|
625
649
|
return (e) => {
|
|
626
|
-
const t =
|
|
627
|
-
|
|
628
|
-
|
|
650
|
+
const t = a.editorParams, i = document.createElement("input");
|
|
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
|
+
const n = () => {
|
|
653
|
+
const r = i.value;
|
|
654
|
+
typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r);
|
|
655
|
+
};
|
|
656
|
+
return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
|
|
657
|
+
r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
|
|
629
658
|
}), i;
|
|
630
659
|
};
|
|
631
660
|
}
|
|
632
|
-
function
|
|
633
|
-
switch (
|
|
661
|
+
function Ft(a) {
|
|
662
|
+
switch (a.type) {
|
|
634
663
|
case "number":
|
|
635
|
-
return
|
|
664
|
+
return At(a);
|
|
636
665
|
case "boolean":
|
|
637
|
-
return
|
|
666
|
+
return _t();
|
|
638
667
|
case "date":
|
|
639
|
-
return
|
|
668
|
+
return Tt(a);
|
|
640
669
|
case "select":
|
|
641
|
-
return
|
|
670
|
+
return Lt(a);
|
|
642
671
|
default:
|
|
643
|
-
return It(
|
|
672
|
+
return It(a);
|
|
644
673
|
}
|
|
645
674
|
}
|
|
646
675
|
const oe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
647
|
-
function
|
|
676
|
+
function Pt(a, e) {
|
|
648
677
|
if (e.editor) return e.editor;
|
|
649
678
|
if (e.__editorTemplate) return "template";
|
|
650
679
|
if (!e.type) return;
|
|
651
|
-
const i =
|
|
680
|
+
const i = a.effectiveConfig?.typeDefaults;
|
|
652
681
|
if (i?.[e.type]?.editor)
|
|
653
682
|
return i[e.type].editor;
|
|
654
|
-
const n =
|
|
683
|
+
const n = a.__frameworkAdapter;
|
|
655
684
|
if (n?.getTypeDefault) {
|
|
656
685
|
const r = n.getTypeDefault(e.type);
|
|
657
686
|
if (r?.editor)
|
|
658
687
|
return r.editor;
|
|
659
688
|
}
|
|
660
689
|
}
|
|
661
|
-
function $(
|
|
662
|
-
return !(typeof
|
|
690
|
+
function $(a) {
|
|
691
|
+
return !(typeof a != "string" || a === "__proto__" || a === "constructor" || a === "prototype");
|
|
663
692
|
}
|
|
664
|
-
function
|
|
665
|
-
const e = (
|
|
666
|
-
|
|
693
|
+
function Dt(a) {
|
|
694
|
+
const e = (a.__editingCellCount ?? 0) + 1;
|
|
695
|
+
a.__editingCellCount = e, a.setAttribute("data-has-editing", "");
|
|
667
696
|
}
|
|
668
|
-
function
|
|
669
|
-
|
|
697
|
+
function Mt(a) {
|
|
698
|
+
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
670
699
|
}
|
|
671
|
-
function U(
|
|
672
|
-
return
|
|
700
|
+
function U(a, e, t) {
|
|
701
|
+
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) : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : a.value;
|
|
673
702
|
}
|
|
674
|
-
function _e(
|
|
703
|
+
function _e(a) {
|
|
675
704
|
}
|
|
676
|
-
function
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
t(U(
|
|
680
|
-
}),
|
|
705
|
+
function Nt(a, e, t, i) {
|
|
706
|
+
const n = a.querySelector("input,textarea,select");
|
|
707
|
+
n && (n.addEventListener("blur", () => {
|
|
708
|
+
t(U(n, e, i));
|
|
709
|
+
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(U(n, e, i))));
|
|
681
710
|
}
|
|
682
|
-
class
|
|
711
|
+
class wn extends A {
|
|
683
712
|
static manifest = {
|
|
684
713
|
ownedProperties: [
|
|
685
714
|
{
|
|
@@ -713,7 +742,7 @@ class bn extends A {
|
|
|
713
742
|
]
|
|
714
743
|
};
|
|
715
744
|
name = "editing";
|
|
716
|
-
styles =
|
|
745
|
+
styles = St;
|
|
717
746
|
get defaultConfig() {
|
|
718
747
|
return {
|
|
719
748
|
editOn: "click"
|
|
@@ -721,10 +750,12 @@ class bn extends A {
|
|
|
721
750
|
}
|
|
722
751
|
#e = -1;
|
|
723
752
|
#t = -1;
|
|
724
|
-
#
|
|
753
|
+
#s = /* @__PURE__ */ new Map();
|
|
725
754
|
#n = /* @__PURE__ */ new Set();
|
|
726
755
|
#i = /* @__PURE__ */ new Set();
|
|
727
|
-
#
|
|
756
|
+
#o = !1;
|
|
757
|
+
#d = -1;
|
|
758
|
+
#r = /* @__PURE__ */ new Map();
|
|
728
759
|
attach(e) {
|
|
729
760
|
super.attach(e);
|
|
730
761
|
const t = this.disconnectSignal, i = e;
|
|
@@ -739,7 +770,7 @@ class bn extends A {
|
|
|
739
770
|
}, document.addEventListener(
|
|
740
771
|
"keydown",
|
|
741
772
|
(n) => {
|
|
742
|
-
n.key === "Escape" && this.#e !== -1 && this.#
|
|
773
|
+
n.key === "Escape" && this.#e !== -1 && this.#l(this.#e, !0);
|
|
743
774
|
},
|
|
744
775
|
{ capture: !0, signal: t }
|
|
745
776
|
), document.addEventListener(
|
|
@@ -748,14 +779,14 @@ class bn extends A {
|
|
|
748
779
|
if (this.#e === -1) return;
|
|
749
780
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
750
781
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || queueMicrotask(() => {
|
|
751
|
-
this.#e !== -1 && this.#
|
|
782
|
+
this.#e !== -1 && this.#l(this.#e, !1);
|
|
752
783
|
});
|
|
753
784
|
},
|
|
754
785
|
{ signal: t }
|
|
755
786
|
);
|
|
756
787
|
}
|
|
757
788
|
detach() {
|
|
758
|
-
this.#e = -1, this.#t = -1, this.#
|
|
789
|
+
this.#e = -1, this.#t = -1, this.#s.clear(), this.#n.clear(), this.#i.clear(), super.detach();
|
|
759
790
|
}
|
|
760
791
|
handleQuery(e) {
|
|
761
792
|
if (e.type === "isEditing")
|
|
@@ -767,21 +798,21 @@ class bn extends A {
|
|
|
767
798
|
const n = e.originalEvent.type === "dblclick";
|
|
768
799
|
if (i === "click" && n || i === "dblclick" && !n) return !1;
|
|
769
800
|
const { rowIndex: r } = e;
|
|
770
|
-
return t._columns?.some((
|
|
801
|
+
return t._columns?.some((s) => s.editable) ? (e.originalEvent.stopPropagation(), this.beginBulkEdit(r), !0) : !1;
|
|
771
802
|
}
|
|
772
803
|
onKeyDown(e) {
|
|
773
804
|
const t = this.grid;
|
|
774
805
|
if (e.key === "Escape" && this.#e !== -1)
|
|
775
|
-
return this.#
|
|
806
|
+
return this.#l(this.#e, !0), !0;
|
|
776
807
|
if (e.key === " " || e.key === "Spacebar") {
|
|
777
808
|
const i = t._focusRow, n = t._focusCol;
|
|
778
809
|
if (i >= 0 && n >= 0) {
|
|
779
810
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
780
811
|
if (r?.editable && r.type === "boolean" && o) {
|
|
781
|
-
const
|
|
782
|
-
if ($(
|
|
783
|
-
const d = !o[
|
|
784
|
-
return this.#
|
|
812
|
+
const s = r.field;
|
|
813
|
+
if ($(s)) {
|
|
814
|
+
const d = !o[s];
|
|
815
|
+
return this.#a(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
785
816
|
}
|
|
786
817
|
}
|
|
787
818
|
}
|
|
@@ -793,8 +824,8 @@ class bn extends A {
|
|
|
793
824
|
const i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
794
825
|
if (i === !1 || i === "manual") return !1;
|
|
795
826
|
const n = t._focusRow, r = t._focusCol;
|
|
796
|
-
if (n >= 0 && t._columns?.some((
|
|
797
|
-
const
|
|
827
|
+
if (n >= 0 && t._columns?.some((s) => s.editable)) {
|
|
828
|
+
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", {
|
|
798
829
|
cancelable: !0,
|
|
799
830
|
bubbles: !0,
|
|
800
831
|
detail: {
|
|
@@ -826,8 +857,8 @@ class bn extends A {
|
|
|
826
857
|
if (!r.type) return r;
|
|
827
858
|
let o;
|
|
828
859
|
if (i?.[r.type]?.editorParams && (o = i[r.type].editorParams), !o && n?.getTypeDefault) {
|
|
829
|
-
const
|
|
830
|
-
|
|
860
|
+
const s = n.getTypeDefault(r.type);
|
|
861
|
+
s?.editorParams && (o = s.editorParams);
|
|
831
862
|
}
|
|
832
863
|
return o ? {
|
|
833
864
|
...r,
|
|
@@ -837,14 +868,18 @@ class bn extends A {
|
|
|
837
868
|
}
|
|
838
869
|
afterRender() {
|
|
839
870
|
const e = this.grid;
|
|
840
|
-
if (this.#
|
|
871
|
+
if (this.#o && (this.#o = !1, this.#m(e)), this.#d !== -1) {
|
|
872
|
+
const t = this.#d;
|
|
873
|
+
this.#d = -1, e.animateRow?.(t, "change");
|
|
874
|
+
}
|
|
875
|
+
if (this.#i.size !== 0)
|
|
841
876
|
for (const t of this.#i) {
|
|
842
|
-
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10),
|
|
843
|
-
if (!
|
|
844
|
-
const l =
|
|
877
|
+
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
878
|
+
if (!s) continue;
|
|
879
|
+
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
845
880
|
if (!l || l.classList.contains("editing")) continue;
|
|
846
881
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
847
|
-
d && c && this.#
|
|
882
|
+
d && c && this.#f(d, r, c, o, l, !0);
|
|
848
883
|
}
|
|
849
884
|
}
|
|
850
885
|
onScrollRender() {
|
|
@@ -886,32 +921,86 @@ class bn extends A {
|
|
|
886
921
|
isRowChangedById(e) {
|
|
887
922
|
return this.#n.has(e);
|
|
888
923
|
}
|
|
924
|
+
setInvalid(e, t, i = "") {
|
|
925
|
+
let n = this.#r.get(e);
|
|
926
|
+
n || (n = /* @__PURE__ */ new Map(), this.#r.set(e, n)), n.set(t, i), this.#c(e, t, !0);
|
|
927
|
+
}
|
|
928
|
+
clearInvalid(e, t) {
|
|
929
|
+
const i = this.#r.get(e);
|
|
930
|
+
i && (i.delete(t), i.size === 0 && this.#r.delete(e)), this.#c(e, t, !1);
|
|
931
|
+
}
|
|
932
|
+
clearRowInvalid(e) {
|
|
933
|
+
const t = this.#r.get(e);
|
|
934
|
+
if (t) {
|
|
935
|
+
const i = Array.from(t.keys());
|
|
936
|
+
this.#r.delete(e), i.forEach((n) => this.#c(e, n, !1));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
clearAllInvalid() {
|
|
940
|
+
const e = Array.from(this.#r.entries());
|
|
941
|
+
this.#r.clear(), e.forEach(([t, i]) => {
|
|
942
|
+
i.forEach((n, r) => this.#c(t, r, !1));
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
isCellInvalid(e, t) {
|
|
946
|
+
return this.#r.get(e)?.has(t) ?? !1;
|
|
947
|
+
}
|
|
948
|
+
getInvalidMessage(e, t) {
|
|
949
|
+
return this.#r.get(e)?.get(t);
|
|
950
|
+
}
|
|
951
|
+
hasInvalidCells(e) {
|
|
952
|
+
const t = this.#r.get(e);
|
|
953
|
+
return t ? t.size > 0 : !1;
|
|
954
|
+
}
|
|
955
|
+
getInvalidFields(e) {
|
|
956
|
+
return new Map(this.#r.get(e) ?? []);
|
|
957
|
+
}
|
|
958
|
+
#c(e, t, i) {
|
|
959
|
+
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
960
|
+
if (r === -1 || r === void 0) return;
|
|
961
|
+
const s = n._rows?.findIndex((c) => {
|
|
962
|
+
try {
|
|
963
|
+
return n.getRowId?.(c) === e;
|
|
964
|
+
} catch {
|
|
965
|
+
return !1;
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
if (s === -1 || s === void 0) return;
|
|
969
|
+
const d = n.findRenderedRowElement?.(s)?.querySelector(`.cell[data-col="${r}"]`);
|
|
970
|
+
if (d)
|
|
971
|
+
if (i) {
|
|
972
|
+
d.setAttribute("data-invalid", "true");
|
|
973
|
+
const c = this.#r.get(e)?.get(t);
|
|
974
|
+
c && d.setAttribute("title", c);
|
|
975
|
+
} else
|
|
976
|
+
d.removeAttribute("data-invalid"), d.removeAttribute("title");
|
|
977
|
+
}
|
|
889
978
|
resetChangedRows(e) {
|
|
890
979
|
const t = this.changedRows, i = this.changedRowIds;
|
|
891
|
-
this.#n.clear(), this.#
|
|
980
|
+
this.#n.clear(), this.#h(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
892
981
|
}
|
|
893
982
|
beginCellEdit(e, t) {
|
|
894
983
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
895
984
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
896
|
-
const
|
|
897
|
-
|
|
985
|
+
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
986
|
+
s && this.#w(e, n, s);
|
|
898
987
|
}
|
|
899
988
|
beginBulkEdit(e) {
|
|
900
989
|
const t = this.grid;
|
|
901
|
-
if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((
|
|
990
|
+
if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((s) => s.editable)) return;
|
|
902
991
|
const r = t.findRenderedRowElement?.(e);
|
|
903
992
|
if (!r) return;
|
|
904
993
|
const o = t._rows[e];
|
|
905
|
-
this.#
|
|
994
|
+
this.#p(e, o), Array.from(r.children).forEach((s, l) => {
|
|
906
995
|
const d = t._visibleColumns[l];
|
|
907
996
|
if (d?.editable) {
|
|
908
|
-
const c =
|
|
909
|
-
c.classList.contains("editing") || this.#
|
|
997
|
+
const c = s;
|
|
998
|
+
c.classList.contains("editing") || this.#f(o, e, d, l, c, !0);
|
|
910
999
|
}
|
|
911
1000
|
}), setTimeout(() => {
|
|
912
|
-
let
|
|
913
|
-
if (
|
|
914
|
-
const l =
|
|
1001
|
+
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1002
|
+
if (s?.classList.contains("editing") || (s = r.querySelector(".cell.editing")), s?.classList.contains("editing")) {
|
|
1003
|
+
const l = s.querySelector(oe);
|
|
915
1004
|
try {
|
|
916
1005
|
l?.focus({ preventScroll: !0 });
|
|
917
1006
|
} catch {
|
|
@@ -920,29 +1009,29 @@ class bn extends A {
|
|
|
920
1009
|
}, 0);
|
|
921
1010
|
}
|
|
922
1011
|
commitActiveRowEdit() {
|
|
923
|
-
this.#e !== -1 && this.#
|
|
1012
|
+
this.#e !== -1 && this.#l(this.#e, !1);
|
|
924
1013
|
}
|
|
925
1014
|
cancelActiveRowEdit() {
|
|
926
|
-
this.#e !== -1 && this.#
|
|
1015
|
+
this.#e !== -1 && this.#l(this.#e, !0);
|
|
927
1016
|
}
|
|
928
|
-
#
|
|
1017
|
+
#w(e, t, i) {
|
|
929
1018
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
930
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#
|
|
1019
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#p(e, r), this.#t = t, this.#f(r, e, o, t, i, !1));
|
|
931
1020
|
}
|
|
932
|
-
#
|
|
1021
|
+
#h() {
|
|
933
1022
|
const e = this.grid;
|
|
934
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1023
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#s;
|
|
935
1024
|
}
|
|
936
|
-
#
|
|
937
|
-
this.#e !== e && (this.#
|
|
1025
|
+
#p(e, t) {
|
|
1026
|
+
this.#e !== e && (this.#s.set(e, { ...t }), this.#e = e, this.#h());
|
|
938
1027
|
}
|
|
939
|
-
#
|
|
1028
|
+
#l(e, t) {
|
|
940
1029
|
if (this.#e !== e) return;
|
|
941
|
-
const i = this.grid, n = this.#
|
|
942
|
-
let
|
|
1030
|
+
const i = this.grid, n = this.#s.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
1031
|
+
let s;
|
|
943
1032
|
if (r)
|
|
944
1033
|
try {
|
|
945
|
-
|
|
1034
|
+
s = i.getRowId?.(r);
|
|
946
1035
|
} catch {
|
|
947
1036
|
}
|
|
948
1037
|
if (!t && o && r && o.querySelectorAll(".cell.editing").forEach((d) => {
|
|
@@ -952,43 +1041,52 @@ class bn extends A {
|
|
|
952
1041
|
if (!u) return;
|
|
953
1042
|
const h = d.querySelector("input,textarea,select");
|
|
954
1043
|
if (h) {
|
|
955
|
-
const g = U(h, u);
|
|
956
|
-
|
|
1044
|
+
const g = u.field, f = r[g], p = U(h, u, f);
|
|
1045
|
+
f !== p && this.#a(e, u, p, r);
|
|
957
1046
|
}
|
|
958
1047
|
}), t && n && r)
|
|
959
1048
|
Object.keys(n).forEach((l) => {
|
|
960
1049
|
r[l] = n[l];
|
|
961
|
-
}),
|
|
1050
|
+
}), s && (this.#n.delete(s), this.clearRowInvalid(s));
|
|
962
1051
|
else if (!t && r) {
|
|
963
|
-
const l =
|
|
964
|
-
this.emit("row-commit", {
|
|
1052
|
+
const l = this.#g(n, r), d = s ? this.#n.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
965
1053
|
rowIndex: e,
|
|
966
|
-
rowId:
|
|
1054
|
+
rowId: s ?? "",
|
|
967
1055
|
row: r,
|
|
968
|
-
|
|
1056
|
+
oldValue: n,
|
|
1057
|
+
newValue: r,
|
|
1058
|
+
changed: d,
|
|
969
1059
|
changedRows: this.changedRows,
|
|
970
1060
|
changedRowIds: this.changedRowIds
|
|
971
|
-
})
|
|
1061
|
+
});
|
|
1062
|
+
c && n ? (Object.keys(n).forEach((u) => {
|
|
1063
|
+
r[u] = n[u];
|
|
1064
|
+
}), s && (this.#n.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#d = e);
|
|
972
1065
|
}
|
|
973
|
-
this.#
|
|
1066
|
+
this.#s.delete(e), this.#e = -1, this.#t = -1, this.#h();
|
|
974
1067
|
for (const l of this.#i)
|
|
975
1068
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
976
1069
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
977
|
-
l.classList.remove("editing"),
|
|
978
|
-
}), this.requestRender()), this.#
|
|
1070
|
+
l.classList.remove("editing"), Mt(l.parentElement);
|
|
1071
|
+
}), this.requestRender()), this.#o = !0, o || (this.#m(i), this.#o = !1);
|
|
979
1072
|
}
|
|
980
|
-
#
|
|
1073
|
+
#a(e, t, i, n) {
|
|
981
1074
|
const r = t.field;
|
|
982
1075
|
if (!$(r)) return;
|
|
983
1076
|
const o = n[r];
|
|
984
1077
|
if (o === i) return;
|
|
985
|
-
const
|
|
1078
|
+
const s = this.grid;
|
|
986
1079
|
let l;
|
|
987
1080
|
try {
|
|
988
1081
|
l = this.grid.getRowId(n);
|
|
989
1082
|
} catch {
|
|
990
1083
|
}
|
|
991
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (
|
|
1084
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : _e;
|
|
1085
|
+
let u = !1;
|
|
1086
|
+
const h = l ? (p) => {
|
|
1087
|
+
u = !0, this.setInvalid(l, r, p ?? "");
|
|
1088
|
+
} : () => {
|
|
1089
|
+
};
|
|
992
1090
|
if (this.emitCancelable("cell-commit", {
|
|
993
1091
|
row: n,
|
|
994
1092
|
rowId: l ?? "",
|
|
@@ -999,40 +1097,41 @@ class bn extends A {
|
|
|
999
1097
|
changedRows: this.changedRows,
|
|
1000
1098
|
changedRowIds: this.changedRowIds,
|
|
1001
1099
|
firstTimeForRow: d,
|
|
1002
|
-
updateRow: c
|
|
1100
|
+
updateRow: c,
|
|
1101
|
+
setInvalid: h
|
|
1003
1102
|
})) return;
|
|
1004
|
-
n[r] = i, l && this.#n.add(l), this.#
|
|
1103
|
+
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#n.add(l), this.#h(), this.emitPluginEvent("cell-edit-committed", {
|
|
1005
1104
|
rowIndex: e,
|
|
1006
1105
|
field: r,
|
|
1007
1106
|
oldValue: o,
|
|
1008
1107
|
newValue: i
|
|
1009
1108
|
});
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1109
|
+
const f = s.findRenderedRowElement?.(e);
|
|
1110
|
+
f && f.classList.add("changed");
|
|
1012
1111
|
}
|
|
1013
|
-
#
|
|
1112
|
+
#f(e, t, i, n, r, o) {
|
|
1014
1113
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1015
|
-
let
|
|
1114
|
+
let s;
|
|
1016
1115
|
try {
|
|
1017
|
-
|
|
1116
|
+
s = this.grid.getRowId(e);
|
|
1018
1117
|
} catch {
|
|
1019
1118
|
}
|
|
1020
|
-
const l =
|
|
1119
|
+
const l = s ? (C) => this.grid.updateRow(s, C, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
|
|
1021
1120
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
1022
1121
|
const c = r.parentElement;
|
|
1023
|
-
c &&
|
|
1122
|
+
c && Dt(c);
|
|
1024
1123
|
let u = !1;
|
|
1025
1124
|
const h = (C) => {
|
|
1026
|
-
u || this.#e === -1 || this.#
|
|
1125
|
+
u || this.#e === -1 || this.#a(t, i, C, e);
|
|
1027
1126
|
}, g = () => {
|
|
1028
1127
|
u = !0, $(i.field) && (e[i.field] = d);
|
|
1029
1128
|
}, f = document.createElement("div");
|
|
1030
1129
|
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (C) => {
|
|
1031
|
-
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#
|
|
1130
|
+
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#l(t, !1)), C.key === "Escape" && (C.stopPropagation(), C.preventDefault(), g(), this.#l(t, !0));
|
|
1032
1131
|
});
|
|
1033
|
-
const p = i, w = p.__editorTemplate, b =
|
|
1132
|
+
const p = i, w = p.__editorTemplate, b = Pt(this.grid, p) ?? Ft(i), v = d;
|
|
1034
1133
|
if (b === "template" && w)
|
|
1035
|
-
this.#
|
|
1134
|
+
this.#u(f, p, e, d, h, g, o, t);
|
|
1036
1135
|
else if (typeof b == "string") {
|
|
1037
1136
|
const C = document.createElement(b);
|
|
1038
1137
|
C.value = v, C.addEventListener("change", () => h(C.value)), f.appendChild(C), o || queueMicrotask(() => {
|
|
@@ -1041,7 +1140,7 @@ class bn extends A {
|
|
|
1041
1140
|
} else if (typeof b == "function") {
|
|
1042
1141
|
const C = {
|
|
1043
1142
|
row: e,
|
|
1044
|
-
rowId:
|
|
1143
|
+
rowId: s ?? "",
|
|
1045
1144
|
value: v,
|
|
1046
1145
|
field: i.field,
|
|
1047
1146
|
column: i,
|
|
@@ -1049,7 +1148,7 @@ class bn extends A {
|
|
|
1049
1148
|
cancel: g,
|
|
1050
1149
|
updateRow: l
|
|
1051
1150
|
}, _ = b(C);
|
|
1052
|
-
typeof _ == "string" ? (f.innerHTML = _,
|
|
1151
|
+
typeof _ == "string" ? (f.innerHTML = _, Nt(f, i, h, d)) : _ instanceof Node && f.appendChild(_), o || queueMicrotask(() => {
|
|
1053
1152
|
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
1054
1153
|
});
|
|
1055
1154
|
} else if (b && typeof b == "object") {
|
|
@@ -1057,7 +1156,7 @@ class bn extends A {
|
|
|
1057
1156
|
C.setAttribute("data-external-editor", ""), C.setAttribute("data-field", i.field), f.appendChild(C);
|
|
1058
1157
|
const _ = {
|
|
1059
1158
|
row: e,
|
|
1060
|
-
rowId:
|
|
1159
|
+
rowId: s ?? "",
|
|
1061
1160
|
value: v,
|
|
1062
1161
|
field: i.field,
|
|
1063
1162
|
column: i,
|
|
@@ -1077,7 +1176,7 @@ class bn extends A {
|
|
|
1077
1176
|
);
|
|
1078
1177
|
}
|
|
1079
1178
|
}
|
|
1080
|
-
#
|
|
1179
|
+
#u(e, t, i, n, r, o, s, l) {
|
|
1081
1180
|
const d = t.__editorTemplate;
|
|
1082
1181
|
if (!d) return;
|
|
1083
1182
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1102,15 +1201,23 @@ class bn extends A {
|
|
|
1102
1201
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1103
1202
|
let g = !1;
|
|
1104
1203
|
h.addEventListener("blur", () => {
|
|
1105
|
-
g || r(U(h, t));
|
|
1204
|
+
g || r(U(h, t, n));
|
|
1106
1205
|
}), h.addEventListener("keydown", (f) => {
|
|
1107
1206
|
const p = f;
|
|
1108
|
-
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t)), this.#
|
|
1109
|
-
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)),
|
|
1207
|
+
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t, n)), this.#l(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#l(l, !0));
|
|
1208
|
+
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1110
1209
|
}
|
|
1111
1210
|
e.appendChild(c);
|
|
1112
1211
|
}
|
|
1113
|
-
#
|
|
1212
|
+
#g(e, t) {
|
|
1213
|
+
if (!e) return !1;
|
|
1214
|
+
const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
|
|
1215
|
+
for (const o of r)
|
|
1216
|
+
if (i[o] !== n[o])
|
|
1217
|
+
return !0;
|
|
1218
|
+
return !1;
|
|
1219
|
+
}
|
|
1220
|
+
#m(e) {
|
|
1114
1221
|
queueMicrotask(() => {
|
|
1115
1222
|
try {
|
|
1116
1223
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1126,17 +1233,17 @@ class bn extends A {
|
|
|
1126
1233
|
});
|
|
1127
1234
|
}
|
|
1128
1235
|
}
|
|
1129
|
-
function Te(
|
|
1130
|
-
if (
|
|
1131
|
-
if (
|
|
1132
|
-
if (typeof
|
|
1133
|
-
const t = String(
|
|
1236
|
+
function Te(a, e = !0) {
|
|
1237
|
+
if (a == null) return "";
|
|
1238
|
+
if (a instanceof Date) return a.toISOString();
|
|
1239
|
+
if (typeof a == "object") return JSON.stringify(a);
|
|
1240
|
+
const t = String(a);
|
|
1134
1241
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1135
1242
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1136
1243
|
}
|
|
1137
|
-
function
|
|
1244
|
+
function qt(a, e, t, i = {}) {
|
|
1138
1245
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1139
|
-
`, o = [],
|
|
1246
|
+
`, o = [], s = i.bom ? "\uFEFF" : "";
|
|
1140
1247
|
if (t.includeHeaders !== !1) {
|
|
1141
1248
|
const l = e.map((d) => {
|
|
1142
1249
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
@@ -1144,27 +1251,27 @@ function Ht(s, e, t, i = {}) {
|
|
|
1144
1251
|
});
|
|
1145
1252
|
o.push(l.join(n));
|
|
1146
1253
|
}
|
|
1147
|
-
for (const l of
|
|
1254
|
+
for (const l of a) {
|
|
1148
1255
|
const d = e.map((c) => {
|
|
1149
1256
|
let u = l[c.field];
|
|
1150
1257
|
return t.processCell && (u = t.processCell(u, c.field, l)), Te(u);
|
|
1151
1258
|
});
|
|
1152
1259
|
o.push(d.join(n));
|
|
1153
1260
|
}
|
|
1154
|
-
return
|
|
1261
|
+
return s + o.join(r);
|
|
1155
1262
|
}
|
|
1156
|
-
function we(
|
|
1157
|
-
const t = URL.createObjectURL(
|
|
1263
|
+
function we(a, e) {
|
|
1264
|
+
const t = URL.createObjectURL(a), i = document.createElement("a");
|
|
1158
1265
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1159
1266
|
}
|
|
1160
|
-
function
|
|
1161
|
-
const t = new Blob([
|
|
1267
|
+
function Ht(a, e) {
|
|
1268
|
+
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1162
1269
|
we(t, e);
|
|
1163
1270
|
}
|
|
1164
|
-
function Le(
|
|
1165
|
-
return
|
|
1271
|
+
function Le(a) {
|
|
1272
|
+
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1166
1273
|
}
|
|
1167
|
-
function
|
|
1274
|
+
function Kt(a, e, t) {
|
|
1168
1275
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1169
1276
|
<?mso-application progid="Excel.Sheet"?>
|
|
1170
1277
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1180,14 +1287,14 @@ function zt(s, e, t) {
|
|
|
1180
1287
|
}
|
|
1181
1288
|
i += "</Row>";
|
|
1182
1289
|
}
|
|
1183
|
-
for (const n of
|
|
1290
|
+
for (const n of a) {
|
|
1184
1291
|
i += `
|
|
1185
1292
|
<Row>`;
|
|
1186
1293
|
for (const r of e) {
|
|
1187
1294
|
let o = n[r.field];
|
|
1188
1295
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1189
|
-
let
|
|
1190
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (
|
|
1296
|
+
let s = "String", l = "";
|
|
1297
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l = Le(String(o)), i += `<Cell><Data ss:Type="${s}">${l}</Data></Cell>`;
|
|
1191
1298
|
}
|
|
1192
1299
|
i += "</Row>";
|
|
1193
1300
|
}
|
|
@@ -1196,13 +1303,13 @@ function zt(s, e, t) {
|
|
|
1196
1303
|
</Worksheet>
|
|
1197
1304
|
</Workbook>`, i;
|
|
1198
1305
|
}
|
|
1199
|
-
function
|
|
1200
|
-
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([
|
|
1306
|
+
function zt(a, e) {
|
|
1307
|
+
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
|
|
1201
1308
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1202
1309
|
});
|
|
1203
1310
|
we(i, t);
|
|
1204
1311
|
}
|
|
1205
|
-
class
|
|
1312
|
+
class bn extends A {
|
|
1206
1313
|
name = "export";
|
|
1207
1314
|
get defaultConfig() {
|
|
1208
1315
|
return {
|
|
@@ -1235,17 +1342,17 @@ class vn extends A {
|
|
|
1235
1342
|
l?.selected?.size && (o = [...l.selected].sort((c, u) => c - u).map((c) => this.rows[c]).filter(Boolean));
|
|
1236
1343
|
}
|
|
1237
1344
|
t?.rowIndices && (o = t.rowIndices.map((l) => this.rows[l]).filter(Boolean)), this.isExportingFlag = !0;
|
|
1238
|
-
let
|
|
1345
|
+
let s = n.fileName;
|
|
1239
1346
|
try {
|
|
1240
1347
|
switch (e) {
|
|
1241
1348
|
case "csv": {
|
|
1242
|
-
const l =
|
|
1243
|
-
|
|
1349
|
+
const l = qt(o, r, n, { bom: !0 });
|
|
1350
|
+
s = s.endsWith(".csv") ? s : `${s}.csv`, Ht(l, s);
|
|
1244
1351
|
break;
|
|
1245
1352
|
}
|
|
1246
1353
|
case "excel": {
|
|
1247
|
-
const l =
|
|
1248
|
-
|
|
1354
|
+
const l = Kt(o, r, n);
|
|
1355
|
+
s = s.endsWith(".xls") ? s : `${s}.xls`, zt(l, s);
|
|
1249
1356
|
break;
|
|
1250
1357
|
}
|
|
1251
1358
|
case "json": {
|
|
@@ -1257,15 +1364,15 @@ class vn extends A {
|
|
|
1257
1364
|
}
|
|
1258
1365
|
return h;
|
|
1259
1366
|
}), d = JSON.stringify(l, null, 2);
|
|
1260
|
-
|
|
1367
|
+
s = s.endsWith(".json") ? s : `${s}.json`;
|
|
1261
1368
|
const c = new Blob([d], { type: "application/json" });
|
|
1262
|
-
we(c,
|
|
1369
|
+
we(c, s);
|
|
1263
1370
|
break;
|
|
1264
1371
|
}
|
|
1265
1372
|
}
|
|
1266
1373
|
this.lastExportInfo = { format: e, timestamp: /* @__PURE__ */ new Date() }, this.emit("export-complete", {
|
|
1267
1374
|
format: e,
|
|
1268
|
-
fileName:
|
|
1375
|
+
fileName: s,
|
|
1269
1376
|
rowCount: o.length,
|
|
1270
1377
|
columnCount: r.length
|
|
1271
1378
|
});
|
|
@@ -1296,23 +1403,23 @@ class vn extends A {
|
|
|
1296
1403
|
return this.lastExportInfo;
|
|
1297
1404
|
}
|
|
1298
1405
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } =
|
|
1301
|
-
let
|
|
1302
|
-
|
|
1303
|
-
let l =
|
|
1304
|
-
return l > e && (l = e), l === e &&
|
|
1305
|
-
start:
|
|
1406
|
+
function Ot(a) {
|
|
1407
|
+
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = a, o = Math.ceil(t / n);
|
|
1408
|
+
let s = Math.floor(i / n) - r;
|
|
1409
|
+
s < 0 && (s = 0);
|
|
1410
|
+
let l = s + o + r * 2;
|
|
1411
|
+
return l > e && (l = e), l === e && s > 0 && (s = Math.max(0, l - o - r * 2)), {
|
|
1412
|
+
start: s,
|
|
1306
1413
|
end: l,
|
|
1307
|
-
offsetY:
|
|
1414
|
+
offsetY: s * n,
|
|
1308
1415
|
totalHeight: e * n
|
|
1309
1416
|
};
|
|
1310
1417
|
}
|
|
1311
|
-
function
|
|
1312
|
-
return
|
|
1418
|
+
function Gt(a, e) {
|
|
1419
|
+
return a <= e;
|
|
1313
1420
|
}
|
|
1314
|
-
function
|
|
1315
|
-
const i =
|
|
1421
|
+
function Bt(a, e, t = !1) {
|
|
1422
|
+
const i = a[e.field];
|
|
1316
1423
|
if (e.operator === "blank")
|
|
1317
1424
|
return i == null || i === "";
|
|
1318
1425
|
if (e.operator === "notBlank")
|
|
@@ -1350,12 +1457,12 @@ function Vt(s, e, t = !1) {
|
|
|
1350
1457
|
return !0;
|
|
1351
1458
|
}
|
|
1352
1459
|
}
|
|
1353
|
-
function
|
|
1354
|
-
return e.length ?
|
|
1460
|
+
function Vt(a, e, t = !1) {
|
|
1461
|
+
return e.length ? a.filter((i) => e.every((n) => Bt(i, n, t))) : a;
|
|
1355
1462
|
}
|
|
1356
|
-
function
|
|
1463
|
+
function Wt(a) {
|
|
1357
1464
|
return JSON.stringify(
|
|
1358
|
-
|
|
1465
|
+
a.map((e) => ({
|
|
1359
1466
|
field: e.field,
|
|
1360
1467
|
operator: e.operator,
|
|
1361
1468
|
value: e.value,
|
|
@@ -1363,15 +1470,15 @@ function $t(s) {
|
|
|
1363
1470
|
}))
|
|
1364
1471
|
);
|
|
1365
1472
|
}
|
|
1366
|
-
function
|
|
1473
|
+
function Ie(a, e) {
|
|
1367
1474
|
const t = /* @__PURE__ */ new Set();
|
|
1368
|
-
for (const i of
|
|
1475
|
+
for (const i of a) {
|
|
1369
1476
|
const n = i[e];
|
|
1370
1477
|
n != null && t.add(n);
|
|
1371
1478
|
}
|
|
1372
1479
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1373
1480
|
}
|
|
1374
|
-
const
|
|
1481
|
+
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-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.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)}}";
|
|
1375
1482
|
class N extends A {
|
|
1376
1483
|
static manifest = {
|
|
1377
1484
|
events: [
|
|
@@ -1382,7 +1489,7 @@ class N extends A {
|
|
|
1382
1489
|
]
|
|
1383
1490
|
};
|
|
1384
1491
|
name = "filtering";
|
|
1385
|
-
styles =
|
|
1492
|
+
styles = $t;
|
|
1386
1493
|
get defaultConfig() {
|
|
1387
1494
|
return {
|
|
1388
1495
|
debounceMs: 300,
|
|
@@ -1435,10 +1542,10 @@ class N extends A {
|
|
|
1435
1542
|
if (!t.length) return [...e];
|
|
1436
1543
|
if (this.config.filterHandler)
|
|
1437
1544
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1438
|
-
const i =
|
|
1545
|
+
const i = Wt(t);
|
|
1439
1546
|
if (this.cacheKey === i && this.cachedResult)
|
|
1440
1547
|
return this.cachedResult;
|
|
1441
|
-
const n =
|
|
1548
|
+
const n = Vt([...e], t, this.config.caseSensitive);
|
|
1442
1549
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1443
1550
|
}
|
|
1444
1551
|
afterRender() {
|
|
@@ -1451,19 +1558,19 @@ class N extends A {
|
|
|
1451
1558
|
if (!r || !this.isColumnFilterable(r) || q(r)) return;
|
|
1452
1559
|
const o = r.field;
|
|
1453
1560
|
if (!o) return;
|
|
1454
|
-
const
|
|
1561
|
+
const s = this.filters.has(o);
|
|
1455
1562
|
let l = i.querySelector(".tbw-filter-btn");
|
|
1456
1563
|
if (l) {
|
|
1457
1564
|
const u = l.classList.contains("active");
|
|
1458
|
-
if (l.classList.toggle("active",
|
|
1459
|
-
const h =
|
|
1565
|
+
if (l.classList.toggle("active", s), i.classList.toggle("filtered", s), u !== s) {
|
|
1566
|
+
const h = s ? "filterActive" : "filter";
|
|
1460
1567
|
this.setIcon(l, this.resolveIcon(h));
|
|
1461
1568
|
}
|
|
1462
1569
|
return;
|
|
1463
1570
|
}
|
|
1464
1571
|
l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`);
|
|
1465
|
-
const d =
|
|
1466
|
-
this.setIcon(l, this.resolveIcon(d)),
|
|
1572
|
+
const d = s ? "filterActive" : "filter";
|
|
1573
|
+
this.setIcon(l, this.resolveIcon(d)), s && (l.classList.add("active"), i.classList.add("filtered")), l.addEventListener("click", (u) => {
|
|
1467
1574
|
u.stopPropagation(), this.toggleFilterPanel(o, r, l);
|
|
1468
1575
|
});
|
|
1469
1576
|
const c = i.querySelector(".resize-handle");
|
|
@@ -1516,7 +1623,7 @@ class N extends A {
|
|
|
1516
1623
|
return this.getFilters();
|
|
1517
1624
|
}
|
|
1518
1625
|
getUniqueValues(e) {
|
|
1519
|
-
return
|
|
1626
|
+
return Ie(this.sourceRows, e);
|
|
1520
1627
|
}
|
|
1521
1628
|
copyGridThemeContext(e) {
|
|
1522
1629
|
const t = this.gridElement;
|
|
@@ -1533,7 +1640,7 @@ class N extends A {
|
|
|
1533
1640
|
return;
|
|
1534
1641
|
}
|
|
1535
1642
|
const e = document.createElement("style");
|
|
1536
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1643
|
+
e.id = "tbw-filter-panel-styles", e.textContent = jt, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1537
1644
|
}
|
|
1538
1645
|
toggleFilterPanel(e, t, i) {
|
|
1539
1646
|
if (this.openPanelField === e) {
|
|
@@ -1548,13 +1655,13 @@ class N extends A {
|
|
|
1548
1655
|
});
|
|
1549
1656
|
return;
|
|
1550
1657
|
}
|
|
1551
|
-
const r =
|
|
1658
|
+
const r = Ie(this.sourceRows, e);
|
|
1552
1659
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1553
1660
|
}
|
|
1554
1661
|
renderPanelContent(e, t, i, n) {
|
|
1555
1662
|
let r = this.excludedValues.get(e);
|
|
1556
1663
|
r || (r = /* @__PURE__ */ new Set(), this.excludedValues.set(e, r));
|
|
1557
|
-
const o = this.searchText.get(e) ?? "",
|
|
1664
|
+
const o = this.searchText.get(e) ?? "", s = {
|
|
1558
1665
|
field: e,
|
|
1559
1666
|
column: t,
|
|
1560
1667
|
uniqueValues: n,
|
|
@@ -1572,13 +1679,13 @@ class N extends A {
|
|
|
1572
1679
|
closePanel: () => this.closeFilterPanel()
|
|
1573
1680
|
};
|
|
1574
1681
|
let l = !1;
|
|
1575
|
-
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i,
|
|
1682
|
+
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, s), l = i.children.length > 0), !l && t.type) {
|
|
1576
1683
|
const d = this.grid.effectiveConfig.typeDefaults?.[t.type];
|
|
1577
|
-
d?.filterPanelRenderer && (d.filterPanelRenderer(i,
|
|
1684
|
+
d?.filterPanelRenderer && (d.filterPanelRenderer(i, s), l = i.children.length > 0);
|
|
1578
1685
|
}
|
|
1579
1686
|
if (!l) {
|
|
1580
1687
|
const d = t.type;
|
|
1581
|
-
d === "number" ? this.renderNumberFilterPanel(i,
|
|
1688
|
+
d === "number" ? this.renderNumberFilterPanel(i, s, n) : d === "date" ? this.renderDateFilterPanel(i, s, n) : this.renderDefaultFilterPanel(i, s, n, r);
|
|
1582
1689
|
}
|
|
1583
1690
|
}
|
|
1584
1691
|
setupPanelCloseHandler(e, t) {
|
|
@@ -1604,8 +1711,8 @@ class N extends A {
|
|
|
1604
1711
|
const n = t.closest(".cell") ?? t;
|
|
1605
1712
|
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, N.checkAnchorPositioningSupport()) {
|
|
1606
1713
|
requestAnimationFrame(() => {
|
|
1607
|
-
const o = e.getBoundingClientRect(),
|
|
1608
|
-
o.top <
|
|
1714
|
+
const o = e.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
1715
|
+
o.top < s.top && e.classList.add("tbw-filter-panel-above");
|
|
1609
1716
|
});
|
|
1610
1717
|
return;
|
|
1611
1718
|
}
|
|
@@ -1616,10 +1723,10 @@ class N extends A {
|
|
|
1616
1723
|
});
|
|
1617
1724
|
}
|
|
1618
1725
|
renderDefaultFilterPanel(e, t, i, n) {
|
|
1619
|
-
const { field: r } = t, o = this.getListItemHeight(),
|
|
1620
|
-
|
|
1726
|
+
const { field: r } = t, o = this.getListItemHeight(), s = document.createElement("div");
|
|
1727
|
+
s.className = "tbw-filter-search";
|
|
1621
1728
|
const l = document.createElement("input");
|
|
1622
|
-
l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "",
|
|
1729
|
+
l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "", s.appendChild(l), e.appendChild(s);
|
|
1623
1730
|
const d = document.createElement("div");
|
|
1624
1731
|
d.className = "tbw-filter-actions";
|
|
1625
1732
|
const c = document.createElement("label");
|
|
@@ -1661,13 +1768,13 @@ class N extends A {
|
|
|
1661
1768
|
return H.textContent = T, y.appendChild(L), y.appendChild(H), y;
|
|
1662
1769
|
}, _ = () => {
|
|
1663
1770
|
const x = v.length, S = f.clientHeight, T = f.scrollTop;
|
|
1664
|
-
if (p.style.height = `${x * o}px`,
|
|
1771
|
+
if (p.style.height = `${x * o}px`, Gt(x, N.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1665
1772
|
w.innerHTML = "", w.style.transform = "translateY(0px)", v.forEach((y, L) => {
|
|
1666
1773
|
w.appendChild(C(y, L));
|
|
1667
1774
|
});
|
|
1668
1775
|
return;
|
|
1669
1776
|
}
|
|
1670
|
-
const m =
|
|
1777
|
+
const m = Ot({
|
|
1671
1778
|
totalRows: x,
|
|
1672
1779
|
viewportHeight: S,
|
|
1673
1780
|
scrollTop: T,
|
|
@@ -1703,10 +1810,10 @@ class N extends A {
|
|
|
1703
1810
|
this.searchText.set(r, l.value), E(l.value);
|
|
1704
1811
|
}, this.config.debounceMs ?? 150);
|
|
1705
1812
|
});
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
const
|
|
1709
|
-
|
|
1813
|
+
const I = document.createElement("div");
|
|
1814
|
+
I.className = "tbw-filter-buttons";
|
|
1815
|
+
const F = document.createElement("button");
|
|
1816
|
+
F.className = "tbw-filter-apply-btn", F.textContent = "Apply", F.addEventListener("click", () => {
|
|
1710
1817
|
const x = [];
|
|
1711
1818
|
for (const [S, T] of b)
|
|
1712
1819
|
if (!T)
|
|
@@ -1717,21 +1824,21 @@ class N extends A {
|
|
|
1717
1824
|
x.push(m !== void 0 ? m : S);
|
|
1718
1825
|
}
|
|
1719
1826
|
t.applySetFilter(x);
|
|
1720
|
-
}),
|
|
1827
|
+
}), I.appendChild(F);
|
|
1721
1828
|
const R = document.createElement("button");
|
|
1722
1829
|
R.className = "tbw-filter-clear-btn", R.textContent = "Clear Filter", R.addEventListener("click", () => {
|
|
1723
1830
|
t.clearFilter();
|
|
1724
|
-
}),
|
|
1831
|
+
}), I.appendChild(R), e.appendChild(I);
|
|
1725
1832
|
}
|
|
1726
1833
|
renderNumberFilterPanel(e, t, i) {
|
|
1727
|
-
const { field: n, column: r } = t, o = r.filterParams,
|
|
1834
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (k, K) => {
|
|
1728
1835
|
if (typeof k == "number") return k;
|
|
1729
1836
|
if (typeof k == "string") {
|
|
1730
1837
|
const W = parseFloat(k);
|
|
1731
1838
|
return isNaN(W) ? K : W;
|
|
1732
1839
|
}
|
|
1733
1840
|
return K;
|
|
1734
|
-
}, d = i.filter((k) => typeof k == "number" && !isNaN(k)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ??
|
|
1841
|
+
}, d = i.filter((k) => typeof k == "number" && !isNaN(k)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), g = l(o?.max ?? s?.max, u), f = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
|
|
1735
1842
|
let w = h, b = g;
|
|
1736
1843
|
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, g));
|
|
1737
1844
|
const v = document.createElement("div");
|
|
@@ -1744,12 +1851,12 @@ class N extends A {
|
|
|
1744
1851
|
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(g), E.step = String(f), E.value = String(w), C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1745
1852
|
const P = document.createElement("span");
|
|
1746
1853
|
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1854
|
+
const I = document.createElement("div");
|
|
1855
|
+
I.className = "tbw-filter-range-group";
|
|
1856
|
+
const F = document.createElement("label");
|
|
1857
|
+
F.textContent = "Max", F.className = "tbw-filter-range-label";
|
|
1751
1858
|
const R = document.createElement("input");
|
|
1752
|
-
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(b),
|
|
1859
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(b), I.appendChild(F), I.appendChild(R), v.appendChild(I), e.appendChild(v);
|
|
1753
1860
|
const x = document.createElement("div");
|
|
1754
1861
|
x.className = "tbw-filter-range-slider";
|
|
1755
1862
|
const S = document.createElement("div");
|
|
@@ -1790,7 +1897,7 @@ class N extends A {
|
|
|
1790
1897
|
}), H.appendChild(X), e.appendChild(H);
|
|
1791
1898
|
}
|
|
1792
1899
|
renderDateFilterPanel(e, t, i) {
|
|
1793
|
-
const { field: n, column: r } = t, o = r.filterParams,
|
|
1900
|
+
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)) : "" : "", g = h(o?.min) || h(s?.min) || u(d), f = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
1794
1901
|
let w = "", b = "";
|
|
1795
1902
|
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) || "");
|
|
1796
1903
|
const v = document.createElement("div");
|
|
@@ -1803,12 +1910,12 @@ class N extends A {
|
|
|
1803
1910
|
E.type = "date", E.className = "tbw-filter-date-input", g && (E.min = g), f && (E.max = f), E.value = w, C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1804
1911
|
const P = document.createElement("span");
|
|
1805
1912
|
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1913
|
+
const I = document.createElement("div");
|
|
1914
|
+
I.className = "tbw-filter-date-group";
|
|
1915
|
+
const F = document.createElement("label");
|
|
1916
|
+
F.textContent = "To", F.className = "tbw-filter-range-label";
|
|
1810
1917
|
const R = document.createElement("input");
|
|
1811
|
-
R.type = "date", R.className = "tbw-filter-date-input", g && (R.min = g), f && (R.max = f), R.value = b,
|
|
1918
|
+
R.type = "date", R.className = "tbw-filter-date-input", g && (R.min = g), f && (R.max = f), R.value = b, I.appendChild(F), I.appendChild(R), v.appendChild(I), e.appendChild(v);
|
|
1812
1919
|
const x = document.createElement("div");
|
|
1813
1920
|
x.className = "tbw-filter-buttons";
|
|
1814
1921
|
const S = document.createElement("button");
|
|
@@ -1885,28 +1992,28 @@ class N extends A {
|
|
|
1885
1992
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1886
1993
|
}
|
|
1887
1994
|
}
|
|
1888
|
-
function
|
|
1889
|
-
if (!
|
|
1890
|
-
const e = /* @__PURE__ */ new Map(), t = [], i = (o,
|
|
1891
|
-
if (!
|
|
1995
|
+
function Fe(a) {
|
|
1996
|
+
if (!a.length) return [];
|
|
1997
|
+
const e = /* @__PURE__ */ new Map(), t = [], i = (o, s) => {
|
|
1998
|
+
if (!s.length) return;
|
|
1892
1999
|
const l = t[t.length - 1];
|
|
1893
2000
|
if (l && l.implicit && l.firstIndex + l.columns.length === o) {
|
|
1894
|
-
l.columns.push(...
|
|
2001
|
+
l.columns.push(...s);
|
|
1895
2002
|
return;
|
|
1896
2003
|
}
|
|
1897
2004
|
t.push({
|
|
1898
2005
|
id: "__implicit__" + o,
|
|
1899
2006
|
label: void 0,
|
|
1900
|
-
columns:
|
|
2007
|
+
columns: s,
|
|
1901
2008
|
firstIndex: o,
|
|
1902
2009
|
implicit: !0
|
|
1903
2010
|
});
|
|
1904
2011
|
};
|
|
1905
2012
|
let n = [], r = 0;
|
|
1906
|
-
return
|
|
2013
|
+
return a.forEach((o, s) => {
|
|
1907
2014
|
const l = o.group;
|
|
1908
2015
|
if (!l) {
|
|
1909
|
-
n.length === 0 && (r =
|
|
2016
|
+
n.length === 0 && (r = s), n.push(o);
|
|
1910
2017
|
return;
|
|
1911
2018
|
}
|
|
1912
2019
|
n.length && (i(r, n.slice()), n = []);
|
|
@@ -1916,43 +2023,43 @@ function Ie(s) {
|
|
|
1916
2023
|
id: d,
|
|
1917
2024
|
label: typeof l == "string" ? void 0 : l.label,
|
|
1918
2025
|
columns: [],
|
|
1919
|
-
firstIndex:
|
|
2026
|
+
firstIndex: s
|
|
1920
2027
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1921
|
-
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length ===
|
|
2028
|
+
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === a.length ? [] : t;
|
|
1922
2029
|
}
|
|
1923
|
-
function
|
|
1924
|
-
if (!e.length || !
|
|
2030
|
+
function Ut(a, e, t) {
|
|
2031
|
+
if (!e.length || !a) return;
|
|
1925
2032
|
const i = /* @__PURE__ */ new Map();
|
|
1926
2033
|
for (const r of e)
|
|
1927
2034
|
for (const o of r.columns)
|
|
1928
2035
|
o.field && i.set(o.field, r.id);
|
|
1929
|
-
const n = Array.from(
|
|
2036
|
+
const n = Array.from(a.querySelectorAll(".cell[data-field]"));
|
|
1930
2037
|
n.forEach((r) => {
|
|
1931
|
-
const o = r.getAttribute("data-field") || "",
|
|
1932
|
-
|
|
2038
|
+
const o = r.getAttribute("data-field") || "", s = i.get(o);
|
|
2039
|
+
s && (r.classList.add("grouped"), r.getAttribute("data-group") || r.setAttribute("data-group", s));
|
|
1933
2040
|
});
|
|
1934
2041
|
for (const r of e) {
|
|
1935
|
-
const o = r.columns[r.columns.length - 1],
|
|
1936
|
-
|
|
2042
|
+
const o = r.columns[r.columns.length - 1], s = n.find((l) => l.getAttribute("data-field") === o.field);
|
|
2043
|
+
s && s.classList.add("group-end");
|
|
1937
2044
|
}
|
|
1938
2045
|
}
|
|
1939
|
-
function
|
|
1940
|
-
if (
|
|
2046
|
+
function Yt(a, e) {
|
|
2047
|
+
if (a.length === 0) return null;
|
|
1941
2048
|
const t = document.createElement("div");
|
|
1942
2049
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
1943
|
-
for (const i of
|
|
2050
|
+
for (const i of a) {
|
|
1944
2051
|
const n = i.columns[0], r = n ? e.findIndex((d) => d.field === n.field) : -1;
|
|
1945
2052
|
if (r === -1) continue;
|
|
1946
|
-
const o = String(i.id).startsWith("__implicit__"),
|
|
1947
|
-
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 =
|
|
2053
|
+
const o = String(i.id).startsWith("__implicit__"), s = o ? "" : i.label || i.id, l = document.createElement("div");
|
|
2054
|
+
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);
|
|
1948
2055
|
}
|
|
1949
2056
|
return t;
|
|
1950
2057
|
}
|
|
1951
|
-
function
|
|
1952
|
-
return
|
|
2058
|
+
function Xt(a) {
|
|
2059
|
+
return a.some((e) => e.group != null);
|
|
1953
2060
|
}
|
|
1954
|
-
const
|
|
1955
|
-
class
|
|
2061
|
+
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)}}";
|
|
2062
|
+
class vn extends A {
|
|
1956
2063
|
static manifest = {
|
|
1957
2064
|
ownedProperties: [
|
|
1958
2065
|
{
|
|
@@ -1969,7 +2076,7 @@ class yn extends A {
|
|
|
1969
2076
|
]
|
|
1970
2077
|
};
|
|
1971
2078
|
name = "groupingColumns";
|
|
1972
|
-
styles =
|
|
2079
|
+
styles = Zt;
|
|
1973
2080
|
get defaultConfig() {
|
|
1974
2081
|
return {
|
|
1975
2082
|
showGroupBorders: !0
|
|
@@ -1984,7 +2091,7 @@ class yn extends A {
|
|
|
1984
2091
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1985
2092
|
return !0;
|
|
1986
2093
|
const i = t?.columns;
|
|
1987
|
-
return Array.isArray(i) ?
|
|
2094
|
+
return Array.isArray(i) ? Xt(i) : !1;
|
|
1988
2095
|
}
|
|
1989
2096
|
processColumns(e) {
|
|
1990
2097
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -1992,15 +2099,15 @@ class yn extends A {
|
|
|
1992
2099
|
if (t && Array.isArray(t) && t.length > 0) {
|
|
1993
2100
|
const r = /* @__PURE__ */ new Map();
|
|
1994
2101
|
for (const o of t)
|
|
1995
|
-
for (const
|
|
1996
|
-
r.set(
|
|
2102
|
+
for (const s of o.children)
|
|
2103
|
+
r.set(s, { id: o.id, label: o.header });
|
|
1997
2104
|
i = e.map((o) => {
|
|
1998
|
-
const
|
|
1999
|
-
return
|
|
2105
|
+
const s = r.get(o.field);
|
|
2106
|
+
return s && !o.group ? { ...o, group: s } : o;
|
|
2000
2107
|
});
|
|
2001
2108
|
} else
|
|
2002
2109
|
i = [...e];
|
|
2003
|
-
const n =
|
|
2110
|
+
const n = Fe(i);
|
|
2004
2111
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
2005
2112
|
}
|
|
2006
2113
|
afterRender() {
|
|
@@ -2013,16 +2120,16 @@ class yn extends A {
|
|
|
2013
2120
|
if (!e) return;
|
|
2014
2121
|
const t = e.querySelector(".header-group-row");
|
|
2015
2122
|
t && t.remove();
|
|
2016
|
-
const i = this.columns, n =
|
|
2123
|
+
const i = this.columns, n = Fe(i);
|
|
2017
2124
|
if (n.length === 0) return;
|
|
2018
|
-
const r =
|
|
2125
|
+
const r = Yt(n, i);
|
|
2019
2126
|
if (r) {
|
|
2020
2127
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2128
|
+
const s = e.querySelector(".header-row");
|
|
2129
|
+
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2023
2130
|
}
|
|
2024
2131
|
const o = e.querySelector(".header-row");
|
|
2025
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
2132
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n)), this.#e(n);
|
|
2026
2133
|
}
|
|
2027
2134
|
#e(e) {
|
|
2028
2135
|
if (!this.config.showGroupBorders) return;
|
|
@@ -2053,12 +2160,12 @@ class yn extends A {
|
|
|
2053
2160
|
this.requestRender();
|
|
2054
2161
|
}
|
|
2055
2162
|
}
|
|
2056
|
-
function Pe({ rows:
|
|
2163
|
+
function Pe({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
2057
2164
|
const n = e.groupOn;
|
|
2058
2165
|
if (typeof n != "function")
|
|
2059
2166
|
return [];
|
|
2060
2167
|
const r = { key: "__root__", value: null, depth: -1, rows: [], children: /* @__PURE__ */ new Map() };
|
|
2061
|
-
if (
|
|
2168
|
+
if (a.forEach((d) => {
|
|
2062
2169
|
let c = n(d);
|
|
2063
2170
|
c == null || c === !1 ? c = ["__ungrouped__"] : Array.isArray(c) || (c = [c]);
|
|
2064
2171
|
let u = r;
|
|
@@ -2067,57 +2174,57 @@ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2067
2174
|
let w = u.children.get(f);
|
|
2068
2175
|
w || (w = { key: p, value: h, depth: g, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(f, w)), u = w;
|
|
2069
2176
|
}), u.rows.push(d);
|
|
2070
|
-
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length ===
|
|
2177
|
+
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === a.length)
|
|
2071
2178
|
return [];
|
|
2072
|
-
const o = /* @__PURE__ */ new Set([...t, ...i ?? []]),
|
|
2179
|
+
const o = /* @__PURE__ */ new Set([...t, ...i ?? []]), s = [], l = (d) => {
|
|
2073
2180
|
if (d === r) {
|
|
2074
2181
|
d.children.forEach((u) => l(u));
|
|
2075
2182
|
return;
|
|
2076
2183
|
}
|
|
2077
2184
|
const c = o.has(d.key);
|
|
2078
|
-
|
|
2185
|
+
s.push({
|
|
2079
2186
|
kind: "group",
|
|
2080
2187
|
key: d.key,
|
|
2081
2188
|
value: d.value,
|
|
2082
2189
|
depth: d.depth,
|
|
2083
2190
|
rows: d.rows,
|
|
2084
2191
|
expanded: c
|
|
2085
|
-
}), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) =>
|
|
2192
|
+
}), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) => s.push({ kind: "data", row: u, rowIndex: a.indexOf(u) })));
|
|
2086
2193
|
};
|
|
2087
|
-
return l(r),
|
|
2194
|
+
return l(r), s;
|
|
2088
2195
|
}
|
|
2089
|
-
function
|
|
2090
|
-
const t = new Set(
|
|
2196
|
+
function Qt(a, e) {
|
|
2197
|
+
const t = new Set(a);
|
|
2091
2198
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2092
2199
|
}
|
|
2093
|
-
function
|
|
2200
|
+
function Jt(a) {
|
|
2094
2201
|
const e = /* @__PURE__ */ new Set();
|
|
2095
|
-
for (const t of
|
|
2202
|
+
for (const t of a)
|
|
2096
2203
|
t.kind === "group" && e.add(t.key);
|
|
2097
2204
|
return e;
|
|
2098
2205
|
}
|
|
2099
|
-
function
|
|
2206
|
+
function ei() {
|
|
2100
2207
|
return /* @__PURE__ */ new Set();
|
|
2101
2208
|
}
|
|
2102
|
-
function
|
|
2103
|
-
if (
|
|
2209
|
+
function ti(a, e) {
|
|
2210
|
+
if (a === !0)
|
|
2104
2211
|
return new Set(e);
|
|
2105
|
-
if (
|
|
2212
|
+
if (a === !1 || a == null)
|
|
2106
2213
|
return /* @__PURE__ */ new Set();
|
|
2107
|
-
if (typeof
|
|
2108
|
-
const t = e[
|
|
2214
|
+
if (typeof a == "number") {
|
|
2215
|
+
const t = e[a];
|
|
2109
2216
|
return t ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set();
|
|
2110
2217
|
}
|
|
2111
|
-
return typeof
|
|
2218
|
+
return typeof a == "string" ? /* @__PURE__ */ new Set([a]) : Array.isArray(a) ? new Set(a) : /* @__PURE__ */ new Set();
|
|
2112
2219
|
}
|
|
2113
|
-
function
|
|
2114
|
-
return
|
|
2220
|
+
function ii(a) {
|
|
2221
|
+
return a.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2115
2222
|
}
|
|
2116
|
-
function
|
|
2117
|
-
return
|
|
2223
|
+
function ni(a) {
|
|
2224
|
+
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2118
2225
|
}
|
|
2119
|
-
const
|
|
2120
|
-
class
|
|
2226
|
+
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}}}";
|
|
2227
|
+
class yn extends A {
|
|
2121
2228
|
static manifest = {
|
|
2122
2229
|
events: [
|
|
2123
2230
|
{
|
|
@@ -2144,7 +2251,7 @@ class xn extends A {
|
|
|
2144
2251
|
]
|
|
2145
2252
|
};
|
|
2146
2253
|
name = "groupingRows";
|
|
2147
|
-
styles =
|
|
2254
|
+
styles = ri;
|
|
2148
2255
|
get defaultConfig() {
|
|
2149
2256
|
return {
|
|
2150
2257
|
defaultExpanded: !1,
|
|
@@ -2187,8 +2294,8 @@ class xn extends A {
|
|
|
2187
2294
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2188
2295
|
let n;
|
|
2189
2296
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2190
|
-
const
|
|
2191
|
-
n =
|
|
2297
|
+
const s = ii(i);
|
|
2298
|
+
n = ti(t.defaultExpanded ?? !1, s), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2192
2299
|
}
|
|
2193
2300
|
const r = Pe({
|
|
2194
2301
|
rows: [...e],
|
|
@@ -2198,20 +2305,20 @@ class xn extends A {
|
|
|
2198
2305
|
});
|
|
2199
2306
|
this.isActive = !0, this.flattenedRows = r, this.keysToAnimate.clear();
|
|
2200
2307
|
const o = /* @__PURE__ */ new Set();
|
|
2201
|
-
return r.forEach((
|
|
2202
|
-
if (
|
|
2308
|
+
return r.forEach((s, l) => {
|
|
2309
|
+
if (s.kind === "data") {
|
|
2203
2310
|
const d = `data-${l}`;
|
|
2204
2311
|
o.add(d), this.previousVisibleKeys.has(d) || this.keysToAnimate.add(d);
|
|
2205
2312
|
}
|
|
2206
|
-
}), this.previousVisibleKeys = o, r.map((
|
|
2313
|
+
}), this.previousVisibleKeys = o, r.map((s) => s.kind === "group" ? {
|
|
2207
2314
|
__isGroupRow: !0,
|
|
2208
|
-
__groupKey:
|
|
2209
|
-
__groupValue:
|
|
2210
|
-
__groupDepth:
|
|
2211
|
-
__groupRows:
|
|
2212
|
-
__groupExpanded:
|
|
2213
|
-
__groupRowCount:
|
|
2214
|
-
} :
|
|
2315
|
+
__groupKey: s.key,
|
|
2316
|
+
__groupValue: s.value,
|
|
2317
|
+
__groupDepth: s.depth,
|
|
2318
|
+
__groupRows: s.rows,
|
|
2319
|
+
__groupExpanded: s.expanded,
|
|
2320
|
+
__groupRowCount: ni(s)
|
|
2321
|
+
} : s.row);
|
|
2215
2322
|
}
|
|
2216
2323
|
onCellClick(e) {
|
|
2217
2324
|
const t = e.row;
|
|
@@ -2229,7 +2336,7 @@ class xn extends A {
|
|
|
2229
2336
|
return !1;
|
|
2230
2337
|
const n = this.config;
|
|
2231
2338
|
if (n.groupRowRenderer) {
|
|
2232
|
-
const
|
|
2339
|
+
const s = () => {
|
|
2233
2340
|
this.toggle(e.__groupKey);
|
|
2234
2341
|
}, l = n.groupRowRenderer({
|
|
2235
2342
|
key: e.__groupKey,
|
|
@@ -2237,7 +2344,7 @@ class xn extends A {
|
|
|
2237
2344
|
depth: e.__groupDepth,
|
|
2238
2345
|
rows: e.__groupRows,
|
|
2239
2346
|
expanded: e.__groupExpanded,
|
|
2240
|
-
toggleExpand:
|
|
2347
|
+
toggleExpand: s
|
|
2241
2348
|
});
|
|
2242
2349
|
if (l)
|
|
2243
2350
|
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;
|
|
@@ -2270,12 +2377,12 @@ class xn extends A {
|
|
|
2270
2377
|
return n.formatLabel ? n.formatLabel(e, t, i) : String(e);
|
|
2271
2378
|
}
|
|
2272
2379
|
renderFullWidthGroupRow(e, t, i) {
|
|
2273
|
-
const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [],
|
|
2274
|
-
|
|
2380
|
+
const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [], s = document.createElement("div");
|
|
2381
|
+
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));
|
|
2275
2382
|
const l = document.createElement("span");
|
|
2276
|
-
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey),
|
|
2383
|
+
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), s.appendChild(l), n.showRowCount !== !1) {
|
|
2277
2384
|
const c = document.createElement("span");
|
|
2278
|
-
c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`,
|
|
2385
|
+
c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, s.appendChild(c);
|
|
2279
2386
|
}
|
|
2280
2387
|
const d = Object.entries(r);
|
|
2281
2388
|
if (d.length > 0) {
|
|
@@ -2290,12 +2397,12 @@ class xn extends A {
|
|
|
2290
2397
|
p.textContent = `${w}: ${f}`, c.appendChild(p);
|
|
2291
2398
|
}
|
|
2292
2399
|
}
|
|
2293
|
-
c.children.length > 0 &&
|
|
2400
|
+
c.children.length > 0 && s.appendChild(c);
|
|
2294
2401
|
}
|
|
2295
|
-
t.appendChild(
|
|
2402
|
+
t.appendChild(s);
|
|
2296
2403
|
}
|
|
2297
2404
|
renderPerColumnGroupRow(e, t, i) {
|
|
2298
|
-
const n = this.config, r = n.aggregators ?? {}, o = this.columns,
|
|
2405
|
+
const n = this.config, r = n.aggregators ?? {}, o = this.columns, s = e.__groupRows ?? [], d = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
|
|
2299
2406
|
d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
|
|
2300
2407
|
let c = !1;
|
|
2301
2408
|
o.forEach((u, h) => {
|
|
@@ -2307,7 +2414,7 @@ class xn extends A {
|
|
|
2307
2414
|
if (c) {
|
|
2308
2415
|
const f = r[u.field];
|
|
2309
2416
|
if (f) {
|
|
2310
|
-
const p = ee(f,
|
|
2417
|
+
const p = ee(f, s, u.field, u);
|
|
2311
2418
|
g.textContent = p != null ? String(p) : "";
|
|
2312
2419
|
} else
|
|
2313
2420
|
g.textContent = "";
|
|
@@ -2315,23 +2422,23 @@ class xn extends A {
|
|
|
2315
2422
|
c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2316
2423
|
const f = document.createElement("span"), p = r[u.field];
|
|
2317
2424
|
if (p) {
|
|
2318
|
-
const w = ee(p,
|
|
2425
|
+
const w = ee(p, s, u.field, u);
|
|
2319
2426
|
f.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2320
2427
|
} else
|
|
2321
2428
|
f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
2322
2429
|
if (g.appendChild(f), n.showRowCount !== !1) {
|
|
2323
2430
|
const w = document.createElement("span");
|
|
2324
|
-
w.className = "group-count", w.textContent = ` (${
|
|
2431
|
+
w.className = "group-count", w.textContent = ` (${s.length})`, g.appendChild(w);
|
|
2325
2432
|
}
|
|
2326
2433
|
}
|
|
2327
2434
|
t.appendChild(g);
|
|
2328
2435
|
});
|
|
2329
2436
|
}
|
|
2330
2437
|
expandAll() {
|
|
2331
|
-
this.expandedKeys =
|
|
2438
|
+
this.expandedKeys = Jt(this.flattenedRows), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2332
2439
|
}
|
|
2333
2440
|
collapseAll() {
|
|
2334
|
-
this.expandedKeys =
|
|
2441
|
+
this.expandedKeys = ei(), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2335
2442
|
}
|
|
2336
2443
|
toggle(e) {
|
|
2337
2444
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2341,12 +2448,12 @@ class xn extends A {
|
|
|
2341
2448
|
if (e.startsWith(o + "||") || o.startsWith(e + "||"))
|
|
2342
2449
|
e.startsWith(o + "||") && r.add(o);
|
|
2343
2450
|
else {
|
|
2344
|
-
const
|
|
2345
|
-
|
|
2451
|
+
const s = this.flattenedRows.find((l) => l.kind === "group" && l.key === o);
|
|
2452
|
+
s && s.depth !== n.depth && r.add(o);
|
|
2346
2453
|
}
|
|
2347
2454
|
r.add(e), this.expandedKeys = r;
|
|
2348
2455
|
} else
|
|
2349
|
-
this.expandedKeys =
|
|
2456
|
+
this.expandedKeys = Qt(this.expandedKeys, e);
|
|
2350
2457
|
this.emit("group-toggle", {
|
|
2351
2458
|
key: e,
|
|
2352
2459
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2396,33 +2503,33 @@ class xn extends A {
|
|
|
2396
2503
|
this.config.groupOn = e, this.requestRender();
|
|
2397
2504
|
}
|
|
2398
2505
|
}
|
|
2399
|
-
function De(
|
|
2400
|
-
const t = new Set(
|
|
2506
|
+
function De(a, e) {
|
|
2507
|
+
const t = new Set(a);
|
|
2401
2508
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2402
2509
|
}
|
|
2403
|
-
function
|
|
2404
|
-
const t = new Set(
|
|
2510
|
+
function oi(a, e) {
|
|
2511
|
+
const t = new Set(a);
|
|
2405
2512
|
return t.add(e), t;
|
|
2406
2513
|
}
|
|
2407
|
-
function
|
|
2408
|
-
const t = new Set(
|
|
2514
|
+
function si(a, e) {
|
|
2515
|
+
const t = new Set(a);
|
|
2409
2516
|
return t.delete(e), t;
|
|
2410
2517
|
}
|
|
2411
|
-
function
|
|
2412
|
-
return
|
|
2518
|
+
function ai(a, e) {
|
|
2519
|
+
return a.has(e);
|
|
2413
2520
|
}
|
|
2414
|
-
function
|
|
2521
|
+
function li(a, e, t, i) {
|
|
2415
2522
|
const n = document.createElement("div");
|
|
2416
2523
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2417
2524
|
const r = document.createElement("div");
|
|
2418
2525
|
r.className = "master-detail-cell", r.setAttribute("role", "cell"), r.style.gridColumn = `1 / ${i + 1}`;
|
|
2419
|
-
const o = t(
|
|
2526
|
+
const o = t(a, e);
|
|
2420
2527
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2421
2528
|
}
|
|
2422
|
-
const
|
|
2529
|
+
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}}}";
|
|
2423
2530
|
class nt extends A {
|
|
2424
2531
|
name = "masterDetail";
|
|
2425
|
-
styles =
|
|
2532
|
+
styles = di;
|
|
2426
2533
|
get defaultConfig() {
|
|
2427
2534
|
return {
|
|
2428
2535
|
detailHeight: "auto",
|
|
@@ -2447,8 +2554,8 @@ class nt extends A {
|
|
|
2447
2554
|
return;
|
|
2448
2555
|
}
|
|
2449
2556
|
}
|
|
2450
|
-
const n = t.getAttribute("animation"), r = t.getAttribute("show-expand-column"), o = t.getAttribute("expand-on-row-click"),
|
|
2451
|
-
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"),
|
|
2557
|
+
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 = {};
|
|
2558
|
+
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));
|
|
2452
2559
|
const c = t.innerHTML.trim();
|
|
2453
2560
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2454
2561
|
const g = Je(c, { value: u, row: u });
|
|
@@ -2499,11 +2606,11 @@ class nt extends A {
|
|
|
2499
2606
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2500
2607
|
return [...e];
|
|
2501
2608
|
const i = [...e];
|
|
2502
|
-
if (
|
|
2609
|
+
if (wt(i))
|
|
2503
2610
|
return i;
|
|
2504
|
-
const r =
|
|
2611
|
+
const r = bt(this.name);
|
|
2505
2612
|
return r.viewRenderer = (o) => {
|
|
2506
|
-
const { row:
|
|
2613
|
+
const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
|
|
2507
2614
|
d.className = "master-detail-expander expander-cell";
|
|
2508
2615
|
const c = document.createElement("span");
|
|
2509
2616
|
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;
|
|
@@ -2538,24 +2645,24 @@ class nt extends A {
|
|
|
2538
2645
|
if (!e) return;
|
|
2539
2646
|
const t = /* @__PURE__ */ new Map(), i = e.querySelectorAll(".data-grid-row"), n = this.columns.length;
|
|
2540
2647
|
for (const o of i) {
|
|
2541
|
-
const
|
|
2648
|
+
const s = o.querySelector(".cell[data-row]"), l = s ? parseInt(s.getAttribute("data-row") ?? "-1", 10) : -1;
|
|
2542
2649
|
l >= 0 && t.set(l, o);
|
|
2543
2650
|
}
|
|
2544
2651
|
const r = e.querySelectorAll(".master-detail-row");
|
|
2545
2652
|
for (const o of r) {
|
|
2546
|
-
const
|
|
2653
|
+
const s = parseInt(o.getAttribute("data-detail-for") ?? "-1", 10), l = s >= 0 ? this.rows[s] : void 0, d = l && this.expandedRows.has(l), c = t.has(s);
|
|
2547
2654
|
(!d || !c) && (o.remove(), l && this.detailElements.delete(l));
|
|
2548
2655
|
}
|
|
2549
|
-
for (const [o,
|
|
2656
|
+
for (const [o, s] of t) {
|
|
2550
2657
|
const l = this.rows[o];
|
|
2551
2658
|
if (!l || !this.expandedRows.has(l)) continue;
|
|
2552
2659
|
const d = this.detailElements.get(l);
|
|
2553
2660
|
if (d) {
|
|
2554
|
-
d.previousElementSibling !==
|
|
2661
|
+
d.previousElementSibling !== s && s.after(d);
|
|
2555
2662
|
continue;
|
|
2556
2663
|
}
|
|
2557
|
-
const c =
|
|
2558
|
-
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`),
|
|
2664
|
+
const c = li(l, o, this.config.detailRenderer, n);
|
|
2665
|
+
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), s.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2559
2666
|
}
|
|
2560
2667
|
}
|
|
2561
2668
|
getExtraHeight() {
|
|
@@ -2575,25 +2682,25 @@ class nt extends A {
|
|
|
2575
2682
|
adjustVirtualStart(e, t, i) {
|
|
2576
2683
|
if (this.expandedRows.size === 0) return e;
|
|
2577
2684
|
const n = [];
|
|
2578
|
-
for (const
|
|
2579
|
-
const l = this.rows.indexOf(
|
|
2580
|
-
l >= 0 && n.push({ index: l, row:
|
|
2685
|
+
for (const s of this.expandedRows) {
|
|
2686
|
+
const l = this.rows.indexOf(s);
|
|
2687
|
+
l >= 0 && n.push({ index: l, row: s });
|
|
2581
2688
|
}
|
|
2582
|
-
n.sort((
|
|
2689
|
+
n.sort((s, l) => s.index - l.index);
|
|
2583
2690
|
let r = e, o = 0;
|
|
2584
|
-
for (const { index:
|
|
2585
|
-
const d =
|
|
2586
|
-
o += c, !(
|
|
2691
|
+
for (const { index: s, row: l } of n) {
|
|
2692
|
+
const d = s * i + o, c = this.getDetailHeight(l), u = d + i + c;
|
|
2693
|
+
o += c, !(s >= e) && u > t && s < r && (r = s);
|
|
2587
2694
|
}
|
|
2588
2695
|
return r;
|
|
2589
2696
|
}
|
|
2590
2697
|
expand(e) {
|
|
2591
2698
|
const t = this.rows[e];
|
|
2592
|
-
t && (this.expandedRows =
|
|
2699
|
+
t && (this.expandedRows = oi(this.expandedRows, t), this.requestRender());
|
|
2593
2700
|
}
|
|
2594
2701
|
collapse(e) {
|
|
2595
2702
|
const t = this.rows[e];
|
|
2596
|
-
t && (this.expandedRows =
|
|
2703
|
+
t && (this.expandedRows = si(this.expandedRows, t), this.requestRender());
|
|
2597
2704
|
}
|
|
2598
2705
|
toggle(e) {
|
|
2599
2706
|
const t = this.rows[e];
|
|
@@ -2601,7 +2708,7 @@ class nt extends A {
|
|
|
2601
2708
|
}
|
|
2602
2709
|
isExpanded(e) {
|
|
2603
2710
|
const t = this.rows[e];
|
|
2604
|
-
return t ?
|
|
2711
|
+
return t ? ai(this.expandedRows, t) : !1;
|
|
2605
2712
|
}
|
|
2606
2713
|
expandAll() {
|
|
2607
2714
|
for (const e of this.rows)
|
|
@@ -2631,34 +2738,34 @@ class nt extends A {
|
|
|
2631
2738
|
}
|
|
2632
2739
|
}
|
|
2633
2740
|
}
|
|
2634
|
-
function
|
|
2635
|
-
return e.length ? [...
|
|
2741
|
+
function ci(a, e, t) {
|
|
2742
|
+
return e.length ? [...a].sort((i, n) => {
|
|
2636
2743
|
for (const r of e) {
|
|
2637
|
-
const
|
|
2744
|
+
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);
|
|
2638
2745
|
if (c !== 0)
|
|
2639
2746
|
return r.direction === "asc" ? c : -c;
|
|
2640
2747
|
}
|
|
2641
2748
|
return 0;
|
|
2642
|
-
}) : [...
|
|
2749
|
+
}) : [...a];
|
|
2643
2750
|
}
|
|
2644
|
-
function
|
|
2645
|
-
return
|
|
2751
|
+
function ui(a, e) {
|
|
2752
|
+
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));
|
|
2646
2753
|
}
|
|
2647
|
-
function
|
|
2648
|
-
const n =
|
|
2649
|
-
return t ? n ? n.direction === "asc" ?
|
|
2754
|
+
function hi(a, e, t, i) {
|
|
2755
|
+
const n = a.find((r) => r.field === e);
|
|
2756
|
+
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" }];
|
|
2650
2757
|
}
|
|
2651
|
-
function Me(
|
|
2652
|
-
const t =
|
|
2758
|
+
function Me(a, e) {
|
|
2759
|
+
const t = a.findIndex((i) => i.field === e);
|
|
2653
2760
|
return t >= 0 ? t + 1 : void 0;
|
|
2654
2761
|
}
|
|
2655
|
-
function Ne(
|
|
2656
|
-
return
|
|
2762
|
+
function Ne(a, e) {
|
|
2763
|
+
return a.find((t) => t.field === e)?.direction;
|
|
2657
2764
|
}
|
|
2658
|
-
const
|
|
2659
|
-
class
|
|
2765
|
+
const gi = '@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}}';
|
|
2766
|
+
class xn extends A {
|
|
2660
2767
|
name = "multiSort";
|
|
2661
|
-
styles =
|
|
2768
|
+
styles = gi;
|
|
2662
2769
|
get defaultConfig() {
|
|
2663
2770
|
return {
|
|
2664
2771
|
maxSortColumns: 3,
|
|
@@ -2670,12 +2777,12 @@ class Cn extends A {
|
|
|
2670
2777
|
this.sortModel = [];
|
|
2671
2778
|
}
|
|
2672
2779
|
processRows(e) {
|
|
2673
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2780
|
+
return this.sortModel.length === 0 ? [...e] : ci([...e], this.sortModel, [...this.columns]);
|
|
2674
2781
|
}
|
|
2675
2782
|
onHeaderClick(e) {
|
|
2676
2783
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2677
2784
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2678
|
-
return this.sortModel =
|
|
2785
|
+
return this.sortModel = hi(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2679
2786
|
}
|
|
2680
2787
|
afterRender() {
|
|
2681
2788
|
const e = this.gridElement;
|
|
@@ -2684,11 +2791,11 @@ class Cn extends A {
|
|
|
2684
2791
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2685
2792
|
const r = n.getAttribute("data-field");
|
|
2686
2793
|
if (!r) return;
|
|
2687
|
-
const o = Me(this.sortModel, r),
|
|
2688
|
-
if (n.querySelector(".sort-index")?.remove(),
|
|
2689
|
-
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort",
|
|
2794
|
+
const o = Me(this.sortModel, r), s = Ne(this.sortModel, r);
|
|
2795
|
+
if (n.querySelector(".sort-index")?.remove(), s) {
|
|
2796
|
+
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
|
|
2690
2797
|
const c = document.createElement("span");
|
|
2691
|
-
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(
|
|
2798
|
+
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(s === "asc" ? "sortAsc" : "sortDesc"));
|
|
2692
2799
|
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), g = u ?? h;
|
|
2693
2800
|
if (g ? n.insertBefore(c, g) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
|
|
2694
2801
|
const f = document.createElement("span");
|
|
@@ -2734,59 +2841,59 @@ class Cn extends A {
|
|
|
2734
2841
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2735
2842
|
}
|
|
2736
2843
|
}
|
|
2737
|
-
function rt(
|
|
2738
|
-
return
|
|
2844
|
+
function rt(a, e) {
|
|
2845
|
+
return gt(a, e);
|
|
2739
2846
|
}
|
|
2740
|
-
function ot(
|
|
2741
|
-
const t =
|
|
2847
|
+
function ot(a, e) {
|
|
2848
|
+
const t = a.sticky;
|
|
2742
2849
|
return t ? rt(t, e) === "left" : !1;
|
|
2743
2850
|
}
|
|
2744
|
-
function st(
|
|
2745
|
-
const t =
|
|
2851
|
+
function st(a, e) {
|
|
2852
|
+
const t = a.sticky;
|
|
2746
2853
|
return t ? rt(t, e) === "right" : !1;
|
|
2747
2854
|
}
|
|
2748
|
-
function
|
|
2749
|
-
return
|
|
2855
|
+
function fi(a, e = "ltr") {
|
|
2856
|
+
return a.filter((t) => ot(t, e));
|
|
2750
2857
|
}
|
|
2751
|
-
function
|
|
2752
|
-
return
|
|
2858
|
+
function pi(a, e = "ltr") {
|
|
2859
|
+
return a.filter((t) => st(t, e));
|
|
2753
2860
|
}
|
|
2754
|
-
function se(
|
|
2755
|
-
return
|
|
2861
|
+
function se(a) {
|
|
2862
|
+
return a.some(
|
|
2756
2863
|
(e) => e.sticky === "left" || e.sticky === "right" || e.sticky === "start" || e.sticky === "end"
|
|
2757
2864
|
);
|
|
2758
2865
|
}
|
|
2759
|
-
function qe(
|
|
2760
|
-
const t = Array.from(
|
|
2866
|
+
function qe(a, e) {
|
|
2867
|
+
const t = Array.from(a.querySelectorAll(".header-row .cell"));
|
|
2761
2868
|
if (!t.length) return;
|
|
2762
|
-
const i = ue(
|
|
2763
|
-
e.forEach((
|
|
2764
|
-
|
|
2869
|
+
const i = ue(a), n = /* @__PURE__ */ new Map();
|
|
2870
|
+
e.forEach((s, l) => {
|
|
2871
|
+
s.field && n.set(s.field, l);
|
|
2765
2872
|
});
|
|
2766
2873
|
let r = 0;
|
|
2767
|
-
for (const
|
|
2768
|
-
if (ot(
|
|
2769
|
-
const l = n.get(
|
|
2770
|
-
d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 &&
|
|
2874
|
+
for (const s of e)
|
|
2875
|
+
if (ot(s, i)) {
|
|
2876
|
+
const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
|
|
2877
|
+
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) => {
|
|
2771
2878
|
c.classList.add("sticky-left"), c.style.position = "sticky", c.style.left = r + "px";
|
|
2772
2879
|
}), r += d.offsetWidth);
|
|
2773
2880
|
}
|
|
2774
2881
|
let o = 0;
|
|
2775
|
-
for (const
|
|
2776
|
-
if (st(
|
|
2777
|
-
const l = n.get(
|
|
2778
|
-
d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 &&
|
|
2882
|
+
for (const s of [...e].reverse())
|
|
2883
|
+
if (st(s, i)) {
|
|
2884
|
+
const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
|
|
2885
|
+
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) => {
|
|
2779
2886
|
c.classList.add("sticky-right"), c.style.position = "sticky", c.style.right = o + "px";
|
|
2780
2887
|
}), o += d.offsetWidth);
|
|
2781
2888
|
}
|
|
2782
2889
|
}
|
|
2783
|
-
function He(
|
|
2784
|
-
|
|
2890
|
+
function He(a) {
|
|
2891
|
+
a.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2785
2892
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2786
2893
|
});
|
|
2787
2894
|
}
|
|
2788
2895
|
const Ke = "canMoveColumn";
|
|
2789
|
-
class
|
|
2896
|
+
class Cn extends A {
|
|
2790
2897
|
static manifest = {
|
|
2791
2898
|
ownedProperties: [
|
|
2792
2899
|
{
|
|
@@ -2860,11 +2967,11 @@ class En extends A {
|
|
|
2860
2967
|
}
|
|
2861
2968
|
getLeftPinnedColumns() {
|
|
2862
2969
|
const e = [...this.columns], t = ue(this.grid);
|
|
2863
|
-
return
|
|
2970
|
+
return fi(e, t);
|
|
2864
2971
|
}
|
|
2865
2972
|
getRightPinnedColumns() {
|
|
2866
2973
|
const e = [...this.columns], t = ue(this.grid);
|
|
2867
|
-
return
|
|
2974
|
+
return pi(e, t);
|
|
2868
2975
|
}
|
|
2869
2976
|
clearStickyPositions() {
|
|
2870
2977
|
He(this.grid);
|
|
@@ -2874,10 +2981,10 @@ class En extends A {
|
|
|
2874
2981
|
return;
|
|
2875
2982
|
let i = 0, n = 0;
|
|
2876
2983
|
if (e) {
|
|
2877
|
-
const o = e.querySelectorAll(".sticky-left"),
|
|
2984
|
+
const o = e.querySelectorAll(".sticky-left"), s = e.querySelectorAll(".sticky-right");
|
|
2878
2985
|
o.forEach((l) => {
|
|
2879
2986
|
i += l.offsetWidth;
|
|
2880
|
-
}),
|
|
2987
|
+
}), s.forEach((l) => {
|
|
2881
2988
|
n += l.offsetWidth;
|
|
2882
2989
|
});
|
|
2883
2990
|
} else
|
|
@@ -2888,10 +2995,10 @@ class En extends A {
|
|
|
2888
2995
|
return { left: i, right: n, skipScroll: r };
|
|
2889
2996
|
}
|
|
2890
2997
|
}
|
|
2891
|
-
function
|
|
2892
|
-
return typeof
|
|
2998
|
+
function mi(a) {
|
|
2999
|
+
return typeof a == "object" && a !== null && "aggFunc" in a;
|
|
2893
3000
|
}
|
|
2894
|
-
function ae(
|
|
3001
|
+
function ae(a, e) {
|
|
2895
3002
|
const t = document.createElement("div");
|
|
2896
3003
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
2897
3004
|
const i = document.createElement("div");
|
|
@@ -2899,41 +3006,41 @@ function ae(s, e) {
|
|
|
2899
3006
|
const n = document.createElement("div");
|
|
2900
3007
|
n.className = "tbw-pinned-rows-center";
|
|
2901
3008
|
const r = document.createElement("div");
|
|
2902
|
-
if (r.className = "tbw-pinned-rows-right",
|
|
3009
|
+
if (r.className = "tbw-pinned-rows-right", a.showRowCount !== !1) {
|
|
2903
3010
|
const o = document.createElement("span");
|
|
2904
3011
|
o.className = "tbw-status-panel tbw-status-panel-row-count", o.textContent = `Total: ${e.totalRows} rows`, i.appendChild(o);
|
|
2905
3012
|
}
|
|
2906
|
-
if (
|
|
3013
|
+
if (a.showFilteredCount && e.filteredRows !== e.totalRows) {
|
|
2907
3014
|
const o = document.createElement("span");
|
|
2908
3015
|
o.className = "tbw-status-panel tbw-status-panel-filtered-count", o.textContent = `Filtered: ${e.filteredRows}`, i.appendChild(o);
|
|
2909
3016
|
}
|
|
2910
|
-
if (
|
|
3017
|
+
if (a.showSelectedCount && e.selectedRows > 0) {
|
|
2911
3018
|
const o = document.createElement("span");
|
|
2912
3019
|
o.className = "tbw-status-panel tbw-status-panel-selected-count", o.textContent = `Selected: ${e.selectedRows}`, r.appendChild(o);
|
|
2913
3020
|
}
|
|
2914
|
-
if (
|
|
2915
|
-
for (const o of
|
|
2916
|
-
const
|
|
3021
|
+
if (a.customPanels)
|
|
3022
|
+
for (const o of a.customPanels) {
|
|
3023
|
+
const s = wi(o, e);
|
|
2917
3024
|
switch (o.position) {
|
|
2918
3025
|
case "left":
|
|
2919
|
-
i.appendChild(
|
|
3026
|
+
i.appendChild(s);
|
|
2920
3027
|
break;
|
|
2921
3028
|
case "center":
|
|
2922
|
-
n.appendChild(
|
|
3029
|
+
n.appendChild(s);
|
|
2923
3030
|
break;
|
|
2924
3031
|
case "right":
|
|
2925
|
-
r.appendChild(
|
|
3032
|
+
r.appendChild(s);
|
|
2926
3033
|
break;
|
|
2927
3034
|
}
|
|
2928
3035
|
}
|
|
2929
3036
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2930
3037
|
}
|
|
2931
|
-
function ze(
|
|
3038
|
+
function ze(a) {
|
|
2932
3039
|
const e = document.createElement("div");
|
|
2933
|
-
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${
|
|
3040
|
+
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${a}`, e.setAttribute("role", "presentation"), e;
|
|
2934
3041
|
}
|
|
2935
|
-
function Oe(
|
|
2936
|
-
|
|
3042
|
+
function Oe(a, e, t, i) {
|
|
3043
|
+
a.innerHTML = "";
|
|
2937
3044
|
for (const n of e) {
|
|
2938
3045
|
const r = document.createElement("div");
|
|
2939
3046
|
if (r.className = "tbw-aggregation-row", r.setAttribute("role", "presentation"), n.id && r.setAttribute("data-aggregation-id", n.id), n.fullWidth) {
|
|
@@ -2941,12 +3048,12 @@ function Oe(s, e, t, i) {
|
|
|
2941
3048
|
o.className = "tbw-aggregation-cell tbw-aggregation-cell-full", o.style.gridColumn = "1 / -1", o.textContent = n.label || "", r.appendChild(o);
|
|
2942
3049
|
} else
|
|
2943
3050
|
for (const o of t) {
|
|
2944
|
-
const
|
|
2945
|
-
|
|
3051
|
+
const s = document.createElement("div");
|
|
3052
|
+
s.className = "tbw-aggregation-cell", s.setAttribute("data-field", o.field);
|
|
2946
3053
|
let l, d;
|
|
2947
3054
|
const c = n.aggregators?.[o.field];
|
|
2948
3055
|
if (c)
|
|
2949
|
-
if (
|
|
3056
|
+
if (mi(c)) {
|
|
2950
3057
|
const u = ye(c.aggFunc);
|
|
2951
3058
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2952
3059
|
} else {
|
|
@@ -2957,31 +3064,31 @@ function Oe(s, e, t, i) {
|
|
|
2957
3064
|
const u = n.cells[o.field];
|
|
2958
3065
|
typeof u == "function" ? l = u(i, o.field, o) : l = u;
|
|
2959
3066
|
}
|
|
2960
|
-
l != null ?
|
|
3067
|
+
l != null ? s.textContent = d ? d(l, o.field, o) : String(l) : s.textContent = "", r.appendChild(s);
|
|
2961
3068
|
}
|
|
2962
|
-
|
|
3069
|
+
a.appendChild(r);
|
|
2963
3070
|
}
|
|
2964
3071
|
}
|
|
2965
|
-
function
|
|
3072
|
+
function wi(a, e) {
|
|
2966
3073
|
const t = document.createElement("div");
|
|
2967
|
-
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${
|
|
2968
|
-
const i =
|
|
3074
|
+
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
|
|
3075
|
+
const i = a.render(e);
|
|
2969
3076
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2970
3077
|
}
|
|
2971
|
-
function Ge(
|
|
3078
|
+
function Ge(a, e, t, i, n) {
|
|
2972
3079
|
return {
|
|
2973
|
-
totalRows:
|
|
2974
|
-
filteredRows: n?.cachedResult?.length ??
|
|
3080
|
+
totalRows: a.length,
|
|
3081
|
+
filteredRows: n?.cachedResult?.length ?? a.length,
|
|
2975
3082
|
selectedRows: i?.selected?.size ?? 0,
|
|
2976
3083
|
columns: e,
|
|
2977
|
-
rows:
|
|
3084
|
+
rows: a,
|
|
2978
3085
|
grid: t
|
|
2979
3086
|
};
|
|
2980
3087
|
}
|
|
2981
|
-
const
|
|
2982
|
-
class
|
|
3088
|
+
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}}";
|
|
3089
|
+
class En extends A {
|
|
2983
3090
|
name = "pinnedRows";
|
|
2984
|
-
styles =
|
|
3091
|
+
styles = bi;
|
|
2985
3092
|
get defaultConfig() {
|
|
2986
3093
|
return {
|
|
2987
3094
|
position: "bottom",
|
|
@@ -3004,13 +3111,13 @@ class Rn extends A {
|
|
|
3004
3111
|
if (!t) return;
|
|
3005
3112
|
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);
|
|
3006
3113
|
const i = this.getSelectionState(), n = this.getFilterState(), r = Ge(
|
|
3007
|
-
this.
|
|
3114
|
+
this.sourceRows,
|
|
3008
3115
|
this.columns,
|
|
3009
3116
|
this.grid,
|
|
3010
3117
|
i,
|
|
3011
3118
|
n
|
|
3012
|
-
), o = this.config.aggregationRows || [],
|
|
3013
|
-
if (
|
|
3119
|
+
), o = this.config.aggregationRows || [], s = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
3120
|
+
if (s.length > 0) {
|
|
3014
3121
|
if (!this.topAggregationContainer) {
|
|
3015
3122
|
this.topAggregationContainer = ze("top");
|
|
3016
3123
|
const h = e.querySelector(".header");
|
|
@@ -3018,9 +3125,9 @@ class Rn extends A {
|
|
|
3018
3125
|
}
|
|
3019
3126
|
Oe(
|
|
3020
3127
|
this.topAggregationContainer,
|
|
3021
|
-
|
|
3128
|
+
s,
|
|
3022
3129
|
this.visibleColumns,
|
|
3023
|
-
this.
|
|
3130
|
+
this.sourceRows
|
|
3024
3131
|
);
|
|
3025
3132
|
} else this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null);
|
|
3026
3133
|
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;
|
|
@@ -3036,7 +3143,7 @@ class Rn extends A {
|
|
|
3036
3143
|
this.bottomAggregationContainer,
|
|
3037
3144
|
l,
|
|
3038
3145
|
this.visibleColumns,
|
|
3039
|
-
this.
|
|
3146
|
+
this.sourceRows
|
|
3040
3147
|
)), c && (this.infoBarElement = ae(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
3041
3148
|
}
|
|
3042
3149
|
cleanup() {
|
|
@@ -3085,63 +3192,63 @@ class Rn extends A {
|
|
|
3085
3192
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3086
3193
|
}
|
|
3087
3194
|
}
|
|
3088
|
-
const
|
|
3089
|
-
function
|
|
3195
|
+
const vi = ft;
|
|
3196
|
+
function yi(a) {
|
|
3090
3197
|
const e = [];
|
|
3091
|
-
return !
|
|
3198
|
+
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;
|
|
3092
3199
|
}
|
|
3093
|
-
function be(
|
|
3094
|
-
return [...
|
|
3200
|
+
function be(a, e) {
|
|
3201
|
+
return [...a, e].join("|");
|
|
3095
3202
|
}
|
|
3096
|
-
function
|
|
3097
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
3098
|
-
|
|
3203
|
+
function xi(a, e) {
|
|
3204
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(a, i), o = at(
|
|
3205
|
+
a,
|
|
3099
3206
|
t,
|
|
3100
3207
|
i,
|
|
3101
3208
|
r,
|
|
3102
3209
|
n,
|
|
3103
3210
|
0,
|
|
3104
3211
|
""
|
|
3105
|
-
),
|
|
3212
|
+
), s = Ri(o, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
|
|
3106
3213
|
return {
|
|
3107
3214
|
rows: o,
|
|
3108
3215
|
columnKeys: r,
|
|
3109
|
-
totals:
|
|
3216
|
+
totals: s,
|
|
3110
3217
|
grandTotal: l
|
|
3111
3218
|
};
|
|
3112
3219
|
}
|
|
3113
|
-
function
|
|
3220
|
+
function Ci(a, e) {
|
|
3114
3221
|
if (e.length === 0) return ["value"];
|
|
3115
3222
|
const t = /* @__PURE__ */ new Set();
|
|
3116
|
-
for (const i of
|
|
3223
|
+
for (const i of a) {
|
|
3117
3224
|
const n = e.map((r) => String(i[r] ?? "")).join("|");
|
|
3118
3225
|
t.add(n);
|
|
3119
3226
|
}
|
|
3120
3227
|
return [...t].sort();
|
|
3121
3228
|
}
|
|
3122
|
-
function
|
|
3229
|
+
function Ei(a, e) {
|
|
3123
3230
|
const t = /* @__PURE__ */ new Map();
|
|
3124
|
-
for (const i of
|
|
3231
|
+
for (const i of a) {
|
|
3125
3232
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
3126
3233
|
r ? r.push(i) : t.set(n, [i]);
|
|
3127
3234
|
}
|
|
3128
3235
|
return t;
|
|
3129
3236
|
}
|
|
3130
|
-
function at(
|
|
3131
|
-
const
|
|
3237
|
+
function at(a, e, t, i, n, r, o) {
|
|
3238
|
+
const s = [];
|
|
3132
3239
|
if (e.length === 0) {
|
|
3133
|
-
const h = Be(
|
|
3134
|
-
return
|
|
3240
|
+
const h = Be(a, t, i, n), g = Ve(h);
|
|
3241
|
+
return s.push({
|
|
3135
3242
|
rowKey: o || "all",
|
|
3136
3243
|
rowLabel: o || "All",
|
|
3137
3244
|
depth: r,
|
|
3138
3245
|
values: h,
|
|
3139
3246
|
total: g,
|
|
3140
3247
|
isGroup: !1,
|
|
3141
|
-
rowCount:
|
|
3142
|
-
}),
|
|
3248
|
+
rowCount: a.length
|
|
3249
|
+
}), s;
|
|
3143
3250
|
}
|
|
3144
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3251
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
|
|
3145
3252
|
for (const [h, g] of u) {
|
|
3146
3253
|
const f = o ? `${o}|${h}` : h, p = Be(g, t, i, n), w = Ve(p);
|
|
3147
3254
|
let b;
|
|
@@ -3153,7 +3260,7 @@ function at(s, e, t, i, n, r, o) {
|
|
|
3153
3260
|
n,
|
|
3154
3261
|
r + 1,
|
|
3155
3262
|
f
|
|
3156
|
-
)),
|
|
3263
|
+
)), s.push({
|
|
3157
3264
|
rowKey: f,
|
|
3158
3265
|
rowLabel: h || "(blank)",
|
|
3159
3266
|
depth: r,
|
|
@@ -3164,90 +3271,90 @@ function at(s, e, t, i, n, r, o) {
|
|
|
3164
3271
|
rowCount: g.length
|
|
3165
3272
|
});
|
|
3166
3273
|
}
|
|
3167
|
-
return
|
|
3274
|
+
return s;
|
|
3168
3275
|
}
|
|
3169
|
-
function Be(
|
|
3276
|
+
function Be(a, e, t, i) {
|
|
3170
3277
|
const n = {};
|
|
3171
3278
|
for (const r of t)
|
|
3172
3279
|
for (const o of i) {
|
|
3173
|
-
const l = (e.length > 0 ?
|
|
3280
|
+
const l = (e.length > 0 ? a.filter((h) => e.map((g) => String(h[g] ?? "")).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);
|
|
3174
3281
|
n[u] = c;
|
|
3175
3282
|
}
|
|
3176
3283
|
return n;
|
|
3177
3284
|
}
|
|
3178
|
-
function Ve(
|
|
3285
|
+
function Ve(a) {
|
|
3179
3286
|
let e = 0;
|
|
3180
|
-
for (const t of Object.values(
|
|
3287
|
+
for (const t of Object.values(a))
|
|
3181
3288
|
e += t ?? 0;
|
|
3182
3289
|
return e;
|
|
3183
3290
|
}
|
|
3184
|
-
function
|
|
3291
|
+
function Ri(a, e, t) {
|
|
3185
3292
|
const i = {};
|
|
3186
3293
|
function n(r) {
|
|
3187
3294
|
for (const o of r)
|
|
3188
3295
|
if (!o.isGroup || !o.children?.length)
|
|
3189
|
-
for (const
|
|
3296
|
+
for (const s of e)
|
|
3190
3297
|
for (const l of t) {
|
|
3191
|
-
const d = be([
|
|
3298
|
+
const d = be([s], l.field);
|
|
3192
3299
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
3193
3300
|
}
|
|
3194
3301
|
else o.children && n(o.children);
|
|
3195
3302
|
}
|
|
3196
|
-
return n(
|
|
3303
|
+
return n(a), i;
|
|
3197
3304
|
}
|
|
3198
|
-
function
|
|
3305
|
+
function Si(a, e, t = !0) {
|
|
3199
3306
|
const i = [];
|
|
3200
3307
|
function n(r) {
|
|
3201
3308
|
i.push(r);
|
|
3202
3309
|
const o = e ? e.has(r.rowKey) : t;
|
|
3203
3310
|
if (r.children && o)
|
|
3204
|
-
for (const
|
|
3205
|
-
n(
|
|
3311
|
+
for (const s of r.children)
|
|
3312
|
+
n(s);
|
|
3206
3313
|
}
|
|
3207
|
-
for (const r of
|
|
3314
|
+
for (const r of a)
|
|
3208
3315
|
n(r);
|
|
3209
3316
|
return i;
|
|
3210
3317
|
}
|
|
3211
|
-
function
|
|
3318
|
+
function ki(a) {
|
|
3212
3319
|
const e = [];
|
|
3213
3320
|
function t(i) {
|
|
3214
3321
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
3215
3322
|
for (const n of i.children)
|
|
3216
3323
|
t(n);
|
|
3217
3324
|
}
|
|
3218
|
-
for (const i of
|
|
3325
|
+
for (const i of a)
|
|
3219
3326
|
t(i);
|
|
3220
3327
|
return e;
|
|
3221
3328
|
}
|
|
3222
|
-
const
|
|
3223
|
-
function
|
|
3329
|
+
const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3330
|
+
function _i(a, e, t, i) {
|
|
3224
3331
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3225
|
-
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () =>
|
|
3332
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Pi(t, r))), o.appendChild(j("Row Groups", () => We("rowGroups", r))), o.appendChild(j("Column Groups", () => We("columnGroups", r))), o.appendChild(j("Values", () => Li(r))), o.appendChild(j("Available Fields", () => Fi(r))), a.appendChild(o), () => {
|
|
3226
3333
|
n.abort(), o.remove();
|
|
3227
3334
|
};
|
|
3228
3335
|
}
|
|
3229
|
-
function j(
|
|
3336
|
+
function j(a, e) {
|
|
3230
3337
|
const t = document.createElement("div");
|
|
3231
3338
|
t.className = "tbw-pivot-section";
|
|
3232
3339
|
const i = document.createElement("div");
|
|
3233
|
-
i.className = "tbw-pivot-section-header", i.textContent =
|
|
3340
|
+
i.className = "tbw-pivot-section-header", i.textContent = a;
|
|
3234
3341
|
const n = document.createElement("div");
|
|
3235
3342
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3236
3343
|
}
|
|
3237
|
-
function We(
|
|
3344
|
+
function We(a, e) {
|
|
3238
3345
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3239
|
-
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone",
|
|
3240
|
-
const o =
|
|
3346
|
+
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", a);
|
|
3347
|
+
const o = a === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
3241
3348
|
if (o.length === 0) {
|
|
3242
|
-
const
|
|
3243
|
-
|
|
3349
|
+
const s = document.createElement("div");
|
|
3350
|
+
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3244
3351
|
} else
|
|
3245
|
-
for (const
|
|
3246
|
-
r.appendChild(
|
|
3352
|
+
for (const s of o)
|
|
3353
|
+
r.appendChild(Ti(s, a, e));
|
|
3247
3354
|
return r.addEventListener(
|
|
3248
3355
|
"dragover",
|
|
3249
|
-
(
|
|
3250
|
-
|
|
3356
|
+
(s) => {
|
|
3357
|
+
s.preventDefault(), r.classList.add("drag-over");
|
|
3251
3358
|
},
|
|
3252
3359
|
{ signal: n }
|
|
3253
3360
|
), r.addEventListener(
|
|
@@ -3258,30 +3365,30 @@ function We(s, e) {
|
|
|
3258
3365
|
{ signal: n }
|
|
3259
3366
|
), r.addEventListener(
|
|
3260
3367
|
"drop",
|
|
3261
|
-
(
|
|
3262
|
-
|
|
3263
|
-
const l =
|
|
3264
|
-
l && i.onAddFieldToZone(l,
|
|
3368
|
+
(s) => {
|
|
3369
|
+
s.preventDefault(), r.classList.remove("drag-over");
|
|
3370
|
+
const l = s.dataTransfer?.getData("text/plain");
|
|
3371
|
+
l && i.onAddFieldToZone(l, a);
|
|
3265
3372
|
},
|
|
3266
3373
|
{ signal: n }
|
|
3267
3374
|
), r;
|
|
3268
3375
|
}
|
|
3269
|
-
function
|
|
3376
|
+
function Ti(a, e, t) {
|
|
3270
3377
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3271
3378
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3272
|
-
const o = i.getAvailableFields().find((d) => d.field ===
|
|
3273
|
-
|
|
3379
|
+
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
3380
|
+
s.className = "tbw-pivot-chip-label", s.textContent = o?.header ?? a;
|
|
3274
3381
|
const l = document.createElement("button");
|
|
3275
3382
|
return l.className = "tbw-pivot-chip-remove", l.innerHTML = "×", l.title = "Remove field", l.addEventListener(
|
|
3276
3383
|
"click",
|
|
3277
3384
|
(d) => {
|
|
3278
|
-
d.stopPropagation(), i.onRemoveFieldFromZone(
|
|
3385
|
+
d.stopPropagation(), i.onRemoveFieldFromZone(a, e);
|
|
3279
3386
|
},
|
|
3280
3387
|
{ signal: n }
|
|
3281
|
-
), r.appendChild(
|
|
3388
|
+
), r.appendChild(s), r.appendChild(l), r.addEventListener(
|
|
3282
3389
|
"dragstart",
|
|
3283
3390
|
(d) => {
|
|
3284
|
-
d.dataTransfer?.setData("text/plain",
|
|
3391
|
+
d.dataTransfer?.setData("text/plain", a), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
|
|
3285
3392
|
},
|
|
3286
3393
|
{ signal: n }
|
|
3287
3394
|
), r.addEventListener(
|
|
@@ -3292,8 +3399,8 @@ function Li(s, e, t) {
|
|
|
3292
3399
|
{ signal: n }
|
|
3293
3400
|
), r;
|
|
3294
3401
|
}
|
|
3295
|
-
function
|
|
3296
|
-
const { config: e, callbacks: t, signal: i } =
|
|
3402
|
+
function Li(a) {
|
|
3403
|
+
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3297
3404
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3298
3405
|
const r = e.valueFields ?? [];
|
|
3299
3406
|
if (r.length === 0) {
|
|
@@ -3301,7 +3408,7 @@ function Fi(s) {
|
|
|
3301
3408
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3302
3409
|
} else
|
|
3303
3410
|
for (const o of r)
|
|
3304
|
-
n.appendChild(Ii(o,
|
|
3411
|
+
n.appendChild(Ii(o, a));
|
|
3305
3412
|
return n.addEventListener(
|
|
3306
3413
|
"dragover",
|
|
3307
3414
|
(o) => {
|
|
@@ -3318,29 +3425,29 @@ function Fi(s) {
|
|
|
3318
3425
|
"drop",
|
|
3319
3426
|
(o) => {
|
|
3320
3427
|
o.preventDefault(), n.classList.remove("drag-over");
|
|
3321
|
-
const
|
|
3322
|
-
|
|
3428
|
+
const s = o.dataTransfer?.getData("text/plain");
|
|
3429
|
+
s && t.onAddValueField(s, "sum");
|
|
3323
3430
|
},
|
|
3324
3431
|
{ signal: i }
|
|
3325
3432
|
), n;
|
|
3326
3433
|
}
|
|
3327
|
-
function Ii(
|
|
3434
|
+
function Ii(a, e) {
|
|
3328
3435
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3329
3436
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3330
|
-
const r = t.getAvailableFields().find((c) => c.field ===
|
|
3437
|
+
const r = t.getAvailableFields().find((c) => c.field === a.field), o = document.createElement("div");
|
|
3331
3438
|
o.className = "tbw-pivot-value-label-wrapper";
|
|
3332
|
-
const
|
|
3333
|
-
|
|
3439
|
+
const s = document.createElement("span");
|
|
3440
|
+
s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? a.field;
|
|
3334
3441
|
const l = document.createElement("select");
|
|
3335
3442
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3336
|
-
for (const c of
|
|
3443
|
+
for (const c of Ai) {
|
|
3337
3444
|
const u = document.createElement("option");
|
|
3338
|
-
u.value = c, u.textContent = c.toUpperCase(), u.selected = c ===
|
|
3445
|
+
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === a.aggFunc, l.appendChild(u);
|
|
3339
3446
|
}
|
|
3340
3447
|
l.addEventListener(
|
|
3341
3448
|
"change",
|
|
3342
3449
|
() => {
|
|
3343
|
-
t.onUpdateValueAggFunc(
|
|
3450
|
+
t.onUpdateValueAggFunc(a.field, l.value);
|
|
3344
3451
|
},
|
|
3345
3452
|
{ signal: i }
|
|
3346
3453
|
);
|
|
@@ -3348,24 +3455,24 @@ function Ii(s, e) {
|
|
|
3348
3455
|
return d.className = "tbw-pivot-chip-remove", d.innerHTML = "×", d.title = "Remove value field", d.addEventListener(
|
|
3349
3456
|
"click",
|
|
3350
3457
|
(c) => {
|
|
3351
|
-
c.stopPropagation(), t.onRemoveValueField(
|
|
3458
|
+
c.stopPropagation(), t.onRemoveValueField(a.field);
|
|
3352
3459
|
},
|
|
3353
3460
|
{ signal: i }
|
|
3354
|
-
), o.appendChild(
|
|
3461
|
+
), o.appendChild(s), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3355
3462
|
}
|
|
3356
|
-
function
|
|
3357
|
-
const { config: e, callbacks: t, signal: i } =
|
|
3463
|
+
function Fi(a) {
|
|
3464
|
+
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3358
3465
|
n.className = "tbw-pivot-available-fields";
|
|
3359
3466
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
3360
3467
|
...e.rowGroupFields ?? [],
|
|
3361
3468
|
...e.columnGroupFields ?? [],
|
|
3362
3469
|
...e.valueFields?.map((l) => l.field) ?? []
|
|
3363
|
-
]),
|
|
3364
|
-
if (
|
|
3470
|
+
]), s = r.filter((l) => !o.has(l.field));
|
|
3471
|
+
if (s.length === 0) {
|
|
3365
3472
|
const l = document.createElement("div");
|
|
3366
3473
|
l.className = "tbw-pivot-placeholder", l.textContent = "All fields are in use", n.appendChild(l);
|
|
3367
3474
|
} else
|
|
3368
|
-
for (const l of
|
|
3475
|
+
for (const l of s) {
|
|
3369
3476
|
const d = document.createElement("div");
|
|
3370
3477
|
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(
|
|
3371
3478
|
"dragstart",
|
|
@@ -3383,12 +3490,12 @@ function Pi(s) {
|
|
|
3383
3490
|
}
|
|
3384
3491
|
return n;
|
|
3385
3492
|
}
|
|
3386
|
-
function
|
|
3493
|
+
function Pi(a, e) {
|
|
3387
3494
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3388
3495
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3389
3496
|
le(
|
|
3390
3497
|
"Enable Pivot View",
|
|
3391
|
-
|
|
3498
|
+
a,
|
|
3392
3499
|
(o) => {
|
|
3393
3500
|
i.onTogglePivot(o);
|
|
3394
3501
|
},
|
|
@@ -3414,67 +3521,67 @@ function Di(s, e) {
|
|
|
3414
3521
|
)
|
|
3415
3522
|
), r;
|
|
3416
3523
|
}
|
|
3417
|
-
function le(
|
|
3524
|
+
function le(a, e, t, i) {
|
|
3418
3525
|
const n = document.createElement("label");
|
|
3419
3526
|
n.className = "tbw-pivot-checkbox";
|
|
3420
3527
|
const r = document.createElement("input");
|
|
3421
3528
|
r.type = "checkbox", r.checked = e, r.addEventListener("change", () => t(r.checked), { signal: i });
|
|
3422
3529
|
const o = document.createElement("span");
|
|
3423
|
-
return o.textContent =
|
|
3530
|
+
return o.textContent = a, n.appendChild(r), n.appendChild(o), n;
|
|
3424
3531
|
}
|
|
3425
|
-
function
|
|
3426
|
-
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(
|
|
3532
|
+
function Di(a, e, t) {
|
|
3533
|
+
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) => {
|
|
3427
3534
|
const r = document.createElement("div");
|
|
3428
3535
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
3429
|
-
const o = Number(
|
|
3536
|
+
const o = Number(a.__pivotIndent) || 0;
|
|
3430
3537
|
r.style.paddingLeft = `${o}px`;
|
|
3431
|
-
const
|
|
3432
|
-
l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label",
|
|
3433
|
-
u.stopPropagation(), t.onToggle(
|
|
3538
|
+
const s = String(a.__pivotRowKey), l = document.createElement("button");
|
|
3539
|
+
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) => {
|
|
3540
|
+
u.stopPropagation(), t.onToggle(s);
|
|
3434
3541
|
}), r.appendChild(l);
|
|
3435
3542
|
const d = document.createElement("span");
|
|
3436
|
-
d.className = "pivot-label", d.textContent = String(
|
|
3543
|
+
d.className = "pivot-label", d.textContent = String(a.__pivotLabel ?? ""), r.appendChild(d);
|
|
3437
3544
|
const c = document.createElement("span");
|
|
3438
|
-
c.className = "pivot-count", c.textContent = ` (${Number(
|
|
3545
|
+
c.className = "pivot-count", c.textContent = ` (${Number(a.__pivotRowCount) || 0})`, r.appendChild(c);
|
|
3439
3546
|
} else {
|
|
3440
|
-
const o =
|
|
3547
|
+
const o = a[i.field];
|
|
3441
3548
|
r.textContent = o != null ? String(o) : "";
|
|
3442
3549
|
}
|
|
3443
3550
|
e.appendChild(r);
|
|
3444
3551
|
}), !0;
|
|
3445
3552
|
}
|
|
3446
|
-
function
|
|
3447
|
-
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(
|
|
3553
|
+
function Mi(a, e, t, i) {
|
|
3554
|
+
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) => {
|
|
3448
3555
|
const o = document.createElement("div");
|
|
3449
3556
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
3450
|
-
const
|
|
3451
|
-
o.style.paddingLeft = `${
|
|
3557
|
+
const s = Number(a.__pivotIndent) || 0;
|
|
3558
|
+
o.style.paddingLeft = `${s + 20}px`;
|
|
3452
3559
|
const l = document.createElement("span");
|
|
3453
|
-
l.className = "pivot-label", l.textContent = String(
|
|
3560
|
+
l.className = "pivot-label", l.textContent = String(a.__pivotLabel ?? ""), o.appendChild(l);
|
|
3454
3561
|
} else {
|
|
3455
|
-
const
|
|
3456
|
-
o.textContent =
|
|
3562
|
+
const s = a[n.field];
|
|
3563
|
+
o.textContent = s != null ? String(s) : "";
|
|
3457
3564
|
}
|
|
3458
3565
|
e.appendChild(o);
|
|
3459
3566
|
}), !0;
|
|
3460
3567
|
}
|
|
3461
|
-
function
|
|
3568
|
+
function Ni(a, e, t) {
|
|
3462
3569
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3463
3570
|
const r = document.createElement("div");
|
|
3464
3571
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
3465
3572
|
const o = document.createElement("span");
|
|
3466
3573
|
o.className = "pivot-label", o.textContent = "Grand Total", r.appendChild(o);
|
|
3467
3574
|
} else {
|
|
3468
|
-
const o =
|
|
3575
|
+
const o = a[i.field];
|
|
3469
3576
|
r.textContent = o != null ? String(o) : "";
|
|
3470
3577
|
}
|
|
3471
3578
|
e.appendChild(r);
|
|
3472
3579
|
}), !0;
|
|
3473
3580
|
}
|
|
3474
|
-
const
|
|
3581
|
+
const qi = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
3475
3582
|
class G extends A {
|
|
3476
3583
|
name = "pivot";
|
|
3477
|
-
styles =
|
|
3584
|
+
styles = qi;
|
|
3478
3585
|
static PANEL_ID = "pivot";
|
|
3479
3586
|
get defaultConfig() {
|
|
3480
3587
|
return {
|
|
@@ -3520,11 +3627,11 @@ class G extends A {
|
|
|
3520
3627
|
processRows(e) {
|
|
3521
3628
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3522
3629
|
return [...e];
|
|
3523
|
-
const t =
|
|
3630
|
+
const t = yi(this.config);
|
|
3524
3631
|
if (t.length > 0)
|
|
3525
3632
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3526
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult =
|
|
3527
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3633
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = xi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
3634
|
+
const i = this.config.indentWidth ?? 20, n = Si(
|
|
3528
3635
|
this.pivotResult.rows,
|
|
3529
3636
|
this.expandedKeys,
|
|
3530
3637
|
this.defaultExpanded
|
|
@@ -3543,8 +3650,8 @@ class G extends A {
|
|
|
3543
3650
|
this.keysToAnimate.clear();
|
|
3544
3651
|
const r = /* @__PURE__ */ new Set();
|
|
3545
3652
|
for (const o of n) {
|
|
3546
|
-
const
|
|
3547
|
-
r.add(
|
|
3653
|
+
const s = o.__pivotRowKey;
|
|
3654
|
+
r.add(s), !this.previousVisibleKeys.has(s) && o.__pivotDepth > 0 && this.keysToAnimate.add(s);
|
|
3548
3655
|
}
|
|
3549
3656
|
return this.previousVisibleKeys = r, n;
|
|
3550
3657
|
}
|
|
@@ -3559,10 +3666,10 @@ class G extends A {
|
|
|
3559
3666
|
});
|
|
3560
3667
|
for (const n of this.pivotResult.columnKeys)
|
|
3561
3668
|
for (const r of this.config.valueFields ?? []) {
|
|
3562
|
-
const o = be([n], r.field),
|
|
3669
|
+
const o = be([n], r.field), s = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3563
3670
|
t.push({
|
|
3564
3671
|
field: o,
|
|
3565
|
-
header: `${n} - ${
|
|
3672
|
+
header: `${n} - ${s} (${r.aggFunc})`,
|
|
3566
3673
|
width: 120,
|
|
3567
3674
|
type: "number"
|
|
3568
3675
|
});
|
|
@@ -3576,13 +3683,13 @@ class G extends A {
|
|
|
3576
3683
|
}
|
|
3577
3684
|
renderRow(e, t, i) {
|
|
3578
3685
|
const n = e;
|
|
3579
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3686
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Di(n, t, {
|
|
3580
3687
|
columns: this.gridColumns,
|
|
3581
3688
|
rowIndex: i,
|
|
3582
3689
|
onToggle: (r) => this.toggle(r),
|
|
3583
3690
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3584
3691
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3585
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3692
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Mi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3586
3693
|
}
|
|
3587
3694
|
cleanupPivotStyling(e) {
|
|
3588
3695
|
(e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
|
|
@@ -3620,7 +3727,7 @@ class G extends A {
|
|
|
3620
3727
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3621
3728
|
...this.pivotResult.totals
|
|
3622
3729
|
};
|
|
3623
|
-
|
|
3730
|
+
Ni(i, this.grandTotalFooter, this.gridColumns);
|
|
3624
3731
|
}
|
|
3625
3732
|
cleanupGrandTotalFooter() {
|
|
3626
3733
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3642,7 +3749,7 @@ class G extends A {
|
|
|
3642
3749
|
}
|
|
3643
3750
|
expandAllKeys() {
|
|
3644
3751
|
if (!this.pivotResult) return;
|
|
3645
|
-
const e =
|
|
3752
|
+
const e = ki(this.pivotResult.rows);
|
|
3646
3753
|
for (const t of e)
|
|
3647
3754
|
this.expandedKeys.add(t);
|
|
3648
3755
|
}
|
|
@@ -3727,7 +3834,7 @@ class G extends A {
|
|
|
3727
3834
|
},
|
|
3728
3835
|
getAvailableFields: () => this.getAvailableFields()
|
|
3729
3836
|
};
|
|
3730
|
-
return
|
|
3837
|
+
return _i(e, this.config, this.isActive, t);
|
|
3731
3838
|
}
|
|
3732
3839
|
refreshPanel() {
|
|
3733
3840
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3761,18 +3868,18 @@ class G extends A {
|
|
|
3761
3868
|
}
|
|
3762
3869
|
}
|
|
3763
3870
|
const Q = "tbw-print-isolation-style";
|
|
3764
|
-
function
|
|
3871
|
+
function Hi(a, e) {
|
|
3765
3872
|
const t = document.createElement("style");
|
|
3766
3873
|
return t.id = Q, t.textContent = `
|
|
3767
3874
|
/* Print isolation: hide everything except the target grid */
|
|
3768
3875
|
@media print {
|
|
3769
3876
|
/* Hide all body children by default */
|
|
3770
|
-
body > *:not(#${
|
|
3877
|
+
body > *:not(#${a}) {
|
|
3771
3878
|
display: none !important;
|
|
3772
3879
|
}
|
|
3773
3880
|
|
|
3774
3881
|
/* But show the grid and ensure it's not hidden by ancestor rules */
|
|
3775
|
-
#${
|
|
3882
|
+
#${a} {
|
|
3776
3883
|
display: block !important;
|
|
3777
3884
|
position: static !important;
|
|
3778
3885
|
visibility: visible !important;
|
|
@@ -3787,14 +3894,14 @@ function Ki(s, e) {
|
|
|
3787
3894
|
}
|
|
3788
3895
|
|
|
3789
3896
|
/* If grid is nested, we need to show its ancestors too */
|
|
3790
|
-
#${
|
|
3791
|
-
#${
|
|
3897
|
+
#${a},
|
|
3898
|
+
#${a} * {
|
|
3792
3899
|
visibility: visible !important;
|
|
3793
3900
|
}
|
|
3794
3901
|
|
|
3795
3902
|
/* Walk up the DOM and show all ancestors of the grid */
|
|
3796
|
-
body *:has(> #${
|
|
3797
|
-
body *:has(#${
|
|
3903
|
+
body *:has(> #${a}),
|
|
3904
|
+
body *:has(#${a}) {
|
|
3798
3905
|
display: block !important;
|
|
3799
3906
|
visibility: visible !important;
|
|
3800
3907
|
opacity: 1 !important;
|
|
@@ -3809,7 +3916,7 @@ function Ki(s, e) {
|
|
|
3809
3916
|
}
|
|
3810
3917
|
|
|
3811
3918
|
/* Hide siblings of ancestors (everything that's not in the path to the grid) */
|
|
3812
|
-
body *:has(#${
|
|
3919
|
+
body *:has(#${a}) > *:not(:has(#${a})):not(#${a}) {
|
|
3813
3920
|
display: none !important;
|
|
3814
3921
|
}
|
|
3815
3922
|
|
|
@@ -3835,22 +3942,22 @@ function Ki(s, e) {
|
|
|
3835
3942
|
}
|
|
3836
3943
|
`, t;
|
|
3837
3944
|
}
|
|
3838
|
-
async function
|
|
3839
|
-
const { orientation: t = "landscape" } = e, i =
|
|
3945
|
+
async function Ki(a, e = {}) {
|
|
3946
|
+
const { orientation: t = "landscape" } = e, i = a.id;
|
|
3840
3947
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3841
3948
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3842
3949
|
), document.getElementById(Q)?.remove();
|
|
3843
|
-
const r =
|
|
3950
|
+
const r = Hi(i, t);
|
|
3844
3951
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3845
|
-
const
|
|
3846
|
-
window.removeEventListener("afterprint",
|
|
3952
|
+
const s = () => {
|
|
3953
|
+
window.removeEventListener("afterprint", s), document.getElementById(Q)?.remove(), o();
|
|
3847
3954
|
};
|
|
3848
|
-
window.addEventListener("afterprint",
|
|
3849
|
-
window.removeEventListener("afterprint",
|
|
3955
|
+
window.addEventListener("afterprint", s), window.print(), setTimeout(() => {
|
|
3956
|
+
window.removeEventListener("afterprint", s), document.getElementById(Q)?.remove(), o();
|
|
3850
3957
|
}, 5e3);
|
|
3851
3958
|
});
|
|
3852
3959
|
}
|
|
3853
|
-
const
|
|
3960
|
+
const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:end}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-inline-end:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Oi = {
|
|
3854
3961
|
button: !1,
|
|
3855
3962
|
orientation: "landscape",
|
|
3856
3963
|
warnThreshold: 500,
|
|
@@ -3860,18 +3967,18 @@ const Oi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3860
3967
|
title: "",
|
|
3861
3968
|
isolate: !1
|
|
3862
3969
|
};
|
|
3863
|
-
class
|
|
3970
|
+
class Rn extends A {
|
|
3864
3971
|
name = "print";
|
|
3865
3972
|
version = "1.0.0";
|
|
3866
|
-
styles =
|
|
3973
|
+
styles = zi;
|
|
3867
3974
|
#e = !1;
|
|
3868
3975
|
#t = null;
|
|
3869
|
-
#
|
|
3976
|
+
#s = null;
|
|
3870
3977
|
#n = null;
|
|
3871
3978
|
#i = null;
|
|
3872
|
-
#
|
|
3979
|
+
#o = null;
|
|
3873
3980
|
#d = null;
|
|
3874
|
-
get #
|
|
3981
|
+
get #r() {
|
|
3875
3982
|
return this.grid;
|
|
3876
3983
|
}
|
|
3877
3984
|
isPrinting() {
|
|
@@ -3887,8 +3994,8 @@ class Sn extends A {
|
|
|
3887
3994
|
console.warn("[PrintPlugin] Grid not available");
|
|
3888
3995
|
return;
|
|
3889
3996
|
}
|
|
3890
|
-
const i = { ...
|
|
3891
|
-
let o = r,
|
|
3997
|
+
const i = { ...Oi, ...this.config, ...e }, r = this.rows.length;
|
|
3998
|
+
let o = r, s = !1;
|
|
3892
3999
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3893
4000
|
const d = i.maxRows > 0 ? `
|
|
3894
4001
|
|
|
@@ -3900,18 +4007,18 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3900
4007
|
))
|
|
3901
4008
|
return;
|
|
3902
4009
|
}
|
|
3903
|
-
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows,
|
|
4010
|
+
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#e = !0;
|
|
3904
4011
|
const l = performance.now();
|
|
3905
4012
|
this.emit("print-start", {
|
|
3906
4013
|
rowCount: o,
|
|
3907
|
-
limitApplied:
|
|
4014
|
+
limitApplied: s,
|
|
3908
4015
|
originalRowCount: r
|
|
3909
4016
|
});
|
|
3910
4017
|
try {
|
|
3911
|
-
const d = this.#
|
|
3912
|
-
this.#
|
|
4018
|
+
const d = this.#r;
|
|
4019
|
+
this.#s = {
|
|
3913
4020
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
3914
|
-
}, this.#
|
|
4021
|
+
}, this.#l(), s && (this.#n = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#c(i), await this.#w(), 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.#h(), this.emit("print-complete", {
|
|
3915
4022
|
success: !0,
|
|
3916
4023
|
rowCount: o,
|
|
3917
4024
|
duration: Math.round(performance.now() - l)
|
|
@@ -3923,7 +4030,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3923
4030
|
duration: Math.round(performance.now() - l)
|
|
3924
4031
|
});
|
|
3925
4032
|
} finally {
|
|
3926
|
-
this.#
|
|
4033
|
+
this.#f(), this.#e = !1;
|
|
3927
4034
|
}
|
|
3928
4035
|
}
|
|
3929
4036
|
#c(e) {
|
|
@@ -3937,16 +4044,16 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3937
4044
|
const i = document.createElement("div");
|
|
3938
4045
|
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#i.appendChild(i);
|
|
3939
4046
|
}
|
|
3940
|
-
t.insertBefore(this.#i, t.firstChild), this.#
|
|
4047
|
+
t.insertBefore(this.#i, t.firstChild), this.#o = document.createElement("div"), this.#o.className = "tbw-print-footer", this.#o.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#o);
|
|
3941
4048
|
}
|
|
3942
4049
|
}
|
|
3943
|
-
async #
|
|
3944
|
-
const e = this.#
|
|
4050
|
+
async #w() {
|
|
4051
|
+
const e = this.#r;
|
|
3945
4052
|
if (!e._virtualization) return;
|
|
3946
4053
|
const t = this.rows.length;
|
|
3947
4054
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
3948
4055
|
}
|
|
3949
|
-
async #
|
|
4056
|
+
async #h() {
|
|
3950
4057
|
return new Promise((e) => {
|
|
3951
4058
|
const t = () => {
|
|
3952
4059
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -3956,13 +4063,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3956
4063
|
}, 1e3);
|
|
3957
4064
|
});
|
|
3958
4065
|
}
|
|
3959
|
-
async #
|
|
4066
|
+
async #p(e) {
|
|
3960
4067
|
const t = this.gridElement;
|
|
3961
|
-
t && await
|
|
4068
|
+
t && await Ki(t, {
|
|
3962
4069
|
orientation: e.orientation
|
|
3963
4070
|
});
|
|
3964
4071
|
}
|
|
3965
|
-
#
|
|
4072
|
+
#l() {
|
|
3966
4073
|
const e = this.columns;
|
|
3967
4074
|
if (e) {
|
|
3968
4075
|
this.#t = /* @__PURE__ */ new Map();
|
|
@@ -3970,26 +4077,26 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3970
4077
|
t.printHidden && t.field && (this.#t.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
3971
4078
|
}
|
|
3972
4079
|
}
|
|
3973
|
-
#
|
|
4080
|
+
#a() {
|
|
3974
4081
|
if (this.#t) {
|
|
3975
4082
|
for (const [e, t] of this.#t)
|
|
3976
4083
|
this.grid.setColumnVisible(e, t);
|
|
3977
4084
|
this.#t = null;
|
|
3978
4085
|
}
|
|
3979
4086
|
}
|
|
3980
|
-
#
|
|
4087
|
+
#f() {
|
|
3981
4088
|
const e = this.gridElement;
|
|
3982
4089
|
if (!e) return;
|
|
3983
|
-
this.#
|
|
3984
|
-
const t = this.#
|
|
3985
|
-
this.#
|
|
4090
|
+
this.#a(), e.classList.remove("print-portrait", "print-landscape"), this.#d !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#d = null), this.#i && (this.#i.remove(), this.#i = null), this.#o && (this.#o.remove(), this.#o = null);
|
|
4091
|
+
const t = this.#r;
|
|
4092
|
+
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#n !== null && (this.grid.rows = this.#n, this.#n = null);
|
|
3986
4093
|
}
|
|
3987
4094
|
afterRender() {
|
|
3988
|
-
this.config?.button && !this.#
|
|
4095
|
+
this.config?.button && !this.#u && (this.#g(), this.#u = !0);
|
|
3989
4096
|
}
|
|
3990
|
-
#
|
|
3991
|
-
#
|
|
3992
|
-
this.#
|
|
4097
|
+
#u = !1;
|
|
4098
|
+
#g() {
|
|
4099
|
+
this.#r.registerToolbarContent?.({
|
|
3993
4100
|
id: "print-button",
|
|
3994
4101
|
order: 900,
|
|
3995
4102
|
render: (t) => {
|
|
@@ -4007,19 +4114,19 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4007
4114
|
});
|
|
4008
4115
|
}
|
|
4009
4116
|
}
|
|
4010
|
-
function
|
|
4011
|
-
const e =
|
|
4117
|
+
function Gi(a) {
|
|
4118
|
+
const e = a.meta ?? {};
|
|
4012
4119
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4013
4120
|
}
|
|
4014
|
-
function $e(
|
|
4015
|
-
if (e === t || e < 0 || e >=
|
|
4016
|
-
const i = [...
|
|
4121
|
+
function $e(a, e, t) {
|
|
4122
|
+
if (e === t || e < 0 || e >= a.length || t < 0 || t > a.length) return a;
|
|
4123
|
+
const i = [...a], [n] = i.splice(e, 1);
|
|
4017
4124
|
return i.splice(t, 0, n), i;
|
|
4018
4125
|
}
|
|
4019
|
-
const
|
|
4020
|
-
class
|
|
4126
|
+
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}}';
|
|
4127
|
+
class Sn extends A {
|
|
4021
4128
|
name = "reorder";
|
|
4022
|
-
styles =
|
|
4129
|
+
styles = Bi;
|
|
4023
4130
|
get defaultConfig() {
|
|
4024
4131
|
return {
|
|
4025
4132
|
animation: "flip"
|
|
@@ -4036,7 +4143,7 @@ class kn extends A {
|
|
|
4036
4143
|
draggedIndex = null;
|
|
4037
4144
|
dropIndex = null;
|
|
4038
4145
|
canMoveColumnWithPlugins(e) {
|
|
4039
|
-
return !e || !
|
|
4146
|
+
return !e || !Gi(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
|
|
4040
4147
|
}
|
|
4041
4148
|
clearDragClasses() {
|
|
4042
4149
|
this.gridElement?.querySelectorAll(".header-row > .cell").forEach((e) => {
|
|
@@ -4062,24 +4169,24 @@ class kn extends A {
|
|
|
4062
4169
|
e.querySelectorAll(".header-row > .cell").forEach((i) => {
|
|
4063
4170
|
const n = i, r = n.getAttribute("data-field");
|
|
4064
4171
|
if (!r) return;
|
|
4065
|
-
const o = this.columns.find((
|
|
4172
|
+
const o = this.columns.find((s) => s.field === r);
|
|
4066
4173
|
if (!this.canMoveColumnWithPlugins(o)) {
|
|
4067
4174
|
n.draggable = !1;
|
|
4068
4175
|
return;
|
|
4069
4176
|
}
|
|
4070
|
-
n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (
|
|
4177
|
+
n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (s) => {
|
|
4071
4178
|
const d = this.getColumnOrder().indexOf(r);
|
|
4072
|
-
this.isDragging = !0, this.draggedField = r, this.draggedIndex = d,
|
|
4179
|
+
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");
|
|
4073
4180
|
}), n.addEventListener("dragend", () => {
|
|
4074
4181
|
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses();
|
|
4075
|
-
}), n.addEventListener("dragover", (
|
|
4076
|
-
if (
|
|
4182
|
+
}), n.addEventListener("dragover", (s) => {
|
|
4183
|
+
if (s.preventDefault(), !this.isDragging || this.draggedField === r) return;
|
|
4077
4184
|
const l = n.getBoundingClientRect(), d = l.left + l.width / 2, u = this.getColumnOrder().indexOf(r);
|
|
4078
|
-
this.dropIndex =
|
|
4185
|
+
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);
|
|
4079
4186
|
}), n.addEventListener("dragleave", () => {
|
|
4080
4187
|
n.classList.remove("drop-target", "drop-before", "drop-after");
|
|
4081
|
-
}), n.addEventListener("drop", (
|
|
4082
|
-
|
|
4188
|
+
}), n.addEventListener("drop", (s) => {
|
|
4189
|
+
s.preventDefault();
|
|
4083
4190
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4084
4191
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4085
4192
|
return;
|
|
@@ -4100,9 +4207,9 @@ class kn extends A {
|
|
|
4100
4207
|
if (i < 0 || i >= n.length) return;
|
|
4101
4208
|
const r = n[i];
|
|
4102
4209
|
if (!this.canMoveColumnWithPlugins(r)) return;
|
|
4103
|
-
const o = this.getColumnOrder(),
|
|
4104
|
-
if (
|
|
4105
|
-
const l = e.key === "ArrowLeft" ?
|
|
4210
|
+
const o = this.getColumnOrder(), s = o.indexOf(r.field);
|
|
4211
|
+
if (s === -1) return;
|
|
4212
|
+
const l = e.key === "ArrowLeft" ? s - 1 : s + 1;
|
|
4106
4213
|
if (l < 0 || l >= o.length) return;
|
|
4107
4214
|
const d = n.find((c) => c.field === o[l]);
|
|
4108
4215
|
if (this.canMoveColumnWithPlugins(d))
|
|
@@ -4141,19 +4248,19 @@ class kn extends A {
|
|
|
4141
4248
|
if (!t || e.size === 0) return;
|
|
4142
4249
|
const i = /* @__PURE__ */ new Map();
|
|
4143
4250
|
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((o) => {
|
|
4144
|
-
const
|
|
4145
|
-
if (!
|
|
4146
|
-
const l = e.get(
|
|
4251
|
+
const s = o.getAttribute("data-field");
|
|
4252
|
+
if (!s) return;
|
|
4253
|
+
const l = e.get(s);
|
|
4147
4254
|
if (l === void 0) return;
|
|
4148
4255
|
const d = l - o.getBoundingClientRect().left;
|
|
4149
|
-
Math.abs(d) > 1 && i.set(
|
|
4256
|
+
Math.abs(d) > 1 && i.set(s, d);
|
|
4150
4257
|
}), i.size === 0) return;
|
|
4151
4258
|
const n = [];
|
|
4152
4259
|
if (t.querySelectorAll(".cell[data-field]").forEach((o) => {
|
|
4153
|
-
const
|
|
4154
|
-
if (
|
|
4260
|
+
const s = i.get(o.getAttribute("data-field") ?? "");
|
|
4261
|
+
if (s !== void 0) {
|
|
4155
4262
|
const l = o;
|
|
4156
|
-
l.style.transform = `translateX(${
|
|
4263
|
+
l.style.transform = `translateX(${s}px)`, n.push(l);
|
|
4157
4264
|
}
|
|
4158
4265
|
}), n.length === 0) return;
|
|
4159
4266
|
this.gridElement.offsetHeight;
|
|
@@ -4177,25 +4284,25 @@ class kn extends A {
|
|
|
4177
4284
|
const i = this.captureHeaderPositions();
|
|
4178
4285
|
e();
|
|
4179
4286
|
const n = /* @__PURE__ */ new Set();
|
|
4180
|
-
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((
|
|
4181
|
-
const l =
|
|
4287
|
+
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((s) => {
|
|
4288
|
+
const l = s.getAttribute("data-field");
|
|
4182
4289
|
if (!l) return;
|
|
4183
4290
|
const d = i.get(l);
|
|
4184
4291
|
if (d === void 0) return;
|
|
4185
|
-
const c =
|
|
4292
|
+
const c = s.getBoundingClientRect().left;
|
|
4186
4293
|
Math.abs(d - c) > 1 && n.add(l);
|
|
4187
4294
|
}), n.size === 0) return;
|
|
4188
4295
|
const r = [];
|
|
4189
|
-
if (t.querySelectorAll(".cell[data-field]").forEach((
|
|
4190
|
-
const l =
|
|
4296
|
+
if (t.querySelectorAll(".cell[data-field]").forEach((s) => {
|
|
4297
|
+
const l = s.getAttribute("data-field");
|
|
4191
4298
|
if (l && n.has(l)) {
|
|
4192
|
-
const d =
|
|
4299
|
+
const d = s;
|
|
4193
4300
|
d.classList.add("fade-animating"), r.push(d);
|
|
4194
4301
|
}
|
|
4195
4302
|
}), r.length === 0) return;
|
|
4196
4303
|
const o = this.animationDuration;
|
|
4197
4304
|
setTimeout(() => {
|
|
4198
|
-
r.forEach((
|
|
4305
|
+
r.forEach((s) => s.classList.remove("fade-animating"));
|
|
4199
4306
|
}, o + 50);
|
|
4200
4307
|
}
|
|
4201
4308
|
updateColumnOrder(e) {
|
|
@@ -4209,11 +4316,11 @@ class kn extends A {
|
|
|
4209
4316
|
this.grid.requestStateChange?.();
|
|
4210
4317
|
}
|
|
4211
4318
|
}
|
|
4212
|
-
const
|
|
4213
|
-
class
|
|
4319
|
+
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}}';
|
|
4320
|
+
class kn extends A {
|
|
4214
4321
|
name = "responsive";
|
|
4215
4322
|
version = "1.0.0";
|
|
4216
|
-
styles =
|
|
4323
|
+
styles = Vi;
|
|
4217
4324
|
static manifest = {
|
|
4218
4325
|
incompatibleWith: [
|
|
4219
4326
|
{
|
|
@@ -4230,25 +4337,25 @@ class An extends A {
|
|
|
4230
4337
|
};
|
|
4231
4338
|
#e;
|
|
4232
4339
|
#t = !1;
|
|
4233
|
-
#
|
|
4340
|
+
#s;
|
|
4234
4341
|
#n = !1;
|
|
4235
4342
|
#i = 0;
|
|
4236
|
-
#
|
|
4343
|
+
#o = /* @__PURE__ */ new Set();
|
|
4237
4344
|
#d = /* @__PURE__ */ new Set();
|
|
4238
|
-
#
|
|
4345
|
+
#r = null;
|
|
4239
4346
|
#c = [];
|
|
4240
4347
|
isResponsive() {
|
|
4241
4348
|
return this.#t;
|
|
4242
4349
|
}
|
|
4243
4350
|
setResponsive(e) {
|
|
4244
|
-
e !== this.#t && (this.#t = e, this.#
|
|
4351
|
+
e !== this.#t && (this.#t = e, this.#f(), this.emit("responsive-change", {
|
|
4245
4352
|
isResponsive: e,
|
|
4246
4353
|
width: this.#i,
|
|
4247
4354
|
breakpoint: this.config.breakpoint ?? 0
|
|
4248
4355
|
}));
|
|
4249
4356
|
}
|
|
4250
4357
|
setBreakpoint(e) {
|
|
4251
|
-
this.config.breakpoint = e, this.#
|
|
4358
|
+
this.config.breakpoint = e, this.#p(this.#i);
|
|
4252
4359
|
}
|
|
4253
4360
|
setCardRenderer(e) {
|
|
4254
4361
|
this.config.cardRenderer = e, this.#t && this.requestRender();
|
|
@@ -4257,17 +4364,17 @@ class An extends A {
|
|
|
4257
4364
|
return this.#i;
|
|
4258
4365
|
}
|
|
4259
4366
|
getActiveBreakpoint() {
|
|
4260
|
-
return this.#
|
|
4367
|
+
return this.#r;
|
|
4261
4368
|
}
|
|
4262
4369
|
attach(e) {
|
|
4263
|
-
super.attach(e), this.#
|
|
4370
|
+
super.attach(e), this.#w(), this.#h(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#c = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
|
|
4264
4371
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4265
|
-
this.#i = i, clearTimeout(this.#
|
|
4266
|
-
this.#
|
|
4372
|
+
this.#i = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
4373
|
+
this.#p(i);
|
|
4267
4374
|
}, this.config.debounceMs ?? 100);
|
|
4268
4375
|
}), this.#e.observe(this.gridElement);
|
|
4269
4376
|
}
|
|
4270
|
-
#
|
|
4377
|
+
#w() {
|
|
4271
4378
|
const e = this.grid;
|
|
4272
4379
|
if (!e || typeof e.querySelector != "function") return;
|
|
4273
4380
|
const t = e.querySelector("tbw-grid-responsive-card");
|
|
@@ -4277,12 +4384,12 @@ class An extends A {
|
|
|
4277
4384
|
const u = i.__frameworkAdapter.parseResponsiveCardElement(t);
|
|
4278
4385
|
u && (this.config = { ...this.config, cardRenderer: u });
|
|
4279
4386
|
}
|
|
4280
|
-
const n = t.getAttribute("breakpoint"), r = t.getAttribute("card-row-height"), o = t.getAttribute("hidden-columns"),
|
|
4387
|
+
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 = {};
|
|
4281
4388
|
if (n !== null) {
|
|
4282
4389
|
const u = parseInt(n, 10);
|
|
4283
4390
|
isNaN(u) || (d.breakpoint = u);
|
|
4284
4391
|
}
|
|
4285
|
-
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)),
|
|
4392
|
+
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) {
|
|
4286
4393
|
const u = parseInt(l, 10);
|
|
4287
4394
|
isNaN(u) || (d.debounceMs = u);
|
|
4288
4395
|
}
|
|
@@ -4292,33 +4399,33 @@ class An extends A {
|
|
|
4292
4399
|
return f.className = "tbw-responsive-card-content", f.innerHTML = g, f;
|
|
4293
4400
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4294
4401
|
}
|
|
4295
|
-
#
|
|
4296
|
-
if (this.#
|
|
4402
|
+
#h(e) {
|
|
4403
|
+
if (this.#o.clear(), this.#d.clear(), !!e)
|
|
4297
4404
|
for (const t of e)
|
|
4298
|
-
typeof t == "string" ? this.#
|
|
4405
|
+
typeof t == "string" ? this.#o.add(t) : t.showValue ? this.#d.add(t.field) : this.#o.add(t.field);
|
|
4299
4406
|
}
|
|
4300
4407
|
detach() {
|
|
4301
|
-
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#
|
|
4408
|
+
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#s), this.#s = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4302
4409
|
}
|
|
4303
4410
|
handleQuery(e) {
|
|
4304
4411
|
if (e.type === "isCardMode")
|
|
4305
4412
|
return this.#t;
|
|
4306
4413
|
}
|
|
4307
4414
|
afterRender() {
|
|
4308
|
-
if (this.#R(), !(this.#c.length > 0 ? this.#
|
|
4415
|
+
if (this.#R(), !(this.#c.length > 0 ? this.#r !== null : this.#t))
|
|
4309
4416
|
return;
|
|
4310
|
-
const t = this.#
|
|
4417
|
+
const t = this.#o.size > 0, i = this.#d.size > 0;
|
|
4311
4418
|
if (!t && !i)
|
|
4312
4419
|
return;
|
|
4313
4420
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
4314
4421
|
for (const r of n) {
|
|
4315
4422
|
const o = r.getAttribute("data-field");
|
|
4316
|
-
o && (this.#
|
|
4423
|
+
o && (this.#o.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#d.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
|
|
4317
4424
|
}
|
|
4318
4425
|
}
|
|
4319
|
-
#
|
|
4426
|
+
#p(e) {
|
|
4320
4427
|
if (this.#c.length > 0) {
|
|
4321
|
-
this.#
|
|
4428
|
+
this.#l(e);
|
|
4322
4429
|
return;
|
|
4323
4430
|
}
|
|
4324
4431
|
const t = this.config.breakpoint ?? 0;
|
|
@@ -4326,41 +4433,41 @@ class An extends A {
|
|
|
4326
4433
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4327
4434
|
));
|
|
4328
4435
|
const i = t > 0 && e < t;
|
|
4329
|
-
i !== this.#t && (this.#t = i, this.#
|
|
4436
|
+
i !== this.#t && (this.#t = i, this.#f(), this.emit("responsive-change", {
|
|
4330
4437
|
isResponsive: i,
|
|
4331
4438
|
width: e,
|
|
4332
4439
|
breakpoint: t
|
|
4333
4440
|
}), this.requestRender());
|
|
4334
4441
|
}
|
|
4335
|
-
#
|
|
4442
|
+
#l(e) {
|
|
4336
4443
|
let t = null;
|
|
4337
4444
|
for (const n of this.#c)
|
|
4338
4445
|
e <= n.maxWidth && (t = n);
|
|
4339
|
-
if (t !== this.#
|
|
4340
|
-
this.#
|
|
4446
|
+
if (t !== this.#r) {
|
|
4447
|
+
this.#r = t, t?.hiddenColumns ? this.#h(t.hiddenColumns) : this.#h(this.config.hiddenColumns);
|
|
4341
4448
|
const n = t?.cardLayout === !0;
|
|
4342
|
-
n !== this.#t && (this.#t = n, this.#
|
|
4449
|
+
n !== this.#t && (this.#t = n, this.#f()), this.emit("responsive-change", {
|
|
4343
4450
|
isResponsive: this.#t,
|
|
4344
4451
|
width: e,
|
|
4345
4452
|
breakpoint: t?.maxWidth ?? 0
|
|
4346
4453
|
}), this.requestRender();
|
|
4347
4454
|
}
|
|
4348
4455
|
}
|
|
4349
|
-
#
|
|
4350
|
-
#
|
|
4456
|
+
#a;
|
|
4457
|
+
#f() {
|
|
4351
4458
|
this.gridElement.toggleAttribute("data-responsive", this.#t);
|
|
4352
4459
|
const e = this.config.animate !== !1;
|
|
4353
4460
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
4354
4461
|
const t = this.grid;
|
|
4355
4462
|
if (this.#t) {
|
|
4356
|
-
t._virtualization && (this.#
|
|
4463
|
+
t._virtualization && (this.#a = t._virtualization.rowHeight);
|
|
4357
4464
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
4358
4465
|
i && (i.scrollLeft = 0);
|
|
4359
4466
|
} else {
|
|
4360
4467
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
4361
4468
|
for (const n of i)
|
|
4362
4469
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
4363
|
-
this.#
|
|
4470
|
+
this.#a && this.#a > 0 && t._virtualization && (t._virtualization.rowHeight = this.#a, this.#a = void 0), this.#u = void 0, this.#g = void 0, this.#m = void 0;
|
|
4364
4471
|
}
|
|
4365
4472
|
}
|
|
4366
4473
|
renderRow(e, t, i) {
|
|
@@ -4400,17 +4507,17 @@ class An extends A {
|
|
|
4400
4507
|
}
|
|
4401
4508
|
return !1;
|
|
4402
4509
|
}
|
|
4403
|
-
#
|
|
4404
|
-
#
|
|
4405
|
-
#
|
|
4510
|
+
#u;
|
|
4511
|
+
#g;
|
|
4512
|
+
#m;
|
|
4406
4513
|
#y() {
|
|
4407
|
-
if (this.#
|
|
4408
|
-
return this.#
|
|
4514
|
+
if (this.#u && this.#u > 0)
|
|
4515
|
+
return this.#u;
|
|
4409
4516
|
const e = this.config.cardRowHeight;
|
|
4410
4517
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
4411
4518
|
}
|
|
4412
4519
|
#x() {
|
|
4413
|
-
return this.#
|
|
4520
|
+
return this.#g && this.#g > 0 ? this.#g : this.#a ?? 28;
|
|
4414
4521
|
}
|
|
4415
4522
|
#b() {
|
|
4416
4523
|
for (const e of this.rows)
|
|
@@ -4427,18 +4534,18 @@ class An extends A {
|
|
|
4427
4534
|
getExtraHeight() {
|
|
4428
4535
|
if (!this.#t || !this.config.cardRenderer || !this.#b())
|
|
4429
4536
|
return 0;
|
|
4430
|
-
const e = this.#
|
|
4431
|
-
return o +
|
|
4537
|
+
const e = this.#a ?? 28, t = this.#x(), i = this.#y(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
|
|
4538
|
+
return o + s;
|
|
4432
4539
|
}
|
|
4433
4540
|
getExtraHeightBefore(e) {
|
|
4434
4541
|
if (!this.#t || !this.config.cardRenderer || !this.#b())
|
|
4435
4542
|
return 0;
|
|
4436
|
-
const t = this.#
|
|
4437
|
-
let
|
|
4543
|
+
const t = this.#a ?? 28, i = this.#x(), n = this.#y(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
4544
|
+
let s = 0, l = 0;
|
|
4438
4545
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4439
4546
|
for (let u = 0; u < c; u++)
|
|
4440
|
-
d[u].__isGroupRow ?
|
|
4441
|
-
return
|
|
4547
|
+
d[u].__isGroupRow ? s++ : l++;
|
|
4548
|
+
return s * r + l * o;
|
|
4442
4549
|
}
|
|
4443
4550
|
#E() {
|
|
4444
4551
|
let e = 0;
|
|
@@ -4452,27 +4559,27 @@ class An extends A {
|
|
|
4452
4559
|
return;
|
|
4453
4560
|
let e = !1;
|
|
4454
4561
|
const t = this.grid, i = this.#b(), n = this.#E();
|
|
4455
|
-
if (n !== this.#
|
|
4562
|
+
if (n !== this.#m && (this.#m = n, e = !0), i) {
|
|
4456
4563
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4457
4564
|
if (o) {
|
|
4458
|
-
const
|
|
4459
|
-
|
|
4565
|
+
const s = o.getBoundingClientRect().height;
|
|
4566
|
+
s > 0 && s !== this.#g && (this.#g = s, e = !0);
|
|
4460
4567
|
}
|
|
4461
4568
|
}
|
|
4462
4569
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
4463
4570
|
if (r) {
|
|
4464
4571
|
const o = r.getBoundingClientRect().height;
|
|
4465
|
-
o > 0 && o !== this.#
|
|
4572
|
+
o > 0 && o !== this.#u && (this.#u = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
4466
4573
|
}
|
|
4467
4574
|
e && !this.#v && (this.#v = !0, queueMicrotask(() => {
|
|
4468
4575
|
this.#v = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
4469
4576
|
}));
|
|
4470
4577
|
}
|
|
4471
4578
|
}
|
|
4472
|
-
const
|
|
4473
|
-
class
|
|
4579
|
+
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";
|
|
4580
|
+
class An extends A {
|
|
4474
4581
|
name = "rowReorder";
|
|
4475
|
-
styles =
|
|
4582
|
+
styles = Wi;
|
|
4476
4583
|
get defaultConfig() {
|
|
4477
4584
|
return {
|
|
4478
4585
|
enableKeyboard: !0,
|
|
@@ -4499,7 +4606,7 @@ class _n extends A {
|
|
|
4499
4606
|
if (!this.config.showDragHandle)
|
|
4500
4607
|
return [...e];
|
|
4501
4608
|
const t = {
|
|
4502
|
-
field:
|
|
4609
|
+
field: $i,
|
|
4503
4610
|
header: "",
|
|
4504
4611
|
width: this.config.dragHandleWidth ?? 40,
|
|
4505
4612
|
resizable: !1,
|
|
@@ -4539,9 +4646,9 @@ class _n extends A {
|
|
|
4539
4646
|
if (i < 0 || i >= n.length) return;
|
|
4540
4647
|
const r = e.key === "ArrowUp" ? "up" : "down", o = r === "up" ? i - 1 : i + 1;
|
|
4541
4648
|
if (o < 0 || o >= n.length) return;
|
|
4542
|
-
const
|
|
4543
|
-
if (!(this.config.canMove && !this.config.canMove(
|
|
4544
|
-
return this.handleKeyboardMove(
|
|
4649
|
+
const s = n[i];
|
|
4650
|
+
if (!(this.config.canMove && !this.config.canMove(s, i, o, r)))
|
|
4651
|
+
return this.handleKeyboardMove(s, i, o, r, t._focusCol), e.preventDefault(), e.stopPropagation(), !0;
|
|
4545
4652
|
}
|
|
4546
4653
|
onCellClick() {
|
|
4547
4654
|
this.flushPendingMove();
|
|
@@ -4581,8 +4688,8 @@ class _n extends A {
|
|
|
4581
4688
|
const i = this.draggedRowIndex;
|
|
4582
4689
|
let n = this.dropRowIndex;
|
|
4583
4690
|
if (!(!this.isDragging || i === null || n === null) && (n > i && n--, i !== n)) {
|
|
4584
|
-
const o = this.sourceRows[i],
|
|
4585
|
-
(!this.config.canMove || this.config.canMove(o, i, n,
|
|
4691
|
+
const o = this.sourceRows[i], s = n < i ? "up" : "down";
|
|
4692
|
+
(!this.config.canMove || this.config.canMove(o, i, n, s)) && this.executeMove(o, i, n, "drag");
|
|
4586
4693
|
}
|
|
4587
4694
|
});
|
|
4588
4695
|
}
|
|
@@ -4592,8 +4699,8 @@ class _n extends A {
|
|
|
4592
4699
|
currentIndex: i,
|
|
4593
4700
|
row: e
|
|
4594
4701
|
}, this.lastFocusCol = r;
|
|
4595
|
-
const o = this.grid,
|
|
4596
|
-
|
|
4702
|
+
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
|
|
4703
|
+
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), D(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
4597
4704
|
this.flushPendingMove();
|
|
4598
4705
|
}, this.config.debounceMs ?? 300);
|
|
4599
4706
|
}
|
|
@@ -4609,8 +4716,8 @@ class _n extends A {
|
|
|
4609
4716
|
source: "keyboard"
|
|
4610
4717
|
};
|
|
4611
4718
|
if (this.emitCancelable("row-move", n)) {
|
|
4612
|
-
const o = [...this.sourceRows], [
|
|
4613
|
-
o.splice(e, 0,
|
|
4719
|
+
const o = [...this.sourceRows], [s] = o.splice(t, 1);
|
|
4720
|
+
o.splice(e, 0, s);
|
|
4614
4721
|
const l = this.grid;
|
|
4615
4722
|
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), D(l);
|
|
4616
4723
|
}
|
|
@@ -4618,14 +4725,14 @@ class _n extends A {
|
|
|
4618
4725
|
executeMove(e, t, i, n) {
|
|
4619
4726
|
const r = [...this.sourceRows], [o] = r.splice(t, 1);
|
|
4620
4727
|
r.splice(i, 0, o);
|
|
4621
|
-
const
|
|
4728
|
+
const s = {
|
|
4622
4729
|
row: e,
|
|
4623
4730
|
fromIndex: t,
|
|
4624
4731
|
toIndex: i,
|
|
4625
4732
|
rows: r,
|
|
4626
4733
|
source: n
|
|
4627
4734
|
};
|
|
4628
|
-
if (!this.emitCancelable("row-move",
|
|
4735
|
+
if (!this.emitCancelable("row-move", s))
|
|
4629
4736
|
if (this.animationType === "flip" && this.gridElement) {
|
|
4630
4737
|
const d = this.captureRowPositions();
|
|
4631
4738
|
this.grid.rows = r, requestAnimationFrame(() => {
|
|
@@ -4644,7 +4751,7 @@ class _n extends A {
|
|
|
4644
4751
|
animateFLIP(e, t, i) {
|
|
4645
4752
|
const n = this.gridElement;
|
|
4646
4753
|
if (!n || e.size === 0) return;
|
|
4647
|
-
const r = Math.min(t, i), o = Math.max(t, i),
|
|
4754
|
+
const r = Math.min(t, i), o = Math.max(t, i), s = [];
|
|
4648
4755
|
if (n.querySelectorAll(".data-grid-row").forEach((d) => {
|
|
4649
4756
|
const c = d, u = this.getRowIndex(c);
|
|
4650
4757
|
if (u < 0 || u < r || u > o) return;
|
|
@@ -4653,17 +4760,17 @@ class _n extends A {
|
|
|
4653
4760
|
const g = e.get(h);
|
|
4654
4761
|
if (g === void 0) return;
|
|
4655
4762
|
const f = c.getBoundingClientRect().top, p = g - f;
|
|
4656
|
-
Math.abs(p) > 1 &&
|
|
4657
|
-
}),
|
|
4658
|
-
|
|
4763
|
+
Math.abs(p) > 1 && s.push({ el: c, deltaY: p });
|
|
4764
|
+
}), s.length === 0) return;
|
|
4765
|
+
s.forEach(({ el: d, deltaY: c }) => {
|
|
4659
4766
|
d.style.transform = `translateY(${c}px)`;
|
|
4660
4767
|
}), n.offsetHeight;
|
|
4661
4768
|
const l = this.animationDuration;
|
|
4662
4769
|
requestAnimationFrame(() => {
|
|
4663
|
-
|
|
4770
|
+
s.forEach(({ el: d }) => {
|
|
4664
4771
|
d.classList.add("flip-animating"), d.style.transform = "";
|
|
4665
4772
|
}), setTimeout(() => {
|
|
4666
|
-
|
|
4773
|
+
s.forEach(({ el: d }) => {
|
|
4667
4774
|
d.style.transform = "", d.classList.remove("flip-animating");
|
|
4668
4775
|
});
|
|
4669
4776
|
}, l + 50);
|
|
@@ -4682,62 +4789,62 @@ class _n extends A {
|
|
|
4682
4789
|
this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
|
|
4683
4790
|
}
|
|
4684
4791
|
}
|
|
4685
|
-
function V(
|
|
4792
|
+
function V(a) {
|
|
4686
4793
|
return {
|
|
4687
|
-
startRow: Math.min(
|
|
4688
|
-
startCol: Math.min(
|
|
4689
|
-
endRow: Math.max(
|
|
4690
|
-
endCol: Math.max(
|
|
4794
|
+
startRow: Math.min(a.startRow, a.endRow),
|
|
4795
|
+
startCol: Math.min(a.startCol, a.endCol),
|
|
4796
|
+
endRow: Math.max(a.startRow, a.endRow),
|
|
4797
|
+
endCol: Math.max(a.startCol, a.endCol)
|
|
4691
4798
|
};
|
|
4692
4799
|
}
|
|
4693
|
-
function
|
|
4694
|
-
const e = V(
|
|
4800
|
+
function ji(a) {
|
|
4801
|
+
const e = V(a);
|
|
4695
4802
|
return {
|
|
4696
4803
|
from: { row: e.startRow, col: e.startCol },
|
|
4697
4804
|
to: { row: e.endRow, col: e.endCol }
|
|
4698
4805
|
};
|
|
4699
4806
|
}
|
|
4700
|
-
function lt(
|
|
4701
|
-
return
|
|
4807
|
+
function lt(a) {
|
|
4808
|
+
return a.map(ji);
|
|
4702
4809
|
}
|
|
4703
|
-
function
|
|
4810
|
+
function Ui(a, e, t) {
|
|
4704
4811
|
const i = V(t);
|
|
4705
|
-
return
|
|
4812
|
+
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4706
4813
|
}
|
|
4707
|
-
function je(
|
|
4708
|
-
return t.some((i) =>
|
|
4814
|
+
function je(a, e, t) {
|
|
4815
|
+
return t.some((i) => Ui(a, e, i));
|
|
4709
4816
|
}
|
|
4710
|
-
function
|
|
4711
|
-
const e = [], t = V(
|
|
4817
|
+
function Yi(a) {
|
|
4818
|
+
const e = [], t = V(a);
|
|
4712
4819
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4713
4820
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4714
4821
|
e.push({ row: i, col: n });
|
|
4715
4822
|
return e;
|
|
4716
4823
|
}
|
|
4717
|
-
function
|
|
4824
|
+
function Xi(a) {
|
|
4718
4825
|
const e = /* @__PURE__ */ new Map();
|
|
4719
|
-
for (const t of
|
|
4720
|
-
for (const i of
|
|
4826
|
+
for (const t of a)
|
|
4827
|
+
for (const i of Yi(t))
|
|
4721
4828
|
e.set(`${i.row},${i.col}`, i);
|
|
4722
4829
|
return [...e.values()];
|
|
4723
4830
|
}
|
|
4724
|
-
function de(
|
|
4831
|
+
function de(a, e) {
|
|
4725
4832
|
return {
|
|
4726
|
-
startRow:
|
|
4727
|
-
startCol:
|
|
4833
|
+
startRow: a.row,
|
|
4834
|
+
startCol: a.col,
|
|
4728
4835
|
endRow: e.row,
|
|
4729
4836
|
endCol: e.col
|
|
4730
4837
|
};
|
|
4731
4838
|
}
|
|
4732
|
-
function Z(
|
|
4733
|
-
const t = V(
|
|
4839
|
+
function Z(a, e) {
|
|
4840
|
+
const t = V(a), i = V(e);
|
|
4734
4841
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4735
4842
|
}
|
|
4736
|
-
const
|
|
4737
|
-
function
|
|
4738
|
-
if (
|
|
4843
|
+
const Zi = "@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%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.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}}}";
|
|
4844
|
+
function Qi(a, e, t) {
|
|
4845
|
+
if (a === "cell" && e.selectedCell)
|
|
4739
4846
|
return {
|
|
4740
|
-
mode:
|
|
4847
|
+
mode: a,
|
|
4741
4848
|
ranges: [
|
|
4742
4849
|
{
|
|
4743
4850
|
from: { row: e.selectedCell.row, col: e.selectedCell.col },
|
|
@@ -4745,16 +4852,16 @@ function Ji(s, e, t) {
|
|
|
4745
4852
|
}
|
|
4746
4853
|
]
|
|
4747
4854
|
};
|
|
4748
|
-
if (
|
|
4855
|
+
if (a === "row" && e.selected.size > 0) {
|
|
4749
4856
|
const i = [...e.selected].map((n) => ({
|
|
4750
4857
|
from: { row: n, col: 0 },
|
|
4751
4858
|
to: { row: n, col: t - 1 }
|
|
4752
4859
|
}));
|
|
4753
|
-
return { mode:
|
|
4860
|
+
return { mode: a, ranges: i };
|
|
4754
4861
|
}
|
|
4755
|
-
return
|
|
4862
|
+
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: lt(e.ranges) } : { mode: a, ranges: [] };
|
|
4756
4863
|
}
|
|
4757
|
-
class
|
|
4864
|
+
class _n extends A {
|
|
4758
4865
|
static manifest = {
|
|
4759
4866
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
4760
4867
|
configRules: [
|
|
@@ -4769,7 +4876,7 @@ class Tn extends A {
|
|
|
4769
4876
|
]
|
|
4770
4877
|
};
|
|
4771
4878
|
name = "selection";
|
|
4772
|
-
styles =
|
|
4879
|
+
styles = Zi;
|
|
4773
4880
|
get defaultConfig() {
|
|
4774
4881
|
return {
|
|
4775
4882
|
mode: "cell",
|
|
@@ -4821,7 +4928,7 @@ class Tn extends A {
|
|
|
4821
4928
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4822
4929
|
if (n.type !== o)
|
|
4823
4930
|
return !1;
|
|
4824
|
-
const
|
|
4931
|
+
const s = this.columns[i], l = s && q(s);
|
|
4825
4932
|
if (r === "cell") {
|
|
4826
4933
|
if (l || !this.isCellSelectable(t, i))
|
|
4827
4934
|
return !1;
|
|
@@ -4885,13 +4992,13 @@ class Tn extends A {
|
|
|
4885
4992
|
const r = this.rows.length, o = this.columns.length;
|
|
4886
4993
|
if (r > 0 && o > 0) {
|
|
4887
4994
|
e.preventDefault(), e.stopPropagation();
|
|
4888
|
-
const
|
|
4995
|
+
const s = {
|
|
4889
4996
|
startRow: 0,
|
|
4890
4997
|
startCol: 0,
|
|
4891
4998
|
endRow: r - 1,
|
|
4892
4999
|
endCol: o - 1
|
|
4893
5000
|
};
|
|
4894
|
-
return this.ranges = [
|
|
5001
|
+
return this.ranges = [s], this.activeRange = s, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
|
|
4895
5002
|
}
|
|
4896
5003
|
}
|
|
4897
5004
|
return !1;
|
|
@@ -4915,7 +5022,7 @@ class Tn extends A {
|
|
|
4915
5022
|
let t = e.colIndex;
|
|
4916
5023
|
const i = this.columns[t];
|
|
4917
5024
|
if (i && q(i)) {
|
|
4918
|
-
const o = this.columns.findIndex((
|
|
5025
|
+
const o = this.columns.findIndex((s) => !q(s));
|
|
4919
5026
|
o >= 0 && (t = o);
|
|
4920
5027
|
}
|
|
4921
5028
|
const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
@@ -4936,14 +5043,14 @@ class Tn extends A {
|
|
|
4936
5043
|
if (r.forEach((o) => {
|
|
4937
5044
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4938
5045
|
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
4939
|
-
const
|
|
5046
|
+
const s = o.querySelector(".cell[data-row]"), l = pt(s);
|
|
4940
5047
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4941
|
-
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((
|
|
4942
|
-
const l = parseInt(
|
|
4943
|
-
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) ||
|
|
5048
|
+
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5049
|
+
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
5050
|
+
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
|
|
4944
5051
|
}), t === "range" && this.ranges.length > 0) {
|
|
4945
5052
|
xe(e);
|
|
4946
|
-
const o = this.activeRange ? V(this.activeRange) : null,
|
|
5053
|
+
const o = this.activeRange ? V(this.activeRange) : null, s = this.columns.findIndex((d) => !q(d));
|
|
4947
5054
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4948
5055
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4949
5056
|
if (c >= 0 && u >= 0) {
|
|
@@ -4952,7 +5059,7 @@ class Tn extends A {
|
|
|
4952
5059
|
return;
|
|
4953
5060
|
if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4954
5061
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4955
|
-
const f = Math.max(o.startCol,
|
|
5062
|
+
const f = Math.max(o.startCol, s);
|
|
4956
5063
|
u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
4957
5064
|
}
|
|
4958
5065
|
}
|
|
@@ -4969,8 +5076,8 @@ class Tn extends A {
|
|
|
4969
5076
|
this.pendingKeyboardUpdate = null;
|
|
4970
5077
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4971
5078
|
if (n && this.cellAnchor) {
|
|
4972
|
-
const
|
|
4973
|
-
this.ranges = [
|
|
5079
|
+
const s = de(this.cellAnchor, { row: r, col: o });
|
|
5080
|
+
this.ranges = [s], this.activeRange = s;
|
|
4974
5081
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
4975
5082
|
this.emit("selection-change", this.#t());
|
|
4976
5083
|
}
|
|
@@ -4987,7 +5094,7 @@ class Tn extends A {
|
|
|
4987
5094
|
};
|
|
4988
5095
|
}
|
|
4989
5096
|
getSelectedCells() {
|
|
4990
|
-
return
|
|
5097
|
+
return Xi(this.ranges);
|
|
4991
5098
|
}
|
|
4992
5099
|
isCellSelected(e, t) {
|
|
4993
5100
|
return je(e, t, this.ranges);
|
|
@@ -5007,7 +5114,7 @@ class Tn extends A {
|
|
|
5007
5114
|
}), this.requestAfterRender();
|
|
5008
5115
|
}
|
|
5009
5116
|
#t() {
|
|
5010
|
-
return
|
|
5117
|
+
return Qi(
|
|
5011
5118
|
this.config.mode,
|
|
5012
5119
|
{
|
|
5013
5120
|
selectedCell: this.selectedCell,
|
|
@@ -5018,38 +5125,38 @@ class Tn extends A {
|
|
|
5018
5125
|
);
|
|
5019
5126
|
}
|
|
5020
5127
|
}
|
|
5021
|
-
function J(
|
|
5022
|
-
return Math.floor(
|
|
5128
|
+
function J(a, e) {
|
|
5129
|
+
return Math.floor(a / e);
|
|
5023
5130
|
}
|
|
5024
|
-
function
|
|
5131
|
+
function Ji(a, e) {
|
|
5025
5132
|
return {
|
|
5026
|
-
start:
|
|
5027
|
-
end: (
|
|
5133
|
+
start: a * e,
|
|
5134
|
+
end: (a + 1) * e
|
|
5028
5135
|
};
|
|
5029
5136
|
}
|
|
5030
|
-
function
|
|
5031
|
-
const i = J(
|
|
5137
|
+
function en(a, e, t) {
|
|
5138
|
+
const i = J(a, t), n = J(e - 1, t), r = [];
|
|
5032
5139
|
for (let o = i; o <= n; o++)
|
|
5033
5140
|
r.push(o);
|
|
5034
5141
|
return r;
|
|
5035
5142
|
}
|
|
5036
|
-
async function Ue(
|
|
5037
|
-
const n =
|
|
5038
|
-
return
|
|
5143
|
+
async function Ue(a, e, t, i) {
|
|
5144
|
+
const n = Ji(e, t);
|
|
5145
|
+
return a.getRows({
|
|
5039
5146
|
startRow: n.start,
|
|
5040
5147
|
endRow: n.end,
|
|
5041
5148
|
sortModel: i.sortModel,
|
|
5042
5149
|
filterModel: i.filterModel
|
|
5043
5150
|
});
|
|
5044
5151
|
}
|
|
5045
|
-
function
|
|
5046
|
-
const i = J(
|
|
5152
|
+
function tn(a, e, t) {
|
|
5153
|
+
const i = J(a, e), n = t.get(i);
|
|
5047
5154
|
if (!n) return;
|
|
5048
|
-
const r =
|
|
5155
|
+
const r = a % e;
|
|
5049
5156
|
return n[r];
|
|
5050
5157
|
}
|
|
5051
|
-
const
|
|
5052
|
-
class
|
|
5158
|
+
const nn = 100;
|
|
5159
|
+
class Tn extends A {
|
|
5053
5160
|
name = "serverSide";
|
|
5054
5161
|
get defaultConfig() {
|
|
5055
5162
|
return {
|
|
@@ -5069,7 +5176,7 @@ class Ln extends A {
|
|
|
5069
5176
|
}
|
|
5070
5177
|
loadRequiredBlocks() {
|
|
5071
5178
|
if (!this.dataSource) return;
|
|
5072
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
5179
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = en(i.startRow, i.endRow, t);
|
|
5073
5180
|
for (const r of n)
|
|
5074
5181
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
5075
5182
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
@@ -5085,7 +5192,7 @@ class Ln extends A {
|
|
|
5085
5192
|
if (!this.dataSource) return [...e];
|
|
5086
5193
|
const t = [];
|
|
5087
5194
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
5088
|
-
const n =
|
|
5195
|
+
const n = tn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
5089
5196
|
t.push(n ?? { __loading: !0, __index: i });
|
|
5090
5197
|
}
|
|
5091
5198
|
return t;
|
|
@@ -5093,7 +5200,7 @@ class Ln extends A {
|
|
|
5093
5200
|
onScroll(e) {
|
|
5094
5201
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
5095
5202
|
this.loadRequiredBlocks();
|
|
5096
|
-
},
|
|
5203
|
+
}, nn));
|
|
5097
5204
|
}
|
|
5098
5205
|
setDataSource(e) {
|
|
5099
5206
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
@@ -5119,17 +5226,17 @@ class Ln extends A {
|
|
|
5119
5226
|
return this.loadedBlocks.size;
|
|
5120
5227
|
}
|
|
5121
5228
|
}
|
|
5122
|
-
function dt(
|
|
5123
|
-
return
|
|
5229
|
+
function dt(a, e, t) {
|
|
5230
|
+
return a.id !== void 0 ? String(a.id) : t ? `${t}-${e}` : String(e);
|
|
5124
5231
|
}
|
|
5125
|
-
function ce(
|
|
5126
|
-
const t = new Set(
|
|
5232
|
+
function ce(a, e) {
|
|
5233
|
+
const t = new Set(a);
|
|
5127
5234
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5128
5235
|
}
|
|
5129
|
-
function fe(
|
|
5236
|
+
function fe(a, e, t = null, i = 0) {
|
|
5130
5237
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5131
|
-
for (let o = 0; o <
|
|
5132
|
-
const
|
|
5238
|
+
for (let o = 0; o < a.length; o++) {
|
|
5239
|
+
const s = a[o], l = dt(s, o, t), d = s[n];
|
|
5133
5240
|
if (Array.isArray(d) && d.length > 0) {
|
|
5134
5241
|
r.add(l);
|
|
5135
5242
|
const c = fe(d, e, l, i + 1);
|
|
@@ -5138,16 +5245,16 @@ function fe(s, e, t = null, i = 0) {
|
|
|
5138
5245
|
}
|
|
5139
5246
|
return r;
|
|
5140
5247
|
}
|
|
5141
|
-
function
|
|
5248
|
+
function rn() {
|
|
5142
5249
|
return /* @__PURE__ */ new Set();
|
|
5143
5250
|
}
|
|
5144
|
-
function ct(
|
|
5251
|
+
function ct(a, e, t, i = null, n = 0) {
|
|
5145
5252
|
const r = t.childrenField ?? "children";
|
|
5146
|
-
for (let o = 0; o <
|
|
5147
|
-
const
|
|
5253
|
+
for (let o = 0; o < a.length; o++) {
|
|
5254
|
+
const s = a[o], l = dt(s, o, i);
|
|
5148
5255
|
if (l === e)
|
|
5149
5256
|
return [l];
|
|
5150
|
-
const d =
|
|
5257
|
+
const d = s[r];
|
|
5151
5258
|
if (Array.isArray(d) && d.length > 0) {
|
|
5152
5259
|
const c = ct(d, e, t, l, n + 1);
|
|
5153
5260
|
if (c)
|
|
@@ -5156,17 +5263,17 @@ function ct(s, e, t, i = null, n = 0) {
|
|
|
5156
5263
|
}
|
|
5157
5264
|
return null;
|
|
5158
5265
|
}
|
|
5159
|
-
function
|
|
5160
|
-
const n = ct(
|
|
5266
|
+
function on(a, e, t, i) {
|
|
5267
|
+
const n = ct(a, e, t);
|
|
5161
5268
|
if (!n) return i;
|
|
5162
5269
|
const r = new Set(i);
|
|
5163
5270
|
for (let o = 0; o < n.length - 1; o++)
|
|
5164
5271
|
r.add(n[o]);
|
|
5165
5272
|
return r;
|
|
5166
5273
|
}
|
|
5167
|
-
function Ye(
|
|
5168
|
-
if (!Array.isArray(
|
|
5169
|
-
for (const t of
|
|
5274
|
+
function Ye(a, e = "children") {
|
|
5275
|
+
if (!Array.isArray(a) || a.length === 0) return !1;
|
|
5276
|
+
for (const t of a) {
|
|
5170
5277
|
if (!t) continue;
|
|
5171
5278
|
const i = t[e];
|
|
5172
5279
|
if (Array.isArray(i) && i.length > 0)
|
|
@@ -5174,10 +5281,10 @@ function Ye(s, e = "children") {
|
|
|
5174
5281
|
}
|
|
5175
5282
|
return !1;
|
|
5176
5283
|
}
|
|
5177
|
-
function
|
|
5178
|
-
if (!Array.isArray(
|
|
5284
|
+
function sn(a) {
|
|
5285
|
+
if (!Array.isArray(a) || a.length === 0) return null;
|
|
5179
5286
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
5180
|
-
for (const t of
|
|
5287
|
+
for (const t of a)
|
|
5181
5288
|
if (!(!t || typeof t != "object"))
|
|
5182
5289
|
for (const i of e) {
|
|
5183
5290
|
const n = t[i];
|
|
@@ -5186,8 +5293,8 @@ function an(s) {
|
|
|
5186
5293
|
}
|
|
5187
5294
|
return null;
|
|
5188
5295
|
}
|
|
5189
|
-
const
|
|
5190
|
-
class
|
|
5296
|
+
const an = "@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}}}";
|
|
5297
|
+
class Ln extends A {
|
|
5191
5298
|
static manifest = {
|
|
5192
5299
|
events: [
|
|
5193
5300
|
{
|
|
@@ -5203,7 +5310,7 @@ class Fn extends A {
|
|
|
5203
5310
|
]
|
|
5204
5311
|
};
|
|
5205
5312
|
name = "tree";
|
|
5206
|
-
styles =
|
|
5313
|
+
styles = an;
|
|
5207
5314
|
get defaultConfig() {
|
|
5208
5315
|
return {
|
|
5209
5316
|
childrenField: "children",
|
|
@@ -5236,7 +5343,7 @@ class Fn extends A {
|
|
|
5236
5343
|
}
|
|
5237
5344
|
detect(e) {
|
|
5238
5345
|
if (!this.config.autoDetect) return !1;
|
|
5239
|
-
const t = e, i = this.config.childrenField ??
|
|
5346
|
+
const t = e, i = this.config.childrenField ?? sn(t) ?? "children";
|
|
5240
5347
|
return Ye(t, i);
|
|
5241
5348
|
}
|
|
5242
5349
|
processRows(e) {
|
|
@@ -5259,11 +5366,11 @@ class Fn extends A {
|
|
|
5259
5366
|
withStableKeys(e, t = null) {
|
|
5260
5367
|
const i = this.config.childrenField ?? "children";
|
|
5261
5368
|
return e.map((n, r) => {
|
|
5262
|
-
const o = n.__stableKey,
|
|
5369
|
+
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;
|
|
5263
5370
|
return {
|
|
5264
5371
|
...n,
|
|
5265
|
-
__stableKey:
|
|
5266
|
-
...d ? { [i]: this.withStableKeys(l,
|
|
5372
|
+
__stableKey: s,
|
|
5373
|
+
...d ? { [i]: this.withStableKeys(l, s) } : {}
|
|
5267
5374
|
};
|
|
5268
5375
|
});
|
|
5269
5376
|
}
|
|
@@ -5284,24 +5391,24 @@ class Fn extends A {
|
|
|
5284
5391
|
}
|
|
5285
5392
|
sortTree(e, t, i) {
|
|
5286
5393
|
const n = this.config.childrenField ?? "children";
|
|
5287
|
-
return [...e].sort((o,
|
|
5288
|
-
const l = o[t], d =
|
|
5394
|
+
return [...e].sort((o, s) => {
|
|
5395
|
+
const l = o[t], d = s[t];
|
|
5289
5396
|
return l == null && d == null ? 0 : l == null ? -1 : d == null ? 1 : l > d ? i : l < d ? -i : 0;
|
|
5290
5397
|
}).map((o) => {
|
|
5291
|
-
const
|
|
5292
|
-
return Array.isArray(
|
|
5398
|
+
const s = o[n];
|
|
5399
|
+
return Array.isArray(s) && s.length > 0 ? { ...o, [n]: this.sortTree(s, t, i) } : o;
|
|
5293
5400
|
});
|
|
5294
5401
|
}
|
|
5295
5402
|
processColumns(e) {
|
|
5296
5403
|
if (this.flattenedRows.length === 0) return [...e];
|
|
5297
5404
|
const t = [...e];
|
|
5298
5405
|
if (t.length === 0) return t;
|
|
5299
|
-
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this),
|
|
5406
|
+
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), s = this.resolveIcon.bind(this), l = (d) => {
|
|
5300
5407
|
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, w = document.createElement("span");
|
|
5301
5408
|
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), g !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${g}px`), h)
|
|
5302
5409
|
if (f.__treeHasChildren) {
|
|
5303
5410
|
const v = document.createElement("span");
|
|
5304
|
-
v.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(v,
|
|
5411
|
+
v.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(v, s(f.__treeExpanded ? "collapse" : "expand")), v.setAttribute("data-tree-key", String(f.__treeKey ?? "")), w.appendChild(v);
|
|
5305
5412
|
} else {
|
|
5306
5413
|
const v = document.createElement("span");
|
|
5307
5414
|
v.className = "tree-spacer", w.appendChild(v);
|
|
@@ -5354,8 +5461,8 @@ class Fn extends A {
|
|
|
5354
5461
|
if (!t) return;
|
|
5355
5462
|
const i = e === "fade" ? "tbw-tree-fade-in" : "tbw-tree-slide-in";
|
|
5356
5463
|
for (const n of t.querySelectorAll(".data-grid-row")) {
|
|
5357
|
-
const r = n.querySelector(".cell[data-row]"), o = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1,
|
|
5358
|
-
|
|
5464
|
+
const r = n.querySelector(".cell[data-row]"), o = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1, s = this.flattenedRows[o]?.key;
|
|
5465
|
+
s && this.keysToAnimate.has(s) && (n.classList.add(i), n.addEventListener("animationend", () => n.classList.remove(i), { once: !0 }));
|
|
5359
5466
|
}
|
|
5360
5467
|
this.keysToAnimate.clear();
|
|
5361
5468
|
}
|
|
@@ -5372,7 +5479,7 @@ class Fn extends A {
|
|
|
5372
5479
|
this.expandedKeys = fe(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5373
5480
|
}
|
|
5374
5481
|
collapseAll() {
|
|
5375
|
-
this.expandedKeys =
|
|
5482
|
+
this.expandedKeys = rn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5376
5483
|
}
|
|
5377
5484
|
isExpanded(e) {
|
|
5378
5485
|
return this.expandedKeys.has(e);
|
|
@@ -5387,11 +5494,11 @@ class Fn extends A {
|
|
|
5387
5494
|
return this.rowKeyMap.get(e)?.data;
|
|
5388
5495
|
}
|
|
5389
5496
|
expandToKey(e) {
|
|
5390
|
-
this.expandedKeys =
|
|
5497
|
+
this.expandedKeys = on(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5391
5498
|
}
|
|
5392
5499
|
}
|
|
5393
|
-
function
|
|
5394
|
-
const i = [...
|
|
5500
|
+
function ln(a, e, t) {
|
|
5501
|
+
const i = [...a.undoStack, e];
|
|
5395
5502
|
for (; i.length > t; )
|
|
5396
5503
|
i.shift();
|
|
5397
5504
|
return {
|
|
@@ -5399,43 +5506,43 @@ function dn(s, e, t) {
|
|
|
5399
5506
|
redoStack: []
|
|
5400
5507
|
};
|
|
5401
5508
|
}
|
|
5402
|
-
function Xe(
|
|
5403
|
-
if (
|
|
5404
|
-
return { newState:
|
|
5405
|
-
const e = [...
|
|
5509
|
+
function Xe(a) {
|
|
5510
|
+
if (a.undoStack.length === 0)
|
|
5511
|
+
return { newState: a, action: null };
|
|
5512
|
+
const e = [...a.undoStack], t = e.pop();
|
|
5406
5513
|
return t ? {
|
|
5407
5514
|
newState: {
|
|
5408
5515
|
undoStack: e,
|
|
5409
|
-
redoStack: [...
|
|
5516
|
+
redoStack: [...a.redoStack, t]
|
|
5410
5517
|
},
|
|
5411
5518
|
action: t
|
|
5412
|
-
} : { newState:
|
|
5519
|
+
} : { newState: a, action: null };
|
|
5413
5520
|
}
|
|
5414
|
-
function Ze(
|
|
5415
|
-
if (
|
|
5416
|
-
return { newState:
|
|
5417
|
-
const e = [...
|
|
5521
|
+
function Ze(a) {
|
|
5522
|
+
if (a.redoStack.length === 0)
|
|
5523
|
+
return { newState: a, action: null };
|
|
5524
|
+
const e = [...a.redoStack], t = e.pop();
|
|
5418
5525
|
return t ? {
|
|
5419
5526
|
newState: {
|
|
5420
|
-
undoStack: [...
|
|
5527
|
+
undoStack: [...a.undoStack, t],
|
|
5421
5528
|
redoStack: e
|
|
5422
5529
|
},
|
|
5423
5530
|
action: t
|
|
5424
|
-
} : { newState:
|
|
5531
|
+
} : { newState: a, action: null };
|
|
5425
5532
|
}
|
|
5426
|
-
function
|
|
5427
|
-
return
|
|
5533
|
+
function dn(a) {
|
|
5534
|
+
return a.undoStack.length > 0;
|
|
5428
5535
|
}
|
|
5429
|
-
function
|
|
5430
|
-
return
|
|
5536
|
+
function cn(a) {
|
|
5537
|
+
return a.redoStack.length > 0;
|
|
5431
5538
|
}
|
|
5432
|
-
function
|
|
5539
|
+
function un() {
|
|
5433
5540
|
return { undoStack: [], redoStack: [] };
|
|
5434
5541
|
}
|
|
5435
|
-
function
|
|
5542
|
+
function hn(a, e, t, i) {
|
|
5436
5543
|
return {
|
|
5437
5544
|
type: "cell-edit",
|
|
5438
|
-
rowIndex:
|
|
5545
|
+
rowIndex: a,
|
|
5439
5546
|
field: e,
|
|
5440
5547
|
oldValue: t,
|
|
5441
5548
|
newValue: i,
|
|
@@ -5492,7 +5599,7 @@ class In extends A {
|
|
|
5492
5599
|
return !1;
|
|
5493
5600
|
}
|
|
5494
5601
|
recordEdit(e, t, i, n) {
|
|
5495
|
-
const r =
|
|
5602
|
+
const r = hn(e, t, i, n), o = ln(
|
|
5496
5603
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5497
5604
|
r,
|
|
5498
5605
|
this.config.maxHistorySize ?? 100
|
|
@@ -5516,13 +5623,13 @@ class In extends A {
|
|
|
5516
5623
|
return e.action;
|
|
5517
5624
|
}
|
|
5518
5625
|
canUndo() {
|
|
5519
|
-
return
|
|
5626
|
+
return dn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5520
5627
|
}
|
|
5521
5628
|
canRedo() {
|
|
5522
|
-
return
|
|
5629
|
+
return cn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5523
5630
|
}
|
|
5524
5631
|
clearHistory() {
|
|
5525
|
-
const e =
|
|
5632
|
+
const e = un();
|
|
5526
5633
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5527
5634
|
}
|
|
5528
5635
|
getUndoStack() {
|
|
@@ -5532,9 +5639,9 @@ class In extends A {
|
|
|
5532
5639
|
return [...this.redoStack];
|
|
5533
5640
|
}
|
|
5534
5641
|
}
|
|
5535
|
-
const
|
|
5536
|
-
function Qe(
|
|
5537
|
-
const e =
|
|
5642
|
+
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))}}';
|
|
5643
|
+
function Qe(a) {
|
|
5644
|
+
const e = a.meta ?? {};
|
|
5538
5645
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5539
5646
|
}
|
|
5540
5647
|
class B extends A {
|
|
@@ -5543,7 +5650,7 @@ class B extends A {
|
|
|
5543
5650
|
];
|
|
5544
5651
|
name = "visibility";
|
|
5545
5652
|
static PANEL_ID = "columns";
|
|
5546
|
-
styles =
|
|
5653
|
+
styles = gn;
|
|
5547
5654
|
get defaultConfig() {
|
|
5548
5655
|
return {
|
|
5549
5656
|
allowHideAll: !1
|
|
@@ -5632,8 +5739,8 @@ class B extends A {
|
|
|
5632
5739
|
e.innerHTML = "";
|
|
5633
5740
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5634
5741
|
for (let n = 0; n < i.length; n++) {
|
|
5635
|
-
const r = i[n], o = r.header || r.field,
|
|
5636
|
-
|
|
5742
|
+
const r = i[n], o = r.header || r.field, s = document.createElement("div");
|
|
5743
|
+
s.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", s.setAttribute("data-field", r.field), s.setAttribute("data-index", String(n)), t && Qe(r) && (s.draggable = !0, s.classList.add("reorderable"), this.setupDragListeners(s, r.field, n, e));
|
|
5637
5744
|
const l = document.createElement("label");
|
|
5638
5745
|
l.className = "tbw-visibility-label";
|
|
5639
5746
|
const d = document.createElement("input");
|
|
@@ -5643,9 +5750,9 @@ class B extends A {
|
|
|
5643
5750
|
const c = document.createElement("span");
|
|
5644
5751
|
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Qe(r)) {
|
|
5645
5752
|
const u = document.createElement("span");
|
|
5646
|
-
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder",
|
|
5753
|
+
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", s.appendChild(u);
|
|
5647
5754
|
}
|
|
5648
|
-
|
|
5755
|
+
s.appendChild(l), e.appendChild(s);
|
|
5649
5756
|
}
|
|
5650
5757
|
}
|
|
5651
5758
|
setupDragListeners(e, t, i, n) {
|
|
@@ -5655,22 +5762,22 @@ class B extends A {
|
|
|
5655
5762
|
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses(n);
|
|
5656
5763
|
}), e.addEventListener("dragover", (r) => {
|
|
5657
5764
|
if (r.preventDefault(), !this.isDragging || this.draggedField === t) return;
|
|
5658
|
-
const o = e.getBoundingClientRect(),
|
|
5659
|
-
this.dropIndex = r.clientY <
|
|
5765
|
+
const o = e.getBoundingClientRect(), s = o.top + o.height / 2;
|
|
5766
|
+
this.dropIndex = r.clientY < s ? i : i + 1, n.querySelectorAll(".tbw-visibility-row").forEach((l) => {
|
|
5660
5767
|
l !== e && l.classList.remove("drop-target", "drop-before", "drop-after");
|
|
5661
|
-
}), e.classList.add("drop-target"), e.classList.toggle("drop-before", r.clientY <
|
|
5768
|
+
}), e.classList.add("drop-target"), e.classList.toggle("drop-before", r.clientY < s), e.classList.toggle("drop-after", r.clientY >= s);
|
|
5662
5769
|
}), e.addEventListener("dragleave", () => {
|
|
5663
5770
|
e.classList.remove("drop-target", "drop-before", "drop-after");
|
|
5664
5771
|
}), e.addEventListener("drop", (r) => {
|
|
5665
5772
|
r.preventDefault();
|
|
5666
|
-
const o = this.draggedField,
|
|
5667
|
-
if (!this.isDragging || o === null ||
|
|
5773
|
+
const o = this.draggedField, s = this.draggedIndex, l = this.dropIndex;
|
|
5774
|
+
if (!this.isDragging || o === null || s === null || l === null)
|
|
5668
5775
|
return;
|
|
5669
|
-
const d = l >
|
|
5670
|
-
if (d !==
|
|
5776
|
+
const d = l > s ? l - 1 : l;
|
|
5777
|
+
if (d !== s) {
|
|
5671
5778
|
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, g = h ? c.findIndex((p) => p.field === h) : c.length, f = {
|
|
5672
5779
|
field: o,
|
|
5673
|
-
fromIndex:
|
|
5780
|
+
fromIndex: s,
|
|
5674
5781
|
toIndex: g
|
|
5675
5782
|
};
|
|
5676
5783
|
this.emit("column-reorder-request", f), setTimeout(() => {
|
|
@@ -5682,49 +5789,49 @@ class B extends A {
|
|
|
5682
5789
|
}
|
|
5683
5790
|
export {
|
|
5684
5791
|
A as BaseGridPlugin,
|
|
5685
|
-
|
|
5686
|
-
|
|
5792
|
+
pn as ClipboardPlugin,
|
|
5793
|
+
mn as ColumnVirtualizationPlugin,
|
|
5687
5794
|
it as ContextMenuPlugin,
|
|
5688
|
-
|
|
5795
|
+
Dn as DEFAULT_ANIMATION_CONFIG,
|
|
5689
5796
|
ht as DEFAULT_GRID_ICONS,
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5797
|
+
Mn as DGEvents,
|
|
5798
|
+
Nn as DataGridElement,
|
|
5799
|
+
wn as EditingPlugin,
|
|
5800
|
+
bn as ExportPlugin,
|
|
5694
5801
|
N as FilteringPlugin,
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5802
|
+
qn as FitModeEnum,
|
|
5803
|
+
Hn as GridCSSVars,
|
|
5804
|
+
Kn as GridClasses,
|
|
5805
|
+
zn as GridDataAttrs,
|
|
5806
|
+
On as GridElement,
|
|
5807
|
+
Gn as GridSelectors,
|
|
5808
|
+
vn as GroupingColumnsPlugin,
|
|
5809
|
+
yn as GroupingRowsPlugin,
|
|
5703
5810
|
nt as MasterDetailPlugin,
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5811
|
+
xn as MultiSortPlugin,
|
|
5812
|
+
Bn as PLUGIN_QUERIES,
|
|
5813
|
+
Cn as PinnedColumnsPlugin,
|
|
5814
|
+
En as PinnedRowsPlugin,
|
|
5708
5815
|
G as PivotPlugin,
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5816
|
+
Vn as PluginEvents,
|
|
5817
|
+
Wn as PluginManager,
|
|
5818
|
+
Rn as PrintPlugin,
|
|
5819
|
+
$i as ROW_DRAG_HANDLE_FIELD,
|
|
5820
|
+
$n as RenderPhase,
|
|
5821
|
+
Sn as ReorderPlugin,
|
|
5822
|
+
kn as ResponsivePlugin,
|
|
5823
|
+
An as RowReorderPlugin,
|
|
5824
|
+
_n as SelectionPlugin,
|
|
5825
|
+
Tn as ServerSidePlugin,
|
|
5826
|
+
Ln as TreePlugin,
|
|
5720
5827
|
In as UndoRedoPlugin,
|
|
5721
5828
|
B as VisibilityPlugin,
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5829
|
+
jn as builtInSort,
|
|
5830
|
+
Un as createGrid,
|
|
5831
|
+
Yn as defaultComparator,
|
|
5832
|
+
Ft as defaultEditorFor,
|
|
5833
|
+
yt as defaultPasteHandler,
|
|
5834
|
+
Ki as printGridIsolated,
|
|
5835
|
+
Xn as queryGrid
|
|
5729
5836
|
};
|
|
5730
5837
|
//# sourceMappingURL=all.js.map
|