@toolbox-web/grid 1.5.0 → 1.6.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 +749 -627
- package/all.js.map +1 -1
- package/index.js +513 -495
- package/index.js.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +8 -0
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/types.d.ts +82 -17
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +68 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +18 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.d.ts +1 -1
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +313 -183
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/filtering/types.d.ts +81 -2
- package/lib/plugins/filtering/types.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +5 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +90 -77
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +45 -0
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +25 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +10 -10
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return s.field ===
|
|
1
|
+
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as st, a as at, runAggregator as te, e as lt, s as dt, PLUGIN_QUERIES as Je, getAggregator as ye, getValueAggregator as ct, b as D, c as xe, g as ut } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Fn, DGEvents as In, DataGridElement as Pn, FitModeEnum as Dn, GridCSSVars as Mn, GridClasses as Nn, GridDataAttrs as qn, DataGridElement as Kn, GridSelectors as Hn, PluginEvents as zn, PluginManager as Gn, RenderPhase as On, builtInSort as Bn, createGrid as Vn, defaultComparator as Wn, queryGrid as $n } from "./index.js";
|
|
3
|
+
const Qe = "__tbw_expander", ht = 32;
|
|
4
|
+
function pe(s) {
|
|
5
|
+
return s.field === Qe;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function K(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return s.find(
|
|
10
|
+
function gt(s) {
|
|
11
|
+
return s.find(pe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function ft(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: Qe,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: ht,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -27,7 +27,7 @@ function st(s) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function ie(s) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(s), !0;
|
|
33
33
|
} catch {
|
|
@@ -37,7 +37,7 @@ async function U(s) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Ce(s, e) {
|
|
41
41
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
42
42
|
`, n = s.replace(/\r\n/g, `
|
|
43
43
|
`).replace(/\r/g, `
|
|
@@ -49,14 +49,14 @@ function pe(s, e) {
|
|
|
49
49
|
}
|
|
50
50
|
return o.push(a), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function pt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function mt(s, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = s;
|
|
61
61
|
if (!i) return;
|
|
62
62
|
const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
@@ -75,13 +75,13 @@ function lt(s, e) {
|
|
|
75
75
|
a.forEach((p) => f[p] = ""), d.push(f);
|
|
76
76
|
}
|
|
77
77
|
d[g] = { ...d[g] }, u.forEach((f, p) => {
|
|
78
|
-
const
|
|
79
|
-
|
|
78
|
+
const w = n[p];
|
|
79
|
+
w && l.get(w) && (d[g][w] = f);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class un extends _ {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -133,7 +133,7 @@ class nn extends R {
|
|
|
133
133
|
o = { startRow: l.row, startCol: l.col, endRow: l.row, endCol: l.col };
|
|
134
134
|
}
|
|
135
135
|
const a = this.#i(o);
|
|
136
|
-
|
|
136
|
+
ie(a.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: a.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: a.text,
|
|
139
139
|
rowCount: a.rowCount,
|
|
@@ -145,19 +145,19 @@ class nn extends R {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
149
|
-
for (let
|
|
150
|
-
const
|
|
151
|
-
|
|
148
|
+
const i = Ce(t, this.config), r = this.#n()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], g = h ? { row: a, col: l, field: h.field, bounds: c } : null, f = [], p = i[0]?.length ?? 0;
|
|
149
|
+
for (let v = 0; v < p && l + v <= u; v++) {
|
|
150
|
+
const y = this.columns[l + v];
|
|
151
|
+
y && !y.hidden && f.push(y.field);
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
this.emit("paste",
|
|
153
|
+
const w = { rows: i, text: t, target: g, fields: f };
|
|
154
|
+
this.emit("paste", w), this.#o(w);
|
|
155
155
|
}
|
|
156
156
|
#o(e) {
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? mt)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#n() {
|
|
163
163
|
try {
|
|
@@ -169,7 +169,7 @@ class nn extends R {
|
|
|
169
169
|
}
|
|
170
170
|
#i(e) {
|
|
171
171
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
172
|
-
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !
|
|
172
|
+
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !K(f));
|
|
173
173
|
if (this.config.includeHeaders) {
|
|
174
174
|
const f = g.map((p) => p.header || p.field);
|
|
175
175
|
h.push(f.join(c));
|
|
@@ -177,11 +177,11 @@ class nn extends R {
|
|
|
177
177
|
for (let f = o; f <= a; f++) {
|
|
178
178
|
const p = this.rows[f];
|
|
179
179
|
if (!p) continue;
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
return
|
|
180
|
+
const w = g.map((v) => {
|
|
181
|
+
const y = p[v.field];
|
|
182
|
+
return y == null ? "" : y instanceof Date ? y.toISOString() : String(y);
|
|
183
183
|
});
|
|
184
|
-
h.push(
|
|
184
|
+
h.push(w.join(c));
|
|
185
185
|
}
|
|
186
186
|
return {
|
|
187
187
|
text: h.join(u),
|
|
@@ -212,7 +212,7 @@ class nn extends R {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
const r = this.#i(n);
|
|
215
|
-
return await
|
|
215
|
+
return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
216
216
|
}
|
|
217
217
|
async copyRows(e) {
|
|
218
218
|
if (e.length === 0) return "";
|
|
@@ -222,43 +222,43 @@ class nn extends R {
|
|
|
222
222
|
endRow: t[t.length - 1],
|
|
223
223
|
endCol: i
|
|
224
224
|
}, r = this.#i(n);
|
|
225
|
-
return await
|
|
225
|
+
return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
226
226
|
}
|
|
227
227
|
async paste() {
|
|
228
|
-
const e = await
|
|
229
|
-
return e ?
|
|
228
|
+
const e = await pt();
|
|
229
|
+
return e ? Ce(e, this.config) : null;
|
|
230
230
|
}
|
|
231
231
|
getLastCopied() {
|
|
232
232
|
return this.lastCopied;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const
|
|
236
|
-
function
|
|
235
|
+
const Re = 100;
|
|
236
|
+
function me(s) {
|
|
237
237
|
if (s == null)
|
|
238
|
-
return
|
|
238
|
+
return Re;
|
|
239
239
|
if (typeof s == "number")
|
|
240
240
|
return s;
|
|
241
241
|
const e = parseFloat(s);
|
|
242
|
-
return isNaN(e) ?
|
|
242
|
+
return isNaN(e) ? Re : e;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
return s.map((e) =>
|
|
244
|
+
function Ee(s) {
|
|
245
|
+
return s.map((e) => me(e.width));
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Se(s) {
|
|
248
248
|
const e = [];
|
|
249
249
|
let t = 0;
|
|
250
250
|
for (const i of s)
|
|
251
|
-
e.push(t), t +=
|
|
251
|
+
e.push(t), t += me(i.width);
|
|
252
252
|
return e;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
return s.reduce((e, t) => e +
|
|
254
|
+
function ke(s) {
|
|
255
|
+
return s.reduce((e, t) => e + me(t.width), 0);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function wt(s, e, t, i, n) {
|
|
258
258
|
const r = t.length;
|
|
259
259
|
if (r === 0)
|
|
260
260
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
261
|
-
let o =
|
|
261
|
+
let o = bt(s, t, i);
|
|
262
262
|
o = Math.max(0, o - n);
|
|
263
263
|
const a = s + e;
|
|
264
264
|
let l = o;
|
|
@@ -275,7 +275,7 @@ function dt(s, e, t, i, n) {
|
|
|
275
275
|
d.push(c);
|
|
276
276
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function bt(s, e, t) {
|
|
279
279
|
let i = 0, n = e.length - 1;
|
|
280
280
|
for (; i < n; ) {
|
|
281
281
|
const r = Math.floor((i + n) / 2);
|
|
@@ -283,10 +283,10 @@ function ct(s, e, t) {
|
|
|
283
283
|
}
|
|
284
284
|
return i;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function vt(s, e, t) {
|
|
287
287
|
return t ? s > e : !1;
|
|
288
288
|
}
|
|
289
|
-
class
|
|
289
|
+
class hn extends _ {
|
|
290
290
|
name = "columnVirtualization";
|
|
291
291
|
get defaultConfig() {
|
|
292
292
|
return {
|
|
@@ -305,16 +305,16 @@ class rn extends R {
|
|
|
305
305
|
attach(e) {
|
|
306
306
|
super.attach(e);
|
|
307
307
|
const t = this.columns;
|
|
308
|
-
this.columnWidths =
|
|
308
|
+
this.columnWidths = Ee(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
|
|
309
309
|
}
|
|
310
310
|
detach() {
|
|
311
311
|
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
312
312
|
}
|
|
313
313
|
processColumns(e) {
|
|
314
|
-
const t =
|
|
315
|
-
if (this.isVirtualized = t ?? !1, this.columnWidths =
|
|
314
|
+
const t = vt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
315
|
+
if (this.isVirtualized = t ?? !1, this.columnWidths = Ee(e), this.columnOffsets = Se(e), this.totalWidth = ke(e), !t)
|
|
316
316
|
return this.startCol = 0, this.endCol = e.length - 1, [...e];
|
|
317
|
-
const i = this.grid.clientWidth || 800, n =
|
|
317
|
+
const i = this.grid.clientWidth || 800, n = wt(
|
|
318
318
|
this.scrollLeft,
|
|
319
319
|
i,
|
|
320
320
|
this.columnOffsets,
|
|
@@ -354,14 +354,14 @@ class rn extends R {
|
|
|
354
354
|
return this.totalWidth;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
function
|
|
357
|
+
const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg, light-dark(#f5f5f5, #2a2a2a)));color:var(--tbw-context-menu-fg, var(--tbw-color-fg, light-dark(#222, #eee)));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);box-shadow:0 2px 10px var(--tbw-color-shadow, rgba(0, 0, 0, .15));min-width:var(--tbw-menu-min-width, 10rem);padding:var(--tbw-spacing-xs, .25rem) 0;z-index:10000;font-size:var(--tbw-font-size-sm, .8125rem);font-family:var(--tbw-font-family, system-ui, sans-serif)}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-menu-item-padding, .375rem .75rem);cursor:pointer;gap:var(--tbw-menu-item-gap, .5rem)}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover, light-dark(#e8e8e8, #3a3a3a)))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:var(--tbw-icon-size, 1rem);text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-color-fg-muted, light-dark(#888, #888));font-size:var(--tbw-font-size-xs, .6875rem)}.tbw-context-menu-arrow{font-size:var(--tbw-font-size-2xs, .625rem);color:var(--tbw-color-fg-muted, light-dark(#888, #888))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));margin:var(--tbw-spacing-xs, .25rem) 0}}";
|
|
358
|
+
function he(s, e) {
|
|
359
359
|
return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function yt(s, e) {
|
|
362
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function ge(s, e, t, i = st.submenuArrow) {
|
|
365
365
|
const n = document.createElement("div");
|
|
366
366
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
367
367
|
for (const r of s) {
|
|
@@ -372,7 +372,7 @@ function oe(s, e, t, i = Je.submenuArrow) {
|
|
|
372
372
|
}
|
|
373
373
|
const o = document.createElement("div");
|
|
374
374
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
375
|
-
const a =
|
|
375
|
+
const a = yt(r, e);
|
|
376
376
|
if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
377
377
|
const d = document.createElement("span");
|
|
378
378
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -386,7 +386,7 @@ function oe(s, e, t, i = Je.submenuArrow) {
|
|
|
386
386
|
const d = document.createElement("span");
|
|
387
387
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
388
388
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
389
|
-
const u =
|
|
389
|
+
const u = he(r.subMenu, e), h = ge(u, e, t, i);
|
|
390
390
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
391
391
|
}), o.addEventListener("mouseleave", () => {
|
|
392
392
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -399,14 +399,14 @@ function oe(s, e, t, i = Je.submenuArrow) {
|
|
|
399
399
|
}
|
|
400
400
|
return n;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Ae(s, e, t) {
|
|
403
403
|
s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
|
|
404
404
|
const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
405
405
|
let o = e, a = t;
|
|
406
406
|
e + i.width > n && (o = e - i.width), t + i.height > r && (a = t - i.height), o = Math.max(0, o), a = Math.max(0, a), s.style.left = `${o}px`, s.style.top = `${a}px`, s.style.visibility = "visible";
|
|
407
407
|
}
|
|
408
|
-
let
|
|
409
|
-
const
|
|
408
|
+
let z = null, G = null, N = null, re = 0;
|
|
409
|
+
const oe = [
|
|
410
410
|
{
|
|
411
411
|
id: "copy",
|
|
412
412
|
name: "Copy",
|
|
@@ -424,11 +424,11 @@ const Z = [
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
];
|
|
427
|
-
class
|
|
427
|
+
class gn extends _ {
|
|
428
428
|
name = "contextMenu";
|
|
429
429
|
get defaultConfig() {
|
|
430
430
|
return {
|
|
431
|
-
items:
|
|
431
|
+
items: oe
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
isOpen = !1;
|
|
@@ -436,20 +436,20 @@ class on extends R {
|
|
|
436
436
|
params = null;
|
|
437
437
|
menuElement = null;
|
|
438
438
|
attach(e) {
|
|
439
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
439
|
+
super.attach(e), this.installGlobalHandlers(), re++;
|
|
440
440
|
}
|
|
441
441
|
detach() {
|
|
442
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
443
443
|
}
|
|
444
444
|
installGlobalHandlers() {
|
|
445
|
-
!
|
|
445
|
+
!N && typeof document < "u" && typeof ne == "string" && ne && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = ne, document.head.appendChild(N)), z || (z = () => {
|
|
446
446
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
447
|
-
}, document.addEventListener("click",
|
|
447
|
+
}, document.addEventListener("click", z)), G || (G = (e) => {
|
|
448
448
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
449
|
-
}, document.addEventListener("keydown",
|
|
449
|
+
}, document.addEventListener("keydown", G));
|
|
450
450
|
}
|
|
451
451
|
uninstallGlobalHandlers() {
|
|
452
|
-
|
|
452
|
+
re--, !(re > 0) && (z && (document.removeEventListener("click", z), z = null), G && (document.removeEventListener("keydown", G), G = null), N && (N.remove(), N = null));
|
|
453
453
|
}
|
|
454
454
|
afterRender() {
|
|
455
455
|
const e = this.gridElement;
|
|
@@ -487,15 +487,15 @@ class on extends R {
|
|
|
487
487
|
} else
|
|
488
488
|
return;
|
|
489
489
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
490
|
-
const d =
|
|
491
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
490
|
+
const d = he(this.config.items ?? oe, l);
|
|
491
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
492
492
|
d,
|
|
493
493
|
l,
|
|
494
494
|
(c) => {
|
|
495
495
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
496
496
|
},
|
|
497
497
|
this.gridIcons.submenuArrow
|
|
498
|
-
), document.body.appendChild(this.menuElement),
|
|
498
|
+
), document.body.appendChild(this.menuElement), Ae(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
499
499
|
}));
|
|
500
500
|
}
|
|
501
501
|
showMenu(e, t, i) {
|
|
@@ -508,15 +508,15 @@ class on extends R {
|
|
|
508
508
|
value: i.value ?? null,
|
|
509
509
|
isHeader: i.isHeader ?? !1,
|
|
510
510
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
511
|
-
}, r =
|
|
512
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
511
|
+
}, r = he(this.config.items ?? oe, n);
|
|
512
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
513
513
|
r,
|
|
514
514
|
n,
|
|
515
515
|
(o) => {
|
|
516
516
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
517
517
|
},
|
|
518
518
|
this.gridIcons.submenuArrow
|
|
519
|
-
), document.body.appendChild(this.menuElement),
|
|
519
|
+
), document.body.appendChild(this.menuElement), Ae(this.menuElement, e, t), this.isOpen = !0;
|
|
520
520
|
}
|
|
521
521
|
hideMenu() {
|
|
522
522
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -525,12 +525,12 @@ class on extends R {
|
|
|
525
525
|
return this.isOpen;
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
528
|
+
const xt = "@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}}}";
|
|
529
|
+
function Ct(s) {
|
|
530
530
|
const e = s.options;
|
|
531
531
|
return e ? typeof e == "function" ? e() : e : [];
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function Rt(s) {
|
|
534
534
|
return (e) => {
|
|
535
535
|
const t = s.editorParams, i = document.createElement("input");
|
|
536
536
|
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);
|
|
@@ -540,13 +540,13 @@ function pt(s) {
|
|
|
540
540
|
}), i;
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function Et() {
|
|
544
544
|
return (s) => {
|
|
545
545
|
const e = document.createElement("input");
|
|
546
546
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function St(s) {
|
|
550
550
|
return (e) => {
|
|
551
551
|
const t = s.editorParams, i = document.createElement("input");
|
|
552
552
|
return i.type = "date", e.value instanceof Date && (i.valueAsDate = e.value), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("change", () => e.commit(i.valueAsDate)), i.addEventListener("keydown", (n) => {
|
|
@@ -554,14 +554,14 @@ function wt(s) {
|
|
|
554
554
|
}), i;
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function kt(s) {
|
|
558
558
|
return (e) => {
|
|
559
559
|
const t = s.editorParams, i = document.createElement("select");
|
|
560
560
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
561
561
|
const o = document.createElement("option");
|
|
562
562
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
Ct(s).forEach((o) => {
|
|
565
565
|
const a = document.createElement("option");
|
|
566
566
|
a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), i.appendChild(a);
|
|
567
567
|
});
|
|
@@ -577,7 +577,7 @@ function bt(s) {
|
|
|
577
577
|
}), i;
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function At(s) {
|
|
581
581
|
return (e) => {
|
|
582
582
|
const t = s.editorParams, i = document.createElement("input");
|
|
583
583
|
return 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), i.addEventListener("blur", () => e.commit(i.value)), i.addEventListener("keydown", (n) => {
|
|
@@ -585,22 +585,22 @@ function vt(s) {
|
|
|
585
585
|
}), i;
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function _t(s) {
|
|
589
589
|
switch (s.type) {
|
|
590
590
|
case "number":
|
|
591
|
-
return
|
|
591
|
+
return Rt(s);
|
|
592
592
|
case "boolean":
|
|
593
|
-
return
|
|
593
|
+
return Et();
|
|
594
594
|
case "date":
|
|
595
|
-
return
|
|
595
|
+
return St(s);
|
|
596
596
|
case "select":
|
|
597
|
-
return
|
|
597
|
+
return kt(s);
|
|
598
598
|
default:
|
|
599
|
-
return
|
|
599
|
+
return At(s);
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
const
|
|
603
|
-
function
|
|
602
|
+
const se = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
603
|
+
function Lt(s, e) {
|
|
604
604
|
if (e.editor) return e.editor;
|
|
605
605
|
if (e.__editorTemplate) return "template";
|
|
606
606
|
if (!e.type) return;
|
|
@@ -614,28 +614,28 @@ function xt(s, e) {
|
|
|
614
614
|
return r.editor;
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function $(s) {
|
|
618
618
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function Tt(s) {
|
|
621
621
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
622
622
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function Ft(s) {
|
|
625
625
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function U(s, e) {
|
|
628
628
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function _e(s) {
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function It(s, e, t) {
|
|
633
633
|
const i = s.querySelector("input,textarea,select");
|
|
634
634
|
i && (i.addEventListener("blur", () => {
|
|
635
|
-
t(
|
|
636
|
-
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(
|
|
635
|
+
t(U(i, e));
|
|
636
|
+
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(U(i, e))));
|
|
637
637
|
}
|
|
638
|
-
class
|
|
638
|
+
class fn extends _ {
|
|
639
639
|
static manifest = {
|
|
640
640
|
ownedProperties: [
|
|
641
641
|
{
|
|
@@ -657,7 +657,7 @@ class sn extends R {
|
|
|
657
657
|
]
|
|
658
658
|
};
|
|
659
659
|
name = "editing";
|
|
660
|
-
styles =
|
|
660
|
+
styles = xt;
|
|
661
661
|
get defaultConfig() {
|
|
662
662
|
return {
|
|
663
663
|
editOn: "click"
|
|
@@ -719,7 +719,7 @@ class sn extends R {
|
|
|
719
719
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
720
720
|
if (r?.editable && r.type === "boolean" && o) {
|
|
721
721
|
const a = r.field;
|
|
722
|
-
if (
|
|
722
|
+
if ($(a)) {
|
|
723
723
|
const d = !o[a];
|
|
724
724
|
return this.#h(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
725
725
|
}
|
|
@@ -851,7 +851,7 @@ class sn extends R {
|
|
|
851
851
|
}), setTimeout(() => {
|
|
852
852
|
let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
853
853
|
if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
|
|
854
|
-
const l = a.querySelector(
|
|
854
|
+
const l = a.querySelector(se);
|
|
855
855
|
try {
|
|
856
856
|
l?.focus({ preventScroll: !0 });
|
|
857
857
|
} catch {
|
|
@@ -892,7 +892,7 @@ class sn extends R {
|
|
|
892
892
|
if (!u) return;
|
|
893
893
|
const h = d.querySelector("input,textarea,select");
|
|
894
894
|
if (h) {
|
|
895
|
-
const g =
|
|
895
|
+
const g = U(h, u);
|
|
896
896
|
r[u.field] !== g && this.#h(e, u, g, r);
|
|
897
897
|
}
|
|
898
898
|
}), t && n && r)
|
|
@@ -914,12 +914,12 @@ class sn extends R {
|
|
|
914
914
|
for (const l of this.#i)
|
|
915
915
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
916
916
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
917
|
-
l.classList.remove("editing"),
|
|
917
|
+
l.classList.remove("editing"), Ft(l.parentElement);
|
|
918
918
|
}), this.requestRender()), this.#r = !0, o || (this.#g(i), this.#r = !1);
|
|
919
919
|
}
|
|
920
920
|
#h(e, t, i, n) {
|
|
921
921
|
const r = t.field;
|
|
922
|
-
if (
|
|
922
|
+
if (!$(r)) return;
|
|
923
923
|
const o = n[r];
|
|
924
924
|
if (o === i) return;
|
|
925
925
|
const a = this.grid;
|
|
@@ -928,7 +928,7 @@ class sn extends R {
|
|
|
928
928
|
l = this.grid.getRowId(n);
|
|
929
929
|
} catch {
|
|
930
930
|
}
|
|
931
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") :
|
|
931
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : _e;
|
|
932
932
|
if (this.emitCancelable("cell-commit", {
|
|
933
933
|
row: n,
|
|
934
934
|
rowId: l ?? "",
|
|
@@ -943,7 +943,7 @@ class sn extends R {
|
|
|
943
943
|
})) return;
|
|
944
944
|
n[r] = i, l && this.#n.add(l), this.#a();
|
|
945
945
|
const h = a.findRenderedRowElement?.(e);
|
|
946
|
-
h && (h.classList.add("changed"),
|
|
946
|
+
h && (h.classList.add("changed"), at(h, "change"));
|
|
947
947
|
}
|
|
948
948
|
#p(e, t, i, n, r, o) {
|
|
949
949
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -952,63 +952,63 @@ class sn extends R {
|
|
|
952
952
|
a = this.grid.getRowId(e);
|
|
953
953
|
} catch {
|
|
954
954
|
}
|
|
955
|
-
const l = a ? (
|
|
955
|
+
const l = a ? (x) => this.grid.updateRow(a, x, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
|
|
956
956
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
957
957
|
const c = r.parentElement;
|
|
958
|
-
c &&
|
|
958
|
+
c && Tt(c);
|
|
959
959
|
let u = !1;
|
|
960
|
-
const h = (
|
|
961
|
-
u || this.#e === -1 || this.#h(t, i,
|
|
960
|
+
const h = (x) => {
|
|
961
|
+
u || this.#e === -1 || this.#h(t, i, x, e);
|
|
962
962
|
}, g = () => {
|
|
963
|
-
u = !0,
|
|
963
|
+
u = !0, $(i.field) && (e[i.field] = d);
|
|
964
964
|
}, f = document.createElement("div");
|
|
965
|
-
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (
|
|
966
|
-
|
|
965
|
+
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (x) => {
|
|
966
|
+
x.key === "Enter" && (x.stopPropagation(), x.preventDefault(), u = !0, this.#s(t, !1)), x.key === "Escape" && (x.stopPropagation(), x.preventDefault(), g(), this.#s(t, !0));
|
|
967
967
|
});
|
|
968
|
-
const p = i,
|
|
969
|
-
if (
|
|
968
|
+
const p = i, w = p.__editorTemplate, v = Lt(this.grid, p) ?? _t(i), y = d;
|
|
969
|
+
if (v === "template" && w)
|
|
970
970
|
this.#l(f, p, e, d, h, g, o, t);
|
|
971
|
-
else if (typeof
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
f.querySelector(
|
|
971
|
+
else if (typeof v == "string") {
|
|
972
|
+
const x = document.createElement(v);
|
|
973
|
+
x.value = y, x.addEventListener("change", () => h(x.value)), f.appendChild(x), o || queueMicrotask(() => {
|
|
974
|
+
f.querySelector(se)?.focus({ preventScroll: !0 });
|
|
975
975
|
});
|
|
976
|
-
} else if (typeof
|
|
977
|
-
const
|
|
976
|
+
} else if (typeof v == "function") {
|
|
977
|
+
const x = {
|
|
978
978
|
row: e,
|
|
979
979
|
rowId: a ?? "",
|
|
980
|
-
value:
|
|
980
|
+
value: y,
|
|
981
981
|
field: i.field,
|
|
982
982
|
column: i,
|
|
983
983
|
commit: h,
|
|
984
984
|
cancel: g,
|
|
985
985
|
updateRow: l
|
|
986
|
-
},
|
|
987
|
-
typeof
|
|
988
|
-
f.querySelector(
|
|
986
|
+
}, A = v(x);
|
|
987
|
+
typeof A == "string" ? (f.innerHTML = A, It(f, i, h)) : A instanceof Node && f.appendChild(A), o || queueMicrotask(() => {
|
|
988
|
+
f.querySelector(se)?.focus({ preventScroll: !0 });
|
|
989
989
|
});
|
|
990
|
-
} else if (
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
const
|
|
990
|
+
} else if (v && typeof v == "object") {
|
|
991
|
+
const x = document.createElement("div");
|
|
992
|
+
x.setAttribute("data-external-editor", ""), x.setAttribute("data-field", i.field), f.appendChild(x);
|
|
993
|
+
const A = {
|
|
994
994
|
row: e,
|
|
995
995
|
rowId: a ?? "",
|
|
996
|
-
value:
|
|
996
|
+
value: y,
|
|
997
997
|
field: i.field,
|
|
998
998
|
column: i,
|
|
999
999
|
commit: h,
|
|
1000
1000
|
cancel: g,
|
|
1001
1001
|
updateRow: l
|
|
1002
1002
|
};
|
|
1003
|
-
if (
|
|
1003
|
+
if (v.mount)
|
|
1004
1004
|
try {
|
|
1005
|
-
|
|
1006
|
-
} catch (
|
|
1007
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1005
|
+
v.mount({ placeholder: x, context: A, spec: v });
|
|
1006
|
+
} catch (F) {
|
|
1007
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, F);
|
|
1008
1008
|
}
|
|
1009
1009
|
else
|
|
1010
1010
|
this.grid.dispatchEvent(
|
|
1011
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder:
|
|
1011
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: x, spec: v, context: A } })
|
|
1012
1012
|
);
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
@@ -1025,9 +1025,9 @@ class sn extends R {
|
|
|
1025
1025
|
cancel: o
|
|
1026
1026
|
}) : c.querySelectorAll("*").forEach((g) => {
|
|
1027
1027
|
g.childNodes.length === 1 && g.firstChild?.nodeType === Node.TEXT_NODE && (g.textContent = g.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (f, p) => {
|
|
1028
|
-
if (
|
|
1029
|
-
const
|
|
1030
|
-
return
|
|
1028
|
+
if (!$(p)) return "";
|
|
1029
|
+
const w = i[p];
|
|
1030
|
+
return w == null ? "" : String(w);
|
|
1031
1031
|
}) || "");
|
|
1032
1032
|
});
|
|
1033
1033
|
const h = c.querySelector(
|
|
@@ -1037,10 +1037,10 @@ class sn extends R {
|
|
|
1037
1037
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1038
1038
|
let g = !1;
|
|
1039
1039
|
h.addEventListener("blur", () => {
|
|
1040
|
-
g || r(
|
|
1040
|
+
g || r(U(h, t));
|
|
1041
1041
|
}), h.addEventListener("keydown", (f) => {
|
|
1042
1042
|
const p = f;
|
|
1043
|
-
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(
|
|
1043
|
+
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t)), this.#s(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#s(l, !0));
|
|
1044
1044
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1045
1045
|
}
|
|
1046
1046
|
e.appendChild(c);
|
|
@@ -1061,7 +1061,7 @@ class sn extends R {
|
|
|
1061
1061
|
});
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Le(s, e = !0) {
|
|
1065
1065
|
if (s == null) return "";
|
|
1066
1066
|
if (s instanceof Date) return s.toISOString();
|
|
1067
1067
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1069,37 +1069,37 @@ function Ce(s, e = !0) {
|
|
|
1069
1069
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1070
1070
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function Pt(s, e, t, i = {}) {
|
|
1073
1073
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1074
1074
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1075
1075
|
if (t.includeHeaders !== !1) {
|
|
1076
1076
|
const l = e.map((d) => {
|
|
1077
1077
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1078
|
-
return
|
|
1078
|
+
return Le(u);
|
|
1079
1079
|
});
|
|
1080
1080
|
o.push(l.join(n));
|
|
1081
1081
|
}
|
|
1082
1082
|
for (const l of s) {
|
|
1083
1083
|
const d = e.map((c) => {
|
|
1084
1084
|
let u = l[c.field];
|
|
1085
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1085
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Le(u);
|
|
1086
1086
|
});
|
|
1087
1087
|
o.push(d.join(n));
|
|
1088
1088
|
}
|
|
1089
1089
|
return a + o.join(r);
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1091
|
+
function we(s, e) {
|
|
1092
1092
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1093
1093
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function Dt(s, e) {
|
|
1096
1096
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1097
|
-
|
|
1097
|
+
we(t, e);
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function Te(s) {
|
|
1100
1100
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1102
|
+
function Mt(s, e, t) {
|
|
1103
1103
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1104
1104
|
<?mso-application progid="Excel.Sheet"?>
|
|
1105
1105
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1111,7 +1111,7 @@ function At(s, e, t) {
|
|
|
1111
1111
|
<Row>`;
|
|
1112
1112
|
for (const n of e) {
|
|
1113
1113
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1114
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1114
|
+
i += `<Cell><Data ss:Type="String">${Te(o)}</Data></Cell>`;
|
|
1115
1115
|
}
|
|
1116
1116
|
i += "</Row>";
|
|
1117
1117
|
}
|
|
@@ -1122,7 +1122,7 @@ function At(s, e, t) {
|
|
|
1122
1122
|
let o = n[r.field];
|
|
1123
1123
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1124
1124
|
let a = "String", l = "";
|
|
1125
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l =
|
|
1125
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Te(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
|
|
1126
1126
|
}
|
|
1127
1127
|
i += "</Row>";
|
|
1128
1128
|
}
|
|
@@ -1131,13 +1131,13 @@ function At(s, e, t) {
|
|
|
1131
1131
|
</Worksheet>
|
|
1132
1132
|
</Workbook>`, i;
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1134
|
+
function Nt(s, e) {
|
|
1135
1135
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1136
1136
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1137
1137
|
});
|
|
1138
|
-
|
|
1138
|
+
we(i, t);
|
|
1139
1139
|
}
|
|
1140
|
-
class
|
|
1140
|
+
class pn extends _ {
|
|
1141
1141
|
name = "export";
|
|
1142
1142
|
get defaultConfig() {
|
|
1143
1143
|
return {
|
|
@@ -1174,13 +1174,13 @@ class an extends R {
|
|
|
1174
1174
|
try {
|
|
1175
1175
|
switch (e) {
|
|
1176
1176
|
case "csv": {
|
|
1177
|
-
const l =
|
|
1178
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1177
|
+
const l = Pt(o, r, n, { bom: !0 });
|
|
1178
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, Dt(l, a);
|
|
1179
1179
|
break;
|
|
1180
1180
|
}
|
|
1181
1181
|
case "excel": {
|
|
1182
|
-
const l =
|
|
1183
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1182
|
+
const l = Mt(o, r, n);
|
|
1183
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, Nt(l, a);
|
|
1184
1184
|
break;
|
|
1185
1185
|
}
|
|
1186
1186
|
case "json": {
|
|
@@ -1194,7 +1194,7 @@ class an extends R {
|
|
|
1194
1194
|
}), d = JSON.stringify(l, null, 2);
|
|
1195
1195
|
a = a.endsWith(".json") ? a : `${a}.json`;
|
|
1196
1196
|
const c = new Blob([d], { type: "application/json" });
|
|
1197
|
-
|
|
1197
|
+
we(c, a);
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
@@ -1231,7 +1231,7 @@ class an extends R {
|
|
|
1231
1231
|
return this.lastExportInfo;
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function qt(s) {
|
|
1235
1235
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1236
1236
|
let a = Math.floor(i / n) - r;
|
|
1237
1237
|
a < 0 && (a = 0);
|
|
@@ -1243,10 +1243,10 @@ function Lt(s) {
|
|
|
1243
1243
|
totalHeight: e * n
|
|
1244
1244
|
};
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Kt(s, e) {
|
|
1247
1247
|
return s <= e;
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1249
|
+
function Ht(s, e, t = !1) {
|
|
1250
1250
|
const i = s[e.field];
|
|
1251
1251
|
if (e.operator === "blank")
|
|
1252
1252
|
return i == null || i === "";
|
|
@@ -1285,10 +1285,10 @@ function It(s, e, t = !1) {
|
|
|
1285
1285
|
return !0;
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1288
|
+
function zt(s, e, t = !1) {
|
|
1289
|
+
return e.length ? s.filter((i) => e.every((n) => Ht(i, n, t))) : s;
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function Gt(s) {
|
|
1292
1292
|
return JSON.stringify(
|
|
1293
1293
|
s.map((e) => ({
|
|
1294
1294
|
field: e.field,
|
|
@@ -1298,7 +1298,7 @@ function Dt(s) {
|
|
|
1298
1298
|
}))
|
|
1299
1299
|
);
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function Fe(s, e) {
|
|
1302
1302
|
const t = /* @__PURE__ */ new Set();
|
|
1303
1303
|
for (const i of s) {
|
|
1304
1304
|
const n = i[e];
|
|
@@ -1306,10 +1306,10 @@ function Ee(s, e) {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1308
1308
|
}
|
|
1309
|
-
const
|
|
1310
|
-
class
|
|
1309
|
+
const Ot = '@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}}}', Bt = "@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-title{font-weight:500;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-bottom:var(--tbw-spacing-sm, .375rem);border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.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)}}";
|
|
1310
|
+
class q extends _ {
|
|
1311
1311
|
name = "filtering";
|
|
1312
|
-
styles =
|
|
1312
|
+
styles = Ot;
|
|
1313
1313
|
get defaultConfig() {
|
|
1314
1314
|
return {
|
|
1315
1315
|
debounceMs: 300,
|
|
@@ -1318,6 +1318,12 @@ class T extends R {
|
|
|
1318
1318
|
useWorker: !0
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
|
+
isFilteringEnabled() {
|
|
1322
|
+
return this.grid.effectiveConfig?.filterable !== !1;
|
|
1323
|
+
}
|
|
1324
|
+
isColumnFilterable(e) {
|
|
1325
|
+
return this.isFilteringEnabled() ? e.filterable !== !1 : !1;
|
|
1326
|
+
}
|
|
1321
1327
|
filters = /* @__PURE__ */ new Map();
|
|
1322
1328
|
cachedResult = null;
|
|
1323
1329
|
cacheKey = null;
|
|
@@ -1340,7 +1346,7 @@ class T extends R {
|
|
|
1340
1346
|
return t;
|
|
1341
1347
|
}
|
|
1342
1348
|
}
|
|
1343
|
-
return
|
|
1349
|
+
return q.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1344
1350
|
}
|
|
1345
1351
|
syncExcludedValues(e, t) {
|
|
1346
1352
|
t ? t.type === "set" && t.operator === "notIn" && Array.isArray(t.value) ? this.excludedValues.set(e, new Set(t.value)) : t.type === "set" && this.excludedValues.delete(e) : this.excludedValues.delete(e);
|
|
@@ -1356,10 +1362,10 @@ class T extends R {
|
|
|
1356
1362
|
if (!t.length) return [...e];
|
|
1357
1363
|
if (this.config.filterHandler)
|
|
1358
1364
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1359
|
-
const i =
|
|
1365
|
+
const i = Gt(t);
|
|
1360
1366
|
if (this.cacheKey === i && this.cachedResult)
|
|
1361
1367
|
return this.cachedResult;
|
|
1362
|
-
const n =
|
|
1368
|
+
const n = zt([...e], t, this.config.caseSensitive);
|
|
1363
1369
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1364
1370
|
}
|
|
1365
1371
|
afterRender() {
|
|
@@ -1369,7 +1375,7 @@ class T extends R {
|
|
|
1369
1375
|
const n = i.getAttribute("data-col");
|
|
1370
1376
|
if (n === null) return;
|
|
1371
1377
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1372
|
-
if (!r || r
|
|
1378
|
+
if (!r || !this.isColumnFilterable(r) || K(r)) return;
|
|
1373
1379
|
const o = r.field;
|
|
1374
1380
|
if (!o) return;
|
|
1375
1381
|
const a = this.filters.has(o);
|
|
@@ -1437,7 +1443,7 @@ class T extends R {
|
|
|
1437
1443
|
return this.getFilters();
|
|
1438
1444
|
}
|
|
1439
1445
|
getUniqueValues(e) {
|
|
1440
|
-
return
|
|
1446
|
+
return Fe(this.sourceRows, e);
|
|
1441
1447
|
}
|
|
1442
1448
|
copyGridThemeContext(e) {
|
|
1443
1449
|
const t = this.gridElement;
|
|
@@ -1454,7 +1460,7 @@ class T extends R {
|
|
|
1454
1460
|
return;
|
|
1455
1461
|
}
|
|
1456
1462
|
const e = document.createElement("style");
|
|
1457
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1463
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Bt, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1458
1464
|
}
|
|
1459
1465
|
toggleFilterPanel(e, t, i) {
|
|
1460
1466
|
if (this.openPanelField === e) {
|
|
@@ -1469,8 +1475,8 @@ class T extends R {
|
|
|
1469
1475
|
});
|
|
1470
1476
|
return;
|
|
1471
1477
|
}
|
|
1472
|
-
const r =
|
|
1473
|
-
|
|
1478
|
+
const r = Fe(this.sourceRows, e);
|
|
1479
|
+
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1474
1480
|
}
|
|
1475
1481
|
renderPanelContent(e, t, i, n) {
|
|
1476
1482
|
let r = this.excludedValues.get(e);
|
|
@@ -1493,7 +1499,14 @@ class T extends R {
|
|
|
1493
1499
|
closePanel: () => this.closeFilterPanel()
|
|
1494
1500
|
};
|
|
1495
1501
|
let l = !1;
|
|
1496
|
-
this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, a), l = i.children.length > 0), l
|
|
1502
|
+
if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, a), l = i.children.length > 0), !l && t.type) {
|
|
1503
|
+
const d = this.grid.effectiveConfig.typeDefaults?.[t.type];
|
|
1504
|
+
d?.filterPanelRenderer && (d.filterPanelRenderer(i, a), l = i.children.length > 0);
|
|
1505
|
+
}
|
|
1506
|
+
if (!l) {
|
|
1507
|
+
const d = t.type;
|
|
1508
|
+
d === "number" ? this.renderNumberFilterPanel(i, a, n) : d === "date" ? this.renderDateFilterPanel(i, a, n) : this.renderDefaultFilterPanel(i, a, n, r);
|
|
1509
|
+
}
|
|
1497
1510
|
}
|
|
1498
1511
|
setupPanelCloseHandler(e, t) {
|
|
1499
1512
|
this.panelAbortController = new AbortController(), setTimeout(() => {
|
|
@@ -1512,11 +1525,11 @@ class T extends R {
|
|
|
1512
1525
|
}
|
|
1513
1526
|
static supportsAnchorPositioning = null;
|
|
1514
1527
|
static checkAnchorPositioningSupport() {
|
|
1515
|
-
return
|
|
1528
|
+
return q.supportsAnchorPositioning === null && (q.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), q.supportsAnchorPositioning;
|
|
1516
1529
|
}
|
|
1517
1530
|
positionPanel(e, t) {
|
|
1518
1531
|
const n = t.closest(".cell") ?? t;
|
|
1519
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1532
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, q.checkAnchorPositioningSupport()) {
|
|
1520
1533
|
requestAnimationFrame(() => {
|
|
1521
1534
|
const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
|
|
1522
1535
|
o.top < a.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1543,99 +1556,201 @@ class T extends R {
|
|
|
1543
1556
|
const h = document.createElement("span");
|
|
1544
1557
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1545
1558
|
const g = () => {
|
|
1546
|
-
const
|
|
1547
|
-
u.checked = E, u.indeterminate = !E && !
|
|
1559
|
+
const b = [...v.values()], E = b.every((C) => C), L = b.every((C) => !C);
|
|
1560
|
+
u.checked = E, u.indeterminate = !E && !L;
|
|
1548
1561
|
};
|
|
1549
1562
|
u.addEventListener("change", () => {
|
|
1550
|
-
const
|
|
1551
|
-
for (const E of
|
|
1552
|
-
|
|
1553
|
-
g(),
|
|
1563
|
+
const b = u.checked;
|
|
1564
|
+
for (const E of v.keys())
|
|
1565
|
+
v.set(E, b);
|
|
1566
|
+
g(), A();
|
|
1554
1567
|
}), e.appendChild(d);
|
|
1555
1568
|
const f = document.createElement("div");
|
|
1556
1569
|
f.className = "tbw-filter-values";
|
|
1557
1570
|
const p = document.createElement("div");
|
|
1558
1571
|
p.className = "tbw-filter-values-spacer", f.appendChild(p);
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1561
|
-
const
|
|
1562
|
-
i.forEach((
|
|
1563
|
-
const E =
|
|
1564
|
-
|
|
1572
|
+
const w = document.createElement("div");
|
|
1573
|
+
w.className = "tbw-filter-values-content", f.appendChild(w);
|
|
1574
|
+
const v = /* @__PURE__ */ new Map();
|
|
1575
|
+
i.forEach((b) => {
|
|
1576
|
+
const E = b == null ? "__null__" : String(b);
|
|
1577
|
+
v.set(E, !n.has(b));
|
|
1565
1578
|
}), g();
|
|
1566
|
-
let
|
|
1567
|
-
const
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1572
|
-
|
|
1579
|
+
let y = [];
|
|
1580
|
+
const x = (b, E) => {
|
|
1581
|
+
const L = b == null ? "(Blank)" : String(b), C = b == null ? "__null__" : String(b), m = document.createElement("label");
|
|
1582
|
+
m.className = "tbw-filter-value-item", m.style.position = "absolute", m.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${E})`, m.style.left = "0", m.style.right = "0", m.style.boxSizing = "border-box";
|
|
1583
|
+
const R = document.createElement("input");
|
|
1584
|
+
R.type = "checkbox", R.className = "tbw-filter-checkbox", R.checked = v.get(C) ?? !0, R.dataset.value = C, R.addEventListener("change", () => {
|
|
1585
|
+
v.set(C, R.checked), g();
|
|
1573
1586
|
});
|
|
1574
|
-
const
|
|
1575
|
-
return
|
|
1576
|
-
},
|
|
1577
|
-
const
|
|
1578
|
-
if (p.style.height = `${
|
|
1579
|
-
|
|
1580
|
-
|
|
1587
|
+
const M = document.createElement("span");
|
|
1588
|
+
return M.textContent = L, m.appendChild(R), m.appendChild(M), m;
|
|
1589
|
+
}, A = () => {
|
|
1590
|
+
const b = y.length, E = f.clientHeight, L = f.scrollTop;
|
|
1591
|
+
if (p.style.height = `${b * o}px`, Kt(b, q.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1592
|
+
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((m, R) => {
|
|
1593
|
+
w.appendChild(x(m, R));
|
|
1581
1594
|
});
|
|
1582
1595
|
return;
|
|
1583
1596
|
}
|
|
1584
|
-
const
|
|
1585
|
-
totalRows:
|
|
1597
|
+
const C = qt({
|
|
1598
|
+
totalRows: b,
|
|
1586
1599
|
viewportHeight: E,
|
|
1587
|
-
scrollTop:
|
|
1600
|
+
scrollTop: L,
|
|
1588
1601
|
rowHeight: o,
|
|
1589
|
-
overscan:
|
|
1602
|
+
overscan: q.LIST_OVERSCAN
|
|
1590
1603
|
});
|
|
1591
|
-
|
|
1592
|
-
for (let
|
|
1593
|
-
|
|
1594
|
-
},
|
|
1595
|
-
const E = this.config.caseSensitive ?? !1,
|
|
1596
|
-
if (
|
|
1597
|
-
const
|
|
1598
|
-
return !
|
|
1599
|
-
}),
|
|
1600
|
-
p.style.height = "0px",
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1604
|
+
w.style.transform = `translateY(${C.offsetY}px)`, w.innerHTML = "";
|
|
1605
|
+
for (let m = C.start; m < C.end; m++)
|
|
1606
|
+
w.appendChild(x(y[m], m - C.start));
|
|
1607
|
+
}, F = (b) => {
|
|
1608
|
+
const E = this.config.caseSensitive ?? !1, L = E ? b : b.toLowerCase();
|
|
1609
|
+
if (y = i.filter((C) => {
|
|
1610
|
+
const m = C == null ? "(Blank)" : String(C), R = E ? m : m.toLowerCase();
|
|
1611
|
+
return !b || R.includes(L);
|
|
1612
|
+
}), y.length === 0) {
|
|
1613
|
+
p.style.height = "0px", w.innerHTML = "";
|
|
1614
|
+
const C = document.createElement("div");
|
|
1615
|
+
C.className = "tbw-filter-no-match", C.textContent = "No matching values", w.appendChild(C);
|
|
1603
1616
|
return;
|
|
1604
1617
|
}
|
|
1605
|
-
|
|
1618
|
+
A();
|
|
1606
1619
|
};
|
|
1607
1620
|
f.addEventListener(
|
|
1608
1621
|
"scroll",
|
|
1609
1622
|
() => {
|
|
1610
|
-
|
|
1623
|
+
y.length > 0 && A();
|
|
1611
1624
|
},
|
|
1612
1625
|
{ passive: !0 }
|
|
1613
|
-
),
|
|
1614
|
-
let
|
|
1626
|
+
), F(l.value), e.appendChild(f);
|
|
1627
|
+
let k;
|
|
1615
1628
|
l.addEventListener("input", () => {
|
|
1616
|
-
clearTimeout(
|
|
1617
|
-
this.searchText.set(r, l.value),
|
|
1629
|
+
clearTimeout(k), k = setTimeout(() => {
|
|
1630
|
+
this.searchText.set(r, l.value), F(l.value);
|
|
1618
1631
|
}, this.config.debounceMs ?? 150);
|
|
1619
1632
|
});
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1624
|
-
const
|
|
1625
|
-
for (const [E,
|
|
1626
|
-
if (!
|
|
1633
|
+
const I = document.createElement("div");
|
|
1634
|
+
I.className = "tbw-filter-buttons";
|
|
1635
|
+
const T = document.createElement("button");
|
|
1636
|
+
T.className = "tbw-filter-apply-btn", T.textContent = "Apply", T.addEventListener("click", () => {
|
|
1637
|
+
const b = [];
|
|
1638
|
+
for (const [E, L] of v)
|
|
1639
|
+
if (!L)
|
|
1627
1640
|
if (E === "__null__")
|
|
1628
|
-
|
|
1641
|
+
b.push(null);
|
|
1629
1642
|
else {
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1643
|
+
const C = i.find((m) => String(m) === E);
|
|
1644
|
+
b.push(C !== void 0 ? C : E);
|
|
1632
1645
|
}
|
|
1633
|
-
t.applySetFilter(
|
|
1634
|
-
}),
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1646
|
+
t.applySetFilter(b);
|
|
1647
|
+
}), I.appendChild(T);
|
|
1648
|
+
const P = document.createElement("button");
|
|
1649
|
+
P.className = "tbw-filter-clear-btn", P.textContent = "Clear Filter", P.addEventListener("click", () => {
|
|
1650
|
+
t.clearFilter();
|
|
1651
|
+
}), I.appendChild(P), e.appendChild(I);
|
|
1652
|
+
}
|
|
1653
|
+
renderNumberFilterPanel(e, t, i) {
|
|
1654
|
+
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (S, H) => {
|
|
1655
|
+
if (typeof S == "number") return S;
|
|
1656
|
+
if (typeof S == "string") {
|
|
1657
|
+
const W = parseFloat(S);
|
|
1658
|
+
return isNaN(W) ? H : W;
|
|
1659
|
+
}
|
|
1660
|
+
return H;
|
|
1661
|
+
}, d = i.filter((S) => typeof S == "number" && !isNaN(S)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), g = l(o?.max ?? a?.max, u), f = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
|
|
1662
|
+
let w = h, v = g;
|
|
1663
|
+
p?.operator === "between" ? (w = l(p.value, h), v = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (v = l(p.value, g));
|
|
1664
|
+
const y = document.createElement("div");
|
|
1665
|
+
y.className = "tbw-filter-range-title", y.textContent = r.header || n, e.appendChild(y);
|
|
1666
|
+
const x = document.createElement("div");
|
|
1667
|
+
x.className = "tbw-filter-range-inputs";
|
|
1668
|
+
const A = document.createElement("div");
|
|
1669
|
+
A.className = "tbw-filter-range-group";
|
|
1670
|
+
const F = document.createElement("label");
|
|
1671
|
+
F.textContent = "Min", F.className = "tbw-filter-range-label";
|
|
1672
|
+
const k = document.createElement("input");
|
|
1673
|
+
k.type = "number", k.className = "tbw-filter-range-input", k.min = String(h), k.max = String(g), k.step = String(f), k.value = String(w), A.appendChild(F), A.appendChild(k), x.appendChild(A);
|
|
1674
|
+
const I = document.createElement("span");
|
|
1675
|
+
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1676
|
+
const T = document.createElement("div");
|
|
1677
|
+
T.className = "tbw-filter-range-group";
|
|
1678
|
+
const P = document.createElement("label");
|
|
1679
|
+
P.textContent = "Max", P.className = "tbw-filter-range-label";
|
|
1680
|
+
const b = document.createElement("input");
|
|
1681
|
+
b.type = "number", b.className = "tbw-filter-range-input", b.min = String(h), b.max = String(g), b.step = String(f), b.value = String(v), T.appendChild(P), T.appendChild(b), x.appendChild(T), e.appendChild(x);
|
|
1682
|
+
const E = document.createElement("div");
|
|
1683
|
+
E.className = "tbw-filter-range-slider";
|
|
1684
|
+
const L = document.createElement("div");
|
|
1685
|
+
L.className = "tbw-filter-range-track";
|
|
1686
|
+
const C = document.createElement("div");
|
|
1687
|
+
C.className = "tbw-filter-range-fill";
|
|
1688
|
+
const m = document.createElement("input");
|
|
1689
|
+
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(g), m.step = String(f), m.value = String(w);
|
|
1690
|
+
const R = document.createElement("input");
|
|
1691
|
+
R.type = "range", R.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(v), E.appendChild(L), E.appendChild(C), E.appendChild(m), E.appendChild(R), e.appendChild(E);
|
|
1692
|
+
const M = () => {
|
|
1693
|
+
const S = parseFloat(m.value), H = parseFloat(R.value), W = g - h, ve = (S - h) / W * 100, ot = (H - h) / W * 100;
|
|
1694
|
+
C.style.left = `${ve}%`, C.style.width = `${ot - ve}%`;
|
|
1695
|
+
};
|
|
1696
|
+
m.addEventListener("input", () => {
|
|
1697
|
+
const S = Math.min(parseFloat(m.value), parseFloat(R.value));
|
|
1698
|
+
m.value = String(S), k.value = String(S), M();
|
|
1699
|
+
}), R.addEventListener("input", () => {
|
|
1700
|
+
const S = Math.max(parseFloat(R.value), parseFloat(m.value));
|
|
1701
|
+
R.value = String(S), b.value = String(S), M();
|
|
1702
|
+
}), k.addEventListener("input", () => {
|
|
1703
|
+
let S = parseFloat(k.value) || h;
|
|
1704
|
+
S = Math.max(h, Math.min(S, parseFloat(b.value))), m.value = String(S), M();
|
|
1705
|
+
}), b.addEventListener("input", () => {
|
|
1706
|
+
let S = parseFloat(b.value) || g;
|
|
1707
|
+
S = Math.min(g, Math.max(S, parseFloat(k.value))), R.value = String(S), M();
|
|
1708
|
+
}), M();
|
|
1709
|
+
const Y = document.createElement("div");
|
|
1710
|
+
Y.className = "tbw-filter-buttons";
|
|
1711
|
+
const X = document.createElement("button");
|
|
1712
|
+
X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
|
|
1713
|
+
const S = parseFloat(k.value), H = parseFloat(b.value);
|
|
1714
|
+
t.applyTextFilter("between", S, H);
|
|
1715
|
+
}), Y.appendChild(X);
|
|
1716
|
+
const Z = document.createElement("button");
|
|
1717
|
+
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
1637
1718
|
t.clearFilter();
|
|
1638
|
-
}),
|
|
1719
|
+
}), Y.appendChild(Z), e.appendChild(Y);
|
|
1720
|
+
}
|
|
1721
|
+
renderDateFilterPanel(e, t, i) {
|
|
1722
|
+
const { field: n, column: r } = t, o = r.filterParams, a = 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(a?.min) || u(d), f = h(o?.max) || h(a?.max) || u(c), p = this.filters.get(n);
|
|
1723
|
+
let w = "", v = "";
|
|
1724
|
+
p?.operator === "between" ? (w = h(p.value) || "", v = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (v = h(p.value) || "");
|
|
1725
|
+
const y = document.createElement("div");
|
|
1726
|
+
y.className = "tbw-filter-range-title", y.textContent = r.header || n, e.appendChild(y);
|
|
1727
|
+
const x = document.createElement("div");
|
|
1728
|
+
x.className = "tbw-filter-date-range";
|
|
1729
|
+
const A = document.createElement("div");
|
|
1730
|
+
A.className = "tbw-filter-date-group";
|
|
1731
|
+
const F = document.createElement("label");
|
|
1732
|
+
F.textContent = "From", F.className = "tbw-filter-range-label";
|
|
1733
|
+
const k = document.createElement("input");
|
|
1734
|
+
k.type = "date", k.className = "tbw-filter-date-input", g && (k.min = g), f && (k.max = f), k.value = w, A.appendChild(F), A.appendChild(k), x.appendChild(A);
|
|
1735
|
+
const I = document.createElement("span");
|
|
1736
|
+
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1737
|
+
const T = document.createElement("div");
|
|
1738
|
+
T.className = "tbw-filter-date-group";
|
|
1739
|
+
const P = document.createElement("label");
|
|
1740
|
+
P.textContent = "To", P.className = "tbw-filter-range-label";
|
|
1741
|
+
const b = document.createElement("input");
|
|
1742
|
+
b.type = "date", b.className = "tbw-filter-date-input", g && (b.min = g), f && (b.max = f), b.value = v, T.appendChild(P), T.appendChild(b), x.appendChild(T), e.appendChild(x);
|
|
1743
|
+
const E = document.createElement("div");
|
|
1744
|
+
E.className = "tbw-filter-buttons";
|
|
1745
|
+
const L = document.createElement("button");
|
|
1746
|
+
L.className = "tbw-filter-apply-btn", L.textContent = "Apply", L.addEventListener("click", () => {
|
|
1747
|
+
const m = k.value, R = b.value;
|
|
1748
|
+
m && R ? t.applyTextFilter("between", m, R) : m ? t.applyTextFilter("greaterThanOrEqual", m) : R ? t.applyTextFilter("lessThanOrEqual", R) : t.clearFilter();
|
|
1749
|
+
}), E.appendChild(L);
|
|
1750
|
+
const C = document.createElement("button");
|
|
1751
|
+
C.className = "tbw-filter-clear-btn", C.textContent = "Clear Filter", C.addEventListener("click", () => {
|
|
1752
|
+
t.clearFilter();
|
|
1753
|
+
}), E.appendChild(C), e.appendChild(E);
|
|
1639
1754
|
}
|
|
1640
1755
|
applySetFilter(e, t) {
|
|
1641
1756
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -1701,7 +1816,7 @@ class T extends R {
|
|
|
1701
1816
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1702
1817
|
}
|
|
1703
1818
|
}
|
|
1704
|
-
function
|
|
1819
|
+
function Ie(s) {
|
|
1705
1820
|
if (!s.length) return [];
|
|
1706
1821
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1707
1822
|
if (!a.length) return;
|
|
@@ -1736,7 +1851,7 @@ function Se(s) {
|
|
|
1736
1851
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1737
1852
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1738
1853
|
}
|
|
1739
|
-
function
|
|
1854
|
+
function Vt(s, e, t) {
|
|
1740
1855
|
if (!e.length || !s) return;
|
|
1741
1856
|
const i = /* @__PURE__ */ new Map();
|
|
1742
1857
|
for (const r of e)
|
|
@@ -1752,7 +1867,7 @@ function qt(s, e, t) {
|
|
|
1752
1867
|
a && a.classList.add("group-end");
|
|
1753
1868
|
}
|
|
1754
1869
|
}
|
|
1755
|
-
function
|
|
1870
|
+
function Wt(s, e) {
|
|
1756
1871
|
if (s.length === 0) return null;
|
|
1757
1872
|
const t = document.createElement("div");
|
|
1758
1873
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1764,11 +1879,11 @@ function Kt(s, e) {
|
|
|
1764
1879
|
}
|
|
1765
1880
|
return t;
|
|
1766
1881
|
}
|
|
1767
|
-
function
|
|
1882
|
+
function $t(s) {
|
|
1768
1883
|
return s.some((e) => e.group != null);
|
|
1769
1884
|
}
|
|
1770
|
-
const
|
|
1771
|
-
class
|
|
1885
|
+
const jt = "@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)}}";
|
|
1886
|
+
class mn extends _ {
|
|
1772
1887
|
static manifest = {
|
|
1773
1888
|
ownedProperties: [
|
|
1774
1889
|
{
|
|
@@ -1785,7 +1900,7 @@ class ln extends R {
|
|
|
1785
1900
|
]
|
|
1786
1901
|
};
|
|
1787
1902
|
name = "groupingColumns";
|
|
1788
|
-
styles =
|
|
1903
|
+
styles = jt;
|
|
1789
1904
|
get defaultConfig() {
|
|
1790
1905
|
return {
|
|
1791
1906
|
showGroupBorders: !0
|
|
@@ -1800,7 +1915,7 @@ class ln extends R {
|
|
|
1800
1915
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1801
1916
|
return !0;
|
|
1802
1917
|
const i = t?.columns;
|
|
1803
|
-
return Array.isArray(i) ?
|
|
1918
|
+
return Array.isArray(i) ? $t(i) : !1;
|
|
1804
1919
|
}
|
|
1805
1920
|
processColumns(e) {
|
|
1806
1921
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -1816,7 +1931,7 @@ class ln extends R {
|
|
|
1816
1931
|
});
|
|
1817
1932
|
} else
|
|
1818
1933
|
i = [...e];
|
|
1819
|
-
const n =
|
|
1934
|
+
const n = Ie(i);
|
|
1820
1935
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
1821
1936
|
}
|
|
1822
1937
|
afterRender() {
|
|
@@ -1829,16 +1944,16 @@ class ln extends R {
|
|
|
1829
1944
|
if (!e) return;
|
|
1830
1945
|
const t = e.querySelector(".header-group-row");
|
|
1831
1946
|
t && t.remove();
|
|
1832
|
-
const i = this.columns, n =
|
|
1947
|
+
const i = this.columns, n = Ie(i);
|
|
1833
1948
|
if (n.length === 0) return;
|
|
1834
|
-
const r =
|
|
1949
|
+
const r = Wt(n, i);
|
|
1835
1950
|
if (r) {
|
|
1836
1951
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
1837
1952
|
const a = e.querySelector(".header-row");
|
|
1838
1953
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
1839
1954
|
}
|
|
1840
1955
|
const o = e.querySelector(".header-row");
|
|
1841
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
1956
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Vt(o, n)), this.#e(n);
|
|
1842
1957
|
}
|
|
1843
1958
|
#e(e) {
|
|
1844
1959
|
if (!this.config.showGroupBorders) return;
|
|
@@ -1869,7 +1984,7 @@ class ln extends R {
|
|
|
1869
1984
|
this.requestRender();
|
|
1870
1985
|
}
|
|
1871
1986
|
}
|
|
1872
|
-
function
|
|
1987
|
+
function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
1873
1988
|
const n = e.groupOn;
|
|
1874
1989
|
if (typeof n != "function")
|
|
1875
1990
|
return [];
|
|
@@ -1880,8 +1995,8 @@ function ke({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
1880
1995
|
let u = r;
|
|
1881
1996
|
c.forEach((h, g) => {
|
|
1882
1997
|
const f = h == null ? "∅" : String(h), p = u.key === "__root__" ? f : u.key + "||" + f;
|
|
1883
|
-
let
|
|
1884
|
-
|
|
1998
|
+
let w = u.children.get(f);
|
|
1999
|
+
w || (w = { key: p, value: h, depth: g, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(f, w)), u = w;
|
|
1885
2000
|
}), u.rows.push(d);
|
|
1886
2001
|
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === s.length)
|
|
1887
2002
|
return [];
|
|
@@ -1902,20 +2017,20 @@ function ke({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
1902
2017
|
};
|
|
1903
2018
|
return l(r), a;
|
|
1904
2019
|
}
|
|
1905
|
-
function
|
|
2020
|
+
function Ut(s, e) {
|
|
1906
2021
|
const t = new Set(s);
|
|
1907
2022
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
1908
2023
|
}
|
|
1909
|
-
function
|
|
2024
|
+
function Yt(s) {
|
|
1910
2025
|
const e = /* @__PURE__ */ new Set();
|
|
1911
2026
|
for (const t of s)
|
|
1912
2027
|
t.kind === "group" && e.add(t.key);
|
|
1913
2028
|
return e;
|
|
1914
2029
|
}
|
|
1915
|
-
function
|
|
2030
|
+
function Xt() {
|
|
1916
2031
|
return /* @__PURE__ */ new Set();
|
|
1917
2032
|
}
|
|
1918
|
-
function
|
|
2033
|
+
function Zt(s, e) {
|
|
1919
2034
|
if (s === !0)
|
|
1920
2035
|
return new Set(e);
|
|
1921
2036
|
if (s === !1 || s == null)
|
|
@@ -1926,14 +2041,14 @@ function Bt(s, e) {
|
|
|
1926
2041
|
}
|
|
1927
2042
|
return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
|
|
1928
2043
|
}
|
|
1929
|
-
function
|
|
2044
|
+
function Jt(s) {
|
|
1930
2045
|
return s.filter((e) => e.kind === "group").map((e) => e.key);
|
|
1931
2046
|
}
|
|
1932
|
-
function
|
|
2047
|
+
function Qt(s) {
|
|
1933
2048
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
1934
2049
|
}
|
|
1935
|
-
const
|
|
1936
|
-
class
|
|
2050
|
+
const ei = "@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}}}";
|
|
2051
|
+
class wn extends _ {
|
|
1937
2052
|
static manifest = {
|
|
1938
2053
|
configRules: [
|
|
1939
2054
|
{
|
|
@@ -1948,7 +2063,7 @@ class dn extends R {
|
|
|
1948
2063
|
]
|
|
1949
2064
|
};
|
|
1950
2065
|
name = "groupingRows";
|
|
1951
|
-
styles =
|
|
2066
|
+
styles = ei;
|
|
1952
2067
|
get defaultConfig() {
|
|
1953
2068
|
return {
|
|
1954
2069
|
defaultExpanded: !1,
|
|
@@ -1978,7 +2093,7 @@ class dn extends R {
|
|
|
1978
2093
|
const t = this.config;
|
|
1979
2094
|
if (typeof t.groupOn != "function")
|
|
1980
2095
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1981
|
-
const i =
|
|
2096
|
+
const i = Pe({
|
|
1982
2097
|
rows: [...e],
|
|
1983
2098
|
config: t,
|
|
1984
2099
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -1987,10 +2102,10 @@ class dn extends R {
|
|
|
1987
2102
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1988
2103
|
let n;
|
|
1989
2104
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
1990
|
-
const a =
|
|
1991
|
-
n =
|
|
2105
|
+
const a = Jt(i);
|
|
2106
|
+
n = Zt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
1992
2107
|
}
|
|
1993
|
-
const r =
|
|
2108
|
+
const r = Pe({
|
|
1994
2109
|
rows: [...e],
|
|
1995
2110
|
config: t,
|
|
1996
2111
|
expanded: this.expandedKeys,
|
|
@@ -2010,7 +2125,7 @@ class dn extends R {
|
|
|
2010
2125
|
__groupDepth: a.depth,
|
|
2011
2126
|
__groupRows: a.rows,
|
|
2012
2127
|
__groupExpanded: a.expanded,
|
|
2013
|
-
__groupRowCount:
|
|
2128
|
+
__groupRowCount: Qt(a)
|
|
2014
2129
|
} : a.row);
|
|
2015
2130
|
}
|
|
2016
2131
|
onCellClick(e) {
|
|
@@ -2082,12 +2197,12 @@ class dn extends R {
|
|
|
2082
2197
|
const c = document.createElement("span");
|
|
2083
2198
|
c.className = "group-aggregates";
|
|
2084
2199
|
for (const [u, h] of d) {
|
|
2085
|
-
const g = this.columns.find((p) => p.field === u), f =
|
|
2200
|
+
const g = this.columns.find((p) => p.field === u), f = te(h, o, u, g);
|
|
2086
2201
|
if (f != null) {
|
|
2087
2202
|
const p = document.createElement("span");
|
|
2088
2203
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
2089
|
-
const
|
|
2090
|
-
p.textContent = `${
|
|
2204
|
+
const w = g?.header ?? u;
|
|
2205
|
+
p.textContent = `${w}: ${f}`, c.appendChild(p);
|
|
2091
2206
|
}
|
|
2092
2207
|
}
|
|
2093
2208
|
c.children.length > 0 && a.appendChild(c);
|
|
@@ -2100,14 +2215,14 @@ class dn extends R {
|
|
|
2100
2215
|
let c = !1;
|
|
2101
2216
|
o.forEach((u, h) => {
|
|
2102
2217
|
const g = document.createElement("div");
|
|
2103
|
-
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"),
|
|
2218
|
+
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), pe(u)) {
|
|
2104
2219
|
g.setAttribute("data-field", u.field), t.appendChild(g);
|
|
2105
2220
|
return;
|
|
2106
2221
|
}
|
|
2107
2222
|
if (c) {
|
|
2108
2223
|
const f = r[u.field];
|
|
2109
2224
|
if (f) {
|
|
2110
|
-
const p =
|
|
2225
|
+
const p = te(f, a, u.field, u);
|
|
2111
2226
|
g.textContent = p != null ? String(p) : "";
|
|
2112
2227
|
} else
|
|
2113
2228
|
g.textContent = "";
|
|
@@ -2115,23 +2230,23 @@ class dn extends R {
|
|
|
2115
2230
|
c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2116
2231
|
const f = document.createElement("span"), p = r[u.field];
|
|
2117
2232
|
if (p) {
|
|
2118
|
-
const
|
|
2119
|
-
f.textContent =
|
|
2233
|
+
const w = te(p, a, u.field, u);
|
|
2234
|
+
f.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2120
2235
|
} else
|
|
2121
2236
|
f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
2122
2237
|
if (g.appendChild(f), n.showRowCount !== !1) {
|
|
2123
|
-
const
|
|
2124
|
-
|
|
2238
|
+
const w = document.createElement("span");
|
|
2239
|
+
w.className = "group-count", w.textContent = ` (${a.length})`, g.appendChild(w);
|
|
2125
2240
|
}
|
|
2126
2241
|
}
|
|
2127
2242
|
t.appendChild(g);
|
|
2128
2243
|
});
|
|
2129
2244
|
}
|
|
2130
2245
|
expandAll() {
|
|
2131
|
-
this.expandedKeys =
|
|
2246
|
+
this.expandedKeys = Yt(this.flattenedRows), this.requestRender();
|
|
2132
2247
|
}
|
|
2133
2248
|
collapseAll() {
|
|
2134
|
-
this.expandedKeys =
|
|
2249
|
+
this.expandedKeys = Xt(), this.requestRender();
|
|
2135
2250
|
}
|
|
2136
2251
|
toggle(e) {
|
|
2137
2252
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2146,7 +2261,7 @@ class dn extends R {
|
|
|
2146
2261
|
}
|
|
2147
2262
|
r.add(e), this.expandedKeys = r;
|
|
2148
2263
|
} else
|
|
2149
|
-
this.expandedKeys =
|
|
2264
|
+
this.expandedKeys = Ut(this.expandedKeys, e);
|
|
2150
2265
|
this.emit("group-toggle", {
|
|
2151
2266
|
key: e,
|
|
2152
2267
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2194,22 +2309,22 @@ class dn extends R {
|
|
|
2194
2309
|
this.config.groupOn = e, this.requestRender();
|
|
2195
2310
|
}
|
|
2196
2311
|
}
|
|
2197
|
-
function
|
|
2312
|
+
function De(s, e) {
|
|
2198
2313
|
const t = new Set(s);
|
|
2199
2314
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2200
2315
|
}
|
|
2201
|
-
function
|
|
2316
|
+
function ti(s, e) {
|
|
2202
2317
|
const t = new Set(s);
|
|
2203
2318
|
return t.add(e), t;
|
|
2204
2319
|
}
|
|
2205
|
-
function
|
|
2320
|
+
function ii(s, e) {
|
|
2206
2321
|
const t = new Set(s);
|
|
2207
2322
|
return t.delete(e), t;
|
|
2208
2323
|
}
|
|
2209
|
-
function
|
|
2324
|
+
function ni(s, e) {
|
|
2210
2325
|
return s.has(e);
|
|
2211
2326
|
}
|
|
2212
|
-
function
|
|
2327
|
+
function ri(s, e, t, i) {
|
|
2213
2328
|
const n = document.createElement("div");
|
|
2214
2329
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2215
2330
|
const r = document.createElement("div");
|
|
@@ -2217,10 +2332,10 @@ function Xt(s, e, t, i) {
|
|
|
2217
2332
|
const o = t(s, e);
|
|
2218
2333
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2219
2334
|
}
|
|
2220
|
-
const
|
|
2221
|
-
class
|
|
2335
|
+
const oi = "@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}}}";
|
|
2336
|
+
class et extends _ {
|
|
2222
2337
|
name = "masterDetail";
|
|
2223
|
-
styles =
|
|
2338
|
+
styles = oi;
|
|
2224
2339
|
get defaultConfig() {
|
|
2225
2340
|
return {
|
|
2226
2341
|
detailHeight: "auto",
|
|
@@ -2249,8 +2364,8 @@ class je extends R {
|
|
|
2249
2364
|
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), a !== null && (d.collapseOnClickOutside = a === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
|
|
2250
2365
|
const c = t.innerHTML.trim();
|
|
2251
2366
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2252
|
-
const g =
|
|
2253
|
-
return
|
|
2367
|
+
const g = lt(c, { value: u, row: u });
|
|
2368
|
+
return dt(g);
|
|
2254
2369
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2255
2370
|
}
|
|
2256
2371
|
get animationStyle() {
|
|
@@ -2281,10 +2396,10 @@ class je extends R {
|
|
|
2281
2396
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2282
2397
|
getDetailHeight(e) {
|
|
2283
2398
|
const t = this.detailElements.get(e);
|
|
2284
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2399
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : et.DEFAULT_DETAIL_HEIGHT;
|
|
2285
2400
|
}
|
|
2286
2401
|
toggleAndEmit(e, t) {
|
|
2287
|
-
this.expandedRows =
|
|
2402
|
+
this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
|
|
2288
2403
|
rowIndex: t,
|
|
2289
2404
|
row: e,
|
|
2290
2405
|
expanded: this.expandedRows.has(e)
|
|
@@ -2297,9 +2412,9 @@ class je extends R {
|
|
|
2297
2412
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2298
2413
|
return [...e];
|
|
2299
2414
|
const i = [...e];
|
|
2300
|
-
if (
|
|
2415
|
+
if (gt(i))
|
|
2301
2416
|
return i;
|
|
2302
|
-
const r =
|
|
2417
|
+
const r = ft(this.name);
|
|
2303
2418
|
return r.viewRenderer = (o) => {
|
|
2304
2419
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2305
2420
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2319,7 +2434,7 @@ class je extends R {
|
|
|
2319
2434
|
onKeyDown(e) {
|
|
2320
2435
|
if (e.key !== " ") return;
|
|
2321
2436
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2322
|
-
if (!n || !
|
|
2437
|
+
if (!n || !pe(n)) return;
|
|
2323
2438
|
const r = this.rows[i];
|
|
2324
2439
|
if (r)
|
|
2325
2440
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -2352,7 +2467,7 @@ class je extends R {
|
|
|
2352
2467
|
d.previousElementSibling !== a && a.after(d);
|
|
2353
2468
|
continue;
|
|
2354
2469
|
}
|
|
2355
|
-
const c =
|
|
2470
|
+
const c = ri(l, o, this.config.detailRenderer, n);
|
|
2356
2471
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2357
2472
|
}
|
|
2358
2473
|
}
|
|
@@ -2387,19 +2502,19 @@ class je extends R {
|
|
|
2387
2502
|
}
|
|
2388
2503
|
expand(e) {
|
|
2389
2504
|
const t = this.rows[e];
|
|
2390
|
-
t && (this.expandedRows =
|
|
2505
|
+
t && (this.expandedRows = ti(this.expandedRows, t), this.requestRender());
|
|
2391
2506
|
}
|
|
2392
2507
|
collapse(e) {
|
|
2393
2508
|
const t = this.rows[e];
|
|
2394
|
-
t && (this.expandedRows =
|
|
2509
|
+
t && (this.expandedRows = ii(this.expandedRows, t), this.requestRender());
|
|
2395
2510
|
}
|
|
2396
2511
|
toggle(e) {
|
|
2397
2512
|
const t = this.rows[e];
|
|
2398
|
-
t && (this.expandedRows =
|
|
2513
|
+
t && (this.expandedRows = De(this.expandedRows, t), this.requestRender());
|
|
2399
2514
|
}
|
|
2400
2515
|
isExpanded(e) {
|
|
2401
2516
|
const t = this.rows[e];
|
|
2402
|
-
return t ?
|
|
2517
|
+
return t ? ni(this.expandedRows, t) : !1;
|
|
2403
2518
|
}
|
|
2404
2519
|
expandAll() {
|
|
2405
2520
|
for (const e of this.rows)
|
|
@@ -2429,34 +2544,34 @@ class je extends R {
|
|
|
2429
2544
|
}
|
|
2430
2545
|
}
|
|
2431
2546
|
}
|
|
2432
|
-
function
|
|
2547
|
+
function si(s, e, t) {
|
|
2433
2548
|
return e.length ? [...s].sort((i, n) => {
|
|
2434
2549
|
for (const r of e) {
|
|
2435
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2550
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? ai, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2436
2551
|
if (c !== 0)
|
|
2437
2552
|
return r.direction === "asc" ? c : -c;
|
|
2438
2553
|
}
|
|
2439
2554
|
return 0;
|
|
2440
2555
|
}) : [...s];
|
|
2441
2556
|
}
|
|
2442
|
-
function
|
|
2557
|
+
function ai(s, e) {
|
|
2443
2558
|
return s == null && e == null ? 0 : s == null ? 1 : e == null ? -1 : typeof s == "number" && typeof e == "number" ? s - e : s instanceof Date && e instanceof Date ? s.getTime() - e.getTime() : typeof s == "boolean" && typeof e == "boolean" ? s === e ? 0 : s ? -1 : 1 : String(s).localeCompare(String(e));
|
|
2444
2559
|
}
|
|
2445
|
-
function
|
|
2560
|
+
function li(s, e, t, i) {
|
|
2446
2561
|
const n = s.find((r) => r.field === e);
|
|
2447
2562
|
return t ? n ? n.direction === "asc" ? s.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : s.filter((r) => r.field !== e) : s.length < i ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
|
|
2448
2563
|
}
|
|
2449
|
-
function
|
|
2564
|
+
function Me(s, e) {
|
|
2450
2565
|
const t = s.findIndex((i) => i.field === e);
|
|
2451
2566
|
return t >= 0 ? t + 1 : void 0;
|
|
2452
2567
|
}
|
|
2453
|
-
function
|
|
2568
|
+
function Ne(s, e) {
|
|
2454
2569
|
return s.find((t) => t.field === e)?.direction;
|
|
2455
2570
|
}
|
|
2456
|
-
const
|
|
2457
|
-
class
|
|
2571
|
+
const di = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;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:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
|
|
2572
|
+
class bn extends _ {
|
|
2458
2573
|
name = "multiSort";
|
|
2459
|
-
styles =
|
|
2574
|
+
styles = di;
|
|
2460
2575
|
get defaultConfig() {
|
|
2461
2576
|
return {
|
|
2462
2577
|
maxSortColumns: 3,
|
|
@@ -2468,12 +2583,12 @@ class cn extends R {
|
|
|
2468
2583
|
this.sortModel = [];
|
|
2469
2584
|
}
|
|
2470
2585
|
processRows(e) {
|
|
2471
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2586
|
+
return this.sortModel.length === 0 ? [...e] : si([...e], this.sortModel, [...this.columns]);
|
|
2472
2587
|
}
|
|
2473
2588
|
onHeaderClick(e) {
|
|
2474
2589
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2475
2590
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2476
|
-
return this.sortModel =
|
|
2591
|
+
return this.sortModel = li(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2477
2592
|
}
|
|
2478
2593
|
afterRender() {
|
|
2479
2594
|
const e = this.gridElement;
|
|
@@ -2482,7 +2597,7 @@ class cn extends R {
|
|
|
2482
2597
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2483
2598
|
const r = n.getAttribute("data-field");
|
|
2484
2599
|
if (!r) return;
|
|
2485
|
-
const o =
|
|
2600
|
+
const o = Me(this.sortModel, r), a = Ne(this.sortModel, r);
|
|
2486
2601
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2487
2602
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2488
2603
|
const c = document.createElement("span");
|
|
@@ -2506,10 +2621,10 @@ class cn extends R {
|
|
|
2506
2621
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2507
2622
|
}
|
|
2508
2623
|
getSortIndex(e) {
|
|
2509
|
-
return
|
|
2624
|
+
return Me(this.sortModel, e);
|
|
2510
2625
|
}
|
|
2511
2626
|
getSortDirection(e) {
|
|
2512
|
-
return
|
|
2627
|
+
return Ne(this.sortModel, e);
|
|
2513
2628
|
}
|
|
2514
2629
|
getColumnState(e) {
|
|
2515
2630
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2532,16 +2647,16 @@ class cn extends R {
|
|
|
2532
2647
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2533
2648
|
}
|
|
2534
2649
|
}
|
|
2535
|
-
function
|
|
2650
|
+
function ci(s) {
|
|
2536
2651
|
return s.filter((e) => e.sticky === "left");
|
|
2537
2652
|
}
|
|
2538
|
-
function
|
|
2653
|
+
function ui(s) {
|
|
2539
2654
|
return s.filter((e) => e.sticky === "right");
|
|
2540
2655
|
}
|
|
2541
|
-
function
|
|
2656
|
+
function ae(s) {
|
|
2542
2657
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2543
2658
|
}
|
|
2544
|
-
function
|
|
2659
|
+
function qe(s, e) {
|
|
2545
2660
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2546
2661
|
if (!t.length) return;
|
|
2547
2662
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2565,12 +2680,12 @@ function Te(s, e) {
|
|
|
2565
2680
|
}), r += l.offsetWidth);
|
|
2566
2681
|
}
|
|
2567
2682
|
}
|
|
2568
|
-
function
|
|
2683
|
+
function Ke(s) {
|
|
2569
2684
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2570
2685
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2571
2686
|
});
|
|
2572
2687
|
}
|
|
2573
|
-
class
|
|
2688
|
+
class vn extends _ {
|
|
2574
2689
|
static manifest = {
|
|
2575
2690
|
ownedProperties: [
|
|
2576
2691
|
{
|
|
@@ -2593,26 +2708,26 @@ class un extends R {
|
|
|
2593
2708
|
}
|
|
2594
2709
|
static detect(e, t) {
|
|
2595
2710
|
const i = t?.columns;
|
|
2596
|
-
return Array.isArray(i) ?
|
|
2711
|
+
return Array.isArray(i) ? ae(i) : !1;
|
|
2597
2712
|
}
|
|
2598
2713
|
processColumns(e) {
|
|
2599
|
-
return this.isApplied =
|
|
2714
|
+
return this.isApplied = ae([...e]), [...e];
|
|
2600
2715
|
}
|
|
2601
2716
|
afterRender() {
|
|
2602
2717
|
if (!this.isApplied)
|
|
2603
2718
|
return;
|
|
2604
2719
|
const e = this.grid, t = [...this.columns];
|
|
2605
|
-
if (!
|
|
2606
|
-
|
|
2720
|
+
if (!ae(t)) {
|
|
2721
|
+
Ke(e), this.isApplied = !1;
|
|
2607
2722
|
return;
|
|
2608
2723
|
}
|
|
2609
2724
|
queueMicrotask(() => {
|
|
2610
|
-
|
|
2725
|
+
qe(e, t);
|
|
2611
2726
|
});
|
|
2612
2727
|
}
|
|
2613
2728
|
onPluginQuery(e) {
|
|
2614
2729
|
switch (e.type) {
|
|
2615
|
-
case
|
|
2730
|
+
case Je.CAN_MOVE_COLUMN: {
|
|
2616
2731
|
const t = e.context, i = t.sticky;
|
|
2617
2732
|
if (i === "left" || i === "right")
|
|
2618
2733
|
return !1;
|
|
@@ -2625,18 +2740,18 @@ class un extends R {
|
|
|
2625
2740
|
}
|
|
2626
2741
|
refreshStickyOffsets() {
|
|
2627
2742
|
const e = [...this.columns];
|
|
2628
|
-
|
|
2743
|
+
qe(this.grid, e);
|
|
2629
2744
|
}
|
|
2630
2745
|
getLeftPinnedColumns() {
|
|
2631
2746
|
const e = [...this.columns];
|
|
2632
|
-
return
|
|
2747
|
+
return ci(e);
|
|
2633
2748
|
}
|
|
2634
2749
|
getRightPinnedColumns() {
|
|
2635
2750
|
const e = [...this.columns];
|
|
2636
|
-
return
|
|
2751
|
+
return ui(e);
|
|
2637
2752
|
}
|
|
2638
2753
|
clearStickyPositions() {
|
|
2639
|
-
|
|
2754
|
+
Ke(this.grid);
|
|
2640
2755
|
}
|
|
2641
2756
|
getHorizontalScrollOffsets(e, t) {
|
|
2642
2757
|
if (!this.isApplied)
|
|
@@ -2657,10 +2772,10 @@ class un extends R {
|
|
|
2657
2772
|
return { left: i, right: n, skipScroll: r };
|
|
2658
2773
|
}
|
|
2659
2774
|
}
|
|
2660
|
-
function
|
|
2775
|
+
function hi(s) {
|
|
2661
2776
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2662
2777
|
}
|
|
2663
|
-
function
|
|
2778
|
+
function le(s, e) {
|
|
2664
2779
|
const t = document.createElement("div");
|
|
2665
2780
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
2666
2781
|
const i = document.createElement("div");
|
|
@@ -2682,7 +2797,7 @@ function ee(s, e) {
|
|
|
2682
2797
|
}
|
|
2683
2798
|
if (s.customPanels)
|
|
2684
2799
|
for (const o of s.customPanels) {
|
|
2685
|
-
const a =
|
|
2800
|
+
const a = gi(o, e);
|
|
2686
2801
|
switch (o.position) {
|
|
2687
2802
|
case "left":
|
|
2688
2803
|
i.appendChild(a);
|
|
@@ -2697,11 +2812,11 @@ function ee(s, e) {
|
|
|
2697
2812
|
}
|
|
2698
2813
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2699
2814
|
}
|
|
2700
|
-
function
|
|
2815
|
+
function He(s) {
|
|
2701
2816
|
const e = document.createElement("div");
|
|
2702
2817
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2703
2818
|
}
|
|
2704
|
-
function
|
|
2819
|
+
function ze(s, e, t, i) {
|
|
2705
2820
|
s.innerHTML = "";
|
|
2706
2821
|
for (const n of e) {
|
|
2707
2822
|
const r = document.createElement("div");
|
|
@@ -2715,11 +2830,11 @@ function De(s, e, t, i) {
|
|
|
2715
2830
|
let l, d;
|
|
2716
2831
|
const c = n.aggregators?.[o.field];
|
|
2717
2832
|
if (c)
|
|
2718
|
-
if (
|
|
2719
|
-
const u =
|
|
2833
|
+
if (hi(c)) {
|
|
2834
|
+
const u = ye(c.aggFunc);
|
|
2720
2835
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2721
2836
|
} else {
|
|
2722
|
-
const u =
|
|
2837
|
+
const u = ye(c);
|
|
2723
2838
|
u && (l = u(i, o.field, o));
|
|
2724
2839
|
}
|
|
2725
2840
|
else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
|
|
@@ -2731,13 +2846,13 @@ function De(s, e, t, i) {
|
|
|
2731
2846
|
s.appendChild(r);
|
|
2732
2847
|
}
|
|
2733
2848
|
}
|
|
2734
|
-
function
|
|
2849
|
+
function gi(s, e) {
|
|
2735
2850
|
const t = document.createElement("div");
|
|
2736
2851
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2737
2852
|
const i = s.render(e);
|
|
2738
2853
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2739
2854
|
}
|
|
2740
|
-
function
|
|
2855
|
+
function Ge(s, e, t, i, n) {
|
|
2741
2856
|
return {
|
|
2742
2857
|
totalRows: s.length,
|
|
2743
2858
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2747,10 +2862,10 @@ function Fe(s, e, t, i, n) {
|
|
|
2747
2862
|
grid: t
|
|
2748
2863
|
};
|
|
2749
2864
|
}
|
|
2750
|
-
const
|
|
2751
|
-
class
|
|
2865
|
+
const fi = "@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}}";
|
|
2866
|
+
class yn extends _ {
|
|
2752
2867
|
name = "pinnedRows";
|
|
2753
|
-
styles =
|
|
2868
|
+
styles = fi;
|
|
2754
2869
|
get defaultConfig() {
|
|
2755
2870
|
return {
|
|
2756
2871
|
position: "bottom",
|
|
@@ -2772,7 +2887,7 @@ class hn extends R {
|
|
|
2772
2887
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2773
2888
|
if (!t) return;
|
|
2774
2889
|
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);
|
|
2775
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
2890
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Ge(
|
|
2776
2891
|
this.rows,
|
|
2777
2892
|
this.columns,
|
|
2778
2893
|
this.grid,
|
|
@@ -2781,11 +2896,11 @@ class hn extends R {
|
|
|
2781
2896
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
2782
2897
|
if (a.length > 0) {
|
|
2783
2898
|
if (!this.topAggregationContainer) {
|
|
2784
|
-
this.topAggregationContainer =
|
|
2899
|
+
this.topAggregationContainer = He("top");
|
|
2785
2900
|
const h = e.querySelector(".header");
|
|
2786
2901
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
2787
2902
|
}
|
|
2788
|
-
|
|
2903
|
+
ze(
|
|
2789
2904
|
this.topAggregationContainer,
|
|
2790
2905
|
a,
|
|
2791
2906
|
this.visibleColumns,
|
|
@@ -2795,18 +2910,18 @@ class hn extends R {
|
|
|
2795
2910
|
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;
|
|
2796
2911
|
if (d && this.config.position === "top")
|
|
2797
2912
|
if (!this.infoBarElement)
|
|
2798
|
-
this.infoBarElement =
|
|
2913
|
+
this.infoBarElement = le(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
2799
2914
|
else {
|
|
2800
|
-
const h =
|
|
2915
|
+
const h = le(this.config, r);
|
|
2801
2916
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2802
2917
|
}
|
|
2803
2918
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
2804
|
-
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer =
|
|
2919
|
+
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = He("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), ze(
|
|
2805
2920
|
this.bottomAggregationContainer,
|
|
2806
2921
|
l,
|
|
2807
2922
|
this.visibleColumns,
|
|
2808
2923
|
this.rows
|
|
2809
|
-
)), c && (this.infoBarElement =
|
|
2924
|
+
)), c && (this.infoBarElement = le(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
2810
2925
|
}
|
|
2811
2926
|
cleanup() {
|
|
2812
2927
|
this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null), this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null), this.bottomAggregationContainer && (this.bottomAggregationContainer.remove(), this.bottomAggregationContainer = null), this.footerWrapper && (this.footerWrapper.remove(), this.footerWrapper = null);
|
|
@@ -2833,7 +2948,7 @@ class hn extends R {
|
|
|
2833
2948
|
}
|
|
2834
2949
|
getContext() {
|
|
2835
2950
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
2836
|
-
return
|
|
2951
|
+
return Ge(
|
|
2837
2952
|
this.rows,
|
|
2838
2953
|
this.columns,
|
|
2839
2954
|
this.grid,
|
|
@@ -2854,16 +2969,16 @@ class hn extends R {
|
|
|
2854
2969
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
2855
2970
|
}
|
|
2856
2971
|
}
|
|
2857
|
-
const
|
|
2858
|
-
function
|
|
2972
|
+
const pi = ct;
|
|
2973
|
+
function mi(s) {
|
|
2859
2974
|
const e = [];
|
|
2860
2975
|
return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
|
|
2861
2976
|
}
|
|
2862
|
-
function
|
|
2977
|
+
function be(s, e) {
|
|
2863
2978
|
return [...s, e].join("|");
|
|
2864
2979
|
}
|
|
2865
|
-
function
|
|
2866
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
2980
|
+
function wi(s, e) {
|
|
2981
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = bi(s, i), o = tt(
|
|
2867
2982
|
s,
|
|
2868
2983
|
t,
|
|
2869
2984
|
i,
|
|
@@ -2871,7 +2986,7 @@ function di(s, e) {
|
|
|
2871
2986
|
n,
|
|
2872
2987
|
0,
|
|
2873
2988
|
""
|
|
2874
|
-
), a =
|
|
2989
|
+
), a = yi(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
2875
2990
|
return {
|
|
2876
2991
|
rows: o,
|
|
2877
2992
|
columnKeys: r,
|
|
@@ -2879,7 +2994,7 @@ function di(s, e) {
|
|
|
2879
2994
|
grandTotal: l
|
|
2880
2995
|
};
|
|
2881
2996
|
}
|
|
2882
|
-
function
|
|
2997
|
+
function bi(s, e) {
|
|
2883
2998
|
if (e.length === 0) return ["value"];
|
|
2884
2999
|
const t = /* @__PURE__ */ new Set();
|
|
2885
3000
|
for (const i of s) {
|
|
@@ -2888,7 +3003,7 @@ function ci(s, e) {
|
|
|
2888
3003
|
}
|
|
2889
3004
|
return [...t].sort();
|
|
2890
3005
|
}
|
|
2891
|
-
function
|
|
3006
|
+
function vi(s, e) {
|
|
2892
3007
|
const t = /* @__PURE__ */ new Map();
|
|
2893
3008
|
for (const i of s) {
|
|
2894
3009
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -2896,10 +3011,10 @@ function ui(s, e) {
|
|
|
2896
3011
|
}
|
|
2897
3012
|
return t;
|
|
2898
3013
|
}
|
|
2899
|
-
function
|
|
3014
|
+
function tt(s, e, t, i, n, r, o) {
|
|
2900
3015
|
const a = [];
|
|
2901
3016
|
if (e.length === 0) {
|
|
2902
|
-
const h =
|
|
3017
|
+
const h = Oe(s, t, i, n), g = Be(h);
|
|
2903
3018
|
return a.push({
|
|
2904
3019
|
rowKey: o || "all",
|
|
2905
3020
|
rowLabel: o || "All",
|
|
@@ -2910,11 +3025,11 @@ function Ue(s, e, t, i, n, r, o) {
|
|
|
2910
3025
|
rowCount: s.length
|
|
2911
3026
|
}), a;
|
|
2912
3027
|
}
|
|
2913
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3028
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = vi(s, l);
|
|
2914
3029
|
for (const [h, g] of u) {
|
|
2915
|
-
const f = o ? `${o}|${h}` : h, p =
|
|
2916
|
-
let
|
|
2917
|
-
c && (
|
|
3030
|
+
const f = o ? `${o}|${h}` : h, p = Oe(g, t, i, n), w = Be(p);
|
|
3031
|
+
let v;
|
|
3032
|
+
c && (v = tt(
|
|
2918
3033
|
g,
|
|
2919
3034
|
d,
|
|
2920
3035
|
t,
|
|
@@ -2927,44 +3042,44 @@ function Ue(s, e, t, i, n, r, o) {
|
|
|
2927
3042
|
rowLabel: h || "(blank)",
|
|
2928
3043
|
depth: r,
|
|
2929
3044
|
values: p,
|
|
2930
|
-
total:
|
|
3045
|
+
total: w,
|
|
2931
3046
|
isGroup: c,
|
|
2932
|
-
children:
|
|
3047
|
+
children: v,
|
|
2933
3048
|
rowCount: g.length
|
|
2934
3049
|
});
|
|
2935
3050
|
}
|
|
2936
3051
|
return a;
|
|
2937
3052
|
}
|
|
2938
|
-
function
|
|
3053
|
+
function Oe(s, e, t, i) {
|
|
2939
3054
|
const n = {};
|
|
2940
3055
|
for (const r of t)
|
|
2941
3056
|
for (const o of i) {
|
|
2942
|
-
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d =
|
|
3057
|
+
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = pi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
|
|
2943
3058
|
n[u] = c;
|
|
2944
3059
|
}
|
|
2945
3060
|
return n;
|
|
2946
3061
|
}
|
|
2947
|
-
function
|
|
3062
|
+
function Be(s) {
|
|
2948
3063
|
let e = 0;
|
|
2949
3064
|
for (const t of Object.values(s))
|
|
2950
3065
|
e += t ?? 0;
|
|
2951
3066
|
return e;
|
|
2952
3067
|
}
|
|
2953
|
-
function
|
|
3068
|
+
function yi(s, e, t) {
|
|
2954
3069
|
const i = {};
|
|
2955
3070
|
function n(r) {
|
|
2956
3071
|
for (const o of r)
|
|
2957
3072
|
if (!o.isGroup || !o.children?.length)
|
|
2958
3073
|
for (const a of e)
|
|
2959
3074
|
for (const l of t) {
|
|
2960
|
-
const d =
|
|
3075
|
+
const d = be([a], l.field);
|
|
2961
3076
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
2962
3077
|
}
|
|
2963
3078
|
else o.children && n(o.children);
|
|
2964
3079
|
}
|
|
2965
3080
|
return n(s), i;
|
|
2966
3081
|
}
|
|
2967
|
-
function
|
|
3082
|
+
function xi(s, e, t = !0) {
|
|
2968
3083
|
const i = [];
|
|
2969
3084
|
function n(r) {
|
|
2970
3085
|
i.push(r);
|
|
@@ -2977,7 +3092,7 @@ function gi(s, e, t = !0) {
|
|
|
2977
3092
|
n(r);
|
|
2978
3093
|
return i;
|
|
2979
3094
|
}
|
|
2980
|
-
function
|
|
3095
|
+
function Ci(s) {
|
|
2981
3096
|
const e = [];
|
|
2982
3097
|
function t(i) {
|
|
2983
3098
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -2988,14 +3103,14 @@ function fi(s) {
|
|
|
2988
3103
|
t(i);
|
|
2989
3104
|
return e;
|
|
2990
3105
|
}
|
|
2991
|
-
const
|
|
2992
|
-
function
|
|
3106
|
+
const Ri = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3107
|
+
function Ei(s, e, t, i) {
|
|
2993
3108
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
2994
|
-
return o.className = "tbw-pivot-panel", o.appendChild(
|
|
3109
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Li(t, r))), o.appendChild(j("Row Groups", () => Ve("rowGroups", r))), o.appendChild(j("Column Groups", () => Ve("columnGroups", r))), o.appendChild(j("Values", () => ki(r))), o.appendChild(j("Available Fields", () => _i(r))), s.appendChild(o), () => {
|
|
2995
3110
|
n.abort(), o.remove();
|
|
2996
3111
|
};
|
|
2997
3112
|
}
|
|
2998
|
-
function
|
|
3113
|
+
function j(s, e) {
|
|
2999
3114
|
const t = document.createElement("div");
|
|
3000
3115
|
t.className = "tbw-pivot-section";
|
|
3001
3116
|
const i = document.createElement("div");
|
|
@@ -3003,7 +3118,7 @@ function H(s, e) {
|
|
|
3003
3118
|
const n = document.createElement("div");
|
|
3004
3119
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3005
3120
|
}
|
|
3006
|
-
function
|
|
3121
|
+
function Ve(s, e) {
|
|
3007
3122
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3008
3123
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
3009
3124
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -3012,7 +3127,7 @@ function Ke(s, e) {
|
|
|
3012
3127
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
3013
3128
|
} else
|
|
3014
3129
|
for (const a of o)
|
|
3015
|
-
r.appendChild(
|
|
3130
|
+
r.appendChild(Si(a, s, e));
|
|
3016
3131
|
return r.addEventListener(
|
|
3017
3132
|
"dragover",
|
|
3018
3133
|
(a) => {
|
|
@@ -3035,7 +3150,7 @@ function Ke(s, e) {
|
|
|
3035
3150
|
{ signal: n }
|
|
3036
3151
|
), r;
|
|
3037
3152
|
}
|
|
3038
|
-
function
|
|
3153
|
+
function Si(s, e, t) {
|
|
3039
3154
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3040
3155
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3041
3156
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -3061,7 +3176,7 @@ function wi(s, e, t) {
|
|
|
3061
3176
|
{ signal: n }
|
|
3062
3177
|
), r;
|
|
3063
3178
|
}
|
|
3064
|
-
function
|
|
3179
|
+
function ki(s) {
|
|
3065
3180
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3066
3181
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3067
3182
|
const r = e.valueFields ?? [];
|
|
@@ -3070,7 +3185,7 @@ function bi(s) {
|
|
|
3070
3185
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3071
3186
|
} else
|
|
3072
3187
|
for (const o of r)
|
|
3073
|
-
n.appendChild(
|
|
3188
|
+
n.appendChild(Ai(o, s));
|
|
3074
3189
|
return n.addEventListener(
|
|
3075
3190
|
"dragover",
|
|
3076
3191
|
(o) => {
|
|
@@ -3093,7 +3208,7 @@ function bi(s) {
|
|
|
3093
3208
|
{ signal: i }
|
|
3094
3209
|
), n;
|
|
3095
3210
|
}
|
|
3096
|
-
function
|
|
3211
|
+
function Ai(s, e) {
|
|
3097
3212
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3098
3213
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3099
3214
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3102,7 +3217,7 @@ function vi(s, e) {
|
|
|
3102
3217
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3103
3218
|
const l = document.createElement("select");
|
|
3104
3219
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3105
|
-
for (const c of
|
|
3220
|
+
for (const c of Ri) {
|
|
3106
3221
|
const u = document.createElement("option");
|
|
3107
3222
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3108
3223
|
}
|
|
@@ -3122,7 +3237,7 @@ function vi(s, e) {
|
|
|
3122
3237
|
{ signal: i }
|
|
3123
3238
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3124
3239
|
}
|
|
3125
|
-
function
|
|
3240
|
+
function _i(s) {
|
|
3126
3241
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3127
3242
|
n.className = "tbw-pivot-available-fields";
|
|
3128
3243
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3152,10 +3267,10 @@ function yi(s) {
|
|
|
3152
3267
|
}
|
|
3153
3268
|
return n;
|
|
3154
3269
|
}
|
|
3155
|
-
function
|
|
3270
|
+
function Li(s, e) {
|
|
3156
3271
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3157
3272
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3158
|
-
|
|
3273
|
+
de(
|
|
3159
3274
|
"Enable Pivot View",
|
|
3160
3275
|
s,
|
|
3161
3276
|
(o) => {
|
|
@@ -3164,7 +3279,7 @@ function xi(s, e) {
|
|
|
3164
3279
|
n
|
|
3165
3280
|
)
|
|
3166
3281
|
), r.appendChild(
|
|
3167
|
-
|
|
3282
|
+
de(
|
|
3168
3283
|
"Show Row Totals",
|
|
3169
3284
|
t.showTotals ?? !0,
|
|
3170
3285
|
(o) => {
|
|
@@ -3173,7 +3288,7 @@ function xi(s, e) {
|
|
|
3173
3288
|
n
|
|
3174
3289
|
)
|
|
3175
3290
|
), r.appendChild(
|
|
3176
|
-
|
|
3291
|
+
de(
|
|
3177
3292
|
"Show Grand Total",
|
|
3178
3293
|
t.showGrandTotal ?? !0,
|
|
3179
3294
|
(o) => {
|
|
@@ -3183,7 +3298,7 @@ function xi(s, e) {
|
|
|
3183
3298
|
)
|
|
3184
3299
|
), r;
|
|
3185
3300
|
}
|
|
3186
|
-
function
|
|
3301
|
+
function de(s, e, t, i) {
|
|
3187
3302
|
const n = document.createElement("label");
|
|
3188
3303
|
n.className = "tbw-pivot-checkbox";
|
|
3189
3304
|
const r = document.createElement("input");
|
|
@@ -3191,7 +3306,7 @@ function te(s, e, t, i) {
|
|
|
3191
3306
|
const o = document.createElement("span");
|
|
3192
3307
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3193
3308
|
}
|
|
3194
|
-
function
|
|
3309
|
+
function Ti(s, e, t) {
|
|
3195
3310
|
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
|
|
3196
3311
|
const r = document.createElement("div");
|
|
3197
3312
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3212,7 +3327,7 @@ function Ci(s, e, t) {
|
|
|
3212
3327
|
e.appendChild(r);
|
|
3213
3328
|
}), !0;
|
|
3214
3329
|
}
|
|
3215
|
-
function
|
|
3330
|
+
function Fi(s, e, t, i) {
|
|
3216
3331
|
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
|
|
3217
3332
|
const o = document.createElement("div");
|
|
3218
3333
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3227,7 +3342,7 @@ function Ri(s, e, t, i) {
|
|
|
3227
3342
|
e.appendChild(o);
|
|
3228
3343
|
}), !0;
|
|
3229
3344
|
}
|
|
3230
|
-
function
|
|
3345
|
+
function Ii(s, e, t) {
|
|
3231
3346
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3232
3347
|
const r = document.createElement("div");
|
|
3233
3348
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3240,10 +3355,10 @@ function Ei(s, e, t) {
|
|
|
3240
3355
|
e.appendChild(r);
|
|
3241
3356
|
}), !0;
|
|
3242
3357
|
}
|
|
3243
|
-
const
|
|
3244
|
-
class
|
|
3358
|
+
const Pi = '@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:18px;height:18px;margin-right:6px;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 .15s,color .15s}.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}}}';
|
|
3359
|
+
class O extends _ {
|
|
3245
3360
|
name = "pivot";
|
|
3246
|
-
styles =
|
|
3361
|
+
styles = Pi;
|
|
3247
3362
|
static PANEL_ID = "pivot";
|
|
3248
3363
|
get defaultConfig() {
|
|
3249
3364
|
return {
|
|
@@ -3277,7 +3392,7 @@ class F extends R {
|
|
|
3277
3392
|
getToolPanel() {
|
|
3278
3393
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3279
3394
|
return {
|
|
3280
|
-
id:
|
|
3395
|
+
id: O.PANEL_ID,
|
|
3281
3396
|
title: "Pivot",
|
|
3282
3397
|
icon: "⊞",
|
|
3283
3398
|
tooltip: "Configure pivot table",
|
|
@@ -3288,11 +3403,11 @@ class F extends R {
|
|
|
3288
3403
|
processRows(e) {
|
|
3289
3404
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3290
3405
|
return [...e];
|
|
3291
|
-
const t =
|
|
3406
|
+
const t = mi(this.config);
|
|
3292
3407
|
if (t.length > 0)
|
|
3293
3408
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3294
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult =
|
|
3295
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3409
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = wi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
|
|
3410
|
+
const i = this.config.indentWidth ?? 20, n = xi(
|
|
3296
3411
|
this.pivotResult.rows,
|
|
3297
3412
|
this.expandedKeys,
|
|
3298
3413
|
this.defaultExpanded
|
|
@@ -3327,7 +3442,7 @@ class F extends R {
|
|
|
3327
3442
|
});
|
|
3328
3443
|
for (const n of this.pivotResult.columnKeys)
|
|
3329
3444
|
for (const r of this.config.valueFields ?? []) {
|
|
3330
|
-
const o =
|
|
3445
|
+
const o = be([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3331
3446
|
t.push({
|
|
3332
3447
|
field: o,
|
|
3333
3448
|
header: `${n} - ${a} (${r.aggFunc})`,
|
|
@@ -3344,13 +3459,13 @@ class F extends R {
|
|
|
3344
3459
|
}
|
|
3345
3460
|
renderRow(e, t, i) {
|
|
3346
3461
|
const n = e;
|
|
3347
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3462
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Ti(n, t, {
|
|
3348
3463
|
columns: this.gridColumns,
|
|
3349
3464
|
rowIndex: i,
|
|
3350
3465
|
onToggle: (r) => this.toggle(r),
|
|
3351
3466
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3352
3467
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3353
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3468
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Fi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3354
3469
|
}
|
|
3355
3470
|
cleanupPivotStyling(e) {
|
|
3356
3471
|
(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 = "");
|
|
@@ -3388,7 +3503,7 @@ class F extends R {
|
|
|
3388
3503
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3389
3504
|
...this.pivotResult.totals
|
|
3390
3505
|
};
|
|
3391
|
-
|
|
3506
|
+
Ii(i, this.grandTotalFooter, this.gridColumns);
|
|
3392
3507
|
}
|
|
3393
3508
|
cleanupGrandTotalFooter() {
|
|
3394
3509
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3410,7 +3525,7 @@ class F extends R {
|
|
|
3410
3525
|
}
|
|
3411
3526
|
expandAllKeys() {
|
|
3412
3527
|
if (!this.pivotResult) return;
|
|
3413
|
-
const e =
|
|
3528
|
+
const e = Ci(this.pivotResult.rows);
|
|
3414
3529
|
for (const t of e)
|
|
3415
3530
|
this.expandedKeys.add(t);
|
|
3416
3531
|
}
|
|
@@ -3442,16 +3557,16 @@ class F extends R {
|
|
|
3442
3557
|
this.pivotResult = null, this.requestRender();
|
|
3443
3558
|
}
|
|
3444
3559
|
showPanel() {
|
|
3445
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3560
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(O.PANEL_ID) || this.grid.toggleToolPanelSection(O.PANEL_ID);
|
|
3446
3561
|
}
|
|
3447
3562
|
hidePanel() {
|
|
3448
3563
|
this.grid.closeToolPanel();
|
|
3449
3564
|
}
|
|
3450
3565
|
togglePanel() {
|
|
3451
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3566
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(O.PANEL_ID);
|
|
3452
3567
|
}
|
|
3453
3568
|
isPanelVisible() {
|
|
3454
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3569
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(O.PANEL_ID);
|
|
3455
3570
|
}
|
|
3456
3571
|
get gridColumns() {
|
|
3457
3572
|
return this.grid.columns ?? [];
|
|
@@ -3495,7 +3610,7 @@ class F extends R {
|
|
|
3495
3610
|
},
|
|
3496
3611
|
getAvailableFields: () => this.getAvailableFields()
|
|
3497
3612
|
};
|
|
3498
|
-
return
|
|
3613
|
+
return Ei(e, this.config, this.isActive, t);
|
|
3499
3614
|
}
|
|
3500
3615
|
refreshPanel() {
|
|
3501
3616
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3528,10 +3643,10 @@ class F extends R {
|
|
|
3528
3643
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3529
3644
|
}
|
|
3530
3645
|
}
|
|
3531
|
-
const
|
|
3532
|
-
function
|
|
3646
|
+
const Q = "tbw-print-isolation-style";
|
|
3647
|
+
function Di(s, e) {
|
|
3533
3648
|
const t = document.createElement("style");
|
|
3534
|
-
return t.id =
|
|
3649
|
+
return t.id = Q, t.textContent = `
|
|
3535
3650
|
/* Print isolation: hide everything except the target grid */
|
|
3536
3651
|
@media print {
|
|
3537
3652
|
/* Hide all body children by default */
|
|
@@ -3603,22 +3718,22 @@ function ki(s, e) {
|
|
|
3603
3718
|
}
|
|
3604
3719
|
`, t;
|
|
3605
3720
|
}
|
|
3606
|
-
async function
|
|
3721
|
+
async function Mi(s, e = {}) {
|
|
3607
3722
|
const { orientation: t = "landscape" } = e, i = s.id;
|
|
3608
3723
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3609
3724
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3610
|
-
), document.getElementById(
|
|
3611
|
-
const r =
|
|
3725
|
+
), document.getElementById(Q)?.remove();
|
|
3726
|
+
const r = Di(i, t);
|
|
3612
3727
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3613
3728
|
const a = () => {
|
|
3614
|
-
window.removeEventListener("afterprint", a), document.getElementById(
|
|
3729
|
+
window.removeEventListener("afterprint", a), document.getElementById(Q)?.remove(), o();
|
|
3615
3730
|
};
|
|
3616
3731
|
window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
|
|
3617
|
-
window.removeEventListener("afterprint", a), document.getElementById(
|
|
3732
|
+
window.removeEventListener("afterprint", a), document.getElementById(Q)?.remove(), o();
|
|
3618
3733
|
}, 5e3);
|
|
3619
3734
|
});
|
|
3620
3735
|
}
|
|
3621
|
-
const
|
|
3736
|
+
const Ni = ".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:.5em 0;margin-bottom:.5em;border-bottom:2px solid var(--tbw-color-border, #333);font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:.875em;color:var(--tbw-color-fg-muted, #666)}tbw-grid .tbw-print-footer{display:block;margin-top:.5em;padding-top:.5em;border-top:1px solid var(--tbw-color-border, #ccc);font-size:.75em;color:var(--tbw-color-fg-muted, #666);text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-color-border, #ddd)!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-right: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}}}", qi = {
|
|
3622
3737
|
button: !1,
|
|
3623
3738
|
orientation: "landscape",
|
|
3624
3739
|
warnThreshold: 500,
|
|
@@ -3628,10 +3743,10 @@ const _i = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3628
3743
|
title: "",
|
|
3629
3744
|
isolate: !1
|
|
3630
3745
|
};
|
|
3631
|
-
class
|
|
3746
|
+
class xn extends _ {
|
|
3632
3747
|
name = "print";
|
|
3633
3748
|
version = "1.0.0";
|
|
3634
|
-
styles =
|
|
3749
|
+
styles = Ni;
|
|
3635
3750
|
#e = !1;
|
|
3636
3751
|
#t = null;
|
|
3637
3752
|
#o = null;
|
|
@@ -3655,7 +3770,7 @@ class gn extends R {
|
|
|
3655
3770
|
console.warn("[PrintPlugin] Grid not available");
|
|
3656
3771
|
return;
|
|
3657
3772
|
}
|
|
3658
|
-
const i = { ...
|
|
3773
|
+
const i = { ...qi, ...this.config, ...e }, r = this.rows.length;
|
|
3659
3774
|
let o = r, a = !1;
|
|
3660
3775
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3661
3776
|
const d = i.maxRows > 0 ? `
|
|
@@ -3726,7 +3841,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3726
3841
|
}
|
|
3727
3842
|
async #p(e) {
|
|
3728
3843
|
const t = this.gridElement;
|
|
3729
|
-
t && await
|
|
3844
|
+
t && await Mi(t, {
|
|
3730
3845
|
orientation: e.orientation
|
|
3731
3846
|
});
|
|
3732
3847
|
}
|
|
@@ -3775,19 +3890,19 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3775
3890
|
});
|
|
3776
3891
|
}
|
|
3777
3892
|
}
|
|
3778
|
-
function
|
|
3893
|
+
function Ki(s) {
|
|
3779
3894
|
const e = s.meta ?? {};
|
|
3780
3895
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3781
3896
|
}
|
|
3782
|
-
function
|
|
3897
|
+
function We(s, e, t) {
|
|
3783
3898
|
if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
|
|
3784
3899
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3785
3900
|
return i.splice(t, 0, n), i;
|
|
3786
3901
|
}
|
|
3787
|
-
const
|
|
3788
|
-
class
|
|
3902
|
+
const Hi = '@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}}';
|
|
3903
|
+
class Cn extends _ {
|
|
3789
3904
|
name = "reorder";
|
|
3790
|
-
styles =
|
|
3905
|
+
styles = Hi;
|
|
3791
3906
|
get defaultConfig() {
|
|
3792
3907
|
return {
|
|
3793
3908
|
animation: "flip"
|
|
@@ -3804,8 +3919,8 @@ class fn extends R {
|
|
|
3804
3919
|
draggedIndex = null;
|
|
3805
3920
|
dropIndex = null;
|
|
3806
3921
|
canMoveColumnWithPlugins(e) {
|
|
3807
|
-
return !e || !
|
|
3808
|
-
type:
|
|
3922
|
+
return !e || !Ki(e) ? !1 : !this.grid.queryPlugins({
|
|
3923
|
+
type: Je.CAN_MOVE_COLUMN,
|
|
3809
3924
|
context: e
|
|
3810
3925
|
}).includes(!1);
|
|
3811
3926
|
}
|
|
@@ -3854,7 +3969,7 @@ class fn extends R {
|
|
|
3854
3969
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
3855
3970
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
3856
3971
|
return;
|
|
3857
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g =
|
|
3972
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = We(h, d, u), f = {
|
|
3858
3973
|
field: l,
|
|
3859
3974
|
fromIndex: d,
|
|
3860
3975
|
toIndex: u,
|
|
@@ -3877,7 +3992,7 @@ class fn extends R {
|
|
|
3877
3992
|
if (l < 0 || l >= o.length) return;
|
|
3878
3993
|
const d = n.find((c) => c.field === o[l]);
|
|
3879
3994
|
if (this.canMoveColumnWithPlugins(d))
|
|
3880
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
3995
|
+
return this.moveColumn(r.field, l), t._focusCol = l, D(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
3881
3996
|
}
|
|
3882
3997
|
getColumnOrder() {
|
|
3883
3998
|
return this.grid.getColumnOrder();
|
|
@@ -3885,7 +4000,7 @@ class fn extends R {
|
|
|
3885
4000
|
moveColumn(e, t) {
|
|
3886
4001
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
3887
4002
|
if (n === -1) return;
|
|
3888
|
-
const r =
|
|
4003
|
+
const r = We(i, n, t);
|
|
3889
4004
|
this.emitCancelable("column-move", {
|
|
3890
4005
|
field: e,
|
|
3891
4006
|
fromIndex: n,
|
|
@@ -3980,11 +4095,11 @@ class fn extends R {
|
|
|
3980
4095
|
this.grid.requestStateChange?.();
|
|
3981
4096
|
}
|
|
3982
4097
|
}
|
|
3983
|
-
const
|
|
3984
|
-
class
|
|
4098
|
+
const zi = '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-left: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;left: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-right: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-right: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}}';
|
|
4099
|
+
class Rn extends _ {
|
|
3985
4100
|
name = "responsive";
|
|
3986
4101
|
version = "1.0.0";
|
|
3987
|
-
styles =
|
|
4102
|
+
styles = zi;
|
|
3988
4103
|
static manifest = {
|
|
3989
4104
|
incompatibleWith: [
|
|
3990
4105
|
{
|
|
@@ -4115,23 +4230,23 @@ class pn extends R {
|
|
|
4115
4230
|
switch (e.key) {
|
|
4116
4231
|
case "ArrowDown":
|
|
4117
4232
|
if (this.grid._focusCol < i)
|
|
4118
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
4233
|
+
return this.grid._focusCol += 1, e.preventDefault(), D(this.grid), !0;
|
|
4119
4234
|
if (this.grid._focusRow < t)
|
|
4120
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
4235
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), D(this.grid), !0;
|
|
4121
4236
|
break;
|
|
4122
4237
|
case "ArrowUp":
|
|
4123
4238
|
if (this.grid._focusCol > 0)
|
|
4124
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
4239
|
+
return this.grid._focusCol -= 1, e.preventDefault(), D(this.grid), !0;
|
|
4125
4240
|
if (this.grid._focusRow > 0)
|
|
4126
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
4241
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), D(this.grid), !0;
|
|
4127
4242
|
break;
|
|
4128
4243
|
case "ArrowRight":
|
|
4129
4244
|
if (this.grid._focusRow < t)
|
|
4130
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
4245
|
+
return this.grid._focusRow += 1, e.preventDefault(), D(this.grid), !0;
|
|
4131
4246
|
break;
|
|
4132
4247
|
case "ArrowLeft":
|
|
4133
4248
|
if (this.grid._focusRow > 0)
|
|
4134
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
4249
|
+
return this.grid._focusRow -= 1, e.preventDefault(), D(this.grid), !0;
|
|
4135
4250
|
break;
|
|
4136
4251
|
}
|
|
4137
4252
|
return !1;
|
|
@@ -4205,10 +4320,10 @@ class pn extends R {
|
|
|
4205
4320
|
}));
|
|
4206
4321
|
}
|
|
4207
4322
|
}
|
|
4208
|
-
const
|
|
4209
|
-
class
|
|
4323
|
+
const Gi = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px;&:hover{color:var(--tbw-color-fg, #333)}&: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-color-accent, #1976d2);z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', Oi = "__tbw_row_drag";
|
|
4324
|
+
class En extends _ {
|
|
4210
4325
|
name = "rowReorder";
|
|
4211
|
-
styles =
|
|
4326
|
+
styles = Gi;
|
|
4212
4327
|
get defaultConfig() {
|
|
4213
4328
|
return {
|
|
4214
4329
|
enableKeyboard: !0,
|
|
@@ -4232,7 +4347,7 @@ class mn extends R {
|
|
|
4232
4347
|
if (!this.config.showDragHandle)
|
|
4233
4348
|
return [...e];
|
|
4234
4349
|
const t = {
|
|
4235
|
-
field:
|
|
4350
|
+
field: Oi,
|
|
4236
4351
|
header: "",
|
|
4237
4352
|
width: this.config.dragHandleWidth ?? 40,
|
|
4238
4353
|
resizable: !1,
|
|
@@ -4326,7 +4441,7 @@ class mn extends R {
|
|
|
4326
4441
|
row: e
|
|
4327
4442
|
}, this.lastFocusCol = r;
|
|
4328
4443
|
const o = this.grid, a = [...o._rows ?? this.sourceRows], [l] = a.splice(t, 1);
|
|
4329
|
-
a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0),
|
|
4444
|
+
a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), D(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
4330
4445
|
this.flushPendingMove();
|
|
4331
4446
|
}, this.config.debounceMs ?? 300);
|
|
4332
4447
|
}
|
|
@@ -4345,7 +4460,7 @@ class mn extends R {
|
|
|
4345
4460
|
const o = [...this.sourceRows], [a] = o.splice(t, 1);
|
|
4346
4461
|
o.splice(e, 0, a);
|
|
4347
4462
|
const l = this.grid;
|
|
4348
|
-
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0),
|
|
4463
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), D(l);
|
|
4349
4464
|
}
|
|
4350
4465
|
}
|
|
4351
4466
|
executeMove(e, t, i, n) {
|
|
@@ -4373,7 +4488,7 @@ class mn extends R {
|
|
|
4373
4488
|
this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
|
|
4374
4489
|
}
|
|
4375
4490
|
}
|
|
4376
|
-
function
|
|
4491
|
+
function V(s) {
|
|
4377
4492
|
return {
|
|
4378
4493
|
startRow: Math.min(s.startRow, s.endRow),
|
|
4379
4494
|
startCol: Math.min(s.startCol, s.endCol),
|
|
@@ -4381,38 +4496,38 @@ function q(s) {
|
|
|
4381
4496
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4382
4497
|
};
|
|
4383
4498
|
}
|
|
4384
|
-
function
|
|
4385
|
-
const e =
|
|
4499
|
+
function Bi(s) {
|
|
4500
|
+
const e = V(s);
|
|
4386
4501
|
return {
|
|
4387
4502
|
from: { row: e.startRow, col: e.startCol },
|
|
4388
4503
|
to: { row: e.endRow, col: e.endCol }
|
|
4389
4504
|
};
|
|
4390
4505
|
}
|
|
4391
|
-
function
|
|
4392
|
-
return s.map(
|
|
4506
|
+
function it(s) {
|
|
4507
|
+
return s.map(Bi);
|
|
4393
4508
|
}
|
|
4394
|
-
function
|
|
4395
|
-
const i =
|
|
4509
|
+
function Vi(s, e, t) {
|
|
4510
|
+
const i = V(t);
|
|
4396
4511
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4397
4512
|
}
|
|
4398
|
-
function
|
|
4399
|
-
return t.some((i) =>
|
|
4513
|
+
function $e(s, e, t) {
|
|
4514
|
+
return t.some((i) => Vi(s, e, i));
|
|
4400
4515
|
}
|
|
4401
|
-
function
|
|
4402
|
-
const e = [], t =
|
|
4516
|
+
function Wi(s) {
|
|
4517
|
+
const e = [], t = V(s);
|
|
4403
4518
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4404
4519
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4405
4520
|
e.push({ row: i, col: n });
|
|
4406
4521
|
return e;
|
|
4407
4522
|
}
|
|
4408
|
-
function
|
|
4523
|
+
function $i(s) {
|
|
4409
4524
|
const e = /* @__PURE__ */ new Map();
|
|
4410
4525
|
for (const t of s)
|
|
4411
|
-
for (const i of
|
|
4526
|
+
for (const i of Wi(t))
|
|
4412
4527
|
e.set(`${i.row},${i.col}`, i);
|
|
4413
4528
|
return [...e.values()];
|
|
4414
4529
|
}
|
|
4415
|
-
function
|
|
4530
|
+
function ce(s, e) {
|
|
4416
4531
|
return {
|
|
4417
4532
|
startRow: s.row,
|
|
4418
4533
|
startCol: s.col,
|
|
@@ -4420,12 +4535,12 @@ function ie(s, e) {
|
|
|
4420
4535
|
endCol: e.col
|
|
4421
4536
|
};
|
|
4422
4537
|
}
|
|
4423
|
-
function
|
|
4424
|
-
const t =
|
|
4538
|
+
function J(s, e) {
|
|
4539
|
+
const t = V(s), i = V(e);
|
|
4425
4540
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4426
4541
|
}
|
|
4427
|
-
const
|
|
4428
|
-
function
|
|
4542
|
+
const ji = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{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-color-warning-bg, rgba(255, 243, 205, .5))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4543
|
+
function Ui(s, e, t) {
|
|
4429
4544
|
if (s === "cell" && e.selectedCell)
|
|
4430
4545
|
return {
|
|
4431
4546
|
mode: s,
|
|
@@ -4443,9 +4558,9 @@ function zi(s, e, t) {
|
|
|
4443
4558
|
}));
|
|
4444
4559
|
return { mode: s, ranges: i };
|
|
4445
4560
|
}
|
|
4446
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4561
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: it(e.ranges) } : { mode: s, ranges: [] };
|
|
4447
4562
|
}
|
|
4448
|
-
class
|
|
4563
|
+
class Sn extends _ {
|
|
4449
4564
|
static manifest = {
|
|
4450
4565
|
configRules: [
|
|
4451
4566
|
{
|
|
@@ -4459,11 +4574,12 @@ class wn extends R {
|
|
|
4459
4574
|
]
|
|
4460
4575
|
};
|
|
4461
4576
|
name = "selection";
|
|
4462
|
-
styles =
|
|
4577
|
+
styles = ji;
|
|
4463
4578
|
get defaultConfig() {
|
|
4464
4579
|
return {
|
|
4465
4580
|
mode: "cell",
|
|
4466
|
-
triggerOn: "click"
|
|
4581
|
+
triggerOn: "click",
|
|
4582
|
+
enabled: !0
|
|
4467
4583
|
};
|
|
4468
4584
|
}
|
|
4469
4585
|
selected = /* @__PURE__ */ new Set();
|
|
@@ -4475,6 +4591,9 @@ class wn extends R {
|
|
|
4475
4591
|
isDragging = !1;
|
|
4476
4592
|
pendingKeyboardUpdate = null;
|
|
4477
4593
|
selectedCell = null;
|
|
4594
|
+
isSelectionEnabled() {
|
|
4595
|
+
return this.config.enabled === !1 ? !1 : this.grid.effectiveConfig?.selectable !== !1;
|
|
4596
|
+
}
|
|
4478
4597
|
checkSelectable(e, t) {
|
|
4479
4598
|
const { isSelectable: i } = this.config;
|
|
4480
4599
|
if (!i) return !0;
|
|
@@ -4493,10 +4612,11 @@ class wn extends R {
|
|
|
4493
4612
|
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
|
|
4494
4613
|
}
|
|
4495
4614
|
onCellClick(e) {
|
|
4615
|
+
if (!this.isSelectionEnabled()) return !1;
|
|
4496
4616
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4497
4617
|
if (n.type !== o)
|
|
4498
4618
|
return !1;
|
|
4499
|
-
const a = this.columns[i], l = a &&
|
|
4619
|
+
const a = this.columns[i], l = a && K(a);
|
|
4500
4620
|
if (r === "cell") {
|
|
4501
4621
|
if (l || !this.isCellSelectable(t, i))
|
|
4502
4622
|
return !1;
|
|
@@ -4510,8 +4630,8 @@ class wn extends R {
|
|
|
4510
4630
|
return !1;
|
|
4511
4631
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4512
4632
|
if (d && this.cellAnchor) {
|
|
4513
|
-
const u =
|
|
4514
|
-
if (h &&
|
|
4633
|
+
const u = ce(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4634
|
+
if (h && J(h, u))
|
|
4515
4635
|
return !1;
|
|
4516
4636
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
4517
4637
|
} else if (c) {
|
|
@@ -4529,7 +4649,7 @@ class wn extends R {
|
|
|
4529
4649
|
endRow: t,
|
|
4530
4650
|
endCol: i
|
|
4531
4651
|
};
|
|
4532
|
-
if (this.ranges.length === 1 &&
|
|
4652
|
+
if (this.ranges.length === 1 && J(this.ranges[0], u))
|
|
4533
4653
|
return !1;
|
|
4534
4654
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
4535
4655
|
}
|
|
@@ -4538,6 +4658,7 @@ class wn extends R {
|
|
|
4538
4658
|
return !1;
|
|
4539
4659
|
}
|
|
4540
4660
|
onKeyDown(e) {
|
|
4661
|
+
if (!this.isSelectionEnabled()) return !1;
|
|
4541
4662
|
const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
|
|
4542
4663
|
if (e.key === "Escape")
|
|
4543
4664
|
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
|
|
@@ -4571,9 +4692,9 @@ class wn extends R {
|
|
|
4571
4692
|
return !1;
|
|
4572
4693
|
}
|
|
4573
4694
|
onCellMouseDown(e) {
|
|
4574
|
-
if (this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4695
|
+
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4575
4696
|
const t = this.columns[e.colIndex];
|
|
4576
|
-
if (t &&
|
|
4697
|
+
if (t && K(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4577
4698
|
return;
|
|
4578
4699
|
this.isDragging = !0;
|
|
4579
4700
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -4582,21 +4703,21 @@ class wn extends R {
|
|
|
4582
4703
|
endRow: i,
|
|
4583
4704
|
endCol: n
|
|
4584
4705
|
};
|
|
4585
|
-
return !r && this.ranges.length === 1 &&
|
|
4706
|
+
return !r && this.ranges.length === 1 && J(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
|
|
4586
4707
|
}
|
|
4587
4708
|
onCellMouseMove(e) {
|
|
4588
|
-
if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4709
|
+
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4589
4710
|
let t = e.colIndex;
|
|
4590
4711
|
const i = this.columns[t];
|
|
4591
|
-
if (i &&
|
|
4592
|
-
const o = this.columns.findIndex((a) => !
|
|
4712
|
+
if (i && K(i)) {
|
|
4713
|
+
const o = this.columns.findIndex((a) => !K(a));
|
|
4593
4714
|
o >= 0 && (t = o);
|
|
4594
4715
|
}
|
|
4595
|
-
const n =
|
|
4596
|
-
return r &&
|
|
4716
|
+
const n = ce(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4717
|
+
return r && J(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
|
|
4597
4718
|
}
|
|
4598
4719
|
onCellMouseUp(e) {
|
|
4599
|
-
if (this.config.mode === "range" && this.isDragging)
|
|
4720
|
+
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
4600
4721
|
return this.isDragging = !1, !0;
|
|
4601
4722
|
}
|
|
4602
4723
|
#e() {
|
|
@@ -4609,22 +4730,22 @@ class wn extends R {
|
|
|
4609
4730
|
const r = e.querySelectorAll(".data-grid-row");
|
|
4610
4731
|
if (r.forEach((o) => {
|
|
4611
4732
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4612
|
-
}), t === "row" && (
|
|
4613
|
-
const a = o.querySelector(".cell[data-row]"), l =
|
|
4733
|
+
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
4734
|
+
const a = o.querySelector(".cell[data-row]"), l = ut(a);
|
|
4614
4735
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4615
4736
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4616
4737
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4617
4738
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4618
4739
|
}), t === "range" && this.ranges.length > 0) {
|
|
4619
|
-
|
|
4620
|
-
const o = this.activeRange ?
|
|
4740
|
+
xe(e);
|
|
4741
|
+
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !K(d));
|
|
4621
4742
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4622
4743
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4623
4744
|
if (c >= 0 && u >= 0) {
|
|
4624
4745
|
const h = this.columns[u];
|
|
4625
|
-
if (h &&
|
|
4746
|
+
if (h && K(h))
|
|
4626
4747
|
return;
|
|
4627
|
-
if (
|
|
4748
|
+
if ($e(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4628
4749
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4629
4750
|
const f = Math.max(o.startCol, a);
|
|
4630
4751
|
u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
@@ -4634,6 +4755,7 @@ class wn extends R {
|
|
|
4634
4755
|
}
|
|
4635
4756
|
}
|
|
4636
4757
|
afterRender() {
|
|
4758
|
+
if (!this.isSelectionEnabled()) return;
|
|
4637
4759
|
const e = this.gridElement;
|
|
4638
4760
|
if (!e) return;
|
|
4639
4761
|
const t = e.children[0], { mode: i } = this.config;
|
|
@@ -4642,7 +4764,7 @@ class wn extends R {
|
|
|
4642
4764
|
this.pendingKeyboardUpdate = null;
|
|
4643
4765
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4644
4766
|
if (n && this.cellAnchor) {
|
|
4645
|
-
const a =
|
|
4767
|
+
const a = ce(this.cellAnchor, { row: r, col: o });
|
|
4646
4768
|
this.ranges = [a], this.activeRange = a;
|
|
4647
4769
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
4648
4770
|
this.emit("selection-change", this.#t());
|
|
@@ -4650,7 +4772,7 @@ class wn extends R {
|
|
|
4650
4772
|
this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#e();
|
|
4651
4773
|
}
|
|
4652
4774
|
onScrollRender() {
|
|
4653
|
-
this.#e();
|
|
4775
|
+
this.isSelectionEnabled() && this.#e();
|
|
4654
4776
|
}
|
|
4655
4777
|
getSelection() {
|
|
4656
4778
|
return {
|
|
@@ -4660,10 +4782,10 @@ class wn extends R {
|
|
|
4660
4782
|
};
|
|
4661
4783
|
}
|
|
4662
4784
|
getSelectedCells() {
|
|
4663
|
-
return
|
|
4785
|
+
return $i(this.ranges);
|
|
4664
4786
|
}
|
|
4665
4787
|
isCellSelected(e, t) {
|
|
4666
|
-
return
|
|
4788
|
+
return $e(e, t, this.ranges);
|
|
4667
4789
|
}
|
|
4668
4790
|
clearSelection() {
|
|
4669
4791
|
this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
|
|
@@ -4676,11 +4798,11 @@ class wn extends R {
|
|
|
4676
4798
|
endCol: t.to.col
|
|
4677
4799
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4678
4800
|
mode: this.config.mode,
|
|
4679
|
-
ranges:
|
|
4801
|
+
ranges: it(this.ranges)
|
|
4680
4802
|
}), this.requestAfterRender();
|
|
4681
4803
|
}
|
|
4682
4804
|
#t() {
|
|
4683
|
-
return
|
|
4805
|
+
return Ui(
|
|
4684
4806
|
this.config.mode,
|
|
4685
4807
|
{
|
|
4686
4808
|
selectedCell: this.selectedCell,
|
|
@@ -4691,23 +4813,23 @@ class wn extends R {
|
|
|
4691
4813
|
);
|
|
4692
4814
|
}
|
|
4693
4815
|
}
|
|
4694
|
-
function
|
|
4816
|
+
function ee(s, e) {
|
|
4695
4817
|
return Math.floor(s / e);
|
|
4696
4818
|
}
|
|
4697
|
-
function
|
|
4819
|
+
function Yi(s, e) {
|
|
4698
4820
|
return {
|
|
4699
4821
|
start: s * e,
|
|
4700
4822
|
end: (s + 1) * e
|
|
4701
4823
|
};
|
|
4702
4824
|
}
|
|
4703
|
-
function
|
|
4704
|
-
const i =
|
|
4825
|
+
function Xi(s, e, t) {
|
|
4826
|
+
const i = ee(s, t), n = ee(e - 1, t), r = [];
|
|
4705
4827
|
for (let o = i; o <= n; o++)
|
|
4706
4828
|
r.push(o);
|
|
4707
4829
|
return r;
|
|
4708
4830
|
}
|
|
4709
|
-
async function
|
|
4710
|
-
const n =
|
|
4831
|
+
async function je(s, e, t, i) {
|
|
4832
|
+
const n = Yi(e, t);
|
|
4711
4833
|
return s.getRows({
|
|
4712
4834
|
startRow: n.start,
|
|
4713
4835
|
endRow: n.end,
|
|
@@ -4715,14 +4837,14 @@ async function ze(s, e, t, i) {
|
|
|
4715
4837
|
filterModel: i.filterModel
|
|
4716
4838
|
});
|
|
4717
4839
|
}
|
|
4718
|
-
function
|
|
4719
|
-
const i =
|
|
4840
|
+
function Zi(s, e, t) {
|
|
4841
|
+
const i = ee(s, e), n = t.get(i);
|
|
4720
4842
|
if (!n) return;
|
|
4721
4843
|
const r = s % e;
|
|
4722
4844
|
return n[r];
|
|
4723
4845
|
}
|
|
4724
|
-
const
|
|
4725
|
-
class
|
|
4846
|
+
const Ji = 100;
|
|
4847
|
+
class kn extends _ {
|
|
4726
4848
|
name = "serverSide";
|
|
4727
4849
|
get defaultConfig() {
|
|
4728
4850
|
return {
|
|
@@ -4742,12 +4864,12 @@ class bn extends R {
|
|
|
4742
4864
|
}
|
|
4743
4865
|
loadRequiredBlocks() {
|
|
4744
4866
|
if (!this.dataSource) return;
|
|
4745
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4867
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Xi(i.startRow, i.endRow, t);
|
|
4746
4868
|
for (const r of n)
|
|
4747
4869
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4748
4870
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
4749
4871
|
break;
|
|
4750
|
-
this.loadingBlocks.add(r),
|
|
4872
|
+
this.loadingBlocks.add(r), je(this.dataSource, r, t, {}).then((o) => {
|
|
4751
4873
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
4752
4874
|
}).catch(() => {
|
|
4753
4875
|
this.loadingBlocks.delete(r);
|
|
@@ -4758,7 +4880,7 @@ class bn extends R {
|
|
|
4758
4880
|
if (!this.dataSource) return [...e];
|
|
4759
4881
|
const t = [];
|
|
4760
4882
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
4761
|
-
const n =
|
|
4883
|
+
const n = Zi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
4762
4884
|
t.push(n ?? { __loading: !0, __index: i });
|
|
4763
4885
|
}
|
|
4764
4886
|
return t;
|
|
@@ -4766,12 +4888,12 @@ class bn extends R {
|
|
|
4766
4888
|
onScroll(e) {
|
|
4767
4889
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4768
4890
|
this.loadRequiredBlocks();
|
|
4769
|
-
},
|
|
4891
|
+
}, Ji));
|
|
4770
4892
|
}
|
|
4771
4893
|
setDataSource(e) {
|
|
4772
4894
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
4773
4895
|
const t = this.config.cacheBlockSize ?? 100;
|
|
4774
|
-
|
|
4896
|
+
je(e, 0, t, {}).then((i) => {
|
|
4775
4897
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
4776
4898
|
});
|
|
4777
4899
|
}
|
|
@@ -4785,59 +4907,59 @@ class bn extends R {
|
|
|
4785
4907
|
return this.totalRowCount;
|
|
4786
4908
|
}
|
|
4787
4909
|
isRowLoaded(e) {
|
|
4788
|
-
const t = this.config.cacheBlockSize ?? 100, i =
|
|
4910
|
+
const t = this.config.cacheBlockSize ?? 100, i = ee(e, t);
|
|
4789
4911
|
return this.loadedBlocks.has(i);
|
|
4790
4912
|
}
|
|
4791
4913
|
getLoadedBlockCount() {
|
|
4792
4914
|
return this.loadedBlocks.size;
|
|
4793
4915
|
}
|
|
4794
4916
|
}
|
|
4795
|
-
function
|
|
4917
|
+
function nt(s, e, t) {
|
|
4796
4918
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4797
4919
|
}
|
|
4798
|
-
function
|
|
4920
|
+
function ue(s, e) {
|
|
4799
4921
|
const t = new Set(s);
|
|
4800
4922
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
4801
4923
|
}
|
|
4802
|
-
function
|
|
4924
|
+
function fe(s, e, t = null, i = 0) {
|
|
4803
4925
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
4804
4926
|
for (let o = 0; o < s.length; o++) {
|
|
4805
|
-
const a = s[o], l =
|
|
4927
|
+
const a = s[o], l = nt(a, o, t), d = a[n];
|
|
4806
4928
|
if (Array.isArray(d) && d.length > 0) {
|
|
4807
4929
|
r.add(l);
|
|
4808
|
-
const c =
|
|
4930
|
+
const c = fe(d, e, l, i + 1);
|
|
4809
4931
|
for (const u of c) r.add(u);
|
|
4810
4932
|
}
|
|
4811
4933
|
}
|
|
4812
4934
|
return r;
|
|
4813
4935
|
}
|
|
4814
|
-
function
|
|
4936
|
+
function Qi() {
|
|
4815
4937
|
return /* @__PURE__ */ new Set();
|
|
4816
4938
|
}
|
|
4817
|
-
function
|
|
4939
|
+
function rt(s, e, t, i = null, n = 0) {
|
|
4818
4940
|
const r = t.childrenField ?? "children";
|
|
4819
4941
|
for (let o = 0; o < s.length; o++) {
|
|
4820
|
-
const a = s[o], l =
|
|
4942
|
+
const a = s[o], l = nt(a, o, i);
|
|
4821
4943
|
if (l === e)
|
|
4822
4944
|
return [l];
|
|
4823
4945
|
const d = a[r];
|
|
4824
4946
|
if (Array.isArray(d) && d.length > 0) {
|
|
4825
|
-
const c =
|
|
4947
|
+
const c = rt(d, e, t, l, n + 1);
|
|
4826
4948
|
if (c)
|
|
4827
4949
|
return [l, ...c];
|
|
4828
4950
|
}
|
|
4829
4951
|
}
|
|
4830
4952
|
return null;
|
|
4831
4953
|
}
|
|
4832
|
-
function
|
|
4833
|
-
const n =
|
|
4954
|
+
function en(s, e, t, i) {
|
|
4955
|
+
const n = rt(s, e, t);
|
|
4834
4956
|
if (!n) return i;
|
|
4835
4957
|
const r = new Set(i);
|
|
4836
4958
|
for (let o = 0; o < n.length - 1; o++)
|
|
4837
4959
|
r.add(n[o]);
|
|
4838
4960
|
return r;
|
|
4839
4961
|
}
|
|
4840
|
-
function
|
|
4962
|
+
function Ue(s, e = "children") {
|
|
4841
4963
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
4842
4964
|
for (const t of s) {
|
|
4843
4965
|
if (!t) continue;
|
|
@@ -4847,7 +4969,7 @@ function Ge(s, e = "children") {
|
|
|
4847
4969
|
}
|
|
4848
4970
|
return !1;
|
|
4849
4971
|
}
|
|
4850
|
-
function
|
|
4972
|
+
function tn(s) {
|
|
4851
4973
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
4852
4974
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
4853
4975
|
for (const t of s)
|
|
@@ -4859,10 +4981,10 @@ function ji(s) {
|
|
|
4859
4981
|
}
|
|
4860
4982
|
return null;
|
|
4861
4983
|
}
|
|
4862
|
-
const
|
|
4863
|
-
class
|
|
4984
|
+
const nn = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right: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-left: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}}}";
|
|
4985
|
+
class An extends _ {
|
|
4864
4986
|
name = "tree";
|
|
4865
|
-
styles =
|
|
4987
|
+
styles = nn;
|
|
4866
4988
|
get defaultConfig() {
|
|
4867
4989
|
return {
|
|
4868
4990
|
childrenField: "children",
|
|
@@ -4888,15 +5010,15 @@ class vn extends R {
|
|
|
4888
5010
|
}
|
|
4889
5011
|
detect(e) {
|
|
4890
5012
|
if (!this.config.autoDetect) return !1;
|
|
4891
|
-
const t = e, i = this.config.childrenField ??
|
|
4892
|
-
return
|
|
5013
|
+
const t = e, i = this.config.childrenField ?? tn(t) ?? "children";
|
|
5014
|
+
return Ue(t, i);
|
|
4893
5015
|
}
|
|
4894
5016
|
processRows(e) {
|
|
4895
5017
|
const t = this.config.childrenField ?? "children", i = e;
|
|
4896
|
-
if (!
|
|
5018
|
+
if (!Ue(i, t))
|
|
4897
5019
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
4898
5020
|
let n = this.withStableKeys(i);
|
|
4899
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5021
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = fe(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
4900
5022
|
const r = /* @__PURE__ */ new Set();
|
|
4901
5023
|
for (const o of this.flattenedRows)
|
|
4902
5024
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -4949,22 +5071,22 @@ class vn extends R {
|
|
|
4949
5071
|
const t = [...e];
|
|
4950
5072
|
if (t.length === 0) return t;
|
|
4951
5073
|
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), a = this.resolveIcon.bind(this), l = (d) => {
|
|
4952
|
-
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0,
|
|
4953
|
-
if (
|
|
5074
|
+
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, w = document.createElement("span");
|
|
5075
|
+
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)
|
|
4954
5076
|
if (f.__treeHasChildren) {
|
|
4955
|
-
const
|
|
4956
|
-
|
|
5077
|
+
const y = document.createElement("span");
|
|
5078
|
+
y.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(y, a(f.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(f.__treeKey ?? "")), w.appendChild(y);
|
|
4957
5079
|
} else {
|
|
4958
|
-
const
|
|
4959
|
-
|
|
5080
|
+
const y = document.createElement("span");
|
|
5081
|
+
y.className = "tree-spacer", w.appendChild(y);
|
|
4960
5082
|
}
|
|
4961
|
-
const
|
|
4962
|
-
if (
|
|
4963
|
-
const
|
|
4964
|
-
|
|
5083
|
+
const v = document.createElement("span");
|
|
5084
|
+
if (v.className = "tree-content", n) {
|
|
5085
|
+
const y = n(d);
|
|
5086
|
+
y instanceof Node ? v.appendChild(y) : typeof y == "string" && (v.innerHTML = y);
|
|
4965
5087
|
} else
|
|
4966
|
-
|
|
4967
|
-
return
|
|
5088
|
+
v.textContent = u != null ? String(u) : "";
|
|
5089
|
+
return w.appendChild(v), w;
|
|
4968
5090
|
};
|
|
4969
5091
|
return t[0] = { ...i, viewRenderer: l }, t;
|
|
4970
5092
|
}
|
|
@@ -4974,7 +5096,7 @@ class vn extends R {
|
|
|
4974
5096
|
const i = t.getAttribute("data-tree-key");
|
|
4975
5097
|
if (!i) return !1;
|
|
4976
5098
|
const n = this.rowKeyMap.get(i);
|
|
4977
|
-
return n ? (this.expandedKeys =
|
|
5099
|
+
return n ? (this.expandedKeys = ue(this.expandedKeys, i), this.emit("tree-expand", {
|
|
4978
5100
|
key: i,
|
|
4979
5101
|
row: n.data,
|
|
4980
5102
|
expanded: this.expandedKeys.has(i),
|
|
@@ -4985,7 +5107,7 @@ class vn extends R {
|
|
|
4985
5107
|
if (e.key !== " ") return;
|
|
4986
5108
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
4987
5109
|
if (i?.hasChildren)
|
|
4988
|
-
return e.preventDefault(), this.expandedKeys =
|
|
5110
|
+
return e.preventDefault(), this.expandedKeys = ue(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
4989
5111
|
key: i.key,
|
|
4990
5112
|
row: i.data,
|
|
4991
5113
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -5018,13 +5140,13 @@ class vn extends R {
|
|
|
5018
5140
|
this.expandedKeys.delete(e), this.requestRender();
|
|
5019
5141
|
}
|
|
5020
5142
|
toggle(e) {
|
|
5021
|
-
this.expandedKeys =
|
|
5143
|
+
this.expandedKeys = ue(this.expandedKeys, e), this.requestRender();
|
|
5022
5144
|
}
|
|
5023
5145
|
expandAll() {
|
|
5024
|
-
this.expandedKeys =
|
|
5146
|
+
this.expandedKeys = fe(this.rows, this.config), this.requestRender();
|
|
5025
5147
|
}
|
|
5026
5148
|
collapseAll() {
|
|
5027
|
-
this.expandedKeys =
|
|
5149
|
+
this.expandedKeys = Qi(), this.requestRender();
|
|
5028
5150
|
}
|
|
5029
5151
|
isExpanded(e) {
|
|
5030
5152
|
return this.expandedKeys.has(e);
|
|
@@ -5039,10 +5161,10 @@ class vn extends R {
|
|
|
5039
5161
|
return this.rowKeyMap.get(e)?.data;
|
|
5040
5162
|
}
|
|
5041
5163
|
expandToKey(e) {
|
|
5042
|
-
this.expandedKeys =
|
|
5164
|
+
this.expandedKeys = en(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5043
5165
|
}
|
|
5044
5166
|
}
|
|
5045
|
-
function
|
|
5167
|
+
function rn(s, e, t) {
|
|
5046
5168
|
const i = [...s.undoStack, e];
|
|
5047
5169
|
for (; i.length > t; )
|
|
5048
5170
|
i.shift();
|
|
@@ -5051,7 +5173,7 @@ function Yi(s, e, t) {
|
|
|
5051
5173
|
redoStack: []
|
|
5052
5174
|
};
|
|
5053
5175
|
}
|
|
5054
|
-
function
|
|
5176
|
+
function Ye(s) {
|
|
5055
5177
|
if (s.undoStack.length === 0)
|
|
5056
5178
|
return { newState: s, action: null };
|
|
5057
5179
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -5063,7 +5185,7 @@ function Oe(s) {
|
|
|
5063
5185
|
action: t
|
|
5064
5186
|
} : { newState: s, action: null };
|
|
5065
5187
|
}
|
|
5066
|
-
function
|
|
5188
|
+
function Xe(s) {
|
|
5067
5189
|
if (s.redoStack.length === 0)
|
|
5068
5190
|
return { newState: s, action: null };
|
|
5069
5191
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -5075,16 +5197,16 @@ function Be(s) {
|
|
|
5075
5197
|
action: t
|
|
5076
5198
|
} : { newState: s, action: null };
|
|
5077
5199
|
}
|
|
5078
|
-
function
|
|
5200
|
+
function on(s) {
|
|
5079
5201
|
return s.undoStack.length > 0;
|
|
5080
5202
|
}
|
|
5081
|
-
function
|
|
5203
|
+
function sn(s) {
|
|
5082
5204
|
return s.redoStack.length > 0;
|
|
5083
5205
|
}
|
|
5084
|
-
function
|
|
5206
|
+
function an() {
|
|
5085
5207
|
return { undoStack: [], redoStack: [] };
|
|
5086
5208
|
}
|
|
5087
|
-
function
|
|
5209
|
+
function ln(s, e, t, i) {
|
|
5088
5210
|
return {
|
|
5089
5211
|
type: "cell-edit",
|
|
5090
5212
|
rowIndex: s,
|
|
@@ -5094,7 +5216,7 @@ function Qi(s, e, t, i) {
|
|
|
5094
5216
|
timestamp: Date.now()
|
|
5095
5217
|
};
|
|
5096
5218
|
}
|
|
5097
|
-
class
|
|
5219
|
+
class _n extends _ {
|
|
5098
5220
|
static dependencies = [
|
|
5099
5221
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5100
5222
|
];
|
|
@@ -5112,7 +5234,7 @@ class yn extends R {
|
|
|
5112
5234
|
onKeyDown(e) {
|
|
5113
5235
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5114
5236
|
if (t) {
|
|
5115
|
-
const n =
|
|
5237
|
+
const n = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5116
5238
|
if (n.action) {
|
|
5117
5239
|
const r = this.rows;
|
|
5118
5240
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
|
|
@@ -5123,7 +5245,7 @@ class yn extends R {
|
|
|
5123
5245
|
return !0;
|
|
5124
5246
|
}
|
|
5125
5247
|
if (i) {
|
|
5126
|
-
const n =
|
|
5248
|
+
const n = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5127
5249
|
if (n.action) {
|
|
5128
5250
|
const r = this.rows;
|
|
5129
5251
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
|
|
@@ -5136,7 +5258,7 @@ class yn extends R {
|
|
|
5136
5258
|
return !1;
|
|
5137
5259
|
}
|
|
5138
5260
|
recordEdit(e, t, i, n) {
|
|
5139
|
-
const r =
|
|
5261
|
+
const r = ln(e, t, i, n), o = rn(
|
|
5140
5262
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5141
5263
|
r,
|
|
5142
5264
|
this.config.maxHistorySize ?? 100
|
|
@@ -5144,7 +5266,7 @@ class yn extends R {
|
|
|
5144
5266
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5145
5267
|
}
|
|
5146
5268
|
undo() {
|
|
5147
|
-
const e =
|
|
5269
|
+
const e = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5148
5270
|
if (e.action) {
|
|
5149
5271
|
const t = this.rows;
|
|
5150
5272
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5152,7 +5274,7 @@ class yn extends R {
|
|
|
5152
5274
|
return e.action;
|
|
5153
5275
|
}
|
|
5154
5276
|
redo() {
|
|
5155
|
-
const e =
|
|
5277
|
+
const e = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5156
5278
|
if (e.action) {
|
|
5157
5279
|
const t = this.rows;
|
|
5158
5280
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5160,13 +5282,13 @@ class yn extends R {
|
|
|
5160
5282
|
return e.action;
|
|
5161
5283
|
}
|
|
5162
5284
|
canUndo() {
|
|
5163
|
-
return
|
|
5285
|
+
return on({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5164
5286
|
}
|
|
5165
5287
|
canRedo() {
|
|
5166
|
-
return
|
|
5288
|
+
return sn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5167
5289
|
}
|
|
5168
5290
|
clearHistory() {
|
|
5169
|
-
const e =
|
|
5291
|
+
const e = an();
|
|
5170
5292
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5171
5293
|
}
|
|
5172
5294
|
getUndoStack() {
|
|
@@ -5176,18 +5298,18 @@ class yn extends R {
|
|
|
5176
5298
|
return [...this.redoStack];
|
|
5177
5299
|
}
|
|
5178
5300
|
}
|
|
5179
|
-
const
|
|
5180
|
-
function
|
|
5301
|
+
const dn = '@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, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);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, #1f2937)}.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-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.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, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);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, #f3f4f6))}}';
|
|
5302
|
+
function Ze(s) {
|
|
5181
5303
|
const e = s.meta ?? {};
|
|
5182
5304
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5183
5305
|
}
|
|
5184
|
-
class
|
|
5306
|
+
class B extends _ {
|
|
5185
5307
|
static dependencies = [
|
|
5186
5308
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5187
5309
|
];
|
|
5188
5310
|
name = "visibility";
|
|
5189
5311
|
static PANEL_ID = "columns";
|
|
5190
|
-
styles =
|
|
5312
|
+
styles = dn;
|
|
5191
5313
|
get defaultConfig() {
|
|
5192
5314
|
return {
|
|
5193
5315
|
allowHideAll: !1
|
|
@@ -5208,7 +5330,7 @@ class M extends R {
|
|
|
5208
5330
|
}
|
|
5209
5331
|
getToolPanel() {
|
|
5210
5332
|
return {
|
|
5211
|
-
id:
|
|
5333
|
+
id: B.PANEL_ID,
|
|
5212
5334
|
title: "Columns",
|
|
5213
5335
|
icon: "☰",
|
|
5214
5336
|
tooltip: "Column visibility",
|
|
@@ -5217,13 +5339,13 @@ class M extends R {
|
|
|
5217
5339
|
};
|
|
5218
5340
|
}
|
|
5219
5341
|
show() {
|
|
5220
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
5342
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(B.PANEL_ID) || this.grid.toggleToolPanelSection(B.PANEL_ID);
|
|
5221
5343
|
}
|
|
5222
5344
|
hide() {
|
|
5223
5345
|
this.grid.closeToolPanel();
|
|
5224
5346
|
}
|
|
5225
5347
|
toggle() {
|
|
5226
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
5348
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(B.PANEL_ID);
|
|
5227
5349
|
}
|
|
5228
5350
|
isColumnVisible(e) {
|
|
5229
5351
|
return this.grid.isColumnVisible(e);
|
|
@@ -5253,7 +5375,7 @@ class M extends R {
|
|
|
5253
5375
|
return this.grid.getAllColumns();
|
|
5254
5376
|
}
|
|
5255
5377
|
isPanelVisible() {
|
|
5256
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
5378
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(B.PANEL_ID);
|
|
5257
5379
|
}
|
|
5258
5380
|
renderPanelContent(e) {
|
|
5259
5381
|
const t = document.createElement("div");
|
|
@@ -5277,7 +5399,7 @@ class M extends R {
|
|
|
5277
5399
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5278
5400
|
for (let n = 0; n < i.length; n++) {
|
|
5279
5401
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
5280
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
5402
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ze(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
5281
5403
|
const l = document.createElement("label");
|
|
5282
5404
|
l.className = "tbw-visibility-label";
|
|
5283
5405
|
const d = document.createElement("input");
|
|
@@ -5285,7 +5407,7 @@ class M extends R {
|
|
|
5285
5407
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5286
5408
|
});
|
|
5287
5409
|
const c = document.createElement("span");
|
|
5288
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
5410
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ze(r)) {
|
|
5289
5411
|
const u = document.createElement("span");
|
|
5290
5412
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
5291
5413
|
}
|
|
@@ -5325,50 +5447,50 @@ class M extends R {
|
|
|
5325
5447
|
}
|
|
5326
5448
|
}
|
|
5327
5449
|
export {
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5450
|
+
_ as BaseGridPlugin,
|
|
5451
|
+
un as ClipboardPlugin,
|
|
5452
|
+
hn as ColumnVirtualizationPlugin,
|
|
5453
|
+
gn as ContextMenuPlugin,
|
|
5454
|
+
Fn as DEFAULT_ANIMATION_CONFIG,
|
|
5455
|
+
st as DEFAULT_GRID_ICONS,
|
|
5456
|
+
In as DGEvents,
|
|
5457
|
+
Pn as DataGridElement,
|
|
5458
|
+
fn as EditingPlugin,
|
|
5459
|
+
pn as ExportPlugin,
|
|
5460
|
+
q as FilteringPlugin,
|
|
5461
|
+
Dn as FitModeEnum,
|
|
5462
|
+
Mn as GridCSSVars,
|
|
5463
|
+
Nn as GridClasses,
|
|
5464
|
+
qn as GridDataAttrs,
|
|
5465
|
+
Kn as GridElement,
|
|
5466
|
+
Hn as GridSelectors,
|
|
5467
|
+
mn as GroupingColumnsPlugin,
|
|
5468
|
+
wn as GroupingRowsPlugin,
|
|
5469
|
+
et as MasterDetailPlugin,
|
|
5470
|
+
bn as MultiSortPlugin,
|
|
5471
|
+
Je as PLUGIN_QUERIES,
|
|
5472
|
+
vn as PinnedColumnsPlugin,
|
|
5473
|
+
yn as PinnedRowsPlugin,
|
|
5474
|
+
O as PivotPlugin,
|
|
5475
|
+
zn as PluginEvents,
|
|
5476
|
+
Gn as PluginManager,
|
|
5477
|
+
xn as PrintPlugin,
|
|
5478
|
+
Oi as ROW_DRAG_HANDLE_FIELD,
|
|
5479
|
+
On as RenderPhase,
|
|
5480
|
+
Cn as ReorderPlugin,
|
|
5481
|
+
Rn as ResponsivePlugin,
|
|
5482
|
+
En as RowReorderPlugin,
|
|
5483
|
+
Sn as SelectionPlugin,
|
|
5484
|
+
kn as ServerSidePlugin,
|
|
5485
|
+
An as TreePlugin,
|
|
5486
|
+
_n as UndoRedoPlugin,
|
|
5487
|
+
B as VisibilityPlugin,
|
|
5488
|
+
Bn as builtInSort,
|
|
5489
|
+
Vn as createGrid,
|
|
5490
|
+
Wn as defaultComparator,
|
|
5491
|
+
_t as defaultEditorFor,
|
|
5492
|
+
mt as defaultPasteHandler,
|
|
5493
|
+
Mi as printGridIsolated,
|
|
5494
|
+
$n as queryGrid
|
|
5373
5495
|
};
|
|
5374
5496
|
//# sourceMappingURL=all.js.map
|