@toolbox-web/grid 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -22
- package/all.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +557 -365
- package/all.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +903 -769
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +102 -3
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +65 -3
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +25 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +62 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +64 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +73 -69
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +69 -40
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +14 -12
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +155 -0
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -0
- package/lib/plugins/row-reorder/index.d.ts +9 -0
- package/lib/plugins/row-reorder/index.d.ts.map +1 -0
- package/lib/plugins/row-reorder/index.js +597 -0
- package/lib/plugins/row-reorder/index.js.map +1 -0
- package/lib/plugins/row-reorder/types.d.ts +80 -0
- package/lib/plugins/row-reorder/types.d.ts.map +1 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +95 -64
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +21 -4
- package/public.d.ts +15 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +23 -23
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +15 -15
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/row-reorder.umd.js +2 -0
- package/umd/plugins/row-reorder.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ue, runAggregator as de, e as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const Oe = "__tbw_expander",
|
|
1
|
+
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ue, a as Ye, runAggregator as de, e as Xe, s as Ze, PLUGIN_QUERIES as Ge, getAggregator as ce, getValueAggregator as Je, b as L, c as ue, g as Qe } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as fn, DGEvents as gn, DataGridElement as pn, FitModeEnum as mn, GridCSSVars as wn, GridClasses as bn, GridDataAttrs as vn, DataGridElement as yn, GridSelectors as Cn, PluginEvents as xn, PluginManager as Rn, RenderPhase as En, builtInSort as Sn, createGrid as kn, defaultComparator as An, queryGrid as _n } from "./index.js";
|
|
3
|
+
const Oe = "__tbw_expander", et = 32;
|
|
4
4
|
function re(s) {
|
|
5
5
|
return s.field === Oe;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function I(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function tt(s) {
|
|
11
11
|
return s.find(re);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function it(s) {
|
|
14
14
|
return {
|
|
15
15
|
field: Oe,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: et,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -49,35 +49,39 @@ 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 nt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function rt(s, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = s;
|
|
61
61
|
if (!i) return;
|
|
62
|
-
const r = e.rows,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
63
|
+
o.forEach((u) => {
|
|
64
|
+
l.set(u.field, u.editable === !0);
|
|
65
|
+
});
|
|
66
|
+
const d = [...r], c = i.bounds ? i.bounds.endRow : 1 / 0;
|
|
67
|
+
t.forEach((u, h) => {
|
|
68
|
+
const f = i.row + h;
|
|
69
|
+
if (!(f > c)) {
|
|
66
70
|
if (i.bounds) {
|
|
67
|
-
if (
|
|
71
|
+
if (f >= d.length)
|
|
68
72
|
return;
|
|
69
|
-
} else for (;
|
|
70
|
-
const
|
|
71
|
-
a.forEach((
|
|
73
|
+
} else for (; f >= d.length; ) {
|
|
74
|
+
const g = {};
|
|
75
|
+
a.forEach((p) => g[p] = ""), d.push(g);
|
|
72
76
|
}
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
77
|
+
d[f] = { ...d[f] }, u.forEach((g, p) => {
|
|
78
|
+
const m = n[p];
|
|
79
|
+
m && l.get(m) && (d[f][m] = g);
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
|
-
}), e.rows =
|
|
82
|
+
}), e.rows = d;
|
|
79
83
|
}
|
|
80
|
-
class
|
|
84
|
+
class ji extends R {
|
|
81
85
|
static dependencies = [
|
|
82
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
83
87
|
];
|
|
@@ -153,7 +157,7 @@ class Vi extends R {
|
|
|
153
157
|
if (!this.grid) return;
|
|
154
158
|
const { pasteHandler: t } = this.config;
|
|
155
159
|
if (t === null) return;
|
|
156
|
-
(t ??
|
|
160
|
+
(t ?? rt)(e, this.grid);
|
|
157
161
|
}
|
|
158
162
|
#i() {
|
|
159
163
|
try {
|
|
@@ -165,7 +169,7 @@ class Vi extends R {
|
|
|
165
169
|
}
|
|
166
170
|
#n(e) {
|
|
167
171
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
168
|
-
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !
|
|
172
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !I(g));
|
|
169
173
|
if (this.config.includeHeaders) {
|
|
170
174
|
const g = f.map((p) => p.header || p.field);
|
|
171
175
|
h.push(g.join(c));
|
|
@@ -221,7 +225,7 @@ class Vi extends R {
|
|
|
221
225
|
return await W(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
222
226
|
}
|
|
223
227
|
async paste() {
|
|
224
|
-
const e = await
|
|
228
|
+
const e = await nt();
|
|
225
229
|
return e ? he(e, this.config) : null;
|
|
226
230
|
}
|
|
227
231
|
getLastCopied() {
|
|
@@ -250,11 +254,11 @@ function pe(s) {
|
|
|
250
254
|
function me(s) {
|
|
251
255
|
return s.reduce((e, t) => e + oe(t.width), 0);
|
|
252
256
|
}
|
|
253
|
-
function
|
|
257
|
+
function ot(s, e, t, i, n) {
|
|
254
258
|
const r = t.length;
|
|
255
259
|
if (r === 0)
|
|
256
260
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
257
|
-
let o =
|
|
261
|
+
let o = st(s, t, i);
|
|
258
262
|
o = Math.max(0, o - n);
|
|
259
263
|
const a = s + e;
|
|
260
264
|
let l = o;
|
|
@@ -271,7 +275,7 @@ function rt(s, e, t, i, n) {
|
|
|
271
275
|
d.push(c);
|
|
272
276
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
273
277
|
}
|
|
274
|
-
function
|
|
278
|
+
function st(s, e, t) {
|
|
275
279
|
let i = 0, n = e.length - 1;
|
|
276
280
|
for (; i < n; ) {
|
|
277
281
|
const r = Math.floor((i + n) / 2);
|
|
@@ -279,10 +283,10 @@ function ot(s, e, t) {
|
|
|
279
283
|
}
|
|
280
284
|
return i;
|
|
281
285
|
}
|
|
282
|
-
function
|
|
286
|
+
function at(s, e, t) {
|
|
283
287
|
return t ? s > e : !1;
|
|
284
288
|
}
|
|
285
|
-
class
|
|
289
|
+
class Ui extends R {
|
|
286
290
|
name = "columnVirtualization";
|
|
287
291
|
get defaultConfig() {
|
|
288
292
|
return {
|
|
@@ -307,10 +311,10 @@ class Wi extends R {
|
|
|
307
311
|
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
308
312
|
}
|
|
309
313
|
processColumns(e) {
|
|
310
|
-
const t =
|
|
314
|
+
const t = at(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
311
315
|
if (this.isVirtualized = t ?? !1, this.columnWidths = ge(e), this.columnOffsets = pe(e), this.totalWidth = me(e), !t)
|
|
312
316
|
return this.startCol = 0, this.endCol = e.length - 1, [...e];
|
|
313
|
-
const i = this.grid.clientWidth || 800, n =
|
|
317
|
+
const i = this.grid.clientWidth || 800, n = ot(
|
|
314
318
|
this.scrollLeft,
|
|
315
319
|
i,
|
|
316
320
|
this.columnOffsets,
|
|
@@ -354,7 +358,7 @@ const $ = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--
|
|
|
354
358
|
function te(s, e) {
|
|
355
359
|
return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
356
360
|
}
|
|
357
|
-
function
|
|
361
|
+
function lt(s, e) {
|
|
358
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
359
363
|
}
|
|
360
364
|
function ie(s, e, t, i = Ue.submenuArrow) {
|
|
@@ -368,7 +372,7 @@ function ie(s, e, t, i = Ue.submenuArrow) {
|
|
|
368
372
|
}
|
|
369
373
|
const o = document.createElement("div");
|
|
370
374
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
371
|
-
const a =
|
|
375
|
+
const a = lt(r, e);
|
|
372
376
|
if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
373
377
|
const d = document.createElement("span");
|
|
374
378
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -401,7 +405,7 @@ function we(s, e, t) {
|
|
|
401
405
|
let o = e, a = t;
|
|
402
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";
|
|
403
407
|
}
|
|
404
|
-
let
|
|
408
|
+
let D = null, F = null, T = null, j = 0;
|
|
405
409
|
const U = [
|
|
406
410
|
{
|
|
407
411
|
id: "copy",
|
|
@@ -420,7 +424,7 @@ const U = [
|
|
|
420
424
|
}
|
|
421
425
|
}
|
|
422
426
|
];
|
|
423
|
-
class
|
|
427
|
+
class Yi extends R {
|
|
424
428
|
name = "contextMenu";
|
|
425
429
|
get defaultConfig() {
|
|
426
430
|
return {
|
|
@@ -438,14 +442,14 @@ class $i extends R {
|
|
|
438
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
439
443
|
}
|
|
440
444
|
installGlobalHandlers() {
|
|
441
|
-
!
|
|
445
|
+
!T && typeof document < "u" && typeof $ == "string" && $ && (T = document.createElement("style"), T.id = "tbw-context-menu-styles", T.textContent = $, document.head.appendChild(T)), D || (D = () => {
|
|
442
446
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
443
|
-
}, document.addEventListener("click",
|
|
447
|
+
}, document.addEventListener("click", D)), F || (F = (e) => {
|
|
444
448
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
445
|
-
}, document.addEventListener("keydown",
|
|
449
|
+
}, document.addEventListener("keydown", F));
|
|
446
450
|
}
|
|
447
451
|
uninstallGlobalHandlers() {
|
|
448
|
-
j--, !(j > 0) && (
|
|
452
|
+
j--, !(j > 0) && (D && (document.removeEventListener("click", D), D = null), F && (document.removeEventListener("keydown", F), F = null), T && (T.remove(), T = null));
|
|
449
453
|
}
|
|
450
454
|
afterRender() {
|
|
451
455
|
const e = this.gridElement;
|
|
@@ -521,12 +525,12 @@ class $i extends R {
|
|
|
521
525
|
return this.isOpen;
|
|
522
526
|
}
|
|
523
527
|
}
|
|
524
|
-
const
|
|
525
|
-
function
|
|
528
|
+
const dt = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
|
|
529
|
+
function ct(s) {
|
|
526
530
|
const e = s.options;
|
|
527
531
|
return e ? typeof e == "function" ? e() : e : [];
|
|
528
532
|
}
|
|
529
|
-
function
|
|
533
|
+
function ut(s) {
|
|
530
534
|
return (e) => {
|
|
531
535
|
const t = s.editorParams, i = document.createElement("input");
|
|
532
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);
|
|
@@ -536,13 +540,13 @@ function ct(s) {
|
|
|
536
540
|
}), i;
|
|
537
541
|
};
|
|
538
542
|
}
|
|
539
|
-
function
|
|
543
|
+
function ht() {
|
|
540
544
|
return (s) => {
|
|
541
545
|
const e = document.createElement("input");
|
|
542
546
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
543
547
|
};
|
|
544
548
|
}
|
|
545
|
-
function
|
|
549
|
+
function ft(s) {
|
|
546
550
|
return (e) => {
|
|
547
551
|
const t = s.editorParams, i = document.createElement("input");
|
|
548
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) => {
|
|
@@ -550,14 +554,14 @@ function ht(s) {
|
|
|
550
554
|
}), i;
|
|
551
555
|
};
|
|
552
556
|
}
|
|
553
|
-
function
|
|
557
|
+
function gt(s) {
|
|
554
558
|
return (e) => {
|
|
555
559
|
const t = s.editorParams, i = document.createElement("select");
|
|
556
560
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
557
561
|
const o = document.createElement("option");
|
|
558
562
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
559
563
|
}
|
|
560
|
-
|
|
564
|
+
ct(s).forEach((o) => {
|
|
561
565
|
const a = document.createElement("option");
|
|
562
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);
|
|
563
567
|
});
|
|
@@ -573,7 +577,7 @@ function ft(s) {
|
|
|
573
577
|
}), i;
|
|
574
578
|
};
|
|
575
579
|
}
|
|
576
|
-
function
|
|
580
|
+
function pt(s) {
|
|
577
581
|
return (e) => {
|
|
578
582
|
const t = s.editorParams, i = document.createElement("input");
|
|
579
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) => {
|
|
@@ -581,22 +585,22 @@ function gt(s) {
|
|
|
581
585
|
}), i;
|
|
582
586
|
};
|
|
583
587
|
}
|
|
584
|
-
function
|
|
588
|
+
function mt(s) {
|
|
585
589
|
switch (s.type) {
|
|
586
590
|
case "number":
|
|
587
|
-
return
|
|
591
|
+
return ut(s);
|
|
588
592
|
case "boolean":
|
|
589
|
-
return
|
|
593
|
+
return ht();
|
|
590
594
|
case "date":
|
|
591
|
-
return ht(s);
|
|
592
|
-
case "select":
|
|
593
595
|
return ft(s);
|
|
594
|
-
|
|
596
|
+
case "select":
|
|
595
597
|
return gt(s);
|
|
598
|
+
default:
|
|
599
|
+
return pt(s);
|
|
596
600
|
}
|
|
597
601
|
}
|
|
598
602
|
const Y = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
599
|
-
function
|
|
603
|
+
function wt(s, e) {
|
|
600
604
|
if (e.editor) return e.editor;
|
|
601
605
|
if (e.__editorTemplate) return "template";
|
|
602
606
|
if (!e.type) return;
|
|
@@ -613,11 +617,11 @@ function mt(s, e) {
|
|
|
613
617
|
function K(s) {
|
|
614
618
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
615
619
|
}
|
|
616
|
-
function
|
|
620
|
+
function bt(s) {
|
|
617
621
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
618
622
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
619
623
|
}
|
|
620
|
-
function
|
|
624
|
+
function vt(s) {
|
|
621
625
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
622
626
|
}
|
|
623
627
|
function N(s, e) {
|
|
@@ -625,13 +629,13 @@ function N(s, e) {
|
|
|
625
629
|
}
|
|
626
630
|
function be(s) {
|
|
627
631
|
}
|
|
628
|
-
function
|
|
632
|
+
function yt(s, e, t) {
|
|
629
633
|
const i = s.querySelector("input,textarea,select");
|
|
630
634
|
i && (i.addEventListener("blur", () => {
|
|
631
635
|
t(N(i, e));
|
|
632
636
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(N(i, e))));
|
|
633
637
|
}
|
|
634
|
-
class
|
|
638
|
+
class Xi extends R {
|
|
635
639
|
static manifest = {
|
|
636
640
|
ownedProperties: [
|
|
637
641
|
{
|
|
@@ -653,7 +657,7 @@ class ji extends R {
|
|
|
653
657
|
]
|
|
654
658
|
};
|
|
655
659
|
name = "editing";
|
|
656
|
-
styles =
|
|
660
|
+
styles = dt;
|
|
657
661
|
get defaultConfig() {
|
|
658
662
|
return {
|
|
659
663
|
editOn: "click"
|
|
@@ -902,13 +906,13 @@ class ji extends R {
|
|
|
902
906
|
changed: l,
|
|
903
907
|
changedRows: this.changedRows,
|
|
904
908
|
changedRowIds: this.changedRowIds
|
|
905
|
-
});
|
|
909
|
+
}), l && this.isAnimationEnabled && i.animateRow?.(e, "change");
|
|
906
910
|
}
|
|
907
911
|
this.#o.delete(e), this.#e = -1, this.#t = -1, this.#l();
|
|
908
912
|
for (const l of this.#n)
|
|
909
913
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
910
914
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
911
|
-
l.classList.remove("editing"),
|
|
915
|
+
l.classList.remove("editing"), vt(l.parentElement);
|
|
912
916
|
}), this.requestRender()), this.#s = !0, o || (this.#h(i), this.#s = !1);
|
|
913
917
|
}
|
|
914
918
|
#u(e, t, i, n) {
|
|
@@ -937,7 +941,7 @@ class ji extends R {
|
|
|
937
941
|
})) return;
|
|
938
942
|
n[r] = i, l && this.#i.add(l), this.#l();
|
|
939
943
|
const h = a.findRenderedRowElement?.(e);
|
|
940
|
-
h && h.classList.add("changed");
|
|
944
|
+
h && (h.classList.add("changed"), Ye(h, "change"));
|
|
941
945
|
}
|
|
942
946
|
#p(e, t, i, n, r, o) {
|
|
943
947
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -949,7 +953,7 @@ class ji extends R {
|
|
|
949
953
|
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : be, d = K(i.field) ? e[i.field] : void 0;
|
|
950
954
|
r.classList.add("editing"), this.#n.add(`${t}:${n}`);
|
|
951
955
|
const c = r.parentElement;
|
|
952
|
-
c &&
|
|
956
|
+
c && bt(c);
|
|
953
957
|
let u = !1;
|
|
954
958
|
const h = (v) => {
|
|
955
959
|
u || this.#e === -1 || this.#u(t, i, v, e);
|
|
@@ -959,7 +963,7 @@ class ji extends R {
|
|
|
959
963
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
|
|
960
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));
|
|
961
965
|
});
|
|
962
|
-
const p = i, m = p.__editorTemplate, w =
|
|
966
|
+
const p = i, m = p.__editorTemplate, w = wt(this.grid, p) ?? mt(i), b = d;
|
|
963
967
|
if (w === "template" && m)
|
|
964
968
|
this.#a(g, p, e, d, h, f, o, t);
|
|
965
969
|
else if (typeof w == "string") {
|
|
@@ -978,7 +982,7 @@ class ji extends R {
|
|
|
978
982
|
cancel: f,
|
|
979
983
|
updateRow: l
|
|
980
984
|
}, S = w(v);
|
|
981
|
-
typeof S == "string" ? (g.innerHTML = S,
|
|
985
|
+
typeof S == "string" ? (g.innerHTML = S, yt(g, i, h)) : S instanceof Node && g.appendChild(S), o || queueMicrotask(() => {
|
|
982
986
|
g.querySelector(Y)?.focus({ preventScroll: !0 });
|
|
983
987
|
});
|
|
984
988
|
} else if (w && typeof w == "object") {
|
|
@@ -1063,7 +1067,7 @@ function ve(s, e = !0) {
|
|
|
1063
1067
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1064
1068
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1065
1069
|
}
|
|
1066
|
-
function
|
|
1070
|
+
function Ct(s, e, t, i = {}) {
|
|
1067
1071
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1068
1072
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1069
1073
|
if (t.includeHeaders !== !1) {
|
|
@@ -1093,7 +1097,7 @@ function xt(s, e) {
|
|
|
1093
1097
|
function ye(s) {
|
|
1094
1098
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1095
1099
|
}
|
|
1096
|
-
function
|
|
1100
|
+
function Rt(s, e, t) {
|
|
1097
1101
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1098
1102
|
<?mso-application progid="Excel.Sheet"?>
|
|
1099
1103
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1125,13 +1129,13 @@ function Ct(s, e, t) {
|
|
|
1125
1129
|
</Worksheet>
|
|
1126
1130
|
</Workbook>`, i;
|
|
1127
1131
|
}
|
|
1128
|
-
function
|
|
1132
|
+
function Et(s, e) {
|
|
1129
1133
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1130
1134
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1131
1135
|
});
|
|
1132
1136
|
se(i, t);
|
|
1133
1137
|
}
|
|
1134
|
-
class
|
|
1138
|
+
class Zi extends R {
|
|
1135
1139
|
name = "export";
|
|
1136
1140
|
get defaultConfig() {
|
|
1137
1141
|
return {
|
|
@@ -1168,13 +1172,13 @@ class Ui extends R {
|
|
|
1168
1172
|
try {
|
|
1169
1173
|
switch (e) {
|
|
1170
1174
|
case "csv": {
|
|
1171
|
-
const l =
|
|
1175
|
+
const l = Ct(o, r, n, { bom: !0 });
|
|
1172
1176
|
a = a.endsWith(".csv") ? a : `${a}.csv`, xt(l, a);
|
|
1173
1177
|
break;
|
|
1174
1178
|
}
|
|
1175
1179
|
case "excel": {
|
|
1176
|
-
const l =
|
|
1177
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1180
|
+
const l = Rt(o, r, n);
|
|
1181
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, Et(l, a);
|
|
1178
1182
|
break;
|
|
1179
1183
|
}
|
|
1180
1184
|
case "json": {
|
|
@@ -1225,7 +1229,7 @@ class Ui extends R {
|
|
|
1225
1229
|
return this.lastExportInfo;
|
|
1226
1230
|
}
|
|
1227
1231
|
}
|
|
1228
|
-
function
|
|
1232
|
+
function St(s) {
|
|
1229
1233
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1230
1234
|
let a = Math.floor(i / n) - r;
|
|
1231
1235
|
a < 0 && (a = 0);
|
|
@@ -1237,10 +1241,10 @@ function Et(s) {
|
|
|
1237
1241
|
totalHeight: e * n
|
|
1238
1242
|
};
|
|
1239
1243
|
}
|
|
1240
|
-
function
|
|
1244
|
+
function kt(s, e) {
|
|
1241
1245
|
return s <= e;
|
|
1242
1246
|
}
|
|
1243
|
-
function
|
|
1247
|
+
function At(s, e, t = !1) {
|
|
1244
1248
|
const i = s[e.field];
|
|
1245
1249
|
if (e.operator === "blank")
|
|
1246
1250
|
return i == null || i === "";
|
|
@@ -1279,10 +1283,10 @@ function kt(s, e, t = !1) {
|
|
|
1279
1283
|
return !0;
|
|
1280
1284
|
}
|
|
1281
1285
|
}
|
|
1282
|
-
function
|
|
1283
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1286
|
+
function _t(s, e, t = !1) {
|
|
1287
|
+
return e.length ? s.filter((i) => e.every((n) => At(i, n, t))) : s;
|
|
1284
1288
|
}
|
|
1285
|
-
function
|
|
1289
|
+
function Lt(s) {
|
|
1286
1290
|
return JSON.stringify(
|
|
1287
1291
|
s.map((e) => ({
|
|
1288
1292
|
field: e.field,
|
|
@@ -1292,7 +1296,7 @@ function _t(s) {
|
|
|
1292
1296
|
}))
|
|
1293
1297
|
);
|
|
1294
1298
|
}
|
|
1295
|
-
function
|
|
1299
|
+
function Ce(s, e) {
|
|
1296
1300
|
const t = /* @__PURE__ */ new Set();
|
|
1297
1301
|
for (const i of s) {
|
|
1298
1302
|
const n = i[e];
|
|
@@ -1300,10 +1304,10 @@ function xe(s, e) {
|
|
|
1300
1304
|
}
|
|
1301
1305
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1302
1306
|
}
|
|
1303
|
-
const
|
|
1307
|
+
const Tt = '@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:inline-flex;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;color:inherit;vertical-align:middle;&:hover,&.active{opacity:1}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}}}', It = "@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-button-padding, .375rem .625rem);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}.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-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)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;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)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}}";
|
|
1304
1308
|
class A extends R {
|
|
1305
1309
|
name = "filtering";
|
|
1306
|
-
styles =
|
|
1310
|
+
styles = Tt;
|
|
1307
1311
|
get defaultConfig() {
|
|
1308
1312
|
return {
|
|
1309
1313
|
debounceMs: 300,
|
|
@@ -1339,10 +1343,10 @@ class A extends R {
|
|
|
1339
1343
|
if (!t.length) return [...e];
|
|
1340
1344
|
if (this.config.filterHandler)
|
|
1341
1345
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1342
|
-
const i =
|
|
1346
|
+
const i = Lt(t);
|
|
1343
1347
|
if (this.cacheKey === i && this.cachedResult)
|
|
1344
1348
|
return this.cachedResult;
|
|
1345
|
-
const n =
|
|
1349
|
+
const n = _t([...e], t, this.config.caseSensitive);
|
|
1346
1350
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1347
1351
|
}
|
|
1348
1352
|
afterRender() {
|
|
@@ -1352,7 +1356,7 @@ class A extends R {
|
|
|
1352
1356
|
const n = i.getAttribute("data-col");
|
|
1353
1357
|
if (n === null) return;
|
|
1354
1358
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1355
|
-
if (!r || r.filterable === !1 ||
|
|
1359
|
+
if (!r || r.filterable === !1 || I(r)) return;
|
|
1356
1360
|
const o = r.field;
|
|
1357
1361
|
if (!o) return;
|
|
1358
1362
|
const a = this.filters.has(o);
|
|
@@ -1414,7 +1418,7 @@ class A extends R {
|
|
|
1414
1418
|
return this.getFilters();
|
|
1415
1419
|
}
|
|
1416
1420
|
getUniqueValues(e) {
|
|
1417
|
-
return
|
|
1421
|
+
return Ce(this.sourceRows, e);
|
|
1418
1422
|
}
|
|
1419
1423
|
injectGlobalStyles() {
|
|
1420
1424
|
if (this.globalStylesInjected) return;
|
|
@@ -1423,7 +1427,7 @@ class A extends R {
|
|
|
1423
1427
|
return;
|
|
1424
1428
|
}
|
|
1425
1429
|
const e = document.createElement("style");
|
|
1426
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1430
|
+
e.id = "tbw-filter-panel-styles", e.textContent = It, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1427
1431
|
}
|
|
1428
1432
|
toggleFilterPanel(e, t, i) {
|
|
1429
1433
|
if (this.openPanelField === e) {
|
|
@@ -1438,7 +1442,7 @@ class A extends R {
|
|
|
1438
1442
|
});
|
|
1439
1443
|
return;
|
|
1440
1444
|
}
|
|
1441
|
-
const r =
|
|
1445
|
+
const r = Ce(this.sourceRows, e);
|
|
1442
1446
|
this.renderPanelContent(e, t, n, r), document.body.appendChild(n), this.positionPanel(n, i), this.setupPanelCloseHandler(n, i);
|
|
1443
1447
|
}
|
|
1444
1448
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1512,7 +1516,7 @@ class A extends R {
|
|
|
1512
1516
|
const u = document.createElement("span");
|
|
1513
1517
|
u.textContent = "Select All", d.appendChild(c), d.appendChild(u), l.appendChild(d);
|
|
1514
1518
|
const h = () => {
|
|
1515
|
-
const y = [...m.values()], E = y.every((
|
|
1519
|
+
const y = [...m.values()], E = y.every((C) => C), _ = y.every((C) => !C);
|
|
1516
1520
|
c.checked = E, c.indeterminate = !E && !_;
|
|
1517
1521
|
};
|
|
1518
1522
|
c.addEventListener("change", () => {
|
|
@@ -1534,41 +1538,41 @@ class A extends R {
|
|
|
1534
1538
|
}), h();
|
|
1535
1539
|
let w = [];
|
|
1536
1540
|
const b = (y, E) => {
|
|
1537
|
-
const _ = y == null ? "(Blank)" : String(y),
|
|
1538
|
-
|
|
1541
|
+
const _ = y == null ? "(Blank)" : String(y), C = y == null ? "__null__" : String(y), x = document.createElement("label");
|
|
1542
|
+
x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `${E * A.LIST_ITEM_HEIGHT}px`, x.style.left = "0", x.style.right = "0", x.style.height = `${A.LIST_ITEM_HEIGHT}px`, x.style.boxSizing = "border-box";
|
|
1539
1543
|
const k = document.createElement("input");
|
|
1540
|
-
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = m.get(
|
|
1541
|
-
m.set(
|
|
1544
|
+
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = m.get(C) ?? !0, k.dataset.value = C, k.addEventListener("change", () => {
|
|
1545
|
+
m.set(C, k.checked), h();
|
|
1542
1546
|
});
|
|
1543
1547
|
const le = document.createElement("span");
|
|
1544
|
-
return le.textContent = _,
|
|
1548
|
+
return le.textContent = _, x.appendChild(k), x.appendChild(le), x;
|
|
1545
1549
|
}, v = () => {
|
|
1546
1550
|
const y = w.length, E = f.clientHeight, _ = f.scrollTop;
|
|
1547
|
-
if (g.style.height = `${y * A.LIST_ITEM_HEIGHT}px`,
|
|
1548
|
-
p.innerHTML = "", p.style.transform = "translateY(0px)", w.forEach((
|
|
1549
|
-
p.appendChild(b(
|
|
1551
|
+
if (g.style.height = `${y * A.LIST_ITEM_HEIGHT}px`, kt(y, A.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1552
|
+
p.innerHTML = "", p.style.transform = "translateY(0px)", w.forEach((x, k) => {
|
|
1553
|
+
p.appendChild(b(x, k));
|
|
1550
1554
|
});
|
|
1551
1555
|
return;
|
|
1552
1556
|
}
|
|
1553
|
-
const
|
|
1557
|
+
const C = St({
|
|
1554
1558
|
totalRows: y,
|
|
1555
1559
|
viewportHeight: E,
|
|
1556
1560
|
scrollTop: _,
|
|
1557
1561
|
rowHeight: A.LIST_ITEM_HEIGHT,
|
|
1558
1562
|
overscan: A.LIST_OVERSCAN
|
|
1559
1563
|
});
|
|
1560
|
-
p.style.transform = `translateY(${
|
|
1561
|
-
for (let
|
|
1562
|
-
p.appendChild(b(w[
|
|
1564
|
+
p.style.transform = `translateY(${C.offsetY}px)`, p.innerHTML = "";
|
|
1565
|
+
for (let x = C.start; x < C.end; x++)
|
|
1566
|
+
p.appendChild(b(w[x], x - C.start));
|
|
1563
1567
|
}, S = (y) => {
|
|
1564
1568
|
const E = this.config.caseSensitive ?? !1, _ = E ? y : y.toLowerCase();
|
|
1565
|
-
if (w = i.filter((
|
|
1566
|
-
const
|
|
1569
|
+
if (w = i.filter((C) => {
|
|
1570
|
+
const x = C == null ? "(Blank)" : String(C), k = E ? x : x.toLowerCase();
|
|
1567
1571
|
return !y || k.includes(_);
|
|
1568
1572
|
}), w.length === 0) {
|
|
1569
1573
|
g.style.height = "0px", p.innerHTML = "";
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1574
|
+
const C = document.createElement("div");
|
|
1575
|
+
C.className = "tbw-filter-no-match", C.textContent = "No matching values", p.appendChild(C);
|
|
1572
1576
|
return;
|
|
1573
1577
|
}
|
|
1574
1578
|
v();
|
|
@@ -1586,25 +1590,25 @@ class A extends R {
|
|
|
1586
1590
|
this.searchText.set(r, a.value), S(a.value);
|
|
1587
1591
|
}, this.config.debounceMs ?? 150);
|
|
1588
1592
|
});
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1593
|
+
const z = document.createElement("div");
|
|
1594
|
+
z.className = "tbw-filter-buttons";
|
|
1595
|
+
const G = document.createElement("button");
|
|
1596
|
+
G.className = "tbw-filter-apply-btn", G.textContent = "Apply", G.addEventListener("click", () => {
|
|
1593
1597
|
const y = [];
|
|
1594
1598
|
for (const [E, _] of m)
|
|
1595
1599
|
if (!_)
|
|
1596
1600
|
if (E === "__null__")
|
|
1597
1601
|
y.push(null);
|
|
1598
1602
|
else {
|
|
1599
|
-
const
|
|
1600
|
-
y.push(
|
|
1603
|
+
const C = i.find((x) => String(x) === E);
|
|
1604
|
+
y.push(C !== void 0 ? C : E);
|
|
1601
1605
|
}
|
|
1602
1606
|
t.applySetFilter(y);
|
|
1603
|
-
}),
|
|
1607
|
+
}), z.appendChild(G);
|
|
1604
1608
|
const O = document.createElement("button");
|
|
1605
1609
|
O.className = "tbw-filter-clear-btn", O.textContent = "Clear Filter", O.addEventListener("click", () => {
|
|
1606
1610
|
t.clearFilter();
|
|
1607
|
-
}),
|
|
1611
|
+
}), z.appendChild(O), e.appendChild(z);
|
|
1608
1612
|
}
|
|
1609
1613
|
applySetFilter(e, t) {
|
|
1610
1614
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -1670,7 +1674,7 @@ class A extends R {
|
|
|
1670
1674
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1671
1675
|
}
|
|
1672
1676
|
}
|
|
1673
|
-
function
|
|
1677
|
+
function xe(s) {
|
|
1674
1678
|
if (!s.length) return [];
|
|
1675
1679
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1676
1680
|
if (!a.length) return;
|
|
@@ -1705,7 +1709,7 @@ function Ce(s) {
|
|
|
1705
1709
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1706
1710
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1707
1711
|
}
|
|
1708
|
-
function
|
|
1712
|
+
function Dt(s, e, t) {
|
|
1709
1713
|
if (!e.length || !s) return;
|
|
1710
1714
|
const i = /* @__PURE__ */ new Map();
|
|
1711
1715
|
for (const r of e)
|
|
@@ -1733,11 +1737,11 @@ function Ft(s, e) {
|
|
|
1733
1737
|
}
|
|
1734
1738
|
return t;
|
|
1735
1739
|
}
|
|
1736
|
-
function
|
|
1740
|
+
function Mt(s) {
|
|
1737
1741
|
return s.some((e) => e.group != null);
|
|
1738
1742
|
}
|
|
1739
|
-
const
|
|
1740
|
-
class
|
|
1743
|
+
const Pt = "@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)}}";
|
|
1744
|
+
class Ji extends R {
|
|
1741
1745
|
static manifest = {
|
|
1742
1746
|
ownedProperties: [
|
|
1743
1747
|
{
|
|
@@ -1754,7 +1758,7 @@ class Yi extends R {
|
|
|
1754
1758
|
]
|
|
1755
1759
|
};
|
|
1756
1760
|
name = "groupingColumns";
|
|
1757
|
-
styles =
|
|
1761
|
+
styles = Pt;
|
|
1758
1762
|
get defaultConfig() {
|
|
1759
1763
|
return {
|
|
1760
1764
|
showGroupBorders: !0
|
|
@@ -1769,7 +1773,7 @@ class Yi extends R {
|
|
|
1769
1773
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1770
1774
|
return !0;
|
|
1771
1775
|
const i = t?.columns;
|
|
1772
|
-
return Array.isArray(i) ?
|
|
1776
|
+
return Array.isArray(i) ? Mt(i) : !1;
|
|
1773
1777
|
}
|
|
1774
1778
|
processColumns(e) {
|
|
1775
1779
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -1785,7 +1789,7 @@ class Yi extends R {
|
|
|
1785
1789
|
});
|
|
1786
1790
|
} else
|
|
1787
1791
|
i = [...e];
|
|
1788
|
-
const n =
|
|
1792
|
+
const n = xe(i);
|
|
1789
1793
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
1790
1794
|
}
|
|
1791
1795
|
afterRender() {
|
|
@@ -1798,7 +1802,7 @@ class Yi extends R {
|
|
|
1798
1802
|
if (!e) return;
|
|
1799
1803
|
const t = e.querySelector(".header-group-row");
|
|
1800
1804
|
t && t.remove();
|
|
1801
|
-
const i = this.columns, n =
|
|
1805
|
+
const i = this.columns, n = xe(i);
|
|
1802
1806
|
if (n.length === 0) return;
|
|
1803
1807
|
const r = Ft(n, i);
|
|
1804
1808
|
if (r) {
|
|
@@ -1807,7 +1811,7 @@ class Yi extends R {
|
|
|
1807
1811
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
1808
1812
|
}
|
|
1809
1813
|
const o = e.querySelector(".header-row");
|
|
1810
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
1814
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Dt(o, n)), this.#e(n);
|
|
1811
1815
|
}
|
|
1812
1816
|
#e(e) {
|
|
1813
1817
|
if (!this.config.showGroupBorders) return;
|
|
@@ -1838,7 +1842,7 @@ class Yi extends R {
|
|
|
1838
1842
|
this.requestRender();
|
|
1839
1843
|
}
|
|
1840
1844
|
}
|
|
1841
|
-
function
|
|
1845
|
+
function qt({ rows: s, config: e, expanded: t }) {
|
|
1842
1846
|
const i = e.groupOn;
|
|
1843
1847
|
if (typeof i != "function")
|
|
1844
1848
|
return [];
|
|
@@ -1871,24 +1875,24 @@ function Mt({ rows: s, config: e, expanded: t }) {
|
|
|
1871
1875
|
};
|
|
1872
1876
|
return o(n), r;
|
|
1873
1877
|
}
|
|
1874
|
-
function
|
|
1878
|
+
function Kt(s, e) {
|
|
1875
1879
|
const t = new Set(s);
|
|
1876
1880
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
1877
1881
|
}
|
|
1878
|
-
function
|
|
1882
|
+
function Ht(s) {
|
|
1879
1883
|
const e = /* @__PURE__ */ new Set();
|
|
1880
1884
|
for (const t of s)
|
|
1881
1885
|
t.kind === "group" && e.add(t.key);
|
|
1882
1886
|
return e;
|
|
1883
1887
|
}
|
|
1884
|
-
function
|
|
1888
|
+
function Nt() {
|
|
1885
1889
|
return /* @__PURE__ */ new Set();
|
|
1886
1890
|
}
|
|
1887
|
-
function
|
|
1891
|
+
function zt(s) {
|
|
1888
1892
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
1889
1893
|
}
|
|
1890
1894
|
const Gt = "@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}}}";
|
|
1891
|
-
class
|
|
1895
|
+
class Qi extends R {
|
|
1892
1896
|
name = "groupingRows";
|
|
1893
1897
|
styles = Gt;
|
|
1894
1898
|
get defaultConfig() {
|
|
@@ -1918,7 +1922,7 @@ class Xi extends R {
|
|
|
1918
1922
|
const t = this.config;
|
|
1919
1923
|
if (typeof t.groupOn != "function")
|
|
1920
1924
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1921
|
-
const i =
|
|
1925
|
+
const i = qt({
|
|
1922
1926
|
rows: [...e],
|
|
1923
1927
|
config: t,
|
|
1924
1928
|
expanded: this.expandedKeys
|
|
@@ -1939,7 +1943,7 @@ class Xi extends R {
|
|
|
1939
1943
|
__groupDepth: r.depth,
|
|
1940
1944
|
__groupRows: r.rows,
|
|
1941
1945
|
__groupExpanded: r.expanded,
|
|
1942
|
-
__groupRowCount:
|
|
1946
|
+
__groupRowCount: zt(r)
|
|
1943
1947
|
} : r.row);
|
|
1944
1948
|
}
|
|
1945
1949
|
onCellClick(e) {
|
|
@@ -2042,13 +2046,13 @@ class Xi extends R {
|
|
|
2042
2046
|
});
|
|
2043
2047
|
}
|
|
2044
2048
|
expandAll() {
|
|
2045
|
-
this.expandedKeys =
|
|
2049
|
+
this.expandedKeys = Ht(this.flattenedRows), this.requestRender();
|
|
2046
2050
|
}
|
|
2047
2051
|
collapseAll() {
|
|
2048
|
-
this.expandedKeys =
|
|
2052
|
+
this.expandedKeys = Nt(), this.requestRender();
|
|
2049
2053
|
}
|
|
2050
2054
|
toggle(e) {
|
|
2051
|
-
this.expandedKeys =
|
|
2055
|
+
this.expandedKeys = Kt(this.expandedKeys, e);
|
|
2052
2056
|
const t = this.flattenedRows.find((i) => i.kind === "group" && i.key === e);
|
|
2053
2057
|
this.emit("group-toggle", {
|
|
2054
2058
|
key: e,
|
|
@@ -2101,18 +2105,18 @@ function Re(s, e) {
|
|
|
2101
2105
|
const t = new Set(s);
|
|
2102
2106
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2103
2107
|
}
|
|
2104
|
-
function
|
|
2108
|
+
function Ot(s, e) {
|
|
2105
2109
|
const t = new Set(s);
|
|
2106
2110
|
return t.add(e), t;
|
|
2107
2111
|
}
|
|
2108
|
-
function
|
|
2112
|
+
function Bt(s, e) {
|
|
2109
2113
|
const t = new Set(s);
|
|
2110
2114
|
return t.delete(e), t;
|
|
2111
2115
|
}
|
|
2112
|
-
function
|
|
2116
|
+
function Vt(s, e) {
|
|
2113
2117
|
return s.has(e);
|
|
2114
2118
|
}
|
|
2115
|
-
function
|
|
2119
|
+
function Wt(s, e, t, i) {
|
|
2116
2120
|
const n = document.createElement("div");
|
|
2117
2121
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2118
2122
|
const r = document.createElement("div");
|
|
@@ -2120,16 +2124,15 @@ function Vt(s, e, t, i) {
|
|
|
2120
2124
|
const o = t(s, e);
|
|
2121
2125
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2122
2126
|
}
|
|
2123
|
-
const
|
|
2127
|
+
const $t = "@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}}}";
|
|
2124
2128
|
class Be extends R {
|
|
2125
2129
|
name = "masterDetail";
|
|
2126
|
-
styles =
|
|
2130
|
+
styles = $t;
|
|
2127
2131
|
get defaultConfig() {
|
|
2128
2132
|
return {
|
|
2129
2133
|
detailHeight: "auto",
|
|
2130
2134
|
expandOnRowClick: !1,
|
|
2131
2135
|
collapseOnClickOutside: !1,
|
|
2132
|
-
showExpandColumn: !0,
|
|
2133
2136
|
animation: "slide"
|
|
2134
2137
|
};
|
|
2135
2138
|
}
|
|
@@ -2153,8 +2156,8 @@ class Be extends R {
|
|
|
2153
2156
|
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));
|
|
2154
2157
|
const c = t.innerHTML.trim();
|
|
2155
2158
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2156
|
-
const f =
|
|
2157
|
-
return
|
|
2159
|
+
const f = Xe(c, { value: u, row: u });
|
|
2160
|
+
return Ze(f);
|
|
2158
2161
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2159
2162
|
}
|
|
2160
2163
|
get animationStyle() {
|
|
@@ -2198,18 +2201,18 @@ class Be extends R {
|
|
|
2198
2201
|
this.expandedRows.clear(), this.detailElements.clear();
|
|
2199
2202
|
}
|
|
2200
2203
|
processColumns(e) {
|
|
2201
|
-
if (!this.config.
|
|
2204
|
+
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2202
2205
|
return [...e];
|
|
2203
|
-
const
|
|
2204
|
-
if (
|
|
2205
|
-
return
|
|
2206
|
-
const
|
|
2207
|
-
return
|
|
2208
|
-
const { row:
|
|
2209
|
-
|
|
2210
|
-
const
|
|
2211
|
-
return
|
|
2212
|
-
}, [
|
|
2206
|
+
const i = [...e];
|
|
2207
|
+
if (tt(i))
|
|
2208
|
+
return i;
|
|
2209
|
+
const r = it(this.name);
|
|
2210
|
+
return r.viewRenderer = (o) => {
|
|
2211
|
+
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2212
|
+
d.className = "master-detail-expander expander-cell";
|
|
2213
|
+
const c = document.createElement("span");
|
|
2214
|
+
return c.className = `master-detail-toggle${l ? " expanded" : ""}`, this.setIcon(c, this.resolveIcon(l ? "collapse" : "expand")), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-expanded", String(l)), c.setAttribute("aria-label", l ? "Collapse details" : "Expand details"), d.appendChild(c), d;
|
|
2215
|
+
}, [r, ...i];
|
|
2213
2216
|
}
|
|
2214
2217
|
onRowClick(e) {
|
|
2215
2218
|
if (!(!this.config.expandOnRowClick || !this.config.detailRenderer))
|
|
@@ -2256,7 +2259,7 @@ class Be extends R {
|
|
|
2256
2259
|
d.previousElementSibling !== a && a.after(d);
|
|
2257
2260
|
continue;
|
|
2258
2261
|
}
|
|
2259
|
-
const c =
|
|
2262
|
+
const c = Wt(l, o, this.config.detailRenderer, n);
|
|
2260
2263
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2261
2264
|
}
|
|
2262
2265
|
}
|
|
@@ -2291,11 +2294,11 @@ class Be extends R {
|
|
|
2291
2294
|
}
|
|
2292
2295
|
expand(e) {
|
|
2293
2296
|
const t = this.rows[e];
|
|
2294
|
-
t && (this.expandedRows =
|
|
2297
|
+
t && (this.expandedRows = Ot(this.expandedRows, t), this.requestRender());
|
|
2295
2298
|
}
|
|
2296
2299
|
collapse(e) {
|
|
2297
2300
|
const t = this.rows[e];
|
|
2298
|
-
t && (this.expandedRows =
|
|
2301
|
+
t && (this.expandedRows = Bt(this.expandedRows, t), this.requestRender());
|
|
2299
2302
|
}
|
|
2300
2303
|
toggle(e) {
|
|
2301
2304
|
const t = this.rows[e];
|
|
@@ -2303,7 +2306,7 @@ class Be extends R {
|
|
|
2303
2306
|
}
|
|
2304
2307
|
isExpanded(e) {
|
|
2305
2308
|
const t = this.rows[e];
|
|
2306
|
-
return t ?
|
|
2309
|
+
return t ? Vt(this.expandedRows, t) : !1;
|
|
2307
2310
|
}
|
|
2308
2311
|
expandAll() {
|
|
2309
2312
|
for (const e of this.rows)
|
|
@@ -2333,20 +2336,20 @@ class Be extends R {
|
|
|
2333
2336
|
}
|
|
2334
2337
|
}
|
|
2335
2338
|
}
|
|
2336
|
-
function
|
|
2339
|
+
function jt(s, e, t) {
|
|
2337
2340
|
return e.length ? [...s].sort((i, n) => {
|
|
2338
2341
|
for (const r of e) {
|
|
2339
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2342
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? Ut, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2340
2343
|
if (c !== 0)
|
|
2341
2344
|
return r.direction === "asc" ? c : -c;
|
|
2342
2345
|
}
|
|
2343
2346
|
return 0;
|
|
2344
2347
|
}) : [...s];
|
|
2345
2348
|
}
|
|
2346
|
-
function
|
|
2349
|
+
function Ut(s, e) {
|
|
2347
2350
|
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));
|
|
2348
2351
|
}
|
|
2349
|
-
function
|
|
2352
|
+
function Yt(s, e, t, i) {
|
|
2350
2353
|
const n = s.find((r) => r.field === e);
|
|
2351
2354
|
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" }];
|
|
2352
2355
|
}
|
|
@@ -2357,10 +2360,10 @@ function Ee(s, e) {
|
|
|
2357
2360
|
function Se(s, e) {
|
|
2358
2361
|
return s.find((t) => t.field === e)?.direction;
|
|
2359
2362
|
}
|
|
2360
|
-
const
|
|
2361
|
-
class
|
|
2363
|
+
const Xt = '@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}}';
|
|
2364
|
+
class en extends R {
|
|
2362
2365
|
name = "multiSort";
|
|
2363
|
-
styles =
|
|
2366
|
+
styles = Xt;
|
|
2364
2367
|
get defaultConfig() {
|
|
2365
2368
|
return {
|
|
2366
2369
|
maxSortColumns: 3,
|
|
@@ -2372,12 +2375,12 @@ class Zi extends R {
|
|
|
2372
2375
|
this.sortModel = [];
|
|
2373
2376
|
}
|
|
2374
2377
|
processRows(e) {
|
|
2375
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2378
|
+
return this.sortModel.length === 0 ? [...e] : jt([...e], this.sortModel, [...this.columns]);
|
|
2376
2379
|
}
|
|
2377
2380
|
onHeaderClick(e) {
|
|
2378
2381
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2379
2382
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2380
|
-
return this.sortModel =
|
|
2383
|
+
return this.sortModel = Yt(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2381
2384
|
}
|
|
2382
2385
|
afterRender() {
|
|
2383
2386
|
const e = this.gridElement;
|
|
@@ -2436,10 +2439,10 @@ class Zi extends R {
|
|
|
2436
2439
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2437
2440
|
}
|
|
2438
2441
|
}
|
|
2439
|
-
function
|
|
2442
|
+
function Zt(s) {
|
|
2440
2443
|
return s.filter((e) => e.sticky === "left");
|
|
2441
2444
|
}
|
|
2442
|
-
function
|
|
2445
|
+
function Jt(s) {
|
|
2443
2446
|
return s.filter((e) => e.sticky === "right");
|
|
2444
2447
|
}
|
|
2445
2448
|
function X(s) {
|
|
@@ -2474,7 +2477,7 @@ function Ae(s) {
|
|
|
2474
2477
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2475
2478
|
});
|
|
2476
2479
|
}
|
|
2477
|
-
class
|
|
2480
|
+
class tn extends R {
|
|
2478
2481
|
static manifest = {
|
|
2479
2482
|
ownedProperties: [
|
|
2480
2483
|
{
|
|
@@ -2516,7 +2519,7 @@ class Ji extends R {
|
|
|
2516
2519
|
}
|
|
2517
2520
|
onPluginQuery(e) {
|
|
2518
2521
|
switch (e.type) {
|
|
2519
|
-
case
|
|
2522
|
+
case Ge.CAN_MOVE_COLUMN: {
|
|
2520
2523
|
const t = e.context, i = t.sticky;
|
|
2521
2524
|
if (i === "left" || i === "right")
|
|
2522
2525
|
return !1;
|
|
@@ -2533,11 +2536,11 @@ class Ji extends R {
|
|
|
2533
2536
|
}
|
|
2534
2537
|
getLeftPinnedColumns() {
|
|
2535
2538
|
const e = [...this.columns];
|
|
2536
|
-
return
|
|
2539
|
+
return Zt(e);
|
|
2537
2540
|
}
|
|
2538
2541
|
getRightPinnedColumns() {
|
|
2539
2542
|
const e = [...this.columns];
|
|
2540
|
-
return
|
|
2543
|
+
return Jt(e);
|
|
2541
2544
|
}
|
|
2542
2545
|
clearStickyPositions() {
|
|
2543
2546
|
Ae(this.grid);
|
|
@@ -2561,7 +2564,7 @@ class Ji extends R {
|
|
|
2561
2564
|
return { left: i, right: n, skipScroll: r };
|
|
2562
2565
|
}
|
|
2563
2566
|
}
|
|
2564
|
-
function
|
|
2567
|
+
function Qt(s) {
|
|
2565
2568
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2566
2569
|
}
|
|
2567
2570
|
function Z(s, e) {
|
|
@@ -2586,7 +2589,7 @@ function Z(s, e) {
|
|
|
2586
2589
|
}
|
|
2587
2590
|
if (s.customPanels)
|
|
2588
2591
|
for (const o of s.customPanels) {
|
|
2589
|
-
const a =
|
|
2592
|
+
const a = ei(o, e);
|
|
2590
2593
|
switch (o.position) {
|
|
2591
2594
|
case "left":
|
|
2592
2595
|
i.appendChild(a);
|
|
@@ -2619,7 +2622,7 @@ function Le(s, e, t, i) {
|
|
|
2619
2622
|
let l, d;
|
|
2620
2623
|
const c = n.aggregators?.[o.field];
|
|
2621
2624
|
if (c)
|
|
2622
|
-
if (
|
|
2625
|
+
if (Qt(c)) {
|
|
2623
2626
|
const u = ce(c.aggFunc);
|
|
2624
2627
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2625
2628
|
} else {
|
|
@@ -2635,7 +2638,7 @@ function Le(s, e, t, i) {
|
|
|
2635
2638
|
s.appendChild(r);
|
|
2636
2639
|
}
|
|
2637
2640
|
}
|
|
2638
|
-
function
|
|
2641
|
+
function ei(s, e) {
|
|
2639
2642
|
const t = document.createElement("div");
|
|
2640
2643
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2641
2644
|
const i = s.render(e);
|
|
@@ -2651,10 +2654,10 @@ function Te(s, e, t, i, n) {
|
|
|
2651
2654
|
grid: t
|
|
2652
2655
|
};
|
|
2653
2656
|
}
|
|
2654
|
-
const
|
|
2655
|
-
class
|
|
2657
|
+
const ti = "@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}}";
|
|
2658
|
+
class nn extends R {
|
|
2656
2659
|
name = "pinnedRows";
|
|
2657
|
-
styles =
|
|
2660
|
+
styles = ti;
|
|
2658
2661
|
get defaultConfig() {
|
|
2659
2662
|
return {
|
|
2660
2663
|
position: "bottom",
|
|
@@ -2758,16 +2761,16 @@ class Qi extends R {
|
|
|
2758
2761
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
2759
2762
|
}
|
|
2760
2763
|
}
|
|
2761
|
-
const
|
|
2762
|
-
function
|
|
2764
|
+
const ii = Je;
|
|
2765
|
+
function ni(s) {
|
|
2763
2766
|
const e = [];
|
|
2764
2767
|
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;
|
|
2765
2768
|
}
|
|
2766
2769
|
function ae(s, e) {
|
|
2767
2770
|
return [...s, e].join("|");
|
|
2768
2771
|
}
|
|
2769
|
-
function
|
|
2770
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
2772
|
+
function ri(s, e) {
|
|
2773
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = oi(s, i), o = Ve(
|
|
2771
2774
|
s,
|
|
2772
2775
|
t,
|
|
2773
2776
|
i,
|
|
@@ -2775,7 +2778,7 @@ function ni(s, e) {
|
|
|
2775
2778
|
n,
|
|
2776
2779
|
0,
|
|
2777
2780
|
""
|
|
2778
|
-
), a =
|
|
2781
|
+
), a = ai(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
2779
2782
|
return {
|
|
2780
2783
|
rows: o,
|
|
2781
2784
|
columnKeys: r,
|
|
@@ -2783,7 +2786,7 @@ function ni(s, e) {
|
|
|
2783
2786
|
grandTotal: l
|
|
2784
2787
|
};
|
|
2785
2788
|
}
|
|
2786
|
-
function
|
|
2789
|
+
function oi(s, e) {
|
|
2787
2790
|
if (e.length === 0) return ["value"];
|
|
2788
2791
|
const t = /* @__PURE__ */ new Set();
|
|
2789
2792
|
for (const i of s) {
|
|
@@ -2792,7 +2795,7 @@ function ri(s, e) {
|
|
|
2792
2795
|
}
|
|
2793
2796
|
return [...t].sort();
|
|
2794
2797
|
}
|
|
2795
|
-
function
|
|
2798
|
+
function si(s, e) {
|
|
2796
2799
|
const t = /* @__PURE__ */ new Map();
|
|
2797
2800
|
for (const i of s) {
|
|
2798
2801
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -2803,7 +2806,7 @@ function oi(s, e) {
|
|
|
2803
2806
|
function Ve(s, e, t, i, n, r, o) {
|
|
2804
2807
|
const a = [];
|
|
2805
2808
|
if (e.length === 0) {
|
|
2806
|
-
const h = Ie(s, t, i, n), f =
|
|
2809
|
+
const h = Ie(s, t, i, n), f = De(h);
|
|
2807
2810
|
return a.push({
|
|
2808
2811
|
rowKey: o || "all",
|
|
2809
2812
|
rowLabel: o || "All",
|
|
@@ -2814,9 +2817,9 @@ function Ve(s, e, t, i, n, r, o) {
|
|
|
2814
2817
|
rowCount: s.length
|
|
2815
2818
|
}), a;
|
|
2816
2819
|
}
|
|
2817
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
2820
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = si(s, l);
|
|
2818
2821
|
for (const [h, f] of u) {
|
|
2819
|
-
const g = o ? `${o}|${h}` : h, p = Ie(f, t, i, n), m =
|
|
2822
|
+
const g = o ? `${o}|${h}` : h, p = Ie(f, t, i, n), m = De(p);
|
|
2820
2823
|
let w;
|
|
2821
2824
|
c && (w = Ve(
|
|
2822
2825
|
f,
|
|
@@ -2843,18 +2846,18 @@ function Ie(s, e, t, i) {
|
|
|
2843
2846
|
const n = {};
|
|
2844
2847
|
for (const r of t)
|
|
2845
2848
|
for (const o of i) {
|
|
2846
|
-
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 =
|
|
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 = ii(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ae([r], o.field);
|
|
2847
2850
|
n[u] = c;
|
|
2848
2851
|
}
|
|
2849
2852
|
return n;
|
|
2850
2853
|
}
|
|
2851
|
-
function
|
|
2854
|
+
function De(s) {
|
|
2852
2855
|
let e = 0;
|
|
2853
2856
|
for (const t of Object.values(s))
|
|
2854
2857
|
e += t ?? 0;
|
|
2855
2858
|
return e;
|
|
2856
2859
|
}
|
|
2857
|
-
function
|
|
2860
|
+
function ai(s, e, t) {
|
|
2858
2861
|
const i = {};
|
|
2859
2862
|
function n(r) {
|
|
2860
2863
|
for (const o of r)
|
|
@@ -2868,7 +2871,7 @@ function si(s, e, t) {
|
|
|
2868
2871
|
}
|
|
2869
2872
|
return n(s), i;
|
|
2870
2873
|
}
|
|
2871
|
-
function
|
|
2874
|
+
function li(s, e, t = !0) {
|
|
2872
2875
|
const i = [];
|
|
2873
2876
|
function n(r) {
|
|
2874
2877
|
i.push(r);
|
|
@@ -2881,7 +2884,7 @@ function ai(s, e, t = !0) {
|
|
|
2881
2884
|
n(r);
|
|
2882
2885
|
return i;
|
|
2883
2886
|
}
|
|
2884
|
-
function
|
|
2887
|
+
function di(s) {
|
|
2885
2888
|
const e = [];
|
|
2886
2889
|
function t(i) {
|
|
2887
2890
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -2892,10 +2895,10 @@ function li(s) {
|
|
|
2892
2895
|
t(i);
|
|
2893
2896
|
return e;
|
|
2894
2897
|
}
|
|
2895
|
-
const
|
|
2896
|
-
function
|
|
2898
|
+
const ci = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
2899
|
+
function ui(s, e, t, i) {
|
|
2897
2900
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
2898
|
-
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () =>
|
|
2901
|
+
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => mi(t, r))), o.appendChild(H("Row Groups", () => Fe("rowGroups", r))), o.appendChild(H("Column Groups", () => Fe("columnGroups", r))), o.appendChild(H("Values", () => fi(r))), o.appendChild(H("Available Fields", () => pi(r))), s.appendChild(o), () => {
|
|
2899
2902
|
n.abort(), o.remove();
|
|
2900
2903
|
};
|
|
2901
2904
|
}
|
|
@@ -2907,7 +2910,7 @@ function H(s, e) {
|
|
|
2907
2910
|
const n = document.createElement("div");
|
|
2908
2911
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
2909
2912
|
}
|
|
2910
|
-
function
|
|
2913
|
+
function Fe(s, e) {
|
|
2911
2914
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
2912
2915
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
2913
2916
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -2916,7 +2919,7 @@ function Pe(s, e) {
|
|
|
2916
2919
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
2917
2920
|
} else
|
|
2918
2921
|
for (const a of o)
|
|
2919
|
-
r.appendChild(
|
|
2922
|
+
r.appendChild(hi(a, s, e));
|
|
2920
2923
|
return r.addEventListener(
|
|
2921
2924
|
"dragover",
|
|
2922
2925
|
(a) => {
|
|
@@ -2939,7 +2942,7 @@ function Pe(s, e) {
|
|
|
2939
2942
|
{ signal: n }
|
|
2940
2943
|
), r;
|
|
2941
2944
|
}
|
|
2942
|
-
function
|
|
2945
|
+
function hi(s, e, t) {
|
|
2943
2946
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
2944
2947
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
2945
2948
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -2965,7 +2968,7 @@ function ui(s, e, t) {
|
|
|
2965
2968
|
{ signal: n }
|
|
2966
2969
|
), r;
|
|
2967
2970
|
}
|
|
2968
|
-
function
|
|
2971
|
+
function fi(s) {
|
|
2969
2972
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
2970
2973
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
2971
2974
|
const r = e.valueFields ?? [];
|
|
@@ -2974,7 +2977,7 @@ function hi(s) {
|
|
|
2974
2977
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
2975
2978
|
} else
|
|
2976
2979
|
for (const o of r)
|
|
2977
|
-
n.appendChild(
|
|
2980
|
+
n.appendChild(gi(o, s));
|
|
2978
2981
|
return n.addEventListener(
|
|
2979
2982
|
"dragover",
|
|
2980
2983
|
(o) => {
|
|
@@ -2997,7 +3000,7 @@ function hi(s) {
|
|
|
2997
3000
|
{ signal: i }
|
|
2998
3001
|
), n;
|
|
2999
3002
|
}
|
|
3000
|
-
function
|
|
3003
|
+
function gi(s, e) {
|
|
3001
3004
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3002
3005
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3003
3006
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3006,7 +3009,7 @@ function fi(s, e) {
|
|
|
3006
3009
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3007
3010
|
const l = document.createElement("select");
|
|
3008
3011
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3009
|
-
for (const c of
|
|
3012
|
+
for (const c of ci) {
|
|
3010
3013
|
const u = document.createElement("option");
|
|
3011
3014
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3012
3015
|
}
|
|
@@ -3026,7 +3029,7 @@ function fi(s, e) {
|
|
|
3026
3029
|
{ signal: i }
|
|
3027
3030
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3028
3031
|
}
|
|
3029
|
-
function
|
|
3032
|
+
function pi(s) {
|
|
3030
3033
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3031
3034
|
n.className = "tbw-pivot-available-fields";
|
|
3032
3035
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3056,7 +3059,7 @@ function gi(s) {
|
|
|
3056
3059
|
}
|
|
3057
3060
|
return n;
|
|
3058
3061
|
}
|
|
3059
|
-
function
|
|
3062
|
+
function mi(s, e) {
|
|
3060
3063
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3061
3064
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3062
3065
|
J(
|
|
@@ -3095,7 +3098,7 @@ function J(s, e, t, i) {
|
|
|
3095
3098
|
const o = document.createElement("span");
|
|
3096
3099
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3097
3100
|
}
|
|
3098
|
-
function
|
|
3101
|
+
function wi(s, e, t) {
|
|
3099
3102
|
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) => {
|
|
3100
3103
|
const r = document.createElement("div");
|
|
3101
3104
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3116,7 +3119,7 @@ function mi(s, e, t) {
|
|
|
3116
3119
|
e.appendChild(r);
|
|
3117
3120
|
}), !0;
|
|
3118
3121
|
}
|
|
3119
|
-
function
|
|
3122
|
+
function bi(s, e, t, i) {
|
|
3120
3123
|
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) => {
|
|
3121
3124
|
const o = document.createElement("div");
|
|
3122
3125
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3131,7 +3134,7 @@ function wi(s, e, t, i) {
|
|
|
3131
3134
|
e.appendChild(o);
|
|
3132
3135
|
}), !0;
|
|
3133
3136
|
}
|
|
3134
|
-
function
|
|
3137
|
+
function vi(s, e, t) {
|
|
3135
3138
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3136
3139
|
const r = document.createElement("div");
|
|
3137
3140
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3144,10 +3147,10 @@ function bi(s, e, t) {
|
|
|
3144
3147
|
e.appendChild(r);
|
|
3145
3148
|
}), !0;
|
|
3146
3149
|
}
|
|
3147
|
-
const
|
|
3148
|
-
class
|
|
3150
|
+
const yi = '@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}}}';
|
|
3151
|
+
class M extends R {
|
|
3149
3152
|
name = "pivot";
|
|
3150
|
-
styles =
|
|
3153
|
+
styles = yi;
|
|
3151
3154
|
static PANEL_ID = "pivot";
|
|
3152
3155
|
get defaultConfig() {
|
|
3153
3156
|
return {
|
|
@@ -3181,7 +3184,7 @@ class D extends R {
|
|
|
3181
3184
|
getToolPanel() {
|
|
3182
3185
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3183
3186
|
return {
|
|
3184
|
-
id:
|
|
3187
|
+
id: M.PANEL_ID,
|
|
3185
3188
|
title: "Pivot",
|
|
3186
3189
|
icon: "⊞",
|
|
3187
3190
|
tooltip: "Configure pivot table",
|
|
@@ -3192,11 +3195,11 @@ class D extends R {
|
|
|
3192
3195
|
processRows(e) {
|
|
3193
3196
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3194
3197
|
return [...e];
|
|
3195
|
-
const t =
|
|
3198
|
+
const t = ni(this.config);
|
|
3196
3199
|
if (t.length > 0)
|
|
3197
3200
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3198
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult =
|
|
3199
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3201
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = ri(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
|
|
3202
|
+
const i = this.config.indentWidth ?? 20, n = li(
|
|
3200
3203
|
this.pivotResult.rows,
|
|
3201
3204
|
this.expandedKeys,
|
|
3202
3205
|
this.defaultExpanded
|
|
@@ -3248,13 +3251,13 @@ class D extends R {
|
|
|
3248
3251
|
}
|
|
3249
3252
|
renderRow(e, t, i) {
|
|
3250
3253
|
const n = e;
|
|
3251
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3254
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? wi(n, t, {
|
|
3252
3255
|
columns: this.gridColumns,
|
|
3253
3256
|
rowIndex: i,
|
|
3254
3257
|
onToggle: (r) => this.toggle(r),
|
|
3255
3258
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3256
3259
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3257
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3260
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? bi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3258
3261
|
}
|
|
3259
3262
|
cleanupPivotStyling(e) {
|
|
3260
3263
|
(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 = "");
|
|
@@ -3292,7 +3295,7 @@ class D extends R {
|
|
|
3292
3295
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3293
3296
|
...this.pivotResult.totals
|
|
3294
3297
|
};
|
|
3295
|
-
|
|
3298
|
+
vi(i, this.grandTotalFooter, this.gridColumns);
|
|
3296
3299
|
}
|
|
3297
3300
|
cleanupGrandTotalFooter() {
|
|
3298
3301
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3314,7 +3317,7 @@ class D extends R {
|
|
|
3314
3317
|
}
|
|
3315
3318
|
expandAllKeys() {
|
|
3316
3319
|
if (!this.pivotResult) return;
|
|
3317
|
-
const e =
|
|
3320
|
+
const e = di(this.pivotResult.rows);
|
|
3318
3321
|
for (const t of e)
|
|
3319
3322
|
this.expandedKeys.add(t);
|
|
3320
3323
|
}
|
|
@@ -3346,16 +3349,16 @@ class D extends R {
|
|
|
3346
3349
|
this.pivotResult = null, this.requestRender();
|
|
3347
3350
|
}
|
|
3348
3351
|
showPanel() {
|
|
3349
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3352
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(M.PANEL_ID) || this.grid.toggleToolPanelSection(M.PANEL_ID);
|
|
3350
3353
|
}
|
|
3351
3354
|
hidePanel() {
|
|
3352
3355
|
this.grid.closeToolPanel();
|
|
3353
3356
|
}
|
|
3354
3357
|
togglePanel() {
|
|
3355
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3358
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(M.PANEL_ID);
|
|
3356
3359
|
}
|
|
3357
3360
|
isPanelVisible() {
|
|
3358
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3361
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(M.PANEL_ID);
|
|
3359
3362
|
}
|
|
3360
3363
|
get gridColumns() {
|
|
3361
3364
|
return this.grid.columns ?? [];
|
|
@@ -3399,7 +3402,7 @@ class D extends R {
|
|
|
3399
3402
|
},
|
|
3400
3403
|
getAvailableFields: () => this.getAvailableFields()
|
|
3401
3404
|
};
|
|
3402
|
-
return
|
|
3405
|
+
return ui(e, this.config, this.isActive, t);
|
|
3403
3406
|
}
|
|
3404
3407
|
refreshPanel() {
|
|
3405
3408
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3432,17 +3435,17 @@ class D extends R {
|
|
|
3432
3435
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3433
3436
|
}
|
|
3434
3437
|
}
|
|
3435
|
-
function
|
|
3438
|
+
function Ci(s) {
|
|
3436
3439
|
const e = s.meta ?? {};
|
|
3437
3440
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3438
3441
|
}
|
|
3439
|
-
function
|
|
3442
|
+
function Me(s, e, t) {
|
|
3440
3443
|
if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
|
|
3441
3444
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3442
3445
|
return i.splice(t, 0, n), i;
|
|
3443
3446
|
}
|
|
3444
3447
|
const xi = '@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}}';
|
|
3445
|
-
class
|
|
3448
|
+
class rn extends R {
|
|
3446
3449
|
name = "reorder";
|
|
3447
3450
|
styles = xi;
|
|
3448
3451
|
get defaultConfig() {
|
|
@@ -3461,8 +3464,8 @@ class en extends R {
|
|
|
3461
3464
|
draggedIndex = null;
|
|
3462
3465
|
dropIndex = null;
|
|
3463
3466
|
canMoveColumnWithPlugins(e) {
|
|
3464
|
-
return !e || !
|
|
3465
|
-
type:
|
|
3467
|
+
return !e || !Ci(e) ? !1 : !this.grid.queryPlugins({
|
|
3468
|
+
type: Ge.CAN_MOVE_COLUMN,
|
|
3466
3469
|
context: e
|
|
3467
3470
|
}).includes(!1);
|
|
3468
3471
|
}
|
|
@@ -3511,7 +3514,7 @@ class en extends R {
|
|
|
3511
3514
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
3512
3515
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
3513
3516
|
return;
|
|
3514
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f =
|
|
3517
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = Me(h, d, u), g = {
|
|
3515
3518
|
field: l,
|
|
3516
3519
|
fromIndex: d,
|
|
3517
3520
|
toIndex: u,
|
|
@@ -3534,7 +3537,7 @@ class en extends R {
|
|
|
3534
3537
|
if (l < 0 || l >= o.length) return;
|
|
3535
3538
|
const d = n.find((c) => c.field === o[l]);
|
|
3536
3539
|
if (this.canMoveColumnWithPlugins(d))
|
|
3537
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
3540
|
+
return this.moveColumn(r.field, l), t._focusCol = l, L(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
3538
3541
|
}
|
|
3539
3542
|
getColumnOrder() {
|
|
3540
3543
|
return this.grid.getColumnOrder();
|
|
@@ -3542,7 +3545,7 @@ class en extends R {
|
|
|
3542
3545
|
moveColumn(e, t) {
|
|
3543
3546
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
3544
3547
|
if (n === -1) return;
|
|
3545
|
-
const r =
|
|
3548
|
+
const r = Me(i, n, t);
|
|
3546
3549
|
this.emitCancelable("column-move", {
|
|
3547
3550
|
field: e,
|
|
3548
3551
|
fromIndex: n,
|
|
@@ -3637,11 +3640,11 @@ class en extends R {
|
|
|
3637
3640
|
this.grid.requestStateChange?.();
|
|
3638
3641
|
}
|
|
3639
3642
|
}
|
|
3640
|
-
const
|
|
3641
|
-
class
|
|
3643
|
+
const Ri = '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}}';
|
|
3644
|
+
class on extends R {
|
|
3642
3645
|
name = "responsive";
|
|
3643
3646
|
version = "1.0.0";
|
|
3644
|
-
styles =
|
|
3647
|
+
styles = Ri;
|
|
3645
3648
|
static manifest = {
|
|
3646
3649
|
incompatibleWith: [
|
|
3647
3650
|
{
|
|
@@ -3772,23 +3775,23 @@ class tn extends R {
|
|
|
3772
3775
|
switch (e.key) {
|
|
3773
3776
|
case "ArrowDown":
|
|
3774
3777
|
if (this.grid._focusCol < i)
|
|
3775
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
3778
|
+
return this.grid._focusCol += 1, e.preventDefault(), L(this.grid), !0;
|
|
3776
3779
|
if (this.grid._focusRow < t)
|
|
3777
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
3780
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), L(this.grid), !0;
|
|
3778
3781
|
break;
|
|
3779
3782
|
case "ArrowUp":
|
|
3780
3783
|
if (this.grid._focusCol > 0)
|
|
3781
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
3784
|
+
return this.grid._focusCol -= 1, e.preventDefault(), L(this.grid), !0;
|
|
3782
3785
|
if (this.grid._focusRow > 0)
|
|
3783
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
3786
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), L(this.grid), !0;
|
|
3784
3787
|
break;
|
|
3785
3788
|
case "ArrowRight":
|
|
3786
3789
|
if (this.grid._focusRow < t)
|
|
3787
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
3790
|
+
return this.grid._focusRow += 1, e.preventDefault(), L(this.grid), !0;
|
|
3788
3791
|
break;
|
|
3789
3792
|
case "ArrowLeft":
|
|
3790
3793
|
if (this.grid._focusRow > 0)
|
|
3791
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
3794
|
+
return this.grid._focusRow -= 1, e.preventDefault(), L(this.grid), !0;
|
|
3792
3795
|
break;
|
|
3793
3796
|
}
|
|
3794
3797
|
return !1;
|
|
@@ -3811,7 +3814,7 @@ class tn extends R {
|
|
|
3811
3814
|
return !0;
|
|
3812
3815
|
return !1;
|
|
3813
3816
|
}
|
|
3814
|
-
#
|
|
3817
|
+
#C() {
|
|
3815
3818
|
let e = 0, t = 0;
|
|
3816
3819
|
for (const i of this.rows)
|
|
3817
3820
|
i.__isGroupRow ? e++ : t++;
|
|
@@ -3820,7 +3823,7 @@ class tn extends R {
|
|
|
3820
3823
|
getExtraHeight() {
|
|
3821
3824
|
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
3822
3825
|
return 0;
|
|
3823
|
-
const e = this.#a ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#
|
|
3826
|
+
const e = this.#a ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
|
|
3824
3827
|
return o + a;
|
|
3825
3828
|
}
|
|
3826
3829
|
getExtraHeightBefore(e) {
|
|
@@ -3833,7 +3836,7 @@ class tn extends R {
|
|
|
3833
3836
|
d[u].__isGroupRow ? a++ : l++;
|
|
3834
3837
|
return a * r + l * o;
|
|
3835
3838
|
}
|
|
3836
|
-
#
|
|
3839
|
+
#x() {
|
|
3837
3840
|
let e = 0;
|
|
3838
3841
|
for (const t of this.rows)
|
|
3839
3842
|
t.__isGroupRow || e++;
|
|
@@ -3844,7 +3847,7 @@ class tn extends R {
|
|
|
3844
3847
|
if (!this.#t || !this.config.cardRenderer)
|
|
3845
3848
|
return;
|
|
3846
3849
|
let e = !1;
|
|
3847
|
-
const t = this.grid, i = this.#w(), n = this.#
|
|
3850
|
+
const t = this.grid, i = this.#w(), n = this.#x();
|
|
3848
3851
|
if (n !== this.#m && (this.#m = n, e = !0), i) {
|
|
3849
3852
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
3850
3853
|
if (o) {
|
|
@@ -3862,6 +3865,174 @@ class tn extends R {
|
|
|
3862
3865
|
}));
|
|
3863
3866
|
}
|
|
3864
3867
|
}
|
|
3868
|
+
const Ei = '.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}', Si = "__tbw_row_drag";
|
|
3869
|
+
class sn extends R {
|
|
3870
|
+
name = "rowReorder";
|
|
3871
|
+
styles = Ei;
|
|
3872
|
+
get defaultConfig() {
|
|
3873
|
+
return {
|
|
3874
|
+
enableKeyboard: !0,
|
|
3875
|
+
showDragHandle: !0,
|
|
3876
|
+
dragHandlePosition: "left",
|
|
3877
|
+
dragHandleWidth: 40,
|
|
3878
|
+
debounceMs: 150,
|
|
3879
|
+
animation: "flip"
|
|
3880
|
+
};
|
|
3881
|
+
}
|
|
3882
|
+
isDragging = !1;
|
|
3883
|
+
draggedRowIndex = null;
|
|
3884
|
+
dropRowIndex = null;
|
|
3885
|
+
pendingMove = null;
|
|
3886
|
+
debounceTimer = null;
|
|
3887
|
+
lastFocusCol = 0;
|
|
3888
|
+
detach() {
|
|
3889
|
+
this.clearDebounceTimer(), this.isDragging = !1, this.draggedRowIndex = null, this.dropRowIndex = null, this.pendingMove = null;
|
|
3890
|
+
}
|
|
3891
|
+
processColumns(e) {
|
|
3892
|
+
if (!this.config.showDragHandle)
|
|
3893
|
+
return [...e];
|
|
3894
|
+
const t = {
|
|
3895
|
+
field: Si,
|
|
3896
|
+
header: "",
|
|
3897
|
+
width: this.config.dragHandleWidth ?? 40,
|
|
3898
|
+
resizable: !1,
|
|
3899
|
+
sortable: !1,
|
|
3900
|
+
filterable: !1,
|
|
3901
|
+
meta: {
|
|
3902
|
+
lockPosition: !0,
|
|
3903
|
+
suppressMovable: !0,
|
|
3904
|
+
utility: !0
|
|
3905
|
+
},
|
|
3906
|
+
viewRenderer: () => {
|
|
3907
|
+
const i = document.createElement("div");
|
|
3908
|
+
return i.className = "dg-row-drag-handle", i.setAttribute("aria-label", "Drag to reorder"), i.setAttribute("role", "button"), i.setAttribute("tabindex", "-1"), i.draggable = !0, this.setIcon(i, this.resolveIcon("dragHandle")), i;
|
|
3909
|
+
}
|
|
3910
|
+
};
|
|
3911
|
+
return this.config.dragHandlePosition === "right" ? [...e, t] : [t, ...e];
|
|
3912
|
+
}
|
|
3913
|
+
afterRender() {
|
|
3914
|
+
if (!this.config.showDragHandle) return;
|
|
3915
|
+
const e = this.gridElement;
|
|
3916
|
+
if (!e) return;
|
|
3917
|
+
e.querySelectorAll(".dg-row-drag-handle").forEach((n) => {
|
|
3918
|
+
const r = n;
|
|
3919
|
+
if (r.getAttribute("data-drag-bound")) return;
|
|
3920
|
+
r.setAttribute("data-drag-bound", "true");
|
|
3921
|
+
const o = r.closest(".data-grid-row");
|
|
3922
|
+
o && this.setupHandleDragListeners(r, o);
|
|
3923
|
+
}), e.querySelectorAll(".data-grid-row").forEach((n) => {
|
|
3924
|
+
const r = n;
|
|
3925
|
+
r.getAttribute("data-drop-bound") || (r.setAttribute("data-drop-bound", "true"), this.setupRowDropListeners(r));
|
|
3926
|
+
});
|
|
3927
|
+
}
|
|
3928
|
+
onKeyDown(e) {
|
|
3929
|
+
if (!this.config.enableKeyboard || !e.ctrlKey || e.key !== "ArrowUp" && e.key !== "ArrowDown")
|
|
3930
|
+
return;
|
|
3931
|
+
const t = this.grid, i = t._focusRow, n = t._rows ?? this.sourceRows;
|
|
3932
|
+
if (i < 0 || i >= n.length) return;
|
|
3933
|
+
const r = e.key === "ArrowUp" ? "up" : "down", o = r === "up" ? i - 1 : i + 1;
|
|
3934
|
+
if (o < 0 || o >= n.length) return;
|
|
3935
|
+
const a = n[i];
|
|
3936
|
+
if (!(this.config.canMove && !this.config.canMove(a, i, o, r)))
|
|
3937
|
+
return this.handleKeyboardMove(a, i, o, r, t._focusCol), e.preventDefault(), e.stopPropagation(), !0;
|
|
3938
|
+
}
|
|
3939
|
+
onCellClick() {
|
|
3940
|
+
this.flushPendingMove();
|
|
3941
|
+
}
|
|
3942
|
+
moveRow(e, t) {
|
|
3943
|
+
const i = [...this.sourceRows];
|
|
3944
|
+
if (e < 0 || e >= i.length || t < 0 || t >= i.length || e === t) return;
|
|
3945
|
+
const n = t < e ? "up" : "down", r = i[e];
|
|
3946
|
+
this.config.canMove && !this.config.canMove(r, e, t, n) || this.executeMove(r, e, t, "keyboard");
|
|
3947
|
+
}
|
|
3948
|
+
canMoveRow(e, t) {
|
|
3949
|
+
const i = this.sourceRows;
|
|
3950
|
+
if (e < 0 || e >= i.length || t < 0 || t >= i.length || e === t) return !1;
|
|
3951
|
+
if (!this.config.canMove) return !0;
|
|
3952
|
+
const n = t < e ? "up" : "down";
|
|
3953
|
+
return this.config.canMove(i[e], e, t, n);
|
|
3954
|
+
}
|
|
3955
|
+
setupHandleDragListeners(e, t) {
|
|
3956
|
+
e.addEventListener("dragstart", (i) => {
|
|
3957
|
+
const n = this.getRowIndex(t);
|
|
3958
|
+
n < 0 || (this.isDragging = !0, this.draggedRowIndex = n, i.dataTransfer && (i.dataTransfer.effectAllowed = "move", i.dataTransfer.setData("text/plain", String(n))), t.classList.add("dragging"));
|
|
3959
|
+
}), e.addEventListener("dragend", () => {
|
|
3960
|
+
this.isDragging = !1, this.draggedRowIndex = null, this.dropRowIndex = null, this.clearDragClasses();
|
|
3961
|
+
});
|
|
3962
|
+
}
|
|
3963
|
+
setupRowDropListeners(e) {
|
|
3964
|
+
e.addEventListener("dragover", (t) => {
|
|
3965
|
+
if (t.preventDefault(), !this.isDragging || this.draggedRowIndex === null) return;
|
|
3966
|
+
const i = this.getRowIndex(e);
|
|
3967
|
+
if (i < 0 || i === this.draggedRowIndex) return;
|
|
3968
|
+
const n = e.getBoundingClientRect(), r = n.top + n.height / 2, o = t.clientY < r;
|
|
3969
|
+
this.dropRowIndex = o ? i : i + 1, e.classList.add("drop-target"), e.classList.toggle("drop-before", o), e.classList.toggle("drop-after", !o);
|
|
3970
|
+
}), e.addEventListener("dragleave", () => {
|
|
3971
|
+
e.classList.remove("drop-target", "drop-before", "drop-after");
|
|
3972
|
+
}), e.addEventListener("drop", (t) => {
|
|
3973
|
+
t.preventDefault();
|
|
3974
|
+
const i = this.draggedRowIndex;
|
|
3975
|
+
let n = this.dropRowIndex;
|
|
3976
|
+
if (!(!this.isDragging || i === null || n === null) && (n > i && n--, i !== n)) {
|
|
3977
|
+
const o = this.sourceRows[i], a = n < i ? "up" : "down";
|
|
3978
|
+
(!this.config.canMove || this.config.canMove(o, i, n, a)) && this.executeMove(o, i, n, "drag");
|
|
3979
|
+
}
|
|
3980
|
+
});
|
|
3981
|
+
}
|
|
3982
|
+
handleKeyboardMove(e, t, i, n, r) {
|
|
3983
|
+
this.pendingMove ? this.pendingMove.currentIndex = i : this.pendingMove = {
|
|
3984
|
+
originalIndex: t,
|
|
3985
|
+
currentIndex: i,
|
|
3986
|
+
row: e
|
|
3987
|
+
}, this.lastFocusCol = r;
|
|
3988
|
+
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), L(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
3990
|
+
this.flushPendingMove();
|
|
3991
|
+
}, this.config.debounceMs ?? 300);
|
|
3992
|
+
}
|
|
3993
|
+
flushPendingMove() {
|
|
3994
|
+
if (this.clearDebounceTimer(), !this.pendingMove) return;
|
|
3995
|
+
const { originalIndex: e, currentIndex: t, row: i } = this.pendingMove;
|
|
3996
|
+
if (this.pendingMove = null, e === t) return;
|
|
3997
|
+
const n = {
|
|
3998
|
+
row: i,
|
|
3999
|
+
fromIndex: e,
|
|
4000
|
+
toIndex: t,
|
|
4001
|
+
rows: [...this.sourceRows],
|
|
4002
|
+
source: "keyboard"
|
|
4003
|
+
};
|
|
4004
|
+
if (this.emitCancelable("row-move", n)) {
|
|
4005
|
+
const o = [...this.sourceRows], [a] = o.splice(t, 1);
|
|
4006
|
+
o.splice(e, 0, a);
|
|
4007
|
+
const l = this.grid;
|
|
4008
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), L(l);
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
executeMove(e, t, i, n) {
|
|
4012
|
+
const r = [...this.sourceRows], [o] = r.splice(t, 1);
|
|
4013
|
+
r.splice(i, 0, o);
|
|
4014
|
+
const a = {
|
|
4015
|
+
row: e,
|
|
4016
|
+
fromIndex: t,
|
|
4017
|
+
toIndex: i,
|
|
4018
|
+
rows: r,
|
|
4019
|
+
source: n
|
|
4020
|
+
};
|
|
4021
|
+
this.emitCancelable("row-move", a) || (this.grid.rows = r);
|
|
4022
|
+
}
|
|
4023
|
+
getRowIndex(e) {
|
|
4024
|
+
const t = e.querySelector(".cell[data-row]");
|
|
4025
|
+
return t ? parseInt(t.getAttribute("data-row") ?? "-1", 10) : -1;
|
|
4026
|
+
}
|
|
4027
|
+
clearDragClasses() {
|
|
4028
|
+
this.gridElement?.querySelectorAll(".data-grid-row").forEach((e) => {
|
|
4029
|
+
e.classList.remove("dragging", "drop-target", "drop-before", "drop-after");
|
|
4030
|
+
});
|
|
4031
|
+
}
|
|
4032
|
+
clearDebounceTimer() {
|
|
4033
|
+
this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
3865
4036
|
function V(s) {
|
|
3866
4037
|
return {
|
|
3867
4038
|
startRow: Math.min(s.startRow, s.endRow),
|
|
@@ -3870,7 +4041,7 @@ function V(s) {
|
|
|
3870
4041
|
endCol: Math.max(s.startCol, s.endCol)
|
|
3871
4042
|
};
|
|
3872
4043
|
}
|
|
3873
|
-
function
|
|
4044
|
+
function ki(s) {
|
|
3874
4045
|
const e = V(s);
|
|
3875
4046
|
return {
|
|
3876
4047
|
from: { row: e.startRow, col: e.startCol },
|
|
@@ -3878,26 +4049,26 @@ function Ri(s) {
|
|
|
3878
4049
|
};
|
|
3879
4050
|
}
|
|
3880
4051
|
function We(s) {
|
|
3881
|
-
return s.map(
|
|
4052
|
+
return s.map(ki);
|
|
3882
4053
|
}
|
|
3883
|
-
function
|
|
4054
|
+
function Ai(s, e, t) {
|
|
3884
4055
|
const i = V(t);
|
|
3885
4056
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
3886
4057
|
}
|
|
3887
|
-
function
|
|
3888
|
-
return t.some((i) =>
|
|
4058
|
+
function Pe(s, e, t) {
|
|
4059
|
+
return t.some((i) => Ai(s, e, i));
|
|
3889
4060
|
}
|
|
3890
|
-
function
|
|
4061
|
+
function _i(s) {
|
|
3891
4062
|
const e = [], t = V(s);
|
|
3892
4063
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
3893
4064
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
3894
4065
|
e.push({ row: i, col: n });
|
|
3895
4066
|
return e;
|
|
3896
4067
|
}
|
|
3897
|
-
function
|
|
4068
|
+
function Li(s) {
|
|
3898
4069
|
const e = /* @__PURE__ */ new Map();
|
|
3899
4070
|
for (const t of s)
|
|
3900
|
-
for (const i of
|
|
4071
|
+
for (const i of _i(t))
|
|
3901
4072
|
e.set(`${i.row},${i.col}`, i);
|
|
3902
4073
|
return [...e.values()];
|
|
3903
4074
|
}
|
|
@@ -3909,8 +4080,8 @@ function Q(s, e) {
|
|
|
3909
4080
|
endCol: e.col
|
|
3910
4081
|
};
|
|
3911
4082
|
}
|
|
3912
|
-
const
|
|
3913
|
-
function
|
|
4083
|
+
const Ti = "@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}}}";
|
|
4084
|
+
function Ii(s, e, t) {
|
|
3914
4085
|
if (s === "cell" && e.selectedCell)
|
|
3915
4086
|
return {
|
|
3916
4087
|
mode: s,
|
|
@@ -3930,7 +4101,7 @@ function _i(s, e, t) {
|
|
|
3930
4101
|
}
|
|
3931
4102
|
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: We(e.ranges) } : { mode: s, ranges: [] };
|
|
3932
4103
|
}
|
|
3933
|
-
class
|
|
4104
|
+
class an extends R {
|
|
3934
4105
|
static manifest = {
|
|
3935
4106
|
configRules: [
|
|
3936
4107
|
{
|
|
@@ -3944,7 +4115,7 @@ class nn extends R {
|
|
|
3944
4115
|
]
|
|
3945
4116
|
};
|
|
3946
4117
|
name = "selection";
|
|
3947
|
-
styles =
|
|
4118
|
+
styles = Ti;
|
|
3948
4119
|
get defaultConfig() {
|
|
3949
4120
|
return {
|
|
3950
4121
|
mode: "cell",
|
|
@@ -3960,6 +4131,20 @@ class nn extends R {
|
|
|
3960
4131
|
isDragging = !1;
|
|
3961
4132
|
pendingKeyboardUpdate = null;
|
|
3962
4133
|
selectedCell = null;
|
|
4134
|
+
checkSelectable(e, t) {
|
|
4135
|
+
const { isSelectable: i } = this.config;
|
|
4136
|
+
if (!i) return !0;
|
|
4137
|
+
const n = this.rows[e];
|
|
4138
|
+
if (!n) return !1;
|
|
4139
|
+
const r = t !== void 0 ? this.columns[t] : void 0;
|
|
4140
|
+
return i(n, e, r, t);
|
|
4141
|
+
}
|
|
4142
|
+
isRowSelectable(e) {
|
|
4143
|
+
return this.checkSelectable(e);
|
|
4144
|
+
}
|
|
4145
|
+
isCellSelectable(e, t) {
|
|
4146
|
+
return this.checkSelectable(e, t);
|
|
4147
|
+
}
|
|
3963
4148
|
detach() {
|
|
3964
4149
|
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
|
|
3965
4150
|
}
|
|
@@ -3967,13 +4152,13 @@ class nn extends R {
|
|
|
3967
4152
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
3968
4153
|
if (n.type !== o)
|
|
3969
4154
|
return !1;
|
|
3970
|
-
const a = this.columns[i], l = a &&
|
|
4155
|
+
const a = this.columns[i], l = a && I(a);
|
|
3971
4156
|
if (r === "cell")
|
|
3972
|
-
return l || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
4157
|
+
return l || !this.isCellSelectable(t, i) || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
3973
4158
|
if (r === "row")
|
|
3974
|
-
return this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
|
|
4159
|
+
return this.isRowSelectable(t) && (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
3975
4160
|
if (r === "range") {
|
|
3976
|
-
if (l)
|
|
4161
|
+
if (l || !this.isCellSelectable(t, i))
|
|
3977
4162
|
return !1;
|
|
3978
4163
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
3979
4164
|
if (d && this.cellAnchor) {
|
|
@@ -4006,11 +4191,13 @@ class nn extends R {
|
|
|
4006
4191
|
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
|
|
4007
4192
|
if (t === "cell" && n)
|
|
4008
4193
|
return queueMicrotask(() => {
|
|
4009
|
-
|
|
4194
|
+
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4195
|
+
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
4010
4196
|
}), !1;
|
|
4011
4197
|
if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
4012
4198
|
return queueMicrotask(() => {
|
|
4013
|
-
|
|
4199
|
+
const r = this.grid._focusRow;
|
|
4200
|
+
this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
4014
4201
|
}), !1;
|
|
4015
4202
|
if (t === "range" && n) {
|
|
4016
4203
|
const r = e.key === "Tab", o = e.shiftKey && !r;
|
|
@@ -4033,7 +4220,7 @@ class nn extends R {
|
|
|
4033
4220
|
onCellMouseDown(e) {
|
|
4034
4221
|
if (this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4035
4222
|
const t = this.columns[e.colIndex];
|
|
4036
|
-
if (t &&
|
|
4223
|
+
if (t && I(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4037
4224
|
return;
|
|
4038
4225
|
this.isDragging = !0;
|
|
4039
4226
|
const i = e.rowIndex, n = e.colIndex;
|
|
@@ -4050,8 +4237,8 @@ class nn extends R {
|
|
|
4050
4237
|
if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4051
4238
|
let t = e.colIndex;
|
|
4052
4239
|
const i = this.columns[t];
|
|
4053
|
-
if (i &&
|
|
4054
|
-
const r = this.columns.findIndex((o) => !
|
|
4240
|
+
if (i && I(i)) {
|
|
4241
|
+
const r = this.columns.findIndex((o) => !I(o));
|
|
4055
4242
|
r >= 0 && (t = r);
|
|
4056
4243
|
}
|
|
4057
4244
|
const n = Q(this.cellAnchor, { row: e.rowIndex, col: t });
|
|
@@ -4064,29 +4251,32 @@ class nn extends R {
|
|
|
4064
4251
|
#e() {
|
|
4065
4252
|
const e = this.gridElement;
|
|
4066
4253
|
if (!e) return;
|
|
4067
|
-
const { mode: t } = this.config;
|
|
4068
|
-
e.querySelectorAll(".cell").forEach((
|
|
4069
|
-
|
|
4254
|
+
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
4255
|
+
e.querySelectorAll(".cell").forEach((o) => {
|
|
4256
|
+
o.classList.remove("selected", "top", "bottom", "first", "last"), i && o.removeAttribute("data-selectable");
|
|
4070
4257
|
});
|
|
4071
|
-
const
|
|
4072
|
-
if (
|
|
4073
|
-
|
|
4074
|
-
}), t === "row" && (ue(e),
|
|
4075
|
-
const
|
|
4076
|
-
|
|
4077
|
-
})), t === "range" &&
|
|
4258
|
+
const r = e.querySelectorAll(".data-grid-row");
|
|
4259
|
+
if (r.forEach((o) => {
|
|
4260
|
+
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4261
|
+
}), t === "row" && (ue(e), r.forEach((o) => {
|
|
4262
|
+
const a = o.querySelector(".cell[data-row]"), l = Qe(a);
|
|
4263
|
+
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4264
|
+
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4265
|
+
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4266
|
+
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4267
|
+
}), t === "range" && this.ranges.length > 0) {
|
|
4078
4268
|
ue(e);
|
|
4079
|
-
const
|
|
4080
|
-
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((
|
|
4081
|
-
const
|
|
4082
|
-
if (
|
|
4083
|
-
const
|
|
4084
|
-
if (
|
|
4269
|
+
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !I(d));
|
|
4270
|
+
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4271
|
+
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4272
|
+
if (c >= 0 && u >= 0) {
|
|
4273
|
+
const h = this.columns[u];
|
|
4274
|
+
if (h && I(h))
|
|
4085
4275
|
return;
|
|
4086
|
-
if (
|
|
4087
|
-
|
|
4088
|
-
const
|
|
4089
|
-
|
|
4276
|
+
if (Pe(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4277
|
+
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4278
|
+
const g = Math.max(o.startCol, a);
|
|
4279
|
+
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
4090
4280
|
}
|
|
4091
4281
|
}
|
|
4092
4282
|
});
|
|
@@ -4119,10 +4309,10 @@ class nn extends R {
|
|
|
4119
4309
|
};
|
|
4120
4310
|
}
|
|
4121
4311
|
getSelectedCells() {
|
|
4122
|
-
return
|
|
4312
|
+
return Li(this.ranges);
|
|
4123
4313
|
}
|
|
4124
4314
|
isCellSelected(e, t) {
|
|
4125
|
-
return
|
|
4315
|
+
return Pe(e, t, this.ranges);
|
|
4126
4316
|
}
|
|
4127
4317
|
clearSelection() {
|
|
4128
4318
|
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();
|
|
@@ -4139,7 +4329,7 @@ class nn extends R {
|
|
|
4139
4329
|
}), this.requestAfterRender();
|
|
4140
4330
|
}
|
|
4141
4331
|
#t() {
|
|
4142
|
-
return
|
|
4332
|
+
return Ii(
|
|
4143
4333
|
this.config.mode,
|
|
4144
4334
|
{
|
|
4145
4335
|
selectedCell: this.selectedCell,
|
|
@@ -4153,20 +4343,20 @@ class nn extends R {
|
|
|
4153
4343
|
function B(s, e) {
|
|
4154
4344
|
return Math.floor(s / e);
|
|
4155
4345
|
}
|
|
4156
|
-
function
|
|
4346
|
+
function Di(s, e) {
|
|
4157
4347
|
return {
|
|
4158
4348
|
start: s * e,
|
|
4159
4349
|
end: (s + 1) * e
|
|
4160
4350
|
};
|
|
4161
4351
|
}
|
|
4162
|
-
function
|
|
4352
|
+
function Fi(s, e, t) {
|
|
4163
4353
|
const i = B(s, t), n = B(e - 1, t), r = [];
|
|
4164
4354
|
for (let o = i; o <= n; o++)
|
|
4165
4355
|
r.push(o);
|
|
4166
4356
|
return r;
|
|
4167
4357
|
}
|
|
4168
4358
|
async function qe(s, e, t, i) {
|
|
4169
|
-
const n =
|
|
4359
|
+
const n = Di(e, t);
|
|
4170
4360
|
return s.getRows({
|
|
4171
4361
|
startRow: n.start,
|
|
4172
4362
|
endRow: n.end,
|
|
@@ -4174,14 +4364,14 @@ async function qe(s, e, t, i) {
|
|
|
4174
4364
|
filterModel: i.filterModel
|
|
4175
4365
|
});
|
|
4176
4366
|
}
|
|
4177
|
-
function
|
|
4367
|
+
function Mi(s, e, t) {
|
|
4178
4368
|
const i = B(s, e), n = t.get(i);
|
|
4179
4369
|
if (!n) return;
|
|
4180
4370
|
const r = s % e;
|
|
4181
4371
|
return n[r];
|
|
4182
4372
|
}
|
|
4183
|
-
const
|
|
4184
|
-
class
|
|
4373
|
+
const Pi = 100;
|
|
4374
|
+
class ln extends R {
|
|
4185
4375
|
name = "serverSide";
|
|
4186
4376
|
get defaultConfig() {
|
|
4187
4377
|
return {
|
|
@@ -4201,7 +4391,7 @@ class rn extends R {
|
|
|
4201
4391
|
}
|
|
4202
4392
|
loadRequiredBlocks() {
|
|
4203
4393
|
if (!this.dataSource) return;
|
|
4204
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4394
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Fi(i.startRow, i.endRow, t);
|
|
4205
4395
|
for (const r of n)
|
|
4206
4396
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4207
4397
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
@@ -4217,7 +4407,7 @@ class rn extends R {
|
|
|
4217
4407
|
if (!this.dataSource) return [...e];
|
|
4218
4408
|
const t = [];
|
|
4219
4409
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
4220
|
-
const n =
|
|
4410
|
+
const n = Mi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
4221
4411
|
t.push(n ?? { __loading: !0, __index: i });
|
|
4222
4412
|
}
|
|
4223
4413
|
return t;
|
|
@@ -4225,7 +4415,7 @@ class rn extends R {
|
|
|
4225
4415
|
onScroll(e) {
|
|
4226
4416
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4227
4417
|
this.loadRequiredBlocks();
|
|
4228
|
-
},
|
|
4418
|
+
}, Pi));
|
|
4229
4419
|
}
|
|
4230
4420
|
setDataSource(e) {
|
|
4231
4421
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
@@ -4270,7 +4460,7 @@ function ne(s, e, t = null, i = 0) {
|
|
|
4270
4460
|
}
|
|
4271
4461
|
return r;
|
|
4272
4462
|
}
|
|
4273
|
-
function
|
|
4463
|
+
function qi() {
|
|
4274
4464
|
return /* @__PURE__ */ new Set();
|
|
4275
4465
|
}
|
|
4276
4466
|
function je(s, e, t, i = null, n = 0) {
|
|
@@ -4288,7 +4478,7 @@ function je(s, e, t, i = null, n = 0) {
|
|
|
4288
4478
|
}
|
|
4289
4479
|
return null;
|
|
4290
4480
|
}
|
|
4291
|
-
function
|
|
4481
|
+
function Ki(s, e, t, i) {
|
|
4292
4482
|
const n = je(s, e, t);
|
|
4293
4483
|
if (!n) return i;
|
|
4294
4484
|
const r = new Set(i);
|
|
@@ -4306,7 +4496,7 @@ function Ke(s, e = "children") {
|
|
|
4306
4496
|
}
|
|
4307
4497
|
return !1;
|
|
4308
4498
|
}
|
|
4309
|
-
function
|
|
4499
|
+
function Hi(s) {
|
|
4310
4500
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
4311
4501
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
4312
4502
|
for (const t of s)
|
|
@@ -4318,10 +4508,10 @@ function Mi(s) {
|
|
|
4318
4508
|
}
|
|
4319
4509
|
return null;
|
|
4320
4510
|
}
|
|
4321
|
-
const
|
|
4322
|
-
class
|
|
4511
|
+
const Ni = "@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}}}";
|
|
4512
|
+
class dn extends R {
|
|
4323
4513
|
name = "tree";
|
|
4324
|
-
styles =
|
|
4514
|
+
styles = Ni;
|
|
4325
4515
|
get defaultConfig() {
|
|
4326
4516
|
return {
|
|
4327
4517
|
childrenField: "children",
|
|
@@ -4347,7 +4537,7 @@ class on extends R {
|
|
|
4347
4537
|
}
|
|
4348
4538
|
detect(e) {
|
|
4349
4539
|
if (!this.config.autoDetect) return !1;
|
|
4350
|
-
const t = e, i = this.config.childrenField ??
|
|
4540
|
+
const t = e, i = this.config.childrenField ?? Hi(t) ?? "children";
|
|
4351
4541
|
return Ke(t, i);
|
|
4352
4542
|
}
|
|
4353
4543
|
processRows(e) {
|
|
@@ -4483,7 +4673,7 @@ class on extends R {
|
|
|
4483
4673
|
this.expandedKeys = ne(this.rows, this.config), this.requestRender();
|
|
4484
4674
|
}
|
|
4485
4675
|
collapseAll() {
|
|
4486
|
-
this.expandedKeys =
|
|
4676
|
+
this.expandedKeys = qi(), this.requestRender();
|
|
4487
4677
|
}
|
|
4488
4678
|
isExpanded(e) {
|
|
4489
4679
|
return this.expandedKeys.has(e);
|
|
@@ -4498,10 +4688,10 @@ class on extends R {
|
|
|
4498
4688
|
return this.rowKeyMap.get(e)?.data;
|
|
4499
4689
|
}
|
|
4500
4690
|
expandToKey(e) {
|
|
4501
|
-
this.expandedKeys =
|
|
4691
|
+
this.expandedKeys = Ki(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
4502
4692
|
}
|
|
4503
4693
|
}
|
|
4504
|
-
function
|
|
4694
|
+
function zi(s, e, t) {
|
|
4505
4695
|
const i = [...s.undoStack, e];
|
|
4506
4696
|
for (; i.length > t; )
|
|
4507
4697
|
i.shift();
|
|
@@ -4534,16 +4724,16 @@ function Ne(s) {
|
|
|
4534
4724
|
action: t
|
|
4535
4725
|
} : { newState: s, action: null };
|
|
4536
4726
|
}
|
|
4537
|
-
function
|
|
4727
|
+
function Gi(s) {
|
|
4538
4728
|
return s.undoStack.length > 0;
|
|
4539
4729
|
}
|
|
4540
|
-
function
|
|
4730
|
+
function Oi(s) {
|
|
4541
4731
|
return s.redoStack.length > 0;
|
|
4542
4732
|
}
|
|
4543
|
-
function
|
|
4733
|
+
function Bi() {
|
|
4544
4734
|
return { undoStack: [], redoStack: [] };
|
|
4545
4735
|
}
|
|
4546
|
-
function
|
|
4736
|
+
function Vi(s, e, t, i) {
|
|
4547
4737
|
return {
|
|
4548
4738
|
type: "cell-edit",
|
|
4549
4739
|
rowIndex: s,
|
|
@@ -4553,7 +4743,7 @@ function zi(s, e, t, i) {
|
|
|
4553
4743
|
timestamp: Date.now()
|
|
4554
4744
|
};
|
|
4555
4745
|
}
|
|
4556
|
-
class
|
|
4746
|
+
class cn extends R {
|
|
4557
4747
|
static dependencies = [
|
|
4558
4748
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
4559
4749
|
];
|
|
@@ -4595,7 +4785,7 @@ class sn extends R {
|
|
|
4595
4785
|
return !1;
|
|
4596
4786
|
}
|
|
4597
4787
|
recordEdit(e, t, i, n) {
|
|
4598
|
-
const r =
|
|
4788
|
+
const r = Vi(e, t, i, n), o = zi(
|
|
4599
4789
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
4600
4790
|
r,
|
|
4601
4791
|
this.config.maxHistorySize ?? 100
|
|
@@ -4619,13 +4809,13 @@ class sn extends R {
|
|
|
4619
4809
|
return e.action;
|
|
4620
4810
|
}
|
|
4621
4811
|
canUndo() {
|
|
4622
|
-
return
|
|
4812
|
+
return Gi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4623
4813
|
}
|
|
4624
4814
|
canRedo() {
|
|
4625
|
-
return
|
|
4815
|
+
return Oi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4626
4816
|
}
|
|
4627
4817
|
clearHistory() {
|
|
4628
|
-
const e =
|
|
4818
|
+
const e = Bi();
|
|
4629
4819
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
4630
4820
|
}
|
|
4631
4821
|
getUndoStack() {
|
|
@@ -4635,18 +4825,18 @@ class sn extends R {
|
|
|
4635
4825
|
return [...this.redoStack];
|
|
4636
4826
|
}
|
|
4637
4827
|
}
|
|
4638
|
-
const
|
|
4639
|
-
function
|
|
4828
|
+
const Wi = '@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))}}';
|
|
4829
|
+
function ze(s) {
|
|
4640
4830
|
const e = s.meta ?? {};
|
|
4641
4831
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4642
4832
|
}
|
|
4643
|
-
class
|
|
4833
|
+
class P extends R {
|
|
4644
4834
|
static dependencies = [
|
|
4645
4835
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
4646
4836
|
];
|
|
4647
4837
|
name = "visibility";
|
|
4648
4838
|
static PANEL_ID = "columns";
|
|
4649
|
-
styles =
|
|
4839
|
+
styles = Wi;
|
|
4650
4840
|
get defaultConfig() {
|
|
4651
4841
|
return {
|
|
4652
4842
|
allowHideAll: !1
|
|
@@ -4667,7 +4857,7 @@ class M extends R {
|
|
|
4667
4857
|
}
|
|
4668
4858
|
getToolPanel() {
|
|
4669
4859
|
return {
|
|
4670
|
-
id:
|
|
4860
|
+
id: P.PANEL_ID,
|
|
4671
4861
|
title: "Columns",
|
|
4672
4862
|
icon: "☰",
|
|
4673
4863
|
tooltip: "Column visibility",
|
|
@@ -4676,13 +4866,13 @@ class M extends R {
|
|
|
4676
4866
|
};
|
|
4677
4867
|
}
|
|
4678
4868
|
show() {
|
|
4679
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
4869
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(P.PANEL_ID) || this.grid.toggleToolPanelSection(P.PANEL_ID);
|
|
4680
4870
|
}
|
|
4681
4871
|
hide() {
|
|
4682
4872
|
this.grid.closeToolPanel();
|
|
4683
4873
|
}
|
|
4684
4874
|
toggle() {
|
|
4685
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
4875
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(P.PANEL_ID);
|
|
4686
4876
|
}
|
|
4687
4877
|
isColumnVisible(e) {
|
|
4688
4878
|
return this.grid.isColumnVisible(e);
|
|
@@ -4712,7 +4902,7 @@ class M extends R {
|
|
|
4712
4902
|
return this.grid.getAllColumns();
|
|
4713
4903
|
}
|
|
4714
4904
|
isPanelVisible() {
|
|
4715
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
4905
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(P.PANEL_ID);
|
|
4716
4906
|
}
|
|
4717
4907
|
renderPanelContent(e) {
|
|
4718
4908
|
const t = document.createElement("div");
|
|
@@ -4736,7 +4926,7 @@ class M extends R {
|
|
|
4736
4926
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
4737
4927
|
for (let n = 0; n < i.length; n++) {
|
|
4738
4928
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
4739
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
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 && ze(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
4740
4930
|
const l = document.createElement("label");
|
|
4741
4931
|
l.className = "tbw-visibility-label";
|
|
4742
4932
|
const d = document.createElement("input");
|
|
@@ -4744,7 +4934,7 @@ class M extends R {
|
|
|
4744
4934
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
4745
4935
|
});
|
|
4746
4936
|
const c = document.createElement("span");
|
|
4747
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
4937
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && ze(r)) {
|
|
4748
4938
|
const u = document.createElement("span");
|
|
4749
4939
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
4750
4940
|
}
|
|
@@ -4785,45 +4975,47 @@ class M extends R {
|
|
|
4785
4975
|
}
|
|
4786
4976
|
export {
|
|
4787
4977
|
R as BaseGridPlugin,
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4978
|
+
ji as ClipboardPlugin,
|
|
4979
|
+
Ui as ColumnVirtualizationPlugin,
|
|
4980
|
+
Yi as ContextMenuPlugin,
|
|
4981
|
+
fn as DEFAULT_ANIMATION_CONFIG,
|
|
4792
4982
|
Ue as DEFAULT_GRID_ICONS,
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4983
|
+
gn as DGEvents,
|
|
4984
|
+
pn as DataGridElement,
|
|
4985
|
+
Xi as EditingPlugin,
|
|
4986
|
+
Zi as ExportPlugin,
|
|
4797
4987
|
A as FilteringPlugin,
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4988
|
+
mn as FitModeEnum,
|
|
4989
|
+
wn as GridCSSVars,
|
|
4990
|
+
bn as GridClasses,
|
|
4991
|
+
vn as GridDataAttrs,
|
|
4992
|
+
yn as GridElement,
|
|
4993
|
+
Cn as GridSelectors,
|
|
4994
|
+
Ji as GroupingColumnsPlugin,
|
|
4995
|
+
Qi as GroupingRowsPlugin,
|
|
4806
4996
|
Be as MasterDetailPlugin,
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4997
|
+
en as MultiSortPlugin,
|
|
4998
|
+
Ge as PLUGIN_QUERIES,
|
|
4999
|
+
tn as PinnedColumnsPlugin,
|
|
5000
|
+
nn as PinnedRowsPlugin,
|
|
5001
|
+
M as PivotPlugin,
|
|
5002
|
+
xn as PluginEvents,
|
|
5003
|
+
Rn as PluginManager,
|
|
5004
|
+
Si as ROW_DRAG_HANDLE_FIELD,
|
|
5005
|
+
En as RenderPhase,
|
|
5006
|
+
rn as ReorderPlugin,
|
|
5007
|
+
on as ResponsivePlugin,
|
|
5008
|
+
sn as RowReorderPlugin,
|
|
5009
|
+
an as SelectionPlugin,
|
|
5010
|
+
ln as ServerSidePlugin,
|
|
5011
|
+
dn as TreePlugin,
|
|
5012
|
+
cn as UndoRedoPlugin,
|
|
5013
|
+
P as VisibilityPlugin,
|
|
5014
|
+
Sn as builtInSort,
|
|
5015
|
+
kn as createGrid,
|
|
5016
|
+
An as defaultComparator,
|
|
5017
|
+
mt as defaultEditorFor,
|
|
5018
|
+
rt as defaultPasteHandler,
|
|
5019
|
+
_n as queryGrid
|
|
4828
5020
|
};
|
|
4829
5021
|
//# sourceMappingURL=all.js.map
|