@toolbox-web/grid 1.6.1 → 1.6.2
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 +641 -645
- package/all.js.map +1 -1
- package/index.js +2 -2
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +246 -250
- package/lib/plugins/filtering/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +22 -22
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.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 A, DEFAULT_GRID_ICONS as st, a as at, runAggregator as ee, e as lt, s as dt, PLUGIN_QUERIES as Ze, getAggregator as ve, getValueAggregator as ct, b as D, c as ye, g as ut } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Ln, DGEvents as Fn, DataGridElement as In, FitModeEnum as Pn, GridCSSVars as Dn, GridClasses as Mn, GridDataAttrs as Nn, DataGridElement as qn, GridSelectors as Hn, PluginEvents as zn, PluginManager as Kn, RenderPhase as On, builtInSort as Gn, createGrid as Bn, defaultComparator as Vn, queryGrid as Wn } from "./index.js";
|
|
3
|
+
const Je = "__tbw_expander", ht = 32;
|
|
4
|
+
function fe(s) {
|
|
5
|
+
return s.field === Je;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function q(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return s.find(
|
|
10
|
+
function gt(s) {
|
|
11
|
+
return s.find(fe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function ft(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: Je,
|
|
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 pt(s) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function te(s) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(s), !0;
|
|
33
33
|
} catch {
|
|
@@ -37,7 +37,7 @@ async function ie(s) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function xe(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 Ce(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();
|
|
@@ -81,7 +81,7 @@ function wt(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class un extends A {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -133,7 +133,7 @@ class hn extends _ {
|
|
|
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
|
+
te(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,10 +145,10 @@ class hn extends _ {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
149
|
-
for (let
|
|
150
|
-
const
|
|
151
|
-
|
|
148
|
+
const i = xe(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 b = 0; b < p && l + b <= u; b++) {
|
|
150
|
+
const v = this.columns[l + b];
|
|
151
|
+
v && !v.hidden && f.push(v.field);
|
|
152
152
|
}
|
|
153
153
|
const w = { rows: i, text: t, target: g, fields: f };
|
|
154
154
|
this.emit("paste", w), this.#o(w);
|
|
@@ -157,7 +157,7 @@ class hn extends _ {
|
|
|
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 hn extends _ {
|
|
|
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) => !q(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,9 +177,9 @@ class hn extends _ {
|
|
|
177
177
|
for (let f = o; f <= a; f++) {
|
|
178
178
|
const p = this.rows[f];
|
|
179
179
|
if (!p) continue;
|
|
180
|
-
const w = g.map((
|
|
181
|
-
const
|
|
182
|
-
return
|
|
180
|
+
const w = g.map((b) => {
|
|
181
|
+
const v = p[b.field];
|
|
182
|
+
return v == null ? "" : v instanceof Date ? v.toISOString() : String(v);
|
|
183
183
|
});
|
|
184
184
|
h.push(w.join(c));
|
|
185
185
|
}
|
|
@@ -212,7 +212,7 @@ class hn extends _ {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
const r = this.#i(n);
|
|
215
|
-
return await
|
|
215
|
+
return await te(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 hn extends _ {
|
|
|
222
222
|
endRow: t[t.length - 1],
|
|
223
223
|
endCol: i
|
|
224
224
|
}, r = this.#i(n);
|
|
225
|
-
return await
|
|
225
|
+
return await te(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 ? xe(e, this.config) : null;
|
|
230
230
|
}
|
|
231
231
|
getLastCopied() {
|
|
232
232
|
return this.lastCopied;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const
|
|
236
|
-
function
|
|
235
|
+
const Ce = 100;
|
|
236
|
+
function pe(s) {
|
|
237
237
|
if (s == null)
|
|
238
|
-
return
|
|
238
|
+
return Ce;
|
|
239
239
|
if (typeof s == "number")
|
|
240
240
|
return s;
|
|
241
241
|
const e = parseFloat(s);
|
|
242
|
-
return isNaN(e) ?
|
|
242
|
+
return isNaN(e) ? Ce : e;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
return s.map((e) =>
|
|
244
|
+
function Ee(s) {
|
|
245
|
+
return s.map((e) => pe(e.width));
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Re(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 += pe(i.width);
|
|
252
252
|
return e;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
return s.reduce((e, t) => e +
|
|
254
|
+
function Se(s) {
|
|
255
|
+
return s.reduce((e, t) => e + pe(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 bt(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 vt(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 A {
|
|
290
290
|
name = "columnVirtualization";
|
|
291
291
|
get defaultConfig() {
|
|
292
292
|
return {
|
|
@@ -305,16 +305,16 @@ class gn extends _ {
|
|
|
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 = Re(t), this.totalWidth = Se(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 = Re(e), this.totalWidth = Se(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 gn extends _ {
|
|
|
354
354
|
return this.totalWidth;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
function
|
|
357
|
+
const ie = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:0 2px 10px var(--tbw-context-menu-shadow, var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
358
|
+
function ue(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 he(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 ge(s, e, t, i = at.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 ge(s, e, t, i = at.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 = ue(r.subMenu, e), h = he(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 ge(s, e, t, i = at.submenuArrow) {
|
|
|
399
399
|
}
|
|
400
400
|
return n;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function ke(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 K = null, O = null,
|
|
409
|
-
const
|
|
408
|
+
let K = null, O = null, M = null, ne = 0;
|
|
409
|
+
const re = [
|
|
410
410
|
{
|
|
411
411
|
id: "copy",
|
|
412
412
|
name: "Copy",
|
|
@@ -424,11 +424,11 @@ const oe = [
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
];
|
|
427
|
-
class
|
|
427
|
+
class Qe extends A {
|
|
428
428
|
name = "contextMenu";
|
|
429
429
|
get defaultConfig() {
|
|
430
430
|
return {
|
|
431
|
-
items:
|
|
431
|
+
items: re
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
isOpen = !1;
|
|
@@ -436,7 +436,7 @@ class et extends _ {
|
|
|
436
436
|
params = null;
|
|
437
437
|
menuElement = null;
|
|
438
438
|
attach(e) {
|
|
439
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
439
|
+
super.attach(e), this.installGlobalHandlers(), ne++;
|
|
440
440
|
}
|
|
441
441
|
detach() {
|
|
442
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
@@ -480,7 +480,7 @@ class et extends _ {
|
|
|
480
480
|
const t = this.gridElement;
|
|
481
481
|
if (!t) return;
|
|
482
482
|
const i = getComputedStyle(t), n = [];
|
|
483
|
-
for (const r of
|
|
483
|
+
for (const r of Qe.CSS_VARS_TO_COPY) {
|
|
484
484
|
const o = i.getPropertyValue(r).trim();
|
|
485
485
|
o && n.push(`${r}: ${o}`);
|
|
486
486
|
}
|
|
@@ -490,14 +490,14 @@ class et extends _ {
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
installGlobalHandlers() {
|
|
493
|
-
!
|
|
493
|
+
!M && typeof document < "u" && typeof ie == "string" && ie && (M = document.createElement("style"), M.id = "tbw-context-menu-styles", M.textContent = ie, document.head.appendChild(M)), K || (K = () => {
|
|
494
494
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
495
495
|
}, document.addEventListener("click", K)), O || (O = (e) => {
|
|
496
496
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
497
497
|
}, document.addEventListener("keydown", O));
|
|
498
498
|
}
|
|
499
499
|
uninstallGlobalHandlers() {
|
|
500
|
-
|
|
500
|
+
ne--, !(ne > 0) && (K && (document.removeEventListener("click", K), K = null), O && (document.removeEventListener("keydown", O), O = null), M && (M.remove(), M = null));
|
|
501
501
|
}
|
|
502
502
|
afterRender() {
|
|
503
503
|
const e = this.gridElement;
|
|
@@ -535,15 +535,15 @@ class et extends _ {
|
|
|
535
535
|
} else
|
|
536
536
|
return;
|
|
537
537
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
538
|
-
const d =
|
|
539
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
538
|
+
const d = ue(this.config.items ?? re, l);
|
|
539
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = he(
|
|
540
540
|
d,
|
|
541
541
|
l,
|
|
542
542
|
(c) => {
|
|
543
543
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
544
544
|
},
|
|
545
545
|
this.gridIcons.submenuArrow
|
|
546
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
546
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), ke(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
547
547
|
}));
|
|
548
548
|
}
|
|
549
549
|
showMenu(e, t, i) {
|
|
@@ -556,15 +556,15 @@ class et extends _ {
|
|
|
556
556
|
value: i.value ?? null,
|
|
557
557
|
isHeader: i.isHeader ?? !1,
|
|
558
558
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
559
|
-
}, r =
|
|
560
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
559
|
+
}, r = ue(this.config.items ?? re, n);
|
|
560
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = he(
|
|
561
561
|
r,
|
|
562
562
|
n,
|
|
563
563
|
(o) => {
|
|
564
564
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
565
565
|
},
|
|
566
566
|
this.gridIcons.submenuArrow
|
|
567
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
567
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), ke(this.menuElement, e, t), this.isOpen = !0;
|
|
568
568
|
}
|
|
569
569
|
hideMenu() {
|
|
570
570
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -573,12 +573,12 @@ class et extends _ {
|
|
|
573
573
|
return this.isOpen;
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
const
|
|
577
|
-
function
|
|
576
|
+
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}}}";
|
|
577
|
+
function Ct(s) {
|
|
578
578
|
const e = s.options;
|
|
579
579
|
return e ? typeof e == "function" ? e() : e : [];
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Et(s) {
|
|
582
582
|
return (e) => {
|
|
583
583
|
const t = s.editorParams, i = document.createElement("input");
|
|
584
584
|
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);
|
|
@@ -588,13 +588,13 @@ function Rt(s) {
|
|
|
588
588
|
}), i;
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Rt() {
|
|
592
592
|
return (s) => {
|
|
593
593
|
const e = document.createElement("input");
|
|
594
594
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
595
595
|
};
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function St(s) {
|
|
598
598
|
return (e) => {
|
|
599
599
|
const t = s.editorParams, i = document.createElement("input");
|
|
600
600
|
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) => {
|
|
@@ -602,14 +602,14 @@ function kt(s) {
|
|
|
602
602
|
}), i;
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function kt(s) {
|
|
606
606
|
return (e) => {
|
|
607
607
|
const t = s.editorParams, i = document.createElement("select");
|
|
608
608
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
609
609
|
const o = document.createElement("option");
|
|
610
610
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
611
611
|
}
|
|
612
|
-
|
|
612
|
+
Ct(s).forEach((o) => {
|
|
613
613
|
const a = document.createElement("option");
|
|
614
614
|
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);
|
|
615
615
|
});
|
|
@@ -625,7 +625,7 @@ function At(s) {
|
|
|
625
625
|
}), i;
|
|
626
626
|
};
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function At(s) {
|
|
629
629
|
return (e) => {
|
|
630
630
|
const t = s.editorParams, i = document.createElement("input");
|
|
631
631
|
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) => {
|
|
@@ -633,22 +633,22 @@ function _t(s) {
|
|
|
633
633
|
}), i;
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function _t(s) {
|
|
637
637
|
switch (s.type) {
|
|
638
638
|
case "number":
|
|
639
|
-
return
|
|
639
|
+
return Et(s);
|
|
640
640
|
case "boolean":
|
|
641
|
-
return
|
|
641
|
+
return Rt();
|
|
642
642
|
case "date":
|
|
643
|
-
return
|
|
643
|
+
return St(s);
|
|
644
644
|
case "select":
|
|
645
|
-
return
|
|
645
|
+
return kt(s);
|
|
646
646
|
default:
|
|
647
|
-
return
|
|
647
|
+
return At(s);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
const
|
|
651
|
-
function
|
|
650
|
+
const oe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
651
|
+
function Tt(s, e) {
|
|
652
652
|
if (e.editor) return e.editor;
|
|
653
653
|
if (e.__editorTemplate) return "template";
|
|
654
654
|
if (!e.type) return;
|
|
@@ -665,25 +665,25 @@ function Lt(s, e) {
|
|
|
665
665
|
function $(s) {
|
|
666
666
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Lt(s) {
|
|
669
669
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
670
670
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function Ft(s) {
|
|
673
673
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
674
674
|
}
|
|
675
675
|
function U(s, e) {
|
|
676
676
|
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;
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function Ae(s) {
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function It(s, e, t) {
|
|
681
681
|
const i = s.querySelector("input,textarea,select");
|
|
682
682
|
i && (i.addEventListener("blur", () => {
|
|
683
683
|
t(U(i, e));
|
|
684
684
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(U(i, e))));
|
|
685
685
|
}
|
|
686
|
-
class
|
|
686
|
+
class gn extends A {
|
|
687
687
|
static manifest = {
|
|
688
688
|
ownedProperties: [
|
|
689
689
|
{
|
|
@@ -705,7 +705,7 @@ class fn extends _ {
|
|
|
705
705
|
]
|
|
706
706
|
};
|
|
707
707
|
name = "editing";
|
|
708
|
-
styles =
|
|
708
|
+
styles = xt;
|
|
709
709
|
get defaultConfig() {
|
|
710
710
|
return {
|
|
711
711
|
editOn: "click"
|
|
@@ -899,7 +899,7 @@ class fn extends _ {
|
|
|
899
899
|
}), setTimeout(() => {
|
|
900
900
|
let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
901
901
|
if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
|
|
902
|
-
const l = a.querySelector(
|
|
902
|
+
const l = a.querySelector(oe);
|
|
903
903
|
try {
|
|
904
904
|
l?.focus({ preventScroll: !0 });
|
|
905
905
|
} catch {
|
|
@@ -962,7 +962,7 @@ class fn extends _ {
|
|
|
962
962
|
for (const l of this.#i)
|
|
963
963
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
964
964
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
965
|
-
l.classList.remove("editing"),
|
|
965
|
+
l.classList.remove("editing"), Ft(l.parentElement);
|
|
966
966
|
}), this.requestRender()), this.#r = !0, o || (this.#g(i), this.#r = !1);
|
|
967
967
|
}
|
|
968
968
|
#h(e, t, i, n) {
|
|
@@ -976,7 +976,7 @@ class fn extends _ {
|
|
|
976
976
|
l = this.grid.getRowId(n);
|
|
977
977
|
} catch {
|
|
978
978
|
}
|
|
979
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") :
|
|
979
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : Ae;
|
|
980
980
|
if (this.emitCancelable("cell-commit", {
|
|
981
981
|
row: n,
|
|
982
982
|
rowId: l ?? "",
|
|
@@ -991,7 +991,7 @@ class fn extends _ {
|
|
|
991
991
|
})) return;
|
|
992
992
|
n[r] = i, l && this.#n.add(l), this.#a();
|
|
993
993
|
const h = a.findRenderedRowElement?.(e);
|
|
994
|
-
h && (h.classList.add("changed"),
|
|
994
|
+
h && (h.classList.add("changed"), at(h, "change"));
|
|
995
995
|
}
|
|
996
996
|
#p(e, t, i, n, r, o) {
|
|
997
997
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -1000,63 +1000,63 @@ class fn extends _ {
|
|
|
1000
1000
|
a = this.grid.getRowId(e);
|
|
1001
1001
|
} catch {
|
|
1002
1002
|
}
|
|
1003
|
-
const l = a ? (
|
|
1003
|
+
const l = a ? (C) => this.grid.updateRow(a, C, "cascade") : Ae, d = $(i.field) ? e[i.field] : void 0;
|
|
1004
1004
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
1005
1005
|
const c = r.parentElement;
|
|
1006
|
-
c &&
|
|
1006
|
+
c && Lt(c);
|
|
1007
1007
|
let u = !1;
|
|
1008
|
-
const h = (
|
|
1009
|
-
u || this.#e === -1 || this.#h(t, i,
|
|
1008
|
+
const h = (C) => {
|
|
1009
|
+
u || this.#e === -1 || this.#h(t, i, C, e);
|
|
1010
1010
|
}, g = () => {
|
|
1011
1011
|
u = !0, $(i.field) && (e[i.field] = d);
|
|
1012
1012
|
}, f = document.createElement("div");
|
|
1013
|
-
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (
|
|
1014
|
-
|
|
1013
|
+
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (C) => {
|
|
1014
|
+
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#s(t, !1)), C.key === "Escape" && (C.stopPropagation(), C.preventDefault(), g(), this.#s(t, !0));
|
|
1015
1015
|
});
|
|
1016
|
-
const p = i, w = p.__editorTemplate,
|
|
1017
|
-
if (
|
|
1016
|
+
const p = i, w = p.__editorTemplate, b = Tt(this.grid, p) ?? _t(i), v = d;
|
|
1017
|
+
if (b === "template" && w)
|
|
1018
1018
|
this.#l(f, p, e, d, h, g, o, t);
|
|
1019
|
-
else if (typeof
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
f.querySelector(
|
|
1019
|
+
else if (typeof b == "string") {
|
|
1020
|
+
const C = document.createElement(b);
|
|
1021
|
+
C.value = v, C.addEventListener("change", () => h(C.value)), f.appendChild(C), o || queueMicrotask(() => {
|
|
1022
|
+
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
1023
1023
|
});
|
|
1024
|
-
} else if (typeof
|
|
1025
|
-
const
|
|
1024
|
+
} else if (typeof b == "function") {
|
|
1025
|
+
const C = {
|
|
1026
1026
|
row: e,
|
|
1027
1027
|
rowId: a ?? "",
|
|
1028
|
-
value:
|
|
1028
|
+
value: v,
|
|
1029
1029
|
field: i.field,
|
|
1030
1030
|
column: i,
|
|
1031
1031
|
commit: h,
|
|
1032
1032
|
cancel: g,
|
|
1033
1033
|
updateRow: l
|
|
1034
|
-
},
|
|
1035
|
-
typeof
|
|
1036
|
-
f.querySelector(
|
|
1034
|
+
}, _ = b(C);
|
|
1035
|
+
typeof _ == "string" ? (f.innerHTML = _, It(f, i, h)) : _ instanceof Node && f.appendChild(_), o || queueMicrotask(() => {
|
|
1036
|
+
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
1037
1037
|
});
|
|
1038
|
-
} else if (
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1038
|
+
} else if (b && typeof b == "object") {
|
|
1039
|
+
const C = document.createElement("div");
|
|
1040
|
+
C.setAttribute("data-external-editor", ""), C.setAttribute("data-field", i.field), f.appendChild(C);
|
|
1041
|
+
const _ = {
|
|
1042
1042
|
row: e,
|
|
1043
1043
|
rowId: a ?? "",
|
|
1044
|
-
value:
|
|
1044
|
+
value: v,
|
|
1045
1045
|
field: i.field,
|
|
1046
1046
|
column: i,
|
|
1047
1047
|
commit: h,
|
|
1048
1048
|
cancel: g,
|
|
1049
1049
|
updateRow: l
|
|
1050
1050
|
};
|
|
1051
|
-
if (
|
|
1051
|
+
if (b.mount)
|
|
1052
1052
|
try {
|
|
1053
|
-
|
|
1054
|
-
} catch (
|
|
1055
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1053
|
+
b.mount({ placeholder: C, context: _, spec: b });
|
|
1054
|
+
} catch (E) {
|
|
1055
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, E);
|
|
1056
1056
|
}
|
|
1057
1057
|
else
|
|
1058
1058
|
this.grid.dispatchEvent(
|
|
1059
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder:
|
|
1059
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: C, spec: b, context: _ } })
|
|
1060
1060
|
);
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
@@ -1109,7 +1109,7 @@ class fn extends _ {
|
|
|
1109
1109
|
});
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
|
-
function
|
|
1112
|
+
function _e(s, e = !0) {
|
|
1113
1113
|
if (s == null) return "";
|
|
1114
1114
|
if (s instanceof Date) return s.toISOString();
|
|
1115
1115
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1117,37 +1117,37 @@ function Te(s, e = !0) {
|
|
|
1117
1117
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1118
1118
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function Pt(s, e, t, i = {}) {
|
|
1121
1121
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1122
1122
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1123
1123
|
if (t.includeHeaders !== !1) {
|
|
1124
1124
|
const l = e.map((d) => {
|
|
1125
1125
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1126
|
-
return
|
|
1126
|
+
return _e(u);
|
|
1127
1127
|
});
|
|
1128
1128
|
o.push(l.join(n));
|
|
1129
1129
|
}
|
|
1130
1130
|
for (const l of s) {
|
|
1131
1131
|
const d = e.map((c) => {
|
|
1132
1132
|
let u = l[c.field];
|
|
1133
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1133
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), _e(u);
|
|
1134
1134
|
});
|
|
1135
1135
|
o.push(d.join(n));
|
|
1136
1136
|
}
|
|
1137
1137
|
return a + o.join(r);
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function me(s, e) {
|
|
1140
1140
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1141
1141
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function Dt(s, e) {
|
|
1144
1144
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1145
|
-
|
|
1145
|
+
me(t, e);
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function Te(s) {
|
|
1148
1148
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function Mt(s, e, t) {
|
|
1151
1151
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1152
1152
|
<?mso-application progid="Excel.Sheet"?>
|
|
1153
1153
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1159,7 +1159,7 @@ function Nt(s, e, t) {
|
|
|
1159
1159
|
<Row>`;
|
|
1160
1160
|
for (const n of e) {
|
|
1161
1161
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1162
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1162
|
+
i += `<Cell><Data ss:Type="String">${Te(o)}</Data></Cell>`;
|
|
1163
1163
|
}
|
|
1164
1164
|
i += "</Row>";
|
|
1165
1165
|
}
|
|
@@ -1170,7 +1170,7 @@ function Nt(s, e, t) {
|
|
|
1170
1170
|
let o = n[r.field];
|
|
1171
1171
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1172
1172
|
let a = "String", l = "";
|
|
1173
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l =
|
|
1173
|
+
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>`;
|
|
1174
1174
|
}
|
|
1175
1175
|
i += "</Row>";
|
|
1176
1176
|
}
|
|
@@ -1179,13 +1179,13 @@ function Nt(s, e, t) {
|
|
|
1179
1179
|
</Worksheet>
|
|
1180
1180
|
</Workbook>`, i;
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1182
|
+
function Nt(s, e) {
|
|
1183
1183
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1184
1184
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1185
1185
|
});
|
|
1186
|
-
|
|
1186
|
+
me(i, t);
|
|
1187
1187
|
}
|
|
1188
|
-
class
|
|
1188
|
+
class fn extends A {
|
|
1189
1189
|
name = "export";
|
|
1190
1190
|
get defaultConfig() {
|
|
1191
1191
|
return {
|
|
@@ -1222,13 +1222,13 @@ class pn extends _ {
|
|
|
1222
1222
|
try {
|
|
1223
1223
|
switch (e) {
|
|
1224
1224
|
case "csv": {
|
|
1225
|
-
const l =
|
|
1226
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1225
|
+
const l = Pt(o, r, n, { bom: !0 });
|
|
1226
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, Dt(l, a);
|
|
1227
1227
|
break;
|
|
1228
1228
|
}
|
|
1229
1229
|
case "excel": {
|
|
1230
|
-
const l =
|
|
1231
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1230
|
+
const l = Mt(o, r, n);
|
|
1231
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, Nt(l, a);
|
|
1232
1232
|
break;
|
|
1233
1233
|
}
|
|
1234
1234
|
case "json": {
|
|
@@ -1242,7 +1242,7 @@ class pn extends _ {
|
|
|
1242
1242
|
}), d = JSON.stringify(l, null, 2);
|
|
1243
1243
|
a = a.endsWith(".json") ? a : `${a}.json`;
|
|
1244
1244
|
const c = new Blob([d], { type: "application/json" });
|
|
1245
|
-
|
|
1245
|
+
me(c, a);
|
|
1246
1246
|
break;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
@@ -1279,7 +1279,7 @@ class pn extends _ {
|
|
|
1279
1279
|
return this.lastExportInfo;
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function qt(s) {
|
|
1283
1283
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1284
1284
|
let a = Math.floor(i / n) - r;
|
|
1285
1285
|
a < 0 && (a = 0);
|
|
@@ -1291,10 +1291,10 @@ function Ht(s) {
|
|
|
1291
1291
|
totalHeight: e * n
|
|
1292
1292
|
};
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function Ht(s, e) {
|
|
1295
1295
|
return s <= e;
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1297
|
+
function zt(s, e, t = !1) {
|
|
1298
1298
|
const i = s[e.field];
|
|
1299
1299
|
if (e.operator === "blank")
|
|
1300
1300
|
return i == null || i === "";
|
|
@@ -1333,10 +1333,10 @@ function Kt(s, e, t = !1) {
|
|
|
1333
1333
|
return !0;
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1337
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1336
|
+
function Kt(s, e, t = !1) {
|
|
1337
|
+
return e.length ? s.filter((i) => e.every((n) => zt(i, n, t))) : s;
|
|
1338
1338
|
}
|
|
1339
|
-
function
|
|
1339
|
+
function Ot(s) {
|
|
1340
1340
|
return JSON.stringify(
|
|
1341
1341
|
s.map((e) => ({
|
|
1342
1342
|
field: e.field,
|
|
@@ -1346,7 +1346,7 @@ function Gt(s) {
|
|
|
1346
1346
|
}))
|
|
1347
1347
|
);
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1349
|
+
function Le(s, e) {
|
|
1350
1350
|
const t = /* @__PURE__ */ new Set();
|
|
1351
1351
|
for (const i of s) {
|
|
1352
1352
|
const n = i[e];
|
|
@@ -1354,10 +1354,10 @@ function Fe(s, e) {
|
|
|
1354
1354
|
}
|
|
1355
1355
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1356
1356
|
}
|
|
1357
|
-
const
|
|
1358
|
-
class
|
|
1357
|
+
const Gt = '@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-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)}}";
|
|
1358
|
+
class N extends A {
|
|
1359
1359
|
name = "filtering";
|
|
1360
|
-
styles =
|
|
1360
|
+
styles = Gt;
|
|
1361
1361
|
get defaultConfig() {
|
|
1362
1362
|
return {
|
|
1363
1363
|
debounceMs: 300,
|
|
@@ -1394,7 +1394,7 @@ class q extends _ {
|
|
|
1394
1394
|
return t;
|
|
1395
1395
|
}
|
|
1396
1396
|
}
|
|
1397
|
-
return
|
|
1397
|
+
return N.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1398
1398
|
}
|
|
1399
1399
|
syncExcludedValues(e, t) {
|
|
1400
1400
|
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);
|
|
@@ -1410,10 +1410,10 @@ class q extends _ {
|
|
|
1410
1410
|
if (!t.length) return [...e];
|
|
1411
1411
|
if (this.config.filterHandler)
|
|
1412
1412
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1413
|
-
const i =
|
|
1413
|
+
const i = Ot(t);
|
|
1414
1414
|
if (this.cacheKey === i && this.cachedResult)
|
|
1415
1415
|
return this.cachedResult;
|
|
1416
|
-
const n =
|
|
1416
|
+
const n = Kt([...e], t, this.config.caseSensitive);
|
|
1417
1417
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1418
1418
|
}
|
|
1419
1419
|
afterRender() {
|
|
@@ -1423,7 +1423,7 @@ class q extends _ {
|
|
|
1423
1423
|
const n = i.getAttribute("data-col");
|
|
1424
1424
|
if (n === null) return;
|
|
1425
1425
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1426
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1426
|
+
if (!r || !this.isColumnFilterable(r) || q(r)) return;
|
|
1427
1427
|
const o = r.field;
|
|
1428
1428
|
if (!o) return;
|
|
1429
1429
|
const a = this.filters.has(o);
|
|
@@ -1491,7 +1491,7 @@ class q extends _ {
|
|
|
1491
1491
|
return this.getFilters();
|
|
1492
1492
|
}
|
|
1493
1493
|
getUniqueValues(e) {
|
|
1494
|
-
return
|
|
1494
|
+
return Le(this.sourceRows, e);
|
|
1495
1495
|
}
|
|
1496
1496
|
copyGridThemeContext(e) {
|
|
1497
1497
|
const t = this.gridElement;
|
|
@@ -1508,7 +1508,7 @@ class q extends _ {
|
|
|
1508
1508
|
return;
|
|
1509
1509
|
}
|
|
1510
1510
|
const e = document.createElement("style");
|
|
1511
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1511
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Bt, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1512
1512
|
}
|
|
1513
1513
|
toggleFilterPanel(e, t, i) {
|
|
1514
1514
|
if (this.openPanelField === e) {
|
|
@@ -1523,7 +1523,7 @@ class q extends _ {
|
|
|
1523
1523
|
});
|
|
1524
1524
|
return;
|
|
1525
1525
|
}
|
|
1526
|
-
const r =
|
|
1526
|
+
const r = Le(this.sourceRows, e);
|
|
1527
1527
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1528
1528
|
}
|
|
1529
1529
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1573,11 +1573,11 @@ class q extends _ {
|
|
|
1573
1573
|
}
|
|
1574
1574
|
static supportsAnchorPositioning = null;
|
|
1575
1575
|
static checkAnchorPositioningSupport() {
|
|
1576
|
-
return
|
|
1576
|
+
return N.supportsAnchorPositioning === null && (N.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), N.supportsAnchorPositioning;
|
|
1577
1577
|
}
|
|
1578
1578
|
positionPanel(e, t) {
|
|
1579
1579
|
const n = t.closest(".cell") ?? t;
|
|
1580
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1580
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, N.checkAnchorPositioningSupport()) {
|
|
1581
1581
|
requestAnimationFrame(() => {
|
|
1582
1582
|
const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
|
|
1583
1583
|
o.top < a.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1604,14 +1604,14 @@ class q extends _ {
|
|
|
1604
1604
|
const h = document.createElement("span");
|
|
1605
1605
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1606
1606
|
const g = () => {
|
|
1607
|
-
const
|
|
1608
|
-
u.checked =
|
|
1607
|
+
const x = [...b.values()], S = x.every((m) => m), T = x.every((m) => !m);
|
|
1608
|
+
u.checked = S, u.indeterminate = !S && !T;
|
|
1609
1609
|
};
|
|
1610
1610
|
u.addEventListener("change", () => {
|
|
1611
|
-
const
|
|
1612
|
-
for (const
|
|
1613
|
-
|
|
1614
|
-
g(),
|
|
1611
|
+
const x = u.checked;
|
|
1612
|
+
for (const S of b.keys())
|
|
1613
|
+
b.set(S, x);
|
|
1614
|
+
g(), _();
|
|
1615
1615
|
}), e.appendChild(d);
|
|
1616
1616
|
const f = document.createElement("div");
|
|
1617
1617
|
f.className = "tbw-filter-values";
|
|
@@ -1619,186 +1619,182 @@ class q extends _ {
|
|
|
1619
1619
|
p.className = "tbw-filter-values-spacer", f.appendChild(p);
|
|
1620
1620
|
const w = document.createElement("div");
|
|
1621
1621
|
w.className = "tbw-filter-values-content", f.appendChild(w);
|
|
1622
|
-
const
|
|
1623
|
-
i.forEach((
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1622
|
+
const b = /* @__PURE__ */ new Map();
|
|
1623
|
+
i.forEach((x) => {
|
|
1624
|
+
const S = x == null ? "__null__" : String(x);
|
|
1625
|
+
b.set(S, !n.has(x));
|
|
1626
1626
|
}), g();
|
|
1627
|
-
let
|
|
1628
|
-
const
|
|
1629
|
-
const T =
|
|
1630
|
-
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1633
|
-
|
|
1627
|
+
let v = [];
|
|
1628
|
+
const C = (x, S) => {
|
|
1629
|
+
const T = x == null ? "(Blank)" : String(x), m = x == null ? "__null__" : String(x), y = document.createElement("label");
|
|
1630
|
+
y.className = "tbw-filter-value-item", y.style.position = "absolute", y.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${S})`, y.style.left = "0", y.style.right = "0", y.style.boxSizing = "border-box";
|
|
1631
|
+
const L = document.createElement("input");
|
|
1632
|
+
L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
|
|
1633
|
+
b.set(m, L.checked), g();
|
|
1634
1634
|
});
|
|
1635
|
-
const
|
|
1636
|
-
return
|
|
1637
|
-
},
|
|
1638
|
-
const
|
|
1639
|
-
if (p.style.height = `${
|
|
1640
|
-
w.innerHTML = "", w.style.transform = "translateY(0px)",
|
|
1641
|
-
w.appendChild(
|
|
1635
|
+
const H = document.createElement("span");
|
|
1636
|
+
return H.textContent = T, y.appendChild(L), y.appendChild(H), y;
|
|
1637
|
+
}, _ = () => {
|
|
1638
|
+
const x = v.length, S = f.clientHeight, T = f.scrollTop;
|
|
1639
|
+
if (p.style.height = `${x * o}px`, Ht(x, N.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1640
|
+
w.innerHTML = "", w.style.transform = "translateY(0px)", v.forEach((y, L) => {
|
|
1641
|
+
w.appendChild(C(y, L));
|
|
1642
1642
|
});
|
|
1643
1643
|
return;
|
|
1644
1644
|
}
|
|
1645
|
-
const
|
|
1646
|
-
totalRows:
|
|
1647
|
-
viewportHeight:
|
|
1645
|
+
const m = qt({
|
|
1646
|
+
totalRows: x,
|
|
1647
|
+
viewportHeight: S,
|
|
1648
1648
|
scrollTop: T,
|
|
1649
1649
|
rowHeight: o,
|
|
1650
|
-
overscan:
|
|
1650
|
+
overscan: N.LIST_OVERSCAN
|
|
1651
1651
|
});
|
|
1652
|
-
w.style.transform = `translateY(${
|
|
1653
|
-
for (let
|
|
1654
|
-
w.appendChild(
|
|
1655
|
-
},
|
|
1656
|
-
const
|
|
1657
|
-
if (
|
|
1658
|
-
const
|
|
1659
|
-
return !
|
|
1660
|
-
}),
|
|
1652
|
+
w.style.transform = `translateY(${m.offsetY}px)`, w.innerHTML = "";
|
|
1653
|
+
for (let y = m.start; y < m.end; y++)
|
|
1654
|
+
w.appendChild(C(v[y], y - m.start));
|
|
1655
|
+
}, E = (x) => {
|
|
1656
|
+
const S = this.config.caseSensitive ?? !1, T = S ? x : x.toLowerCase();
|
|
1657
|
+
if (v = i.filter((m) => {
|
|
1658
|
+
const y = m == null ? "(Blank)" : String(m), L = S ? y : y.toLowerCase();
|
|
1659
|
+
return !x || L.includes(T);
|
|
1660
|
+
}), v.length === 0) {
|
|
1661
1661
|
p.style.height = "0px", w.innerHTML = "";
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1662
|
+
const m = document.createElement("div");
|
|
1663
|
+
m.className = "tbw-filter-no-match", m.textContent = "No matching values", w.appendChild(m);
|
|
1664
1664
|
return;
|
|
1665
1665
|
}
|
|
1666
|
-
|
|
1666
|
+
_();
|
|
1667
1667
|
};
|
|
1668
1668
|
f.addEventListener(
|
|
1669
1669
|
"scroll",
|
|
1670
1670
|
() => {
|
|
1671
|
-
|
|
1671
|
+
v.length > 0 && _();
|
|
1672
1672
|
},
|
|
1673
1673
|
{ passive: !0 }
|
|
1674
|
-
),
|
|
1675
|
-
let
|
|
1674
|
+
), E(l.value), e.appendChild(f);
|
|
1675
|
+
let P;
|
|
1676
1676
|
l.addEventListener("input", () => {
|
|
1677
|
-
clearTimeout(
|
|
1678
|
-
this.searchText.set(r, l.value),
|
|
1677
|
+
clearTimeout(P), P = setTimeout(() => {
|
|
1678
|
+
this.searchText.set(r, l.value), E(l.value);
|
|
1679
1679
|
}, this.config.debounceMs ?? 150);
|
|
1680
1680
|
});
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1685
|
-
const
|
|
1686
|
-
for (const [
|
|
1681
|
+
const F = document.createElement("div");
|
|
1682
|
+
F.className = "tbw-filter-buttons";
|
|
1683
|
+
const I = document.createElement("button");
|
|
1684
|
+
I.className = "tbw-filter-apply-btn", I.textContent = "Apply", I.addEventListener("click", () => {
|
|
1685
|
+
const x = [];
|
|
1686
|
+
for (const [S, T] of b)
|
|
1687
1687
|
if (!T)
|
|
1688
|
-
if (
|
|
1689
|
-
|
|
1688
|
+
if (S === "__null__")
|
|
1689
|
+
x.push(null);
|
|
1690
1690
|
else {
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1691
|
+
const m = i.find((y) => String(y) === S);
|
|
1692
|
+
x.push(m !== void 0 ? m : S);
|
|
1693
1693
|
}
|
|
1694
|
-
t.applySetFilter(
|
|
1695
|
-
}),
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1694
|
+
t.applySetFilter(x);
|
|
1695
|
+
}), F.appendChild(I);
|
|
1696
|
+
const R = document.createElement("button");
|
|
1697
|
+
R.className = "tbw-filter-clear-btn", R.textContent = "Clear Filter", R.addEventListener("click", () => {
|
|
1698
1698
|
t.clearFilter();
|
|
1699
|
-
}),
|
|
1699
|
+
}), F.appendChild(R), e.appendChild(F);
|
|
1700
1700
|
}
|
|
1701
1701
|
renderNumberFilterPanel(e, t, i) {
|
|
1702
|
-
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (
|
|
1703
|
-
if (typeof
|
|
1704
|
-
if (typeof
|
|
1705
|
-
const W = parseFloat(
|
|
1702
|
+
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (k, z) => {
|
|
1703
|
+
if (typeof k == "number") return k;
|
|
1704
|
+
if (typeof k == "string") {
|
|
1705
|
+
const W = parseFloat(k);
|
|
1706
1706
|
return isNaN(W) ? z : W;
|
|
1707
1707
|
}
|
|
1708
1708
|
return z;
|
|
1709
|
-
}, d = i.filter((
|
|
1710
|
-
let w = h,
|
|
1711
|
-
p?.operator === "between" ? (w = l(p.value, h),
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1709
|
+
}, d = i.filter((k) => typeof k == "number" && !isNaN(k)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), g = l(o?.max ?? a?.max, u), f = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
|
|
1710
|
+
let w = h, b = g;
|
|
1711
|
+
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, g));
|
|
1712
|
+
const v = document.createElement("div");
|
|
1713
|
+
v.className = "tbw-filter-range-inputs";
|
|
1714
|
+
const C = document.createElement("div");
|
|
1715
|
+
C.className = "tbw-filter-range-group";
|
|
1716
|
+
const _ = document.createElement("label");
|
|
1717
|
+
_.textContent = "Min", _.className = "tbw-filter-range-label";
|
|
1718
|
+
const E = document.createElement("input");
|
|
1719
|
+
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(g), E.step = String(f), E.value = String(w), C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1720
|
+
const P = document.createElement("span");
|
|
1721
|
+
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1722
|
+
const F = document.createElement("div");
|
|
1723
|
+
F.className = "tbw-filter-range-group";
|
|
1724
|
+
const I = document.createElement("label");
|
|
1725
|
+
I.textContent = "Max", I.className = "tbw-filter-range-label";
|
|
1726
|
+
const R = document.createElement("input");
|
|
1727
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(b), F.appendChild(I), F.appendChild(R), v.appendChild(F), e.appendChild(v);
|
|
1714
1728
|
const x = document.createElement("div");
|
|
1715
|
-
x.className = "tbw-filter-range-
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1718
|
-
const F = document.createElement("label");
|
|
1719
|
-
F.textContent = "Min", F.className = "tbw-filter-range-label";
|
|
1720
|
-
const k = document.createElement("input");
|
|
1721
|
-
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);
|
|
1722
|
-
const I = document.createElement("span");
|
|
1723
|
-
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1724
|
-
const L = document.createElement("div");
|
|
1725
|
-
L.className = "tbw-filter-range-group";
|
|
1726
|
-
const P = document.createElement("label");
|
|
1727
|
-
P.textContent = "Max", P.className = "tbw-filter-range-label";
|
|
1728
|
-
const b = document.createElement("input");
|
|
1729
|
-
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), L.appendChild(P), L.appendChild(b), x.appendChild(L), e.appendChild(x);
|
|
1730
|
-
const R = document.createElement("div");
|
|
1731
|
-
R.className = "tbw-filter-range-slider";
|
|
1729
|
+
x.className = "tbw-filter-range-slider";
|
|
1730
|
+
const S = document.createElement("div");
|
|
1731
|
+
S.className = "tbw-filter-range-track";
|
|
1732
1732
|
const T = document.createElement("div");
|
|
1733
|
-
T.className = "tbw-filter-range-
|
|
1734
|
-
const C = document.createElement("div");
|
|
1735
|
-
C.className = "tbw-filter-range-fill";
|
|
1733
|
+
T.className = "tbw-filter-range-fill";
|
|
1736
1734
|
const m = document.createElement("input");
|
|
1737
1735
|
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);
|
|
1738
|
-
const
|
|
1739
|
-
|
|
1740
|
-
const
|
|
1741
|
-
const
|
|
1742
|
-
|
|
1736
|
+
const y = document.createElement("input");
|
|
1737
|
+
y.type = "range", y.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", y.min = String(h), y.max = String(g), y.step = String(f), y.value = String(b), x.appendChild(S), x.appendChild(T), x.appendChild(m), x.appendChild(y), e.appendChild(x);
|
|
1738
|
+
const L = () => {
|
|
1739
|
+
const k = parseFloat(m.value), z = parseFloat(y.value), W = g - h, be = (k - h) / W * 100, ot = (z - h) / W * 100;
|
|
1740
|
+
T.style.left = `${be}%`, T.style.width = `${ot - be}%`;
|
|
1743
1741
|
};
|
|
1744
1742
|
m.addEventListener("input", () => {
|
|
1745
|
-
const
|
|
1746
|
-
m.value = String(
|
|
1743
|
+
const k = Math.min(parseFloat(m.value), parseFloat(y.value));
|
|
1744
|
+
m.value = String(k), E.value = String(k), L();
|
|
1745
|
+
}), y.addEventListener("input", () => {
|
|
1746
|
+
const k = Math.max(parseFloat(y.value), parseFloat(m.value));
|
|
1747
|
+
y.value = String(k), R.value = String(k), L();
|
|
1747
1748
|
}), E.addEventListener("input", () => {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
}),
|
|
1751
|
-
let
|
|
1752
|
-
|
|
1753
|
-
}),
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1749
|
+
let k = parseFloat(E.value) || h;
|
|
1750
|
+
k = Math.max(h, Math.min(k, parseFloat(R.value))), m.value = String(k), L();
|
|
1751
|
+
}), R.addEventListener("input", () => {
|
|
1752
|
+
let k = parseFloat(R.value) || g;
|
|
1753
|
+
k = Math.min(g, Math.max(k, parseFloat(E.value))), y.value = String(k), L();
|
|
1754
|
+
}), L();
|
|
1755
|
+
const H = document.createElement("div");
|
|
1756
|
+
H.className = "tbw-filter-buttons";
|
|
1757
|
+
const Y = document.createElement("button");
|
|
1758
|
+
Y.className = "tbw-filter-apply-btn", Y.textContent = "Apply", Y.addEventListener("click", () => {
|
|
1759
|
+
const k = parseFloat(E.value), z = parseFloat(R.value);
|
|
1760
|
+
t.applyTextFilter("between", k, z);
|
|
1761
|
+
}), H.appendChild(Y);
|
|
1759
1762
|
const X = document.createElement("button");
|
|
1760
|
-
X.className = "tbw-filter-
|
|
1761
|
-
const S = parseFloat(k.value), z = parseFloat(b.value);
|
|
1762
|
-
t.applyTextFilter("between", S, z);
|
|
1763
|
-
}), Y.appendChild(X);
|
|
1764
|
-
const Z = document.createElement("button");
|
|
1765
|
-
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
1763
|
+
X.className = "tbw-filter-clear-btn", X.textContent = "Clear Filter", X.addEventListener("click", () => {
|
|
1766
1764
|
t.clearFilter();
|
|
1767
|
-
}),
|
|
1765
|
+
}), H.appendChild(X), e.appendChild(H);
|
|
1768
1766
|
}
|
|
1769
1767
|
renderDateFilterPanel(e, t, i) {
|
|
1770
1768
|
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);
|
|
1771
|
-
let w = "",
|
|
1772
|
-
p?.operator === "between" ? (w = h(p.value) || "",
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1769
|
+
let w = "", b = "";
|
|
1770
|
+
p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
|
|
1771
|
+
const v = document.createElement("div");
|
|
1772
|
+
v.className = "tbw-filter-date-range";
|
|
1773
|
+
const C = document.createElement("div");
|
|
1774
|
+
C.className = "tbw-filter-date-group";
|
|
1775
|
+
const _ = document.createElement("label");
|
|
1776
|
+
_.textContent = "From", _.className = "tbw-filter-range-label";
|
|
1777
|
+
const E = document.createElement("input");
|
|
1778
|
+
E.type = "date", E.className = "tbw-filter-date-input", g && (E.min = g), f && (E.max = f), E.value = w, C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1779
|
+
const P = document.createElement("span");
|
|
1780
|
+
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1781
|
+
const F = document.createElement("div");
|
|
1782
|
+
F.className = "tbw-filter-date-group";
|
|
1783
|
+
const I = document.createElement("label");
|
|
1784
|
+
I.textContent = "To", I.className = "tbw-filter-range-label";
|
|
1785
|
+
const R = document.createElement("input");
|
|
1786
|
+
R.type = "date", R.className = "tbw-filter-date-input", g && (R.min = g), f && (R.max = f), R.value = b, F.appendChild(I), F.appendChild(R), v.appendChild(F), e.appendChild(v);
|
|
1775
1787
|
const x = document.createElement("div");
|
|
1776
|
-
x.className = "tbw-filter-
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
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);
|
|
1783
|
-
const I = document.createElement("span");
|
|
1784
|
-
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1785
|
-
const L = document.createElement("div");
|
|
1786
|
-
L.className = "tbw-filter-date-group";
|
|
1787
|
-
const P = document.createElement("label");
|
|
1788
|
-
P.textContent = "To", P.className = "tbw-filter-range-label";
|
|
1789
|
-
const b = document.createElement("input");
|
|
1790
|
-
b.type = "date", b.className = "tbw-filter-date-input", g && (b.min = g), f && (b.max = f), b.value = v, L.appendChild(P), L.appendChild(b), x.appendChild(L), e.appendChild(x);
|
|
1791
|
-
const R = document.createElement("div");
|
|
1792
|
-
R.className = "tbw-filter-buttons";
|
|
1788
|
+
x.className = "tbw-filter-buttons";
|
|
1789
|
+
const S = document.createElement("button");
|
|
1790
|
+
S.className = "tbw-filter-apply-btn", S.textContent = "Apply", S.addEventListener("click", () => {
|
|
1791
|
+
const m = E.value, y = R.value;
|
|
1792
|
+
m && y ? t.applyTextFilter("between", m, y) : m ? t.applyTextFilter("greaterThanOrEqual", m) : y ? t.applyTextFilter("lessThanOrEqual", y) : t.clearFilter();
|
|
1793
|
+
}), x.appendChild(S);
|
|
1793
1794
|
const T = document.createElement("button");
|
|
1794
|
-
T.className = "tbw-filter-
|
|
1795
|
-
const m = k.value, E = b.value;
|
|
1796
|
-
m && E ? t.applyTextFilter("between", m, E) : m ? t.applyTextFilter("greaterThanOrEqual", m) : E ? t.applyTextFilter("lessThanOrEqual", E) : t.clearFilter();
|
|
1797
|
-
}), R.appendChild(T);
|
|
1798
|
-
const C = document.createElement("button");
|
|
1799
|
-
C.className = "tbw-filter-clear-btn", C.textContent = "Clear Filter", C.addEventListener("click", () => {
|
|
1795
|
+
T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
|
|
1800
1796
|
t.clearFilter();
|
|
1801
|
-
}),
|
|
1797
|
+
}), x.appendChild(T), e.appendChild(x);
|
|
1802
1798
|
}
|
|
1803
1799
|
applySetFilter(e, t) {
|
|
1804
1800
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -1864,7 +1860,7 @@ class q extends _ {
|
|
|
1864
1860
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1865
1861
|
}
|
|
1866
1862
|
}
|
|
1867
|
-
function
|
|
1863
|
+
function Fe(s) {
|
|
1868
1864
|
if (!s.length) return [];
|
|
1869
1865
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1870
1866
|
if (!a.length) return;
|
|
@@ -1899,7 +1895,7 @@ function Ie(s) {
|
|
|
1899
1895
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1900
1896
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1901
1897
|
}
|
|
1902
|
-
function
|
|
1898
|
+
function Vt(s, e, t) {
|
|
1903
1899
|
if (!e.length || !s) return;
|
|
1904
1900
|
const i = /* @__PURE__ */ new Map();
|
|
1905
1901
|
for (const r of e)
|
|
@@ -1915,7 +1911,7 @@ function Wt(s, e, t) {
|
|
|
1915
1911
|
a && a.classList.add("group-end");
|
|
1916
1912
|
}
|
|
1917
1913
|
}
|
|
1918
|
-
function
|
|
1914
|
+
function Wt(s, e) {
|
|
1919
1915
|
if (s.length === 0) return null;
|
|
1920
1916
|
const t = document.createElement("div");
|
|
1921
1917
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1927,11 +1923,11 @@ function $t(s, e) {
|
|
|
1927
1923
|
}
|
|
1928
1924
|
return t;
|
|
1929
1925
|
}
|
|
1930
|
-
function
|
|
1926
|
+
function $t(s) {
|
|
1931
1927
|
return s.some((e) => e.group != null);
|
|
1932
1928
|
}
|
|
1933
|
-
const
|
|
1934
|
-
class
|
|
1929
|
+
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)}}";
|
|
1930
|
+
class pn extends A {
|
|
1935
1931
|
static manifest = {
|
|
1936
1932
|
ownedProperties: [
|
|
1937
1933
|
{
|
|
@@ -1948,7 +1944,7 @@ class mn extends _ {
|
|
|
1948
1944
|
]
|
|
1949
1945
|
};
|
|
1950
1946
|
name = "groupingColumns";
|
|
1951
|
-
styles =
|
|
1947
|
+
styles = jt;
|
|
1952
1948
|
get defaultConfig() {
|
|
1953
1949
|
return {
|
|
1954
1950
|
showGroupBorders: !0
|
|
@@ -1963,7 +1959,7 @@ class mn extends _ {
|
|
|
1963
1959
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1964
1960
|
return !0;
|
|
1965
1961
|
const i = t?.columns;
|
|
1966
|
-
return Array.isArray(i) ?
|
|
1962
|
+
return Array.isArray(i) ? $t(i) : !1;
|
|
1967
1963
|
}
|
|
1968
1964
|
processColumns(e) {
|
|
1969
1965
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -1979,7 +1975,7 @@ class mn extends _ {
|
|
|
1979
1975
|
});
|
|
1980
1976
|
} else
|
|
1981
1977
|
i = [...e];
|
|
1982
|
-
const n =
|
|
1978
|
+
const n = Fe(i);
|
|
1983
1979
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
1984
1980
|
}
|
|
1985
1981
|
afterRender() {
|
|
@@ -1992,16 +1988,16 @@ class mn extends _ {
|
|
|
1992
1988
|
if (!e) return;
|
|
1993
1989
|
const t = e.querySelector(".header-group-row");
|
|
1994
1990
|
t && t.remove();
|
|
1995
|
-
const i = this.columns, n =
|
|
1991
|
+
const i = this.columns, n = Fe(i);
|
|
1996
1992
|
if (n.length === 0) return;
|
|
1997
|
-
const r =
|
|
1993
|
+
const r = Wt(n, i);
|
|
1998
1994
|
if (r) {
|
|
1999
1995
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
2000
1996
|
const a = e.querySelector(".header-row");
|
|
2001
1997
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
2002
1998
|
}
|
|
2003
1999
|
const o = e.querySelector(".header-row");
|
|
2004
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
2000
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Vt(o, n)), this.#e(n);
|
|
2005
2001
|
}
|
|
2006
2002
|
#e(e) {
|
|
2007
2003
|
if (!this.config.showGroupBorders) return;
|
|
@@ -2032,7 +2028,7 @@ class mn extends _ {
|
|
|
2032
2028
|
this.requestRender();
|
|
2033
2029
|
}
|
|
2034
2030
|
}
|
|
2035
|
-
function
|
|
2031
|
+
function Ie({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
2036
2032
|
const n = e.groupOn;
|
|
2037
2033
|
if (typeof n != "function")
|
|
2038
2034
|
return [];
|
|
@@ -2065,20 +2061,20 @@ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2065
2061
|
};
|
|
2066
2062
|
return l(r), a;
|
|
2067
2063
|
}
|
|
2068
|
-
function
|
|
2064
|
+
function Ut(s, e) {
|
|
2069
2065
|
const t = new Set(s);
|
|
2070
2066
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2071
2067
|
}
|
|
2072
|
-
function
|
|
2068
|
+
function Yt(s) {
|
|
2073
2069
|
const e = /* @__PURE__ */ new Set();
|
|
2074
2070
|
for (const t of s)
|
|
2075
2071
|
t.kind === "group" && e.add(t.key);
|
|
2076
2072
|
return e;
|
|
2077
2073
|
}
|
|
2078
|
-
function
|
|
2074
|
+
function Xt() {
|
|
2079
2075
|
return /* @__PURE__ */ new Set();
|
|
2080
2076
|
}
|
|
2081
|
-
function
|
|
2077
|
+
function Zt(s, e) {
|
|
2082
2078
|
if (s === !0)
|
|
2083
2079
|
return new Set(e);
|
|
2084
2080
|
if (s === !1 || s == null)
|
|
@@ -2089,14 +2085,14 @@ function Jt(s, e) {
|
|
|
2089
2085
|
}
|
|
2090
2086
|
return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
|
|
2091
2087
|
}
|
|
2092
|
-
function
|
|
2088
|
+
function Jt(s) {
|
|
2093
2089
|
return s.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2094
2090
|
}
|
|
2095
|
-
function
|
|
2091
|
+
function Qt(s) {
|
|
2096
2092
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
2097
2093
|
}
|
|
2098
|
-
const
|
|
2099
|
-
class
|
|
2094
|
+
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}}}";
|
|
2095
|
+
class mn extends A {
|
|
2100
2096
|
static manifest = {
|
|
2101
2097
|
configRules: [
|
|
2102
2098
|
{
|
|
@@ -2111,7 +2107,7 @@ class wn extends _ {
|
|
|
2111
2107
|
]
|
|
2112
2108
|
};
|
|
2113
2109
|
name = "groupingRows";
|
|
2114
|
-
styles =
|
|
2110
|
+
styles = ei;
|
|
2115
2111
|
get defaultConfig() {
|
|
2116
2112
|
return {
|
|
2117
2113
|
defaultExpanded: !1,
|
|
@@ -2141,7 +2137,7 @@ class wn extends _ {
|
|
|
2141
2137
|
const t = this.config;
|
|
2142
2138
|
if (typeof t.groupOn != "function")
|
|
2143
2139
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2144
|
-
const i =
|
|
2140
|
+
const i = Ie({
|
|
2145
2141
|
rows: [...e],
|
|
2146
2142
|
config: t,
|
|
2147
2143
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -2150,10 +2146,10 @@ class wn extends _ {
|
|
|
2150
2146
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2151
2147
|
let n;
|
|
2152
2148
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2153
|
-
const a =
|
|
2154
|
-
n =
|
|
2149
|
+
const a = Jt(i);
|
|
2150
|
+
n = Zt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2155
2151
|
}
|
|
2156
|
-
const r =
|
|
2152
|
+
const r = Ie({
|
|
2157
2153
|
rows: [...e],
|
|
2158
2154
|
config: t,
|
|
2159
2155
|
expanded: this.expandedKeys,
|
|
@@ -2173,7 +2169,7 @@ class wn extends _ {
|
|
|
2173
2169
|
__groupDepth: a.depth,
|
|
2174
2170
|
__groupRows: a.rows,
|
|
2175
2171
|
__groupExpanded: a.expanded,
|
|
2176
|
-
__groupRowCount:
|
|
2172
|
+
__groupRowCount: Qt(a)
|
|
2177
2173
|
} : a.row);
|
|
2178
2174
|
}
|
|
2179
2175
|
onCellClick(e) {
|
|
@@ -2245,7 +2241,7 @@ class wn extends _ {
|
|
|
2245
2241
|
const c = document.createElement("span");
|
|
2246
2242
|
c.className = "group-aggregates";
|
|
2247
2243
|
for (const [u, h] of d) {
|
|
2248
|
-
const g = this.columns.find((p) => p.field === u), f =
|
|
2244
|
+
const g = this.columns.find((p) => p.field === u), f = ee(h, o, u, g);
|
|
2249
2245
|
if (f != null) {
|
|
2250
2246
|
const p = document.createElement("span");
|
|
2251
2247
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
@@ -2263,14 +2259,14 @@ class wn extends _ {
|
|
|
2263
2259
|
let c = !1;
|
|
2264
2260
|
o.forEach((u, h) => {
|
|
2265
2261
|
const g = document.createElement("div");
|
|
2266
|
-
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"),
|
|
2262
|
+
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), fe(u)) {
|
|
2267
2263
|
g.setAttribute("data-field", u.field), t.appendChild(g);
|
|
2268
2264
|
return;
|
|
2269
2265
|
}
|
|
2270
2266
|
if (c) {
|
|
2271
2267
|
const f = r[u.field];
|
|
2272
2268
|
if (f) {
|
|
2273
|
-
const p =
|
|
2269
|
+
const p = ee(f, a, u.field, u);
|
|
2274
2270
|
g.textContent = p != null ? String(p) : "";
|
|
2275
2271
|
} else
|
|
2276
2272
|
g.textContent = "";
|
|
@@ -2278,7 +2274,7 @@ class wn extends _ {
|
|
|
2278
2274
|
c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2279
2275
|
const f = document.createElement("span"), p = r[u.field];
|
|
2280
2276
|
if (p) {
|
|
2281
|
-
const w =
|
|
2277
|
+
const w = ee(p, a, u.field, u);
|
|
2282
2278
|
f.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2283
2279
|
} else
|
|
2284
2280
|
f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
@@ -2291,10 +2287,10 @@ class wn extends _ {
|
|
|
2291
2287
|
});
|
|
2292
2288
|
}
|
|
2293
2289
|
expandAll() {
|
|
2294
|
-
this.expandedKeys =
|
|
2290
|
+
this.expandedKeys = Yt(this.flattenedRows), this.requestRender();
|
|
2295
2291
|
}
|
|
2296
2292
|
collapseAll() {
|
|
2297
|
-
this.expandedKeys =
|
|
2293
|
+
this.expandedKeys = Xt(), this.requestRender();
|
|
2298
2294
|
}
|
|
2299
2295
|
toggle(e) {
|
|
2300
2296
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2309,7 +2305,7 @@ class wn extends _ {
|
|
|
2309
2305
|
}
|
|
2310
2306
|
r.add(e), this.expandedKeys = r;
|
|
2311
2307
|
} else
|
|
2312
|
-
this.expandedKeys =
|
|
2308
|
+
this.expandedKeys = Ut(this.expandedKeys, e);
|
|
2313
2309
|
this.emit("group-toggle", {
|
|
2314
2310
|
key: e,
|
|
2315
2311
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2357,22 +2353,22 @@ class wn extends _ {
|
|
|
2357
2353
|
this.config.groupOn = e, this.requestRender();
|
|
2358
2354
|
}
|
|
2359
2355
|
}
|
|
2360
|
-
function
|
|
2356
|
+
function Pe(s, e) {
|
|
2361
2357
|
const t = new Set(s);
|
|
2362
2358
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2363
2359
|
}
|
|
2364
|
-
function
|
|
2360
|
+
function ti(s, e) {
|
|
2365
2361
|
const t = new Set(s);
|
|
2366
2362
|
return t.add(e), t;
|
|
2367
2363
|
}
|
|
2368
|
-
function
|
|
2364
|
+
function ii(s, e) {
|
|
2369
2365
|
const t = new Set(s);
|
|
2370
2366
|
return t.delete(e), t;
|
|
2371
2367
|
}
|
|
2372
|
-
function
|
|
2368
|
+
function ni(s, e) {
|
|
2373
2369
|
return s.has(e);
|
|
2374
2370
|
}
|
|
2375
|
-
function
|
|
2371
|
+
function ri(s, e, t, i) {
|
|
2376
2372
|
const n = document.createElement("div");
|
|
2377
2373
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2378
2374
|
const r = document.createElement("div");
|
|
@@ -2380,10 +2376,10 @@ function oi(s, e, t, i) {
|
|
|
2380
2376
|
const o = t(s, e);
|
|
2381
2377
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2382
2378
|
}
|
|
2383
|
-
const
|
|
2384
|
-
class
|
|
2379
|
+
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}}}";
|
|
2380
|
+
class et extends A {
|
|
2385
2381
|
name = "masterDetail";
|
|
2386
|
-
styles =
|
|
2382
|
+
styles = oi;
|
|
2387
2383
|
get defaultConfig() {
|
|
2388
2384
|
return {
|
|
2389
2385
|
detailHeight: "auto",
|
|
@@ -2412,8 +2408,8 @@ class tt extends _ {
|
|
|
2412
2408
|
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));
|
|
2413
2409
|
const c = t.innerHTML.trim();
|
|
2414
2410
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2415
|
-
const g =
|
|
2416
|
-
return
|
|
2411
|
+
const g = lt(c, { value: u, row: u });
|
|
2412
|
+
return dt(g);
|
|
2417
2413
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2418
2414
|
}
|
|
2419
2415
|
get animationStyle() {
|
|
@@ -2444,10 +2440,10 @@ class tt extends _ {
|
|
|
2444
2440
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2445
2441
|
getDetailHeight(e) {
|
|
2446
2442
|
const t = this.detailElements.get(e);
|
|
2447
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2443
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : et.DEFAULT_DETAIL_HEIGHT;
|
|
2448
2444
|
}
|
|
2449
2445
|
toggleAndEmit(e, t) {
|
|
2450
|
-
this.expandedRows =
|
|
2446
|
+
this.expandedRows = Pe(this.expandedRows, e), this.emit("detail-expand", {
|
|
2451
2447
|
rowIndex: t,
|
|
2452
2448
|
row: e,
|
|
2453
2449
|
expanded: this.expandedRows.has(e)
|
|
@@ -2460,9 +2456,9 @@ class tt extends _ {
|
|
|
2460
2456
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2461
2457
|
return [...e];
|
|
2462
2458
|
const i = [...e];
|
|
2463
|
-
if (
|
|
2459
|
+
if (gt(i))
|
|
2464
2460
|
return i;
|
|
2465
|
-
const r =
|
|
2461
|
+
const r = ft(this.name);
|
|
2466
2462
|
return r.viewRenderer = (o) => {
|
|
2467
2463
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2468
2464
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2482,7 +2478,7 @@ class tt extends _ {
|
|
|
2482
2478
|
onKeyDown(e) {
|
|
2483
2479
|
if (e.key !== " ") return;
|
|
2484
2480
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2485
|
-
if (!n || !
|
|
2481
|
+
if (!n || !fe(n)) return;
|
|
2486
2482
|
const r = this.rows[i];
|
|
2487
2483
|
if (r)
|
|
2488
2484
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -2515,7 +2511,7 @@ class tt extends _ {
|
|
|
2515
2511
|
d.previousElementSibling !== a && a.after(d);
|
|
2516
2512
|
continue;
|
|
2517
2513
|
}
|
|
2518
|
-
const c =
|
|
2514
|
+
const c = ri(l, o, this.config.detailRenderer, n);
|
|
2519
2515
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2520
2516
|
}
|
|
2521
2517
|
}
|
|
@@ -2550,19 +2546,19 @@ class tt extends _ {
|
|
|
2550
2546
|
}
|
|
2551
2547
|
expand(e) {
|
|
2552
2548
|
const t = this.rows[e];
|
|
2553
|
-
t && (this.expandedRows =
|
|
2549
|
+
t && (this.expandedRows = ti(this.expandedRows, t), this.requestRender());
|
|
2554
2550
|
}
|
|
2555
2551
|
collapse(e) {
|
|
2556
2552
|
const t = this.rows[e];
|
|
2557
|
-
t && (this.expandedRows =
|
|
2553
|
+
t && (this.expandedRows = ii(this.expandedRows, t), this.requestRender());
|
|
2558
2554
|
}
|
|
2559
2555
|
toggle(e) {
|
|
2560
2556
|
const t = this.rows[e];
|
|
2561
|
-
t && (this.expandedRows =
|
|
2557
|
+
t && (this.expandedRows = Pe(this.expandedRows, t), this.requestRender());
|
|
2562
2558
|
}
|
|
2563
2559
|
isExpanded(e) {
|
|
2564
2560
|
const t = this.rows[e];
|
|
2565
|
-
return t ?
|
|
2561
|
+
return t ? ni(this.expandedRows, t) : !1;
|
|
2566
2562
|
}
|
|
2567
2563
|
expandAll() {
|
|
2568
2564
|
for (const e of this.rows)
|
|
@@ -2592,34 +2588,34 @@ class tt extends _ {
|
|
|
2592
2588
|
}
|
|
2593
2589
|
}
|
|
2594
2590
|
}
|
|
2595
|
-
function
|
|
2591
|
+
function si(s, e, t) {
|
|
2596
2592
|
return e.length ? [...s].sort((i, n) => {
|
|
2597
2593
|
for (const r of e) {
|
|
2598
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2594
|
+
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);
|
|
2599
2595
|
if (c !== 0)
|
|
2600
2596
|
return r.direction === "asc" ? c : -c;
|
|
2601
2597
|
}
|
|
2602
2598
|
return 0;
|
|
2603
2599
|
}) : [...s];
|
|
2604
2600
|
}
|
|
2605
|
-
function
|
|
2601
|
+
function ai(s, e) {
|
|
2606
2602
|
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));
|
|
2607
2603
|
}
|
|
2608
|
-
function
|
|
2604
|
+
function li(s, e, t, i) {
|
|
2609
2605
|
const n = s.find((r) => r.field === e);
|
|
2610
2606
|
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" }];
|
|
2611
2607
|
}
|
|
2612
|
-
function
|
|
2608
|
+
function De(s, e) {
|
|
2613
2609
|
const t = s.findIndex((i) => i.field === e);
|
|
2614
2610
|
return t >= 0 ? t + 1 : void 0;
|
|
2615
2611
|
}
|
|
2616
|
-
function
|
|
2612
|
+
function Me(s, e) {
|
|
2617
2613
|
return s.find((t) => t.field === e)?.direction;
|
|
2618
2614
|
}
|
|
2619
|
-
const
|
|
2620
|
-
class
|
|
2615
|
+
const di = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2616
|
+
class wn extends A {
|
|
2621
2617
|
name = "multiSort";
|
|
2622
|
-
styles =
|
|
2618
|
+
styles = di;
|
|
2623
2619
|
get defaultConfig() {
|
|
2624
2620
|
return {
|
|
2625
2621
|
maxSortColumns: 3,
|
|
@@ -2631,12 +2627,12 @@ class bn extends _ {
|
|
|
2631
2627
|
this.sortModel = [];
|
|
2632
2628
|
}
|
|
2633
2629
|
processRows(e) {
|
|
2634
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2630
|
+
return this.sortModel.length === 0 ? [...e] : si([...e], this.sortModel, [...this.columns]);
|
|
2635
2631
|
}
|
|
2636
2632
|
onHeaderClick(e) {
|
|
2637
2633
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2638
2634
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2639
|
-
return this.sortModel =
|
|
2635
|
+
return this.sortModel = li(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2640
2636
|
}
|
|
2641
2637
|
afterRender() {
|
|
2642
2638
|
const e = this.gridElement;
|
|
@@ -2645,7 +2641,7 @@ class bn extends _ {
|
|
|
2645
2641
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2646
2642
|
const r = n.getAttribute("data-field");
|
|
2647
2643
|
if (!r) return;
|
|
2648
|
-
const o =
|
|
2644
|
+
const o = De(this.sortModel, r), a = Me(this.sortModel, r);
|
|
2649
2645
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2650
2646
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2651
2647
|
const c = document.createElement("span");
|
|
@@ -2669,10 +2665,10 @@ class bn extends _ {
|
|
|
2669
2665
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2670
2666
|
}
|
|
2671
2667
|
getSortIndex(e) {
|
|
2672
|
-
return
|
|
2668
|
+
return De(this.sortModel, e);
|
|
2673
2669
|
}
|
|
2674
2670
|
getSortDirection(e) {
|
|
2675
|
-
return
|
|
2671
|
+
return Me(this.sortModel, e);
|
|
2676
2672
|
}
|
|
2677
2673
|
getColumnState(e) {
|
|
2678
2674
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2695,16 +2691,16 @@ class bn extends _ {
|
|
|
2695
2691
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2696
2692
|
}
|
|
2697
2693
|
}
|
|
2698
|
-
function
|
|
2694
|
+
function ci(s) {
|
|
2699
2695
|
return s.filter((e) => e.sticky === "left");
|
|
2700
2696
|
}
|
|
2701
|
-
function
|
|
2697
|
+
function ui(s) {
|
|
2702
2698
|
return s.filter((e) => e.sticky === "right");
|
|
2703
2699
|
}
|
|
2704
|
-
function
|
|
2700
|
+
function se(s) {
|
|
2705
2701
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2706
2702
|
}
|
|
2707
|
-
function
|
|
2703
|
+
function Ne(s, e) {
|
|
2708
2704
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2709
2705
|
if (!t.length) return;
|
|
2710
2706
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2728,12 +2724,12 @@ function qe(s, e) {
|
|
|
2728
2724
|
}), r += l.offsetWidth);
|
|
2729
2725
|
}
|
|
2730
2726
|
}
|
|
2731
|
-
function
|
|
2727
|
+
function qe(s) {
|
|
2732
2728
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2733
2729
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2734
2730
|
});
|
|
2735
2731
|
}
|
|
2736
|
-
class
|
|
2732
|
+
class bn extends A {
|
|
2737
2733
|
static manifest = {
|
|
2738
2734
|
ownedProperties: [
|
|
2739
2735
|
{
|
|
@@ -2756,26 +2752,26 @@ class vn extends _ {
|
|
|
2756
2752
|
}
|
|
2757
2753
|
static detect(e, t) {
|
|
2758
2754
|
const i = t?.columns;
|
|
2759
|
-
return Array.isArray(i) ?
|
|
2755
|
+
return Array.isArray(i) ? se(i) : !1;
|
|
2760
2756
|
}
|
|
2761
2757
|
processColumns(e) {
|
|
2762
|
-
return this.isApplied =
|
|
2758
|
+
return this.isApplied = se([...e]), [...e];
|
|
2763
2759
|
}
|
|
2764
2760
|
afterRender() {
|
|
2765
2761
|
if (!this.isApplied)
|
|
2766
2762
|
return;
|
|
2767
2763
|
const e = this.grid, t = [...this.columns];
|
|
2768
|
-
if (!
|
|
2769
|
-
|
|
2764
|
+
if (!se(t)) {
|
|
2765
|
+
qe(e), this.isApplied = !1;
|
|
2770
2766
|
return;
|
|
2771
2767
|
}
|
|
2772
2768
|
queueMicrotask(() => {
|
|
2773
|
-
|
|
2769
|
+
Ne(e, t);
|
|
2774
2770
|
});
|
|
2775
2771
|
}
|
|
2776
2772
|
onPluginQuery(e) {
|
|
2777
2773
|
switch (e.type) {
|
|
2778
|
-
case
|
|
2774
|
+
case Ze.CAN_MOVE_COLUMN: {
|
|
2779
2775
|
const t = e.context, i = t.sticky;
|
|
2780
2776
|
if (i === "left" || i === "right")
|
|
2781
2777
|
return !1;
|
|
@@ -2788,18 +2784,18 @@ class vn extends _ {
|
|
|
2788
2784
|
}
|
|
2789
2785
|
refreshStickyOffsets() {
|
|
2790
2786
|
const e = [...this.columns];
|
|
2791
|
-
|
|
2787
|
+
Ne(this.grid, e);
|
|
2792
2788
|
}
|
|
2793
2789
|
getLeftPinnedColumns() {
|
|
2794
2790
|
const e = [...this.columns];
|
|
2795
|
-
return
|
|
2791
|
+
return ci(e);
|
|
2796
2792
|
}
|
|
2797
2793
|
getRightPinnedColumns() {
|
|
2798
2794
|
const e = [...this.columns];
|
|
2799
|
-
return
|
|
2795
|
+
return ui(e);
|
|
2800
2796
|
}
|
|
2801
2797
|
clearStickyPositions() {
|
|
2802
|
-
|
|
2798
|
+
qe(this.grid);
|
|
2803
2799
|
}
|
|
2804
2800
|
getHorizontalScrollOffsets(e, t) {
|
|
2805
2801
|
if (!this.isApplied)
|
|
@@ -2820,10 +2816,10 @@ class vn extends _ {
|
|
|
2820
2816
|
return { left: i, right: n, skipScroll: r };
|
|
2821
2817
|
}
|
|
2822
2818
|
}
|
|
2823
|
-
function
|
|
2819
|
+
function hi(s) {
|
|
2824
2820
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2825
2821
|
}
|
|
2826
|
-
function
|
|
2822
|
+
function ae(s, e) {
|
|
2827
2823
|
const t = document.createElement("div");
|
|
2828
2824
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
2829
2825
|
const i = document.createElement("div");
|
|
@@ -2845,7 +2841,7 @@ function le(s, e) {
|
|
|
2845
2841
|
}
|
|
2846
2842
|
if (s.customPanels)
|
|
2847
2843
|
for (const o of s.customPanels) {
|
|
2848
|
-
const a =
|
|
2844
|
+
const a = gi(o, e);
|
|
2849
2845
|
switch (o.position) {
|
|
2850
2846
|
case "left":
|
|
2851
2847
|
i.appendChild(a);
|
|
@@ -2860,11 +2856,11 @@ function le(s, e) {
|
|
|
2860
2856
|
}
|
|
2861
2857
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2862
2858
|
}
|
|
2863
|
-
function
|
|
2859
|
+
function He(s) {
|
|
2864
2860
|
const e = document.createElement("div");
|
|
2865
2861
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2866
2862
|
}
|
|
2867
|
-
function
|
|
2863
|
+
function ze(s, e, t, i) {
|
|
2868
2864
|
s.innerHTML = "";
|
|
2869
2865
|
for (const n of e) {
|
|
2870
2866
|
const r = document.createElement("div");
|
|
@@ -2878,11 +2874,11 @@ function Ke(s, e, t, i) {
|
|
|
2878
2874
|
let l, d;
|
|
2879
2875
|
const c = n.aggregators?.[o.field];
|
|
2880
2876
|
if (c)
|
|
2881
|
-
if (
|
|
2882
|
-
const u =
|
|
2877
|
+
if (hi(c)) {
|
|
2878
|
+
const u = ve(c.aggFunc);
|
|
2883
2879
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2884
2880
|
} else {
|
|
2885
|
-
const u =
|
|
2881
|
+
const u = ve(c);
|
|
2886
2882
|
u && (l = u(i, o.field, o));
|
|
2887
2883
|
}
|
|
2888
2884
|
else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
|
|
@@ -2894,13 +2890,13 @@ function Ke(s, e, t, i) {
|
|
|
2894
2890
|
s.appendChild(r);
|
|
2895
2891
|
}
|
|
2896
2892
|
}
|
|
2897
|
-
function
|
|
2893
|
+
function gi(s, e) {
|
|
2898
2894
|
const t = document.createElement("div");
|
|
2899
2895
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2900
2896
|
const i = s.render(e);
|
|
2901
2897
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2902
2898
|
}
|
|
2903
|
-
function
|
|
2899
|
+
function Ke(s, e, t, i, n) {
|
|
2904
2900
|
return {
|
|
2905
2901
|
totalRows: s.length,
|
|
2906
2902
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2910,10 +2906,10 @@ function Oe(s, e, t, i, n) {
|
|
|
2910
2906
|
grid: t
|
|
2911
2907
|
};
|
|
2912
2908
|
}
|
|
2913
|
-
const
|
|
2914
|
-
class
|
|
2909
|
+
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}}";
|
|
2910
|
+
class vn extends A {
|
|
2915
2911
|
name = "pinnedRows";
|
|
2916
|
-
styles =
|
|
2912
|
+
styles = fi;
|
|
2917
2913
|
get defaultConfig() {
|
|
2918
2914
|
return {
|
|
2919
2915
|
position: "bottom",
|
|
@@ -2935,7 +2931,7 @@ class yn extends _ {
|
|
|
2935
2931
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2936
2932
|
if (!t) return;
|
|
2937
2933
|
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);
|
|
2938
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
2934
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Ke(
|
|
2939
2935
|
this.rows,
|
|
2940
2936
|
this.columns,
|
|
2941
2937
|
this.grid,
|
|
@@ -2944,11 +2940,11 @@ class yn extends _ {
|
|
|
2944
2940
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
2945
2941
|
if (a.length > 0) {
|
|
2946
2942
|
if (!this.topAggregationContainer) {
|
|
2947
|
-
this.topAggregationContainer =
|
|
2943
|
+
this.topAggregationContainer = He("top");
|
|
2948
2944
|
const h = e.querySelector(".header");
|
|
2949
2945
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
2950
2946
|
}
|
|
2951
|
-
|
|
2947
|
+
ze(
|
|
2952
2948
|
this.topAggregationContainer,
|
|
2953
2949
|
a,
|
|
2954
2950
|
this.visibleColumns,
|
|
@@ -2958,18 +2954,18 @@ class yn extends _ {
|
|
|
2958
2954
|
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;
|
|
2959
2955
|
if (d && this.config.position === "top")
|
|
2960
2956
|
if (!this.infoBarElement)
|
|
2961
|
-
this.infoBarElement =
|
|
2957
|
+
this.infoBarElement = ae(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
2962
2958
|
else {
|
|
2963
|
-
const h =
|
|
2959
|
+
const h = ae(this.config, r);
|
|
2964
2960
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2965
2961
|
}
|
|
2966
2962
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
2967
|
-
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 =
|
|
2963
|
+
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(
|
|
2968
2964
|
this.bottomAggregationContainer,
|
|
2969
2965
|
l,
|
|
2970
2966
|
this.visibleColumns,
|
|
2971
2967
|
this.rows
|
|
2972
|
-
)), c && (this.infoBarElement =
|
|
2968
|
+
)), c && (this.infoBarElement = ae(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
2973
2969
|
}
|
|
2974
2970
|
cleanup() {
|
|
2975
2971
|
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);
|
|
@@ -2996,7 +2992,7 @@ class yn extends _ {
|
|
|
2996
2992
|
}
|
|
2997
2993
|
getContext() {
|
|
2998
2994
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
2999
|
-
return
|
|
2995
|
+
return Ke(
|
|
3000
2996
|
this.rows,
|
|
3001
2997
|
this.columns,
|
|
3002
2998
|
this.grid,
|
|
@@ -3017,16 +3013,16 @@ class yn extends _ {
|
|
|
3017
3013
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3018
3014
|
}
|
|
3019
3015
|
}
|
|
3020
|
-
const
|
|
3021
|
-
function
|
|
3016
|
+
const pi = ct;
|
|
3017
|
+
function mi(s) {
|
|
3022
3018
|
const e = [];
|
|
3023
3019
|
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;
|
|
3024
3020
|
}
|
|
3025
|
-
function
|
|
3021
|
+
function we(s, e) {
|
|
3026
3022
|
return [...s, e].join("|");
|
|
3027
3023
|
}
|
|
3028
|
-
function
|
|
3029
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
3024
|
+
function wi(s, e) {
|
|
3025
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = bi(s, i), o = tt(
|
|
3030
3026
|
s,
|
|
3031
3027
|
t,
|
|
3032
3028
|
i,
|
|
@@ -3034,7 +3030,7 @@ function bi(s, e) {
|
|
|
3034
3030
|
n,
|
|
3035
3031
|
0,
|
|
3036
3032
|
""
|
|
3037
|
-
), a =
|
|
3033
|
+
), a = yi(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
3038
3034
|
return {
|
|
3039
3035
|
rows: o,
|
|
3040
3036
|
columnKeys: r,
|
|
@@ -3042,7 +3038,7 @@ function bi(s, e) {
|
|
|
3042
3038
|
grandTotal: l
|
|
3043
3039
|
};
|
|
3044
3040
|
}
|
|
3045
|
-
function
|
|
3041
|
+
function bi(s, e) {
|
|
3046
3042
|
if (e.length === 0) return ["value"];
|
|
3047
3043
|
const t = /* @__PURE__ */ new Set();
|
|
3048
3044
|
for (const i of s) {
|
|
@@ -3051,7 +3047,7 @@ function vi(s, e) {
|
|
|
3051
3047
|
}
|
|
3052
3048
|
return [...t].sort();
|
|
3053
3049
|
}
|
|
3054
|
-
function
|
|
3050
|
+
function vi(s, e) {
|
|
3055
3051
|
const t = /* @__PURE__ */ new Map();
|
|
3056
3052
|
for (const i of s) {
|
|
3057
3053
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -3059,10 +3055,10 @@ function yi(s, e) {
|
|
|
3059
3055
|
}
|
|
3060
3056
|
return t;
|
|
3061
3057
|
}
|
|
3062
|
-
function
|
|
3058
|
+
function tt(s, e, t, i, n, r, o) {
|
|
3063
3059
|
const a = [];
|
|
3064
3060
|
if (e.length === 0) {
|
|
3065
|
-
const h =
|
|
3061
|
+
const h = Oe(s, t, i, n), g = Ge(h);
|
|
3066
3062
|
return a.push({
|
|
3067
3063
|
rowKey: o || "all",
|
|
3068
3064
|
rowLabel: o || "All",
|
|
@@ -3073,11 +3069,11 @@ function it(s, e, t, i, n, r, o) {
|
|
|
3073
3069
|
rowCount: s.length
|
|
3074
3070
|
}), a;
|
|
3075
3071
|
}
|
|
3076
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3072
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = vi(s, l);
|
|
3077
3073
|
for (const [h, g] of u) {
|
|
3078
|
-
const f = o ? `${o}|${h}` : h, p =
|
|
3079
|
-
let
|
|
3080
|
-
c && (
|
|
3074
|
+
const f = o ? `${o}|${h}` : h, p = Oe(g, t, i, n), w = Ge(p);
|
|
3075
|
+
let b;
|
|
3076
|
+
c && (b = tt(
|
|
3081
3077
|
g,
|
|
3082
3078
|
d,
|
|
3083
3079
|
t,
|
|
@@ -3092,42 +3088,42 @@ function it(s, e, t, i, n, r, o) {
|
|
|
3092
3088
|
values: p,
|
|
3093
3089
|
total: w,
|
|
3094
3090
|
isGroup: c,
|
|
3095
|
-
children:
|
|
3091
|
+
children: b,
|
|
3096
3092
|
rowCount: g.length
|
|
3097
3093
|
});
|
|
3098
3094
|
}
|
|
3099
3095
|
return a;
|
|
3100
3096
|
}
|
|
3101
|
-
function
|
|
3097
|
+
function Oe(s, e, t, i) {
|
|
3102
3098
|
const n = {};
|
|
3103
3099
|
for (const r of t)
|
|
3104
3100
|
for (const o of i) {
|
|
3105
|
-
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 =
|
|
3101
|
+
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 = we([r], o.field);
|
|
3106
3102
|
n[u] = c;
|
|
3107
3103
|
}
|
|
3108
3104
|
return n;
|
|
3109
3105
|
}
|
|
3110
|
-
function
|
|
3106
|
+
function Ge(s) {
|
|
3111
3107
|
let e = 0;
|
|
3112
3108
|
for (const t of Object.values(s))
|
|
3113
3109
|
e += t ?? 0;
|
|
3114
3110
|
return e;
|
|
3115
3111
|
}
|
|
3116
|
-
function
|
|
3112
|
+
function yi(s, e, t) {
|
|
3117
3113
|
const i = {};
|
|
3118
3114
|
function n(r) {
|
|
3119
3115
|
for (const o of r)
|
|
3120
3116
|
if (!o.isGroup || !o.children?.length)
|
|
3121
3117
|
for (const a of e)
|
|
3122
3118
|
for (const l of t) {
|
|
3123
|
-
const d =
|
|
3119
|
+
const d = we([a], l.field);
|
|
3124
3120
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
3125
3121
|
}
|
|
3126
3122
|
else o.children && n(o.children);
|
|
3127
3123
|
}
|
|
3128
3124
|
return n(s), i;
|
|
3129
3125
|
}
|
|
3130
|
-
function
|
|
3126
|
+
function xi(s, e, t = !0) {
|
|
3131
3127
|
const i = [];
|
|
3132
3128
|
function n(r) {
|
|
3133
3129
|
i.push(r);
|
|
@@ -3140,7 +3136,7 @@ function Ci(s, e, t = !0) {
|
|
|
3140
3136
|
n(r);
|
|
3141
3137
|
return i;
|
|
3142
3138
|
}
|
|
3143
|
-
function
|
|
3139
|
+
function Ci(s) {
|
|
3144
3140
|
const e = [];
|
|
3145
3141
|
function t(i) {
|
|
3146
3142
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -3151,10 +3147,10 @@ function Ei(s) {
|
|
|
3151
3147
|
t(i);
|
|
3152
3148
|
return e;
|
|
3153
3149
|
}
|
|
3154
|
-
const
|
|
3155
|
-
function
|
|
3150
|
+
const Ei = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3151
|
+
function Ri(s, e, t, i) {
|
|
3156
3152
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3157
|
-
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () =>
|
|
3153
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Ti(t, r))), o.appendChild(j("Row Groups", () => Be("rowGroups", r))), o.appendChild(j("Column Groups", () => Be("columnGroups", r))), o.appendChild(j("Values", () => ki(r))), o.appendChild(j("Available Fields", () => _i(r))), s.appendChild(o), () => {
|
|
3158
3154
|
n.abort(), o.remove();
|
|
3159
3155
|
};
|
|
3160
3156
|
}
|
|
@@ -3166,7 +3162,7 @@ function j(s, e) {
|
|
|
3166
3162
|
const n = document.createElement("div");
|
|
3167
3163
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3168
3164
|
}
|
|
3169
|
-
function
|
|
3165
|
+
function Be(s, e) {
|
|
3170
3166
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3171
3167
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
3172
3168
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -3175,7 +3171,7 @@ function Ve(s, e) {
|
|
|
3175
3171
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
3176
3172
|
} else
|
|
3177
3173
|
for (const a of o)
|
|
3178
|
-
r.appendChild(
|
|
3174
|
+
r.appendChild(Si(a, s, e));
|
|
3179
3175
|
return r.addEventListener(
|
|
3180
3176
|
"dragover",
|
|
3181
3177
|
(a) => {
|
|
@@ -3198,7 +3194,7 @@ function Ve(s, e) {
|
|
|
3198
3194
|
{ signal: n }
|
|
3199
3195
|
), r;
|
|
3200
3196
|
}
|
|
3201
|
-
function
|
|
3197
|
+
function Si(s, e, t) {
|
|
3202
3198
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3203
3199
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3204
3200
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -3224,7 +3220,7 @@ function ki(s, e, t) {
|
|
|
3224
3220
|
{ signal: n }
|
|
3225
3221
|
), r;
|
|
3226
3222
|
}
|
|
3227
|
-
function
|
|
3223
|
+
function ki(s) {
|
|
3228
3224
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3229
3225
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3230
3226
|
const r = e.valueFields ?? [];
|
|
@@ -3233,7 +3229,7 @@ function Ai(s) {
|
|
|
3233
3229
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3234
3230
|
} else
|
|
3235
3231
|
for (const o of r)
|
|
3236
|
-
n.appendChild(
|
|
3232
|
+
n.appendChild(Ai(o, s));
|
|
3237
3233
|
return n.addEventListener(
|
|
3238
3234
|
"dragover",
|
|
3239
3235
|
(o) => {
|
|
@@ -3256,7 +3252,7 @@ function Ai(s) {
|
|
|
3256
3252
|
{ signal: i }
|
|
3257
3253
|
), n;
|
|
3258
3254
|
}
|
|
3259
|
-
function
|
|
3255
|
+
function Ai(s, e) {
|
|
3260
3256
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3261
3257
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3262
3258
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3265,7 +3261,7 @@ function _i(s, e) {
|
|
|
3265
3261
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3266
3262
|
const l = document.createElement("select");
|
|
3267
3263
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3268
|
-
for (const c of
|
|
3264
|
+
for (const c of Ei) {
|
|
3269
3265
|
const u = document.createElement("option");
|
|
3270
3266
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3271
3267
|
}
|
|
@@ -3285,7 +3281,7 @@ function _i(s, e) {
|
|
|
3285
3281
|
{ signal: i }
|
|
3286
3282
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3287
3283
|
}
|
|
3288
|
-
function
|
|
3284
|
+
function _i(s) {
|
|
3289
3285
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3290
3286
|
n.className = "tbw-pivot-available-fields";
|
|
3291
3287
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3315,10 +3311,10 @@ function Ti(s) {
|
|
|
3315
3311
|
}
|
|
3316
3312
|
return n;
|
|
3317
3313
|
}
|
|
3318
|
-
function
|
|
3314
|
+
function Ti(s, e) {
|
|
3319
3315
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3320
3316
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3321
|
-
|
|
3317
|
+
le(
|
|
3322
3318
|
"Enable Pivot View",
|
|
3323
3319
|
s,
|
|
3324
3320
|
(o) => {
|
|
@@ -3327,7 +3323,7 @@ function Li(s, e) {
|
|
|
3327
3323
|
n
|
|
3328
3324
|
)
|
|
3329
3325
|
), r.appendChild(
|
|
3330
|
-
|
|
3326
|
+
le(
|
|
3331
3327
|
"Show Row Totals",
|
|
3332
3328
|
t.showTotals ?? !0,
|
|
3333
3329
|
(o) => {
|
|
@@ -3336,7 +3332,7 @@ function Li(s, e) {
|
|
|
3336
3332
|
n
|
|
3337
3333
|
)
|
|
3338
3334
|
), r.appendChild(
|
|
3339
|
-
|
|
3335
|
+
le(
|
|
3340
3336
|
"Show Grand Total",
|
|
3341
3337
|
t.showGrandTotal ?? !0,
|
|
3342
3338
|
(o) => {
|
|
@@ -3346,7 +3342,7 @@ function Li(s, e) {
|
|
|
3346
3342
|
)
|
|
3347
3343
|
), r;
|
|
3348
3344
|
}
|
|
3349
|
-
function
|
|
3345
|
+
function le(s, e, t, i) {
|
|
3350
3346
|
const n = document.createElement("label");
|
|
3351
3347
|
n.className = "tbw-pivot-checkbox";
|
|
3352
3348
|
const r = document.createElement("input");
|
|
@@ -3354,7 +3350,7 @@ function de(s, e, t, i) {
|
|
|
3354
3350
|
const o = document.createElement("span");
|
|
3355
3351
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3356
3352
|
}
|
|
3357
|
-
function
|
|
3353
|
+
function Li(s, e, t) {
|
|
3358
3354
|
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) => {
|
|
3359
3355
|
const r = document.createElement("div");
|
|
3360
3356
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3375,7 +3371,7 @@ function Fi(s, e, t) {
|
|
|
3375
3371
|
e.appendChild(r);
|
|
3376
3372
|
}), !0;
|
|
3377
3373
|
}
|
|
3378
|
-
function
|
|
3374
|
+
function Fi(s, e, t, i) {
|
|
3379
3375
|
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) => {
|
|
3380
3376
|
const o = document.createElement("div");
|
|
3381
3377
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3390,7 +3386,7 @@ function Ii(s, e, t, i) {
|
|
|
3390
3386
|
e.appendChild(o);
|
|
3391
3387
|
}), !0;
|
|
3392
3388
|
}
|
|
3393
|
-
function
|
|
3389
|
+
function Ii(s, e, t) {
|
|
3394
3390
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3395
3391
|
const r = document.createElement("div");
|
|
3396
3392
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3403,10 +3399,10 @@ function Pi(s, e, t) {
|
|
|
3403
3399
|
e.appendChild(r);
|
|
3404
3400
|
}), !0;
|
|
3405
3401
|
}
|
|
3406
|
-
const
|
|
3407
|
-
class G extends
|
|
3402
|
+
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:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
3403
|
+
class G extends A {
|
|
3408
3404
|
name = "pivot";
|
|
3409
|
-
styles =
|
|
3405
|
+
styles = Pi;
|
|
3410
3406
|
static PANEL_ID = "pivot";
|
|
3411
3407
|
get defaultConfig() {
|
|
3412
3408
|
return {
|
|
@@ -3452,11 +3448,11 @@ class G extends _ {
|
|
|
3452
3448
|
processRows(e) {
|
|
3453
3449
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3454
3450
|
return [...e];
|
|
3455
|
-
const t =
|
|
3451
|
+
const t = mi(this.config);
|
|
3456
3452
|
if (t.length > 0)
|
|
3457
3453
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3458
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult =
|
|
3459
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3454
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = wi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
3455
|
+
const i = this.config.indentWidth ?? 20, n = xi(
|
|
3460
3456
|
this.pivotResult.rows,
|
|
3461
3457
|
this.expandedKeys,
|
|
3462
3458
|
this.defaultExpanded
|
|
@@ -3491,7 +3487,7 @@ class G extends _ {
|
|
|
3491
3487
|
});
|
|
3492
3488
|
for (const n of this.pivotResult.columnKeys)
|
|
3493
3489
|
for (const r of this.config.valueFields ?? []) {
|
|
3494
|
-
const o =
|
|
3490
|
+
const o = we([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3495
3491
|
t.push({
|
|
3496
3492
|
field: o,
|
|
3497
3493
|
header: `${n} - ${a} (${r.aggFunc})`,
|
|
@@ -3508,13 +3504,13 @@ class G extends _ {
|
|
|
3508
3504
|
}
|
|
3509
3505
|
renderRow(e, t, i) {
|
|
3510
3506
|
const n = e;
|
|
3511
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3507
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Li(n, t, {
|
|
3512
3508
|
columns: this.gridColumns,
|
|
3513
3509
|
rowIndex: i,
|
|
3514
3510
|
onToggle: (r) => this.toggle(r),
|
|
3515
3511
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3516
3512
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3517
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3513
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Fi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3518
3514
|
}
|
|
3519
3515
|
cleanupPivotStyling(e) {
|
|
3520
3516
|
(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 = "");
|
|
@@ -3552,7 +3548,7 @@ class G extends _ {
|
|
|
3552
3548
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3553
3549
|
...this.pivotResult.totals
|
|
3554
3550
|
};
|
|
3555
|
-
|
|
3551
|
+
Ii(i, this.grandTotalFooter, this.gridColumns);
|
|
3556
3552
|
}
|
|
3557
3553
|
cleanupGrandTotalFooter() {
|
|
3558
3554
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3574,7 +3570,7 @@ class G extends _ {
|
|
|
3574
3570
|
}
|
|
3575
3571
|
expandAllKeys() {
|
|
3576
3572
|
if (!this.pivotResult) return;
|
|
3577
|
-
const e =
|
|
3573
|
+
const e = Ci(this.pivotResult.rows);
|
|
3578
3574
|
for (const t of e)
|
|
3579
3575
|
this.expandedKeys.add(t);
|
|
3580
3576
|
}
|
|
@@ -3659,7 +3655,7 @@ class G extends _ {
|
|
|
3659
3655
|
},
|
|
3660
3656
|
getAvailableFields: () => this.getAvailableFields()
|
|
3661
3657
|
};
|
|
3662
|
-
return
|
|
3658
|
+
return Ri(e, this.config, this.isActive, t);
|
|
3663
3659
|
}
|
|
3664
3660
|
refreshPanel() {
|
|
3665
3661
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3692,10 +3688,10 @@ class G extends _ {
|
|
|
3692
3688
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3693
3689
|
}
|
|
3694
3690
|
}
|
|
3695
|
-
const
|
|
3696
|
-
function
|
|
3691
|
+
const J = "tbw-print-isolation-style";
|
|
3692
|
+
function Di(s, e) {
|
|
3697
3693
|
const t = document.createElement("style");
|
|
3698
|
-
return t.id =
|
|
3694
|
+
return t.id = J, t.textContent = `
|
|
3699
3695
|
/* Print isolation: hide everything except the target grid */
|
|
3700
3696
|
@media print {
|
|
3701
3697
|
/* Hide all body children by default */
|
|
@@ -3767,22 +3763,22 @@ function Mi(s, e) {
|
|
|
3767
3763
|
}
|
|
3768
3764
|
`, t;
|
|
3769
3765
|
}
|
|
3770
|
-
async function
|
|
3766
|
+
async function Mi(s, e = {}) {
|
|
3771
3767
|
const { orientation: t = "landscape" } = e, i = s.id;
|
|
3772
3768
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3773
3769
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3774
|
-
), document.getElementById(
|
|
3775
|
-
const r =
|
|
3770
|
+
), document.getElementById(J)?.remove();
|
|
3771
|
+
const r = Di(i, t);
|
|
3776
3772
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3777
3773
|
const a = () => {
|
|
3778
|
-
window.removeEventListener("afterprint", a), document.getElementById(
|
|
3774
|
+
window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
|
|
3779
3775
|
};
|
|
3780
3776
|
window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
|
|
3781
|
-
window.removeEventListener("afterprint", a), document.getElementById(
|
|
3777
|
+
window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
|
|
3782
3778
|
}, 5e3);
|
|
3783
3779
|
});
|
|
3784
3780
|
}
|
|
3785
|
-
const
|
|
3781
|
+
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:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-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 = {
|
|
3786
3782
|
button: !1,
|
|
3787
3783
|
orientation: "landscape",
|
|
3788
3784
|
warnThreshold: 500,
|
|
@@ -3792,10 +3788,10 @@ const qi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3792
3788
|
title: "",
|
|
3793
3789
|
isolate: !1
|
|
3794
3790
|
};
|
|
3795
|
-
class
|
|
3791
|
+
class yn extends A {
|
|
3796
3792
|
name = "print";
|
|
3797
3793
|
version = "1.0.0";
|
|
3798
|
-
styles =
|
|
3794
|
+
styles = Ni;
|
|
3799
3795
|
#e = !1;
|
|
3800
3796
|
#t = null;
|
|
3801
3797
|
#o = null;
|
|
@@ -3819,7 +3815,7 @@ class xn extends _ {
|
|
|
3819
3815
|
console.warn("[PrintPlugin] Grid not available");
|
|
3820
3816
|
return;
|
|
3821
3817
|
}
|
|
3822
|
-
const i = { ...
|
|
3818
|
+
const i = { ...qi, ...this.config, ...e }, r = this.rows.length;
|
|
3823
3819
|
let o = r, a = !1;
|
|
3824
3820
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3825
3821
|
const d = i.maxRows > 0 ? `
|
|
@@ -3890,7 +3886,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3890
3886
|
}
|
|
3891
3887
|
async #p(e) {
|
|
3892
3888
|
const t = this.gridElement;
|
|
3893
|
-
t && await
|
|
3889
|
+
t && await Mi(t, {
|
|
3894
3890
|
orientation: e.orientation
|
|
3895
3891
|
});
|
|
3896
3892
|
}
|
|
@@ -3939,19 +3935,19 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3939
3935
|
});
|
|
3940
3936
|
}
|
|
3941
3937
|
}
|
|
3942
|
-
function
|
|
3938
|
+
function Hi(s) {
|
|
3943
3939
|
const e = s.meta ?? {};
|
|
3944
3940
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3945
3941
|
}
|
|
3946
|
-
function
|
|
3942
|
+
function Ve(s, e, t) {
|
|
3947
3943
|
if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
|
|
3948
3944
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3949
3945
|
return i.splice(t, 0, n), i;
|
|
3950
3946
|
}
|
|
3951
|
-
const
|
|
3952
|
-
class
|
|
3947
|
+
const zi = '@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}}';
|
|
3948
|
+
class xn extends A {
|
|
3953
3949
|
name = "reorder";
|
|
3954
|
-
styles =
|
|
3950
|
+
styles = zi;
|
|
3955
3951
|
get defaultConfig() {
|
|
3956
3952
|
return {
|
|
3957
3953
|
animation: "flip"
|
|
@@ -3968,8 +3964,8 @@ class Cn extends _ {
|
|
|
3968
3964
|
draggedIndex = null;
|
|
3969
3965
|
dropIndex = null;
|
|
3970
3966
|
canMoveColumnWithPlugins(e) {
|
|
3971
|
-
return !e || !
|
|
3972
|
-
type:
|
|
3967
|
+
return !e || !Hi(e) ? !1 : !this.grid.queryPlugins({
|
|
3968
|
+
type: Ze.CAN_MOVE_COLUMN,
|
|
3973
3969
|
context: e
|
|
3974
3970
|
}).includes(!1);
|
|
3975
3971
|
}
|
|
@@ -4018,7 +4014,7 @@ class Cn extends _ {
|
|
|
4018
4014
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4019
4015
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4020
4016
|
return;
|
|
4021
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g =
|
|
4017
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = Ve(h, d, u), f = {
|
|
4022
4018
|
field: l,
|
|
4023
4019
|
fromIndex: d,
|
|
4024
4020
|
toIndex: u,
|
|
@@ -4049,7 +4045,7 @@ class Cn extends _ {
|
|
|
4049
4045
|
moveColumn(e, t) {
|
|
4050
4046
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
4051
4047
|
if (n === -1) return;
|
|
4052
|
-
const r =
|
|
4048
|
+
const r = Ve(i, n, t);
|
|
4053
4049
|
this.emitCancelable("column-move", {
|
|
4054
4050
|
field: e,
|
|
4055
4051
|
fromIndex: n,
|
|
@@ -4144,11 +4140,11 @@ class Cn extends _ {
|
|
|
4144
4140
|
this.grid.requestStateChange?.();
|
|
4145
4141
|
}
|
|
4146
4142
|
}
|
|
4147
|
-
const
|
|
4148
|
-
class
|
|
4143
|
+
const Ki = '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}}';
|
|
4144
|
+
class Cn extends A {
|
|
4149
4145
|
name = "responsive";
|
|
4150
4146
|
version = "1.0.0";
|
|
4151
|
-
styles =
|
|
4147
|
+
styles = Ki;
|
|
4152
4148
|
static manifest = {
|
|
4153
4149
|
incompatibleWith: [
|
|
4154
4150
|
{
|
|
@@ -4369,10 +4365,10 @@ class En extends _ {
|
|
|
4369
4365
|
}));
|
|
4370
4366
|
}
|
|
4371
4367
|
}
|
|
4372
|
-
const
|
|
4373
|
-
class
|
|
4368
|
+
const Oi = '@layer tbw-plugins{.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', Gi = "__tbw_row_drag";
|
|
4369
|
+
class En extends A {
|
|
4374
4370
|
name = "rowReorder";
|
|
4375
|
-
styles =
|
|
4371
|
+
styles = Oi;
|
|
4376
4372
|
get defaultConfig() {
|
|
4377
4373
|
return {
|
|
4378
4374
|
enableKeyboard: !0,
|
|
@@ -4399,7 +4395,7 @@ class Rn extends _ {
|
|
|
4399
4395
|
if (!this.config.showDragHandle)
|
|
4400
4396
|
return [...e];
|
|
4401
4397
|
const t = {
|
|
4402
|
-
field:
|
|
4398
|
+
field: Gi,
|
|
4403
4399
|
header: "",
|
|
4404
4400
|
width: this.config.dragHandleWidth ?? 40,
|
|
4405
4401
|
resizable: !1,
|
|
@@ -4590,38 +4586,38 @@ function V(s) {
|
|
|
4590
4586
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4591
4587
|
};
|
|
4592
4588
|
}
|
|
4593
|
-
function
|
|
4589
|
+
function Bi(s) {
|
|
4594
4590
|
const e = V(s);
|
|
4595
4591
|
return {
|
|
4596
4592
|
from: { row: e.startRow, col: e.startCol },
|
|
4597
4593
|
to: { row: e.endRow, col: e.endCol }
|
|
4598
4594
|
};
|
|
4599
4595
|
}
|
|
4600
|
-
function
|
|
4601
|
-
return s.map(
|
|
4596
|
+
function it(s) {
|
|
4597
|
+
return s.map(Bi);
|
|
4602
4598
|
}
|
|
4603
|
-
function
|
|
4599
|
+
function Vi(s, e, t) {
|
|
4604
4600
|
const i = V(t);
|
|
4605
4601
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4606
4602
|
}
|
|
4607
|
-
function
|
|
4608
|
-
return t.some((i) =>
|
|
4603
|
+
function We(s, e, t) {
|
|
4604
|
+
return t.some((i) => Vi(s, e, i));
|
|
4609
4605
|
}
|
|
4610
|
-
function
|
|
4606
|
+
function Wi(s) {
|
|
4611
4607
|
const e = [], t = V(s);
|
|
4612
4608
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4613
4609
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4614
4610
|
e.push({ row: i, col: n });
|
|
4615
4611
|
return e;
|
|
4616
4612
|
}
|
|
4617
|
-
function
|
|
4613
|
+
function $i(s) {
|
|
4618
4614
|
const e = /* @__PURE__ */ new Map();
|
|
4619
4615
|
for (const t of s)
|
|
4620
|
-
for (const i of
|
|
4616
|
+
for (const i of Wi(t))
|
|
4621
4617
|
e.set(`${i.row},${i.col}`, i);
|
|
4622
4618
|
return [...e.values()];
|
|
4623
4619
|
}
|
|
4624
|
-
function
|
|
4620
|
+
function de(s, e) {
|
|
4625
4621
|
return {
|
|
4626
4622
|
startRow: s.row,
|
|
4627
4623
|
startCol: s.col,
|
|
@@ -4629,12 +4625,12 @@ function ce(s, e) {
|
|
|
4629
4625
|
endCol: e.col
|
|
4630
4626
|
};
|
|
4631
4627
|
}
|
|
4632
|
-
function
|
|
4628
|
+
function Z(s, e) {
|
|
4633
4629
|
const t = V(s), i = V(e);
|
|
4634
4630
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4635
4631
|
}
|
|
4636
|
-
const
|
|
4637
|
-
function
|
|
4632
|
+
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-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4633
|
+
function Ui(s, e, t) {
|
|
4638
4634
|
if (s === "cell" && e.selectedCell)
|
|
4639
4635
|
return {
|
|
4640
4636
|
mode: s,
|
|
@@ -4652,9 +4648,9 @@ function Yi(s, e, t) {
|
|
|
4652
4648
|
}));
|
|
4653
4649
|
return { mode: s, ranges: i };
|
|
4654
4650
|
}
|
|
4655
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4651
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: it(e.ranges) } : { mode: s, ranges: [] };
|
|
4656
4652
|
}
|
|
4657
|
-
class
|
|
4653
|
+
class Rn extends A {
|
|
4658
4654
|
static manifest = {
|
|
4659
4655
|
configRules: [
|
|
4660
4656
|
{
|
|
@@ -4668,7 +4664,7 @@ class Sn extends _ {
|
|
|
4668
4664
|
]
|
|
4669
4665
|
};
|
|
4670
4666
|
name = "selection";
|
|
4671
|
-
styles =
|
|
4667
|
+
styles = ji;
|
|
4672
4668
|
get defaultConfig() {
|
|
4673
4669
|
return {
|
|
4674
4670
|
mode: "cell",
|
|
@@ -4710,7 +4706,7 @@ class Sn extends _ {
|
|
|
4710
4706
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4711
4707
|
if (n.type !== o)
|
|
4712
4708
|
return !1;
|
|
4713
|
-
const a = this.columns[i], l = a &&
|
|
4709
|
+
const a = this.columns[i], l = a && q(a);
|
|
4714
4710
|
if (r === "cell") {
|
|
4715
4711
|
if (l || !this.isCellSelectable(t, i))
|
|
4716
4712
|
return !1;
|
|
@@ -4724,8 +4720,8 @@ class Sn extends _ {
|
|
|
4724
4720
|
return !1;
|
|
4725
4721
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4726
4722
|
if (d && this.cellAnchor) {
|
|
4727
|
-
const u =
|
|
4728
|
-
if (h &&
|
|
4723
|
+
const u = de(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4724
|
+
if (h && Z(h, u))
|
|
4729
4725
|
return !1;
|
|
4730
4726
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
4731
4727
|
} else if (c) {
|
|
@@ -4743,7 +4739,7 @@ class Sn extends _ {
|
|
|
4743
4739
|
endRow: t,
|
|
4744
4740
|
endCol: i
|
|
4745
4741
|
};
|
|
4746
|
-
if (this.ranges.length === 1 &&
|
|
4742
|
+
if (this.ranges.length === 1 && Z(this.ranges[0], u))
|
|
4747
4743
|
return !1;
|
|
4748
4744
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
4749
4745
|
}
|
|
@@ -4788,7 +4784,7 @@ class Sn extends _ {
|
|
|
4788
4784
|
onCellMouseDown(e) {
|
|
4789
4785
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4790
4786
|
const t = this.columns[e.colIndex];
|
|
4791
|
-
if (t &&
|
|
4787
|
+
if (t && q(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4792
4788
|
return;
|
|
4793
4789
|
this.isDragging = !0;
|
|
4794
4790
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -4797,18 +4793,18 @@ class Sn extends _ {
|
|
|
4797
4793
|
endRow: i,
|
|
4798
4794
|
endCol: n
|
|
4799
4795
|
};
|
|
4800
|
-
return !r && this.ranges.length === 1 &&
|
|
4796
|
+
return !r && this.ranges.length === 1 && Z(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);
|
|
4801
4797
|
}
|
|
4802
4798
|
onCellMouseMove(e) {
|
|
4803
4799
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4804
4800
|
let t = e.colIndex;
|
|
4805
4801
|
const i = this.columns[t];
|
|
4806
|
-
if (i &&
|
|
4807
|
-
const o = this.columns.findIndex((a) => !
|
|
4802
|
+
if (i && q(i)) {
|
|
4803
|
+
const o = this.columns.findIndex((a) => !q(a));
|
|
4808
4804
|
o >= 0 && (t = o);
|
|
4809
4805
|
}
|
|
4810
|
-
const n =
|
|
4811
|
-
return r &&
|
|
4806
|
+
const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4807
|
+
return r && Z(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;
|
|
4812
4808
|
}
|
|
4813
4809
|
onCellMouseUp(e) {
|
|
4814
4810
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
@@ -4824,22 +4820,22 @@ class Sn extends _ {
|
|
|
4824
4820
|
const r = e.querySelectorAll(".data-grid-row");
|
|
4825
4821
|
if (r.forEach((o) => {
|
|
4826
4822
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4827
|
-
}), t === "row" && (
|
|
4828
|
-
const a = o.querySelector(".cell[data-row]"), l =
|
|
4823
|
+
}), t === "row" && (ye(e), r.forEach((o) => {
|
|
4824
|
+
const a = o.querySelector(".cell[data-row]"), l = ut(a);
|
|
4829
4825
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4830
4826
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4831
4827
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4832
4828
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4833
4829
|
}), t === "range" && this.ranges.length > 0) {
|
|
4834
|
-
|
|
4835
|
-
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !
|
|
4830
|
+
ye(e);
|
|
4831
|
+
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !q(d));
|
|
4836
4832
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4837
4833
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4838
4834
|
if (c >= 0 && u >= 0) {
|
|
4839
4835
|
const h = this.columns[u];
|
|
4840
|
-
if (h &&
|
|
4836
|
+
if (h && q(h))
|
|
4841
4837
|
return;
|
|
4842
|
-
if (
|
|
4838
|
+
if (We(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4843
4839
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4844
4840
|
const f = Math.max(o.startCol, a);
|
|
4845
4841
|
u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
@@ -4858,7 +4854,7 @@ class Sn extends _ {
|
|
|
4858
4854
|
this.pendingKeyboardUpdate = null;
|
|
4859
4855
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4860
4856
|
if (n && this.cellAnchor) {
|
|
4861
|
-
const a =
|
|
4857
|
+
const a = de(this.cellAnchor, { row: r, col: o });
|
|
4862
4858
|
this.ranges = [a], this.activeRange = a;
|
|
4863
4859
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
4864
4860
|
this.emit("selection-change", this.#t());
|
|
@@ -4876,10 +4872,10 @@ class Sn extends _ {
|
|
|
4876
4872
|
};
|
|
4877
4873
|
}
|
|
4878
4874
|
getSelectedCells() {
|
|
4879
|
-
return
|
|
4875
|
+
return $i(this.ranges);
|
|
4880
4876
|
}
|
|
4881
4877
|
isCellSelected(e, t) {
|
|
4882
|
-
return
|
|
4878
|
+
return We(e, t, this.ranges);
|
|
4883
4879
|
}
|
|
4884
4880
|
clearSelection() {
|
|
4885
4881
|
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();
|
|
@@ -4892,11 +4888,11 @@ class Sn extends _ {
|
|
|
4892
4888
|
endCol: t.to.col
|
|
4893
4889
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4894
4890
|
mode: this.config.mode,
|
|
4895
|
-
ranges:
|
|
4891
|
+
ranges: it(this.ranges)
|
|
4896
4892
|
}), this.requestAfterRender();
|
|
4897
4893
|
}
|
|
4898
4894
|
#t() {
|
|
4899
|
-
return
|
|
4895
|
+
return Ui(
|
|
4900
4896
|
this.config.mode,
|
|
4901
4897
|
{
|
|
4902
4898
|
selectedCell: this.selectedCell,
|
|
@@ -4907,23 +4903,23 @@ class Sn extends _ {
|
|
|
4907
4903
|
);
|
|
4908
4904
|
}
|
|
4909
4905
|
}
|
|
4910
|
-
function
|
|
4906
|
+
function Q(s, e) {
|
|
4911
4907
|
return Math.floor(s / e);
|
|
4912
4908
|
}
|
|
4913
|
-
function
|
|
4909
|
+
function Yi(s, e) {
|
|
4914
4910
|
return {
|
|
4915
4911
|
start: s * e,
|
|
4916
4912
|
end: (s + 1) * e
|
|
4917
4913
|
};
|
|
4918
4914
|
}
|
|
4919
|
-
function
|
|
4920
|
-
const i =
|
|
4915
|
+
function Xi(s, e, t) {
|
|
4916
|
+
const i = Q(s, t), n = Q(e - 1, t), r = [];
|
|
4921
4917
|
for (let o = i; o <= n; o++)
|
|
4922
4918
|
r.push(o);
|
|
4923
4919
|
return r;
|
|
4924
4920
|
}
|
|
4925
|
-
async function
|
|
4926
|
-
const n =
|
|
4921
|
+
async function $e(s, e, t, i) {
|
|
4922
|
+
const n = Yi(e, t);
|
|
4927
4923
|
return s.getRows({
|
|
4928
4924
|
startRow: n.start,
|
|
4929
4925
|
endRow: n.end,
|
|
@@ -4931,14 +4927,14 @@ async function je(s, e, t, i) {
|
|
|
4931
4927
|
filterModel: i.filterModel
|
|
4932
4928
|
});
|
|
4933
4929
|
}
|
|
4934
|
-
function
|
|
4935
|
-
const i =
|
|
4930
|
+
function Zi(s, e, t) {
|
|
4931
|
+
const i = Q(s, e), n = t.get(i);
|
|
4936
4932
|
if (!n) return;
|
|
4937
4933
|
const r = s % e;
|
|
4938
4934
|
return n[r];
|
|
4939
4935
|
}
|
|
4940
|
-
const
|
|
4941
|
-
class
|
|
4936
|
+
const Ji = 100;
|
|
4937
|
+
class Sn extends A {
|
|
4942
4938
|
name = "serverSide";
|
|
4943
4939
|
get defaultConfig() {
|
|
4944
4940
|
return {
|
|
@@ -4958,12 +4954,12 @@ class kn extends _ {
|
|
|
4958
4954
|
}
|
|
4959
4955
|
loadRequiredBlocks() {
|
|
4960
4956
|
if (!this.dataSource) return;
|
|
4961
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4957
|
+
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);
|
|
4962
4958
|
for (const r of n)
|
|
4963
4959
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4964
4960
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
4965
4961
|
break;
|
|
4966
|
-
this.loadingBlocks.add(r),
|
|
4962
|
+
this.loadingBlocks.add(r), $e(this.dataSource, r, t, {}).then((o) => {
|
|
4967
4963
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
4968
4964
|
}).catch(() => {
|
|
4969
4965
|
this.loadingBlocks.delete(r);
|
|
@@ -4974,7 +4970,7 @@ class kn extends _ {
|
|
|
4974
4970
|
if (!this.dataSource) return [...e];
|
|
4975
4971
|
const t = [];
|
|
4976
4972
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
4977
|
-
const n =
|
|
4973
|
+
const n = Zi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
4978
4974
|
t.push(n ?? { __loading: !0, __index: i });
|
|
4979
4975
|
}
|
|
4980
4976
|
return t;
|
|
@@ -4982,12 +4978,12 @@ class kn extends _ {
|
|
|
4982
4978
|
onScroll(e) {
|
|
4983
4979
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4984
4980
|
this.loadRequiredBlocks();
|
|
4985
|
-
},
|
|
4981
|
+
}, Ji));
|
|
4986
4982
|
}
|
|
4987
4983
|
setDataSource(e) {
|
|
4988
4984
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
4989
4985
|
const t = this.config.cacheBlockSize ?? 100;
|
|
4990
|
-
|
|
4986
|
+
$e(e, 0, t, {}).then((i) => {
|
|
4991
4987
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
4992
4988
|
});
|
|
4993
4989
|
}
|
|
@@ -5001,59 +4997,59 @@ class kn extends _ {
|
|
|
5001
4997
|
return this.totalRowCount;
|
|
5002
4998
|
}
|
|
5003
4999
|
isRowLoaded(e) {
|
|
5004
|
-
const t = this.config.cacheBlockSize ?? 100, i =
|
|
5000
|
+
const t = this.config.cacheBlockSize ?? 100, i = Q(e, t);
|
|
5005
5001
|
return this.loadedBlocks.has(i);
|
|
5006
5002
|
}
|
|
5007
5003
|
getLoadedBlockCount() {
|
|
5008
5004
|
return this.loadedBlocks.size;
|
|
5009
5005
|
}
|
|
5010
5006
|
}
|
|
5011
|
-
function
|
|
5007
|
+
function nt(s, e, t) {
|
|
5012
5008
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
5013
5009
|
}
|
|
5014
|
-
function
|
|
5010
|
+
function ce(s, e) {
|
|
5015
5011
|
const t = new Set(s);
|
|
5016
5012
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5017
5013
|
}
|
|
5018
|
-
function
|
|
5014
|
+
function ge(s, e, t = null, i = 0) {
|
|
5019
5015
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5020
5016
|
for (let o = 0; o < s.length; o++) {
|
|
5021
|
-
const a = s[o], l =
|
|
5017
|
+
const a = s[o], l = nt(a, o, t), d = a[n];
|
|
5022
5018
|
if (Array.isArray(d) && d.length > 0) {
|
|
5023
5019
|
r.add(l);
|
|
5024
|
-
const c =
|
|
5020
|
+
const c = ge(d, e, l, i + 1);
|
|
5025
5021
|
for (const u of c) r.add(u);
|
|
5026
5022
|
}
|
|
5027
5023
|
}
|
|
5028
5024
|
return r;
|
|
5029
5025
|
}
|
|
5030
|
-
function
|
|
5026
|
+
function Qi() {
|
|
5031
5027
|
return /* @__PURE__ */ new Set();
|
|
5032
5028
|
}
|
|
5033
|
-
function
|
|
5029
|
+
function rt(s, e, t, i = null, n = 0) {
|
|
5034
5030
|
const r = t.childrenField ?? "children";
|
|
5035
5031
|
for (let o = 0; o < s.length; o++) {
|
|
5036
|
-
const a = s[o], l =
|
|
5032
|
+
const a = s[o], l = nt(a, o, i);
|
|
5037
5033
|
if (l === e)
|
|
5038
5034
|
return [l];
|
|
5039
5035
|
const d = a[r];
|
|
5040
5036
|
if (Array.isArray(d) && d.length > 0) {
|
|
5041
|
-
const c =
|
|
5037
|
+
const c = rt(d, e, t, l, n + 1);
|
|
5042
5038
|
if (c)
|
|
5043
5039
|
return [l, ...c];
|
|
5044
5040
|
}
|
|
5045
5041
|
}
|
|
5046
5042
|
return null;
|
|
5047
5043
|
}
|
|
5048
|
-
function
|
|
5049
|
-
const n =
|
|
5044
|
+
function en(s, e, t, i) {
|
|
5045
|
+
const n = rt(s, e, t);
|
|
5050
5046
|
if (!n) return i;
|
|
5051
5047
|
const r = new Set(i);
|
|
5052
5048
|
for (let o = 0; o < n.length - 1; o++)
|
|
5053
5049
|
r.add(n[o]);
|
|
5054
5050
|
return r;
|
|
5055
5051
|
}
|
|
5056
|
-
function
|
|
5052
|
+
function je(s, e = "children") {
|
|
5057
5053
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
5058
5054
|
for (const t of s) {
|
|
5059
5055
|
if (!t) continue;
|
|
@@ -5063,7 +5059,7 @@ function Ue(s, e = "children") {
|
|
|
5063
5059
|
}
|
|
5064
5060
|
return !1;
|
|
5065
5061
|
}
|
|
5066
|
-
function
|
|
5062
|
+
function tn(s) {
|
|
5067
5063
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
5068
5064
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
5069
5065
|
for (const t of s)
|
|
@@ -5075,10 +5071,10 @@ function nn(s) {
|
|
|
5075
5071
|
}
|
|
5076
5072
|
return null;
|
|
5077
5073
|
}
|
|
5078
|
-
const
|
|
5079
|
-
class
|
|
5074
|
+
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}}}";
|
|
5075
|
+
class kn extends A {
|
|
5080
5076
|
name = "tree";
|
|
5081
|
-
styles =
|
|
5077
|
+
styles = nn;
|
|
5082
5078
|
get defaultConfig() {
|
|
5083
5079
|
return {
|
|
5084
5080
|
childrenField: "children",
|
|
@@ -5104,15 +5100,15 @@ class An extends _ {
|
|
|
5104
5100
|
}
|
|
5105
5101
|
detect(e) {
|
|
5106
5102
|
if (!this.config.autoDetect) return !1;
|
|
5107
|
-
const t = e, i = this.config.childrenField ??
|
|
5108
|
-
return
|
|
5103
|
+
const t = e, i = this.config.childrenField ?? tn(t) ?? "children";
|
|
5104
|
+
return je(t, i);
|
|
5109
5105
|
}
|
|
5110
5106
|
processRows(e) {
|
|
5111
5107
|
const t = this.config.childrenField ?? "children", i = e;
|
|
5112
|
-
if (!
|
|
5108
|
+
if (!je(i, t))
|
|
5113
5109
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5114
5110
|
let n = this.withStableKeys(i);
|
|
5115
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5111
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ge(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5116
5112
|
const r = /* @__PURE__ */ new Set();
|
|
5117
5113
|
for (const o of this.flattenedRows)
|
|
5118
5114
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5168,19 +5164,19 @@ class An extends _ {
|
|
|
5168
5164
|
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, w = document.createElement("span");
|
|
5169
5165
|
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)
|
|
5170
5166
|
if (f.__treeHasChildren) {
|
|
5171
|
-
const
|
|
5172
|
-
|
|
5167
|
+
const v = document.createElement("span");
|
|
5168
|
+
v.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(v, a(f.__treeExpanded ? "collapse" : "expand")), v.setAttribute("data-tree-key", String(f.__treeKey ?? "")), w.appendChild(v);
|
|
5173
5169
|
} else {
|
|
5174
|
-
const
|
|
5175
|
-
|
|
5170
|
+
const v = document.createElement("span");
|
|
5171
|
+
v.className = "tree-spacer", w.appendChild(v);
|
|
5176
5172
|
}
|
|
5177
|
-
const
|
|
5178
|
-
if (
|
|
5179
|
-
const
|
|
5180
|
-
|
|
5173
|
+
const b = document.createElement("span");
|
|
5174
|
+
if (b.className = "tree-content", n) {
|
|
5175
|
+
const v = n(d);
|
|
5176
|
+
v instanceof Node ? b.appendChild(v) : typeof v == "string" && (b.innerHTML = v);
|
|
5181
5177
|
} else
|
|
5182
|
-
|
|
5183
|
-
return w.appendChild(
|
|
5178
|
+
b.textContent = u != null ? String(u) : "";
|
|
5179
|
+
return w.appendChild(b), w;
|
|
5184
5180
|
};
|
|
5185
5181
|
return t[0] = { ...i, viewRenderer: l }, t;
|
|
5186
5182
|
}
|
|
@@ -5190,7 +5186,7 @@ class An extends _ {
|
|
|
5190
5186
|
const i = t.getAttribute("data-tree-key");
|
|
5191
5187
|
if (!i) return !1;
|
|
5192
5188
|
const n = this.rowKeyMap.get(i);
|
|
5193
|
-
return n ? (this.expandedKeys =
|
|
5189
|
+
return n ? (this.expandedKeys = ce(this.expandedKeys, i), this.emit("tree-expand", {
|
|
5194
5190
|
key: i,
|
|
5195
5191
|
row: n.data,
|
|
5196
5192
|
expanded: this.expandedKeys.has(i),
|
|
@@ -5201,7 +5197,7 @@ class An extends _ {
|
|
|
5201
5197
|
if (e.key !== " ") return;
|
|
5202
5198
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
5203
5199
|
if (i?.hasChildren)
|
|
5204
|
-
return e.preventDefault(), this.expandedKeys =
|
|
5200
|
+
return e.preventDefault(), this.expandedKeys = ce(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
5205
5201
|
key: i.key,
|
|
5206
5202
|
row: i.data,
|
|
5207
5203
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -5234,13 +5230,13 @@ class An extends _ {
|
|
|
5234
5230
|
this.expandedKeys.delete(e), this.requestRender();
|
|
5235
5231
|
}
|
|
5236
5232
|
toggle(e) {
|
|
5237
|
-
this.expandedKeys =
|
|
5233
|
+
this.expandedKeys = ce(this.expandedKeys, e), this.requestRender();
|
|
5238
5234
|
}
|
|
5239
5235
|
expandAll() {
|
|
5240
|
-
this.expandedKeys =
|
|
5236
|
+
this.expandedKeys = ge(this.rows, this.config), this.requestRender();
|
|
5241
5237
|
}
|
|
5242
5238
|
collapseAll() {
|
|
5243
|
-
this.expandedKeys =
|
|
5239
|
+
this.expandedKeys = Qi(), this.requestRender();
|
|
5244
5240
|
}
|
|
5245
5241
|
isExpanded(e) {
|
|
5246
5242
|
return this.expandedKeys.has(e);
|
|
@@ -5255,10 +5251,10 @@ class An extends _ {
|
|
|
5255
5251
|
return this.rowKeyMap.get(e)?.data;
|
|
5256
5252
|
}
|
|
5257
5253
|
expandToKey(e) {
|
|
5258
|
-
this.expandedKeys =
|
|
5254
|
+
this.expandedKeys = en(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5259
5255
|
}
|
|
5260
5256
|
}
|
|
5261
|
-
function
|
|
5257
|
+
function rn(s, e, t) {
|
|
5262
5258
|
const i = [...s.undoStack, e];
|
|
5263
5259
|
for (; i.length > t; )
|
|
5264
5260
|
i.shift();
|
|
@@ -5267,7 +5263,7 @@ function on(s, e, t) {
|
|
|
5267
5263
|
redoStack: []
|
|
5268
5264
|
};
|
|
5269
5265
|
}
|
|
5270
|
-
function
|
|
5266
|
+
function Ue(s) {
|
|
5271
5267
|
if (s.undoStack.length === 0)
|
|
5272
5268
|
return { newState: s, action: null };
|
|
5273
5269
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -5279,7 +5275,7 @@ function Ye(s) {
|
|
|
5279
5275
|
action: t
|
|
5280
5276
|
} : { newState: s, action: null };
|
|
5281
5277
|
}
|
|
5282
|
-
function
|
|
5278
|
+
function Ye(s) {
|
|
5283
5279
|
if (s.redoStack.length === 0)
|
|
5284
5280
|
return { newState: s, action: null };
|
|
5285
5281
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -5291,16 +5287,16 @@ function Xe(s) {
|
|
|
5291
5287
|
action: t
|
|
5292
5288
|
} : { newState: s, action: null };
|
|
5293
5289
|
}
|
|
5294
|
-
function
|
|
5290
|
+
function on(s) {
|
|
5295
5291
|
return s.undoStack.length > 0;
|
|
5296
5292
|
}
|
|
5297
|
-
function
|
|
5293
|
+
function sn(s) {
|
|
5298
5294
|
return s.redoStack.length > 0;
|
|
5299
5295
|
}
|
|
5300
|
-
function
|
|
5296
|
+
function an() {
|
|
5301
5297
|
return { undoStack: [], redoStack: [] };
|
|
5302
5298
|
}
|
|
5303
|
-
function
|
|
5299
|
+
function ln(s, e, t, i) {
|
|
5304
5300
|
return {
|
|
5305
5301
|
type: "cell-edit",
|
|
5306
5302
|
rowIndex: s,
|
|
@@ -5310,7 +5306,7 @@ function dn(s, e, t, i) {
|
|
|
5310
5306
|
timestamp: Date.now()
|
|
5311
5307
|
};
|
|
5312
5308
|
}
|
|
5313
|
-
class
|
|
5309
|
+
class An extends A {
|
|
5314
5310
|
static dependencies = [
|
|
5315
5311
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5316
5312
|
];
|
|
@@ -5328,7 +5324,7 @@ class _n extends _ {
|
|
|
5328
5324
|
onKeyDown(e) {
|
|
5329
5325
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5330
5326
|
if (t) {
|
|
5331
|
-
const n =
|
|
5327
|
+
const n = Ue({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5332
5328
|
if (n.action) {
|
|
5333
5329
|
const r = this.rows;
|
|
5334
5330
|
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", {
|
|
@@ -5339,7 +5335,7 @@ class _n extends _ {
|
|
|
5339
5335
|
return !0;
|
|
5340
5336
|
}
|
|
5341
5337
|
if (i) {
|
|
5342
|
-
const n =
|
|
5338
|
+
const n = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5343
5339
|
if (n.action) {
|
|
5344
5340
|
const r = this.rows;
|
|
5345
5341
|
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", {
|
|
@@ -5352,7 +5348,7 @@ class _n extends _ {
|
|
|
5352
5348
|
return !1;
|
|
5353
5349
|
}
|
|
5354
5350
|
recordEdit(e, t, i, n) {
|
|
5355
|
-
const r =
|
|
5351
|
+
const r = ln(e, t, i, n), o = rn(
|
|
5356
5352
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5357
5353
|
r,
|
|
5358
5354
|
this.config.maxHistorySize ?? 100
|
|
@@ -5360,7 +5356,7 @@ class _n extends _ {
|
|
|
5360
5356
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5361
5357
|
}
|
|
5362
5358
|
undo() {
|
|
5363
|
-
const e =
|
|
5359
|
+
const e = Ue({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5364
5360
|
if (e.action) {
|
|
5365
5361
|
const t = this.rows;
|
|
5366
5362
|
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();
|
|
@@ -5368,7 +5364,7 @@ class _n extends _ {
|
|
|
5368
5364
|
return e.action;
|
|
5369
5365
|
}
|
|
5370
5366
|
redo() {
|
|
5371
|
-
const e =
|
|
5367
|
+
const e = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5372
5368
|
if (e.action) {
|
|
5373
5369
|
const t = this.rows;
|
|
5374
5370
|
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();
|
|
@@ -5376,13 +5372,13 @@ class _n extends _ {
|
|
|
5376
5372
|
return e.action;
|
|
5377
5373
|
}
|
|
5378
5374
|
canUndo() {
|
|
5379
|
-
return
|
|
5375
|
+
return on({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5380
5376
|
}
|
|
5381
5377
|
canRedo() {
|
|
5382
|
-
return
|
|
5378
|
+
return sn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5383
5379
|
}
|
|
5384
5380
|
clearHistory() {
|
|
5385
|
-
const e =
|
|
5381
|
+
const e = an();
|
|
5386
5382
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5387
5383
|
}
|
|
5388
5384
|
getUndoStack() {
|
|
@@ -5392,18 +5388,18 @@ class _n extends _ {
|
|
|
5392
5388
|
return [...this.redoStack];
|
|
5393
5389
|
}
|
|
5394
5390
|
}
|
|
5395
|
-
const
|
|
5396
|
-
function
|
|
5391
|
+
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))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
|
|
5392
|
+
function Xe(s) {
|
|
5397
5393
|
const e = s.meta ?? {};
|
|
5398
5394
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5399
5395
|
}
|
|
5400
|
-
class B extends
|
|
5396
|
+
class B extends A {
|
|
5401
5397
|
static dependencies = [
|
|
5402
5398
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5403
5399
|
];
|
|
5404
5400
|
name = "visibility";
|
|
5405
5401
|
static PANEL_ID = "columns";
|
|
5406
|
-
styles =
|
|
5402
|
+
styles = dn;
|
|
5407
5403
|
get defaultConfig() {
|
|
5408
5404
|
return {
|
|
5409
5405
|
allowHideAll: !1
|
|
@@ -5493,7 +5489,7 @@ class B extends _ {
|
|
|
5493
5489
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5494
5490
|
for (let n = 0; n < i.length; n++) {
|
|
5495
5491
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
5496
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
5492
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Xe(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
5497
5493
|
const l = document.createElement("label");
|
|
5498
5494
|
l.className = "tbw-visibility-label";
|
|
5499
5495
|
const d = document.createElement("input");
|
|
@@ -5501,7 +5497,7 @@ class B extends _ {
|
|
|
5501
5497
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5502
5498
|
});
|
|
5503
5499
|
const c = document.createElement("span");
|
|
5504
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
5500
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Xe(r)) {
|
|
5505
5501
|
const u = document.createElement("span");
|
|
5506
5502
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
5507
5503
|
}
|
|
@@ -5541,50 +5537,50 @@ class B extends _ {
|
|
|
5541
5537
|
}
|
|
5542
5538
|
}
|
|
5543
5539
|
export {
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5540
|
+
A as BaseGridPlugin,
|
|
5541
|
+
un as ClipboardPlugin,
|
|
5542
|
+
hn as ColumnVirtualizationPlugin,
|
|
5543
|
+
Qe as ContextMenuPlugin,
|
|
5544
|
+
Ln as DEFAULT_ANIMATION_CONFIG,
|
|
5545
|
+
st as DEFAULT_GRID_ICONS,
|
|
5546
|
+
Fn as DGEvents,
|
|
5547
|
+
In as DataGridElement,
|
|
5548
|
+
gn as EditingPlugin,
|
|
5549
|
+
fn as ExportPlugin,
|
|
5550
|
+
N as FilteringPlugin,
|
|
5551
|
+
Pn as FitModeEnum,
|
|
5552
|
+
Dn as GridCSSVars,
|
|
5553
|
+
Mn as GridClasses,
|
|
5554
|
+
Nn as GridDataAttrs,
|
|
5555
|
+
qn as GridElement,
|
|
5556
|
+
Hn as GridSelectors,
|
|
5557
|
+
pn as GroupingColumnsPlugin,
|
|
5558
|
+
mn as GroupingRowsPlugin,
|
|
5559
|
+
et as MasterDetailPlugin,
|
|
5560
|
+
wn as MultiSortPlugin,
|
|
5561
|
+
Ze as PLUGIN_QUERIES,
|
|
5562
|
+
bn as PinnedColumnsPlugin,
|
|
5563
|
+
vn as PinnedRowsPlugin,
|
|
5568
5564
|
G as PivotPlugin,
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5565
|
+
zn as PluginEvents,
|
|
5566
|
+
Kn as PluginManager,
|
|
5567
|
+
yn as PrintPlugin,
|
|
5568
|
+
Gi as ROW_DRAG_HANDLE_FIELD,
|
|
5569
|
+
On as RenderPhase,
|
|
5570
|
+
xn as ReorderPlugin,
|
|
5571
|
+
Cn as ResponsivePlugin,
|
|
5572
|
+
En as RowReorderPlugin,
|
|
5573
|
+
Rn as SelectionPlugin,
|
|
5574
|
+
Sn as ServerSidePlugin,
|
|
5575
|
+
kn as TreePlugin,
|
|
5576
|
+
An as UndoRedoPlugin,
|
|
5581
5577
|
B as VisibilityPlugin,
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5578
|
+
Gn as builtInSort,
|
|
5579
|
+
Bn as createGrid,
|
|
5580
|
+
Vn as defaultComparator,
|
|
5581
|
+
_t as defaultEditorFor,
|
|
5582
|
+
mt as defaultPasteHandler,
|
|
5583
|
+
Mi as printGridIsolated,
|
|
5584
|
+
Wn as queryGrid
|
|
5589
5585
|
};
|
|
5590
5586
|
//# sourceMappingURL=all.js.map
|