@toolbox-web/grid 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +694 -525
- package/all.js.map +1 -1
- package/index.js +1468 -1449
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +2 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/sanitize.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/types.d.ts +9 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.d.ts +1 -1
- package/lib/plugins/editing/index.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +187 -170
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +44 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +9 -9
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +8 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +59 -60
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +7 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +185 -145
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +40 -39
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +51 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +325 -131
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +18 -0
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +2 -0
- package/public.d.ts.map +1 -1
- package/themes/dg-theme-bootstrap.css +192 -8
- package/themes/dg-theme-material.css +243 -0
- package/umd/grid.all.umd.js +43 -43
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +19 -19
- 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/editing.umd.js +1 -1
- package/umd/plugins/editing.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/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return a.field ===
|
|
1
|
+
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ft, F as M, e as F, s as gt, c as pt, runAggregator as ie, a as et, b as tt, g as he, r as mt, getAggregator as ye, getValueAggregator as wt, d as xe, f as Ce } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Mn, DGEvents as Nn, DataGridElement as qn, FitModeEnum as Hn, GridCSSVars as Kn, GridClasses as zn, GridDataAttrs as On, DataGridElement as Gn, GridSelectors as Bn, PLUGIN_QUERIES as Vn, PluginEvents as Wn, PluginManager as $n, RenderPhase as jn, builtInSort as Un, createGrid as Yn, defaultComparator as Xn, queryGrid as Zn } from "./index.js";
|
|
3
|
+
const it = "__tbw_expander", bt = 32;
|
|
4
|
+
function te(a) {
|
|
5
|
+
return a.field === it;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function K(a) {
|
|
8
8
|
return a.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
10
|
function vt(a) {
|
|
11
|
-
return a.find(
|
|
11
|
+
return a.find(te);
|
|
12
12
|
}
|
|
13
13
|
function yt(a) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: it,
|
|
16
16
|
header: "",
|
|
17
17
|
width: bt,
|
|
18
18
|
resizable: !1,
|
|
@@ -27,7 +27,7 @@ function yt(a) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function ne(a) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(a), !0;
|
|
33
33
|
} catch {
|
|
@@ -37,7 +37,7 @@ async function ie(a) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Ee(a, e) {
|
|
41
41
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
42
42
|
`, n = a.replace(/\r\n/g, `
|
|
43
43
|
`).replace(/\r/g, `
|
|
@@ -81,7 +81,7 @@ function Ct(a, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class mn extends _ {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -107,10 +107,10 @@ class pn extends _ {
|
|
|
107
107
|
this.lastCopied = null;
|
|
108
108
|
}
|
|
109
109
|
onKeyDown(e) {
|
|
110
|
-
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#
|
|
110
|
+
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#i(e.target), !0) : !1;
|
|
111
111
|
}
|
|
112
|
-
#
|
|
113
|
-
const t = this.#
|
|
112
|
+
#i(e) {
|
|
113
|
+
const t = this.#r(), i = this.columns.length - 1, n = this.rows.length - 1;
|
|
114
114
|
let r;
|
|
115
115
|
if (t && t.ranges.length > 0) {
|
|
116
116
|
const { mode: s, ranges: l } = t, d = l[l.length - 1];
|
|
@@ -132,8 +132,8 @@ class pn extends _ {
|
|
|
132
132
|
if (!s) return;
|
|
133
133
|
r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
|
|
134
134
|
}
|
|
135
|
-
const o = this.#
|
|
136
|
-
|
|
135
|
+
const o = this.#t(r);
|
|
136
|
+
ne(o.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: o.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: o.text,
|
|
139
139
|
rowCount: o.rowCount,
|
|
@@ -145,7 +145,7 @@ class pn extends _ {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i =
|
|
148
|
+
const i = Ee(t, this.config), n = this.#r(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
|
|
149
149
|
for (let w = 0; w < g && s + w <= c; w++) {
|
|
150
150
|
const b = this.columns[s + w];
|
|
151
151
|
b && !b.hidden && f.push(b.field);
|
|
@@ -159,12 +159,12 @@ class pn extends _ {
|
|
|
159
159
|
if (t === null) return;
|
|
160
160
|
(t ?? Ct)(e, this.grid);
|
|
161
161
|
}
|
|
162
|
-
#
|
|
162
|
+
#r() {
|
|
163
163
|
return this.grid?.query("getSelection", void 0)?.[0];
|
|
164
164
|
}
|
|
165
|
-
#
|
|
165
|
+
#t(e) {
|
|
166
166
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), s = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
167
|
-
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !
|
|
167
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !K(g));
|
|
168
168
|
if (this.config.includeHeaders) {
|
|
169
169
|
const g = f.map((p) => p.header || p.field);
|
|
170
170
|
h.push(g.join(c));
|
|
@@ -195,7 +195,7 @@ class pn extends _ {
|
|
|
195
195
|
return o === -1 ? null : { row: r, col: o };
|
|
196
196
|
}
|
|
197
197
|
async copy() {
|
|
198
|
-
const e = this.#
|
|
198
|
+
const e = this.#r(), t = this.columns.length - 1;
|
|
199
199
|
let i = { startRow: 0, startCol: 0, endRow: this.rows.length - 1, endCol: t };
|
|
200
200
|
if (e && e.ranges.length > 0) {
|
|
201
201
|
const r = e.ranges[e.ranges.length - 1];
|
|
@@ -206,8 +206,8 @@ class pn extends _ {
|
|
|
206
206
|
endCol: r.to.col
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
const n = this.#
|
|
210
|
-
return await
|
|
209
|
+
const n = this.#t(i);
|
|
210
|
+
return await ne(n.text), this.lastCopied = { text: n.text, timestamp: Date.now() }, n.text;
|
|
211
211
|
}
|
|
212
212
|
async copyRows(e) {
|
|
213
213
|
if (e.length === 0) return "";
|
|
@@ -216,37 +216,37 @@ class pn extends _ {
|
|
|
216
216
|
startCol: 0,
|
|
217
217
|
endRow: t[t.length - 1],
|
|
218
218
|
endCol: i
|
|
219
|
-
}, r = this.#
|
|
220
|
-
return await
|
|
219
|
+
}, r = this.#t(n);
|
|
220
|
+
return await ne(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
223
|
const e = await xt();
|
|
224
|
-
return e ?
|
|
224
|
+
return e ? Ee(e, this.config) : null;
|
|
225
225
|
}
|
|
226
226
|
getLastCopied() {
|
|
227
227
|
return this.lastCopied;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
const
|
|
230
|
+
const Re = 100;
|
|
231
231
|
function me(a) {
|
|
232
232
|
if (a == null)
|
|
233
|
-
return
|
|
233
|
+
return Re;
|
|
234
234
|
if (typeof a == "number")
|
|
235
235
|
return a;
|
|
236
236
|
const e = parseFloat(a);
|
|
237
|
-
return isNaN(e) ?
|
|
237
|
+
return isNaN(e) ? Re : e;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Se(a) {
|
|
240
240
|
return a.map((e) => me(e.width));
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function ke(a) {
|
|
243
243
|
const e = [];
|
|
244
244
|
let t = 0;
|
|
245
245
|
for (const i of a)
|
|
246
246
|
e.push(t), t += me(i.width);
|
|
247
247
|
return e;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Ae(a) {
|
|
250
250
|
return a.reduce((e, t) => e + me(t.width), 0);
|
|
251
251
|
}
|
|
252
252
|
function Et(a, e, t, i, n) {
|
|
@@ -281,7 +281,7 @@ function Rt(a, e, t) {
|
|
|
281
281
|
function St(a, e, t) {
|
|
282
282
|
return t ? a > e : !1;
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class wn extends _ {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -301,12 +301,12 @@ class mn extends _ {
|
|
|
301
301
|
attach(e) {
|
|
302
302
|
super.attach(e);
|
|
303
303
|
const t = this.columns;
|
|
304
|
-
this.columnWidths =
|
|
304
|
+
this.columnWidths = Se(t), this.columnOffsets = ke(t), this.totalWidth = Ae(t), this.endCol = t.length - 1;
|
|
305
305
|
}
|
|
306
306
|
detach() {
|
|
307
|
-
this.#
|
|
307
|
+
this.#i(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
308
308
|
}
|
|
309
|
-
#
|
|
309
|
+
#i() {
|
|
310
310
|
const e = this.gridElement;
|
|
311
311
|
if (!e) return;
|
|
312
312
|
const t = e.querySelector(".header-row");
|
|
@@ -319,7 +319,7 @@ class mn extends _ {
|
|
|
319
319
|
r && (r.style.minWidth = "");
|
|
320
320
|
}
|
|
321
321
|
processColumns(e) {
|
|
322
|
-
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths =
|
|
322
|
+
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Se(e), this.columnOffsets = ke(e), this.totalWidth = Ae(e));
|
|
323
323
|
const i = this.originalColumns, n = St(
|
|
324
324
|
i.length,
|
|
325
325
|
this.config.threshold ?? 30,
|
|
@@ -369,14 +369,14 @@ class mn extends _ {
|
|
|
369
369
|
return this.totalWidth;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
const
|
|
373
|
-
function
|
|
372
|
+
const re = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
373
|
+
function fe(a, e) {
|
|
374
374
|
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
375
375
|
}
|
|
376
376
|
function kt(a, e) {
|
|
377
377
|
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function ge(a, e, t, i = ft.submenuArrow) {
|
|
380
380
|
const n = document.createElement("div");
|
|
381
381
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
382
382
|
for (const r of a) {
|
|
@@ -401,7 +401,7 @@ function fe(a, e, t, i = ht.submenuArrow) {
|
|
|
401
401
|
const d = document.createElement("span");
|
|
402
402
|
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", () => {
|
|
403
403
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
404
|
-
const u =
|
|
404
|
+
const u = fe(r.subMenu, e), h = ge(u, e, t, i);
|
|
405
405
|
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);
|
|
406
406
|
}), o.addEventListener("mouseleave", () => {
|
|
407
407
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -414,14 +414,14 @@ function fe(a, e, t, i = ht.submenuArrow) {
|
|
|
414
414
|
}
|
|
415
415
|
return n;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function _e(a, e, t) {
|
|
418
418
|
a.style.position = "fixed", a.style.left = `${e}px`, a.style.top = `${t}px`, a.style.visibility = "hidden", a.style.zIndex = "10000";
|
|
419
419
|
const i = a.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
420
420
|
let o = e, s = t;
|
|
421
421
|
e + i.width > n && (o = e - i.width), t + i.height > r && (s = t - i.height), o = Math.max(0, o), s = Math.max(0, s), a.style.left = `${o}px`, a.style.top = `${s}px`, a.style.visibility = "visible";
|
|
422
422
|
}
|
|
423
|
-
let O = null, G = null, N = null,
|
|
424
|
-
const
|
|
423
|
+
let O = null, G = null, N = null, oe = 0;
|
|
424
|
+
const se = [
|
|
425
425
|
{
|
|
426
426
|
id: "copy",
|
|
427
427
|
name: "Copy",
|
|
@@ -439,11 +439,11 @@ const oe = [
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
];
|
|
442
|
-
class
|
|
442
|
+
class nt extends _ {
|
|
443
443
|
name = "contextMenu";
|
|
444
444
|
get defaultConfig() {
|
|
445
445
|
return {
|
|
446
|
-
items:
|
|
446
|
+
items: se
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
449
|
isOpen = !1;
|
|
@@ -451,7 +451,7 @@ class it extends _ {
|
|
|
451
451
|
params = null;
|
|
452
452
|
menuElement = null;
|
|
453
453
|
attach(e) {
|
|
454
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
454
|
+
super.attach(e), this.installGlobalHandlers(), oe++;
|
|
455
455
|
}
|
|
456
456
|
detach() {
|
|
457
457
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
@@ -496,7 +496,7 @@ class it extends _ {
|
|
|
496
496
|
if (!t) return;
|
|
497
497
|
const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
|
|
498
498
|
r && n.push(`color-scheme: ${r}`);
|
|
499
|
-
for (const o of
|
|
499
|
+
for (const o of nt.CSS_VARS_TO_COPY) {
|
|
500
500
|
const s = i.getPropertyValue(o).trim();
|
|
501
501
|
s && n.push(`${o}: ${s}`);
|
|
502
502
|
}
|
|
@@ -506,19 +506,19 @@ class it extends _ {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
installGlobalHandlers() {
|
|
509
|
-
!N && typeof document < "u" && typeof
|
|
509
|
+
!N && typeof document < "u" && typeof re == "string" && re && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = re, document.head.appendChild(N)), O || (O = () => {
|
|
510
510
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
511
511
|
}, document.addEventListener("click", O)), G || (G = (e) => {
|
|
512
512
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
513
513
|
}, document.addEventListener("keydown", G));
|
|
514
514
|
}
|
|
515
515
|
uninstallGlobalHandlers() {
|
|
516
|
-
|
|
516
|
+
oe--, !(oe > 0) && (O && (document.removeEventListener("click", O), O = null), G && (document.removeEventListener("keydown", G), G = null), N && (N.remove(), N = null));
|
|
517
517
|
}
|
|
518
518
|
afterRender() {
|
|
519
519
|
const e = this.gridElement;
|
|
520
520
|
if (!e) return;
|
|
521
|
-
const t = e.
|
|
521
|
+
const t = e.querySelector(".tbw-grid-root");
|
|
522
522
|
t && t.getAttribute("data-context-menu-bound") !== "true" && (t.setAttribute("data-context-menu-bound", "true"), t.addEventListener("contextmenu", (i) => {
|
|
523
523
|
const n = i;
|
|
524
524
|
n.preventDefault();
|
|
@@ -551,15 +551,15 @@ class it extends _ {
|
|
|
551
551
|
} else
|
|
552
552
|
return;
|
|
553
553
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
554
|
-
const d =
|
|
555
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
554
|
+
const d = fe(this.config.items ?? se, l);
|
|
555
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
556
556
|
d,
|
|
557
557
|
l,
|
|
558
558
|
(c) => {
|
|
559
559
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
560
560
|
},
|
|
561
561
|
this.gridIcons.submenuArrow
|
|
562
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
562
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), _e(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
563
563
|
}));
|
|
564
564
|
}
|
|
565
565
|
showMenu(e, t, i) {
|
|
@@ -572,15 +572,15 @@ class it extends _ {
|
|
|
572
572
|
value: i.value ?? null,
|
|
573
573
|
isHeader: i.isHeader ?? !1,
|
|
574
574
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
575
|
-
}, r =
|
|
576
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
575
|
+
}, r = fe(this.config.items ?? se, n);
|
|
576
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = ge(
|
|
577
577
|
r,
|
|
578
578
|
n,
|
|
579
579
|
(o) => {
|
|
580
580
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
581
581
|
},
|
|
582
582
|
this.gridIcons.submenuArrow
|
|
583
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
583
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), _e(this.menuElement, e, t), this.isOpen = !0;
|
|
584
584
|
}
|
|
585
585
|
hideMenu() {
|
|
586
586
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -594,7 +594,7 @@ function _t(a) {
|
|
|
594
594
|
const e = a.options;
|
|
595
595
|
return e ? typeof e == "function" ? e() : e : [];
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Tt(a) {
|
|
598
598
|
return (e) => {
|
|
599
599
|
const t = a.editorParams, i = document.createElement("input");
|
|
600
600
|
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);
|
|
@@ -604,7 +604,7 @@ function Lt(a) {
|
|
|
604
604
|
}), i;
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function Lt() {
|
|
608
608
|
return (a) => {
|
|
609
609
|
const e = document.createElement("input");
|
|
610
610
|
return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
|
|
@@ -651,7 +651,7 @@ function Pt(a) {
|
|
|
651
651
|
i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder);
|
|
652
652
|
const n = () => {
|
|
653
653
|
const r = i.value;
|
|
654
|
-
typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r);
|
|
654
|
+
(e.value === null || e.value === void 0) && r === "" || typeof e.value == "string" && r === e.value.replace(/[\n\r]/g, "") || (typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r));
|
|
655
655
|
};
|
|
656
656
|
return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
|
|
657
657
|
r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
|
|
@@ -661,9 +661,9 @@ function Pt(a) {
|
|
|
661
661
|
function Dt(a) {
|
|
662
662
|
switch (a.type) {
|
|
663
663
|
case "number":
|
|
664
|
-
return
|
|
664
|
+
return Tt(a);
|
|
665
665
|
case "boolean":
|
|
666
|
-
return
|
|
666
|
+
return Lt();
|
|
667
667
|
case "date":
|
|
668
668
|
return It(a);
|
|
669
669
|
case "select":
|
|
@@ -697,9 +697,9 @@ function qt(a) {
|
|
|
697
697
|
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
698
698
|
}
|
|
699
699
|
function W(a, e, t) {
|
|
700
|
-
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
|
|
700
|
+
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" || typeof t == "string" && a.value === t.replace(/[\n\r]/g, "") ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function Te(a) {
|
|
703
703
|
}
|
|
704
704
|
function Ht(a, e, t, i) {
|
|
705
705
|
const n = a.querySelector("input,textarea,select");
|
|
@@ -707,7 +707,7 @@ function Ht(a, e, t, i) {
|
|
|
707
707
|
t(W(n, e, i));
|
|
708
708
|
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(W(n, e, i))));
|
|
709
709
|
}
|
|
710
|
-
class
|
|
710
|
+
class bn extends _ {
|
|
711
711
|
static manifest = {
|
|
712
712
|
ownedProperties: [
|
|
713
713
|
{
|
|
@@ -748,17 +748,17 @@ class wn extends _ {
|
|
|
748
748
|
editOn: "click"
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
get #
|
|
751
|
+
get #i() {
|
|
752
752
|
return this.config.mode === "grid";
|
|
753
753
|
}
|
|
754
754
|
#e = -1;
|
|
755
755
|
#s = -1;
|
|
756
|
-
#
|
|
757
|
-
#
|
|
756
|
+
#r = /* @__PURE__ */ new Map();
|
|
757
|
+
#t = /* @__PURE__ */ new Set();
|
|
758
758
|
#n = /* @__PURE__ */ new Set();
|
|
759
759
|
#u = !1;
|
|
760
760
|
#l = -1;
|
|
761
|
-
#
|
|
761
|
+
#o = /* @__PURE__ */ new Map();
|
|
762
762
|
#d = !1;
|
|
763
763
|
#f = !1;
|
|
764
764
|
attach(e) {
|
|
@@ -775,7 +775,7 @@ class wn extends _ {
|
|
|
775
775
|
}, document.addEventListener(
|
|
776
776
|
"keydown",
|
|
777
777
|
(n) => {
|
|
778
|
-
if (!this.#
|
|
778
|
+
if (!this.#i && n.key === "Escape" && this.#e !== -1) {
|
|
779
779
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
780
780
|
return;
|
|
781
781
|
this.#a(this.#e, !0);
|
|
@@ -785,14 +785,14 @@ class wn extends _ {
|
|
|
785
785
|
), document.addEventListener(
|
|
786
786
|
"mousedown",
|
|
787
787
|
(n) => {
|
|
788
|
-
if (this.#
|
|
788
|
+
if (this.#i || this.#e === -1) return;
|
|
789
789
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
790
790
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
|
|
791
791
|
this.#e !== -1 && this.#a(this.#e, !1);
|
|
792
792
|
});
|
|
793
793
|
},
|
|
794
794
|
{ signal: t }
|
|
795
|
-
), this.#
|
|
795
|
+
), this.#i && (this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
|
|
796
796
|
"focusin",
|
|
797
797
|
(n) => {
|
|
798
798
|
const r = n.target;
|
|
@@ -830,14 +830,14 @@ class wn extends _ {
|
|
|
830
830
|
));
|
|
831
831
|
}
|
|
832
832
|
detach() {
|
|
833
|
-
this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#s = -1, this.#
|
|
833
|
+
this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#s = -1, this.#r.clear(), this.#t.clear(), this.#n.clear(), this.#d = !1, this.#f = !1, super.detach();
|
|
834
834
|
}
|
|
835
835
|
handleQuery(e) {
|
|
836
836
|
if (e.type === "isEditing")
|
|
837
|
-
return this.#
|
|
837
|
+
return this.#i || this.#e !== -1;
|
|
838
838
|
}
|
|
839
839
|
onCellClick(e) {
|
|
840
|
-
if (this.#
|
|
840
|
+
if (this.#i) return !1;
|
|
841
841
|
const t = this.grid, i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
842
842
|
if (i === !1 || i === "manual" || i !== "click" && i !== "dblclick") return !1;
|
|
843
843
|
const n = e.originalEvent.type === "dblclick";
|
|
@@ -848,22 +848,22 @@ class wn extends _ {
|
|
|
848
848
|
onKeyDown(e) {
|
|
849
849
|
const t = this.grid;
|
|
850
850
|
if (e.key === "Escape") {
|
|
851
|
-
if (this.#
|
|
851
|
+
if (this.#i && this.#d) {
|
|
852
852
|
const i = document.activeElement;
|
|
853
853
|
return i && this.gridElement.contains(i) && i.blur(), this.#d = !1, this.requestAfterRender(), !0;
|
|
854
854
|
}
|
|
855
|
-
if (this.#e !== -1 && !this.#
|
|
855
|
+
if (this.#e !== -1 && !this.#i)
|
|
856
856
|
return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#a(this.#e, !0), !0;
|
|
857
857
|
}
|
|
858
|
-
if (this.#
|
|
858
|
+
if (this.#i && !this.#d && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
|
|
859
859
|
return !1;
|
|
860
|
-
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#
|
|
860
|
+
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#i) {
|
|
861
861
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
862
862
|
return !0;
|
|
863
863
|
const i = t._rows.length - 1, n = this.#e;
|
|
864
864
|
return this.#a(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), F(t), this.requestAfterRender(), !0;
|
|
865
865
|
}
|
|
866
|
-
if (e.key === "Tab" && (this.#e !== -1 || this.#
|
|
866
|
+
if (e.key === "Tab" && (this.#e !== -1 || this.#i)) {
|
|
867
867
|
e.preventDefault();
|
|
868
868
|
const i = !e.shiftKey;
|
|
869
869
|
return this.#w(i), !0;
|
|
@@ -885,7 +885,7 @@ class wn extends _ {
|
|
|
885
885
|
return !1;
|
|
886
886
|
}
|
|
887
887
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
888
|
-
if (this.#
|
|
888
|
+
if (this.#i && !this.#d)
|
|
889
889
|
return this.#h(), !0;
|
|
890
890
|
if (this.#e !== -1)
|
|
891
891
|
return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
|
|
@@ -940,7 +940,7 @@ class wn extends _ {
|
|
|
940
940
|
const t = this.#l;
|
|
941
941
|
this.#l = -1, e.animateRow?.(t, "change");
|
|
942
942
|
}
|
|
943
|
-
if (!this.#
|
|
943
|
+
if (!this.#i && this.#n.size !== 0)
|
|
944
944
|
for (const t of this.#n) {
|
|
945
945
|
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
946
946
|
if (!s) continue;
|
|
@@ -951,7 +951,7 @@ class wn extends _ {
|
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
953
|
afterCellRender(e) {
|
|
954
|
-
if (!this.#
|
|
954
|
+
if (!this.#i) return;
|
|
955
955
|
const { row: t, rowIndex: i, column: n, colIndex: r, cellElement: o } = e;
|
|
956
956
|
n.editable && (o.classList.contains("editing") || this.#m(t, i, n, r, o, !0));
|
|
957
957
|
}
|
|
@@ -960,14 +960,14 @@ class wn extends _ {
|
|
|
960
960
|
}
|
|
961
961
|
get changedRows() {
|
|
962
962
|
const e = [];
|
|
963
|
-
for (const t of this.#
|
|
963
|
+
for (const t of this.#t) {
|
|
964
964
|
const i = this.grid.getRow(t);
|
|
965
965
|
i && e.push(i);
|
|
966
966
|
}
|
|
967
967
|
return e;
|
|
968
968
|
}
|
|
969
969
|
get changedRowIds() {
|
|
970
|
-
return Array.from(this.#
|
|
970
|
+
return Array.from(this.#t);
|
|
971
971
|
}
|
|
972
972
|
get activeEditRow() {
|
|
973
973
|
return this.#e;
|
|
@@ -986,47 +986,47 @@ class wn extends _ {
|
|
|
986
986
|
if (!i) return !1;
|
|
987
987
|
try {
|
|
988
988
|
const n = t.getRowId?.(i);
|
|
989
|
-
return n ? this.#
|
|
989
|
+
return n ? this.#t.has(n) : !1;
|
|
990
990
|
} catch {
|
|
991
991
|
return !1;
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
994
|
isRowChangedById(e) {
|
|
995
|
-
return this.#
|
|
995
|
+
return this.#t.has(e);
|
|
996
996
|
}
|
|
997
997
|
setInvalid(e, t, i = "") {
|
|
998
|
-
let n = this.#
|
|
999
|
-
n || (n = /* @__PURE__ */ new Map(), this.#
|
|
998
|
+
let n = this.#o.get(e);
|
|
999
|
+
n || (n = /* @__PURE__ */ new Map(), this.#o.set(e, n)), n.set(t, i), this.#p(e, t, !0);
|
|
1000
1000
|
}
|
|
1001
1001
|
clearInvalid(e, t) {
|
|
1002
|
-
const i = this.#
|
|
1003
|
-
i && (i.delete(t), i.size === 0 && this.#
|
|
1002
|
+
const i = this.#o.get(e);
|
|
1003
|
+
i && (i.delete(t), i.size === 0 && this.#o.delete(e)), this.#p(e, t, !1);
|
|
1004
1004
|
}
|
|
1005
1005
|
clearRowInvalid(e) {
|
|
1006
|
-
const t = this.#
|
|
1006
|
+
const t = this.#o.get(e);
|
|
1007
1007
|
if (t) {
|
|
1008
1008
|
const i = Array.from(t.keys());
|
|
1009
|
-
this.#
|
|
1009
|
+
this.#o.delete(e), i.forEach((n) => this.#p(e, n, !1));
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
1012
|
clearAllInvalid() {
|
|
1013
|
-
const e = Array.from(this.#
|
|
1014
|
-
this.#
|
|
1013
|
+
const e = Array.from(this.#o.entries());
|
|
1014
|
+
this.#o.clear(), e.forEach(([t, i]) => {
|
|
1015
1015
|
i.forEach((n, r) => this.#p(t, r, !1));
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
isCellInvalid(e, t) {
|
|
1019
|
-
return this.#
|
|
1019
|
+
return this.#o.get(e)?.has(t) ?? !1;
|
|
1020
1020
|
}
|
|
1021
1021
|
getInvalidMessage(e, t) {
|
|
1022
|
-
return this.#
|
|
1022
|
+
return this.#o.get(e)?.get(t);
|
|
1023
1023
|
}
|
|
1024
1024
|
hasInvalidCells(e) {
|
|
1025
|
-
const t = this.#
|
|
1025
|
+
const t = this.#o.get(e);
|
|
1026
1026
|
return t ? t.size > 0 : !1;
|
|
1027
1027
|
}
|
|
1028
1028
|
getInvalidFields(e) {
|
|
1029
|
-
return new Map(this.#
|
|
1029
|
+
return new Map(this.#o.get(e) ?? []);
|
|
1030
1030
|
}
|
|
1031
1031
|
#p(e, t, i) {
|
|
1032
1032
|
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
@@ -1043,14 +1043,14 @@ class wn extends _ {
|
|
|
1043
1043
|
if (d)
|
|
1044
1044
|
if (i) {
|
|
1045
1045
|
d.setAttribute("data-invalid", "true");
|
|
1046
|
-
const c = this.#
|
|
1046
|
+
const c = this.#o.get(e)?.get(t);
|
|
1047
1047
|
c && d.setAttribute("title", c);
|
|
1048
1048
|
} else
|
|
1049
1049
|
d.removeAttribute("data-invalid"), d.removeAttribute("title");
|
|
1050
1050
|
}
|
|
1051
1051
|
resetChangedRows(e) {
|
|
1052
1052
|
const t = this.changedRows, i = this.changedRowIds;
|
|
1053
|
-
this.#
|
|
1053
|
+
this.#t.clear(), this.#c(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
1054
1054
|
}
|
|
1055
1055
|
beginCellEdit(e, t) {
|
|
1056
1056
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
@@ -1101,7 +1101,7 @@ class wn extends _ {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
#w(e) {
|
|
1104
|
-
const t = this.grid, i = t._rows, n = this.#
|
|
1104
|
+
const t = this.grid, i = t._rows, n = this.#i ? t._focusRow : this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
|
|
1105
1105
|
if (r.length === 0) return;
|
|
1106
1106
|
const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
|
|
1107
1107
|
if (s >= 0 && s < r.length) {
|
|
@@ -1111,21 +1111,33 @@ class wn extends _ {
|
|
|
1111
1111
|
return;
|
|
1112
1112
|
}
|
|
1113
1113
|
const l = n + (e ? 1 : -1);
|
|
1114
|
-
l >= 0 && l < i.length && (this.#
|
|
1114
|
+
l >= 0 && l < i.length && (this.#i ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], F(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
|
|
1115
1115
|
const c = t.findRenderedRowElement?.(l)?.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1116
1116
|
c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 });
|
|
1117
1117
|
}, 0)) : (this.#a(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), F(t, { forceHorizontalScroll: !0 })));
|
|
1118
1118
|
}
|
|
1119
1119
|
#c() {
|
|
1120
1120
|
const e = this.grid;
|
|
1121
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1121
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#r;
|
|
1122
1122
|
}
|
|
1123
1123
|
#g(e, t) {
|
|
1124
|
-
this.#e !== e && (this.#
|
|
1124
|
+
if (this.#e !== e && (this.#r.set(e, { ...t }), this.#e = e, this.#c(), !this.#i)) {
|
|
1125
|
+
const i = this.grid;
|
|
1126
|
+
let n = "";
|
|
1127
|
+
try {
|
|
1128
|
+
n = i.getRowId?.(t) ?? "";
|
|
1129
|
+
} catch {
|
|
1130
|
+
}
|
|
1131
|
+
this.emit("edit-open", {
|
|
1132
|
+
rowIndex: e,
|
|
1133
|
+
rowId: n,
|
|
1134
|
+
row: t
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1125
1137
|
}
|
|
1126
1138
|
#a(e, t) {
|
|
1127
1139
|
if (this.#e !== e) return;
|
|
1128
|
-
const i = this.grid, n = this.#
|
|
1140
|
+
const i = this.grid, n = this.#r.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
1129
1141
|
let s;
|
|
1130
1142
|
if (r)
|
|
1131
1143
|
try {
|
|
@@ -1146,9 +1158,9 @@ class wn extends _ {
|
|
|
1146
1158
|
}), t && n && r)
|
|
1147
1159
|
Object.keys(n).forEach((l) => {
|
|
1148
1160
|
r[l] = n[l];
|
|
1149
|
-
}), s && (this.#
|
|
1161
|
+
}), s && (this.#t.delete(s), this.clearRowInvalid(s));
|
|
1150
1162
|
else if (!t && r) {
|
|
1151
|
-
const l = this.#C(n, r), d = s ? this.#
|
|
1163
|
+
const l = this.#C(n, r), d = s ? this.#t.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
1152
1164
|
rowIndex: e,
|
|
1153
1165
|
rowId: s ?? "",
|
|
1154
1166
|
row: r,
|
|
@@ -1160,14 +1172,19 @@ class wn extends _ {
|
|
|
1160
1172
|
});
|
|
1161
1173
|
c && n ? (Object.keys(n).forEach((u) => {
|
|
1162
1174
|
r[u] = n[u];
|
|
1163
|
-
}), s && (this.#
|
|
1175
|
+
}), s && (this.#t.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#l = e);
|
|
1164
1176
|
}
|
|
1165
|
-
this.#
|
|
1177
|
+
this.#r.delete(e), this.#e = -1, this.#s = -1, this.#c();
|
|
1166
1178
|
for (const l of this.#n)
|
|
1167
1179
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
1168
1180
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
1169
1181
|
l.classList.remove("editing"), qt(l.parentElement);
|
|
1170
|
-
}), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1)
|
|
1182
|
+
}), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1), !this.#i && r && this.emit("edit-close", {
|
|
1183
|
+
rowIndex: e,
|
|
1184
|
+
rowId: s ?? "",
|
|
1185
|
+
row: r,
|
|
1186
|
+
reverted: t
|
|
1187
|
+
});
|
|
1171
1188
|
}
|
|
1172
1189
|
#b(e, t, i, n) {
|
|
1173
1190
|
const r = t.field;
|
|
@@ -1180,7 +1197,7 @@ class wn extends _ {
|
|
|
1180
1197
|
l = this.grid.getRowId(n);
|
|
1181
1198
|
} catch {
|
|
1182
1199
|
}
|
|
1183
|
-
const d = l ? !this.#
|
|
1200
|
+
const d = l ? !this.#t.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : Te;
|
|
1184
1201
|
let u = !1;
|
|
1185
1202
|
const h = l ? (p) => {
|
|
1186
1203
|
u = !0, this.setInvalid(l, r, p ?? "");
|
|
@@ -1199,7 +1216,7 @@ class wn extends _ {
|
|
|
1199
1216
|
updateRow: c,
|
|
1200
1217
|
setInvalid: h
|
|
1201
1218
|
})) return;
|
|
1202
|
-
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#
|
|
1219
|
+
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#t.add(l), this.#c(), this.emitPluginEvent("cell-edit-committed", {
|
|
1203
1220
|
rowIndex: e,
|
|
1204
1221
|
field: r,
|
|
1205
1222
|
oldValue: o,
|
|
@@ -1215,19 +1232,19 @@ class wn extends _ {
|
|
|
1215
1232
|
s = this.grid.getRowId(e);
|
|
1216
1233
|
} catch {
|
|
1217
1234
|
}
|
|
1218
|
-
const l = s ? (v) => this.grid.updateRow(s, v, "cascade") :
|
|
1235
|
+
const l = s ? (v) => this.grid.updateRow(s, v, "cascade") : Te, d = U(i.field) ? e[i.field] : void 0;
|
|
1219
1236
|
r.classList.add("editing"), this.#n.add(`${t}:${n}`);
|
|
1220
1237
|
const c = r.parentElement;
|
|
1221
1238
|
c && Nt(c);
|
|
1222
1239
|
let u = !1;
|
|
1223
1240
|
const h = (v) => {
|
|
1224
|
-
u || !this.#
|
|
1241
|
+
u || !this.#i && this.#e === -1 || this.#b(t, i, v, e);
|
|
1225
1242
|
}, f = () => {
|
|
1226
1243
|
u = !0, U(i.field) && (e[i.field] = d);
|
|
1227
1244
|
}, g = document.createElement("div");
|
|
1228
1245
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
|
|
1229
1246
|
if (v.key === "Enter") {
|
|
1230
|
-
if (this.#
|
|
1247
|
+
if (this.#i) {
|
|
1231
1248
|
v.stopPropagation(), v.preventDefault();
|
|
1232
1249
|
const E = g.querySelector("input,textarea,select");
|
|
1233
1250
|
E && h(W(E, i, d));
|
|
@@ -1238,7 +1255,7 @@ class wn extends _ {
|
|
|
1238
1255
|
v.stopPropagation(), v.preventDefault(), u = !0, this.#a(t, !1);
|
|
1239
1256
|
}
|
|
1240
1257
|
if (v.key === "Escape") {
|
|
1241
|
-
if (this.#
|
|
1258
|
+
if (this.#i) {
|
|
1242
1259
|
v.stopPropagation(), v.preventDefault();
|
|
1243
1260
|
return;
|
|
1244
1261
|
}
|
|
@@ -1395,7 +1412,7 @@ function zt(a, e) {
|
|
|
1395
1412
|
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1396
1413
|
we(t, e);
|
|
1397
1414
|
}
|
|
1398
|
-
function
|
|
1415
|
+
function Ie(a) {
|
|
1399
1416
|
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1400
1417
|
}
|
|
1401
1418
|
function Ot(a, e, t) {
|
|
@@ -1410,7 +1427,7 @@ function Ot(a, e, t) {
|
|
|
1410
1427
|
<Row>`;
|
|
1411
1428
|
for (const n of e) {
|
|
1412
1429
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1413
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1430
|
+
i += `<Cell><Data ss:Type="String">${Ie(o)}</Data></Cell>`;
|
|
1414
1431
|
}
|
|
1415
1432
|
i += "</Row>";
|
|
1416
1433
|
}
|
|
@@ -1421,7 +1438,7 @@ function Ot(a, e, t) {
|
|
|
1421
1438
|
let o = n[r.field];
|
|
1422
1439
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1423
1440
|
let s = "String", l = "";
|
|
1424
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l =
|
|
1441
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l = Ie(String(o)), i += `<Cell><Data ss:Type="${s}">${l}</Data></Cell>`;
|
|
1425
1442
|
}
|
|
1426
1443
|
i += "</Row>";
|
|
1427
1444
|
}
|
|
@@ -1436,7 +1453,7 @@ function Gt(a, e) {
|
|
|
1436
1453
|
});
|
|
1437
1454
|
we(i, t);
|
|
1438
1455
|
}
|
|
1439
|
-
class
|
|
1456
|
+
class vn extends _ {
|
|
1440
1457
|
name = "export";
|
|
1441
1458
|
get defaultConfig() {
|
|
1442
1459
|
return {
|
|
@@ -1582,7 +1599,7 @@ function Wt(a) {
|
|
|
1582
1599
|
}))
|
|
1583
1600
|
);
|
|
1584
1601
|
}
|
|
1585
|
-
function
|
|
1602
|
+
function Fe(a, e) {
|
|
1586
1603
|
const t = /* @__PURE__ */ new Set();
|
|
1587
1604
|
for (const i of a) {
|
|
1588
1605
|
const n = i[e];
|
|
@@ -1590,7 +1607,7 @@ function Ie(a, e) {
|
|
|
1590
1607
|
}
|
|
1591
1608
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1592
1609
|
}
|
|
1593
|
-
const $t = '@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}}}', jt = "@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-
|
|
1610
|
+
const $t = '@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}}}', jt = "@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-actions .tbw-filter-value-item{flex:1}.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)}}";
|
|
1594
1611
|
class q extends _ {
|
|
1595
1612
|
static manifest = {
|
|
1596
1613
|
events: [
|
|
@@ -1667,7 +1684,7 @@ class q extends _ {
|
|
|
1667
1684
|
const n = i.getAttribute("data-col");
|
|
1668
1685
|
if (n === null) return;
|
|
1669
1686
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1670
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1687
|
+
if (!r || !this.isColumnFilterable(r) || K(r)) return;
|
|
1671
1688
|
const o = r.field;
|
|
1672
1689
|
if (!o) return;
|
|
1673
1690
|
const s = this.filters.has(o);
|
|
@@ -1735,7 +1752,7 @@ class q extends _ {
|
|
|
1735
1752
|
return this.getFilters();
|
|
1736
1753
|
}
|
|
1737
1754
|
getUniqueValues(e) {
|
|
1738
|
-
return
|
|
1755
|
+
return Fe(this.sourceRows, e);
|
|
1739
1756
|
}
|
|
1740
1757
|
copyGridThemeContext(e) {
|
|
1741
1758
|
const t = this.gridElement;
|
|
@@ -1767,7 +1784,7 @@ class q extends _ {
|
|
|
1767
1784
|
});
|
|
1768
1785
|
return;
|
|
1769
1786
|
}
|
|
1770
|
-
const r =
|
|
1787
|
+
const r = Fe(this.sourceRows, e);
|
|
1771
1788
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1772
1789
|
}
|
|
1773
1790
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1848,8 +1865,8 @@ class q extends _ {
|
|
|
1848
1865
|
const h = document.createElement("span");
|
|
1849
1866
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1850
1867
|
const f = () => {
|
|
1851
|
-
const C = [...b.values()], k = C.every((m) => m),
|
|
1852
|
-
u.checked = k, u.indeterminate = !k && !
|
|
1868
|
+
const C = [...b.values()], k = C.every((m) => m), T = C.every((m) => !m);
|
|
1869
|
+
u.checked = k, u.indeterminate = !k && !T;
|
|
1853
1870
|
};
|
|
1854
1871
|
u.addEventListener("change", () => {
|
|
1855
1872
|
const C = u.checked;
|
|
@@ -1870,26 +1887,26 @@ class q extends _ {
|
|
|
1870
1887
|
}), f();
|
|
1871
1888
|
let y = [];
|
|
1872
1889
|
const v = (C, k) => {
|
|
1873
|
-
const
|
|
1890
|
+
const T = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), x = document.createElement("label");
|
|
1874
1891
|
x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${k})`, x.style.left = "0", x.style.right = "0", x.style.boxSizing = "border-box";
|
|
1875
|
-
const
|
|
1876
|
-
|
|
1877
|
-
b.set(m,
|
|
1892
|
+
const L = document.createElement("input");
|
|
1893
|
+
L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
|
|
1894
|
+
b.set(m, L.checked), f();
|
|
1878
1895
|
});
|
|
1879
|
-
const
|
|
1880
|
-
return
|
|
1896
|
+
const H = document.createElement("span");
|
|
1897
|
+
return H.textContent = T, x.appendChild(L), x.appendChild(H), x;
|
|
1881
1898
|
}, E = () => {
|
|
1882
|
-
const C = y.length, k = g.clientHeight,
|
|
1883
|
-
if (p.style.height = `${C * o}px`,
|
|
1884
|
-
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x,
|
|
1885
|
-
w.appendChild(v(x,
|
|
1899
|
+
const C = y.length, k = g.clientHeight, T = g.scrollTop;
|
|
1900
|
+
if (p.style.height = `${C * o}px`, gt(C, q.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1901
|
+
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x, L) => {
|
|
1902
|
+
w.appendChild(v(x, L));
|
|
1886
1903
|
});
|
|
1887
1904
|
return;
|
|
1888
1905
|
}
|
|
1889
|
-
const m =
|
|
1906
|
+
const m = pt({
|
|
1890
1907
|
totalRows: C,
|
|
1891
1908
|
viewportHeight: k,
|
|
1892
|
-
scrollTop:
|
|
1909
|
+
scrollTop: T,
|
|
1893
1910
|
rowHeight: o,
|
|
1894
1911
|
overscan: q.LIST_OVERSCAN
|
|
1895
1912
|
});
|
|
@@ -1897,10 +1914,10 @@ class q extends _ {
|
|
|
1897
1914
|
for (let x = m.start; x < m.end; x++)
|
|
1898
1915
|
w.appendChild(v(y[x], x - m.start));
|
|
1899
1916
|
}, R = (C) => {
|
|
1900
|
-
const k = this.config.caseSensitive ?? !1,
|
|
1917
|
+
const k = this.config.caseSensitive ?? !1, T = k ? C : C.toLowerCase();
|
|
1901
1918
|
if (y = i.filter((m) => {
|
|
1902
|
-
const x = m == null ? "(Blank)" : String(m),
|
|
1903
|
-
return !C ||
|
|
1919
|
+
const x = m == null ? "(Blank)" : String(m), L = k ? x : x.toLowerCase();
|
|
1920
|
+
return !C || L.includes(T);
|
|
1904
1921
|
}), y.length === 0) {
|
|
1905
1922
|
p.style.height = "0px", w.innerHTML = "";
|
|
1906
1923
|
const m = document.createElement("div");
|
|
@@ -1927,8 +1944,8 @@ class q extends _ {
|
|
|
1927
1944
|
const P = document.createElement("button");
|
|
1928
1945
|
P.className = "tbw-filter-apply-btn", P.textContent = "Apply", P.addEventListener("click", () => {
|
|
1929
1946
|
const C = [];
|
|
1930
|
-
for (const [k,
|
|
1931
|
-
if (!
|
|
1947
|
+
for (const [k, T] of b)
|
|
1948
|
+
if (!T)
|
|
1932
1949
|
if (k === "__null__")
|
|
1933
1950
|
C.push(null);
|
|
1934
1951
|
else {
|
|
@@ -1973,40 +1990,40 @@ class q extends _ {
|
|
|
1973
1990
|
C.className = "tbw-filter-range-slider";
|
|
1974
1991
|
const k = document.createElement("div");
|
|
1975
1992
|
k.className = "tbw-filter-range-track";
|
|
1976
|
-
const
|
|
1977
|
-
|
|
1993
|
+
const T = document.createElement("div");
|
|
1994
|
+
T.className = "tbw-filter-range-fill";
|
|
1978
1995
|
const m = document.createElement("input");
|
|
1979
1996
|
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(f), m.step = String(g), m.value = String(w);
|
|
1980
1997
|
const x = document.createElement("input");
|
|
1981
|
-
x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(
|
|
1982
|
-
const
|
|
1983
|
-
const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100,
|
|
1984
|
-
|
|
1998
|
+
x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(T), C.appendChild(m), C.appendChild(x), e.appendChild(C);
|
|
1999
|
+
const L = () => {
|
|
2000
|
+
const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100, ht = (z - h) / j * 100;
|
|
2001
|
+
T.style.left = `${ve}%`, T.style.width = `${ht - ve}%`;
|
|
1985
2002
|
};
|
|
1986
2003
|
m.addEventListener("input", () => {
|
|
1987
2004
|
const A = Math.min(parseFloat(m.value), parseFloat(x.value));
|
|
1988
|
-
m.value = String(A), R.value = String(A),
|
|
2005
|
+
m.value = String(A), R.value = String(A), L();
|
|
1989
2006
|
}), x.addEventListener("input", () => {
|
|
1990
2007
|
const A = Math.max(parseFloat(x.value), parseFloat(m.value));
|
|
1991
|
-
x.value = String(A), S.value = String(A),
|
|
2008
|
+
x.value = String(A), S.value = String(A), L();
|
|
1992
2009
|
}), R.addEventListener("input", () => {
|
|
1993
2010
|
let A = parseFloat(R.value) || h;
|
|
1994
|
-
A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A),
|
|
2011
|
+
A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), L();
|
|
1995
2012
|
}), S.addEventListener("input", () => {
|
|
1996
2013
|
let A = parseFloat(S.value) || f;
|
|
1997
|
-
A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A),
|
|
1998
|
-
}),
|
|
1999
|
-
const
|
|
2000
|
-
|
|
2014
|
+
A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A), L();
|
|
2015
|
+
}), L();
|
|
2016
|
+
const H = document.createElement("div");
|
|
2017
|
+
H.className = "tbw-filter-buttons";
|
|
2001
2018
|
const X = document.createElement("button");
|
|
2002
2019
|
X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
|
|
2003
2020
|
const A = parseFloat(R.value), z = parseFloat(S.value);
|
|
2004
2021
|
t.applyTextFilter("between", A, z);
|
|
2005
|
-
}),
|
|
2022
|
+
}), H.appendChild(X);
|
|
2006
2023
|
const Z = document.createElement("button");
|
|
2007
2024
|
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
2008
2025
|
t.clearFilter();
|
|
2009
|
-
}),
|
|
2026
|
+
}), H.appendChild(Z), e.appendChild(H);
|
|
2010
2027
|
}
|
|
2011
2028
|
renderDateFilterPanel(e, t, i) {
|
|
2012
2029
|
const { field: n, column: r } = t, o = r.filterParams, s = 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)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
@@ -2035,10 +2052,10 @@ class q extends _ {
|
|
|
2035
2052
|
const m = R.value, x = S.value;
|
|
2036
2053
|
m && x ? t.applyTextFilter("between", m, x) : m ? t.applyTextFilter("greaterThanOrEqual", m) : x ? t.applyTextFilter("lessThanOrEqual", x) : t.clearFilter();
|
|
2037
2054
|
}), C.appendChild(k);
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2055
|
+
const T = document.createElement("button");
|
|
2056
|
+
T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
|
|
2040
2057
|
t.clearFilter();
|
|
2041
|
-
}), C.appendChild(
|
|
2058
|
+
}), C.appendChild(T), e.appendChild(C);
|
|
2042
2059
|
}
|
|
2043
2060
|
applySetFilter(e, t) {
|
|
2044
2061
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -2104,7 +2121,7 @@ class q extends _ {
|
|
|
2104
2121
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
2105
2122
|
}
|
|
2106
2123
|
}
|
|
2107
|
-
function
|
|
2124
|
+
function Pe(a) {
|
|
2108
2125
|
if (!a.length) return [];
|
|
2109
2126
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, s) => {
|
|
2110
2127
|
if (!s.length) return;
|
|
@@ -2171,7 +2188,7 @@ function Xt(a) {
|
|
|
2171
2188
|
return a.some((e) => e.group != null);
|
|
2172
2189
|
}
|
|
2173
2190
|
const Zt = "@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)}}";
|
|
2174
|
-
class
|
|
2191
|
+
class yn extends _ {
|
|
2175
2192
|
static manifest = {
|
|
2176
2193
|
ownedProperties: [
|
|
2177
2194
|
{
|
|
@@ -2196,8 +2213,9 @@ class vn extends _ {
|
|
|
2196
2213
|
}
|
|
2197
2214
|
groups = [];
|
|
2198
2215
|
isActive = !1;
|
|
2216
|
+
#i = /* @__PURE__ */ new Set();
|
|
2199
2217
|
detach() {
|
|
2200
|
-
this.groups = [], this.isActive = !1;
|
|
2218
|
+
this.groups = [], this.isActive = !1, this.#i.clear();
|
|
2201
2219
|
}
|
|
2202
2220
|
static detect(e, t) {
|
|
2203
2221
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
@@ -2219,8 +2237,15 @@ class vn extends _ {
|
|
|
2219
2237
|
});
|
|
2220
2238
|
} else
|
|
2221
2239
|
i = [...e];
|
|
2222
|
-
const n =
|
|
2223
|
-
|
|
2240
|
+
const n = Pe(i);
|
|
2241
|
+
if (n.length === 0)
|
|
2242
|
+
return this.isActive = !1, this.groups = [], i;
|
|
2243
|
+
this.isActive = !0, this.groups = n, this.#i.clear();
|
|
2244
|
+
for (const r of n) {
|
|
2245
|
+
const o = r.columns[r.columns.length - 1];
|
|
2246
|
+
o?.field && this.#i.add(o.field);
|
|
2247
|
+
}
|
|
2248
|
+
return i;
|
|
2224
2249
|
}
|
|
2225
2250
|
afterRender() {
|
|
2226
2251
|
if (!this.isActive) {
|
|
@@ -2232,7 +2257,7 @@ class vn extends _ {
|
|
|
2232
2257
|
if (!e) return;
|
|
2233
2258
|
const t = e.querySelector(".header-group-row");
|
|
2234
2259
|
t && t.remove();
|
|
2235
|
-
const i = this.columns, n =
|
|
2260
|
+
const i = this.columns, n = Pe(i);
|
|
2236
2261
|
if (n.length === 0) return;
|
|
2237
2262
|
const r = Yt(n, i);
|
|
2238
2263
|
if (r) {
|
|
@@ -2241,22 +2266,10 @@ class vn extends _ {
|
|
|
2241
2266
|
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2242
2267
|
}
|
|
2243
2268
|
const o = e.querySelector(".header-row");
|
|
2244
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n))
|
|
2269
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n));
|
|
2245
2270
|
}
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
const t = this.gridElement;
|
|
2249
|
-
if (!t) return;
|
|
2250
|
-
const i = /* @__PURE__ */ new Set();
|
|
2251
|
-
for (const r of e) {
|
|
2252
|
-
const o = r.columns[r.columns.length - 1];
|
|
2253
|
-
o?.field && i.add(o.field);
|
|
2254
|
-
}
|
|
2255
|
-
const n = t.querySelectorAll(".rows .cell[data-field]");
|
|
2256
|
-
for (const r of n) {
|
|
2257
|
-
const o = r.getAttribute("data-field");
|
|
2258
|
-
o && i.has(o) ? r.classList.add("group-end") : r.classList.remove("group-end");
|
|
2259
|
-
}
|
|
2271
|
+
afterCellRender(e) {
|
|
2272
|
+
!this.isActive || !this.config.showGroupBorders || e.cellElement.classList.toggle("group-end", this.#i.has(e.column.field));
|
|
2260
2273
|
}
|
|
2261
2274
|
isGroupingActive() {
|
|
2262
2275
|
return this.isActive;
|
|
@@ -2272,7 +2285,7 @@ class vn extends _ {
|
|
|
2272
2285
|
this.requestRender();
|
|
2273
2286
|
}
|
|
2274
2287
|
}
|
|
2275
|
-
function
|
|
2288
|
+
function De({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
2276
2289
|
const n = e.groupOn;
|
|
2277
2290
|
if (typeof n != "function")
|
|
2278
2291
|
return [];
|
|
@@ -2336,7 +2349,7 @@ function ni(a) {
|
|
|
2336
2349
|
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2337
2350
|
}
|
|
2338
2351
|
const ri = "@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}}}";
|
|
2339
|
-
class
|
|
2352
|
+
class xn extends _ {
|
|
2340
2353
|
static manifest = {
|
|
2341
2354
|
events: [
|
|
2342
2355
|
{
|
|
@@ -2401,7 +2414,7 @@ class yn extends _ {
|
|
|
2401
2414
|
const t = this.config;
|
|
2402
2415
|
if (typeof t.groupOn != "function")
|
|
2403
2416
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2404
|
-
const i =
|
|
2417
|
+
const i = De({
|
|
2405
2418
|
rows: [...e],
|
|
2406
2419
|
config: t,
|
|
2407
2420
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -2413,7 +2426,7 @@ class yn extends _ {
|
|
|
2413
2426
|
const s = ii(i);
|
|
2414
2427
|
n = ti(t.defaultExpanded ?? !1, s), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2415
2428
|
}
|
|
2416
|
-
const r =
|
|
2429
|
+
const r = De({
|
|
2417
2430
|
rows: [...e],
|
|
2418
2431
|
config: t,
|
|
2419
2432
|
expanded: this.expandedKeys,
|
|
@@ -2506,7 +2519,7 @@ class yn extends _ {
|
|
|
2506
2519
|
const c = document.createElement("span");
|
|
2507
2520
|
c.className = "group-aggregates";
|
|
2508
2521
|
for (const [u, h] of d) {
|
|
2509
|
-
const f = this.columns.find((p) => p.field === u), g =
|
|
2522
|
+
const f = this.columns.find((p) => p.field === u), g = ie(h, o, u, f);
|
|
2510
2523
|
if (g != null) {
|
|
2511
2524
|
const p = document.createElement("span");
|
|
2512
2525
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
@@ -2524,14 +2537,14 @@ class yn extends _ {
|
|
|
2524
2537
|
let c = !1;
|
|
2525
2538
|
o.forEach((u, h) => {
|
|
2526
2539
|
const f = document.createElement("div");
|
|
2527
|
-
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"),
|
|
2540
|
+
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), te(u)) {
|
|
2528
2541
|
f.setAttribute("data-field", u.field), t.appendChild(f);
|
|
2529
2542
|
return;
|
|
2530
2543
|
}
|
|
2531
2544
|
if (c) {
|
|
2532
2545
|
const g = r[u.field];
|
|
2533
2546
|
if (g) {
|
|
2534
|
-
const p =
|
|
2547
|
+
const p = ie(g, s, u.field, u);
|
|
2535
2548
|
f.textContent = p != null ? String(p) : "";
|
|
2536
2549
|
} else
|
|
2537
2550
|
f.textContent = "";
|
|
@@ -2539,7 +2552,7 @@ class yn extends _ {
|
|
|
2539
2552
|
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2540
2553
|
const g = document.createElement("span"), p = r[u.field];
|
|
2541
2554
|
if (p) {
|
|
2542
|
-
const w =
|
|
2555
|
+
const w = ie(p, s, u.field, u);
|
|
2543
2556
|
g.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2544
2557
|
} else
|
|
2545
2558
|
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
@@ -2620,7 +2633,7 @@ class yn extends _ {
|
|
|
2620
2633
|
this.config.groupOn = e, this.requestRender();
|
|
2621
2634
|
}
|
|
2622
2635
|
}
|
|
2623
|
-
function
|
|
2636
|
+
function Me(a, e) {
|
|
2624
2637
|
const t = new Set(a);
|
|
2625
2638
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2626
2639
|
}
|
|
@@ -2644,7 +2657,7 @@ function li(a, e, t, i) {
|
|
|
2644
2657
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2645
2658
|
}
|
|
2646
2659
|
const di = "@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}}}";
|
|
2647
|
-
class
|
|
2660
|
+
class rt extends _ {
|
|
2648
2661
|
name = "masterDetail";
|
|
2649
2662
|
styles = di;
|
|
2650
2663
|
get defaultConfig() {
|
|
@@ -2675,21 +2688,21 @@ class nt extends _ {
|
|
|
2675
2688
|
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), s !== null && (d.collapseOnClickOutside = s === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
|
|
2676
2689
|
const c = t.innerHTML.trim();
|
|
2677
2690
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2678
|
-
const f =
|
|
2679
|
-
return
|
|
2691
|
+
const f = et(c, { value: u, row: u });
|
|
2692
|
+
return tt(f);
|
|
2680
2693
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2681
2694
|
}
|
|
2682
2695
|
get animationStyle() {
|
|
2683
2696
|
return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
|
|
2684
2697
|
}
|
|
2685
|
-
animateExpand(e) {
|
|
2686
|
-
!this.isAnimationEnabled || this.animationStyle === !1
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
));
|
|
2698
|
+
animateExpand(e, t, i) {
|
|
2699
|
+
if (!this.isAnimationEnabled || this.animationStyle === !1) return !1;
|
|
2700
|
+
e.classList.add("tbw-expanding");
|
|
2701
|
+
let n = !1;
|
|
2702
|
+
const r = () => {
|
|
2703
|
+
n || (n = !0, e.classList.remove("tbw-expanding"), t !== void 0 && i !== void 0 && this.#i(e, t, i));
|
|
2704
|
+
};
|
|
2705
|
+
return e.addEventListener("animationend", r, { once: !0 }), setTimeout(r, this.animationDuration + 50), !0;
|
|
2693
2706
|
}
|
|
2694
2707
|
animateCollapse(e, t) {
|
|
2695
2708
|
if (!this.isAnimationEnabled || this.animationStyle === !1) {
|
|
@@ -2702,29 +2715,40 @@ class nt extends _ {
|
|
|
2702
2715
|
};
|
|
2703
2716
|
e.addEventListener("animationend", i, { once: !0 }), setTimeout(i, this.animationDuration + 50);
|
|
2704
2717
|
}
|
|
2718
|
+
#i(e, t, i) {
|
|
2719
|
+
if (!e.isConnected) return;
|
|
2720
|
+
const n = e.offsetHeight;
|
|
2721
|
+
if (n > 0) {
|
|
2722
|
+
const r = this.measuredDetailHeights.get(t);
|
|
2723
|
+
this.measuredDetailHeights.set(t, n), r !== n && this.grid.invalidateRowHeight(i);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2705
2726
|
expandedRows = /* @__PURE__ */ new Set();
|
|
2706
2727
|
detailElements = /* @__PURE__ */ new Map();
|
|
2707
2728
|
measuredDetailHeights = /* @__PURE__ */ new Map();
|
|
2729
|
+
rowsToAnimate = /* @__PURE__ */ new Set();
|
|
2708
2730
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2709
2731
|
getDetailHeight(e) {
|
|
2710
2732
|
const t = this.detailElements.get(e);
|
|
2711
|
-
if (t) {
|
|
2712
|
-
const
|
|
2713
|
-
if (
|
|
2714
|
-
return this.measuredDetailHeights.set(e,
|
|
2733
|
+
if (t && !(t.classList.contains("tbw-expanding") || t.classList.contains("tbw-collapsing"))) {
|
|
2734
|
+
const r = t.offsetHeight;
|
|
2735
|
+
if (r > 0)
|
|
2736
|
+
return this.measuredDetailHeights.set(e, r), r;
|
|
2715
2737
|
}
|
|
2716
2738
|
const i = this.measuredDetailHeights.get(e);
|
|
2717
|
-
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2739
|
+
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : rt.DEFAULT_DETAIL_HEIGHT;
|
|
2718
2740
|
}
|
|
2719
2741
|
toggleAndEmit(e, t) {
|
|
2720
|
-
this.expandedRows =
|
|
2742
|
+
this.expandedRows = Me(this.expandedRows, e);
|
|
2743
|
+
const i = this.expandedRows.has(e);
|
|
2744
|
+
i && this.rowsToAnimate.add(e), this.emit("detail-expand", {
|
|
2721
2745
|
rowIndex: t,
|
|
2722
2746
|
row: e,
|
|
2723
|
-
expanded:
|
|
2747
|
+
expanded: i
|
|
2724
2748
|
}), this.requestRender();
|
|
2725
2749
|
}
|
|
2726
2750
|
detach() {
|
|
2727
|
-
this.expandedRows.clear(), this.detailElements.clear(), this.measuredDetailHeights.clear();
|
|
2751
|
+
this.expandedRows.clear(), this.detailElements.clear(), this.measuredDetailHeights.clear(), this.rowsToAnimate.clear();
|
|
2728
2752
|
}
|
|
2729
2753
|
processColumns(e) {
|
|
2730
2754
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
@@ -2747,54 +2771,58 @@ class nt extends _ {
|
|
|
2747
2771
|
onCellClick(e) {
|
|
2748
2772
|
if (e.originalEvent?.target?.classList.contains("master-detail-toggle"))
|
|
2749
2773
|
return this.toggleAndEmit(e.row, e.rowIndex), !0;
|
|
2750
|
-
this.expandedRows.size > 0 && queueMicrotask(() => this.#
|
|
2774
|
+
this.expandedRows.size > 0 && queueMicrotask(() => this.#e());
|
|
2751
2775
|
}
|
|
2752
2776
|
onKeyDown(e) {
|
|
2753
2777
|
if (e.key !== " ") return;
|
|
2754
2778
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2755
|
-
if (!n || !
|
|
2779
|
+
if (!n || !te(n)) return;
|
|
2756
2780
|
const r = this.rows[i];
|
|
2757
2781
|
if (r)
|
|
2758
2782
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
2759
2783
|
}
|
|
2760
2784
|
afterRender() {
|
|
2761
|
-
this.#
|
|
2785
|
+
this.#e();
|
|
2762
2786
|
}
|
|
2763
2787
|
onScrollRender() {
|
|
2764
|
-
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#
|
|
2788
|
+
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#e();
|
|
2765
2789
|
}
|
|
2766
|
-
#
|
|
2790
|
+
#e() {
|
|
2767
2791
|
if (!this.config.detailRenderer) return;
|
|
2768
2792
|
const e = this.gridElement?.querySelector(".rows");
|
|
2769
2793
|
if (!e) return;
|
|
2770
|
-
const t =
|
|
2771
|
-
|
|
2772
|
-
const
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2794
|
+
const t = this.grid, i = t._rowPool, n = t._virtualization?.start ?? 0, r = t._virtualization?.end ?? 0, o = this.columns.length, s = n, l = r, d = /* @__PURE__ */ new Map();
|
|
2795
|
+
if (i) {
|
|
2796
|
+
const c = Math.min(i.length, l - s);
|
|
2797
|
+
for (let u = 0; u < c; u++) {
|
|
2798
|
+
const h = i[u];
|
|
2799
|
+
h.parentNode === e && d.set(s + u, h);
|
|
2800
|
+
}
|
|
2801
|
+
} else {
|
|
2802
|
+
const c = e.querySelectorAll(".data-grid-row");
|
|
2803
|
+
for (const u of c) {
|
|
2804
|
+
const h = u.querySelector(".cell[data-row]"), f = h ? parseInt(h.getAttribute("data-row") ?? "-1", 10) : -1;
|
|
2805
|
+
f >= 0 && d.set(f, u);
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
for (const [c, u] of this.detailElements) {
|
|
2809
|
+
const h = this.rows.indexOf(c), f = this.expandedRows.has(c), g = h >= 0 && d.has(h);
|
|
2810
|
+
(!f || !g) && (u.parentNode && u.remove(), this.detailElements.delete(c));
|
|
2811
|
+
}
|
|
2812
|
+
for (const [c, u] of d) {
|
|
2813
|
+
const h = this.rows[c];
|
|
2814
|
+
if (!h || !this.expandedRows.has(h)) continue;
|
|
2815
|
+
const f = this.detailElements.get(h);
|
|
2816
|
+
if (f) {
|
|
2817
|
+
f.previousElementSibling !== u && u.after(f);
|
|
2786
2818
|
continue;
|
|
2787
2819
|
}
|
|
2788
|
-
const
|
|
2789
|
-
typeof this.config.detailHeight == "number" && (
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
this.measuredDetailHeights.set(l, u), h !== u && this.grid.invalidateRowHeight(o);
|
|
2795
|
-
}
|
|
2796
|
-
}
|
|
2797
|
-
}), this.animateExpand(c);
|
|
2820
|
+
const g = li(h, c, this.config.detailRenderer, o);
|
|
2821
|
+
typeof this.config.detailHeight == "number" && (g.style.height = `${this.config.detailHeight}px`), u.after(g), this.detailElements.set(h, g);
|
|
2822
|
+
const p = this.rowsToAnimate.has(h);
|
|
2823
|
+
p && this.rowsToAnimate.delete(h), p && this.animateExpand(g, h, c) || requestAnimationFrame(() => {
|
|
2824
|
+
this.#i(g, h, c);
|
|
2825
|
+
});
|
|
2798
2826
|
}
|
|
2799
2827
|
}
|
|
2800
2828
|
getExtraHeight() {
|
|
@@ -2819,22 +2847,32 @@ class nt extends _ {
|
|
|
2819
2847
|
}
|
|
2820
2848
|
adjustVirtualStart(e, t, i) {
|
|
2821
2849
|
if (this.expandedRows.size === 0) return e;
|
|
2822
|
-
const n =
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
o
|
|
2850
|
+
const n = this.grid?._virtualization?.positionCache;
|
|
2851
|
+
let r = e;
|
|
2852
|
+
if (n && n.length > 0)
|
|
2853
|
+
for (const o of this.expandedRows) {
|
|
2854
|
+
const s = this.rows.indexOf(o);
|
|
2855
|
+
if (s < 0 || s >= e) continue;
|
|
2856
|
+
n[s].offset + n[s].height > t && s < r && (r = s);
|
|
2857
|
+
}
|
|
2858
|
+
else {
|
|
2859
|
+
const o = [];
|
|
2860
|
+
for (const l of this.expandedRows) {
|
|
2861
|
+
const d = this.rows.indexOf(l);
|
|
2862
|
+
d >= 0 && o.push({ index: d, row: l });
|
|
2863
|
+
}
|
|
2864
|
+
o.sort((l, d) => l.index - d.index);
|
|
2865
|
+
let s = 0;
|
|
2866
|
+
for (const { index: l, row: d } of o) {
|
|
2867
|
+
const c = l * i + s, u = this.getDetailHeight(d), h = c + i + u;
|
|
2868
|
+
s += u, !(l >= e) && h > t && l < r && (r = l);
|
|
2869
|
+
}
|
|
2832
2870
|
}
|
|
2833
2871
|
return r;
|
|
2834
2872
|
}
|
|
2835
2873
|
expand(e) {
|
|
2836
2874
|
const t = this.rows[e];
|
|
2837
|
-
t && (this.expandedRows = oi(this.expandedRows, t), this.requestRender());
|
|
2875
|
+
t && (this.rowsToAnimate.add(t), this.expandedRows = oi(this.expandedRows, t), this.requestRender());
|
|
2838
2876
|
}
|
|
2839
2877
|
collapse(e) {
|
|
2840
2878
|
const t = this.rows[e];
|
|
@@ -2842,7 +2880,7 @@ class nt extends _ {
|
|
|
2842
2880
|
}
|
|
2843
2881
|
toggle(e) {
|
|
2844
2882
|
const t = this.rows[e];
|
|
2845
|
-
t && (this.expandedRows =
|
|
2883
|
+
t && (this.expandedRows = Me(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
|
|
2846
2884
|
}
|
|
2847
2885
|
isExpanded(e) {
|
|
2848
2886
|
const t = this.rows[e];
|
|
@@ -2850,7 +2888,7 @@ class nt extends _ {
|
|
|
2850
2888
|
}
|
|
2851
2889
|
expandAll() {
|
|
2852
2890
|
for (const e of this.rows)
|
|
2853
|
-
this.expandedRows.add(e);
|
|
2891
|
+
this.rowsToAnimate.add(e), this.expandedRows.add(e);
|
|
2854
2892
|
this.requestRender();
|
|
2855
2893
|
}
|
|
2856
2894
|
collapseAll() {
|
|
@@ -2893,15 +2931,15 @@ function hi(a, e, t, i) {
|
|
|
2893
2931
|
const n = a.find((r) => r.field === e);
|
|
2894
2932
|
return t ? n ? n.direction === "asc" ? a.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : a.filter((r) => r.field !== e) : a.length < i ? [...a, { field: e, direction: "asc" }] : a : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
|
|
2895
2933
|
}
|
|
2896
|
-
function
|
|
2934
|
+
function Ne(a, e) {
|
|
2897
2935
|
const t = a.findIndex((i) => i.field === e);
|
|
2898
2936
|
return t >= 0 ? t + 1 : void 0;
|
|
2899
2937
|
}
|
|
2900
|
-
function
|
|
2938
|
+
function qe(a, e) {
|
|
2901
2939
|
return a.find((t) => t.field === e)?.direction;
|
|
2902
2940
|
}
|
|
2903
2941
|
const fi = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2904
|
-
class
|
|
2942
|
+
class Cn extends _ {
|
|
2905
2943
|
name = "multiSort";
|
|
2906
2944
|
styles = fi;
|
|
2907
2945
|
get defaultConfig() {
|
|
@@ -2929,7 +2967,7 @@ class xn extends _ {
|
|
|
2929
2967
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2930
2968
|
const r = n.getAttribute("data-field");
|
|
2931
2969
|
if (!r) return;
|
|
2932
|
-
const o =
|
|
2970
|
+
const o = Ne(this.sortModel, r), s = qe(this.sortModel, r);
|
|
2933
2971
|
if (n.querySelector(".sort-index")?.remove(), s) {
|
|
2934
2972
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
|
|
2935
2973
|
const c = document.createElement("span");
|
|
@@ -2953,10 +2991,10 @@ class xn extends _ {
|
|
|
2953
2991
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2954
2992
|
}
|
|
2955
2993
|
getSortIndex(e) {
|
|
2956
|
-
return
|
|
2994
|
+
return Ne(this.sortModel, e);
|
|
2957
2995
|
}
|
|
2958
2996
|
getSortDirection(e) {
|
|
2959
|
-
return
|
|
2997
|
+
return qe(this.sortModel, e);
|
|
2960
2998
|
}
|
|
2961
2999
|
getColumnState(e) {
|
|
2962
3000
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2979,38 +3017,38 @@ class xn extends _ {
|
|
|
2979
3017
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2980
3018
|
}
|
|
2981
3019
|
}
|
|
2982
|
-
function rt(a, e) {
|
|
2983
|
-
return pt(a, e);
|
|
2984
|
-
}
|
|
2985
3020
|
function ot(a, e) {
|
|
2986
|
-
|
|
2987
|
-
return t ? rt(t, e) === "left" : !1;
|
|
3021
|
+
return mt(a, e);
|
|
2988
3022
|
}
|
|
2989
3023
|
function st(a, e) {
|
|
2990
3024
|
const t = a.sticky;
|
|
2991
|
-
return t ?
|
|
3025
|
+
return t ? ot(t, e) === "left" : !1;
|
|
3026
|
+
}
|
|
3027
|
+
function at(a, e) {
|
|
3028
|
+
const t = a.sticky;
|
|
3029
|
+
return t ? ot(t, e) === "right" : !1;
|
|
2992
3030
|
}
|
|
2993
3031
|
function gi(a, e = "ltr") {
|
|
2994
|
-
return a.filter((t) =>
|
|
3032
|
+
return a.filter((t) => st(t, e));
|
|
2995
3033
|
}
|
|
2996
3034
|
function pi(a, e = "ltr") {
|
|
2997
|
-
return a.filter((t) =>
|
|
3035
|
+
return a.filter((t) => at(t, e));
|
|
2998
3036
|
}
|
|
2999
|
-
function
|
|
3037
|
+
function ae(a) {
|
|
3000
3038
|
return a.some(
|
|
3001
3039
|
(e) => e.sticky === "left" || e.sticky === "right" || e.sticky === "start" || e.sticky === "end"
|
|
3002
3040
|
);
|
|
3003
3041
|
}
|
|
3004
|
-
function
|
|
3042
|
+
function He(a, e) {
|
|
3005
3043
|
const t = Array.from(a.querySelectorAll(".header-row .cell"));
|
|
3006
3044
|
if (!t.length) return;
|
|
3007
|
-
const i =
|
|
3045
|
+
const i = he(a), n = /* @__PURE__ */ new Map();
|
|
3008
3046
|
e.forEach((s, l) => {
|
|
3009
3047
|
s.field && n.set(s.field, l);
|
|
3010
3048
|
});
|
|
3011
3049
|
let r = 0;
|
|
3012
3050
|
for (const s of e)
|
|
3013
|
-
if (
|
|
3051
|
+
if (st(s, i)) {
|
|
3014
3052
|
const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
|
|
3015
3053
|
d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 && a.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
|
|
3016
3054
|
c.classList.add("sticky-left"), c.style.position = "sticky", c.style.left = r + "px";
|
|
@@ -3018,20 +3056,20 @@ function qe(a, e) {
|
|
|
3018
3056
|
}
|
|
3019
3057
|
let o = 0;
|
|
3020
3058
|
for (const s of [...e].reverse())
|
|
3021
|
-
if (
|
|
3059
|
+
if (at(s, i)) {
|
|
3022
3060
|
const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
|
|
3023
3061
|
d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 && a.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
|
|
3024
3062
|
c.classList.add("sticky-right"), c.style.position = "sticky", c.style.right = o + "px";
|
|
3025
3063
|
}), o += d.offsetWidth);
|
|
3026
3064
|
}
|
|
3027
3065
|
}
|
|
3028
|
-
function
|
|
3066
|
+
function Ke(a) {
|
|
3029
3067
|
a.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
3030
3068
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
3031
3069
|
});
|
|
3032
3070
|
}
|
|
3033
|
-
const
|
|
3034
|
-
class
|
|
3071
|
+
const ze = "canMoveColumn";
|
|
3072
|
+
class En extends _ {
|
|
3035
3073
|
static manifest = {
|
|
3036
3074
|
ownedProperties: [
|
|
3037
3075
|
{
|
|
@@ -3043,7 +3081,7 @@ class Cn extends _ {
|
|
|
3043
3081
|
],
|
|
3044
3082
|
queries: [
|
|
3045
3083
|
{
|
|
3046
|
-
type:
|
|
3084
|
+
type: ze,
|
|
3047
3085
|
description: "Prevents pinned (sticky) columns from being moved/reordered"
|
|
3048
3086
|
},
|
|
3049
3087
|
{
|
|
@@ -3064,26 +3102,26 @@ class Cn extends _ {
|
|
|
3064
3102
|
}
|
|
3065
3103
|
static detect(e, t) {
|
|
3066
3104
|
const i = t?.columns;
|
|
3067
|
-
return Array.isArray(i) ?
|
|
3105
|
+
return Array.isArray(i) ? ae(i) : !1;
|
|
3068
3106
|
}
|
|
3069
3107
|
processColumns(e) {
|
|
3070
|
-
return this.isApplied =
|
|
3108
|
+
return this.isApplied = ae([...e]), [...e];
|
|
3071
3109
|
}
|
|
3072
3110
|
afterRender() {
|
|
3073
3111
|
if (!this.isApplied)
|
|
3074
3112
|
return;
|
|
3075
3113
|
const e = this.grid, t = [...this.columns];
|
|
3076
|
-
if (!
|
|
3077
|
-
|
|
3114
|
+
if (!ae(t)) {
|
|
3115
|
+
Ke(e), this.isApplied = !1;
|
|
3078
3116
|
return;
|
|
3079
3117
|
}
|
|
3080
3118
|
queueMicrotask(() => {
|
|
3081
|
-
|
|
3119
|
+
He(e, t);
|
|
3082
3120
|
});
|
|
3083
3121
|
}
|
|
3084
3122
|
handleQuery(e) {
|
|
3085
3123
|
switch (e.type) {
|
|
3086
|
-
case
|
|
3124
|
+
case ze: {
|
|
3087
3125
|
const t = e.context, i = t.sticky;
|
|
3088
3126
|
if (i === "left" || i === "right" || i === "start" || i === "end")
|
|
3089
3127
|
return !1;
|
|
@@ -3101,18 +3139,18 @@ class Cn extends _ {
|
|
|
3101
3139
|
}
|
|
3102
3140
|
refreshStickyOffsets() {
|
|
3103
3141
|
const e = [...this.columns];
|
|
3104
|
-
|
|
3142
|
+
He(this.grid, e);
|
|
3105
3143
|
}
|
|
3106
3144
|
getLeftPinnedColumns() {
|
|
3107
|
-
const e = [...this.columns], t =
|
|
3145
|
+
const e = [...this.columns], t = he(this.grid);
|
|
3108
3146
|
return gi(e, t);
|
|
3109
3147
|
}
|
|
3110
3148
|
getRightPinnedColumns() {
|
|
3111
|
-
const e = [...this.columns], t =
|
|
3149
|
+
const e = [...this.columns], t = he(this.grid);
|
|
3112
3150
|
return pi(e, t);
|
|
3113
3151
|
}
|
|
3114
3152
|
clearStickyPositions() {
|
|
3115
|
-
|
|
3153
|
+
Ke(this.grid);
|
|
3116
3154
|
}
|
|
3117
3155
|
getHorizontalScrollOffsets(e, t) {
|
|
3118
3156
|
if (!this.isApplied)
|
|
@@ -3136,7 +3174,7 @@ class Cn extends _ {
|
|
|
3136
3174
|
function mi(a) {
|
|
3137
3175
|
return typeof a == "object" && a !== null && "aggFunc" in a;
|
|
3138
3176
|
}
|
|
3139
|
-
function
|
|
3177
|
+
function le(a, e) {
|
|
3140
3178
|
const t = document.createElement("div");
|
|
3141
3179
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
3142
3180
|
const i = document.createElement("div");
|
|
@@ -3173,11 +3211,11 @@ function ae(a, e) {
|
|
|
3173
3211
|
}
|
|
3174
3212
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
3175
3213
|
}
|
|
3176
|
-
function
|
|
3214
|
+
function Oe(a) {
|
|
3177
3215
|
const e = document.createElement("div");
|
|
3178
3216
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${a}`, e.setAttribute("role", "presentation"), e;
|
|
3179
3217
|
}
|
|
3180
|
-
function
|
|
3218
|
+
function Ge(a, e, t, i) {
|
|
3181
3219
|
a.innerHTML = "";
|
|
3182
3220
|
for (const n of e) {
|
|
3183
3221
|
const r = document.createElement("div");
|
|
@@ -3213,7 +3251,7 @@ function wi(a, e) {
|
|
|
3213
3251
|
const i = a.render(e);
|
|
3214
3252
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
3215
3253
|
}
|
|
3216
|
-
function
|
|
3254
|
+
function Be(a, e, t, i, n) {
|
|
3217
3255
|
return {
|
|
3218
3256
|
totalRows: a.length,
|
|
3219
3257
|
filteredRows: n?.cachedResult?.length ?? a.length,
|
|
@@ -3224,7 +3262,7 @@ function Ge(a, e, t, i, n) {
|
|
|
3224
3262
|
};
|
|
3225
3263
|
}
|
|
3226
3264
|
const bi = "@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}}";
|
|
3227
|
-
class
|
|
3265
|
+
class Rn extends _ {
|
|
3228
3266
|
name = "pinnedRows";
|
|
3229
3267
|
styles = bi;
|
|
3230
3268
|
get defaultConfig() {
|
|
@@ -3248,7 +3286,7 @@ class En extends _ {
|
|
|
3248
3286
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
3249
3287
|
if (!t) return;
|
|
3250
3288
|
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);
|
|
3251
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
3289
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Be(
|
|
3252
3290
|
this.sourceRows,
|
|
3253
3291
|
this.columns,
|
|
3254
3292
|
this.grid,
|
|
@@ -3257,11 +3295,11 @@ class En extends _ {
|
|
|
3257
3295
|
), o = this.config.aggregationRows || [], s = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
3258
3296
|
if (s.length > 0) {
|
|
3259
3297
|
if (!this.topAggregationContainer) {
|
|
3260
|
-
this.topAggregationContainer =
|
|
3298
|
+
this.topAggregationContainer = Oe("top");
|
|
3261
3299
|
const h = e.querySelector(".header");
|
|
3262
3300
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
3263
3301
|
}
|
|
3264
|
-
|
|
3302
|
+
Ge(
|
|
3265
3303
|
this.topAggregationContainer,
|
|
3266
3304
|
s,
|
|
3267
3305
|
this.visibleColumns,
|
|
@@ -3271,18 +3309,18 @@ class En extends _ {
|
|
|
3271
3309
|
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;
|
|
3272
3310
|
if (d && this.config.position === "top")
|
|
3273
3311
|
if (!this.infoBarElement)
|
|
3274
|
-
this.infoBarElement =
|
|
3312
|
+
this.infoBarElement = le(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
3275
3313
|
else {
|
|
3276
|
-
const h =
|
|
3314
|
+
const h = le(this.config, r);
|
|
3277
3315
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
3278
3316
|
}
|
|
3279
3317
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
3280
|
-
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer =
|
|
3318
|
+
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Oe("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Ge(
|
|
3281
3319
|
this.bottomAggregationContainer,
|
|
3282
3320
|
l,
|
|
3283
3321
|
this.visibleColumns,
|
|
3284
3322
|
this.sourceRows
|
|
3285
|
-
)), c && (this.infoBarElement =
|
|
3323
|
+
)), c && (this.infoBarElement = le(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
3286
3324
|
}
|
|
3287
3325
|
cleanup() {
|
|
3288
3326
|
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);
|
|
@@ -3309,7 +3347,7 @@ class En extends _ {
|
|
|
3309
3347
|
}
|
|
3310
3348
|
getContext() {
|
|
3311
3349
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
3312
|
-
return
|
|
3350
|
+
return Be(
|
|
3313
3351
|
this.rows,
|
|
3314
3352
|
this.columns,
|
|
3315
3353
|
this.grid,
|
|
@@ -3330,7 +3368,7 @@ class En extends _ {
|
|
|
3330
3368
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3331
3369
|
}
|
|
3332
3370
|
}
|
|
3333
|
-
const vi =
|
|
3371
|
+
const vi = wt;
|
|
3334
3372
|
function yi(a) {
|
|
3335
3373
|
const e = [];
|
|
3336
3374
|
return !a.rowGroupFields?.length && !a.columnGroupFields?.length && e.push("At least one row or column group field is required"), a.valueFields?.length || e.push("At least one value field is required"), e;
|
|
@@ -3339,7 +3377,7 @@ function be(a, e) {
|
|
|
3339
3377
|
return [...a, e].join("|");
|
|
3340
3378
|
}
|
|
3341
3379
|
function xi(a, e) {
|
|
3342
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(a, i), o =
|
|
3380
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(a, i), o = lt(
|
|
3343
3381
|
a,
|
|
3344
3382
|
t,
|
|
3345
3383
|
i,
|
|
@@ -3372,10 +3410,10 @@ function Ei(a, e) {
|
|
|
3372
3410
|
}
|
|
3373
3411
|
return t;
|
|
3374
3412
|
}
|
|
3375
|
-
function
|
|
3413
|
+
function lt(a, e, t, i, n, r, o) {
|
|
3376
3414
|
const s = [];
|
|
3377
3415
|
if (e.length === 0) {
|
|
3378
|
-
const h =
|
|
3416
|
+
const h = Ve(a, t, i, n), f = We(h);
|
|
3379
3417
|
return s.push({
|
|
3380
3418
|
rowKey: o || "all",
|
|
3381
3419
|
rowLabel: o || "All",
|
|
@@ -3388,9 +3426,9 @@ function at(a, e, t, i, n, r, o) {
|
|
|
3388
3426
|
}
|
|
3389
3427
|
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
|
|
3390
3428
|
for (const [h, f] of u) {
|
|
3391
|
-
const g = o ? `${o}|${h}` : h, p =
|
|
3429
|
+
const g = o ? `${o}|${h}` : h, p = Ve(f, t, i, n), w = We(p);
|
|
3392
3430
|
let b;
|
|
3393
|
-
c && (b =
|
|
3431
|
+
c && (b = lt(
|
|
3394
3432
|
f,
|
|
3395
3433
|
d,
|
|
3396
3434
|
t,
|
|
@@ -3411,7 +3449,7 @@ function at(a, e, t, i, n, r, o) {
|
|
|
3411
3449
|
}
|
|
3412
3450
|
return s;
|
|
3413
3451
|
}
|
|
3414
|
-
function
|
|
3452
|
+
function Ve(a, e, t, i) {
|
|
3415
3453
|
const n = {};
|
|
3416
3454
|
for (const r of t)
|
|
3417
3455
|
for (const o of i) {
|
|
@@ -3420,7 +3458,7 @@ function Be(a, e, t, i) {
|
|
|
3420
3458
|
}
|
|
3421
3459
|
return n;
|
|
3422
3460
|
}
|
|
3423
|
-
function
|
|
3461
|
+
function We(a) {
|
|
3424
3462
|
let e = 0;
|
|
3425
3463
|
for (const t of Object.values(a))
|
|
3426
3464
|
e += t ?? 0;
|
|
@@ -3467,7 +3505,7 @@ function ki(a) {
|
|
|
3467
3505
|
const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3468
3506
|
function _i(a, e, t, i) {
|
|
3469
3507
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3470
|
-
return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () =>
|
|
3508
|
+
return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () => $e("rowGroups", r))), o.appendChild(Y("Column Groups", () => $e("columnGroups", r))), o.appendChild(Y("Values", () => Li(r))), o.appendChild(Y("Available Fields", () => Fi(r))), a.appendChild(o), () => {
|
|
3471
3509
|
n.abort(), o.remove();
|
|
3472
3510
|
};
|
|
3473
3511
|
}
|
|
@@ -3479,7 +3517,7 @@ function Y(a, e) {
|
|
|
3479
3517
|
const n = document.createElement("div");
|
|
3480
3518
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3481
3519
|
}
|
|
3482
|
-
function
|
|
3520
|
+
function $e(a, e) {
|
|
3483
3521
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3484
3522
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", a);
|
|
3485
3523
|
const o = a === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -3488,7 +3526,7 @@ function We(a, e) {
|
|
|
3488
3526
|
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3489
3527
|
} else
|
|
3490
3528
|
for (const s of o)
|
|
3491
|
-
r.appendChild(
|
|
3529
|
+
r.appendChild(Ti(s, a, e));
|
|
3492
3530
|
return r.addEventListener(
|
|
3493
3531
|
"dragover",
|
|
3494
3532
|
(s) => {
|
|
@@ -3511,7 +3549,7 @@ function We(a, e) {
|
|
|
3511
3549
|
{ signal: n }
|
|
3512
3550
|
), r;
|
|
3513
3551
|
}
|
|
3514
|
-
function
|
|
3552
|
+
function Ti(a, e, t) {
|
|
3515
3553
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3516
3554
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3517
3555
|
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
@@ -3537,7 +3575,7 @@ function Li(a, e, t) {
|
|
|
3537
3575
|
{ signal: n }
|
|
3538
3576
|
), r;
|
|
3539
3577
|
}
|
|
3540
|
-
function
|
|
3578
|
+
function Li(a) {
|
|
3541
3579
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3542
3580
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3543
3581
|
const r = e.valueFields ?? [];
|
|
@@ -3631,7 +3669,7 @@ function Fi(a) {
|
|
|
3631
3669
|
function Pi(a, e) {
|
|
3632
3670
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3633
3671
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3634
|
-
|
|
3672
|
+
de(
|
|
3635
3673
|
"Enable Pivot View",
|
|
3636
3674
|
a,
|
|
3637
3675
|
(o) => {
|
|
@@ -3640,7 +3678,7 @@ function Pi(a, e) {
|
|
|
3640
3678
|
n
|
|
3641
3679
|
)
|
|
3642
3680
|
), r.appendChild(
|
|
3643
|
-
|
|
3681
|
+
de(
|
|
3644
3682
|
"Show Row Totals",
|
|
3645
3683
|
t.showTotals ?? !0,
|
|
3646
3684
|
(o) => {
|
|
@@ -3649,7 +3687,7 @@ function Pi(a, e) {
|
|
|
3649
3687
|
n
|
|
3650
3688
|
)
|
|
3651
3689
|
), r.appendChild(
|
|
3652
|
-
|
|
3690
|
+
de(
|
|
3653
3691
|
"Show Grand Total",
|
|
3654
3692
|
t.showGrandTotal ?? !0,
|
|
3655
3693
|
(o) => {
|
|
@@ -3659,7 +3697,7 @@ function Pi(a, e) {
|
|
|
3659
3697
|
)
|
|
3660
3698
|
), r;
|
|
3661
3699
|
}
|
|
3662
|
-
function
|
|
3700
|
+
function de(a, e, t, i) {
|
|
3663
3701
|
const n = document.createElement("label");
|
|
3664
3702
|
n.className = "tbw-pivot-checkbox";
|
|
3665
3703
|
const r = document.createElement("input");
|
|
@@ -4105,25 +4143,25 @@ const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
4105
4143
|
title: "",
|
|
4106
4144
|
isolate: !1
|
|
4107
4145
|
};
|
|
4108
|
-
class
|
|
4146
|
+
class Sn extends _ {
|
|
4109
4147
|
name = "print";
|
|
4110
4148
|
version = "1.0.0";
|
|
4111
4149
|
styles = zi;
|
|
4112
|
-
#
|
|
4150
|
+
#i = !1;
|
|
4113
4151
|
#e = null;
|
|
4114
4152
|
#s = null;
|
|
4115
|
-
#
|
|
4116
|
-
#
|
|
4153
|
+
#r = null;
|
|
4154
|
+
#t = null;
|
|
4117
4155
|
#n = null;
|
|
4118
4156
|
#u = null;
|
|
4119
4157
|
get #l() {
|
|
4120
4158
|
return this.grid;
|
|
4121
4159
|
}
|
|
4122
4160
|
isPrinting() {
|
|
4123
|
-
return this.#
|
|
4161
|
+
return this.#i;
|
|
4124
4162
|
}
|
|
4125
4163
|
async print(e) {
|
|
4126
|
-
if (this.#
|
|
4164
|
+
if (this.#i) {
|
|
4127
4165
|
console.warn("[PrintPlugin] Print already in progress");
|
|
4128
4166
|
return;
|
|
4129
4167
|
}
|
|
@@ -4145,7 +4183,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4145
4183
|
))
|
|
4146
4184
|
return;
|
|
4147
4185
|
}
|
|
4148
|
-
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#
|
|
4186
|
+
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#i = !0;
|
|
4149
4187
|
const l = performance.now();
|
|
4150
4188
|
this.emit("print-start", {
|
|
4151
4189
|
rowCount: o,
|
|
@@ -4156,7 +4194,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4156
4194
|
const d = this.#l;
|
|
4157
4195
|
this.#s = {
|
|
4158
4196
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
4159
|
-
}, this.#v(), s && (this.#
|
|
4197
|
+
}, this.#v(), s && (this.#r = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#o(i), await this.#d(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#f(), this.emit("print-complete", {
|
|
4160
4198
|
success: !0,
|
|
4161
4199
|
rowCount: o,
|
|
4162
4200
|
duration: Math.round(performance.now() - l)
|
|
@@ -4168,21 +4206,21 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4168
4206
|
duration: Math.round(performance.now() - l)
|
|
4169
4207
|
});
|
|
4170
4208
|
} finally {
|
|
4171
|
-
this.#w(), this.#
|
|
4209
|
+
this.#w(), this.#i = !1;
|
|
4172
4210
|
}
|
|
4173
4211
|
}
|
|
4174
|
-
#
|
|
4212
|
+
#o(e) {
|
|
4175
4213
|
const t = this.gridElement;
|
|
4176
4214
|
if (t) {
|
|
4177
|
-
if (this.#
|
|
4215
|
+
if (this.#t = document.createElement("div"), this.#t.className = "tbw-print-header", e.includeTitle) {
|
|
4178
4216
|
const i = e.title || this.grid.effectiveConfig?.shell?.header?.title || "Grid Data", n = document.createElement("div");
|
|
4179
|
-
n.className = "tbw-print-header-title", n.textContent = i, this.#
|
|
4217
|
+
n.className = "tbw-print-header-title", n.textContent = i, this.#t.appendChild(n);
|
|
4180
4218
|
}
|
|
4181
4219
|
if (e.includeTimestamp) {
|
|
4182
4220
|
const i = document.createElement("div");
|
|
4183
|
-
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#
|
|
4221
|
+
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#t.appendChild(i);
|
|
4184
4222
|
}
|
|
4185
|
-
t.insertBefore(this.#
|
|
4223
|
+
t.insertBefore(this.#t, t.firstChild), this.#n = document.createElement("div"), this.#n.className = "tbw-print-footer", this.#n.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#n);
|
|
4186
4224
|
}
|
|
4187
4225
|
}
|
|
4188
4226
|
async #d() {
|
|
@@ -4225,9 +4263,9 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4225
4263
|
#w() {
|
|
4226
4264
|
const e = this.gridElement;
|
|
4227
4265
|
if (!e) return;
|
|
4228
|
-
this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#u !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#u = null), this.#
|
|
4266
|
+
this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#u !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#u = null), this.#t && (this.#t.remove(), this.#t = null), this.#n && (this.#n.remove(), this.#n = null);
|
|
4229
4267
|
const t = this.#l;
|
|
4230
|
-
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#
|
|
4268
|
+
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#r !== null && (this.grid.rows = this.#r, this.#r = null);
|
|
4231
4269
|
}
|
|
4232
4270
|
afterRender() {
|
|
4233
4271
|
this.config?.button && !this.#c && (this.#g(), this.#c = !0);
|
|
@@ -4256,13 +4294,13 @@ function Gi(a) {
|
|
|
4256
4294
|
const e = a.meta ?? {};
|
|
4257
4295
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4258
4296
|
}
|
|
4259
|
-
function
|
|
4297
|
+
function je(a, e, t) {
|
|
4260
4298
|
if (e === t || e < 0 || e >= a.length || t < 0 || t > a.length) return a;
|
|
4261
4299
|
const i = [...a], [n] = i.splice(e, 1);
|
|
4262
4300
|
return i.splice(t, 0, n), i;
|
|
4263
4301
|
}
|
|
4264
4302
|
const Bi = '@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}}';
|
|
4265
|
-
class
|
|
4303
|
+
class kn extends _ {
|
|
4266
4304
|
name = "reorder";
|
|
4267
4305
|
styles = Bi;
|
|
4268
4306
|
get defaultConfig() {
|
|
@@ -4328,7 +4366,7 @@ class Sn extends _ {
|
|
|
4328
4366
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4329
4367
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4330
4368
|
return;
|
|
4331
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f =
|
|
4369
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = je(h, d, u), g = {
|
|
4332
4370
|
field: l,
|
|
4333
4371
|
fromIndex: d,
|
|
4334
4372
|
toIndex: u,
|
|
@@ -4359,7 +4397,7 @@ class Sn extends _ {
|
|
|
4359
4397
|
moveColumn(e, t) {
|
|
4360
4398
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
4361
4399
|
if (n === -1) return;
|
|
4362
|
-
const r =
|
|
4400
|
+
const r = je(i, n, t);
|
|
4363
4401
|
this.emitCancelable("column-move", {
|
|
4364
4402
|
field: e,
|
|
4365
4403
|
fromIndex: n,
|
|
@@ -4455,7 +4493,7 @@ class Sn extends _ {
|
|
|
4455
4493
|
}
|
|
4456
4494
|
}
|
|
4457
4495
|
const Vi = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-inline-start:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-inline-end:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-inline-end:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
4458
|
-
class
|
|
4496
|
+
class An extends _ {
|
|
4459
4497
|
name = "responsive";
|
|
4460
4498
|
version = "1.0.0";
|
|
4461
4499
|
styles = Vi;
|
|
@@ -4473,44 +4511,44 @@ class kn extends _ {
|
|
|
4473
4511
|
}
|
|
4474
4512
|
]
|
|
4475
4513
|
};
|
|
4476
|
-
#
|
|
4514
|
+
#i;
|
|
4477
4515
|
#e = !1;
|
|
4478
4516
|
#s;
|
|
4479
|
-
#
|
|
4480
|
-
#
|
|
4517
|
+
#r = !1;
|
|
4518
|
+
#t = 0;
|
|
4481
4519
|
#n = /* @__PURE__ */ new Set();
|
|
4482
4520
|
#u = /* @__PURE__ */ new Set();
|
|
4483
4521
|
#l = null;
|
|
4484
|
-
#
|
|
4522
|
+
#o = [];
|
|
4485
4523
|
isResponsive() {
|
|
4486
4524
|
return this.#e;
|
|
4487
4525
|
}
|
|
4488
4526
|
setResponsive(e) {
|
|
4489
4527
|
e !== this.#e && (this.#e = e, this.#w(), this.emit("responsive-change", {
|
|
4490
4528
|
isResponsive: e,
|
|
4491
|
-
width: this.#
|
|
4529
|
+
width: this.#t,
|
|
4492
4530
|
breakpoint: this.config.breakpoint ?? 0
|
|
4493
4531
|
}));
|
|
4494
4532
|
}
|
|
4495
4533
|
setBreakpoint(e) {
|
|
4496
|
-
this.config.breakpoint = e, this.#p(this.#
|
|
4534
|
+
this.config.breakpoint = e, this.#p(this.#t);
|
|
4497
4535
|
}
|
|
4498
4536
|
setCardRenderer(e) {
|
|
4499
4537
|
this.config.cardRenderer = e, this.#e && this.requestRender();
|
|
4500
4538
|
}
|
|
4501
4539
|
getWidth() {
|
|
4502
|
-
return this.#
|
|
4540
|
+
return this.#t;
|
|
4503
4541
|
}
|
|
4504
4542
|
getActiveBreakpoint() {
|
|
4505
4543
|
return this.#l;
|
|
4506
4544
|
}
|
|
4507
4545
|
attach(e) {
|
|
4508
|
-
super.attach(e), this.#d(), this.#f(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#
|
|
4546
|
+
super.attach(e), this.#d(), this.#f(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#o = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#i = new ResizeObserver((t) => {
|
|
4509
4547
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4510
|
-
this.#
|
|
4548
|
+
this.#t = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
4511
4549
|
this.#p(i);
|
|
4512
4550
|
}, this.config.debounceMs ?? 100);
|
|
4513
|
-
}), this.#
|
|
4551
|
+
}), this.#i.observe(this.gridElement);
|
|
4514
4552
|
}
|
|
4515
4553
|
#d() {
|
|
4516
4554
|
const e = this.grid;
|
|
@@ -4533,7 +4571,7 @@ class kn extends _ {
|
|
|
4533
4571
|
}
|
|
4534
4572
|
const c = t.innerHTML.trim();
|
|
4535
4573
|
c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
|
|
4536
|
-
const h =
|
|
4574
|
+
const h = et(c, { value: u, row: u }), f = tt(h), g = document.createElement("div");
|
|
4537
4575
|
return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
|
|
4538
4576
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4539
4577
|
}
|
|
@@ -4543,14 +4581,14 @@ class kn extends _ {
|
|
|
4543
4581
|
typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#u.add(t.field) : this.#n.add(t.field);
|
|
4544
4582
|
}
|
|
4545
4583
|
detach() {
|
|
4546
|
-
this.#
|
|
4584
|
+
this.#i?.disconnect(), this.#i = void 0, clearTimeout(this.#s), this.#s = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4547
4585
|
}
|
|
4548
4586
|
handleQuery(e) {
|
|
4549
4587
|
if (e.type === "isCardMode")
|
|
4550
4588
|
return this.#e;
|
|
4551
4589
|
}
|
|
4552
4590
|
afterRender() {
|
|
4553
|
-
if (this.#R(), !(this.#
|
|
4591
|
+
if (this.#R(), !(this.#o.length > 0 ? this.#l !== null : this.#e))
|
|
4554
4592
|
return;
|
|
4555
4593
|
const t = this.#n.size > 0, i = this.#u.size > 0;
|
|
4556
4594
|
if (!t && !i)
|
|
@@ -4562,12 +4600,12 @@ class kn extends _ {
|
|
|
4562
4600
|
}
|
|
4563
4601
|
}
|
|
4564
4602
|
#p(e) {
|
|
4565
|
-
if (this.#
|
|
4603
|
+
if (this.#o.length > 0) {
|
|
4566
4604
|
this.#v(e);
|
|
4567
4605
|
return;
|
|
4568
4606
|
}
|
|
4569
4607
|
const t = this.config.breakpoint ?? 0;
|
|
4570
|
-
t === 0 && !this.#
|
|
4608
|
+
t === 0 && !this.#r && (this.#r = !0, console.warn(
|
|
4571
4609
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4572
4610
|
));
|
|
4573
4611
|
const i = t > 0 && e < t;
|
|
@@ -4579,7 +4617,7 @@ class kn extends _ {
|
|
|
4579
4617
|
}
|
|
4580
4618
|
#v(e) {
|
|
4581
4619
|
let t = null;
|
|
4582
|
-
for (const n of this.#
|
|
4620
|
+
for (const n of this.#o)
|
|
4583
4621
|
e <= n.maxWidth && (t = n);
|
|
4584
4622
|
if (t !== this.#l) {
|
|
4585
4623
|
this.#l = t, t?.hiddenColumns ? this.#f(t.hiddenColumns) : this.#f(this.config.hiddenColumns);
|
|
@@ -4719,7 +4757,7 @@ class kn extends _ {
|
|
|
4719
4757
|
}
|
|
4720
4758
|
}
|
|
4721
4759
|
const Wi = '@layer tbw-plugins{[data-field=__tbw_row_drag]{display:flex;align-items:center;justify-content:center}.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;min-width:1em;min-height:1em;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}}', $i = "__tbw_row_drag";
|
|
4722
|
-
class
|
|
4760
|
+
class _n extends _ {
|
|
4723
4761
|
name = "rowReorder";
|
|
4724
4762
|
styles = Wi;
|
|
4725
4763
|
get defaultConfig() {
|
|
@@ -4946,31 +4984,31 @@ function ji(a) {
|
|
|
4946
4984
|
to: { row: e.endRow, col: e.endCol }
|
|
4947
4985
|
};
|
|
4948
4986
|
}
|
|
4949
|
-
function
|
|
4987
|
+
function dt(a) {
|
|
4950
4988
|
return a.map(ji);
|
|
4951
4989
|
}
|
|
4952
4990
|
function Ui(a, e, t) {
|
|
4953
4991
|
const i = $(t);
|
|
4954
4992
|
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4955
4993
|
}
|
|
4956
|
-
function
|
|
4994
|
+
function Yi(a, e, t) {
|
|
4957
4995
|
return t.some((i) => Ui(a, e, i));
|
|
4958
4996
|
}
|
|
4959
|
-
function
|
|
4997
|
+
function Xi(a) {
|
|
4960
4998
|
const e = [], t = $(a);
|
|
4961
4999
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4962
5000
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4963
5001
|
e.push({ row: i, col: n });
|
|
4964
5002
|
return e;
|
|
4965
5003
|
}
|
|
4966
|
-
function
|
|
5004
|
+
function Zi(a) {
|
|
4967
5005
|
const e = /* @__PURE__ */ new Map();
|
|
4968
5006
|
for (const t of a)
|
|
4969
|
-
for (const i of
|
|
5007
|
+
for (const i of Xi(t))
|
|
4970
5008
|
e.set(`${i.row},${i.col}`, i);
|
|
4971
5009
|
return [...e.values()];
|
|
4972
5010
|
}
|
|
4973
|
-
function
|
|
5011
|
+
function ce(a, e) {
|
|
4974
5012
|
return {
|
|
4975
5013
|
startRow: a.row,
|
|
4976
5014
|
startCol: a.col,
|
|
@@ -4982,8 +5020,8 @@ function Q(a, e) {
|
|
|
4982
5020
|
const t = $(a), i = $(e);
|
|
4983
5021
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4984
5022
|
}
|
|
4985
|
-
const
|
|
4986
|
-
function
|
|
5023
|
+
const Qi = '@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){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%));outline:none;position:relative;&:after{content:"";position:absolute;inset:0;pointer-events:none;border:0 solid var(--tbw-range-border-color, var(--tbw-color-accent));border-top-width:2px;border-bottom-width:2px;z-index:1}+.data-grid-row.row-focus:after{border-top-width:0}&:has(+.data-grid-row.row-focus):after{border-bottom-width:0}}&[data-selection-mode=row] .cell-focus,&[data-selection-mode=row] .row-focus,&[data-selection-mode=range] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);position:relative;&:after{content:"";position:absolute;inset:0;pointer-events:none;border:0 solid var(--tbw-range-border-color);z-index:1}&.top:after{border-top-width:2px}&.bottom:after{border-bottom-width:2px}&.first:after{border-left-width:2px}&.last:after{border-right-width:2px}}.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}.data-grid-row>.cell[data-field=__tbw_checkbox],.header-row>.cell[data-field=__tbw_checkbox]{text-align:center;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center}.tbw-select-row-checkbox{pointer-events:none;margin:0;cursor:pointer}.tbw-checkbox-header{display:flex;justify-content:center;align-items:center;height:100%}.tbw-select-all-checkbox{margin:0;cursor:pointer}}}', Ue = "__tbw_checkbox";
|
|
5024
|
+
function Ji(a, e, t) {
|
|
4987
5025
|
if (a === "cell" && e.selectedCell)
|
|
4988
5026
|
return {
|
|
4989
5027
|
mode: a,
|
|
@@ -4995,15 +5033,15 @@ function Qi(a, e, t) {
|
|
|
4995
5033
|
]
|
|
4996
5034
|
};
|
|
4997
5035
|
if (a === "row" && e.selected.size > 0) {
|
|
4998
|
-
const i = [...e.selected].
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
return { mode: a, ranges:
|
|
5036
|
+
const i = [...e.selected].sort((s, l) => s - l), n = [];
|
|
5037
|
+
let r = i[0], o = r;
|
|
5038
|
+
for (let s = 1; s < i.length; s++)
|
|
5039
|
+
i[s] === o + 1 ? o = i[s] : (n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), r = i[s], o = r);
|
|
5040
|
+
return n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), { mode: a, ranges: n };
|
|
5003
5041
|
}
|
|
5004
|
-
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges:
|
|
5042
|
+
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: dt(e.ranges) } : { mode: a, ranges: [] };
|
|
5005
5043
|
}
|
|
5006
|
-
class
|
|
5044
|
+
class Tn extends _ {
|
|
5007
5045
|
static manifest = {
|
|
5008
5046
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
5009
5047
|
configRules: [
|
|
@@ -5018,7 +5056,7 @@ class _n extends _ {
|
|
|
5018
5056
|
]
|
|
5019
5057
|
};
|
|
5020
5058
|
name = "selection";
|
|
5021
|
-
styles =
|
|
5059
|
+
styles = Qi;
|
|
5022
5060
|
get defaultConfig() {
|
|
5023
5061
|
return {
|
|
5024
5062
|
mode: "cell",
|
|
@@ -5035,6 +5073,9 @@ class _n extends _ {
|
|
|
5035
5073
|
isDragging = !1;
|
|
5036
5074
|
pendingKeyboardUpdate = null;
|
|
5037
5075
|
selectedCell = null;
|
|
5076
|
+
lastSyncedFocusRow = -1;
|
|
5077
|
+
lastSyncedFocusCol = -1;
|
|
5078
|
+
explicitSelection = !1;
|
|
5038
5079
|
isSelectionEnabled() {
|
|
5039
5080
|
return this.config.enabled === !1 ? !1 : this.grid.effectiveConfig?.selectable !== !1;
|
|
5040
5081
|
}
|
|
@@ -5060,31 +5101,47 @@ class _n extends _ {
|
|
|
5060
5101
|
return this.getSelection();
|
|
5061
5102
|
}
|
|
5062
5103
|
detach() {
|
|
5063
|
-
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
|
|
5104
|
+
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null, this.lastSyncedFocusRow = -1, this.lastSyncedFocusCol = -1;
|
|
5064
5105
|
}
|
|
5065
5106
|
clearSelectionSilent() {
|
|
5066
|
-
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.requestAfterRender();
|
|
5107
|
+
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.lastSyncedFocusRow = -1, this.lastSyncedFocusCol = -1, this.requestAfterRender();
|
|
5067
5108
|
}
|
|
5068
5109
|
onCellClick(e) {
|
|
5069
5110
|
if (!this.isSelectionEnabled()) return !1;
|
|
5070
5111
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
5071
5112
|
if (n.type !== o)
|
|
5072
5113
|
return !1;
|
|
5073
|
-
const s = this.columns[i], l = s &&
|
|
5114
|
+
const s = this.columns[i], l = s && K(s);
|
|
5074
5115
|
if (r === "cell") {
|
|
5075
5116
|
if (l || !this.isCellSelectable(t, i))
|
|
5076
5117
|
return !1;
|
|
5077
5118
|
const d = this.selectedCell;
|
|
5078
|
-
return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#
|
|
5119
|
+
return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
5120
|
+
}
|
|
5121
|
+
if (r === "row") {
|
|
5122
|
+
if (!this.isRowSelectable(t))
|
|
5123
|
+
return !1;
|
|
5124
|
+
const d = n.shiftKey, c = n.ctrlKey || n.metaKey, u = s?.meta?.checkboxColumn === !0;
|
|
5125
|
+
if (d && this.anchor !== null) {
|
|
5126
|
+
const h = Math.min(this.anchor, t), f = Math.max(this.anchor, t);
|
|
5127
|
+
c || this.selected.clear();
|
|
5128
|
+
for (let g = h; g <= f; g++)
|
|
5129
|
+
this.isRowSelectable(g) && this.selected.add(g);
|
|
5130
|
+
} else if (c || u)
|
|
5131
|
+
this.selected.has(t) ? this.selected.delete(t) : this.selected.add(t), this.anchor = t;
|
|
5132
|
+
else {
|
|
5133
|
+
if (this.selected.size === 1 && this.selected.has(t))
|
|
5134
|
+
return !1;
|
|
5135
|
+
this.selected.clear(), this.selected.add(t), this.anchor = t;
|
|
5136
|
+
}
|
|
5137
|
+
return this.lastSelected = t, this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
|
|
5079
5138
|
}
|
|
5080
|
-
if (r === "row")
|
|
5081
|
-
return !this.isRowSelectable(t) || this.selected.size === 1 && this.selected.has(t) || (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
|
|
5082
5139
|
if (r === "range") {
|
|
5083
5140
|
if (l || !this.isCellSelectable(t, i))
|
|
5084
5141
|
return !1;
|
|
5085
5142
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
5086
5143
|
if (d && this.cellAnchor) {
|
|
5087
|
-
const u =
|
|
5144
|
+
const u = ce(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5088
5145
|
if (h && Q(h, u))
|
|
5089
5146
|
return !1;
|
|
5090
5147
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
@@ -5107,7 +5164,7 @@ class _n extends _ {
|
|
|
5107
5164
|
return !1;
|
|
5108
5165
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
5109
5166
|
}
|
|
5110
|
-
return this.emit("selection-change", this.#
|
|
5167
|
+
return this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
|
|
5111
5168
|
}
|
|
5112
5169
|
return !1;
|
|
5113
5170
|
}
|
|
@@ -5115,40 +5172,40 @@ class _n extends _ {
|
|
|
5115
5172
|
if (!this.isSelectionEnabled()) return !1;
|
|
5116
5173
|
const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
|
|
5117
5174
|
if (e.key === "Escape")
|
|
5118
|
-
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#
|
|
5175
|
+
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
|
|
5119
5176
|
if (t === "cell" && n)
|
|
5120
5177
|
return queueMicrotask(() => {
|
|
5121
5178
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
5122
|
-
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#
|
|
5123
|
-
}), !1;
|
|
5124
|
-
if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
5125
|
-
return queueMicrotask(() => {
|
|
5126
|
-
const r = this.grid._focusRow;
|
|
5127
|
-
this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#e()), this.requestAfterRender();
|
|
5179
|
+
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5128
5180
|
}), !1;
|
|
5181
|
+
if (t === "row") {
|
|
5182
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
5183
|
+
const r = e.shiftKey;
|
|
5184
|
+
return r && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
|
|
5185
|
+
const o = this.grid._focusRow;
|
|
5186
|
+
if (r && this.anchor !== null) {
|
|
5187
|
+
this.selected.clear();
|
|
5188
|
+
const s = Math.min(this.anchor, o), l = Math.max(this.anchor, o);
|
|
5189
|
+
for (let d = s; d <= l; d++)
|
|
5190
|
+
this.isRowSelectable(d) && this.selected.add(d);
|
|
5191
|
+
} else
|
|
5192
|
+
this.isRowSelectable(o) ? (this.selected.clear(), this.selected.add(o), this.anchor = o) : this.selected.clear();
|
|
5193
|
+
this.lastSelected = o, this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5194
|
+
}), !1;
|
|
5195
|
+
}
|
|
5196
|
+
if (e.key === "a" && (e.ctrlKey || e.metaKey))
|
|
5197
|
+
return e.preventDefault(), e.stopPropagation(), this.selectAll(), !0;
|
|
5198
|
+
}
|
|
5129
5199
|
if (t === "range" && n) {
|
|
5130
5200
|
const r = e.key === "Tab", o = e.shiftKey && !r;
|
|
5131
5201
|
return o && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: o }, queueMicrotask(() => this.requestAfterRender()), !1;
|
|
5132
5202
|
}
|
|
5133
|
-
|
|
5134
|
-
const r = this.rows.length, o = this.columns.length;
|
|
5135
|
-
if (r > 0 && o > 0) {
|
|
5136
|
-
e.preventDefault(), e.stopPropagation();
|
|
5137
|
-
const s = {
|
|
5138
|
-
startRow: 0,
|
|
5139
|
-
startCol: 0,
|
|
5140
|
-
endRow: r - 1,
|
|
5141
|
-
endCol: o - 1
|
|
5142
|
-
};
|
|
5143
|
-
return this.ranges = [s], this.activeRange = s, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
|
|
5144
|
-
}
|
|
5145
|
-
}
|
|
5146
|
-
return !1;
|
|
5203
|
+
return t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey) ? (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0) : !1;
|
|
5147
5204
|
}
|
|
5148
5205
|
onCellMouseDown(e) {
|
|
5149
5206
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5150
5207
|
const t = this.columns[e.colIndex];
|
|
5151
|
-
if (t &&
|
|
5208
|
+
if (t && K(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
5152
5209
|
return;
|
|
5153
5210
|
this.isDragging = !0;
|
|
5154
5211
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -5157,24 +5214,104 @@ class _n extends _ {
|
|
|
5157
5214
|
endRow: i,
|
|
5158
5215
|
endCol: n
|
|
5159
5216
|
};
|
|
5160
|
-
return !r && this.ranges.length === 1 && Q(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.#
|
|
5217
|
+
return !r && this.ranges.length === 1 && Q(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);
|
|
5161
5218
|
}
|
|
5162
5219
|
onCellMouseMove(e) {
|
|
5163
5220
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5164
5221
|
let t = e.colIndex;
|
|
5165
5222
|
const i = this.columns[t];
|
|
5166
|
-
if (i &&
|
|
5167
|
-
const o = this.columns.findIndex((s) => !
|
|
5223
|
+
if (i && K(i)) {
|
|
5224
|
+
const o = this.columns.findIndex((s) => !K(s));
|
|
5168
5225
|
o >= 0 && (t = o);
|
|
5169
5226
|
}
|
|
5170
|
-
const n =
|
|
5171
|
-
return r && Q(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.#
|
|
5227
|
+
const n = ce(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5228
|
+
return r && Q(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;
|
|
5172
5229
|
}
|
|
5173
5230
|
onCellMouseUp(e) {
|
|
5174
5231
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
5175
5232
|
return this.isDragging = !1, !0;
|
|
5176
5233
|
}
|
|
5177
|
-
|
|
5234
|
+
processColumns(e) {
|
|
5235
|
+
if (this.config.checkbox && this.config.mode === "row") {
|
|
5236
|
+
if (e.some((r) => r.field === Ue))
|
|
5237
|
+
return e;
|
|
5238
|
+
const t = this.#i(), i = e.findIndex(te), n = i >= 0 ? i + 1 : 0;
|
|
5239
|
+
return [...e.slice(0, n), t, ...e.slice(n)];
|
|
5240
|
+
}
|
|
5241
|
+
return e;
|
|
5242
|
+
}
|
|
5243
|
+
#i() {
|
|
5244
|
+
return {
|
|
5245
|
+
field: Ue,
|
|
5246
|
+
header: "",
|
|
5247
|
+
width: 32,
|
|
5248
|
+
resizable: !1,
|
|
5249
|
+
sortable: !1,
|
|
5250
|
+
meta: {
|
|
5251
|
+
lockPosition: !0,
|
|
5252
|
+
suppressMovable: !0,
|
|
5253
|
+
utility: !0,
|
|
5254
|
+
checkboxColumn: !0
|
|
5255
|
+
},
|
|
5256
|
+
headerRenderer: () => {
|
|
5257
|
+
const e = document.createElement("div");
|
|
5258
|
+
e.className = "tbw-checkbox-header";
|
|
5259
|
+
const t = document.createElement("input");
|
|
5260
|
+
return t.type = "checkbox", t.className = "tbw-select-all-checkbox", t.addEventListener("click", (i) => {
|
|
5261
|
+
i.stopPropagation(), i.target.checked ? this.selectAll() : this.clearSelection();
|
|
5262
|
+
}), e.appendChild(t), e;
|
|
5263
|
+
},
|
|
5264
|
+
renderer: (e) => {
|
|
5265
|
+
const t = document.createElement("input");
|
|
5266
|
+
t.type = "checkbox", t.className = "tbw-select-row-checkbox";
|
|
5267
|
+
const i = e.cellEl;
|
|
5268
|
+
if (i) {
|
|
5269
|
+
const n = parseInt(i.getAttribute("data-row") ?? "-1", 10);
|
|
5270
|
+
n >= 0 && (t.checked = this.selected.has(n));
|
|
5271
|
+
}
|
|
5272
|
+
return t;
|
|
5273
|
+
}
|
|
5274
|
+
};
|
|
5275
|
+
}
|
|
5276
|
+
#e(e) {
|
|
5277
|
+
e.querySelectorAll(".tbw-select-row-checkbox").forEach((n) => {
|
|
5278
|
+
const r = n.closest(".cell"), o = r ? xe(r) : -1;
|
|
5279
|
+
o >= 0 && (n.checked = this.selected.has(o));
|
|
5280
|
+
});
|
|
5281
|
+
const i = e.querySelector(".tbw-select-all-checkbox");
|
|
5282
|
+
if (i) {
|
|
5283
|
+
const n = this.rows.length;
|
|
5284
|
+
let r = 0;
|
|
5285
|
+
if (this.config.isSelectable)
|
|
5286
|
+
for (let l = 0; l < n; l++)
|
|
5287
|
+
this.isRowSelectable(l) && r++;
|
|
5288
|
+
else
|
|
5289
|
+
r = n;
|
|
5290
|
+
const o = r > 0 && this.selected.size >= r, s = this.selected.size > 0;
|
|
5291
|
+
i.checked = o, i.indeterminate = s && !o;
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
#s(e) {
|
|
5295
|
+
const t = this.grid._focusRow, i = this.grid._focusCol;
|
|
5296
|
+
if (e === "row") {
|
|
5297
|
+
if (this.explicitSelection) {
|
|
5298
|
+
this.explicitSelection = !1, this.lastSyncedFocusRow = t;
|
|
5299
|
+
return;
|
|
5300
|
+
}
|
|
5301
|
+
t !== this.lastSyncedFocusRow && (this.lastSyncedFocusRow = t, this.isRowSelectable(t) && (!this.selected.has(t) || this.selected.size !== 1) && (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.anchor = t, this.emit("selection-change", this.#t())));
|
|
5302
|
+
}
|
|
5303
|
+
if (e === "cell") {
|
|
5304
|
+
if (this.explicitSelection) {
|
|
5305
|
+
this.explicitSelection = !1, this.lastSyncedFocusRow = t, this.lastSyncedFocusCol = i;
|
|
5306
|
+
return;
|
|
5307
|
+
}
|
|
5308
|
+
if ((t !== this.lastSyncedFocusRow || i !== this.lastSyncedFocusCol) && (this.lastSyncedFocusRow = t, this.lastSyncedFocusCol = i, this.isCellSelectable(t, i))) {
|
|
5309
|
+
const n = this.selectedCell;
|
|
5310
|
+
(!n || n.row !== t || n.col !== i) && (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()));
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
#r() {
|
|
5178
5315
|
const e = this.gridElement;
|
|
5179
5316
|
if (!e) return;
|
|
5180
5317
|
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
@@ -5184,26 +5321,27 @@ class _n extends _ {
|
|
|
5184
5321
|
const r = e.querySelectorAll(".data-grid-row");
|
|
5185
5322
|
if (r.forEach((o) => {
|
|
5186
5323
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
5187
|
-
}), t === "row" && (
|
|
5188
|
-
const s = o.querySelector(".cell[data-row]"), l =
|
|
5324
|
+
}), t === "row" && (Ce(e), r.forEach((o) => {
|
|
5325
|
+
const s = o.querySelector(".cell[data-row]"), l = xe(s);
|
|
5189
5326
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
5190
|
-
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5327
|
+
}), this.config.checkbox && this.#e(e)), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5191
5328
|
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
5192
5329
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
|
|
5193
5330
|
}), t === "range" && this.ranges.length > 0) {
|
|
5194
|
-
|
|
5195
|
-
const o = this.
|
|
5196
|
-
|
|
5331
|
+
Ce(e);
|
|
5332
|
+
const o = this.ranges.map($), s = (d, c) => {
|
|
5333
|
+
for (const u of o)
|
|
5334
|
+
if (d >= u.startRow && d <= u.endRow && c >= u.startCol && c <= u.endCol)
|
|
5335
|
+
return !0;
|
|
5336
|
+
return !1;
|
|
5337
|
+
};
|
|
5338
|
+
e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
5197
5339
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
5198
5340
|
if (c >= 0 && u >= 0) {
|
|
5199
5341
|
const h = this.columns[u];
|
|
5200
|
-
if (h &&
|
|
5342
|
+
if (h && K(h))
|
|
5201
5343
|
return;
|
|
5202
|
-
|
|
5203
|
-
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
5204
|
-
const g = Math.max(o.startCol, s);
|
|
5205
|
-
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
5206
|
-
}
|
|
5344
|
+
s(c, u) && (d.classList.add("selected"), s(c - 1, u) || d.classList.add("top"), s(c + 1, u) || d.classList.add("bottom"), s(c, u - 1) || d.classList.add("first"), s(c, u + 1) || d.classList.add("last"));
|
|
5207
5345
|
}
|
|
5208
5346
|
});
|
|
5209
5347
|
}
|
|
@@ -5218,28 +5356,59 @@ class _n extends _ {
|
|
|
5218
5356
|
this.pendingKeyboardUpdate = null;
|
|
5219
5357
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
5220
5358
|
if (n && this.cellAnchor) {
|
|
5221
|
-
const s =
|
|
5359
|
+
const s = ce(this.cellAnchor, { row: r, col: o });
|
|
5222
5360
|
this.ranges = [s], this.activeRange = s;
|
|
5223
5361
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
5224
|
-
this.emit("selection-change", this.#
|
|
5362
|
+
this.emit("selection-change", this.#t());
|
|
5225
5363
|
}
|
|
5226
|
-
this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#
|
|
5364
|
+
this.#s(i), this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#r();
|
|
5227
5365
|
}
|
|
5228
5366
|
onScrollRender() {
|
|
5229
|
-
this.isSelectionEnabled() && this.#
|
|
5367
|
+
this.isSelectionEnabled() && this.#r();
|
|
5230
5368
|
}
|
|
5231
5369
|
getSelection() {
|
|
5232
5370
|
return {
|
|
5233
5371
|
mode: this.config.mode,
|
|
5234
|
-
ranges: this.#
|
|
5372
|
+
ranges: this.#t().ranges,
|
|
5235
5373
|
anchor: this.cellAnchor
|
|
5236
5374
|
};
|
|
5237
5375
|
}
|
|
5238
5376
|
getSelectedCells() {
|
|
5239
|
-
return
|
|
5377
|
+
return Zi(this.ranges);
|
|
5240
5378
|
}
|
|
5241
5379
|
isCellSelected(e, t) {
|
|
5242
|
-
return
|
|
5380
|
+
return Yi(e, t, this.ranges);
|
|
5381
|
+
}
|
|
5382
|
+
selectAll() {
|
|
5383
|
+
const { mode: e } = this.config;
|
|
5384
|
+
if (e === "row") {
|
|
5385
|
+
this.selected.clear();
|
|
5386
|
+
for (let t = 0; t < this.rows.length; t++)
|
|
5387
|
+
this.isRowSelectable(t) && this.selected.add(t);
|
|
5388
|
+
this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5389
|
+
} else if (e === "range") {
|
|
5390
|
+
const t = this.rows.length, i = this.columns.length;
|
|
5391
|
+
if (t > 0 && i > 0) {
|
|
5392
|
+
const n = {
|
|
5393
|
+
startRow: 0,
|
|
5394
|
+
startCol: 0,
|
|
5395
|
+
endRow: t - 1,
|
|
5396
|
+
endCol: i - 1
|
|
5397
|
+
};
|
|
5398
|
+
this.ranges = [n], this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5399
|
+
}
|
|
5400
|
+
}
|
|
5401
|
+
}
|
|
5402
|
+
selectRows(e) {
|
|
5403
|
+
if (this.config.mode === "row") {
|
|
5404
|
+
this.selected.clear();
|
|
5405
|
+
for (const t of e)
|
|
5406
|
+
t >= 0 && t < this.rows.length && this.isRowSelectable(t) && this.selected.add(t);
|
|
5407
|
+
this.anchor = e.length > 0 ? e[e.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
getSelectedRowIndices() {
|
|
5411
|
+
return [...this.selected].sort((e, t) => e - t);
|
|
5243
5412
|
}
|
|
5244
5413
|
clearSelection() {
|
|
5245
5414
|
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();
|
|
@@ -5252,11 +5421,11 @@ class _n extends _ {
|
|
|
5252
5421
|
endCol: t.to.col
|
|
5253
5422
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
5254
5423
|
mode: this.config.mode,
|
|
5255
|
-
ranges:
|
|
5424
|
+
ranges: dt(this.ranges)
|
|
5256
5425
|
}), this.requestAfterRender();
|
|
5257
5426
|
}
|
|
5258
|
-
#
|
|
5259
|
-
return
|
|
5427
|
+
#t() {
|
|
5428
|
+
return Ji(
|
|
5260
5429
|
this.config.mode,
|
|
5261
5430
|
{
|
|
5262
5431
|
selectedCell: this.selectedCell,
|
|
@@ -5270,20 +5439,20 @@ class _n extends _ {
|
|
|
5270
5439
|
function ee(a, e) {
|
|
5271
5440
|
return Math.floor(a / e);
|
|
5272
5441
|
}
|
|
5273
|
-
function
|
|
5442
|
+
function en(a, e) {
|
|
5274
5443
|
return {
|
|
5275
5444
|
start: a * e,
|
|
5276
5445
|
end: (a + 1) * e
|
|
5277
5446
|
};
|
|
5278
5447
|
}
|
|
5279
|
-
function
|
|
5448
|
+
function tn(a, e, t) {
|
|
5280
5449
|
const i = ee(a, t), n = ee(e - 1, t), r = [];
|
|
5281
5450
|
for (let o = i; o <= n; o++)
|
|
5282
5451
|
r.push(o);
|
|
5283
5452
|
return r;
|
|
5284
5453
|
}
|
|
5285
|
-
async function
|
|
5286
|
-
const n =
|
|
5454
|
+
async function Ye(a, e, t, i) {
|
|
5455
|
+
const n = en(e, t);
|
|
5287
5456
|
return a.getRows({
|
|
5288
5457
|
startRow: n.start,
|
|
5289
5458
|
endRow: n.end,
|
|
@@ -5291,13 +5460,13 @@ async function Ue(a, e, t, i) {
|
|
|
5291
5460
|
filterModel: i.filterModel
|
|
5292
5461
|
});
|
|
5293
5462
|
}
|
|
5294
|
-
function
|
|
5463
|
+
function nn(a, e, t) {
|
|
5295
5464
|
const i = ee(a, e), n = t.get(i);
|
|
5296
5465
|
if (!n) return;
|
|
5297
5466
|
const r = a % e;
|
|
5298
5467
|
return n[r];
|
|
5299
5468
|
}
|
|
5300
|
-
const
|
|
5469
|
+
const rn = 100;
|
|
5301
5470
|
class Ln extends _ {
|
|
5302
5471
|
name = "serverSide";
|
|
5303
5472
|
get defaultConfig() {
|
|
@@ -5318,12 +5487,12 @@ class Ln extends _ {
|
|
|
5318
5487
|
}
|
|
5319
5488
|
loadRequiredBlocks() {
|
|
5320
5489
|
if (!this.dataSource) return;
|
|
5321
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
5490
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = tn(i.startRow, i.endRow, t);
|
|
5322
5491
|
for (const r of n)
|
|
5323
5492
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
5324
5493
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
5325
5494
|
break;
|
|
5326
|
-
this.loadingBlocks.add(r),
|
|
5495
|
+
this.loadingBlocks.add(r), Ye(this.dataSource, r, t, {}).then((o) => {
|
|
5327
5496
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
5328
5497
|
}).catch(() => {
|
|
5329
5498
|
this.loadingBlocks.delete(r);
|
|
@@ -5334,7 +5503,7 @@ class Ln extends _ {
|
|
|
5334
5503
|
if (!this.dataSource) return [...e];
|
|
5335
5504
|
const t = [];
|
|
5336
5505
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
5337
|
-
const n =
|
|
5506
|
+
const n = nn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
5338
5507
|
t.push(n ?? { __loading: !0, __index: i });
|
|
5339
5508
|
}
|
|
5340
5509
|
return t;
|
|
@@ -5342,12 +5511,12 @@ class Ln extends _ {
|
|
|
5342
5511
|
onScroll(e) {
|
|
5343
5512
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
5344
5513
|
this.loadRequiredBlocks();
|
|
5345
|
-
},
|
|
5514
|
+
}, rn));
|
|
5346
5515
|
}
|
|
5347
5516
|
setDataSource(e) {
|
|
5348
5517
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
5349
5518
|
const t = this.config.cacheBlockSize ?? 100;
|
|
5350
|
-
|
|
5519
|
+
Ye(e, 0, t, {}).then((i) => {
|
|
5351
5520
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
5352
5521
|
});
|
|
5353
5522
|
}
|
|
@@ -5368,52 +5537,52 @@ class Ln extends _ {
|
|
|
5368
5537
|
return this.loadedBlocks.size;
|
|
5369
5538
|
}
|
|
5370
5539
|
}
|
|
5371
|
-
function
|
|
5540
|
+
function ct(a, e, t) {
|
|
5372
5541
|
return a.id !== void 0 ? String(a.id) : t ? `${t}-${e}` : String(e);
|
|
5373
5542
|
}
|
|
5374
|
-
function
|
|
5543
|
+
function ue(a, e) {
|
|
5375
5544
|
const t = new Set(a);
|
|
5376
5545
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5377
5546
|
}
|
|
5378
|
-
function
|
|
5547
|
+
function pe(a, e, t = null, i = 0) {
|
|
5379
5548
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5380
5549
|
for (let o = 0; o < a.length; o++) {
|
|
5381
|
-
const s = a[o], l =
|
|
5550
|
+
const s = a[o], l = ct(s, o, t), d = s[n];
|
|
5382
5551
|
if (Array.isArray(d) && d.length > 0) {
|
|
5383
5552
|
r.add(l);
|
|
5384
|
-
const c =
|
|
5553
|
+
const c = pe(d, e, l, i + 1);
|
|
5385
5554
|
for (const u of c) r.add(u);
|
|
5386
5555
|
}
|
|
5387
5556
|
}
|
|
5388
5557
|
return r;
|
|
5389
5558
|
}
|
|
5390
|
-
function
|
|
5559
|
+
function on() {
|
|
5391
5560
|
return /* @__PURE__ */ new Set();
|
|
5392
5561
|
}
|
|
5393
|
-
function
|
|
5562
|
+
function ut(a, e, t, i = null, n = 0) {
|
|
5394
5563
|
const r = t.childrenField ?? "children";
|
|
5395
5564
|
for (let o = 0; o < a.length; o++) {
|
|
5396
|
-
const s = a[o], l =
|
|
5565
|
+
const s = a[o], l = ct(s, o, i);
|
|
5397
5566
|
if (l === e)
|
|
5398
5567
|
return [l];
|
|
5399
5568
|
const d = s[r];
|
|
5400
5569
|
if (Array.isArray(d) && d.length > 0) {
|
|
5401
|
-
const c =
|
|
5570
|
+
const c = ut(d, e, t, l, n + 1);
|
|
5402
5571
|
if (c)
|
|
5403
5572
|
return [l, ...c];
|
|
5404
5573
|
}
|
|
5405
5574
|
}
|
|
5406
5575
|
return null;
|
|
5407
5576
|
}
|
|
5408
|
-
function
|
|
5409
|
-
const n =
|
|
5577
|
+
function sn(a, e, t, i) {
|
|
5578
|
+
const n = ut(a, e, t);
|
|
5410
5579
|
if (!n) return i;
|
|
5411
5580
|
const r = new Set(i);
|
|
5412
5581
|
for (let o = 0; o < n.length - 1; o++)
|
|
5413
5582
|
r.add(n[o]);
|
|
5414
5583
|
return r;
|
|
5415
5584
|
}
|
|
5416
|
-
function
|
|
5585
|
+
function Xe(a, e = "children") {
|
|
5417
5586
|
if (!Array.isArray(a) || a.length === 0) return !1;
|
|
5418
5587
|
for (const t of a) {
|
|
5419
5588
|
if (!t) continue;
|
|
@@ -5423,7 +5592,7 @@ function Ye(a, e = "children") {
|
|
|
5423
5592
|
}
|
|
5424
5593
|
return !1;
|
|
5425
5594
|
}
|
|
5426
|
-
function
|
|
5595
|
+
function an(a) {
|
|
5427
5596
|
if (!Array.isArray(a) || a.length === 0) return null;
|
|
5428
5597
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
5429
5598
|
for (const t of a)
|
|
@@ -5435,8 +5604,8 @@ function sn(a) {
|
|
|
5435
5604
|
}
|
|
5436
5605
|
return null;
|
|
5437
5606
|
}
|
|
5438
|
-
const
|
|
5439
|
-
class
|
|
5607
|
+
const ln = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-inline-start:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
5608
|
+
class In extends _ {
|
|
5440
5609
|
static manifest = {
|
|
5441
5610
|
events: [
|
|
5442
5611
|
{
|
|
@@ -5452,7 +5621,7 @@ class Tn extends _ {
|
|
|
5452
5621
|
]
|
|
5453
5622
|
};
|
|
5454
5623
|
name = "tree";
|
|
5455
|
-
styles =
|
|
5624
|
+
styles = ln;
|
|
5456
5625
|
get defaultConfig() {
|
|
5457
5626
|
return {
|
|
5458
5627
|
childrenField: "children",
|
|
@@ -5485,15 +5654,15 @@ class Tn extends _ {
|
|
|
5485
5654
|
}
|
|
5486
5655
|
detect(e) {
|
|
5487
5656
|
if (!this.config.autoDetect) return !1;
|
|
5488
|
-
const t = e, i = this.config.childrenField ??
|
|
5489
|
-
return
|
|
5657
|
+
const t = e, i = this.config.childrenField ?? an(t) ?? "children";
|
|
5658
|
+
return Xe(t, i);
|
|
5490
5659
|
}
|
|
5491
5660
|
processRows(e) {
|
|
5492
5661
|
const t = this.config.childrenField ?? "children", i = e;
|
|
5493
|
-
if (!
|
|
5662
|
+
if (!Xe(i, t))
|
|
5494
5663
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5495
5664
|
let n = this.withStableKeys(i);
|
|
5496
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5665
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = pe(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5497
5666
|
const r = /* @__PURE__ */ new Set();
|
|
5498
5667
|
for (const o of this.flattenedRows)
|
|
5499
5668
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5571,7 +5740,7 @@ class Tn extends _ {
|
|
|
5571
5740
|
const i = t.getAttribute("data-tree-key");
|
|
5572
5741
|
if (!i) return !1;
|
|
5573
5742
|
const n = this.rowKeyMap.get(i);
|
|
5574
|
-
return n ? (this.expandedKeys =
|
|
5743
|
+
return n ? (this.expandedKeys = ue(this.expandedKeys, i), this.emit("tree-expand", {
|
|
5575
5744
|
key: i,
|
|
5576
5745
|
row: n.data,
|
|
5577
5746
|
expanded: this.expandedKeys.has(i),
|
|
@@ -5582,7 +5751,7 @@ class Tn extends _ {
|
|
|
5582
5751
|
if (e.key !== " ") return;
|
|
5583
5752
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
5584
5753
|
if (i?.hasChildren)
|
|
5585
|
-
return e.preventDefault(), this.expandedKeys =
|
|
5754
|
+
return e.preventDefault(), this.expandedKeys = ue(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
5586
5755
|
key: i.key,
|
|
5587
5756
|
row: i.data,
|
|
5588
5757
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -5615,13 +5784,13 @@ class Tn extends _ {
|
|
|
5615
5784
|
this.expandedKeys.delete(e), this.requestRender();
|
|
5616
5785
|
}
|
|
5617
5786
|
toggle(e) {
|
|
5618
|
-
this.expandedKeys =
|
|
5787
|
+
this.expandedKeys = ue(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5619
5788
|
}
|
|
5620
5789
|
expandAll() {
|
|
5621
|
-
this.expandedKeys =
|
|
5790
|
+
this.expandedKeys = pe(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5622
5791
|
}
|
|
5623
5792
|
collapseAll() {
|
|
5624
|
-
this.expandedKeys =
|
|
5793
|
+
this.expandedKeys = on(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5625
5794
|
}
|
|
5626
5795
|
isExpanded(e) {
|
|
5627
5796
|
return this.expandedKeys.has(e);
|
|
@@ -5636,10 +5805,10 @@ class Tn extends _ {
|
|
|
5636
5805
|
return this.rowKeyMap.get(e)?.data;
|
|
5637
5806
|
}
|
|
5638
5807
|
expandToKey(e) {
|
|
5639
|
-
this.expandedKeys =
|
|
5808
|
+
this.expandedKeys = sn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5640
5809
|
}
|
|
5641
5810
|
}
|
|
5642
|
-
function
|
|
5811
|
+
function dn(a, e, t) {
|
|
5643
5812
|
const i = [...a.undoStack, e];
|
|
5644
5813
|
for (; i.length > t; )
|
|
5645
5814
|
i.shift();
|
|
@@ -5648,7 +5817,7 @@ function ln(a, e, t) {
|
|
|
5648
5817
|
redoStack: []
|
|
5649
5818
|
};
|
|
5650
5819
|
}
|
|
5651
|
-
function
|
|
5820
|
+
function Ze(a) {
|
|
5652
5821
|
if (a.undoStack.length === 0)
|
|
5653
5822
|
return { newState: a, action: null };
|
|
5654
5823
|
const e = [...a.undoStack], t = e.pop();
|
|
@@ -5660,7 +5829,7 @@ function Xe(a) {
|
|
|
5660
5829
|
action: t
|
|
5661
5830
|
} : { newState: a, action: null };
|
|
5662
5831
|
}
|
|
5663
|
-
function
|
|
5832
|
+
function Qe(a) {
|
|
5664
5833
|
if (a.redoStack.length === 0)
|
|
5665
5834
|
return { newState: a, action: null };
|
|
5666
5835
|
const e = [...a.redoStack], t = e.pop();
|
|
@@ -5672,16 +5841,16 @@ function Ze(a) {
|
|
|
5672
5841
|
action: t
|
|
5673
5842
|
} : { newState: a, action: null };
|
|
5674
5843
|
}
|
|
5675
|
-
function
|
|
5844
|
+
function cn(a) {
|
|
5676
5845
|
return a.undoStack.length > 0;
|
|
5677
5846
|
}
|
|
5678
|
-
function
|
|
5847
|
+
function un(a) {
|
|
5679
5848
|
return a.redoStack.length > 0;
|
|
5680
5849
|
}
|
|
5681
|
-
function
|
|
5850
|
+
function hn() {
|
|
5682
5851
|
return { undoStack: [], redoStack: [] };
|
|
5683
5852
|
}
|
|
5684
|
-
function
|
|
5853
|
+
function fn(a, e, t, i) {
|
|
5685
5854
|
return {
|
|
5686
5855
|
type: "cell-edit",
|
|
5687
5856
|
rowIndex: a,
|
|
@@ -5691,7 +5860,7 @@ function hn(a, e, t, i) {
|
|
|
5691
5860
|
timestamp: Date.now()
|
|
5692
5861
|
};
|
|
5693
5862
|
}
|
|
5694
|
-
class
|
|
5863
|
+
class Fn extends _ {
|
|
5695
5864
|
static dependencies = [
|
|
5696
5865
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5697
5866
|
];
|
|
@@ -5717,7 +5886,7 @@ class In extends _ {
|
|
|
5717
5886
|
onKeyDown(e) {
|
|
5718
5887
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5719
5888
|
if (t) {
|
|
5720
|
-
const n =
|
|
5889
|
+
const n = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5721
5890
|
if (n.action) {
|
|
5722
5891
|
const r = this.rows;
|
|
5723
5892
|
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", {
|
|
@@ -5728,7 +5897,7 @@ class In extends _ {
|
|
|
5728
5897
|
return !0;
|
|
5729
5898
|
}
|
|
5730
5899
|
if (i) {
|
|
5731
|
-
const n =
|
|
5900
|
+
const n = Qe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5732
5901
|
if (n.action) {
|
|
5733
5902
|
const r = this.rows;
|
|
5734
5903
|
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", {
|
|
@@ -5741,7 +5910,7 @@ class In extends _ {
|
|
|
5741
5910
|
return !1;
|
|
5742
5911
|
}
|
|
5743
5912
|
recordEdit(e, t, i, n) {
|
|
5744
|
-
const r =
|
|
5913
|
+
const r = fn(e, t, i, n), o = dn(
|
|
5745
5914
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5746
5915
|
r,
|
|
5747
5916
|
this.config.maxHistorySize ?? 100
|
|
@@ -5749,7 +5918,7 @@ class In extends _ {
|
|
|
5749
5918
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5750
5919
|
}
|
|
5751
5920
|
undo() {
|
|
5752
|
-
const e =
|
|
5921
|
+
const e = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5753
5922
|
if (e.action) {
|
|
5754
5923
|
const t = this.rows;
|
|
5755
5924
|
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();
|
|
@@ -5757,7 +5926,7 @@ class In extends _ {
|
|
|
5757
5926
|
return e.action;
|
|
5758
5927
|
}
|
|
5759
5928
|
redo() {
|
|
5760
|
-
const e =
|
|
5929
|
+
const e = Qe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5761
5930
|
if (e.action) {
|
|
5762
5931
|
const t = this.rows;
|
|
5763
5932
|
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();
|
|
@@ -5765,13 +5934,13 @@ class In extends _ {
|
|
|
5765
5934
|
return e.action;
|
|
5766
5935
|
}
|
|
5767
5936
|
canUndo() {
|
|
5768
|
-
return
|
|
5937
|
+
return cn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5769
5938
|
}
|
|
5770
5939
|
canRedo() {
|
|
5771
|
-
return
|
|
5940
|
+
return un({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5772
5941
|
}
|
|
5773
5942
|
clearHistory() {
|
|
5774
|
-
const e =
|
|
5943
|
+
const e = hn();
|
|
5775
5944
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5776
5945
|
}
|
|
5777
5946
|
getUndoStack() {
|
|
@@ -5781,8 +5950,8 @@ class In extends _ {
|
|
|
5781
5950
|
return [...this.redoStack];
|
|
5782
5951
|
}
|
|
5783
5952
|
}
|
|
5784
|
-
const
|
|
5785
|
-
function
|
|
5953
|
+
const gn = '@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))}}';
|
|
5954
|
+
function Je(a) {
|
|
5786
5955
|
const e = a.meta ?? {};
|
|
5787
5956
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5788
5957
|
}
|
|
@@ -5792,7 +5961,7 @@ class V extends _ {
|
|
|
5792
5961
|
];
|
|
5793
5962
|
name = "visibility";
|
|
5794
5963
|
static PANEL_ID = "columns";
|
|
5795
|
-
styles =
|
|
5964
|
+
styles = gn;
|
|
5796
5965
|
get defaultConfig() {
|
|
5797
5966
|
return {
|
|
5798
5967
|
allowHideAll: !1
|
|
@@ -5882,7 +6051,7 @@ class V extends _ {
|
|
|
5882
6051
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5883
6052
|
for (let n = 0; n < i.length; n++) {
|
|
5884
6053
|
const r = i[n], o = r.header || r.field, s = document.createElement("div");
|
|
5885
|
-
s.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", s.setAttribute("data-field", r.field), s.setAttribute("data-index", String(n)), t &&
|
|
6054
|
+
s.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", s.setAttribute("data-field", r.field), s.setAttribute("data-index", String(n)), t && Je(r) && (s.draggable = !0, s.classList.add("reorderable"), this.setupDragListeners(s, r.field, n, e));
|
|
5886
6055
|
const l = document.createElement("label");
|
|
5887
6056
|
l.className = "tbw-visibility-label";
|
|
5888
6057
|
const d = document.createElement("input");
|
|
@@ -5890,7 +6059,7 @@ class V extends _ {
|
|
|
5890
6059
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5891
6060
|
});
|
|
5892
6061
|
const c = document.createElement("span");
|
|
5893
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
6062
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Je(r)) {
|
|
5894
6063
|
const u = document.createElement("span");
|
|
5895
6064
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", s.appendChild(u);
|
|
5896
6065
|
}
|
|
@@ -5931,49 +6100,49 @@ class V extends _ {
|
|
|
5931
6100
|
}
|
|
5932
6101
|
export {
|
|
5933
6102
|
_ as BaseGridPlugin,
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
6103
|
+
mn as ClipboardPlugin,
|
|
6104
|
+
wn as ColumnVirtualizationPlugin,
|
|
6105
|
+
nt as ContextMenuPlugin,
|
|
6106
|
+
Mn as DEFAULT_ANIMATION_CONFIG,
|
|
6107
|
+
ft as DEFAULT_GRID_ICONS,
|
|
6108
|
+
Nn as DGEvents,
|
|
6109
|
+
qn as DataGridElement,
|
|
6110
|
+
bn as EditingPlugin,
|
|
6111
|
+
vn as ExportPlugin,
|
|
5943
6112
|
q as FilteringPlugin,
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
6113
|
+
Hn as FitModeEnum,
|
|
6114
|
+
Kn as GridCSSVars,
|
|
6115
|
+
zn as GridClasses,
|
|
6116
|
+
On as GridDataAttrs,
|
|
6117
|
+
Gn as GridElement,
|
|
6118
|
+
Bn as GridSelectors,
|
|
6119
|
+
yn as GroupingColumnsPlugin,
|
|
6120
|
+
xn as GroupingRowsPlugin,
|
|
6121
|
+
rt as MasterDetailPlugin,
|
|
6122
|
+
Cn as MultiSortPlugin,
|
|
6123
|
+
Vn as PLUGIN_QUERIES,
|
|
6124
|
+
En as PinnedColumnsPlugin,
|
|
6125
|
+
Rn as PinnedRowsPlugin,
|
|
5957
6126
|
B as PivotPlugin,
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
6127
|
+
Wn as PluginEvents,
|
|
6128
|
+
$n as PluginManager,
|
|
6129
|
+
Sn as PrintPlugin,
|
|
5961
6130
|
$i as ROW_DRAG_HANDLE_FIELD,
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
6131
|
+
jn as RenderPhase,
|
|
6132
|
+
kn as ReorderPlugin,
|
|
6133
|
+
An as ResponsivePlugin,
|
|
6134
|
+
_n as RowReorderPlugin,
|
|
6135
|
+
Tn as SelectionPlugin,
|
|
5967
6136
|
Ln as ServerSidePlugin,
|
|
5968
|
-
|
|
5969
|
-
|
|
6137
|
+
In as TreePlugin,
|
|
6138
|
+
Fn as UndoRedoPlugin,
|
|
5970
6139
|
V as VisibilityPlugin,
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
6140
|
+
Un as builtInSort,
|
|
6141
|
+
Yn as createGrid,
|
|
6142
|
+
Xn as defaultComparator,
|
|
5974
6143
|
Dt as defaultEditorFor,
|
|
5975
6144
|
Ct as defaultPasteHandler,
|
|
5976
6145
|
Ki as printGridIsolated,
|
|
5977
|
-
|
|
6146
|
+
Zn as queryGrid
|
|
5978
6147
|
};
|
|
5979
6148
|
//# sourceMappingURL=all.js.map
|