@toolbox-web/grid 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +554 -519
- package/all.js.map +1 -1
- package/index.js +347 -325
- package/index.js.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +46 -0
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +2 -5
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +13 -6
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +92 -65
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +24 -7
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/types.d.ts +51 -2
- package/lib/plugins/pinned-columns/types.d.ts.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +245 -102
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +6 -6
- package/lib/plugins/tree/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +23 -23
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return s.field ===
|
|
1
|
+
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as ht, a as gt, runAggregator as ee, e as Je, s as et, g as ue, r as ft, getAggregator as ye, getValueAggregator as pt, b as D, c as xe, d as mt } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Mn, DGEvents as Nn, DataGridElement as qn, FitModeEnum as Hn, GridCSSVars as Kn, GridClasses as zn, GridDataAttrs as On, DataGridElement as Gn, GridSelectors as Bn, PLUGIN_QUERIES as Vn, PluginEvents as Wn, PluginManager as $n, RenderPhase as jn, builtInSort as Un, createGrid as Yn, defaultComparator as Xn, queryGrid as Zn } from "./index.js";
|
|
3
|
+
const tt = "__tbw_expander", wt = 32;
|
|
4
|
+
function pe(s) {
|
|
5
|
+
return s.field === tt;
|
|
6
6
|
}
|
|
7
7
|
function q(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return s.find(
|
|
10
|
+
function bt(s) {
|
|
11
|
+
return s.find(pe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function vt(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: tt,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: wt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -37,7 +37,7 @@ async function te(s) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Ce(s, e) {
|
|
41
41
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
42
42
|
`, n = s.replace(/\r\n/g, `
|
|
43
43
|
`).replace(/\r/g, `
|
|
@@ -49,14 +49,14 @@ function xe(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 yt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function xt(s, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = s;
|
|
61
61
|
if (!i) return;
|
|
62
62
|
const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
@@ -81,7 +81,7 @@ function mt(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class mn extends A {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -145,7 +145,7 @@ class un extends A {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
148
|
+
const i = Ce(t, this.config), n = this.#n(), r = n?.ranges?.[0], o = r?.from.row ?? 0, a = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[a], h = u ? { row: o, col: a, field: u.field, bounds: d } : null, g = [], f = i[0]?.length ?? 0;
|
|
149
149
|
for (let w = 0; w < f && a + w <= c; w++) {
|
|
150
150
|
const b = this.columns[a + w];
|
|
151
151
|
b && !b.hidden && g.push(b.field);
|
|
@@ -157,7 +157,7 @@ class un extends A {
|
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? xt)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#n() {
|
|
163
163
|
return this.grid?.query("getSelection", void 0)?.[0];
|
|
@@ -220,40 +220,40 @@ class un extends A {
|
|
|
220
220
|
return await te(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
|
-
const e = await
|
|
224
|
-
return e ?
|
|
223
|
+
const e = await yt();
|
|
224
|
+
return e ? Ce(e, this.config) : null;
|
|
225
225
|
}
|
|
226
226
|
getLastCopied() {
|
|
227
227
|
return this.lastCopied;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
230
|
+
const Ee = 100;
|
|
231
|
+
function me(s) {
|
|
232
232
|
if (s == null)
|
|
233
|
-
return
|
|
233
|
+
return Ee;
|
|
234
234
|
if (typeof s == "number")
|
|
235
235
|
return s;
|
|
236
236
|
const e = parseFloat(s);
|
|
237
|
-
return isNaN(e) ?
|
|
238
|
-
}
|
|
239
|
-
function Ee(s) {
|
|
240
|
-
return s.map((e) => pe(e.width));
|
|
237
|
+
return isNaN(e) ? Ee : e;
|
|
241
238
|
}
|
|
242
239
|
function Re(s) {
|
|
240
|
+
return s.map((e) => me(e.width));
|
|
241
|
+
}
|
|
242
|
+
function Se(s) {
|
|
243
243
|
const e = [];
|
|
244
244
|
let t = 0;
|
|
245
245
|
for (const i of s)
|
|
246
|
-
e.push(t), t +=
|
|
246
|
+
e.push(t), t += me(i.width);
|
|
247
247
|
return e;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
return s.reduce((e, t) => e +
|
|
249
|
+
function ke(s) {
|
|
250
|
+
return s.reduce((e, t) => e + me(t.width), 0);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Ct(s, e, t, i, n) {
|
|
253
253
|
const r = t.length;
|
|
254
254
|
if (r === 0)
|
|
255
255
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
256
|
-
let o =
|
|
256
|
+
let o = Et(s, t, i);
|
|
257
257
|
o = Math.max(0, o - n);
|
|
258
258
|
const a = s + e;
|
|
259
259
|
let l = o;
|
|
@@ -270,7 +270,7 @@ function wt(s, e, t, i, n) {
|
|
|
270
270
|
d.push(c);
|
|
271
271
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Et(s, e, t) {
|
|
274
274
|
let i = 0, n = e.length - 1;
|
|
275
275
|
for (; i < n; ) {
|
|
276
276
|
const r = Math.floor((i + n) / 2);
|
|
@@ -278,10 +278,10 @@ function bt(s, e, t) {
|
|
|
278
278
|
}
|
|
279
279
|
return i;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Rt(s, e, t) {
|
|
282
282
|
return t ? s > e : !1;
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class wn extends A {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -300,16 +300,16 @@ class hn extends A {
|
|
|
300
300
|
attach(e) {
|
|
301
301
|
super.attach(e);
|
|
302
302
|
const t = this.columns;
|
|
303
|
-
this.columnWidths =
|
|
303
|
+
this.columnWidths = Re(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
|
|
304
304
|
}
|
|
305
305
|
detach() {
|
|
306
306
|
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
307
307
|
}
|
|
308
308
|
processColumns(e) {
|
|
309
|
-
const t =
|
|
310
|
-
if (this.isVirtualized = t ?? !1, this.columnWidths =
|
|
309
|
+
const t = Rt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
310
|
+
if (this.isVirtualized = t ?? !1, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(e), !t)
|
|
311
311
|
return this.startCol = 0, this.endCol = e.length - 1, [...e];
|
|
312
|
-
const i = this.grid.clientWidth || 800, n =
|
|
312
|
+
const i = this.grid.clientWidth || 800, n = Ct(
|
|
313
313
|
this.scrollLeft,
|
|
314
314
|
i,
|
|
315
315
|
this.columnOffsets,
|
|
@@ -350,13 +350,13 @@ class hn extends A {
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
const ie = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
353
|
-
function
|
|
353
|
+
function he(s, e) {
|
|
354
354
|
return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function St(s, e) {
|
|
357
357
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function ge(s, e, t, i = ht.submenuArrow) {
|
|
360
360
|
const n = document.createElement("div");
|
|
361
361
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
362
362
|
for (const r of s) {
|
|
@@ -367,7 +367,7 @@ function he(s, e, t, i = st.submenuArrow) {
|
|
|
367
367
|
}
|
|
368
368
|
const o = document.createElement("div");
|
|
369
369
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
370
|
-
const a =
|
|
370
|
+
const a = St(r, e);
|
|
371
371
|
if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
372
372
|
const d = document.createElement("span");
|
|
373
373
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -381,7 +381,7 @@ function he(s, e, t, i = st.submenuArrow) {
|
|
|
381
381
|
const d = document.createElement("span");
|
|
382
382
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
383
383
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
384
|
-
const u =
|
|
384
|
+
const u = he(r.subMenu, e), h = ge(u, e, t, i);
|
|
385
385
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
386
386
|
}), o.addEventListener("mouseleave", () => {
|
|
387
387
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -394,7 +394,7 @@ function he(s, e, t, i = st.submenuArrow) {
|
|
|
394
394
|
}
|
|
395
395
|
return n;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function Ae(s, e, t) {
|
|
398
398
|
s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
|
|
399
399
|
const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
400
400
|
let o = e, a = t;
|
|
@@ -419,7 +419,7 @@ const re = [
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
];
|
|
422
|
-
class
|
|
422
|
+
class it extends A {
|
|
423
423
|
name = "contextMenu";
|
|
424
424
|
get defaultConfig() {
|
|
425
425
|
return {
|
|
@@ -476,7 +476,7 @@ class Je extends A {
|
|
|
476
476
|
if (!t) return;
|
|
477
477
|
const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
|
|
478
478
|
r && n.push(`color-scheme: ${r}`);
|
|
479
|
-
for (const o of
|
|
479
|
+
for (const o of it.CSS_VARS_TO_COPY) {
|
|
480
480
|
const a = i.getPropertyValue(o).trim();
|
|
481
481
|
a && n.push(`${o}: ${a}`);
|
|
482
482
|
}
|
|
@@ -531,15 +531,15 @@ class Je extends A {
|
|
|
531
531
|
} else
|
|
532
532
|
return;
|
|
533
533
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
534
|
-
const d =
|
|
535
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
534
|
+
const d = he(this.config.items ?? re, l);
|
|
535
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
536
536
|
d,
|
|
537
537
|
l,
|
|
538
538
|
(c) => {
|
|
539
539
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
540
540
|
},
|
|
541
541
|
this.gridIcons.submenuArrow
|
|
542
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
542
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
543
543
|
}));
|
|
544
544
|
}
|
|
545
545
|
showMenu(e, t, i) {
|
|
@@ -552,15 +552,15 @@ class Je extends A {
|
|
|
552
552
|
value: i.value ?? null,
|
|
553
553
|
isHeader: i.isHeader ?? !1,
|
|
554
554
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
555
|
-
}, r =
|
|
556
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
555
|
+
}, r = he(this.config.items ?? re, n);
|
|
556
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
557
557
|
r,
|
|
558
558
|
n,
|
|
559
559
|
(o) => {
|
|
560
560
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
561
561
|
},
|
|
562
562
|
this.gridIcons.submenuArrow
|
|
563
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
563
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, e, t), this.isOpen = !0;
|
|
564
564
|
}
|
|
565
565
|
hideMenu() {
|
|
566
566
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -569,12 +569,12 @@ class Je extends A {
|
|
|
569
569
|
return this.isOpen;
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
const
|
|
573
|
-
function
|
|
572
|
+
const kt = "@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}}}";
|
|
573
|
+
function At(s) {
|
|
574
574
|
const e = s.options;
|
|
575
575
|
return e ? typeof e == "function" ? e() : e : [];
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function _t(s) {
|
|
578
578
|
return (e) => {
|
|
579
579
|
const t = s.editorParams, i = document.createElement("input");
|
|
580
580
|
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);
|
|
@@ -584,13 +584,13 @@ function Et(s) {
|
|
|
584
584
|
}), i;
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Tt() {
|
|
588
588
|
return (s) => {
|
|
589
589
|
const e = document.createElement("input");
|
|
590
590
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
591
591
|
};
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function Lt(s) {
|
|
594
594
|
return (e) => {
|
|
595
595
|
const t = s.editorParams, i = document.createElement("input");
|
|
596
596
|
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) => {
|
|
@@ -598,14 +598,14 @@ function St(s) {
|
|
|
598
598
|
}), i;
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function Ft(s) {
|
|
602
602
|
return (e) => {
|
|
603
603
|
const t = s.editorParams, i = document.createElement("select");
|
|
604
604
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
605
605
|
const o = document.createElement("option");
|
|
606
606
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
607
607
|
}
|
|
608
|
-
|
|
608
|
+
At(s).forEach((o) => {
|
|
609
609
|
const a = document.createElement("option");
|
|
610
610
|
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);
|
|
611
611
|
});
|
|
@@ -621,7 +621,7 @@ function kt(s) {
|
|
|
621
621
|
}), i;
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function It(s) {
|
|
625
625
|
return (e) => {
|
|
626
626
|
const t = s.editorParams, i = document.createElement("input");
|
|
627
627
|
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) => {
|
|
@@ -629,22 +629,22 @@ function At(s) {
|
|
|
629
629
|
}), i;
|
|
630
630
|
};
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Pt(s) {
|
|
633
633
|
switch (s.type) {
|
|
634
634
|
case "number":
|
|
635
|
-
return
|
|
635
|
+
return _t(s);
|
|
636
636
|
case "boolean":
|
|
637
|
-
return
|
|
637
|
+
return Tt();
|
|
638
638
|
case "date":
|
|
639
|
-
return
|
|
639
|
+
return Lt(s);
|
|
640
640
|
case "select":
|
|
641
|
-
return
|
|
641
|
+
return Ft(s);
|
|
642
642
|
default:
|
|
643
|
-
return
|
|
643
|
+
return It(s);
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
const oe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
647
|
-
function
|
|
647
|
+
function Dt(s, e) {
|
|
648
648
|
if (e.editor) return e.editor;
|
|
649
649
|
if (e.__editorTemplate) return "template";
|
|
650
650
|
if (!e.type) return;
|
|
@@ -661,25 +661,25 @@ function Tt(s, e) {
|
|
|
661
661
|
function $(s) {
|
|
662
662
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function Mt(s) {
|
|
665
665
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
666
666
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Nt(s) {
|
|
669
669
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
670
670
|
}
|
|
671
671
|
function U(s, e) {
|
|
672
672
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function _e(s) {
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function qt(s, e, t) {
|
|
677
677
|
const i = s.querySelector("input,textarea,select");
|
|
678
678
|
i && (i.addEventListener("blur", () => {
|
|
679
679
|
t(U(i, e));
|
|
680
680
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(U(i, e))));
|
|
681
681
|
}
|
|
682
|
-
class
|
|
682
|
+
class bn extends A {
|
|
683
683
|
static manifest = {
|
|
684
684
|
ownedProperties: [
|
|
685
685
|
{
|
|
@@ -713,7 +713,7 @@ class gn extends A {
|
|
|
713
713
|
]
|
|
714
714
|
};
|
|
715
715
|
name = "editing";
|
|
716
|
-
styles =
|
|
716
|
+
styles = kt;
|
|
717
717
|
get defaultConfig() {
|
|
718
718
|
return {
|
|
719
719
|
editOn: "click"
|
|
@@ -739,7 +739,7 @@ class gn extends A {
|
|
|
739
739
|
}, document.addEventListener(
|
|
740
740
|
"keydown",
|
|
741
741
|
(n) => {
|
|
742
|
-
n.key === "Escape" && this.#e !== -1 && this.#
|
|
742
|
+
n.key === "Escape" && this.#e !== -1 && this.#a(this.#e, !0);
|
|
743
743
|
},
|
|
744
744
|
{ capture: !0, signal: t }
|
|
745
745
|
), document.addEventListener(
|
|
@@ -748,7 +748,7 @@ class gn extends A {
|
|
|
748
748
|
if (this.#e === -1) return;
|
|
749
749
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
750
750
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || queueMicrotask(() => {
|
|
751
|
-
this.#e !== -1 && this.#
|
|
751
|
+
this.#e !== -1 && this.#a(this.#e, !1);
|
|
752
752
|
});
|
|
753
753
|
},
|
|
754
754
|
{ signal: t }
|
|
@@ -772,7 +772,7 @@ class gn extends A {
|
|
|
772
772
|
onKeyDown(e) {
|
|
773
773
|
const t = this.grid;
|
|
774
774
|
if (e.key === "Escape" && this.#e !== -1)
|
|
775
|
-
return this.#
|
|
775
|
+
return this.#a(this.#e, !0), !0;
|
|
776
776
|
if (e.key === " " || e.key === "Spacebar") {
|
|
777
777
|
const i = t._focusRow, n = t._focusCol;
|
|
778
778
|
if (i >= 0 && n >= 0) {
|
|
@@ -781,7 +781,7 @@ class gn extends A {
|
|
|
781
781
|
const a = r.field;
|
|
782
782
|
if ($(a)) {
|
|
783
783
|
const d = !o[a];
|
|
784
|
-
return this.#
|
|
784
|
+
return this.#u(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
787
|
}
|
|
@@ -837,14 +837,14 @@ class gn extends A {
|
|
|
837
837
|
}
|
|
838
838
|
afterRender() {
|
|
839
839
|
const e = this.grid;
|
|
840
|
-
if (this.#r && (this.#r = !1, this.#
|
|
840
|
+
if (this.#r && (this.#r = !1, this.#l(e)), this.#i.size !== 0)
|
|
841
841
|
for (const t of this.#i) {
|
|
842
842
|
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), a = e.findRenderedRowElement?.(r);
|
|
843
843
|
if (!a) continue;
|
|
844
844
|
const l = a.querySelector(`.cell[data-col="${o}"]`);
|
|
845
845
|
if (!l || l.classList.contains("editing")) continue;
|
|
846
846
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
847
|
-
d && c && this.#
|
|
847
|
+
d && c && this.#g(d, r, c, o, l, !0);
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
onScrollRender() {
|
|
@@ -888,7 +888,7 @@ class gn extends A {
|
|
|
888
888
|
}
|
|
889
889
|
resetChangedRows(e) {
|
|
890
890
|
const t = this.changedRows, i = this.changedRowIds;
|
|
891
|
-
this.#n.clear(), this.#
|
|
891
|
+
this.#n.clear(), this.#s(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
892
892
|
}
|
|
893
893
|
beginCellEdit(e, t) {
|
|
894
894
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
@@ -906,7 +906,7 @@ class gn extends A {
|
|
|
906
906
|
const d = t._visibleColumns[l];
|
|
907
907
|
if (d?.editable) {
|
|
908
908
|
const c = a;
|
|
909
|
-
c.classList.contains("editing") || this.#
|
|
909
|
+
c.classList.contains("editing") || this.#g(o, e, d, l, c, !0);
|
|
910
910
|
}
|
|
911
911
|
}), setTimeout(() => {
|
|
912
912
|
let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
@@ -920,23 +920,23 @@ class gn extends A {
|
|
|
920
920
|
}, 0);
|
|
921
921
|
}
|
|
922
922
|
commitActiveRowEdit() {
|
|
923
|
-
this.#e !== -1 && this.#
|
|
923
|
+
this.#e !== -1 && this.#a(this.#e, !1);
|
|
924
924
|
}
|
|
925
925
|
cancelActiveRowEdit() {
|
|
926
|
-
this.#e !== -1 && this.#
|
|
926
|
+
this.#e !== -1 && this.#a(this.#e, !0);
|
|
927
927
|
}
|
|
928
928
|
#d(e, t, i) {
|
|
929
929
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
930
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#c(e, r), this.#t = t, this.#
|
|
930
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#c(e, r), this.#t = t, this.#g(r, e, o, t, i, !1));
|
|
931
931
|
}
|
|
932
|
-
#
|
|
932
|
+
#s() {
|
|
933
933
|
const e = this.grid;
|
|
934
934
|
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#o;
|
|
935
935
|
}
|
|
936
936
|
#c(e, t) {
|
|
937
|
-
this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#
|
|
937
|
+
this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#s());
|
|
938
938
|
}
|
|
939
|
-
#
|
|
939
|
+
#a(e, t) {
|
|
940
940
|
if (this.#e !== e) return;
|
|
941
941
|
const i = this.grid, n = this.#o.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
942
942
|
let a;
|
|
@@ -953,7 +953,7 @@ class gn extends A {
|
|
|
953
953
|
const h = d.querySelector("input,textarea,select");
|
|
954
954
|
if (h) {
|
|
955
955
|
const g = U(h, u);
|
|
956
|
-
r[u.field] !== g && this.#
|
|
956
|
+
r[u.field] !== g && this.#u(e, u, g, r);
|
|
957
957
|
}
|
|
958
958
|
}), t && n && r)
|
|
959
959
|
Object.keys(n).forEach((l) => {
|
|
@@ -970,14 +970,14 @@ class gn extends A {
|
|
|
970
970
|
changedRowIds: this.changedRowIds
|
|
971
971
|
}), l && this.isAnimationEnabled && i.animateRow?.(e, "change");
|
|
972
972
|
}
|
|
973
|
-
this.#o.delete(e), this.#e = -1, this.#t = -1, this.#
|
|
973
|
+
this.#o.delete(e), this.#e = -1, this.#t = -1, this.#s();
|
|
974
974
|
for (const l of this.#i)
|
|
975
975
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
976
976
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
977
|
-
l.classList.remove("editing"),
|
|
978
|
-
}), this.requestRender()), this.#r = !0, o || (this.#
|
|
977
|
+
l.classList.remove("editing"), Nt(l.parentElement);
|
|
978
|
+
}), this.requestRender()), this.#r = !0, o || (this.#l(i), this.#r = !1);
|
|
979
979
|
}
|
|
980
|
-
#
|
|
980
|
+
#u(e, t, i, n) {
|
|
981
981
|
const r = t.field;
|
|
982
982
|
if (!$(r)) return;
|
|
983
983
|
const o = n[r];
|
|
@@ -988,7 +988,7 @@ class gn extends A {
|
|
|
988
988
|
l = this.grid.getRowId(n);
|
|
989
989
|
} catch {
|
|
990
990
|
}
|
|
991
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") :
|
|
991
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : _e;
|
|
992
992
|
if (this.emitCancelable("cell-commit", {
|
|
993
993
|
row: n,
|
|
994
994
|
rowId: l ?? "",
|
|
@@ -1001,38 +1001,38 @@ class gn extends A {
|
|
|
1001
1001
|
firstTimeForRow: d,
|
|
1002
1002
|
updateRow: c
|
|
1003
1003
|
})) return;
|
|
1004
|
-
n[r] = i, l && this.#n.add(l), this.#
|
|
1004
|
+
n[r] = i, l && this.#n.add(l), this.#s(), this.emitPluginEvent("cell-edit-committed", {
|
|
1005
1005
|
rowIndex: e,
|
|
1006
1006
|
field: r,
|
|
1007
1007
|
oldValue: o,
|
|
1008
1008
|
newValue: i
|
|
1009
1009
|
});
|
|
1010
1010
|
const h = a.findRenderedRowElement?.(e);
|
|
1011
|
-
h && (h.classList.add("changed"),
|
|
1011
|
+
h && (h.classList.add("changed"), gt(h, "change"));
|
|
1012
1012
|
}
|
|
1013
|
-
#
|
|
1013
|
+
#g(e, t, i, n, r, o) {
|
|
1014
1014
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1015
1015
|
let a;
|
|
1016
1016
|
try {
|
|
1017
1017
|
a = this.grid.getRowId(e);
|
|
1018
1018
|
} catch {
|
|
1019
1019
|
}
|
|
1020
|
-
const l = a ? (C) => this.grid.updateRow(a, C, "cascade") :
|
|
1020
|
+
const l = a ? (C) => this.grid.updateRow(a, C, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
|
|
1021
1021
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
1022
1022
|
const c = r.parentElement;
|
|
1023
|
-
c &&
|
|
1023
|
+
c && Mt(c);
|
|
1024
1024
|
let u = !1;
|
|
1025
1025
|
const h = (C) => {
|
|
1026
|
-
u || this.#e === -1 || this.#
|
|
1026
|
+
u || this.#e === -1 || this.#u(t, i, C, e);
|
|
1027
1027
|
}, g = () => {
|
|
1028
1028
|
u = !0, $(i.field) && (e[i.field] = d);
|
|
1029
1029
|
}, f = document.createElement("div");
|
|
1030
1030
|
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (C) => {
|
|
1031
|
-
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#
|
|
1031
|
+
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#a(t, !1)), C.key === "Escape" && (C.stopPropagation(), C.preventDefault(), g(), this.#a(t, !0));
|
|
1032
1032
|
});
|
|
1033
|
-
const p = i, w = p.__editorTemplate, b =
|
|
1033
|
+
const p = i, w = p.__editorTemplate, b = Dt(this.grid, p) ?? Pt(i), v = d;
|
|
1034
1034
|
if (b === "template" && w)
|
|
1035
|
-
this.#
|
|
1035
|
+
this.#p(f, p, e, d, h, g, o, t);
|
|
1036
1036
|
else if (typeof b == "string") {
|
|
1037
1037
|
const C = document.createElement(b);
|
|
1038
1038
|
C.value = v, C.addEventListener("change", () => h(C.value)), f.appendChild(C), o || queueMicrotask(() => {
|
|
@@ -1049,7 +1049,7 @@ class gn extends A {
|
|
|
1049
1049
|
cancel: g,
|
|
1050
1050
|
updateRow: l
|
|
1051
1051
|
}, _ = b(C);
|
|
1052
|
-
typeof _ == "string" ? (f.innerHTML = _,
|
|
1052
|
+
typeof _ == "string" ? (f.innerHTML = _, qt(f, i, h)) : _ instanceof Node && f.appendChild(_), o || queueMicrotask(() => {
|
|
1053
1053
|
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
1054
1054
|
});
|
|
1055
1055
|
} else if (b && typeof b == "object") {
|
|
@@ -1077,7 +1077,7 @@ class gn extends A {
|
|
|
1077
1077
|
);
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
|
-
#
|
|
1080
|
+
#p(e, t, i, n, r, o, a, l) {
|
|
1081
1081
|
const d = t.__editorTemplate;
|
|
1082
1082
|
if (!d) return;
|
|
1083
1083
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1105,12 +1105,12 @@ class gn extends A {
|
|
|
1105
1105
|
g || r(U(h, t));
|
|
1106
1106
|
}), h.addEventListener("keydown", (f) => {
|
|
1107
1107
|
const p = f;
|
|
1108
|
-
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t)), this.#
|
|
1108
|
+
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t)), this.#a(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#a(l, !0));
|
|
1109
1109
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1110
1110
|
}
|
|
1111
1111
|
e.appendChild(c);
|
|
1112
1112
|
}
|
|
1113
|
-
#
|
|
1113
|
+
#l(e) {
|
|
1114
1114
|
queueMicrotask(() => {
|
|
1115
1115
|
try {
|
|
1116
1116
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1126,7 +1126,7 @@ class gn extends A {
|
|
|
1126
1126
|
});
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function Te(s, e = !0) {
|
|
1130
1130
|
if (s == null) return "";
|
|
1131
1131
|
if (s instanceof Date) return s.toISOString();
|
|
1132
1132
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1134,37 +1134,37 @@ function _e(s, e = !0) {
|
|
|
1134
1134
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1135
1135
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function Ht(s, e, t, i = {}) {
|
|
1138
1138
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1139
1139
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1140
1140
|
if (t.includeHeaders !== !1) {
|
|
1141
1141
|
const l = e.map((d) => {
|
|
1142
1142
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1143
|
-
return
|
|
1143
|
+
return Te(u);
|
|
1144
1144
|
});
|
|
1145
1145
|
o.push(l.join(n));
|
|
1146
1146
|
}
|
|
1147
1147
|
for (const l of s) {
|
|
1148
1148
|
const d = e.map((c) => {
|
|
1149
1149
|
let u = l[c.field];
|
|
1150
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1150
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Te(u);
|
|
1151
1151
|
});
|
|
1152
1152
|
o.push(d.join(n));
|
|
1153
1153
|
}
|
|
1154
1154
|
return a + o.join(r);
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function we(s, e) {
|
|
1157
1157
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1158
1158
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function Kt(s, e) {
|
|
1161
1161
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1162
|
-
|
|
1162
|
+
we(t, e);
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function Le(s) {
|
|
1165
1165
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function zt(s, e, t) {
|
|
1168
1168
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1169
1169
|
<?mso-application progid="Excel.Sheet"?>
|
|
1170
1170
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1176,7 +1176,7 @@ function Mt(s, e, t) {
|
|
|
1176
1176
|
<Row>`;
|
|
1177
1177
|
for (const n of e) {
|
|
1178
1178
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1179
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1179
|
+
i += `<Cell><Data ss:Type="String">${Le(o)}</Data></Cell>`;
|
|
1180
1180
|
}
|
|
1181
1181
|
i += "</Row>";
|
|
1182
1182
|
}
|
|
@@ -1187,7 +1187,7 @@ function Mt(s, e, t) {
|
|
|
1187
1187
|
let o = n[r.field];
|
|
1188
1188
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1189
1189
|
let a = "String", l = "";
|
|
1190
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l =
|
|
1190
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Le(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
|
|
1191
1191
|
}
|
|
1192
1192
|
i += "</Row>";
|
|
1193
1193
|
}
|
|
@@ -1196,13 +1196,13 @@ function Mt(s, e, t) {
|
|
|
1196
1196
|
</Worksheet>
|
|
1197
1197
|
</Workbook>`, i;
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function Ot(s, e) {
|
|
1200
1200
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1201
1201
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1202
1202
|
});
|
|
1203
|
-
|
|
1203
|
+
we(i, t);
|
|
1204
1204
|
}
|
|
1205
|
-
class
|
|
1205
|
+
class vn extends A {
|
|
1206
1206
|
name = "export";
|
|
1207
1207
|
get defaultConfig() {
|
|
1208
1208
|
return {
|
|
@@ -1239,13 +1239,13 @@ class fn extends A {
|
|
|
1239
1239
|
try {
|
|
1240
1240
|
switch (e) {
|
|
1241
1241
|
case "csv": {
|
|
1242
|
-
const l =
|
|
1243
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1242
|
+
const l = Ht(o, r, n, { bom: !0 });
|
|
1243
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, Kt(l, a);
|
|
1244
1244
|
break;
|
|
1245
1245
|
}
|
|
1246
1246
|
case "excel": {
|
|
1247
|
-
const l =
|
|
1248
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1247
|
+
const l = zt(o, r, n);
|
|
1248
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, Ot(l, a);
|
|
1249
1249
|
break;
|
|
1250
1250
|
}
|
|
1251
1251
|
case "json": {
|
|
@@ -1259,7 +1259,7 @@ class fn extends A {
|
|
|
1259
1259
|
}), d = JSON.stringify(l, null, 2);
|
|
1260
1260
|
a = a.endsWith(".json") ? a : `${a}.json`;
|
|
1261
1261
|
const c = new Blob([d], { type: "application/json" });
|
|
1262
|
-
|
|
1262
|
+
we(c, a);
|
|
1263
1263
|
break;
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
@@ -1296,7 +1296,7 @@ class fn extends A {
|
|
|
1296
1296
|
return this.lastExportInfo;
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1299
|
+
function Gt(s) {
|
|
1300
1300
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1301
1301
|
let a = Math.floor(i / n) - r;
|
|
1302
1302
|
a < 0 && (a = 0);
|
|
@@ -1308,10 +1308,10 @@ function qt(s) {
|
|
|
1308
1308
|
totalHeight: e * n
|
|
1309
1309
|
};
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function Bt(s, e) {
|
|
1312
1312
|
return s <= e;
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function Vt(s, e, t = !1) {
|
|
1315
1315
|
const i = s[e.field];
|
|
1316
1316
|
if (e.operator === "blank")
|
|
1317
1317
|
return i == null || i === "";
|
|
@@ -1350,10 +1350,10 @@ function Ht(s, e, t = !1) {
|
|
|
1350
1350
|
return !0;
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1354
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1353
|
+
function Wt(s, e, t = !1) {
|
|
1354
|
+
return e.length ? s.filter((i) => e.every((n) => Vt(i, n, t))) : s;
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1356
|
+
function $t(s) {
|
|
1357
1357
|
return JSON.stringify(
|
|
1358
1358
|
s.map((e) => ({
|
|
1359
1359
|
field: e.field,
|
|
@@ -1363,7 +1363,7 @@ function Ot(s) {
|
|
|
1363
1363
|
}))
|
|
1364
1364
|
);
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1366
|
+
function Fe(s, e) {
|
|
1367
1367
|
const t = /* @__PURE__ */ new Set();
|
|
1368
1368
|
for (const i of s) {
|
|
1369
1369
|
const n = i[e];
|
|
@@ -1371,7 +1371,7 @@ function Le(s, e) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1373
1373
|
}
|
|
1374
|
-
const
|
|
1374
|
+
const jt = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', Ut = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-range-inputs,.tbw-filter-date-range{display:flex;align-items:flex-end;gap:var(--tbw-spacing-sm, .375rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-group,.tbw-filter-date-group{display:flex;flex-direction:column;gap:var(--tbw-spacing-xs, .25rem);flex:1}.tbw-filter-range-label{font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)))}.tbw-filter-range-input,.tbw-filter-date-input{width:100%;height:var(--tbw-filter-item-height, 28px);padding:var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-sm, .375rem);background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-range-input:focus,.tbw-filter-date-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-range-separator{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding-bottom:var(--tbw-spacing-xs, .25rem)}.tbw-filter-range-slider{position:relative;height:24px;margin:var(--tbw-spacing-md, .5rem) 0 var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-fill{position:absolute;top:50%;height:4px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-thumb{position:absolute;top:0;width:100%;height:100%;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}.tbw-filter-range-thumb::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-moz-range-thumb{width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-webkit-slider-thumb:hover{transform:scale(1.1)}.tbw-filter-range-thumb::-moz-range-thumb:hover{transform:scale(1.1)}}";
|
|
1375
1375
|
class N extends A {
|
|
1376
1376
|
static manifest = {
|
|
1377
1377
|
events: [
|
|
@@ -1382,7 +1382,7 @@ class N extends A {
|
|
|
1382
1382
|
]
|
|
1383
1383
|
};
|
|
1384
1384
|
name = "filtering";
|
|
1385
|
-
styles =
|
|
1385
|
+
styles = jt;
|
|
1386
1386
|
get defaultConfig() {
|
|
1387
1387
|
return {
|
|
1388
1388
|
debounceMs: 300,
|
|
@@ -1435,10 +1435,10 @@ class N extends A {
|
|
|
1435
1435
|
if (!t.length) return [...e];
|
|
1436
1436
|
if (this.config.filterHandler)
|
|
1437
1437
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1438
|
-
const i =
|
|
1438
|
+
const i = $t(t);
|
|
1439
1439
|
if (this.cacheKey === i && this.cachedResult)
|
|
1440
1440
|
return this.cachedResult;
|
|
1441
|
-
const n =
|
|
1441
|
+
const n = Wt([...e], t, this.config.caseSensitive);
|
|
1442
1442
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1443
1443
|
}
|
|
1444
1444
|
afterRender() {
|
|
@@ -1516,7 +1516,7 @@ class N extends A {
|
|
|
1516
1516
|
return this.getFilters();
|
|
1517
1517
|
}
|
|
1518
1518
|
getUniqueValues(e) {
|
|
1519
|
-
return
|
|
1519
|
+
return Fe(this.sourceRows, e);
|
|
1520
1520
|
}
|
|
1521
1521
|
copyGridThemeContext(e) {
|
|
1522
1522
|
const t = this.gridElement;
|
|
@@ -1533,7 +1533,7 @@ class N extends A {
|
|
|
1533
1533
|
return;
|
|
1534
1534
|
}
|
|
1535
1535
|
const e = document.createElement("style");
|
|
1536
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1536
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Ut, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1537
1537
|
}
|
|
1538
1538
|
toggleFilterPanel(e, t, i) {
|
|
1539
1539
|
if (this.openPanelField === e) {
|
|
@@ -1548,7 +1548,7 @@ class N extends A {
|
|
|
1548
1548
|
});
|
|
1549
1549
|
return;
|
|
1550
1550
|
}
|
|
1551
|
-
const r =
|
|
1551
|
+
const r = Fe(this.sourceRows, e);
|
|
1552
1552
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1553
1553
|
}
|
|
1554
1554
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1657,17 +1657,17 @@ class N extends A {
|
|
|
1657
1657
|
L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
|
|
1658
1658
|
b.set(m, L.checked), g();
|
|
1659
1659
|
});
|
|
1660
|
-
const
|
|
1661
|
-
return
|
|
1660
|
+
const H = document.createElement("span");
|
|
1661
|
+
return H.textContent = T, y.appendChild(L), y.appendChild(H), y;
|
|
1662
1662
|
}, _ = () => {
|
|
1663
1663
|
const x = v.length, S = f.clientHeight, T = f.scrollTop;
|
|
1664
|
-
if (p.style.height = `${x * o}px`,
|
|
1664
|
+
if (p.style.height = `${x * o}px`, Bt(x, N.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1665
1665
|
w.innerHTML = "", w.style.transform = "translateY(0px)", v.forEach((y, L) => {
|
|
1666
1666
|
w.appendChild(C(y, L));
|
|
1667
1667
|
});
|
|
1668
1668
|
return;
|
|
1669
1669
|
}
|
|
1670
|
-
const m =
|
|
1670
|
+
const m = Gt({
|
|
1671
1671
|
totalRows: x,
|
|
1672
1672
|
viewportHeight: S,
|
|
1673
1673
|
scrollTop: T,
|
|
@@ -1724,13 +1724,13 @@ class N extends A {
|
|
|
1724
1724
|
}), F.appendChild(R), e.appendChild(F);
|
|
1725
1725
|
}
|
|
1726
1726
|
renderNumberFilterPanel(e, t, i) {
|
|
1727
|
-
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (k,
|
|
1727
|
+
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (k, K) => {
|
|
1728
1728
|
if (typeof k == "number") return k;
|
|
1729
1729
|
if (typeof k == "string") {
|
|
1730
1730
|
const W = parseFloat(k);
|
|
1731
|
-
return isNaN(W) ?
|
|
1731
|
+
return isNaN(W) ? K : W;
|
|
1732
1732
|
}
|
|
1733
|
-
return
|
|
1733
|
+
return K;
|
|
1734
1734
|
}, d = i.filter((k) => typeof k == "number" && !isNaN(k)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), g = l(o?.max ?? a?.max, u), f = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
|
|
1735
1735
|
let w = h, b = g;
|
|
1736
1736
|
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, g));
|
|
@@ -1761,8 +1761,8 @@ class N extends A {
|
|
|
1761
1761
|
const y = document.createElement("input");
|
|
1762
1762
|
y.type = "range", y.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", y.min = String(h), y.max = String(g), y.step = String(f), y.value = String(b), x.appendChild(S), x.appendChild(T), x.appendChild(m), x.appendChild(y), e.appendChild(x);
|
|
1763
1763
|
const L = () => {
|
|
1764
|
-
const k = parseFloat(m.value),
|
|
1765
|
-
T.style.left = `${
|
|
1764
|
+
const k = parseFloat(m.value), K = parseFloat(y.value), W = g - h, ve = (k - h) / W * 100, ut = (K - h) / W * 100;
|
|
1765
|
+
T.style.left = `${ve}%`, T.style.width = `${ut - ve}%`;
|
|
1766
1766
|
};
|
|
1767
1767
|
m.addEventListener("input", () => {
|
|
1768
1768
|
const k = Math.min(parseFloat(m.value), parseFloat(y.value));
|
|
@@ -1777,17 +1777,17 @@ class N extends A {
|
|
|
1777
1777
|
let k = parseFloat(R.value) || g;
|
|
1778
1778
|
k = Math.min(g, Math.max(k, parseFloat(E.value))), y.value = String(k), L();
|
|
1779
1779
|
}), L();
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1780
|
+
const H = document.createElement("div");
|
|
1781
|
+
H.className = "tbw-filter-buttons";
|
|
1782
1782
|
const Y = document.createElement("button");
|
|
1783
1783
|
Y.className = "tbw-filter-apply-btn", Y.textContent = "Apply", Y.addEventListener("click", () => {
|
|
1784
|
-
const k = parseFloat(E.value),
|
|
1785
|
-
t.applyTextFilter("between", k,
|
|
1786
|
-
}),
|
|
1784
|
+
const k = parseFloat(E.value), K = parseFloat(R.value);
|
|
1785
|
+
t.applyTextFilter("between", k, K);
|
|
1786
|
+
}), H.appendChild(Y);
|
|
1787
1787
|
const X = document.createElement("button");
|
|
1788
1788
|
X.className = "tbw-filter-clear-btn", X.textContent = "Clear Filter", X.addEventListener("click", () => {
|
|
1789
1789
|
t.clearFilter();
|
|
1790
|
-
}),
|
|
1790
|
+
}), H.appendChild(X), e.appendChild(H);
|
|
1791
1791
|
}
|
|
1792
1792
|
renderDateFilterPanel(e, t, i) {
|
|
1793
1793
|
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", g = h(o?.min) || h(a?.min) || u(d), f = h(o?.max) || h(a?.max) || u(c), p = this.filters.get(n);
|
|
@@ -1885,7 +1885,7 @@ class N extends A {
|
|
|
1885
1885
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1886
1886
|
}
|
|
1887
1887
|
}
|
|
1888
|
-
function
|
|
1888
|
+
function Ie(s) {
|
|
1889
1889
|
if (!s.length) return [];
|
|
1890
1890
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1891
1891
|
if (!a.length) return;
|
|
@@ -1920,7 +1920,7 @@ function Fe(s) {
|
|
|
1920
1920
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1921
1921
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Yt(s, e, t) {
|
|
1924
1924
|
if (!e.length || !s) return;
|
|
1925
1925
|
const i = /* @__PURE__ */ new Map();
|
|
1926
1926
|
for (const r of e)
|
|
@@ -1936,7 +1936,7 @@ function Vt(s, e, t) {
|
|
|
1936
1936
|
a && a.classList.add("group-end");
|
|
1937
1937
|
}
|
|
1938
1938
|
}
|
|
1939
|
-
function
|
|
1939
|
+
function Xt(s, e) {
|
|
1940
1940
|
if (s.length === 0) return null;
|
|
1941
1941
|
const t = document.createElement("div");
|
|
1942
1942
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1948,11 +1948,11 @@ function Wt(s, e) {
|
|
|
1948
1948
|
}
|
|
1949
1949
|
return t;
|
|
1950
1950
|
}
|
|
1951
|
-
function
|
|
1951
|
+
function Zt(s) {
|
|
1952
1952
|
return s.some((e) => e.group != null);
|
|
1953
1953
|
}
|
|
1954
|
-
const
|
|
1955
|
-
class
|
|
1954
|
+
const Qt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
|
|
1955
|
+
class yn extends A {
|
|
1956
1956
|
static manifest = {
|
|
1957
1957
|
ownedProperties: [
|
|
1958
1958
|
{
|
|
@@ -1969,7 +1969,7 @@ class pn extends A {
|
|
|
1969
1969
|
]
|
|
1970
1970
|
};
|
|
1971
1971
|
name = "groupingColumns";
|
|
1972
|
-
styles =
|
|
1972
|
+
styles = Qt;
|
|
1973
1973
|
get defaultConfig() {
|
|
1974
1974
|
return {
|
|
1975
1975
|
showGroupBorders: !0
|
|
@@ -1984,7 +1984,7 @@ class pn extends A {
|
|
|
1984
1984
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1985
1985
|
return !0;
|
|
1986
1986
|
const i = t?.columns;
|
|
1987
|
-
return Array.isArray(i) ?
|
|
1987
|
+
return Array.isArray(i) ? Zt(i) : !1;
|
|
1988
1988
|
}
|
|
1989
1989
|
processColumns(e) {
|
|
1990
1990
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -2000,7 +2000,7 @@ class pn extends A {
|
|
|
2000
2000
|
});
|
|
2001
2001
|
} else
|
|
2002
2002
|
i = [...e];
|
|
2003
|
-
const n =
|
|
2003
|
+
const n = Ie(i);
|
|
2004
2004
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
2005
2005
|
}
|
|
2006
2006
|
afterRender() {
|
|
@@ -2013,16 +2013,16 @@ class pn extends A {
|
|
|
2013
2013
|
if (!e) return;
|
|
2014
2014
|
const t = e.querySelector(".header-group-row");
|
|
2015
2015
|
t && t.remove();
|
|
2016
|
-
const i = this.columns, n =
|
|
2016
|
+
const i = this.columns, n = Ie(i);
|
|
2017
2017
|
if (n.length === 0) return;
|
|
2018
|
-
const r =
|
|
2018
|
+
const r = Xt(n, i);
|
|
2019
2019
|
if (r) {
|
|
2020
2020
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
2021
2021
|
const a = e.querySelector(".header-row");
|
|
2022
2022
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
2023
2023
|
}
|
|
2024
2024
|
const o = e.querySelector(".header-row");
|
|
2025
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
2025
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Yt(o, n)), this.#e(n);
|
|
2026
2026
|
}
|
|
2027
2027
|
#e(e) {
|
|
2028
2028
|
if (!this.config.showGroupBorders) return;
|
|
@@ -2053,7 +2053,7 @@ class pn extends A {
|
|
|
2053
2053
|
this.requestRender();
|
|
2054
2054
|
}
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2056
|
+
function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
2057
2057
|
const n = e.groupOn;
|
|
2058
2058
|
if (typeof n != "function")
|
|
2059
2059
|
return [];
|
|
@@ -2086,20 +2086,20 @@ function Ie({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2086
2086
|
};
|
|
2087
2087
|
return l(r), a;
|
|
2088
2088
|
}
|
|
2089
|
-
function
|
|
2089
|
+
function Jt(s, e) {
|
|
2090
2090
|
const t = new Set(s);
|
|
2091
2091
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2093
|
+
function ei(s) {
|
|
2094
2094
|
const e = /* @__PURE__ */ new Set();
|
|
2095
2095
|
for (const t of s)
|
|
2096
2096
|
t.kind === "group" && e.add(t.key);
|
|
2097
2097
|
return e;
|
|
2098
2098
|
}
|
|
2099
|
-
function
|
|
2099
|
+
function ti() {
|
|
2100
2100
|
return /* @__PURE__ */ new Set();
|
|
2101
2101
|
}
|
|
2102
|
-
function
|
|
2102
|
+
function ii(s, e) {
|
|
2103
2103
|
if (s === !0)
|
|
2104
2104
|
return new Set(e);
|
|
2105
2105
|
if (s === !1 || s == null)
|
|
@@ -2110,14 +2110,14 @@ function Zt(s, e) {
|
|
|
2110
2110
|
}
|
|
2111
2111
|
return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function ni(s) {
|
|
2114
2114
|
return s.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function ri(s) {
|
|
2117
2117
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
2118
2118
|
}
|
|
2119
|
-
const
|
|
2120
|
-
class
|
|
2119
|
+
const oi = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
2120
|
+
class xn extends A {
|
|
2121
2121
|
static manifest = {
|
|
2122
2122
|
events: [
|
|
2123
2123
|
{
|
|
@@ -2144,7 +2144,7 @@ class mn extends A {
|
|
|
2144
2144
|
]
|
|
2145
2145
|
};
|
|
2146
2146
|
name = "groupingRows";
|
|
2147
|
-
styles =
|
|
2147
|
+
styles = oi;
|
|
2148
2148
|
get defaultConfig() {
|
|
2149
2149
|
return {
|
|
2150
2150
|
defaultExpanded: !1,
|
|
@@ -2168,11 +2168,8 @@ class mn extends A {
|
|
|
2168
2168
|
this.expandedKeys.clear(), this.flattenedRows = [], this.isActive = !1, this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.hasAppliedDefaultExpanded = !1;
|
|
2169
2169
|
}
|
|
2170
2170
|
handleQuery(e) {
|
|
2171
|
-
if (e.type === "canMoveRow")
|
|
2172
|
-
|
|
2173
|
-
if (t && t.__isGroupRow === !0)
|
|
2174
|
-
return !1;
|
|
2175
|
-
}
|
|
2171
|
+
if (e.type === "canMoveRow" && e.context?.__isGroupRow === !0)
|
|
2172
|
+
return !1;
|
|
2176
2173
|
}
|
|
2177
2174
|
static detect(e, t) {
|
|
2178
2175
|
return typeof t?.groupOn == "function" || typeof t?.enableRowGrouping == "boolean";
|
|
@@ -2181,7 +2178,7 @@ class mn extends A {
|
|
|
2181
2178
|
const t = this.config;
|
|
2182
2179
|
if (typeof t.groupOn != "function")
|
|
2183
2180
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2184
|
-
const i =
|
|
2181
|
+
const i = Pe({
|
|
2185
2182
|
rows: [...e],
|
|
2186
2183
|
config: t,
|
|
2187
2184
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -2190,10 +2187,10 @@ class mn extends A {
|
|
|
2190
2187
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2191
2188
|
let n;
|
|
2192
2189
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2193
|
-
const a =
|
|
2194
|
-
n =
|
|
2190
|
+
const a = ni(i);
|
|
2191
|
+
n = ii(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2195
2192
|
}
|
|
2196
|
-
const r =
|
|
2193
|
+
const r = Pe({
|
|
2197
2194
|
rows: [...e],
|
|
2198
2195
|
config: t,
|
|
2199
2196
|
expanded: this.expandedKeys,
|
|
@@ -2213,7 +2210,7 @@ class mn extends A {
|
|
|
2213
2210
|
__groupDepth: a.depth,
|
|
2214
2211
|
__groupRows: a.rows,
|
|
2215
2212
|
__groupExpanded: a.expanded,
|
|
2216
|
-
__groupRowCount:
|
|
2213
|
+
__groupRowCount: ri(a)
|
|
2217
2214
|
} : a.row);
|
|
2218
2215
|
}
|
|
2219
2216
|
onCellClick(e) {
|
|
@@ -2303,7 +2300,7 @@ class mn extends A {
|
|
|
2303
2300
|
let c = !1;
|
|
2304
2301
|
o.forEach((u, h) => {
|
|
2305
2302
|
const g = document.createElement("div");
|
|
2306
|
-
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"),
|
|
2303
|
+
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), pe(u)) {
|
|
2307
2304
|
g.setAttribute("data-field", u.field), t.appendChild(g);
|
|
2308
2305
|
return;
|
|
2309
2306
|
}
|
|
@@ -2331,10 +2328,10 @@ class mn extends A {
|
|
|
2331
2328
|
});
|
|
2332
2329
|
}
|
|
2333
2330
|
expandAll() {
|
|
2334
|
-
this.expandedKeys =
|
|
2331
|
+
this.expandedKeys = ei(this.flattenedRows), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2335
2332
|
}
|
|
2336
2333
|
collapseAll() {
|
|
2337
|
-
this.expandedKeys =
|
|
2334
|
+
this.expandedKeys = ti(), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2338
2335
|
}
|
|
2339
2336
|
toggle(e) {
|
|
2340
2337
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2349,7 +2346,7 @@ class mn extends A {
|
|
|
2349
2346
|
}
|
|
2350
2347
|
r.add(e), this.expandedKeys = r;
|
|
2351
2348
|
} else
|
|
2352
|
-
this.expandedKeys =
|
|
2349
|
+
this.expandedKeys = Jt(this.expandedKeys, e);
|
|
2353
2350
|
this.emit("group-toggle", {
|
|
2354
2351
|
key: e,
|
|
2355
2352
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2399,22 +2396,22 @@ class mn extends A {
|
|
|
2399
2396
|
this.config.groupOn = e, this.requestRender();
|
|
2400
2397
|
}
|
|
2401
2398
|
}
|
|
2402
|
-
function
|
|
2399
|
+
function De(s, e) {
|
|
2403
2400
|
const t = new Set(s);
|
|
2404
2401
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2405
2402
|
}
|
|
2406
|
-
function
|
|
2403
|
+
function si(s, e) {
|
|
2407
2404
|
const t = new Set(s);
|
|
2408
2405
|
return t.add(e), t;
|
|
2409
2406
|
}
|
|
2410
|
-
function
|
|
2407
|
+
function ai(s, e) {
|
|
2411
2408
|
const t = new Set(s);
|
|
2412
2409
|
return t.delete(e), t;
|
|
2413
2410
|
}
|
|
2414
|
-
function
|
|
2411
|
+
function li(s, e) {
|
|
2415
2412
|
return s.has(e);
|
|
2416
2413
|
}
|
|
2417
|
-
function
|
|
2414
|
+
function di(s, e, t, i) {
|
|
2418
2415
|
const n = document.createElement("div");
|
|
2419
2416
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2420
2417
|
const r = document.createElement("div");
|
|
@@ -2422,10 +2419,10 @@ function ri(s, e, t, i) {
|
|
|
2422
2419
|
const o = t(s, e);
|
|
2423
2420
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2424
2421
|
}
|
|
2425
|
-
const
|
|
2426
|
-
class
|
|
2422
|
+
const ci = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
2423
|
+
class nt extends A {
|
|
2427
2424
|
name = "masterDetail";
|
|
2428
|
-
styles =
|
|
2425
|
+
styles = ci;
|
|
2429
2426
|
get defaultConfig() {
|
|
2430
2427
|
return {
|
|
2431
2428
|
detailHeight: "auto",
|
|
@@ -2454,8 +2451,8 @@ class et extends A {
|
|
|
2454
2451
|
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));
|
|
2455
2452
|
const c = t.innerHTML.trim();
|
|
2456
2453
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2457
|
-
const g =
|
|
2458
|
-
return
|
|
2454
|
+
const g = Je(c, { value: u, row: u });
|
|
2455
|
+
return et(g);
|
|
2459
2456
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2460
2457
|
}
|
|
2461
2458
|
get animationStyle() {
|
|
@@ -2486,10 +2483,10 @@ class et extends A {
|
|
|
2486
2483
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2487
2484
|
getDetailHeight(e) {
|
|
2488
2485
|
const t = this.detailElements.get(e);
|
|
2489
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2486
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : nt.DEFAULT_DETAIL_HEIGHT;
|
|
2490
2487
|
}
|
|
2491
2488
|
toggleAndEmit(e, t) {
|
|
2492
|
-
this.expandedRows =
|
|
2489
|
+
this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
|
|
2493
2490
|
rowIndex: t,
|
|
2494
2491
|
row: e,
|
|
2495
2492
|
expanded: this.expandedRows.has(e)
|
|
@@ -2502,9 +2499,9 @@ class et extends A {
|
|
|
2502
2499
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2503
2500
|
return [...e];
|
|
2504
2501
|
const i = [...e];
|
|
2505
|
-
if (
|
|
2502
|
+
if (bt(i))
|
|
2506
2503
|
return i;
|
|
2507
|
-
const r =
|
|
2504
|
+
const r = vt(this.name);
|
|
2508
2505
|
return r.viewRenderer = (o) => {
|
|
2509
2506
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2510
2507
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2524,7 +2521,7 @@ class et extends A {
|
|
|
2524
2521
|
onKeyDown(e) {
|
|
2525
2522
|
if (e.key !== " ") return;
|
|
2526
2523
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2527
|
-
if (!n || !
|
|
2524
|
+
if (!n || !pe(n)) return;
|
|
2528
2525
|
const r = this.rows[i];
|
|
2529
2526
|
if (r)
|
|
2530
2527
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -2557,7 +2554,7 @@ class et extends A {
|
|
|
2557
2554
|
d.previousElementSibling !== a && a.after(d);
|
|
2558
2555
|
continue;
|
|
2559
2556
|
}
|
|
2560
|
-
const c =
|
|
2557
|
+
const c = di(l, o, this.config.detailRenderer, n);
|
|
2561
2558
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2562
2559
|
}
|
|
2563
2560
|
}
|
|
@@ -2592,19 +2589,19 @@ class et extends A {
|
|
|
2592
2589
|
}
|
|
2593
2590
|
expand(e) {
|
|
2594
2591
|
const t = this.rows[e];
|
|
2595
|
-
t && (this.expandedRows =
|
|
2592
|
+
t && (this.expandedRows = si(this.expandedRows, t), this.requestRender());
|
|
2596
2593
|
}
|
|
2597
2594
|
collapse(e) {
|
|
2598
2595
|
const t = this.rows[e];
|
|
2599
|
-
t && (this.expandedRows =
|
|
2596
|
+
t && (this.expandedRows = ai(this.expandedRows, t), this.requestRender());
|
|
2600
2597
|
}
|
|
2601
2598
|
toggle(e) {
|
|
2602
2599
|
const t = this.rows[e];
|
|
2603
|
-
t && (this.expandedRows =
|
|
2600
|
+
t && (this.expandedRows = De(this.expandedRows, t), this.requestRender());
|
|
2604
2601
|
}
|
|
2605
2602
|
isExpanded(e) {
|
|
2606
2603
|
const t = this.rows[e];
|
|
2607
|
-
return t ?
|
|
2604
|
+
return t ? li(this.expandedRows, t) : !1;
|
|
2608
2605
|
}
|
|
2609
2606
|
expandAll() {
|
|
2610
2607
|
for (const e of this.rows)
|
|
@@ -2634,34 +2631,34 @@ class et extends A {
|
|
|
2634
2631
|
}
|
|
2635
2632
|
}
|
|
2636
2633
|
}
|
|
2637
|
-
function
|
|
2634
|
+
function ui(s, e, t) {
|
|
2638
2635
|
return e.length ? [...s].sort((i, n) => {
|
|
2639
2636
|
for (const r of e) {
|
|
2640
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2637
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? hi, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2641
2638
|
if (c !== 0)
|
|
2642
2639
|
return r.direction === "asc" ? c : -c;
|
|
2643
2640
|
}
|
|
2644
2641
|
return 0;
|
|
2645
2642
|
}) : [...s];
|
|
2646
2643
|
}
|
|
2647
|
-
function
|
|
2644
|
+
function hi(s, e) {
|
|
2648
2645
|
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));
|
|
2649
2646
|
}
|
|
2650
|
-
function
|
|
2647
|
+
function gi(s, e, t, i) {
|
|
2651
2648
|
const n = s.find((r) => r.field === e);
|
|
2652
2649
|
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" }];
|
|
2653
2650
|
}
|
|
2654
|
-
function
|
|
2651
|
+
function Me(s, e) {
|
|
2655
2652
|
const t = s.findIndex((i) => i.field === e);
|
|
2656
2653
|
return t >= 0 ? t + 1 : void 0;
|
|
2657
2654
|
}
|
|
2658
|
-
function
|
|
2655
|
+
function Ne(s, e) {
|
|
2659
2656
|
return s.find((t) => t.field === e)?.direction;
|
|
2660
2657
|
}
|
|
2661
|
-
const
|
|
2662
|
-
class
|
|
2658
|
+
const fi = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2659
|
+
class Cn extends A {
|
|
2663
2660
|
name = "multiSort";
|
|
2664
|
-
styles =
|
|
2661
|
+
styles = fi;
|
|
2665
2662
|
get defaultConfig() {
|
|
2666
2663
|
return {
|
|
2667
2664
|
maxSortColumns: 3,
|
|
@@ -2673,12 +2670,12 @@ class wn extends A {
|
|
|
2673
2670
|
this.sortModel = [];
|
|
2674
2671
|
}
|
|
2675
2672
|
processRows(e) {
|
|
2676
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2673
|
+
return this.sortModel.length === 0 ? [...e] : ui([...e], this.sortModel, [...this.columns]);
|
|
2677
2674
|
}
|
|
2678
2675
|
onHeaderClick(e) {
|
|
2679
2676
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2680
2677
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2681
|
-
return this.sortModel =
|
|
2678
|
+
return this.sortModel = gi(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2682
2679
|
}
|
|
2683
2680
|
afterRender() {
|
|
2684
2681
|
const e = this.gridElement;
|
|
@@ -2687,7 +2684,7 @@ class wn extends A {
|
|
|
2687
2684
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2688
2685
|
const r = n.getAttribute("data-field");
|
|
2689
2686
|
if (!r) return;
|
|
2690
|
-
const o =
|
|
2687
|
+
const o = Me(this.sortModel, r), a = Ne(this.sortModel, r);
|
|
2691
2688
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2692
2689
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2693
2690
|
const c = document.createElement("span");
|
|
@@ -2711,10 +2708,10 @@ class wn extends A {
|
|
|
2711
2708
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2712
2709
|
}
|
|
2713
2710
|
getSortIndex(e) {
|
|
2714
|
-
return
|
|
2711
|
+
return Me(this.sortModel, e);
|
|
2715
2712
|
}
|
|
2716
2713
|
getSortDirection(e) {
|
|
2717
|
-
return
|
|
2714
|
+
return Ne(this.sortModel, e);
|
|
2718
2715
|
}
|
|
2719
2716
|
getColumnState(e) {
|
|
2720
2717
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2737,53 +2734,66 @@ class wn extends A {
|
|
|
2737
2734
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2738
2735
|
}
|
|
2739
2736
|
}
|
|
2740
|
-
function
|
|
2741
|
-
return s
|
|
2737
|
+
function rt(s, e) {
|
|
2738
|
+
return ft(s, e);
|
|
2739
|
+
}
|
|
2740
|
+
function ot(s, e) {
|
|
2741
|
+
const t = s.sticky;
|
|
2742
|
+
return t ? rt(t, e) === "left" : !1;
|
|
2743
|
+
}
|
|
2744
|
+
function st(s, e) {
|
|
2745
|
+
const t = s.sticky;
|
|
2746
|
+
return t ? rt(t, e) === "right" : !1;
|
|
2742
2747
|
}
|
|
2743
|
-
function
|
|
2744
|
-
return s.filter((
|
|
2748
|
+
function pi(s, e = "ltr") {
|
|
2749
|
+
return s.filter((t) => ot(t, e));
|
|
2750
|
+
}
|
|
2751
|
+
function mi(s, e = "ltr") {
|
|
2752
|
+
return s.filter((t) => st(t, e));
|
|
2745
2753
|
}
|
|
2746
2754
|
function se(s) {
|
|
2747
|
-
return s.some(
|
|
2755
|
+
return s.some(
|
|
2756
|
+
(e) => e.sticky === "left" || e.sticky === "right" || e.sticky === "start" || e.sticky === "end"
|
|
2757
|
+
);
|
|
2748
2758
|
}
|
|
2749
|
-
function
|
|
2759
|
+
function qe(s, e) {
|
|
2750
2760
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2751
2761
|
if (!t.length) return;
|
|
2752
|
-
const i = /* @__PURE__ */ new Map();
|
|
2753
|
-
e.forEach((
|
|
2754
|
-
|
|
2762
|
+
const i = ue(s), n = /* @__PURE__ */ new Map();
|
|
2763
|
+
e.forEach((a, l) => {
|
|
2764
|
+
a.field && n.set(a.field, l);
|
|
2755
2765
|
});
|
|
2756
|
-
let n = 0;
|
|
2757
|
-
for (const o of e)
|
|
2758
|
-
if (o.sticky === "left") {
|
|
2759
|
-
const a = i.get(o.field), l = t.find((d) => d.getAttribute("data-field") === o.field);
|
|
2760
|
-
l && (l.classList.add("sticky-left"), l.style.position = "sticky", l.style.left = n + "px", a !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${a}"]`).forEach((d) => {
|
|
2761
|
-
d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = n + "px";
|
|
2762
|
-
}), n += l.offsetWidth);
|
|
2763
|
-
}
|
|
2764
2766
|
let r = 0;
|
|
2765
|
-
for (const
|
|
2766
|
-
if (
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
}), r +=
|
|
2767
|
+
for (const a of e)
|
|
2768
|
+
if (ot(a, i)) {
|
|
2769
|
+
const l = n.get(a.field), d = t.find((c) => c.getAttribute("data-field") === a.field);
|
|
2770
|
+
d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
|
|
2771
|
+
c.classList.add("sticky-left"), c.style.position = "sticky", c.style.left = r + "px";
|
|
2772
|
+
}), r += d.offsetWidth);
|
|
2773
|
+
}
|
|
2774
|
+
let o = 0;
|
|
2775
|
+
for (const a of [...e].reverse())
|
|
2776
|
+
if (st(a, i)) {
|
|
2777
|
+
const l = n.get(a.field), d = t.find((c) => c.getAttribute("data-field") === a.field);
|
|
2778
|
+
d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
|
|
2779
|
+
c.classList.add("sticky-right"), c.style.position = "sticky", c.style.right = o + "px";
|
|
2780
|
+
}), o += d.offsetWidth);
|
|
2771
2781
|
}
|
|
2772
2782
|
}
|
|
2773
|
-
function
|
|
2783
|
+
function He(s) {
|
|
2774
2784
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2775
2785
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2776
2786
|
});
|
|
2777
2787
|
}
|
|
2778
2788
|
const Ke = "canMoveColumn";
|
|
2779
|
-
class
|
|
2789
|
+
class En extends A {
|
|
2780
2790
|
static manifest = {
|
|
2781
2791
|
ownedProperties: [
|
|
2782
2792
|
{
|
|
2783
2793
|
property: "sticky",
|
|
2784
2794
|
level: "column",
|
|
2785
2795
|
description: 'the "sticky" column property',
|
|
2786
|
-
isUsed: (e) => e === "left" || e === "right"
|
|
2796
|
+
isUsed: (e) => e === "left" || e === "right" || e === "start" || e === "end"
|
|
2787
2797
|
}
|
|
2788
2798
|
],
|
|
2789
2799
|
queries: [
|
|
@@ -2819,21 +2829,21 @@ class bn extends A {
|
|
|
2819
2829
|
return;
|
|
2820
2830
|
const e = this.grid, t = [...this.columns];
|
|
2821
2831
|
if (!se(t)) {
|
|
2822
|
-
|
|
2832
|
+
He(e), this.isApplied = !1;
|
|
2823
2833
|
return;
|
|
2824
2834
|
}
|
|
2825
2835
|
queueMicrotask(() => {
|
|
2826
|
-
|
|
2836
|
+
qe(e, t);
|
|
2827
2837
|
});
|
|
2828
2838
|
}
|
|
2829
2839
|
handleQuery(e) {
|
|
2830
2840
|
switch (e.type) {
|
|
2831
2841
|
case Ke: {
|
|
2832
2842
|
const t = e.context, i = t.sticky;
|
|
2833
|
-
if (i === "left" || i === "right")
|
|
2843
|
+
if (i === "left" || i === "right" || i === "start" || i === "end")
|
|
2834
2844
|
return !1;
|
|
2835
2845
|
const n = t.meta?.sticky;
|
|
2836
|
-
return n === "left" || n === "right" ? !1 : void 0;
|
|
2846
|
+
return n === "left" || n === "right" || n === "start" || n === "end" ? !1 : void 0;
|
|
2837
2847
|
}
|
|
2838
2848
|
case "getStickyOffsets":
|
|
2839
2849
|
return {
|
|
@@ -2846,18 +2856,18 @@ class bn extends A {
|
|
|
2846
2856
|
}
|
|
2847
2857
|
refreshStickyOffsets() {
|
|
2848
2858
|
const e = [...this.columns];
|
|
2849
|
-
|
|
2859
|
+
qe(this.grid, e);
|
|
2850
2860
|
}
|
|
2851
2861
|
getLeftPinnedColumns() {
|
|
2852
|
-
const e = [...this.columns];
|
|
2853
|
-
return
|
|
2862
|
+
const e = [...this.columns], t = ue(this.grid);
|
|
2863
|
+
return pi(e, t);
|
|
2854
2864
|
}
|
|
2855
2865
|
getRightPinnedColumns() {
|
|
2856
|
-
const e = [...this.columns];
|
|
2857
|
-
return
|
|
2866
|
+
const e = [...this.columns], t = ue(this.grid);
|
|
2867
|
+
return mi(e, t);
|
|
2858
2868
|
}
|
|
2859
2869
|
clearStickyPositions() {
|
|
2860
|
-
|
|
2870
|
+
He(this.grid);
|
|
2861
2871
|
}
|
|
2862
2872
|
getHorizontalScrollOffsets(e, t) {
|
|
2863
2873
|
if (!this.isApplied)
|
|
@@ -2878,7 +2888,7 @@ class bn extends A {
|
|
|
2878
2888
|
return { left: i, right: n, skipScroll: r };
|
|
2879
2889
|
}
|
|
2880
2890
|
}
|
|
2881
|
-
function
|
|
2891
|
+
function wi(s) {
|
|
2882
2892
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2883
2893
|
}
|
|
2884
2894
|
function ae(s, e) {
|
|
@@ -2903,7 +2913,7 @@ function ae(s, e) {
|
|
|
2903
2913
|
}
|
|
2904
2914
|
if (s.customPanels)
|
|
2905
2915
|
for (const o of s.customPanels) {
|
|
2906
|
-
const a =
|
|
2916
|
+
const a = bi(o, e);
|
|
2907
2917
|
switch (o.position) {
|
|
2908
2918
|
case "left":
|
|
2909
2919
|
i.appendChild(a);
|
|
@@ -2918,11 +2928,11 @@ function ae(s, e) {
|
|
|
2918
2928
|
}
|
|
2919
2929
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2920
2930
|
}
|
|
2921
|
-
function
|
|
2931
|
+
function ze(s) {
|
|
2922
2932
|
const e = document.createElement("div");
|
|
2923
2933
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2924
2934
|
}
|
|
2925
|
-
function
|
|
2935
|
+
function Oe(s, e, t, i) {
|
|
2926
2936
|
s.innerHTML = "";
|
|
2927
2937
|
for (const n of e) {
|
|
2928
2938
|
const r = document.createElement("div");
|
|
@@ -2936,11 +2946,11 @@ function ze(s, e, t, i) {
|
|
|
2936
2946
|
let l, d;
|
|
2937
2947
|
const c = n.aggregators?.[o.field];
|
|
2938
2948
|
if (c)
|
|
2939
|
-
if (
|
|
2940
|
-
const u =
|
|
2949
|
+
if (wi(c)) {
|
|
2950
|
+
const u = ye(c.aggFunc);
|
|
2941
2951
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2942
2952
|
} else {
|
|
2943
|
-
const u =
|
|
2953
|
+
const u = ye(c);
|
|
2944
2954
|
u && (l = u(i, o.field, o));
|
|
2945
2955
|
}
|
|
2946
2956
|
else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
|
|
@@ -2952,13 +2962,13 @@ function ze(s, e, t, i) {
|
|
|
2952
2962
|
s.appendChild(r);
|
|
2953
2963
|
}
|
|
2954
2964
|
}
|
|
2955
|
-
function
|
|
2965
|
+
function bi(s, e) {
|
|
2956
2966
|
const t = document.createElement("div");
|
|
2957
2967
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2958
2968
|
const i = s.render(e);
|
|
2959
2969
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2960
2970
|
}
|
|
2961
|
-
function
|
|
2971
|
+
function Ge(s, e, t, i, n) {
|
|
2962
2972
|
return {
|
|
2963
2973
|
totalRows: s.length,
|
|
2964
2974
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2968,10 +2978,10 @@ function Oe(s, e, t, i, n) {
|
|
|
2968
2978
|
grid: t
|
|
2969
2979
|
};
|
|
2970
2980
|
}
|
|
2971
|
-
const
|
|
2972
|
-
class
|
|
2981
|
+
const vi = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
2982
|
+
class Rn extends A {
|
|
2973
2983
|
name = "pinnedRows";
|
|
2974
|
-
styles =
|
|
2984
|
+
styles = vi;
|
|
2975
2985
|
get defaultConfig() {
|
|
2976
2986
|
return {
|
|
2977
2987
|
position: "bottom",
|
|
@@ -2993,7 +3003,7 @@ class vn extends A {
|
|
|
2993
3003
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2994
3004
|
if (!t) return;
|
|
2995
3005
|
this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
|
|
2996
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
3006
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Ge(
|
|
2997
3007
|
this.rows,
|
|
2998
3008
|
this.columns,
|
|
2999
3009
|
this.grid,
|
|
@@ -3002,11 +3012,11 @@ class vn extends A {
|
|
|
3002
3012
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
3003
3013
|
if (a.length > 0) {
|
|
3004
3014
|
if (!this.topAggregationContainer) {
|
|
3005
|
-
this.topAggregationContainer =
|
|
3015
|
+
this.topAggregationContainer = ze("top");
|
|
3006
3016
|
const h = e.querySelector(".header");
|
|
3007
3017
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
3008
3018
|
}
|
|
3009
|
-
|
|
3019
|
+
Oe(
|
|
3010
3020
|
this.topAggregationContainer,
|
|
3011
3021
|
a,
|
|
3012
3022
|
this.visibleColumns,
|
|
@@ -3022,7 +3032,7 @@ class vn extends A {
|
|
|
3022
3032
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
3023
3033
|
}
|
|
3024
3034
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
3025
|
-
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer =
|
|
3035
|
+
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = ze("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Oe(
|
|
3026
3036
|
this.bottomAggregationContainer,
|
|
3027
3037
|
l,
|
|
3028
3038
|
this.visibleColumns,
|
|
@@ -3054,7 +3064,7 @@ class vn extends A {
|
|
|
3054
3064
|
}
|
|
3055
3065
|
getContext() {
|
|
3056
3066
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
3057
|
-
return
|
|
3067
|
+
return Ge(
|
|
3058
3068
|
this.rows,
|
|
3059
3069
|
this.columns,
|
|
3060
3070
|
this.grid,
|
|
@@ -3075,16 +3085,16 @@ class vn extends A {
|
|
|
3075
3085
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3076
3086
|
}
|
|
3077
3087
|
}
|
|
3078
|
-
const
|
|
3079
|
-
function
|
|
3088
|
+
const yi = pt;
|
|
3089
|
+
function xi(s) {
|
|
3080
3090
|
const e = [];
|
|
3081
3091
|
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;
|
|
3082
3092
|
}
|
|
3083
|
-
function
|
|
3093
|
+
function be(s, e) {
|
|
3084
3094
|
return [...s, e].join("|");
|
|
3085
3095
|
}
|
|
3086
|
-
function
|
|
3087
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
3096
|
+
function Ci(s, e) {
|
|
3097
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ei(s, i), o = at(
|
|
3088
3098
|
s,
|
|
3089
3099
|
t,
|
|
3090
3100
|
i,
|
|
@@ -3092,7 +3102,7 @@ function wi(s, e) {
|
|
|
3092
3102
|
n,
|
|
3093
3103
|
0,
|
|
3094
3104
|
""
|
|
3095
|
-
), a =
|
|
3105
|
+
), a = Si(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
3096
3106
|
return {
|
|
3097
3107
|
rows: o,
|
|
3098
3108
|
columnKeys: r,
|
|
@@ -3100,7 +3110,7 @@ function wi(s, e) {
|
|
|
3100
3110
|
grandTotal: l
|
|
3101
3111
|
};
|
|
3102
3112
|
}
|
|
3103
|
-
function
|
|
3113
|
+
function Ei(s, e) {
|
|
3104
3114
|
if (e.length === 0) return ["value"];
|
|
3105
3115
|
const t = /* @__PURE__ */ new Set();
|
|
3106
3116
|
for (const i of s) {
|
|
@@ -3109,7 +3119,7 @@ function bi(s, e) {
|
|
|
3109
3119
|
}
|
|
3110
3120
|
return [...t].sort();
|
|
3111
3121
|
}
|
|
3112
|
-
function
|
|
3122
|
+
function Ri(s, e) {
|
|
3113
3123
|
const t = /* @__PURE__ */ new Map();
|
|
3114
3124
|
for (const i of s) {
|
|
3115
3125
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -3117,10 +3127,10 @@ function vi(s, e) {
|
|
|
3117
3127
|
}
|
|
3118
3128
|
return t;
|
|
3119
3129
|
}
|
|
3120
|
-
function
|
|
3130
|
+
function at(s, e, t, i, n, r, o) {
|
|
3121
3131
|
const a = [];
|
|
3122
3132
|
if (e.length === 0) {
|
|
3123
|
-
const h =
|
|
3133
|
+
const h = Be(s, t, i, n), g = Ve(h);
|
|
3124
3134
|
return a.push({
|
|
3125
3135
|
rowKey: o || "all",
|
|
3126
3136
|
rowLabel: o || "All",
|
|
@@ -3131,11 +3141,11 @@ function tt(s, e, t, i, n, r, o) {
|
|
|
3131
3141
|
rowCount: s.length
|
|
3132
3142
|
}), a;
|
|
3133
3143
|
}
|
|
3134
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3144
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ri(s, l);
|
|
3135
3145
|
for (const [h, g] of u) {
|
|
3136
|
-
const f = o ? `${o}|${h}` : h, p =
|
|
3146
|
+
const f = o ? `${o}|${h}` : h, p = Be(g, t, i, n), w = Ve(p);
|
|
3137
3147
|
let b;
|
|
3138
|
-
c && (b =
|
|
3148
|
+
c && (b = at(
|
|
3139
3149
|
g,
|
|
3140
3150
|
d,
|
|
3141
3151
|
t,
|
|
@@ -3156,36 +3166,36 @@ function tt(s, e, t, i, n, r, o) {
|
|
|
3156
3166
|
}
|
|
3157
3167
|
return a;
|
|
3158
3168
|
}
|
|
3159
|
-
function
|
|
3169
|
+
function Be(s, e, t, i) {
|
|
3160
3170
|
const n = {};
|
|
3161
3171
|
for (const r of t)
|
|
3162
3172
|
for (const o of i) {
|
|
3163
|
-
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d =
|
|
3173
|
+
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = yi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
|
|
3164
3174
|
n[u] = c;
|
|
3165
3175
|
}
|
|
3166
3176
|
return n;
|
|
3167
3177
|
}
|
|
3168
|
-
function
|
|
3178
|
+
function Ve(s) {
|
|
3169
3179
|
let e = 0;
|
|
3170
3180
|
for (const t of Object.values(s))
|
|
3171
3181
|
e += t ?? 0;
|
|
3172
3182
|
return e;
|
|
3173
3183
|
}
|
|
3174
|
-
function
|
|
3184
|
+
function Si(s, e, t) {
|
|
3175
3185
|
const i = {};
|
|
3176
3186
|
function n(r) {
|
|
3177
3187
|
for (const o of r)
|
|
3178
3188
|
if (!o.isGroup || !o.children?.length)
|
|
3179
3189
|
for (const a of e)
|
|
3180
3190
|
for (const l of t) {
|
|
3181
|
-
const d =
|
|
3191
|
+
const d = be([a], l.field);
|
|
3182
3192
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
3183
3193
|
}
|
|
3184
3194
|
else o.children && n(o.children);
|
|
3185
3195
|
}
|
|
3186
3196
|
return n(s), i;
|
|
3187
3197
|
}
|
|
3188
|
-
function
|
|
3198
|
+
function ki(s, e, t = !0) {
|
|
3189
3199
|
const i = [];
|
|
3190
3200
|
function n(r) {
|
|
3191
3201
|
i.push(r);
|
|
@@ -3198,7 +3208,7 @@ function xi(s, e, t = !0) {
|
|
|
3198
3208
|
n(r);
|
|
3199
3209
|
return i;
|
|
3200
3210
|
}
|
|
3201
|
-
function
|
|
3211
|
+
function Ai(s) {
|
|
3202
3212
|
const e = [];
|
|
3203
3213
|
function t(i) {
|
|
3204
3214
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -3209,10 +3219,10 @@ function Ci(s) {
|
|
|
3209
3219
|
t(i);
|
|
3210
3220
|
return e;
|
|
3211
3221
|
}
|
|
3212
|
-
const
|
|
3213
|
-
function
|
|
3222
|
+
const _i = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3223
|
+
function Ti(s, e, t, i) {
|
|
3214
3224
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3215
|
-
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () =>
|
|
3225
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Di(t, r))), o.appendChild(j("Row Groups", () => We("rowGroups", r))), o.appendChild(j("Column Groups", () => We("columnGroups", r))), o.appendChild(j("Values", () => Fi(r))), o.appendChild(j("Available Fields", () => Pi(r))), s.appendChild(o), () => {
|
|
3216
3226
|
n.abort(), o.remove();
|
|
3217
3227
|
};
|
|
3218
3228
|
}
|
|
@@ -3224,7 +3234,7 @@ function j(s, e) {
|
|
|
3224
3234
|
const n = document.createElement("div");
|
|
3225
3235
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3226
3236
|
}
|
|
3227
|
-
function
|
|
3237
|
+
function We(s, e) {
|
|
3228
3238
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3229
3239
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
3230
3240
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -3233,7 +3243,7 @@ function Ve(s, e) {
|
|
|
3233
3243
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
3234
3244
|
} else
|
|
3235
3245
|
for (const a of o)
|
|
3236
|
-
r.appendChild(
|
|
3246
|
+
r.appendChild(Li(a, s, e));
|
|
3237
3247
|
return r.addEventListener(
|
|
3238
3248
|
"dragover",
|
|
3239
3249
|
(a) => {
|
|
@@ -3256,7 +3266,7 @@ function Ve(s, e) {
|
|
|
3256
3266
|
{ signal: n }
|
|
3257
3267
|
), r;
|
|
3258
3268
|
}
|
|
3259
|
-
function
|
|
3269
|
+
function Li(s, e, t) {
|
|
3260
3270
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3261
3271
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3262
3272
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -3282,7 +3292,7 @@ function Si(s, e, t) {
|
|
|
3282
3292
|
{ signal: n }
|
|
3283
3293
|
), r;
|
|
3284
3294
|
}
|
|
3285
|
-
function
|
|
3295
|
+
function Fi(s) {
|
|
3286
3296
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3287
3297
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3288
3298
|
const r = e.valueFields ?? [];
|
|
@@ -3291,7 +3301,7 @@ function ki(s) {
|
|
|
3291
3301
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3292
3302
|
} else
|
|
3293
3303
|
for (const o of r)
|
|
3294
|
-
n.appendChild(
|
|
3304
|
+
n.appendChild(Ii(o, s));
|
|
3295
3305
|
return n.addEventListener(
|
|
3296
3306
|
"dragover",
|
|
3297
3307
|
(o) => {
|
|
@@ -3314,7 +3324,7 @@ function ki(s) {
|
|
|
3314
3324
|
{ signal: i }
|
|
3315
3325
|
), n;
|
|
3316
3326
|
}
|
|
3317
|
-
function
|
|
3327
|
+
function Ii(s, e) {
|
|
3318
3328
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3319
3329
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3320
3330
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3323,7 +3333,7 @@ function Ai(s, e) {
|
|
|
3323
3333
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3324
3334
|
const l = document.createElement("select");
|
|
3325
3335
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3326
|
-
for (const c of
|
|
3336
|
+
for (const c of _i) {
|
|
3327
3337
|
const u = document.createElement("option");
|
|
3328
3338
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3329
3339
|
}
|
|
@@ -3343,7 +3353,7 @@ function Ai(s, e) {
|
|
|
3343
3353
|
{ signal: i }
|
|
3344
3354
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3345
3355
|
}
|
|
3346
|
-
function
|
|
3356
|
+
function Pi(s) {
|
|
3347
3357
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3348
3358
|
n.className = "tbw-pivot-available-fields";
|
|
3349
3359
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3373,7 +3383,7 @@ function _i(s) {
|
|
|
3373
3383
|
}
|
|
3374
3384
|
return n;
|
|
3375
3385
|
}
|
|
3376
|
-
function
|
|
3386
|
+
function Di(s, e) {
|
|
3377
3387
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3378
3388
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3379
3389
|
le(
|
|
@@ -3412,7 +3422,7 @@ function le(s, e, t, i) {
|
|
|
3412
3422
|
const o = document.createElement("span");
|
|
3413
3423
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3414
3424
|
}
|
|
3415
|
-
function
|
|
3425
|
+
function Mi(s, e, t) {
|
|
3416
3426
|
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) => {
|
|
3417
3427
|
const r = document.createElement("div");
|
|
3418
3428
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3433,7 +3443,7 @@ function Li(s, e, t) {
|
|
|
3433
3443
|
e.appendChild(r);
|
|
3434
3444
|
}), !0;
|
|
3435
3445
|
}
|
|
3436
|
-
function
|
|
3446
|
+
function Ni(s, e, t, i) {
|
|
3437
3447
|
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) => {
|
|
3438
3448
|
const o = document.createElement("div");
|
|
3439
3449
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3448,7 +3458,7 @@ function Fi(s, e, t, i) {
|
|
|
3448
3458
|
e.appendChild(o);
|
|
3449
3459
|
}), !0;
|
|
3450
3460
|
}
|
|
3451
|
-
function
|
|
3461
|
+
function qi(s, e, t) {
|
|
3452
3462
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3453
3463
|
const r = document.createElement("div");
|
|
3454
3464
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3461,10 +3471,10 @@ function Ii(s, e, t) {
|
|
|
3461
3471
|
e.appendChild(r);
|
|
3462
3472
|
}), !0;
|
|
3463
3473
|
}
|
|
3464
|
-
const
|
|
3474
|
+
const Hi = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
3465
3475
|
class G extends A {
|
|
3466
3476
|
name = "pivot";
|
|
3467
|
-
styles =
|
|
3477
|
+
styles = Hi;
|
|
3468
3478
|
static PANEL_ID = "pivot";
|
|
3469
3479
|
get defaultConfig() {
|
|
3470
3480
|
return {
|
|
@@ -3510,11 +3520,11 @@ class G extends A {
|
|
|
3510
3520
|
processRows(e) {
|
|
3511
3521
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3512
3522
|
return [...e];
|
|
3513
|
-
const t =
|
|
3523
|
+
const t = xi(this.config);
|
|
3514
3524
|
if (t.length > 0)
|
|
3515
3525
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3516
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult =
|
|
3517
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3526
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = Ci(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
3527
|
+
const i = this.config.indentWidth ?? 20, n = ki(
|
|
3518
3528
|
this.pivotResult.rows,
|
|
3519
3529
|
this.expandedKeys,
|
|
3520
3530
|
this.defaultExpanded
|
|
@@ -3549,7 +3559,7 @@ class G extends A {
|
|
|
3549
3559
|
});
|
|
3550
3560
|
for (const n of this.pivotResult.columnKeys)
|
|
3551
3561
|
for (const r of this.config.valueFields ?? []) {
|
|
3552
|
-
const o =
|
|
3562
|
+
const o = be([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3553
3563
|
t.push({
|
|
3554
3564
|
field: o,
|
|
3555
3565
|
header: `${n} - ${a} (${r.aggFunc})`,
|
|
@@ -3566,13 +3576,13 @@ class G extends A {
|
|
|
3566
3576
|
}
|
|
3567
3577
|
renderRow(e, t, i) {
|
|
3568
3578
|
const n = e;
|
|
3569
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3579
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Mi(n, t, {
|
|
3570
3580
|
columns: this.gridColumns,
|
|
3571
3581
|
rowIndex: i,
|
|
3572
3582
|
onToggle: (r) => this.toggle(r),
|
|
3573
3583
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3574
3584
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3575
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3585
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Ni(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3576
3586
|
}
|
|
3577
3587
|
cleanupPivotStyling(e) {
|
|
3578
3588
|
(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 = "");
|
|
@@ -3610,7 +3620,7 @@ class G extends A {
|
|
|
3610
3620
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3611
3621
|
...this.pivotResult.totals
|
|
3612
3622
|
};
|
|
3613
|
-
|
|
3623
|
+
qi(i, this.grandTotalFooter, this.gridColumns);
|
|
3614
3624
|
}
|
|
3615
3625
|
cleanupGrandTotalFooter() {
|
|
3616
3626
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3632,7 +3642,7 @@ class G extends A {
|
|
|
3632
3642
|
}
|
|
3633
3643
|
expandAllKeys() {
|
|
3634
3644
|
if (!this.pivotResult) return;
|
|
3635
|
-
const e =
|
|
3645
|
+
const e = Ai(this.pivotResult.rows);
|
|
3636
3646
|
for (const t of e)
|
|
3637
3647
|
this.expandedKeys.add(t);
|
|
3638
3648
|
}
|
|
@@ -3717,7 +3727,7 @@ class G extends A {
|
|
|
3717
3727
|
},
|
|
3718
3728
|
getAvailableFields: () => this.getAvailableFields()
|
|
3719
3729
|
};
|
|
3720
|
-
return
|
|
3730
|
+
return Ti(e, this.config, this.isActive, t);
|
|
3721
3731
|
}
|
|
3722
3732
|
refreshPanel() {
|
|
3723
3733
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3751,7 +3761,7 @@ class G extends A {
|
|
|
3751
3761
|
}
|
|
3752
3762
|
}
|
|
3753
3763
|
const Q = "tbw-print-isolation-style";
|
|
3754
|
-
function
|
|
3764
|
+
function Ki(s, e) {
|
|
3755
3765
|
const t = document.createElement("style");
|
|
3756
3766
|
return t.id = Q, t.textContent = `
|
|
3757
3767
|
/* Print isolation: hide everything except the target grid */
|
|
@@ -3825,12 +3835,12 @@ function Di(s, e) {
|
|
|
3825
3835
|
}
|
|
3826
3836
|
`, t;
|
|
3827
3837
|
}
|
|
3828
|
-
async function
|
|
3838
|
+
async function zi(s, e = {}) {
|
|
3829
3839
|
const { orientation: t = "landscape" } = e, i = s.id;
|
|
3830
3840
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3831
3841
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3832
3842
|
), document.getElementById(Q)?.remove();
|
|
3833
|
-
const r =
|
|
3843
|
+
const r = Ki(i, t);
|
|
3834
3844
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3835
3845
|
const a = () => {
|
|
3836
3846
|
window.removeEventListener("afterprint", a), document.getElementById(Q)?.remove(), o();
|
|
@@ -3840,7 +3850,7 @@ async function Mi(s, e = {}) {
|
|
|
3840
3850
|
}, 5e3);
|
|
3841
3851
|
});
|
|
3842
3852
|
}
|
|
3843
|
-
const
|
|
3853
|
+
const Oi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:end}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-inline-end:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Gi = {
|
|
3844
3854
|
button: !1,
|
|
3845
3855
|
orientation: "landscape",
|
|
3846
3856
|
warnThreshold: 500,
|
|
@@ -3850,10 +3860,10 @@ const Ni = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3850
3860
|
title: "",
|
|
3851
3861
|
isolate: !1
|
|
3852
3862
|
};
|
|
3853
|
-
class
|
|
3863
|
+
class Sn extends A {
|
|
3854
3864
|
name = "print";
|
|
3855
3865
|
version = "1.0.0";
|
|
3856
|
-
styles =
|
|
3866
|
+
styles = Oi;
|
|
3857
3867
|
#e = !1;
|
|
3858
3868
|
#t = null;
|
|
3859
3869
|
#o = null;
|
|
@@ -3861,7 +3871,7 @@ class yn extends A {
|
|
|
3861
3871
|
#i = null;
|
|
3862
3872
|
#r = null;
|
|
3863
3873
|
#d = null;
|
|
3864
|
-
get #
|
|
3874
|
+
get #s() {
|
|
3865
3875
|
return this.grid;
|
|
3866
3876
|
}
|
|
3867
3877
|
isPrinting() {
|
|
@@ -3877,7 +3887,7 @@ class yn extends A {
|
|
|
3877
3887
|
console.warn("[PrintPlugin] Grid not available");
|
|
3878
3888
|
return;
|
|
3879
3889
|
}
|
|
3880
|
-
const i = { ...
|
|
3890
|
+
const i = { ...Gi, ...this.config, ...e }, r = this.rows.length;
|
|
3881
3891
|
let o = r, a = !1;
|
|
3882
3892
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3883
3893
|
const d = i.maxRows > 0 ? `
|
|
@@ -3898,10 +3908,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3898
3908
|
originalRowCount: r
|
|
3899
3909
|
});
|
|
3900
3910
|
try {
|
|
3901
|
-
const d = this.#
|
|
3911
|
+
const d = this.#s;
|
|
3902
3912
|
this.#o = {
|
|
3903
3913
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
3904
|
-
}, this.#
|
|
3914
|
+
}, this.#p(), a && (this.#n = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#c(i), await this.#a(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#g(i) : await this.#u(), this.emit("print-complete", {
|
|
3905
3915
|
success: !0,
|
|
3906
3916
|
rowCount: o,
|
|
3907
3917
|
duration: Math.round(performance.now() - l)
|
|
@@ -3913,7 +3923,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3913
3923
|
duration: Math.round(performance.now() - l)
|
|
3914
3924
|
});
|
|
3915
3925
|
} finally {
|
|
3916
|
-
this.#
|
|
3926
|
+
this.#m(), this.#e = !1;
|
|
3917
3927
|
}
|
|
3918
3928
|
}
|
|
3919
3929
|
#c(e) {
|
|
@@ -3930,13 +3940,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3930
3940
|
t.insertBefore(this.#i, t.firstChild), this.#r = document.createElement("div"), this.#r.className = "tbw-print-footer", this.#r.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#r);
|
|
3931
3941
|
}
|
|
3932
3942
|
}
|
|
3933
|
-
async #
|
|
3934
|
-
const e = this.#
|
|
3943
|
+
async #a() {
|
|
3944
|
+
const e = this.#s;
|
|
3935
3945
|
if (!e._virtualization) return;
|
|
3936
3946
|
const t = this.rows.length;
|
|
3937
3947
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
3938
3948
|
}
|
|
3939
|
-
async #
|
|
3949
|
+
async #u() {
|
|
3940
3950
|
return new Promise((e) => {
|
|
3941
3951
|
const t = () => {
|
|
3942
3952
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -3946,13 +3956,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3946
3956
|
}, 1e3);
|
|
3947
3957
|
});
|
|
3948
3958
|
}
|
|
3949
|
-
async #
|
|
3959
|
+
async #g(e) {
|
|
3950
3960
|
const t = this.gridElement;
|
|
3951
|
-
t && await
|
|
3961
|
+
t && await zi(t, {
|
|
3952
3962
|
orientation: e.orientation
|
|
3953
3963
|
});
|
|
3954
3964
|
}
|
|
3955
|
-
#
|
|
3965
|
+
#p() {
|
|
3956
3966
|
const e = this.columns;
|
|
3957
3967
|
if (e) {
|
|
3958
3968
|
this.#t = /* @__PURE__ */ new Map();
|
|
@@ -3960,26 +3970,26 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3960
3970
|
t.printHidden && t.field && (this.#t.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
3961
3971
|
}
|
|
3962
3972
|
}
|
|
3963
|
-
#
|
|
3973
|
+
#l() {
|
|
3964
3974
|
if (this.#t) {
|
|
3965
3975
|
for (const [e, t] of this.#t)
|
|
3966
3976
|
this.grid.setColumnVisible(e, t);
|
|
3967
3977
|
this.#t = null;
|
|
3968
3978
|
}
|
|
3969
3979
|
}
|
|
3970
|
-
#
|
|
3980
|
+
#m() {
|
|
3971
3981
|
const e = this.gridElement;
|
|
3972
3982
|
if (!e) return;
|
|
3973
|
-
this.#
|
|
3974
|
-
const t = this.#
|
|
3983
|
+
this.#l(), e.classList.remove("print-portrait", "print-landscape"), this.#d !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#d = null), this.#i && (this.#i.remove(), this.#i = null), this.#r && (this.#r.remove(), this.#r = null);
|
|
3984
|
+
const t = this.#s;
|
|
3975
3985
|
this.#o && t._virtualization && (t._virtualization.bypassThreshold = this.#o.bypassThreshold, t.refreshVirtualWindow(!0), this.#o = null), this.#n !== null && (this.grid.rows = this.#n, this.#n = null);
|
|
3976
3986
|
}
|
|
3977
3987
|
afterRender() {
|
|
3978
|
-
this.config?.button && !this.#
|
|
3988
|
+
this.config?.button && !this.#h && (this.#f(), this.#h = !0);
|
|
3979
3989
|
}
|
|
3980
|
-
#
|
|
3981
|
-
#
|
|
3982
|
-
this.#
|
|
3990
|
+
#h = !1;
|
|
3991
|
+
#f() {
|
|
3992
|
+
this.#s.registerToolbarContent?.({
|
|
3983
3993
|
id: "print-button",
|
|
3984
3994
|
order: 900,
|
|
3985
3995
|
render: (t) => {
|
|
@@ -3997,19 +4007,19 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3997
4007
|
});
|
|
3998
4008
|
}
|
|
3999
4009
|
}
|
|
4000
|
-
function
|
|
4010
|
+
function Bi(s) {
|
|
4001
4011
|
const e = s.meta ?? {};
|
|
4002
4012
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4003
4013
|
}
|
|
4004
|
-
function
|
|
4014
|
+
function $e(s, e, t) {
|
|
4005
4015
|
if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
|
|
4006
4016
|
const i = [...s], [n] = i.splice(e, 1);
|
|
4007
4017
|
return i.splice(t, 0, n), i;
|
|
4008
4018
|
}
|
|
4009
|
-
const
|
|
4010
|
-
class
|
|
4019
|
+
const Vi = '@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}}';
|
|
4020
|
+
class kn extends A {
|
|
4011
4021
|
name = "reorder";
|
|
4012
|
-
styles =
|
|
4022
|
+
styles = Vi;
|
|
4013
4023
|
get defaultConfig() {
|
|
4014
4024
|
return {
|
|
4015
4025
|
animation: "flip"
|
|
@@ -4026,7 +4036,7 @@ class xn extends A {
|
|
|
4026
4036
|
draggedIndex = null;
|
|
4027
4037
|
dropIndex = null;
|
|
4028
4038
|
canMoveColumnWithPlugins(e) {
|
|
4029
|
-
return !e || !
|
|
4039
|
+
return !e || !Bi(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
|
|
4030
4040
|
}
|
|
4031
4041
|
clearDragClasses() {
|
|
4032
4042
|
this.gridElement?.querySelectorAll(".header-row > .cell").forEach((e) => {
|
|
@@ -4073,7 +4083,7 @@ class xn extends A {
|
|
|
4073
4083
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4074
4084
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4075
4085
|
return;
|
|
4076
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g =
|
|
4086
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = $e(h, d, u), f = {
|
|
4077
4087
|
field: l,
|
|
4078
4088
|
fromIndex: d,
|
|
4079
4089
|
toIndex: u,
|
|
@@ -4104,7 +4114,7 @@ class xn extends A {
|
|
|
4104
4114
|
moveColumn(e, t) {
|
|
4105
4115
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
4106
4116
|
if (n === -1) return;
|
|
4107
|
-
const r =
|
|
4117
|
+
const r = $e(i, n, t);
|
|
4108
4118
|
this.emitCancelable("column-move", {
|
|
4109
4119
|
field: e,
|
|
4110
4120
|
fromIndex: n,
|
|
@@ -4199,11 +4209,11 @@ class xn extends A {
|
|
|
4199
4209
|
this.grid.requestStateChange?.();
|
|
4200
4210
|
}
|
|
4201
4211
|
}
|
|
4202
|
-
const
|
|
4203
|
-
class
|
|
4212
|
+
const Wi = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-inline-start:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-inline-end:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-inline-end:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
4213
|
+
class An extends A {
|
|
4204
4214
|
name = "responsive";
|
|
4205
4215
|
version = "1.0.0";
|
|
4206
|
-
styles =
|
|
4216
|
+
styles = Wi;
|
|
4207
4217
|
static manifest = {
|
|
4208
4218
|
incompatibleWith: [
|
|
4209
4219
|
{
|
|
@@ -4225,20 +4235,20 @@ class Cn extends A {
|
|
|
4225
4235
|
#i = 0;
|
|
4226
4236
|
#r = /* @__PURE__ */ new Set();
|
|
4227
4237
|
#d = /* @__PURE__ */ new Set();
|
|
4228
|
-
#
|
|
4238
|
+
#s = null;
|
|
4229
4239
|
#c = [];
|
|
4230
4240
|
isResponsive() {
|
|
4231
4241
|
return this.#t;
|
|
4232
4242
|
}
|
|
4233
4243
|
setResponsive(e) {
|
|
4234
|
-
e !== this.#t && (this.#t = e, this.#
|
|
4244
|
+
e !== this.#t && (this.#t = e, this.#m(), this.emit("responsive-change", {
|
|
4235
4245
|
isResponsive: e,
|
|
4236
4246
|
width: this.#i,
|
|
4237
4247
|
breakpoint: this.config.breakpoint ?? 0
|
|
4238
4248
|
}));
|
|
4239
4249
|
}
|
|
4240
4250
|
setBreakpoint(e) {
|
|
4241
|
-
this.config.breakpoint = e, this.#
|
|
4251
|
+
this.config.breakpoint = e, this.#g(this.#i);
|
|
4242
4252
|
}
|
|
4243
4253
|
setCardRenderer(e) {
|
|
4244
4254
|
this.config.cardRenderer = e, this.#t && this.requestRender();
|
|
@@ -4247,17 +4257,42 @@ class Cn extends A {
|
|
|
4247
4257
|
return this.#i;
|
|
4248
4258
|
}
|
|
4249
4259
|
getActiveBreakpoint() {
|
|
4250
|
-
return this.#
|
|
4260
|
+
return this.#s;
|
|
4251
4261
|
}
|
|
4252
4262
|
attach(e) {
|
|
4253
|
-
super.attach(e), this.#
|
|
4263
|
+
super.attach(e), this.#a(), this.#u(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#c = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
|
|
4254
4264
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4255
4265
|
this.#i = i, clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
4256
|
-
this.#
|
|
4266
|
+
this.#g(i);
|
|
4257
4267
|
}, this.config.debounceMs ?? 100);
|
|
4258
4268
|
}), this.#e.observe(this.gridElement);
|
|
4259
4269
|
}
|
|
4260
|
-
#
|
|
4270
|
+
#a() {
|
|
4271
|
+
const e = this.grid;
|
|
4272
|
+
if (!e || typeof e.querySelector != "function") return;
|
|
4273
|
+
const t = e.querySelector("tbw-grid-responsive-card");
|
|
4274
|
+
if (!t) return;
|
|
4275
|
+
const i = e;
|
|
4276
|
+
if (i.__frameworkAdapter?.parseResponsiveCardElement) {
|
|
4277
|
+
const u = i.__frameworkAdapter.parseResponsiveCardElement(t);
|
|
4278
|
+
u && (this.config = { ...this.config, cardRenderer: u });
|
|
4279
|
+
}
|
|
4280
|
+
const n = t.getAttribute("breakpoint"), r = t.getAttribute("card-row-height"), o = t.getAttribute("hidden-columns"), a = t.getAttribute("hide-header"), l = t.getAttribute("debounce-ms"), d = {};
|
|
4281
|
+
if (n !== null) {
|
|
4282
|
+
const u = parseInt(n, 10);
|
|
4283
|
+
isNaN(u) || (d.breakpoint = u);
|
|
4284
|
+
}
|
|
4285
|
+
if (r !== null && (d.cardRowHeight = r === "auto" ? "auto" : parseInt(r, 10)), o !== null && (d.hiddenColumns = o.split(",").map((u) => u.trim()).filter((u) => u.length > 0)), a !== null && (d.hideHeader = a !== "false"), l !== null) {
|
|
4286
|
+
const u = parseInt(l, 10);
|
|
4287
|
+
isNaN(u) || (d.debounceMs = u);
|
|
4288
|
+
}
|
|
4289
|
+
const c = t.innerHTML.trim();
|
|
4290
|
+
c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
|
|
4291
|
+
const h = Je(c, { value: u, row: u }), g = et(h), f = document.createElement("div");
|
|
4292
|
+
return f.className = "tbw-responsive-card-content", f.innerHTML = g, f;
|
|
4293
|
+
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4294
|
+
}
|
|
4295
|
+
#u(e) {
|
|
4261
4296
|
if (this.#r.clear(), this.#d.clear(), !!e)
|
|
4262
4297
|
for (const t of e)
|
|
4263
4298
|
typeof t == "string" ? this.#r.add(t) : t.showValue ? this.#d.add(t.field) : this.#r.add(t.field);
|
|
@@ -4270,7 +4305,7 @@ class Cn extends A {
|
|
|
4270
4305
|
return this.#t;
|
|
4271
4306
|
}
|
|
4272
4307
|
afterRender() {
|
|
4273
|
-
if (this.#
|
|
4308
|
+
if (this.#R(), !(this.#c.length > 0 ? this.#s !== null : this.#t))
|
|
4274
4309
|
return;
|
|
4275
4310
|
const t = this.#r.size > 0, i = this.#d.size > 0;
|
|
4276
4311
|
if (!t && !i)
|
|
@@ -4281,7 +4316,7 @@ class Cn extends A {
|
|
|
4281
4316
|
o && (this.#r.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#d.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
|
|
4282
4317
|
}
|
|
4283
4318
|
}
|
|
4284
|
-
#
|
|
4319
|
+
#g(e) {
|
|
4285
4320
|
if (this.#c.length > 0) {
|
|
4286
4321
|
this.#p(e);
|
|
4287
4322
|
return;
|
|
@@ -4291,7 +4326,7 @@ class Cn extends A {
|
|
|
4291
4326
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4292
4327
|
));
|
|
4293
4328
|
const i = t > 0 && e < t;
|
|
4294
|
-
i !== this.#t && (this.#t = i, this.#
|
|
4329
|
+
i !== this.#t && (this.#t = i, this.#m(), this.emit("responsive-change", {
|
|
4295
4330
|
isResponsive: i,
|
|
4296
4331
|
width: e,
|
|
4297
4332
|
breakpoint: t
|
|
@@ -4301,10 +4336,10 @@ class Cn extends A {
|
|
|
4301
4336
|
let t = null;
|
|
4302
4337
|
for (const n of this.#c)
|
|
4303
4338
|
e <= n.maxWidth && (t = n);
|
|
4304
|
-
if (t !== this.#
|
|
4305
|
-
this.#
|
|
4339
|
+
if (t !== this.#s) {
|
|
4340
|
+
this.#s = t, t?.hiddenColumns ? this.#u(t.hiddenColumns) : this.#u(this.config.hiddenColumns);
|
|
4306
4341
|
const n = t?.cardLayout === !0;
|
|
4307
|
-
n !== this.#t && (this.#t = n, this.#
|
|
4342
|
+
n !== this.#t && (this.#t = n, this.#m()), this.emit("responsive-change", {
|
|
4308
4343
|
isResponsive: this.#t,
|
|
4309
4344
|
width: e,
|
|
4310
4345
|
breakpoint: t?.maxWidth ?? 0
|
|
@@ -4312,7 +4347,7 @@ class Cn extends A {
|
|
|
4312
4347
|
}
|
|
4313
4348
|
}
|
|
4314
4349
|
#l;
|
|
4315
|
-
#
|
|
4350
|
+
#m() {
|
|
4316
4351
|
this.gridElement.toggleAttribute("data-responsive", this.#t);
|
|
4317
4352
|
const e = this.config.animate !== !1;
|
|
4318
4353
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
@@ -4325,7 +4360,7 @@ class Cn extends A {
|
|
|
4325
4360
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
4326
4361
|
for (const n of i)
|
|
4327
4362
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
4328
|
-
this.#l && this.#l > 0 && t._virtualization && (t._virtualization.rowHeight = this.#l, this.#l = void 0), this.#
|
|
4363
|
+
this.#l && this.#l > 0 && t._virtualization && (t._virtualization.rowHeight = this.#l, this.#l = void 0), this.#h = void 0, this.#f = void 0, this.#w = void 0;
|
|
4329
4364
|
}
|
|
4330
4365
|
}
|
|
4331
4366
|
renderRow(e, t, i) {
|
|
@@ -4365,79 +4400,79 @@ class Cn extends A {
|
|
|
4365
4400
|
}
|
|
4366
4401
|
return !1;
|
|
4367
4402
|
}
|
|
4403
|
+
#h;
|
|
4368
4404
|
#f;
|
|
4369
|
-
#
|
|
4370
|
-
#
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
return this.#f;
|
|
4405
|
+
#w;
|
|
4406
|
+
#y() {
|
|
4407
|
+
if (this.#h && this.#h > 0)
|
|
4408
|
+
return this.#h;
|
|
4374
4409
|
const e = this.config.cardRowHeight;
|
|
4375
4410
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
4376
4411
|
}
|
|
4377
|
-
#
|
|
4378
|
-
return this.#
|
|
4412
|
+
#x() {
|
|
4413
|
+
return this.#f && this.#f > 0 ? this.#f : this.#l ?? 28;
|
|
4379
4414
|
}
|
|
4380
|
-
#
|
|
4415
|
+
#b() {
|
|
4381
4416
|
for (const e of this.rows)
|
|
4382
4417
|
if (e.__isGroupRow)
|
|
4383
4418
|
return !0;
|
|
4384
4419
|
return !1;
|
|
4385
4420
|
}
|
|
4386
|
-
#
|
|
4421
|
+
#C() {
|
|
4387
4422
|
let e = 0, t = 0;
|
|
4388
4423
|
for (const i of this.rows)
|
|
4389
4424
|
i.__isGroupRow ? e++ : t++;
|
|
4390
4425
|
return { groupCount: e, cardCount: t };
|
|
4391
4426
|
}
|
|
4392
4427
|
getExtraHeight() {
|
|
4393
|
-
if (!this.#t || !this.config.cardRenderer || !this.#
|
|
4428
|
+
if (!this.#t || !this.config.cardRenderer || !this.#b())
|
|
4394
4429
|
return 0;
|
|
4395
|
-
const e = this.#l ?? 28, t = this.#
|
|
4430
|
+
const e = this.#l ?? 28, t = this.#x(), i = this.#y(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
|
|
4396
4431
|
return o + a;
|
|
4397
4432
|
}
|
|
4398
4433
|
getExtraHeightBefore(e) {
|
|
4399
|
-
if (!this.#t || !this.config.cardRenderer || !this.#
|
|
4434
|
+
if (!this.#t || !this.config.cardRenderer || !this.#b())
|
|
4400
4435
|
return 0;
|
|
4401
|
-
const t = this.#l ?? 28, i = this.#
|
|
4436
|
+
const t = this.#l ?? 28, i = this.#x(), n = this.#y(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
4402
4437
|
let a = 0, l = 0;
|
|
4403
4438
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4404
4439
|
for (let u = 0; u < c; u++)
|
|
4405
4440
|
d[u].__isGroupRow ? a++ : l++;
|
|
4406
4441
|
return a * r + l * o;
|
|
4407
4442
|
}
|
|
4408
|
-
#
|
|
4443
|
+
#E() {
|
|
4409
4444
|
let e = 0;
|
|
4410
4445
|
for (const t of this.rows)
|
|
4411
4446
|
t.__isGroupRow || e++;
|
|
4412
4447
|
return e;
|
|
4413
4448
|
}
|
|
4414
|
-
#
|
|
4415
|
-
#
|
|
4449
|
+
#v = !1;
|
|
4450
|
+
#R() {
|
|
4416
4451
|
if (!this.#t || !this.config.cardRenderer)
|
|
4417
4452
|
return;
|
|
4418
4453
|
let e = !1;
|
|
4419
|
-
const t = this.grid, i = this.#
|
|
4420
|
-
if (n !== this.#
|
|
4454
|
+
const t = this.grid, i = this.#b(), n = this.#E();
|
|
4455
|
+
if (n !== this.#w && (this.#w = n, e = !0), i) {
|
|
4421
4456
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4422
4457
|
if (o) {
|
|
4423
4458
|
const a = o.getBoundingClientRect().height;
|
|
4424
|
-
a > 0 && a !== this.#
|
|
4459
|
+
a > 0 && a !== this.#f && (this.#f = a, e = !0);
|
|
4425
4460
|
}
|
|
4426
4461
|
}
|
|
4427
4462
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
4428
4463
|
if (r) {
|
|
4429
4464
|
const o = r.getBoundingClientRect().height;
|
|
4430
|
-
o > 0 && o !== this.#
|
|
4465
|
+
o > 0 && o !== this.#h && (this.#h = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
4431
4466
|
}
|
|
4432
|
-
e && !this.#
|
|
4433
|
-
this.#
|
|
4467
|
+
e && !this.#v && (this.#v = !0, queueMicrotask(() => {
|
|
4468
|
+
this.#v = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
4434
4469
|
}));
|
|
4435
4470
|
}
|
|
4436
4471
|
}
|
|
4437
|
-
const
|
|
4438
|
-
class
|
|
4472
|
+
const $i = '@layer tbw-plugins{.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', ji = "__tbw_row_drag";
|
|
4473
|
+
class _n extends A {
|
|
4439
4474
|
name = "rowReorder";
|
|
4440
|
-
styles =
|
|
4475
|
+
styles = $i;
|
|
4441
4476
|
get defaultConfig() {
|
|
4442
4477
|
return {
|
|
4443
4478
|
enableKeyboard: !0,
|
|
@@ -4464,7 +4499,7 @@ class En extends A {
|
|
|
4464
4499
|
if (!this.config.showDragHandle)
|
|
4465
4500
|
return [...e];
|
|
4466
4501
|
const t = {
|
|
4467
|
-
field:
|
|
4502
|
+
field: ji,
|
|
4468
4503
|
header: "",
|
|
4469
4504
|
width: this.config.dragHandleWidth ?? 40,
|
|
4470
4505
|
resizable: !1,
|
|
@@ -4655,34 +4690,34 @@ function V(s) {
|
|
|
4655
4690
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4656
4691
|
};
|
|
4657
4692
|
}
|
|
4658
|
-
function
|
|
4693
|
+
function Ui(s) {
|
|
4659
4694
|
const e = V(s);
|
|
4660
4695
|
return {
|
|
4661
4696
|
from: { row: e.startRow, col: e.startCol },
|
|
4662
4697
|
to: { row: e.endRow, col: e.endCol }
|
|
4663
4698
|
};
|
|
4664
4699
|
}
|
|
4665
|
-
function
|
|
4666
|
-
return s.map(
|
|
4700
|
+
function lt(s) {
|
|
4701
|
+
return s.map(Ui);
|
|
4667
4702
|
}
|
|
4668
|
-
function
|
|
4703
|
+
function Yi(s, e, t) {
|
|
4669
4704
|
const i = V(t);
|
|
4670
4705
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4671
4706
|
}
|
|
4672
|
-
function
|
|
4673
|
-
return t.some((i) =>
|
|
4707
|
+
function je(s, e, t) {
|
|
4708
|
+
return t.some((i) => Yi(s, e, i));
|
|
4674
4709
|
}
|
|
4675
|
-
function
|
|
4710
|
+
function Xi(s) {
|
|
4676
4711
|
const e = [], t = V(s);
|
|
4677
4712
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4678
4713
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4679
4714
|
e.push({ row: i, col: n });
|
|
4680
4715
|
return e;
|
|
4681
4716
|
}
|
|
4682
|
-
function
|
|
4717
|
+
function Zi(s) {
|
|
4683
4718
|
const e = /* @__PURE__ */ new Map();
|
|
4684
4719
|
for (const t of s)
|
|
4685
|
-
for (const i of
|
|
4720
|
+
for (const i of Xi(t))
|
|
4686
4721
|
e.set(`${i.row},${i.col}`, i);
|
|
4687
4722
|
return [...e.values()];
|
|
4688
4723
|
}
|
|
@@ -4698,8 +4733,8 @@ function Z(s, e) {
|
|
|
4698
4733
|
const t = V(s), i = V(e);
|
|
4699
4734
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4700
4735
|
}
|
|
4701
|
-
const
|
|
4702
|
-
function
|
|
4736
|
+
const Qi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4737
|
+
function Ji(s, e, t) {
|
|
4703
4738
|
if (s === "cell" && e.selectedCell)
|
|
4704
4739
|
return {
|
|
4705
4740
|
mode: s,
|
|
@@ -4717,9 +4752,9 @@ function Ui(s, e, t) {
|
|
|
4717
4752
|
}));
|
|
4718
4753
|
return { mode: s, ranges: i };
|
|
4719
4754
|
}
|
|
4720
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4755
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: lt(e.ranges) } : { mode: s, ranges: [] };
|
|
4721
4756
|
}
|
|
4722
|
-
class
|
|
4757
|
+
class Tn extends A {
|
|
4723
4758
|
static manifest = {
|
|
4724
4759
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
4725
4760
|
configRules: [
|
|
@@ -4734,7 +4769,7 @@ class Rn extends A {
|
|
|
4734
4769
|
]
|
|
4735
4770
|
};
|
|
4736
4771
|
name = "selection";
|
|
4737
|
-
styles =
|
|
4772
|
+
styles = Qi;
|
|
4738
4773
|
get defaultConfig() {
|
|
4739
4774
|
return {
|
|
4740
4775
|
mode: "cell",
|
|
@@ -4900,14 +4935,14 @@ class Rn extends A {
|
|
|
4900
4935
|
const r = e.querySelectorAll(".data-grid-row");
|
|
4901
4936
|
if (r.forEach((o) => {
|
|
4902
4937
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4903
|
-
}), t === "row" && (
|
|
4904
|
-
const a = o.querySelector(".cell[data-row]"), l =
|
|
4938
|
+
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
4939
|
+
const a = o.querySelector(".cell[data-row]"), l = mt(a);
|
|
4905
4940
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4906
4941
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4907
4942
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4908
4943
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4909
4944
|
}), t === "range" && this.ranges.length > 0) {
|
|
4910
|
-
|
|
4945
|
+
xe(e);
|
|
4911
4946
|
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !q(d));
|
|
4912
4947
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4913
4948
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
@@ -4915,7 +4950,7 @@ class Rn extends A {
|
|
|
4915
4950
|
const h = this.columns[u];
|
|
4916
4951
|
if (h && q(h))
|
|
4917
4952
|
return;
|
|
4918
|
-
if (
|
|
4953
|
+
if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4919
4954
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4920
4955
|
const f = Math.max(o.startCol, a);
|
|
4921
4956
|
u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
@@ -4952,10 +4987,10 @@ class Rn extends A {
|
|
|
4952
4987
|
};
|
|
4953
4988
|
}
|
|
4954
4989
|
getSelectedCells() {
|
|
4955
|
-
return
|
|
4990
|
+
return Zi(this.ranges);
|
|
4956
4991
|
}
|
|
4957
4992
|
isCellSelected(e, t) {
|
|
4958
|
-
return
|
|
4993
|
+
return je(e, t, this.ranges);
|
|
4959
4994
|
}
|
|
4960
4995
|
clearSelection() {
|
|
4961
4996
|
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();
|
|
@@ -4968,11 +5003,11 @@ class Rn extends A {
|
|
|
4968
5003
|
endCol: t.to.col
|
|
4969
5004
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4970
5005
|
mode: this.config.mode,
|
|
4971
|
-
ranges:
|
|
5006
|
+
ranges: lt(this.ranges)
|
|
4972
5007
|
}), this.requestAfterRender();
|
|
4973
5008
|
}
|
|
4974
5009
|
#t() {
|
|
4975
|
-
return
|
|
5010
|
+
return Ji(
|
|
4976
5011
|
this.config.mode,
|
|
4977
5012
|
{
|
|
4978
5013
|
selectedCell: this.selectedCell,
|
|
@@ -4986,20 +5021,20 @@ class Rn extends A {
|
|
|
4986
5021
|
function J(s, e) {
|
|
4987
5022
|
return Math.floor(s / e);
|
|
4988
5023
|
}
|
|
4989
|
-
function
|
|
5024
|
+
function en(s, e) {
|
|
4990
5025
|
return {
|
|
4991
5026
|
start: s * e,
|
|
4992
5027
|
end: (s + 1) * e
|
|
4993
5028
|
};
|
|
4994
5029
|
}
|
|
4995
|
-
function
|
|
5030
|
+
function tn(s, e, t) {
|
|
4996
5031
|
const i = J(s, t), n = J(e - 1, t), r = [];
|
|
4997
5032
|
for (let o = i; o <= n; o++)
|
|
4998
5033
|
r.push(o);
|
|
4999
5034
|
return r;
|
|
5000
5035
|
}
|
|
5001
|
-
async function
|
|
5002
|
-
const n =
|
|
5036
|
+
async function Ue(s, e, t, i) {
|
|
5037
|
+
const n = en(e, t);
|
|
5003
5038
|
return s.getRows({
|
|
5004
5039
|
startRow: n.start,
|
|
5005
5040
|
endRow: n.end,
|
|
@@ -5007,14 +5042,14 @@ async function je(s, e, t, i) {
|
|
|
5007
5042
|
filterModel: i.filterModel
|
|
5008
5043
|
});
|
|
5009
5044
|
}
|
|
5010
|
-
function
|
|
5045
|
+
function nn(s, e, t) {
|
|
5011
5046
|
const i = J(s, e), n = t.get(i);
|
|
5012
5047
|
if (!n) return;
|
|
5013
5048
|
const r = s % e;
|
|
5014
5049
|
return n[r];
|
|
5015
5050
|
}
|
|
5016
|
-
const
|
|
5017
|
-
class
|
|
5051
|
+
const rn = 100;
|
|
5052
|
+
class Ln extends A {
|
|
5018
5053
|
name = "serverSide";
|
|
5019
5054
|
get defaultConfig() {
|
|
5020
5055
|
return {
|
|
@@ -5034,12 +5069,12 @@ class Sn extends A {
|
|
|
5034
5069
|
}
|
|
5035
5070
|
loadRequiredBlocks() {
|
|
5036
5071
|
if (!this.dataSource) return;
|
|
5037
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
5072
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = tn(i.startRow, i.endRow, t);
|
|
5038
5073
|
for (const r of n)
|
|
5039
5074
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
5040
5075
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
5041
5076
|
break;
|
|
5042
|
-
this.loadingBlocks.add(r),
|
|
5077
|
+
this.loadingBlocks.add(r), Ue(this.dataSource, r, t, {}).then((o) => {
|
|
5043
5078
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
5044
5079
|
}).catch(() => {
|
|
5045
5080
|
this.loadingBlocks.delete(r);
|
|
@@ -5050,7 +5085,7 @@ class Sn extends A {
|
|
|
5050
5085
|
if (!this.dataSource) return [...e];
|
|
5051
5086
|
const t = [];
|
|
5052
5087
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
5053
|
-
const n =
|
|
5088
|
+
const n = nn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
5054
5089
|
t.push(n ?? { __loading: !0, __index: i });
|
|
5055
5090
|
}
|
|
5056
5091
|
return t;
|
|
@@ -5058,12 +5093,12 @@ class Sn extends A {
|
|
|
5058
5093
|
onScroll(e) {
|
|
5059
5094
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
5060
5095
|
this.loadRequiredBlocks();
|
|
5061
|
-
},
|
|
5096
|
+
}, rn));
|
|
5062
5097
|
}
|
|
5063
5098
|
setDataSource(e) {
|
|
5064
5099
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
5065
5100
|
const t = this.config.cacheBlockSize ?? 100;
|
|
5066
|
-
|
|
5101
|
+
Ue(e, 0, t, {}).then((i) => {
|
|
5067
5102
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
5068
5103
|
});
|
|
5069
5104
|
}
|
|
@@ -5084,52 +5119,52 @@ class Sn extends A {
|
|
|
5084
5119
|
return this.loadedBlocks.size;
|
|
5085
5120
|
}
|
|
5086
5121
|
}
|
|
5087
|
-
function
|
|
5122
|
+
function dt(s, e, t) {
|
|
5088
5123
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
5089
5124
|
}
|
|
5090
5125
|
function ce(s, e) {
|
|
5091
5126
|
const t = new Set(s);
|
|
5092
5127
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5093
5128
|
}
|
|
5094
|
-
function
|
|
5129
|
+
function fe(s, e, t = null, i = 0) {
|
|
5095
5130
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5096
5131
|
for (let o = 0; o < s.length; o++) {
|
|
5097
|
-
const a = s[o], l =
|
|
5132
|
+
const a = s[o], l = dt(a, o, t), d = a[n];
|
|
5098
5133
|
if (Array.isArray(d) && d.length > 0) {
|
|
5099
5134
|
r.add(l);
|
|
5100
|
-
const c =
|
|
5135
|
+
const c = fe(d, e, l, i + 1);
|
|
5101
5136
|
for (const u of c) r.add(u);
|
|
5102
5137
|
}
|
|
5103
5138
|
}
|
|
5104
5139
|
return r;
|
|
5105
5140
|
}
|
|
5106
|
-
function
|
|
5141
|
+
function on() {
|
|
5107
5142
|
return /* @__PURE__ */ new Set();
|
|
5108
5143
|
}
|
|
5109
|
-
function
|
|
5144
|
+
function ct(s, e, t, i = null, n = 0) {
|
|
5110
5145
|
const r = t.childrenField ?? "children";
|
|
5111
5146
|
for (let o = 0; o < s.length; o++) {
|
|
5112
|
-
const a = s[o], l =
|
|
5147
|
+
const a = s[o], l = dt(a, o, i);
|
|
5113
5148
|
if (l === e)
|
|
5114
5149
|
return [l];
|
|
5115
5150
|
const d = a[r];
|
|
5116
5151
|
if (Array.isArray(d) && d.length > 0) {
|
|
5117
|
-
const c =
|
|
5152
|
+
const c = ct(d, e, t, l, n + 1);
|
|
5118
5153
|
if (c)
|
|
5119
5154
|
return [l, ...c];
|
|
5120
5155
|
}
|
|
5121
5156
|
}
|
|
5122
5157
|
return null;
|
|
5123
5158
|
}
|
|
5124
|
-
function
|
|
5125
|
-
const n =
|
|
5159
|
+
function sn(s, e, t, i) {
|
|
5160
|
+
const n = ct(s, e, t);
|
|
5126
5161
|
if (!n) return i;
|
|
5127
5162
|
const r = new Set(i);
|
|
5128
5163
|
for (let o = 0; o < n.length - 1; o++)
|
|
5129
5164
|
r.add(n[o]);
|
|
5130
5165
|
return r;
|
|
5131
5166
|
}
|
|
5132
|
-
function
|
|
5167
|
+
function Ye(s, e = "children") {
|
|
5133
5168
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
5134
5169
|
for (const t of s) {
|
|
5135
5170
|
if (!t) continue;
|
|
@@ -5139,7 +5174,7 @@ function Ue(s, e = "children") {
|
|
|
5139
5174
|
}
|
|
5140
5175
|
return !1;
|
|
5141
5176
|
}
|
|
5142
|
-
function
|
|
5177
|
+
function an(s) {
|
|
5143
5178
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
5144
5179
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
5145
5180
|
for (const t of s)
|
|
@@ -5151,8 +5186,8 @@ function tn(s) {
|
|
|
5151
5186
|
}
|
|
5152
5187
|
return null;
|
|
5153
5188
|
}
|
|
5154
|
-
const
|
|
5155
|
-
class
|
|
5189
|
+
const ln = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-inline-start:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
5190
|
+
class Fn extends A {
|
|
5156
5191
|
static manifest = {
|
|
5157
5192
|
events: [
|
|
5158
5193
|
{
|
|
@@ -5168,7 +5203,7 @@ class kn extends A {
|
|
|
5168
5203
|
]
|
|
5169
5204
|
};
|
|
5170
5205
|
name = "tree";
|
|
5171
|
-
styles =
|
|
5206
|
+
styles = ln;
|
|
5172
5207
|
get defaultConfig() {
|
|
5173
5208
|
return {
|
|
5174
5209
|
childrenField: "children",
|
|
@@ -5191,8 +5226,8 @@ class kn extends A {
|
|
|
5191
5226
|
}
|
|
5192
5227
|
handleQuery(e) {
|
|
5193
5228
|
if (e.type === "canMoveRow") {
|
|
5194
|
-
const t = e.context;
|
|
5195
|
-
if (
|
|
5229
|
+
const t = e.context, i = this.config.childrenField ?? "children", n = t?.[i];
|
|
5230
|
+
if (Array.isArray(n) && n.length > 0)
|
|
5196
5231
|
return !1;
|
|
5197
5232
|
}
|
|
5198
5233
|
}
|
|
@@ -5201,15 +5236,15 @@ class kn extends A {
|
|
|
5201
5236
|
}
|
|
5202
5237
|
detect(e) {
|
|
5203
5238
|
if (!this.config.autoDetect) return !1;
|
|
5204
|
-
const t = e, i = this.config.childrenField ??
|
|
5205
|
-
return
|
|
5239
|
+
const t = e, i = this.config.childrenField ?? an(t) ?? "children";
|
|
5240
|
+
return Ye(t, i);
|
|
5206
5241
|
}
|
|
5207
5242
|
processRows(e) {
|
|
5208
5243
|
const t = this.config.childrenField ?? "children", i = e;
|
|
5209
|
-
if (!
|
|
5244
|
+
if (!Ye(i, t))
|
|
5210
5245
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5211
5246
|
let n = this.withStableKeys(i);
|
|
5212
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5247
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = fe(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5213
5248
|
const r = /* @__PURE__ */ new Set();
|
|
5214
5249
|
for (const o of this.flattenedRows)
|
|
5215
5250
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5334,10 +5369,10 @@ class kn extends A {
|
|
|
5334
5369
|
this.expandedKeys = ce(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5335
5370
|
}
|
|
5336
5371
|
expandAll() {
|
|
5337
|
-
this.expandedKeys =
|
|
5372
|
+
this.expandedKeys = fe(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5338
5373
|
}
|
|
5339
5374
|
collapseAll() {
|
|
5340
|
-
this.expandedKeys =
|
|
5375
|
+
this.expandedKeys = on(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5341
5376
|
}
|
|
5342
5377
|
isExpanded(e) {
|
|
5343
5378
|
return this.expandedKeys.has(e);
|
|
@@ -5352,10 +5387,10 @@ class kn extends A {
|
|
|
5352
5387
|
return this.rowKeyMap.get(e)?.data;
|
|
5353
5388
|
}
|
|
5354
5389
|
expandToKey(e) {
|
|
5355
|
-
this.expandedKeys =
|
|
5390
|
+
this.expandedKeys = sn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5356
5391
|
}
|
|
5357
5392
|
}
|
|
5358
|
-
function
|
|
5393
|
+
function dn(s, e, t) {
|
|
5359
5394
|
const i = [...s.undoStack, e];
|
|
5360
5395
|
for (; i.length > t; )
|
|
5361
5396
|
i.shift();
|
|
@@ -5364,7 +5399,7 @@ function rn(s, e, t) {
|
|
|
5364
5399
|
redoStack: []
|
|
5365
5400
|
};
|
|
5366
5401
|
}
|
|
5367
|
-
function
|
|
5402
|
+
function Xe(s) {
|
|
5368
5403
|
if (s.undoStack.length === 0)
|
|
5369
5404
|
return { newState: s, action: null };
|
|
5370
5405
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -5376,7 +5411,7 @@ function Ye(s) {
|
|
|
5376
5411
|
action: t
|
|
5377
5412
|
} : { newState: s, action: null };
|
|
5378
5413
|
}
|
|
5379
|
-
function
|
|
5414
|
+
function Ze(s) {
|
|
5380
5415
|
if (s.redoStack.length === 0)
|
|
5381
5416
|
return { newState: s, action: null };
|
|
5382
5417
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -5388,16 +5423,16 @@ function Xe(s) {
|
|
|
5388
5423
|
action: t
|
|
5389
5424
|
} : { newState: s, action: null };
|
|
5390
5425
|
}
|
|
5391
|
-
function
|
|
5426
|
+
function cn(s) {
|
|
5392
5427
|
return s.undoStack.length > 0;
|
|
5393
5428
|
}
|
|
5394
|
-
function
|
|
5429
|
+
function un(s) {
|
|
5395
5430
|
return s.redoStack.length > 0;
|
|
5396
5431
|
}
|
|
5397
|
-
function
|
|
5432
|
+
function hn() {
|
|
5398
5433
|
return { undoStack: [], redoStack: [] };
|
|
5399
5434
|
}
|
|
5400
|
-
function
|
|
5435
|
+
function gn(s, e, t, i) {
|
|
5401
5436
|
return {
|
|
5402
5437
|
type: "cell-edit",
|
|
5403
5438
|
rowIndex: s,
|
|
@@ -5407,7 +5442,7 @@ function ln(s, e, t, i) {
|
|
|
5407
5442
|
timestamp: Date.now()
|
|
5408
5443
|
};
|
|
5409
5444
|
}
|
|
5410
|
-
class
|
|
5445
|
+
class In extends A {
|
|
5411
5446
|
static dependencies = [
|
|
5412
5447
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5413
5448
|
];
|
|
@@ -5433,7 +5468,7 @@ class An extends A {
|
|
|
5433
5468
|
onKeyDown(e) {
|
|
5434
5469
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5435
5470
|
if (t) {
|
|
5436
|
-
const n =
|
|
5471
|
+
const n = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5437
5472
|
if (n.action) {
|
|
5438
5473
|
const r = this.rows;
|
|
5439
5474
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
|
|
@@ -5444,7 +5479,7 @@ class An extends A {
|
|
|
5444
5479
|
return !0;
|
|
5445
5480
|
}
|
|
5446
5481
|
if (i) {
|
|
5447
|
-
const n =
|
|
5482
|
+
const n = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5448
5483
|
if (n.action) {
|
|
5449
5484
|
const r = this.rows;
|
|
5450
5485
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
|
|
@@ -5457,7 +5492,7 @@ class An extends A {
|
|
|
5457
5492
|
return !1;
|
|
5458
5493
|
}
|
|
5459
5494
|
recordEdit(e, t, i, n) {
|
|
5460
|
-
const r =
|
|
5495
|
+
const r = gn(e, t, i, n), o = dn(
|
|
5461
5496
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5462
5497
|
r,
|
|
5463
5498
|
this.config.maxHistorySize ?? 100
|
|
@@ -5465,7 +5500,7 @@ class An extends A {
|
|
|
5465
5500
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5466
5501
|
}
|
|
5467
5502
|
undo() {
|
|
5468
|
-
const e =
|
|
5503
|
+
const e = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5469
5504
|
if (e.action) {
|
|
5470
5505
|
const t = this.rows;
|
|
5471
5506
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5473,7 +5508,7 @@ class An extends A {
|
|
|
5473
5508
|
return e.action;
|
|
5474
5509
|
}
|
|
5475
5510
|
redo() {
|
|
5476
|
-
const e =
|
|
5511
|
+
const e = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5477
5512
|
if (e.action) {
|
|
5478
5513
|
const t = this.rows;
|
|
5479
5514
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5481,13 +5516,13 @@ class An extends A {
|
|
|
5481
5516
|
return e.action;
|
|
5482
5517
|
}
|
|
5483
5518
|
canUndo() {
|
|
5484
|
-
return
|
|
5519
|
+
return cn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5485
5520
|
}
|
|
5486
5521
|
canRedo() {
|
|
5487
|
-
return
|
|
5522
|
+
return un({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5488
5523
|
}
|
|
5489
5524
|
clearHistory() {
|
|
5490
|
-
const e =
|
|
5525
|
+
const e = hn();
|
|
5491
5526
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5492
5527
|
}
|
|
5493
5528
|
getUndoStack() {
|
|
@@ -5497,8 +5532,8 @@ class An extends A {
|
|
|
5497
5532
|
return [...this.redoStack];
|
|
5498
5533
|
}
|
|
5499
5534
|
}
|
|
5500
|
-
const
|
|
5501
|
-
function
|
|
5535
|
+
const fn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
|
|
5536
|
+
function Qe(s) {
|
|
5502
5537
|
const e = s.meta ?? {};
|
|
5503
5538
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5504
5539
|
}
|
|
@@ -5508,7 +5543,7 @@ class B extends A {
|
|
|
5508
5543
|
];
|
|
5509
5544
|
name = "visibility";
|
|
5510
5545
|
static PANEL_ID = "columns";
|
|
5511
|
-
styles =
|
|
5546
|
+
styles = fn;
|
|
5512
5547
|
get defaultConfig() {
|
|
5513
5548
|
return {
|
|
5514
5549
|
allowHideAll: !1
|
|
@@ -5598,7 +5633,7 @@ class B extends A {
|
|
|
5598
5633
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5599
5634
|
for (let n = 0; n < i.length; n++) {
|
|
5600
5635
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
5601
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
5636
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Qe(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
5602
5637
|
const l = document.createElement("label");
|
|
5603
5638
|
l.className = "tbw-visibility-label";
|
|
5604
5639
|
const d = document.createElement("input");
|
|
@@ -5606,7 +5641,7 @@ class B extends A {
|
|
|
5606
5641
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5607
5642
|
});
|
|
5608
5643
|
const c = document.createElement("span");
|
|
5609
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
5644
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Qe(r)) {
|
|
5610
5645
|
const u = document.createElement("span");
|
|
5611
5646
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
5612
5647
|
}
|
|
@@ -5647,49 +5682,49 @@ class B extends A {
|
|
|
5647
5682
|
}
|
|
5648
5683
|
export {
|
|
5649
5684
|
A as BaseGridPlugin,
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5685
|
+
mn as ClipboardPlugin,
|
|
5686
|
+
wn as ColumnVirtualizationPlugin,
|
|
5687
|
+
it as ContextMenuPlugin,
|
|
5688
|
+
Mn as DEFAULT_ANIMATION_CONFIG,
|
|
5689
|
+
ht as DEFAULT_GRID_ICONS,
|
|
5690
|
+
Nn as DGEvents,
|
|
5691
|
+
qn as DataGridElement,
|
|
5692
|
+
bn as EditingPlugin,
|
|
5693
|
+
vn as ExportPlugin,
|
|
5659
5694
|
N as FilteringPlugin,
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5695
|
+
Hn as FitModeEnum,
|
|
5696
|
+
Kn as GridCSSVars,
|
|
5697
|
+
zn as GridClasses,
|
|
5698
|
+
On as GridDataAttrs,
|
|
5699
|
+
Gn as GridElement,
|
|
5700
|
+
Bn as GridSelectors,
|
|
5701
|
+
yn as GroupingColumnsPlugin,
|
|
5702
|
+
xn as GroupingRowsPlugin,
|
|
5703
|
+
nt as MasterDetailPlugin,
|
|
5704
|
+
Cn as MultiSortPlugin,
|
|
5705
|
+
Vn as PLUGIN_QUERIES,
|
|
5706
|
+
En as PinnedColumnsPlugin,
|
|
5707
|
+
Rn as PinnedRowsPlugin,
|
|
5673
5708
|
G as PivotPlugin,
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5709
|
+
Wn as PluginEvents,
|
|
5710
|
+
$n as PluginManager,
|
|
5711
|
+
Sn as PrintPlugin,
|
|
5712
|
+
ji as ROW_DRAG_HANDLE_FIELD,
|
|
5713
|
+
jn as RenderPhase,
|
|
5714
|
+
kn as ReorderPlugin,
|
|
5715
|
+
An as ResponsivePlugin,
|
|
5716
|
+
_n as RowReorderPlugin,
|
|
5717
|
+
Tn as SelectionPlugin,
|
|
5718
|
+
Ln as ServerSidePlugin,
|
|
5719
|
+
Fn as TreePlugin,
|
|
5720
|
+
In as UndoRedoPlugin,
|
|
5686
5721
|
B as VisibilityPlugin,
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5722
|
+
Un as builtInSort,
|
|
5723
|
+
Yn as createGrid,
|
|
5724
|
+
Xn as defaultComparator,
|
|
5725
|
+
Pt as defaultEditorFor,
|
|
5726
|
+
xt as defaultPasteHandler,
|
|
5727
|
+
zi as printGridIsolated,
|
|
5728
|
+
Zn as queryGrid
|
|
5694
5729
|
};
|
|
5695
5730
|
//# sourceMappingURL=all.js.map
|