@toolbox-web/grid 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +576 -483
- package/all.js.map +1 -1
- package/index.js +1747 -1475
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +19 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/aria.d.ts +52 -0
- package/lib/core/internal/aria.d.ts.map +1 -0
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/idle-scheduler.d.ts +0 -27
- package/lib/core/internal/idle-scheduler.d.ts.map +1 -1
- package/lib/core/internal/loading.d.ts +0 -38
- package/lib/core/internal/loading.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +6 -0
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/style-injector.d.ts +0 -8
- package/lib/core/internal/style-injector.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +6 -4
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/internal/virtualization.d.ts +177 -23
- package/lib/core/internal/virtualization.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +50 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +18 -0
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +16 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +51 -2
- 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 +7 -5
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +379 -278
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +14 -1
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -0
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +88 -69
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +17 -0
- package/lib/plugins/grouping-rows/types.d.ts.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +17 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +133 -97
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +2 -2
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +2 -2
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +13 -0
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +65 -49
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/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 +25 -23
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +18 -16
- 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/grouping-rows.umd.js +2 -2
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ht, e as
|
|
1
|
+
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ht, F as M, e as F, s as ft, c as gt, runAggregator as te, a as Je, b as et, g as ue, r as pt, getAggregator as ye, getValueAggregator as mt, d as xe, f as wt } from "./index.js";
|
|
2
2
|
import { DEFAULT_ANIMATION_CONFIG as Dn, DGEvents as Mn, DataGridElement as Nn, FitModeEnum as qn, GridCSSVars as Hn, GridClasses as Kn, GridDataAttrs as zn, DataGridElement as On, GridSelectors as Gn, PLUGIN_QUERIES as Bn, PluginEvents as Vn, PluginManager as Wn, RenderPhase as $n, builtInSort as jn, createGrid as Un, defaultComparator as Yn, queryGrid as Xn } from "./index.js";
|
|
3
|
-
const tt = "__tbw_expander",
|
|
3
|
+
const tt = "__tbw_expander", bt = 32;
|
|
4
4
|
function pe(a) {
|
|
5
5
|
return a.field === tt;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function H(a) {
|
|
8
8
|
return a.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function vt(a) {
|
|
11
11
|
return a.find(pe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function yt(a) {
|
|
14
14
|
return {
|
|
15
15
|
field: tt,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: bt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -49,14 +49,14 @@ function Ce(a, e) {
|
|
|
49
49
|
}
|
|
50
50
|
return o.push(s), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function xt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Ct(a, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = a;
|
|
61
61
|
if (!i) return;
|
|
62
62
|
const r = e.rows, o = e.effectiveConfig.columns ?? [], s = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
@@ -99,7 +99,7 @@ class pn extends _ {
|
|
|
99
99
|
attach(e) {
|
|
100
100
|
super.attach(e), e.addEventListener(
|
|
101
101
|
"paste",
|
|
102
|
-
(t) => this.#
|
|
102
|
+
(t) => this.#e(t),
|
|
103
103
|
{ signal: this.disconnectSignal }
|
|
104
104
|
);
|
|
105
105
|
}
|
|
@@ -107,10 +107,10 @@ class pn extends _ {
|
|
|
107
107
|
this.lastCopied = null;
|
|
108
108
|
}
|
|
109
109
|
onKeyDown(e) {
|
|
110
|
-
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#
|
|
110
|
+
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#t(e.target), !0) : !1;
|
|
111
111
|
}
|
|
112
|
-
#
|
|
113
|
-
const t = this.#
|
|
112
|
+
#t(e) {
|
|
113
|
+
const t = this.#o(), i = this.columns.length - 1, n = this.rows.length - 1;
|
|
114
114
|
let r;
|
|
115
115
|
if (t && t.ranges.length > 0) {
|
|
116
116
|
const { mode: s, ranges: l } = t, d = l[l.length - 1];
|
|
@@ -128,7 +128,7 @@ class pn extends _ {
|
|
|
128
128
|
} else if (!t)
|
|
129
129
|
r = { startRow: 0, startCol: 0, endRow: n, endCol: i };
|
|
130
130
|
else {
|
|
131
|
-
const s = this.#
|
|
131
|
+
const s = this.#n(e);
|
|
132
132
|
if (!s) return;
|
|
133
133
|
r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
|
|
134
134
|
}
|
|
@@ -141,30 +141,30 @@ class pn extends _ {
|
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
#
|
|
144
|
+
#e(e) {
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i = Ce(t, this.config), n = this.#
|
|
148
|
+
const i = Ce(t, this.config), n = this.#o(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
|
|
149
149
|
for (let w = 0; w < g && s + w <= c; w++) {
|
|
150
150
|
const b = this.columns[s + w];
|
|
151
151
|
b && !b.hidden && f.push(b.field);
|
|
152
152
|
}
|
|
153
153
|
const p = { rows: i, text: t, target: h, fields: f };
|
|
154
|
-
this.emit("paste", p), this.#
|
|
154
|
+
this.emit("paste", p), this.#s(p);
|
|
155
155
|
}
|
|
156
|
-
#
|
|
156
|
+
#s(e) {
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? Ct)(e, this.grid);
|
|
161
161
|
}
|
|
162
|
-
#
|
|
162
|
+
#o() {
|
|
163
163
|
return this.grid?.query("getSelection", void 0)?.[0];
|
|
164
164
|
}
|
|
165
165
|
#i(e) {
|
|
166
166
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), s = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
167
|
-
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !
|
|
167
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !H(g));
|
|
168
168
|
if (this.config.includeHeaders) {
|
|
169
169
|
const g = f.map((p) => p.header || p.field);
|
|
170
170
|
h.push(g.join(c));
|
|
@@ -173,8 +173,8 @@ class pn extends _ {
|
|
|
173
173
|
const p = this.rows[g];
|
|
174
174
|
if (!p) continue;
|
|
175
175
|
const w = f.map((b) => {
|
|
176
|
-
const
|
|
177
|
-
return
|
|
176
|
+
const y = p[b.field];
|
|
177
|
+
return y == null ? "" : y instanceof Date ? y.toISOString() : String(y);
|
|
178
178
|
});
|
|
179
179
|
h.push(w.join(c));
|
|
180
180
|
}
|
|
@@ -184,7 +184,7 @@ class pn extends _ {
|
|
|
184
184
|
columnCount: d - l + 1
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
#
|
|
187
|
+
#n(e) {
|
|
188
188
|
const t = e.closest("[data-field-cache]");
|
|
189
189
|
if (!t) return null;
|
|
190
190
|
const i = t.dataset.fieldCache, n = t.dataset.row;
|
|
@@ -195,7 +195,7 @@ class pn extends _ {
|
|
|
195
195
|
return o === -1 ? null : { row: r, col: o };
|
|
196
196
|
}
|
|
197
197
|
async copy() {
|
|
198
|
-
const e = this.#
|
|
198
|
+
const e = this.#o(), t = this.columns.length - 1;
|
|
199
199
|
let i = { startRow: 0, startCol: 0, endRow: this.rows.length - 1, endCol: t };
|
|
200
200
|
if (e && e.ranges.length > 0) {
|
|
201
201
|
const r = e.ranges[e.ranges.length - 1];
|
|
@@ -220,7 +220,7 @@ class pn extends _ {
|
|
|
220
220
|
return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
|
-
const e = await
|
|
223
|
+
const e = await xt();
|
|
224
224
|
return e ? Ce(e, this.config) : null;
|
|
225
225
|
}
|
|
226
226
|
getLastCopied() {
|
|
@@ -249,11 +249,11 @@ function Se(a) {
|
|
|
249
249
|
function ke(a) {
|
|
250
250
|
return a.reduce((e, t) => e + me(t.width), 0);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Et(a, e, t, i, n) {
|
|
253
253
|
const r = t.length;
|
|
254
254
|
if (r === 0)
|
|
255
255
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
256
|
-
let o =
|
|
256
|
+
let o = Rt(a, t, i);
|
|
257
257
|
o = Math.max(0, o - n);
|
|
258
258
|
const s = a + e;
|
|
259
259
|
let l = o;
|
|
@@ -270,7 +270,7 @@ function xt(a, e, t, i, n) {
|
|
|
270
270
|
d.push(c);
|
|
271
271
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Rt(a, e, t) {
|
|
274
274
|
let i = 0, n = e.length - 1;
|
|
275
275
|
for (; i < n; ) {
|
|
276
276
|
const r = Math.floor((i + n) / 2);
|
|
@@ -278,7 +278,7 @@ function Ct(a, e, t) {
|
|
|
278
278
|
}
|
|
279
279
|
return i;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function St(a, e, t) {
|
|
282
282
|
return t ? a > e : !1;
|
|
283
283
|
}
|
|
284
284
|
class mn extends _ {
|
|
@@ -304,9 +304,9 @@ class mn extends _ {
|
|
|
304
304
|
this.columnWidths = Re(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
|
|
305
305
|
}
|
|
306
306
|
detach() {
|
|
307
|
-
this.#
|
|
307
|
+
this.#t(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
308
308
|
}
|
|
309
|
-
#
|
|
309
|
+
#t() {
|
|
310
310
|
const e = this.gridElement;
|
|
311
311
|
if (!e) return;
|
|
312
312
|
const t = e.querySelector(".header-row");
|
|
@@ -320,14 +320,14 @@ class mn extends _ {
|
|
|
320
320
|
}
|
|
321
321
|
processColumns(e) {
|
|
322
322
|
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(e));
|
|
323
|
-
const i = this.originalColumns, n =
|
|
323
|
+
const i = this.originalColumns, n = St(
|
|
324
324
|
i.length,
|
|
325
325
|
this.config.threshold ?? 30,
|
|
326
326
|
this.config.autoEnable ?? !0
|
|
327
327
|
);
|
|
328
328
|
if (this.isVirtualized = n ?? !1, !n)
|
|
329
329
|
return this.startCol = 0, this.endCol = i.length - 1, [...i];
|
|
330
|
-
const r = this.grid.clientWidth || 800, o =
|
|
330
|
+
const r = this.grid.clientWidth || 800, o = Et(
|
|
331
331
|
this.scrollLeft,
|
|
332
332
|
r,
|
|
333
333
|
this.columnOffsets,
|
|
@@ -373,7 +373,7 @@ const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(-
|
|
|
373
373
|
function he(a, e) {
|
|
374
374
|
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function kt(a, e) {
|
|
377
377
|
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
378
378
|
}
|
|
379
379
|
function fe(a, e, t, i = ht.submenuArrow) {
|
|
@@ -387,7 +387,7 @@ function fe(a, e, t, i = ht.submenuArrow) {
|
|
|
387
387
|
}
|
|
388
388
|
const o = document.createElement("div");
|
|
389
389
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
390
|
-
const s =
|
|
390
|
+
const s = kt(r, e);
|
|
391
391
|
if (s && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
392
392
|
const d = document.createElement("span");
|
|
393
393
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -420,7 +420,7 @@ function Ae(a, e, t) {
|
|
|
420
420
|
let o = e, s = t;
|
|
421
421
|
e + i.width > n && (o = e - i.width), t + i.height > r && (s = t - i.height), o = Math.max(0, o), s = Math.max(0, s), a.style.left = `${o}px`, a.style.top = `${s}px`, a.style.visibility = "visible";
|
|
422
422
|
}
|
|
423
|
-
let
|
|
423
|
+
let O = null, G = null, N = null, re = 0;
|
|
424
424
|
const oe = [
|
|
425
425
|
{
|
|
426
426
|
id: "copy",
|
|
@@ -506,14 +506,14 @@ class it extends _ {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
installGlobalHandlers() {
|
|
509
|
-
!
|
|
509
|
+
!N && typeof document < "u" && typeof ne == "string" && ne && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = ne, document.head.appendChild(N)), O || (O = () => {
|
|
510
510
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
511
|
-
}, document.addEventListener("click",
|
|
511
|
+
}, document.addEventListener("click", O)), G || (G = (e) => {
|
|
512
512
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
513
|
-
}, document.addEventListener("keydown",
|
|
513
|
+
}, document.addEventListener("keydown", G));
|
|
514
514
|
}
|
|
515
515
|
uninstallGlobalHandlers() {
|
|
516
|
-
re--, !(re > 0) && (
|
|
516
|
+
re--, !(re > 0) && (O && (document.removeEventListener("click", O), O = null), G && (document.removeEventListener("keydown", G), G = null), N && (N.remove(), N = null));
|
|
517
517
|
}
|
|
518
518
|
afterRender() {
|
|
519
519
|
const e = this.gridElement;
|
|
@@ -589,12 +589,12 @@ class it extends _ {
|
|
|
589
589
|
return this.isOpen;
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
const
|
|
593
|
-
function
|
|
592
|
+
const At = "@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}}}";
|
|
593
|
+
function _t(a) {
|
|
594
594
|
const e = a.options;
|
|
595
595
|
return e ? typeof e == "function" ? e() : e : [];
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Lt(a) {
|
|
598
598
|
return (e) => {
|
|
599
599
|
const t = a.editorParams, i = document.createElement("input");
|
|
600
600
|
i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -604,13 +604,13 @@ function At(a) {
|
|
|
604
604
|
}), i;
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function Tt() {
|
|
608
608
|
return (a) => {
|
|
609
609
|
const e = document.createElement("input");
|
|
610
610
|
return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function It(a) {
|
|
614
614
|
return (e) => {
|
|
615
615
|
const t = a.editorParams, i = document.createElement("input");
|
|
616
616
|
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);
|
|
@@ -622,14 +622,14 @@ function Tt(a) {
|
|
|
622
622
|
}), i;
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function Ft(a) {
|
|
626
626
|
return (e) => {
|
|
627
627
|
const t = a.editorParams, i = document.createElement("select");
|
|
628
628
|
if (a.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
629
629
|
const o = document.createElement("option");
|
|
630
630
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
631
631
|
}
|
|
632
|
-
|
|
632
|
+
_t(a).forEach((o) => {
|
|
633
633
|
const s = document.createElement("option");
|
|
634
634
|
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);
|
|
635
635
|
});
|
|
@@ -645,7 +645,7 @@ function Lt(a) {
|
|
|
645
645
|
}), i;
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function Pt(a) {
|
|
649
649
|
return (e) => {
|
|
650
650
|
const t = a.editorParams, i = document.createElement("input");
|
|
651
651
|
i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -658,22 +658,21 @@ function It(a) {
|
|
|
658
658
|
}), i;
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function Dt(a) {
|
|
662
662
|
switch (a.type) {
|
|
663
663
|
case "number":
|
|
664
|
-
return
|
|
664
|
+
return Lt(a);
|
|
665
665
|
case "boolean":
|
|
666
|
-
return
|
|
666
|
+
return Tt();
|
|
667
667
|
case "date":
|
|
668
|
-
return
|
|
668
|
+
return It(a);
|
|
669
669
|
case "select":
|
|
670
|
-
return
|
|
670
|
+
return Ft(a);
|
|
671
671
|
default:
|
|
672
|
-
return
|
|
672
|
+
return Pt(a);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
|
|
676
|
-
function Pt(a, e) {
|
|
675
|
+
function Mt(a, e) {
|
|
677
676
|
if (e.editor) return e.editor;
|
|
678
677
|
if (e.__editorTemplate) return "template";
|
|
679
678
|
if (!e.type) return;
|
|
@@ -687,26 +686,26 @@ function Pt(a, e) {
|
|
|
687
686
|
return r.editor;
|
|
688
687
|
}
|
|
689
688
|
}
|
|
690
|
-
function
|
|
689
|
+
function U(a) {
|
|
691
690
|
return !(typeof a != "string" || a === "__proto__" || a === "constructor" || a === "prototype");
|
|
692
691
|
}
|
|
693
|
-
function
|
|
692
|
+
function Nt(a) {
|
|
694
693
|
const e = (a.__editingCellCount ?? 0) + 1;
|
|
695
694
|
a.__editingCellCount = e, a.setAttribute("data-has-editing", "");
|
|
696
695
|
}
|
|
697
|
-
function
|
|
696
|
+
function qt(a) {
|
|
698
697
|
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
699
698
|
}
|
|
700
|
-
function
|
|
699
|
+
function W(a, e, t) {
|
|
701
700
|
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
|
|
702
701
|
}
|
|
703
702
|
function _e(a) {
|
|
704
703
|
}
|
|
705
|
-
function
|
|
704
|
+
function Ht(a, e, t, i) {
|
|
706
705
|
const n = a.querySelector("input,textarea,select");
|
|
707
706
|
n && (n.addEventListener("blur", () => {
|
|
708
|
-
t(
|
|
709
|
-
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(
|
|
707
|
+
t(W(n, e, i));
|
|
708
|
+
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(W(n, e, i))));
|
|
710
709
|
}
|
|
711
710
|
class wn extends _ {
|
|
712
711
|
static manifest = {
|
|
@@ -742,20 +741,26 @@ class wn extends _ {
|
|
|
742
741
|
]
|
|
743
742
|
};
|
|
744
743
|
name = "editing";
|
|
745
|
-
styles =
|
|
744
|
+
styles = At;
|
|
746
745
|
get defaultConfig() {
|
|
747
746
|
return {
|
|
747
|
+
mode: "row",
|
|
748
748
|
editOn: "click"
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
+
get #t() {
|
|
752
|
+
return this.config.mode === "grid";
|
|
753
|
+
}
|
|
751
754
|
#e = -1;
|
|
752
|
-
#
|
|
753
|
-
#
|
|
754
|
-
#n = /* @__PURE__ */ new Set();
|
|
755
|
+
#s = -1;
|
|
756
|
+
#o = /* @__PURE__ */ new Map();
|
|
755
757
|
#i = /* @__PURE__ */ new Set();
|
|
756
|
-
#
|
|
757
|
-
#
|
|
758
|
+
#n = /* @__PURE__ */ new Set();
|
|
759
|
+
#u = !1;
|
|
760
|
+
#l = -1;
|
|
758
761
|
#r = /* @__PURE__ */ new Map();
|
|
762
|
+
#d = !1;
|
|
763
|
+
#f = !1;
|
|
759
764
|
attach(e) {
|
|
760
765
|
super.attach(e);
|
|
761
766
|
const t = this.disconnectSignal, i = e;
|
|
@@ -770,33 +775,69 @@ class wn extends _ {
|
|
|
770
775
|
}, document.addEventListener(
|
|
771
776
|
"keydown",
|
|
772
777
|
(n) => {
|
|
773
|
-
if (n.key === "Escape" && this.#e !== -1) {
|
|
778
|
+
if (!this.#t && n.key === "Escape" && this.#e !== -1) {
|
|
774
779
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
775
780
|
return;
|
|
776
|
-
this.#
|
|
781
|
+
this.#a(this.#e, !0);
|
|
777
782
|
}
|
|
778
783
|
},
|
|
779
784
|
{ capture: !0, signal: t }
|
|
780
785
|
), document.addEventListener(
|
|
781
786
|
"mousedown",
|
|
782
787
|
(n) => {
|
|
783
|
-
if (this.#e === -1) return;
|
|
788
|
+
if (this.#t || this.#e === -1) return;
|
|
784
789
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
785
790
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
|
|
786
|
-
this.#e !== -1 && this.#
|
|
791
|
+
this.#e !== -1 && this.#a(this.#e, !1);
|
|
787
792
|
});
|
|
788
793
|
},
|
|
789
794
|
{ signal: t }
|
|
790
|
-
)
|
|
795
|
+
), this.#t && (this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
|
|
796
|
+
"focusin",
|
|
797
|
+
(n) => {
|
|
798
|
+
const r = n.target;
|
|
799
|
+
if (r.matches(M)) {
|
|
800
|
+
if (this.#f) {
|
|
801
|
+
r.blur(), this.gridElement.focus();
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
this.#d = !0;
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
{ signal: t }
|
|
808
|
+
), this.gridElement.addEventListener(
|
|
809
|
+
"focusout",
|
|
810
|
+
(n) => {
|
|
811
|
+
const r = n.relatedTarget;
|
|
812
|
+
(!r || !this.gridElement.contains(r) || !r.matches(M)) && (this.#d = !1);
|
|
813
|
+
},
|
|
814
|
+
{ signal: t }
|
|
815
|
+
), this.gridElement.addEventListener(
|
|
816
|
+
"keydown",
|
|
817
|
+
(n) => {
|
|
818
|
+
if (n.key === "Escape" && this.#d) {
|
|
819
|
+
const r = document.activeElement;
|
|
820
|
+
r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#d = !1, this.#f = !0, n.preventDefault(), n.stopPropagation();
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
{ capture: !0, signal: t }
|
|
824
|
+
), this.gridElement.addEventListener(
|
|
825
|
+
"mousedown",
|
|
826
|
+
(n) => {
|
|
827
|
+
n.target.matches(M) && (this.#f = !1);
|
|
828
|
+
},
|
|
829
|
+
{ signal: t }
|
|
830
|
+
));
|
|
791
831
|
}
|
|
792
832
|
detach() {
|
|
793
|
-
this.#e = -1, this.#
|
|
833
|
+
this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#s = -1, this.#o.clear(), this.#i.clear(), this.#n.clear(), this.#d = !1, this.#f = !1, super.detach();
|
|
794
834
|
}
|
|
795
835
|
handleQuery(e) {
|
|
796
836
|
if (e.type === "isEditing")
|
|
797
|
-
return this.#e !== -1;
|
|
837
|
+
return this.#t || this.#e !== -1;
|
|
798
838
|
}
|
|
799
839
|
onCellClick(e) {
|
|
840
|
+
if (this.#t) return !1;
|
|
800
841
|
const t = this.grid, i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
801
842
|
if (i === !1 || i === "manual" || i !== "click" && i !== "dblclick") return !1;
|
|
802
843
|
const n = e.originalEvent.type === "dblclick";
|
|
@@ -806,18 +847,26 @@ class wn extends _ {
|
|
|
806
847
|
}
|
|
807
848
|
onKeyDown(e) {
|
|
808
849
|
const t = this.grid;
|
|
809
|
-
if (e.key === "Escape"
|
|
810
|
-
|
|
811
|
-
|
|
850
|
+
if (e.key === "Escape") {
|
|
851
|
+
if (this.#t && this.#d) {
|
|
852
|
+
const i = document.activeElement;
|
|
853
|
+
return i && this.gridElement.contains(i) && i.blur(), this.#d = !1, this.requestAfterRender(), !0;
|
|
854
|
+
}
|
|
855
|
+
if (this.#e !== -1 && !this.#t)
|
|
856
|
+
return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#a(this.#e, !0), !0;
|
|
857
|
+
}
|
|
858
|
+
if (this.#t && !this.#d && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
|
|
859
|
+
return !1;
|
|
860
|
+
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#t) {
|
|
812
861
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
813
862
|
return !0;
|
|
814
863
|
const i = t._rows.length - 1, n = this.#e;
|
|
815
|
-
return this.#
|
|
864
|
+
return this.#a(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), F(t), this.requestAfterRender(), !0;
|
|
816
865
|
}
|
|
817
|
-
if (e.key === "Tab" && this.#e !== -1) {
|
|
866
|
+
if (e.key === "Tab" && (this.#e !== -1 || this.#t)) {
|
|
818
867
|
e.preventDefault();
|
|
819
868
|
const i = !e.shiftKey;
|
|
820
|
-
return this.#
|
|
869
|
+
return this.#w(i), !0;
|
|
821
870
|
}
|
|
822
871
|
if (e.key === " " || e.key === "Spacebar") {
|
|
823
872
|
if (this.#e !== -1)
|
|
@@ -827,15 +876,17 @@ class wn extends _ {
|
|
|
827
876
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
828
877
|
if (r?.editable && r.type === "boolean" && o) {
|
|
829
878
|
const s = r.field;
|
|
830
|
-
if (
|
|
879
|
+
if (U(s)) {
|
|
831
880
|
const d = !o[s];
|
|
832
|
-
return this.#
|
|
881
|
+
return this.#b(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
833
882
|
}
|
|
834
883
|
}
|
|
835
884
|
}
|
|
836
885
|
return !1;
|
|
837
886
|
}
|
|
838
887
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
888
|
+
if (this.#t && !this.#d)
|
|
889
|
+
return this.#h(), !0;
|
|
839
890
|
if (this.#e !== -1)
|
|
840
891
|
return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
|
|
841
892
|
const i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
@@ -885,78 +936,83 @@ class wn extends _ {
|
|
|
885
936
|
}
|
|
886
937
|
afterRender() {
|
|
887
938
|
const e = this.grid;
|
|
888
|
-
if (this.#
|
|
889
|
-
const t = this.#
|
|
890
|
-
this.#
|
|
939
|
+
if (this.#u && (this.#u = !1, this.#x(e)), this.#l !== -1) {
|
|
940
|
+
const t = this.#l;
|
|
941
|
+
this.#l = -1, e.animateRow?.(t, "change");
|
|
891
942
|
}
|
|
892
|
-
if (this.#
|
|
893
|
-
for (const t of this.#
|
|
943
|
+
if (!this.#t && this.#n.size !== 0)
|
|
944
|
+
for (const t of this.#n) {
|
|
894
945
|
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
895
946
|
if (!s) continue;
|
|
896
947
|
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
897
948
|
if (!l || l.classList.contains("editing")) continue;
|
|
898
949
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
899
|
-
d && c && this.#
|
|
950
|
+
d && c && this.#m(d, r, c, o, l, !0);
|
|
900
951
|
}
|
|
901
952
|
}
|
|
953
|
+
afterCellRender(e) {
|
|
954
|
+
if (!this.#t) return;
|
|
955
|
+
const { row: t, rowIndex: i, column: n, colIndex: r, cellElement: o } = e;
|
|
956
|
+
n.editable && (o.classList.contains("editing") || this.#m(t, i, n, r, o, !0));
|
|
957
|
+
}
|
|
902
958
|
onScrollRender() {
|
|
903
959
|
this.afterRender();
|
|
904
960
|
}
|
|
905
961
|
get changedRows() {
|
|
906
962
|
const e = [];
|
|
907
|
-
for (const t of this.#
|
|
963
|
+
for (const t of this.#i) {
|
|
908
964
|
const i = this.grid.getRow(t);
|
|
909
965
|
i && e.push(i);
|
|
910
966
|
}
|
|
911
967
|
return e;
|
|
912
968
|
}
|
|
913
969
|
get changedRowIds() {
|
|
914
|
-
return Array.from(this.#
|
|
970
|
+
return Array.from(this.#i);
|
|
915
971
|
}
|
|
916
972
|
get activeEditRow() {
|
|
917
973
|
return this.#e;
|
|
918
974
|
}
|
|
919
975
|
get activeEditCol() {
|
|
920
|
-
return this.#
|
|
976
|
+
return this.#s;
|
|
921
977
|
}
|
|
922
978
|
isRowEditing(e) {
|
|
923
979
|
return this.#e === e;
|
|
924
980
|
}
|
|
925
981
|
isCellEditing(e, t) {
|
|
926
|
-
return this.#
|
|
982
|
+
return this.#n.has(`${e}:${t}`);
|
|
927
983
|
}
|
|
928
984
|
isRowChanged(e) {
|
|
929
985
|
const t = this.grid, i = t._rows[e];
|
|
930
986
|
if (!i) return !1;
|
|
931
987
|
try {
|
|
932
988
|
const n = t.getRowId?.(i);
|
|
933
|
-
return n ? this.#
|
|
989
|
+
return n ? this.#i.has(n) : !1;
|
|
934
990
|
} catch {
|
|
935
991
|
return !1;
|
|
936
992
|
}
|
|
937
993
|
}
|
|
938
994
|
isRowChangedById(e) {
|
|
939
|
-
return this.#
|
|
995
|
+
return this.#i.has(e);
|
|
940
996
|
}
|
|
941
997
|
setInvalid(e, t, i = "") {
|
|
942
998
|
let n = this.#r.get(e);
|
|
943
|
-
n || (n = /* @__PURE__ */ new Map(), this.#r.set(e, n)), n.set(t, i), this.#
|
|
999
|
+
n || (n = /* @__PURE__ */ new Map(), this.#r.set(e, n)), n.set(t, i), this.#p(e, t, !0);
|
|
944
1000
|
}
|
|
945
1001
|
clearInvalid(e, t) {
|
|
946
1002
|
const i = this.#r.get(e);
|
|
947
|
-
i && (i.delete(t), i.size === 0 && this.#r.delete(e)), this.#
|
|
1003
|
+
i && (i.delete(t), i.size === 0 && this.#r.delete(e)), this.#p(e, t, !1);
|
|
948
1004
|
}
|
|
949
1005
|
clearRowInvalid(e) {
|
|
950
1006
|
const t = this.#r.get(e);
|
|
951
1007
|
if (t) {
|
|
952
1008
|
const i = Array.from(t.keys());
|
|
953
|
-
this.#r.delete(e), i.forEach((n) => this.#
|
|
1009
|
+
this.#r.delete(e), i.forEach((n) => this.#p(e, n, !1));
|
|
954
1010
|
}
|
|
955
1011
|
}
|
|
956
1012
|
clearAllInvalid() {
|
|
957
1013
|
const e = Array.from(this.#r.entries());
|
|
958
1014
|
this.#r.clear(), e.forEach(([t, i]) => {
|
|
959
|
-
i.forEach((n, r) => this.#
|
|
1015
|
+
i.forEach((n, r) => this.#p(t, r, !1));
|
|
960
1016
|
});
|
|
961
1017
|
}
|
|
962
1018
|
isCellInvalid(e, t) {
|
|
@@ -972,7 +1028,7 @@ class wn extends _ {
|
|
|
972
1028
|
getInvalidFields(e) {
|
|
973
1029
|
return new Map(this.#r.get(e) ?? []);
|
|
974
1030
|
}
|
|
975
|
-
#
|
|
1031
|
+
#p(e, t, i) {
|
|
976
1032
|
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
977
1033
|
if (r === -1 || r === void 0) return;
|
|
978
1034
|
const s = n._rows?.findIndex((c) => {
|
|
@@ -994,13 +1050,13 @@ class wn extends _ {
|
|
|
994
1050
|
}
|
|
995
1051
|
resetChangedRows(e) {
|
|
996
1052
|
const t = this.changedRows, i = this.changedRowIds;
|
|
997
|
-
this.#
|
|
1053
|
+
this.#i.clear(), this.#c(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
998
1054
|
}
|
|
999
1055
|
beginCellEdit(e, t) {
|
|
1000
1056
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
1001
1057
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
1002
1058
|
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
1003
|
-
s && this.#
|
|
1059
|
+
s && this.#v(e, n, s);
|
|
1004
1060
|
}
|
|
1005
1061
|
beginBulkEdit(e) {
|
|
1006
1062
|
const t = this.grid;
|
|
@@ -1008,16 +1064,16 @@ class wn extends _ {
|
|
|
1008
1064
|
const r = t.findRenderedRowElement?.(e);
|
|
1009
1065
|
if (!r) return;
|
|
1010
1066
|
const o = t._rows[e];
|
|
1011
|
-
this.#
|
|
1067
|
+
this.#g(e, o), Array.from(r.children).forEach((s, l) => {
|
|
1012
1068
|
const d = t._visibleColumns[l];
|
|
1013
1069
|
if (d?.editable) {
|
|
1014
1070
|
const c = s;
|
|
1015
|
-
c.classList.contains("editing") || this.#
|
|
1071
|
+
c.classList.contains("editing") || this.#m(o, e, d, l, c, !0);
|
|
1016
1072
|
}
|
|
1017
1073
|
}), setTimeout(() => {
|
|
1018
1074
|
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1019
1075
|
if (s?.classList.contains("editing") || (s = r.querySelector(".cell.editing")), s?.classList.contains("editing")) {
|
|
1020
|
-
const l = s.querySelector(
|
|
1076
|
+
const l = s.querySelector(M);
|
|
1021
1077
|
try {
|
|
1022
1078
|
l?.focus({ preventScroll: !0 });
|
|
1023
1079
|
} catch {
|
|
@@ -1026,38 +1082,50 @@ class wn extends _ {
|
|
|
1026
1082
|
}, 0);
|
|
1027
1083
|
}
|
|
1028
1084
|
commitActiveRowEdit() {
|
|
1029
|
-
this.#e !== -1 && this.#
|
|
1085
|
+
this.#e !== -1 && this.#a(this.#e, !1);
|
|
1030
1086
|
}
|
|
1031
1087
|
cancelActiveRowEdit() {
|
|
1032
|
-
this.#e !== -1 && this.#
|
|
1088
|
+
this.#e !== -1 && this.#a(this.#e, !0);
|
|
1033
1089
|
}
|
|
1034
|
-
#
|
|
1090
|
+
#v(e, t, i) {
|
|
1035
1091
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
1036
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#
|
|
1092
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#g(e, r), this.#s = t, this.#m(r, e, o, t, i, !1));
|
|
1093
|
+
}
|
|
1094
|
+
#h() {
|
|
1095
|
+
const e = this.grid, t = e._focusRow, i = e._focusCol;
|
|
1096
|
+
if (t < 0 || i < 0) return;
|
|
1097
|
+
const r = e.findRenderedRowElement?.(t)?.querySelector(`.cell[data-col="${i}"]`);
|
|
1098
|
+
if (r?.classList.contains("editing")) {
|
|
1099
|
+
const o = r.querySelector(M);
|
|
1100
|
+
o && (this.#f = !1, o.focus(), this.#d = !0, o instanceof HTMLInputElement && (o.type === "text" || o.type === "number") && o.select());
|
|
1101
|
+
}
|
|
1037
1102
|
}
|
|
1038
|
-
#
|
|
1039
|
-
const t = this.grid, i = t._rows, n = this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
|
|
1103
|
+
#w(e) {
|
|
1104
|
+
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);
|
|
1040
1105
|
if (r.length === 0) return;
|
|
1041
1106
|
const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
|
|
1042
1107
|
if (s >= 0 && s < r.length) {
|
|
1043
1108
|
t._focusCol = r[s];
|
|
1044
1109
|
const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[s]}"]`);
|
|
1045
|
-
c?.classList.contains("editing") && c.querySelector(
|
|
1110
|
+
c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 }), F(t, { forceHorizontalScroll: !0 });
|
|
1046
1111
|
return;
|
|
1047
1112
|
}
|
|
1048
1113
|
const l = n + (e ? 1 : -1);
|
|
1049
|
-
l >= 0 && l < i.length && (this.#
|
|
1114
|
+
l >= 0 && l < i.length && (this.#t ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], F(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
|
|
1115
|
+
const c = t.findRenderedRowElement?.(l)?.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1116
|
+
c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 });
|
|
1117
|
+
}, 0)) : (this.#a(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), F(t, { forceHorizontalScroll: !0 })));
|
|
1050
1118
|
}
|
|
1051
|
-
#
|
|
1119
|
+
#c() {
|
|
1052
1120
|
const e = this.grid;
|
|
1053
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1121
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#o;
|
|
1054
1122
|
}
|
|
1055
|
-
#
|
|
1056
|
-
this.#e !== e && (this.#
|
|
1123
|
+
#g(e, t) {
|
|
1124
|
+
this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#c());
|
|
1057
1125
|
}
|
|
1058
|
-
#
|
|
1126
|
+
#a(e, t) {
|
|
1059
1127
|
if (this.#e !== e) return;
|
|
1060
|
-
const i = this.grid, n = this.#
|
|
1128
|
+
const i = this.grid, n = this.#o.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
1061
1129
|
let s;
|
|
1062
1130
|
if (r)
|
|
1063
1131
|
try {
|
|
@@ -1072,15 +1140,15 @@ class wn extends _ {
|
|
|
1072
1140
|
return;
|
|
1073
1141
|
const h = d.querySelector("input,textarea,select");
|
|
1074
1142
|
if (h) {
|
|
1075
|
-
const f = u.field, g = r[f], p =
|
|
1076
|
-
g !== p && this.#
|
|
1143
|
+
const f = u.field, g = r[f], p = W(h, u, g);
|
|
1144
|
+
g !== p && this.#b(e, u, p, r);
|
|
1077
1145
|
}
|
|
1078
1146
|
}), t && n && r)
|
|
1079
1147
|
Object.keys(n).forEach((l) => {
|
|
1080
1148
|
r[l] = n[l];
|
|
1081
|
-
}), s && (this.#
|
|
1149
|
+
}), s && (this.#i.delete(s), this.clearRowInvalid(s));
|
|
1082
1150
|
else if (!t && r) {
|
|
1083
|
-
const l = this.#
|
|
1151
|
+
const l = this.#C(n, r), d = s ? this.#i.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
1084
1152
|
rowIndex: e,
|
|
1085
1153
|
rowId: s ?? "",
|
|
1086
1154
|
row: r,
|
|
@@ -1092,18 +1160,18 @@ class wn extends _ {
|
|
|
1092
1160
|
});
|
|
1093
1161
|
c && n ? (Object.keys(n).forEach((u) => {
|
|
1094
1162
|
r[u] = n[u];
|
|
1095
|
-
}), s && (this.#
|
|
1163
|
+
}), s && (this.#i.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#l = e);
|
|
1096
1164
|
}
|
|
1097
|
-
this.#
|
|
1098
|
-
for (const l of this.#
|
|
1099
|
-
l.startsWith(`${e}:`) && this.#
|
|
1165
|
+
this.#o.delete(e), this.#e = -1, this.#s = -1, this.#c();
|
|
1166
|
+
for (const l of this.#n)
|
|
1167
|
+
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
1100
1168
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
1101
|
-
l.classList.remove("editing"),
|
|
1102
|
-
}), this.requestRender()), this.#
|
|
1169
|
+
l.classList.remove("editing"), qt(l.parentElement);
|
|
1170
|
+
}), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1);
|
|
1103
1171
|
}
|
|
1104
|
-
#
|
|
1172
|
+
#b(e, t, i, n) {
|
|
1105
1173
|
const r = t.field;
|
|
1106
|
-
if (
|
|
1174
|
+
if (!U(r)) return;
|
|
1107
1175
|
const o = n[r];
|
|
1108
1176
|
if (o === i) return;
|
|
1109
1177
|
const s = this.grid;
|
|
@@ -1112,7 +1180,7 @@ class wn extends _ {
|
|
|
1112
1180
|
l = this.grid.getRowId(n);
|
|
1113
1181
|
} catch {
|
|
1114
1182
|
}
|
|
1115
|
-
const d = l ? !this.#
|
|
1183
|
+
const d = l ? !this.#i.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : _e;
|
|
1116
1184
|
let u = !1;
|
|
1117
1185
|
const h = l ? (p) => {
|
|
1118
1186
|
u = !0, this.setInvalid(l, r, p ?? "");
|
|
@@ -1131,7 +1199,7 @@ class wn extends _ {
|
|
|
1131
1199
|
updateRow: c,
|
|
1132
1200
|
setInvalid: h
|
|
1133
1201
|
})) return;
|
|
1134
|
-
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#
|
|
1202
|
+
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#i.add(l), this.#c(), this.emitPluginEvent("cell-edit-committed", {
|
|
1135
1203
|
rowIndex: e,
|
|
1136
1204
|
field: r,
|
|
1137
1205
|
oldValue: o,
|
|
@@ -1140,64 +1208,74 @@ class wn extends _ {
|
|
|
1140
1208
|
const g = s.findRenderedRowElement?.(e);
|
|
1141
1209
|
g && g.classList.add("changed");
|
|
1142
1210
|
}
|
|
1143
|
-
#
|
|
1211
|
+
#m(e, t, i, n, r, o) {
|
|
1144
1212
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1145
1213
|
let s;
|
|
1146
1214
|
try {
|
|
1147
1215
|
s = this.grid.getRowId(e);
|
|
1148
1216
|
} catch {
|
|
1149
1217
|
}
|
|
1150
|
-
const l = s ? (
|
|
1151
|
-
r.classList.add("editing"), this.#
|
|
1218
|
+
const l = s ? (v) => this.grid.updateRow(s, v, "cascade") : _e, d = U(i.field) ? e[i.field] : void 0;
|
|
1219
|
+
r.classList.add("editing"), this.#n.add(`${t}:${n}`);
|
|
1152
1220
|
const c = r.parentElement;
|
|
1153
|
-
c &&
|
|
1221
|
+
c && Nt(c);
|
|
1154
1222
|
let u = !1;
|
|
1155
|
-
const h = (
|
|
1156
|
-
u || this.#e === -1 || this.#
|
|
1223
|
+
const h = (v) => {
|
|
1224
|
+
u || !this.#t && this.#e === -1 || this.#b(t, i, v, e);
|
|
1157
1225
|
}, f = () => {
|
|
1158
|
-
u = !0,
|
|
1226
|
+
u = !0, U(i.field) && (e[i.field] = d);
|
|
1159
1227
|
}, g = document.createElement("div");
|
|
1160
|
-
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (
|
|
1161
|
-
if (
|
|
1162
|
-
if (this
|
|
1228
|
+
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
|
|
1229
|
+
if (v.key === "Enter") {
|
|
1230
|
+
if (this.#t) {
|
|
1231
|
+
v.stopPropagation(), v.preventDefault();
|
|
1232
|
+
const E = g.querySelector("input,textarea,select");
|
|
1233
|
+
E && h(W(E, i, d));
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(v) === !1)
|
|
1163
1237
|
return;
|
|
1164
|
-
|
|
1238
|
+
v.stopPropagation(), v.preventDefault(), u = !0, this.#a(t, !1);
|
|
1165
1239
|
}
|
|
1166
|
-
if (
|
|
1167
|
-
if (this
|
|
1240
|
+
if (v.key === "Escape") {
|
|
1241
|
+
if (this.#t) {
|
|
1242
|
+
v.stopPropagation(), v.preventDefault();
|
|
1168
1243
|
return;
|
|
1169
|
-
|
|
1244
|
+
}
|
|
1245
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(v) === !1)
|
|
1246
|
+
return;
|
|
1247
|
+
v.stopPropagation(), v.preventDefault(), f(), this.#a(t, !0);
|
|
1170
1248
|
}
|
|
1171
1249
|
});
|
|
1172
|
-
const p = i, w = p.__editorTemplate, b =
|
|
1250
|
+
const p = i, w = p.__editorTemplate, b = Mt(this.grid, p) ?? Dt(i), y = d;
|
|
1173
1251
|
if (b === "template" && w)
|
|
1174
|
-
this.#
|
|
1252
|
+
this.#y(g, p, e, d, h, f, o, t);
|
|
1175
1253
|
else if (typeof b == "string") {
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
g.querySelector(
|
|
1254
|
+
const v = document.createElement(b);
|
|
1255
|
+
v.value = y, v.addEventListener("change", () => h(v.value)), g.appendChild(v), o || queueMicrotask(() => {
|
|
1256
|
+
g.querySelector(M)?.focus({ preventScroll: !0 });
|
|
1179
1257
|
});
|
|
1180
1258
|
} else if (typeof b == "function") {
|
|
1181
|
-
const
|
|
1259
|
+
const v = {
|
|
1182
1260
|
row: e,
|
|
1183
1261
|
rowId: s ?? "",
|
|
1184
|
-
value:
|
|
1262
|
+
value: y,
|
|
1185
1263
|
field: i.field,
|
|
1186
1264
|
column: i,
|
|
1187
1265
|
commit: h,
|
|
1188
1266
|
cancel: f,
|
|
1189
1267
|
updateRow: l
|
|
1190
|
-
},
|
|
1191
|
-
typeof
|
|
1192
|
-
g.querySelector(
|
|
1268
|
+
}, E = b(v);
|
|
1269
|
+
typeof E == "string" ? (g.innerHTML = E, Ht(g, i, h, d)) : E instanceof Node && (g.appendChild(E), E instanceof HTMLInputElement || E instanceof HTMLSelectElement || E instanceof HTMLTextAreaElement || r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
|
|
1270
|
+
g.querySelector(M)?.focus({ preventScroll: !0 });
|
|
1193
1271
|
});
|
|
1194
1272
|
} else if (b && typeof b == "object") {
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
const
|
|
1273
|
+
const v = document.createElement("div");
|
|
1274
|
+
v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v), r.setAttribute("data-editor-managed", "");
|
|
1275
|
+
const E = {
|
|
1198
1276
|
row: e,
|
|
1199
1277
|
rowId: s ?? "",
|
|
1200
|
-
value:
|
|
1278
|
+
value: y,
|
|
1201
1279
|
field: i.field,
|
|
1202
1280
|
column: i,
|
|
1203
1281
|
commit: h,
|
|
@@ -1206,17 +1284,17 @@ class wn extends _ {
|
|
|
1206
1284
|
};
|
|
1207
1285
|
if (b.mount)
|
|
1208
1286
|
try {
|
|
1209
|
-
b.mount({ placeholder:
|
|
1210
|
-
} catch (
|
|
1211
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1287
|
+
b.mount({ placeholder: v, context: E, spec: b });
|
|
1288
|
+
} catch (R) {
|
|
1289
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, R);
|
|
1212
1290
|
}
|
|
1213
1291
|
else
|
|
1214
1292
|
this.grid.dispatchEvent(
|
|
1215
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder:
|
|
1293
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: b, context: E } })
|
|
1216
1294
|
);
|
|
1217
1295
|
}
|
|
1218
1296
|
}
|
|
1219
|
-
#
|
|
1297
|
+
#y(e, t, i, n, r, o, s, l) {
|
|
1220
1298
|
const d = t.__editorTemplate;
|
|
1221
1299
|
if (!d) return;
|
|
1222
1300
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1229,7 +1307,7 @@ class wn extends _ {
|
|
|
1229
1307
|
cancel: o
|
|
1230
1308
|
}) : c.querySelectorAll("*").forEach((f) => {
|
|
1231
1309
|
f.childNodes.length === 1 && f.firstChild?.nodeType === Node.TEXT_NODE && (f.textContent = f.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (g, p) => {
|
|
1232
|
-
if (
|
|
1310
|
+
if (!U(p)) return "";
|
|
1233
1311
|
const w = i[p];
|
|
1234
1312
|
return w == null ? "" : String(w);
|
|
1235
1313
|
}) || "");
|
|
@@ -1241,24 +1319,24 @@ class wn extends _ {
|
|
|
1241
1319
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1242
1320
|
let f = !1;
|
|
1243
1321
|
h.addEventListener("blur", () => {
|
|
1244
|
-
f || r(
|
|
1322
|
+
f || r(W(h, t, n));
|
|
1245
1323
|
}), h.addEventListener("keydown", (g) => {
|
|
1246
1324
|
const p = g;
|
|
1247
1325
|
if (p.key === "Enter") {
|
|
1248
1326
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1249
1327
|
return;
|
|
1250
|
-
p.stopPropagation(), p.preventDefault(), f = !0, r(
|
|
1328
|
+
p.stopPropagation(), p.preventDefault(), f = !0, r(W(h, t, n)), this.#a(l, !1);
|
|
1251
1329
|
}
|
|
1252
1330
|
if (p.key === "Escape") {
|
|
1253
1331
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1254
1332
|
return;
|
|
1255
|
-
p.stopPropagation(), p.preventDefault(), o(), this.#
|
|
1333
|
+
p.stopPropagation(), p.preventDefault(), o(), this.#a(l, !0);
|
|
1256
1334
|
}
|
|
1257
1335
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1258
1336
|
}
|
|
1259
1337
|
e.appendChild(c);
|
|
1260
1338
|
}
|
|
1261
|
-
#
|
|
1339
|
+
#C(e, t) {
|
|
1262
1340
|
if (!e) return !1;
|
|
1263
1341
|
const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
|
|
1264
1342
|
for (const o of r)
|
|
@@ -1266,7 +1344,7 @@ class wn extends _ {
|
|
|
1266
1344
|
return !0;
|
|
1267
1345
|
return !1;
|
|
1268
1346
|
}
|
|
1269
|
-
#
|
|
1347
|
+
#x(e) {
|
|
1270
1348
|
queueMicrotask(() => {
|
|
1271
1349
|
try {
|
|
1272
1350
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1282,7 +1360,7 @@ class wn extends _ {
|
|
|
1282
1360
|
});
|
|
1283
1361
|
}
|
|
1284
1362
|
}
|
|
1285
|
-
function
|
|
1363
|
+
function Le(a, e = !0) {
|
|
1286
1364
|
if (a == null) return "";
|
|
1287
1365
|
if (a instanceof Date) return a.toISOString();
|
|
1288
1366
|
if (typeof a == "object") return JSON.stringify(a);
|
|
@@ -1290,20 +1368,20 @@ function Te(a, e = !0) {
|
|
|
1290
1368
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1291
1369
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1292
1370
|
}
|
|
1293
|
-
function
|
|
1371
|
+
function Kt(a, e, t, i = {}) {
|
|
1294
1372
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1295
1373
|
`, o = [], s = i.bom ? "\uFEFF" : "";
|
|
1296
1374
|
if (t.includeHeaders !== !1) {
|
|
1297
1375
|
const l = e.map((d) => {
|
|
1298
1376
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1299
|
-
return
|
|
1377
|
+
return Le(u);
|
|
1300
1378
|
});
|
|
1301
1379
|
o.push(l.join(n));
|
|
1302
1380
|
}
|
|
1303
1381
|
for (const l of a) {
|
|
1304
1382
|
const d = e.map((c) => {
|
|
1305
1383
|
let u = l[c.field];
|
|
1306
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1384
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Le(u);
|
|
1307
1385
|
});
|
|
1308
1386
|
o.push(d.join(n));
|
|
1309
1387
|
}
|
|
@@ -1313,14 +1391,14 @@ function we(a, e) {
|
|
|
1313
1391
|
const t = URL.createObjectURL(a), i = document.createElement("a");
|
|
1314
1392
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1315
1393
|
}
|
|
1316
|
-
function
|
|
1394
|
+
function zt(a, e) {
|
|
1317
1395
|
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1318
1396
|
we(t, e);
|
|
1319
1397
|
}
|
|
1320
|
-
function
|
|
1398
|
+
function Te(a) {
|
|
1321
1399
|
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1322
1400
|
}
|
|
1323
|
-
function
|
|
1401
|
+
function Ot(a, e, t) {
|
|
1324
1402
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1325
1403
|
<?mso-application progid="Excel.Sheet"?>
|
|
1326
1404
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1332,7 +1410,7 @@ function Kt(a, e, t) {
|
|
|
1332
1410
|
<Row>`;
|
|
1333
1411
|
for (const n of e) {
|
|
1334
1412
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1335
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1413
|
+
i += `<Cell><Data ss:Type="String">${Te(o)}</Data></Cell>`;
|
|
1336
1414
|
}
|
|
1337
1415
|
i += "</Row>";
|
|
1338
1416
|
}
|
|
@@ -1343,7 +1421,7 @@ function Kt(a, e, t) {
|
|
|
1343
1421
|
let o = n[r.field];
|
|
1344
1422
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1345
1423
|
let s = "String", l = "";
|
|
1346
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l =
|
|
1424
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l = Te(String(o)), i += `<Cell><Data ss:Type="${s}">${l}</Data></Cell>`;
|
|
1347
1425
|
}
|
|
1348
1426
|
i += "</Row>";
|
|
1349
1427
|
}
|
|
@@ -1352,7 +1430,7 @@ function Kt(a, e, t) {
|
|
|
1352
1430
|
</Worksheet>
|
|
1353
1431
|
</Workbook>`, i;
|
|
1354
1432
|
}
|
|
1355
|
-
function
|
|
1433
|
+
function Gt(a, e) {
|
|
1356
1434
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
|
|
1357
1435
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1358
1436
|
});
|
|
@@ -1395,13 +1473,13 @@ class bn extends _ {
|
|
|
1395
1473
|
try {
|
|
1396
1474
|
switch (e) {
|
|
1397
1475
|
case "csv": {
|
|
1398
|
-
const l =
|
|
1399
|
-
s = s.endsWith(".csv") ? s : `${s}.csv`,
|
|
1476
|
+
const l = Kt(o, r, n, { bom: !0 });
|
|
1477
|
+
s = s.endsWith(".csv") ? s : `${s}.csv`, zt(l, s);
|
|
1400
1478
|
break;
|
|
1401
1479
|
}
|
|
1402
1480
|
case "excel": {
|
|
1403
|
-
const l =
|
|
1404
|
-
s = s.endsWith(".xls") ? s : `${s}.xls`,
|
|
1481
|
+
const l = Ot(o, r, n);
|
|
1482
|
+
s = s.endsWith(".xls") ? s : `${s}.xls`, Gt(l, s);
|
|
1405
1483
|
break;
|
|
1406
1484
|
}
|
|
1407
1485
|
case "json": {
|
|
@@ -1452,21 +1530,6 @@ class bn extends _ {
|
|
|
1452
1530
|
return this.lastExportInfo;
|
|
1453
1531
|
}
|
|
1454
1532
|
}
|
|
1455
|
-
function Ot(a) {
|
|
1456
|
-
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = a, o = Math.ceil(t / n);
|
|
1457
|
-
let s = Math.floor(i / n) - r;
|
|
1458
|
-
s < 0 && (s = 0);
|
|
1459
|
-
let l = s + o + r * 2;
|
|
1460
|
-
return l > e && (l = e), l === e && s > 0 && (s = Math.max(0, l - o - r * 2)), {
|
|
1461
|
-
start: s,
|
|
1462
|
-
end: l,
|
|
1463
|
-
offsetY: s * n,
|
|
1464
|
-
totalHeight: e * n
|
|
1465
|
-
};
|
|
1466
|
-
}
|
|
1467
|
-
function Gt(a, e) {
|
|
1468
|
-
return a <= e;
|
|
1469
|
-
}
|
|
1470
1533
|
function Bt(a, e, t = !1) {
|
|
1471
1534
|
const i = a[e.field];
|
|
1472
1535
|
if (e.operator === "blank")
|
|
@@ -1528,7 +1591,7 @@ function Ie(a, e) {
|
|
|
1528
1591
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1529
1592
|
}
|
|
1530
1593
|
const $t = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', jt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-range-inputs,.tbw-filter-date-range{display:flex;align-items:flex-end;gap:var(--tbw-spacing-sm, .375rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-group,.tbw-filter-date-group{display:flex;flex-direction:column;gap:var(--tbw-spacing-xs, .25rem);flex:1}.tbw-filter-range-label{font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)))}.tbw-filter-range-input,.tbw-filter-date-input{width:100%;height:var(--tbw-filter-item-height, 28px);padding:var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-sm, .375rem);background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-range-input:focus,.tbw-filter-date-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-range-separator{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding-bottom:var(--tbw-spacing-xs, .25rem)}.tbw-filter-range-slider{position:relative;height:24px;margin:var(--tbw-spacing-md, .5rem) 0 var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-fill{position:absolute;top:50%;height:4px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-thumb{position:absolute;top:0;width:100%;height:100%;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}.tbw-filter-range-thumb::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-moz-range-thumb{width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-webkit-slider-thumb:hover{transform:scale(1.1)}.tbw-filter-range-thumb::-moz-range-thumb:hover{transform:scale(1.1)}}";
|
|
1531
|
-
class
|
|
1594
|
+
class q extends _ {
|
|
1532
1595
|
static manifest = {
|
|
1533
1596
|
events: [
|
|
1534
1597
|
{
|
|
@@ -1575,7 +1638,7 @@ class N extends _ {
|
|
|
1575
1638
|
return t;
|
|
1576
1639
|
}
|
|
1577
1640
|
}
|
|
1578
|
-
return
|
|
1641
|
+
return q.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1579
1642
|
}
|
|
1580
1643
|
syncExcludedValues(e, t) {
|
|
1581
1644
|
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);
|
|
@@ -1604,7 +1667,7 @@ class N extends _ {
|
|
|
1604
1667
|
const n = i.getAttribute("data-col");
|
|
1605
1668
|
if (n === null) return;
|
|
1606
1669
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1607
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1670
|
+
if (!r || !this.isColumnFilterable(r) || H(r)) return;
|
|
1608
1671
|
const o = r.field;
|
|
1609
1672
|
if (!o) return;
|
|
1610
1673
|
const s = this.filters.has(o);
|
|
@@ -1754,11 +1817,11 @@ class N extends _ {
|
|
|
1754
1817
|
}
|
|
1755
1818
|
static supportsAnchorPositioning = null;
|
|
1756
1819
|
static checkAnchorPositioningSupport() {
|
|
1757
|
-
return
|
|
1820
|
+
return q.supportsAnchorPositioning === null && (q.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), q.supportsAnchorPositioning;
|
|
1758
1821
|
}
|
|
1759
1822
|
positionPanel(e, t) {
|
|
1760
1823
|
const n = t.closest(".cell") ?? t;
|
|
1761
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1824
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, q.checkAnchorPositioningSupport()) {
|
|
1762
1825
|
requestAnimationFrame(() => {
|
|
1763
1826
|
const o = e.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
1764
1827
|
o.top < s.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1785,14 +1848,14 @@ class N extends _ {
|
|
|
1785
1848
|
const h = document.createElement("span");
|
|
1786
1849
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1787
1850
|
const f = () => {
|
|
1788
|
-
const C = [...b.values()], k = C.every((m) => m),
|
|
1789
|
-
u.checked = k, u.indeterminate = !k && !
|
|
1851
|
+
const C = [...b.values()], k = C.every((m) => m), L = C.every((m) => !m);
|
|
1852
|
+
u.checked = k, u.indeterminate = !k && !L;
|
|
1790
1853
|
};
|
|
1791
1854
|
u.addEventListener("change", () => {
|
|
1792
1855
|
const C = u.checked;
|
|
1793
1856
|
for (const k of b.keys())
|
|
1794
1857
|
b.set(k, C);
|
|
1795
|
-
f(),
|
|
1858
|
+
f(), E();
|
|
1796
1859
|
}), e.appendChild(d);
|
|
1797
1860
|
const g = document.createElement("div");
|
|
1798
1861
|
g.className = "tbw-filter-values";
|
|
@@ -1805,177 +1868,177 @@ class N extends _ {
|
|
|
1805
1868
|
const k = C == null ? "__null__" : String(C);
|
|
1806
1869
|
b.set(k, !n.has(C));
|
|
1807
1870
|
}), f();
|
|
1808
|
-
let
|
|
1809
|
-
const
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
b.set(m,
|
|
1871
|
+
let y = [];
|
|
1872
|
+
const v = (C, k) => {
|
|
1873
|
+
const L = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), x = document.createElement("label");
|
|
1874
|
+
x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${k})`, x.style.left = "0", x.style.right = "0", x.style.boxSizing = "border-box";
|
|
1875
|
+
const T = document.createElement("input");
|
|
1876
|
+
T.type = "checkbox", T.className = "tbw-filter-checkbox", T.checked = b.get(m) ?? !0, T.dataset.value = m, T.addEventListener("change", () => {
|
|
1877
|
+
b.set(m, T.checked), f();
|
|
1815
1878
|
});
|
|
1816
|
-
const
|
|
1817
|
-
return
|
|
1818
|
-
},
|
|
1819
|
-
const C =
|
|
1820
|
-
if (p.style.height = `${C * o}px`,
|
|
1821
|
-
w.innerHTML = "", w.style.transform = "translateY(0px)",
|
|
1822
|
-
w.appendChild(x
|
|
1879
|
+
const K = document.createElement("span");
|
|
1880
|
+
return K.textContent = L, x.appendChild(T), x.appendChild(K), x;
|
|
1881
|
+
}, E = () => {
|
|
1882
|
+
const C = y.length, k = g.clientHeight, L = g.scrollTop;
|
|
1883
|
+
if (p.style.height = `${C * o}px`, ft(C, q.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1884
|
+
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x, T) => {
|
|
1885
|
+
w.appendChild(v(x, T));
|
|
1823
1886
|
});
|
|
1824
1887
|
return;
|
|
1825
1888
|
}
|
|
1826
|
-
const m =
|
|
1889
|
+
const m = gt({
|
|
1827
1890
|
totalRows: C,
|
|
1828
1891
|
viewportHeight: k,
|
|
1829
|
-
scrollTop:
|
|
1892
|
+
scrollTop: L,
|
|
1830
1893
|
rowHeight: o,
|
|
1831
|
-
overscan:
|
|
1894
|
+
overscan: q.LIST_OVERSCAN
|
|
1832
1895
|
});
|
|
1833
1896
|
w.style.transform = `translateY(${m.offsetY}px)`, w.innerHTML = "";
|
|
1834
|
-
for (let
|
|
1835
|
-
w.appendChild(
|
|
1836
|
-
},
|
|
1837
|
-
const k = this.config.caseSensitive ?? !1,
|
|
1838
|
-
if (
|
|
1839
|
-
const
|
|
1840
|
-
return !C ||
|
|
1841
|
-
}),
|
|
1897
|
+
for (let x = m.start; x < m.end; x++)
|
|
1898
|
+
w.appendChild(v(y[x], x - m.start));
|
|
1899
|
+
}, R = (C) => {
|
|
1900
|
+
const k = this.config.caseSensitive ?? !1, L = k ? C : C.toLowerCase();
|
|
1901
|
+
if (y = i.filter((m) => {
|
|
1902
|
+
const x = m == null ? "(Blank)" : String(m), T = k ? x : x.toLowerCase();
|
|
1903
|
+
return !C || T.includes(L);
|
|
1904
|
+
}), y.length === 0) {
|
|
1842
1905
|
p.style.height = "0px", w.innerHTML = "";
|
|
1843
1906
|
const m = document.createElement("div");
|
|
1844
1907
|
m.className = "tbw-filter-no-match", m.textContent = "No matching values", w.appendChild(m);
|
|
1845
1908
|
return;
|
|
1846
1909
|
}
|
|
1847
|
-
|
|
1910
|
+
E();
|
|
1848
1911
|
};
|
|
1849
1912
|
g.addEventListener(
|
|
1850
1913
|
"scroll",
|
|
1851
1914
|
() => {
|
|
1852
|
-
|
|
1915
|
+
y.length > 0 && E();
|
|
1853
1916
|
},
|
|
1854
1917
|
{ passive: !0 }
|
|
1855
|
-
),
|
|
1918
|
+
), R(l.value), e.appendChild(g);
|
|
1856
1919
|
let D;
|
|
1857
1920
|
l.addEventListener("input", () => {
|
|
1858
1921
|
clearTimeout(D), D = setTimeout(() => {
|
|
1859
|
-
this.searchText.set(r, l.value),
|
|
1922
|
+
this.searchText.set(r, l.value), R(l.value);
|
|
1860
1923
|
}, this.config.debounceMs ?? 150);
|
|
1861
1924
|
});
|
|
1862
1925
|
const I = document.createElement("div");
|
|
1863
1926
|
I.className = "tbw-filter-buttons";
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1927
|
+
const P = document.createElement("button");
|
|
1928
|
+
P.className = "tbw-filter-apply-btn", P.textContent = "Apply", P.addEventListener("click", () => {
|
|
1866
1929
|
const C = [];
|
|
1867
|
-
for (const [k,
|
|
1868
|
-
if (!
|
|
1930
|
+
for (const [k, L] of b)
|
|
1931
|
+
if (!L)
|
|
1869
1932
|
if (k === "__null__")
|
|
1870
1933
|
C.push(null);
|
|
1871
1934
|
else {
|
|
1872
|
-
const m = i.find((
|
|
1935
|
+
const m = i.find((x) => String(x) === k);
|
|
1873
1936
|
C.push(m !== void 0 ? m : k);
|
|
1874
1937
|
}
|
|
1875
1938
|
t.applySetFilter(C);
|
|
1876
|
-
}), I.appendChild(
|
|
1939
|
+
}), I.appendChild(P);
|
|
1877
1940
|
const S = document.createElement("button");
|
|
1878
1941
|
S.className = "tbw-filter-clear-btn", S.textContent = "Clear Filter", S.addEventListener("click", () => {
|
|
1879
1942
|
t.clearFilter();
|
|
1880
1943
|
}), I.appendChild(S), e.appendChild(I);
|
|
1881
1944
|
}
|
|
1882
1945
|
renderNumberFilterPanel(e, t, i) {
|
|
1883
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A,
|
|
1946
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A, z) => {
|
|
1884
1947
|
if (typeof A == "number") return A;
|
|
1885
1948
|
if (typeof A == "string") {
|
|
1886
|
-
const
|
|
1887
|
-
return isNaN(
|
|
1949
|
+
const j = parseFloat(A);
|
|
1950
|
+
return isNaN(j) ? z : j;
|
|
1888
1951
|
}
|
|
1889
|
-
return
|
|
1952
|
+
return z;
|
|
1890
1953
|
}, 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);
|
|
1891
1954
|
let w = h, b = f;
|
|
1892
1955
|
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, f));
|
|
1956
|
+
const y = document.createElement("div");
|
|
1957
|
+
y.className = "tbw-filter-range-inputs";
|
|
1893
1958
|
const v = document.createElement("div");
|
|
1894
|
-
v.className = "tbw-filter-range-
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1897
|
-
const R = document.createElement("
|
|
1898
|
-
R.
|
|
1899
|
-
const E = document.createElement("input");
|
|
1900
|
-
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(f), E.step = String(g), E.value = String(w), x.appendChild(R), x.appendChild(E), v.appendChild(x);
|
|
1959
|
+
v.className = "tbw-filter-range-group";
|
|
1960
|
+
const E = document.createElement("label");
|
|
1961
|
+
E.textContent = "Min", E.className = "tbw-filter-range-label";
|
|
1962
|
+
const R = document.createElement("input");
|
|
1963
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(w), v.appendChild(E), v.appendChild(R), y.appendChild(v);
|
|
1901
1964
|
const D = document.createElement("span");
|
|
1902
|
-
D.className = "tbw-filter-range-separator", D.textContent = "–",
|
|
1965
|
+
D.className = "tbw-filter-range-separator", D.textContent = "–", y.appendChild(D);
|
|
1903
1966
|
const I = document.createElement("div");
|
|
1904
1967
|
I.className = "tbw-filter-range-group";
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1968
|
+
const P = document.createElement("label");
|
|
1969
|
+
P.textContent = "Max", P.className = "tbw-filter-range-label";
|
|
1907
1970
|
const S = document.createElement("input");
|
|
1908
|
-
S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(f), S.step = String(g), S.value = String(b), I.appendChild(
|
|
1971
|
+
S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(f), S.step = String(g), S.value = String(b), I.appendChild(P), I.appendChild(S), y.appendChild(I), e.appendChild(y);
|
|
1909
1972
|
const C = document.createElement("div");
|
|
1910
1973
|
C.className = "tbw-filter-range-slider";
|
|
1911
1974
|
const k = document.createElement("div");
|
|
1912
1975
|
k.className = "tbw-filter-range-track";
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1976
|
+
const L = document.createElement("div");
|
|
1977
|
+
L.className = "tbw-filter-range-fill";
|
|
1915
1978
|
const m = document.createElement("input");
|
|
1916
1979
|
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(f), m.step = String(g), m.value = String(w);
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
const
|
|
1920
|
-
const A = parseFloat(m.value),
|
|
1921
|
-
|
|
1980
|
+
const x = document.createElement("input");
|
|
1981
|
+
x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(L), C.appendChild(m), C.appendChild(x), e.appendChild(C);
|
|
1982
|
+
const T = () => {
|
|
1983
|
+
const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100, ut = (z - h) / j * 100;
|
|
1984
|
+
L.style.left = `${ve}%`, L.style.width = `${ut - ve}%`;
|
|
1922
1985
|
};
|
|
1923
1986
|
m.addEventListener("input", () => {
|
|
1924
|
-
const A = Math.min(parseFloat(m.value), parseFloat(
|
|
1925
|
-
m.value = String(A),
|
|
1926
|
-
}),
|
|
1927
|
-
const A = Math.max(parseFloat(
|
|
1928
|
-
|
|
1929
|
-
}),
|
|
1930
|
-
let A = parseFloat(
|
|
1931
|
-
A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A),
|
|
1987
|
+
const A = Math.min(parseFloat(m.value), parseFloat(x.value));
|
|
1988
|
+
m.value = String(A), R.value = String(A), T();
|
|
1989
|
+
}), x.addEventListener("input", () => {
|
|
1990
|
+
const A = Math.max(parseFloat(x.value), parseFloat(m.value));
|
|
1991
|
+
x.value = String(A), S.value = String(A), T();
|
|
1992
|
+
}), R.addEventListener("input", () => {
|
|
1993
|
+
let A = parseFloat(R.value) || h;
|
|
1994
|
+
A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), T();
|
|
1932
1995
|
}), S.addEventListener("input", () => {
|
|
1933
1996
|
let A = parseFloat(S.value) || f;
|
|
1934
|
-
A = Math.min(f, Math.max(A, parseFloat(
|
|
1935
|
-
}),
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1938
|
-
const Y = document.createElement("button");
|
|
1939
|
-
Y.className = "tbw-filter-apply-btn", Y.textContent = "Apply", Y.addEventListener("click", () => {
|
|
1940
|
-
const A = parseFloat(E.value), K = parseFloat(S.value);
|
|
1941
|
-
t.applyTextFilter("between", A, K);
|
|
1942
|
-
}), H.appendChild(Y);
|
|
1997
|
+
A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A), T();
|
|
1998
|
+
}), T();
|
|
1999
|
+
const K = document.createElement("div");
|
|
2000
|
+
K.className = "tbw-filter-buttons";
|
|
1943
2001
|
const X = document.createElement("button");
|
|
1944
|
-
X.className = "tbw-filter-
|
|
2002
|
+
X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
|
|
2003
|
+
const A = parseFloat(R.value), z = parseFloat(S.value);
|
|
2004
|
+
t.applyTextFilter("between", A, z);
|
|
2005
|
+
}), K.appendChild(X);
|
|
2006
|
+
const Z = document.createElement("button");
|
|
2007
|
+
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
1945
2008
|
t.clearFilter();
|
|
1946
|
-
}),
|
|
2009
|
+
}), K.appendChild(Z), e.appendChild(K);
|
|
1947
2010
|
}
|
|
1948
2011
|
renderDateFilterPanel(e, t, i) {
|
|
1949
2012
|
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
1950
2013
|
let w = "", b = "";
|
|
1951
2014
|
p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
|
|
2015
|
+
const y = document.createElement("div");
|
|
2016
|
+
y.className = "tbw-filter-date-range";
|
|
1952
2017
|
const v = document.createElement("div");
|
|
1953
|
-
v.className = "tbw-filter-date-
|
|
1954
|
-
const
|
|
1955
|
-
|
|
1956
|
-
const R = document.createElement("
|
|
1957
|
-
R.
|
|
1958
|
-
const E = document.createElement("input");
|
|
1959
|
-
E.type = "date", E.className = "tbw-filter-date-input", f && (E.min = f), g && (E.max = g), E.value = w, x.appendChild(R), x.appendChild(E), v.appendChild(x);
|
|
2018
|
+
v.className = "tbw-filter-date-group";
|
|
2019
|
+
const E = document.createElement("label");
|
|
2020
|
+
E.textContent = "From", E.className = "tbw-filter-range-label";
|
|
2021
|
+
const R = document.createElement("input");
|
|
2022
|
+
R.type = "date", R.className = "tbw-filter-date-input", f && (R.min = f), g && (R.max = g), R.value = w, v.appendChild(E), v.appendChild(R), y.appendChild(v);
|
|
1960
2023
|
const D = document.createElement("span");
|
|
1961
|
-
D.className = "tbw-filter-range-separator", D.textContent = "–",
|
|
2024
|
+
D.className = "tbw-filter-range-separator", D.textContent = "–", y.appendChild(D);
|
|
1962
2025
|
const I = document.createElement("div");
|
|
1963
2026
|
I.className = "tbw-filter-date-group";
|
|
1964
|
-
const
|
|
1965
|
-
|
|
2027
|
+
const P = document.createElement("label");
|
|
2028
|
+
P.textContent = "To", P.className = "tbw-filter-range-label";
|
|
1966
2029
|
const S = document.createElement("input");
|
|
1967
|
-
S.type = "date", S.className = "tbw-filter-date-input", f && (S.min = f), g && (S.max = g), S.value = b, I.appendChild(
|
|
2030
|
+
S.type = "date", S.className = "tbw-filter-date-input", f && (S.min = f), g && (S.max = g), S.value = b, I.appendChild(P), I.appendChild(S), y.appendChild(I), e.appendChild(y);
|
|
1968
2031
|
const C = document.createElement("div");
|
|
1969
2032
|
C.className = "tbw-filter-buttons";
|
|
1970
2033
|
const k = document.createElement("button");
|
|
1971
2034
|
k.className = "tbw-filter-apply-btn", k.textContent = "Apply", k.addEventListener("click", () => {
|
|
1972
|
-
const m =
|
|
1973
|
-
m &&
|
|
2035
|
+
const m = R.value, x = S.value;
|
|
2036
|
+
m && x ? t.applyTextFilter("between", m, x) : m ? t.applyTextFilter("greaterThanOrEqual", m) : x ? t.applyTextFilter("lessThanOrEqual", x) : t.clearFilter();
|
|
1974
2037
|
}), C.appendChild(k);
|
|
1975
|
-
const
|
|
1976
|
-
|
|
2038
|
+
const L = document.createElement("button");
|
|
2039
|
+
L.className = "tbw-filter-clear-btn", L.textContent = "Clear Filter", L.addEventListener("click", () => {
|
|
1977
2040
|
t.clearFilter();
|
|
1978
|
-
}), C.appendChild(
|
|
2041
|
+
}), C.appendChild(L), e.appendChild(C);
|
|
1979
2042
|
}
|
|
1980
2043
|
applySetFilter(e, t) {
|
|
1981
2044
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -2178,9 +2241,9 @@ class vn extends _ {
|
|
|
2178
2241
|
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2179
2242
|
}
|
|
2180
2243
|
const o = e.querySelector(".header-row");
|
|
2181
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n)), this.#
|
|
2244
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n)), this.#t(n);
|
|
2182
2245
|
}
|
|
2183
|
-
#
|
|
2246
|
+
#t(e) {
|
|
2184
2247
|
if (!this.config.showGroupBorders) return;
|
|
2185
2248
|
const t = this.gridElement;
|
|
2186
2249
|
if (!t) return;
|
|
@@ -2323,6 +2386,10 @@ class yn extends _ {
|
|
|
2323
2386
|
detach() {
|
|
2324
2387
|
this.expandedKeys.clear(), this.flattenedRows = [], this.isActive = !1, this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.hasAppliedDefaultExpanded = !1;
|
|
2325
2388
|
}
|
|
2389
|
+
getRowHeight(e, t) {
|
|
2390
|
+
if (this.config.groupRowHeight != null && e.__isGroupRow === !0)
|
|
2391
|
+
return this.config.groupRowHeight;
|
|
2392
|
+
}
|
|
2326
2393
|
handleQuery(e) {
|
|
2327
2394
|
if (e.type === "canMoveRow" && e.context?.__isGroupRow === !0)
|
|
2328
2395
|
return !1;
|
|
@@ -2366,7 +2433,8 @@ class yn extends _ {
|
|
|
2366
2433
|
__groupDepth: s.depth,
|
|
2367
2434
|
__groupRows: s.rows,
|
|
2368
2435
|
__groupExpanded: s.expanded,
|
|
2369
|
-
__groupRowCount: ni(s)
|
|
2436
|
+
__groupRowCount: ni(s),
|
|
2437
|
+
__rowCacheKey: `group:${s.key}`
|
|
2370
2438
|
} : s.row);
|
|
2371
2439
|
}
|
|
2372
2440
|
onCellClick(e) {
|
|
@@ -2636,10 +2704,17 @@ class nt extends _ {
|
|
|
2636
2704
|
}
|
|
2637
2705
|
expandedRows = /* @__PURE__ */ new Set();
|
|
2638
2706
|
detailElements = /* @__PURE__ */ new Map();
|
|
2707
|
+
measuredDetailHeights = /* @__PURE__ */ new Map();
|
|
2639
2708
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2640
2709
|
getDetailHeight(e) {
|
|
2641
2710
|
const t = this.detailElements.get(e);
|
|
2642
|
-
|
|
2711
|
+
if (t) {
|
|
2712
|
+
const n = t.offsetHeight;
|
|
2713
|
+
if (n > 0)
|
|
2714
|
+
return this.measuredDetailHeights.set(e, n), n;
|
|
2715
|
+
}
|
|
2716
|
+
const i = this.measuredDetailHeights.get(e);
|
|
2717
|
+
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : nt.DEFAULT_DETAIL_HEIGHT;
|
|
2643
2718
|
}
|
|
2644
2719
|
toggleAndEmit(e, t) {
|
|
2645
2720
|
this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
|
|
@@ -2649,15 +2724,15 @@ class nt extends _ {
|
|
|
2649
2724
|
}), this.requestRender();
|
|
2650
2725
|
}
|
|
2651
2726
|
detach() {
|
|
2652
|
-
this.expandedRows.clear(), this.detailElements.clear();
|
|
2727
|
+
this.expandedRows.clear(), this.detailElements.clear(), this.measuredDetailHeights.clear();
|
|
2653
2728
|
}
|
|
2654
2729
|
processColumns(e) {
|
|
2655
2730
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2656
2731
|
return [...e];
|
|
2657
2732
|
const i = [...e];
|
|
2658
|
-
if (
|
|
2733
|
+
if (vt(i))
|
|
2659
2734
|
return i;
|
|
2660
|
-
const r =
|
|
2735
|
+
const r = yt(this.name);
|
|
2661
2736
|
return r.viewRenderer = (o) => {
|
|
2662
2737
|
const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
|
|
2663
2738
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2672,7 +2747,7 @@ class nt extends _ {
|
|
|
2672
2747
|
onCellClick(e) {
|
|
2673
2748
|
if (e.originalEvent?.target?.classList.contains("master-detail-toggle"))
|
|
2674
2749
|
return this.toggleAndEmit(e.row, e.rowIndex), !0;
|
|
2675
|
-
this.expandedRows.size > 0 && queueMicrotask(() => this.#
|
|
2750
|
+
this.expandedRows.size > 0 && queueMicrotask(() => this.#t());
|
|
2676
2751
|
}
|
|
2677
2752
|
onKeyDown(e) {
|
|
2678
2753
|
if (e.key !== " ") return;
|
|
@@ -2683,12 +2758,12 @@ class nt extends _ {
|
|
|
2683
2758
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
2684
2759
|
}
|
|
2685
2760
|
afterRender() {
|
|
2686
|
-
this.#
|
|
2761
|
+
this.#t();
|
|
2687
2762
|
}
|
|
2688
2763
|
onScrollRender() {
|
|
2689
|
-
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#
|
|
2764
|
+
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#t();
|
|
2690
2765
|
}
|
|
2691
|
-
#
|
|
2766
|
+
#t() {
|
|
2692
2767
|
if (!this.config.detailRenderer) return;
|
|
2693
2768
|
const e = this.gridElement?.querySelector(".rows");
|
|
2694
2769
|
if (!e) return;
|
|
@@ -2711,7 +2786,15 @@ class nt extends _ {
|
|
|
2711
2786
|
continue;
|
|
2712
2787
|
}
|
|
2713
2788
|
const c = li(l, o, this.config.detailRenderer, n);
|
|
2714
|
-
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), s.after(c), this.detailElements.set(l, c),
|
|
2789
|
+
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), s.after(c), this.detailElements.set(l, c), requestAnimationFrame(() => {
|
|
2790
|
+
if (c.isConnected) {
|
|
2791
|
+
const u = c.offsetHeight;
|
|
2792
|
+
if (u > 0) {
|
|
2793
|
+
const h = this.measuredDetailHeights.get(l);
|
|
2794
|
+
this.measuredDetailHeights.set(l, u), h !== u && this.grid.invalidateRowHeight(o);
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
}), this.animateExpand(c);
|
|
2715
2798
|
}
|
|
2716
2799
|
}
|
|
2717
2800
|
getExtraHeight() {
|
|
@@ -2728,6 +2811,12 @@ class nt extends _ {
|
|
|
2728
2811
|
}
|
|
2729
2812
|
return t;
|
|
2730
2813
|
}
|
|
2814
|
+
getRowHeight(e, t) {
|
|
2815
|
+
if (!this.expandedRows.has(e))
|
|
2816
|
+
return;
|
|
2817
|
+
const n = this.grid.defaultRowHeight ?? 28, r = this.getDetailHeight(e);
|
|
2818
|
+
return n + r;
|
|
2819
|
+
}
|
|
2731
2820
|
adjustVirtualStart(e, t, i) {
|
|
2732
2821
|
if (this.expandedRows.size === 0) return e;
|
|
2733
2822
|
const n = [];
|
|
@@ -2891,7 +2980,7 @@ class xn extends _ {
|
|
|
2891
2980
|
}
|
|
2892
2981
|
}
|
|
2893
2982
|
function rt(a, e) {
|
|
2894
|
-
return
|
|
2983
|
+
return pt(a, e);
|
|
2895
2984
|
}
|
|
2896
2985
|
function ot(a, e) {
|
|
2897
2986
|
const t = a.sticky;
|
|
@@ -3241,7 +3330,7 @@ class En extends _ {
|
|
|
3241
3330
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3242
3331
|
}
|
|
3243
3332
|
}
|
|
3244
|
-
const vi =
|
|
3333
|
+
const vi = mt;
|
|
3245
3334
|
function yi(a) {
|
|
3246
3335
|
const e = [];
|
|
3247
3336
|
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;
|
|
@@ -3378,11 +3467,11 @@ function ki(a) {
|
|
|
3378
3467
|
const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3379
3468
|
function _i(a, e, t, i) {
|
|
3380
3469
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3381
|
-
return o.className = "tbw-pivot-panel", o.appendChild(
|
|
3470
|
+
return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () => We("rowGroups", r))), o.appendChild(Y("Column Groups", () => We("columnGroups", r))), o.appendChild(Y("Values", () => Ti(r))), o.appendChild(Y("Available Fields", () => Fi(r))), a.appendChild(o), () => {
|
|
3382
3471
|
n.abort(), o.remove();
|
|
3383
3472
|
};
|
|
3384
3473
|
}
|
|
3385
|
-
function
|
|
3474
|
+
function Y(a, e) {
|
|
3386
3475
|
const t = document.createElement("div");
|
|
3387
3476
|
t.className = "tbw-pivot-section";
|
|
3388
3477
|
const i = document.createElement("div");
|
|
@@ -3399,7 +3488,7 @@ function We(a, e) {
|
|
|
3399
3488
|
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3400
3489
|
} else
|
|
3401
3490
|
for (const s of o)
|
|
3402
|
-
r.appendChild(
|
|
3491
|
+
r.appendChild(Li(s, a, e));
|
|
3403
3492
|
return r.addEventListener(
|
|
3404
3493
|
"dragover",
|
|
3405
3494
|
(s) => {
|
|
@@ -3422,7 +3511,7 @@ function We(a, e) {
|
|
|
3422
3511
|
{ signal: n }
|
|
3423
3512
|
), r;
|
|
3424
3513
|
}
|
|
3425
|
-
function
|
|
3514
|
+
function Li(a, e, t) {
|
|
3426
3515
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3427
3516
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3428
3517
|
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
@@ -3448,7 +3537,7 @@ function Ti(a, e, t) {
|
|
|
3448
3537
|
{ signal: n }
|
|
3449
3538
|
), r;
|
|
3450
3539
|
}
|
|
3451
|
-
function
|
|
3540
|
+
function Ti(a) {
|
|
3452
3541
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3453
3542
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3454
3543
|
const r = e.valueFields ?? [];
|
|
@@ -3628,7 +3717,7 @@ function Ni(a, e, t) {
|
|
|
3628
3717
|
}), !0;
|
|
3629
3718
|
}
|
|
3630
3719
|
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}}}';
|
|
3631
|
-
class
|
|
3720
|
+
class B extends _ {
|
|
3632
3721
|
name = "pivot";
|
|
3633
3722
|
styles = qi;
|
|
3634
3723
|
static PANEL_ID = "pivot";
|
|
@@ -3665,7 +3754,7 @@ class G extends _ {
|
|
|
3665
3754
|
getToolPanel() {
|
|
3666
3755
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3667
3756
|
return {
|
|
3668
|
-
id:
|
|
3757
|
+
id: B.PANEL_ID,
|
|
3669
3758
|
title: "Pivot",
|
|
3670
3759
|
icon: "⊞",
|
|
3671
3760
|
tooltip: "Configure pivot table",
|
|
@@ -3830,16 +3919,16 @@ class G extends _ {
|
|
|
3830
3919
|
this.pivotResult = null, this.requestRender();
|
|
3831
3920
|
}
|
|
3832
3921
|
showPanel() {
|
|
3833
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3922
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(B.PANEL_ID) || this.grid.toggleToolPanelSection(B.PANEL_ID);
|
|
3834
3923
|
}
|
|
3835
3924
|
hidePanel() {
|
|
3836
3925
|
this.grid.closeToolPanel();
|
|
3837
3926
|
}
|
|
3838
3927
|
togglePanel() {
|
|
3839
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3928
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(B.PANEL_ID);
|
|
3840
3929
|
}
|
|
3841
3930
|
isPanelVisible() {
|
|
3842
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3931
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(B.PANEL_ID);
|
|
3843
3932
|
}
|
|
3844
3933
|
get gridColumns() {
|
|
3845
3934
|
return this.grid.columns ?? [];
|
|
@@ -4020,21 +4109,21 @@ class Rn extends _ {
|
|
|
4020
4109
|
name = "print";
|
|
4021
4110
|
version = "1.0.0";
|
|
4022
4111
|
styles = zi;
|
|
4023
|
-
#
|
|
4024
|
-
#
|
|
4025
|
-
#a = null;
|
|
4026
|
-
#n = null;
|
|
4027
|
-
#i = null;
|
|
4112
|
+
#t = !1;
|
|
4113
|
+
#e = null;
|
|
4028
4114
|
#s = null;
|
|
4029
|
-
#
|
|
4030
|
-
|
|
4115
|
+
#o = null;
|
|
4116
|
+
#i = null;
|
|
4117
|
+
#n = null;
|
|
4118
|
+
#u = null;
|
|
4119
|
+
get #l() {
|
|
4031
4120
|
return this.grid;
|
|
4032
4121
|
}
|
|
4033
4122
|
isPrinting() {
|
|
4034
|
-
return this.#
|
|
4123
|
+
return this.#t;
|
|
4035
4124
|
}
|
|
4036
4125
|
async print(e) {
|
|
4037
|
-
if (this.#
|
|
4126
|
+
if (this.#t) {
|
|
4038
4127
|
console.warn("[PrintPlugin] Print already in progress");
|
|
4039
4128
|
return;
|
|
4040
4129
|
}
|
|
@@ -4056,7 +4145,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4056
4145
|
))
|
|
4057
4146
|
return;
|
|
4058
4147
|
}
|
|
4059
|
-
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#
|
|
4148
|
+
i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#t = !0;
|
|
4060
4149
|
const l = performance.now();
|
|
4061
4150
|
this.emit("print-start", {
|
|
4062
4151
|
rowCount: o,
|
|
@@ -4064,10 +4153,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4064
4153
|
originalRowCount: r
|
|
4065
4154
|
});
|
|
4066
4155
|
try {
|
|
4067
|
-
const d = this.#
|
|
4068
|
-
this.#
|
|
4156
|
+
const d = this.#l;
|
|
4157
|
+
this.#s = {
|
|
4069
4158
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
4070
|
-
}, this.#
|
|
4159
|
+
}, this.#v(), s && (this.#o = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#r(i), await this.#d(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#f(), this.emit("print-complete", {
|
|
4071
4160
|
success: !0,
|
|
4072
4161
|
rowCount: o,
|
|
4073
4162
|
duration: Math.round(performance.now() - l)
|
|
@@ -4079,10 +4168,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4079
4168
|
duration: Math.round(performance.now() - l)
|
|
4080
4169
|
});
|
|
4081
4170
|
} finally {
|
|
4082
|
-
this.#
|
|
4171
|
+
this.#w(), this.#t = !1;
|
|
4083
4172
|
}
|
|
4084
4173
|
}
|
|
4085
|
-
#
|
|
4174
|
+
#r(e) {
|
|
4086
4175
|
const t = this.gridElement;
|
|
4087
4176
|
if (t) {
|
|
4088
4177
|
if (this.#i = document.createElement("div"), this.#i.className = "tbw-print-header", e.includeTitle) {
|
|
@@ -4093,16 +4182,16 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4093
4182
|
const i = document.createElement("div");
|
|
4094
4183
|
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#i.appendChild(i);
|
|
4095
4184
|
}
|
|
4096
|
-
t.insertBefore(this.#i, t.firstChild), this.#
|
|
4185
|
+
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);
|
|
4097
4186
|
}
|
|
4098
4187
|
}
|
|
4099
|
-
async #
|
|
4100
|
-
const e = this.#
|
|
4188
|
+
async #d() {
|
|
4189
|
+
const e = this.#l;
|
|
4101
4190
|
if (!e._virtualization) return;
|
|
4102
4191
|
const t = this.rows.length;
|
|
4103
4192
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
4104
4193
|
}
|
|
4105
|
-
async #
|
|
4194
|
+
async #f() {
|
|
4106
4195
|
return new Promise((e) => {
|
|
4107
4196
|
const t = () => {
|
|
4108
4197
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -4112,40 +4201,40 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4112
4201
|
}, 1e3);
|
|
4113
4202
|
});
|
|
4114
4203
|
}
|
|
4115
|
-
async #
|
|
4204
|
+
async #p(e) {
|
|
4116
4205
|
const t = this.gridElement;
|
|
4117
4206
|
t && await Ki(t, {
|
|
4118
4207
|
orientation: e.orientation
|
|
4119
4208
|
});
|
|
4120
4209
|
}
|
|
4121
|
-
#
|
|
4210
|
+
#v() {
|
|
4122
4211
|
const e = this.columns;
|
|
4123
4212
|
if (e) {
|
|
4124
|
-
this.#
|
|
4213
|
+
this.#e = /* @__PURE__ */ new Map();
|
|
4125
4214
|
for (const t of e)
|
|
4126
|
-
t.printHidden && t.field && (this.#
|
|
4215
|
+
t.printHidden && t.field && (this.#e.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
4127
4216
|
}
|
|
4128
4217
|
}
|
|
4129
|
-
#
|
|
4130
|
-
if (this.#
|
|
4131
|
-
for (const [e, t] of this.#
|
|
4218
|
+
#h() {
|
|
4219
|
+
if (this.#e) {
|
|
4220
|
+
for (const [e, t] of this.#e)
|
|
4132
4221
|
this.grid.setColumnVisible(e, t);
|
|
4133
|
-
this.#
|
|
4222
|
+
this.#e = null;
|
|
4134
4223
|
}
|
|
4135
4224
|
}
|
|
4136
|
-
#
|
|
4225
|
+
#w() {
|
|
4137
4226
|
const e = this.gridElement;
|
|
4138
4227
|
if (!e) return;
|
|
4139
|
-
this.#
|
|
4140
|
-
const t = this.#
|
|
4141
|
-
this.#
|
|
4228
|
+
this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#u !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#u = null), this.#i && (this.#i.remove(), this.#i = null), this.#n && (this.#n.remove(), this.#n = null);
|
|
4229
|
+
const t = this.#l;
|
|
4230
|
+
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#o !== null && (this.grid.rows = this.#o, this.#o = null);
|
|
4142
4231
|
}
|
|
4143
4232
|
afterRender() {
|
|
4144
|
-
this.config?.button && !this.#
|
|
4233
|
+
this.config?.button && !this.#c && (this.#g(), this.#c = !0);
|
|
4145
4234
|
}
|
|
4146
|
-
#
|
|
4147
|
-
#
|
|
4148
|
-
this.#
|
|
4235
|
+
#c = !1;
|
|
4236
|
+
#g() {
|
|
4237
|
+
this.#l.registerToolbarContent?.({
|
|
4149
4238
|
id: "print-button",
|
|
4150
4239
|
order: 900,
|
|
4151
4240
|
render: (t) => {
|
|
@@ -4262,7 +4351,7 @@ class Sn extends _ {
|
|
|
4262
4351
|
if (l < 0 || l >= o.length) return;
|
|
4263
4352
|
const d = n.find((c) => c.field === o[l]);
|
|
4264
4353
|
if (this.canMoveColumnWithPlugins(d))
|
|
4265
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
4354
|
+
return this.moveColumn(r.field, l), t._focusCol = l, F(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
4266
4355
|
}
|
|
4267
4356
|
getColumnOrder() {
|
|
4268
4357
|
return this.grid.getColumnOrder();
|
|
@@ -4384,46 +4473,46 @@ class kn extends _ {
|
|
|
4384
4473
|
}
|
|
4385
4474
|
]
|
|
4386
4475
|
};
|
|
4387
|
-
#
|
|
4388
|
-
#
|
|
4389
|
-
#
|
|
4390
|
-
#
|
|
4476
|
+
#t;
|
|
4477
|
+
#e = !1;
|
|
4478
|
+
#s;
|
|
4479
|
+
#o = !1;
|
|
4391
4480
|
#i = 0;
|
|
4392
|
-
#
|
|
4393
|
-
#
|
|
4394
|
-
#
|
|
4395
|
-
#
|
|
4481
|
+
#n = /* @__PURE__ */ new Set();
|
|
4482
|
+
#u = /* @__PURE__ */ new Set();
|
|
4483
|
+
#l = null;
|
|
4484
|
+
#r = [];
|
|
4396
4485
|
isResponsive() {
|
|
4397
|
-
return this.#
|
|
4486
|
+
return this.#e;
|
|
4398
4487
|
}
|
|
4399
4488
|
setResponsive(e) {
|
|
4400
|
-
e !== this.#
|
|
4489
|
+
e !== this.#e && (this.#e = e, this.#w(), this.emit("responsive-change", {
|
|
4401
4490
|
isResponsive: e,
|
|
4402
4491
|
width: this.#i,
|
|
4403
4492
|
breakpoint: this.config.breakpoint ?? 0
|
|
4404
4493
|
}));
|
|
4405
4494
|
}
|
|
4406
4495
|
setBreakpoint(e) {
|
|
4407
|
-
this.config.breakpoint = e, this.#
|
|
4496
|
+
this.config.breakpoint = e, this.#p(this.#i);
|
|
4408
4497
|
}
|
|
4409
4498
|
setCardRenderer(e) {
|
|
4410
|
-
this.config.cardRenderer = e, this.#
|
|
4499
|
+
this.config.cardRenderer = e, this.#e && this.requestRender();
|
|
4411
4500
|
}
|
|
4412
4501
|
getWidth() {
|
|
4413
4502
|
return this.#i;
|
|
4414
4503
|
}
|
|
4415
4504
|
getActiveBreakpoint() {
|
|
4416
|
-
return this.#
|
|
4505
|
+
return this.#l;
|
|
4417
4506
|
}
|
|
4418
4507
|
attach(e) {
|
|
4419
|
-
super.attach(e), this.#
|
|
4508
|
+
super.attach(e), this.#d(), this.#f(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#r = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#t = new ResizeObserver((t) => {
|
|
4420
4509
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4421
|
-
this.#i = i, clearTimeout(this.#
|
|
4422
|
-
this.#
|
|
4510
|
+
this.#i = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
4511
|
+
this.#p(i);
|
|
4423
4512
|
}, this.config.debounceMs ?? 100);
|
|
4424
|
-
}), this.#
|
|
4513
|
+
}), this.#t.observe(this.gridElement);
|
|
4425
4514
|
}
|
|
4426
|
-
#
|
|
4515
|
+
#d() {
|
|
4427
4516
|
const e = this.grid;
|
|
4428
4517
|
if (!e || typeof e.querySelector != "function") return;
|
|
4429
4518
|
const t = e.querySelector("tbw-grid-responsive-card");
|
|
@@ -4448,79 +4537,79 @@ class kn extends _ {
|
|
|
4448
4537
|
return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
|
|
4449
4538
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4450
4539
|
}
|
|
4451
|
-
#
|
|
4452
|
-
if (this.#
|
|
4540
|
+
#f(e) {
|
|
4541
|
+
if (this.#n.clear(), this.#u.clear(), !!e)
|
|
4453
4542
|
for (const t of e)
|
|
4454
|
-
typeof t == "string" ? this.#
|
|
4543
|
+
typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#u.add(t.field) : this.#n.add(t.field);
|
|
4455
4544
|
}
|
|
4456
4545
|
detach() {
|
|
4457
|
-
this.#
|
|
4546
|
+
this.#t?.disconnect(), this.#t = void 0, clearTimeout(this.#s), this.#s = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4458
4547
|
}
|
|
4459
4548
|
handleQuery(e) {
|
|
4460
4549
|
if (e.type === "isCardMode")
|
|
4461
|
-
return this.#
|
|
4550
|
+
return this.#e;
|
|
4462
4551
|
}
|
|
4463
4552
|
afterRender() {
|
|
4464
|
-
if (this.#R(), !(this.#
|
|
4553
|
+
if (this.#R(), !(this.#r.length > 0 ? this.#l !== null : this.#e))
|
|
4465
4554
|
return;
|
|
4466
|
-
const t = this.#
|
|
4555
|
+
const t = this.#n.size > 0, i = this.#u.size > 0;
|
|
4467
4556
|
if (!t && !i)
|
|
4468
4557
|
return;
|
|
4469
4558
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
4470
4559
|
for (const r of n) {
|
|
4471
4560
|
const o = r.getAttribute("data-field");
|
|
4472
|
-
o && (this.#
|
|
4561
|
+
o && (this.#n.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#u.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
|
|
4473
4562
|
}
|
|
4474
4563
|
}
|
|
4475
|
-
#
|
|
4476
|
-
if (this.#
|
|
4477
|
-
this.#
|
|
4564
|
+
#p(e) {
|
|
4565
|
+
if (this.#r.length > 0) {
|
|
4566
|
+
this.#v(e);
|
|
4478
4567
|
return;
|
|
4479
4568
|
}
|
|
4480
4569
|
const t = this.config.breakpoint ?? 0;
|
|
4481
|
-
t === 0 && !this.#
|
|
4570
|
+
t === 0 && !this.#o && (this.#o = !0, console.warn(
|
|
4482
4571
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4483
4572
|
));
|
|
4484
4573
|
const i = t > 0 && e < t;
|
|
4485
|
-
i !== this.#
|
|
4574
|
+
i !== this.#e && (this.#e = i, this.#w(), this.emit("responsive-change", {
|
|
4486
4575
|
isResponsive: i,
|
|
4487
4576
|
width: e,
|
|
4488
4577
|
breakpoint: t
|
|
4489
4578
|
}), this.requestRender());
|
|
4490
4579
|
}
|
|
4491
|
-
#
|
|
4580
|
+
#v(e) {
|
|
4492
4581
|
let t = null;
|
|
4493
|
-
for (const n of this.#
|
|
4582
|
+
for (const n of this.#r)
|
|
4494
4583
|
e <= n.maxWidth && (t = n);
|
|
4495
|
-
if (t !== this.#
|
|
4496
|
-
this.#
|
|
4584
|
+
if (t !== this.#l) {
|
|
4585
|
+
this.#l = t, t?.hiddenColumns ? this.#f(t.hiddenColumns) : this.#f(this.config.hiddenColumns);
|
|
4497
4586
|
const n = t?.cardLayout === !0;
|
|
4498
|
-
n !== this.#
|
|
4499
|
-
isResponsive: this.#
|
|
4587
|
+
n !== this.#e && (this.#e = n, this.#w()), this.emit("responsive-change", {
|
|
4588
|
+
isResponsive: this.#e,
|
|
4500
4589
|
width: e,
|
|
4501
4590
|
breakpoint: t?.maxWidth ?? 0
|
|
4502
4591
|
}), this.requestRender();
|
|
4503
4592
|
}
|
|
4504
4593
|
}
|
|
4505
|
-
#
|
|
4506
|
-
#
|
|
4507
|
-
this.gridElement.toggleAttribute("data-responsive", this.#
|
|
4594
|
+
#h;
|
|
4595
|
+
#w() {
|
|
4596
|
+
this.gridElement.toggleAttribute("data-responsive", this.#e);
|
|
4508
4597
|
const e = this.config.animate !== !1;
|
|
4509
4598
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
4510
4599
|
const t = this.grid;
|
|
4511
|
-
if (this.#
|
|
4512
|
-
t._virtualization && (this.#
|
|
4600
|
+
if (this.#e) {
|
|
4601
|
+
t._virtualization && (this.#h = t._virtualization.rowHeight);
|
|
4513
4602
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
4514
4603
|
i && (i.scrollLeft = 0);
|
|
4515
4604
|
} else {
|
|
4516
4605
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
4517
4606
|
for (const n of i)
|
|
4518
4607
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
4519
|
-
this.#
|
|
4608
|
+
this.#h && this.#h > 0 && t._virtualization && (t._virtualization.rowHeight = this.#h, this.#h = void 0), this.#c = void 0, this.#g = void 0, this.#a = void 0;
|
|
4520
4609
|
}
|
|
4521
4610
|
}
|
|
4522
4611
|
renderRow(e, t, i) {
|
|
4523
|
-
if (!this.#
|
|
4612
|
+
if (!this.#e || !this.config.cardRenderer || e.__isGroupRow)
|
|
4524
4613
|
return;
|
|
4525
4614
|
t.replaceChildren();
|
|
4526
4615
|
const n = this.config.cardRenderer(e, i);
|
|
@@ -4529,46 +4618,46 @@ class kn extends _ {
|
|
|
4529
4618
|
return r !== "auto" ? t.style.height = `${r}px` : t.style.height = "auto", t.appendChild(n), !0;
|
|
4530
4619
|
}
|
|
4531
4620
|
onKeyDown(e) {
|
|
4532
|
-
if (!this.#
|
|
4621
|
+
if (!this.#e || this.config.cardRenderer && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key))
|
|
4533
4622
|
return !1;
|
|
4534
4623
|
const t = this.rows.length - 1, i = this.visibleColumns.length - 1;
|
|
4535
4624
|
switch (e.key) {
|
|
4536
4625
|
case "ArrowDown":
|
|
4537
4626
|
if (this.grid._focusCol < i)
|
|
4538
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
4627
|
+
return this.grid._focusCol += 1, e.preventDefault(), F(this.grid), !0;
|
|
4539
4628
|
if (this.grid._focusRow < t)
|
|
4540
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
4629
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), F(this.grid), !0;
|
|
4541
4630
|
break;
|
|
4542
4631
|
case "ArrowUp":
|
|
4543
4632
|
if (this.grid._focusCol > 0)
|
|
4544
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
4633
|
+
return this.grid._focusCol -= 1, e.preventDefault(), F(this.grid), !0;
|
|
4545
4634
|
if (this.grid._focusRow > 0)
|
|
4546
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
4635
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), F(this.grid), !0;
|
|
4547
4636
|
break;
|
|
4548
4637
|
case "ArrowRight":
|
|
4549
4638
|
if (this.grid._focusRow < t)
|
|
4550
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
4639
|
+
return this.grid._focusRow += 1, e.preventDefault(), F(this.grid), !0;
|
|
4551
4640
|
break;
|
|
4552
4641
|
case "ArrowLeft":
|
|
4553
4642
|
if (this.grid._focusRow > 0)
|
|
4554
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
4643
|
+
return this.grid._focusRow -= 1, e.preventDefault(), F(this.grid), !0;
|
|
4555
4644
|
break;
|
|
4556
4645
|
}
|
|
4557
4646
|
return !1;
|
|
4558
4647
|
}
|
|
4559
|
-
#
|
|
4560
|
-
#
|
|
4561
|
-
#
|
|
4648
|
+
#c;
|
|
4649
|
+
#g;
|
|
4650
|
+
#a;
|
|
4562
4651
|
#b() {
|
|
4563
|
-
if (this.#
|
|
4564
|
-
return this.#
|
|
4652
|
+
if (this.#c && this.#c > 0)
|
|
4653
|
+
return this.#c;
|
|
4565
4654
|
const e = this.config.cardRowHeight;
|
|
4566
4655
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
4567
4656
|
}
|
|
4568
|
-
#
|
|
4569
|
-
return this.#
|
|
4657
|
+
#m() {
|
|
4658
|
+
return this.#g && this.#g > 0 ? this.#g : this.#h ?? 28;
|
|
4570
4659
|
}
|
|
4571
|
-
#
|
|
4660
|
+
#y() {
|
|
4572
4661
|
for (const e of this.rows)
|
|
4573
4662
|
if (e.__isGroupRow)
|
|
4574
4663
|
return !0;
|
|
@@ -4581,47 +4670,51 @@ class kn extends _ {
|
|
|
4581
4670
|
return { groupCount: e, cardCount: t };
|
|
4582
4671
|
}
|
|
4583
4672
|
getExtraHeight() {
|
|
4584
|
-
if (!this.#
|
|
4673
|
+
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
4585
4674
|
return 0;
|
|
4586
|
-
const e = this.#
|
|
4675
|
+
const e = this.#h ?? 28, t = this.#m(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
|
|
4587
4676
|
return o + s;
|
|
4588
4677
|
}
|
|
4589
4678
|
getExtraHeightBefore(e) {
|
|
4590
|
-
if (!this.#
|
|
4679
|
+
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
4591
4680
|
return 0;
|
|
4592
|
-
const t = this.#
|
|
4681
|
+
const t = this.#h ?? 28, i = this.#m(), n = this.#b(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
4593
4682
|
let s = 0, l = 0;
|
|
4594
4683
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4595
4684
|
for (let u = 0; u < c; u++)
|
|
4596
4685
|
d[u].__isGroupRow ? s++ : l++;
|
|
4597
4686
|
return s * r + l * o;
|
|
4598
4687
|
}
|
|
4599
|
-
|
|
4688
|
+
getRowHeight(e, t) {
|
|
4689
|
+
if (!(!this.#e || !this.config.cardRenderer))
|
|
4690
|
+
return e.__isGroupRow ? this.#m() : this.#b();
|
|
4691
|
+
}
|
|
4692
|
+
#x() {
|
|
4600
4693
|
let e = 0;
|
|
4601
4694
|
for (const t of this.rows)
|
|
4602
4695
|
t.__isGroupRow || e++;
|
|
4603
4696
|
return e;
|
|
4604
4697
|
}
|
|
4605
|
-
#
|
|
4698
|
+
#E = !1;
|
|
4606
4699
|
#R() {
|
|
4607
|
-
if (!this.#
|
|
4700
|
+
if (!this.#e || !this.config.cardRenderer)
|
|
4608
4701
|
return;
|
|
4609
4702
|
let e = !1;
|
|
4610
|
-
const t = this.grid, i = this.#
|
|
4611
|
-
if (n !== this.#
|
|
4703
|
+
const t = this.grid, i = this.#y(), n = this.#x();
|
|
4704
|
+
if (n !== this.#a && (this.#a = n, e = !0), i) {
|
|
4612
4705
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4613
4706
|
if (o) {
|
|
4614
4707
|
const s = o.getBoundingClientRect().height;
|
|
4615
|
-
s > 0 && s !== this.#
|
|
4708
|
+
s > 0 && s !== this.#g && (this.#g = s, e = !0);
|
|
4616
4709
|
}
|
|
4617
4710
|
}
|
|
4618
4711
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
4619
4712
|
if (r) {
|
|
4620
4713
|
const o = r.getBoundingClientRect().height;
|
|
4621
|
-
o > 0 && o !== this.#
|
|
4714
|
+
o > 0 && o !== this.#c && (this.#c = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
4622
4715
|
}
|
|
4623
|
-
e && !this.#
|
|
4624
|
-
this.#
|
|
4716
|
+
e && !this.#E && (this.#E = !0, queueMicrotask(() => {
|
|
4717
|
+
this.#E = !1, this.grid && this.#e && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
4625
4718
|
}));
|
|
4626
4719
|
}
|
|
4627
4720
|
}
|
|
@@ -4749,7 +4842,7 @@ class An extends _ {
|
|
|
4749
4842
|
row: e
|
|
4750
4843
|
}, this.lastFocusCol = r;
|
|
4751
4844
|
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
|
|
4752
|
-
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0),
|
|
4845
|
+
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), F(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
4753
4846
|
this.flushPendingMove();
|
|
4754
4847
|
}, this.config.debounceMs ?? 300);
|
|
4755
4848
|
}
|
|
@@ -4768,7 +4861,7 @@ class An extends _ {
|
|
|
4768
4861
|
const o = [...this.sourceRows], [s] = o.splice(t, 1);
|
|
4769
4862
|
o.splice(e, 0, s);
|
|
4770
4863
|
const l = this.grid;
|
|
4771
|
-
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0),
|
|
4864
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), F(l);
|
|
4772
4865
|
}
|
|
4773
4866
|
}
|
|
4774
4867
|
executeMove(e, t, i, n) {
|
|
@@ -4838,7 +4931,7 @@ class An extends _ {
|
|
|
4838
4931
|
this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
|
|
4839
4932
|
}
|
|
4840
4933
|
}
|
|
4841
|
-
function
|
|
4934
|
+
function $(a) {
|
|
4842
4935
|
return {
|
|
4843
4936
|
startRow: Math.min(a.startRow, a.endRow),
|
|
4844
4937
|
startCol: Math.min(a.startCol, a.endCol),
|
|
@@ -4847,7 +4940,7 @@ function V(a) {
|
|
|
4847
4940
|
};
|
|
4848
4941
|
}
|
|
4849
4942
|
function ji(a) {
|
|
4850
|
-
const e =
|
|
4943
|
+
const e = $(a);
|
|
4851
4944
|
return {
|
|
4852
4945
|
from: { row: e.startRow, col: e.startCol },
|
|
4853
4946
|
to: { row: e.endRow, col: e.endCol }
|
|
@@ -4857,14 +4950,14 @@ function lt(a) {
|
|
|
4857
4950
|
return a.map(ji);
|
|
4858
4951
|
}
|
|
4859
4952
|
function Ui(a, e, t) {
|
|
4860
|
-
const i =
|
|
4953
|
+
const i = $(t);
|
|
4861
4954
|
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4862
4955
|
}
|
|
4863
4956
|
function je(a, e, t) {
|
|
4864
4957
|
return t.some((i) => Ui(a, e, i));
|
|
4865
4958
|
}
|
|
4866
4959
|
function Yi(a) {
|
|
4867
|
-
const e = [], t =
|
|
4960
|
+
const e = [], t = $(a);
|
|
4868
4961
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4869
4962
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4870
4963
|
e.push({ row: i, col: n });
|
|
@@ -4886,7 +4979,7 @@ function de(a, e) {
|
|
|
4886
4979
|
};
|
|
4887
4980
|
}
|
|
4888
4981
|
function Q(a, e) {
|
|
4889
|
-
const t =
|
|
4982
|
+
const t = $(a), i = $(e);
|
|
4890
4983
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4891
4984
|
}
|
|
4892
4985
|
const Zi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
@@ -4977,15 +5070,15 @@ class _n extends _ {
|
|
|
4977
5070
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4978
5071
|
if (n.type !== o)
|
|
4979
5072
|
return !1;
|
|
4980
|
-
const s = this.columns[i], l = s &&
|
|
5073
|
+
const s = this.columns[i], l = s && H(s);
|
|
4981
5074
|
if (r === "cell") {
|
|
4982
5075
|
if (l || !this.isCellSelectable(t, i))
|
|
4983
5076
|
return !1;
|
|
4984
5077
|
const d = this.selectedCell;
|
|
4985
|
-
return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#
|
|
5078
|
+
return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
|
|
4986
5079
|
}
|
|
4987
5080
|
if (r === "row")
|
|
4988
|
-
return !this.isRowSelectable(t) || this.selected.size === 1 && this.selected.has(t) || (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#
|
|
5081
|
+
return !this.isRowSelectable(t) || this.selected.size === 1 && this.selected.has(t) || (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
|
|
4989
5082
|
if (r === "range") {
|
|
4990
5083
|
if (l || !this.isCellSelectable(t, i))
|
|
4991
5084
|
return !1;
|
|
@@ -5014,7 +5107,7 @@ class _n extends _ {
|
|
|
5014
5107
|
return !1;
|
|
5015
5108
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
5016
5109
|
}
|
|
5017
|
-
return this.emit("selection-change", this.#
|
|
5110
|
+
return this.emit("selection-change", this.#e()), this.requestAfterRender(), !1;
|
|
5018
5111
|
}
|
|
5019
5112
|
return !1;
|
|
5020
5113
|
}
|
|
@@ -5022,16 +5115,16 @@ class _n extends _ {
|
|
|
5022
5115
|
if (!this.isSelectionEnabled()) return !1;
|
|
5023
5116
|
const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
|
|
5024
5117
|
if (e.key === "Escape")
|
|
5025
|
-
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#
|
|
5118
|
+
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
|
|
5026
5119
|
if (t === "cell" && n)
|
|
5027
5120
|
return queueMicrotask(() => {
|
|
5028
5121
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
5029
|
-
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#
|
|
5122
|
+
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#e()), this.requestAfterRender();
|
|
5030
5123
|
}), !1;
|
|
5031
5124
|
if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
5032
5125
|
return queueMicrotask(() => {
|
|
5033
5126
|
const r = this.grid._focusRow;
|
|
5034
|
-
this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#
|
|
5127
|
+
this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#e()), this.requestAfterRender();
|
|
5035
5128
|
}), !1;
|
|
5036
5129
|
if (t === "range" && n) {
|
|
5037
5130
|
const r = e.key === "Tab", o = e.shiftKey && !r;
|
|
@@ -5047,7 +5140,7 @@ class _n extends _ {
|
|
|
5047
5140
|
endRow: r - 1,
|
|
5048
5141
|
endCol: o - 1
|
|
5049
5142
|
};
|
|
5050
|
-
return this.ranges = [s], this.activeRange = s, this.emit("selection-change", this.#
|
|
5143
|
+
return this.ranges = [s], this.activeRange = s, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
|
|
5051
5144
|
}
|
|
5052
5145
|
}
|
|
5053
5146
|
return !1;
|
|
@@ -5055,7 +5148,7 @@ class _n extends _ {
|
|
|
5055
5148
|
onCellMouseDown(e) {
|
|
5056
5149
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5057
5150
|
const t = this.columns[e.colIndex];
|
|
5058
|
-
if (t &&
|
|
5151
|
+
if (t && H(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
5059
5152
|
return;
|
|
5060
5153
|
this.isDragging = !0;
|
|
5061
5154
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -5064,24 +5157,24 @@ class _n extends _ {
|
|
|
5064
5157
|
endRow: i,
|
|
5065
5158
|
endCol: n
|
|
5066
5159
|
};
|
|
5067
|
-
return !r && this.ranges.length === 1 && Q(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#
|
|
5160
|
+
return !r && this.ranges.length === 1 && Q(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0);
|
|
5068
5161
|
}
|
|
5069
5162
|
onCellMouseMove(e) {
|
|
5070
5163
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5071
5164
|
let t = e.colIndex;
|
|
5072
5165
|
const i = this.columns[t];
|
|
5073
|
-
if (i &&
|
|
5074
|
-
const o = this.columns.findIndex((s) => !
|
|
5166
|
+
if (i && H(i)) {
|
|
5167
|
+
const o = this.columns.findIndex((s) => !H(s));
|
|
5075
5168
|
o >= 0 && (t = o);
|
|
5076
5169
|
}
|
|
5077
5170
|
const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5078
|
-
return r && Q(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#
|
|
5171
|
+
return r && Q(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#e()), this.requestAfterRender()), !0;
|
|
5079
5172
|
}
|
|
5080
5173
|
onCellMouseUp(e) {
|
|
5081
5174
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
5082
5175
|
return this.isDragging = !1, !0;
|
|
5083
5176
|
}
|
|
5084
|
-
#
|
|
5177
|
+
#t() {
|
|
5085
5178
|
const e = this.gridElement;
|
|
5086
5179
|
if (!e) return;
|
|
5087
5180
|
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
@@ -5092,19 +5185,19 @@ class _n extends _ {
|
|
|
5092
5185
|
if (r.forEach((o) => {
|
|
5093
5186
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
5094
5187
|
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
5095
|
-
const s = o.querySelector(".cell[data-row]"), l =
|
|
5188
|
+
const s = o.querySelector(".cell[data-row]"), l = wt(s);
|
|
5096
5189
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
5097
5190
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5098
5191
|
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
5099
5192
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
|
|
5100
5193
|
}), t === "range" && this.ranges.length > 0) {
|
|
5101
5194
|
xe(e);
|
|
5102
|
-
const o = this.activeRange ?
|
|
5195
|
+
const o = this.activeRange ? $(this.activeRange) : null, s = this.columns.findIndex((d) => !H(d));
|
|
5103
5196
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
5104
5197
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
5105
5198
|
if (c >= 0 && u >= 0) {
|
|
5106
5199
|
const h = this.columns[u];
|
|
5107
|
-
if (h &&
|
|
5200
|
+
if (h && H(h))
|
|
5108
5201
|
return;
|
|
5109
5202
|
if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
5110
5203
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
@@ -5128,17 +5221,17 @@ class _n extends _ {
|
|
|
5128
5221
|
const s = de(this.cellAnchor, { row: r, col: o });
|
|
5129
5222
|
this.ranges = [s], this.activeRange = s;
|
|
5130
5223
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
5131
|
-
this.emit("selection-change", this.#
|
|
5224
|
+
this.emit("selection-change", this.#e());
|
|
5132
5225
|
}
|
|
5133
|
-
this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#
|
|
5226
|
+
this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#t();
|
|
5134
5227
|
}
|
|
5135
5228
|
onScrollRender() {
|
|
5136
|
-
this.isSelectionEnabled() && this.#
|
|
5229
|
+
this.isSelectionEnabled() && this.#t();
|
|
5137
5230
|
}
|
|
5138
5231
|
getSelection() {
|
|
5139
5232
|
return {
|
|
5140
5233
|
mode: this.config.mode,
|
|
5141
|
-
ranges: this.#
|
|
5234
|
+
ranges: this.#e().ranges,
|
|
5142
5235
|
anchor: this.cellAnchor
|
|
5143
5236
|
};
|
|
5144
5237
|
}
|
|
@@ -5162,7 +5255,7 @@ class _n extends _ {
|
|
|
5162
5255
|
ranges: lt(this.ranges)
|
|
5163
5256
|
}), this.requestAfterRender();
|
|
5164
5257
|
}
|
|
5165
|
-
#
|
|
5258
|
+
#e() {
|
|
5166
5259
|
return Qi(
|
|
5167
5260
|
this.config.mode,
|
|
5168
5261
|
{
|
|
@@ -5205,7 +5298,7 @@ function tn(a, e, t) {
|
|
|
5205
5298
|
return n[r];
|
|
5206
5299
|
}
|
|
5207
5300
|
const nn = 100;
|
|
5208
|
-
class
|
|
5301
|
+
class Ln extends _ {
|
|
5209
5302
|
name = "serverSide";
|
|
5210
5303
|
get defaultConfig() {
|
|
5211
5304
|
return {
|
|
@@ -5343,7 +5436,7 @@ function sn(a) {
|
|
|
5343
5436
|
return null;
|
|
5344
5437
|
}
|
|
5345
5438
|
const an = "@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}}}";
|
|
5346
|
-
class
|
|
5439
|
+
class Tn extends _ {
|
|
5347
5440
|
static manifest = {
|
|
5348
5441
|
events: [
|
|
5349
5442
|
{
|
|
@@ -5456,16 +5549,16 @@ class Ln extends _ {
|
|
|
5456
5549
|
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, w = document.createElement("span");
|
|
5457
5550
|
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
|
|
5458
5551
|
if (g.__treeHasChildren) {
|
|
5459
|
-
const
|
|
5460
|
-
|
|
5552
|
+
const y = document.createElement("span");
|
|
5553
|
+
y.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(y, s(g.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(y);
|
|
5461
5554
|
} else {
|
|
5462
|
-
const
|
|
5463
|
-
|
|
5555
|
+
const y = document.createElement("span");
|
|
5556
|
+
y.className = "tree-spacer", w.appendChild(y);
|
|
5464
5557
|
}
|
|
5465
5558
|
const b = document.createElement("span");
|
|
5466
5559
|
if (b.className = "tree-content", n) {
|
|
5467
|
-
const
|
|
5468
|
-
|
|
5560
|
+
const y = n(d);
|
|
5561
|
+
y instanceof Node ? b.appendChild(y) : typeof y == "string" && (b.innerHTML = y);
|
|
5469
5562
|
} else
|
|
5470
5563
|
b.textContent = u != null ? String(u) : "";
|
|
5471
5564
|
return w.appendChild(b), w;
|
|
@@ -5693,7 +5786,7 @@ function Qe(a) {
|
|
|
5693
5786
|
const e = a.meta ?? {};
|
|
5694
5787
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5695
5788
|
}
|
|
5696
|
-
class
|
|
5789
|
+
class V extends _ {
|
|
5697
5790
|
static dependencies = [
|
|
5698
5791
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5699
5792
|
];
|
|
@@ -5720,7 +5813,7 @@ class B extends _ {
|
|
|
5720
5813
|
}
|
|
5721
5814
|
getToolPanel() {
|
|
5722
5815
|
return {
|
|
5723
|
-
id:
|
|
5816
|
+
id: V.PANEL_ID,
|
|
5724
5817
|
title: "Columns",
|
|
5725
5818
|
icon: "☰",
|
|
5726
5819
|
tooltip: "Column visibility",
|
|
@@ -5729,13 +5822,13 @@ class B extends _ {
|
|
|
5729
5822
|
};
|
|
5730
5823
|
}
|
|
5731
5824
|
show() {
|
|
5732
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
5825
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(V.PANEL_ID) || this.grid.toggleToolPanelSection(V.PANEL_ID);
|
|
5733
5826
|
}
|
|
5734
5827
|
hide() {
|
|
5735
5828
|
this.grid.closeToolPanel();
|
|
5736
5829
|
}
|
|
5737
5830
|
toggle() {
|
|
5738
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
5831
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(V.PANEL_ID);
|
|
5739
5832
|
}
|
|
5740
5833
|
isColumnVisible(e) {
|
|
5741
5834
|
return this.grid.isColumnVisible(e);
|
|
@@ -5765,7 +5858,7 @@ class B extends _ {
|
|
|
5765
5858
|
return this.grid.getAllColumns();
|
|
5766
5859
|
}
|
|
5767
5860
|
isPanelVisible() {
|
|
5768
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
5861
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(V.PANEL_ID);
|
|
5769
5862
|
}
|
|
5770
5863
|
renderPanelContent(e) {
|
|
5771
5864
|
const t = document.createElement("div");
|
|
@@ -5847,7 +5940,7 @@ export {
|
|
|
5847
5940
|
Nn as DataGridElement,
|
|
5848
5941
|
wn as EditingPlugin,
|
|
5849
5942
|
bn as ExportPlugin,
|
|
5850
|
-
|
|
5943
|
+
q as FilteringPlugin,
|
|
5851
5944
|
qn as FitModeEnum,
|
|
5852
5945
|
Hn as GridCSSVars,
|
|
5853
5946
|
Kn as GridClasses,
|
|
@@ -5861,7 +5954,7 @@ export {
|
|
|
5861
5954
|
Bn as PLUGIN_QUERIES,
|
|
5862
5955
|
Cn as PinnedColumnsPlugin,
|
|
5863
5956
|
En as PinnedRowsPlugin,
|
|
5864
|
-
|
|
5957
|
+
B as PivotPlugin,
|
|
5865
5958
|
Vn as PluginEvents,
|
|
5866
5959
|
Wn as PluginManager,
|
|
5867
5960
|
Rn as PrintPlugin,
|
|
@@ -5871,15 +5964,15 @@ export {
|
|
|
5871
5964
|
kn as ResponsivePlugin,
|
|
5872
5965
|
An as RowReorderPlugin,
|
|
5873
5966
|
_n as SelectionPlugin,
|
|
5874
|
-
|
|
5875
|
-
|
|
5967
|
+
Ln as ServerSidePlugin,
|
|
5968
|
+
Tn as TreePlugin,
|
|
5876
5969
|
In as UndoRedoPlugin,
|
|
5877
|
-
|
|
5970
|
+
V as VisibilityPlugin,
|
|
5878
5971
|
jn as builtInSort,
|
|
5879
5972
|
Un as createGrid,
|
|
5880
5973
|
Yn as defaultComparator,
|
|
5881
|
-
|
|
5882
|
-
|
|
5974
|
+
Dt as defaultEditorFor,
|
|
5975
|
+
Ct as defaultPasteHandler,
|
|
5883
5976
|
Ki as printGridIsolated,
|
|
5884
5977
|
Xn as queryGrid
|
|
5885
5978
|
};
|