@toolbox-web/grid 1.3.0 → 1.3.1
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 +469 -444
- package/all.js.map +1 -1
- package/index.js +242 -240
- package/index.js.map +1 -1
- package/lib/core/types.d.ts +4 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +18 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +43 -41
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +24 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js +48 -46
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +22 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +160 -125
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +20 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +66 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +51 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +17 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +24 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +25 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +49 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +24 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +19 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +38 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +41 -39
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +34 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +25 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +22 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +21 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
1
|
+
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ye, a as Xe, runAggregator as ce, e as Ze, s as Je, PLUGIN_QUERIES as Oe, getAggregator as ue, getValueAggregator as Qe, b as _, c as he, g as et } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as gn, DGEvents as pn, DataGridElement as mn, FitModeEnum as wn, GridCSSVars as bn, GridClasses as vn, GridDataAttrs as yn, DataGridElement as Cn, GridSelectors as xn, PluginEvents as Rn, PluginManager as En, RenderPhase as Sn, builtInSort as kn, createGrid as An, defaultComparator as _n, queryGrid as Ln } from "./index.js";
|
|
3
|
+
const Be = "__tbw_expander", tt = 32;
|
|
4
4
|
function re(s) {
|
|
5
|
-
return s.field ===
|
|
5
|
+
return s.field === Be;
|
|
6
6
|
}
|
|
7
7
|
function I(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function it(s) {
|
|
11
11
|
return s.find(re);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function nt(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: Be,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: tt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -37,7 +37,7 @@ async function W(s) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function fe(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 he(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 rt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function ot(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 rt(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class Ui extends R {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -145,7 +145,7 @@ class ji extends R {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
148
|
+
const i = fe(t, this.config), r = this.#i()?.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], f = h ? { row: a, col: l, field: h.field, bounds: c } : null, g = [], p = i[0]?.length ?? 0;
|
|
149
149
|
for (let w = 0; w < p && l + w <= u; w++) {
|
|
150
150
|
const b = this.columns[l + w];
|
|
151
151
|
b && !b.hidden && g.push(b.field);
|
|
@@ -157,7 +157,7 @@ class ji extends R {
|
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? ot)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#i() {
|
|
163
163
|
try {
|
|
@@ -225,40 +225,40 @@ class ji extends R {
|
|
|
225
225
|
return await W(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 rt();
|
|
229
|
+
return e ? fe(e, this.config) : null;
|
|
230
230
|
}
|
|
231
231
|
getLastCopied() {
|
|
232
232
|
return this.lastCopied;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const ge = 100;
|
|
236
236
|
function oe(s) {
|
|
237
237
|
if (s == null)
|
|
238
|
-
return
|
|
238
|
+
return ge;
|
|
239
239
|
if (typeof s == "number")
|
|
240
240
|
return s;
|
|
241
241
|
const e = parseFloat(s);
|
|
242
|
-
return isNaN(e) ?
|
|
242
|
+
return isNaN(e) ? ge : e;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function pe(s) {
|
|
245
245
|
return s.map((e) => oe(e.width));
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function me(s) {
|
|
248
248
|
const e = [];
|
|
249
249
|
let t = 0;
|
|
250
250
|
for (const i of s)
|
|
251
251
|
e.push(t), t += oe(i.width);
|
|
252
252
|
return e;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function we(s) {
|
|
255
255
|
return s.reduce((e, t) => e + oe(t.width), 0);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function st(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 = at(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 ot(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 at(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 st(s, e, t) {
|
|
|
283
283
|
}
|
|
284
284
|
return i;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function lt(s, e, t) {
|
|
287
287
|
return t ? s > e : !1;
|
|
288
288
|
}
|
|
289
|
-
class
|
|
289
|
+
class Yi extends R {
|
|
290
290
|
name = "columnVirtualization";
|
|
291
291
|
get defaultConfig() {
|
|
292
292
|
return {
|
|
@@ -305,16 +305,16 @@ class Ui extends R {
|
|
|
305
305
|
attach(e) {
|
|
306
306
|
super.attach(e);
|
|
307
307
|
const t = this.columns;
|
|
308
|
-
this.columnWidths =
|
|
308
|
+
this.columnWidths = pe(t), this.columnOffsets = me(t), this.totalWidth = we(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 = lt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
315
|
+
if (this.isVirtualized = t ?? !1, this.columnWidths = pe(e), this.columnOffsets = me(e), this.totalWidth = we(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 = st(
|
|
318
318
|
this.scrollLeft,
|
|
319
319
|
i,
|
|
320
320
|
this.columnOffsets,
|
|
@@ -358,10 +358,10 @@ const $ = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--
|
|
|
358
358
|
function te(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 dt(s, e) {
|
|
362
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
363
363
|
}
|
|
364
|
-
function ie(s, e, t, i =
|
|
364
|
+
function ie(s, e, t, i = Ye.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 ie(s, e, t, i = Ue.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 = dt(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);
|
|
@@ -399,13 +399,13 @@ function ie(s, e, t, i = Ue.submenuArrow) {
|
|
|
399
399
|
}
|
|
400
400
|
return n;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function be(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
|
|
408
|
+
let F = null, D = null, L = null, j = 0;
|
|
409
409
|
const U = [
|
|
410
410
|
{
|
|
411
411
|
id: "copy",
|
|
@@ -424,7 +424,7 @@ const U = [
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
];
|
|
427
|
-
class
|
|
427
|
+
class Xi extends R {
|
|
428
428
|
name = "contextMenu";
|
|
429
429
|
get defaultConfig() {
|
|
430
430
|
return {
|
|
@@ -442,14 +442,14 @@ class Yi extends R {
|
|
|
442
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
443
443
|
}
|
|
444
444
|
installGlobalHandlers() {
|
|
445
|
-
!
|
|
445
|
+
!L && typeof document < "u" && typeof $ == "string" && $ && (L = document.createElement("style"), L.id = "tbw-context-menu-styles", L.textContent = $, document.head.appendChild(L)), F || (F = () => {
|
|
446
446
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
447
|
-
}, document.addEventListener("click",
|
|
447
|
+
}, document.addEventListener("click", F)), D || (D = (e) => {
|
|
448
448
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
449
|
-
}, document.addEventListener("keydown",
|
|
449
|
+
}, document.addEventListener("keydown", D));
|
|
450
450
|
}
|
|
451
451
|
uninstallGlobalHandlers() {
|
|
452
|
-
j--, !(j > 0) && (
|
|
452
|
+
j--, !(j > 0) && (F && (document.removeEventListener("click", F), F = null), D && (document.removeEventListener("keydown", D), D = null), L && (L.remove(), L = null));
|
|
453
453
|
}
|
|
454
454
|
afterRender() {
|
|
455
455
|
const e = this.gridElement;
|
|
@@ -495,7 +495,7 @@ class Yi extends R {
|
|
|
495
495
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
496
496
|
},
|
|
497
497
|
this.gridIcons.submenuArrow
|
|
498
|
-
), document.body.appendChild(this.menuElement),
|
|
498
|
+
), document.body.appendChild(this.menuElement), be(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
499
499
|
}));
|
|
500
500
|
}
|
|
501
501
|
showMenu(e, t, i) {
|
|
@@ -516,7 +516,7 @@ class Yi extends R {
|
|
|
516
516
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
517
517
|
},
|
|
518
518
|
this.gridIcons.submenuArrow
|
|
519
|
-
), document.body.appendChild(this.menuElement),
|
|
519
|
+
), document.body.appendChild(this.menuElement), be(this.menuElement, e, t), this.isOpen = !0;
|
|
520
520
|
}
|
|
521
521
|
hideMenu() {
|
|
522
522
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -525,12 +525,12 @@ class Yi extends R {
|
|
|
525
525
|
return this.isOpen;
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
528
|
+
const ct = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
|
|
529
|
+
function ut(s) {
|
|
530
530
|
const e = s.options;
|
|
531
531
|
return e ? typeof e == "function" ? e() : e : [];
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function ht(s) {
|
|
534
534
|
return (e) => {
|
|
535
535
|
const t = s.editorParams, i = document.createElement("input");
|
|
536
536
|
i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -540,13 +540,13 @@ function ut(s) {
|
|
|
540
540
|
}), i;
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function ft() {
|
|
544
544
|
return (s) => {
|
|
545
545
|
const e = document.createElement("input");
|
|
546
546
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function gt(s) {
|
|
550
550
|
return (e) => {
|
|
551
551
|
const t = s.editorParams, i = document.createElement("input");
|
|
552
552
|
return i.type = "date", e.value instanceof Date && (i.valueAsDate = e.value), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("change", () => e.commit(i.valueAsDate)), i.addEventListener("keydown", (n) => {
|
|
@@ -554,14 +554,14 @@ function ft(s) {
|
|
|
554
554
|
}), i;
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function pt(s) {
|
|
558
558
|
return (e) => {
|
|
559
559
|
const t = s.editorParams, i = document.createElement("select");
|
|
560
560
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
561
561
|
const o = document.createElement("option");
|
|
562
562
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
ut(s).forEach((o) => {
|
|
565
565
|
const a = document.createElement("option");
|
|
566
566
|
a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), i.appendChild(a);
|
|
567
567
|
});
|
|
@@ -577,7 +577,7 @@ function gt(s) {
|
|
|
577
577
|
}), i;
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function mt(s) {
|
|
581
581
|
return (e) => {
|
|
582
582
|
const t = s.editorParams, i = document.createElement("input");
|
|
583
583
|
return i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("blur", () => e.commit(i.value)), i.addEventListener("keydown", (n) => {
|
|
@@ -585,22 +585,22 @@ function pt(s) {
|
|
|
585
585
|
}), i;
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function wt(s) {
|
|
589
589
|
switch (s.type) {
|
|
590
590
|
case "number":
|
|
591
|
-
return
|
|
591
|
+
return ht(s);
|
|
592
592
|
case "boolean":
|
|
593
|
-
return
|
|
593
|
+
return ft();
|
|
594
594
|
case "date":
|
|
595
|
-
return ft(s);
|
|
596
|
-
case "select":
|
|
597
595
|
return gt(s);
|
|
598
|
-
|
|
596
|
+
case "select":
|
|
599
597
|
return pt(s);
|
|
598
|
+
default:
|
|
599
|
+
return mt(s);
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
const Y = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
603
|
-
function
|
|
603
|
+
function bt(s, e) {
|
|
604
604
|
if (e.editor) return e.editor;
|
|
605
605
|
if (e.__editorTemplate) return "template";
|
|
606
606
|
if (!e.type) return;
|
|
@@ -617,25 +617,25 @@ function wt(s, e) {
|
|
|
617
617
|
function K(s) {
|
|
618
618
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function vt(s) {
|
|
621
621
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
622
622
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function yt(s) {
|
|
625
625
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
626
626
|
}
|
|
627
627
|
function N(s, e) {
|
|
628
628
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function ve(s) {
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Ct(s, e, t) {
|
|
633
633
|
const i = s.querySelector("input,textarea,select");
|
|
634
634
|
i && (i.addEventListener("blur", () => {
|
|
635
635
|
t(N(i, e));
|
|
636
636
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(N(i, e))));
|
|
637
637
|
}
|
|
638
|
-
class
|
|
638
|
+
class Zi extends R {
|
|
639
639
|
static manifest = {
|
|
640
640
|
ownedProperties: [
|
|
641
641
|
{
|
|
@@ -657,7 +657,7 @@ class Xi extends R {
|
|
|
657
657
|
]
|
|
658
658
|
};
|
|
659
659
|
name = "editing";
|
|
660
|
-
styles =
|
|
660
|
+
styles = ct;
|
|
661
661
|
get defaultConfig() {
|
|
662
662
|
return {
|
|
663
663
|
editOn: "click"
|
|
@@ -912,7 +912,7 @@ class Xi extends R {
|
|
|
912
912
|
for (const l of this.#n)
|
|
913
913
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
914
914
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
915
|
-
l.classList.remove("editing"),
|
|
915
|
+
l.classList.remove("editing"), yt(l.parentElement);
|
|
916
916
|
}), this.requestRender()), this.#s = !0, o || (this.#h(i), this.#s = !1);
|
|
917
917
|
}
|
|
918
918
|
#u(e, t, i, n) {
|
|
@@ -926,7 +926,7 @@ class Xi extends R {
|
|
|
926
926
|
l = this.grid.getRowId(n);
|
|
927
927
|
} catch {
|
|
928
928
|
}
|
|
929
|
-
const d = l ? !this.#i.has(l) : !0, c = l ? (f) => this.grid.updateRow(l, f, "cascade") :
|
|
929
|
+
const d = l ? !this.#i.has(l) : !0, c = l ? (f) => this.grid.updateRow(l, f, "cascade") : ve;
|
|
930
930
|
if (this.emitCancelable("cell-commit", {
|
|
931
931
|
row: n,
|
|
932
932
|
rowId: l ?? "",
|
|
@@ -941,7 +941,7 @@ class Xi extends R {
|
|
|
941
941
|
})) return;
|
|
942
942
|
n[r] = i, l && this.#i.add(l), this.#l();
|
|
943
943
|
const h = a.findRenderedRowElement?.(e);
|
|
944
|
-
h && (h.classList.add("changed"),
|
|
944
|
+
h && (h.classList.add("changed"), Xe(h, "change"));
|
|
945
945
|
}
|
|
946
946
|
#p(e, t, i, n, r, o) {
|
|
947
947
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -950,10 +950,10 @@ class Xi extends R {
|
|
|
950
950
|
a = this.grid.getRowId(e);
|
|
951
951
|
} catch {
|
|
952
952
|
}
|
|
953
|
-
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") :
|
|
953
|
+
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : ve, d = K(i.field) ? e[i.field] : void 0;
|
|
954
954
|
r.classList.add("editing"), this.#n.add(`${t}:${n}`);
|
|
955
955
|
const c = r.parentElement;
|
|
956
|
-
c &&
|
|
956
|
+
c && vt(c);
|
|
957
957
|
let u = !1;
|
|
958
958
|
const h = (v) => {
|
|
959
959
|
u || this.#e === -1 || this.#u(t, i, v, e);
|
|
@@ -963,7 +963,7 @@ class Xi extends R {
|
|
|
963
963
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
|
|
964
964
|
v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#r(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(), f(), this.#r(t, !0));
|
|
965
965
|
});
|
|
966
|
-
const p = i, m = p.__editorTemplate, w =
|
|
966
|
+
const p = i, m = p.__editorTemplate, w = bt(this.grid, p) ?? wt(i), b = d;
|
|
967
967
|
if (w === "template" && m)
|
|
968
968
|
this.#a(g, p, e, d, h, f, o, t);
|
|
969
969
|
else if (typeof w == "string") {
|
|
@@ -982,7 +982,7 @@ class Xi extends R {
|
|
|
982
982
|
cancel: f,
|
|
983
983
|
updateRow: l
|
|
984
984
|
}, S = w(v);
|
|
985
|
-
typeof S == "string" ? (g.innerHTML = S,
|
|
985
|
+
typeof S == "string" ? (g.innerHTML = S, Ct(g, i, h)) : S instanceof Node && g.appendChild(S), o || queueMicrotask(() => {
|
|
986
986
|
g.querySelector(Y)?.focus({ preventScroll: !0 });
|
|
987
987
|
});
|
|
988
988
|
} else if (w && typeof w == "object") {
|
|
@@ -1059,7 +1059,7 @@ class Xi extends R {
|
|
|
1059
1059
|
});
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function ye(s, e = !0) {
|
|
1063
1063
|
if (s == null) return "";
|
|
1064
1064
|
if (s instanceof Date) return s.toISOString();
|
|
1065
1065
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1067,20 +1067,20 @@ function ve(s, e = !0) {
|
|
|
1067
1067
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1068
1068
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function xt(s, e, t, i = {}) {
|
|
1071
1071
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1072
1072
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1073
1073
|
if (t.includeHeaders !== !1) {
|
|
1074
1074
|
const l = e.map((d) => {
|
|
1075
1075
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1076
|
-
return
|
|
1076
|
+
return ye(u);
|
|
1077
1077
|
});
|
|
1078
1078
|
o.push(l.join(n));
|
|
1079
1079
|
}
|
|
1080
1080
|
for (const l of s) {
|
|
1081
1081
|
const d = e.map((c) => {
|
|
1082
1082
|
let u = l[c.field];
|
|
1083
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1083
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), ye(u);
|
|
1084
1084
|
});
|
|
1085
1085
|
o.push(d.join(n));
|
|
1086
1086
|
}
|
|
@@ -1090,14 +1090,14 @@ function se(s, e) {
|
|
|
1090
1090
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1091
1091
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Rt(s, e) {
|
|
1094
1094
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1095
1095
|
se(t, e);
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function Ce(s) {
|
|
1098
1098
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function Et(s, e, t) {
|
|
1101
1101
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1102
1102
|
<?mso-application progid="Excel.Sheet"?>
|
|
1103
1103
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1109,7 +1109,7 @@ function Rt(s, e, t) {
|
|
|
1109
1109
|
<Row>`;
|
|
1110
1110
|
for (const n of e) {
|
|
1111
1111
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1112
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1112
|
+
i += `<Cell><Data ss:Type="String">${Ce(o)}</Data></Cell>`;
|
|
1113
1113
|
}
|
|
1114
1114
|
i += "</Row>";
|
|
1115
1115
|
}
|
|
@@ -1120,7 +1120,7 @@ function Rt(s, e, t) {
|
|
|
1120
1120
|
let o = n[r.field];
|
|
1121
1121
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1122
1122
|
let a = "String", l = "";
|
|
1123
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l =
|
|
1123
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Ce(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
|
|
1124
1124
|
}
|
|
1125
1125
|
i += "</Row>";
|
|
1126
1126
|
}
|
|
@@ -1129,13 +1129,13 @@ function Rt(s, e, t) {
|
|
|
1129
1129
|
</Worksheet>
|
|
1130
1130
|
</Workbook>`, i;
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function St(s, e) {
|
|
1133
1133
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1134
1134
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1135
1135
|
});
|
|
1136
1136
|
se(i, t);
|
|
1137
1137
|
}
|
|
1138
|
-
class
|
|
1138
|
+
class Ji extends R {
|
|
1139
1139
|
name = "export";
|
|
1140
1140
|
get defaultConfig() {
|
|
1141
1141
|
return {
|
|
@@ -1172,13 +1172,13 @@ class Zi extends R {
|
|
|
1172
1172
|
try {
|
|
1173
1173
|
switch (e) {
|
|
1174
1174
|
case "csv": {
|
|
1175
|
-
const l =
|
|
1176
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1175
|
+
const l = xt(o, r, n, { bom: !0 });
|
|
1176
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, Rt(l, a);
|
|
1177
1177
|
break;
|
|
1178
1178
|
}
|
|
1179
1179
|
case "excel": {
|
|
1180
|
-
const l =
|
|
1181
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1180
|
+
const l = Et(o, r, n);
|
|
1181
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, St(l, a);
|
|
1182
1182
|
break;
|
|
1183
1183
|
}
|
|
1184
1184
|
case "json": {
|
|
@@ -1229,7 +1229,7 @@ class Zi extends R {
|
|
|
1229
1229
|
return this.lastExportInfo;
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1232
|
+
function kt(s) {
|
|
1233
1233
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1234
1234
|
let a = Math.floor(i / n) - r;
|
|
1235
1235
|
a < 0 && (a = 0);
|
|
@@ -1241,10 +1241,10 @@ function St(s) {
|
|
|
1241
1241
|
totalHeight: e * n
|
|
1242
1242
|
};
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1244
|
+
function At(s, e) {
|
|
1245
1245
|
return s <= e;
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function _t(s, e, t = !1) {
|
|
1248
1248
|
const i = s[e.field];
|
|
1249
1249
|
if (e.operator === "blank")
|
|
1250
1250
|
return i == null || i === "";
|
|
@@ -1283,10 +1283,10 @@ function At(s, e, t = !1) {
|
|
|
1283
1283
|
return !0;
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1286
|
+
function Lt(s, e, t = !1) {
|
|
1287
|
+
return e.length ? s.filter((i) => e.every((n) => _t(i, n, t))) : s;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function Tt(s) {
|
|
1290
1290
|
return JSON.stringify(
|
|
1291
1291
|
s.map((e) => ({
|
|
1292
1292
|
field: e.field,
|
|
@@ -1296,7 +1296,7 @@ function Lt(s) {
|
|
|
1296
1296
|
}))
|
|
1297
1297
|
);
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1299
|
+
function xe(s, e) {
|
|
1300
1300
|
const t = /* @__PURE__ */ new Set();
|
|
1301
1301
|
for (const i of s) {
|
|
1302
1302
|
const n = i[e];
|
|
@@ -1304,10 +1304,10 @@ function Ce(s, e) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1306
1306
|
}
|
|
1307
|
-
const
|
|
1308
|
-
class
|
|
1307
|
+
const It = '@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;color:inherit;vertical-align:middle;&:hover,&.active{opacity:1;visibility:visible}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}}}', Ft = "@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))}.tbw-filter-search-input{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)))}.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;min-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)))}}";
|
|
1308
|
+
class T extends R {
|
|
1309
1309
|
name = "filtering";
|
|
1310
|
-
styles =
|
|
1310
|
+
styles = It;
|
|
1311
1311
|
get defaultConfig() {
|
|
1312
1312
|
return {
|
|
1313
1313
|
debounceMs: 300,
|
|
@@ -1326,9 +1326,20 @@ class A extends R {
|
|
|
1326
1326
|
excludedValues = /* @__PURE__ */ new Map();
|
|
1327
1327
|
panelAbortController = null;
|
|
1328
1328
|
globalStylesInjected = !1;
|
|
1329
|
-
static
|
|
1329
|
+
static DEFAULT_LIST_ITEM_HEIGHT = 28;
|
|
1330
1330
|
static LIST_OVERSCAN = 3;
|
|
1331
1331
|
static LIST_BYPASS_THRESHOLD = 50;
|
|
1332
|
+
getListItemHeight() {
|
|
1333
|
+
if (this.panelElement) {
|
|
1334
|
+
const e = getComputedStyle(this.panelElement).getPropertyValue("--tbw-filter-item-height");
|
|
1335
|
+
if (e && e.trim()) {
|
|
1336
|
+
const t = parseFloat(e);
|
|
1337
|
+
if (!isNaN(t) && t > 0)
|
|
1338
|
+
return t;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
return T.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1342
|
+
}
|
|
1332
1343
|
syncExcludedValues(e, t) {
|
|
1333
1344
|
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);
|
|
1334
1345
|
}
|
|
@@ -1343,10 +1354,10 @@ class A extends R {
|
|
|
1343
1354
|
if (!t.length) return [...e];
|
|
1344
1355
|
if (this.config.filterHandler)
|
|
1345
1356
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1346
|
-
const i =
|
|
1357
|
+
const i = Tt(t);
|
|
1347
1358
|
if (this.cacheKey === i && this.cachedResult)
|
|
1348
1359
|
return this.cachedResult;
|
|
1349
|
-
const n =
|
|
1360
|
+
const n = Lt([...e], t, this.config.caseSensitive);
|
|
1350
1361
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1351
1362
|
}
|
|
1352
1363
|
afterRender() {
|
|
@@ -1362,14 +1373,20 @@ class A extends R {
|
|
|
1362
1373
|
const a = this.filters.has(o);
|
|
1363
1374
|
let l = i.querySelector(".tbw-filter-btn");
|
|
1364
1375
|
if (l) {
|
|
1365
|
-
l.classList.
|
|
1376
|
+
const u = l.classList.contains("active");
|
|
1377
|
+
if (l.classList.toggle("active", a), i.classList.toggle("filtered", a), u !== a) {
|
|
1378
|
+
const h = a ? "filterActive" : "filter";
|
|
1379
|
+
this.setIcon(l, this.resolveIcon(h));
|
|
1380
|
+
}
|
|
1366
1381
|
return;
|
|
1367
1382
|
}
|
|
1368
|
-
l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`)
|
|
1369
|
-
|
|
1383
|
+
l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`);
|
|
1384
|
+
const d = a ? "filterActive" : "filter";
|
|
1385
|
+
this.setIcon(l, this.resolveIcon(d)), a && (l.classList.add("active"), i.classList.add("filtered")), l.addEventListener("click", (u) => {
|
|
1386
|
+
u.stopPropagation(), this.toggleFilterPanel(o, r, l);
|
|
1370
1387
|
});
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1388
|
+
const c = i.querySelector(".resize-handle");
|
|
1389
|
+
c ? i.insertBefore(l, c) : i.appendChild(l);
|
|
1373
1390
|
});
|
|
1374
1391
|
}
|
|
1375
1392
|
setFilter(e, t) {
|
|
@@ -1418,7 +1435,15 @@ class A extends R {
|
|
|
1418
1435
|
return this.getFilters();
|
|
1419
1436
|
}
|
|
1420
1437
|
getUniqueValues(e) {
|
|
1421
|
-
return
|
|
1438
|
+
return xe(this.sourceRows, e);
|
|
1439
|
+
}
|
|
1440
|
+
copyGridThemeContext(e) {
|
|
1441
|
+
const t = this.gridElement;
|
|
1442
|
+
if (!t) return;
|
|
1443
|
+
for (const n of t.classList)
|
|
1444
|
+
n.startsWith("tbw-") || n === "selecting" || e.classList.add(n);
|
|
1445
|
+
const i = t.dataset.theme;
|
|
1446
|
+
i && (e.dataset.theme = i);
|
|
1422
1447
|
}
|
|
1423
1448
|
injectGlobalStyles() {
|
|
1424
1449
|
if (this.globalStylesInjected) return;
|
|
@@ -1427,7 +1452,7 @@ class A extends R {
|
|
|
1427
1452
|
return;
|
|
1428
1453
|
}
|
|
1429
1454
|
const e = document.createElement("style");
|
|
1430
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1455
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Ft, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1431
1456
|
}
|
|
1432
1457
|
toggleFilterPanel(e, t, i) {
|
|
1433
1458
|
if (this.openPanelField === e) {
|
|
@@ -1436,13 +1461,13 @@ class A extends R {
|
|
|
1436
1461
|
}
|
|
1437
1462
|
this.closeFilterPanel();
|
|
1438
1463
|
const n = document.createElement("div");
|
|
1439
|
-
if (n.className = "tbw-filter-panel", this.isAnimationEnabled && n.classList.add("tbw-filter-panel-animated"), this.panelElement = n, this.openPanelField = e, this.config.valuesHandler) {
|
|
1464
|
+
if (n.className = "tbw-filter-panel", this.copyGridThemeContext(n), this.isAnimationEnabled && n.classList.add("tbw-filter-panel-animated"), this.panelElement = n, this.openPanelField = e, this.config.valuesHandler) {
|
|
1440
1465
|
n.innerHTML = '<div class="tbw-filter-loading">Loading...</div>', document.body.appendChild(n), this.positionPanel(n, i), this.setupPanelCloseHandler(n, i), this.config.valuesHandler(e, t).then((o) => {
|
|
1441
1466
|
this.openPanelField !== e || !this.panelElement || (n.innerHTML = "", this.renderPanelContent(e, t, n, o));
|
|
1442
1467
|
});
|
|
1443
1468
|
return;
|
|
1444
1469
|
}
|
|
1445
|
-
const r =
|
|
1470
|
+
const r = xe(this.sourceRows, e);
|
|
1446
1471
|
this.renderPanelContent(e, t, n, r), document.body.appendChild(n), this.positionPanel(n, i), this.setupPanelCloseHandler(n, i);
|
|
1447
1472
|
}
|
|
1448
1473
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1485,11 +1510,11 @@ class A extends R {
|
|
|
1485
1510
|
}
|
|
1486
1511
|
static supportsAnchorPositioning = null;
|
|
1487
1512
|
static checkAnchorPositioningSupport() {
|
|
1488
|
-
return
|
|
1513
|
+
return T.supportsAnchorPositioning === null && (T.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), T.supportsAnchorPositioning;
|
|
1489
1514
|
}
|
|
1490
1515
|
positionPanel(e, t) {
|
|
1491
1516
|
const n = t.closest(".cell") ?? t;
|
|
1492
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1517
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, T.checkAnchorPositioningSupport()) {
|
|
1493
1518
|
requestAnimationFrame(() => {
|
|
1494
1519
|
const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
|
|
1495
1520
|
o.top < a.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1503,91 +1528,91 @@ class A extends R {
|
|
|
1503
1528
|
});
|
|
1504
1529
|
}
|
|
1505
1530
|
renderDefaultFilterPanel(e, t, i, n) {
|
|
1506
|
-
const { field: r } = t, o = document.createElement("div");
|
|
1507
|
-
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1519
|
-
const y = [...
|
|
1520
|
-
|
|
1531
|
+
const { field: r } = t, o = this.getListItemHeight(), a = document.createElement("div");
|
|
1532
|
+
a.className = "tbw-filter-search";
|
|
1533
|
+
const l = document.createElement("input");
|
|
1534
|
+
l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "", a.appendChild(l), e.appendChild(a);
|
|
1535
|
+
const d = document.createElement("div");
|
|
1536
|
+
d.className = "tbw-filter-actions";
|
|
1537
|
+
const c = document.createElement("label");
|
|
1538
|
+
c.className = "tbw-filter-value-item", c.style.padding = "0", c.style.margin = "0";
|
|
1539
|
+
const u = document.createElement("input");
|
|
1540
|
+
u.type = "checkbox", u.className = "tbw-filter-checkbox";
|
|
1541
|
+
const h = document.createElement("span");
|
|
1542
|
+
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1543
|
+
const f = () => {
|
|
1544
|
+
const y = [...w.values()], E = y.every((C) => C), A = y.every((C) => !C);
|
|
1545
|
+
u.checked = E, u.indeterminate = !E && !A;
|
|
1521
1546
|
};
|
|
1522
|
-
|
|
1523
|
-
const y =
|
|
1524
|
-
for (const E of
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
}), e.appendChild(
|
|
1528
|
-
const f = document.createElement("div");
|
|
1529
|
-
f.className = "tbw-filter-values";
|
|
1547
|
+
u.addEventListener("change", () => {
|
|
1548
|
+
const y = u.checked;
|
|
1549
|
+
for (const E of w.keys())
|
|
1550
|
+
w.set(E, y);
|
|
1551
|
+
f(), S();
|
|
1552
|
+
}), e.appendChild(d);
|
|
1530
1553
|
const g = document.createElement("div");
|
|
1531
|
-
g.className = "tbw-filter-values
|
|
1554
|
+
g.className = "tbw-filter-values";
|
|
1532
1555
|
const p = document.createElement("div");
|
|
1533
|
-
p.className = "tbw-filter-values-
|
|
1534
|
-
const m =
|
|
1556
|
+
p.className = "tbw-filter-values-spacer", g.appendChild(p);
|
|
1557
|
+
const m = document.createElement("div");
|
|
1558
|
+
m.className = "tbw-filter-values-content", g.appendChild(m);
|
|
1559
|
+
const w = /* @__PURE__ */ new Map();
|
|
1535
1560
|
i.forEach((y) => {
|
|
1536
1561
|
const E = y == null ? "__null__" : String(y);
|
|
1537
|
-
|
|
1538
|
-
}),
|
|
1539
|
-
let
|
|
1540
|
-
const
|
|
1541
|
-
const
|
|
1542
|
-
x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `${E *
|
|
1562
|
+
w.set(E, !n.has(y));
|
|
1563
|
+
}), f();
|
|
1564
|
+
let b = [];
|
|
1565
|
+
const v = (y, E) => {
|
|
1566
|
+
const A = y == null ? "(Blank)" : String(y), C = y == null ? "__null__" : String(y), x = document.createElement("label");
|
|
1567
|
+
x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `${E * o}px`, x.style.left = "0", x.style.right = "0", x.style.height = `${o}px`, x.style.boxSizing = "border-box";
|
|
1543
1568
|
const k = document.createElement("input");
|
|
1544
|
-
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked =
|
|
1545
|
-
|
|
1569
|
+
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = w.get(C) ?? !0, k.dataset.value = C, k.addEventListener("change", () => {
|
|
1570
|
+
w.set(C, k.checked), f();
|
|
1546
1571
|
});
|
|
1547
|
-
const
|
|
1548
|
-
return
|
|
1549
|
-
},
|
|
1550
|
-
const y =
|
|
1551
|
-
if (
|
|
1552
|
-
|
|
1553
|
-
|
|
1572
|
+
const de = document.createElement("span");
|
|
1573
|
+
return de.textContent = A, x.appendChild(k), x.appendChild(de), x;
|
|
1574
|
+
}, S = () => {
|
|
1575
|
+
const y = b.length, E = g.clientHeight, A = g.scrollTop;
|
|
1576
|
+
if (p.style.height = `${y * o}px`, At(y, T.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1577
|
+
m.innerHTML = "", m.style.transform = "translateY(0px)", b.forEach((x, k) => {
|
|
1578
|
+
m.appendChild(v(x, k));
|
|
1554
1579
|
});
|
|
1555
1580
|
return;
|
|
1556
1581
|
}
|
|
1557
|
-
const C =
|
|
1582
|
+
const C = kt({
|
|
1558
1583
|
totalRows: y,
|
|
1559
1584
|
viewportHeight: E,
|
|
1560
|
-
scrollTop:
|
|
1561
|
-
rowHeight:
|
|
1562
|
-
overscan:
|
|
1585
|
+
scrollTop: A,
|
|
1586
|
+
rowHeight: o,
|
|
1587
|
+
overscan: T.LIST_OVERSCAN
|
|
1563
1588
|
});
|
|
1564
|
-
|
|
1589
|
+
m.style.transform = `translateY(${C.offsetY}px)`, m.innerHTML = "";
|
|
1565
1590
|
for (let x = C.start; x < C.end; x++)
|
|
1566
|
-
|
|
1567
|
-
},
|
|
1568
|
-
const E = this.config.caseSensitive ?? !1,
|
|
1569
|
-
if (
|
|
1591
|
+
m.appendChild(v(b[x], x - C.start));
|
|
1592
|
+
}, q = (y) => {
|
|
1593
|
+
const E = this.config.caseSensitive ?? !1, A = E ? y : y.toLowerCase();
|
|
1594
|
+
if (b = i.filter((C) => {
|
|
1570
1595
|
const x = C == null ? "(Blank)" : String(C), k = E ? x : x.toLowerCase();
|
|
1571
|
-
return !y || k.includes(
|
|
1572
|
-
}),
|
|
1573
|
-
|
|
1596
|
+
return !y || k.includes(A);
|
|
1597
|
+
}), b.length === 0) {
|
|
1598
|
+
p.style.height = "0px", m.innerHTML = "";
|
|
1574
1599
|
const C = document.createElement("div");
|
|
1575
|
-
C.className = "tbw-filter-no-match", C.textContent = "No matching values",
|
|
1600
|
+
C.className = "tbw-filter-no-match", C.textContent = "No matching values", m.appendChild(C);
|
|
1576
1601
|
return;
|
|
1577
1602
|
}
|
|
1578
|
-
|
|
1603
|
+
S();
|
|
1579
1604
|
};
|
|
1580
|
-
|
|
1605
|
+
g.addEventListener(
|
|
1581
1606
|
"scroll",
|
|
1582
1607
|
() => {
|
|
1583
|
-
|
|
1608
|
+
b.length > 0 && S();
|
|
1584
1609
|
},
|
|
1585
1610
|
{ passive: !0 }
|
|
1586
|
-
),
|
|
1587
|
-
let
|
|
1588
|
-
|
|
1589
|
-
clearTimeout(
|
|
1590
|
-
this.searchText.set(r,
|
|
1611
|
+
), q(l.value), e.appendChild(g);
|
|
1612
|
+
let le;
|
|
1613
|
+
l.addEventListener("input", () => {
|
|
1614
|
+
clearTimeout(le), le = setTimeout(() => {
|
|
1615
|
+
this.searchText.set(r, l.value), q(l.value);
|
|
1591
1616
|
}, this.config.debounceMs ?? 150);
|
|
1592
1617
|
});
|
|
1593
1618
|
const z = document.createElement("div");
|
|
@@ -1595,8 +1620,8 @@ class A extends R {
|
|
|
1595
1620
|
const G = document.createElement("button");
|
|
1596
1621
|
G.className = "tbw-filter-apply-btn", G.textContent = "Apply", G.addEventListener("click", () => {
|
|
1597
1622
|
const y = [];
|
|
1598
|
-
for (const [E,
|
|
1599
|
-
if (!
|
|
1623
|
+
for (const [E, A] of w)
|
|
1624
|
+
if (!A)
|
|
1600
1625
|
if (E === "__null__")
|
|
1601
1626
|
y.push(null);
|
|
1602
1627
|
else {
|
|
@@ -1674,7 +1699,7 @@ class A extends R {
|
|
|
1674
1699
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1675
1700
|
}
|
|
1676
1701
|
}
|
|
1677
|
-
function
|
|
1702
|
+
function Re(s) {
|
|
1678
1703
|
if (!s.length) return [];
|
|
1679
1704
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1680
1705
|
if (!a.length) return;
|
|
@@ -1725,7 +1750,7 @@ function Dt(s, e, t) {
|
|
|
1725
1750
|
a && a.classList.add("group-end");
|
|
1726
1751
|
}
|
|
1727
1752
|
}
|
|
1728
|
-
function
|
|
1753
|
+
function Pt(s, e) {
|
|
1729
1754
|
if (s.length === 0) return null;
|
|
1730
1755
|
const t = document.createElement("div");
|
|
1731
1756
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1740,8 +1765,8 @@ function Ft(s, e) {
|
|
|
1740
1765
|
function Mt(s) {
|
|
1741
1766
|
return s.some((e) => e.group != null);
|
|
1742
1767
|
}
|
|
1743
|
-
const
|
|
1744
|
-
class
|
|
1768
|
+
const qt = "@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)}}";
|
|
1769
|
+
class Qi extends R {
|
|
1745
1770
|
static manifest = {
|
|
1746
1771
|
ownedProperties: [
|
|
1747
1772
|
{
|
|
@@ -1758,7 +1783,7 @@ class Ji extends R {
|
|
|
1758
1783
|
]
|
|
1759
1784
|
};
|
|
1760
1785
|
name = "groupingColumns";
|
|
1761
|
-
styles =
|
|
1786
|
+
styles = qt;
|
|
1762
1787
|
get defaultConfig() {
|
|
1763
1788
|
return {
|
|
1764
1789
|
showGroupBorders: !0
|
|
@@ -1789,7 +1814,7 @@ class Ji extends R {
|
|
|
1789
1814
|
});
|
|
1790
1815
|
} else
|
|
1791
1816
|
i = [...e];
|
|
1792
|
-
const n =
|
|
1817
|
+
const n = Re(i);
|
|
1793
1818
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
1794
1819
|
}
|
|
1795
1820
|
afterRender() {
|
|
@@ -1802,9 +1827,9 @@ class Ji extends R {
|
|
|
1802
1827
|
if (!e) return;
|
|
1803
1828
|
const t = e.querySelector(".header-group-row");
|
|
1804
1829
|
t && t.remove();
|
|
1805
|
-
const i = this.columns, n =
|
|
1830
|
+
const i = this.columns, n = Re(i);
|
|
1806
1831
|
if (n.length === 0) return;
|
|
1807
|
-
const r =
|
|
1832
|
+
const r = Pt(n, i);
|
|
1808
1833
|
if (r) {
|
|
1809
1834
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
1810
1835
|
const a = e.querySelector(".header-row");
|
|
@@ -1842,7 +1867,7 @@ class Ji extends R {
|
|
|
1842
1867
|
this.requestRender();
|
|
1843
1868
|
}
|
|
1844
1869
|
}
|
|
1845
|
-
function
|
|
1870
|
+
function Kt({ rows: s, config: e, expanded: t }) {
|
|
1846
1871
|
const i = e.groupOn;
|
|
1847
1872
|
if (typeof i != "function")
|
|
1848
1873
|
return [];
|
|
@@ -1875,26 +1900,26 @@ function qt({ rows: s, config: e, expanded: t }) {
|
|
|
1875
1900
|
};
|
|
1876
1901
|
return o(n), r;
|
|
1877
1902
|
}
|
|
1878
|
-
function
|
|
1903
|
+
function Ht(s, e) {
|
|
1879
1904
|
const t = new Set(s);
|
|
1880
1905
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
1881
1906
|
}
|
|
1882
|
-
function
|
|
1907
|
+
function Nt(s) {
|
|
1883
1908
|
const e = /* @__PURE__ */ new Set();
|
|
1884
1909
|
for (const t of s)
|
|
1885
1910
|
t.kind === "group" && e.add(t.key);
|
|
1886
1911
|
return e;
|
|
1887
1912
|
}
|
|
1888
|
-
function
|
|
1913
|
+
function zt() {
|
|
1889
1914
|
return /* @__PURE__ */ new Set();
|
|
1890
1915
|
}
|
|
1891
|
-
function
|
|
1916
|
+
function Gt(s) {
|
|
1892
1917
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
1893
1918
|
}
|
|
1894
|
-
const
|
|
1895
|
-
class
|
|
1919
|
+
const Ot = "@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-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}}}";
|
|
1920
|
+
class en extends R {
|
|
1896
1921
|
name = "groupingRows";
|
|
1897
|
-
styles =
|
|
1922
|
+
styles = Ot;
|
|
1898
1923
|
get defaultConfig() {
|
|
1899
1924
|
return {
|
|
1900
1925
|
defaultExpanded: !1,
|
|
@@ -1922,7 +1947,7 @@ class Qi extends R {
|
|
|
1922
1947
|
const t = this.config;
|
|
1923
1948
|
if (typeof t.groupOn != "function")
|
|
1924
1949
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1925
|
-
const i =
|
|
1950
|
+
const i = Kt({
|
|
1926
1951
|
rows: [...e],
|
|
1927
1952
|
config: t,
|
|
1928
1953
|
expanded: this.expandedKeys
|
|
@@ -1943,7 +1968,7 @@ class Qi extends R {
|
|
|
1943
1968
|
__groupDepth: r.depth,
|
|
1944
1969
|
__groupRows: r.rows,
|
|
1945
1970
|
__groupExpanded: r.expanded,
|
|
1946
|
-
__groupRowCount:
|
|
1971
|
+
__groupRowCount: Gt(r)
|
|
1947
1972
|
} : r.row);
|
|
1948
1973
|
}
|
|
1949
1974
|
onCellClick(e) {
|
|
@@ -2025,7 +2050,7 @@ class Qi extends R {
|
|
|
2025
2050
|
if (c) {
|
|
2026
2051
|
const g = r[u.field];
|
|
2027
2052
|
if (g) {
|
|
2028
|
-
const p =
|
|
2053
|
+
const p = ce(g, a, u.field, u);
|
|
2029
2054
|
f.textContent = p != null ? String(p) : "";
|
|
2030
2055
|
} else
|
|
2031
2056
|
f.textContent = "";
|
|
@@ -2033,7 +2058,7 @@ class Qi extends R {
|
|
|
2033
2058
|
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2034
2059
|
const g = document.createElement("span"), p = r[u.field];
|
|
2035
2060
|
if (p) {
|
|
2036
|
-
const m =
|
|
2061
|
+
const m = ce(p, a, u.field, u);
|
|
2037
2062
|
g.textContent = m != null ? String(m) : String(e.__groupValue);
|
|
2038
2063
|
} else
|
|
2039
2064
|
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
@@ -2046,13 +2071,13 @@ class Qi extends R {
|
|
|
2046
2071
|
});
|
|
2047
2072
|
}
|
|
2048
2073
|
expandAll() {
|
|
2049
|
-
this.expandedKeys =
|
|
2074
|
+
this.expandedKeys = Nt(this.flattenedRows), this.requestRender();
|
|
2050
2075
|
}
|
|
2051
2076
|
collapseAll() {
|
|
2052
|
-
this.expandedKeys =
|
|
2077
|
+
this.expandedKeys = zt(), this.requestRender();
|
|
2053
2078
|
}
|
|
2054
2079
|
toggle(e) {
|
|
2055
|
-
this.expandedKeys =
|
|
2080
|
+
this.expandedKeys = Ht(this.expandedKeys, e);
|
|
2056
2081
|
const t = this.flattenedRows.find((i) => i.kind === "group" && i.key === e);
|
|
2057
2082
|
this.emit("group-toggle", {
|
|
2058
2083
|
key: e,
|
|
@@ -2101,22 +2126,22 @@ class Qi extends R {
|
|
|
2101
2126
|
this.config.groupOn = e, this.requestRender();
|
|
2102
2127
|
}
|
|
2103
2128
|
}
|
|
2104
|
-
function
|
|
2129
|
+
function Ee(s, e) {
|
|
2105
2130
|
const t = new Set(s);
|
|
2106
2131
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2107
2132
|
}
|
|
2108
|
-
function
|
|
2133
|
+
function Bt(s, e) {
|
|
2109
2134
|
const t = new Set(s);
|
|
2110
2135
|
return t.add(e), t;
|
|
2111
2136
|
}
|
|
2112
|
-
function
|
|
2137
|
+
function Vt(s, e) {
|
|
2113
2138
|
const t = new Set(s);
|
|
2114
2139
|
return t.delete(e), t;
|
|
2115
2140
|
}
|
|
2116
|
-
function
|
|
2141
|
+
function Wt(s, e) {
|
|
2117
2142
|
return s.has(e);
|
|
2118
2143
|
}
|
|
2119
|
-
function
|
|
2144
|
+
function $t(s, e, t, i) {
|
|
2120
2145
|
const n = document.createElement("div");
|
|
2121
2146
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2122
2147
|
const r = document.createElement("div");
|
|
@@ -2124,10 +2149,10 @@ function Wt(s, e, t, i) {
|
|
|
2124
2149
|
const o = t(s, e);
|
|
2125
2150
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2126
2151
|
}
|
|
2127
|
-
const
|
|
2128
|
-
class
|
|
2152
|
+
const jt = "@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}}}";
|
|
2153
|
+
class Ve extends R {
|
|
2129
2154
|
name = "masterDetail";
|
|
2130
|
-
styles =
|
|
2155
|
+
styles = jt;
|
|
2131
2156
|
get defaultConfig() {
|
|
2132
2157
|
return {
|
|
2133
2158
|
detailHeight: "auto",
|
|
@@ -2156,8 +2181,8 @@ class Be extends R {
|
|
|
2156
2181
|
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));
|
|
2157
2182
|
const c = t.innerHTML.trim();
|
|
2158
2183
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2159
|
-
const f =
|
|
2160
|
-
return
|
|
2184
|
+
const f = Ze(c, { value: u, row: u });
|
|
2185
|
+
return Je(f);
|
|
2161
2186
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2162
2187
|
}
|
|
2163
2188
|
get animationStyle() {
|
|
@@ -2188,10 +2213,10 @@ class Be extends R {
|
|
|
2188
2213
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2189
2214
|
getDetailHeight(e) {
|
|
2190
2215
|
const t = this.detailElements.get(e);
|
|
2191
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2216
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : Ve.DEFAULT_DETAIL_HEIGHT;
|
|
2192
2217
|
}
|
|
2193
2218
|
toggleAndEmit(e, t) {
|
|
2194
|
-
this.expandedRows =
|
|
2219
|
+
this.expandedRows = Ee(this.expandedRows, e), this.emit("detail-expand", {
|
|
2195
2220
|
rowIndex: t,
|
|
2196
2221
|
row: e,
|
|
2197
2222
|
expanded: this.expandedRows.has(e)
|
|
@@ -2204,9 +2229,9 @@ class Be extends R {
|
|
|
2204
2229
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2205
2230
|
return [...e];
|
|
2206
2231
|
const i = [...e];
|
|
2207
|
-
if (
|
|
2232
|
+
if (it(i))
|
|
2208
2233
|
return i;
|
|
2209
|
-
const r =
|
|
2234
|
+
const r = nt(this.name);
|
|
2210
2235
|
return r.viewRenderer = (o) => {
|
|
2211
2236
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2212
2237
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2259,7 +2284,7 @@ class Be extends R {
|
|
|
2259
2284
|
d.previousElementSibling !== a && a.after(d);
|
|
2260
2285
|
continue;
|
|
2261
2286
|
}
|
|
2262
|
-
const c =
|
|
2287
|
+
const c = $t(l, o, this.config.detailRenderer, n);
|
|
2263
2288
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2264
2289
|
}
|
|
2265
2290
|
}
|
|
@@ -2294,19 +2319,19 @@ class Be extends R {
|
|
|
2294
2319
|
}
|
|
2295
2320
|
expand(e) {
|
|
2296
2321
|
const t = this.rows[e];
|
|
2297
|
-
t && (this.expandedRows =
|
|
2322
|
+
t && (this.expandedRows = Bt(this.expandedRows, t), this.requestRender());
|
|
2298
2323
|
}
|
|
2299
2324
|
collapse(e) {
|
|
2300
2325
|
const t = this.rows[e];
|
|
2301
|
-
t && (this.expandedRows =
|
|
2326
|
+
t && (this.expandedRows = Vt(this.expandedRows, t), this.requestRender());
|
|
2302
2327
|
}
|
|
2303
2328
|
toggle(e) {
|
|
2304
2329
|
const t = this.rows[e];
|
|
2305
|
-
t && (this.expandedRows =
|
|
2330
|
+
t && (this.expandedRows = Ee(this.expandedRows, t), this.requestRender());
|
|
2306
2331
|
}
|
|
2307
2332
|
isExpanded(e) {
|
|
2308
2333
|
const t = this.rows[e];
|
|
2309
|
-
return t ?
|
|
2334
|
+
return t ? Wt(this.expandedRows, t) : !1;
|
|
2310
2335
|
}
|
|
2311
2336
|
expandAll() {
|
|
2312
2337
|
for (const e of this.rows)
|
|
@@ -2336,34 +2361,34 @@ class Be extends R {
|
|
|
2336
2361
|
}
|
|
2337
2362
|
}
|
|
2338
2363
|
}
|
|
2339
|
-
function
|
|
2364
|
+
function Ut(s, e, t) {
|
|
2340
2365
|
return e.length ? [...s].sort((i, n) => {
|
|
2341
2366
|
for (const r of e) {
|
|
2342
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2367
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? Yt, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2343
2368
|
if (c !== 0)
|
|
2344
2369
|
return r.direction === "asc" ? c : -c;
|
|
2345
2370
|
}
|
|
2346
2371
|
return 0;
|
|
2347
2372
|
}) : [...s];
|
|
2348
2373
|
}
|
|
2349
|
-
function
|
|
2374
|
+
function Yt(s, e) {
|
|
2350
2375
|
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));
|
|
2351
2376
|
}
|
|
2352
|
-
function
|
|
2377
|
+
function Xt(s, e, t, i) {
|
|
2353
2378
|
const n = s.find((r) => r.field === e);
|
|
2354
2379
|
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" }];
|
|
2355
2380
|
}
|
|
2356
|
-
function
|
|
2381
|
+
function Se(s, e) {
|
|
2357
2382
|
const t = s.findIndex((i) => i.field === e);
|
|
2358
2383
|
return t >= 0 ? t + 1 : void 0;
|
|
2359
2384
|
}
|
|
2360
|
-
function
|
|
2385
|
+
function ke(s, e) {
|
|
2361
2386
|
return s.find((t) => t.field === e)?.direction;
|
|
2362
2387
|
}
|
|
2363
|
-
const
|
|
2364
|
-
class
|
|
2388
|
+
const Zt = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
|
|
2389
|
+
class tn extends R {
|
|
2365
2390
|
name = "multiSort";
|
|
2366
|
-
styles =
|
|
2391
|
+
styles = Zt;
|
|
2367
2392
|
get defaultConfig() {
|
|
2368
2393
|
return {
|
|
2369
2394
|
maxSortColumns: 3,
|
|
@@ -2375,12 +2400,12 @@ class en extends R {
|
|
|
2375
2400
|
this.sortModel = [];
|
|
2376
2401
|
}
|
|
2377
2402
|
processRows(e) {
|
|
2378
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2403
|
+
return this.sortModel.length === 0 ? [...e] : Ut([...e], this.sortModel, [...this.columns]);
|
|
2379
2404
|
}
|
|
2380
2405
|
onHeaderClick(e) {
|
|
2381
2406
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2382
2407
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2383
|
-
return this.sortModel =
|
|
2408
|
+
return this.sortModel = Xt(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2384
2409
|
}
|
|
2385
2410
|
afterRender() {
|
|
2386
2411
|
const e = this.gridElement;
|
|
@@ -2389,7 +2414,7 @@ class en extends R {
|
|
|
2389
2414
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2390
2415
|
const r = n.getAttribute("data-field");
|
|
2391
2416
|
if (!r) return;
|
|
2392
|
-
const o =
|
|
2417
|
+
const o = Se(this.sortModel, r), a = ke(this.sortModel, r);
|
|
2393
2418
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2394
2419
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2395
2420
|
const c = document.createElement("span");
|
|
@@ -2413,10 +2438,10 @@ class en extends R {
|
|
|
2413
2438
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2414
2439
|
}
|
|
2415
2440
|
getSortIndex(e) {
|
|
2416
|
-
return
|
|
2441
|
+
return Se(this.sortModel, e);
|
|
2417
2442
|
}
|
|
2418
2443
|
getSortDirection(e) {
|
|
2419
|
-
return
|
|
2444
|
+
return ke(this.sortModel, e);
|
|
2420
2445
|
}
|
|
2421
2446
|
getColumnState(e) {
|
|
2422
2447
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2439,16 +2464,16 @@ class en extends R {
|
|
|
2439
2464
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2440
2465
|
}
|
|
2441
2466
|
}
|
|
2442
|
-
function
|
|
2467
|
+
function Jt(s) {
|
|
2443
2468
|
return s.filter((e) => e.sticky === "left");
|
|
2444
2469
|
}
|
|
2445
|
-
function
|
|
2470
|
+
function Qt(s) {
|
|
2446
2471
|
return s.filter((e) => e.sticky === "right");
|
|
2447
2472
|
}
|
|
2448
2473
|
function X(s) {
|
|
2449
2474
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2450
2475
|
}
|
|
2451
|
-
function
|
|
2476
|
+
function Ae(s, e) {
|
|
2452
2477
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2453
2478
|
if (!t.length) return;
|
|
2454
2479
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2472,12 +2497,12 @@ function ke(s, e) {
|
|
|
2472
2497
|
}), r += l.offsetWidth);
|
|
2473
2498
|
}
|
|
2474
2499
|
}
|
|
2475
|
-
function
|
|
2500
|
+
function _e(s) {
|
|
2476
2501
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2477
2502
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2478
2503
|
});
|
|
2479
2504
|
}
|
|
2480
|
-
class
|
|
2505
|
+
class nn extends R {
|
|
2481
2506
|
static manifest = {
|
|
2482
2507
|
ownedProperties: [
|
|
2483
2508
|
{
|
|
@@ -2510,16 +2535,16 @@ class tn extends R {
|
|
|
2510
2535
|
return;
|
|
2511
2536
|
const e = this.grid, t = [...this.columns];
|
|
2512
2537
|
if (!X(t)) {
|
|
2513
|
-
|
|
2538
|
+
_e(e), this.isApplied = !1;
|
|
2514
2539
|
return;
|
|
2515
2540
|
}
|
|
2516
2541
|
queueMicrotask(() => {
|
|
2517
|
-
|
|
2542
|
+
Ae(e, t);
|
|
2518
2543
|
});
|
|
2519
2544
|
}
|
|
2520
2545
|
onPluginQuery(e) {
|
|
2521
2546
|
switch (e.type) {
|
|
2522
|
-
case
|
|
2547
|
+
case Oe.CAN_MOVE_COLUMN: {
|
|
2523
2548
|
const t = e.context, i = t.sticky;
|
|
2524
2549
|
if (i === "left" || i === "right")
|
|
2525
2550
|
return !1;
|
|
@@ -2532,18 +2557,18 @@ class tn extends R {
|
|
|
2532
2557
|
}
|
|
2533
2558
|
refreshStickyOffsets() {
|
|
2534
2559
|
const e = [...this.columns];
|
|
2535
|
-
|
|
2560
|
+
Ae(this.grid, e);
|
|
2536
2561
|
}
|
|
2537
2562
|
getLeftPinnedColumns() {
|
|
2538
2563
|
const e = [...this.columns];
|
|
2539
|
-
return
|
|
2564
|
+
return Jt(e);
|
|
2540
2565
|
}
|
|
2541
2566
|
getRightPinnedColumns() {
|
|
2542
2567
|
const e = [...this.columns];
|
|
2543
|
-
return
|
|
2568
|
+
return Qt(e);
|
|
2544
2569
|
}
|
|
2545
2570
|
clearStickyPositions() {
|
|
2546
|
-
|
|
2571
|
+
_e(this.grid);
|
|
2547
2572
|
}
|
|
2548
2573
|
getHorizontalScrollOffsets(e, t) {
|
|
2549
2574
|
if (!this.isApplied)
|
|
@@ -2564,7 +2589,7 @@ class tn extends R {
|
|
|
2564
2589
|
return { left: i, right: n, skipScroll: r };
|
|
2565
2590
|
}
|
|
2566
2591
|
}
|
|
2567
|
-
function
|
|
2592
|
+
function ei(s) {
|
|
2568
2593
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2569
2594
|
}
|
|
2570
2595
|
function Z(s, e) {
|
|
@@ -2589,7 +2614,7 @@ function Z(s, e) {
|
|
|
2589
2614
|
}
|
|
2590
2615
|
if (s.customPanels)
|
|
2591
2616
|
for (const o of s.customPanels) {
|
|
2592
|
-
const a =
|
|
2617
|
+
const a = ti(o, e);
|
|
2593
2618
|
switch (o.position) {
|
|
2594
2619
|
case "left":
|
|
2595
2620
|
i.appendChild(a);
|
|
@@ -2604,11 +2629,11 @@ function Z(s, e) {
|
|
|
2604
2629
|
}
|
|
2605
2630
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2606
2631
|
}
|
|
2607
|
-
function
|
|
2632
|
+
function Le(s) {
|
|
2608
2633
|
const e = document.createElement("div");
|
|
2609
2634
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2610
2635
|
}
|
|
2611
|
-
function
|
|
2636
|
+
function Te(s, e, t, i) {
|
|
2612
2637
|
s.innerHTML = "";
|
|
2613
2638
|
for (const n of e) {
|
|
2614
2639
|
const r = document.createElement("div");
|
|
@@ -2622,11 +2647,11 @@ function Le(s, e, t, i) {
|
|
|
2622
2647
|
let l, d;
|
|
2623
2648
|
const c = n.aggregators?.[o.field];
|
|
2624
2649
|
if (c)
|
|
2625
|
-
if (
|
|
2626
|
-
const u =
|
|
2650
|
+
if (ei(c)) {
|
|
2651
|
+
const u = ue(c.aggFunc);
|
|
2627
2652
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2628
2653
|
} else {
|
|
2629
|
-
const u =
|
|
2654
|
+
const u = ue(c);
|
|
2630
2655
|
u && (l = u(i, o.field, o));
|
|
2631
2656
|
}
|
|
2632
2657
|
else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
|
|
@@ -2638,13 +2663,13 @@ function Le(s, e, t, i) {
|
|
|
2638
2663
|
s.appendChild(r);
|
|
2639
2664
|
}
|
|
2640
2665
|
}
|
|
2641
|
-
function
|
|
2666
|
+
function ti(s, e) {
|
|
2642
2667
|
const t = document.createElement("div");
|
|
2643
2668
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2644
2669
|
const i = s.render(e);
|
|
2645
2670
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2646
2671
|
}
|
|
2647
|
-
function
|
|
2672
|
+
function Ie(s, e, t, i, n) {
|
|
2648
2673
|
return {
|
|
2649
2674
|
totalRows: s.length,
|
|
2650
2675
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2654,10 +2679,10 @@ function Te(s, e, t, i, n) {
|
|
|
2654
2679
|
grid: t
|
|
2655
2680
|
};
|
|
2656
2681
|
}
|
|
2657
|
-
const
|
|
2658
|
-
class
|
|
2682
|
+
const ii = "@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:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
2683
|
+
class rn extends R {
|
|
2659
2684
|
name = "pinnedRows";
|
|
2660
|
-
styles =
|
|
2685
|
+
styles = ii;
|
|
2661
2686
|
get defaultConfig() {
|
|
2662
2687
|
return {
|
|
2663
2688
|
position: "bottom",
|
|
@@ -2679,7 +2704,7 @@ class nn extends R {
|
|
|
2679
2704
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2680
2705
|
if (!t) return;
|
|
2681
2706
|
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);
|
|
2682
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
2707
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Ie(
|
|
2683
2708
|
this.rows,
|
|
2684
2709
|
this.columns,
|
|
2685
2710
|
this.grid,
|
|
@@ -2688,11 +2713,11 @@ class nn extends R {
|
|
|
2688
2713
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
2689
2714
|
if (a.length > 0) {
|
|
2690
2715
|
if (!this.topAggregationContainer) {
|
|
2691
|
-
this.topAggregationContainer =
|
|
2716
|
+
this.topAggregationContainer = Le("top");
|
|
2692
2717
|
const h = e.querySelector(".header");
|
|
2693
2718
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
2694
2719
|
}
|
|
2695
|
-
|
|
2720
|
+
Te(
|
|
2696
2721
|
this.topAggregationContainer,
|
|
2697
2722
|
a,
|
|
2698
2723
|
this.visibleColumns,
|
|
@@ -2708,7 +2733,7 @@ class nn extends R {
|
|
|
2708
2733
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2709
2734
|
}
|
|
2710
2735
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
2711
|
-
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 =
|
|
2736
|
+
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 = Le("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Te(
|
|
2712
2737
|
this.bottomAggregationContainer,
|
|
2713
2738
|
l,
|
|
2714
2739
|
this.visibleColumns,
|
|
@@ -2740,7 +2765,7 @@ class nn extends R {
|
|
|
2740
2765
|
}
|
|
2741
2766
|
getContext() {
|
|
2742
2767
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
2743
|
-
return
|
|
2768
|
+
return Ie(
|
|
2744
2769
|
this.rows,
|
|
2745
2770
|
this.columns,
|
|
2746
2771
|
this.grid,
|
|
@@ -2761,16 +2786,16 @@ class nn extends R {
|
|
|
2761
2786
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
2762
2787
|
}
|
|
2763
2788
|
}
|
|
2764
|
-
const
|
|
2765
|
-
function
|
|
2789
|
+
const ni = Qe;
|
|
2790
|
+
function ri(s) {
|
|
2766
2791
|
const e = [];
|
|
2767
2792
|
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;
|
|
2768
2793
|
}
|
|
2769
2794
|
function ae(s, e) {
|
|
2770
2795
|
return [...s, e].join("|");
|
|
2771
2796
|
}
|
|
2772
|
-
function
|
|
2773
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
2797
|
+
function oi(s, e) {
|
|
2798
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = si(s, i), o = We(
|
|
2774
2799
|
s,
|
|
2775
2800
|
t,
|
|
2776
2801
|
i,
|
|
@@ -2778,7 +2803,7 @@ function ri(s, e) {
|
|
|
2778
2803
|
n,
|
|
2779
2804
|
0,
|
|
2780
2805
|
""
|
|
2781
|
-
), a =
|
|
2806
|
+
), a = li(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
2782
2807
|
return {
|
|
2783
2808
|
rows: o,
|
|
2784
2809
|
columnKeys: r,
|
|
@@ -2786,7 +2811,7 @@ function ri(s, e) {
|
|
|
2786
2811
|
grandTotal: l
|
|
2787
2812
|
};
|
|
2788
2813
|
}
|
|
2789
|
-
function
|
|
2814
|
+
function si(s, e) {
|
|
2790
2815
|
if (e.length === 0) return ["value"];
|
|
2791
2816
|
const t = /* @__PURE__ */ new Set();
|
|
2792
2817
|
for (const i of s) {
|
|
@@ -2795,7 +2820,7 @@ function oi(s, e) {
|
|
|
2795
2820
|
}
|
|
2796
2821
|
return [...t].sort();
|
|
2797
2822
|
}
|
|
2798
|
-
function
|
|
2823
|
+
function ai(s, e) {
|
|
2799
2824
|
const t = /* @__PURE__ */ new Map();
|
|
2800
2825
|
for (const i of s) {
|
|
2801
2826
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -2803,10 +2828,10 @@ function si(s, e) {
|
|
|
2803
2828
|
}
|
|
2804
2829
|
return t;
|
|
2805
2830
|
}
|
|
2806
|
-
function
|
|
2831
|
+
function We(s, e, t, i, n, r, o) {
|
|
2807
2832
|
const a = [];
|
|
2808
2833
|
if (e.length === 0) {
|
|
2809
|
-
const h =
|
|
2834
|
+
const h = Fe(s, t, i, n), f = De(h);
|
|
2810
2835
|
return a.push({
|
|
2811
2836
|
rowKey: o || "all",
|
|
2812
2837
|
rowLabel: o || "All",
|
|
@@ -2817,11 +2842,11 @@ function Ve(s, e, t, i, n, r, o) {
|
|
|
2817
2842
|
rowCount: s.length
|
|
2818
2843
|
}), a;
|
|
2819
2844
|
}
|
|
2820
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
2845
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = ai(s, l);
|
|
2821
2846
|
for (const [h, f] of u) {
|
|
2822
|
-
const g = o ? `${o}|${h}` : h, p =
|
|
2847
|
+
const g = o ? `${o}|${h}` : h, p = Fe(f, t, i, n), m = De(p);
|
|
2823
2848
|
let w;
|
|
2824
|
-
c && (w =
|
|
2849
|
+
c && (w = We(
|
|
2825
2850
|
f,
|
|
2826
2851
|
d,
|
|
2827
2852
|
t,
|
|
@@ -2842,11 +2867,11 @@ function Ve(s, e, t, i, n, r, o) {
|
|
|
2842
2867
|
}
|
|
2843
2868
|
return a;
|
|
2844
2869
|
}
|
|
2845
|
-
function
|
|
2870
|
+
function Fe(s, e, t, i) {
|
|
2846
2871
|
const n = {};
|
|
2847
2872
|
for (const r of t)
|
|
2848
2873
|
for (const o of i) {
|
|
2849
|
-
const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d =
|
|
2874
|
+
const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = ni(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ae([r], o.field);
|
|
2850
2875
|
n[u] = c;
|
|
2851
2876
|
}
|
|
2852
2877
|
return n;
|
|
@@ -2857,7 +2882,7 @@ function De(s) {
|
|
|
2857
2882
|
e += t ?? 0;
|
|
2858
2883
|
return e;
|
|
2859
2884
|
}
|
|
2860
|
-
function
|
|
2885
|
+
function li(s, e, t) {
|
|
2861
2886
|
const i = {};
|
|
2862
2887
|
function n(r) {
|
|
2863
2888
|
for (const o of r)
|
|
@@ -2871,7 +2896,7 @@ function ai(s, e, t) {
|
|
|
2871
2896
|
}
|
|
2872
2897
|
return n(s), i;
|
|
2873
2898
|
}
|
|
2874
|
-
function
|
|
2899
|
+
function di(s, e, t = !0) {
|
|
2875
2900
|
const i = [];
|
|
2876
2901
|
function n(r) {
|
|
2877
2902
|
i.push(r);
|
|
@@ -2884,7 +2909,7 @@ function li(s, e, t = !0) {
|
|
|
2884
2909
|
n(r);
|
|
2885
2910
|
return i;
|
|
2886
2911
|
}
|
|
2887
|
-
function
|
|
2912
|
+
function ci(s) {
|
|
2888
2913
|
const e = [];
|
|
2889
2914
|
function t(i) {
|
|
2890
2915
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -2895,10 +2920,10 @@ function di(s) {
|
|
|
2895
2920
|
t(i);
|
|
2896
2921
|
return e;
|
|
2897
2922
|
}
|
|
2898
|
-
const
|
|
2899
|
-
function
|
|
2923
|
+
const ui = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
2924
|
+
function hi(s, e, t, i) {
|
|
2900
2925
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
2901
|
-
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () =>
|
|
2926
|
+
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => wi(t, r))), o.appendChild(H("Row Groups", () => Pe("rowGroups", r))), o.appendChild(H("Column Groups", () => Pe("columnGroups", r))), o.appendChild(H("Values", () => gi(r))), o.appendChild(H("Available Fields", () => mi(r))), s.appendChild(o), () => {
|
|
2902
2927
|
n.abort(), o.remove();
|
|
2903
2928
|
};
|
|
2904
2929
|
}
|
|
@@ -2910,7 +2935,7 @@ function H(s, e) {
|
|
|
2910
2935
|
const n = document.createElement("div");
|
|
2911
2936
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
2912
2937
|
}
|
|
2913
|
-
function
|
|
2938
|
+
function Pe(s, e) {
|
|
2914
2939
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
2915
2940
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
2916
2941
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -2919,7 +2944,7 @@ function Fe(s, e) {
|
|
|
2919
2944
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
2920
2945
|
} else
|
|
2921
2946
|
for (const a of o)
|
|
2922
|
-
r.appendChild(
|
|
2947
|
+
r.appendChild(fi(a, s, e));
|
|
2923
2948
|
return r.addEventListener(
|
|
2924
2949
|
"dragover",
|
|
2925
2950
|
(a) => {
|
|
@@ -2942,7 +2967,7 @@ function Fe(s, e) {
|
|
|
2942
2967
|
{ signal: n }
|
|
2943
2968
|
), r;
|
|
2944
2969
|
}
|
|
2945
|
-
function
|
|
2970
|
+
function fi(s, e, t) {
|
|
2946
2971
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
2947
2972
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
2948
2973
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -2968,7 +2993,7 @@ function hi(s, e, t) {
|
|
|
2968
2993
|
{ signal: n }
|
|
2969
2994
|
), r;
|
|
2970
2995
|
}
|
|
2971
|
-
function
|
|
2996
|
+
function gi(s) {
|
|
2972
2997
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
2973
2998
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
2974
2999
|
const r = e.valueFields ?? [];
|
|
@@ -2977,7 +3002,7 @@ function fi(s) {
|
|
|
2977
3002
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
2978
3003
|
} else
|
|
2979
3004
|
for (const o of r)
|
|
2980
|
-
n.appendChild(
|
|
3005
|
+
n.appendChild(pi(o, s));
|
|
2981
3006
|
return n.addEventListener(
|
|
2982
3007
|
"dragover",
|
|
2983
3008
|
(o) => {
|
|
@@ -3000,7 +3025,7 @@ function fi(s) {
|
|
|
3000
3025
|
{ signal: i }
|
|
3001
3026
|
), n;
|
|
3002
3027
|
}
|
|
3003
|
-
function
|
|
3028
|
+
function pi(s, e) {
|
|
3004
3029
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3005
3030
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3006
3031
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3009,7 +3034,7 @@ function gi(s, e) {
|
|
|
3009
3034
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3010
3035
|
const l = document.createElement("select");
|
|
3011
3036
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3012
|
-
for (const c of
|
|
3037
|
+
for (const c of ui) {
|
|
3013
3038
|
const u = document.createElement("option");
|
|
3014
3039
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3015
3040
|
}
|
|
@@ -3029,7 +3054,7 @@ function gi(s, e) {
|
|
|
3029
3054
|
{ signal: i }
|
|
3030
3055
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3031
3056
|
}
|
|
3032
|
-
function
|
|
3057
|
+
function mi(s) {
|
|
3033
3058
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3034
3059
|
n.className = "tbw-pivot-available-fields";
|
|
3035
3060
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3059,7 +3084,7 @@ function pi(s) {
|
|
|
3059
3084
|
}
|
|
3060
3085
|
return n;
|
|
3061
3086
|
}
|
|
3062
|
-
function
|
|
3087
|
+
function wi(s, e) {
|
|
3063
3088
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3064
3089
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3065
3090
|
J(
|
|
@@ -3098,7 +3123,7 @@ function J(s, e, t, i) {
|
|
|
3098
3123
|
const o = document.createElement("span");
|
|
3099
3124
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3100
3125
|
}
|
|
3101
|
-
function
|
|
3126
|
+
function bi(s, e, t) {
|
|
3102
3127
|
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) => {
|
|
3103
3128
|
const r = document.createElement("div");
|
|
3104
3129
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3119,7 +3144,7 @@ function wi(s, e, t) {
|
|
|
3119
3144
|
e.appendChild(r);
|
|
3120
3145
|
}), !0;
|
|
3121
3146
|
}
|
|
3122
|
-
function
|
|
3147
|
+
function vi(s, e, t, i) {
|
|
3123
3148
|
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) => {
|
|
3124
3149
|
const o = document.createElement("div");
|
|
3125
3150
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3134,7 +3159,7 @@ function bi(s, e, t, i) {
|
|
|
3134
3159
|
e.appendChild(o);
|
|
3135
3160
|
}), !0;
|
|
3136
3161
|
}
|
|
3137
|
-
function
|
|
3162
|
+
function yi(s, e, t) {
|
|
3138
3163
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3139
3164
|
const r = document.createElement("div");
|
|
3140
3165
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3147,10 +3172,10 @@ function vi(s, e, t) {
|
|
|
3147
3172
|
e.appendChild(r);
|
|
3148
3173
|
}), !0;
|
|
3149
3174
|
}
|
|
3150
|
-
const
|
|
3151
|
-
class
|
|
3175
|
+
const Ci = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
3176
|
+
class P extends R {
|
|
3152
3177
|
name = "pivot";
|
|
3153
|
-
styles =
|
|
3178
|
+
styles = Ci;
|
|
3154
3179
|
static PANEL_ID = "pivot";
|
|
3155
3180
|
get defaultConfig() {
|
|
3156
3181
|
return {
|
|
@@ -3184,7 +3209,7 @@ class M extends R {
|
|
|
3184
3209
|
getToolPanel() {
|
|
3185
3210
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3186
3211
|
return {
|
|
3187
|
-
id:
|
|
3212
|
+
id: P.PANEL_ID,
|
|
3188
3213
|
title: "Pivot",
|
|
3189
3214
|
icon: "⊞",
|
|
3190
3215
|
tooltip: "Configure pivot table",
|
|
@@ -3195,11 +3220,11 @@ class M extends R {
|
|
|
3195
3220
|
processRows(e) {
|
|
3196
3221
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3197
3222
|
return [...e];
|
|
3198
|
-
const t =
|
|
3223
|
+
const t = ri(this.config);
|
|
3199
3224
|
if (t.length > 0)
|
|
3200
3225
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3201
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult =
|
|
3202
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3226
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = oi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
|
|
3227
|
+
const i = this.config.indentWidth ?? 20, n = di(
|
|
3203
3228
|
this.pivotResult.rows,
|
|
3204
3229
|
this.expandedKeys,
|
|
3205
3230
|
this.defaultExpanded
|
|
@@ -3251,13 +3276,13 @@ class M extends R {
|
|
|
3251
3276
|
}
|
|
3252
3277
|
renderRow(e, t, i) {
|
|
3253
3278
|
const n = e;
|
|
3254
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3279
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? bi(n, t, {
|
|
3255
3280
|
columns: this.gridColumns,
|
|
3256
3281
|
rowIndex: i,
|
|
3257
3282
|
onToggle: (r) => this.toggle(r),
|
|
3258
3283
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3259
3284
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3260
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3285
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? vi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3261
3286
|
}
|
|
3262
3287
|
cleanupPivotStyling(e) {
|
|
3263
3288
|
(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 = "");
|
|
@@ -3295,7 +3320,7 @@ class M extends R {
|
|
|
3295
3320
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3296
3321
|
...this.pivotResult.totals
|
|
3297
3322
|
};
|
|
3298
|
-
|
|
3323
|
+
yi(i, this.grandTotalFooter, this.gridColumns);
|
|
3299
3324
|
}
|
|
3300
3325
|
cleanupGrandTotalFooter() {
|
|
3301
3326
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3317,7 +3342,7 @@ class M extends R {
|
|
|
3317
3342
|
}
|
|
3318
3343
|
expandAllKeys() {
|
|
3319
3344
|
if (!this.pivotResult) return;
|
|
3320
|
-
const e =
|
|
3345
|
+
const e = ci(this.pivotResult.rows);
|
|
3321
3346
|
for (const t of e)
|
|
3322
3347
|
this.expandedKeys.add(t);
|
|
3323
3348
|
}
|
|
@@ -3349,16 +3374,16 @@ class M extends R {
|
|
|
3349
3374
|
this.pivotResult = null, this.requestRender();
|
|
3350
3375
|
}
|
|
3351
3376
|
showPanel() {
|
|
3352
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3377
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(P.PANEL_ID) || this.grid.toggleToolPanelSection(P.PANEL_ID);
|
|
3353
3378
|
}
|
|
3354
3379
|
hidePanel() {
|
|
3355
3380
|
this.grid.closeToolPanel();
|
|
3356
3381
|
}
|
|
3357
3382
|
togglePanel() {
|
|
3358
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3383
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(P.PANEL_ID);
|
|
3359
3384
|
}
|
|
3360
3385
|
isPanelVisible() {
|
|
3361
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3386
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(P.PANEL_ID);
|
|
3362
3387
|
}
|
|
3363
3388
|
get gridColumns() {
|
|
3364
3389
|
return this.grid.columns ?? [];
|
|
@@ -3402,7 +3427,7 @@ class M extends R {
|
|
|
3402
3427
|
},
|
|
3403
3428
|
getAvailableFields: () => this.getAvailableFields()
|
|
3404
3429
|
};
|
|
3405
|
-
return
|
|
3430
|
+
return hi(e, this.config, this.isActive, t);
|
|
3406
3431
|
}
|
|
3407
3432
|
refreshPanel() {
|
|
3408
3433
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3435,7 +3460,7 @@ class M extends R {
|
|
|
3435
3460
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3436
3461
|
}
|
|
3437
3462
|
}
|
|
3438
|
-
function
|
|
3463
|
+
function xi(s) {
|
|
3439
3464
|
const e = s.meta ?? {};
|
|
3440
3465
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3441
3466
|
}
|
|
@@ -3444,10 +3469,10 @@ function Me(s, e, t) {
|
|
|
3444
3469
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3445
3470
|
return i.splice(t, 0, n), i;
|
|
3446
3471
|
}
|
|
3447
|
-
const
|
|
3448
|
-
class
|
|
3472
|
+
const Ri = '@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}}';
|
|
3473
|
+
class on extends R {
|
|
3449
3474
|
name = "reorder";
|
|
3450
|
-
styles =
|
|
3475
|
+
styles = Ri;
|
|
3451
3476
|
get defaultConfig() {
|
|
3452
3477
|
return {
|
|
3453
3478
|
animation: "flip"
|
|
@@ -3464,8 +3489,8 @@ class rn extends R {
|
|
|
3464
3489
|
draggedIndex = null;
|
|
3465
3490
|
dropIndex = null;
|
|
3466
3491
|
canMoveColumnWithPlugins(e) {
|
|
3467
|
-
return !e || !
|
|
3468
|
-
type:
|
|
3492
|
+
return !e || !xi(e) ? !1 : !this.grid.queryPlugins({
|
|
3493
|
+
type: Oe.CAN_MOVE_COLUMN,
|
|
3469
3494
|
context: e
|
|
3470
3495
|
}).includes(!1);
|
|
3471
3496
|
}
|
|
@@ -3537,7 +3562,7 @@ class rn extends R {
|
|
|
3537
3562
|
if (l < 0 || l >= o.length) return;
|
|
3538
3563
|
const d = n.find((c) => c.field === o[l]);
|
|
3539
3564
|
if (this.canMoveColumnWithPlugins(d))
|
|
3540
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
3565
|
+
return this.moveColumn(r.field, l), t._focusCol = l, _(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
3541
3566
|
}
|
|
3542
3567
|
getColumnOrder() {
|
|
3543
3568
|
return this.grid.getColumnOrder();
|
|
@@ -3640,11 +3665,11 @@ class rn extends R {
|
|
|
3640
3665
|
this.grid.requestStateChange?.();
|
|
3641
3666
|
}
|
|
3642
3667
|
}
|
|
3643
|
-
const
|
|
3644
|
-
class
|
|
3668
|
+
const Ei = '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}}';
|
|
3669
|
+
class sn extends R {
|
|
3645
3670
|
name = "responsive";
|
|
3646
3671
|
version = "1.0.0";
|
|
3647
|
-
styles =
|
|
3672
|
+
styles = Ei;
|
|
3648
3673
|
static manifest = {
|
|
3649
3674
|
incompatibleWith: [
|
|
3650
3675
|
{
|
|
@@ -3775,23 +3800,23 @@ class on extends R {
|
|
|
3775
3800
|
switch (e.key) {
|
|
3776
3801
|
case "ArrowDown":
|
|
3777
3802
|
if (this.grid._focusCol < i)
|
|
3778
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
3803
|
+
return this.grid._focusCol += 1, e.preventDefault(), _(this.grid), !0;
|
|
3779
3804
|
if (this.grid._focusRow < t)
|
|
3780
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
3805
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), _(this.grid), !0;
|
|
3781
3806
|
break;
|
|
3782
3807
|
case "ArrowUp":
|
|
3783
3808
|
if (this.grid._focusCol > 0)
|
|
3784
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
3809
|
+
return this.grid._focusCol -= 1, e.preventDefault(), _(this.grid), !0;
|
|
3785
3810
|
if (this.grid._focusRow > 0)
|
|
3786
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
3811
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), _(this.grid), !0;
|
|
3787
3812
|
break;
|
|
3788
3813
|
case "ArrowRight":
|
|
3789
3814
|
if (this.grid._focusRow < t)
|
|
3790
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
3815
|
+
return this.grid._focusRow += 1, e.preventDefault(), _(this.grid), !0;
|
|
3791
3816
|
break;
|
|
3792
3817
|
case "ArrowLeft":
|
|
3793
3818
|
if (this.grid._focusRow > 0)
|
|
3794
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
3819
|
+
return this.grid._focusRow -= 1, e.preventDefault(), _(this.grid), !0;
|
|
3795
3820
|
break;
|
|
3796
3821
|
}
|
|
3797
3822
|
return !1;
|
|
@@ -3865,10 +3890,10 @@ class on extends R {
|
|
|
3865
3890
|
}));
|
|
3866
3891
|
}
|
|
3867
3892
|
}
|
|
3868
|
-
const
|
|
3869
|
-
class
|
|
3893
|
+
const Si = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px;&:hover{color:var(--tbw-color-fg, #333)}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', ki = "__tbw_row_drag";
|
|
3894
|
+
class an extends R {
|
|
3870
3895
|
name = "rowReorder";
|
|
3871
|
-
styles =
|
|
3896
|
+
styles = Si;
|
|
3872
3897
|
get defaultConfig() {
|
|
3873
3898
|
return {
|
|
3874
3899
|
enableKeyboard: !0,
|
|
@@ -3892,7 +3917,7 @@ class sn extends R {
|
|
|
3892
3917
|
if (!this.config.showDragHandle)
|
|
3893
3918
|
return [...e];
|
|
3894
3919
|
const t = {
|
|
3895
|
-
field:
|
|
3920
|
+
field: ki,
|
|
3896
3921
|
header: "",
|
|
3897
3922
|
width: this.config.dragHandleWidth ?? 40,
|
|
3898
3923
|
resizable: !1,
|
|
@@ -3986,7 +4011,7 @@ class sn extends R {
|
|
|
3986
4011
|
row: e
|
|
3987
4012
|
}, this.lastFocusCol = r;
|
|
3988
4013
|
const o = this.grid, a = [...o._rows ?? this.sourceRows], [l] = a.splice(t, 1);
|
|
3989
|
-
a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0),
|
|
4014
|
+
a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), _(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
3990
4015
|
this.flushPendingMove();
|
|
3991
4016
|
}, this.config.debounceMs ?? 300);
|
|
3992
4017
|
}
|
|
@@ -4005,7 +4030,7 @@ class sn extends R {
|
|
|
4005
4030
|
const o = [...this.sourceRows], [a] = o.splice(t, 1);
|
|
4006
4031
|
o.splice(e, 0, a);
|
|
4007
4032
|
const l = this.grid;
|
|
4008
|
-
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0),
|
|
4033
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), _(l);
|
|
4009
4034
|
}
|
|
4010
4035
|
}
|
|
4011
4036
|
executeMove(e, t, i, n) {
|
|
@@ -4041,34 +4066,34 @@ function V(s) {
|
|
|
4041
4066
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4042
4067
|
};
|
|
4043
4068
|
}
|
|
4044
|
-
function
|
|
4069
|
+
function Ai(s) {
|
|
4045
4070
|
const e = V(s);
|
|
4046
4071
|
return {
|
|
4047
4072
|
from: { row: e.startRow, col: e.startCol },
|
|
4048
4073
|
to: { row: e.endRow, col: e.endCol }
|
|
4049
4074
|
};
|
|
4050
4075
|
}
|
|
4051
|
-
function
|
|
4052
|
-
return s.map(
|
|
4076
|
+
function $e(s) {
|
|
4077
|
+
return s.map(Ai);
|
|
4053
4078
|
}
|
|
4054
|
-
function
|
|
4079
|
+
function _i(s, e, t) {
|
|
4055
4080
|
const i = V(t);
|
|
4056
4081
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4057
4082
|
}
|
|
4058
|
-
function
|
|
4059
|
-
return t.some((i) =>
|
|
4083
|
+
function qe(s, e, t) {
|
|
4084
|
+
return t.some((i) => _i(s, e, i));
|
|
4060
4085
|
}
|
|
4061
|
-
function
|
|
4086
|
+
function Li(s) {
|
|
4062
4087
|
const e = [], t = V(s);
|
|
4063
4088
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4064
4089
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4065
4090
|
e.push({ row: i, col: n });
|
|
4066
4091
|
return e;
|
|
4067
4092
|
}
|
|
4068
|
-
function
|
|
4093
|
+
function Ti(s) {
|
|
4069
4094
|
const e = /* @__PURE__ */ new Map();
|
|
4070
4095
|
for (const t of s)
|
|
4071
|
-
for (const i of
|
|
4096
|
+
for (const i of Li(t))
|
|
4072
4097
|
e.set(`${i.row},${i.col}`, i);
|
|
4073
4098
|
return [...e.values()];
|
|
4074
4099
|
}
|
|
@@ -4080,8 +4105,8 @@ function Q(s, e) {
|
|
|
4080
4105
|
endCol: e.col
|
|
4081
4106
|
};
|
|
4082
4107
|
}
|
|
4083
|
-
const
|
|
4084
|
-
function
|
|
4108
|
+
const Ii = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-color-warning-bg, rgba(255, 243, 205, .5))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4109
|
+
function Fi(s, e, t) {
|
|
4085
4110
|
if (s === "cell" && e.selectedCell)
|
|
4086
4111
|
return {
|
|
4087
4112
|
mode: s,
|
|
@@ -4099,9 +4124,9 @@ function Ii(s, e, t) {
|
|
|
4099
4124
|
}));
|
|
4100
4125
|
return { mode: s, ranges: i };
|
|
4101
4126
|
}
|
|
4102
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4127
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: $e(e.ranges) } : { mode: s, ranges: [] };
|
|
4103
4128
|
}
|
|
4104
|
-
class
|
|
4129
|
+
class ln extends R {
|
|
4105
4130
|
static manifest = {
|
|
4106
4131
|
configRules: [
|
|
4107
4132
|
{
|
|
@@ -4115,7 +4140,7 @@ class an extends R {
|
|
|
4115
4140
|
]
|
|
4116
4141
|
};
|
|
4117
4142
|
name = "selection";
|
|
4118
|
-
styles =
|
|
4143
|
+
styles = Ii;
|
|
4119
4144
|
get defaultConfig() {
|
|
4120
4145
|
return {
|
|
4121
4146
|
mode: "cell",
|
|
@@ -4258,14 +4283,14 @@ class an extends R {
|
|
|
4258
4283
|
const r = e.querySelectorAll(".data-grid-row");
|
|
4259
4284
|
if (r.forEach((o) => {
|
|
4260
4285
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4261
|
-
}), t === "row" && (
|
|
4262
|
-
const a = o.querySelector(".cell[data-row]"), l =
|
|
4286
|
+
}), t === "row" && (he(e), r.forEach((o) => {
|
|
4287
|
+
const a = o.querySelector(".cell[data-row]"), l = et(a);
|
|
4263
4288
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4264
4289
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4265
4290
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4266
4291
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4267
4292
|
}), t === "range" && this.ranges.length > 0) {
|
|
4268
|
-
|
|
4293
|
+
he(e);
|
|
4269
4294
|
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !I(d));
|
|
4270
4295
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4271
4296
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
@@ -4273,7 +4298,7 @@ class an extends R {
|
|
|
4273
4298
|
const h = this.columns[u];
|
|
4274
4299
|
if (h && I(h))
|
|
4275
4300
|
return;
|
|
4276
|
-
if (
|
|
4301
|
+
if (qe(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4277
4302
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4278
4303
|
const g = Math.max(o.startCol, a);
|
|
4279
4304
|
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
@@ -4309,10 +4334,10 @@ class an extends R {
|
|
|
4309
4334
|
};
|
|
4310
4335
|
}
|
|
4311
4336
|
getSelectedCells() {
|
|
4312
|
-
return
|
|
4337
|
+
return Ti(this.ranges);
|
|
4313
4338
|
}
|
|
4314
4339
|
isCellSelected(e, t) {
|
|
4315
|
-
return
|
|
4340
|
+
return qe(e, t, this.ranges);
|
|
4316
4341
|
}
|
|
4317
4342
|
clearSelection() {
|
|
4318
4343
|
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();
|
|
@@ -4325,11 +4350,11 @@ class an extends R {
|
|
|
4325
4350
|
endCol: t.to.col
|
|
4326
4351
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4327
4352
|
mode: this.config.mode,
|
|
4328
|
-
ranges:
|
|
4353
|
+
ranges: $e(this.ranges)
|
|
4329
4354
|
}), this.requestAfterRender();
|
|
4330
4355
|
}
|
|
4331
4356
|
#t() {
|
|
4332
|
-
return
|
|
4357
|
+
return Fi(
|
|
4333
4358
|
this.config.mode,
|
|
4334
4359
|
{
|
|
4335
4360
|
selectedCell: this.selectedCell,
|
|
@@ -4349,13 +4374,13 @@ function Di(s, e) {
|
|
|
4349
4374
|
end: (s + 1) * e
|
|
4350
4375
|
};
|
|
4351
4376
|
}
|
|
4352
|
-
function
|
|
4377
|
+
function Pi(s, e, t) {
|
|
4353
4378
|
const i = B(s, t), n = B(e - 1, t), r = [];
|
|
4354
4379
|
for (let o = i; o <= n; o++)
|
|
4355
4380
|
r.push(o);
|
|
4356
4381
|
return r;
|
|
4357
4382
|
}
|
|
4358
|
-
async function
|
|
4383
|
+
async function Ke(s, e, t, i) {
|
|
4359
4384
|
const n = Di(e, t);
|
|
4360
4385
|
return s.getRows({
|
|
4361
4386
|
startRow: n.start,
|
|
@@ -4370,8 +4395,8 @@ function Mi(s, e, t) {
|
|
|
4370
4395
|
const r = s % e;
|
|
4371
4396
|
return n[r];
|
|
4372
4397
|
}
|
|
4373
|
-
const
|
|
4374
|
-
class
|
|
4398
|
+
const qi = 100;
|
|
4399
|
+
class dn extends R {
|
|
4375
4400
|
name = "serverSide";
|
|
4376
4401
|
get defaultConfig() {
|
|
4377
4402
|
return {
|
|
@@ -4391,12 +4416,12 @@ class ln extends R {
|
|
|
4391
4416
|
}
|
|
4392
4417
|
loadRequiredBlocks() {
|
|
4393
4418
|
if (!this.dataSource) return;
|
|
4394
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4419
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Pi(i.startRow, i.endRow, t);
|
|
4395
4420
|
for (const r of n)
|
|
4396
4421
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4397
4422
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
4398
4423
|
break;
|
|
4399
|
-
this.loadingBlocks.add(r),
|
|
4424
|
+
this.loadingBlocks.add(r), Ke(this.dataSource, r, t, {}).then((o) => {
|
|
4400
4425
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
4401
4426
|
}).catch(() => {
|
|
4402
4427
|
this.loadingBlocks.delete(r);
|
|
@@ -4415,12 +4440,12 @@ class ln extends R {
|
|
|
4415
4440
|
onScroll(e) {
|
|
4416
4441
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4417
4442
|
this.loadRequiredBlocks();
|
|
4418
|
-
},
|
|
4443
|
+
}, qi));
|
|
4419
4444
|
}
|
|
4420
4445
|
setDataSource(e) {
|
|
4421
4446
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
4422
4447
|
const t = this.config.cacheBlockSize ?? 100;
|
|
4423
|
-
|
|
4448
|
+
Ke(e, 0, t, {}).then((i) => {
|
|
4424
4449
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
4425
4450
|
});
|
|
4426
4451
|
}
|
|
@@ -4441,7 +4466,7 @@ class ln extends R {
|
|
|
4441
4466
|
return this.loadedBlocks.size;
|
|
4442
4467
|
}
|
|
4443
4468
|
}
|
|
4444
|
-
function
|
|
4469
|
+
function je(s, e, t) {
|
|
4445
4470
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4446
4471
|
}
|
|
4447
4472
|
function ee(s, e) {
|
|
@@ -4451,7 +4476,7 @@ function ee(s, e) {
|
|
|
4451
4476
|
function ne(s, e, t = null, i = 0) {
|
|
4452
4477
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
4453
4478
|
for (let o = 0; o < s.length; o++) {
|
|
4454
|
-
const a = s[o], l =
|
|
4479
|
+
const a = s[o], l = je(a, o, t), d = a[n];
|
|
4455
4480
|
if (Array.isArray(d) && d.length > 0) {
|
|
4456
4481
|
r.add(l);
|
|
4457
4482
|
const c = ne(d, e, l, i + 1);
|
|
@@ -4460,33 +4485,33 @@ function ne(s, e, t = null, i = 0) {
|
|
|
4460
4485
|
}
|
|
4461
4486
|
return r;
|
|
4462
4487
|
}
|
|
4463
|
-
function
|
|
4488
|
+
function Ki() {
|
|
4464
4489
|
return /* @__PURE__ */ new Set();
|
|
4465
4490
|
}
|
|
4466
|
-
function
|
|
4491
|
+
function Ue(s, e, t, i = null, n = 0) {
|
|
4467
4492
|
const r = t.childrenField ?? "children";
|
|
4468
4493
|
for (let o = 0; o < s.length; o++) {
|
|
4469
|
-
const a = s[o], l =
|
|
4494
|
+
const a = s[o], l = je(a, o, i);
|
|
4470
4495
|
if (l === e)
|
|
4471
4496
|
return [l];
|
|
4472
4497
|
const d = a[r];
|
|
4473
4498
|
if (Array.isArray(d) && d.length > 0) {
|
|
4474
|
-
const c =
|
|
4499
|
+
const c = Ue(d, e, t, l, n + 1);
|
|
4475
4500
|
if (c)
|
|
4476
4501
|
return [l, ...c];
|
|
4477
4502
|
}
|
|
4478
4503
|
}
|
|
4479
4504
|
return null;
|
|
4480
4505
|
}
|
|
4481
|
-
function
|
|
4482
|
-
const n =
|
|
4506
|
+
function Hi(s, e, t, i) {
|
|
4507
|
+
const n = Ue(s, e, t);
|
|
4483
4508
|
if (!n) return i;
|
|
4484
4509
|
const r = new Set(i);
|
|
4485
4510
|
for (let o = 0; o < n.length - 1; o++)
|
|
4486
4511
|
r.add(n[o]);
|
|
4487
4512
|
return r;
|
|
4488
4513
|
}
|
|
4489
|
-
function
|
|
4514
|
+
function He(s, e = "children") {
|
|
4490
4515
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
4491
4516
|
for (const t of s) {
|
|
4492
4517
|
if (!t) continue;
|
|
@@ -4496,7 +4521,7 @@ function Ke(s, e = "children") {
|
|
|
4496
4521
|
}
|
|
4497
4522
|
return !1;
|
|
4498
4523
|
}
|
|
4499
|
-
function
|
|
4524
|
+
function Ni(s) {
|
|
4500
4525
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
4501
4526
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
4502
4527
|
for (const t of s)
|
|
@@ -4508,10 +4533,10 @@ function Hi(s) {
|
|
|
4508
4533
|
}
|
|
4509
4534
|
return null;
|
|
4510
4535
|
}
|
|
4511
|
-
const
|
|
4512
|
-
class
|
|
4536
|
+
const zi = "@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}}}";
|
|
4537
|
+
class cn extends R {
|
|
4513
4538
|
name = "tree";
|
|
4514
|
-
styles =
|
|
4539
|
+
styles = zi;
|
|
4515
4540
|
get defaultConfig() {
|
|
4516
4541
|
return {
|
|
4517
4542
|
childrenField: "children",
|
|
@@ -4537,12 +4562,12 @@ class dn extends R {
|
|
|
4537
4562
|
}
|
|
4538
4563
|
detect(e) {
|
|
4539
4564
|
if (!this.config.autoDetect) return !1;
|
|
4540
|
-
const t = e, i = this.config.childrenField ??
|
|
4541
|
-
return
|
|
4565
|
+
const t = e, i = this.config.childrenField ?? Ni(t) ?? "children";
|
|
4566
|
+
return He(t, i);
|
|
4542
4567
|
}
|
|
4543
4568
|
processRows(e) {
|
|
4544
4569
|
const t = this.config.childrenField ?? "children", i = e;
|
|
4545
|
-
if (!
|
|
4570
|
+
if (!He(i, t))
|
|
4546
4571
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
4547
4572
|
let n = this.withStableKeys(i);
|
|
4548
4573
|
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ne(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
@@ -4673,7 +4698,7 @@ class dn extends R {
|
|
|
4673
4698
|
this.expandedKeys = ne(this.rows, this.config), this.requestRender();
|
|
4674
4699
|
}
|
|
4675
4700
|
collapseAll() {
|
|
4676
|
-
this.expandedKeys =
|
|
4701
|
+
this.expandedKeys = Ki(), this.requestRender();
|
|
4677
4702
|
}
|
|
4678
4703
|
isExpanded(e) {
|
|
4679
4704
|
return this.expandedKeys.has(e);
|
|
@@ -4688,10 +4713,10 @@ class dn extends R {
|
|
|
4688
4713
|
return this.rowKeyMap.get(e)?.data;
|
|
4689
4714
|
}
|
|
4690
4715
|
expandToKey(e) {
|
|
4691
|
-
this.expandedKeys =
|
|
4716
|
+
this.expandedKeys = Hi(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
4692
4717
|
}
|
|
4693
4718
|
}
|
|
4694
|
-
function
|
|
4719
|
+
function Gi(s, e, t) {
|
|
4695
4720
|
const i = [...s.undoStack, e];
|
|
4696
4721
|
for (; i.length > t; )
|
|
4697
4722
|
i.shift();
|
|
@@ -4700,7 +4725,7 @@ function zi(s, e, t) {
|
|
|
4700
4725
|
redoStack: []
|
|
4701
4726
|
};
|
|
4702
4727
|
}
|
|
4703
|
-
function
|
|
4728
|
+
function Ne(s) {
|
|
4704
4729
|
if (s.undoStack.length === 0)
|
|
4705
4730
|
return { newState: s, action: null };
|
|
4706
4731
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -4712,7 +4737,7 @@ function He(s) {
|
|
|
4712
4737
|
action: t
|
|
4713
4738
|
} : { newState: s, action: null };
|
|
4714
4739
|
}
|
|
4715
|
-
function
|
|
4740
|
+
function ze(s) {
|
|
4716
4741
|
if (s.redoStack.length === 0)
|
|
4717
4742
|
return { newState: s, action: null };
|
|
4718
4743
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -4724,16 +4749,16 @@ function Ne(s) {
|
|
|
4724
4749
|
action: t
|
|
4725
4750
|
} : { newState: s, action: null };
|
|
4726
4751
|
}
|
|
4727
|
-
function
|
|
4752
|
+
function Oi(s) {
|
|
4728
4753
|
return s.undoStack.length > 0;
|
|
4729
4754
|
}
|
|
4730
|
-
function
|
|
4755
|
+
function Bi(s) {
|
|
4731
4756
|
return s.redoStack.length > 0;
|
|
4732
4757
|
}
|
|
4733
|
-
function
|
|
4758
|
+
function Vi() {
|
|
4734
4759
|
return { undoStack: [], redoStack: [] };
|
|
4735
4760
|
}
|
|
4736
|
-
function
|
|
4761
|
+
function Wi(s, e, t, i) {
|
|
4737
4762
|
return {
|
|
4738
4763
|
type: "cell-edit",
|
|
4739
4764
|
rowIndex: s,
|
|
@@ -4743,7 +4768,7 @@ function Vi(s, e, t, i) {
|
|
|
4743
4768
|
timestamp: Date.now()
|
|
4744
4769
|
};
|
|
4745
4770
|
}
|
|
4746
|
-
class
|
|
4771
|
+
class un extends R {
|
|
4747
4772
|
static dependencies = [
|
|
4748
4773
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
4749
4774
|
];
|
|
@@ -4761,7 +4786,7 @@ class cn extends R {
|
|
|
4761
4786
|
onKeyDown(e) {
|
|
4762
4787
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
4763
4788
|
if (t) {
|
|
4764
|
-
const n =
|
|
4789
|
+
const n = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4765
4790
|
if (n.action) {
|
|
4766
4791
|
const r = this.rows;
|
|
4767
4792
|
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", {
|
|
@@ -4772,7 +4797,7 @@ class cn extends R {
|
|
|
4772
4797
|
return !0;
|
|
4773
4798
|
}
|
|
4774
4799
|
if (i) {
|
|
4775
|
-
const n =
|
|
4800
|
+
const n = ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4776
4801
|
if (n.action) {
|
|
4777
4802
|
const r = this.rows;
|
|
4778
4803
|
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", {
|
|
@@ -4785,7 +4810,7 @@ class cn extends R {
|
|
|
4785
4810
|
return !1;
|
|
4786
4811
|
}
|
|
4787
4812
|
recordEdit(e, t, i, n) {
|
|
4788
|
-
const r =
|
|
4813
|
+
const r = Wi(e, t, i, n), o = Gi(
|
|
4789
4814
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
4790
4815
|
r,
|
|
4791
4816
|
this.config.maxHistorySize ?? 100
|
|
@@ -4793,7 +4818,7 @@ class cn extends R {
|
|
|
4793
4818
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
4794
4819
|
}
|
|
4795
4820
|
undo() {
|
|
4796
|
-
const e =
|
|
4821
|
+
const e = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4797
4822
|
if (e.action) {
|
|
4798
4823
|
const t = this.rows;
|
|
4799
4824
|
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();
|
|
@@ -4801,7 +4826,7 @@ class cn extends R {
|
|
|
4801
4826
|
return e.action;
|
|
4802
4827
|
}
|
|
4803
4828
|
redo() {
|
|
4804
|
-
const e =
|
|
4829
|
+
const e = ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4805
4830
|
if (e.action) {
|
|
4806
4831
|
const t = this.rows;
|
|
4807
4832
|
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();
|
|
@@ -4809,13 +4834,13 @@ class cn extends R {
|
|
|
4809
4834
|
return e.action;
|
|
4810
4835
|
}
|
|
4811
4836
|
canUndo() {
|
|
4812
|
-
return
|
|
4837
|
+
return Oi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4813
4838
|
}
|
|
4814
4839
|
canRedo() {
|
|
4815
|
-
return
|
|
4840
|
+
return Bi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4816
4841
|
}
|
|
4817
4842
|
clearHistory() {
|
|
4818
|
-
const e =
|
|
4843
|
+
const e = Vi();
|
|
4819
4844
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
4820
4845
|
}
|
|
4821
4846
|
getUndoStack() {
|
|
@@ -4825,18 +4850,18 @@ class cn extends R {
|
|
|
4825
4850
|
return [...this.redoStack];
|
|
4826
4851
|
}
|
|
4827
4852
|
}
|
|
4828
|
-
const
|
|
4829
|
-
function
|
|
4853
|
+
const $i = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
|
|
4854
|
+
function Ge(s) {
|
|
4830
4855
|
const e = s.meta ?? {};
|
|
4831
4856
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4832
4857
|
}
|
|
4833
|
-
class
|
|
4858
|
+
class M extends R {
|
|
4834
4859
|
static dependencies = [
|
|
4835
4860
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
4836
4861
|
];
|
|
4837
4862
|
name = "visibility";
|
|
4838
4863
|
static PANEL_ID = "columns";
|
|
4839
|
-
styles =
|
|
4864
|
+
styles = $i;
|
|
4840
4865
|
get defaultConfig() {
|
|
4841
4866
|
return {
|
|
4842
4867
|
allowHideAll: !1
|
|
@@ -4857,7 +4882,7 @@ class P extends R {
|
|
|
4857
4882
|
}
|
|
4858
4883
|
getToolPanel() {
|
|
4859
4884
|
return {
|
|
4860
|
-
id:
|
|
4885
|
+
id: M.PANEL_ID,
|
|
4861
4886
|
title: "Columns",
|
|
4862
4887
|
icon: "☰",
|
|
4863
4888
|
tooltip: "Column visibility",
|
|
@@ -4866,13 +4891,13 @@ class P extends R {
|
|
|
4866
4891
|
};
|
|
4867
4892
|
}
|
|
4868
4893
|
show() {
|
|
4869
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
4894
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(M.PANEL_ID) || this.grid.toggleToolPanelSection(M.PANEL_ID);
|
|
4870
4895
|
}
|
|
4871
4896
|
hide() {
|
|
4872
4897
|
this.grid.closeToolPanel();
|
|
4873
4898
|
}
|
|
4874
4899
|
toggle() {
|
|
4875
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
4900
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(M.PANEL_ID);
|
|
4876
4901
|
}
|
|
4877
4902
|
isColumnVisible(e) {
|
|
4878
4903
|
return this.grid.isColumnVisible(e);
|
|
@@ -4902,7 +4927,7 @@ class P extends R {
|
|
|
4902
4927
|
return this.grid.getAllColumns();
|
|
4903
4928
|
}
|
|
4904
4929
|
isPanelVisible() {
|
|
4905
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
4930
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(M.PANEL_ID);
|
|
4906
4931
|
}
|
|
4907
4932
|
renderPanelContent(e) {
|
|
4908
4933
|
const t = document.createElement("div");
|
|
@@ -4926,7 +4951,7 @@ class P extends R {
|
|
|
4926
4951
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
4927
4952
|
for (let n = 0; n < i.length; n++) {
|
|
4928
4953
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
4929
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
4954
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ge(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
4930
4955
|
const l = document.createElement("label");
|
|
4931
4956
|
l.className = "tbw-visibility-label";
|
|
4932
4957
|
const d = document.createElement("input");
|
|
@@ -4934,7 +4959,7 @@ class P extends R {
|
|
|
4934
4959
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
4935
4960
|
});
|
|
4936
4961
|
const c = document.createElement("span");
|
|
4937
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
4962
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ge(r)) {
|
|
4938
4963
|
const u = document.createElement("span");
|
|
4939
4964
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
4940
4965
|
}
|
|
@@ -4975,47 +5000,47 @@ class P extends R {
|
|
|
4975
5000
|
}
|
|
4976
5001
|
export {
|
|
4977
5002
|
R as BaseGridPlugin,
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5003
|
+
Ui as ClipboardPlugin,
|
|
5004
|
+
Yi as ColumnVirtualizationPlugin,
|
|
5005
|
+
Xi as ContextMenuPlugin,
|
|
5006
|
+
gn as DEFAULT_ANIMATION_CONFIG,
|
|
5007
|
+
Ye as DEFAULT_GRID_ICONS,
|
|
5008
|
+
pn as DGEvents,
|
|
5009
|
+
mn as DataGridElement,
|
|
5010
|
+
Zi as EditingPlugin,
|
|
5011
|
+
Ji as ExportPlugin,
|
|
5012
|
+
T as FilteringPlugin,
|
|
5013
|
+
wn as FitModeEnum,
|
|
5014
|
+
bn as GridCSSVars,
|
|
5015
|
+
vn as GridClasses,
|
|
5016
|
+
yn as GridDataAttrs,
|
|
5017
|
+
Cn as GridElement,
|
|
5018
|
+
xn as GridSelectors,
|
|
5019
|
+
Qi as GroupingColumnsPlugin,
|
|
5020
|
+
en as GroupingRowsPlugin,
|
|
5021
|
+
Ve as MasterDetailPlugin,
|
|
5022
|
+
tn as MultiSortPlugin,
|
|
5023
|
+
Oe as PLUGIN_QUERIES,
|
|
5024
|
+
nn as PinnedColumnsPlugin,
|
|
5025
|
+
rn as PinnedRowsPlugin,
|
|
5026
|
+
P as PivotPlugin,
|
|
5027
|
+
Rn as PluginEvents,
|
|
5028
|
+
En as PluginManager,
|
|
5029
|
+
ki as ROW_DRAG_HANDLE_FIELD,
|
|
5030
|
+
Sn as RenderPhase,
|
|
5031
|
+
on as ReorderPlugin,
|
|
5032
|
+
sn as ResponsivePlugin,
|
|
5033
|
+
an as RowReorderPlugin,
|
|
5034
|
+
ln as SelectionPlugin,
|
|
5035
|
+
dn as ServerSidePlugin,
|
|
5036
|
+
cn as TreePlugin,
|
|
5037
|
+
un as UndoRedoPlugin,
|
|
5038
|
+
M as VisibilityPlugin,
|
|
5039
|
+
kn as builtInSort,
|
|
5040
|
+
An as createGrid,
|
|
5041
|
+
_n as defaultComparator,
|
|
5042
|
+
wt as defaultEditorFor,
|
|
5043
|
+
ot as defaultPasteHandler,
|
|
5044
|
+
Ln as queryGrid
|
|
5020
5045
|
};
|
|
5021
5046
|
//# sourceMappingURL=all.js.map
|