@toolbox-web/grid 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +561 -471
- package/all.js.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +11 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +136 -77
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +246 -250
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -11
- package/lib/plugins/pivot/PivotPlugin.d.ts +2 -0
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +29 -27
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +18 -0
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/row-reorder/index.js +132 -72
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/visibility/index.js +7 -7
- package/package.json +1 -1
- package/themes/dg-theme-bootstrap.css +60 -33
- package/themes/dg-theme-material.css +83 -52
- package/themes/dg-theme-standard.css +80 -12
- package/themes/dg-theme-vibrant.css +78 -9
- package/umd/grid.all.umd.js +17 -17
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.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/row-reorder.umd.js +1 -1
- package/umd/plugins/row-reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { BaseGridPlugin as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return s.field ===
|
|
1
|
+
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as st, a as at, runAggregator as ee, e as lt, s as dt, PLUGIN_QUERIES as Ze, getAggregator as ve, getValueAggregator as ct, b as D, c as ye, g as ut } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Ln, DGEvents as Fn, DataGridElement as In, FitModeEnum as Pn, GridCSSVars as Dn, GridClasses as Mn, GridDataAttrs as Nn, DataGridElement as qn, GridSelectors as Hn, PluginEvents as zn, PluginManager as Kn, RenderPhase as On, builtInSort as Gn, createGrid as Bn, defaultComparator as Vn, queryGrid as Wn } from "./index.js";
|
|
3
|
+
const Je = "__tbw_expander", ht = 32;
|
|
4
|
+
function fe(s) {
|
|
5
|
+
return s.field === Je;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function q(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
10
|
function gt(s) {
|
|
11
|
-
return s.find(
|
|
11
|
+
return s.find(fe);
|
|
12
12
|
}
|
|
13
13
|
function ft(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: Je,
|
|
16
16
|
header: "",
|
|
17
17
|
width: ht,
|
|
18
18
|
resizable: !1,
|
|
@@ -27,7 +27,7 @@ function ft(s) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function te(s) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(s), !0;
|
|
33
33
|
} catch {
|
|
@@ -37,7 +37,7 @@ async function ie(s) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function xe(s, e) {
|
|
41
41
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
42
42
|
`, n = s.replace(/\r\n/g, `
|
|
43
43
|
`).replace(/\r/g, `
|
|
@@ -81,7 +81,7 @@ function mt(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class un extends
|
|
84
|
+
class un extends A {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -133,7 +133,7 @@ class un extends _ {
|
|
|
133
133
|
o = { startRow: l.row, startCol: l.col, endRow: l.row, endCol: l.col };
|
|
134
134
|
}
|
|
135
135
|
const a = this.#i(o);
|
|
136
|
-
|
|
136
|
+
te(a.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: a.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: a.text,
|
|
139
139
|
rowCount: a.rowCount,
|
|
@@ -145,10 +145,10 @@ class un extends _ {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
149
|
-
for (let
|
|
150
|
-
const
|
|
151
|
-
|
|
148
|
+
const i = xe(t, this.config), r = this.#n()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], g = h ? { row: a, col: l, field: h.field, bounds: c } : null, f = [], p = i[0]?.length ?? 0;
|
|
149
|
+
for (let b = 0; b < p && l + b <= u; b++) {
|
|
150
|
+
const v = this.columns[l + b];
|
|
151
|
+
v && !v.hidden && f.push(v.field);
|
|
152
152
|
}
|
|
153
153
|
const w = { rows: i, text: t, target: g, fields: f };
|
|
154
154
|
this.emit("paste", w), this.#o(w);
|
|
@@ -169,7 +169,7 @@ class un extends _ {
|
|
|
169
169
|
}
|
|
170
170
|
#i(e) {
|
|
171
171
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
172
|
-
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !
|
|
172
|
+
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !q(f));
|
|
173
173
|
if (this.config.includeHeaders) {
|
|
174
174
|
const f = g.map((p) => p.header || p.field);
|
|
175
175
|
h.push(f.join(c));
|
|
@@ -177,9 +177,9 @@ class un extends _ {
|
|
|
177
177
|
for (let f = o; f <= a; f++) {
|
|
178
178
|
const p = this.rows[f];
|
|
179
179
|
if (!p) continue;
|
|
180
|
-
const w = g.map((
|
|
181
|
-
const
|
|
182
|
-
return
|
|
180
|
+
const w = g.map((b) => {
|
|
181
|
+
const v = p[b.field];
|
|
182
|
+
return v == null ? "" : v instanceof Date ? v.toISOString() : String(v);
|
|
183
183
|
});
|
|
184
184
|
h.push(w.join(c));
|
|
185
185
|
}
|
|
@@ -212,7 +212,7 @@ class un extends _ {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
const r = this.#i(n);
|
|
215
|
-
return await
|
|
215
|
+
return await te(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
216
216
|
}
|
|
217
217
|
async copyRows(e) {
|
|
218
218
|
if (e.length === 0) return "";
|
|
@@ -222,37 +222,37 @@ class un extends _ {
|
|
|
222
222
|
endRow: t[t.length - 1],
|
|
223
223
|
endCol: i
|
|
224
224
|
}, r = this.#i(n);
|
|
225
|
-
return await
|
|
225
|
+
return await te(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
226
226
|
}
|
|
227
227
|
async paste() {
|
|
228
228
|
const e = await pt();
|
|
229
|
-
return e ?
|
|
229
|
+
return e ? xe(e, this.config) : null;
|
|
230
230
|
}
|
|
231
231
|
getLastCopied() {
|
|
232
232
|
return this.lastCopied;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const
|
|
236
|
-
function
|
|
235
|
+
const Ce = 100;
|
|
236
|
+
function pe(s) {
|
|
237
237
|
if (s == null)
|
|
238
|
-
return
|
|
238
|
+
return Ce;
|
|
239
239
|
if (typeof s == "number")
|
|
240
240
|
return s;
|
|
241
241
|
const e = parseFloat(s);
|
|
242
|
-
return isNaN(e) ?
|
|
242
|
+
return isNaN(e) ? Ce : e;
|
|
243
243
|
}
|
|
244
244
|
function Ee(s) {
|
|
245
|
-
return s.map((e) =>
|
|
245
|
+
return s.map((e) => pe(e.width));
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Re(s) {
|
|
248
248
|
const e = [];
|
|
249
249
|
let t = 0;
|
|
250
250
|
for (const i of s)
|
|
251
|
-
e.push(t), t +=
|
|
251
|
+
e.push(t), t += pe(i.width);
|
|
252
252
|
return e;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
return s.reduce((e, t) => e +
|
|
254
|
+
function Se(s) {
|
|
255
|
+
return s.reduce((e, t) => e + pe(t.width), 0);
|
|
256
256
|
}
|
|
257
257
|
function wt(s, e, t, i, n) {
|
|
258
258
|
const r = t.length;
|
|
@@ -286,7 +286,7 @@ function bt(s, e, t) {
|
|
|
286
286
|
function vt(s, e, t) {
|
|
287
287
|
return t ? s > e : !1;
|
|
288
288
|
}
|
|
289
|
-
class hn extends
|
|
289
|
+
class hn extends A {
|
|
290
290
|
name = "columnVirtualization";
|
|
291
291
|
get defaultConfig() {
|
|
292
292
|
return {
|
|
@@ -305,14 +305,14 @@ class hn extends _ {
|
|
|
305
305
|
attach(e) {
|
|
306
306
|
super.attach(e);
|
|
307
307
|
const t = this.columns;
|
|
308
|
-
this.columnWidths = Ee(t), this.columnOffsets =
|
|
308
|
+
this.columnWidths = Ee(t), this.columnOffsets = Re(t), this.totalWidth = Se(t), this.endCol = t.length - 1;
|
|
309
309
|
}
|
|
310
310
|
detach() {
|
|
311
311
|
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
312
312
|
}
|
|
313
313
|
processColumns(e) {
|
|
314
314
|
const t = vt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
315
|
-
if (this.isVirtualized = t ?? !1, this.columnWidths = Ee(e), this.columnOffsets =
|
|
315
|
+
if (this.isVirtualized = t ?? !1, this.columnWidths = Ee(e), this.columnOffsets = Re(e), this.totalWidth = Se(e), !t)
|
|
316
316
|
return this.startCol = 0, this.endCol = e.length - 1, [...e];
|
|
317
317
|
const i = this.grid.clientWidth || 800, n = wt(
|
|
318
318
|
this.scrollLeft,
|
|
@@ -354,14 +354,14 @@ class hn extends _ {
|
|
|
354
354
|
return this.totalWidth;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
function
|
|
357
|
+
const ie = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:0 2px 10px var(--tbw-context-menu-shadow, var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
358
|
+
function ue(s, e) {
|
|
359
359
|
return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
360
360
|
}
|
|
361
361
|
function yt(s, e) {
|
|
362
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function he(s, e, t, i = st.submenuArrow) {
|
|
365
365
|
const n = document.createElement("div");
|
|
366
366
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
367
367
|
for (const r of s) {
|
|
@@ -386,7 +386,7 @@ function ge(s, e, t, i = st.submenuArrow) {
|
|
|
386
386
|
const d = document.createElement("span");
|
|
387
387
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
388
388
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
389
|
-
const u =
|
|
389
|
+
const u = ue(r.subMenu, e), h = he(u, e, t, i);
|
|
390
390
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
391
391
|
}), o.addEventListener("mouseleave", () => {
|
|
392
392
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -399,14 +399,14 @@ function ge(s, e, t, i = st.submenuArrow) {
|
|
|
399
399
|
}
|
|
400
400
|
return n;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function ke(s, e, t) {
|
|
403
403
|
s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
|
|
404
404
|
const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
405
405
|
let o = e, a = t;
|
|
406
406
|
e + i.width > n && (o = e - i.width), t + i.height > r && (a = t - i.height), o = Math.max(0, o), a = Math.max(0, a), s.style.left = `${o}px`, s.style.top = `${a}px`, s.style.visibility = "visible";
|
|
407
407
|
}
|
|
408
|
-
let
|
|
409
|
-
const
|
|
408
|
+
let K = null, O = null, M = null, ne = 0;
|
|
409
|
+
const re = [
|
|
410
410
|
{
|
|
411
411
|
id: "copy",
|
|
412
412
|
name: "Copy",
|
|
@@ -424,11 +424,11 @@ const oe = [
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
];
|
|
427
|
-
class
|
|
427
|
+
class Qe extends A {
|
|
428
428
|
name = "contextMenu";
|
|
429
429
|
get defaultConfig() {
|
|
430
430
|
return {
|
|
431
|
-
items:
|
|
431
|
+
items: re
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
isOpen = !1;
|
|
@@ -436,20 +436,68 @@ class gn extends _ {
|
|
|
436
436
|
params = null;
|
|
437
437
|
menuElement = null;
|
|
438
438
|
attach(e) {
|
|
439
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
439
|
+
super.attach(e), this.installGlobalHandlers(), ne++;
|
|
440
440
|
}
|
|
441
441
|
detach() {
|
|
442
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
443
443
|
}
|
|
444
|
+
static CSS_VARS_TO_COPY = [
|
|
445
|
+
"--tbw-color-panel-bg",
|
|
446
|
+
"--tbw-color-fg",
|
|
447
|
+
"--tbw-color-fg-muted",
|
|
448
|
+
"--tbw-color-border",
|
|
449
|
+
"--tbw-color-row-hover",
|
|
450
|
+
"--tbw-color-shadow",
|
|
451
|
+
"--tbw-color-danger",
|
|
452
|
+
"--tbw-border-radius",
|
|
453
|
+
"--tbw-font-family",
|
|
454
|
+
"--tbw-font-size-sm",
|
|
455
|
+
"--tbw-font-size-xs",
|
|
456
|
+
"--tbw-font-size-2xs",
|
|
457
|
+
"--tbw-spacing-xs",
|
|
458
|
+
"--tbw-icon-size",
|
|
459
|
+
"--tbw-menu-min-width",
|
|
460
|
+
"--tbw-menu-item-padding",
|
|
461
|
+
"--tbw-menu-item-gap",
|
|
462
|
+
"--tbw-context-menu-bg",
|
|
463
|
+
"--tbw-context-menu-fg",
|
|
464
|
+
"--tbw-context-menu-border",
|
|
465
|
+
"--tbw-context-menu-radius",
|
|
466
|
+
"--tbw-context-menu-shadow",
|
|
467
|
+
"--tbw-context-menu-hover",
|
|
468
|
+
"--tbw-context-menu-danger",
|
|
469
|
+
"--tbw-context-menu-muted",
|
|
470
|
+
"--tbw-context-menu-min-width",
|
|
471
|
+
"--tbw-context-menu-font-size",
|
|
472
|
+
"--tbw-context-menu-font-family",
|
|
473
|
+
"--tbw-context-menu-item-padding",
|
|
474
|
+
"--tbw-context-menu-item-gap",
|
|
475
|
+
"--tbw-context-menu-icon-size",
|
|
476
|
+
"--tbw-context-menu-shortcut-size",
|
|
477
|
+
"--tbw-context-menu-arrow-size"
|
|
478
|
+
];
|
|
479
|
+
copyGridStyles(e) {
|
|
480
|
+
const t = this.gridElement;
|
|
481
|
+
if (!t) return;
|
|
482
|
+
const i = getComputedStyle(t), n = [];
|
|
483
|
+
for (const r of Qe.CSS_VARS_TO_COPY) {
|
|
484
|
+
const o = i.getPropertyValue(r).trim();
|
|
485
|
+
o && n.push(`${r}: ${o}`);
|
|
486
|
+
}
|
|
487
|
+
if (n.length > 0) {
|
|
488
|
+
const r = e.getAttribute("style") || "";
|
|
489
|
+
e.setAttribute("style", r + n.join("; ") + ";");
|
|
490
|
+
}
|
|
491
|
+
}
|
|
444
492
|
installGlobalHandlers() {
|
|
445
|
-
!
|
|
493
|
+
!M && typeof document < "u" && typeof ie == "string" && ie && (M = document.createElement("style"), M.id = "tbw-context-menu-styles", M.textContent = ie, document.head.appendChild(M)), K || (K = () => {
|
|
446
494
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
447
|
-
}, document.addEventListener("click",
|
|
495
|
+
}, document.addEventListener("click", K)), O || (O = (e) => {
|
|
448
496
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
449
|
-
}, document.addEventListener("keydown",
|
|
497
|
+
}, document.addEventListener("keydown", O));
|
|
450
498
|
}
|
|
451
499
|
uninstallGlobalHandlers() {
|
|
452
|
-
|
|
500
|
+
ne--, !(ne > 0) && (K && (document.removeEventListener("click", K), K = null), O && (document.removeEventListener("keydown", O), O = null), M && (M.remove(), M = null));
|
|
453
501
|
}
|
|
454
502
|
afterRender() {
|
|
455
503
|
const e = this.gridElement;
|
|
@@ -487,15 +535,15 @@ class gn extends _ {
|
|
|
487
535
|
} else
|
|
488
536
|
return;
|
|
489
537
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
490
|
-
const d =
|
|
491
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
538
|
+
const d = ue(this.config.items ?? re, l);
|
|
539
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = he(
|
|
492
540
|
d,
|
|
493
541
|
l,
|
|
494
542
|
(c) => {
|
|
495
543
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
496
544
|
},
|
|
497
545
|
this.gridIcons.submenuArrow
|
|
498
|
-
), document.body.appendChild(this.menuElement),
|
|
546
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), ke(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
499
547
|
}));
|
|
500
548
|
}
|
|
501
549
|
showMenu(e, t, i) {
|
|
@@ -508,15 +556,15 @@ class gn extends _ {
|
|
|
508
556
|
value: i.value ?? null,
|
|
509
557
|
isHeader: i.isHeader ?? !1,
|
|
510
558
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
511
|
-
}, r =
|
|
512
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
559
|
+
}, r = ue(this.config.items ?? re, n);
|
|
560
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = he(
|
|
513
561
|
r,
|
|
514
562
|
n,
|
|
515
563
|
(o) => {
|
|
516
564
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
517
565
|
},
|
|
518
566
|
this.gridIcons.submenuArrow
|
|
519
|
-
), document.body.appendChild(this.menuElement),
|
|
567
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), ke(this.menuElement, e, t), this.isOpen = !0;
|
|
520
568
|
}
|
|
521
569
|
hideMenu() {
|
|
522
570
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -530,7 +578,7 @@ function Ct(s) {
|
|
|
530
578
|
const e = s.options;
|
|
531
579
|
return e ? typeof e == "function" ? e() : e : [];
|
|
532
580
|
}
|
|
533
|
-
function
|
|
581
|
+
function Et(s) {
|
|
534
582
|
return (e) => {
|
|
535
583
|
const t = s.editorParams, i = document.createElement("input");
|
|
536
584
|
i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -540,7 +588,7 @@ function Rt(s) {
|
|
|
540
588
|
}), i;
|
|
541
589
|
};
|
|
542
590
|
}
|
|
543
|
-
function
|
|
591
|
+
function Rt() {
|
|
544
592
|
return (s) => {
|
|
545
593
|
const e = document.createElement("input");
|
|
546
594
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
@@ -588,9 +636,9 @@ function At(s) {
|
|
|
588
636
|
function _t(s) {
|
|
589
637
|
switch (s.type) {
|
|
590
638
|
case "number":
|
|
591
|
-
return
|
|
639
|
+
return Et(s);
|
|
592
640
|
case "boolean":
|
|
593
|
-
return
|
|
641
|
+
return Rt();
|
|
594
642
|
case "date":
|
|
595
643
|
return St(s);
|
|
596
644
|
case "select":
|
|
@@ -599,8 +647,8 @@ function _t(s) {
|
|
|
599
647
|
return At(s);
|
|
600
648
|
}
|
|
601
649
|
}
|
|
602
|
-
const
|
|
603
|
-
function
|
|
650
|
+
const oe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
651
|
+
function Tt(s, e) {
|
|
604
652
|
if (e.editor) return e.editor;
|
|
605
653
|
if (e.__editorTemplate) return "template";
|
|
606
654
|
if (!e.type) return;
|
|
@@ -617,7 +665,7 @@ function Lt(s, e) {
|
|
|
617
665
|
function $(s) {
|
|
618
666
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
619
667
|
}
|
|
620
|
-
function
|
|
668
|
+
function Lt(s) {
|
|
621
669
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
622
670
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
623
671
|
}
|
|
@@ -627,7 +675,7 @@ function Ft(s) {
|
|
|
627
675
|
function U(s, e) {
|
|
628
676
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
629
677
|
}
|
|
630
|
-
function
|
|
678
|
+
function Ae(s) {
|
|
631
679
|
}
|
|
632
680
|
function It(s, e, t) {
|
|
633
681
|
const i = s.querySelector("input,textarea,select");
|
|
@@ -635,7 +683,7 @@ function It(s, e, t) {
|
|
|
635
683
|
t(U(i, e));
|
|
636
684
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(U(i, e))));
|
|
637
685
|
}
|
|
638
|
-
class
|
|
686
|
+
class gn extends A {
|
|
639
687
|
static manifest = {
|
|
640
688
|
ownedProperties: [
|
|
641
689
|
{
|
|
@@ -851,7 +899,7 @@ class fn extends _ {
|
|
|
851
899
|
}), setTimeout(() => {
|
|
852
900
|
let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
853
901
|
if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
|
|
854
|
-
const l = a.querySelector(
|
|
902
|
+
const l = a.querySelector(oe);
|
|
855
903
|
try {
|
|
856
904
|
l?.focus({ preventScroll: !0 });
|
|
857
905
|
} catch {
|
|
@@ -928,7 +976,7 @@ class fn extends _ {
|
|
|
928
976
|
l = this.grid.getRowId(n);
|
|
929
977
|
} catch {
|
|
930
978
|
}
|
|
931
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") :
|
|
979
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : Ae;
|
|
932
980
|
if (this.emitCancelable("cell-commit", {
|
|
933
981
|
row: n,
|
|
934
982
|
rowId: l ?? "",
|
|
@@ -952,63 +1000,63 @@ class fn extends _ {
|
|
|
952
1000
|
a = this.grid.getRowId(e);
|
|
953
1001
|
} catch {
|
|
954
1002
|
}
|
|
955
|
-
const l = a ? (
|
|
1003
|
+
const l = a ? (C) => this.grid.updateRow(a, C, "cascade") : Ae, d = $(i.field) ? e[i.field] : void 0;
|
|
956
1004
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
957
1005
|
const c = r.parentElement;
|
|
958
|
-
c &&
|
|
1006
|
+
c && Lt(c);
|
|
959
1007
|
let u = !1;
|
|
960
|
-
const h = (
|
|
961
|
-
u || this.#e === -1 || this.#h(t, i,
|
|
1008
|
+
const h = (C) => {
|
|
1009
|
+
u || this.#e === -1 || this.#h(t, i, C, e);
|
|
962
1010
|
}, g = () => {
|
|
963
1011
|
u = !0, $(i.field) && (e[i.field] = d);
|
|
964
1012
|
}, f = document.createElement("div");
|
|
965
|
-
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (
|
|
966
|
-
|
|
1013
|
+
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (C) => {
|
|
1014
|
+
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#s(t, !1)), C.key === "Escape" && (C.stopPropagation(), C.preventDefault(), g(), this.#s(t, !0));
|
|
967
1015
|
});
|
|
968
|
-
const p = i, w = p.__editorTemplate,
|
|
969
|
-
if (
|
|
1016
|
+
const p = i, w = p.__editorTemplate, b = Tt(this.grid, p) ?? _t(i), v = d;
|
|
1017
|
+
if (b === "template" && w)
|
|
970
1018
|
this.#l(f, p, e, d, h, g, o, t);
|
|
971
|
-
else if (typeof
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
f.querySelector(
|
|
1019
|
+
else if (typeof b == "string") {
|
|
1020
|
+
const C = document.createElement(b);
|
|
1021
|
+
C.value = v, C.addEventListener("change", () => h(C.value)), f.appendChild(C), o || queueMicrotask(() => {
|
|
1022
|
+
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
975
1023
|
});
|
|
976
|
-
} else if (typeof
|
|
977
|
-
const
|
|
1024
|
+
} else if (typeof b == "function") {
|
|
1025
|
+
const C = {
|
|
978
1026
|
row: e,
|
|
979
1027
|
rowId: a ?? "",
|
|
980
|
-
value:
|
|
1028
|
+
value: v,
|
|
981
1029
|
field: i.field,
|
|
982
1030
|
column: i,
|
|
983
1031
|
commit: h,
|
|
984
1032
|
cancel: g,
|
|
985
1033
|
updateRow: l
|
|
986
|
-
},
|
|
987
|
-
typeof
|
|
988
|
-
f.querySelector(
|
|
1034
|
+
}, _ = b(C);
|
|
1035
|
+
typeof _ == "string" ? (f.innerHTML = _, It(f, i, h)) : _ instanceof Node && f.appendChild(_), o || queueMicrotask(() => {
|
|
1036
|
+
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
989
1037
|
});
|
|
990
|
-
} else if (
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
const
|
|
1038
|
+
} else if (b && typeof b == "object") {
|
|
1039
|
+
const C = document.createElement("div");
|
|
1040
|
+
C.setAttribute("data-external-editor", ""), C.setAttribute("data-field", i.field), f.appendChild(C);
|
|
1041
|
+
const _ = {
|
|
994
1042
|
row: e,
|
|
995
1043
|
rowId: a ?? "",
|
|
996
|
-
value:
|
|
1044
|
+
value: v,
|
|
997
1045
|
field: i.field,
|
|
998
1046
|
column: i,
|
|
999
1047
|
commit: h,
|
|
1000
1048
|
cancel: g,
|
|
1001
1049
|
updateRow: l
|
|
1002
1050
|
};
|
|
1003
|
-
if (
|
|
1051
|
+
if (b.mount)
|
|
1004
1052
|
try {
|
|
1005
|
-
|
|
1006
|
-
} catch (
|
|
1007
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1053
|
+
b.mount({ placeholder: C, context: _, spec: b });
|
|
1054
|
+
} catch (E) {
|
|
1055
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, E);
|
|
1008
1056
|
}
|
|
1009
1057
|
else
|
|
1010
1058
|
this.grid.dispatchEvent(
|
|
1011
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder:
|
|
1059
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: C, spec: b, context: _ } })
|
|
1012
1060
|
);
|
|
1013
1061
|
}
|
|
1014
1062
|
}
|
|
@@ -1061,7 +1109,7 @@ class fn extends _ {
|
|
|
1061
1109
|
});
|
|
1062
1110
|
}
|
|
1063
1111
|
}
|
|
1064
|
-
function
|
|
1112
|
+
function _e(s, e = !0) {
|
|
1065
1113
|
if (s == null) return "";
|
|
1066
1114
|
if (s instanceof Date) return s.toISOString();
|
|
1067
1115
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1075,26 +1123,26 @@ function Pt(s, e, t, i = {}) {
|
|
|
1075
1123
|
if (t.includeHeaders !== !1) {
|
|
1076
1124
|
const l = e.map((d) => {
|
|
1077
1125
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1078
|
-
return
|
|
1126
|
+
return _e(u);
|
|
1079
1127
|
});
|
|
1080
1128
|
o.push(l.join(n));
|
|
1081
1129
|
}
|
|
1082
1130
|
for (const l of s) {
|
|
1083
1131
|
const d = e.map((c) => {
|
|
1084
1132
|
let u = l[c.field];
|
|
1085
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1133
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), _e(u);
|
|
1086
1134
|
});
|
|
1087
1135
|
o.push(d.join(n));
|
|
1088
1136
|
}
|
|
1089
1137
|
return a + o.join(r);
|
|
1090
1138
|
}
|
|
1091
|
-
function
|
|
1139
|
+
function me(s, e) {
|
|
1092
1140
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1093
1141
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1094
1142
|
}
|
|
1095
1143
|
function Dt(s, e) {
|
|
1096
1144
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1097
|
-
|
|
1145
|
+
me(t, e);
|
|
1098
1146
|
}
|
|
1099
1147
|
function Te(s) {
|
|
1100
1148
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -1135,9 +1183,9 @@ function Nt(s, e) {
|
|
|
1135
1183
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1136
1184
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1137
1185
|
});
|
|
1138
|
-
|
|
1186
|
+
me(i, t);
|
|
1139
1187
|
}
|
|
1140
|
-
class
|
|
1188
|
+
class fn extends A {
|
|
1141
1189
|
name = "export";
|
|
1142
1190
|
get defaultConfig() {
|
|
1143
1191
|
return {
|
|
@@ -1194,7 +1242,7 @@ class pn extends _ {
|
|
|
1194
1242
|
}), d = JSON.stringify(l, null, 2);
|
|
1195
1243
|
a = a.endsWith(".json") ? a : `${a}.json`;
|
|
1196
1244
|
const c = new Blob([d], { type: "application/json" });
|
|
1197
|
-
|
|
1245
|
+
me(c, a);
|
|
1198
1246
|
break;
|
|
1199
1247
|
}
|
|
1200
1248
|
}
|
|
@@ -1243,10 +1291,10 @@ function qt(s) {
|
|
|
1243
1291
|
totalHeight: e * n
|
|
1244
1292
|
};
|
|
1245
1293
|
}
|
|
1246
|
-
function
|
|
1294
|
+
function Ht(s, e) {
|
|
1247
1295
|
return s <= e;
|
|
1248
1296
|
}
|
|
1249
|
-
function
|
|
1297
|
+
function zt(s, e, t = !1) {
|
|
1250
1298
|
const i = s[e.field];
|
|
1251
1299
|
if (e.operator === "blank")
|
|
1252
1300
|
return i == null || i === "";
|
|
@@ -1285,10 +1333,10 @@ function Ht(s, e, t = !1) {
|
|
|
1285
1333
|
return !0;
|
|
1286
1334
|
}
|
|
1287
1335
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1336
|
+
function Kt(s, e, t = !1) {
|
|
1337
|
+
return e.length ? s.filter((i) => e.every((n) => zt(i, n, t))) : s;
|
|
1290
1338
|
}
|
|
1291
|
-
function
|
|
1339
|
+
function Ot(s) {
|
|
1292
1340
|
return JSON.stringify(
|
|
1293
1341
|
s.map((e) => ({
|
|
1294
1342
|
field: e.field,
|
|
@@ -1298,7 +1346,7 @@ function Gt(s) {
|
|
|
1298
1346
|
}))
|
|
1299
1347
|
);
|
|
1300
1348
|
}
|
|
1301
|
-
function
|
|
1349
|
+
function Le(s, e) {
|
|
1302
1350
|
const t = /* @__PURE__ */ new Set();
|
|
1303
1351
|
for (const i of s) {
|
|
1304
1352
|
const n = i[e];
|
|
@@ -1306,10 +1354,10 @@ function Fe(s, e) {
|
|
|
1306
1354
|
}
|
|
1307
1355
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1308
1356
|
}
|
|
1309
|
-
const
|
|
1310
|
-
class
|
|
1357
|
+
const Gt = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', Bt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-range-inputs,.tbw-filter-date-range{display:flex;align-items:flex-end;gap:var(--tbw-spacing-sm, .375rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-group,.tbw-filter-date-group{display:flex;flex-direction:column;gap:var(--tbw-spacing-xs, .25rem);flex:1}.tbw-filter-range-label{font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)))}.tbw-filter-range-input,.tbw-filter-date-input{width:100%;height:var(--tbw-filter-item-height, 28px);padding:var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-sm, .375rem);background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-range-input:focus,.tbw-filter-date-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-range-separator{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding-bottom:var(--tbw-spacing-xs, .25rem)}.tbw-filter-range-slider{position:relative;height:24px;margin:var(--tbw-spacing-md, .5rem) 0 var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-fill{position:absolute;top:50%;height:4px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-thumb{position:absolute;top:0;width:100%;height:100%;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}.tbw-filter-range-thumb::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-moz-range-thumb{width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-webkit-slider-thumb:hover{transform:scale(1.1)}.tbw-filter-range-thumb::-moz-range-thumb:hover{transform:scale(1.1)}}";
|
|
1358
|
+
class N extends A {
|
|
1311
1359
|
name = "filtering";
|
|
1312
|
-
styles =
|
|
1360
|
+
styles = Gt;
|
|
1313
1361
|
get defaultConfig() {
|
|
1314
1362
|
return {
|
|
1315
1363
|
debounceMs: 300,
|
|
@@ -1346,7 +1394,7 @@ class q extends _ {
|
|
|
1346
1394
|
return t;
|
|
1347
1395
|
}
|
|
1348
1396
|
}
|
|
1349
|
-
return
|
|
1397
|
+
return N.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1350
1398
|
}
|
|
1351
1399
|
syncExcludedValues(e, t) {
|
|
1352
1400
|
t ? t.type === "set" && t.operator === "notIn" && Array.isArray(t.value) ? this.excludedValues.set(e, new Set(t.value)) : t.type === "set" && this.excludedValues.delete(e) : this.excludedValues.delete(e);
|
|
@@ -1362,10 +1410,10 @@ class q extends _ {
|
|
|
1362
1410
|
if (!t.length) return [...e];
|
|
1363
1411
|
if (this.config.filterHandler)
|
|
1364
1412
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1365
|
-
const i =
|
|
1413
|
+
const i = Ot(t);
|
|
1366
1414
|
if (this.cacheKey === i && this.cachedResult)
|
|
1367
1415
|
return this.cachedResult;
|
|
1368
|
-
const n =
|
|
1416
|
+
const n = Kt([...e], t, this.config.caseSensitive);
|
|
1369
1417
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1370
1418
|
}
|
|
1371
1419
|
afterRender() {
|
|
@@ -1375,7 +1423,7 @@ class q extends _ {
|
|
|
1375
1423
|
const n = i.getAttribute("data-col");
|
|
1376
1424
|
if (n === null) return;
|
|
1377
1425
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1378
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1426
|
+
if (!r || !this.isColumnFilterable(r) || q(r)) return;
|
|
1379
1427
|
const o = r.field;
|
|
1380
1428
|
if (!o) return;
|
|
1381
1429
|
const a = this.filters.has(o);
|
|
@@ -1443,7 +1491,7 @@ class q extends _ {
|
|
|
1443
1491
|
return this.getFilters();
|
|
1444
1492
|
}
|
|
1445
1493
|
getUniqueValues(e) {
|
|
1446
|
-
return
|
|
1494
|
+
return Le(this.sourceRows, e);
|
|
1447
1495
|
}
|
|
1448
1496
|
copyGridThemeContext(e) {
|
|
1449
1497
|
const t = this.gridElement;
|
|
@@ -1475,7 +1523,7 @@ class q extends _ {
|
|
|
1475
1523
|
});
|
|
1476
1524
|
return;
|
|
1477
1525
|
}
|
|
1478
|
-
const r =
|
|
1526
|
+
const r = Le(this.sourceRows, e);
|
|
1479
1527
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1480
1528
|
}
|
|
1481
1529
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1525,11 +1573,11 @@ class q extends _ {
|
|
|
1525
1573
|
}
|
|
1526
1574
|
static supportsAnchorPositioning = null;
|
|
1527
1575
|
static checkAnchorPositioningSupport() {
|
|
1528
|
-
return
|
|
1576
|
+
return N.supportsAnchorPositioning === null && (N.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), N.supportsAnchorPositioning;
|
|
1529
1577
|
}
|
|
1530
1578
|
positionPanel(e, t) {
|
|
1531
1579
|
const n = t.closest(".cell") ?? t;
|
|
1532
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1580
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, N.checkAnchorPositioningSupport()) {
|
|
1533
1581
|
requestAnimationFrame(() => {
|
|
1534
1582
|
const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
|
|
1535
1583
|
o.top < a.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1556,14 +1604,14 @@ class q extends _ {
|
|
|
1556
1604
|
const h = document.createElement("span");
|
|
1557
1605
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1558
1606
|
const g = () => {
|
|
1559
|
-
const
|
|
1560
|
-
u.checked =
|
|
1607
|
+
const x = [...b.values()], S = x.every((m) => m), T = x.every((m) => !m);
|
|
1608
|
+
u.checked = S, u.indeterminate = !S && !T;
|
|
1561
1609
|
};
|
|
1562
1610
|
u.addEventListener("change", () => {
|
|
1563
|
-
const
|
|
1564
|
-
for (const
|
|
1565
|
-
|
|
1566
|
-
g(),
|
|
1611
|
+
const x = u.checked;
|
|
1612
|
+
for (const S of b.keys())
|
|
1613
|
+
b.set(S, x);
|
|
1614
|
+
g(), _();
|
|
1567
1615
|
}), e.appendChild(d);
|
|
1568
1616
|
const f = document.createElement("div");
|
|
1569
1617
|
f.className = "tbw-filter-values";
|
|
@@ -1571,186 +1619,182 @@ class q extends _ {
|
|
|
1571
1619
|
p.className = "tbw-filter-values-spacer", f.appendChild(p);
|
|
1572
1620
|
const w = document.createElement("div");
|
|
1573
1621
|
w.className = "tbw-filter-values-content", f.appendChild(w);
|
|
1574
|
-
const
|
|
1575
|
-
i.forEach((
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1622
|
+
const b = /* @__PURE__ */ new Map();
|
|
1623
|
+
i.forEach((x) => {
|
|
1624
|
+
const S = x == null ? "__null__" : String(x);
|
|
1625
|
+
b.set(S, !n.has(x));
|
|
1578
1626
|
}), g();
|
|
1579
|
-
let
|
|
1580
|
-
const
|
|
1581
|
-
const
|
|
1582
|
-
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
|
|
1627
|
+
let v = [];
|
|
1628
|
+
const C = (x, S) => {
|
|
1629
|
+
const T = x == null ? "(Blank)" : String(x), m = x == null ? "__null__" : String(x), y = document.createElement("label");
|
|
1630
|
+
y.className = "tbw-filter-value-item", y.style.position = "absolute", y.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${S})`, y.style.left = "0", y.style.right = "0", y.style.boxSizing = "border-box";
|
|
1631
|
+
const L = document.createElement("input");
|
|
1632
|
+
L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
|
|
1633
|
+
b.set(m, L.checked), g();
|
|
1586
1634
|
});
|
|
1587
|
-
const
|
|
1588
|
-
return
|
|
1589
|
-
},
|
|
1590
|
-
const
|
|
1591
|
-
if (p.style.height = `${
|
|
1592
|
-
w.innerHTML = "", w.style.transform = "translateY(0px)",
|
|
1593
|
-
w.appendChild(
|
|
1635
|
+
const H = document.createElement("span");
|
|
1636
|
+
return H.textContent = T, y.appendChild(L), y.appendChild(H), y;
|
|
1637
|
+
}, _ = () => {
|
|
1638
|
+
const x = v.length, S = f.clientHeight, T = f.scrollTop;
|
|
1639
|
+
if (p.style.height = `${x * o}px`, Ht(x, N.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1640
|
+
w.innerHTML = "", w.style.transform = "translateY(0px)", v.forEach((y, L) => {
|
|
1641
|
+
w.appendChild(C(y, L));
|
|
1594
1642
|
});
|
|
1595
1643
|
return;
|
|
1596
1644
|
}
|
|
1597
|
-
const
|
|
1598
|
-
totalRows:
|
|
1599
|
-
viewportHeight:
|
|
1600
|
-
scrollTop:
|
|
1645
|
+
const m = qt({
|
|
1646
|
+
totalRows: x,
|
|
1647
|
+
viewportHeight: S,
|
|
1648
|
+
scrollTop: T,
|
|
1601
1649
|
rowHeight: o,
|
|
1602
|
-
overscan:
|
|
1650
|
+
overscan: N.LIST_OVERSCAN
|
|
1603
1651
|
});
|
|
1604
|
-
w.style.transform = `translateY(${
|
|
1605
|
-
for (let
|
|
1606
|
-
w.appendChild(
|
|
1607
|
-
},
|
|
1608
|
-
const
|
|
1609
|
-
if (
|
|
1610
|
-
const
|
|
1611
|
-
return !
|
|
1612
|
-
}),
|
|
1652
|
+
w.style.transform = `translateY(${m.offsetY}px)`, w.innerHTML = "";
|
|
1653
|
+
for (let y = m.start; y < m.end; y++)
|
|
1654
|
+
w.appendChild(C(v[y], y - m.start));
|
|
1655
|
+
}, E = (x) => {
|
|
1656
|
+
const S = this.config.caseSensitive ?? !1, T = S ? x : x.toLowerCase();
|
|
1657
|
+
if (v = i.filter((m) => {
|
|
1658
|
+
const y = m == null ? "(Blank)" : String(m), L = S ? y : y.toLowerCase();
|
|
1659
|
+
return !x || L.includes(T);
|
|
1660
|
+
}), v.length === 0) {
|
|
1613
1661
|
p.style.height = "0px", w.innerHTML = "";
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1662
|
+
const m = document.createElement("div");
|
|
1663
|
+
m.className = "tbw-filter-no-match", m.textContent = "No matching values", w.appendChild(m);
|
|
1616
1664
|
return;
|
|
1617
1665
|
}
|
|
1618
|
-
|
|
1666
|
+
_();
|
|
1619
1667
|
};
|
|
1620
1668
|
f.addEventListener(
|
|
1621
1669
|
"scroll",
|
|
1622
1670
|
() => {
|
|
1623
|
-
|
|
1671
|
+
v.length > 0 && _();
|
|
1624
1672
|
},
|
|
1625
1673
|
{ passive: !0 }
|
|
1626
|
-
),
|
|
1627
|
-
let
|
|
1674
|
+
), E(l.value), e.appendChild(f);
|
|
1675
|
+
let P;
|
|
1628
1676
|
l.addEventListener("input", () => {
|
|
1629
|
-
clearTimeout(
|
|
1630
|
-
this.searchText.set(r, l.value),
|
|
1677
|
+
clearTimeout(P), P = setTimeout(() => {
|
|
1678
|
+
this.searchText.set(r, l.value), E(l.value);
|
|
1631
1679
|
}, this.config.debounceMs ?? 150);
|
|
1632
1680
|
});
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1637
|
-
const
|
|
1638
|
-
for (const [
|
|
1639
|
-
if (!
|
|
1640
|
-
if (
|
|
1641
|
-
|
|
1681
|
+
const F = document.createElement("div");
|
|
1682
|
+
F.className = "tbw-filter-buttons";
|
|
1683
|
+
const I = document.createElement("button");
|
|
1684
|
+
I.className = "tbw-filter-apply-btn", I.textContent = "Apply", I.addEventListener("click", () => {
|
|
1685
|
+
const x = [];
|
|
1686
|
+
for (const [S, T] of b)
|
|
1687
|
+
if (!T)
|
|
1688
|
+
if (S === "__null__")
|
|
1689
|
+
x.push(null);
|
|
1642
1690
|
else {
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1691
|
+
const m = i.find((y) => String(y) === S);
|
|
1692
|
+
x.push(m !== void 0 ? m : S);
|
|
1645
1693
|
}
|
|
1646
|
-
t.applySetFilter(
|
|
1647
|
-
}),
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1694
|
+
t.applySetFilter(x);
|
|
1695
|
+
}), F.appendChild(I);
|
|
1696
|
+
const R = document.createElement("button");
|
|
1697
|
+
R.className = "tbw-filter-clear-btn", R.textContent = "Clear Filter", R.addEventListener("click", () => {
|
|
1650
1698
|
t.clearFilter();
|
|
1651
|
-
}),
|
|
1699
|
+
}), F.appendChild(R), e.appendChild(F);
|
|
1652
1700
|
}
|
|
1653
1701
|
renderNumberFilterPanel(e, t, i) {
|
|
1654
|
-
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (
|
|
1655
|
-
if (typeof
|
|
1656
|
-
if (typeof
|
|
1657
|
-
const W = parseFloat(
|
|
1658
|
-
return isNaN(W) ?
|
|
1702
|
+
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (k, z) => {
|
|
1703
|
+
if (typeof k == "number") return k;
|
|
1704
|
+
if (typeof k == "string") {
|
|
1705
|
+
const W = parseFloat(k);
|
|
1706
|
+
return isNaN(W) ? z : W;
|
|
1659
1707
|
}
|
|
1660
|
-
return
|
|
1661
|
-
}, d = i.filter((
|
|
1662
|
-
let w = h,
|
|
1663
|
-
p?.operator === "between" ? (w = l(p.value, h),
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1708
|
+
return z;
|
|
1709
|
+
}, d = i.filter((k) => typeof k == "number" && !isNaN(k)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), g = l(o?.max ?? a?.max, u), f = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
|
|
1710
|
+
let w = h, b = g;
|
|
1711
|
+
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, g));
|
|
1712
|
+
const v = document.createElement("div");
|
|
1713
|
+
v.className = "tbw-filter-range-inputs";
|
|
1714
|
+
const C = document.createElement("div");
|
|
1715
|
+
C.className = "tbw-filter-range-group";
|
|
1716
|
+
const _ = document.createElement("label");
|
|
1717
|
+
_.textContent = "Min", _.className = "tbw-filter-range-label";
|
|
1718
|
+
const E = document.createElement("input");
|
|
1719
|
+
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(g), E.step = String(f), E.value = String(w), C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1720
|
+
const P = document.createElement("span");
|
|
1721
|
+
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1722
|
+
const F = document.createElement("div");
|
|
1723
|
+
F.className = "tbw-filter-range-group";
|
|
1724
|
+
const I = document.createElement("label");
|
|
1725
|
+
I.textContent = "Max", I.className = "tbw-filter-range-label";
|
|
1726
|
+
const R = document.createElement("input");
|
|
1727
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(b), F.appendChild(I), F.appendChild(R), v.appendChild(F), e.appendChild(v);
|
|
1666
1728
|
const x = document.createElement("div");
|
|
1667
|
-
x.className = "tbw-filter-range-
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
const F = document.createElement("label");
|
|
1671
|
-
F.textContent = "Min", F.className = "tbw-filter-range-label";
|
|
1672
|
-
const k = document.createElement("input");
|
|
1673
|
-
k.type = "number", k.className = "tbw-filter-range-input", k.min = String(h), k.max = String(g), k.step = String(f), k.value = String(w), A.appendChild(F), A.appendChild(k), x.appendChild(A);
|
|
1674
|
-
const I = document.createElement("span");
|
|
1675
|
-
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1729
|
+
x.className = "tbw-filter-range-slider";
|
|
1730
|
+
const S = document.createElement("div");
|
|
1731
|
+
S.className = "tbw-filter-range-track";
|
|
1676
1732
|
const T = document.createElement("div");
|
|
1677
|
-
T.className = "tbw-filter-range-
|
|
1678
|
-
const P = document.createElement("label");
|
|
1679
|
-
P.textContent = "Max", P.className = "tbw-filter-range-label";
|
|
1680
|
-
const b = document.createElement("input");
|
|
1681
|
-
b.type = "number", b.className = "tbw-filter-range-input", b.min = String(h), b.max = String(g), b.step = String(f), b.value = String(v), T.appendChild(P), T.appendChild(b), x.appendChild(T), e.appendChild(x);
|
|
1682
|
-
const E = document.createElement("div");
|
|
1683
|
-
E.className = "tbw-filter-range-slider";
|
|
1684
|
-
const L = document.createElement("div");
|
|
1685
|
-
L.className = "tbw-filter-range-track";
|
|
1686
|
-
const C = document.createElement("div");
|
|
1687
|
-
C.className = "tbw-filter-range-fill";
|
|
1733
|
+
T.className = "tbw-filter-range-fill";
|
|
1688
1734
|
const m = document.createElement("input");
|
|
1689
1735
|
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(g), m.step = String(f), m.value = String(w);
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1692
|
-
const
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1736
|
+
const y = document.createElement("input");
|
|
1737
|
+
y.type = "range", y.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", y.min = String(h), y.max = String(g), y.step = String(f), y.value = String(b), x.appendChild(S), x.appendChild(T), x.appendChild(m), x.appendChild(y), e.appendChild(x);
|
|
1738
|
+
const L = () => {
|
|
1739
|
+
const k = parseFloat(m.value), z = parseFloat(y.value), W = g - h, be = (k - h) / W * 100, ot = (z - h) / W * 100;
|
|
1740
|
+
T.style.left = `${be}%`, T.style.width = `${ot - be}%`;
|
|
1695
1741
|
};
|
|
1696
1742
|
m.addEventListener("input", () => {
|
|
1697
|
-
const
|
|
1698
|
-
m.value = String(
|
|
1743
|
+
const k = Math.min(parseFloat(m.value), parseFloat(y.value));
|
|
1744
|
+
m.value = String(k), E.value = String(k), L();
|
|
1745
|
+
}), y.addEventListener("input", () => {
|
|
1746
|
+
const k = Math.max(parseFloat(y.value), parseFloat(m.value));
|
|
1747
|
+
y.value = String(k), R.value = String(k), L();
|
|
1748
|
+
}), E.addEventListener("input", () => {
|
|
1749
|
+
let k = parseFloat(E.value) || h;
|
|
1750
|
+
k = Math.max(h, Math.min(k, parseFloat(R.value))), m.value = String(k), L();
|
|
1699
1751
|
}), R.addEventListener("input", () => {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
}),
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
Y.className = "tbw-filter-buttons";
|
|
1752
|
+
let k = parseFloat(R.value) || g;
|
|
1753
|
+
k = Math.min(g, Math.max(k, parseFloat(E.value))), y.value = String(k), L();
|
|
1754
|
+
}), L();
|
|
1755
|
+
const H = document.createElement("div");
|
|
1756
|
+
H.className = "tbw-filter-buttons";
|
|
1757
|
+
const Y = document.createElement("button");
|
|
1758
|
+
Y.className = "tbw-filter-apply-btn", Y.textContent = "Apply", Y.addEventListener("click", () => {
|
|
1759
|
+
const k = parseFloat(E.value), z = parseFloat(R.value);
|
|
1760
|
+
t.applyTextFilter("between", k, z);
|
|
1761
|
+
}), H.appendChild(Y);
|
|
1711
1762
|
const X = document.createElement("button");
|
|
1712
|
-
X.className = "tbw-filter-
|
|
1713
|
-
const S = parseFloat(k.value), H = parseFloat(b.value);
|
|
1714
|
-
t.applyTextFilter("between", S, H);
|
|
1715
|
-
}), Y.appendChild(X);
|
|
1716
|
-
const Z = document.createElement("button");
|
|
1717
|
-
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
1763
|
+
X.className = "tbw-filter-clear-btn", X.textContent = "Clear Filter", X.addEventListener("click", () => {
|
|
1718
1764
|
t.clearFilter();
|
|
1719
|
-
}),
|
|
1765
|
+
}), H.appendChild(X), e.appendChild(H);
|
|
1720
1766
|
}
|
|
1721
1767
|
renderDateFilterPanel(e, t, i) {
|
|
1722
1768
|
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", g = h(o?.min) || h(a?.min) || u(d), f = h(o?.max) || h(a?.max) || u(c), p = this.filters.get(n);
|
|
1723
|
-
let w = "",
|
|
1724
|
-
p?.operator === "between" ? (w = h(p.value) || "",
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1769
|
+
let w = "", b = "";
|
|
1770
|
+
p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
|
|
1771
|
+
const v = document.createElement("div");
|
|
1772
|
+
v.className = "tbw-filter-date-range";
|
|
1773
|
+
const C = document.createElement("div");
|
|
1774
|
+
C.className = "tbw-filter-date-group";
|
|
1775
|
+
const _ = document.createElement("label");
|
|
1776
|
+
_.textContent = "From", _.className = "tbw-filter-range-label";
|
|
1777
|
+
const E = document.createElement("input");
|
|
1778
|
+
E.type = "date", E.className = "tbw-filter-date-input", g && (E.min = g), f && (E.max = f), E.value = w, C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1779
|
+
const P = document.createElement("span");
|
|
1780
|
+
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1781
|
+
const F = document.createElement("div");
|
|
1782
|
+
F.className = "tbw-filter-date-group";
|
|
1783
|
+
const I = document.createElement("label");
|
|
1784
|
+
I.textContent = "To", I.className = "tbw-filter-range-label";
|
|
1785
|
+
const R = document.createElement("input");
|
|
1786
|
+
R.type = "date", R.className = "tbw-filter-date-input", g && (R.min = g), f && (R.max = f), R.value = b, F.appendChild(I), F.appendChild(R), v.appendChild(F), e.appendChild(v);
|
|
1727
1787
|
const x = document.createElement("div");
|
|
1728
|
-
x.className = "tbw-filter-
|
|
1729
|
-
const
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1737
|
-
const T = document.createElement("div");
|
|
1738
|
-
T.className = "tbw-filter-date-group";
|
|
1739
|
-
const P = document.createElement("label");
|
|
1740
|
-
P.textContent = "To", P.className = "tbw-filter-range-label";
|
|
1741
|
-
const b = document.createElement("input");
|
|
1742
|
-
b.type = "date", b.className = "tbw-filter-date-input", g && (b.min = g), f && (b.max = f), b.value = v, T.appendChild(P), T.appendChild(b), x.appendChild(T), e.appendChild(x);
|
|
1743
|
-
const E = document.createElement("div");
|
|
1744
|
-
E.className = "tbw-filter-buttons";
|
|
1745
|
-
const L = document.createElement("button");
|
|
1746
|
-
L.className = "tbw-filter-apply-btn", L.textContent = "Apply", L.addEventListener("click", () => {
|
|
1747
|
-
const m = k.value, R = b.value;
|
|
1748
|
-
m && R ? t.applyTextFilter("between", m, R) : m ? t.applyTextFilter("greaterThanOrEqual", m) : R ? t.applyTextFilter("lessThanOrEqual", R) : t.clearFilter();
|
|
1749
|
-
}), E.appendChild(L);
|
|
1750
|
-
const C = document.createElement("button");
|
|
1751
|
-
C.className = "tbw-filter-clear-btn", C.textContent = "Clear Filter", C.addEventListener("click", () => {
|
|
1788
|
+
x.className = "tbw-filter-buttons";
|
|
1789
|
+
const S = document.createElement("button");
|
|
1790
|
+
S.className = "tbw-filter-apply-btn", S.textContent = "Apply", S.addEventListener("click", () => {
|
|
1791
|
+
const m = E.value, y = R.value;
|
|
1792
|
+
m && y ? t.applyTextFilter("between", m, y) : m ? t.applyTextFilter("greaterThanOrEqual", m) : y ? t.applyTextFilter("lessThanOrEqual", y) : t.clearFilter();
|
|
1793
|
+
}), x.appendChild(S);
|
|
1794
|
+
const T = document.createElement("button");
|
|
1795
|
+
T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
|
|
1752
1796
|
t.clearFilter();
|
|
1753
|
-
}),
|
|
1797
|
+
}), x.appendChild(T), e.appendChild(x);
|
|
1754
1798
|
}
|
|
1755
1799
|
applySetFilter(e, t) {
|
|
1756
1800
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -1816,7 +1860,7 @@ class q extends _ {
|
|
|
1816
1860
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1817
1861
|
}
|
|
1818
1862
|
}
|
|
1819
|
-
function
|
|
1863
|
+
function Fe(s) {
|
|
1820
1864
|
if (!s.length) return [];
|
|
1821
1865
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1822
1866
|
if (!a.length) return;
|
|
@@ -1883,7 +1927,7 @@ function $t(s) {
|
|
|
1883
1927
|
return s.some((e) => e.group != null);
|
|
1884
1928
|
}
|
|
1885
1929
|
const jt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
|
|
1886
|
-
class
|
|
1930
|
+
class pn extends A {
|
|
1887
1931
|
static manifest = {
|
|
1888
1932
|
ownedProperties: [
|
|
1889
1933
|
{
|
|
@@ -1931,7 +1975,7 @@ class mn extends _ {
|
|
|
1931
1975
|
});
|
|
1932
1976
|
} else
|
|
1933
1977
|
i = [...e];
|
|
1934
|
-
const n =
|
|
1978
|
+
const n = Fe(i);
|
|
1935
1979
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
1936
1980
|
}
|
|
1937
1981
|
afterRender() {
|
|
@@ -1944,7 +1988,7 @@ class mn extends _ {
|
|
|
1944
1988
|
if (!e) return;
|
|
1945
1989
|
const t = e.querySelector(".header-group-row");
|
|
1946
1990
|
t && t.remove();
|
|
1947
|
-
const i = this.columns, n =
|
|
1991
|
+
const i = this.columns, n = Fe(i);
|
|
1948
1992
|
if (n.length === 0) return;
|
|
1949
1993
|
const r = Wt(n, i);
|
|
1950
1994
|
if (r) {
|
|
@@ -1984,7 +2028,7 @@ class mn extends _ {
|
|
|
1984
2028
|
this.requestRender();
|
|
1985
2029
|
}
|
|
1986
2030
|
}
|
|
1987
|
-
function
|
|
2031
|
+
function Ie({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
1988
2032
|
const n = e.groupOn;
|
|
1989
2033
|
if (typeof n != "function")
|
|
1990
2034
|
return [];
|
|
@@ -2048,7 +2092,7 @@ function Qt(s) {
|
|
|
2048
2092
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
2049
2093
|
}
|
|
2050
2094
|
const ei = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
2051
|
-
class
|
|
2095
|
+
class mn extends A {
|
|
2052
2096
|
static manifest = {
|
|
2053
2097
|
configRules: [
|
|
2054
2098
|
{
|
|
@@ -2093,7 +2137,7 @@ class wn extends _ {
|
|
|
2093
2137
|
const t = this.config;
|
|
2094
2138
|
if (typeof t.groupOn != "function")
|
|
2095
2139
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2096
|
-
const i =
|
|
2140
|
+
const i = Ie({
|
|
2097
2141
|
rows: [...e],
|
|
2098
2142
|
config: t,
|
|
2099
2143
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -2105,7 +2149,7 @@ class wn extends _ {
|
|
|
2105
2149
|
const a = Jt(i);
|
|
2106
2150
|
n = Zt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2107
2151
|
}
|
|
2108
|
-
const r =
|
|
2152
|
+
const r = Ie({
|
|
2109
2153
|
rows: [...e],
|
|
2110
2154
|
config: t,
|
|
2111
2155
|
expanded: this.expandedKeys,
|
|
@@ -2197,7 +2241,7 @@ class wn extends _ {
|
|
|
2197
2241
|
const c = document.createElement("span");
|
|
2198
2242
|
c.className = "group-aggregates";
|
|
2199
2243
|
for (const [u, h] of d) {
|
|
2200
|
-
const g = this.columns.find((p) => p.field === u), f =
|
|
2244
|
+
const g = this.columns.find((p) => p.field === u), f = ee(h, o, u, g);
|
|
2201
2245
|
if (f != null) {
|
|
2202
2246
|
const p = document.createElement("span");
|
|
2203
2247
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
@@ -2215,14 +2259,14 @@ class wn extends _ {
|
|
|
2215
2259
|
let c = !1;
|
|
2216
2260
|
o.forEach((u, h) => {
|
|
2217
2261
|
const g = document.createElement("div");
|
|
2218
|
-
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"),
|
|
2262
|
+
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), fe(u)) {
|
|
2219
2263
|
g.setAttribute("data-field", u.field), t.appendChild(g);
|
|
2220
2264
|
return;
|
|
2221
2265
|
}
|
|
2222
2266
|
if (c) {
|
|
2223
2267
|
const f = r[u.field];
|
|
2224
2268
|
if (f) {
|
|
2225
|
-
const p =
|
|
2269
|
+
const p = ee(f, a, u.field, u);
|
|
2226
2270
|
g.textContent = p != null ? String(p) : "";
|
|
2227
2271
|
} else
|
|
2228
2272
|
g.textContent = "";
|
|
@@ -2230,7 +2274,7 @@ class wn extends _ {
|
|
|
2230
2274
|
c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2231
2275
|
const f = document.createElement("span"), p = r[u.field];
|
|
2232
2276
|
if (p) {
|
|
2233
|
-
const w =
|
|
2277
|
+
const w = ee(p, a, u.field, u);
|
|
2234
2278
|
f.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2235
2279
|
} else
|
|
2236
2280
|
f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
@@ -2309,7 +2353,7 @@ class wn extends _ {
|
|
|
2309
2353
|
this.config.groupOn = e, this.requestRender();
|
|
2310
2354
|
}
|
|
2311
2355
|
}
|
|
2312
|
-
function
|
|
2356
|
+
function Pe(s, e) {
|
|
2313
2357
|
const t = new Set(s);
|
|
2314
2358
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2315
2359
|
}
|
|
@@ -2333,7 +2377,7 @@ function ri(s, e, t, i) {
|
|
|
2333
2377
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2334
2378
|
}
|
|
2335
2379
|
const oi = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
2336
|
-
class et extends
|
|
2380
|
+
class et extends A {
|
|
2337
2381
|
name = "masterDetail";
|
|
2338
2382
|
styles = oi;
|
|
2339
2383
|
get defaultConfig() {
|
|
@@ -2399,7 +2443,7 @@ class et extends _ {
|
|
|
2399
2443
|
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : et.DEFAULT_DETAIL_HEIGHT;
|
|
2400
2444
|
}
|
|
2401
2445
|
toggleAndEmit(e, t) {
|
|
2402
|
-
this.expandedRows =
|
|
2446
|
+
this.expandedRows = Pe(this.expandedRows, e), this.emit("detail-expand", {
|
|
2403
2447
|
rowIndex: t,
|
|
2404
2448
|
row: e,
|
|
2405
2449
|
expanded: this.expandedRows.has(e)
|
|
@@ -2434,7 +2478,7 @@ class et extends _ {
|
|
|
2434
2478
|
onKeyDown(e) {
|
|
2435
2479
|
if (e.key !== " ") return;
|
|
2436
2480
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2437
|
-
if (!n || !
|
|
2481
|
+
if (!n || !fe(n)) return;
|
|
2438
2482
|
const r = this.rows[i];
|
|
2439
2483
|
if (r)
|
|
2440
2484
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -2510,7 +2554,7 @@ class et extends _ {
|
|
|
2510
2554
|
}
|
|
2511
2555
|
toggle(e) {
|
|
2512
2556
|
const t = this.rows[e];
|
|
2513
|
-
t && (this.expandedRows =
|
|
2557
|
+
t && (this.expandedRows = Pe(this.expandedRows, t), this.requestRender());
|
|
2514
2558
|
}
|
|
2515
2559
|
isExpanded(e) {
|
|
2516
2560
|
const t = this.rows[e];
|
|
@@ -2561,15 +2605,15 @@ function li(s, e, t, i) {
|
|
|
2561
2605
|
const n = s.find((r) => r.field === e);
|
|
2562
2606
|
return t ? n ? n.direction === "asc" ? s.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : s.filter((r) => r.field !== e) : s.length < i ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
|
|
2563
2607
|
}
|
|
2564
|
-
function
|
|
2608
|
+
function De(s, e) {
|
|
2565
2609
|
const t = s.findIndex((i) => i.field === e);
|
|
2566
2610
|
return t >= 0 ? t + 1 : void 0;
|
|
2567
2611
|
}
|
|
2568
|
-
function
|
|
2612
|
+
function Me(s, e) {
|
|
2569
2613
|
return s.find((t) => t.field === e)?.direction;
|
|
2570
2614
|
}
|
|
2571
|
-
const di = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:
|
|
2572
|
-
class
|
|
2615
|
+
const di = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2616
|
+
class wn extends A {
|
|
2573
2617
|
name = "multiSort";
|
|
2574
2618
|
styles = di;
|
|
2575
2619
|
get defaultConfig() {
|
|
@@ -2597,7 +2641,7 @@ class bn extends _ {
|
|
|
2597
2641
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2598
2642
|
const r = n.getAttribute("data-field");
|
|
2599
2643
|
if (!r) return;
|
|
2600
|
-
const o =
|
|
2644
|
+
const o = De(this.sortModel, r), a = Me(this.sortModel, r);
|
|
2601
2645
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2602
2646
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2603
2647
|
const c = document.createElement("span");
|
|
@@ -2621,10 +2665,10 @@ class bn extends _ {
|
|
|
2621
2665
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2622
2666
|
}
|
|
2623
2667
|
getSortIndex(e) {
|
|
2624
|
-
return
|
|
2668
|
+
return De(this.sortModel, e);
|
|
2625
2669
|
}
|
|
2626
2670
|
getSortDirection(e) {
|
|
2627
|
-
return
|
|
2671
|
+
return Me(this.sortModel, e);
|
|
2628
2672
|
}
|
|
2629
2673
|
getColumnState(e) {
|
|
2630
2674
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2653,10 +2697,10 @@ function ci(s) {
|
|
|
2653
2697
|
function ui(s) {
|
|
2654
2698
|
return s.filter((e) => e.sticky === "right");
|
|
2655
2699
|
}
|
|
2656
|
-
function
|
|
2700
|
+
function se(s) {
|
|
2657
2701
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2658
2702
|
}
|
|
2659
|
-
function
|
|
2703
|
+
function Ne(s, e) {
|
|
2660
2704
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2661
2705
|
if (!t.length) return;
|
|
2662
2706
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2680,12 +2724,12 @@ function qe(s, e) {
|
|
|
2680
2724
|
}), r += l.offsetWidth);
|
|
2681
2725
|
}
|
|
2682
2726
|
}
|
|
2683
|
-
function
|
|
2727
|
+
function qe(s) {
|
|
2684
2728
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2685
2729
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2686
2730
|
});
|
|
2687
2731
|
}
|
|
2688
|
-
class
|
|
2732
|
+
class bn extends A {
|
|
2689
2733
|
static manifest = {
|
|
2690
2734
|
ownedProperties: [
|
|
2691
2735
|
{
|
|
@@ -2708,26 +2752,26 @@ class vn extends _ {
|
|
|
2708
2752
|
}
|
|
2709
2753
|
static detect(e, t) {
|
|
2710
2754
|
const i = t?.columns;
|
|
2711
|
-
return Array.isArray(i) ?
|
|
2755
|
+
return Array.isArray(i) ? se(i) : !1;
|
|
2712
2756
|
}
|
|
2713
2757
|
processColumns(e) {
|
|
2714
|
-
return this.isApplied =
|
|
2758
|
+
return this.isApplied = se([...e]), [...e];
|
|
2715
2759
|
}
|
|
2716
2760
|
afterRender() {
|
|
2717
2761
|
if (!this.isApplied)
|
|
2718
2762
|
return;
|
|
2719
2763
|
const e = this.grid, t = [...this.columns];
|
|
2720
|
-
if (!
|
|
2721
|
-
|
|
2764
|
+
if (!se(t)) {
|
|
2765
|
+
qe(e), this.isApplied = !1;
|
|
2722
2766
|
return;
|
|
2723
2767
|
}
|
|
2724
2768
|
queueMicrotask(() => {
|
|
2725
|
-
|
|
2769
|
+
Ne(e, t);
|
|
2726
2770
|
});
|
|
2727
2771
|
}
|
|
2728
2772
|
onPluginQuery(e) {
|
|
2729
2773
|
switch (e.type) {
|
|
2730
|
-
case
|
|
2774
|
+
case Ze.CAN_MOVE_COLUMN: {
|
|
2731
2775
|
const t = e.context, i = t.sticky;
|
|
2732
2776
|
if (i === "left" || i === "right")
|
|
2733
2777
|
return !1;
|
|
@@ -2740,7 +2784,7 @@ class vn extends _ {
|
|
|
2740
2784
|
}
|
|
2741
2785
|
refreshStickyOffsets() {
|
|
2742
2786
|
const e = [...this.columns];
|
|
2743
|
-
|
|
2787
|
+
Ne(this.grid, e);
|
|
2744
2788
|
}
|
|
2745
2789
|
getLeftPinnedColumns() {
|
|
2746
2790
|
const e = [...this.columns];
|
|
@@ -2751,7 +2795,7 @@ class vn extends _ {
|
|
|
2751
2795
|
return ui(e);
|
|
2752
2796
|
}
|
|
2753
2797
|
clearStickyPositions() {
|
|
2754
|
-
|
|
2798
|
+
qe(this.grid);
|
|
2755
2799
|
}
|
|
2756
2800
|
getHorizontalScrollOffsets(e, t) {
|
|
2757
2801
|
if (!this.isApplied)
|
|
@@ -2775,7 +2819,7 @@ class vn extends _ {
|
|
|
2775
2819
|
function hi(s) {
|
|
2776
2820
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2777
2821
|
}
|
|
2778
|
-
function
|
|
2822
|
+
function ae(s, e) {
|
|
2779
2823
|
const t = document.createElement("div");
|
|
2780
2824
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
2781
2825
|
const i = document.createElement("div");
|
|
@@ -2831,10 +2875,10 @@ function ze(s, e, t, i) {
|
|
|
2831
2875
|
const c = n.aggregators?.[o.field];
|
|
2832
2876
|
if (c)
|
|
2833
2877
|
if (hi(c)) {
|
|
2834
|
-
const u =
|
|
2878
|
+
const u = ve(c.aggFunc);
|
|
2835
2879
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2836
2880
|
} else {
|
|
2837
|
-
const u =
|
|
2881
|
+
const u = ve(c);
|
|
2838
2882
|
u && (l = u(i, o.field, o));
|
|
2839
2883
|
}
|
|
2840
2884
|
else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
|
|
@@ -2852,7 +2896,7 @@ function gi(s, e) {
|
|
|
2852
2896
|
const i = s.render(e);
|
|
2853
2897
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2854
2898
|
}
|
|
2855
|
-
function
|
|
2899
|
+
function Ke(s, e, t, i, n) {
|
|
2856
2900
|
return {
|
|
2857
2901
|
totalRows: s.length,
|
|
2858
2902
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2863,7 +2907,7 @@ function Ge(s, e, t, i, n) {
|
|
|
2863
2907
|
};
|
|
2864
2908
|
}
|
|
2865
2909
|
const fi = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
2866
|
-
class
|
|
2910
|
+
class vn extends A {
|
|
2867
2911
|
name = "pinnedRows";
|
|
2868
2912
|
styles = fi;
|
|
2869
2913
|
get defaultConfig() {
|
|
@@ -2887,7 +2931,7 @@ class yn extends _ {
|
|
|
2887
2931
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2888
2932
|
if (!t) return;
|
|
2889
2933
|
this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
|
|
2890
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
2934
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Ke(
|
|
2891
2935
|
this.rows,
|
|
2892
2936
|
this.columns,
|
|
2893
2937
|
this.grid,
|
|
@@ -2910,9 +2954,9 @@ class yn extends _ {
|
|
|
2910
2954
|
const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && r.selectedRows > 0 || this.config.showFilteredCount && r.filteredRows !== r.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = l.length > 0 || c;
|
|
2911
2955
|
if (d && this.config.position === "top")
|
|
2912
2956
|
if (!this.infoBarElement)
|
|
2913
|
-
this.infoBarElement =
|
|
2957
|
+
this.infoBarElement = ae(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
2914
2958
|
else {
|
|
2915
|
-
const h =
|
|
2959
|
+
const h = ae(this.config, r);
|
|
2916
2960
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2917
2961
|
}
|
|
2918
2962
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
@@ -2921,7 +2965,7 @@ class yn extends _ {
|
|
|
2921
2965
|
l,
|
|
2922
2966
|
this.visibleColumns,
|
|
2923
2967
|
this.rows
|
|
2924
|
-
)), c && (this.infoBarElement =
|
|
2968
|
+
)), c && (this.infoBarElement = ae(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
2925
2969
|
}
|
|
2926
2970
|
cleanup() {
|
|
2927
2971
|
this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null), this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null), this.bottomAggregationContainer && (this.bottomAggregationContainer.remove(), this.bottomAggregationContainer = null), this.footerWrapper && (this.footerWrapper.remove(), this.footerWrapper = null);
|
|
@@ -2948,7 +2992,7 @@ class yn extends _ {
|
|
|
2948
2992
|
}
|
|
2949
2993
|
getContext() {
|
|
2950
2994
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
2951
|
-
return
|
|
2995
|
+
return Ke(
|
|
2952
2996
|
this.rows,
|
|
2953
2997
|
this.columns,
|
|
2954
2998
|
this.grid,
|
|
@@ -2974,7 +3018,7 @@ function mi(s) {
|
|
|
2974
3018
|
const e = [];
|
|
2975
3019
|
return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
|
|
2976
3020
|
}
|
|
2977
|
-
function
|
|
3021
|
+
function we(s, e) {
|
|
2978
3022
|
return [...s, e].join("|");
|
|
2979
3023
|
}
|
|
2980
3024
|
function wi(s, e) {
|
|
@@ -3014,7 +3058,7 @@ function vi(s, e) {
|
|
|
3014
3058
|
function tt(s, e, t, i, n, r, o) {
|
|
3015
3059
|
const a = [];
|
|
3016
3060
|
if (e.length === 0) {
|
|
3017
|
-
const h = Oe(s, t, i, n), g =
|
|
3061
|
+
const h = Oe(s, t, i, n), g = Ge(h);
|
|
3018
3062
|
return a.push({
|
|
3019
3063
|
rowKey: o || "all",
|
|
3020
3064
|
rowLabel: o || "All",
|
|
@@ -3027,9 +3071,9 @@ function tt(s, e, t, i, n, r, o) {
|
|
|
3027
3071
|
}
|
|
3028
3072
|
const l = e[0], d = e.slice(1), c = d.length > 0, u = vi(s, l);
|
|
3029
3073
|
for (const [h, g] of u) {
|
|
3030
|
-
const f = o ? `${o}|${h}` : h, p = Oe(g, t, i, n), w =
|
|
3031
|
-
let
|
|
3032
|
-
c && (
|
|
3074
|
+
const f = o ? `${o}|${h}` : h, p = Oe(g, t, i, n), w = Ge(p);
|
|
3075
|
+
let b;
|
|
3076
|
+
c && (b = tt(
|
|
3033
3077
|
g,
|
|
3034
3078
|
d,
|
|
3035
3079
|
t,
|
|
@@ -3044,7 +3088,7 @@ function tt(s, e, t, i, n, r, o) {
|
|
|
3044
3088
|
values: p,
|
|
3045
3089
|
total: w,
|
|
3046
3090
|
isGroup: c,
|
|
3047
|
-
children:
|
|
3091
|
+
children: b,
|
|
3048
3092
|
rowCount: g.length
|
|
3049
3093
|
});
|
|
3050
3094
|
}
|
|
@@ -3054,12 +3098,12 @@ function Oe(s, e, t, i) {
|
|
|
3054
3098
|
const n = {};
|
|
3055
3099
|
for (const r of t)
|
|
3056
3100
|
for (const o of i) {
|
|
3057
|
-
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = pi(o.aggFunc), c = l.length > 0 ? d(l) : null, u =
|
|
3101
|
+
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = pi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = we([r], o.field);
|
|
3058
3102
|
n[u] = c;
|
|
3059
3103
|
}
|
|
3060
3104
|
return n;
|
|
3061
3105
|
}
|
|
3062
|
-
function
|
|
3106
|
+
function Ge(s) {
|
|
3063
3107
|
let e = 0;
|
|
3064
3108
|
for (const t of Object.values(s))
|
|
3065
3109
|
e += t ?? 0;
|
|
@@ -3072,7 +3116,7 @@ function yi(s, e, t) {
|
|
|
3072
3116
|
if (!o.isGroup || !o.children?.length)
|
|
3073
3117
|
for (const a of e)
|
|
3074
3118
|
for (const l of t) {
|
|
3075
|
-
const d =
|
|
3119
|
+
const d = we([a], l.field);
|
|
3076
3120
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
3077
3121
|
}
|
|
3078
3122
|
else o.children && n(o.children);
|
|
@@ -3103,10 +3147,10 @@ function Ci(s) {
|
|
|
3103
3147
|
t(i);
|
|
3104
3148
|
return e;
|
|
3105
3149
|
}
|
|
3106
|
-
const
|
|
3107
|
-
function
|
|
3150
|
+
const Ei = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3151
|
+
function Ri(s, e, t, i) {
|
|
3108
3152
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3109
|
-
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () =>
|
|
3153
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Ti(t, r))), o.appendChild(j("Row Groups", () => Be("rowGroups", r))), o.appendChild(j("Column Groups", () => Be("columnGroups", r))), o.appendChild(j("Values", () => ki(r))), o.appendChild(j("Available Fields", () => _i(r))), s.appendChild(o), () => {
|
|
3110
3154
|
n.abort(), o.remove();
|
|
3111
3155
|
};
|
|
3112
3156
|
}
|
|
@@ -3118,7 +3162,7 @@ function j(s, e) {
|
|
|
3118
3162
|
const n = document.createElement("div");
|
|
3119
3163
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3120
3164
|
}
|
|
3121
|
-
function
|
|
3165
|
+
function Be(s, e) {
|
|
3122
3166
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3123
3167
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
3124
3168
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -3217,7 +3261,7 @@ function Ai(s, e) {
|
|
|
3217
3261
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3218
3262
|
const l = document.createElement("select");
|
|
3219
3263
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3220
|
-
for (const c of
|
|
3264
|
+
for (const c of Ei) {
|
|
3221
3265
|
const u = document.createElement("option");
|
|
3222
3266
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3223
3267
|
}
|
|
@@ -3267,10 +3311,10 @@ function _i(s) {
|
|
|
3267
3311
|
}
|
|
3268
3312
|
return n;
|
|
3269
3313
|
}
|
|
3270
|
-
function
|
|
3314
|
+
function Ti(s, e) {
|
|
3271
3315
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3272
3316
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3273
|
-
|
|
3317
|
+
le(
|
|
3274
3318
|
"Enable Pivot View",
|
|
3275
3319
|
s,
|
|
3276
3320
|
(o) => {
|
|
@@ -3279,7 +3323,7 @@ function Li(s, e) {
|
|
|
3279
3323
|
n
|
|
3280
3324
|
)
|
|
3281
3325
|
), r.appendChild(
|
|
3282
|
-
|
|
3326
|
+
le(
|
|
3283
3327
|
"Show Row Totals",
|
|
3284
3328
|
t.showTotals ?? !0,
|
|
3285
3329
|
(o) => {
|
|
@@ -3288,7 +3332,7 @@ function Li(s, e) {
|
|
|
3288
3332
|
n
|
|
3289
3333
|
)
|
|
3290
3334
|
), r.appendChild(
|
|
3291
|
-
|
|
3335
|
+
le(
|
|
3292
3336
|
"Show Grand Total",
|
|
3293
3337
|
t.showGrandTotal ?? !0,
|
|
3294
3338
|
(o) => {
|
|
@@ -3298,7 +3342,7 @@ function Li(s, e) {
|
|
|
3298
3342
|
)
|
|
3299
3343
|
), r;
|
|
3300
3344
|
}
|
|
3301
|
-
function
|
|
3345
|
+
function le(s, e, t, i) {
|
|
3302
3346
|
const n = document.createElement("label");
|
|
3303
3347
|
n.className = "tbw-pivot-checkbox";
|
|
3304
3348
|
const r = document.createElement("input");
|
|
@@ -3306,7 +3350,7 @@ function de(s, e, t, i) {
|
|
|
3306
3350
|
const o = document.createElement("span");
|
|
3307
3351
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3308
3352
|
}
|
|
3309
|
-
function
|
|
3353
|
+
function Li(s, e, t) {
|
|
3310
3354
|
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
|
|
3311
3355
|
const r = document.createElement("div");
|
|
3312
3356
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3355,8 +3399,8 @@ function Ii(s, e, t) {
|
|
|
3355
3399
|
e.appendChild(r);
|
|
3356
3400
|
}), !0;
|
|
3357
3401
|
}
|
|
3358
|
-
const Pi = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:
|
|
3359
|
-
class
|
|
3402
|
+
const Pi = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
3403
|
+
class G extends A {
|
|
3360
3404
|
name = "pivot";
|
|
3361
3405
|
styles = Pi;
|
|
3362
3406
|
static PANEL_ID = "pivot";
|
|
@@ -3375,6 +3419,7 @@ class O extends _ {
|
|
|
3375
3419
|
fieldHeaderMap = /* @__PURE__ */ new Map();
|
|
3376
3420
|
expandedKeys = /* @__PURE__ */ new Set();
|
|
3377
3421
|
defaultExpanded = !0;
|
|
3422
|
+
userHasToggledExpand = !1;
|
|
3378
3423
|
originalColumns = [];
|
|
3379
3424
|
panelContainer = null;
|
|
3380
3425
|
grandTotalFooter = null;
|
|
@@ -3387,12 +3432,12 @@ class O extends _ {
|
|
|
3387
3432
|
return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
|
|
3388
3433
|
}
|
|
3389
3434
|
detach() {
|
|
3390
|
-
this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear();
|
|
3435
|
+
this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.userHasToggledExpand = !1;
|
|
3391
3436
|
}
|
|
3392
3437
|
getToolPanel() {
|
|
3393
3438
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3394
3439
|
return {
|
|
3395
|
-
id:
|
|
3440
|
+
id: G.PANEL_ID,
|
|
3396
3441
|
title: "Pivot",
|
|
3397
3442
|
icon: "⊞",
|
|
3398
3443
|
tooltip: "Configure pivot table",
|
|
@@ -3406,7 +3451,7 @@ class O extends _ {
|
|
|
3406
3451
|
const t = mi(this.config);
|
|
3407
3452
|
if (t.length > 0)
|
|
3408
3453
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3409
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.
|
|
3454
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = wi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
3410
3455
|
const i = this.config.indentWidth ?? 20, n = xi(
|
|
3411
3456
|
this.pivotResult.rows,
|
|
3412
3457
|
this.expandedKeys,
|
|
@@ -3442,7 +3487,7 @@ class O extends _ {
|
|
|
3442
3487
|
});
|
|
3443
3488
|
for (const n of this.pivotResult.columnKeys)
|
|
3444
3489
|
for (const r of this.config.valueFields ?? []) {
|
|
3445
|
-
const o =
|
|
3490
|
+
const o = we([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3446
3491
|
t.push({
|
|
3447
3492
|
field: o,
|
|
3448
3493
|
header: `${n} - ${a} (${r.aggFunc})`,
|
|
@@ -3459,7 +3504,7 @@ class O extends _ {
|
|
|
3459
3504
|
}
|
|
3460
3505
|
renderRow(e, t, i) {
|
|
3461
3506
|
const n = e;
|
|
3462
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3507
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Li(n, t, {
|
|
3463
3508
|
columns: this.gridColumns,
|
|
3464
3509
|
rowIndex: i,
|
|
3465
3510
|
onToggle: (r) => this.toggle(r),
|
|
@@ -3509,19 +3554,19 @@ class O extends _ {
|
|
|
3509
3554
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
3510
3555
|
}
|
|
3511
3556
|
toggle(e) {
|
|
3512
|
-
this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
|
|
3557
|
+
this.userHasToggledExpand = !0, this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
|
|
3513
3558
|
}
|
|
3514
3559
|
expand(e) {
|
|
3515
|
-
this.expandedKeys.add(e), this.requestRender();
|
|
3560
|
+
this.userHasToggledExpand = !0, this.expandedKeys.add(e), this.requestRender();
|
|
3516
3561
|
}
|
|
3517
3562
|
collapse(e) {
|
|
3518
|
-
this.expandedKeys.delete(e), this.requestRender();
|
|
3563
|
+
this.userHasToggledExpand = !0, this.expandedKeys.delete(e), this.requestRender();
|
|
3519
3564
|
}
|
|
3520
3565
|
expandAll() {
|
|
3521
|
-
this.expandAllKeys(), this.requestRender();
|
|
3566
|
+
this.userHasToggledExpand = !0, this.expandAllKeys(), this.requestRender();
|
|
3522
3567
|
}
|
|
3523
3568
|
collapseAll() {
|
|
3524
|
-
this.expandedKeys.clear(), this.requestRender();
|
|
3569
|
+
this.userHasToggledExpand = !0, this.expandedKeys.clear(), this.requestRender();
|
|
3525
3570
|
}
|
|
3526
3571
|
expandAllKeys() {
|
|
3527
3572
|
if (!this.pivotResult) return;
|
|
@@ -3557,16 +3602,16 @@ class O extends _ {
|
|
|
3557
3602
|
this.pivotResult = null, this.requestRender();
|
|
3558
3603
|
}
|
|
3559
3604
|
showPanel() {
|
|
3560
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3605
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(G.PANEL_ID) || this.grid.toggleToolPanelSection(G.PANEL_ID);
|
|
3561
3606
|
}
|
|
3562
3607
|
hidePanel() {
|
|
3563
3608
|
this.grid.closeToolPanel();
|
|
3564
3609
|
}
|
|
3565
3610
|
togglePanel() {
|
|
3566
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3611
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(G.PANEL_ID);
|
|
3567
3612
|
}
|
|
3568
3613
|
isPanelVisible() {
|
|
3569
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3614
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(G.PANEL_ID);
|
|
3570
3615
|
}
|
|
3571
3616
|
get gridColumns() {
|
|
3572
3617
|
return this.grid.columns ?? [];
|
|
@@ -3610,7 +3655,7 @@ class O extends _ {
|
|
|
3610
3655
|
},
|
|
3611
3656
|
getAvailableFields: () => this.getAvailableFields()
|
|
3612
3657
|
};
|
|
3613
|
-
return
|
|
3658
|
+
return Ri(e, this.config, this.isActive, t);
|
|
3614
3659
|
}
|
|
3615
3660
|
refreshPanel() {
|
|
3616
3661
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3643,10 +3688,10 @@ class O extends _ {
|
|
|
3643
3688
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3644
3689
|
}
|
|
3645
3690
|
}
|
|
3646
|
-
const
|
|
3691
|
+
const J = "tbw-print-isolation-style";
|
|
3647
3692
|
function Di(s, e) {
|
|
3648
3693
|
const t = document.createElement("style");
|
|
3649
|
-
return t.id =
|
|
3694
|
+
return t.id = J, t.textContent = `
|
|
3650
3695
|
/* Print isolation: hide everything except the target grid */
|
|
3651
3696
|
@media print {
|
|
3652
3697
|
/* Hide all body children by default */
|
|
@@ -3722,18 +3767,18 @@ async function Mi(s, e = {}) {
|
|
|
3722
3767
|
const { orientation: t = "landscape" } = e, i = s.id;
|
|
3723
3768
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3724
3769
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3725
|
-
), document.getElementById(
|
|
3770
|
+
), document.getElementById(J)?.remove();
|
|
3726
3771
|
const r = Di(i, t);
|
|
3727
3772
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3728
3773
|
const a = () => {
|
|
3729
|
-
window.removeEventListener("afterprint", a), document.getElementById(
|
|
3774
|
+
window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
|
|
3730
3775
|
};
|
|
3731
3776
|
window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
|
|
3732
|
-
window.removeEventListener("afterprint", a), document.getElementById(
|
|
3777
|
+
window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
|
|
3733
3778
|
}, 5e3);
|
|
3734
3779
|
});
|
|
3735
3780
|
}
|
|
3736
|
-
const Ni = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding
|
|
3781
|
+
const Ni = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-right:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", qi = {
|
|
3737
3782
|
button: !1,
|
|
3738
3783
|
orientation: "landscape",
|
|
3739
3784
|
warnThreshold: 500,
|
|
@@ -3743,7 +3788,7 @@ const Ni = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3743
3788
|
title: "",
|
|
3744
3789
|
isolate: !1
|
|
3745
3790
|
};
|
|
3746
|
-
class
|
|
3791
|
+
class yn extends A {
|
|
3747
3792
|
name = "print";
|
|
3748
3793
|
version = "1.0.0";
|
|
3749
3794
|
styles = Ni;
|
|
@@ -3890,19 +3935,19 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3890
3935
|
});
|
|
3891
3936
|
}
|
|
3892
3937
|
}
|
|
3893
|
-
function
|
|
3938
|
+
function Hi(s) {
|
|
3894
3939
|
const e = s.meta ?? {};
|
|
3895
3940
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3896
3941
|
}
|
|
3897
|
-
function
|
|
3942
|
+
function Ve(s, e, t) {
|
|
3898
3943
|
if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
|
|
3899
3944
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3900
3945
|
return i.splice(t, 0, n), i;
|
|
3901
3946
|
}
|
|
3902
|
-
const
|
|
3903
|
-
class
|
|
3947
|
+
const zi = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
|
|
3948
|
+
class xn extends A {
|
|
3904
3949
|
name = "reorder";
|
|
3905
|
-
styles =
|
|
3950
|
+
styles = zi;
|
|
3906
3951
|
get defaultConfig() {
|
|
3907
3952
|
return {
|
|
3908
3953
|
animation: "flip"
|
|
@@ -3919,8 +3964,8 @@ class Cn extends _ {
|
|
|
3919
3964
|
draggedIndex = null;
|
|
3920
3965
|
dropIndex = null;
|
|
3921
3966
|
canMoveColumnWithPlugins(e) {
|
|
3922
|
-
return !e || !
|
|
3923
|
-
type:
|
|
3967
|
+
return !e || !Hi(e) ? !1 : !this.grid.queryPlugins({
|
|
3968
|
+
type: Ze.CAN_MOVE_COLUMN,
|
|
3924
3969
|
context: e
|
|
3925
3970
|
}).includes(!1);
|
|
3926
3971
|
}
|
|
@@ -3969,7 +4014,7 @@ class Cn extends _ {
|
|
|
3969
4014
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
3970
4015
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
3971
4016
|
return;
|
|
3972
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g =
|
|
4017
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = Ve(h, d, u), f = {
|
|
3973
4018
|
field: l,
|
|
3974
4019
|
fromIndex: d,
|
|
3975
4020
|
toIndex: u,
|
|
@@ -4000,7 +4045,7 @@ class Cn extends _ {
|
|
|
4000
4045
|
moveColumn(e, t) {
|
|
4001
4046
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
4002
4047
|
if (n === -1) return;
|
|
4003
|
-
const r =
|
|
4048
|
+
const r = Ve(i, n, t);
|
|
4004
4049
|
this.emitCancelable("column-move", {
|
|
4005
4050
|
field: e,
|
|
4006
4051
|
fromIndex: n,
|
|
@@ -4095,11 +4140,11 @@ class Cn extends _ {
|
|
|
4095
4140
|
this.grid.requestStateChange?.();
|
|
4096
4141
|
}
|
|
4097
4142
|
}
|
|
4098
|
-
const
|
|
4099
|
-
class
|
|
4143
|
+
const Ki = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
4144
|
+
class Cn extends A {
|
|
4100
4145
|
name = "responsive";
|
|
4101
4146
|
version = "1.0.0";
|
|
4102
|
-
styles =
|
|
4147
|
+
styles = Ki;
|
|
4103
4148
|
static manifest = {
|
|
4104
4149
|
incompatibleWith: [
|
|
4105
4150
|
{
|
|
@@ -4156,7 +4201,7 @@ class Rn extends _ {
|
|
|
4156
4201
|
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4157
4202
|
}
|
|
4158
4203
|
afterRender() {
|
|
4159
|
-
if (this.#
|
|
4204
|
+
if (this.#E(), !(this.#c.length > 0 ? this.#a !== null : this.#t))
|
|
4160
4205
|
return;
|
|
4161
4206
|
const t = this.#r.size > 0, i = this.#d.size > 0;
|
|
4162
4207
|
if (!t && !i)
|
|
@@ -4298,7 +4343,7 @@ class Rn extends _ {
|
|
|
4298
4343
|
return e;
|
|
4299
4344
|
}
|
|
4300
4345
|
#b = !1;
|
|
4301
|
-
#
|
|
4346
|
+
#E() {
|
|
4302
4347
|
if (!this.#t || !this.config.cardRenderer)
|
|
4303
4348
|
return;
|
|
4304
4349
|
let e = !1;
|
|
@@ -4320,10 +4365,10 @@ class Rn extends _ {
|
|
|
4320
4365
|
}));
|
|
4321
4366
|
}
|
|
4322
4367
|
}
|
|
4323
|
-
const
|
|
4324
|
-
class En extends
|
|
4368
|
+
const Oi = '@layer tbw-plugins{.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', Gi = "__tbw_row_drag";
|
|
4369
|
+
class En extends A {
|
|
4325
4370
|
name = "rowReorder";
|
|
4326
|
-
styles =
|
|
4371
|
+
styles = Oi;
|
|
4327
4372
|
get defaultConfig() {
|
|
4328
4373
|
return {
|
|
4329
4374
|
enableKeyboard: !0,
|
|
@@ -4334,6 +4379,9 @@ class En extends _ {
|
|
|
4334
4379
|
animation: "flip"
|
|
4335
4380
|
};
|
|
4336
4381
|
}
|
|
4382
|
+
get animationType() {
|
|
4383
|
+
return this.isAnimationEnabled ? this.config.animation !== void 0 ? this.config.animation : "flip" : !1;
|
|
4384
|
+
}
|
|
4337
4385
|
isDragging = !1;
|
|
4338
4386
|
draggedRowIndex = null;
|
|
4339
4387
|
dropRowIndex = null;
|
|
@@ -4347,7 +4395,7 @@ class En extends _ {
|
|
|
4347
4395
|
if (!this.config.showDragHandle)
|
|
4348
4396
|
return [...e];
|
|
4349
4397
|
const t = {
|
|
4350
|
-
field:
|
|
4398
|
+
field: Gi,
|
|
4351
4399
|
header: "",
|
|
4352
4400
|
width: this.config.dragHandleWidth ?? 40,
|
|
4353
4401
|
resizable: !1,
|
|
@@ -4473,7 +4521,49 @@ class En extends _ {
|
|
|
4473
4521
|
rows: r,
|
|
4474
4522
|
source: n
|
|
4475
4523
|
};
|
|
4476
|
-
this.emitCancelable("row-move", a)
|
|
4524
|
+
if (!this.emitCancelable("row-move", a))
|
|
4525
|
+
if (this.animationType === "flip" && this.gridElement) {
|
|
4526
|
+
const d = this.captureRowPositions();
|
|
4527
|
+
this.grid.rows = r, requestAnimationFrame(() => {
|
|
4528
|
+
this.gridElement.offsetHeight, this.animateFLIP(d, t, i);
|
|
4529
|
+
});
|
|
4530
|
+
} else
|
|
4531
|
+
this.grid.rows = r;
|
|
4532
|
+
}
|
|
4533
|
+
captureRowPositions() {
|
|
4534
|
+
const e = /* @__PURE__ */ new Map();
|
|
4535
|
+
return this.gridElement?.querySelectorAll(".data-grid-row").forEach((t) => {
|
|
4536
|
+
const i = this.getRowIndex(t);
|
|
4537
|
+
i >= 0 && e.set(i, t.getBoundingClientRect().top);
|
|
4538
|
+
}), e;
|
|
4539
|
+
}
|
|
4540
|
+
animateFLIP(e, t, i) {
|
|
4541
|
+
const n = this.gridElement;
|
|
4542
|
+
if (!n || e.size === 0) return;
|
|
4543
|
+
const r = Math.min(t, i), o = Math.max(t, i), a = [];
|
|
4544
|
+
if (n.querySelectorAll(".data-grid-row").forEach((d) => {
|
|
4545
|
+
const c = d, u = this.getRowIndex(c);
|
|
4546
|
+
if (u < 0 || u < r || u > o) return;
|
|
4547
|
+
let h;
|
|
4548
|
+
u === i ? h = t : t < i ? h = u + 1 : h = u - 1;
|
|
4549
|
+
const g = e.get(h);
|
|
4550
|
+
if (g === void 0) return;
|
|
4551
|
+
const f = c.getBoundingClientRect().top, p = g - f;
|
|
4552
|
+
Math.abs(p) > 1 && a.push({ el: c, deltaY: p });
|
|
4553
|
+
}), a.length === 0) return;
|
|
4554
|
+
a.forEach(({ el: d, deltaY: c }) => {
|
|
4555
|
+
d.style.transform = `translateY(${c}px)`;
|
|
4556
|
+
}), n.offsetHeight;
|
|
4557
|
+
const l = this.animationDuration;
|
|
4558
|
+
requestAnimationFrame(() => {
|
|
4559
|
+
a.forEach(({ el: d }) => {
|
|
4560
|
+
d.classList.add("flip-animating"), d.style.transform = "";
|
|
4561
|
+
}), setTimeout(() => {
|
|
4562
|
+
a.forEach(({ el: d }) => {
|
|
4563
|
+
d.style.transform = "", d.classList.remove("flip-animating");
|
|
4564
|
+
});
|
|
4565
|
+
}, l + 50);
|
|
4566
|
+
});
|
|
4477
4567
|
}
|
|
4478
4568
|
getRowIndex(e) {
|
|
4479
4569
|
const t = e.querySelector(".cell[data-row]");
|
|
@@ -4510,7 +4600,7 @@ function Vi(s, e, t) {
|
|
|
4510
4600
|
const i = V(t);
|
|
4511
4601
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4512
4602
|
}
|
|
4513
|
-
function
|
|
4603
|
+
function We(s, e, t) {
|
|
4514
4604
|
return t.some((i) => Vi(s, e, i));
|
|
4515
4605
|
}
|
|
4516
4606
|
function Wi(s) {
|
|
@@ -4527,7 +4617,7 @@ function $i(s) {
|
|
|
4527
4617
|
e.set(`${i.row},${i.col}`, i);
|
|
4528
4618
|
return [...e.values()];
|
|
4529
4619
|
}
|
|
4530
|
-
function
|
|
4620
|
+
function de(s, e) {
|
|
4531
4621
|
return {
|
|
4532
4622
|
startRow: s.row,
|
|
4533
4623
|
startCol: s.col,
|
|
@@ -4535,11 +4625,11 @@ function ce(s, e) {
|
|
|
4535
4625
|
endCol: e.col
|
|
4536
4626
|
};
|
|
4537
4627
|
}
|
|
4538
|
-
function
|
|
4628
|
+
function Z(s, e) {
|
|
4539
4629
|
const t = V(s), i = V(e);
|
|
4540
4630
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4541
4631
|
}
|
|
4542
|
-
const ji = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-
|
|
4632
|
+
const ji = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4543
4633
|
function Ui(s, e, t) {
|
|
4544
4634
|
if (s === "cell" && e.selectedCell)
|
|
4545
4635
|
return {
|
|
@@ -4560,7 +4650,7 @@ function Ui(s, e, t) {
|
|
|
4560
4650
|
}
|
|
4561
4651
|
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: it(e.ranges) } : { mode: s, ranges: [] };
|
|
4562
4652
|
}
|
|
4563
|
-
class
|
|
4653
|
+
class Rn extends A {
|
|
4564
4654
|
static manifest = {
|
|
4565
4655
|
configRules: [
|
|
4566
4656
|
{
|
|
@@ -4616,7 +4706,7 @@ class Sn extends _ {
|
|
|
4616
4706
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4617
4707
|
if (n.type !== o)
|
|
4618
4708
|
return !1;
|
|
4619
|
-
const a = this.columns[i], l = a &&
|
|
4709
|
+
const a = this.columns[i], l = a && q(a);
|
|
4620
4710
|
if (r === "cell") {
|
|
4621
4711
|
if (l || !this.isCellSelectable(t, i))
|
|
4622
4712
|
return !1;
|
|
@@ -4630,8 +4720,8 @@ class Sn extends _ {
|
|
|
4630
4720
|
return !1;
|
|
4631
4721
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4632
4722
|
if (d && this.cellAnchor) {
|
|
4633
|
-
const u =
|
|
4634
|
-
if (h &&
|
|
4723
|
+
const u = de(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4724
|
+
if (h && Z(h, u))
|
|
4635
4725
|
return !1;
|
|
4636
4726
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
4637
4727
|
} else if (c) {
|
|
@@ -4649,7 +4739,7 @@ class Sn extends _ {
|
|
|
4649
4739
|
endRow: t,
|
|
4650
4740
|
endCol: i
|
|
4651
4741
|
};
|
|
4652
|
-
if (this.ranges.length === 1 &&
|
|
4742
|
+
if (this.ranges.length === 1 && Z(this.ranges[0], u))
|
|
4653
4743
|
return !1;
|
|
4654
4744
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
4655
4745
|
}
|
|
@@ -4694,7 +4784,7 @@ class Sn extends _ {
|
|
|
4694
4784
|
onCellMouseDown(e) {
|
|
4695
4785
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4696
4786
|
const t = this.columns[e.colIndex];
|
|
4697
|
-
if (t &&
|
|
4787
|
+
if (t && q(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4698
4788
|
return;
|
|
4699
4789
|
this.isDragging = !0;
|
|
4700
4790
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -4703,18 +4793,18 @@ class Sn extends _ {
|
|
|
4703
4793
|
endRow: i,
|
|
4704
4794
|
endCol: n
|
|
4705
4795
|
};
|
|
4706
|
-
return !r && this.ranges.length === 1 &&
|
|
4796
|
+
return !r && this.ranges.length === 1 && Z(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
|
|
4707
4797
|
}
|
|
4708
4798
|
onCellMouseMove(e) {
|
|
4709
4799
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4710
4800
|
let t = e.colIndex;
|
|
4711
4801
|
const i = this.columns[t];
|
|
4712
|
-
if (i &&
|
|
4713
|
-
const o = this.columns.findIndex((a) => !
|
|
4802
|
+
if (i && q(i)) {
|
|
4803
|
+
const o = this.columns.findIndex((a) => !q(a));
|
|
4714
4804
|
o >= 0 && (t = o);
|
|
4715
4805
|
}
|
|
4716
|
-
const n =
|
|
4717
|
-
return r &&
|
|
4806
|
+
const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4807
|
+
return r && Z(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
|
|
4718
4808
|
}
|
|
4719
4809
|
onCellMouseUp(e) {
|
|
4720
4810
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
@@ -4730,22 +4820,22 @@ class Sn extends _ {
|
|
|
4730
4820
|
const r = e.querySelectorAll(".data-grid-row");
|
|
4731
4821
|
if (r.forEach((o) => {
|
|
4732
4822
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4733
|
-
}), t === "row" && (
|
|
4823
|
+
}), t === "row" && (ye(e), r.forEach((o) => {
|
|
4734
4824
|
const a = o.querySelector(".cell[data-row]"), l = ut(a);
|
|
4735
4825
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4736
4826
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4737
4827
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4738
4828
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4739
4829
|
}), t === "range" && this.ranges.length > 0) {
|
|
4740
|
-
|
|
4741
|
-
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !
|
|
4830
|
+
ye(e);
|
|
4831
|
+
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !q(d));
|
|
4742
4832
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4743
4833
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4744
4834
|
if (c >= 0 && u >= 0) {
|
|
4745
4835
|
const h = this.columns[u];
|
|
4746
|
-
if (h &&
|
|
4836
|
+
if (h && q(h))
|
|
4747
4837
|
return;
|
|
4748
|
-
if (
|
|
4838
|
+
if (We(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4749
4839
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4750
4840
|
const f = Math.max(o.startCol, a);
|
|
4751
4841
|
u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
@@ -4764,7 +4854,7 @@ class Sn extends _ {
|
|
|
4764
4854
|
this.pendingKeyboardUpdate = null;
|
|
4765
4855
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4766
4856
|
if (n && this.cellAnchor) {
|
|
4767
|
-
const a =
|
|
4857
|
+
const a = de(this.cellAnchor, { row: r, col: o });
|
|
4768
4858
|
this.ranges = [a], this.activeRange = a;
|
|
4769
4859
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
4770
4860
|
this.emit("selection-change", this.#t());
|
|
@@ -4785,7 +4875,7 @@ class Sn extends _ {
|
|
|
4785
4875
|
return $i(this.ranges);
|
|
4786
4876
|
}
|
|
4787
4877
|
isCellSelected(e, t) {
|
|
4788
|
-
return
|
|
4878
|
+
return We(e, t, this.ranges);
|
|
4789
4879
|
}
|
|
4790
4880
|
clearSelection() {
|
|
4791
4881
|
this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
|
|
@@ -4813,7 +4903,7 @@ class Sn extends _ {
|
|
|
4813
4903
|
);
|
|
4814
4904
|
}
|
|
4815
4905
|
}
|
|
4816
|
-
function
|
|
4906
|
+
function Q(s, e) {
|
|
4817
4907
|
return Math.floor(s / e);
|
|
4818
4908
|
}
|
|
4819
4909
|
function Yi(s, e) {
|
|
@@ -4823,12 +4913,12 @@ function Yi(s, e) {
|
|
|
4823
4913
|
};
|
|
4824
4914
|
}
|
|
4825
4915
|
function Xi(s, e, t) {
|
|
4826
|
-
const i =
|
|
4916
|
+
const i = Q(s, t), n = Q(e - 1, t), r = [];
|
|
4827
4917
|
for (let o = i; o <= n; o++)
|
|
4828
4918
|
r.push(o);
|
|
4829
4919
|
return r;
|
|
4830
4920
|
}
|
|
4831
|
-
async function
|
|
4921
|
+
async function $e(s, e, t, i) {
|
|
4832
4922
|
const n = Yi(e, t);
|
|
4833
4923
|
return s.getRows({
|
|
4834
4924
|
startRow: n.start,
|
|
@@ -4838,13 +4928,13 @@ async function je(s, e, t, i) {
|
|
|
4838
4928
|
});
|
|
4839
4929
|
}
|
|
4840
4930
|
function Zi(s, e, t) {
|
|
4841
|
-
const i =
|
|
4931
|
+
const i = Q(s, e), n = t.get(i);
|
|
4842
4932
|
if (!n) return;
|
|
4843
4933
|
const r = s % e;
|
|
4844
4934
|
return n[r];
|
|
4845
4935
|
}
|
|
4846
4936
|
const Ji = 100;
|
|
4847
|
-
class
|
|
4937
|
+
class Sn extends A {
|
|
4848
4938
|
name = "serverSide";
|
|
4849
4939
|
get defaultConfig() {
|
|
4850
4940
|
return {
|
|
@@ -4869,7 +4959,7 @@ class kn extends _ {
|
|
|
4869
4959
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4870
4960
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
4871
4961
|
break;
|
|
4872
|
-
this.loadingBlocks.add(r),
|
|
4962
|
+
this.loadingBlocks.add(r), $e(this.dataSource, r, t, {}).then((o) => {
|
|
4873
4963
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
4874
4964
|
}).catch(() => {
|
|
4875
4965
|
this.loadingBlocks.delete(r);
|
|
@@ -4893,7 +4983,7 @@ class kn extends _ {
|
|
|
4893
4983
|
setDataSource(e) {
|
|
4894
4984
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
4895
4985
|
const t = this.config.cacheBlockSize ?? 100;
|
|
4896
|
-
|
|
4986
|
+
$e(e, 0, t, {}).then((i) => {
|
|
4897
4987
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
4898
4988
|
});
|
|
4899
4989
|
}
|
|
@@ -4907,7 +4997,7 @@ class kn extends _ {
|
|
|
4907
4997
|
return this.totalRowCount;
|
|
4908
4998
|
}
|
|
4909
4999
|
isRowLoaded(e) {
|
|
4910
|
-
const t = this.config.cacheBlockSize ?? 100, i =
|
|
5000
|
+
const t = this.config.cacheBlockSize ?? 100, i = Q(e, t);
|
|
4911
5001
|
return this.loadedBlocks.has(i);
|
|
4912
5002
|
}
|
|
4913
5003
|
getLoadedBlockCount() {
|
|
@@ -4917,17 +5007,17 @@ class kn extends _ {
|
|
|
4917
5007
|
function nt(s, e, t) {
|
|
4918
5008
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4919
5009
|
}
|
|
4920
|
-
function
|
|
5010
|
+
function ce(s, e) {
|
|
4921
5011
|
const t = new Set(s);
|
|
4922
5012
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
4923
5013
|
}
|
|
4924
|
-
function
|
|
5014
|
+
function ge(s, e, t = null, i = 0) {
|
|
4925
5015
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
4926
5016
|
for (let o = 0; o < s.length; o++) {
|
|
4927
5017
|
const a = s[o], l = nt(a, o, t), d = a[n];
|
|
4928
5018
|
if (Array.isArray(d) && d.length > 0) {
|
|
4929
5019
|
r.add(l);
|
|
4930
|
-
const c =
|
|
5020
|
+
const c = ge(d, e, l, i + 1);
|
|
4931
5021
|
for (const u of c) r.add(u);
|
|
4932
5022
|
}
|
|
4933
5023
|
}
|
|
@@ -4959,7 +5049,7 @@ function en(s, e, t, i) {
|
|
|
4959
5049
|
r.add(n[o]);
|
|
4960
5050
|
return r;
|
|
4961
5051
|
}
|
|
4962
|
-
function
|
|
5052
|
+
function je(s, e = "children") {
|
|
4963
5053
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
4964
5054
|
for (const t of s) {
|
|
4965
5055
|
if (!t) continue;
|
|
@@ -4982,7 +5072,7 @@ function tn(s) {
|
|
|
4982
5072
|
return null;
|
|
4983
5073
|
}
|
|
4984
5074
|
const nn = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
4985
|
-
class
|
|
5075
|
+
class kn extends A {
|
|
4986
5076
|
name = "tree";
|
|
4987
5077
|
styles = nn;
|
|
4988
5078
|
get defaultConfig() {
|
|
@@ -5011,14 +5101,14 @@ class An extends _ {
|
|
|
5011
5101
|
detect(e) {
|
|
5012
5102
|
if (!this.config.autoDetect) return !1;
|
|
5013
5103
|
const t = e, i = this.config.childrenField ?? tn(t) ?? "children";
|
|
5014
|
-
return
|
|
5104
|
+
return je(t, i);
|
|
5015
5105
|
}
|
|
5016
5106
|
processRows(e) {
|
|
5017
5107
|
const t = this.config.childrenField ?? "children", i = e;
|
|
5018
|
-
if (!
|
|
5108
|
+
if (!je(i, t))
|
|
5019
5109
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5020
5110
|
let n = this.withStableKeys(i);
|
|
5021
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5111
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ge(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5022
5112
|
const r = /* @__PURE__ */ new Set();
|
|
5023
5113
|
for (const o of this.flattenedRows)
|
|
5024
5114
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5074,19 +5164,19 @@ class An extends _ {
|
|
|
5074
5164
|
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, w = document.createElement("span");
|
|
5075
5165
|
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), g !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${g}px`), h)
|
|
5076
5166
|
if (f.__treeHasChildren) {
|
|
5077
|
-
const
|
|
5078
|
-
|
|
5167
|
+
const v = document.createElement("span");
|
|
5168
|
+
v.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(v, a(f.__treeExpanded ? "collapse" : "expand")), v.setAttribute("data-tree-key", String(f.__treeKey ?? "")), w.appendChild(v);
|
|
5079
5169
|
} else {
|
|
5080
|
-
const
|
|
5081
|
-
|
|
5170
|
+
const v = document.createElement("span");
|
|
5171
|
+
v.className = "tree-spacer", w.appendChild(v);
|
|
5082
5172
|
}
|
|
5083
|
-
const
|
|
5084
|
-
if (
|
|
5085
|
-
const
|
|
5086
|
-
|
|
5173
|
+
const b = document.createElement("span");
|
|
5174
|
+
if (b.className = "tree-content", n) {
|
|
5175
|
+
const v = n(d);
|
|
5176
|
+
v instanceof Node ? b.appendChild(v) : typeof v == "string" && (b.innerHTML = v);
|
|
5087
5177
|
} else
|
|
5088
|
-
|
|
5089
|
-
return w.appendChild(
|
|
5178
|
+
b.textContent = u != null ? String(u) : "";
|
|
5179
|
+
return w.appendChild(b), w;
|
|
5090
5180
|
};
|
|
5091
5181
|
return t[0] = { ...i, viewRenderer: l }, t;
|
|
5092
5182
|
}
|
|
@@ -5096,7 +5186,7 @@ class An extends _ {
|
|
|
5096
5186
|
const i = t.getAttribute("data-tree-key");
|
|
5097
5187
|
if (!i) return !1;
|
|
5098
5188
|
const n = this.rowKeyMap.get(i);
|
|
5099
|
-
return n ? (this.expandedKeys =
|
|
5189
|
+
return n ? (this.expandedKeys = ce(this.expandedKeys, i), this.emit("tree-expand", {
|
|
5100
5190
|
key: i,
|
|
5101
5191
|
row: n.data,
|
|
5102
5192
|
expanded: this.expandedKeys.has(i),
|
|
@@ -5107,7 +5197,7 @@ class An extends _ {
|
|
|
5107
5197
|
if (e.key !== " ") return;
|
|
5108
5198
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
5109
5199
|
if (i?.hasChildren)
|
|
5110
|
-
return e.preventDefault(), this.expandedKeys =
|
|
5200
|
+
return e.preventDefault(), this.expandedKeys = ce(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
5111
5201
|
key: i.key,
|
|
5112
5202
|
row: i.data,
|
|
5113
5203
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -5140,10 +5230,10 @@ class An extends _ {
|
|
|
5140
5230
|
this.expandedKeys.delete(e), this.requestRender();
|
|
5141
5231
|
}
|
|
5142
5232
|
toggle(e) {
|
|
5143
|
-
this.expandedKeys =
|
|
5233
|
+
this.expandedKeys = ce(this.expandedKeys, e), this.requestRender();
|
|
5144
5234
|
}
|
|
5145
5235
|
expandAll() {
|
|
5146
|
-
this.expandedKeys =
|
|
5236
|
+
this.expandedKeys = ge(this.rows, this.config), this.requestRender();
|
|
5147
5237
|
}
|
|
5148
5238
|
collapseAll() {
|
|
5149
5239
|
this.expandedKeys = Qi(), this.requestRender();
|
|
@@ -5173,7 +5263,7 @@ function rn(s, e, t) {
|
|
|
5173
5263
|
redoStack: []
|
|
5174
5264
|
};
|
|
5175
5265
|
}
|
|
5176
|
-
function
|
|
5266
|
+
function Ue(s) {
|
|
5177
5267
|
if (s.undoStack.length === 0)
|
|
5178
5268
|
return { newState: s, action: null };
|
|
5179
5269
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -5185,7 +5275,7 @@ function Ye(s) {
|
|
|
5185
5275
|
action: t
|
|
5186
5276
|
} : { newState: s, action: null };
|
|
5187
5277
|
}
|
|
5188
|
-
function
|
|
5278
|
+
function Ye(s) {
|
|
5189
5279
|
if (s.redoStack.length === 0)
|
|
5190
5280
|
return { newState: s, action: null };
|
|
5191
5281
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -5216,7 +5306,7 @@ function ln(s, e, t, i) {
|
|
|
5216
5306
|
timestamp: Date.now()
|
|
5217
5307
|
};
|
|
5218
5308
|
}
|
|
5219
|
-
class
|
|
5309
|
+
class An extends A {
|
|
5220
5310
|
static dependencies = [
|
|
5221
5311
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5222
5312
|
];
|
|
@@ -5234,7 +5324,7 @@ class _n extends _ {
|
|
|
5234
5324
|
onKeyDown(e) {
|
|
5235
5325
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5236
5326
|
if (t) {
|
|
5237
|
-
const n =
|
|
5327
|
+
const n = Ue({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5238
5328
|
if (n.action) {
|
|
5239
5329
|
const r = this.rows;
|
|
5240
5330
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
|
|
@@ -5245,7 +5335,7 @@ class _n extends _ {
|
|
|
5245
5335
|
return !0;
|
|
5246
5336
|
}
|
|
5247
5337
|
if (i) {
|
|
5248
|
-
const n =
|
|
5338
|
+
const n = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5249
5339
|
if (n.action) {
|
|
5250
5340
|
const r = this.rows;
|
|
5251
5341
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
|
|
@@ -5266,7 +5356,7 @@ class _n extends _ {
|
|
|
5266
5356
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5267
5357
|
}
|
|
5268
5358
|
undo() {
|
|
5269
|
-
const e =
|
|
5359
|
+
const e = Ue({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5270
5360
|
if (e.action) {
|
|
5271
5361
|
const t = this.rows;
|
|
5272
5362
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5274,7 +5364,7 @@ class _n extends _ {
|
|
|
5274
5364
|
return e.action;
|
|
5275
5365
|
}
|
|
5276
5366
|
redo() {
|
|
5277
|
-
const e =
|
|
5367
|
+
const e = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5278
5368
|
if (e.action) {
|
|
5279
5369
|
const t = this.rows;
|
|
5280
5370
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -5298,12 +5388,12 @@ class _n extends _ {
|
|
|
5298
5388
|
return [...this.redoStack];
|
|
5299
5389
|
}
|
|
5300
5390
|
}
|
|
5301
|
-
const dn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover
|
|
5302
|
-
function
|
|
5391
|
+
const dn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
|
|
5392
|
+
function Xe(s) {
|
|
5303
5393
|
const e = s.meta ?? {};
|
|
5304
5394
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5305
5395
|
}
|
|
5306
|
-
class B extends
|
|
5396
|
+
class B extends A {
|
|
5307
5397
|
static dependencies = [
|
|
5308
5398
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5309
5399
|
];
|
|
@@ -5399,7 +5489,7 @@ class B extends _ {
|
|
|
5399
5489
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5400
5490
|
for (let n = 0; n < i.length; n++) {
|
|
5401
5491
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
5402
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
5492
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Xe(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
5403
5493
|
const l = document.createElement("label");
|
|
5404
5494
|
l.className = "tbw-visibility-label";
|
|
5405
5495
|
const d = document.createElement("input");
|
|
@@ -5407,7 +5497,7 @@ class B extends _ {
|
|
|
5407
5497
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5408
5498
|
});
|
|
5409
5499
|
const c = document.createElement("span");
|
|
5410
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
5500
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Xe(r)) {
|
|
5411
5501
|
const u = document.createElement("span");
|
|
5412
5502
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
5413
5503
|
}
|
|
@@ -5447,50 +5537,50 @@ class B extends _ {
|
|
|
5447
5537
|
}
|
|
5448
5538
|
}
|
|
5449
5539
|
export {
|
|
5450
|
-
|
|
5540
|
+
A as BaseGridPlugin,
|
|
5451
5541
|
un as ClipboardPlugin,
|
|
5452
5542
|
hn as ColumnVirtualizationPlugin,
|
|
5453
|
-
|
|
5454
|
-
|
|
5543
|
+
Qe as ContextMenuPlugin,
|
|
5544
|
+
Ln as DEFAULT_ANIMATION_CONFIG,
|
|
5455
5545
|
st as DEFAULT_GRID_ICONS,
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5546
|
+
Fn as DGEvents,
|
|
5547
|
+
In as DataGridElement,
|
|
5548
|
+
gn as EditingPlugin,
|
|
5549
|
+
fn as ExportPlugin,
|
|
5550
|
+
N as FilteringPlugin,
|
|
5551
|
+
Pn as FitModeEnum,
|
|
5552
|
+
Dn as GridCSSVars,
|
|
5553
|
+
Mn as GridClasses,
|
|
5554
|
+
Nn as GridDataAttrs,
|
|
5555
|
+
qn as GridElement,
|
|
5466
5556
|
Hn as GridSelectors,
|
|
5467
|
-
|
|
5468
|
-
|
|
5557
|
+
pn as GroupingColumnsPlugin,
|
|
5558
|
+
mn as GroupingRowsPlugin,
|
|
5469
5559
|
et as MasterDetailPlugin,
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5560
|
+
wn as MultiSortPlugin,
|
|
5561
|
+
Ze as PLUGIN_QUERIES,
|
|
5562
|
+
bn as PinnedColumnsPlugin,
|
|
5563
|
+
vn as PinnedRowsPlugin,
|
|
5564
|
+
G as PivotPlugin,
|
|
5475
5565
|
zn as PluginEvents,
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5566
|
+
Kn as PluginManager,
|
|
5567
|
+
yn as PrintPlugin,
|
|
5568
|
+
Gi as ROW_DRAG_HANDLE_FIELD,
|
|
5479
5569
|
On as RenderPhase,
|
|
5480
|
-
|
|
5481
|
-
|
|
5570
|
+
xn as ReorderPlugin,
|
|
5571
|
+
Cn as ResponsivePlugin,
|
|
5482
5572
|
En as RowReorderPlugin,
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5573
|
+
Rn as SelectionPlugin,
|
|
5574
|
+
Sn as ServerSidePlugin,
|
|
5575
|
+
kn as TreePlugin,
|
|
5576
|
+
An as UndoRedoPlugin,
|
|
5487
5577
|
B as VisibilityPlugin,
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5578
|
+
Gn as builtInSort,
|
|
5579
|
+
Bn as createGrid,
|
|
5580
|
+
Vn as defaultComparator,
|
|
5491
5581
|
_t as defaultEditorFor,
|
|
5492
5582
|
mt as defaultPasteHandler,
|
|
5493
5583
|
Mi as printGridIsolated,
|
|
5494
|
-
|
|
5584
|
+
Wn as queryGrid
|
|
5495
5585
|
};
|
|
5496
5586
|
//# sourceMappingURL=all.js.map
|