@toolbox-web/grid 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -41
- package/all.js +1045 -935
- package/all.js.map +1 -1
- package/index.js +39 -33
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +12 -2
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/types.d.ts +34 -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/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +155 -145
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +31 -0
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/filter-model.d.ts +30 -3
- package/lib/plugins/filtering/filter-model.d.ts.map +1 -1
- package/lib/plugins/filtering/index.d.ts +1 -0
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +471 -361
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/filtering/types.d.ts +32 -0
- package/lib/plugins/filtering/types.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +4 -0
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +49 -39
- 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 +81 -78
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +58 -55
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +5 -2
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.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/umd/grid.all.umd.js +29 -29
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +2 -2
- package/umd/grid.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/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGridPlugin as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
1
|
+
import { BaseGridPlugin as F, DEFAULT_GRID_ICONS as yt, F as G, e as q, s as xt, c as Ct, runAggregator as ae, a as at, b as lt, g as te, r as Et, getAggregator as Se, getValueAggregator as Rt, d as ke, f as Ae } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Yn, DGEvents as Xn, DataGridElement as Qn, FitModeEnum as Zn, GridCSSVars as Jn, GridClasses as er, GridDataAttrs as tr, DataGridElement as ir, GridSelectors as nr, PLUGIN_QUERIES as rr, PluginEvents as or, PluginManager as sr, RenderPhase as ar, builtInSort as lr, createGrid as dr, defaultComparator as cr, queryGrid as ur } from "./index.js";
|
|
3
3
|
function ie(a, e, t = !0) {
|
|
4
4
|
let i = a;
|
|
5
5
|
if (t && (i = i.filter((n) => !n.hidden && !n.field.startsWith("__") && n.meta?.utility !== !0)), e?.length) {
|
|
@@ -8,13 +8,13 @@ function ie(a, e, t = !0) {
|
|
|
8
8
|
}
|
|
9
9
|
return i;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function me(a, e) {
|
|
12
12
|
return e?.length ? [...e].sort((t, i) => t - i).map((t) => a[t]).filter((t) => t != null) : a;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function St(a) {
|
|
15
15
|
return a == null ? "" : a instanceof Date ? a.toISOString() : typeof a == "object" ? JSON.stringify(a) : String(a);
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
17
|
+
async function kt(a) {
|
|
18
18
|
try {
|
|
19
19
|
return await navigator.clipboard.writeText(a), !0;
|
|
20
20
|
} catch (e) {
|
|
@@ -25,7 +25,7 @@ async function St(a) {
|
|
|
25
25
|
return document.body.removeChild(t), i;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function _e(a, e) {
|
|
29
29
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
30
30
|
`, n = a.replace(/\r\n/g, `
|
|
31
31
|
`).replace(/\r/g, `
|
|
@@ -37,14 +37,14 @@ function Ae(a, e) {
|
|
|
37
37
|
}
|
|
38
38
|
return o.push(s), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
|
|
39
39
|
}
|
|
40
|
-
async function
|
|
40
|
+
async function At() {
|
|
41
41
|
try {
|
|
42
42
|
return await navigator.clipboard.readText();
|
|
43
43
|
} catch {
|
|
44
44
|
return "";
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function _t(a, e) {
|
|
48
48
|
const { rows: t, target: i, fields: n } = a;
|
|
49
49
|
if (!i) return;
|
|
50
50
|
const r = e.rows, o = e.effectiveConfig.columns ?? [], s = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
@@ -69,7 +69,7 @@ function At(a, e) {
|
|
|
69
69
|
}
|
|
70
70
|
}), e.rows = d;
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class Tn extends F {
|
|
73
73
|
static dependencies = [
|
|
74
74
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
75
75
|
];
|
|
@@ -96,9 +96,9 @@ class _n extends I {
|
|
|
96
96
|
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (e.preventDefault(), this.#t(e.target), !0) : !1;
|
|
97
97
|
}
|
|
98
98
|
#t(e) {
|
|
99
|
-
const t = this.#
|
|
99
|
+
const t = this.#s();
|
|
100
100
|
if (t && t.ranges.length === 0) {
|
|
101
|
-
const i = this.#
|
|
101
|
+
const i = this.#r(e);
|
|
102
102
|
if (!i) return;
|
|
103
103
|
const n = this.columns[i.col];
|
|
104
104
|
if (!n) return;
|
|
@@ -111,10 +111,10 @@ class _n extends I {
|
|
|
111
111
|
const t = e.clipboardData?.getData("text/plain");
|
|
112
112
|
if (!t) return;
|
|
113
113
|
e.preventDefault();
|
|
114
|
-
const i =
|
|
114
|
+
const i = _e(t, this.config), n = this.#s(), 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;
|
|
115
115
|
for (let m = 0; m < g && s + m <= c; m++) {
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const x = this.columns[s + m];
|
|
117
|
+
x && !x.hidden && f.push(x.field);
|
|
118
118
|
}
|
|
119
119
|
const p = { rows: i, text: t, target: h, fields: f };
|
|
120
120
|
this.emit("paste", p), this.#o(p);
|
|
@@ -123,13 +123,13 @@ class _n extends I {
|
|
|
123
123
|
if (!this.grid) return;
|
|
124
124
|
const { pasteHandler: t } = this.config;
|
|
125
125
|
if (t === null) return;
|
|
126
|
-
(t ??
|
|
126
|
+
(t ?? _t)(e, this.grid);
|
|
127
127
|
}
|
|
128
|
-
#
|
|
128
|
+
#s() {
|
|
129
129
|
return this.grid?.query("getSelection")?.[0];
|
|
130
130
|
}
|
|
131
131
|
#i(e) {
|
|
132
|
-
const t = this.#
|
|
132
|
+
const t = this.#s();
|
|
133
133
|
let i;
|
|
134
134
|
if (e?.columns)
|
|
135
135
|
i = ie(this.columns, e.columns);
|
|
@@ -140,7 +140,7 @@ class _n extends I {
|
|
|
140
140
|
i = ie(this.columns);
|
|
141
141
|
let n;
|
|
142
142
|
if (e?.rowIndices)
|
|
143
|
-
n =
|
|
143
|
+
n = me(this.rows, e.rowIndices);
|
|
144
144
|
else if (t?.ranges.length) {
|
|
145
145
|
const r = t.ranges[t.ranges.length - 1], o = Math.min(r.from.row, r.to.row), s = Math.max(r.from.row, r.to.row);
|
|
146
146
|
n = [];
|
|
@@ -159,13 +159,13 @@ class _n extends I {
|
|
|
159
159
|
for (const d of t) {
|
|
160
160
|
const c = e.map((u) => {
|
|
161
161
|
const h = d[u.field];
|
|
162
|
-
return s ? s(h, u.field, d) :
|
|
162
|
+
return s ? s(h, u.field, d) : St(h);
|
|
163
163
|
});
|
|
164
164
|
l.push(c.join(n));
|
|
165
165
|
}
|
|
166
166
|
return l.join(r);
|
|
167
167
|
}
|
|
168
|
-
#
|
|
168
|
+
#r(e) {
|
|
169
169
|
const t = e.closest("[data-field-cache]");
|
|
170
170
|
if (!t) return null;
|
|
171
171
|
const i = t.dataset.fieldCache, n = t.dataset.row;
|
|
@@ -184,7 +184,7 @@ class _n extends I {
|
|
|
184
184
|
if (t.length === 0 || i.length === 0)
|
|
185
185
|
return "";
|
|
186
186
|
const n = this.#n(t, i, e);
|
|
187
|
-
return await
|
|
187
|
+
return await kt(n), this.lastCopied = { text: n, timestamp: Date.now() }, this.emit("copy", {
|
|
188
188
|
text: n,
|
|
189
189
|
rowCount: i.length,
|
|
190
190
|
columnCount: t.length
|
|
@@ -194,40 +194,40 @@ class _n extends I {
|
|
|
194
194
|
return e.length === 0 ? "" : this.copy({ ...t, rowIndices: e });
|
|
195
195
|
}
|
|
196
196
|
async paste() {
|
|
197
|
-
const e = await
|
|
198
|
-
return e ?
|
|
197
|
+
const e = await At();
|
|
198
|
+
return e ? _e(e, this.config) : null;
|
|
199
199
|
}
|
|
200
200
|
getLastCopied() {
|
|
201
201
|
return this.lastCopied;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
function
|
|
204
|
+
const Le = 100;
|
|
205
|
+
function ye(a) {
|
|
206
206
|
if (a == null)
|
|
207
|
-
return
|
|
207
|
+
return Le;
|
|
208
208
|
if (typeof a == "number")
|
|
209
209
|
return a;
|
|
210
210
|
const e = parseFloat(a);
|
|
211
|
-
return isNaN(e) ?
|
|
212
|
-
}
|
|
213
|
-
function Le(a) {
|
|
214
|
-
return a.map((e) => ve(e.width));
|
|
211
|
+
return isNaN(e) ? Le : e;
|
|
215
212
|
}
|
|
216
213
|
function Te(a) {
|
|
214
|
+
return a.map((e) => ye(e.width));
|
|
215
|
+
}
|
|
216
|
+
function Ie(a) {
|
|
217
217
|
const e = [];
|
|
218
218
|
let t = 0;
|
|
219
219
|
for (const i of a)
|
|
220
|
-
e.push(t), t +=
|
|
220
|
+
e.push(t), t += ye(i.width);
|
|
221
221
|
return e;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
return a.reduce((e, t) => e +
|
|
223
|
+
function Fe(a) {
|
|
224
|
+
return a.reduce((e, t) => e + ye(t.width), 0);
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Lt(a, e, t, i, n) {
|
|
227
227
|
const r = t.length;
|
|
228
228
|
if (r === 0)
|
|
229
229
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
230
|
-
let o =
|
|
230
|
+
let o = Tt(a, t, i);
|
|
231
231
|
o = Math.max(0, o - n);
|
|
232
232
|
const s = a + e;
|
|
233
233
|
let l = o;
|
|
@@ -244,7 +244,7 @@ function _t(a, e, t, i, n) {
|
|
|
244
244
|
d.push(c);
|
|
245
245
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Tt(a, e, t) {
|
|
248
248
|
let i = 0, n = e.length - 1;
|
|
249
249
|
for (; i < n; ) {
|
|
250
250
|
const r = Math.floor((i + n) / 2);
|
|
@@ -252,10 +252,10 @@ function Lt(a, e, t) {
|
|
|
252
252
|
}
|
|
253
253
|
return i;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function It(a, e, t) {
|
|
256
256
|
return t ? a > e : !1;
|
|
257
257
|
}
|
|
258
|
-
class
|
|
258
|
+
class In extends F {
|
|
259
259
|
name = "columnVirtualization";
|
|
260
260
|
get defaultConfig() {
|
|
261
261
|
return {
|
|
@@ -275,7 +275,7 @@ class Ln extends I {
|
|
|
275
275
|
attach(e) {
|
|
276
276
|
super.attach(e);
|
|
277
277
|
const t = this.columns;
|
|
278
|
-
this.columnWidths =
|
|
278
|
+
this.columnWidths = Te(t), this.columnOffsets = Ie(t), this.totalWidth = Fe(t), this.endCol = t.length - 1;
|
|
279
279
|
}
|
|
280
280
|
detach() {
|
|
281
281
|
this.#t(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
@@ -293,15 +293,15 @@ class Ln extends I {
|
|
|
293
293
|
r && (r.style.minWidth = "");
|
|
294
294
|
}
|
|
295
295
|
processColumns(e) {
|
|
296
|
-
(this.originalColumns.length === 0 || e.length >= this.originalColumns.length) && (this.originalColumns = e, this.columnWidths =
|
|
297
|
-
const i = this.originalColumns, n =
|
|
296
|
+
(this.originalColumns.length === 0 || e.length >= this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Te(e), this.columnOffsets = Ie(e), this.totalWidth = Fe(e));
|
|
297
|
+
const i = this.originalColumns, n = It(
|
|
298
298
|
i.length,
|
|
299
299
|
this.config.threshold ?? 30,
|
|
300
300
|
this.config.autoEnable ?? !0
|
|
301
301
|
);
|
|
302
302
|
if (this.isVirtualized = n ?? !1, !n)
|
|
303
303
|
return this.startCol = 0, this.endCol = i.length - 1, [...i];
|
|
304
|
-
const r = this.grid.clientWidth || 800, o =
|
|
304
|
+
const r = this.grid.clientWidth || 800, o = Lt(
|
|
305
305
|
this.scrollLeft,
|
|
306
306
|
r,
|
|
307
307
|
this.columnOffsets,
|
|
@@ -343,20 +343,20 @@ class Ln extends I {
|
|
|
343
343
|
return this.totalWidth;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
const
|
|
347
|
-
function
|
|
346
|
+
const le = "@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 kbd{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}}";
|
|
347
|
+
function be(a, e) {
|
|
348
348
|
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Pe(a) {
|
|
351
351
|
const e = [];
|
|
352
352
|
for (const t of a)
|
|
353
353
|
t.separator && (e.length === 0 || e[e.length - 1].separator) || e.push(t);
|
|
354
354
|
return e.length > 0 && e[e.length - 1].separator && e.pop(), e;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function Ft(a, e) {
|
|
357
357
|
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function we(a, e, t, i = yt.submenuArrow) {
|
|
360
360
|
const n = document.createElement("div");
|
|
361
361
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
362
362
|
const r = a.some((o) => !o.separator && o.icon);
|
|
@@ -368,7 +368,7 @@ function be(a, e, t, i = vt.submenuArrow) {
|
|
|
368
368
|
}
|
|
369
369
|
const s = document.createElement("div");
|
|
370
370
|
s.className = "tbw-context-menu-item", o.cssClass && s.classList.add(o.cssClass), s.setAttribute("role", "menuitem"), s.setAttribute("data-id", o.id);
|
|
371
|
-
const l =
|
|
371
|
+
const l = Ft(o, e);
|
|
372
372
|
if (l && (s.classList.add("disabled"), s.setAttribute("aria-disabled", "true")), o.icon) {
|
|
373
373
|
const c = document.createElement("span");
|
|
374
374
|
c.className = "tbw-context-menu-icon", c.innerHTML = o.icon, s.appendChild(c);
|
|
@@ -395,7 +395,7 @@ function be(a, e, t, i = vt.submenuArrow) {
|
|
|
395
395
|
const c = document.createElement("span");
|
|
396
396
|
c.className = "tbw-context-menu-arrow", typeof i == "string" ? c.innerHTML = i : i instanceof HTMLElement && c.appendChild(i.cloneNode(!0)), s.appendChild(c), s.addEventListener("mouseenter", () => {
|
|
397
397
|
if (s.querySelector(".tbw-context-menu") || !o.subMenu) return;
|
|
398
|
-
const h =
|
|
398
|
+
const h = be(o.subMenu, e), f = we(h, e, t, i);
|
|
399
399
|
f.classList.add("tbw-context-submenu"), f.style.position = "absolute", f.style.left = "100%", f.style.top = "0", s.style.position = "relative", s.appendChild(f);
|
|
400
400
|
}), s.addEventListener("mouseleave", () => {
|
|
401
401
|
const u = s.querySelector(".tbw-context-menu");
|
|
@@ -408,15 +408,15 @@ function be(a, e, t, i = vt.submenuArrow) {
|
|
|
408
408
|
}
|
|
409
409
|
return n;
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function Me(a, e, t) {
|
|
412
412
|
a.style.position = "fixed", a.style.left = `${e}px`, a.style.top = `${t}px`, a.style.visibility = "hidden", a.style.zIndex = "10000";
|
|
413
413
|
const i = a.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
414
414
|
let o = e, s = t;
|
|
415
415
|
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";
|
|
416
416
|
}
|
|
417
417
|
const De = "getContextMenuItems";
|
|
418
|
-
let V = null, $ = null, K = null,
|
|
419
|
-
const
|
|
418
|
+
let V = null, $ = null, K = null, de = 0;
|
|
419
|
+
const ce = [
|
|
420
420
|
{
|
|
421
421
|
id: "copy",
|
|
422
422
|
name: "Copy",
|
|
@@ -434,7 +434,7 @@ const de = [
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
];
|
|
437
|
-
class
|
|
437
|
+
class dt extends F {
|
|
438
438
|
static manifest = {
|
|
439
439
|
queries: [
|
|
440
440
|
{
|
|
@@ -446,7 +446,7 @@ class lt extends I {
|
|
|
446
446
|
name = "contextMenu";
|
|
447
447
|
get defaultConfig() {
|
|
448
448
|
return {
|
|
449
|
-
items:
|
|
449
|
+
items: ce
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
452
|
isOpen = !1;
|
|
@@ -454,7 +454,7 @@ class lt extends I {
|
|
|
454
454
|
params = null;
|
|
455
455
|
menuElement = null;
|
|
456
456
|
attach(e) {
|
|
457
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
457
|
+
super.attach(e), this.installGlobalHandlers(), de++;
|
|
458
458
|
}
|
|
459
459
|
detach() {
|
|
460
460
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
@@ -504,7 +504,7 @@ class lt extends I {
|
|
|
504
504
|
if (!t) return;
|
|
505
505
|
const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
|
|
506
506
|
r && n.push(`color-scheme: ${r}`);
|
|
507
|
-
for (const o of
|
|
507
|
+
for (const o of dt.CSS_VARS_TO_COPY) {
|
|
508
508
|
const s = i.getPropertyValue(o).trim();
|
|
509
509
|
s && n.push(`${o}: ${s}`);
|
|
510
510
|
}
|
|
@@ -514,14 +514,14 @@ class lt extends I {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
installGlobalHandlers() {
|
|
517
|
-
!K && typeof document < "u" && typeof
|
|
517
|
+
!K && typeof document < "u" && typeof le == "string" && le && (K = document.createElement("style"), K.id = "tbw-context-menu-styles", K.textContent = le, document.head.appendChild(K)), V || (V = () => {
|
|
518
518
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
519
519
|
}, document.addEventListener("click", V)), $ || ($ = (e) => {
|
|
520
520
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
521
521
|
}, document.addEventListener("keydown", $));
|
|
522
522
|
}
|
|
523
523
|
uninstallGlobalHandlers() {
|
|
524
|
-
|
|
524
|
+
de--, !(de > 0) && (V && (document.removeEventListener("click", V), V = null), $ && (document.removeEventListener("keydown", $), $ = null), K && (K.remove(), K = null));
|
|
525
525
|
}
|
|
526
526
|
collectPluginItems(e) {
|
|
527
527
|
if (!this.grid) return [];
|
|
@@ -601,19 +601,19 @@ class lt extends I {
|
|
|
601
601
|
return;
|
|
602
602
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
603
603
|
const d = this.collectPluginItems(l);
|
|
604
|
-
let c =
|
|
604
|
+
let c = be(this.config.items ?? ce, l);
|
|
605
605
|
if (d.length > 0) {
|
|
606
606
|
const u = this.convertPluginItems(d);
|
|
607
607
|
c.length > 0 && u.length > 0 ? c = [...c, { id: "__plugin-sep", name: "", separator: !0 }, ...u] : c = [...c, ...u];
|
|
608
608
|
}
|
|
609
|
-
c =
|
|
609
|
+
c = Pe(c), c.length && (this.menuElement && this.menuElement.remove(), this.menuElement = we(
|
|
610
610
|
c,
|
|
611
611
|
l,
|
|
612
612
|
(u) => {
|
|
613
613
|
u.action && u.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
614
614
|
},
|
|
615
615
|
this.gridIcons.submenuArrow
|
|
616
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
616
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Me(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: c }));
|
|
617
617
|
}));
|
|
618
618
|
}
|
|
619
619
|
showMenu(e, t, i) {
|
|
@@ -628,19 +628,19 @@ class lt extends I {
|
|
|
628
628
|
event: i.event ?? new MouseEvent("contextmenu"),
|
|
629
629
|
selectedRows: i.selectedRows ?? []
|
|
630
630
|
}, r = this.collectPluginItems(n);
|
|
631
|
-
let o =
|
|
631
|
+
let o = be(this.config.items ?? ce, n);
|
|
632
632
|
if (r.length > 0) {
|
|
633
633
|
const s = this.convertPluginItems(r);
|
|
634
634
|
o.length > 0 && s.length > 0 ? o = [...o, { id: "__plugin-sep", name: "", separator: !0 }, ...s] : o = [...o, ...s];
|
|
635
635
|
}
|
|
636
|
-
o =
|
|
636
|
+
o = Pe(o), this.menuElement && this.menuElement.remove(), this.menuElement = we(
|
|
637
637
|
o,
|
|
638
638
|
n,
|
|
639
639
|
(s) => {
|
|
640
640
|
s.action && s.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
641
641
|
},
|
|
642
642
|
this.gridIcons.submenuArrow
|
|
643
|
-
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement),
|
|
643
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Me(this.menuElement, e, t), this.isOpen = !0;
|
|
644
644
|
}
|
|
645
645
|
hideMenu() {
|
|
646
646
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -649,8 +649,8 @@ class lt extends I {
|
|
|
649
649
|
return this.isOpen;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
const
|
|
653
|
-
function
|
|
652
|
+
const Pt = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;&:not(.tbw-grid-mode) .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171);.data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}}";
|
|
653
|
+
function Mt(a) {
|
|
654
654
|
const e = a.options;
|
|
655
655
|
return e ? typeof e == "function" ? e() : e : [];
|
|
656
656
|
}
|
|
@@ -664,13 +664,13 @@ function Dt(a) {
|
|
|
664
664
|
}), i;
|
|
665
665
|
};
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function qt() {
|
|
668
668
|
return (a) => {
|
|
669
669
|
const e = document.createElement("input");
|
|
670
670
|
return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function Nt(a) {
|
|
674
674
|
return (e) => {
|
|
675
675
|
const t = a.editorParams, i = document.createElement("input");
|
|
676
676
|
i.type = "date", e.value instanceof Date ? i.valueAsDate = e.value : typeof e.value == "string" && e.value && (i.value = e.value.split("T")[0]), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -682,14 +682,14 @@ function qt(a) {
|
|
|
682
682
|
}), i;
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Ht(a) {
|
|
686
686
|
return (e) => {
|
|
687
687
|
const t = a.editorParams, i = document.createElement("select");
|
|
688
688
|
if (a.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
689
689
|
const o = document.createElement("option");
|
|
690
690
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
691
691
|
}
|
|
692
|
-
|
|
692
|
+
Mt(a).forEach((o) => {
|
|
693
693
|
const s = document.createElement("option");
|
|
694
694
|
s.value = String(o.value), s.textContent = o.label, (a.multi && Array.isArray(e.value) && e.value.includes(o.value) || !a.multi && e.value === o.value) && (s.selected = !0), i.appendChild(s);
|
|
695
695
|
});
|
|
@@ -705,7 +705,7 @@ function Nt(a) {
|
|
|
705
705
|
}), i;
|
|
706
706
|
};
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function Gt(a) {
|
|
709
709
|
return (e) => {
|
|
710
710
|
const t = a.editorParams, i = document.createElement("input");
|
|
711
711
|
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);
|
|
@@ -718,21 +718,21 @@ function Ht(a) {
|
|
|
718
718
|
}), i;
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function Kt(a) {
|
|
722
722
|
switch (a.type) {
|
|
723
723
|
case "number":
|
|
724
724
|
return Dt(a);
|
|
725
725
|
case "boolean":
|
|
726
|
-
return
|
|
726
|
+
return qt();
|
|
727
727
|
case "date":
|
|
728
|
-
return qt(a);
|
|
729
|
-
case "select":
|
|
730
728
|
return Nt(a);
|
|
731
|
-
|
|
729
|
+
case "select":
|
|
732
730
|
return Ht(a);
|
|
731
|
+
default:
|
|
732
|
+
return Gt(a);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function zt(a, e) {
|
|
736
736
|
if (e.editor) return e.editor;
|
|
737
737
|
if (e.__editorTemplate) return "template";
|
|
738
738
|
if (!e.type) return;
|
|
@@ -749,25 +749,25 @@ function Kt(a, e) {
|
|
|
749
749
|
function Z(a) {
|
|
750
750
|
return !(typeof a != "string" || a === "__proto__" || a === "constructor" || a === "prototype");
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Ot(a) {
|
|
753
753
|
const e = (a.__editingCellCount ?? 0) + 1;
|
|
754
754
|
a.__editingCellCount = e, a.setAttribute("data-has-editing", "");
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function Bt(a) {
|
|
757
757
|
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
758
758
|
}
|
|
759
759
|
function Y(a, e, t) {
|
|
760
760
|
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;
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function qe(a) {
|
|
763
763
|
}
|
|
764
|
-
function
|
|
764
|
+
function Vt(a, e, t, i) {
|
|
765
765
|
const n = a.querySelector("input,textarea,select");
|
|
766
766
|
n && (n.addEventListener("blur", () => {
|
|
767
767
|
t(Y(n, e, i));
|
|
768
768
|
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(Y(n, e, i))));
|
|
769
769
|
}
|
|
770
|
-
class
|
|
770
|
+
class Fn extends F {
|
|
771
771
|
static manifest = {
|
|
772
772
|
ownedProperties: [
|
|
773
773
|
{
|
|
@@ -801,7 +801,7 @@ class Tn extends I {
|
|
|
801
801
|
]
|
|
802
802
|
};
|
|
803
803
|
name = "editing";
|
|
804
|
-
styles =
|
|
804
|
+
styles = Pt;
|
|
805
805
|
get defaultConfig() {
|
|
806
806
|
return {
|
|
807
807
|
mode: "row",
|
|
@@ -812,17 +812,19 @@ class Tn extends I {
|
|
|
812
812
|
return this.config.mode === "grid";
|
|
813
813
|
}
|
|
814
814
|
#e = -1;
|
|
815
|
-
#o
|
|
816
|
-
#
|
|
817
|
-
#i =
|
|
818
|
-
#n = /* @__PURE__ */ new
|
|
819
|
-
#
|
|
820
|
-
#
|
|
821
|
-
#
|
|
815
|
+
#o;
|
|
816
|
+
#s;
|
|
817
|
+
#i = -1;
|
|
818
|
+
#n = /* @__PURE__ */ new Map();
|
|
819
|
+
#r = /* @__PURE__ */ new Set();
|
|
820
|
+
#l = /* @__PURE__ */ new Set();
|
|
821
|
+
#f = /* @__PURE__ */ new Map();
|
|
822
|
+
#b = !1;
|
|
823
|
+
#p = -1;
|
|
822
824
|
#a = /* @__PURE__ */ new Map();
|
|
823
|
-
#
|
|
825
|
+
#c = !1;
|
|
826
|
+
#d = !1;
|
|
824
827
|
#g = !1;
|
|
825
|
-
#m = !1;
|
|
826
828
|
attach(e) {
|
|
827
829
|
super.attach(e);
|
|
828
830
|
const t = this.disconnectSignal, i = e;
|
|
@@ -840,7 +842,7 @@ class Tn extends I {
|
|
|
840
842
|
if (!this.#t && n.key === "Escape" && this.#e !== -1) {
|
|
841
843
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
842
844
|
return;
|
|
843
|
-
this.#
|
|
845
|
+
this.#h(this.#e, !0);
|
|
844
846
|
}
|
|
845
847
|
},
|
|
846
848
|
{ capture: !0, signal: t }
|
|
@@ -850,7 +852,7 @@ class Tn extends I {
|
|
|
850
852
|
if (this.#t || this.#e === -1) return;
|
|
851
853
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
852
854
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
|
|
853
|
-
this.#e !== -1 && this.#
|
|
855
|
+
this.#e !== -1 && this.#h(this.#e, !1);
|
|
854
856
|
});
|
|
855
857
|
},
|
|
856
858
|
{ signal: t }
|
|
@@ -859,7 +861,7 @@ class Tn extends I {
|
|
|
859
861
|
(n) => {
|
|
860
862
|
const r = n.detail;
|
|
861
863
|
if (r.source === "user") return;
|
|
862
|
-
const o = `${r.rowIndex}:${r.field}`, s = this.#
|
|
864
|
+
const o = `${r.rowIndex}:${r.field}`, s = this.#f.get(o);
|
|
863
865
|
s && s(r.newValue);
|
|
864
866
|
},
|
|
865
867
|
{ signal: t }
|
|
@@ -868,11 +870,11 @@ class Tn extends I {
|
|
|
868
870
|
(n) => {
|
|
869
871
|
const r = n.target;
|
|
870
872
|
if (r.matches(G)) {
|
|
871
|
-
if (this.#
|
|
873
|
+
if (this.#d) {
|
|
872
874
|
r.blur(), this.gridElement.focus();
|
|
873
875
|
return;
|
|
874
876
|
}
|
|
875
|
-
this.#
|
|
877
|
+
this.#c = !0;
|
|
876
878
|
}
|
|
877
879
|
},
|
|
878
880
|
{ signal: t }
|
|
@@ -880,31 +882,31 @@ class Tn extends I {
|
|
|
880
882
|
"focusout",
|
|
881
883
|
(n) => {
|
|
882
884
|
const r = n.relatedTarget;
|
|
883
|
-
(!r || !this.gridElement.contains(r) || !r.matches(G)) && (this.#
|
|
885
|
+
(!r || !this.gridElement.contains(r) || !r.matches(G)) && (this.#c = !1);
|
|
884
886
|
},
|
|
885
887
|
{ signal: t }
|
|
886
888
|
), this.gridElement.addEventListener(
|
|
887
889
|
"keydown",
|
|
888
890
|
(n) => {
|
|
889
|
-
if (n.key === "Escape" && this.#
|
|
891
|
+
if (n.key === "Escape" && this.#c) {
|
|
890
892
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
891
893
|
return;
|
|
892
894
|
const r = document.activeElement;
|
|
893
|
-
r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#
|
|
895
|
+
r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#c = !1, this.#d = !0, n.preventDefault(), n.stopPropagation();
|
|
894
896
|
}
|
|
895
897
|
},
|
|
896
898
|
{ capture: !0, signal: t }
|
|
897
899
|
), this.gridElement.addEventListener(
|
|
898
900
|
"mousedown",
|
|
899
901
|
(n) => {
|
|
900
|
-
n.target.matches(G) && (this.#
|
|
902
|
+
n.target.matches(G) && (this.#d = !1);
|
|
901
903
|
},
|
|
902
904
|
{ signal: t }
|
|
903
905
|
));
|
|
904
906
|
}
|
|
905
907
|
detach() {
|
|
906
908
|
const e = this.gridElement;
|
|
907
|
-
e._isGridEditMode = !1, this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#o = -1, this.#
|
|
909
|
+
e._isGridEditMode = !1, this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#o = void 0, this.#s = void 0, this.#i = -1, this.#n.clear(), this.#r.clear(), this.#l.clear(), this.#f.clear(), this.#c = !1, this.#d = !1, this.#g = !1, super.detach();
|
|
908
910
|
}
|
|
909
911
|
handleQuery(e) {
|
|
910
912
|
if (e.type === "isEditing")
|
|
@@ -922,30 +924,30 @@ class Tn extends I {
|
|
|
922
924
|
onKeyDown(e) {
|
|
923
925
|
const t = this.grid;
|
|
924
926
|
if (e.key === "Escape") {
|
|
925
|
-
if (this.#t && this.#
|
|
927
|
+
if (this.#t && this.#c) {
|
|
926
928
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
927
929
|
return !0;
|
|
928
930
|
const i = document.activeElement;
|
|
929
|
-
return i && this.gridElement.contains(i) && i.blur(), this.#
|
|
931
|
+
return i && this.gridElement.contains(i) && i.blur(), this.#c = !1, this.requestAfterRender(), !0;
|
|
930
932
|
}
|
|
931
933
|
if (this.#e !== -1 && !this.#t)
|
|
932
|
-
return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#
|
|
934
|
+
return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#h(this.#e, !0), !0;
|
|
933
935
|
}
|
|
934
|
-
if (this.#t && !this.#
|
|
936
|
+
if (this.#t && !this.#c && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
|
|
935
937
|
return !1;
|
|
936
|
-
if (this.#t && this.#
|
|
938
|
+
if (this.#t && this.#c && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
937
939
|
return !0;
|
|
938
940
|
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#t) {
|
|
939
941
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
940
942
|
return !0;
|
|
941
943
|
const i = t._rows.length - 1, n = this.#e;
|
|
942
|
-
return this.#
|
|
944
|
+
return this.#h(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), q(t), this.requestAfterRender(), !0;
|
|
943
945
|
}
|
|
944
946
|
if (e.key === "Tab" && (this.#e !== -1 || this.#t)) {
|
|
945
|
-
if (e.preventDefault(), this.#
|
|
946
|
-
return this.#
|
|
947
|
+
if (e.preventDefault(), this.#g)
|
|
948
|
+
return this.#h(this.#e, !1), !0;
|
|
947
949
|
const i = !e.shiftKey;
|
|
948
|
-
return this.#
|
|
950
|
+
return this.#C(i), !0;
|
|
949
951
|
}
|
|
950
952
|
if (e.key === " " || e.key === "Spacebar") {
|
|
951
953
|
if (this.#e !== -1)
|
|
@@ -957,15 +959,15 @@ class Tn extends I {
|
|
|
957
959
|
const s = r.field;
|
|
958
960
|
if (Z(s)) {
|
|
959
961
|
const d = !o[s];
|
|
960
|
-
return this.#
|
|
962
|
+
return this.#E(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
961
963
|
}
|
|
962
964
|
}
|
|
963
965
|
}
|
|
964
966
|
return !1;
|
|
965
967
|
}
|
|
966
968
|
if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
|
967
|
-
if (this.#t && !this.#
|
|
968
|
-
return this.#
|
|
969
|
+
if (this.#t && !this.#c)
|
|
970
|
+
return this.#x(), !0;
|
|
969
971
|
if (this.#e !== -1)
|
|
970
972
|
return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
|
|
971
973
|
const i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
@@ -1025,83 +1027,83 @@ class Tn extends I {
|
|
|
1025
1027
|
}
|
|
1026
1028
|
afterRender() {
|
|
1027
1029
|
const e = this.grid;
|
|
1028
|
-
if (this.#
|
|
1029
|
-
const t = this.#
|
|
1030
|
-
this.#
|
|
1030
|
+
if (this.#b && (this.#b = !1, this.#S(e)), this.#p !== -1) {
|
|
1031
|
+
const t = this.#p;
|
|
1032
|
+
this.#p = -1, e.animateRow?.(t, "change");
|
|
1031
1033
|
}
|
|
1032
|
-
if (!this.#t && this.#
|
|
1033
|
-
for (const t of this.#
|
|
1034
|
+
if (!this.#t && this.#l.size !== 0)
|
|
1035
|
+
for (const t of this.#l) {
|
|
1034
1036
|
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
1035
1037
|
if (!s) continue;
|
|
1036
1038
|
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
1037
1039
|
if (!l || l.classList.contains("editing")) continue;
|
|
1038
1040
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
1039
|
-
d && c && this.#
|
|
1041
|
+
d && c && this.#v(d, r, c, o, l, !0);
|
|
1040
1042
|
}
|
|
1041
1043
|
}
|
|
1042
1044
|
afterCellRender(e) {
|
|
1043
1045
|
if (!this.#t) return;
|
|
1044
1046
|
const { row: t, rowIndex: i, column: n, colIndex: r, cellElement: o } = e;
|
|
1045
|
-
n.editable && (o.classList.contains("editing") || this.#
|
|
1047
|
+
n.editable && (o.classList.contains("editing") || this.#v(t, i, n, r, o, !0));
|
|
1046
1048
|
}
|
|
1047
1049
|
onScrollRender() {
|
|
1048
1050
|
this.afterRender();
|
|
1049
1051
|
}
|
|
1050
1052
|
get changedRows() {
|
|
1051
1053
|
const e = [];
|
|
1052
|
-
for (const t of this.#
|
|
1054
|
+
for (const t of this.#r) {
|
|
1053
1055
|
const i = this.grid.getRow(t);
|
|
1054
1056
|
i && e.push(i);
|
|
1055
1057
|
}
|
|
1056
1058
|
return e;
|
|
1057
1059
|
}
|
|
1058
1060
|
get changedRowIds() {
|
|
1059
|
-
return Array.from(this.#
|
|
1061
|
+
return Array.from(this.#r);
|
|
1060
1062
|
}
|
|
1061
1063
|
get activeEditRow() {
|
|
1062
1064
|
return this.#e;
|
|
1063
1065
|
}
|
|
1064
1066
|
get activeEditCol() {
|
|
1065
|
-
return this.#
|
|
1067
|
+
return this.#i;
|
|
1066
1068
|
}
|
|
1067
1069
|
isRowEditing(e) {
|
|
1068
1070
|
return this.#e === e;
|
|
1069
1071
|
}
|
|
1070
1072
|
isCellEditing(e, t) {
|
|
1071
|
-
return this.#
|
|
1073
|
+
return this.#l.has(`${e}:${t}`);
|
|
1072
1074
|
}
|
|
1073
1075
|
isRowChanged(e) {
|
|
1074
1076
|
const t = this.grid, i = t._rows[e];
|
|
1075
1077
|
if (!i) return !1;
|
|
1076
1078
|
try {
|
|
1077
1079
|
const n = t.getRowId?.(i);
|
|
1078
|
-
return n ? this.#
|
|
1080
|
+
return n ? this.#r.has(n) : !1;
|
|
1079
1081
|
} catch {
|
|
1080
1082
|
return !1;
|
|
1081
1083
|
}
|
|
1082
1084
|
}
|
|
1083
1085
|
isRowChangedById(e) {
|
|
1084
|
-
return this.#
|
|
1086
|
+
return this.#r.has(e);
|
|
1085
1087
|
}
|
|
1086
1088
|
setInvalid(e, t, i = "") {
|
|
1087
1089
|
let n = this.#a.get(e);
|
|
1088
|
-
n || (n = /* @__PURE__ */ new Map(), this.#a.set(e, n)), n.set(t, i), this.#
|
|
1090
|
+
n || (n = /* @__PURE__ */ new Map(), this.#a.set(e, n)), n.set(t, i), this.#u(e, t, !0);
|
|
1089
1091
|
}
|
|
1090
1092
|
clearInvalid(e, t) {
|
|
1091
1093
|
const i = this.#a.get(e);
|
|
1092
|
-
i && (i.delete(t), i.size === 0 && this.#a.delete(e)), this.#
|
|
1094
|
+
i && (i.delete(t), i.size === 0 && this.#a.delete(e)), this.#u(e, t, !1);
|
|
1093
1095
|
}
|
|
1094
1096
|
clearRowInvalid(e) {
|
|
1095
1097
|
const t = this.#a.get(e);
|
|
1096
1098
|
if (t) {
|
|
1097
1099
|
const i = Array.from(t.keys());
|
|
1098
|
-
this.#a.delete(e), i.forEach((n) => this.#
|
|
1100
|
+
this.#a.delete(e), i.forEach((n) => this.#u(e, n, !1));
|
|
1099
1101
|
}
|
|
1100
1102
|
}
|
|
1101
1103
|
clearAllInvalid() {
|
|
1102
1104
|
const e = Array.from(this.#a.entries());
|
|
1103
1105
|
this.#a.clear(), e.forEach(([t, i]) => {
|
|
1104
|
-
i.forEach((n, r) => this.#
|
|
1106
|
+
i.forEach((n, r) => this.#u(t, r, !1));
|
|
1105
1107
|
});
|
|
1106
1108
|
}
|
|
1107
1109
|
isCellInvalid(e, t) {
|
|
@@ -1117,7 +1119,7 @@ class Tn extends I {
|
|
|
1117
1119
|
getInvalidFields(e) {
|
|
1118
1120
|
return new Map(this.#a.get(e) ?? []);
|
|
1119
1121
|
}
|
|
1120
|
-
#
|
|
1122
|
+
#u(e, t, i) {
|
|
1121
1123
|
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
1122
1124
|
if (r === -1 || r === void 0) return;
|
|
1123
1125
|
const s = n._rows?.findIndex((c) => {
|
|
@@ -1139,26 +1141,26 @@ class Tn extends I {
|
|
|
1139
1141
|
}
|
|
1140
1142
|
resetChangedRows(e) {
|
|
1141
1143
|
const t = this.changedRows, i = this.changedRowIds;
|
|
1142
|
-
this.#
|
|
1144
|
+
this.#r.clear(), this.#w(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
1143
1145
|
}
|
|
1144
1146
|
beginCellEdit(e, t) {
|
|
1145
1147
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
1146
1148
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
1147
1149
|
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
1148
|
-
s && (this.#
|
|
1150
|
+
s && (this.#g = !0, this.#m(e, n, s));
|
|
1149
1151
|
}
|
|
1150
1152
|
beginBulkEdit(e) {
|
|
1151
1153
|
const t = this.grid;
|
|
1152
1154
|
if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((s) => s.editable)) return;
|
|
1153
1155
|
const r = t.findRenderedRowElement?.(e);
|
|
1154
1156
|
if (!r) return;
|
|
1155
|
-
this.#
|
|
1157
|
+
this.#g = !1;
|
|
1156
1158
|
const o = t._rows[e];
|
|
1157
1159
|
this.#y(e, o), Array.from(r.children).forEach((s, l) => {
|
|
1158
1160
|
const d = t._visibleColumns[l];
|
|
1159
1161
|
if (d?.editable) {
|
|
1160
1162
|
const c = s;
|
|
1161
|
-
c.classList.contains("editing") || this.#
|
|
1163
|
+
c.classList.contains("editing") || this.#v(o, e, d, l, c, !0);
|
|
1162
1164
|
}
|
|
1163
1165
|
}), setTimeout(() => {
|
|
1164
1166
|
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
@@ -1172,113 +1174,115 @@ class Tn extends I {
|
|
|
1172
1174
|
}, 0);
|
|
1173
1175
|
}
|
|
1174
1176
|
commitActiveRowEdit() {
|
|
1175
|
-
this.#e !== -1 && this.#
|
|
1177
|
+
this.#e !== -1 && this.#h(this.#e, !1);
|
|
1176
1178
|
}
|
|
1177
1179
|
cancelActiveRowEdit() {
|
|
1178
|
-
this.#e !== -1 && this.#
|
|
1180
|
+
this.#e !== -1 && this.#h(this.#e, !0);
|
|
1179
1181
|
}
|
|
1180
|
-
#
|
|
1182
|
+
#m(e, t, i) {
|
|
1181
1183
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
1182
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#y(e, r), this.#
|
|
1184
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#y(e, r), this.#i = t, this.#v(r, e, o, t, i, !1));
|
|
1183
1185
|
}
|
|
1184
|
-
#
|
|
1186
|
+
#x() {
|
|
1185
1187
|
const e = this.grid, t = e._focusRow, i = e._focusCol;
|
|
1186
1188
|
if (t < 0 || i < 0) return;
|
|
1187
1189
|
const r = e.findRenderedRowElement?.(t)?.querySelector(`.cell[data-col="${i}"]`);
|
|
1188
1190
|
if (r?.classList.contains("editing")) {
|
|
1189
1191
|
const o = r.querySelector(G);
|
|
1190
|
-
o && (this.#
|
|
1192
|
+
o && (this.#d = !1, o.focus(), this.#c = !0, o instanceof HTMLInputElement && (o.type === "text" || o.type === "number") && o.select());
|
|
1191
1193
|
}
|
|
1192
1194
|
}
|
|
1193
|
-
#
|
|
1195
|
+
#C(e) {
|
|
1194
1196
|
const t = this.grid, i = t._rows, n = this.#t ? t._focusRow : this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
|
|
1195
1197
|
if (r.length === 0) return;
|
|
1196
1198
|
const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
|
|
1197
1199
|
if (s >= 0 && s < r.length) {
|
|
1198
1200
|
t._focusCol = r[s];
|
|
1199
1201
|
const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[s]}"]`);
|
|
1200
|
-
c?.classList.contains("editing") && c.querySelector(G)?.focus({ preventScroll: !0 }),
|
|
1202
|
+
c?.classList.contains("editing") && c.querySelector(G)?.focus({ preventScroll: !0 }), q(t, { forceHorizontalScroll: !0 });
|
|
1201
1203
|
return;
|
|
1202
1204
|
}
|
|
1203
1205
|
const l = n + (e ? 1 : -1);
|
|
1204
|
-
l >= 0 && l < i.length && (this.#t ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1],
|
|
1206
|
+
l >= 0 && l < i.length && (this.#t ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], q(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
|
|
1205
1207
|
const c = t.findRenderedRowElement?.(l)?.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1206
1208
|
c?.classList.contains("editing") && c.querySelector(G)?.focus({ preventScroll: !0 });
|
|
1207
|
-
}, 0)) : (this.#
|
|
1209
|
+
}, 0)) : (this.#h(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), q(t, { forceHorizontalScroll: !0 })));
|
|
1208
1210
|
}
|
|
1209
|
-
#
|
|
1211
|
+
#w() {
|
|
1210
1212
|
const e = this.grid;
|
|
1211
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1213
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#n;
|
|
1212
1214
|
}
|
|
1213
1215
|
#y(e, t) {
|
|
1214
|
-
if (this.#e !== e
|
|
1216
|
+
if (this.#e !== e) {
|
|
1217
|
+
this.#n.set(e, { ...t }), this.#e = e, this.#s = t;
|
|
1215
1218
|
const i = this.grid;
|
|
1216
|
-
let n = "";
|
|
1217
1219
|
try {
|
|
1218
|
-
|
|
1220
|
+
this.#o = i.getRowId?.(t) ?? void 0;
|
|
1219
1221
|
} catch {
|
|
1222
|
+
this.#o = void 0;
|
|
1220
1223
|
}
|
|
1221
|
-
this.emit("edit-open", {
|
|
1224
|
+
this.#w(), this.#t || this.emit("edit-open", {
|
|
1222
1225
|
rowIndex: e,
|
|
1223
|
-
rowId:
|
|
1226
|
+
rowId: this.#o ?? "",
|
|
1224
1227
|
row: t
|
|
1225
1228
|
});
|
|
1226
1229
|
}
|
|
1227
1230
|
}
|
|
1228
|
-
#
|
|
1231
|
+
#h(e, t) {
|
|
1229
1232
|
if (this.#e !== e) return;
|
|
1230
|
-
const i = this.grid, n = this.#
|
|
1231
|
-
let
|
|
1232
|
-
|
|
1233
|
+
const i = this.grid, n = this.#n.get(e), r = i.findRenderedRowElement?.(e);
|
|
1234
|
+
let o = this.#o;
|
|
1235
|
+
const l = (o ? i._getRowEntry(o) : void 0)?.row ?? this.#s ?? i._rows[e];
|
|
1236
|
+
if (!o && l)
|
|
1233
1237
|
try {
|
|
1234
|
-
|
|
1238
|
+
o = i.getRowId?.(l);
|
|
1235
1239
|
} catch {
|
|
1236
1240
|
}
|
|
1237
|
-
if (!t &&
|
|
1238
|
-
const
|
|
1239
|
-
if (isNaN(
|
|
1240
|
-
const
|
|
1241
|
-
if (!
|
|
1241
|
+
if (!t && r && l && r.querySelectorAll(".cell.editing").forEach((c) => {
|
|
1242
|
+
const u = Number(c.getAttribute("data-col"));
|
|
1243
|
+
if (isNaN(u)) return;
|
|
1244
|
+
const h = i._visibleColumns[u];
|
|
1245
|
+
if (!h || c.hasAttribute("data-editor-managed"))
|
|
1242
1246
|
return;
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
+
const f = c.querySelector("input,textarea,select");
|
|
1248
|
+
if (f) {
|
|
1249
|
+
const g = h.field, p = l[g], m = Y(f, h, p);
|
|
1250
|
+
p !== m && this.#E(e, h, m, l);
|
|
1247
1251
|
}
|
|
1248
|
-
}), t && n &&
|
|
1249
|
-
Object.keys(n).forEach((
|
|
1250
|
-
|
|
1251
|
-
}),
|
|
1252
|
-
else if (!t &&
|
|
1253
|
-
const
|
|
1252
|
+
}), t && n && l)
|
|
1253
|
+
Object.keys(n).forEach((d) => {
|
|
1254
|
+
l[d] = n[d];
|
|
1255
|
+
}), o && (this.#r.delete(o), this.clearRowInvalid(o));
|
|
1256
|
+
else if (!t && l) {
|
|
1257
|
+
const d = this.#k(n, l), c = o ? this.#r.has(o) : d, u = this.emitCancelable("row-commit", {
|
|
1254
1258
|
rowIndex: e,
|
|
1255
|
-
rowId:
|
|
1256
|
-
row:
|
|
1259
|
+
rowId: o ?? "",
|
|
1260
|
+
row: l,
|
|
1257
1261
|
oldValue: n,
|
|
1258
|
-
newValue:
|
|
1259
|
-
changed:
|
|
1262
|
+
newValue: l,
|
|
1263
|
+
changed: c,
|
|
1260
1264
|
changedRows: this.changedRows,
|
|
1261
1265
|
changedRowIds: this.changedRowIds
|
|
1262
1266
|
});
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}),
|
|
1266
|
-
}
|
|
1267
|
-
this.#
|
|
1268
|
-
for (const
|
|
1269
|
-
|
|
1270
|
-
for (const
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}),
|
|
1267
|
+
u && n ? (Object.keys(n).forEach((h) => {
|
|
1268
|
+
l[h] = n[h];
|
|
1269
|
+
}), o && (this.#r.delete(o), this.clearRowInvalid(o))) : !u && d && this.isAnimationEnabled && (this.#p = e);
|
|
1270
|
+
}
|
|
1271
|
+
this.#n.delete(e), this.#e = -1, this.#o = void 0, this.#s = void 0, this.#i = -1, this.#g = !1, this.#w();
|
|
1272
|
+
for (const d of this.#l)
|
|
1273
|
+
d.startsWith(`${e}:`) && this.#l.delete(d);
|
|
1274
|
+
for (const d of this.#f.keys())
|
|
1275
|
+
d.startsWith(`${e}:`) && this.#f.delete(d);
|
|
1276
|
+
this.#b = !0, r ? (r.querySelectorAll(".cell.editing").forEach((d) => {
|
|
1277
|
+
d.classList.remove("editing"), Bt(d.parentElement);
|
|
1278
|
+
}), i.refreshVirtualWindow(!0)) : (this.#S(i), this.#b = !1), !this.#t && l && this.emit("edit-close", {
|
|
1275
1279
|
rowIndex: e,
|
|
1276
|
-
rowId:
|
|
1277
|
-
row:
|
|
1280
|
+
rowId: o ?? "",
|
|
1281
|
+
row: l,
|
|
1278
1282
|
reverted: t
|
|
1279
1283
|
});
|
|
1280
1284
|
}
|
|
1281
|
-
#
|
|
1285
|
+
#E(e, t, i, n) {
|
|
1282
1286
|
const r = t.field;
|
|
1283
1287
|
if (!Z(r)) return;
|
|
1284
1288
|
const o = n[r];
|
|
@@ -1289,7 +1293,7 @@ class Tn extends I {
|
|
|
1289
1293
|
l = this.grid.getRowId(n);
|
|
1290
1294
|
} catch {
|
|
1291
1295
|
}
|
|
1292
|
-
const d = l ? !this.#
|
|
1296
|
+
const d = l ? !this.#r.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : qe;
|
|
1293
1297
|
let u = !1;
|
|
1294
1298
|
const h = l ? (p) => {
|
|
1295
1299
|
u = !0, this.setInvalid(l, r, p ?? "");
|
|
@@ -1308,7 +1312,7 @@ class Tn extends I {
|
|
|
1308
1312
|
updateRow: c,
|
|
1309
1313
|
setInvalid: h
|
|
1310
1314
|
})) return;
|
|
1311
|
-
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#
|
|
1315
|
+
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#r.add(l), this.#w(), this.emitPluginEvent("cell-edit-committed", {
|
|
1312
1316
|
rowIndex: e,
|
|
1313
1317
|
field: r,
|
|
1314
1318
|
oldValue: o,
|
|
@@ -1317,26 +1321,26 @@ class Tn extends I {
|
|
|
1317
1321
|
const g = s.findRenderedRowElement?.(e);
|
|
1318
1322
|
g && g.classList.add("changed");
|
|
1319
1323
|
}
|
|
1320
|
-
#
|
|
1324
|
+
#v(e, t, i, n, r, o) {
|
|
1321
1325
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1322
1326
|
let s;
|
|
1323
1327
|
try {
|
|
1324
1328
|
s = this.grid.getRowId(e);
|
|
1325
1329
|
} catch {
|
|
1326
1330
|
}
|
|
1327
|
-
const l = s ? (b) => this.grid.updateRow(s, b, "cascade") :
|
|
1328
|
-
r.classList.add("editing"), this.#
|
|
1331
|
+
const l = s ? (b) => this.grid.updateRow(s, b, "cascade") : qe, d = Z(i.field) ? e[i.field] : void 0;
|
|
1332
|
+
r.classList.add("editing"), this.#l.add(`${t}:${n}`);
|
|
1329
1333
|
const c = r.parentElement;
|
|
1330
|
-
c &&
|
|
1334
|
+
c && Ot(c);
|
|
1331
1335
|
let u = !1;
|
|
1332
1336
|
const h = (b) => {
|
|
1333
1337
|
if (u || !this.#t && this.#e === -1) return;
|
|
1334
|
-
const w = this.grid.
|
|
1335
|
-
this.#
|
|
1338
|
+
const w = this.grid, T = s ? w._getRowEntry(s) : void 0, R = T?.row ?? e, I = T?.index ?? t;
|
|
1339
|
+
this.#E(I, i, b, R);
|
|
1336
1340
|
}, f = () => {
|
|
1337
1341
|
if (u = !0, Z(i.field)) {
|
|
1338
|
-
const b = this.grid.
|
|
1339
|
-
|
|
1342
|
+
const b = this.grid, T = (s ? b._getRowEntry(s) : void 0)?.row ?? e;
|
|
1343
|
+
T[i.field] = d;
|
|
1340
1344
|
}
|
|
1341
1345
|
}, g = document.createElement("div");
|
|
1342
1346
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (b) => {
|
|
@@ -1349,7 +1353,7 @@ class Tn extends I {
|
|
|
1349
1353
|
}
|
|
1350
1354
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(b) === !1)
|
|
1351
1355
|
return;
|
|
1352
|
-
b.stopPropagation(), b.preventDefault(), u = !0, this.#
|
|
1356
|
+
b.stopPropagation(), b.preventDefault(), u = !0, this.#h(t, !1);
|
|
1353
1357
|
}
|
|
1354
1358
|
if (b.key === "Escape") {
|
|
1355
1359
|
if (this.#t) {
|
|
@@ -1358,75 +1362,75 @@ class Tn extends I {
|
|
|
1358
1362
|
}
|
|
1359
1363
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(b) === !1)
|
|
1360
1364
|
return;
|
|
1361
|
-
b.stopPropagation(), b.preventDefault(), f(), this.#
|
|
1365
|
+
b.stopPropagation(), b.preventDefault(), f(), this.#h(t, !0);
|
|
1362
1366
|
}
|
|
1363
1367
|
});
|
|
1364
|
-
const p = i, m = p.__editorTemplate,
|
|
1365
|
-
this.#
|
|
1368
|
+
const p = i, m = p.__editorTemplate, x = zt(this.grid, p) ?? Kt(i), E = d, P = `${t}:${i.field}`, D = [];
|
|
1369
|
+
this.#f.set(P, (b) => {
|
|
1366
1370
|
for (const w of D) w(b);
|
|
1367
1371
|
});
|
|
1368
|
-
const
|
|
1372
|
+
const _ = (b) => {
|
|
1369
1373
|
D.push(b);
|
|
1370
1374
|
};
|
|
1371
|
-
if (
|
|
1372
|
-
this.#R(g, p, e, d, h, f, o, t),
|
|
1375
|
+
if (x === "template" && m)
|
|
1376
|
+
this.#R(g, p, e, d, h, f, o, t), _((b) => {
|
|
1373
1377
|
const w = g.querySelector(
|
|
1374
1378
|
"input,textarea,select"
|
|
1375
1379
|
);
|
|
1376
1380
|
w && (w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!b : w.value = String(b ?? ""));
|
|
1377
1381
|
});
|
|
1378
|
-
else if (typeof
|
|
1379
|
-
const b = document.createElement(
|
|
1380
|
-
b.value =
|
|
1382
|
+
else if (typeof x == "string") {
|
|
1383
|
+
const b = document.createElement(x);
|
|
1384
|
+
b.value = E, b.addEventListener("change", () => h(b.value)), _((w) => {
|
|
1381
1385
|
b.value = w;
|
|
1382
1386
|
}), g.appendChild(b), o || queueMicrotask(() => {
|
|
1383
1387
|
g.querySelector(G)?.focus({ preventScroll: !0 });
|
|
1384
1388
|
});
|
|
1385
|
-
} else if (typeof
|
|
1389
|
+
} else if (typeof x == "function") {
|
|
1386
1390
|
const b = {
|
|
1387
1391
|
row: e,
|
|
1388
1392
|
rowId: s ?? "",
|
|
1389
|
-
value:
|
|
1393
|
+
value: E,
|
|
1390
1394
|
field: i.field,
|
|
1391
1395
|
column: i,
|
|
1392
1396
|
commit: h,
|
|
1393
1397
|
cancel: f,
|
|
1394
1398
|
updateRow: l,
|
|
1395
|
-
onValueChange:
|
|
1396
|
-
}, w =
|
|
1397
|
-
typeof w == "string" ? (g.innerHTML = w,
|
|
1398
|
-
const
|
|
1399
|
+
onValueChange: _
|
|
1400
|
+
}, w = x(b);
|
|
1401
|
+
typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((T) => {
|
|
1402
|
+
const R = g.querySelector(
|
|
1399
1403
|
"input,textarea,select"
|
|
1400
1404
|
);
|
|
1401
|
-
|
|
1402
|
-
})) : w instanceof Node && (g.appendChild(w), w instanceof HTMLInputElement || w instanceof HTMLSelectElement || w instanceof HTMLTextAreaElement ?
|
|
1403
|
-
w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!
|
|
1405
|
+
R && (R instanceof HTMLInputElement && R.type === "checkbox" ? R.checked = !!T : R.value = String(T ?? ""));
|
|
1406
|
+
})) : w instanceof Node && (g.appendChild(w), w instanceof HTMLInputElement || w instanceof HTMLSelectElement || w instanceof HTMLTextAreaElement ? _((R) => {
|
|
1407
|
+
w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!R : w.value = String(R ?? "");
|
|
1404
1408
|
}) : r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
|
|
1405
1409
|
g.querySelector(G)?.focus({ preventScroll: !0 });
|
|
1406
1410
|
});
|
|
1407
|
-
} else if (
|
|
1411
|
+
} else if (x && typeof x == "object") {
|
|
1408
1412
|
const b = document.createElement("div");
|
|
1409
1413
|
b.setAttribute("data-external-editor", ""), b.setAttribute("data-field", i.field), g.appendChild(b), r.setAttribute("data-editor-managed", "");
|
|
1410
1414
|
const w = {
|
|
1411
1415
|
row: e,
|
|
1412
1416
|
rowId: s ?? "",
|
|
1413
|
-
value:
|
|
1417
|
+
value: E,
|
|
1414
1418
|
field: i.field,
|
|
1415
1419
|
column: i,
|
|
1416
1420
|
commit: h,
|
|
1417
1421
|
cancel: f,
|
|
1418
1422
|
updateRow: l,
|
|
1419
|
-
onValueChange:
|
|
1423
|
+
onValueChange: _
|
|
1420
1424
|
};
|
|
1421
|
-
if (
|
|
1425
|
+
if (x.mount)
|
|
1422
1426
|
try {
|
|
1423
|
-
|
|
1424
|
-
} catch (
|
|
1425
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1427
|
+
x.mount({ placeholder: b, context: w, spec: x });
|
|
1428
|
+
} catch (T) {
|
|
1429
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, T);
|
|
1426
1430
|
}
|
|
1427
1431
|
else
|
|
1428
1432
|
this.grid.dispatchEvent(
|
|
1429
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec:
|
|
1433
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec: x, context: w } })
|
|
1430
1434
|
);
|
|
1431
1435
|
}
|
|
1432
1436
|
}
|
|
@@ -1461,18 +1465,18 @@ class Tn extends I {
|
|
|
1461
1465
|
if (p.key === "Enter") {
|
|
1462
1466
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1463
1467
|
return;
|
|
1464
|
-
p.stopPropagation(), p.preventDefault(), f = !0, r(Y(h, t, n)), this.#
|
|
1468
|
+
p.stopPropagation(), p.preventDefault(), f = !0, r(Y(h, t, n)), this.#h(l, !1);
|
|
1465
1469
|
}
|
|
1466
1470
|
if (p.key === "Escape") {
|
|
1467
1471
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1468
1472
|
return;
|
|
1469
|
-
p.stopPropagation(), p.preventDefault(), o(), this.#
|
|
1473
|
+
p.stopPropagation(), p.preventDefault(), o(), this.#h(l, !0);
|
|
1470
1474
|
}
|
|
1471
1475
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1472
1476
|
}
|
|
1473
1477
|
e.appendChild(c);
|
|
1474
1478
|
}
|
|
1475
|
-
#
|
|
1479
|
+
#k(e, t) {
|
|
1476
1480
|
if (!e) return !1;
|
|
1477
1481
|
const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
|
|
1478
1482
|
for (const o of r)
|
|
@@ -1480,7 +1484,7 @@ class Tn extends I {
|
|
|
1480
1484
|
return !0;
|
|
1481
1485
|
return !1;
|
|
1482
1486
|
}
|
|
1483
|
-
#
|
|
1487
|
+
#S(e) {
|
|
1484
1488
|
queueMicrotask(() => {
|
|
1485
1489
|
try {
|
|
1486
1490
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1496,7 +1500,7 @@ class Tn extends I {
|
|
|
1496
1500
|
});
|
|
1497
1501
|
}
|
|
1498
1502
|
}
|
|
1499
|
-
function
|
|
1503
|
+
function Ne(a, e = !0) {
|
|
1500
1504
|
if (a == null) return "";
|
|
1501
1505
|
if (a instanceof Date) return a.toISOString();
|
|
1502
1506
|
if (typeof a == "object") return JSON.stringify(a);
|
|
@@ -1504,37 +1508,37 @@ function qe(a, e = !0) {
|
|
|
1504
1508
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1505
1509
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1506
1510
|
}
|
|
1507
|
-
function
|
|
1511
|
+
function $t(a, e, t, i = {}) {
|
|
1508
1512
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1509
1513
|
`, o = [], s = i.bom ? "\uFEFF" : "";
|
|
1510
1514
|
if (t.includeHeaders !== !1) {
|
|
1511
1515
|
const l = e.map((d) => {
|
|
1512
1516
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1513
|
-
return
|
|
1517
|
+
return Ne(u);
|
|
1514
1518
|
});
|
|
1515
1519
|
o.push(l.join(n));
|
|
1516
1520
|
}
|
|
1517
1521
|
for (const l of a) {
|
|
1518
1522
|
const d = e.map((c) => {
|
|
1519
1523
|
let u = l[c.field];
|
|
1520
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1524
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Ne(u);
|
|
1521
1525
|
});
|
|
1522
1526
|
o.push(d.join(n));
|
|
1523
1527
|
}
|
|
1524
1528
|
return s + o.join(r);
|
|
1525
1529
|
}
|
|
1526
|
-
function
|
|
1530
|
+
function xe(a, e) {
|
|
1527
1531
|
const t = URL.createObjectURL(a), i = document.createElement("a");
|
|
1528
1532
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1529
1533
|
}
|
|
1530
|
-
function
|
|
1534
|
+
function Wt(a, e) {
|
|
1531
1535
|
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1532
|
-
|
|
1536
|
+
xe(t, e);
|
|
1533
1537
|
}
|
|
1534
|
-
function
|
|
1538
|
+
function He(a) {
|
|
1535
1539
|
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1536
1540
|
}
|
|
1537
|
-
function
|
|
1541
|
+
function jt(a, e, t) {
|
|
1538
1542
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1539
1543
|
<?mso-application progid="Excel.Sheet"?>
|
|
1540
1544
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1546,7 +1550,7 @@ function Wt(a, e, t) {
|
|
|
1546
1550
|
<Row>`;
|
|
1547
1551
|
for (const n of e) {
|
|
1548
1552
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1549
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1553
|
+
i += `<Cell><Data ss:Type="String">${He(o)}</Data></Cell>`;
|
|
1550
1554
|
}
|
|
1551
1555
|
i += "</Row>";
|
|
1552
1556
|
}
|
|
@@ -1557,7 +1561,7 @@ function Wt(a, e, t) {
|
|
|
1557
1561
|
let o = n[r.field];
|
|
1558
1562
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1559
1563
|
let s = "String", l = "";
|
|
1560
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l =
|
|
1564
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l = He(String(o)), i += `<Cell><Data ss:Type="${s}">${l}</Data></Cell>`;
|
|
1561
1565
|
}
|
|
1562
1566
|
i += "</Row>";
|
|
1563
1567
|
}
|
|
@@ -1566,13 +1570,13 @@ function Wt(a, e, t) {
|
|
|
1566
1570
|
</Worksheet>
|
|
1567
1571
|
</Workbook>`, i;
|
|
1568
1572
|
}
|
|
1569
|
-
function
|
|
1573
|
+
function Ut(a, e) {
|
|
1570
1574
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
|
|
1571
1575
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1572
1576
|
});
|
|
1573
|
-
|
|
1577
|
+
xe(i, t);
|
|
1574
1578
|
}
|
|
1575
|
-
class
|
|
1579
|
+
class Pn extends F {
|
|
1576
1580
|
name = "export";
|
|
1577
1581
|
get defaultConfig() {
|
|
1578
1582
|
return {
|
|
@@ -1596,10 +1600,10 @@ class In extends I {
|
|
|
1596
1600
|
}, r = ie(this.columns, t?.columns, i.onlyVisible);
|
|
1597
1601
|
let o;
|
|
1598
1602
|
if (t?.rowIndices)
|
|
1599
|
-
o =
|
|
1603
|
+
o = me(this.rows, t.rowIndices);
|
|
1600
1604
|
else if (i.onlySelected) {
|
|
1601
1605
|
const l = this.getSelectionState();
|
|
1602
|
-
l?.selected?.size ? o =
|
|
1606
|
+
l?.selected?.size ? o = me(this.rows, [...l.selected]) : o = [...this.rows];
|
|
1603
1607
|
} else
|
|
1604
1608
|
o = [...this.rows];
|
|
1605
1609
|
this.isExportingFlag = !0;
|
|
@@ -1607,13 +1611,13 @@ class In extends I {
|
|
|
1607
1611
|
try {
|
|
1608
1612
|
switch (e) {
|
|
1609
1613
|
case "csv": {
|
|
1610
|
-
const l =
|
|
1611
|
-
s = s.endsWith(".csv") ? s : `${s}.csv`,
|
|
1614
|
+
const l = $t(o, r, n, { bom: !0 });
|
|
1615
|
+
s = s.endsWith(".csv") ? s : `${s}.csv`, Wt(l, s);
|
|
1612
1616
|
break;
|
|
1613
1617
|
}
|
|
1614
1618
|
case "excel": {
|
|
1615
|
-
const l =
|
|
1616
|
-
s = s.endsWith(".xls") ? s : `${s}.xls`,
|
|
1619
|
+
const l = jt(o, r, n);
|
|
1620
|
+
s = s.endsWith(".xls") ? s : `${s}.xls`, Ut(l, s);
|
|
1617
1621
|
break;
|
|
1618
1622
|
}
|
|
1619
1623
|
case "json": {
|
|
@@ -1627,7 +1631,7 @@ class In extends I {
|
|
|
1627
1631
|
}), d = JSON.stringify(l, null, 2);
|
|
1628
1632
|
s = s.endsWith(".json") ? s : `${s}.json`;
|
|
1629
1633
|
const c = new Blob([d], { type: "application/json" });
|
|
1630
|
-
|
|
1634
|
+
xe(c, s);
|
|
1631
1635
|
break;
|
|
1632
1636
|
}
|
|
1633
1637
|
}
|
|
@@ -1664,81 +1668,75 @@ class In extends I {
|
|
|
1664
1668
|
return this.lastExportInfo;
|
|
1665
1669
|
}
|
|
1666
1670
|
}
|
|
1667
|
-
const
|
|
1668
|
-
function
|
|
1669
|
-
return a.field === dt;
|
|
1670
|
-
}
|
|
1671
|
-
function W(a) {
|
|
1672
|
-
return a.meta?.utility === !0;
|
|
1673
|
-
}
|
|
1674
|
-
function Yt(a) {
|
|
1675
|
-
return a.find(oe);
|
|
1676
|
-
}
|
|
1677
|
-
function Xt(a) {
|
|
1678
|
-
return {
|
|
1679
|
-
field: dt,
|
|
1680
|
-
header: "",
|
|
1681
|
-
width: Ut,
|
|
1682
|
-
resizable: !1,
|
|
1683
|
-
sortable: !1,
|
|
1684
|
-
filterable: !1,
|
|
1685
|
-
meta: {
|
|
1686
|
-
lockPosition: !0,
|
|
1687
|
-
suppressMovable: !0,
|
|
1688
|
-
expanderColumn: !0,
|
|
1689
|
-
expanderPlugin: a,
|
|
1690
|
-
utility: !0
|
|
1691
|
-
}
|
|
1692
|
-
};
|
|
1693
|
-
}
|
|
1694
|
-
function N(a) {
|
|
1671
|
+
const re = "(Blank)";
|
|
1672
|
+
function H(a) {
|
|
1695
1673
|
if (a instanceof Date) return a.getTime();
|
|
1696
1674
|
const e = Number(a);
|
|
1697
1675
|
return isNaN(e) ? new Date(a).getTime() : e;
|
|
1698
1676
|
}
|
|
1699
|
-
function
|
|
1700
|
-
const
|
|
1677
|
+
function Yt(a, e, t = !1, i) {
|
|
1678
|
+
const n = a[e.field];
|
|
1701
1679
|
if (e.operator === "blank")
|
|
1702
|
-
return
|
|
1680
|
+
return n == null || n === "";
|
|
1703
1681
|
if (e.operator === "notBlank")
|
|
1704
|
-
return
|
|
1682
|
+
return n != null && n !== "";
|
|
1683
|
+
if (i && (e.operator === "notIn" || e.operator === "in")) {
|
|
1684
|
+
const l = i(n, a), d = Array.isArray(l) ? l : l != null ? [l] : [];
|
|
1685
|
+
if (e.operator === "notIn") {
|
|
1686
|
+
const c = e.value;
|
|
1687
|
+
return Array.isArray(c) ? d.length === 0 ? !c.includes(re) : !d.some((u) => c.includes(u)) : !0;
|
|
1688
|
+
}
|
|
1689
|
+
if (e.operator === "in") {
|
|
1690
|
+
const c = e.value;
|
|
1691
|
+
return Array.isArray(c) ? d.length === 0 ? c.includes(re) : d.some((u) => c.includes(u)) : !1;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1705
1694
|
if (e.operator === "notIn")
|
|
1706
|
-
return
|
|
1695
|
+
return n == null ? !0 : Array.isArray(e.value) && !e.value.includes(n);
|
|
1707
1696
|
if (e.operator === "in")
|
|
1708
|
-
return Array.isArray(e.value) && e.value.includes(
|
|
1709
|
-
if (
|
|
1710
|
-
const
|
|
1697
|
+
return Array.isArray(e.value) && e.value.includes(n);
|
|
1698
|
+
if (n == null) return !1;
|
|
1699
|
+
const r = String(n), o = t ? r : r.toLowerCase(), s = t ? String(e.value) : String(e.value).toLowerCase();
|
|
1711
1700
|
switch (e.operator) {
|
|
1712
1701
|
case "contains":
|
|
1713
|
-
return
|
|
1702
|
+
return o.includes(s);
|
|
1714
1703
|
case "notContains":
|
|
1715
|
-
return !
|
|
1704
|
+
return !o.includes(s);
|
|
1716
1705
|
case "equals":
|
|
1717
|
-
return
|
|
1706
|
+
return o === s;
|
|
1718
1707
|
case "notEquals":
|
|
1719
|
-
return
|
|
1708
|
+
return o !== s;
|
|
1720
1709
|
case "startsWith":
|
|
1721
|
-
return
|
|
1710
|
+
return o.startsWith(s);
|
|
1722
1711
|
case "endsWith":
|
|
1723
|
-
return
|
|
1712
|
+
return o.endsWith(s);
|
|
1724
1713
|
case "lessThan":
|
|
1725
|
-
return
|
|
1714
|
+
return H(n) < H(e.value);
|
|
1726
1715
|
case "lessThanOrEqual":
|
|
1727
|
-
return
|
|
1716
|
+
return H(n) <= H(e.value);
|
|
1728
1717
|
case "greaterThan":
|
|
1729
|
-
return
|
|
1718
|
+
return H(n) > H(e.value);
|
|
1730
1719
|
case "greaterThanOrEqual":
|
|
1731
|
-
return
|
|
1720
|
+
return H(n) >= H(e.value);
|
|
1732
1721
|
case "between":
|
|
1733
|
-
return
|
|
1722
|
+
return H(n) >= H(e.value) && H(n) <= H(e.valueTo);
|
|
1734
1723
|
default:
|
|
1735
1724
|
return !0;
|
|
1736
1725
|
}
|
|
1737
1726
|
}
|
|
1738
|
-
function
|
|
1739
|
-
return e.length ? a.filter(
|
|
1727
|
+
function Xt(a, e, t = !1, i) {
|
|
1728
|
+
return e.length ? a.filter(
|
|
1729
|
+
(n) => e.every(
|
|
1730
|
+
(r) => Yt(
|
|
1731
|
+
n,
|
|
1732
|
+
r,
|
|
1733
|
+
t,
|
|
1734
|
+
i?.get(r.field)
|
|
1735
|
+
)
|
|
1736
|
+
)
|
|
1737
|
+
) : a;
|
|
1740
1738
|
}
|
|
1741
|
-
function
|
|
1739
|
+
function Qt(a) {
|
|
1742
1740
|
return JSON.stringify(
|
|
1743
1741
|
a.map((e) => ({
|
|
1744
1742
|
field: e.field,
|
|
@@ -1748,16 +1746,77 @@ function Jt(a) {
|
|
|
1748
1746
|
}))
|
|
1749
1747
|
);
|
|
1750
1748
|
}
|
|
1751
|
-
function
|
|
1752
|
-
const
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1749
|
+
function Ge(a, e, t) {
|
|
1750
|
+
const i = /* @__PURE__ */ new Set();
|
|
1751
|
+
let n = !1;
|
|
1752
|
+
for (const r of a) {
|
|
1753
|
+
const o = r[e];
|
|
1754
|
+
if (t) {
|
|
1755
|
+
const s = t(o, r);
|
|
1756
|
+
if (Array.isArray(s)) {
|
|
1757
|
+
s.length === 0 && (n = !0);
|
|
1758
|
+
for (const l of s)
|
|
1759
|
+
l != null && i.add(l);
|
|
1760
|
+
} else s != null ? i.add(s) : n = !0;
|
|
1761
|
+
} else
|
|
1762
|
+
o != null && i.add(o);
|
|
1756
1763
|
}
|
|
1757
|
-
return [...
|
|
1764
|
+
return t && n && i.add(re), [...i].sort((r, o) => typeof r == "number" && typeof o == "number" ? r - o : String(r).localeCompare(String(o)));
|
|
1765
|
+
}
|
|
1766
|
+
function Zt(a, e) {
|
|
1767
|
+
const t = /* @__PURE__ */ new Map();
|
|
1768
|
+
for (const { field: n, filterValue: r } of e)
|
|
1769
|
+
t.set(n, { values: /* @__PURE__ */ new Set(), hasBlank: !1, hasExtractor: !!r });
|
|
1770
|
+
for (const n of a)
|
|
1771
|
+
for (const { field: r, filterValue: o } of e) {
|
|
1772
|
+
const s = t.get(r), l = n[r];
|
|
1773
|
+
if (o) {
|
|
1774
|
+
const d = o(l, n);
|
|
1775
|
+
if (Array.isArray(d)) {
|
|
1776
|
+
d.length === 0 && (s.hasBlank = !0);
|
|
1777
|
+
for (const c of d)
|
|
1778
|
+
c != null && s.values.add(c);
|
|
1779
|
+
} else d != null ? s.values.add(d) : s.hasBlank = !0;
|
|
1780
|
+
} else
|
|
1781
|
+
l != null && s.values.add(l);
|
|
1782
|
+
}
|
|
1783
|
+
const i = /* @__PURE__ */ new Map();
|
|
1784
|
+
for (const [n, { values: r, hasBlank: o, hasExtractor: s }] of t)
|
|
1785
|
+
s && o && r.add(re), i.set(
|
|
1786
|
+
n,
|
|
1787
|
+
[...r].sort((l, d) => typeof l == "number" && typeof d == "number" ? l - d : String(l).localeCompare(String(d)))
|
|
1788
|
+
);
|
|
1789
|
+
return i;
|
|
1790
|
+
}
|
|
1791
|
+
const ct = "__tbw_expander", Jt = 32;
|
|
1792
|
+
function se(a) {
|
|
1793
|
+
return a.field === ct;
|
|
1794
|
+
}
|
|
1795
|
+
function W(a) {
|
|
1796
|
+
return a.meta?.utility === !0;
|
|
1797
|
+
}
|
|
1798
|
+
function ei(a) {
|
|
1799
|
+
return a.find(se);
|
|
1800
|
+
}
|
|
1801
|
+
function ti(a) {
|
|
1802
|
+
return {
|
|
1803
|
+
field: ct,
|
|
1804
|
+
header: "",
|
|
1805
|
+
width: Jt,
|
|
1806
|
+
resizable: !1,
|
|
1807
|
+
sortable: !1,
|
|
1808
|
+
filterable: !1,
|
|
1809
|
+
meta: {
|
|
1810
|
+
lockPosition: !0,
|
|
1811
|
+
suppressMovable: !0,
|
|
1812
|
+
expanderColumn: !0,
|
|
1813
|
+
expanderPlugin: a,
|
|
1814
|
+
utility: !0
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1758
1817
|
}
|
|
1759
|
-
const
|
|
1760
|
-
class z extends
|
|
1818
|
+
const ii = '@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}}}', ni = "@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-blank-option{display:flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-spacing-xs, .25rem) 0;margin-bottom:var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-sm, .8125rem);cursor:pointer;user-select:none}.tbw-filter-blank-checkbox{accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));margin:0;cursor:pointer}.tbw-filter-date-range.tbw-filter-disabled{opacity:.4;pointer-events:none}.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)}}";
|
|
1819
|
+
class z extends F {
|
|
1761
1820
|
static manifest = {
|
|
1762
1821
|
events: [
|
|
1763
1822
|
{
|
|
@@ -1773,7 +1832,7 @@ class z extends I {
|
|
|
1773
1832
|
]
|
|
1774
1833
|
};
|
|
1775
1834
|
name = "filtering";
|
|
1776
|
-
styles =
|
|
1835
|
+
styles = ii;
|
|
1777
1836
|
get defaultConfig() {
|
|
1778
1837
|
return {
|
|
1779
1838
|
debounceMs: 300,
|
|
@@ -1788,6 +1847,14 @@ class z extends I {
|
|
|
1788
1847
|
isColumnFilterable(e) {
|
|
1789
1848
|
return this.isFilteringEnabled() ? e.filterable !== !1 : !1;
|
|
1790
1849
|
}
|
|
1850
|
+
getFilterValues() {
|
|
1851
|
+
const e = this.grid.effectiveConfig?.columns;
|
|
1852
|
+
if (!e) return;
|
|
1853
|
+
let t;
|
|
1854
|
+
for (const i of e)
|
|
1855
|
+
i.field && i.filterValue && (t || (t = /* @__PURE__ */ new Map()), t.set(i.field, i.filterValue));
|
|
1856
|
+
return t;
|
|
1857
|
+
}
|
|
1791
1858
|
filters = /* @__PURE__ */ new Map();
|
|
1792
1859
|
cachedResult = null;
|
|
1793
1860
|
cacheKey = null;
|
|
@@ -1813,6 +1880,21 @@ class z extends I {
|
|
|
1813
1880
|
}
|
|
1814
1881
|
return z.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1815
1882
|
}
|
|
1883
|
+
computeSelected() {
|
|
1884
|
+
const e = [];
|
|
1885
|
+
for (const [n, r] of this.filters) {
|
|
1886
|
+
if (r.type !== "set" || r.operator !== "notIn") continue;
|
|
1887
|
+
const o = this.grid.effectiveConfig?.columns?.find((s) => s.field === n);
|
|
1888
|
+
e.push({ field: n, filterValue: o?.filterValue });
|
|
1889
|
+
}
|
|
1890
|
+
if (e.length === 0) return {};
|
|
1891
|
+
const t = Zt(this.sourceRows, e), i = {};
|
|
1892
|
+
for (const { field: n } of e) {
|
|
1893
|
+
const r = this.excludedValues.get(n), o = t.get(n) ?? [];
|
|
1894
|
+
i[n] = r ? o.filter((s) => !r.has(s)) : o;
|
|
1895
|
+
}
|
|
1896
|
+
return i;
|
|
1897
|
+
}
|
|
1816
1898
|
syncExcludedValues(e, t) {
|
|
1817
1899
|
t ? t.type === "set" && t.operator === "notIn" && Array.isArray(t.value) ? this.excludedValues.set(e, new Set(t.value)) : t.type === "set" && this.excludedValues.delete(e) : this.excludedValues.delete(e);
|
|
1818
1900
|
}
|
|
@@ -1850,7 +1932,7 @@ class z extends I {
|
|
|
1850
1932
|
if (!t.length) return [...e];
|
|
1851
1933
|
if (this.config.filterHandler)
|
|
1852
1934
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1853
|
-
const i =
|
|
1935
|
+
const i = Qt(t), n = {
|
|
1854
1936
|
len: e.length,
|
|
1855
1937
|
first: e[0],
|
|
1856
1938
|
mid: e[Math.floor(e.length / 2)],
|
|
@@ -1858,7 +1940,12 @@ class z extends I {
|
|
|
1858
1940
|
}, r = this.cachedInputSpot != null && n.len === this.cachedInputSpot.len && n.first === this.cachedInputSpot.first && n.mid === this.cachedInputSpot.mid && n.last === this.cachedInputSpot.last;
|
|
1859
1941
|
if (this.cacheKey === i && this.cachedResult && r)
|
|
1860
1942
|
return this.cachedResult;
|
|
1861
|
-
const o =
|
|
1943
|
+
const o = Xt(
|
|
1944
|
+
[...e],
|
|
1945
|
+
t,
|
|
1946
|
+
this.config.caseSensitive,
|
|
1947
|
+
this.getFilterValues()
|
|
1948
|
+
);
|
|
1862
1949
|
return this.cachedResult = o, this.cacheKey = i, this.cachedInputSpot = n, o;
|
|
1863
1950
|
}
|
|
1864
1951
|
afterRender() {
|
|
@@ -1899,7 +1986,8 @@ class z extends I {
|
|
|
1899
1986
|
}
|
|
1900
1987
|
this.cachedResult = null, this.cacheKey = null, this.cachedInputSpot = null, this.emit("filter-change", {
|
|
1901
1988
|
filters: [...this.filters.values()],
|
|
1902
|
-
filteredRowCount: 0
|
|
1989
|
+
filteredRowCount: 0,
|
|
1990
|
+
selected: this.computeSelected()
|
|
1903
1991
|
}), this.emitPluginEvent("filter-applied", { filters: [...this.filters.values()] }), this.requestRender();
|
|
1904
1992
|
}
|
|
1905
1993
|
getFilter(e) {
|
|
@@ -1917,7 +2005,8 @@ class z extends I {
|
|
|
1917
2005
|
this.filters.set(t.field, t), this.syncExcludedValues(t.field, t);
|
|
1918
2006
|
this.cachedResult = null, this.cacheKey = null, this.cachedInputSpot = null, this.emit("filter-change", {
|
|
1919
2007
|
filters: [...this.filters.values()],
|
|
1920
|
-
filteredRowCount: 0
|
|
2008
|
+
filteredRowCount: 0,
|
|
2009
|
+
selected: this.computeSelected()
|
|
1921
2010
|
}), this.emitPluginEvent("filter-applied", { filters: [...this.filters.values()] }), this.requestRender();
|
|
1922
2011
|
}
|
|
1923
2012
|
clearAllFilters() {
|
|
@@ -1936,7 +2025,8 @@ class z extends I {
|
|
|
1936
2025
|
return this.getFilters();
|
|
1937
2026
|
}
|
|
1938
2027
|
getUniqueValues(e) {
|
|
1939
|
-
|
|
2028
|
+
const i = this.grid.effectiveConfig?.columns?.find((n) => n.field === e)?.filterValue;
|
|
2029
|
+
return Ge(this.sourceRows, e, i);
|
|
1940
2030
|
}
|
|
1941
2031
|
copyGridThemeContext(e) {
|
|
1942
2032
|
const t = this.gridElement;
|
|
@@ -1953,7 +2043,7 @@ class z extends I {
|
|
|
1953
2043
|
return;
|
|
1954
2044
|
}
|
|
1955
2045
|
const e = document.createElement("style");
|
|
1956
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
2046
|
+
e.id = "tbw-filter-panel-styles", e.textContent = ni, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1957
2047
|
}
|
|
1958
2048
|
toggleFilterPanel(e, t, i) {
|
|
1959
2049
|
if (this.openPanelField === e) {
|
|
@@ -1968,7 +2058,7 @@ class z extends I {
|
|
|
1968
2058
|
});
|
|
1969
2059
|
return;
|
|
1970
2060
|
}
|
|
1971
|
-
const r =
|
|
2061
|
+
const r = Ge(this.sourceRows, e, t.filterValue);
|
|
1972
2062
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1973
2063
|
}
|
|
1974
2064
|
renderPanelContent(e, t, i, n) {
|
|
@@ -2036,227 +2126,236 @@ class z extends I {
|
|
|
2036
2126
|
});
|
|
2037
2127
|
}
|
|
2038
2128
|
renderDefaultFilterPanel(e, t, i, n) {
|
|
2039
|
-
const { field: r } = t,
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2129
|
+
const { field: r, column: o } = t, s = this.getListItemHeight(), l = (v) => {
|
|
2130
|
+
if (v == null) return "(Blank)";
|
|
2131
|
+
if (o.format && !o.filterValue) {
|
|
2132
|
+
const C = o.format(v, void 0);
|
|
2133
|
+
if (C) return C;
|
|
2134
|
+
}
|
|
2135
|
+
return String(v);
|
|
2136
|
+
};
|
|
2137
|
+
i = i.slice().sort((v, C) => l(v).localeCompare(l(C)));
|
|
2043
2138
|
const d = document.createElement("div");
|
|
2044
|
-
d.className = "tbw-filter-
|
|
2045
|
-
const c = document.createElement("
|
|
2046
|
-
c.className = "tbw-filter-
|
|
2047
|
-
const u = document.createElement("
|
|
2048
|
-
u.
|
|
2049
|
-
const h = document.createElement("
|
|
2050
|
-
h.
|
|
2051
|
-
const f = ()
|
|
2052
|
-
|
|
2053
|
-
|
|
2139
|
+
d.className = "tbw-filter-search";
|
|
2140
|
+
const c = document.createElement("input");
|
|
2141
|
+
c.type = "text", c.placeholder = "Search...", c.className = "tbw-filter-search-input", c.value = this.searchText.get(r) ?? "", d.appendChild(c), e.appendChild(d);
|
|
2142
|
+
const u = document.createElement("div");
|
|
2143
|
+
u.className = "tbw-filter-actions";
|
|
2144
|
+
const h = document.createElement("label");
|
|
2145
|
+
h.className = "tbw-filter-value-item", h.style.padding = "0", h.style.margin = "0";
|
|
2146
|
+
const f = document.createElement("input");
|
|
2147
|
+
f.type = "checkbox", f.className = "tbw-filter-checkbox";
|
|
2148
|
+
const g = document.createElement("span");
|
|
2149
|
+
g.textContent = "Select All", h.appendChild(f), h.appendChild(g), u.appendChild(h);
|
|
2150
|
+
const p = () => {
|
|
2151
|
+
const v = [...P.values()], C = v.every((S) => S), L = v.every((S) => !S);
|
|
2152
|
+
f.checked = C, f.indeterminate = !C && !L;
|
|
2054
2153
|
};
|
|
2055
|
-
|
|
2056
|
-
const
|
|
2057
|
-
for (const
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
}), e.appendChild(
|
|
2061
|
-
const g = document.createElement("div");
|
|
2062
|
-
g.className = "tbw-filter-values";
|
|
2063
|
-
const p = document.createElement("div");
|
|
2064
|
-
p.className = "tbw-filter-values-spacer", g.appendChild(p);
|
|
2154
|
+
f.addEventListener("change", () => {
|
|
2155
|
+
const v = f.checked;
|
|
2156
|
+
for (const C of P.keys())
|
|
2157
|
+
P.set(C, v);
|
|
2158
|
+
p(), b();
|
|
2159
|
+
}), e.appendChild(u);
|
|
2065
2160
|
const m = document.createElement("div");
|
|
2066
|
-
m.className = "tbw-filter-values
|
|
2067
|
-
const
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2161
|
+
m.className = "tbw-filter-values";
|
|
2162
|
+
const x = document.createElement("div");
|
|
2163
|
+
x.className = "tbw-filter-values-spacer", m.appendChild(x);
|
|
2164
|
+
const E = document.createElement("div");
|
|
2165
|
+
E.className = "tbw-filter-values-content", m.appendChild(E);
|
|
2166
|
+
const P = /* @__PURE__ */ new Map();
|
|
2167
|
+
i.forEach((v) => {
|
|
2168
|
+
const C = v == null ? "__null__" : String(v);
|
|
2169
|
+
P.set(C, !n.has(v));
|
|
2170
|
+
}), p();
|
|
2171
|
+
let D = [];
|
|
2172
|
+
const _ = (v, C) => {
|
|
2173
|
+
const L = l(v), S = v == null ? "__null__" : String(v), k = document.createElement("label");
|
|
2174
|
+
k.className = "tbw-filter-value-item", k.style.position = "absolute", k.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${C})`, k.style.left = "0", k.style.right = "0", k.style.boxSizing = "border-box";
|
|
2175
|
+
const M = document.createElement("input");
|
|
2176
|
+
M.type = "checkbox", M.className = "tbw-filter-checkbox", M.checked = P.get(S) ?? !0, M.dataset.value = S, M.addEventListener("change", () => {
|
|
2177
|
+
P.set(S, M.checked), p();
|
|
2079
2178
|
});
|
|
2080
|
-
const
|
|
2081
|
-
return
|
|
2082
|
-
},
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
2085
|
-
|
|
2086
|
-
|
|
2179
|
+
const y = document.createElement("span");
|
|
2180
|
+
return y.textContent = L, k.appendChild(M), k.appendChild(y), k;
|
|
2181
|
+
}, b = () => {
|
|
2182
|
+
const v = D.length, C = m.clientHeight, L = m.scrollTop;
|
|
2183
|
+
if (x.style.height = `${v * s}px`, xt(v, z.LIST_BYPASS_THRESHOLD / 3)) {
|
|
2184
|
+
E.innerHTML = "", E.style.transform = "translateY(0px)", D.forEach((k, M) => {
|
|
2185
|
+
E.appendChild(_(k, M));
|
|
2087
2186
|
});
|
|
2088
2187
|
return;
|
|
2089
2188
|
}
|
|
2090
|
-
const
|
|
2091
|
-
totalRows:
|
|
2092
|
-
viewportHeight:
|
|
2189
|
+
const S = Ct({
|
|
2190
|
+
totalRows: v,
|
|
2191
|
+
viewportHeight: C,
|
|
2093
2192
|
scrollTop: L,
|
|
2094
|
-
rowHeight:
|
|
2193
|
+
rowHeight: s,
|
|
2095
2194
|
overscan: z.LIST_OVERSCAN
|
|
2096
2195
|
});
|
|
2097
|
-
|
|
2098
|
-
for (let
|
|
2099
|
-
|
|
2100
|
-
},
|
|
2101
|
-
const
|
|
2102
|
-
if (
|
|
2103
|
-
const
|
|
2104
|
-
return !
|
|
2105
|
-
}),
|
|
2106
|
-
|
|
2107
|
-
const
|
|
2108
|
-
|
|
2196
|
+
E.style.transform = `translateY(${S.offsetY}px)`, E.innerHTML = "";
|
|
2197
|
+
for (let k = S.start; k < S.end; k++)
|
|
2198
|
+
E.appendChild(_(D[k], k - S.start));
|
|
2199
|
+
}, w = (v) => {
|
|
2200
|
+
const C = this.config.caseSensitive ?? !1, L = C ? v : v.toLowerCase();
|
|
2201
|
+
if (D = i.filter((S) => {
|
|
2202
|
+
const k = l(S), M = C ? k : k.toLowerCase();
|
|
2203
|
+
return !v || M.includes(L);
|
|
2204
|
+
}), D.length === 0) {
|
|
2205
|
+
x.style.height = "0px", E.innerHTML = "";
|
|
2206
|
+
const S = document.createElement("div");
|
|
2207
|
+
S.className = "tbw-filter-no-match", S.textContent = "No matching values", E.appendChild(S);
|
|
2109
2208
|
return;
|
|
2110
2209
|
}
|
|
2111
|
-
|
|
2210
|
+
b();
|
|
2112
2211
|
};
|
|
2113
|
-
|
|
2212
|
+
m.addEventListener(
|
|
2114
2213
|
"scroll",
|
|
2115
2214
|
() => {
|
|
2116
|
-
|
|
2215
|
+
D.length > 0 && b();
|
|
2117
2216
|
},
|
|
2118
2217
|
{ passive: !0 }
|
|
2119
|
-
),
|
|
2120
|
-
let
|
|
2121
|
-
|
|
2122
|
-
clearTimeout(
|
|
2123
|
-
this.searchText.set(r,
|
|
2218
|
+
), w(c.value), e.appendChild(m);
|
|
2219
|
+
let T;
|
|
2220
|
+
c.addEventListener("input", () => {
|
|
2221
|
+
clearTimeout(T), T = setTimeout(() => {
|
|
2222
|
+
this.searchText.set(r, c.value), w(c.value);
|
|
2124
2223
|
}, this.config.debounceMs ?? 150);
|
|
2125
2224
|
});
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
const
|
|
2131
|
-
for (const [
|
|
2225
|
+
const R = document.createElement("div");
|
|
2226
|
+
R.className = "tbw-filter-buttons";
|
|
2227
|
+
const I = document.createElement("button");
|
|
2228
|
+
I.className = "tbw-filter-apply-btn", I.textContent = "Apply", I.addEventListener("click", () => {
|
|
2229
|
+
const v = [];
|
|
2230
|
+
for (const [C, L] of P)
|
|
2132
2231
|
if (!L)
|
|
2133
|
-
if (
|
|
2134
|
-
|
|
2232
|
+
if (C === "__null__")
|
|
2233
|
+
v.push(null);
|
|
2135
2234
|
else {
|
|
2136
|
-
const
|
|
2137
|
-
|
|
2235
|
+
const S = i.find((k) => String(k) === C);
|
|
2236
|
+
v.push(S !== void 0 ? S : C);
|
|
2138
2237
|
}
|
|
2139
|
-
t.applySetFilter(
|
|
2140
|
-
}),
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2238
|
+
t.applySetFilter(v);
|
|
2239
|
+
}), R.appendChild(I);
|
|
2240
|
+
const N = document.createElement("button");
|
|
2241
|
+
N.className = "tbw-filter-clear-btn", N.textContent = "Clear Filter", N.addEventListener("click", () => {
|
|
2143
2242
|
t.clearFilter();
|
|
2144
|
-
}),
|
|
2243
|
+
}), R.appendChild(N), e.appendChild(R);
|
|
2145
2244
|
}
|
|
2146
2245
|
renderNumberFilterPanel(e, t, i) {
|
|
2147
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (
|
|
2148
|
-
if (typeof
|
|
2149
|
-
if (typeof
|
|
2150
|
-
const Q = parseFloat(
|
|
2246
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A, B) => {
|
|
2247
|
+
if (typeof A == "number") return A;
|
|
2248
|
+
if (typeof A == "string") {
|
|
2249
|
+
const Q = parseFloat(A);
|
|
2151
2250
|
return isNaN(Q) ? B : Q;
|
|
2152
2251
|
}
|
|
2153
2252
|
return B;
|
|
2154
|
-
}, d = i.filter((
|
|
2155
|
-
let m = h,
|
|
2156
|
-
p?.operator === "between" ? (m = l(p.value, h),
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2253
|
+
}, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), f = l(o?.max ?? s?.max, u), g = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
|
|
2254
|
+
let m = h, x = f;
|
|
2255
|
+
p?.operator === "between" ? (m = l(p.value, h), x = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? m = l(p.value, h) : p?.operator === "lessThanOrEqual" && (x = l(p.value, f));
|
|
2256
|
+
const E = document.createElement("div");
|
|
2257
|
+
E.className = "tbw-filter-range-inputs";
|
|
2159
2258
|
const P = document.createElement("div");
|
|
2160
2259
|
P.className = "tbw-filter-range-group";
|
|
2161
2260
|
const D = document.createElement("label");
|
|
2162
2261
|
D.textContent = "Min", D.className = "tbw-filter-range-label";
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2262
|
+
const _ = document.createElement("input");
|
|
2263
|
+
_.type = "number", _.className = "tbw-filter-range-input", _.min = String(h), _.max = String(f), _.step = String(g), _.value = String(m), P.appendChild(D), P.appendChild(_), E.appendChild(P);
|
|
2165
2264
|
const b = document.createElement("span");
|
|
2166
|
-
b.className = "tbw-filter-range-separator", b.textContent = "–",
|
|
2265
|
+
b.className = "tbw-filter-range-separator", b.textContent = "–", E.appendChild(b);
|
|
2167
2266
|
const w = document.createElement("div");
|
|
2168
2267
|
w.className = "tbw-filter-range-group";
|
|
2169
|
-
const
|
|
2170
|
-
|
|
2171
|
-
const
|
|
2172
|
-
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2175
|
-
const
|
|
2176
|
-
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2179
|
-
const x = document.createElement("input");
|
|
2180
|
-
x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(m);
|
|
2268
|
+
const T = document.createElement("label");
|
|
2269
|
+
T.textContent = "Max", T.className = "tbw-filter-range-label";
|
|
2270
|
+
const R = document.createElement("input");
|
|
2271
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(x), w.appendChild(T), w.appendChild(R), E.appendChild(w), e.appendChild(E);
|
|
2272
|
+
const I = document.createElement("div");
|
|
2273
|
+
I.className = "tbw-filter-range-slider";
|
|
2274
|
+
const N = document.createElement("div");
|
|
2275
|
+
N.className = "tbw-filter-range-track";
|
|
2276
|
+
const v = document.createElement("div");
|
|
2277
|
+
v.className = "tbw-filter-range-fill";
|
|
2181
2278
|
const C = document.createElement("input");
|
|
2182
|
-
C.type = "range", C.className = "tbw-filter-range-thumb tbw-filter-range-thumb-
|
|
2183
|
-
const
|
|
2184
|
-
|
|
2185
|
-
|
|
2279
|
+
C.type = "range", C.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", C.min = String(h), C.max = String(f), C.step = String(g), C.value = String(m);
|
|
2280
|
+
const L = document.createElement("input");
|
|
2281
|
+
L.type = "range", L.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", L.min = String(h), L.max = String(f), L.step = String(g), L.value = String(x), I.appendChild(N), I.appendChild(v), I.appendChild(C), I.appendChild(L), e.appendChild(I);
|
|
2282
|
+
const S = () => {
|
|
2283
|
+
const A = parseFloat(C.value), B = parseFloat(L.value), Q = f - h, Re = (A - h) / Q * 100, vt = (B - h) / Q * 100;
|
|
2284
|
+
v.style.left = `${Re}%`, v.style.width = `${vt - Re}%`;
|
|
2186
2285
|
};
|
|
2187
|
-
|
|
2188
|
-
const
|
|
2189
|
-
|
|
2190
|
-
}),
|
|
2191
|
-
const
|
|
2192
|
-
|
|
2193
|
-
}),
|
|
2194
|
-
let
|
|
2195
|
-
|
|
2196
|
-
}),
|
|
2197
|
-
let
|
|
2198
|
-
|
|
2199
|
-
}),
|
|
2200
|
-
const
|
|
2201
|
-
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2204
|
-
const
|
|
2205
|
-
t.applyTextFilter("between",
|
|
2206
|
-
}),
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2286
|
+
C.addEventListener("input", () => {
|
|
2287
|
+
const A = Math.min(parseFloat(C.value), parseFloat(L.value));
|
|
2288
|
+
C.value = String(A), _.value = String(A), S();
|
|
2289
|
+
}), L.addEventListener("input", () => {
|
|
2290
|
+
const A = Math.max(parseFloat(L.value), parseFloat(C.value));
|
|
2291
|
+
L.value = String(A), R.value = String(A), S();
|
|
2292
|
+
}), _.addEventListener("input", () => {
|
|
2293
|
+
let A = parseFloat(_.value) || h;
|
|
2294
|
+
A = Math.max(h, Math.min(A, parseFloat(R.value))), C.value = String(A), S();
|
|
2295
|
+
}), R.addEventListener("input", () => {
|
|
2296
|
+
let A = parseFloat(R.value) || f;
|
|
2297
|
+
A = Math.min(f, Math.max(A, parseFloat(_.value))), L.value = String(A), S();
|
|
2298
|
+
}), S();
|
|
2299
|
+
const k = document.createElement("div");
|
|
2300
|
+
k.className = "tbw-filter-buttons";
|
|
2301
|
+
const M = document.createElement("button");
|
|
2302
|
+
M.className = "tbw-filter-apply-btn", M.textContent = "Apply", M.addEventListener("click", () => {
|
|
2303
|
+
const A = parseFloat(_.value), B = parseFloat(R.value);
|
|
2304
|
+
t.applyTextFilter("between", A, B);
|
|
2305
|
+
}), k.appendChild(M);
|
|
2306
|
+
const y = document.createElement("button");
|
|
2307
|
+
y.className = "tbw-filter-clear-btn", y.textContent = "Clear Filter", y.addEventListener("click", () => {
|
|
2209
2308
|
t.clearFilter();
|
|
2210
|
-
}),
|
|
2309
|
+
}), k.appendChild(y), e.appendChild(k);
|
|
2211
2310
|
}
|
|
2212
2311
|
renderDateFilterPanel(e, t, i) {
|
|
2213
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((
|
|
2214
|
-
let m = "",
|
|
2215
|
-
const
|
|
2216
|
-
p?.operator === "between" ? (m = h(p.value) || "",
|
|
2312
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((y) => y instanceof Date || typeof y == "string" && !isNaN(Date.parse(y))).map((y) => y instanceof Date ? y : new Date(y)).filter((y) => !isNaN(y.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((y) => y.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((y) => y.getTime()))) : null, u = (y) => y ? y.toISOString().split("T")[0] : "", h = (y) => y ? typeof y == "string" ? y : typeof y == "number" ? u(new Date(y)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
2313
|
+
let m = "", x = "";
|
|
2314
|
+
const E = p?.operator === "blank";
|
|
2315
|
+
p?.operator === "between" ? (m = h(p.value) || "", x = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? m = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (x = h(p.value) || "");
|
|
2217
2316
|
const P = document.createElement("div");
|
|
2218
2317
|
P.className = "tbw-filter-date-range";
|
|
2219
2318
|
const D = document.createElement("div");
|
|
2220
2319
|
D.className = "tbw-filter-date-group";
|
|
2221
|
-
const
|
|
2222
|
-
|
|
2320
|
+
const _ = document.createElement("label");
|
|
2321
|
+
_.textContent = "From", _.className = "tbw-filter-range-label";
|
|
2223
2322
|
const b = document.createElement("input");
|
|
2224
|
-
b.type = "date", b.className = "tbw-filter-date-input", f && (b.min = f), g && (b.max = g), b.value = m, D.appendChild(
|
|
2323
|
+
b.type = "date", b.className = "tbw-filter-date-input", f && (b.min = f), g && (b.max = g), b.value = m, D.appendChild(_), D.appendChild(b), P.appendChild(D);
|
|
2225
2324
|
const w = document.createElement("span");
|
|
2226
2325
|
w.className = "tbw-filter-range-separator", w.textContent = "–", P.appendChild(w);
|
|
2227
|
-
const F = document.createElement("div");
|
|
2228
|
-
F.className = "tbw-filter-date-group";
|
|
2229
|
-
const S = document.createElement("label");
|
|
2230
|
-
S.textContent = "To", S.className = "tbw-filter-range-label";
|
|
2231
|
-
const y = document.createElement("input");
|
|
2232
|
-
y.type = "date", y.className = "tbw-filter-date-input", f && (y.min = f), g && (y.max = g), y.value = v, F.appendChild(S), F.appendChild(y), P.appendChild(F), e.appendChild(P);
|
|
2233
|
-
const _ = document.createElement("label");
|
|
2234
|
-
_.className = "tbw-filter-blank-option";
|
|
2235
|
-
const L = document.createElement("input");
|
|
2236
|
-
L.type = "checkbox", L.className = "tbw-filter-blank-checkbox", L.checked = R;
|
|
2237
|
-
const x = document.createTextNode("Show only blank");
|
|
2238
|
-
_.appendChild(L), _.appendChild(x);
|
|
2239
|
-
const C = (E) => {
|
|
2240
|
-
b.disabled = E, y.disabled = E, P.classList.toggle("tbw-filter-disabled", E);
|
|
2241
|
-
};
|
|
2242
|
-
C(R), L.addEventListener("change", () => {
|
|
2243
|
-
C(L.checked);
|
|
2244
|
-
}), e.appendChild(_);
|
|
2245
2326
|
const T = document.createElement("div");
|
|
2246
|
-
T.className = "tbw-filter-
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
|
|
2327
|
+
T.className = "tbw-filter-date-group";
|
|
2328
|
+
const R = document.createElement("label");
|
|
2329
|
+
R.textContent = "To", R.className = "tbw-filter-range-label";
|
|
2330
|
+
const I = document.createElement("input");
|
|
2331
|
+
I.type = "date", I.className = "tbw-filter-date-input", f && (I.min = f), g && (I.max = g), I.value = x, T.appendChild(R), T.appendChild(I), P.appendChild(T), e.appendChild(P);
|
|
2332
|
+
const N = document.createElement("label");
|
|
2333
|
+
N.className = "tbw-filter-blank-option";
|
|
2334
|
+
const v = document.createElement("input");
|
|
2335
|
+
v.type = "checkbox", v.className = "tbw-filter-blank-checkbox", v.checked = E;
|
|
2336
|
+
const C = document.createTextNode("Show only blank");
|
|
2337
|
+
N.appendChild(v), N.appendChild(C);
|
|
2338
|
+
const L = (y) => {
|
|
2339
|
+
b.disabled = y, I.disabled = y, P.classList.toggle("tbw-filter-disabled", y);
|
|
2340
|
+
};
|
|
2341
|
+
L(E), v.addEventListener("change", () => {
|
|
2342
|
+
L(v.checked);
|
|
2343
|
+
}), e.appendChild(N);
|
|
2344
|
+
const S = document.createElement("div");
|
|
2345
|
+
S.className = "tbw-filter-buttons";
|
|
2346
|
+
const k = document.createElement("button");
|
|
2347
|
+
k.className = "tbw-filter-apply-btn", k.textContent = "Apply", k.addEventListener("click", () => {
|
|
2348
|
+
if (v.checked) {
|
|
2250
2349
|
t.applyTextFilter("blank", "");
|
|
2251
2350
|
return;
|
|
2252
2351
|
}
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2255
|
-
}),
|
|
2256
|
-
const
|
|
2257
|
-
|
|
2352
|
+
const y = b.value, A = I.value;
|
|
2353
|
+
y && A ? t.applyTextFilter("between", y, A) : y ? t.applyTextFilter("greaterThanOrEqual", y) : A ? t.applyTextFilter("lessThanOrEqual", A) : t.clearFilter();
|
|
2354
|
+
}), S.appendChild(k);
|
|
2355
|
+
const M = document.createElement("button");
|
|
2356
|
+
M.className = "tbw-filter-clear-btn", M.textContent = "Clear Filter", M.addEventListener("click", () => {
|
|
2258
2357
|
t.clearFilter();
|
|
2259
|
-
}),
|
|
2358
|
+
}), S.appendChild(M), e.appendChild(S);
|
|
2260
2359
|
}
|
|
2261
2360
|
applySetFilter(e, t) {
|
|
2262
2361
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -2284,7 +2383,8 @@ class z extends I {
|
|
|
2284
2383
|
const i = this.config.filterHandler(e, this.sourceRows), n = (r) => {
|
|
2285
2384
|
t.removeAttribute("aria-busy"), this.cachedResult = r, this.grid.rows = r, this.emit("filter-change", {
|
|
2286
2385
|
filters: e,
|
|
2287
|
-
filteredRowCount: r.length
|
|
2386
|
+
filteredRowCount: r.length,
|
|
2387
|
+
selected: this.computeSelected()
|
|
2288
2388
|
}), this.emitPluginEvent("filter-applied", { filters: e }), this.requestRender();
|
|
2289
2389
|
};
|
|
2290
2390
|
i && typeof i.then == "function" ? i.then(n) : n(i);
|
|
@@ -2292,7 +2392,8 @@ class z extends I {
|
|
|
2292
2392
|
}
|
|
2293
2393
|
this.emit("filter-change", {
|
|
2294
2394
|
filters: e,
|
|
2295
|
-
filteredRowCount: 0
|
|
2395
|
+
filteredRowCount: 0,
|
|
2396
|
+
selected: this.computeSelected()
|
|
2296
2397
|
}), this.emitPluginEvent("filter-applied", { filters: e }), this.requestRender();
|
|
2297
2398
|
}
|
|
2298
2399
|
getColumnState(e) {
|
|
@@ -2322,7 +2423,7 @@ class z extends I {
|
|
|
2322
2423
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null, this.cachedInputSpot = null;
|
|
2323
2424
|
}
|
|
2324
2425
|
}
|
|
2325
|
-
function
|
|
2426
|
+
function Ke(a) {
|
|
2326
2427
|
if (!a.length) return [];
|
|
2327
2428
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, s) => {
|
|
2328
2429
|
if (!s.length) return;
|
|
@@ -2357,7 +2458,7 @@ function Ge(a) {
|
|
|
2357
2458
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
2358
2459
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === a.length ? [] : t;
|
|
2359
2460
|
}
|
|
2360
|
-
function
|
|
2461
|
+
function ri(a, e, t) {
|
|
2361
2462
|
if (!e.length || !a) return;
|
|
2362
2463
|
const i = /* @__PURE__ */ new Map();
|
|
2363
2464
|
for (const r of e)
|
|
@@ -2373,7 +2474,7 @@ function ii(a, e, t) {
|
|
|
2373
2474
|
s && s.classList.add("group-end");
|
|
2374
2475
|
}
|
|
2375
2476
|
}
|
|
2376
|
-
function
|
|
2477
|
+
function oi(a, e) {
|
|
2377
2478
|
if (a.length === 0) return null;
|
|
2378
2479
|
const t = document.createElement("div");
|
|
2379
2480
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -2385,11 +2486,11 @@ function ni(a, e) {
|
|
|
2385
2486
|
}
|
|
2386
2487
|
return t;
|
|
2387
2488
|
}
|
|
2388
|
-
function
|
|
2489
|
+
function si(a) {
|
|
2389
2490
|
return a.some((e) => e.group != null);
|
|
2390
2491
|
}
|
|
2391
|
-
const
|
|
2392
|
-
class
|
|
2492
|
+
const ai = "@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)}}";
|
|
2493
|
+
class Mn extends F {
|
|
2393
2494
|
static manifest = {
|
|
2394
2495
|
ownedProperties: [
|
|
2395
2496
|
{
|
|
@@ -2407,7 +2508,7 @@ class Fn extends I {
|
|
|
2407
2508
|
queries: [{ type: "getColumnGrouping", description: "Returns column group metadata for the visibility panel" }]
|
|
2408
2509
|
};
|
|
2409
2510
|
name = "groupingColumns";
|
|
2410
|
-
styles =
|
|
2511
|
+
styles = ai;
|
|
2411
2512
|
get defaultConfig() {
|
|
2412
2513
|
return {
|
|
2413
2514
|
showGroupBorders: !0,
|
|
@@ -2439,7 +2540,7 @@ class Fn extends I {
|
|
|
2439
2540
|
};
|
|
2440
2541
|
#o(e) {
|
|
2441
2542
|
this.#t.clear();
|
|
2442
|
-
const t = this.#
|
|
2543
|
+
const t = this.#s(e);
|
|
2443
2544
|
for (const i of this.groups) {
|
|
2444
2545
|
const n = new Set(i.columns.map((r) => r.field));
|
|
2445
2546
|
for (let r = e.length - 1; r >= 0; r--)
|
|
@@ -2450,7 +2551,7 @@ class Fn extends I {
|
|
|
2450
2551
|
}
|
|
2451
2552
|
}
|
|
2452
2553
|
}
|
|
2453
|
-
#
|
|
2554
|
+
#s(e) {
|
|
2454
2555
|
if (this.groups.length === 0) return null;
|
|
2455
2556
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
2456
2557
|
const i = e[t];
|
|
@@ -2478,9 +2579,9 @@ class Fn extends I {
|
|
|
2478
2579
|
}
|
|
2479
2580
|
handleQuery(e) {
|
|
2480
2581
|
if (e.type === "getColumnGrouping")
|
|
2481
|
-
return this.#
|
|
2582
|
+
return this.#r();
|
|
2482
2583
|
}
|
|
2483
|
-
#
|
|
2584
|
+
#r() {
|
|
2484
2585
|
let e;
|
|
2485
2586
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
2486
2587
|
if (t && Array.isArray(t) && t.length > 0)
|
|
@@ -2522,7 +2623,7 @@ class Fn extends I {
|
|
|
2522
2623
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
2523
2624
|
return !0;
|
|
2524
2625
|
const i = t?.columns;
|
|
2525
|
-
return Array.isArray(i) ?
|
|
2626
|
+
return Array.isArray(i) ? si(i) : !1;
|
|
2526
2627
|
}
|
|
2527
2628
|
processColumns(e) {
|
|
2528
2629
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -2538,7 +2639,7 @@ class Fn extends I {
|
|
|
2538
2639
|
});
|
|
2539
2640
|
} else
|
|
2540
2641
|
i = [...e];
|
|
2541
|
-
const n =
|
|
2642
|
+
const n = Ke(i);
|
|
2542
2643
|
if (n.length === 0)
|
|
2543
2644
|
return this.isActive = !1, this.groups = [], i;
|
|
2544
2645
|
this.isActive = !0, this.groups = n, this.#t.clear();
|
|
@@ -2558,21 +2659,21 @@ class Fn extends I {
|
|
|
2558
2659
|
if (!e) return;
|
|
2559
2660
|
const t = e.querySelector(".header-group-row");
|
|
2560
2661
|
t && t.remove();
|
|
2561
|
-
const i = this.visibleColumns, n =
|
|
2662
|
+
const i = this.visibleColumns, n = Ke(i);
|
|
2562
2663
|
if (n.length === 0) return;
|
|
2563
2664
|
this.#t.clear();
|
|
2564
2665
|
for (let s = 0; s < n.length; s++) {
|
|
2565
2666
|
const l = n[s], d = l.columns[l.columns.length - 1];
|
|
2566
2667
|
d?.field && s < n.length - 1 && this.#t.add(d.field);
|
|
2567
2668
|
}
|
|
2568
|
-
const r =
|
|
2669
|
+
const r = oi(n, i);
|
|
2569
2670
|
if (r) {
|
|
2570
2671
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
2571
2672
|
const s = e.querySelector(".header-row");
|
|
2572
2673
|
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2573
2674
|
}
|
|
2574
2675
|
const o = e.querySelector(".header-row");
|
|
2575
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
2676
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), ri(o, n));
|
|
2576
2677
|
}
|
|
2577
2678
|
afterCellRender(e) {
|
|
2578
2679
|
!this.isActive || !this.config.showGroupBorders || e.cellElement.classList.toggle("group-end", this.#t.has(e.column.field));
|
|
@@ -2591,7 +2692,7 @@ class Fn extends I {
|
|
|
2591
2692
|
this.requestRender();
|
|
2592
2693
|
}
|
|
2593
2694
|
}
|
|
2594
|
-
function
|
|
2695
|
+
function ze({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
2595
2696
|
const n = e.groupOn;
|
|
2596
2697
|
if (typeof n != "function")
|
|
2597
2698
|
return [];
|
|
@@ -2624,20 +2725,20 @@ function Ke({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2624
2725
|
};
|
|
2625
2726
|
return l(r), s;
|
|
2626
2727
|
}
|
|
2627
|
-
function
|
|
2728
|
+
function li(a, e) {
|
|
2628
2729
|
const t = new Set(a);
|
|
2629
2730
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2630
2731
|
}
|
|
2631
|
-
function
|
|
2732
|
+
function di(a) {
|
|
2632
2733
|
const e = /* @__PURE__ */ new Set();
|
|
2633
2734
|
for (const t of a)
|
|
2634
2735
|
t.kind === "group" && e.add(t.key);
|
|
2635
2736
|
return e;
|
|
2636
2737
|
}
|
|
2637
|
-
function
|
|
2738
|
+
function ci() {
|
|
2638
2739
|
return /* @__PURE__ */ new Set();
|
|
2639
2740
|
}
|
|
2640
|
-
function
|
|
2741
|
+
function ui(a, e) {
|
|
2641
2742
|
if (a === !0)
|
|
2642
2743
|
return new Set(e);
|
|
2643
2744
|
if (a === !1 || a == null)
|
|
@@ -2648,14 +2749,14 @@ function di(a, e) {
|
|
|
2648
2749
|
}
|
|
2649
2750
|
return typeof a == "string" ? /* @__PURE__ */ new Set([a]) : Array.isArray(a) ? new Set(a) : /* @__PURE__ */ new Set();
|
|
2650
2751
|
}
|
|
2651
|
-
function
|
|
2752
|
+
function hi(a) {
|
|
2652
2753
|
return a.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2653
2754
|
}
|
|
2654
|
-
function
|
|
2755
|
+
function fi(a) {
|
|
2655
2756
|
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2656
2757
|
}
|
|
2657
|
-
const
|
|
2658
|
-
class
|
|
2758
|
+
const gi = "@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}}}";
|
|
2759
|
+
class Dn extends F {
|
|
2659
2760
|
static manifest = {
|
|
2660
2761
|
events: [
|
|
2661
2762
|
{
|
|
@@ -2682,7 +2783,7 @@ class Pn extends I {
|
|
|
2682
2783
|
]
|
|
2683
2784
|
};
|
|
2684
2785
|
name = "groupingRows";
|
|
2685
|
-
styles =
|
|
2786
|
+
styles = gi;
|
|
2686
2787
|
get defaultConfig() {
|
|
2687
2788
|
return {
|
|
2688
2789
|
defaultExpanded: !1,
|
|
@@ -2720,7 +2821,7 @@ class Pn extends I {
|
|
|
2720
2821
|
const t = this.config;
|
|
2721
2822
|
if (typeof t.groupOn != "function")
|
|
2722
2823
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2723
|
-
const i =
|
|
2824
|
+
const i = ze({
|
|
2724
2825
|
rows: [...e],
|
|
2725
2826
|
config: t,
|
|
2726
2827
|
expanded: /* @__PURE__ */ new Set()
|
|
@@ -2729,10 +2830,10 @@ class Pn extends I {
|
|
|
2729
2830
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2730
2831
|
let n;
|
|
2731
2832
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2732
|
-
const s =
|
|
2733
|
-
n =
|
|
2833
|
+
const s = hi(i);
|
|
2834
|
+
n = ui(t.defaultExpanded ?? !1, s), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2734
2835
|
}
|
|
2735
|
-
const r =
|
|
2836
|
+
const r = ze({
|
|
2736
2837
|
rows: [...e],
|
|
2737
2838
|
config: t,
|
|
2738
2839
|
expanded: this.expandedKeys,
|
|
@@ -2752,7 +2853,7 @@ class Pn extends I {
|
|
|
2752
2853
|
__groupDepth: s.depth,
|
|
2753
2854
|
__groupRows: s.rows,
|
|
2754
2855
|
__groupExpanded: s.expanded,
|
|
2755
|
-
__groupRowCount:
|
|
2856
|
+
__groupRowCount: fi(s),
|
|
2756
2857
|
__rowCacheKey: `group:${s.key}`
|
|
2757
2858
|
} : s.row);
|
|
2758
2859
|
}
|
|
@@ -2825,7 +2926,7 @@ class Pn extends I {
|
|
|
2825
2926
|
const c = document.createElement("span");
|
|
2826
2927
|
c.className = "group-aggregates";
|
|
2827
2928
|
for (const [u, h] of d) {
|
|
2828
|
-
const f = this.columns.find((p) => p.field === u), g =
|
|
2929
|
+
const f = this.columns.find((p) => p.field === u), g = ae(h, o, u, f);
|
|
2829
2930
|
if (g != null) {
|
|
2830
2931
|
const p = document.createElement("span");
|
|
2831
2932
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
@@ -2843,14 +2944,14 @@ class Pn extends I {
|
|
|
2843
2944
|
let c = !1;
|
|
2844
2945
|
o.forEach((u, h) => {
|
|
2845
2946
|
const f = document.createElement("div");
|
|
2846
|
-
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"),
|
|
2947
|
+
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), se(u)) {
|
|
2847
2948
|
f.setAttribute("data-field", u.field), t.appendChild(f);
|
|
2848
2949
|
return;
|
|
2849
2950
|
}
|
|
2850
2951
|
if (c) {
|
|
2851
2952
|
const g = r[u.field];
|
|
2852
2953
|
if (g) {
|
|
2853
|
-
const p =
|
|
2954
|
+
const p = ae(g, s, u.field, u);
|
|
2854
2955
|
f.textContent = p != null ? String(p) : "";
|
|
2855
2956
|
} else
|
|
2856
2957
|
f.textContent = "";
|
|
@@ -2858,7 +2959,7 @@ class Pn extends I {
|
|
|
2858
2959
|
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2859
2960
|
const g = document.createElement("span"), p = r[u.field];
|
|
2860
2961
|
if (p) {
|
|
2861
|
-
const m =
|
|
2962
|
+
const m = ae(p, s, u.field, u);
|
|
2862
2963
|
g.textContent = m != null ? String(m) : String(e.__groupValue);
|
|
2863
2964
|
} else
|
|
2864
2965
|
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
@@ -2871,10 +2972,10 @@ class Pn extends I {
|
|
|
2871
2972
|
});
|
|
2872
2973
|
}
|
|
2873
2974
|
expandAll() {
|
|
2874
|
-
this.expandedKeys =
|
|
2975
|
+
this.expandedKeys = di(this.flattenedRows), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2875
2976
|
}
|
|
2876
2977
|
collapseAll() {
|
|
2877
|
-
this.expandedKeys =
|
|
2978
|
+
this.expandedKeys = ci(), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2878
2979
|
}
|
|
2879
2980
|
toggle(e) {
|
|
2880
2981
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2889,7 +2990,7 @@ class Pn extends I {
|
|
|
2889
2990
|
}
|
|
2890
2991
|
r.add(e), this.expandedKeys = r;
|
|
2891
2992
|
} else
|
|
2892
|
-
this.expandedKeys =
|
|
2993
|
+
this.expandedKeys = li(this.expandedKeys, e);
|
|
2893
2994
|
this.emit("group-toggle", {
|
|
2894
2995
|
key: e,
|
|
2895
2996
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2939,22 +3040,22 @@ class Pn extends I {
|
|
|
2939
3040
|
this.config.groupOn = e, this.requestRender();
|
|
2940
3041
|
}
|
|
2941
3042
|
}
|
|
2942
|
-
function
|
|
3043
|
+
function Oe(a, e) {
|
|
2943
3044
|
const t = new Set(a);
|
|
2944
3045
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2945
3046
|
}
|
|
2946
|
-
function
|
|
3047
|
+
function pi(a, e) {
|
|
2947
3048
|
const t = new Set(a);
|
|
2948
3049
|
return t.add(e), t;
|
|
2949
3050
|
}
|
|
2950
|
-
function
|
|
3051
|
+
function mi(a, e) {
|
|
2951
3052
|
const t = new Set(a);
|
|
2952
3053
|
return t.delete(e), t;
|
|
2953
3054
|
}
|
|
2954
|
-
function
|
|
3055
|
+
function bi(a, e) {
|
|
2955
3056
|
return a.has(e);
|
|
2956
3057
|
}
|
|
2957
|
-
function
|
|
3058
|
+
function wi(a, e, t, i) {
|
|
2958
3059
|
const n = document.createElement("div");
|
|
2959
3060
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2960
3061
|
const r = document.createElement("div");
|
|
@@ -2962,10 +3063,10 @@ function mi(a, e, t, i) {
|
|
|
2962
3063
|
const o = t(a, e);
|
|
2963
3064
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2964
3065
|
}
|
|
2965
|
-
const
|
|
2966
|
-
class
|
|
3066
|
+
const vi = "@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}}}";
|
|
3067
|
+
class ut extends F {
|
|
2967
3068
|
name = "masterDetail";
|
|
2968
|
-
styles =
|
|
3069
|
+
styles = vi;
|
|
2969
3070
|
get defaultConfig() {
|
|
2970
3071
|
return {
|
|
2971
3072
|
detailHeight: "auto",
|
|
@@ -2994,8 +3095,8 @@ class ct extends I {
|
|
|
2994
3095
|
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));
|
|
2995
3096
|
const c = t.innerHTML.trim();
|
|
2996
3097
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2997
|
-
const f =
|
|
2998
|
-
return
|
|
3098
|
+
const f = at(c, { value: u, row: u });
|
|
3099
|
+
return lt(f);
|
|
2999
3100
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
3000
3101
|
}
|
|
3001
3102
|
get animationStyle() {
|
|
@@ -3042,10 +3143,10 @@ class ct extends I {
|
|
|
3042
3143
|
return this.measuredDetailHeights.set(e, r), r;
|
|
3043
3144
|
}
|
|
3044
3145
|
const i = this.measuredDetailHeights.get(e);
|
|
3045
|
-
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
3146
|
+
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : ut.DEFAULT_DETAIL_HEIGHT;
|
|
3046
3147
|
}
|
|
3047
3148
|
toggleAndEmit(e, t) {
|
|
3048
|
-
this.expandedRows =
|
|
3149
|
+
this.expandedRows = Oe(this.expandedRows, e);
|
|
3049
3150
|
const i = this.expandedRows.has(e);
|
|
3050
3151
|
i && this.rowsToAnimate.add(e), this.emit("detail-expand", {
|
|
3051
3152
|
rowIndex: t,
|
|
@@ -3060,9 +3161,9 @@ class ct extends I {
|
|
|
3060
3161
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
3061
3162
|
return [...e];
|
|
3062
3163
|
const i = [...e];
|
|
3063
|
-
if (
|
|
3164
|
+
if (ei(i))
|
|
3064
3165
|
return i;
|
|
3065
|
-
const r =
|
|
3166
|
+
const r = ti(this.name);
|
|
3066
3167
|
return r.viewRenderer = (o) => {
|
|
3067
3168
|
const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
|
|
3068
3169
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -3082,7 +3183,7 @@ class ct extends I {
|
|
|
3082
3183
|
onKeyDown(e) {
|
|
3083
3184
|
if (e.key !== " ") return;
|
|
3084
3185
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
3085
|
-
if (!n || !
|
|
3186
|
+
if (!n || !se(n)) return;
|
|
3086
3187
|
const r = this.rows[i];
|
|
3087
3188
|
if (r)
|
|
3088
3189
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -3123,7 +3224,7 @@ class ct extends I {
|
|
|
3123
3224
|
f.previousElementSibling !== u && u.after(f);
|
|
3124
3225
|
continue;
|
|
3125
3226
|
}
|
|
3126
|
-
const g =
|
|
3227
|
+
const g = wi(h, c, this.config.detailRenderer, o);
|
|
3127
3228
|
typeof this.config.detailHeight == "number" && (g.style.height = `${this.config.detailHeight}px`), u.after(g), this.detailElements.set(h, g);
|
|
3128
3229
|
const p = this.rowsToAnimate.has(h);
|
|
3129
3230
|
p && this.rowsToAnimate.delete(h), p && this.animateExpand(g, h, c) || requestAnimationFrame(() => {
|
|
@@ -3178,19 +3279,19 @@ class ct extends I {
|
|
|
3178
3279
|
}
|
|
3179
3280
|
expand(e) {
|
|
3180
3281
|
const t = this.rows[e];
|
|
3181
|
-
t && (this.rowsToAnimate.add(t), this.expandedRows =
|
|
3282
|
+
t && (this.rowsToAnimate.add(t), this.expandedRows = pi(this.expandedRows, t), this.requestRender());
|
|
3182
3283
|
}
|
|
3183
3284
|
collapse(e) {
|
|
3184
3285
|
const t = this.rows[e];
|
|
3185
|
-
t && (this.expandedRows =
|
|
3286
|
+
t && (this.expandedRows = mi(this.expandedRows, t), this.requestRender());
|
|
3186
3287
|
}
|
|
3187
3288
|
toggle(e) {
|
|
3188
3289
|
const t = this.rows[e];
|
|
3189
|
-
t && (this.expandedRows =
|
|
3290
|
+
t && (this.expandedRows = Oe(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
|
|
3190
3291
|
}
|
|
3191
3292
|
isExpanded(e) {
|
|
3192
3293
|
const t = this.rows[e];
|
|
3193
|
-
return t ?
|
|
3294
|
+
return t ? bi(this.expandedRows, t) : !1;
|
|
3194
3295
|
}
|
|
3195
3296
|
expandAll() {
|
|
3196
3297
|
for (const e of this.rows)
|
|
@@ -3220,34 +3321,34 @@ class ct extends I {
|
|
|
3220
3321
|
}
|
|
3221
3322
|
}
|
|
3222
3323
|
}
|
|
3223
|
-
function
|
|
3324
|
+
function yi(a, e, t) {
|
|
3224
3325
|
return e.length ? [...a].sort((i, n) => {
|
|
3225
3326
|
for (const r of e) {
|
|
3226
|
-
const s = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
3327
|
+
const s = t.find((u) => u.field === r.field)?.sortComparator ?? xi, l = i[r.field], d = n[r.field], c = s(l, d, i, n);
|
|
3227
3328
|
if (c !== 0)
|
|
3228
3329
|
return r.direction === "asc" ? c : -c;
|
|
3229
3330
|
}
|
|
3230
3331
|
return 0;
|
|
3231
3332
|
}) : [...a];
|
|
3232
3333
|
}
|
|
3233
|
-
function
|
|
3334
|
+
function xi(a, e) {
|
|
3234
3335
|
return a == null && e == null ? 0 : a == null ? 1 : e == null ? -1 : typeof a == "number" && typeof e == "number" ? a - e : a instanceof Date && e instanceof Date ? a.getTime() - e.getTime() : typeof a == "boolean" && typeof e == "boolean" ? a === e ? 0 : a ? -1 : 1 : String(a).localeCompare(String(e));
|
|
3235
3336
|
}
|
|
3236
|
-
function
|
|
3337
|
+
function Ci(a, e, t, i) {
|
|
3237
3338
|
const n = a.find((r) => r.field === e);
|
|
3238
3339
|
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" }];
|
|
3239
3340
|
}
|
|
3240
|
-
function
|
|
3341
|
+
function Be(a, e) {
|
|
3241
3342
|
const t = a.findIndex((i) => i.field === e);
|
|
3242
3343
|
return t >= 0 ? t + 1 : void 0;
|
|
3243
3344
|
}
|
|
3244
|
-
function
|
|
3345
|
+
function Ve(a, e) {
|
|
3245
3346
|
return a.find((t) => t.field === e)?.direction;
|
|
3246
3347
|
}
|
|
3247
|
-
const
|
|
3248
|
-
class
|
|
3348
|
+
const Ei = '@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}}';
|
|
3349
|
+
class qn extends F {
|
|
3249
3350
|
name = "multiSort";
|
|
3250
|
-
styles =
|
|
3351
|
+
styles = Ei;
|
|
3251
3352
|
get defaultConfig() {
|
|
3252
3353
|
return {
|
|
3253
3354
|
maxSortColumns: 3,
|
|
@@ -3255,16 +3356,23 @@ class Dn extends I {
|
|
|
3255
3356
|
};
|
|
3256
3357
|
}
|
|
3257
3358
|
sortModel = [];
|
|
3359
|
+
cachedSortResult = null;
|
|
3258
3360
|
detach() {
|
|
3259
|
-
this.sortModel = [];
|
|
3361
|
+
this.sortModel = [], this.cachedSortResult = null;
|
|
3260
3362
|
}
|
|
3261
3363
|
processRows(e) {
|
|
3262
|
-
|
|
3364
|
+
if (this.sortModel.length === 0)
|
|
3365
|
+
return this.cachedSortResult = null, [...e];
|
|
3366
|
+
const t = this.gridElement;
|
|
3367
|
+
if (t && !t._isGridEditMode && typeof t._activeEditRows == "number" && t._activeEditRows !== -1 && this.cachedSortResult && this.cachedSortResult.length === e.length)
|
|
3368
|
+
return [...this.cachedSortResult];
|
|
3369
|
+
const i = yi([...e], this.sortModel, [...this.columns]);
|
|
3370
|
+
return this.cachedSortResult = i, i;
|
|
3263
3371
|
}
|
|
3264
3372
|
onHeaderClick(e) {
|
|
3265
3373
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
3266
3374
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
3267
|
-
return this.sortModel =
|
|
3375
|
+
return this.sortModel = Ci(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), this.grid?.requestStateChange?.(), !0;
|
|
3268
3376
|
}
|
|
3269
3377
|
afterRender() {
|
|
3270
3378
|
const e = this.gridElement;
|
|
@@ -3273,7 +3381,7 @@ class Dn extends I {
|
|
|
3273
3381
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
3274
3382
|
const r = n.getAttribute("data-field");
|
|
3275
3383
|
if (!r) return;
|
|
3276
|
-
const o =
|
|
3384
|
+
const o = Be(this.sortModel, r), s = Ve(this.sortModel, r);
|
|
3277
3385
|
if (n.querySelector(".sort-index")?.remove(), s) {
|
|
3278
3386
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
|
|
3279
3387
|
const c = document.createElement("span");
|
|
@@ -3291,16 +3399,16 @@ class Dn extends I {
|
|
|
3291
3399
|
return [...this.sortModel];
|
|
3292
3400
|
}
|
|
3293
3401
|
setSortModel(e) {
|
|
3294
|
-
this.sortModel = [...e], this.emit("sort-change", { sortModel: [...e] }), this.requestRender();
|
|
3402
|
+
this.sortModel = [...e], this.emit("sort-change", { sortModel: [...e] }), this.requestRender(), this.grid?.requestStateChange?.();
|
|
3295
3403
|
}
|
|
3296
3404
|
clearSort() {
|
|
3297
|
-
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
3405
|
+
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender(), this.grid?.requestStateChange?.();
|
|
3298
3406
|
}
|
|
3299
3407
|
getSortIndex(e) {
|
|
3300
|
-
return
|
|
3408
|
+
return Be(this.sortModel, e);
|
|
3301
3409
|
}
|
|
3302
3410
|
getSortDirection(e) {
|
|
3303
|
-
return
|
|
3411
|
+
return Ve(this.sortModel, e);
|
|
3304
3412
|
}
|
|
3305
3413
|
getColumnState(e) {
|
|
3306
3414
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -3326,33 +3434,33 @@ class Dn extends I {
|
|
|
3326
3434
|
function O(a) {
|
|
3327
3435
|
return a.pinned ?? a.sticky ?? a.meta?.pinned ?? a.meta?.sticky;
|
|
3328
3436
|
}
|
|
3329
|
-
function
|
|
3330
|
-
return
|
|
3331
|
-
}
|
|
3332
|
-
function ut(a, e) {
|
|
3333
|
-
const t = O(a);
|
|
3334
|
-
return t ? xe(t, e) === "left" : !1;
|
|
3437
|
+
function Ce(a, e) {
|
|
3438
|
+
return Et(a, e);
|
|
3335
3439
|
}
|
|
3336
3440
|
function ht(a, e) {
|
|
3337
3441
|
const t = O(a);
|
|
3338
|
-
return t ?
|
|
3442
|
+
return t ? Ce(t, e) === "left" : !1;
|
|
3339
3443
|
}
|
|
3340
|
-
function
|
|
3341
|
-
|
|
3444
|
+
function ft(a, e) {
|
|
3445
|
+
const t = O(a);
|
|
3446
|
+
return t ? Ce(t, e) === "right" : !1;
|
|
3342
3447
|
}
|
|
3343
|
-
function
|
|
3448
|
+
function Ri(a, e = "ltr") {
|
|
3344
3449
|
return a.filter((t) => ht(t, e));
|
|
3345
3450
|
}
|
|
3346
|
-
function
|
|
3451
|
+
function Si(a, e = "ltr") {
|
|
3452
|
+
return a.filter((t) => ft(t, e));
|
|
3453
|
+
}
|
|
3454
|
+
function ue(a) {
|
|
3347
3455
|
return a.some((e) => O(e) != null);
|
|
3348
3456
|
}
|
|
3349
|
-
function
|
|
3457
|
+
function $e(a, e) {
|
|
3350
3458
|
const t = Array.from(a.querySelectorAll(".header-row .cell"));
|
|
3351
3459
|
if (!t.length) return;
|
|
3352
3460
|
const i = te(a);
|
|
3353
3461
|
let n = 0;
|
|
3354
3462
|
for (const o of e)
|
|
3355
|
-
if (
|
|
3463
|
+
if (ht(o, i)) {
|
|
3356
3464
|
const s = t.find((l) => l.getAttribute("data-field") === o.field);
|
|
3357
3465
|
s && (s.classList.add("sticky-left"), s.style.position = "sticky", s.style.left = n + "px", a.querySelectorAll(`.data-grid-row .cell[data-field="${o.field}"]`).forEach((l) => {
|
|
3358
3466
|
l.classList.add("sticky-left"), l.style.position = "sticky", l.style.left = n + "px";
|
|
@@ -3360,28 +3468,28 @@ function Ve(a, e) {
|
|
|
3360
3468
|
}
|
|
3361
3469
|
let r = 0;
|
|
3362
3470
|
for (const o of [...e].reverse())
|
|
3363
|
-
if (
|
|
3471
|
+
if (ft(o, i)) {
|
|
3364
3472
|
const s = t.find((l) => l.getAttribute("data-field") === o.field);
|
|
3365
3473
|
s && (s.classList.add("sticky-right"), s.style.position = "sticky", s.style.right = r + "px", a.querySelectorAll(`.data-grid-row .cell[data-field="${o.field}"]`).forEach((l) => {
|
|
3366
3474
|
l.classList.add("sticky-right"), l.style.position = "sticky", l.style.right = r + "px";
|
|
3367
3475
|
}), r += s.offsetWidth);
|
|
3368
3476
|
}
|
|
3369
3477
|
}
|
|
3370
|
-
function
|
|
3478
|
+
function ki(a, e = "ltr") {
|
|
3371
3479
|
const t = [], i = [], n = [];
|
|
3372
3480
|
for (const r of a) {
|
|
3373
3481
|
const o = O(r);
|
|
3374
|
-
o ?
|
|
3482
|
+
o ? Ce(o, e) === "left" ? t.push(r) : n.push(r) : i.push(r);
|
|
3375
3483
|
}
|
|
3376
3484
|
return [...t, ...i, ...n];
|
|
3377
3485
|
}
|
|
3378
|
-
function
|
|
3486
|
+
function We(a) {
|
|
3379
3487
|
a.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
3380
3488
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
3381
3489
|
});
|
|
3382
3490
|
}
|
|
3383
|
-
const
|
|
3384
|
-
class
|
|
3491
|
+
const je = "canMoveColumn";
|
|
3492
|
+
class Nn extends F {
|
|
3385
3493
|
static manifest = {
|
|
3386
3494
|
ownedProperties: [
|
|
3387
3495
|
{
|
|
@@ -3405,7 +3513,7 @@ class Mn extends I {
|
|
|
3405
3513
|
],
|
|
3406
3514
|
queries: [
|
|
3407
3515
|
{
|
|
3408
|
-
type:
|
|
3516
|
+
type: je,
|
|
3409
3517
|
description: "Prevents pinned (sticky) columns from being moved/reordered"
|
|
3410
3518
|
},
|
|
3411
3519
|
{
|
|
@@ -3431,29 +3539,29 @@ class Mn extends I {
|
|
|
3431
3539
|
}
|
|
3432
3540
|
static detect(e, t) {
|
|
3433
3541
|
const i = t?.columns;
|
|
3434
|
-
return Array.isArray(i) ?
|
|
3542
|
+
return Array.isArray(i) ? ue(i) : !1;
|
|
3435
3543
|
}
|
|
3436
3544
|
processColumns(e) {
|
|
3437
3545
|
const t = [...e];
|
|
3438
|
-
if (this.isApplied =
|
|
3546
|
+
if (this.isApplied = ue(t), !this.isApplied) return t;
|
|
3439
3547
|
const i = this.gridElement, n = i ? te(i) : "ltr";
|
|
3440
|
-
return
|
|
3548
|
+
return ki(t, n);
|
|
3441
3549
|
}
|
|
3442
3550
|
afterRender() {
|
|
3443
3551
|
if (!this.isApplied)
|
|
3444
3552
|
return;
|
|
3445
3553
|
const e = this.grid, t = [...this.columns];
|
|
3446
|
-
if (!
|
|
3447
|
-
|
|
3554
|
+
if (!ue(t)) {
|
|
3555
|
+
We(e), this.isApplied = !1;
|
|
3448
3556
|
return;
|
|
3449
3557
|
}
|
|
3450
3558
|
queueMicrotask(() => {
|
|
3451
|
-
|
|
3559
|
+
$e(e, t);
|
|
3452
3560
|
});
|
|
3453
3561
|
}
|
|
3454
3562
|
handleQuery(e) {
|
|
3455
3563
|
switch (e.type) {
|
|
3456
|
-
case
|
|
3564
|
+
case je: {
|
|
3457
3565
|
const t = e.context;
|
|
3458
3566
|
return O(t) != null ? !1 : void 0;
|
|
3459
3567
|
}
|
|
@@ -3529,18 +3637,18 @@ class Mn extends I {
|
|
|
3529
3637
|
}
|
|
3530
3638
|
refreshStickyOffsets() {
|
|
3531
3639
|
const e = [...this.columns];
|
|
3532
|
-
|
|
3640
|
+
$e(this.grid, e);
|
|
3533
3641
|
}
|
|
3534
3642
|
getLeftPinnedColumns() {
|
|
3535
3643
|
const e = [...this.columns], t = te(this.grid);
|
|
3536
|
-
return
|
|
3644
|
+
return Ri(e, t);
|
|
3537
3645
|
}
|
|
3538
3646
|
getRightPinnedColumns() {
|
|
3539
3647
|
const e = [...this.columns], t = te(this.grid);
|
|
3540
|
-
return
|
|
3648
|
+
return Si(e, t);
|
|
3541
3649
|
}
|
|
3542
3650
|
clearStickyPositions() {
|
|
3543
|
-
|
|
3651
|
+
We(this.grid);
|
|
3544
3652
|
}
|
|
3545
3653
|
getHorizontalScrollOffsets(e, t) {
|
|
3546
3654
|
if (!this.isApplied)
|
|
@@ -3561,10 +3669,10 @@ class Mn extends I {
|
|
|
3561
3669
|
return { left: i, right: n, skipScroll: r };
|
|
3562
3670
|
}
|
|
3563
3671
|
}
|
|
3564
|
-
function
|
|
3672
|
+
function Ai(a) {
|
|
3565
3673
|
return typeof a == "object" && a !== null && "aggFunc" in a;
|
|
3566
3674
|
}
|
|
3567
|
-
function
|
|
3675
|
+
function he(a, e) {
|
|
3568
3676
|
const t = document.createElement("div");
|
|
3569
3677
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
3570
3678
|
const i = document.createElement("div");
|
|
@@ -3586,7 +3694,7 @@ function ue(a, e) {
|
|
|
3586
3694
|
}
|
|
3587
3695
|
if (a.customPanels)
|
|
3588
3696
|
for (const o of a.customPanels) {
|
|
3589
|
-
const s =
|
|
3697
|
+
const s = Ii(o, e);
|
|
3590
3698
|
switch (o.position) {
|
|
3591
3699
|
case "left":
|
|
3592
3700
|
i.appendChild(s);
|
|
@@ -3601,18 +3709,18 @@ function ue(a, e) {
|
|
|
3601
3709
|
}
|
|
3602
3710
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
3603
3711
|
}
|
|
3604
|
-
function
|
|
3712
|
+
function Ue(a) {
|
|
3605
3713
|
const e = document.createElement("div");
|
|
3606
3714
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${a}`, e.setAttribute("role", "presentation"), e;
|
|
3607
3715
|
}
|
|
3608
|
-
function
|
|
3716
|
+
function Ye(a, e, t, i, n = !1) {
|
|
3609
3717
|
a.innerHTML = "";
|
|
3610
3718
|
for (const r of e) {
|
|
3611
3719
|
const o = document.createElement("div");
|
|
3612
|
-
o.className = "tbw-aggregation-row", o.setAttribute("role", "presentation"), r.id && o.setAttribute("data-aggregation-id", r.id), r.fullWidth ?? n ?
|
|
3720
|
+
o.className = "tbw-aggregation-row", o.setAttribute("role", "presentation"), r.id && o.setAttribute("data-aggregation-id", r.id), r.fullWidth ?? n ? _i(o, r, t, i) : Li(o, r, t, i), a.appendChild(o);
|
|
3613
3721
|
}
|
|
3614
3722
|
}
|
|
3615
|
-
function
|
|
3723
|
+
function _i(a, e, t, i) {
|
|
3616
3724
|
const n = document.createElement("div");
|
|
3617
3725
|
n.className = "tbw-aggregation-cell tbw-aggregation-cell-full", n.style.gridColumn = "1 / -1";
|
|
3618
3726
|
const r = typeof e.label == "function" ? e.label(i, t) : e.label;
|
|
@@ -3620,26 +3728,26 @@ function ki(a, e, t, i) {
|
|
|
3620
3728
|
const s = document.createElement("span");
|
|
3621
3729
|
s.className = "tbw-aggregation-label", s.textContent = r, n.appendChild(s);
|
|
3622
3730
|
}
|
|
3623
|
-
const o =
|
|
3731
|
+
const o = Ti(e, t, i);
|
|
3624
3732
|
o && n.appendChild(o), a.appendChild(n);
|
|
3625
3733
|
}
|
|
3626
|
-
function
|
|
3734
|
+
function Li(a, e, t, i) {
|
|
3627
3735
|
for (const n of t) {
|
|
3628
3736
|
const r = document.createElement("div");
|
|
3629
3737
|
r.className = "tbw-aggregation-cell", r.setAttribute("data-field", n.field);
|
|
3630
|
-
const { value: o, formatter: s } =
|
|
3738
|
+
const { value: o, formatter: s } = gt(e, n, i);
|
|
3631
3739
|
o != null ? r.textContent = s ? s(o, n.field, n) : String(o) : r.textContent = "", a.appendChild(r);
|
|
3632
3740
|
}
|
|
3633
3741
|
}
|
|
3634
|
-
function
|
|
3742
|
+
function gt(a, e, t) {
|
|
3635
3743
|
let i, n;
|
|
3636
3744
|
const r = a.aggregators?.[e.field];
|
|
3637
3745
|
if (r)
|
|
3638
|
-
if (
|
|
3639
|
-
const o =
|
|
3746
|
+
if (Ai(r)) {
|
|
3747
|
+
const o = Se(r.aggFunc);
|
|
3640
3748
|
o && (i = o(t, e.field, e)), n = r.formatter;
|
|
3641
3749
|
} else {
|
|
3642
|
-
const o =
|
|
3750
|
+
const o = Se(r);
|
|
3643
3751
|
o && (i = o(t, e.field, e));
|
|
3644
3752
|
}
|
|
3645
3753
|
else if (a.cells && Object.prototype.hasOwnProperty.call(a.cells, e.field)) {
|
|
@@ -3648,13 +3756,13 @@ function ft(a, e, t) {
|
|
|
3648
3756
|
}
|
|
3649
3757
|
return { value: i, formatter: n };
|
|
3650
3758
|
}
|
|
3651
|
-
function
|
|
3759
|
+
function Ti(a, e, t) {
|
|
3652
3760
|
const i = a.aggregators && Object.keys(a.aggregators).length > 0, n = a.cells && Object.keys(a.cells).length > 0;
|
|
3653
3761
|
if (!i && !n) return null;
|
|
3654
3762
|
const r = document.createElement("span");
|
|
3655
3763
|
r.className = "tbw-aggregation-aggregates";
|
|
3656
3764
|
for (const o of e) {
|
|
3657
|
-
const { value: s, formatter: l } =
|
|
3765
|
+
const { value: s, formatter: l } = gt(a, o, t);
|
|
3658
3766
|
if (s != null) {
|
|
3659
3767
|
const d = document.createElement("span");
|
|
3660
3768
|
d.className = "tbw-aggregation-aggregate", d.setAttribute("data-field", o.field);
|
|
@@ -3664,13 +3772,13 @@ function _i(a, e, t) {
|
|
|
3664
3772
|
}
|
|
3665
3773
|
return r.children.length > 0 ? r : null;
|
|
3666
3774
|
}
|
|
3667
|
-
function
|
|
3775
|
+
function Ii(a, e) {
|
|
3668
3776
|
const t = document.createElement("div");
|
|
3669
3777
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
|
|
3670
3778
|
const i = a.render(e);
|
|
3671
3779
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
3672
3780
|
}
|
|
3673
|
-
function
|
|
3781
|
+
function Xe(a, e, t, i, n) {
|
|
3674
3782
|
return {
|
|
3675
3783
|
totalRows: a.length,
|
|
3676
3784
|
filteredRows: n?.cachedResult?.length ?? a.length,
|
|
@@ -3680,10 +3788,10 @@ function Ye(a, e, t, i, n) {
|
|
|
3680
3788
|
grid: t
|
|
3681
3789
|
};
|
|
3682
3790
|
}
|
|
3683
|
-
const
|
|
3684
|
-
class
|
|
3791
|
+
const Fi = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;align-content: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;display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem)}.tbw-aggregation-label{white-space:nowrap}.tbw-aggregation-aggregates{display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem);font-weight:400;opacity:.85}.tbw-aggregation-aggregate{white-space:nowrap}}";
|
|
3792
|
+
class Hn extends F {
|
|
3685
3793
|
name = "pinnedRows";
|
|
3686
|
-
styles =
|
|
3794
|
+
styles = Fi;
|
|
3687
3795
|
get defaultConfig() {
|
|
3688
3796
|
return {
|
|
3689
3797
|
position: "bottom",
|
|
@@ -3705,7 +3813,7 @@ class qn extends I {
|
|
|
3705
3813
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
3706
3814
|
if (!t) return;
|
|
3707
3815
|
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);
|
|
3708
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
3816
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Xe(
|
|
3709
3817
|
this.sourceRows,
|
|
3710
3818
|
this.columns,
|
|
3711
3819
|
this.grid,
|
|
@@ -3714,11 +3822,11 @@ class qn extends I {
|
|
|
3714
3822
|
), o = this.config.aggregationRows || [], s = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
3715
3823
|
if (s.length > 0) {
|
|
3716
3824
|
if (!this.topAggregationContainer) {
|
|
3717
|
-
this.topAggregationContainer =
|
|
3825
|
+
this.topAggregationContainer = Ue("top");
|
|
3718
3826
|
const h = e.querySelector(".header");
|
|
3719
3827
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
3720
3828
|
}
|
|
3721
|
-
|
|
3829
|
+
Ye(
|
|
3722
3830
|
this.topAggregationContainer,
|
|
3723
3831
|
s,
|
|
3724
3832
|
this.visibleColumns,
|
|
@@ -3729,19 +3837,19 @@ class qn extends I {
|
|
|
3729
3837
|
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;
|
|
3730
3838
|
if (d && this.config.position === "top")
|
|
3731
3839
|
if (!this.infoBarElement)
|
|
3732
|
-
this.infoBarElement =
|
|
3840
|
+
this.infoBarElement = he(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
3733
3841
|
else {
|
|
3734
|
-
const h =
|
|
3842
|
+
const h = he(this.config, r);
|
|
3735
3843
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
3736
3844
|
}
|
|
3737
3845
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
3738
|
-
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 =
|
|
3846
|
+
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 = Ue("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Ye(
|
|
3739
3847
|
this.bottomAggregationContainer,
|
|
3740
3848
|
l,
|
|
3741
3849
|
this.visibleColumns,
|
|
3742
3850
|
this.sourceRows,
|
|
3743
3851
|
this.config.fullWidth
|
|
3744
|
-
)), c && (this.infoBarElement =
|
|
3852
|
+
)), c && (this.infoBarElement = he(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
3745
3853
|
}
|
|
3746
3854
|
cleanup() {
|
|
3747
3855
|
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);
|
|
@@ -3768,7 +3876,7 @@ class qn extends I {
|
|
|
3768
3876
|
}
|
|
3769
3877
|
getContext() {
|
|
3770
3878
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
3771
|
-
return
|
|
3879
|
+
return Xe(
|
|
3772
3880
|
this.rows,
|
|
3773
3881
|
this.columns,
|
|
3774
3882
|
this.grid,
|
|
@@ -3789,16 +3897,16 @@ class qn extends I {
|
|
|
3789
3897
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3790
3898
|
}
|
|
3791
3899
|
}
|
|
3792
|
-
const
|
|
3793
|
-
function
|
|
3900
|
+
const Pi = Rt;
|
|
3901
|
+
function Mi(a) {
|
|
3794
3902
|
const e = [];
|
|
3795
3903
|
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;
|
|
3796
3904
|
}
|
|
3797
|
-
function
|
|
3905
|
+
function Ee(a, e) {
|
|
3798
3906
|
return [...a, e].join("|");
|
|
3799
3907
|
}
|
|
3800
|
-
function
|
|
3801
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
3908
|
+
function Di(a, e) {
|
|
3909
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = qi(a, i), o = pt(
|
|
3802
3910
|
a,
|
|
3803
3911
|
t,
|
|
3804
3912
|
i,
|
|
@@ -3806,7 +3914,7 @@ function Pi(a, e) {
|
|
|
3806
3914
|
n,
|
|
3807
3915
|
0,
|
|
3808
3916
|
""
|
|
3809
|
-
), s =
|
|
3917
|
+
), s = Hi(o, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
|
|
3810
3918
|
return {
|
|
3811
3919
|
rows: o,
|
|
3812
3920
|
columnKeys: r,
|
|
@@ -3814,7 +3922,7 @@ function Pi(a, e) {
|
|
|
3814
3922
|
grandTotal: l
|
|
3815
3923
|
};
|
|
3816
3924
|
}
|
|
3817
|
-
function
|
|
3925
|
+
function qi(a, e) {
|
|
3818
3926
|
if (e.length === 0) return ["value"];
|
|
3819
3927
|
const t = /* @__PURE__ */ new Set();
|
|
3820
3928
|
for (const i of a) {
|
|
@@ -3823,7 +3931,7 @@ function Di(a, e) {
|
|
|
3823
3931
|
}
|
|
3824
3932
|
return [...t].sort();
|
|
3825
3933
|
}
|
|
3826
|
-
function
|
|
3934
|
+
function Ni(a, e) {
|
|
3827
3935
|
const t = /* @__PURE__ */ new Map();
|
|
3828
3936
|
for (const i of a) {
|
|
3829
3937
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -3831,10 +3939,10 @@ function Mi(a, e) {
|
|
|
3831
3939
|
}
|
|
3832
3940
|
return t;
|
|
3833
3941
|
}
|
|
3834
|
-
function
|
|
3942
|
+
function pt(a, e, t, i, n, r, o) {
|
|
3835
3943
|
const s = [];
|
|
3836
3944
|
if (e.length === 0) {
|
|
3837
|
-
const h =
|
|
3945
|
+
const h = Qe(a, t, i, n), f = Ze(h);
|
|
3838
3946
|
return s.push({
|
|
3839
3947
|
rowKey: o || "all",
|
|
3840
3948
|
rowLabel: o || "All",
|
|
@@ -3845,11 +3953,11 @@ function gt(a, e, t, i, n, r, o) {
|
|
|
3845
3953
|
rowCount: a.length
|
|
3846
3954
|
}), s;
|
|
3847
3955
|
}
|
|
3848
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3956
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ni(a, l);
|
|
3849
3957
|
for (const [h, f] of u) {
|
|
3850
|
-
const g = o ? `${o}|${h}` : h, p =
|
|
3851
|
-
let
|
|
3852
|
-
c && (
|
|
3958
|
+
const g = o ? `${o}|${h}` : h, p = Qe(f, t, i, n), m = Ze(p);
|
|
3959
|
+
let x;
|
|
3960
|
+
c && (x = pt(
|
|
3853
3961
|
f,
|
|
3854
3962
|
d,
|
|
3855
3963
|
t,
|
|
@@ -3864,42 +3972,42 @@ function gt(a, e, t, i, n, r, o) {
|
|
|
3864
3972
|
values: p,
|
|
3865
3973
|
total: m,
|
|
3866
3974
|
isGroup: c,
|
|
3867
|
-
children:
|
|
3975
|
+
children: x,
|
|
3868
3976
|
rowCount: f.length
|
|
3869
3977
|
});
|
|
3870
3978
|
}
|
|
3871
3979
|
return s;
|
|
3872
3980
|
}
|
|
3873
|
-
function
|
|
3981
|
+
function Qe(a, e, t, i) {
|
|
3874
3982
|
const n = {};
|
|
3875
3983
|
for (const r of t)
|
|
3876
3984
|
for (const o of i) {
|
|
3877
|
-
const l = (e.length > 0 ? a.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d =
|
|
3985
|
+
const l = (e.length > 0 ? a.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d = Pi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = Ee([r], o.field);
|
|
3878
3986
|
n[u] = c;
|
|
3879
3987
|
}
|
|
3880
3988
|
return n;
|
|
3881
3989
|
}
|
|
3882
|
-
function
|
|
3990
|
+
function Ze(a) {
|
|
3883
3991
|
let e = 0;
|
|
3884
3992
|
for (const t of Object.values(a))
|
|
3885
3993
|
e += t ?? 0;
|
|
3886
3994
|
return e;
|
|
3887
3995
|
}
|
|
3888
|
-
function
|
|
3996
|
+
function Hi(a, e, t) {
|
|
3889
3997
|
const i = {};
|
|
3890
3998
|
function n(r) {
|
|
3891
3999
|
for (const o of r)
|
|
3892
4000
|
if (!o.isGroup || !o.children?.length)
|
|
3893
4001
|
for (const s of e)
|
|
3894
4002
|
for (const l of t) {
|
|
3895
|
-
const d =
|
|
4003
|
+
const d = Ee([s], l.field);
|
|
3896
4004
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
3897
4005
|
}
|
|
3898
4006
|
else o.children && n(o.children);
|
|
3899
4007
|
}
|
|
3900
4008
|
return n(a), i;
|
|
3901
4009
|
}
|
|
3902
|
-
function
|
|
4010
|
+
function Gi(a, e, t = !0) {
|
|
3903
4011
|
const i = [];
|
|
3904
4012
|
function n(r) {
|
|
3905
4013
|
i.push(r);
|
|
@@ -3912,7 +4020,7 @@ function Ni(a, e, t = !0) {
|
|
|
3912
4020
|
n(r);
|
|
3913
4021
|
return i;
|
|
3914
4022
|
}
|
|
3915
|
-
function
|
|
4023
|
+
function Ki(a) {
|
|
3916
4024
|
const e = [];
|
|
3917
4025
|
function t(i) {
|
|
3918
4026
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -3923,10 +4031,10 @@ function Hi(a) {
|
|
|
3923
4031
|
t(i);
|
|
3924
4032
|
return e;
|
|
3925
4033
|
}
|
|
3926
|
-
const
|
|
3927
|
-
function
|
|
4034
|
+
const zi = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
4035
|
+
function Oi(a, e, t, i) {
|
|
3928
4036
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3929
|
-
return o.className = "tbw-pivot-panel", o.appendChild(J("Options", () =>
|
|
4037
|
+
return o.className = "tbw-pivot-panel", o.appendChild(J("Options", () => ji(t, r))), o.appendChild(J("Row Groups", () => Je("rowGroups", r))), o.appendChild(J("Column Groups", () => Je("columnGroups", r))), o.appendChild(J("Values", () => Vi(r))), o.appendChild(J("Available Fields", () => Wi(r))), a.appendChild(o), () => {
|
|
3930
4038
|
n.abort(), o.remove();
|
|
3931
4039
|
};
|
|
3932
4040
|
}
|
|
@@ -3938,7 +4046,7 @@ function J(a, e) {
|
|
|
3938
4046
|
const n = document.createElement("div");
|
|
3939
4047
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
3940
4048
|
}
|
|
3941
|
-
function
|
|
4049
|
+
function Je(a, e) {
|
|
3942
4050
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3943
4051
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", a);
|
|
3944
4052
|
const o = a === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -3947,7 +4055,7 @@ function Ze(a, e) {
|
|
|
3947
4055
|
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3948
4056
|
} else
|
|
3949
4057
|
for (const s of o)
|
|
3950
|
-
r.appendChild(
|
|
4058
|
+
r.appendChild(Bi(s, a, e));
|
|
3951
4059
|
return r.addEventListener(
|
|
3952
4060
|
"dragover",
|
|
3953
4061
|
(s) => {
|
|
@@ -3970,7 +4078,7 @@ function Ze(a, e) {
|
|
|
3970
4078
|
{ signal: n }
|
|
3971
4079
|
), r;
|
|
3972
4080
|
}
|
|
3973
|
-
function
|
|
4081
|
+
function Bi(a, e, t) {
|
|
3974
4082
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3975
4083
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3976
4084
|
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
@@ -3996,7 +4104,7 @@ function zi(a, e, t) {
|
|
|
3996
4104
|
{ signal: n }
|
|
3997
4105
|
), r;
|
|
3998
4106
|
}
|
|
3999
|
-
function
|
|
4107
|
+
function Vi(a) {
|
|
4000
4108
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
4001
4109
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
4002
4110
|
const r = e.valueFields ?? [];
|
|
@@ -4005,7 +4113,7 @@ function Oi(a) {
|
|
|
4005
4113
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
4006
4114
|
} else
|
|
4007
4115
|
for (const o of r)
|
|
4008
|
-
n.appendChild(
|
|
4116
|
+
n.appendChild($i(o, a));
|
|
4009
4117
|
return n.addEventListener(
|
|
4010
4118
|
"dragover",
|
|
4011
4119
|
(o) => {
|
|
@@ -4028,7 +4136,7 @@ function Oi(a) {
|
|
|
4028
4136
|
{ signal: i }
|
|
4029
4137
|
), n;
|
|
4030
4138
|
}
|
|
4031
|
-
function
|
|
4139
|
+
function $i(a, e) {
|
|
4032
4140
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
4033
4141
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
4034
4142
|
const r = t.getAvailableFields().find((c) => c.field === a.field), o = document.createElement("div");
|
|
@@ -4037,7 +4145,7 @@ function Bi(a, e) {
|
|
|
4037
4145
|
s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? a.field;
|
|
4038
4146
|
const l = document.createElement("select");
|
|
4039
4147
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
4040
|
-
for (const c of
|
|
4148
|
+
for (const c of zi) {
|
|
4041
4149
|
const u = document.createElement("option");
|
|
4042
4150
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === a.aggFunc, l.appendChild(u);
|
|
4043
4151
|
}
|
|
@@ -4057,7 +4165,7 @@ function Bi(a, e) {
|
|
|
4057
4165
|
{ signal: i }
|
|
4058
4166
|
), o.appendChild(s), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
4059
4167
|
}
|
|
4060
|
-
function
|
|
4168
|
+
function Wi(a) {
|
|
4061
4169
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
4062
4170
|
n.className = "tbw-pivot-available-fields";
|
|
4063
4171
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -4087,10 +4195,10 @@ function Vi(a) {
|
|
|
4087
4195
|
}
|
|
4088
4196
|
return n;
|
|
4089
4197
|
}
|
|
4090
|
-
function
|
|
4198
|
+
function ji(a, e) {
|
|
4091
4199
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
4092
4200
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
4093
|
-
|
|
4201
|
+
fe(
|
|
4094
4202
|
"Enable Pivot View",
|
|
4095
4203
|
a,
|
|
4096
4204
|
(o) => {
|
|
@@ -4099,7 +4207,7 @@ function $i(a, e) {
|
|
|
4099
4207
|
n
|
|
4100
4208
|
)
|
|
4101
4209
|
), r.appendChild(
|
|
4102
|
-
|
|
4210
|
+
fe(
|
|
4103
4211
|
"Show Row Totals",
|
|
4104
4212
|
t.showTotals ?? !0,
|
|
4105
4213
|
(o) => {
|
|
@@ -4108,7 +4216,7 @@ function $i(a, e) {
|
|
|
4108
4216
|
n
|
|
4109
4217
|
)
|
|
4110
4218
|
), r.appendChild(
|
|
4111
|
-
|
|
4219
|
+
fe(
|
|
4112
4220
|
"Show Grand Total",
|
|
4113
4221
|
t.showGrandTotal ?? !0,
|
|
4114
4222
|
(o) => {
|
|
@@ -4118,7 +4226,7 @@ function $i(a, e) {
|
|
|
4118
4226
|
)
|
|
4119
4227
|
), r;
|
|
4120
4228
|
}
|
|
4121
|
-
function
|
|
4229
|
+
function fe(a, e, t, i) {
|
|
4122
4230
|
const n = document.createElement("label");
|
|
4123
4231
|
n.className = "tbw-pivot-checkbox";
|
|
4124
4232
|
const r = document.createElement("input");
|
|
@@ -4126,7 +4234,7 @@ function he(a, e, t, i) {
|
|
|
4126
4234
|
const o = document.createElement("span");
|
|
4127
4235
|
return o.textContent = a, n.appendChild(r), n.appendChild(o), n;
|
|
4128
4236
|
}
|
|
4129
|
-
function
|
|
4237
|
+
function Ui(a, e, t) {
|
|
4130
4238
|
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
|
|
4131
4239
|
const r = document.createElement("div");
|
|
4132
4240
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -4147,7 +4255,7 @@ function Wi(a, e, t) {
|
|
|
4147
4255
|
e.appendChild(r);
|
|
4148
4256
|
}), !0;
|
|
4149
4257
|
}
|
|
4150
|
-
function
|
|
4258
|
+
function Yi(a, e, t, i) {
|
|
4151
4259
|
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
|
|
4152
4260
|
const o = document.createElement("div");
|
|
4153
4261
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -4162,7 +4270,7 @@ function ji(a, e, t, i) {
|
|
|
4162
4270
|
e.appendChild(o);
|
|
4163
4271
|
}), !0;
|
|
4164
4272
|
}
|
|
4165
|
-
function
|
|
4273
|
+
function Xi(a, e, t) {
|
|
4166
4274
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
4167
4275
|
const r = document.createElement("div");
|
|
4168
4276
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -4175,10 +4283,10 @@ function Ui(a, e, t) {
|
|
|
4175
4283
|
e.appendChild(r);
|
|
4176
4284
|
}), !0;
|
|
4177
4285
|
}
|
|
4178
|
-
const
|
|
4179
|
-
class j extends
|
|
4286
|
+
const Qi = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
4287
|
+
class j extends F {
|
|
4180
4288
|
name = "pivot";
|
|
4181
|
-
styles =
|
|
4289
|
+
styles = Qi;
|
|
4182
4290
|
static PANEL_ID = "pivot";
|
|
4183
4291
|
get defaultConfig() {
|
|
4184
4292
|
return {
|
|
@@ -4224,11 +4332,11 @@ class j extends I {
|
|
|
4224
4332
|
processRows(e) {
|
|
4225
4333
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
4226
4334
|
return [...e];
|
|
4227
|
-
const t =
|
|
4335
|
+
const t = Mi(this.config);
|
|
4228
4336
|
if (t.length > 0)
|
|
4229
4337
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
4230
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult =
|
|
4231
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
4338
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = Di(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
4339
|
+
const i = this.config.indentWidth ?? 20, n = Gi(
|
|
4232
4340
|
this.pivotResult.rows,
|
|
4233
4341
|
this.expandedKeys,
|
|
4234
4342
|
this.defaultExpanded
|
|
@@ -4263,7 +4371,7 @@ class j extends I {
|
|
|
4263
4371
|
});
|
|
4264
4372
|
for (const n of this.pivotResult.columnKeys)
|
|
4265
4373
|
for (const r of this.config.valueFields ?? []) {
|
|
4266
|
-
const o =
|
|
4374
|
+
const o = Ee([n], r.field), s = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
4267
4375
|
t.push({
|
|
4268
4376
|
field: o,
|
|
4269
4377
|
header: `${n} - ${s} (${r.aggFunc})`,
|
|
@@ -4280,13 +4388,13 @@ class j extends I {
|
|
|
4280
4388
|
}
|
|
4281
4389
|
renderRow(e, t, i) {
|
|
4282
4390
|
const n = e;
|
|
4283
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
4391
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Ui(n, t, {
|
|
4284
4392
|
columns: this.gridColumns,
|
|
4285
4393
|
rowIndex: i,
|
|
4286
4394
|
onToggle: (r) => this.toggle(r),
|
|
4287
4395
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
4288
4396
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
4289
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
4397
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Yi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
4290
4398
|
}
|
|
4291
4399
|
cleanupPivotStyling(e) {
|
|
4292
4400
|
(e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
|
|
@@ -4324,7 +4432,7 @@ class j extends I {
|
|
|
4324
4432
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
4325
4433
|
...this.pivotResult.totals
|
|
4326
4434
|
};
|
|
4327
|
-
|
|
4435
|
+
Xi(i, this.grandTotalFooter, this.gridColumns);
|
|
4328
4436
|
}
|
|
4329
4437
|
cleanupGrandTotalFooter() {
|
|
4330
4438
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -4346,7 +4454,7 @@ class j extends I {
|
|
|
4346
4454
|
}
|
|
4347
4455
|
expandAllKeys() {
|
|
4348
4456
|
if (!this.pivotResult) return;
|
|
4349
|
-
const e =
|
|
4457
|
+
const e = Ki(this.pivotResult.rows);
|
|
4350
4458
|
for (const t of e)
|
|
4351
4459
|
this.expandedKeys.add(t);
|
|
4352
4460
|
}
|
|
@@ -4431,7 +4539,7 @@ class j extends I {
|
|
|
4431
4539
|
},
|
|
4432
4540
|
getAvailableFields: () => this.getAvailableFields()
|
|
4433
4541
|
};
|
|
4434
|
-
return
|
|
4542
|
+
return Oi(e, this.config, this.isActive, t);
|
|
4435
4543
|
}
|
|
4436
4544
|
refreshPanel() {
|
|
4437
4545
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -4465,7 +4573,7 @@ class j extends I {
|
|
|
4465
4573
|
}
|
|
4466
4574
|
}
|
|
4467
4575
|
const ne = "tbw-print-isolation-style";
|
|
4468
|
-
function
|
|
4576
|
+
function Zi(a, e) {
|
|
4469
4577
|
const t = document.createElement("style");
|
|
4470
4578
|
return t.id = ne, t.textContent = `
|
|
4471
4579
|
/* Print isolation: hide everything except the target grid */
|
|
@@ -4539,12 +4647,12 @@ function Xi(a, e) {
|
|
|
4539
4647
|
}
|
|
4540
4648
|
`, t;
|
|
4541
4649
|
}
|
|
4542
|
-
async function
|
|
4650
|
+
async function Ji(a, e = {}) {
|
|
4543
4651
|
const { orientation: t = "landscape" } = e, i = a.id;
|
|
4544
4652
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
4545
4653
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
4546
4654
|
), document.getElementById(ne)?.remove();
|
|
4547
|
-
const r =
|
|
4655
|
+
const r = Zi(i, t);
|
|
4548
4656
|
return document.head.appendChild(r), new Promise((o) => {
|
|
4549
4657
|
const s = () => {
|
|
4550
4658
|
window.removeEventListener("afterprint", s), document.getElementById(ne)?.remove(), o();
|
|
@@ -4554,7 +4662,7 @@ async function Qi(a, e = {}) {
|
|
|
4554
4662
|
}, 5e3);
|
|
4555
4663
|
});
|
|
4556
4664
|
}
|
|
4557
|
-
const
|
|
4665
|
+
const en = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:end}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-inline-end:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", tn = {
|
|
4558
4666
|
button: !1,
|
|
4559
4667
|
orientation: "landscape",
|
|
4560
4668
|
warnThreshold: 500,
|
|
@@ -4564,18 +4672,18 @@ const Zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
4564
4672
|
title: "",
|
|
4565
4673
|
isolate: !1
|
|
4566
4674
|
};
|
|
4567
|
-
class
|
|
4675
|
+
class Gn extends F {
|
|
4568
4676
|
name = "print";
|
|
4569
4677
|
version = "1.0.0";
|
|
4570
|
-
styles =
|
|
4678
|
+
styles = en;
|
|
4571
4679
|
#t = !1;
|
|
4572
4680
|
#e = null;
|
|
4573
4681
|
#o = null;
|
|
4574
|
-
#
|
|
4682
|
+
#s = null;
|
|
4575
4683
|
#i = null;
|
|
4576
4684
|
#n = null;
|
|
4577
|
-
#
|
|
4578
|
-
get #
|
|
4685
|
+
#r = null;
|
|
4686
|
+
get #l() {
|
|
4579
4687
|
return this.grid;
|
|
4580
4688
|
}
|
|
4581
4689
|
isPrinting() {
|
|
@@ -4591,7 +4699,7 @@ class Nn extends I {
|
|
|
4591
4699
|
console.warn("[PrintPlugin] Grid not available");
|
|
4592
4700
|
return;
|
|
4593
4701
|
}
|
|
4594
|
-
const i = { ...
|
|
4702
|
+
const i = { ...tn, ...this.config, ...e }, r = this.rows.length;
|
|
4595
4703
|
let o = r, s = !1;
|
|
4596
4704
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
4597
4705
|
const d = i.maxRows > 0 ? `
|
|
@@ -4612,10 +4720,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4612
4720
|
originalRowCount: r
|
|
4613
4721
|
});
|
|
4614
4722
|
try {
|
|
4615
|
-
const d = this.#
|
|
4723
|
+
const d = this.#l;
|
|
4616
4724
|
this.#o = {
|
|
4617
4725
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
4618
|
-
}, this.#
|
|
4726
|
+
}, this.#c(), s && (this.#s = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#f(i), await this.#b(), 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.#a(i) : await this.#p(), this.emit("print-complete", {
|
|
4619
4727
|
success: !0,
|
|
4620
4728
|
rowCount: o,
|
|
4621
4729
|
duration: Math.round(performance.now() - l)
|
|
@@ -4627,10 +4735,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4627
4735
|
duration: Math.round(performance.now() - l)
|
|
4628
4736
|
});
|
|
4629
4737
|
} finally {
|
|
4630
|
-
this.#
|
|
4738
|
+
this.#g(), this.#t = !1;
|
|
4631
4739
|
}
|
|
4632
4740
|
}
|
|
4633
|
-
#
|
|
4741
|
+
#f(e) {
|
|
4634
4742
|
const t = this.gridElement;
|
|
4635
4743
|
if (t) {
|
|
4636
4744
|
if (this.#i = document.createElement("div"), this.#i.className = "tbw-print-header", e.includeTitle) {
|
|
@@ -4644,13 +4752,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4644
4752
|
t.insertBefore(this.#i, 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);
|
|
4645
4753
|
}
|
|
4646
4754
|
}
|
|
4647
|
-
async #
|
|
4648
|
-
const e = this.#
|
|
4755
|
+
async #b() {
|
|
4756
|
+
const e = this.#l;
|
|
4649
4757
|
if (!e._virtualization) return;
|
|
4650
4758
|
const t = this.rows.length;
|
|
4651
4759
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
4652
4760
|
}
|
|
4653
|
-
async #
|
|
4761
|
+
async #p() {
|
|
4654
4762
|
return new Promise((e) => {
|
|
4655
4763
|
const t = () => {
|
|
4656
4764
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -4660,13 +4768,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4660
4768
|
}, 1e3);
|
|
4661
4769
|
});
|
|
4662
4770
|
}
|
|
4663
|
-
async #
|
|
4771
|
+
async #a(e) {
|
|
4664
4772
|
const t = this.gridElement;
|
|
4665
|
-
t && await
|
|
4773
|
+
t && await Ji(t, {
|
|
4666
4774
|
orientation: e.orientation
|
|
4667
4775
|
});
|
|
4668
4776
|
}
|
|
4669
|
-
#
|
|
4777
|
+
#c() {
|
|
4670
4778
|
const e = this.columns;
|
|
4671
4779
|
if (e) {
|
|
4672
4780
|
this.#e = /* @__PURE__ */ new Map();
|
|
@@ -4674,26 +4782,26 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4674
4782
|
t.printHidden && t.field && (this.#e.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
4675
4783
|
}
|
|
4676
4784
|
}
|
|
4677
|
-
#
|
|
4785
|
+
#d() {
|
|
4678
4786
|
if (this.#e) {
|
|
4679
4787
|
for (const [e, t] of this.#e)
|
|
4680
4788
|
this.grid.setColumnVisible(e, t);
|
|
4681
4789
|
this.#e = null;
|
|
4682
4790
|
}
|
|
4683
4791
|
}
|
|
4684
|
-
#
|
|
4792
|
+
#g() {
|
|
4685
4793
|
const e = this.gridElement;
|
|
4686
4794
|
if (!e) return;
|
|
4687
|
-
this.#
|
|
4688
|
-
const t = this.#
|
|
4689
|
-
this.#o && t._virtualization && (t._virtualization.bypassThreshold = this.#o.bypassThreshold, t.refreshVirtualWindow(!0), this.#o = null), this.#
|
|
4795
|
+
this.#d(), e.classList.remove("print-portrait", "print-landscape"), this.#r !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#r = null), this.#i && (this.#i.remove(), this.#i = null), this.#n && (this.#n.remove(), this.#n = null);
|
|
4796
|
+
const t = this.#l;
|
|
4797
|
+
this.#o && t._virtualization && (t._virtualization.bypassThreshold = this.#o.bypassThreshold, t.refreshVirtualWindow(!0), this.#o = null), this.#s !== null && (this.grid.rows = this.#s, this.#s = null);
|
|
4690
4798
|
}
|
|
4691
4799
|
afterRender() {
|
|
4692
|
-
this.config?.button && !this.#
|
|
4800
|
+
this.config?.button && !this.#u && (this.#m(), this.#u = !0);
|
|
4693
4801
|
}
|
|
4694
|
-
#
|
|
4695
|
-
#
|
|
4696
|
-
this.#
|
|
4802
|
+
#u = !1;
|
|
4803
|
+
#m() {
|
|
4804
|
+
this.#l.registerToolbarContent?.({
|
|
4697
4805
|
id: "print-button",
|
|
4698
4806
|
order: 900,
|
|
4699
4807
|
render: (t) => {
|
|
@@ -4711,19 +4819,19 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4711
4819
|
});
|
|
4712
4820
|
}
|
|
4713
4821
|
}
|
|
4714
|
-
function
|
|
4822
|
+
function nn(a) {
|
|
4715
4823
|
const e = a.meta ?? {};
|
|
4716
4824
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4717
4825
|
}
|
|
4718
|
-
function
|
|
4826
|
+
function et(a, e, t) {
|
|
4719
4827
|
if (e === t || e < 0 || e >= a.length || t < 0 || t > a.length) return a;
|
|
4720
4828
|
const i = [...a], [n] = i.splice(e, 1);
|
|
4721
4829
|
return i.splice(t, 0, n), i;
|
|
4722
4830
|
}
|
|
4723
|
-
const
|
|
4724
|
-
class
|
|
4831
|
+
const rn = '@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}}';
|
|
4832
|
+
class Kn extends F {
|
|
4725
4833
|
name = "reorder";
|
|
4726
|
-
styles =
|
|
4834
|
+
styles = rn;
|
|
4727
4835
|
get defaultConfig() {
|
|
4728
4836
|
return {
|
|
4729
4837
|
animation: "flip"
|
|
@@ -4740,7 +4848,7 @@ class Hn extends I {
|
|
|
4740
4848
|
draggedIndex = null;
|
|
4741
4849
|
dropIndex = null;
|
|
4742
4850
|
canMoveColumnWithPlugins(e) {
|
|
4743
|
-
return !e || !
|
|
4851
|
+
return !e || !nn(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
|
|
4744
4852
|
}
|
|
4745
4853
|
clearDragClasses() {
|
|
4746
4854
|
this.gridElement?.querySelectorAll(".header-row > .cell").forEach((e) => {
|
|
@@ -4787,7 +4895,7 @@ class Hn extends I {
|
|
|
4787
4895
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4788
4896
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4789
4897
|
return;
|
|
4790
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f =
|
|
4898
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = et(h, d, u), g = {
|
|
4791
4899
|
field: l,
|
|
4792
4900
|
fromIndex: d,
|
|
4793
4901
|
toIndex: u,
|
|
@@ -4810,7 +4918,7 @@ class Hn extends I {
|
|
|
4810
4918
|
if (l < 0 || l >= o.length) return;
|
|
4811
4919
|
const d = n.find((c) => c.field === o[l]);
|
|
4812
4920
|
if (this.canMoveColumnWithPlugins(d))
|
|
4813
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
4921
|
+
return this.moveColumn(r.field, l), t._focusCol = l, q(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
4814
4922
|
}
|
|
4815
4923
|
getColumnOrder() {
|
|
4816
4924
|
return this.grid.getColumnOrder();
|
|
@@ -4818,7 +4926,7 @@ class Hn extends I {
|
|
|
4818
4926
|
moveColumn(e, t) {
|
|
4819
4927
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
4820
4928
|
if (n === -1) return;
|
|
4821
|
-
const r =
|
|
4929
|
+
const r = et(i, n, t);
|
|
4822
4930
|
this.emitCancelable("column-move", {
|
|
4823
4931
|
field: e,
|
|
4824
4932
|
fromIndex: n,
|
|
@@ -4913,11 +5021,11 @@ class Hn extends I {
|
|
|
4913
5021
|
this.grid.requestStateChange?.();
|
|
4914
5022
|
}
|
|
4915
5023
|
}
|
|
4916
|
-
const
|
|
4917
|
-
class
|
|
5024
|
+
const on = '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}}';
|
|
5025
|
+
class zn extends F {
|
|
4918
5026
|
name = "responsive";
|
|
4919
5027
|
version = "1.0.0";
|
|
4920
|
-
styles =
|
|
5028
|
+
styles = on;
|
|
4921
5029
|
static manifest = {
|
|
4922
5030
|
incompatibleWith: [
|
|
4923
5031
|
{
|
|
@@ -4935,24 +5043,24 @@ class Gn extends I {
|
|
|
4935
5043
|
#t;
|
|
4936
5044
|
#e = !1;
|
|
4937
5045
|
#o;
|
|
4938
|
-
#
|
|
5046
|
+
#s = !1;
|
|
4939
5047
|
#i = 0;
|
|
4940
5048
|
#n = /* @__PURE__ */ new Set();
|
|
4941
|
-
#
|
|
4942
|
-
#
|
|
4943
|
-
#
|
|
5049
|
+
#r = /* @__PURE__ */ new Set();
|
|
5050
|
+
#l = null;
|
|
5051
|
+
#f = [];
|
|
4944
5052
|
isResponsive() {
|
|
4945
5053
|
return this.#e;
|
|
4946
5054
|
}
|
|
4947
5055
|
setResponsive(e) {
|
|
4948
|
-
e !== this.#e && (this.#e = e, this.#
|
|
5056
|
+
e !== this.#e && (this.#e = e, this.#g(), this.emit("responsive-change", {
|
|
4949
5057
|
isResponsive: e,
|
|
4950
5058
|
width: this.#i,
|
|
4951
5059
|
breakpoint: this.config.breakpoint ?? 0
|
|
4952
5060
|
}));
|
|
4953
5061
|
}
|
|
4954
5062
|
setBreakpoint(e) {
|
|
4955
|
-
this.config.breakpoint = e, this.#
|
|
5063
|
+
this.config.breakpoint = e, this.#a(this.#i);
|
|
4956
5064
|
}
|
|
4957
5065
|
setCardRenderer(e) {
|
|
4958
5066
|
this.config.cardRenderer = e, this.#e && this.requestRender();
|
|
@@ -4961,17 +5069,17 @@ class Gn extends I {
|
|
|
4961
5069
|
return this.#i;
|
|
4962
5070
|
}
|
|
4963
5071
|
getActiveBreakpoint() {
|
|
4964
|
-
return this.#
|
|
5072
|
+
return this.#l;
|
|
4965
5073
|
}
|
|
4966
5074
|
attach(e) {
|
|
4967
|
-
super.attach(e), this.#
|
|
5075
|
+
super.attach(e), this.#b(), this.#p(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#f = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#t = new ResizeObserver((t) => {
|
|
4968
5076
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4969
5077
|
this.#i = i, clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
4970
|
-
this.#
|
|
5078
|
+
this.#a(i);
|
|
4971
5079
|
}, this.config.debounceMs ?? 100);
|
|
4972
5080
|
}), this.#t.observe(this.gridElement);
|
|
4973
5081
|
}
|
|
4974
|
-
#
|
|
5082
|
+
#b() {
|
|
4975
5083
|
const e = this.grid;
|
|
4976
5084
|
if (!e || typeof e.querySelector != "function") return;
|
|
4977
5085
|
const t = e.querySelector("tbw-grid-responsive-card");
|
|
@@ -4992,14 +5100,14 @@ class Gn extends I {
|
|
|
4992
5100
|
}
|
|
4993
5101
|
const c = t.innerHTML.trim();
|
|
4994
5102
|
c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
|
|
4995
|
-
const h =
|
|
5103
|
+
const h = at(c, { value: u, row: u }), f = lt(h), g = document.createElement("div");
|
|
4996
5104
|
return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
|
|
4997
5105
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4998
5106
|
}
|
|
4999
|
-
#
|
|
5000
|
-
if (this.#n.clear(), this.#
|
|
5107
|
+
#p(e) {
|
|
5108
|
+
if (this.#n.clear(), this.#r.clear(), !!e)
|
|
5001
5109
|
for (const t of e)
|
|
5002
|
-
typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#
|
|
5110
|
+
typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#r.add(t.field) : this.#n.add(t.field);
|
|
5003
5111
|
}
|
|
5004
5112
|
detach() {
|
|
5005
5113
|
this.#t?.disconnect(), this.#t = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
@@ -5009,62 +5117,62 @@ class Gn extends I {
|
|
|
5009
5117
|
return this.#e;
|
|
5010
5118
|
}
|
|
5011
5119
|
afterRender() {
|
|
5012
|
-
if (this.#
|
|
5120
|
+
if (this.#R(), !(this.#f.length > 0 ? this.#l !== null : this.#e))
|
|
5013
5121
|
return;
|
|
5014
|
-
const t = this.#n.size > 0, i = this.#
|
|
5122
|
+
const t = this.#n.size > 0, i = this.#r.size > 0;
|
|
5015
5123
|
if (!t && !i)
|
|
5016
5124
|
return;
|
|
5017
5125
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
5018
5126
|
for (const r of n) {
|
|
5019
5127
|
const o = r.getAttribute("data-field");
|
|
5020
|
-
o && (this.#n.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#
|
|
5128
|
+
o && (this.#n.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#r.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
|
|
5021
5129
|
}
|
|
5022
5130
|
}
|
|
5023
|
-
#
|
|
5024
|
-
if (this.#
|
|
5025
|
-
this.#
|
|
5131
|
+
#a(e) {
|
|
5132
|
+
if (this.#f.length > 0) {
|
|
5133
|
+
this.#c(e);
|
|
5026
5134
|
return;
|
|
5027
5135
|
}
|
|
5028
5136
|
const t = this.config.breakpoint ?? 0;
|
|
5029
|
-
t === 0 && !this.#
|
|
5137
|
+
t === 0 && !this.#s && (this.#s = !0, console.warn(
|
|
5030
5138
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
5031
5139
|
));
|
|
5032
5140
|
const i = t > 0 && e < t;
|
|
5033
|
-
i !== this.#e && (this.#e = i, this.#
|
|
5141
|
+
i !== this.#e && (this.#e = i, this.#g(), this.emit("responsive-change", {
|
|
5034
5142
|
isResponsive: i,
|
|
5035
5143
|
width: e,
|
|
5036
5144
|
breakpoint: t
|
|
5037
5145
|
}), this.requestRender());
|
|
5038
5146
|
}
|
|
5039
|
-
#
|
|
5147
|
+
#c(e) {
|
|
5040
5148
|
let t = null;
|
|
5041
|
-
for (const n of this.#
|
|
5149
|
+
for (const n of this.#f)
|
|
5042
5150
|
e <= n.maxWidth && (t = n);
|
|
5043
|
-
if (t !== this.#
|
|
5044
|
-
this.#
|
|
5151
|
+
if (t !== this.#l) {
|
|
5152
|
+
this.#l = t, t?.hiddenColumns ? this.#p(t.hiddenColumns) : this.#p(this.config.hiddenColumns);
|
|
5045
5153
|
const n = t?.cardLayout === !0;
|
|
5046
|
-
n !== this.#e && (this.#e = n, this.#
|
|
5154
|
+
n !== this.#e && (this.#e = n, this.#g()), this.emit("responsive-change", {
|
|
5047
5155
|
isResponsive: this.#e,
|
|
5048
5156
|
width: e,
|
|
5049
5157
|
breakpoint: t?.maxWidth ?? 0
|
|
5050
5158
|
}), this.requestRender();
|
|
5051
5159
|
}
|
|
5052
5160
|
}
|
|
5053
|
-
#
|
|
5054
|
-
#
|
|
5161
|
+
#d;
|
|
5162
|
+
#g() {
|
|
5055
5163
|
this.gridElement.toggleAttribute("data-responsive", this.#e);
|
|
5056
5164
|
const e = this.config.animate !== !1;
|
|
5057
5165
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
5058
5166
|
const t = this.grid;
|
|
5059
5167
|
if (this.#e) {
|
|
5060
|
-
t._virtualization && (this.#
|
|
5168
|
+
t._virtualization && (this.#d = t._virtualization.rowHeight);
|
|
5061
5169
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
5062
5170
|
i && (i.scrollLeft = 0);
|
|
5063
5171
|
} else {
|
|
5064
5172
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
5065
5173
|
for (const n of i)
|
|
5066
5174
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
5067
|
-
this.#
|
|
5175
|
+
this.#d && this.#d > 0 && t._virtualization && (t._virtualization.rowHeight = this.#d, this.#d = void 0), this.#u = void 0, this.#m = void 0, this.#x = void 0;
|
|
5068
5176
|
}
|
|
5069
5177
|
}
|
|
5070
5178
|
renderRow(e, t, i) {
|
|
@@ -5083,61 +5191,61 @@ class Gn extends I {
|
|
|
5083
5191
|
switch (e.key) {
|
|
5084
5192
|
case "ArrowDown":
|
|
5085
5193
|
if (this.grid._focusCol < i)
|
|
5086
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
5194
|
+
return this.grid._focusCol += 1, e.preventDefault(), q(this.grid), !0;
|
|
5087
5195
|
if (this.grid._focusRow < t)
|
|
5088
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
5196
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), q(this.grid), !0;
|
|
5089
5197
|
break;
|
|
5090
5198
|
case "ArrowUp":
|
|
5091
5199
|
if (this.grid._focusCol > 0)
|
|
5092
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
5200
|
+
return this.grid._focusCol -= 1, e.preventDefault(), q(this.grid), !0;
|
|
5093
5201
|
if (this.grid._focusRow > 0)
|
|
5094
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
5202
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), q(this.grid), !0;
|
|
5095
5203
|
break;
|
|
5096
5204
|
case "ArrowRight":
|
|
5097
5205
|
if (this.grid._focusRow < t)
|
|
5098
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
5206
|
+
return this.grid._focusRow += 1, e.preventDefault(), q(this.grid), !0;
|
|
5099
5207
|
break;
|
|
5100
5208
|
case "ArrowLeft":
|
|
5101
5209
|
if (this.grid._focusRow > 0)
|
|
5102
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
5210
|
+
return this.grid._focusRow -= 1, e.preventDefault(), q(this.grid), !0;
|
|
5103
5211
|
break;
|
|
5104
5212
|
}
|
|
5105
5213
|
return !1;
|
|
5106
5214
|
}
|
|
5107
|
-
#
|
|
5108
|
-
#
|
|
5109
|
-
#
|
|
5110
|
-
#
|
|
5111
|
-
if (this.#
|
|
5112
|
-
return this.#
|
|
5215
|
+
#u;
|
|
5216
|
+
#m;
|
|
5217
|
+
#x;
|
|
5218
|
+
#C() {
|
|
5219
|
+
if (this.#u && this.#u > 0)
|
|
5220
|
+
return this.#u;
|
|
5113
5221
|
const e = this.config.cardRowHeight;
|
|
5114
5222
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
5115
5223
|
}
|
|
5116
|
-
#
|
|
5117
|
-
return this.#
|
|
5224
|
+
#w() {
|
|
5225
|
+
return this.#m && this.#m > 0 ? this.#m : this.#d ?? 28;
|
|
5118
5226
|
}
|
|
5119
|
-
#
|
|
5227
|
+
#y() {
|
|
5120
5228
|
for (const e of this.rows)
|
|
5121
5229
|
if (e.__isGroupRow)
|
|
5122
5230
|
return !0;
|
|
5123
5231
|
return !1;
|
|
5124
5232
|
}
|
|
5125
|
-
#
|
|
5233
|
+
#h() {
|
|
5126
5234
|
let e = 0, t = 0;
|
|
5127
5235
|
for (const i of this.rows)
|
|
5128
5236
|
i.__isGroupRow ? e++ : t++;
|
|
5129
5237
|
return { groupCount: e, cardCount: t };
|
|
5130
5238
|
}
|
|
5131
5239
|
getExtraHeight() {
|
|
5132
|
-
if (!this.#e || !this.config.cardRenderer || !this.#
|
|
5240
|
+
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
5133
5241
|
return 0;
|
|
5134
|
-
const e = this.#
|
|
5242
|
+
const e = this.#d ?? 28, t = this.#w(), i = this.#C(), { groupCount: n, cardCount: r } = this.#h(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
|
|
5135
5243
|
return o + s;
|
|
5136
5244
|
}
|
|
5137
5245
|
getExtraHeightBefore(e) {
|
|
5138
|
-
if (!this.#e || !this.config.cardRenderer || !this.#
|
|
5246
|
+
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
5139
5247
|
return 0;
|
|
5140
|
-
const t = this.#
|
|
5248
|
+
const t = this.#d ?? 28, i = this.#w(), n = this.#C(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
5141
5249
|
let s = 0, l = 0;
|
|
5142
5250
|
const d = this.rows, c = Math.min(e, d.length);
|
|
5143
5251
|
for (let u = 0; u < c; u++)
|
|
@@ -5146,41 +5254,41 @@ class Gn extends I {
|
|
|
5146
5254
|
}
|
|
5147
5255
|
getRowHeight(e, t) {
|
|
5148
5256
|
if (!(!this.#e || !this.config.cardRenderer))
|
|
5149
|
-
return e.__isGroupRow ? this.#
|
|
5257
|
+
return e.__isGroupRow ? this.#w() : this.#C();
|
|
5150
5258
|
}
|
|
5151
|
-
#
|
|
5259
|
+
#E() {
|
|
5152
5260
|
let e = 0;
|
|
5153
5261
|
for (const t of this.rows)
|
|
5154
5262
|
t.__isGroupRow || e++;
|
|
5155
5263
|
return e;
|
|
5156
5264
|
}
|
|
5157
|
-
#
|
|
5158
|
-
#
|
|
5265
|
+
#v = !1;
|
|
5266
|
+
#R() {
|
|
5159
5267
|
if (!this.#e || !this.config.cardRenderer)
|
|
5160
5268
|
return;
|
|
5161
5269
|
let e = !1;
|
|
5162
|
-
const t = this.grid, i = this.#
|
|
5163
|
-
if (n !== this.#
|
|
5270
|
+
const t = this.grid, i = this.#y(), n = this.#E();
|
|
5271
|
+
if (n !== this.#x && (this.#x = n, e = !0), i) {
|
|
5164
5272
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
5165
5273
|
if (o) {
|
|
5166
5274
|
const s = o.getBoundingClientRect().height;
|
|
5167
|
-
s > 0 && s !== this.#
|
|
5275
|
+
s > 0 && s !== this.#m && (this.#m = s, e = !0);
|
|
5168
5276
|
}
|
|
5169
5277
|
}
|
|
5170
5278
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
5171
5279
|
if (r) {
|
|
5172
5280
|
const o = r.getBoundingClientRect().height;
|
|
5173
|
-
o > 0 && o !== this.#
|
|
5281
|
+
o > 0 && o !== this.#u && (this.#u = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
5174
5282
|
}
|
|
5175
|
-
e && !this.#
|
|
5176
|
-
this.#
|
|
5283
|
+
e && !this.#v && (this.#v = !0, queueMicrotask(() => {
|
|
5284
|
+
this.#v = !1, this.grid && this.#e && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
5177
5285
|
}));
|
|
5178
5286
|
}
|
|
5179
5287
|
}
|
|
5180
|
-
const
|
|
5181
|
-
class
|
|
5288
|
+
const sn = '@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}}', an = "__tbw_row_drag";
|
|
5289
|
+
class On extends F {
|
|
5182
5290
|
name = "rowReorder";
|
|
5183
|
-
styles =
|
|
5291
|
+
styles = sn;
|
|
5184
5292
|
get defaultConfig() {
|
|
5185
5293
|
return {
|
|
5186
5294
|
enableKeyboard: !0,
|
|
@@ -5207,7 +5315,7 @@ class Kn extends I {
|
|
|
5207
5315
|
if (!this.config.showDragHandle)
|
|
5208
5316
|
return [...e];
|
|
5209
5317
|
const t = {
|
|
5210
|
-
field:
|
|
5318
|
+
field: an,
|
|
5211
5319
|
header: "",
|
|
5212
5320
|
width: this.config.dragHandleWidth ?? 40,
|
|
5213
5321
|
resizable: !1,
|
|
@@ -5301,7 +5409,7 @@ class Kn extends I {
|
|
|
5301
5409
|
row: e
|
|
5302
5410
|
}, this.lastFocusCol = r;
|
|
5303
5411
|
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
|
|
5304
|
-
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0),
|
|
5412
|
+
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), q(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
5305
5413
|
this.flushPendingMove();
|
|
5306
5414
|
}, this.config.debounceMs ?? 300);
|
|
5307
5415
|
}
|
|
@@ -5320,7 +5428,7 @@ class Kn extends I {
|
|
|
5320
5428
|
const o = [...this.sourceRows], [s] = o.splice(t, 1);
|
|
5321
5429
|
o.splice(e, 0, s);
|
|
5322
5430
|
const l = this.grid;
|
|
5323
|
-
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0),
|
|
5431
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), q(l);
|
|
5324
5432
|
}
|
|
5325
5433
|
}
|
|
5326
5434
|
executeMove(e, t, i, n) {
|
|
@@ -5398,38 +5506,38 @@ function X(a) {
|
|
|
5398
5506
|
endCol: Math.max(a.startCol, a.endCol)
|
|
5399
5507
|
};
|
|
5400
5508
|
}
|
|
5401
|
-
function
|
|
5509
|
+
function ln(a) {
|
|
5402
5510
|
const e = X(a);
|
|
5403
5511
|
return {
|
|
5404
5512
|
from: { row: e.startRow, col: e.startCol },
|
|
5405
5513
|
to: { row: e.endRow, col: e.endCol }
|
|
5406
5514
|
};
|
|
5407
5515
|
}
|
|
5408
|
-
function
|
|
5409
|
-
return a.map(
|
|
5516
|
+
function mt(a) {
|
|
5517
|
+
return a.map(ln);
|
|
5410
5518
|
}
|
|
5411
|
-
function
|
|
5519
|
+
function dn(a, e, t) {
|
|
5412
5520
|
const i = X(t);
|
|
5413
5521
|
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
5414
5522
|
}
|
|
5415
|
-
function
|
|
5416
|
-
return t.some((i) =>
|
|
5523
|
+
function cn(a, e, t) {
|
|
5524
|
+
return t.some((i) => dn(a, e, i));
|
|
5417
5525
|
}
|
|
5418
|
-
function
|
|
5526
|
+
function un(a) {
|
|
5419
5527
|
const e = [], t = X(a);
|
|
5420
5528
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
5421
5529
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
5422
5530
|
e.push({ row: i, col: n });
|
|
5423
5531
|
return e;
|
|
5424
5532
|
}
|
|
5425
|
-
function
|
|
5533
|
+
function hn(a) {
|
|
5426
5534
|
const e = /* @__PURE__ */ new Map();
|
|
5427
5535
|
for (const t of a)
|
|
5428
|
-
for (const i of
|
|
5536
|
+
for (const i of un(t))
|
|
5429
5537
|
e.set(`${i.row},${i.col}`, i);
|
|
5430
5538
|
return [...e.values()];
|
|
5431
5539
|
}
|
|
5432
|
-
function
|
|
5540
|
+
function ge(a, e) {
|
|
5433
5541
|
return {
|
|
5434
5542
|
startRow: a.row,
|
|
5435
5543
|
startCol: a.col,
|
|
@@ -5441,8 +5549,8 @@ function ee(a, e) {
|
|
|
5441
5549
|
const t = X(a), i = X(e);
|
|
5442
5550
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
5443
5551
|
}
|
|
5444
|
-
const
|
|
5445
|
-
function
|
|
5552
|
+
const fn = '@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}.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-width:0;border-style:var(--tbw-selection-border-style, var(--tbw-border-style));border-color:var(--tbw-range-border-color, var(--tbw-color-accent));border-top-width:var(--tbw-selection-border-width, var(--tbw-border-width));border-bottom-width:var(--tbw-selection-border-width, var(--tbw-border-width));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 var(--tbw-selection-border-style, var(--tbw-border-style)) var(--tbw-range-border-color);z-index:1}&.top:after{border-top-width:var(--tbw-selection-border-width, var(--tbw-border-width))}&.bottom:after{border-bottom-width:var(--tbw-selection-border-width, var(--tbw-border-width))}&.first:after{border-left-width:var(--tbw-selection-border-width, var(--tbw-border-width))}&.last:after{border-right-width:var(--tbw-selection-border-width, var(--tbw-border-width))}}.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}}}', tt = "__tbw_checkbox";
|
|
5553
|
+
function gn(a, e, t) {
|
|
5446
5554
|
if (a === "cell" && e.selectedCell)
|
|
5447
5555
|
return {
|
|
5448
5556
|
mode: a,
|
|
@@ -5460,9 +5568,9 @@ function hn(a, e, t) {
|
|
|
5460
5568
|
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);
|
|
5461
5569
|
return n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), { mode: a, ranges: n };
|
|
5462
5570
|
}
|
|
5463
|
-
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges:
|
|
5571
|
+
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: mt(e.ranges) } : { mode: a, ranges: [] };
|
|
5464
5572
|
}
|
|
5465
|
-
class
|
|
5573
|
+
class Bn extends F {
|
|
5466
5574
|
static manifest = {
|
|
5467
5575
|
queries: [
|
|
5468
5576
|
{ type: "getSelection", description: "Get the current selection state" },
|
|
@@ -5481,7 +5589,7 @@ class zn extends I {
|
|
|
5481
5589
|
]
|
|
5482
5590
|
};
|
|
5483
5591
|
name = "selection";
|
|
5484
|
-
styles =
|
|
5592
|
+
styles = fn;
|
|
5485
5593
|
get defaultConfig() {
|
|
5486
5594
|
return {
|
|
5487
5595
|
mode: "cell",
|
|
@@ -5570,7 +5678,7 @@ class zn extends I {
|
|
|
5570
5678
|
return !1;
|
|
5571
5679
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
5572
5680
|
if (d && this.cellAnchor) {
|
|
5573
|
-
const u =
|
|
5681
|
+
const u = ge(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5574
5682
|
if (h && ee(h, u))
|
|
5575
5683
|
return !1;
|
|
5576
5684
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
@@ -5653,7 +5761,7 @@ class zn extends I {
|
|
|
5653
5761
|
const o = this.columns.findIndex((s) => !W(s));
|
|
5654
5762
|
o >= 0 && (t = o);
|
|
5655
5763
|
}
|
|
5656
|
-
const n =
|
|
5764
|
+
const n = ge(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5657
5765
|
return r && ee(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.#i()), this.requestAfterRender()), !0;
|
|
5658
5766
|
}
|
|
5659
5767
|
onCellMouseUp(e) {
|
|
@@ -5662,16 +5770,16 @@ class zn extends I {
|
|
|
5662
5770
|
}
|
|
5663
5771
|
processColumns(e) {
|
|
5664
5772
|
if (this.config.checkbox && this.config.mode === "row") {
|
|
5665
|
-
if (e.some((r) => r.field ===
|
|
5773
|
+
if (e.some((r) => r.field === tt))
|
|
5666
5774
|
return e;
|
|
5667
|
-
const t = this.#t(), i = e.findIndex(
|
|
5775
|
+
const t = this.#t(), i = e.findIndex(se), n = i >= 0 ? i + 1 : 0;
|
|
5668
5776
|
return [...e.slice(0, n), t, ...e.slice(n)];
|
|
5669
5777
|
}
|
|
5670
5778
|
return e;
|
|
5671
5779
|
}
|
|
5672
5780
|
#t() {
|
|
5673
5781
|
return {
|
|
5674
|
-
field:
|
|
5782
|
+
field: tt,
|
|
5675
5783
|
header: "",
|
|
5676
5784
|
width: 32,
|
|
5677
5785
|
resizable: !1,
|
|
@@ -5704,7 +5812,7 @@ class zn extends I {
|
|
|
5704
5812
|
}
|
|
5705
5813
|
#e(e) {
|
|
5706
5814
|
e.querySelectorAll(".tbw-select-row-checkbox").forEach((n) => {
|
|
5707
|
-
const r = n.closest(".cell"), o = r ?
|
|
5815
|
+
const r = n.closest(".cell"), o = r ? ke(r) : -1;
|
|
5708
5816
|
o >= 0 && (n.checked = this.selected.has(o));
|
|
5709
5817
|
});
|
|
5710
5818
|
const i = e.querySelector(".tbw-select-all-checkbox");
|
|
@@ -5740,7 +5848,7 @@ class zn extends I {
|
|
|
5740
5848
|
}
|
|
5741
5849
|
}
|
|
5742
5850
|
}
|
|
5743
|
-
#
|
|
5851
|
+
#s() {
|
|
5744
5852
|
const e = this.gridElement;
|
|
5745
5853
|
if (!e) return;
|
|
5746
5854
|
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
@@ -5750,14 +5858,14 @@ class zn extends I {
|
|
|
5750
5858
|
const r = e.querySelectorAll(".data-grid-row");
|
|
5751
5859
|
if (r.forEach((o) => {
|
|
5752
5860
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
5753
|
-
}), t === "row" && (
|
|
5754
|
-
const s = o.querySelector(".cell[data-row]"), l =
|
|
5861
|
+
}), t === "row" && (Ae(e), r.forEach((o) => {
|
|
5862
|
+
const s = o.querySelector(".cell[data-row]"), l = ke(s);
|
|
5755
5863
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
5756
5864
|
}), this.config.checkbox && this.#e(e)), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5757
5865
|
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
5758
5866
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
|
|
5759
5867
|
}), t === "range" && this.ranges.length > 0) {
|
|
5760
|
-
|
|
5868
|
+
Ae(e);
|
|
5761
5869
|
const o = this.ranges.map(X), s = (d, c) => {
|
|
5762
5870
|
for (const u of o)
|
|
5763
5871
|
if (d >= u.startRow && d <= u.endRow && c >= u.startCol && c <= u.endCol)
|
|
@@ -5785,15 +5893,15 @@ class zn extends I {
|
|
|
5785
5893
|
this.pendingKeyboardUpdate = null;
|
|
5786
5894
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
5787
5895
|
if (n && this.cellAnchor) {
|
|
5788
|
-
const s =
|
|
5896
|
+
const s = ge(this.cellAnchor, { row: r, col: o });
|
|
5789
5897
|
this.ranges = [s], this.activeRange = s;
|
|
5790
5898
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
5791
5899
|
this.emit("selection-change", this.#i());
|
|
5792
5900
|
}
|
|
5793
|
-
this.#o(i), this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#
|
|
5901
|
+
this.#o(i), this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#s();
|
|
5794
5902
|
}
|
|
5795
5903
|
onScrollRender() {
|
|
5796
|
-
this.isSelectionEnabled() && this.#
|
|
5904
|
+
this.isSelectionEnabled() && this.#s();
|
|
5797
5905
|
}
|
|
5798
5906
|
getSelection() {
|
|
5799
5907
|
return {
|
|
@@ -5803,10 +5911,10 @@ class zn extends I {
|
|
|
5803
5911
|
};
|
|
5804
5912
|
}
|
|
5805
5913
|
getSelectedCells() {
|
|
5806
|
-
return
|
|
5914
|
+
return hn(this.ranges);
|
|
5807
5915
|
}
|
|
5808
5916
|
isCellSelected(e, t) {
|
|
5809
|
-
return
|
|
5917
|
+
return cn(e, t, this.ranges);
|
|
5810
5918
|
}
|
|
5811
5919
|
selectAll() {
|
|
5812
5920
|
const { mode: e } = this.config;
|
|
@@ -5850,11 +5958,11 @@ class zn extends I {
|
|
|
5850
5958
|
endCol: t.to.col
|
|
5851
5959
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
5852
5960
|
mode: this.config.mode,
|
|
5853
|
-
ranges:
|
|
5961
|
+
ranges: mt(this.ranges)
|
|
5854
5962
|
}), this.requestAfterRender();
|
|
5855
5963
|
}
|
|
5856
5964
|
#i() {
|
|
5857
|
-
return
|
|
5965
|
+
return gn(
|
|
5858
5966
|
this.config.mode,
|
|
5859
5967
|
{
|
|
5860
5968
|
selectedCell: this.selectedCell,
|
|
@@ -5865,23 +5973,23 @@ class zn extends I {
|
|
|
5865
5973
|
);
|
|
5866
5974
|
}
|
|
5867
5975
|
}
|
|
5868
|
-
function
|
|
5976
|
+
function oe(a, e) {
|
|
5869
5977
|
return Math.floor(a / e);
|
|
5870
5978
|
}
|
|
5871
|
-
function
|
|
5979
|
+
function pn(a, e) {
|
|
5872
5980
|
return {
|
|
5873
5981
|
start: a * e,
|
|
5874
5982
|
end: (a + 1) * e
|
|
5875
5983
|
};
|
|
5876
5984
|
}
|
|
5877
|
-
function
|
|
5878
|
-
const i =
|
|
5985
|
+
function mn(a, e, t) {
|
|
5986
|
+
const i = oe(a, t), n = oe(e - 1, t), r = [];
|
|
5879
5987
|
for (let o = i; o <= n; o++)
|
|
5880
5988
|
r.push(o);
|
|
5881
5989
|
return r;
|
|
5882
5990
|
}
|
|
5883
|
-
async function
|
|
5884
|
-
const n =
|
|
5991
|
+
async function it(a, e, t, i) {
|
|
5992
|
+
const n = pn(e, t);
|
|
5885
5993
|
return a.getRows({
|
|
5886
5994
|
startRow: n.start,
|
|
5887
5995
|
endRow: n.end,
|
|
@@ -5889,14 +5997,14 @@ async function tt(a, e, t, i) {
|
|
|
5889
5997
|
filterModel: i.filterModel
|
|
5890
5998
|
});
|
|
5891
5999
|
}
|
|
5892
|
-
function
|
|
5893
|
-
const i =
|
|
6000
|
+
function bn(a, e, t) {
|
|
6001
|
+
const i = oe(a, e), n = t.get(i);
|
|
5894
6002
|
if (!n) return;
|
|
5895
6003
|
const r = a % e;
|
|
5896
6004
|
return n[r];
|
|
5897
6005
|
}
|
|
5898
|
-
const
|
|
5899
|
-
class
|
|
6006
|
+
const wn = 100;
|
|
6007
|
+
class Vn extends F {
|
|
5900
6008
|
name = "serverSide";
|
|
5901
6009
|
get defaultConfig() {
|
|
5902
6010
|
return {
|
|
@@ -5916,12 +6024,12 @@ class On extends I {
|
|
|
5916
6024
|
}
|
|
5917
6025
|
loadRequiredBlocks() {
|
|
5918
6026
|
if (!this.dataSource) return;
|
|
5919
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
6027
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = mn(i.startRow, i.endRow, t);
|
|
5920
6028
|
for (const r of n)
|
|
5921
6029
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
5922
6030
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
5923
6031
|
break;
|
|
5924
|
-
this.loadingBlocks.add(r),
|
|
6032
|
+
this.loadingBlocks.add(r), it(this.dataSource, r, t, {}).then((o) => {
|
|
5925
6033
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
5926
6034
|
}).catch(() => {
|
|
5927
6035
|
this.loadingBlocks.delete(r);
|
|
@@ -5932,7 +6040,7 @@ class On extends I {
|
|
|
5932
6040
|
if (!this.dataSource) return [...e];
|
|
5933
6041
|
const t = [];
|
|
5934
6042
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
5935
|
-
const n =
|
|
6043
|
+
const n = bn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
5936
6044
|
t.push(n ?? { __loading: !0, __index: i });
|
|
5937
6045
|
}
|
|
5938
6046
|
return t;
|
|
@@ -5940,12 +6048,12 @@ class On extends I {
|
|
|
5940
6048
|
onScroll(e) {
|
|
5941
6049
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
5942
6050
|
this.loadRequiredBlocks();
|
|
5943
|
-
},
|
|
6051
|
+
}, wn));
|
|
5944
6052
|
}
|
|
5945
6053
|
setDataSource(e) {
|
|
5946
6054
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
5947
6055
|
const t = this.config.cacheBlockSize ?? 100;
|
|
5948
|
-
|
|
6056
|
+
it(e, 0, t, {}).then((i) => {
|
|
5949
6057
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
5950
6058
|
});
|
|
5951
6059
|
}
|
|
@@ -5959,59 +6067,59 @@ class On extends I {
|
|
|
5959
6067
|
return this.totalRowCount;
|
|
5960
6068
|
}
|
|
5961
6069
|
isRowLoaded(e) {
|
|
5962
|
-
const t = this.config.cacheBlockSize ?? 100, i =
|
|
6070
|
+
const t = this.config.cacheBlockSize ?? 100, i = oe(e, t);
|
|
5963
6071
|
return this.loadedBlocks.has(i);
|
|
5964
6072
|
}
|
|
5965
6073
|
getLoadedBlockCount() {
|
|
5966
6074
|
return this.loadedBlocks.size;
|
|
5967
6075
|
}
|
|
5968
6076
|
}
|
|
5969
|
-
function
|
|
6077
|
+
function bt(a, e, t) {
|
|
5970
6078
|
return a.id !== void 0 ? String(a.id) : t ? `${t}-${e}` : String(e);
|
|
5971
6079
|
}
|
|
5972
|
-
function
|
|
6080
|
+
function pe(a, e) {
|
|
5973
6081
|
const t = new Set(a);
|
|
5974
6082
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5975
6083
|
}
|
|
5976
|
-
function
|
|
6084
|
+
function ve(a, e, t = null, i = 0) {
|
|
5977
6085
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5978
6086
|
for (let o = 0; o < a.length; o++) {
|
|
5979
|
-
const s = a[o], l =
|
|
6087
|
+
const s = a[o], l = bt(s, o, t), d = s[n];
|
|
5980
6088
|
if (Array.isArray(d) && d.length > 0) {
|
|
5981
6089
|
r.add(l);
|
|
5982
|
-
const c =
|
|
6090
|
+
const c = ve(d, e, l, i + 1);
|
|
5983
6091
|
for (const u of c) r.add(u);
|
|
5984
6092
|
}
|
|
5985
6093
|
}
|
|
5986
6094
|
return r;
|
|
5987
6095
|
}
|
|
5988
|
-
function
|
|
6096
|
+
function vn() {
|
|
5989
6097
|
return /* @__PURE__ */ new Set();
|
|
5990
6098
|
}
|
|
5991
|
-
function
|
|
6099
|
+
function wt(a, e, t, i = null, n = 0) {
|
|
5992
6100
|
const r = t.childrenField ?? "children";
|
|
5993
6101
|
for (let o = 0; o < a.length; o++) {
|
|
5994
|
-
const s = a[o], l =
|
|
6102
|
+
const s = a[o], l = bt(s, o, i);
|
|
5995
6103
|
if (l === e)
|
|
5996
6104
|
return [l];
|
|
5997
6105
|
const d = s[r];
|
|
5998
6106
|
if (Array.isArray(d) && d.length > 0) {
|
|
5999
|
-
const c =
|
|
6107
|
+
const c = wt(d, e, t, l, n + 1);
|
|
6000
6108
|
if (c)
|
|
6001
6109
|
return [l, ...c];
|
|
6002
6110
|
}
|
|
6003
6111
|
}
|
|
6004
6112
|
return null;
|
|
6005
6113
|
}
|
|
6006
|
-
function
|
|
6007
|
-
const n =
|
|
6114
|
+
function yn(a, e, t, i) {
|
|
6115
|
+
const n = wt(a, e, t);
|
|
6008
6116
|
if (!n) return i;
|
|
6009
6117
|
const r = new Set(i);
|
|
6010
6118
|
for (let o = 0; o < n.length - 1; o++)
|
|
6011
6119
|
r.add(n[o]);
|
|
6012
6120
|
return r;
|
|
6013
6121
|
}
|
|
6014
|
-
function
|
|
6122
|
+
function nt(a, e = "children") {
|
|
6015
6123
|
if (!Array.isArray(a) || a.length === 0) return !1;
|
|
6016
6124
|
for (const t of a) {
|
|
6017
6125
|
if (!t) continue;
|
|
@@ -6021,7 +6129,7 @@ function it(a, e = "children") {
|
|
|
6021
6129
|
}
|
|
6022
6130
|
return !1;
|
|
6023
6131
|
}
|
|
6024
|
-
function
|
|
6132
|
+
function xn(a) {
|
|
6025
6133
|
if (!Array.isArray(a) || a.length === 0) return null;
|
|
6026
6134
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
6027
6135
|
for (const t of a)
|
|
@@ -6033,8 +6141,8 @@ function vn(a) {
|
|
|
6033
6141
|
}
|
|
6034
6142
|
return null;
|
|
6035
6143
|
}
|
|
6036
|
-
const
|
|
6037
|
-
class
|
|
6144
|
+
const Cn = "@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}}}";
|
|
6145
|
+
class $n extends F {
|
|
6038
6146
|
static manifest = {
|
|
6039
6147
|
events: [
|
|
6040
6148
|
{
|
|
@@ -6050,7 +6158,7 @@ class Bn extends I {
|
|
|
6050
6158
|
]
|
|
6051
6159
|
};
|
|
6052
6160
|
name = "tree";
|
|
6053
|
-
styles =
|
|
6161
|
+
styles = Cn;
|
|
6054
6162
|
get defaultConfig() {
|
|
6055
6163
|
return {
|
|
6056
6164
|
childrenField: "children",
|
|
@@ -6083,15 +6191,15 @@ class Bn extends I {
|
|
|
6083
6191
|
}
|
|
6084
6192
|
detect(e) {
|
|
6085
6193
|
if (!this.config.autoDetect) return !1;
|
|
6086
|
-
const t = e, i = this.config.childrenField ??
|
|
6087
|
-
return
|
|
6194
|
+
const t = e, i = this.config.childrenField ?? xn(t) ?? "children";
|
|
6195
|
+
return nt(t, i);
|
|
6088
6196
|
}
|
|
6089
6197
|
processRows(e) {
|
|
6090
6198
|
const t = this.config.childrenField ?? "children", i = e;
|
|
6091
|
-
if (!
|
|
6199
|
+
if (!nt(i, t))
|
|
6092
6200
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
6093
6201
|
let n = this.withStableKeys(i);
|
|
6094
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
6202
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ve(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
6095
6203
|
const r = /* @__PURE__ */ new Set();
|
|
6096
6204
|
for (const o of this.flattenedRows)
|
|
6097
6205
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -6147,19 +6255,19 @@ class Bn extends I {
|
|
|
6147
6255
|
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, m = document.createElement("span");
|
|
6148
6256
|
if (m.className = "tree-cell-wrapper", m.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && m.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
|
|
6149
6257
|
if (g.__treeHasChildren) {
|
|
6150
|
-
const
|
|
6151
|
-
|
|
6258
|
+
const E = document.createElement("span");
|
|
6259
|
+
E.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(E, s(g.__treeExpanded ? "collapse" : "expand")), E.setAttribute("data-tree-key", String(g.__treeKey ?? "")), m.appendChild(E);
|
|
6152
6260
|
} else {
|
|
6153
|
-
const
|
|
6154
|
-
|
|
6261
|
+
const E = document.createElement("span");
|
|
6262
|
+
E.className = "tree-spacer", m.appendChild(E);
|
|
6155
6263
|
}
|
|
6156
|
-
const
|
|
6157
|
-
if (
|
|
6158
|
-
const
|
|
6159
|
-
|
|
6264
|
+
const x = document.createElement("span");
|
|
6265
|
+
if (x.className = "tree-content", n) {
|
|
6266
|
+
const E = n(d);
|
|
6267
|
+
E instanceof Node ? x.appendChild(E) : typeof E == "string" && (x.innerHTML = E);
|
|
6160
6268
|
} else
|
|
6161
|
-
|
|
6162
|
-
return m.appendChild(
|
|
6269
|
+
x.textContent = u != null ? String(u) : "";
|
|
6270
|
+
return m.appendChild(x), m;
|
|
6163
6271
|
};
|
|
6164
6272
|
return t[0] = { ...i, viewRenderer: l }, t;
|
|
6165
6273
|
}
|
|
@@ -6169,7 +6277,7 @@ class Bn extends I {
|
|
|
6169
6277
|
const i = t.getAttribute("data-tree-key");
|
|
6170
6278
|
if (!i) return !1;
|
|
6171
6279
|
const n = this.rowKeyMap.get(i);
|
|
6172
|
-
return n ? (this.expandedKeys =
|
|
6280
|
+
return n ? (this.expandedKeys = pe(this.expandedKeys, i), this.emit("tree-expand", {
|
|
6173
6281
|
key: i,
|
|
6174
6282
|
row: n.data,
|
|
6175
6283
|
expanded: this.expandedKeys.has(i),
|
|
@@ -6180,7 +6288,7 @@ class Bn extends I {
|
|
|
6180
6288
|
if (e.key !== " ") return;
|
|
6181
6289
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
6182
6290
|
if (i?.hasChildren)
|
|
6183
|
-
return e.preventDefault(), this.expandedKeys =
|
|
6291
|
+
return e.preventDefault(), this.expandedKeys = pe(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
6184
6292
|
key: i.key,
|
|
6185
6293
|
row: i.data,
|
|
6186
6294
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -6213,13 +6321,13 @@ class Bn extends I {
|
|
|
6213
6321
|
this.expandedKeys.delete(e), this.requestRender();
|
|
6214
6322
|
}
|
|
6215
6323
|
toggle(e) {
|
|
6216
|
-
this.expandedKeys =
|
|
6324
|
+
this.expandedKeys = pe(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
6217
6325
|
}
|
|
6218
6326
|
expandAll() {
|
|
6219
|
-
this.expandedKeys =
|
|
6327
|
+
this.expandedKeys = ve(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
6220
6328
|
}
|
|
6221
6329
|
collapseAll() {
|
|
6222
|
-
this.expandedKeys =
|
|
6330
|
+
this.expandedKeys = vn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
6223
6331
|
}
|
|
6224
6332
|
isExpanded(e) {
|
|
6225
6333
|
return this.expandedKeys.has(e);
|
|
@@ -6234,10 +6342,10 @@ class Bn extends I {
|
|
|
6234
6342
|
return this.rowKeyMap.get(e)?.data;
|
|
6235
6343
|
}
|
|
6236
6344
|
expandToKey(e) {
|
|
6237
|
-
this.expandedKeys =
|
|
6345
|
+
this.expandedKeys = yn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
6238
6346
|
}
|
|
6239
6347
|
}
|
|
6240
|
-
function
|
|
6348
|
+
function En(a, e, t) {
|
|
6241
6349
|
const i = [...a.undoStack, e];
|
|
6242
6350
|
for (; i.length > t; )
|
|
6243
6351
|
i.shift();
|
|
@@ -6246,7 +6354,7 @@ function xn(a, e, t) {
|
|
|
6246
6354
|
redoStack: []
|
|
6247
6355
|
};
|
|
6248
6356
|
}
|
|
6249
|
-
function
|
|
6357
|
+
function rt(a) {
|
|
6250
6358
|
if (a.undoStack.length === 0)
|
|
6251
6359
|
return { newState: a, action: null };
|
|
6252
6360
|
const e = [...a.undoStack], t = e.pop();
|
|
@@ -6258,7 +6366,7 @@ function nt(a) {
|
|
|
6258
6366
|
action: t
|
|
6259
6367
|
} : { newState: a, action: null };
|
|
6260
6368
|
}
|
|
6261
|
-
function
|
|
6369
|
+
function ot(a) {
|
|
6262
6370
|
if (a.redoStack.length === 0)
|
|
6263
6371
|
return { newState: a, action: null };
|
|
6264
6372
|
const e = [...a.redoStack], t = e.pop();
|
|
@@ -6270,16 +6378,16 @@ function rt(a) {
|
|
|
6270
6378
|
action: t
|
|
6271
6379
|
} : { newState: a, action: null };
|
|
6272
6380
|
}
|
|
6273
|
-
function
|
|
6381
|
+
function Rn(a) {
|
|
6274
6382
|
return a.undoStack.length > 0;
|
|
6275
6383
|
}
|
|
6276
|
-
function
|
|
6384
|
+
function Sn(a) {
|
|
6277
6385
|
return a.redoStack.length > 0;
|
|
6278
6386
|
}
|
|
6279
|
-
function
|
|
6387
|
+
function kn() {
|
|
6280
6388
|
return { undoStack: [], redoStack: [] };
|
|
6281
6389
|
}
|
|
6282
|
-
function
|
|
6390
|
+
function An(a, e, t, i) {
|
|
6283
6391
|
return {
|
|
6284
6392
|
type: "cell-edit",
|
|
6285
6393
|
rowIndex: a,
|
|
@@ -6289,7 +6397,7 @@ function Sn(a, e, t, i) {
|
|
|
6289
6397
|
timestamp: Date.now()
|
|
6290
6398
|
};
|
|
6291
6399
|
}
|
|
6292
|
-
class
|
|
6400
|
+
class Wn extends F {
|
|
6293
6401
|
static dependencies = [
|
|
6294
6402
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
6295
6403
|
];
|
|
@@ -6315,7 +6423,7 @@ class Vn extends I {
|
|
|
6315
6423
|
onKeyDown(e) {
|
|
6316
6424
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
6317
6425
|
if (t) {
|
|
6318
|
-
const n =
|
|
6426
|
+
const n = rt({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
6319
6427
|
if (n.action) {
|
|
6320
6428
|
const r = this.rows;
|
|
6321
6429
|
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", {
|
|
@@ -6326,7 +6434,7 @@ class Vn extends I {
|
|
|
6326
6434
|
return !0;
|
|
6327
6435
|
}
|
|
6328
6436
|
if (i) {
|
|
6329
|
-
const n =
|
|
6437
|
+
const n = ot({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
6330
6438
|
if (n.action) {
|
|
6331
6439
|
const r = this.rows;
|
|
6332
6440
|
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", {
|
|
@@ -6339,7 +6447,7 @@ class Vn extends I {
|
|
|
6339
6447
|
return !1;
|
|
6340
6448
|
}
|
|
6341
6449
|
recordEdit(e, t, i, n) {
|
|
6342
|
-
const r =
|
|
6450
|
+
const r = An(e, t, i, n), o = En(
|
|
6343
6451
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
6344
6452
|
r,
|
|
6345
6453
|
this.config.maxHistorySize ?? 100
|
|
@@ -6347,7 +6455,7 @@ class Vn extends I {
|
|
|
6347
6455
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
6348
6456
|
}
|
|
6349
6457
|
undo() {
|
|
6350
|
-
const e =
|
|
6458
|
+
const e = rt({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
6351
6459
|
if (e.action) {
|
|
6352
6460
|
const t = this.rows;
|
|
6353
6461
|
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();
|
|
@@ -6355,7 +6463,7 @@ class Vn extends I {
|
|
|
6355
6463
|
return e.action;
|
|
6356
6464
|
}
|
|
6357
6465
|
redo() {
|
|
6358
|
-
const e =
|
|
6466
|
+
const e = ot({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
6359
6467
|
if (e.action) {
|
|
6360
6468
|
const t = this.rows;
|
|
6361
6469
|
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();
|
|
@@ -6363,13 +6471,13 @@ class Vn extends I {
|
|
|
6363
6471
|
return e.action;
|
|
6364
6472
|
}
|
|
6365
6473
|
canUndo() {
|
|
6366
|
-
return
|
|
6474
|
+
return Rn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
6367
6475
|
}
|
|
6368
6476
|
canRedo() {
|
|
6369
|
-
return
|
|
6477
|
+
return Sn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
6370
6478
|
}
|
|
6371
6479
|
clearHistory() {
|
|
6372
|
-
const e =
|
|
6480
|
+
const e = kn();
|
|
6373
6481
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
6374
6482
|
}
|
|
6375
6483
|
getUndoStack() {
|
|
@@ -6379,12 +6487,12 @@ class Vn extends I {
|
|
|
6379
6487
|
return [...this.redoStack];
|
|
6380
6488
|
}
|
|
6381
6489
|
}
|
|
6382
|
-
const
|
|
6383
|
-
function
|
|
6490
|
+
const _n = '@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))}.tbw-visibility-group-header{display:flex;align-items:center;padding:var(--tbw-menu-item-padding, .375rem .25rem);font-size:var(--tbw-font-size-sm, .8125rem);font-weight:600;color:var(--tbw-color-fg);border-bottom:1px solid var(--tbw-color-border);margin-top:var(--tbw-spacing-sm, .25rem);position:relative}.tbw-visibility-group-header:first-child{margin-top:0}.tbw-visibility-group-header .tbw-visibility-label{gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-visibility-group-header.reorderable{cursor:grab}.tbw-visibility-group-header.reorderable:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-group-header .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-group-header.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-group-header.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-group-header.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-group-header.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-row--grouped{padding-left:calc(var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem)) + .75rem)}}';
|
|
6491
|
+
function st(a) {
|
|
6384
6492
|
const e = a.meta ?? {};
|
|
6385
6493
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
6386
6494
|
}
|
|
6387
|
-
class U extends
|
|
6495
|
+
class U extends F {
|
|
6388
6496
|
static dependencies = [
|
|
6389
6497
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
6390
6498
|
];
|
|
@@ -6398,7 +6506,7 @@ class U extends I {
|
|
|
6398
6506
|
};
|
|
6399
6507
|
name = "visibility";
|
|
6400
6508
|
static PANEL_ID = "columns";
|
|
6401
|
-
styles =
|
|
6509
|
+
styles = _n;
|
|
6402
6510
|
get defaultConfig() {
|
|
6403
6511
|
return {
|
|
6404
6512
|
allowHideAll: !1
|
|
@@ -6572,7 +6680,7 @@ class U extends I {
|
|
|
6572
6680
|
}
|
|
6573
6681
|
createColumnRow(e, t, i, n) {
|
|
6574
6682
|
const r = e.header || e.field, o = document.createElement("div");
|
|
6575
|
-
o.className = e.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", o.setAttribute("data-field", e.field), o.setAttribute("data-index", String(t)), i &&
|
|
6683
|
+
o.className = e.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", o.setAttribute("data-field", e.field), o.setAttribute("data-index", String(t)), i && st(e) && (o.draggable = !0, o.classList.add("reorderable"), this.setupDragListeners(o, e.field, t, n));
|
|
6576
6684
|
const s = document.createElement("label");
|
|
6577
6685
|
s.className = "tbw-visibility-label";
|
|
6578
6686
|
const l = document.createElement("input");
|
|
@@ -6580,7 +6688,7 @@ class U extends I {
|
|
|
6580
6688
|
this.grid.toggleColumnVisibility(e.field), setTimeout(() => this.rebuildToggles(n), 0);
|
|
6581
6689
|
});
|
|
6582
6690
|
const d = document.createElement("span");
|
|
6583
|
-
if (d.textContent = r, s.appendChild(l), s.appendChild(d), i &&
|
|
6691
|
+
if (d.textContent = r, s.appendChild(l), s.appendChild(d), i && st(e)) {
|
|
6584
6692
|
const c = document.createElement("span");
|
|
6585
6693
|
c.className = "tbw-visibility-handle", this.setIcon(c, this.resolveIcon("dragHandle")), c.title = "Drag to reorder", o.appendChild(c);
|
|
6586
6694
|
}
|
|
@@ -6656,50 +6764,52 @@ class U extends I {
|
|
|
6656
6764
|
}
|
|
6657
6765
|
}
|
|
6658
6766
|
export {
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6767
|
+
re as BLANK_FILTER_VALUE,
|
|
6768
|
+
F as BaseGridPlugin,
|
|
6769
|
+
Tn as ClipboardPlugin,
|
|
6770
|
+
In as ColumnVirtualizationPlugin,
|
|
6771
|
+
dt as ContextMenuPlugin,
|
|
6772
|
+
Yn as DEFAULT_ANIMATION_CONFIG,
|
|
6773
|
+
yt as DEFAULT_GRID_ICONS,
|
|
6774
|
+
Xn as DGEvents,
|
|
6775
|
+
Qn as DataGridElement,
|
|
6776
|
+
Fn as EditingPlugin,
|
|
6777
|
+
Pn as ExportPlugin,
|
|
6669
6778
|
z as FilteringPlugin,
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6779
|
+
Zn as FitModeEnum,
|
|
6780
|
+
Jn as GridCSSVars,
|
|
6781
|
+
er as GridClasses,
|
|
6782
|
+
tr as GridDataAttrs,
|
|
6783
|
+
ir as GridElement,
|
|
6784
|
+
nr as GridSelectors,
|
|
6785
|
+
Mn as GroupingColumnsPlugin,
|
|
6786
|
+
Dn as GroupingRowsPlugin,
|
|
6787
|
+
ut as MasterDetailPlugin,
|
|
6788
|
+
qn as MultiSortPlugin,
|
|
6789
|
+
rr as PLUGIN_QUERIES,
|
|
6790
|
+
Nn as PinnedColumnsPlugin,
|
|
6791
|
+
Hn as PinnedRowsPlugin,
|
|
6683
6792
|
j as PivotPlugin,
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6793
|
+
or as PluginEvents,
|
|
6794
|
+
sr as PluginManager,
|
|
6795
|
+
Gn as PrintPlugin,
|
|
6796
|
+
an as ROW_DRAG_HANDLE_FIELD,
|
|
6797
|
+
ar as RenderPhase,
|
|
6798
|
+
Kn as ReorderPlugin,
|
|
6799
|
+
zn as ResponsivePlugin,
|
|
6800
|
+
On as RowReorderPlugin,
|
|
6801
|
+
Bn as SelectionPlugin,
|
|
6802
|
+
Vn as ServerSidePlugin,
|
|
6803
|
+
$n as TreePlugin,
|
|
6804
|
+
Wn as UndoRedoPlugin,
|
|
6696
6805
|
U as VisibilityPlugin,
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6806
|
+
lr as builtInSort,
|
|
6807
|
+
dr as createGrid,
|
|
6808
|
+
cr as defaultComparator,
|
|
6809
|
+
Kt as defaultEditorFor,
|
|
6810
|
+
_t as defaultPasteHandler,
|
|
6811
|
+
Zt as getUniqueValuesBatch,
|
|
6812
|
+
Ji as printGridIsolated,
|
|
6813
|
+
ur as queryGrid
|
|
6704
6814
|
};
|
|
6705
6815
|
//# sourceMappingURL=all.js.map
|