@toolbox-web/grid 1.10.1 → 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 +791 -649
- package/all.js.map +1 -1
- package/index.js +1822 -1507
- 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/columns.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/header.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/keyboard.d.ts +2 -0
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/loading.d.ts +41 -0
- package/lib/core/internal/loading.d.ts.map +1 -0
- package/lib/core/internal/render-scheduler.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/sanitize.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 +35 -0
- package/lib/core/internal/style-injector.d.ts.map +1 -0
- package/lib/core/internal/touch-scroll.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/styles/index.d.ts +32 -0
- package/lib/core/styles/index.d.ts.map +1 -0
- package/lib/core/types.d.ts +95 -3
- 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 +520 -310
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +58 -3
- 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 +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 +35 -19
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +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 +63 -33
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +46 -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
|
|
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,
|
|
@@ -27,7 +27,7 @@ function bt(a) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function ie(a) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(a), !0;
|
|
33
33
|
} catch {
|
|
@@ -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();
|
|
@@ -65,23 +65,23 @@ function yt(a, e) {
|
|
|
65
65
|
});
|
|
66
66
|
const d = [...r], c = i.bounds ? i.bounds.endRow : 1 / 0;
|
|
67
67
|
t.forEach((u, h) => {
|
|
68
|
-
const
|
|
69
|
-
if (!(
|
|
68
|
+
const f = i.row + h;
|
|
69
|
+
if (!(f > c)) {
|
|
70
70
|
if (i.bounds) {
|
|
71
|
-
if (
|
|
71
|
+
if (f >= d.length)
|
|
72
72
|
return;
|
|
73
|
-
} else for (;
|
|
74
|
-
const
|
|
75
|
-
s.forEach((p) =>
|
|
73
|
+
} else for (; f >= d.length; ) {
|
|
74
|
+
const g = {};
|
|
75
|
+
s.forEach((p) => g[p] = ""), d.push(g);
|
|
76
76
|
}
|
|
77
|
-
d[
|
|
77
|
+
d[f] = { ...d[f] }, u.forEach((g, p) => {
|
|
78
78
|
const w = n[p];
|
|
79
|
-
w && l.get(w) && (d[
|
|
79
|
+
w && l.get(w) && (d[f][w] = g);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class pn extends
|
|
84
|
+
class pn extends _ {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -99,7 +99,7 @@ class pn extends A {
|
|
|
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 A {
|
|
|
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,12 +128,12 @@ class pn extends A {
|
|
|
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
|
}
|
|
135
135
|
const o = this.#i(r);
|
|
136
|
-
|
|
136
|
+
ie(o.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: o.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: o.text,
|
|
139
139
|
rowCount: o.rowCount,
|
|
@@ -141,40 +141,40 @@ class pn extends A {
|
|
|
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.#
|
|
149
|
-
for (let w = 0; w <
|
|
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
|
+
for (let w = 0; w < g && s + w <= c; w++) {
|
|
150
150
|
const b = this.columns[s + w];
|
|
151
|
-
b && !b.hidden &&
|
|
151
|
+
b && !b.hidden && f.push(b.field);
|
|
152
152
|
}
|
|
153
|
-
const p = { rows: i, text: t, target: h, fields:
|
|
153
|
+
const p = { rows: i, text: t, target: h, fields: f };
|
|
154
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 = [],
|
|
167
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !H(g));
|
|
168
168
|
if (this.config.includeHeaders) {
|
|
169
|
-
const
|
|
170
|
-
h.push(
|
|
169
|
+
const g = f.map((p) => p.header || p.field);
|
|
170
|
+
h.push(g.join(c));
|
|
171
171
|
}
|
|
172
|
-
for (let
|
|
173
|
-
const p = this.rows[
|
|
172
|
+
for (let g = o; g <= s; g++) {
|
|
173
|
+
const p = this.rows[g];
|
|
174
174
|
if (!p) continue;
|
|
175
|
-
const w =
|
|
176
|
-
const
|
|
177
|
-
return
|
|
175
|
+
const w = f.map((b) => {
|
|
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 A {
|
|
|
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 A {
|
|
|
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];
|
|
@@ -207,7 +207,7 @@ class pn extends A {
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
const n = this.#i(i);
|
|
210
|
-
return await
|
|
210
|
+
return await ie(n.text), this.lastCopied = { text: n.text, timestamp: Date.now() }, n.text;
|
|
211
211
|
}
|
|
212
212
|
async copyRows(e) {
|
|
213
213
|
if (e.length === 0) return "";
|
|
@@ -217,10 +217,10 @@ class pn extends A {
|
|
|
217
217
|
endRow: t[t.length - 1],
|
|
218
218
|
endCol: i
|
|
219
219
|
}, r = this.#i(n);
|
|
220
|
-
return await
|
|
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,10 +278,10 @@ 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
|
-
class mn extends
|
|
284
|
+
class mn extends _ {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -304,9 +304,9 @@ class mn extends A {
|
|
|
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 A {
|
|
|
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,
|
|
@@ -369,14 +369,14 @@ class mn extends A {
|
|
|
369
369
|
return this.totalWidth;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
const
|
|
372
|
+
const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
373
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
|
-
function
|
|
379
|
+
function fe(a, e, t, i = ht.submenuArrow) {
|
|
380
380
|
const n = document.createElement("div");
|
|
381
381
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
382
382
|
for (const r of a) {
|
|
@@ -387,7 +387,7 @@ function ge(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);
|
|
@@ -401,7 +401,7 @@ function ge(a, e, t, i = ht.submenuArrow) {
|
|
|
401
401
|
const d = document.createElement("span");
|
|
402
402
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
403
403
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
404
|
-
const u = he(r.subMenu, e), h =
|
|
404
|
+
const u = he(r.subMenu, e), h = fe(u, e, t, i);
|
|
405
405
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
406
406
|
}), o.addEventListener("mouseleave", () => {
|
|
407
407
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -420,8 +420,8 @@ 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
|
|
424
|
-
const
|
|
423
|
+
let O = null, G = null, N = null, re = 0;
|
|
424
|
+
const oe = [
|
|
425
425
|
{
|
|
426
426
|
id: "copy",
|
|
427
427
|
name: "Copy",
|
|
@@ -439,11 +439,11 @@ const re = [
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
];
|
|
442
|
-
class it extends
|
|
442
|
+
class it extends _ {
|
|
443
443
|
name = "contextMenu";
|
|
444
444
|
get defaultConfig() {
|
|
445
445
|
return {
|
|
446
|
-
items:
|
|
446
|
+
items: oe
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
449
|
isOpen = !1;
|
|
@@ -451,7 +451,7 @@ class it extends A {
|
|
|
451
451
|
params = null;
|
|
452
452
|
menuElement = null;
|
|
453
453
|
attach(e) {
|
|
454
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
454
|
+
super.attach(e), this.installGlobalHandlers(), re++;
|
|
455
455
|
}
|
|
456
456
|
detach() {
|
|
457
457
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
@@ -506,14 +506,14 @@ class it extends A {
|
|
|
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
|
-
|
|
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;
|
|
@@ -525,14 +525,14 @@ class it extends A {
|
|
|
525
525
|
const r = n.target, o = r.closest("[data-row][data-col]"), s = r.closest(".header-cell");
|
|
526
526
|
let l;
|
|
527
527
|
if (o) {
|
|
528
|
-
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u],
|
|
528
|
+
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
|
|
529
529
|
l = {
|
|
530
|
-
row:
|
|
530
|
+
row: f,
|
|
531
531
|
rowIndex: c,
|
|
532
532
|
column: h,
|
|
533
533
|
columnIndex: u,
|
|
534
534
|
field: h?.field ?? "",
|
|
535
|
-
value:
|
|
535
|
+
value: f?.[h?.field] ?? null,
|
|
536
536
|
isHeader: !1,
|
|
537
537
|
event: n
|
|
538
538
|
};
|
|
@@ -551,8 +551,8 @@ class it extends A {
|
|
|
551
551
|
} else
|
|
552
552
|
return;
|
|
553
553
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
554
|
-
const d = he(this.config.items ??
|
|
555
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
554
|
+
const d = he(this.config.items ?? oe, l);
|
|
555
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = fe(
|
|
556
556
|
d,
|
|
557
557
|
l,
|
|
558
558
|
(c) => {
|
|
@@ -572,8 +572,8 @@ class it extends A {
|
|
|
572
572
|
value: i.value ?? null,
|
|
573
573
|
isHeader: i.isHeader ?? !1,
|
|
574
574
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
575
|
-
}, r = he(this.config.items ??
|
|
576
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
575
|
+
}, r = he(this.config.items ?? oe, n);
|
|
576
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = fe(
|
|
577
577
|
r,
|
|
578
578
|
n,
|
|
579
579
|
(o) => {
|
|
@@ -589,12 +589,12 @@ class it extends A {
|
|
|
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,28 +686,28 @@ 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
|
|
701
|
-
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) : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : a.value;
|
|
699
|
+
function W(a, e, t) {
|
|
700
|
+
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
|
|
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
|
-
class wn extends
|
|
710
|
+
class wn extends _ {
|
|
712
711
|
static manifest = {
|
|
713
712
|
ownedProperties: [
|
|
714
713
|
{
|
|
@@ -742,20 +741,26 @@ class wn extends A {
|
|
|
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,29 +775,69 @@ class wn extends A {
|
|
|
770
775
|
}, document.addEventListener(
|
|
771
776
|
"keydown",
|
|
772
777
|
(n) => {
|
|
773
|
-
n.key === "Escape" && this.#e !== -1
|
|
778
|
+
if (!this.#t && n.key === "Escape" && this.#e !== -1) {
|
|
779
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
780
|
+
return;
|
|
781
|
+
this.#a(this.#e, !0);
|
|
782
|
+
}
|
|
774
783
|
},
|
|
775
784
|
{ capture: !0, signal: t }
|
|
776
785
|
), document.addEventListener(
|
|
777
786
|
"mousedown",
|
|
778
787
|
(n) => {
|
|
779
|
-
if (this.#e === -1) return;
|
|
788
|
+
if (this.#t || this.#e === -1) return;
|
|
780
789
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
781
|
-
!r || (n.composedPath && n.composedPath() || []).includes(r) || queueMicrotask(() => {
|
|
782
|
-
this.#e !== -1 && this.#
|
|
790
|
+
!r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
|
|
791
|
+
this.#e !== -1 && this.#a(this.#e, !1);
|
|
783
792
|
});
|
|
784
793
|
},
|
|
785
794
|
{ signal: t }
|
|
786
|
-
)
|
|
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
|
+
));
|
|
787
831
|
}
|
|
788
832
|
detach() {
|
|
789
|
-
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();
|
|
790
834
|
}
|
|
791
835
|
handleQuery(e) {
|
|
792
836
|
if (e.type === "isEditing")
|
|
793
|
-
return this.#e !== -1;
|
|
837
|
+
return this.#t || this.#e !== -1;
|
|
794
838
|
}
|
|
795
839
|
onCellClick(e) {
|
|
840
|
+
if (this.#t) return !1;
|
|
796
841
|
const t = this.grid, i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
797
842
|
if (i === !1 || i === "manual" || i !== "click" && i !== "dblclick") return !1;
|
|
798
843
|
const n = e.originalEvent.type === "dblclick";
|
|
@@ -802,25 +847,48 @@ class wn extends A {
|
|
|
802
847
|
}
|
|
803
848
|
onKeyDown(e) {
|
|
804
849
|
const t = this.grid;
|
|
805
|
-
if (e.key === "Escape"
|
|
806
|
-
|
|
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) {
|
|
861
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
862
|
+
return !0;
|
|
863
|
+
const i = t._rows.length - 1, n = this.#e;
|
|
864
|
+
return this.#a(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), F(t), this.requestAfterRender(), !0;
|
|
865
|
+
}
|
|
866
|
+
if (e.key === "Tab" && (this.#e !== -1 || this.#t)) {
|
|
867
|
+
e.preventDefault();
|
|
868
|
+
const i = !e.shiftKey;
|
|
869
|
+
return this.#w(i), !0;
|
|
870
|
+
}
|
|
807
871
|
if (e.key === " " || e.key === "Spacebar") {
|
|
872
|
+
if (this.#e !== -1)
|
|
873
|
+
return !1;
|
|
808
874
|
const i = t._focusRow, n = t._focusCol;
|
|
809
875
|
if (i >= 0 && n >= 0) {
|
|
810
876
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
811
877
|
if (r?.editable && r.type === "boolean" && o) {
|
|
812
878
|
const s = r.field;
|
|
813
|
-
if (
|
|
879
|
+
if (U(s)) {
|
|
814
880
|
const d = !o[s];
|
|
815
|
-
return this.#
|
|
881
|
+
return this.#b(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
816
882
|
}
|
|
817
883
|
}
|
|
818
884
|
}
|
|
819
885
|
return !1;
|
|
820
886
|
}
|
|
821
887
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
888
|
+
if (this.#t && !this.#d)
|
|
889
|
+
return this.#h(), !0;
|
|
822
890
|
if (this.#e !== -1)
|
|
823
|
-
return !1;
|
|
891
|
+
return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
|
|
824
892
|
const i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
825
893
|
if (i === !1 || i === "manual") return !1;
|
|
826
894
|
const n = t._focusRow, r = t._focusCol;
|
|
@@ -840,12 +908,12 @@ class wn extends A {
|
|
|
840
908
|
}
|
|
841
909
|
});
|
|
842
910
|
this.gridElement.dispatchEvent(h);
|
|
843
|
-
const
|
|
911
|
+
const f = new CustomEvent("activate-cell", {
|
|
844
912
|
cancelable: !0,
|
|
845
913
|
bubbles: !0,
|
|
846
914
|
detail: { row: n, col: r }
|
|
847
915
|
});
|
|
848
|
-
return this.gridElement.dispatchEvent(
|
|
916
|
+
return this.gridElement.dispatchEvent(f), h.defaultPrevented || f.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(n), !0);
|
|
849
917
|
}
|
|
850
918
|
return !1;
|
|
851
919
|
}
|
|
@@ -868,78 +936,83 @@ class wn extends A {
|
|
|
868
936
|
}
|
|
869
937
|
afterRender() {
|
|
870
938
|
const e = this.grid;
|
|
871
|
-
if (this.#
|
|
872
|
-
const t = this.#
|
|
873
|
-
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");
|
|
874
942
|
}
|
|
875
|
-
if (this.#
|
|
876
|
-
for (const t of this.#
|
|
943
|
+
if (!this.#t && this.#n.size !== 0)
|
|
944
|
+
for (const t of this.#n) {
|
|
877
945
|
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
878
946
|
if (!s) continue;
|
|
879
947
|
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
880
948
|
if (!l || l.classList.contains("editing")) continue;
|
|
881
949
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
882
|
-
d && c && this.#
|
|
950
|
+
d && c && this.#m(d, r, c, o, l, !0);
|
|
883
951
|
}
|
|
884
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
|
+
}
|
|
885
958
|
onScrollRender() {
|
|
886
959
|
this.afterRender();
|
|
887
960
|
}
|
|
888
961
|
get changedRows() {
|
|
889
962
|
const e = [];
|
|
890
|
-
for (const t of this.#
|
|
963
|
+
for (const t of this.#i) {
|
|
891
964
|
const i = this.grid.getRow(t);
|
|
892
965
|
i && e.push(i);
|
|
893
966
|
}
|
|
894
967
|
return e;
|
|
895
968
|
}
|
|
896
969
|
get changedRowIds() {
|
|
897
|
-
return Array.from(this.#
|
|
970
|
+
return Array.from(this.#i);
|
|
898
971
|
}
|
|
899
972
|
get activeEditRow() {
|
|
900
973
|
return this.#e;
|
|
901
974
|
}
|
|
902
975
|
get activeEditCol() {
|
|
903
|
-
return this.#
|
|
976
|
+
return this.#s;
|
|
904
977
|
}
|
|
905
978
|
isRowEditing(e) {
|
|
906
979
|
return this.#e === e;
|
|
907
980
|
}
|
|
908
981
|
isCellEditing(e, t) {
|
|
909
|
-
return this.#
|
|
982
|
+
return this.#n.has(`${e}:${t}`);
|
|
910
983
|
}
|
|
911
984
|
isRowChanged(e) {
|
|
912
985
|
const t = this.grid, i = t._rows[e];
|
|
913
986
|
if (!i) return !1;
|
|
914
987
|
try {
|
|
915
988
|
const n = t.getRowId?.(i);
|
|
916
|
-
return n ? this.#
|
|
989
|
+
return n ? this.#i.has(n) : !1;
|
|
917
990
|
} catch {
|
|
918
991
|
return !1;
|
|
919
992
|
}
|
|
920
993
|
}
|
|
921
994
|
isRowChangedById(e) {
|
|
922
|
-
return this.#
|
|
995
|
+
return this.#i.has(e);
|
|
923
996
|
}
|
|
924
997
|
setInvalid(e, t, i = "") {
|
|
925
998
|
let n = this.#r.get(e);
|
|
926
|
-
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);
|
|
927
1000
|
}
|
|
928
1001
|
clearInvalid(e, t) {
|
|
929
1002
|
const i = this.#r.get(e);
|
|
930
|
-
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);
|
|
931
1004
|
}
|
|
932
1005
|
clearRowInvalid(e) {
|
|
933
1006
|
const t = this.#r.get(e);
|
|
934
1007
|
if (t) {
|
|
935
1008
|
const i = Array.from(t.keys());
|
|
936
|
-
this.#r.delete(e), i.forEach((n) => this.#
|
|
1009
|
+
this.#r.delete(e), i.forEach((n) => this.#p(e, n, !1));
|
|
937
1010
|
}
|
|
938
1011
|
}
|
|
939
1012
|
clearAllInvalid() {
|
|
940
1013
|
const e = Array.from(this.#r.entries());
|
|
941
1014
|
this.#r.clear(), e.forEach(([t, i]) => {
|
|
942
|
-
i.forEach((n, r) => this.#
|
|
1015
|
+
i.forEach((n, r) => this.#p(t, r, !1));
|
|
943
1016
|
});
|
|
944
1017
|
}
|
|
945
1018
|
isCellInvalid(e, t) {
|
|
@@ -955,7 +1028,7 @@ class wn extends A {
|
|
|
955
1028
|
getInvalidFields(e) {
|
|
956
1029
|
return new Map(this.#r.get(e) ?? []);
|
|
957
1030
|
}
|
|
958
|
-
#
|
|
1031
|
+
#p(e, t, i) {
|
|
959
1032
|
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
960
1033
|
if (r === -1 || r === void 0) return;
|
|
961
1034
|
const s = n._rows?.findIndex((c) => {
|
|
@@ -977,13 +1050,13 @@ class wn extends A {
|
|
|
977
1050
|
}
|
|
978
1051
|
resetChangedRows(e) {
|
|
979
1052
|
const t = this.changedRows, i = this.changedRowIds;
|
|
980
|
-
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"));
|
|
981
1054
|
}
|
|
982
1055
|
beginCellEdit(e, t) {
|
|
983
1056
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
984
1057
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
985
1058
|
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
986
|
-
s && this.#
|
|
1059
|
+
s && this.#v(e, n, s);
|
|
987
1060
|
}
|
|
988
1061
|
beginBulkEdit(e) {
|
|
989
1062
|
const t = this.grid;
|
|
@@ -991,16 +1064,16 @@ class wn extends A {
|
|
|
991
1064
|
const r = t.findRenderedRowElement?.(e);
|
|
992
1065
|
if (!r) return;
|
|
993
1066
|
const o = t._rows[e];
|
|
994
|
-
this.#
|
|
1067
|
+
this.#g(e, o), Array.from(r.children).forEach((s, l) => {
|
|
995
1068
|
const d = t._visibleColumns[l];
|
|
996
1069
|
if (d?.editable) {
|
|
997
1070
|
const c = s;
|
|
998
|
-
c.classList.contains("editing") || this.#
|
|
1071
|
+
c.classList.contains("editing") || this.#m(o, e, d, l, c, !0);
|
|
999
1072
|
}
|
|
1000
1073
|
}), setTimeout(() => {
|
|
1001
1074
|
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1002
1075
|
if (s?.classList.contains("editing") || (s = r.querySelector(".cell.editing")), s?.classList.contains("editing")) {
|
|
1003
|
-
const l = s.querySelector(
|
|
1076
|
+
const l = s.querySelector(M);
|
|
1004
1077
|
try {
|
|
1005
1078
|
l?.focus({ preventScroll: !0 });
|
|
1006
1079
|
} catch {
|
|
@@ -1009,25 +1082,50 @@ class wn extends A {
|
|
|
1009
1082
|
}, 0);
|
|
1010
1083
|
}
|
|
1011
1084
|
commitActiveRowEdit() {
|
|
1012
|
-
this.#e !== -1 && this.#
|
|
1085
|
+
this.#e !== -1 && this.#a(this.#e, !1);
|
|
1013
1086
|
}
|
|
1014
1087
|
cancelActiveRowEdit() {
|
|
1015
|
-
this.#e !== -1 && this.#
|
|
1088
|
+
this.#e !== -1 && this.#a(this.#e, !0);
|
|
1016
1089
|
}
|
|
1017
|
-
#
|
|
1090
|
+
#v(e, t, i) {
|
|
1018
1091
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
1019
|
-
!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));
|
|
1020
1093
|
}
|
|
1021
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
|
+
}
|
|
1102
|
+
}
|
|
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);
|
|
1105
|
+
if (r.length === 0) return;
|
|
1106
|
+
const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
|
|
1107
|
+
if (s >= 0 && s < r.length) {
|
|
1108
|
+
t._focusCol = r[s];
|
|
1109
|
+
const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[s]}"]`);
|
|
1110
|
+
c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 }), F(t, { forceHorizontalScroll: !0 });
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
const l = n + (e ? 1 : -1);
|
|
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 })));
|
|
1118
|
+
}
|
|
1119
|
+
#c() {
|
|
1022
1120
|
const e = this.grid;
|
|
1023
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1121
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#o;
|
|
1024
1122
|
}
|
|
1025
|
-
#
|
|
1026
|
-
this.#e !== e && (this.#
|
|
1123
|
+
#g(e, t) {
|
|
1124
|
+
this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#c());
|
|
1027
1125
|
}
|
|
1028
|
-
#
|
|
1126
|
+
#a(e, t) {
|
|
1029
1127
|
if (this.#e !== e) return;
|
|
1030
|
-
const i = this.grid, n = this.#
|
|
1128
|
+
const i = this.grid, n = this.#o.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
1031
1129
|
let s;
|
|
1032
1130
|
if (r)
|
|
1033
1131
|
try {
|
|
@@ -1038,18 +1136,19 @@ class wn extends A {
|
|
|
1038
1136
|
const c = Number(d.getAttribute("data-col"));
|
|
1039
1137
|
if (isNaN(c)) return;
|
|
1040
1138
|
const u = i._visibleColumns[c];
|
|
1041
|
-
if (!u)
|
|
1139
|
+
if (!u || d.hasAttribute("data-editor-managed"))
|
|
1140
|
+
return;
|
|
1042
1141
|
const h = d.querySelector("input,textarea,select");
|
|
1043
1142
|
if (h) {
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1143
|
+
const f = u.field, g = r[f], p = W(h, u, g);
|
|
1144
|
+
g !== p && this.#b(e, u, p, r);
|
|
1046
1145
|
}
|
|
1047
1146
|
}), t && n && r)
|
|
1048
1147
|
Object.keys(n).forEach((l) => {
|
|
1049
1148
|
r[l] = n[l];
|
|
1050
|
-
}), s && (this.#
|
|
1149
|
+
}), s && (this.#i.delete(s), this.clearRowInvalid(s));
|
|
1051
1150
|
else if (!t && r) {
|
|
1052
|
-
const l = this.#
|
|
1151
|
+
const l = this.#C(n, r), d = s ? this.#i.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
1053
1152
|
rowIndex: e,
|
|
1054
1153
|
rowId: s ?? "",
|
|
1055
1154
|
row: r,
|
|
@@ -1061,18 +1160,18 @@ class wn extends A {
|
|
|
1061
1160
|
});
|
|
1062
1161
|
c && n ? (Object.keys(n).forEach((u) => {
|
|
1063
1162
|
r[u] = n[u];
|
|
1064
|
-
}), s && (this.#
|
|
1163
|
+
}), s && (this.#i.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#l = e);
|
|
1065
1164
|
}
|
|
1066
|
-
this.#
|
|
1067
|
-
for (const l of this.#
|
|
1068
|
-
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);
|
|
1069
1168
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
1070
|
-
l.classList.remove("editing"),
|
|
1071
|
-
}), this.requestRender()), this.#
|
|
1169
|
+
l.classList.remove("editing"), qt(l.parentElement);
|
|
1170
|
+
}), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1);
|
|
1072
1171
|
}
|
|
1073
|
-
#
|
|
1172
|
+
#b(e, t, i, n) {
|
|
1074
1173
|
const r = t.field;
|
|
1075
|
-
if (
|
|
1174
|
+
if (!U(r)) return;
|
|
1076
1175
|
const o = n[r];
|
|
1077
1176
|
if (o === i) return;
|
|
1078
1177
|
const s = this.grid;
|
|
@@ -1081,7 +1180,7 @@ class wn extends A {
|
|
|
1081
1180
|
l = this.grid.getRowId(n);
|
|
1082
1181
|
} catch {
|
|
1083
1182
|
}
|
|
1084
|
-
const d = l ? !this.#
|
|
1183
|
+
const d = l ? !this.#i.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : _e;
|
|
1085
1184
|
let u = !1;
|
|
1086
1185
|
const h = l ? (p) => {
|
|
1087
1186
|
u = !0, this.setInvalid(l, r, p ?? "");
|
|
@@ -1100,83 +1199,102 @@ class wn extends A {
|
|
|
1100
1199
|
updateRow: c,
|
|
1101
1200
|
setInvalid: h
|
|
1102
1201
|
})) return;
|
|
1103
|
-
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", {
|
|
1104
1203
|
rowIndex: e,
|
|
1105
1204
|
field: r,
|
|
1106
1205
|
oldValue: o,
|
|
1107
1206
|
newValue: i
|
|
1108
1207
|
});
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1208
|
+
const g = s.findRenderedRowElement?.(e);
|
|
1209
|
+
g && g.classList.add("changed");
|
|
1111
1210
|
}
|
|
1112
|
-
#
|
|
1211
|
+
#m(e, t, i, n, r, o) {
|
|
1113
1212
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1114
1213
|
let s;
|
|
1115
1214
|
try {
|
|
1116
1215
|
s = this.grid.getRowId(e);
|
|
1117
1216
|
} catch {
|
|
1118
1217
|
}
|
|
1119
|
-
const l = s ? (
|
|
1120
|
-
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}`);
|
|
1121
1220
|
const c = r.parentElement;
|
|
1122
|
-
c &&
|
|
1221
|
+
c && Nt(c);
|
|
1123
1222
|
let u = !1;
|
|
1124
|
-
const h = (
|
|
1125
|
-
u || this.#e === -1 || this.#
|
|
1126
|
-
},
|
|
1127
|
-
u = !0,
|
|
1128
|
-
},
|
|
1129
|
-
|
|
1130
|
-
|
|
1223
|
+
const h = (v) => {
|
|
1224
|
+
u || !this.#t && this.#e === -1 || this.#b(t, i, v, e);
|
|
1225
|
+
}, f = () => {
|
|
1226
|
+
u = !0, U(i.field) && (e[i.field] = d);
|
|
1227
|
+
}, g = document.createElement("div");
|
|
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)
|
|
1237
|
+
return;
|
|
1238
|
+
v.stopPropagation(), v.preventDefault(), u = !0, this.#a(t, !1);
|
|
1239
|
+
}
|
|
1240
|
+
if (v.key === "Escape") {
|
|
1241
|
+
if (this.#t) {
|
|
1242
|
+
v.stopPropagation(), v.preventDefault();
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(v) === !1)
|
|
1246
|
+
return;
|
|
1247
|
+
v.stopPropagation(), v.preventDefault(), f(), this.#a(t, !0);
|
|
1248
|
+
}
|
|
1131
1249
|
});
|
|
1132
|
-
const p = i, w = p.__editorTemplate, b =
|
|
1250
|
+
const p = i, w = p.__editorTemplate, b = Mt(this.grid, p) ?? Dt(i), y = d;
|
|
1133
1251
|
if (b === "template" && w)
|
|
1134
|
-
this.#
|
|
1252
|
+
this.#y(g, p, e, d, h, f, o, t);
|
|
1135
1253
|
else if (typeof b == "string") {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
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 });
|
|
1139
1257
|
});
|
|
1140
1258
|
} else if (typeof b == "function") {
|
|
1141
|
-
const
|
|
1259
|
+
const v = {
|
|
1142
1260
|
row: e,
|
|
1143
1261
|
rowId: s ?? "",
|
|
1144
|
-
value:
|
|
1262
|
+
value: y,
|
|
1145
1263
|
field: i.field,
|
|
1146
1264
|
column: i,
|
|
1147
1265
|
commit: h,
|
|
1148
|
-
cancel:
|
|
1266
|
+
cancel: f,
|
|
1149
1267
|
updateRow: l
|
|
1150
|
-
},
|
|
1151
|
-
typeof
|
|
1152
|
-
|
|
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 });
|
|
1153
1271
|
});
|
|
1154
1272
|
} else if (b && typeof b == "object") {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
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 = {
|
|
1158
1276
|
row: e,
|
|
1159
1277
|
rowId: s ?? "",
|
|
1160
|
-
value:
|
|
1278
|
+
value: y,
|
|
1161
1279
|
field: i.field,
|
|
1162
1280
|
column: i,
|
|
1163
1281
|
commit: h,
|
|
1164
|
-
cancel:
|
|
1282
|
+
cancel: f,
|
|
1165
1283
|
updateRow: l
|
|
1166
1284
|
};
|
|
1167
1285
|
if (b.mount)
|
|
1168
1286
|
try {
|
|
1169
|
-
b.mount({ placeholder:
|
|
1170
|
-
} catch (
|
|
1171
|
-
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);
|
|
1172
1290
|
}
|
|
1173
1291
|
else
|
|
1174
1292
|
this.grid.dispatchEvent(
|
|
1175
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder:
|
|
1293
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: b, context: E } })
|
|
1176
1294
|
);
|
|
1177
1295
|
}
|
|
1178
1296
|
}
|
|
1179
|
-
#
|
|
1297
|
+
#y(e, t, i, n, r, o, s, l) {
|
|
1180
1298
|
const d = t.__editorTemplate;
|
|
1181
1299
|
if (!d) return;
|
|
1182
1300
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1187,9 +1305,9 @@ class wn extends A {
|
|
|
1187
1305
|
column: t,
|
|
1188
1306
|
commit: r,
|
|
1189
1307
|
cancel: o
|
|
1190
|
-
}) : c.querySelectorAll("*").forEach((
|
|
1191
|
-
|
|
1192
|
-
if (
|
|
1308
|
+
}) : c.querySelectorAll("*").forEach((f) => {
|
|
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) => {
|
|
1310
|
+
if (!U(p)) return "";
|
|
1193
1311
|
const w = i[p];
|
|
1194
1312
|
return w == null ? "" : String(w);
|
|
1195
1313
|
}) || "");
|
|
@@ -1199,17 +1317,26 @@ class wn extends A {
|
|
|
1199
1317
|
);
|
|
1200
1318
|
if (h) {
|
|
1201
1319
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1202
|
-
let
|
|
1320
|
+
let f = !1;
|
|
1203
1321
|
h.addEventListener("blur", () => {
|
|
1204
|
-
|
|
1205
|
-
}), h.addEventListener("keydown", (
|
|
1206
|
-
const p =
|
|
1207
|
-
|
|
1322
|
+
f || r(W(h, t, n));
|
|
1323
|
+
}), h.addEventListener("keydown", (g) => {
|
|
1324
|
+
const p = g;
|
|
1325
|
+
if (p.key === "Enter") {
|
|
1326
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1327
|
+
return;
|
|
1328
|
+
p.stopPropagation(), p.preventDefault(), f = !0, r(W(h, t, n)), this.#a(l, !1);
|
|
1329
|
+
}
|
|
1330
|
+
if (p.key === "Escape") {
|
|
1331
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1332
|
+
return;
|
|
1333
|
+
p.stopPropagation(), p.preventDefault(), o(), this.#a(l, !0);
|
|
1334
|
+
}
|
|
1208
1335
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1209
1336
|
}
|
|
1210
1337
|
e.appendChild(c);
|
|
1211
1338
|
}
|
|
1212
|
-
#
|
|
1339
|
+
#C(e, t) {
|
|
1213
1340
|
if (!e) return !1;
|
|
1214
1341
|
const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
|
|
1215
1342
|
for (const o of r)
|
|
@@ -1217,7 +1344,7 @@ class wn extends A {
|
|
|
1217
1344
|
return !0;
|
|
1218
1345
|
return !1;
|
|
1219
1346
|
}
|
|
1220
|
-
#
|
|
1347
|
+
#x(e) {
|
|
1221
1348
|
queueMicrotask(() => {
|
|
1222
1349
|
try {
|
|
1223
1350
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1233,7 +1360,7 @@ class wn extends A {
|
|
|
1233
1360
|
});
|
|
1234
1361
|
}
|
|
1235
1362
|
}
|
|
1236
|
-
function
|
|
1363
|
+
function Le(a, e = !0) {
|
|
1237
1364
|
if (a == null) return "";
|
|
1238
1365
|
if (a instanceof Date) return a.toISOString();
|
|
1239
1366
|
if (typeof a == "object") return JSON.stringify(a);
|
|
@@ -1241,20 +1368,20 @@ function Te(a, e = !0) {
|
|
|
1241
1368
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1242
1369
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1243
1370
|
}
|
|
1244
|
-
function
|
|
1371
|
+
function Kt(a, e, t, i = {}) {
|
|
1245
1372
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1246
1373
|
`, o = [], s = i.bom ? "\uFEFF" : "";
|
|
1247
1374
|
if (t.includeHeaders !== !1) {
|
|
1248
1375
|
const l = e.map((d) => {
|
|
1249
1376
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1250
|
-
return
|
|
1377
|
+
return Le(u);
|
|
1251
1378
|
});
|
|
1252
1379
|
o.push(l.join(n));
|
|
1253
1380
|
}
|
|
1254
1381
|
for (const l of a) {
|
|
1255
1382
|
const d = e.map((c) => {
|
|
1256
1383
|
let u = l[c.field];
|
|
1257
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1384
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Le(u);
|
|
1258
1385
|
});
|
|
1259
1386
|
o.push(d.join(n));
|
|
1260
1387
|
}
|
|
@@ -1264,14 +1391,14 @@ function we(a, e) {
|
|
|
1264
1391
|
const t = URL.createObjectURL(a), i = document.createElement("a");
|
|
1265
1392
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1266
1393
|
}
|
|
1267
|
-
function
|
|
1394
|
+
function zt(a, e) {
|
|
1268
1395
|
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1269
1396
|
we(t, e);
|
|
1270
1397
|
}
|
|
1271
|
-
function
|
|
1398
|
+
function Te(a) {
|
|
1272
1399
|
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1273
1400
|
}
|
|
1274
|
-
function
|
|
1401
|
+
function Ot(a, e, t) {
|
|
1275
1402
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1276
1403
|
<?mso-application progid="Excel.Sheet"?>
|
|
1277
1404
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1283,7 +1410,7 @@ function Kt(a, e, t) {
|
|
|
1283
1410
|
<Row>`;
|
|
1284
1411
|
for (const n of e) {
|
|
1285
1412
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1286
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1413
|
+
i += `<Cell><Data ss:Type="String">${Te(o)}</Data></Cell>`;
|
|
1287
1414
|
}
|
|
1288
1415
|
i += "</Row>";
|
|
1289
1416
|
}
|
|
@@ -1294,7 +1421,7 @@ function Kt(a, e, t) {
|
|
|
1294
1421
|
let o = n[r.field];
|
|
1295
1422
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1296
1423
|
let s = "String", l = "";
|
|
1297
|
-
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>`;
|
|
1298
1425
|
}
|
|
1299
1426
|
i += "</Row>";
|
|
1300
1427
|
}
|
|
@@ -1303,13 +1430,13 @@ function Kt(a, e, t) {
|
|
|
1303
1430
|
</Worksheet>
|
|
1304
1431
|
</Workbook>`, i;
|
|
1305
1432
|
}
|
|
1306
|
-
function
|
|
1433
|
+
function Gt(a, e) {
|
|
1307
1434
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
|
|
1308
1435
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1309
1436
|
});
|
|
1310
1437
|
we(i, t);
|
|
1311
1438
|
}
|
|
1312
|
-
class bn extends
|
|
1439
|
+
class bn extends _ {
|
|
1313
1440
|
name = "export";
|
|
1314
1441
|
get defaultConfig() {
|
|
1315
1442
|
return {
|
|
@@ -1346,21 +1473,21 @@ class bn extends A {
|
|
|
1346
1473
|
try {
|
|
1347
1474
|
switch (e) {
|
|
1348
1475
|
case "csv": {
|
|
1349
|
-
const l =
|
|
1350
|
-
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);
|
|
1351
1478
|
break;
|
|
1352
1479
|
}
|
|
1353
1480
|
case "excel": {
|
|
1354
|
-
const l =
|
|
1355
|
-
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);
|
|
1356
1483
|
break;
|
|
1357
1484
|
}
|
|
1358
1485
|
case "json": {
|
|
1359
1486
|
const l = o.map((u) => {
|
|
1360
1487
|
const h = {};
|
|
1361
|
-
for (const
|
|
1362
|
-
let
|
|
1363
|
-
n.processCell && (
|
|
1488
|
+
for (const f of r) {
|
|
1489
|
+
let g = u[f.field];
|
|
1490
|
+
n.processCell && (g = n.processCell(g, f.field, u)), h[f.field] = g;
|
|
1364
1491
|
}
|
|
1365
1492
|
return h;
|
|
1366
1493
|
}), d = JSON.stringify(l, null, 2);
|
|
@@ -1403,21 +1530,6 @@ class bn extends A {
|
|
|
1403
1530
|
return this.lastExportInfo;
|
|
1404
1531
|
}
|
|
1405
1532
|
}
|
|
1406
|
-
function Ot(a) {
|
|
1407
|
-
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = a, o = Math.ceil(t / n);
|
|
1408
|
-
let s = Math.floor(i / n) - r;
|
|
1409
|
-
s < 0 && (s = 0);
|
|
1410
|
-
let l = s + o + r * 2;
|
|
1411
|
-
return l > e && (l = e), l === e && s > 0 && (s = Math.max(0, l - o - r * 2)), {
|
|
1412
|
-
start: s,
|
|
1413
|
-
end: l,
|
|
1414
|
-
offsetY: s * n,
|
|
1415
|
-
totalHeight: e * n
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
function Gt(a, e) {
|
|
1419
|
-
return a <= e;
|
|
1420
|
-
}
|
|
1421
1533
|
function Bt(a, e, t = !1) {
|
|
1422
1534
|
const i = a[e.field];
|
|
1423
1535
|
if (e.operator === "blank")
|
|
@@ -1479,7 +1591,7 @@ function Ie(a, e) {
|
|
|
1479
1591
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1480
1592
|
}
|
|
1481
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)}}";
|
|
1482
|
-
class
|
|
1594
|
+
class q extends _ {
|
|
1483
1595
|
static manifest = {
|
|
1484
1596
|
events: [
|
|
1485
1597
|
{
|
|
@@ -1526,7 +1638,7 @@ class N extends A {
|
|
|
1526
1638
|
return t;
|
|
1527
1639
|
}
|
|
1528
1640
|
}
|
|
1529
|
-
return
|
|
1641
|
+
return q.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1530
1642
|
}
|
|
1531
1643
|
syncExcludedValues(e, t) {
|
|
1532
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);
|
|
@@ -1555,7 +1667,7 @@ class N extends A {
|
|
|
1555
1667
|
const n = i.getAttribute("data-col");
|
|
1556
1668
|
if (n === null) return;
|
|
1557
1669
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1558
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1670
|
+
if (!r || !this.isColumnFilterable(r) || H(r)) return;
|
|
1559
1671
|
const o = r.field;
|
|
1560
1672
|
if (!o) return;
|
|
1561
1673
|
const s = this.filters.has(o);
|
|
@@ -1705,11 +1817,11 @@ class N extends A {
|
|
|
1705
1817
|
}
|
|
1706
1818
|
static supportsAnchorPositioning = null;
|
|
1707
1819
|
static checkAnchorPositioningSupport() {
|
|
1708
|
-
return
|
|
1820
|
+
return q.supportsAnchorPositioning === null && (q.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), q.supportsAnchorPositioning;
|
|
1709
1821
|
}
|
|
1710
1822
|
positionPanel(e, t) {
|
|
1711
1823
|
const n = t.closest(".cell") ?? t;
|
|
1712
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1824
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, q.checkAnchorPositioningSupport()) {
|
|
1713
1825
|
requestAnimationFrame(() => {
|
|
1714
1826
|
const o = e.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
1715
1827
|
o.top < s.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1735,198 +1847,198 @@ class N extends A {
|
|
|
1735
1847
|
u.type = "checkbox", u.className = "tbw-filter-checkbox";
|
|
1736
1848
|
const h = document.createElement("span");
|
|
1737
1849
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1738
|
-
const
|
|
1739
|
-
const
|
|
1740
|
-
u.checked =
|
|
1850
|
+
const f = () => {
|
|
1851
|
+
const C = [...b.values()], k = C.every((m) => m), L = C.every((m) => !m);
|
|
1852
|
+
u.checked = k, u.indeterminate = !k && !L;
|
|
1741
1853
|
};
|
|
1742
1854
|
u.addEventListener("change", () => {
|
|
1743
|
-
const
|
|
1744
|
-
for (const
|
|
1745
|
-
b.set(
|
|
1746
|
-
|
|
1855
|
+
const C = u.checked;
|
|
1856
|
+
for (const k of b.keys())
|
|
1857
|
+
b.set(k, C);
|
|
1858
|
+
f(), E();
|
|
1747
1859
|
}), e.appendChild(d);
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1860
|
+
const g = document.createElement("div");
|
|
1861
|
+
g.className = "tbw-filter-values";
|
|
1750
1862
|
const p = document.createElement("div");
|
|
1751
|
-
p.className = "tbw-filter-values-spacer",
|
|
1863
|
+
p.className = "tbw-filter-values-spacer", g.appendChild(p);
|
|
1752
1864
|
const w = document.createElement("div");
|
|
1753
|
-
w.className = "tbw-filter-values-content",
|
|
1865
|
+
w.className = "tbw-filter-values-content", g.appendChild(w);
|
|
1754
1866
|
const b = /* @__PURE__ */ new Map();
|
|
1755
|
-
i.forEach((
|
|
1756
|
-
const
|
|
1757
|
-
b.set(
|
|
1758
|
-
}),
|
|
1759
|
-
let
|
|
1760
|
-
const
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
const
|
|
1764
|
-
|
|
1765
|
-
b.set(m,
|
|
1867
|
+
i.forEach((C) => {
|
|
1868
|
+
const k = C == null ? "__null__" : String(C);
|
|
1869
|
+
b.set(k, !n.has(C));
|
|
1870
|
+
}), f();
|
|
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();
|
|
1766
1878
|
});
|
|
1767
|
-
const
|
|
1768
|
-
return
|
|
1769
|
-
},
|
|
1770
|
-
const
|
|
1771
|
-
if (p.style.height = `${
|
|
1772
|
-
w.innerHTML = "", w.style.transform = "translateY(0px)",
|
|
1773
|
-
w.appendChild(
|
|
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));
|
|
1774
1886
|
});
|
|
1775
1887
|
return;
|
|
1776
1888
|
}
|
|
1777
|
-
const m =
|
|
1778
|
-
totalRows:
|
|
1779
|
-
viewportHeight:
|
|
1780
|
-
scrollTop:
|
|
1889
|
+
const m = gt({
|
|
1890
|
+
totalRows: C,
|
|
1891
|
+
viewportHeight: k,
|
|
1892
|
+
scrollTop: L,
|
|
1781
1893
|
rowHeight: o,
|
|
1782
|
-
overscan:
|
|
1894
|
+
overscan: q.LIST_OVERSCAN
|
|
1783
1895
|
});
|
|
1784
1896
|
w.style.transform = `translateY(${m.offsetY}px)`, w.innerHTML = "";
|
|
1785
|
-
for (let
|
|
1786
|
-
w.appendChild(
|
|
1787
|
-
},
|
|
1788
|
-
const
|
|
1789
|
-
if (
|
|
1790
|
-
const
|
|
1791
|
-
return !
|
|
1792
|
-
}),
|
|
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) {
|
|
1793
1905
|
p.style.height = "0px", w.innerHTML = "";
|
|
1794
1906
|
const m = document.createElement("div");
|
|
1795
1907
|
m.className = "tbw-filter-no-match", m.textContent = "No matching values", w.appendChild(m);
|
|
1796
1908
|
return;
|
|
1797
1909
|
}
|
|
1798
|
-
|
|
1910
|
+
E();
|
|
1799
1911
|
};
|
|
1800
|
-
|
|
1912
|
+
g.addEventListener(
|
|
1801
1913
|
"scroll",
|
|
1802
1914
|
() => {
|
|
1803
|
-
|
|
1915
|
+
y.length > 0 && E();
|
|
1804
1916
|
},
|
|
1805
1917
|
{ passive: !0 }
|
|
1806
|
-
),
|
|
1807
|
-
let
|
|
1918
|
+
), R(l.value), e.appendChild(g);
|
|
1919
|
+
let D;
|
|
1808
1920
|
l.addEventListener("input", () => {
|
|
1809
|
-
clearTimeout(
|
|
1810
|
-
this.searchText.set(r, l.value),
|
|
1921
|
+
clearTimeout(D), D = setTimeout(() => {
|
|
1922
|
+
this.searchText.set(r, l.value), R(l.value);
|
|
1811
1923
|
}, this.config.debounceMs ?? 150);
|
|
1812
1924
|
});
|
|
1813
1925
|
const I = document.createElement("div");
|
|
1814
1926
|
I.className = "tbw-filter-buttons";
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
const
|
|
1818
|
-
for (const [
|
|
1819
|
-
if (!
|
|
1820
|
-
if (
|
|
1821
|
-
|
|
1927
|
+
const P = document.createElement("button");
|
|
1928
|
+
P.className = "tbw-filter-apply-btn", P.textContent = "Apply", P.addEventListener("click", () => {
|
|
1929
|
+
const C = [];
|
|
1930
|
+
for (const [k, L] of b)
|
|
1931
|
+
if (!L)
|
|
1932
|
+
if (k === "__null__")
|
|
1933
|
+
C.push(null);
|
|
1822
1934
|
else {
|
|
1823
|
-
const m = i.find((
|
|
1824
|
-
|
|
1935
|
+
const m = i.find((x) => String(x) === k);
|
|
1936
|
+
C.push(m !== void 0 ? m : k);
|
|
1825
1937
|
}
|
|
1826
|
-
t.applySetFilter(
|
|
1827
|
-
}), I.appendChild(
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1938
|
+
t.applySetFilter(C);
|
|
1939
|
+
}), I.appendChild(P);
|
|
1940
|
+
const S = document.createElement("button");
|
|
1941
|
+
S.className = "tbw-filter-clear-btn", S.textContent = "Clear Filter", S.addEventListener("click", () => {
|
|
1830
1942
|
t.clearFilter();
|
|
1831
|
-
}), I.appendChild(
|
|
1943
|
+
}), I.appendChild(S), e.appendChild(I);
|
|
1832
1944
|
}
|
|
1833
1945
|
renderNumberFilterPanel(e, t, i) {
|
|
1834
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (
|
|
1835
|
-
if (typeof
|
|
1836
|
-
if (typeof
|
|
1837
|
-
const
|
|
1838
|
-
return isNaN(
|
|
1946
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A, z) => {
|
|
1947
|
+
if (typeof A == "number") return A;
|
|
1948
|
+
if (typeof A == "string") {
|
|
1949
|
+
const j = parseFloat(A);
|
|
1950
|
+
return isNaN(j) ? z : j;
|
|
1839
1951
|
}
|
|
1840
|
-
return
|
|
1841
|
-
}, d = i.filter((
|
|
1842
|
-
let w = h, b =
|
|
1843
|
-
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo,
|
|
1952
|
+
return z;
|
|
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);
|
|
1954
|
+
let w = h, b = f;
|
|
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";
|
|
1844
1958
|
const v = document.createElement("div");
|
|
1845
|
-
v.className = "tbw-filter-range-
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1852
|
-
const P = document.createElement("span");
|
|
1853
|
-
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
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);
|
|
1964
|
+
const D = document.createElement("span");
|
|
1965
|
+
D.className = "tbw-filter-range-separator", D.textContent = "–", y.appendChild(D);
|
|
1854
1966
|
const I = document.createElement("div");
|
|
1855
1967
|
I.className = "tbw-filter-range-group";
|
|
1856
|
-
const
|
|
1857
|
-
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1968
|
+
const P = document.createElement("label");
|
|
1969
|
+
P.textContent = "Max", P.className = "tbw-filter-range-label";
|
|
1970
|
+
const S = document.createElement("input");
|
|
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);
|
|
1972
|
+
const C = document.createElement("div");
|
|
1973
|
+
C.className = "tbw-filter-range-slider";
|
|
1974
|
+
const k = document.createElement("div");
|
|
1975
|
+
k.className = "tbw-filter-range-track";
|
|
1976
|
+
const L = document.createElement("div");
|
|
1977
|
+
L.className = "tbw-filter-range-fill";
|
|
1866
1978
|
const m = document.createElement("input");
|
|
1867
|
-
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
const
|
|
1871
|
-
const
|
|
1872
|
-
|
|
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);
|
|
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}%`;
|
|
1873
1985
|
};
|
|
1874
1986
|
m.addEventListener("input", () => {
|
|
1875
|
-
const
|
|
1876
|
-
m.value = String(
|
|
1877
|
-
}),
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
}), E.addEventListener("input", () => {
|
|
1881
|
-
let k = parseFloat(E.value) || h;
|
|
1882
|
-
k = Math.max(h, Math.min(k, parseFloat(R.value))), m.value = String(k), L();
|
|
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();
|
|
1883
1992
|
}), R.addEventListener("input", () => {
|
|
1884
|
-
let
|
|
1885
|
-
|
|
1886
|
-
}),
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
t.applyTextFilter("between", k, K);
|
|
1893
|
-
}), H.appendChild(Y);
|
|
1993
|
+
let A = parseFloat(R.value) || h;
|
|
1994
|
+
A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), T();
|
|
1995
|
+
}), S.addEventListener("input", () => {
|
|
1996
|
+
let A = parseFloat(S.value) || f;
|
|
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";
|
|
1894
2001
|
const X = document.createElement("button");
|
|
1895
|
-
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", () => {
|
|
1896
2008
|
t.clearFilter();
|
|
1897
|
-
}),
|
|
2009
|
+
}), K.appendChild(Z), e.appendChild(K);
|
|
1898
2010
|
}
|
|
1899
2011
|
renderDateFilterPanel(e, t, i) {
|
|
1900
|
-
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)) : "" : "",
|
|
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);
|
|
1901
2013
|
let w = "", b = "";
|
|
1902
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";
|
|
1903
2017
|
const v = document.createElement("div");
|
|
1904
|
-
v.className = "tbw-filter-date-
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
const P = document.createElement("span");
|
|
1912
|
-
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
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);
|
|
2023
|
+
const D = document.createElement("span");
|
|
2024
|
+
D.className = "tbw-filter-range-separator", D.textContent = "–", y.appendChild(D);
|
|
1913
2025
|
const I = document.createElement("div");
|
|
1914
2026
|
I.className = "tbw-filter-date-group";
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
const m =
|
|
1924
|
-
m &&
|
|
1925
|
-
}),
|
|
1926
|
-
const
|
|
1927
|
-
|
|
2027
|
+
const P = document.createElement("label");
|
|
2028
|
+
P.textContent = "To", P.className = "tbw-filter-range-label";
|
|
2029
|
+
const S = document.createElement("input");
|
|
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);
|
|
2031
|
+
const C = document.createElement("div");
|
|
2032
|
+
C.className = "tbw-filter-buttons";
|
|
2033
|
+
const k = document.createElement("button");
|
|
2034
|
+
k.className = "tbw-filter-apply-btn", k.textContent = "Apply", k.addEventListener("click", () => {
|
|
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();
|
|
2037
|
+
}), C.appendChild(k);
|
|
2038
|
+
const L = document.createElement("button");
|
|
2039
|
+
L.className = "tbw-filter-clear-btn", L.textContent = "Clear Filter", L.addEventListener("click", () => {
|
|
1928
2040
|
t.clearFilter();
|
|
1929
|
-
}),
|
|
2041
|
+
}), C.appendChild(L), e.appendChild(C);
|
|
1930
2042
|
}
|
|
1931
2043
|
applySetFilter(e, t) {
|
|
1932
2044
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -2059,7 +2171,7 @@ function Xt(a) {
|
|
|
2059
2171
|
return a.some((e) => e.group != null);
|
|
2060
2172
|
}
|
|
2061
2173
|
const Zt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
|
|
2062
|
-
class vn extends
|
|
2174
|
+
class vn extends _ {
|
|
2063
2175
|
static manifest = {
|
|
2064
2176
|
ownedProperties: [
|
|
2065
2177
|
{
|
|
@@ -2129,9 +2241,9 @@ class vn extends A {
|
|
|
2129
2241
|
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2130
2242
|
}
|
|
2131
2243
|
const o = e.querySelector(".header-row");
|
|
2132
|
-
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);
|
|
2133
2245
|
}
|
|
2134
|
-
#
|
|
2246
|
+
#t(e) {
|
|
2135
2247
|
if (!this.config.showGroupBorders) return;
|
|
2136
2248
|
const t = this.gridElement;
|
|
2137
2249
|
if (!t) return;
|
|
@@ -2169,10 +2281,10 @@ function Pe({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2169
2281
|
let c = n(d);
|
|
2170
2282
|
c == null || c === !1 ? c = ["__ungrouped__"] : Array.isArray(c) || (c = [c]);
|
|
2171
2283
|
let u = r;
|
|
2172
|
-
c.forEach((h,
|
|
2173
|
-
const
|
|
2174
|
-
let w = u.children.get(
|
|
2175
|
-
w || (w = { key: p, value: h, depth:
|
|
2284
|
+
c.forEach((h, f) => {
|
|
2285
|
+
const g = h == null ? "∅" : String(h), p = u.key === "__root__" ? g : u.key + "||" + g;
|
|
2286
|
+
let w = u.children.get(g);
|
|
2287
|
+
w || (w = { key: p, value: h, depth: f, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(g, w)), u = w;
|
|
2176
2288
|
}), u.rows.push(d);
|
|
2177
2289
|
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === a.length)
|
|
2178
2290
|
return [];
|
|
@@ -2224,7 +2336,7 @@ function ni(a) {
|
|
|
2224
2336
|
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2225
2337
|
}
|
|
2226
2338
|
const ri = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
2227
|
-
class yn extends
|
|
2339
|
+
class yn extends _ {
|
|
2228
2340
|
static manifest = {
|
|
2229
2341
|
events: [
|
|
2230
2342
|
{
|
|
@@ -2274,6 +2386,10 @@ class yn extends A {
|
|
|
2274
2386
|
detach() {
|
|
2275
2387
|
this.expandedKeys.clear(), this.flattenedRows = [], this.isActive = !1, this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.hasAppliedDefaultExpanded = !1;
|
|
2276
2388
|
}
|
|
2389
|
+
getRowHeight(e, t) {
|
|
2390
|
+
if (this.config.groupRowHeight != null && e.__isGroupRow === !0)
|
|
2391
|
+
return this.config.groupRowHeight;
|
|
2392
|
+
}
|
|
2277
2393
|
handleQuery(e) {
|
|
2278
2394
|
if (e.type === "canMoveRow" && e.context?.__isGroupRow === !0)
|
|
2279
2395
|
return !1;
|
|
@@ -2317,7 +2433,8 @@ class yn extends A {
|
|
|
2317
2433
|
__groupDepth: s.depth,
|
|
2318
2434
|
__groupRows: s.rows,
|
|
2319
2435
|
__groupExpanded: s.expanded,
|
|
2320
|
-
__groupRowCount: ni(s)
|
|
2436
|
+
__groupRowCount: ni(s),
|
|
2437
|
+
__rowCacheKey: `group:${s.key}`
|
|
2321
2438
|
} : s.row);
|
|
2322
2439
|
}
|
|
2323
2440
|
onCellClick(e) {
|
|
@@ -2389,12 +2506,12 @@ class yn extends A {
|
|
|
2389
2506
|
const c = document.createElement("span");
|
|
2390
2507
|
c.className = "group-aggregates";
|
|
2391
2508
|
for (const [u, h] of d) {
|
|
2392
|
-
const
|
|
2393
|
-
if (
|
|
2509
|
+
const f = this.columns.find((p) => p.field === u), g = te(h, o, u, f);
|
|
2510
|
+
if (g != null) {
|
|
2394
2511
|
const p = document.createElement("span");
|
|
2395
2512
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
2396
|
-
const w =
|
|
2397
|
-
p.textContent = `${w}: ${
|
|
2513
|
+
const w = f?.header ?? u;
|
|
2514
|
+
p.textContent = `${w}: ${g}`, c.appendChild(p);
|
|
2398
2515
|
}
|
|
2399
2516
|
}
|
|
2400
2517
|
c.children.length > 0 && s.appendChild(c);
|
|
@@ -2406,32 +2523,32 @@ class yn extends A {
|
|
|
2406
2523
|
d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
|
|
2407
2524
|
let c = !1;
|
|
2408
2525
|
o.forEach((u, h) => {
|
|
2409
|
-
const
|
|
2410
|
-
if (
|
|
2411
|
-
|
|
2526
|
+
const f = document.createElement("div");
|
|
2527
|
+
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), pe(u)) {
|
|
2528
|
+
f.setAttribute("data-field", u.field), t.appendChild(f);
|
|
2412
2529
|
return;
|
|
2413
2530
|
}
|
|
2414
2531
|
if (c) {
|
|
2415
|
-
const
|
|
2416
|
-
if (
|
|
2417
|
-
const p =
|
|
2418
|
-
|
|
2532
|
+
const g = r[u.field];
|
|
2533
|
+
if (g) {
|
|
2534
|
+
const p = te(g, s, u.field, u);
|
|
2535
|
+
f.textContent = p != null ? String(p) : "";
|
|
2419
2536
|
} else
|
|
2420
|
-
|
|
2537
|
+
f.textContent = "";
|
|
2421
2538
|
} else {
|
|
2422
|
-
c = !0,
|
|
2423
|
-
const
|
|
2539
|
+
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2540
|
+
const g = document.createElement("span"), p = r[u.field];
|
|
2424
2541
|
if (p) {
|
|
2425
|
-
const w =
|
|
2426
|
-
|
|
2542
|
+
const w = te(p, s, u.field, u);
|
|
2543
|
+
g.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2427
2544
|
} else
|
|
2428
|
-
|
|
2429
|
-
if (
|
|
2545
|
+
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
2546
|
+
if (f.appendChild(g), n.showRowCount !== !1) {
|
|
2430
2547
|
const w = document.createElement("span");
|
|
2431
|
-
w.className = "group-count", w.textContent = ` (${s.length})`,
|
|
2548
|
+
w.className = "group-count", w.textContent = ` (${s.length})`, f.appendChild(w);
|
|
2432
2549
|
}
|
|
2433
2550
|
}
|
|
2434
|
-
t.appendChild(
|
|
2551
|
+
t.appendChild(f);
|
|
2435
2552
|
});
|
|
2436
2553
|
}
|
|
2437
2554
|
expandAll() {
|
|
@@ -2527,7 +2644,7 @@ function li(a, e, t, i) {
|
|
|
2527
2644
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2528
2645
|
}
|
|
2529
2646
|
const di = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
2530
|
-
class nt extends
|
|
2647
|
+
class nt extends _ {
|
|
2531
2648
|
name = "masterDetail";
|
|
2532
2649
|
styles = di;
|
|
2533
2650
|
get defaultConfig() {
|
|
@@ -2558,8 +2675,8 @@ class nt extends A {
|
|
|
2558
2675
|
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), s !== null && (d.collapseOnClickOutside = s === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
|
|
2559
2676
|
const c = t.innerHTML.trim();
|
|
2560
2677
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2561
|
-
const
|
|
2562
|
-
return et(
|
|
2678
|
+
const f = Je(c, { value: u, row: u });
|
|
2679
|
+
return et(f);
|
|
2563
2680
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2564
2681
|
}
|
|
2565
2682
|
get animationStyle() {
|
|
@@ -2587,10 +2704,17 @@ class nt extends A {
|
|
|
2587
2704
|
}
|
|
2588
2705
|
expandedRows = /* @__PURE__ */ new Set();
|
|
2589
2706
|
detailElements = /* @__PURE__ */ new Map();
|
|
2707
|
+
measuredDetailHeights = /* @__PURE__ */ new Map();
|
|
2590
2708
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2591
2709
|
getDetailHeight(e) {
|
|
2592
2710
|
const t = this.detailElements.get(e);
|
|
2593
|
-
|
|
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;
|
|
2594
2718
|
}
|
|
2595
2719
|
toggleAndEmit(e, t) {
|
|
2596
2720
|
this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
|
|
@@ -2600,15 +2724,15 @@ class nt extends A {
|
|
|
2600
2724
|
}), this.requestRender();
|
|
2601
2725
|
}
|
|
2602
2726
|
detach() {
|
|
2603
|
-
this.expandedRows.clear(), this.detailElements.clear();
|
|
2727
|
+
this.expandedRows.clear(), this.detailElements.clear(), this.measuredDetailHeights.clear();
|
|
2604
2728
|
}
|
|
2605
2729
|
processColumns(e) {
|
|
2606
2730
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2607
2731
|
return [...e];
|
|
2608
2732
|
const i = [...e];
|
|
2609
|
-
if (
|
|
2733
|
+
if (vt(i))
|
|
2610
2734
|
return i;
|
|
2611
|
-
const r =
|
|
2735
|
+
const r = yt(this.name);
|
|
2612
2736
|
return r.viewRenderer = (o) => {
|
|
2613
2737
|
const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
|
|
2614
2738
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2623,7 +2747,7 @@ class nt extends A {
|
|
|
2623
2747
|
onCellClick(e) {
|
|
2624
2748
|
if (e.originalEvent?.target?.classList.contains("master-detail-toggle"))
|
|
2625
2749
|
return this.toggleAndEmit(e.row, e.rowIndex), !0;
|
|
2626
|
-
this.expandedRows.size > 0 && queueMicrotask(() => this.#
|
|
2750
|
+
this.expandedRows.size > 0 && queueMicrotask(() => this.#t());
|
|
2627
2751
|
}
|
|
2628
2752
|
onKeyDown(e) {
|
|
2629
2753
|
if (e.key !== " ") return;
|
|
@@ -2634,12 +2758,12 @@ class nt extends A {
|
|
|
2634
2758
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
2635
2759
|
}
|
|
2636
2760
|
afterRender() {
|
|
2637
|
-
this.#
|
|
2761
|
+
this.#t();
|
|
2638
2762
|
}
|
|
2639
2763
|
onScrollRender() {
|
|
2640
|
-
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#
|
|
2764
|
+
!this.config.detailRenderer || this.expandedRows.size === 0 || this.#t();
|
|
2641
2765
|
}
|
|
2642
|
-
#
|
|
2766
|
+
#t() {
|
|
2643
2767
|
if (!this.config.detailRenderer) return;
|
|
2644
2768
|
const e = this.gridElement?.querySelector(".rows");
|
|
2645
2769
|
if (!e) return;
|
|
@@ -2662,7 +2786,15 @@ class nt extends A {
|
|
|
2662
2786
|
continue;
|
|
2663
2787
|
}
|
|
2664
2788
|
const c = li(l, o, this.config.detailRenderer, n);
|
|
2665
|
-
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);
|
|
2666
2798
|
}
|
|
2667
2799
|
}
|
|
2668
2800
|
getExtraHeight() {
|
|
@@ -2679,6 +2811,12 @@ class nt extends A {
|
|
|
2679
2811
|
}
|
|
2680
2812
|
return t;
|
|
2681
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
|
+
}
|
|
2682
2820
|
adjustVirtualStart(e, t, i) {
|
|
2683
2821
|
if (this.expandedRows.size === 0) return e;
|
|
2684
2822
|
const n = [];
|
|
@@ -2762,10 +2900,10 @@ function Me(a, e) {
|
|
|
2762
2900
|
function Ne(a, e) {
|
|
2763
2901
|
return a.find((t) => t.field === e)?.direction;
|
|
2764
2902
|
}
|
|
2765
|
-
const
|
|
2766
|
-
class xn extends
|
|
2903
|
+
const fi = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2904
|
+
class xn extends _ {
|
|
2767
2905
|
name = "multiSort";
|
|
2768
|
-
styles =
|
|
2906
|
+
styles = fi;
|
|
2769
2907
|
get defaultConfig() {
|
|
2770
2908
|
return {
|
|
2771
2909
|
maxSortColumns: 3,
|
|
@@ -2796,10 +2934,10 @@ class xn extends A {
|
|
|
2796
2934
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
|
|
2797
2935
|
const c = document.createElement("span");
|
|
2798
2936
|
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(s === "asc" ? "sortAsc" : "sortDesc"));
|
|
2799
|
-
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"),
|
|
2800
|
-
if (
|
|
2801
|
-
const
|
|
2802
|
-
|
|
2937
|
+
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), f = u ?? h;
|
|
2938
|
+
if (f ? n.insertBefore(c, f) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
|
|
2939
|
+
const g = document.createElement("span");
|
|
2940
|
+
g.className = "sort-index", g.textContent = String(o), c.nextSibling ? n.insertBefore(g, c.nextSibling) : n.appendChild(g);
|
|
2803
2941
|
}
|
|
2804
2942
|
} else
|
|
2805
2943
|
n.removeAttribute("data-sort");
|
|
@@ -2842,7 +2980,7 @@ class xn extends A {
|
|
|
2842
2980
|
}
|
|
2843
2981
|
}
|
|
2844
2982
|
function rt(a, e) {
|
|
2845
|
-
return
|
|
2983
|
+
return pt(a, e);
|
|
2846
2984
|
}
|
|
2847
2985
|
function ot(a, e) {
|
|
2848
2986
|
const t = a.sticky;
|
|
@@ -2852,7 +2990,7 @@ function st(a, e) {
|
|
|
2852
2990
|
const t = a.sticky;
|
|
2853
2991
|
return t ? rt(t, e) === "right" : !1;
|
|
2854
2992
|
}
|
|
2855
|
-
function
|
|
2993
|
+
function gi(a, e = "ltr") {
|
|
2856
2994
|
return a.filter((t) => ot(t, e));
|
|
2857
2995
|
}
|
|
2858
2996
|
function pi(a, e = "ltr") {
|
|
@@ -2893,7 +3031,7 @@ function He(a) {
|
|
|
2893
3031
|
});
|
|
2894
3032
|
}
|
|
2895
3033
|
const Ke = "canMoveColumn";
|
|
2896
|
-
class Cn extends
|
|
3034
|
+
class Cn extends _ {
|
|
2897
3035
|
static manifest = {
|
|
2898
3036
|
ownedProperties: [
|
|
2899
3037
|
{
|
|
@@ -2967,7 +3105,7 @@ class Cn extends A {
|
|
|
2967
3105
|
}
|
|
2968
3106
|
getLeftPinnedColumns() {
|
|
2969
3107
|
const e = [...this.columns], t = ue(this.grid);
|
|
2970
|
-
return
|
|
3108
|
+
return gi(e, t);
|
|
2971
3109
|
}
|
|
2972
3110
|
getRightPinnedColumns() {
|
|
2973
3111
|
const e = [...this.columns], t = ue(this.grid);
|
|
@@ -3086,7 +3224,7 @@ function Ge(a, e, t, i, n) {
|
|
|
3086
3224
|
};
|
|
3087
3225
|
}
|
|
3088
3226
|
const bi = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
3089
|
-
class En extends
|
|
3227
|
+
class En extends _ {
|
|
3090
3228
|
name = "pinnedRows";
|
|
3091
3229
|
styles = bi;
|
|
3092
3230
|
get defaultConfig() {
|
|
@@ -3192,7 +3330,7 @@ class En extends A {
|
|
|
3192
3330
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3193
3331
|
}
|
|
3194
3332
|
}
|
|
3195
|
-
const vi =
|
|
3333
|
+
const vi = mt;
|
|
3196
3334
|
function yi(a) {
|
|
3197
3335
|
const e = [];
|
|
3198
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;
|
|
@@ -3237,38 +3375,38 @@ function Ei(a, e) {
|
|
|
3237
3375
|
function at(a, e, t, i, n, r, o) {
|
|
3238
3376
|
const s = [];
|
|
3239
3377
|
if (e.length === 0) {
|
|
3240
|
-
const h = Be(a, t, i, n),
|
|
3378
|
+
const h = Be(a, t, i, n), f = Ve(h);
|
|
3241
3379
|
return s.push({
|
|
3242
3380
|
rowKey: o || "all",
|
|
3243
3381
|
rowLabel: o || "All",
|
|
3244
3382
|
depth: r,
|
|
3245
3383
|
values: h,
|
|
3246
|
-
total:
|
|
3384
|
+
total: f,
|
|
3247
3385
|
isGroup: !1,
|
|
3248
3386
|
rowCount: a.length
|
|
3249
3387
|
}), s;
|
|
3250
3388
|
}
|
|
3251
3389
|
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
|
|
3252
|
-
for (const [h,
|
|
3253
|
-
const
|
|
3390
|
+
for (const [h, f] of u) {
|
|
3391
|
+
const g = o ? `${o}|${h}` : h, p = Be(f, t, i, n), w = Ve(p);
|
|
3254
3392
|
let b;
|
|
3255
3393
|
c && (b = at(
|
|
3256
|
-
|
|
3394
|
+
f,
|
|
3257
3395
|
d,
|
|
3258
3396
|
t,
|
|
3259
3397
|
i,
|
|
3260
3398
|
n,
|
|
3261
3399
|
r + 1,
|
|
3262
|
-
|
|
3400
|
+
g
|
|
3263
3401
|
)), s.push({
|
|
3264
|
-
rowKey:
|
|
3402
|
+
rowKey: g,
|
|
3265
3403
|
rowLabel: h || "(blank)",
|
|
3266
3404
|
depth: r,
|
|
3267
3405
|
values: p,
|
|
3268
3406
|
total: w,
|
|
3269
3407
|
isGroup: c,
|
|
3270
3408
|
children: b,
|
|
3271
|
-
rowCount:
|
|
3409
|
+
rowCount: f.length
|
|
3272
3410
|
});
|
|
3273
3411
|
}
|
|
3274
3412
|
return s;
|
|
@@ -3277,7 +3415,7 @@ function Be(a, e, t, i) {
|
|
|
3277
3415
|
const n = {};
|
|
3278
3416
|
for (const r of t)
|
|
3279
3417
|
for (const o of i) {
|
|
3280
|
-
const l = (e.length > 0 ? a.filter((h) => e.map((
|
|
3418
|
+
const l = (e.length > 0 ? a.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d = vi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
|
|
3281
3419
|
n[u] = c;
|
|
3282
3420
|
}
|
|
3283
3421
|
return n;
|
|
@@ -3329,11 +3467,11 @@ function ki(a) {
|
|
|
3329
3467
|
const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3330
3468
|
function _i(a, e, t, i) {
|
|
3331
3469
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3332
|
-
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), () => {
|
|
3333
3471
|
n.abort(), o.remove();
|
|
3334
3472
|
};
|
|
3335
3473
|
}
|
|
3336
|
-
function
|
|
3474
|
+
function Y(a, e) {
|
|
3337
3475
|
const t = document.createElement("div");
|
|
3338
3476
|
t.className = "tbw-pivot-section";
|
|
3339
3477
|
const i = document.createElement("div");
|
|
@@ -3350,7 +3488,7 @@ function We(a, e) {
|
|
|
3350
3488
|
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3351
3489
|
} else
|
|
3352
3490
|
for (const s of o)
|
|
3353
|
-
r.appendChild(
|
|
3491
|
+
r.appendChild(Li(s, a, e));
|
|
3354
3492
|
return r.addEventListener(
|
|
3355
3493
|
"dragover",
|
|
3356
3494
|
(s) => {
|
|
@@ -3373,7 +3511,7 @@ function We(a, e) {
|
|
|
3373
3511
|
{ signal: n }
|
|
3374
3512
|
), r;
|
|
3375
3513
|
}
|
|
3376
|
-
function
|
|
3514
|
+
function Li(a, e, t) {
|
|
3377
3515
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3378
3516
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3379
3517
|
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
@@ -3399,7 +3537,7 @@ function Ti(a, e, t) {
|
|
|
3399
3537
|
{ signal: n }
|
|
3400
3538
|
), r;
|
|
3401
3539
|
}
|
|
3402
|
-
function
|
|
3540
|
+
function Ti(a) {
|
|
3403
3541
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3404
3542
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3405
3543
|
const r = e.valueFields ?? [];
|
|
@@ -3579,7 +3717,7 @@ function Ni(a, e, t) {
|
|
|
3579
3717
|
}), !0;
|
|
3580
3718
|
}
|
|
3581
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}}}';
|
|
3582
|
-
class
|
|
3720
|
+
class B extends _ {
|
|
3583
3721
|
name = "pivot";
|
|
3584
3722
|
styles = qi;
|
|
3585
3723
|
static PANEL_ID = "pivot";
|
|
@@ -3616,7 +3754,7 @@ class G extends A {
|
|
|
3616
3754
|
getToolPanel() {
|
|
3617
3755
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3618
3756
|
return {
|
|
3619
|
-
id:
|
|
3757
|
+
id: B.PANEL_ID,
|
|
3620
3758
|
title: "Pivot",
|
|
3621
3759
|
icon: "⊞",
|
|
3622
3760
|
tooltip: "Configure pivot table",
|
|
@@ -3781,16 +3919,16 @@ class G extends A {
|
|
|
3781
3919
|
this.pivotResult = null, this.requestRender();
|
|
3782
3920
|
}
|
|
3783
3921
|
showPanel() {
|
|
3784
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3922
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(B.PANEL_ID) || this.grid.toggleToolPanelSection(B.PANEL_ID);
|
|
3785
3923
|
}
|
|
3786
3924
|
hidePanel() {
|
|
3787
3925
|
this.grid.closeToolPanel();
|
|
3788
3926
|
}
|
|
3789
3927
|
togglePanel() {
|
|
3790
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3928
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(B.PANEL_ID);
|
|
3791
3929
|
}
|
|
3792
3930
|
isPanelVisible() {
|
|
3793
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3931
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(B.PANEL_ID);
|
|
3794
3932
|
}
|
|
3795
3933
|
get gridColumns() {
|
|
3796
3934
|
return this.grid.columns ?? [];
|
|
@@ -3867,10 +4005,10 @@ class G extends A {
|
|
|
3867
4005
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3868
4006
|
}
|
|
3869
4007
|
}
|
|
3870
|
-
const
|
|
4008
|
+
const J = "tbw-print-isolation-style";
|
|
3871
4009
|
function Hi(a, e) {
|
|
3872
4010
|
const t = document.createElement("style");
|
|
3873
|
-
return t.id =
|
|
4011
|
+
return t.id = J, t.textContent = `
|
|
3874
4012
|
/* Print isolation: hide everything except the target grid */
|
|
3875
4013
|
@media print {
|
|
3876
4014
|
/* Hide all body children by default */
|
|
@@ -3946,14 +4084,14 @@ async function Ki(a, e = {}) {
|
|
|
3946
4084
|
const { orientation: t = "landscape" } = e, i = a.id;
|
|
3947
4085
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3948
4086
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3949
|
-
), document.getElementById(
|
|
4087
|
+
), document.getElementById(J)?.remove();
|
|
3950
4088
|
const r = Hi(i, t);
|
|
3951
4089
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3952
4090
|
const s = () => {
|
|
3953
|
-
window.removeEventListener("afterprint", s), document.getElementById(
|
|
4091
|
+
window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
|
|
3954
4092
|
};
|
|
3955
4093
|
window.addEventListener("afterprint", s), window.print(), setTimeout(() => {
|
|
3956
|
-
window.removeEventListener("afterprint", s), document.getElementById(
|
|
4094
|
+
window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
|
|
3957
4095
|
}, 5e3);
|
|
3958
4096
|
});
|
|
3959
4097
|
}
|
|
@@ -3967,25 +4105,25 @@ const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3967
4105
|
title: "",
|
|
3968
4106
|
isolate: !1
|
|
3969
4107
|
};
|
|
3970
|
-
class Rn extends
|
|
4108
|
+
class Rn extends _ {
|
|
3971
4109
|
name = "print";
|
|
3972
4110
|
version = "1.0.0";
|
|
3973
4111
|
styles = zi;
|
|
3974
|
-
#
|
|
3975
|
-
#
|
|
4112
|
+
#t = !1;
|
|
4113
|
+
#e = null;
|
|
3976
4114
|
#s = null;
|
|
3977
|
-
#n = null;
|
|
3978
|
-
#i = null;
|
|
3979
4115
|
#o = null;
|
|
3980
|
-
#
|
|
3981
|
-
|
|
4116
|
+
#i = null;
|
|
4117
|
+
#n = null;
|
|
4118
|
+
#u = null;
|
|
4119
|
+
get #l() {
|
|
3982
4120
|
return this.grid;
|
|
3983
4121
|
}
|
|
3984
4122
|
isPrinting() {
|
|
3985
|
-
return this.#
|
|
4123
|
+
return this.#t;
|
|
3986
4124
|
}
|
|
3987
4125
|
async print(e) {
|
|
3988
|
-
if (this.#
|
|
4126
|
+
if (this.#t) {
|
|
3989
4127
|
console.warn("[PrintPlugin] Print already in progress");
|
|
3990
4128
|
return;
|
|
3991
4129
|
}
|
|
@@ -4007,7 +4145,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4007
4145
|
))
|
|
4008
4146
|
return;
|
|
4009
4147
|
}
|
|
4010
|
-
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;
|
|
4011
4149
|
const l = performance.now();
|
|
4012
4150
|
this.emit("print-start", {
|
|
4013
4151
|
rowCount: o,
|
|
@@ -4015,10 +4153,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4015
4153
|
originalRowCount: r
|
|
4016
4154
|
});
|
|
4017
4155
|
try {
|
|
4018
|
-
const d = this.#
|
|
4156
|
+
const d = this.#l;
|
|
4019
4157
|
this.#s = {
|
|
4020
4158
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
4021
|
-
}, 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", {
|
|
4022
4160
|
success: !0,
|
|
4023
4161
|
rowCount: o,
|
|
4024
4162
|
duration: Math.round(performance.now() - l)
|
|
@@ -4030,10 +4168,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4030
4168
|
duration: Math.round(performance.now() - l)
|
|
4031
4169
|
});
|
|
4032
4170
|
} finally {
|
|
4033
|
-
this.#
|
|
4171
|
+
this.#w(), this.#t = !1;
|
|
4034
4172
|
}
|
|
4035
4173
|
}
|
|
4036
|
-
#
|
|
4174
|
+
#r(e) {
|
|
4037
4175
|
const t = this.gridElement;
|
|
4038
4176
|
if (t) {
|
|
4039
4177
|
if (this.#i = document.createElement("div"), this.#i.className = "tbw-print-header", e.includeTitle) {
|
|
@@ -4044,16 +4182,16 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4044
4182
|
const i = document.createElement("div");
|
|
4045
4183
|
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#i.appendChild(i);
|
|
4046
4184
|
}
|
|
4047
|
-
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);
|
|
4048
4186
|
}
|
|
4049
4187
|
}
|
|
4050
|
-
async #
|
|
4051
|
-
const e = this.#
|
|
4188
|
+
async #d() {
|
|
4189
|
+
const e = this.#l;
|
|
4052
4190
|
if (!e._virtualization) return;
|
|
4053
4191
|
const t = this.rows.length;
|
|
4054
4192
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
4055
4193
|
}
|
|
4056
|
-
async #
|
|
4194
|
+
async #f() {
|
|
4057
4195
|
return new Promise((e) => {
|
|
4058
4196
|
const t = () => {
|
|
4059
4197
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -4069,34 +4207,34 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4069
4207
|
orientation: e.orientation
|
|
4070
4208
|
});
|
|
4071
4209
|
}
|
|
4072
|
-
#
|
|
4210
|
+
#v() {
|
|
4073
4211
|
const e = this.columns;
|
|
4074
4212
|
if (e) {
|
|
4075
|
-
this.#
|
|
4213
|
+
this.#e = /* @__PURE__ */ new Map();
|
|
4076
4214
|
for (const t of e)
|
|
4077
|
-
t.printHidden && t.field && (this.#
|
|
4215
|
+
t.printHidden && t.field && (this.#e.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
4078
4216
|
}
|
|
4079
4217
|
}
|
|
4080
|
-
#
|
|
4081
|
-
if (this.#
|
|
4082
|
-
for (const [e, t] of this.#
|
|
4218
|
+
#h() {
|
|
4219
|
+
if (this.#e) {
|
|
4220
|
+
for (const [e, t] of this.#e)
|
|
4083
4221
|
this.grid.setColumnVisible(e, t);
|
|
4084
|
-
this.#
|
|
4222
|
+
this.#e = null;
|
|
4085
4223
|
}
|
|
4086
4224
|
}
|
|
4087
|
-
#
|
|
4225
|
+
#w() {
|
|
4088
4226
|
const e = this.gridElement;
|
|
4089
4227
|
if (!e) return;
|
|
4090
|
-
this.#
|
|
4091
|
-
const t = this.#
|
|
4092
|
-
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), 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);
|
|
4093
4231
|
}
|
|
4094
4232
|
afterRender() {
|
|
4095
|
-
this.config?.button && !this.#
|
|
4233
|
+
this.config?.button && !this.#c && (this.#g(), this.#c = !0);
|
|
4096
4234
|
}
|
|
4097
|
-
#
|
|
4235
|
+
#c = !1;
|
|
4098
4236
|
#g() {
|
|
4099
|
-
this.#
|
|
4237
|
+
this.#l.registerToolbarContent?.({
|
|
4100
4238
|
id: "print-button",
|
|
4101
4239
|
order: 900,
|
|
4102
4240
|
render: (t) => {
|
|
@@ -4124,7 +4262,7 @@ function $e(a, e, t) {
|
|
|
4124
4262
|
return i.splice(t, 0, n), i;
|
|
4125
4263
|
}
|
|
4126
4264
|
const Bi = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
|
|
4127
|
-
class Sn extends
|
|
4265
|
+
class Sn extends _ {
|
|
4128
4266
|
name = "reorder";
|
|
4129
4267
|
styles = Bi;
|
|
4130
4268
|
get defaultConfig() {
|
|
@@ -4190,13 +4328,13 @@ class Sn extends A {
|
|
|
4190
4328
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4191
4329
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4192
4330
|
return;
|
|
4193
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(),
|
|
4331
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = $e(h, d, u), g = {
|
|
4194
4332
|
field: l,
|
|
4195
4333
|
fromIndex: d,
|
|
4196
4334
|
toIndex: u,
|
|
4197
|
-
columnOrder:
|
|
4335
|
+
columnOrder: f
|
|
4198
4336
|
};
|
|
4199
|
-
this.emitCancelable("column-move",
|
|
4337
|
+
this.emitCancelable("column-move", g) || this.updateColumnOrder(f);
|
|
4200
4338
|
}));
|
|
4201
4339
|
});
|
|
4202
4340
|
}
|
|
@@ -4213,7 +4351,7 @@ class Sn extends A {
|
|
|
4213
4351
|
if (l < 0 || l >= o.length) return;
|
|
4214
4352
|
const d = n.find((c) => c.field === o[l]);
|
|
4215
4353
|
if (this.canMoveColumnWithPlugins(d))
|
|
4216
|
-
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;
|
|
4217
4355
|
}
|
|
4218
4356
|
getColumnOrder() {
|
|
4219
4357
|
return this.grid.getColumnOrder();
|
|
@@ -4317,7 +4455,7 @@ class Sn extends A {
|
|
|
4317
4455
|
}
|
|
4318
4456
|
}
|
|
4319
4457
|
const Vi = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-inline-start:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-inline-end:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-inline-end:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
4320
|
-
class kn extends
|
|
4458
|
+
class kn extends _ {
|
|
4321
4459
|
name = "responsive";
|
|
4322
4460
|
version = "1.0.0";
|
|
4323
4461
|
styles = Vi;
|
|
@@ -4335,20 +4473,20 @@ class kn extends A {
|
|
|
4335
4473
|
}
|
|
4336
4474
|
]
|
|
4337
4475
|
};
|
|
4338
|
-
#
|
|
4339
|
-
#
|
|
4476
|
+
#t;
|
|
4477
|
+
#e = !1;
|
|
4340
4478
|
#s;
|
|
4341
|
-
#
|
|
4479
|
+
#o = !1;
|
|
4342
4480
|
#i = 0;
|
|
4343
|
-
#
|
|
4344
|
-
#
|
|
4345
|
-
#
|
|
4346
|
-
#
|
|
4481
|
+
#n = /* @__PURE__ */ new Set();
|
|
4482
|
+
#u = /* @__PURE__ */ new Set();
|
|
4483
|
+
#l = null;
|
|
4484
|
+
#r = [];
|
|
4347
4485
|
isResponsive() {
|
|
4348
|
-
return this.#
|
|
4486
|
+
return this.#e;
|
|
4349
4487
|
}
|
|
4350
4488
|
setResponsive(e) {
|
|
4351
|
-
e !== this.#
|
|
4489
|
+
e !== this.#e && (this.#e = e, this.#w(), this.emit("responsive-change", {
|
|
4352
4490
|
isResponsive: e,
|
|
4353
4491
|
width: this.#i,
|
|
4354
4492
|
breakpoint: this.config.breakpoint ?? 0
|
|
@@ -4358,23 +4496,23 @@ class kn extends A {
|
|
|
4358
4496
|
this.config.breakpoint = e, this.#p(this.#i);
|
|
4359
4497
|
}
|
|
4360
4498
|
setCardRenderer(e) {
|
|
4361
|
-
this.config.cardRenderer = e, this.#
|
|
4499
|
+
this.config.cardRenderer = e, this.#e && this.requestRender();
|
|
4362
4500
|
}
|
|
4363
4501
|
getWidth() {
|
|
4364
4502
|
return this.#i;
|
|
4365
4503
|
}
|
|
4366
4504
|
getActiveBreakpoint() {
|
|
4367
|
-
return this.#
|
|
4505
|
+
return this.#l;
|
|
4368
4506
|
}
|
|
4369
4507
|
attach(e) {
|
|
4370
|
-
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) => {
|
|
4371
4509
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4372
4510
|
this.#i = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
4373
4511
|
this.#p(i);
|
|
4374
4512
|
}, this.config.debounceMs ?? 100);
|
|
4375
|
-
}), this.#
|
|
4513
|
+
}), this.#t.observe(this.gridElement);
|
|
4376
4514
|
}
|
|
4377
|
-
#
|
|
4515
|
+
#d() {
|
|
4378
4516
|
const e = this.grid;
|
|
4379
4517
|
if (!e || typeof e.querySelector != "function") return;
|
|
4380
4518
|
const t = e.querySelector("tbw-grid-responsive-card");
|
|
@@ -4395,83 +4533,83 @@ class kn extends A {
|
|
|
4395
4533
|
}
|
|
4396
4534
|
const c = t.innerHTML.trim();
|
|
4397
4535
|
c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
|
|
4398
|
-
const h = Je(c, { value: u, row: u }),
|
|
4399
|
-
return
|
|
4536
|
+
const h = Je(c, { value: u, row: u }), f = et(h), g = document.createElement("div");
|
|
4537
|
+
return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
|
|
4400
4538
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4401
4539
|
}
|
|
4402
|
-
#
|
|
4403
|
-
if (this.#
|
|
4540
|
+
#f(e) {
|
|
4541
|
+
if (this.#n.clear(), this.#u.clear(), !!e)
|
|
4404
4542
|
for (const t of e)
|
|
4405
|
-
typeof t == "string" ? this.#
|
|
4543
|
+
typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#u.add(t.field) : this.#n.add(t.field);
|
|
4406
4544
|
}
|
|
4407
4545
|
detach() {
|
|
4408
|
-
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();
|
|
4409
4547
|
}
|
|
4410
4548
|
handleQuery(e) {
|
|
4411
4549
|
if (e.type === "isCardMode")
|
|
4412
|
-
return this.#
|
|
4550
|
+
return this.#e;
|
|
4413
4551
|
}
|
|
4414
4552
|
afterRender() {
|
|
4415
|
-
if (this.#R(), !(this.#
|
|
4553
|
+
if (this.#R(), !(this.#r.length > 0 ? this.#l !== null : this.#e))
|
|
4416
4554
|
return;
|
|
4417
|
-
const t = this.#
|
|
4555
|
+
const t = this.#n.size > 0, i = this.#u.size > 0;
|
|
4418
4556
|
if (!t && !i)
|
|
4419
4557
|
return;
|
|
4420
4558
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
4421
4559
|
for (const r of n) {
|
|
4422
4560
|
const o = r.getAttribute("data-field");
|
|
4423
|
-
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")));
|
|
4424
4562
|
}
|
|
4425
4563
|
}
|
|
4426
4564
|
#p(e) {
|
|
4427
|
-
if (this.#
|
|
4428
|
-
this.#
|
|
4565
|
+
if (this.#r.length > 0) {
|
|
4566
|
+
this.#v(e);
|
|
4429
4567
|
return;
|
|
4430
4568
|
}
|
|
4431
4569
|
const t = this.config.breakpoint ?? 0;
|
|
4432
|
-
t === 0 && !this.#
|
|
4570
|
+
t === 0 && !this.#o && (this.#o = !0, console.warn(
|
|
4433
4571
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4434
4572
|
));
|
|
4435
4573
|
const i = t > 0 && e < t;
|
|
4436
|
-
i !== this.#
|
|
4574
|
+
i !== this.#e && (this.#e = i, this.#w(), this.emit("responsive-change", {
|
|
4437
4575
|
isResponsive: i,
|
|
4438
4576
|
width: e,
|
|
4439
4577
|
breakpoint: t
|
|
4440
4578
|
}), this.requestRender());
|
|
4441
4579
|
}
|
|
4442
|
-
#
|
|
4580
|
+
#v(e) {
|
|
4443
4581
|
let t = null;
|
|
4444
|
-
for (const n of this.#
|
|
4582
|
+
for (const n of this.#r)
|
|
4445
4583
|
e <= n.maxWidth && (t = n);
|
|
4446
|
-
if (t !== this.#
|
|
4447
|
-
this.#
|
|
4584
|
+
if (t !== this.#l) {
|
|
4585
|
+
this.#l = t, t?.hiddenColumns ? this.#f(t.hiddenColumns) : this.#f(this.config.hiddenColumns);
|
|
4448
4586
|
const n = t?.cardLayout === !0;
|
|
4449
|
-
n !== this.#
|
|
4450
|
-
isResponsive: this.#
|
|
4587
|
+
n !== this.#e && (this.#e = n, this.#w()), this.emit("responsive-change", {
|
|
4588
|
+
isResponsive: this.#e,
|
|
4451
4589
|
width: e,
|
|
4452
4590
|
breakpoint: t?.maxWidth ?? 0
|
|
4453
4591
|
}), this.requestRender();
|
|
4454
4592
|
}
|
|
4455
4593
|
}
|
|
4456
|
-
#
|
|
4457
|
-
#
|
|
4458
|
-
this.gridElement.toggleAttribute("data-responsive", this.#
|
|
4594
|
+
#h;
|
|
4595
|
+
#w() {
|
|
4596
|
+
this.gridElement.toggleAttribute("data-responsive", this.#e);
|
|
4459
4597
|
const e = this.config.animate !== !1;
|
|
4460
4598
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
4461
4599
|
const t = this.grid;
|
|
4462
|
-
if (this.#
|
|
4463
|
-
t._virtualization && (this.#
|
|
4600
|
+
if (this.#e) {
|
|
4601
|
+
t._virtualization && (this.#h = t._virtualization.rowHeight);
|
|
4464
4602
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
4465
4603
|
i && (i.scrollLeft = 0);
|
|
4466
4604
|
} else {
|
|
4467
4605
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
4468
4606
|
for (const n of i)
|
|
4469
4607
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
4470
|
-
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;
|
|
4471
4609
|
}
|
|
4472
4610
|
}
|
|
4473
4611
|
renderRow(e, t, i) {
|
|
4474
|
-
if (!this.#
|
|
4612
|
+
if (!this.#e || !this.config.cardRenderer || e.__isGroupRow)
|
|
4475
4613
|
return;
|
|
4476
4614
|
t.replaceChildren();
|
|
4477
4615
|
const n = this.config.cardRenderer(e, i);
|
|
@@ -4480,46 +4618,46 @@ class kn extends A {
|
|
|
4480
4618
|
return r !== "auto" ? t.style.height = `${r}px` : t.style.height = "auto", t.appendChild(n), !0;
|
|
4481
4619
|
}
|
|
4482
4620
|
onKeyDown(e) {
|
|
4483
|
-
if (!this.#
|
|
4621
|
+
if (!this.#e || this.config.cardRenderer && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key))
|
|
4484
4622
|
return !1;
|
|
4485
4623
|
const t = this.rows.length - 1, i = this.visibleColumns.length - 1;
|
|
4486
4624
|
switch (e.key) {
|
|
4487
4625
|
case "ArrowDown":
|
|
4488
4626
|
if (this.grid._focusCol < i)
|
|
4489
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
4627
|
+
return this.grid._focusCol += 1, e.preventDefault(), F(this.grid), !0;
|
|
4490
4628
|
if (this.grid._focusRow < t)
|
|
4491
|
-
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;
|
|
4492
4630
|
break;
|
|
4493
4631
|
case "ArrowUp":
|
|
4494
4632
|
if (this.grid._focusCol > 0)
|
|
4495
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
4633
|
+
return this.grid._focusCol -= 1, e.preventDefault(), F(this.grid), !0;
|
|
4496
4634
|
if (this.grid._focusRow > 0)
|
|
4497
|
-
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;
|
|
4498
4636
|
break;
|
|
4499
4637
|
case "ArrowRight":
|
|
4500
4638
|
if (this.grid._focusRow < t)
|
|
4501
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
4639
|
+
return this.grid._focusRow += 1, e.preventDefault(), F(this.grid), !0;
|
|
4502
4640
|
break;
|
|
4503
4641
|
case "ArrowLeft":
|
|
4504
4642
|
if (this.grid._focusRow > 0)
|
|
4505
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
4643
|
+
return this.grid._focusRow -= 1, e.preventDefault(), F(this.grid), !0;
|
|
4506
4644
|
break;
|
|
4507
4645
|
}
|
|
4508
4646
|
return !1;
|
|
4509
4647
|
}
|
|
4510
|
-
#
|
|
4648
|
+
#c;
|
|
4511
4649
|
#g;
|
|
4512
|
-
#
|
|
4513
|
-
#
|
|
4514
|
-
if (this.#
|
|
4515
|
-
return this.#
|
|
4650
|
+
#a;
|
|
4651
|
+
#b() {
|
|
4652
|
+
if (this.#c && this.#c > 0)
|
|
4653
|
+
return this.#c;
|
|
4516
4654
|
const e = this.config.cardRowHeight;
|
|
4517
4655
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
4518
4656
|
}
|
|
4519
|
-
#
|
|
4520
|
-
return this.#g && this.#g > 0 ? this.#g : this.#
|
|
4657
|
+
#m() {
|
|
4658
|
+
return this.#g && this.#g > 0 ? this.#g : this.#h ?? 28;
|
|
4521
4659
|
}
|
|
4522
|
-
#
|
|
4660
|
+
#y() {
|
|
4523
4661
|
for (const e of this.rows)
|
|
4524
4662
|
if (e.__isGroupRow)
|
|
4525
4663
|
return !0;
|
|
@@ -4532,34 +4670,38 @@ class kn extends A {
|
|
|
4532
4670
|
return { groupCount: e, cardCount: t };
|
|
4533
4671
|
}
|
|
4534
4672
|
getExtraHeight() {
|
|
4535
|
-
if (!this.#
|
|
4673
|
+
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
4536
4674
|
return 0;
|
|
4537
|
-
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);
|
|
4538
4676
|
return o + s;
|
|
4539
4677
|
}
|
|
4540
4678
|
getExtraHeightBefore(e) {
|
|
4541
|
-
if (!this.#
|
|
4679
|
+
if (!this.#e || !this.config.cardRenderer || !this.#y())
|
|
4542
4680
|
return 0;
|
|
4543
|
-
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);
|
|
4544
4682
|
let s = 0, l = 0;
|
|
4545
4683
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4546
4684
|
for (let u = 0; u < c; u++)
|
|
4547
4685
|
d[u].__isGroupRow ? s++ : l++;
|
|
4548
4686
|
return s * r + l * o;
|
|
4549
4687
|
}
|
|
4550
|
-
|
|
4688
|
+
getRowHeight(e, t) {
|
|
4689
|
+
if (!(!this.#e || !this.config.cardRenderer))
|
|
4690
|
+
return e.__isGroupRow ? this.#m() : this.#b();
|
|
4691
|
+
}
|
|
4692
|
+
#x() {
|
|
4551
4693
|
let e = 0;
|
|
4552
4694
|
for (const t of this.rows)
|
|
4553
4695
|
t.__isGroupRow || e++;
|
|
4554
4696
|
return e;
|
|
4555
4697
|
}
|
|
4556
|
-
#
|
|
4698
|
+
#E = !1;
|
|
4557
4699
|
#R() {
|
|
4558
|
-
if (!this.#
|
|
4700
|
+
if (!this.#e || !this.config.cardRenderer)
|
|
4559
4701
|
return;
|
|
4560
4702
|
let e = !1;
|
|
4561
|
-
const t = this.grid, i = this.#
|
|
4562
|
-
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) {
|
|
4563
4705
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4564
4706
|
if (o) {
|
|
4565
4707
|
const s = o.getBoundingClientRect().height;
|
|
@@ -4569,15 +4711,15 @@ class kn extends A {
|
|
|
4569
4711
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
4570
4712
|
if (r) {
|
|
4571
4713
|
const o = r.getBoundingClientRect().height;
|
|
4572
|
-
o > 0 && o !== this.#
|
|
4714
|
+
o > 0 && o !== this.#c && (this.#c = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
4573
4715
|
}
|
|
4574
|
-
e && !this.#
|
|
4575
|
-
this.#
|
|
4716
|
+
e && !this.#E && (this.#E = !0, queueMicrotask(() => {
|
|
4717
|
+
this.#E = !1, this.grid && this.#e && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
4576
4718
|
}));
|
|
4577
4719
|
}
|
|
4578
4720
|
}
|
|
4579
4721
|
const Wi = '@layer tbw-plugins{[data-field=__tbw_row_drag]{display:flex;align-items:center;justify-content:center}.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;min-width:1em;min-height:1em;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', $i = "__tbw_row_drag";
|
|
4580
|
-
class An extends
|
|
4722
|
+
class An extends _ {
|
|
4581
4723
|
name = "rowReorder";
|
|
4582
4724
|
styles = Wi;
|
|
4583
4725
|
get defaultConfig() {
|
|
@@ -4700,7 +4842,7 @@ class An extends A {
|
|
|
4700
4842
|
row: e
|
|
4701
4843
|
}, this.lastFocusCol = r;
|
|
4702
4844
|
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
|
|
4703
|
-
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(() => {
|
|
4704
4846
|
this.flushPendingMove();
|
|
4705
4847
|
}, this.config.debounceMs ?? 300);
|
|
4706
4848
|
}
|
|
@@ -4719,7 +4861,7 @@ class An extends A {
|
|
|
4719
4861
|
const o = [...this.sourceRows], [s] = o.splice(t, 1);
|
|
4720
4862
|
o.splice(e, 0, s);
|
|
4721
4863
|
const l = this.grid;
|
|
4722
|
-
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);
|
|
4723
4865
|
}
|
|
4724
4866
|
}
|
|
4725
4867
|
executeMove(e, t, i, n) {
|
|
@@ -4757,9 +4899,9 @@ class An extends A {
|
|
|
4757
4899
|
if (u < 0 || u < r || u > o) return;
|
|
4758
4900
|
let h;
|
|
4759
4901
|
u === i ? h = t : t < i ? h = u + 1 : h = u - 1;
|
|
4760
|
-
const
|
|
4761
|
-
if (
|
|
4762
|
-
const
|
|
4902
|
+
const f = e.get(h);
|
|
4903
|
+
if (f === void 0) return;
|
|
4904
|
+
const g = c.getBoundingClientRect().top, p = f - g;
|
|
4763
4905
|
Math.abs(p) > 1 && s.push({ el: c, deltaY: p });
|
|
4764
4906
|
}), s.length === 0) return;
|
|
4765
4907
|
s.forEach(({ el: d, deltaY: c }) => {
|
|
@@ -4789,7 +4931,7 @@ class An extends A {
|
|
|
4789
4931
|
this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
|
|
4790
4932
|
}
|
|
4791
4933
|
}
|
|
4792
|
-
function
|
|
4934
|
+
function $(a) {
|
|
4793
4935
|
return {
|
|
4794
4936
|
startRow: Math.min(a.startRow, a.endRow),
|
|
4795
4937
|
startCol: Math.min(a.startCol, a.endCol),
|
|
@@ -4798,7 +4940,7 @@ function V(a) {
|
|
|
4798
4940
|
};
|
|
4799
4941
|
}
|
|
4800
4942
|
function ji(a) {
|
|
4801
|
-
const e =
|
|
4943
|
+
const e = $(a);
|
|
4802
4944
|
return {
|
|
4803
4945
|
from: { row: e.startRow, col: e.startCol },
|
|
4804
4946
|
to: { row: e.endRow, col: e.endCol }
|
|
@@ -4808,14 +4950,14 @@ function lt(a) {
|
|
|
4808
4950
|
return a.map(ji);
|
|
4809
4951
|
}
|
|
4810
4952
|
function Ui(a, e, t) {
|
|
4811
|
-
const i =
|
|
4953
|
+
const i = $(t);
|
|
4812
4954
|
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4813
4955
|
}
|
|
4814
4956
|
function je(a, e, t) {
|
|
4815
4957
|
return t.some((i) => Ui(a, e, i));
|
|
4816
4958
|
}
|
|
4817
4959
|
function Yi(a) {
|
|
4818
|
-
const e = [], t =
|
|
4960
|
+
const e = [], t = $(a);
|
|
4819
4961
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4820
4962
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4821
4963
|
e.push({ row: i, col: n });
|
|
@@ -4836,8 +4978,8 @@ function de(a, e) {
|
|
|
4836
4978
|
endCol: e.col
|
|
4837
4979
|
};
|
|
4838
4980
|
}
|
|
4839
|
-
function
|
|
4840
|
-
const t =
|
|
4981
|
+
function Q(a, e) {
|
|
4982
|
+
const t = $(a), i = $(e);
|
|
4841
4983
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4842
4984
|
}
|
|
4843
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}}}";
|
|
@@ -4861,7 +5003,7 @@ function Qi(a, e, t) {
|
|
|
4861
5003
|
}
|
|
4862
5004
|
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: lt(e.ranges) } : { mode: a, ranges: [] };
|
|
4863
5005
|
}
|
|
4864
|
-
class _n extends
|
|
5006
|
+
class _n extends _ {
|
|
4865
5007
|
static manifest = {
|
|
4866
5008
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
4867
5009
|
configRules: [
|
|
@@ -4928,22 +5070,22 @@ class _n extends A {
|
|
|
4928
5070
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4929
5071
|
if (n.type !== o)
|
|
4930
5072
|
return !1;
|
|
4931
|
-
const s = this.columns[i], l = s &&
|
|
5073
|
+
const s = this.columns[i], l = s && H(s);
|
|
4932
5074
|
if (r === "cell") {
|
|
4933
5075
|
if (l || !this.isCellSelectable(t, i))
|
|
4934
5076
|
return !1;
|
|
4935
5077
|
const d = this.selectedCell;
|
|
4936
|
-
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;
|
|
4937
5079
|
}
|
|
4938
5080
|
if (r === "row")
|
|
4939
|
-
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;
|
|
4940
5082
|
if (r === "range") {
|
|
4941
5083
|
if (l || !this.isCellSelectable(t, i))
|
|
4942
5084
|
return !1;
|
|
4943
5085
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4944
5086
|
if (d && this.cellAnchor) {
|
|
4945
5087
|
const u = de(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4946
|
-
if (h &&
|
|
5088
|
+
if (h && Q(h, u))
|
|
4947
5089
|
return !1;
|
|
4948
5090
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
4949
5091
|
} else if (c) {
|
|
@@ -4961,11 +5103,11 @@ class _n extends A {
|
|
|
4961
5103
|
endRow: t,
|
|
4962
5104
|
endCol: i
|
|
4963
5105
|
};
|
|
4964
|
-
if (this.ranges.length === 1 &&
|
|
5106
|
+
if (this.ranges.length === 1 && Q(this.ranges[0], u))
|
|
4965
5107
|
return !1;
|
|
4966
5108
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
4967
5109
|
}
|
|
4968
|
-
return this.emit("selection-change", this.#
|
|
5110
|
+
return this.emit("selection-change", this.#e()), this.requestAfterRender(), !1;
|
|
4969
5111
|
}
|
|
4970
5112
|
return !1;
|
|
4971
5113
|
}
|
|
@@ -4973,16 +5115,16 @@ class _n extends A {
|
|
|
4973
5115
|
if (!this.isSelectionEnabled()) return !1;
|
|
4974
5116
|
const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
|
|
4975
5117
|
if (e.key === "Escape")
|
|
4976
|
-
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;
|
|
4977
5119
|
if (t === "cell" && n)
|
|
4978
5120
|
return queueMicrotask(() => {
|
|
4979
5121
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4980
|
-
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();
|
|
4981
5123
|
}), !1;
|
|
4982
5124
|
if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
4983
5125
|
return queueMicrotask(() => {
|
|
4984
5126
|
const r = this.grid._focusRow;
|
|
4985
|
-
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();
|
|
4986
5128
|
}), !1;
|
|
4987
5129
|
if (t === "range" && n) {
|
|
4988
5130
|
const r = e.key === "Tab", o = e.shiftKey && !r;
|
|
@@ -4998,7 +5140,7 @@ class _n extends A {
|
|
|
4998
5140
|
endRow: r - 1,
|
|
4999
5141
|
endCol: o - 1
|
|
5000
5142
|
};
|
|
5001
|
-
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;
|
|
5002
5144
|
}
|
|
5003
5145
|
}
|
|
5004
5146
|
return !1;
|
|
@@ -5006,7 +5148,7 @@ class _n extends A {
|
|
|
5006
5148
|
onCellMouseDown(e) {
|
|
5007
5149
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5008
5150
|
const t = this.columns[e.colIndex];
|
|
5009
|
-
if (t &&
|
|
5151
|
+
if (t && H(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
5010
5152
|
return;
|
|
5011
5153
|
this.isDragging = !0;
|
|
5012
5154
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -5015,24 +5157,24 @@ class _n extends A {
|
|
|
5015
5157
|
endRow: i,
|
|
5016
5158
|
endCol: n
|
|
5017
5159
|
};
|
|
5018
|
-
return !r && this.ranges.length === 1 &&
|
|
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);
|
|
5019
5161
|
}
|
|
5020
5162
|
onCellMouseMove(e) {
|
|
5021
5163
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
5022
5164
|
let t = e.colIndex;
|
|
5023
5165
|
const i = this.columns[t];
|
|
5024
|
-
if (i &&
|
|
5025
|
-
const o = this.columns.findIndex((s) => !
|
|
5166
|
+
if (i && H(i)) {
|
|
5167
|
+
const o = this.columns.findIndex((s) => !H(s));
|
|
5026
5168
|
o >= 0 && (t = o);
|
|
5027
5169
|
}
|
|
5028
5170
|
const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5029
|
-
return r &&
|
|
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;
|
|
5030
5172
|
}
|
|
5031
5173
|
onCellMouseUp(e) {
|
|
5032
5174
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
5033
5175
|
return this.isDragging = !1, !0;
|
|
5034
5176
|
}
|
|
5035
|
-
#
|
|
5177
|
+
#t() {
|
|
5036
5178
|
const e = this.gridElement;
|
|
5037
5179
|
if (!e) return;
|
|
5038
5180
|
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
@@ -5043,24 +5185,24 @@ class _n extends A {
|
|
|
5043
5185
|
if (r.forEach((o) => {
|
|
5044
5186
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
5045
5187
|
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
5046
|
-
const s = o.querySelector(".cell[data-row]"), l =
|
|
5188
|
+
const s = o.querySelector(".cell[data-row]"), l = wt(s);
|
|
5047
5189
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
5048
5190
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
5049
5191
|
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
5050
5192
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
|
|
5051
5193
|
}), t === "range" && this.ranges.length > 0) {
|
|
5052
5194
|
xe(e);
|
|
5053
|
-
const o = this.activeRange ?
|
|
5195
|
+
const o = this.activeRange ? $(this.activeRange) : null, s = this.columns.findIndex((d) => !H(d));
|
|
5054
5196
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
5055
5197
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
5056
5198
|
if (c >= 0 && u >= 0) {
|
|
5057
5199
|
const h = this.columns[u];
|
|
5058
|
-
if (h &&
|
|
5200
|
+
if (h && H(h))
|
|
5059
5201
|
return;
|
|
5060
5202
|
if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
5061
5203
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
5062
|
-
const
|
|
5063
|
-
u ===
|
|
5204
|
+
const g = Math.max(o.startCol, s);
|
|
5205
|
+
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
5064
5206
|
}
|
|
5065
5207
|
}
|
|
5066
5208
|
});
|
|
@@ -5079,17 +5221,17 @@ class _n extends A {
|
|
|
5079
5221
|
const s = de(this.cellAnchor, { row: r, col: o });
|
|
5080
5222
|
this.ranges = [s], this.activeRange = s;
|
|
5081
5223
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
5082
|
-
this.emit("selection-change", this.#
|
|
5224
|
+
this.emit("selection-change", this.#e());
|
|
5083
5225
|
}
|
|
5084
|
-
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();
|
|
5085
5227
|
}
|
|
5086
5228
|
onScrollRender() {
|
|
5087
|
-
this.isSelectionEnabled() && this.#
|
|
5229
|
+
this.isSelectionEnabled() && this.#t();
|
|
5088
5230
|
}
|
|
5089
5231
|
getSelection() {
|
|
5090
5232
|
return {
|
|
5091
5233
|
mode: this.config.mode,
|
|
5092
|
-
ranges: this.#
|
|
5234
|
+
ranges: this.#e().ranges,
|
|
5093
5235
|
anchor: this.cellAnchor
|
|
5094
5236
|
};
|
|
5095
5237
|
}
|
|
@@ -5113,7 +5255,7 @@ class _n extends A {
|
|
|
5113
5255
|
ranges: lt(this.ranges)
|
|
5114
5256
|
}), this.requestAfterRender();
|
|
5115
5257
|
}
|
|
5116
|
-
#
|
|
5258
|
+
#e() {
|
|
5117
5259
|
return Qi(
|
|
5118
5260
|
this.config.mode,
|
|
5119
5261
|
{
|
|
@@ -5125,7 +5267,7 @@ class _n extends A {
|
|
|
5125
5267
|
);
|
|
5126
5268
|
}
|
|
5127
5269
|
}
|
|
5128
|
-
function
|
|
5270
|
+
function ee(a, e) {
|
|
5129
5271
|
return Math.floor(a / e);
|
|
5130
5272
|
}
|
|
5131
5273
|
function Ji(a, e) {
|
|
@@ -5135,7 +5277,7 @@ function Ji(a, e) {
|
|
|
5135
5277
|
};
|
|
5136
5278
|
}
|
|
5137
5279
|
function en(a, e, t) {
|
|
5138
|
-
const i =
|
|
5280
|
+
const i = ee(a, t), n = ee(e - 1, t), r = [];
|
|
5139
5281
|
for (let o = i; o <= n; o++)
|
|
5140
5282
|
r.push(o);
|
|
5141
5283
|
return r;
|
|
@@ -5150,13 +5292,13 @@ async function Ue(a, e, t, i) {
|
|
|
5150
5292
|
});
|
|
5151
5293
|
}
|
|
5152
5294
|
function tn(a, e, t) {
|
|
5153
|
-
const i =
|
|
5295
|
+
const i = ee(a, e), n = t.get(i);
|
|
5154
5296
|
if (!n) return;
|
|
5155
5297
|
const r = a % e;
|
|
5156
5298
|
return n[r];
|
|
5157
5299
|
}
|
|
5158
5300
|
const nn = 100;
|
|
5159
|
-
class
|
|
5301
|
+
class Ln extends _ {
|
|
5160
5302
|
name = "serverSide";
|
|
5161
5303
|
get defaultConfig() {
|
|
5162
5304
|
return {
|
|
@@ -5219,7 +5361,7 @@ class Tn extends A {
|
|
|
5219
5361
|
return this.totalRowCount;
|
|
5220
5362
|
}
|
|
5221
5363
|
isRowLoaded(e) {
|
|
5222
|
-
const t = this.config.cacheBlockSize ?? 100, i =
|
|
5364
|
+
const t = this.config.cacheBlockSize ?? 100, i = ee(e, t);
|
|
5223
5365
|
return this.loadedBlocks.has(i);
|
|
5224
5366
|
}
|
|
5225
5367
|
getLoadedBlockCount() {
|
|
@@ -5233,13 +5375,13 @@ function ce(a, e) {
|
|
|
5233
5375
|
const t = new Set(a);
|
|
5234
5376
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5235
5377
|
}
|
|
5236
|
-
function
|
|
5378
|
+
function ge(a, e, t = null, i = 0) {
|
|
5237
5379
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5238
5380
|
for (let o = 0; o < a.length; o++) {
|
|
5239
5381
|
const s = a[o], l = dt(s, o, t), d = s[n];
|
|
5240
5382
|
if (Array.isArray(d) && d.length > 0) {
|
|
5241
5383
|
r.add(l);
|
|
5242
|
-
const c =
|
|
5384
|
+
const c = ge(d, e, l, i + 1);
|
|
5243
5385
|
for (const u of c) r.add(u);
|
|
5244
5386
|
}
|
|
5245
5387
|
}
|
|
@@ -5294,7 +5436,7 @@ function sn(a) {
|
|
|
5294
5436
|
return null;
|
|
5295
5437
|
}
|
|
5296
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}}}";
|
|
5297
|
-
class
|
|
5439
|
+
class Tn extends _ {
|
|
5298
5440
|
static manifest = {
|
|
5299
5441
|
events: [
|
|
5300
5442
|
{
|
|
@@ -5351,7 +5493,7 @@ class Ln extends A {
|
|
|
5351
5493
|
if (!Ye(i, t))
|
|
5352
5494
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5353
5495
|
let n = this.withStableKeys(i);
|
|
5354
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5496
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ge(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5355
5497
|
const r = /* @__PURE__ */ new Set();
|
|
5356
5498
|
for (const o of this.flattenedRows)
|
|
5357
5499
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5404,19 +5546,19 @@ class Ln extends A {
|
|
|
5404
5546
|
const t = [...e];
|
|
5405
5547
|
if (t.length === 0) return t;
|
|
5406
5548
|
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), s = this.resolveIcon.bind(this), l = (d) => {
|
|
5407
|
-
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth:
|
|
5408
|
-
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)),
|
|
5409
|
-
if (
|
|
5410
|
-
const
|
|
5411
|
-
|
|
5549
|
+
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, w = document.createElement("span");
|
|
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)
|
|
5551
|
+
if (g.__treeHasChildren) {
|
|
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);
|
|
5412
5554
|
} else {
|
|
5413
|
-
const
|
|
5414
|
-
|
|
5555
|
+
const y = document.createElement("span");
|
|
5556
|
+
y.className = "tree-spacer", w.appendChild(y);
|
|
5415
5557
|
}
|
|
5416
5558
|
const b = document.createElement("span");
|
|
5417
5559
|
if (b.className = "tree-content", n) {
|
|
5418
|
-
const
|
|
5419
|
-
|
|
5560
|
+
const y = n(d);
|
|
5561
|
+
y instanceof Node ? b.appendChild(y) : typeof y == "string" && (b.innerHTML = y);
|
|
5420
5562
|
} else
|
|
5421
5563
|
b.textContent = u != null ? String(u) : "";
|
|
5422
5564
|
return w.appendChild(b), w;
|
|
@@ -5476,7 +5618,7 @@ class Ln extends A {
|
|
|
5476
5618
|
this.expandedKeys = ce(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5477
5619
|
}
|
|
5478
5620
|
expandAll() {
|
|
5479
|
-
this.expandedKeys =
|
|
5621
|
+
this.expandedKeys = ge(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5480
5622
|
}
|
|
5481
5623
|
collapseAll() {
|
|
5482
5624
|
this.expandedKeys = rn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
@@ -5549,7 +5691,7 @@ function hn(a, e, t, i) {
|
|
|
5549
5691
|
timestamp: Date.now()
|
|
5550
5692
|
};
|
|
5551
5693
|
}
|
|
5552
|
-
class In extends
|
|
5694
|
+
class In extends _ {
|
|
5553
5695
|
static dependencies = [
|
|
5554
5696
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5555
5697
|
];
|
|
@@ -5639,18 +5781,18 @@ class In extends A {
|
|
|
5639
5781
|
return [...this.redoStack];
|
|
5640
5782
|
}
|
|
5641
5783
|
}
|
|
5642
|
-
const
|
|
5784
|
+
const fn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
|
|
5643
5785
|
function Qe(a) {
|
|
5644
5786
|
const e = a.meta ?? {};
|
|
5645
5787
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5646
5788
|
}
|
|
5647
|
-
class
|
|
5789
|
+
class V extends _ {
|
|
5648
5790
|
static dependencies = [
|
|
5649
5791
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5650
5792
|
];
|
|
5651
5793
|
name = "visibility";
|
|
5652
5794
|
static PANEL_ID = "columns";
|
|
5653
|
-
styles =
|
|
5795
|
+
styles = fn;
|
|
5654
5796
|
get defaultConfig() {
|
|
5655
5797
|
return {
|
|
5656
5798
|
allowHideAll: !1
|
|
@@ -5671,7 +5813,7 @@ class B extends A {
|
|
|
5671
5813
|
}
|
|
5672
5814
|
getToolPanel() {
|
|
5673
5815
|
return {
|
|
5674
|
-
id:
|
|
5816
|
+
id: V.PANEL_ID,
|
|
5675
5817
|
title: "Columns",
|
|
5676
5818
|
icon: "☰",
|
|
5677
5819
|
tooltip: "Column visibility",
|
|
@@ -5680,13 +5822,13 @@ class B extends A {
|
|
|
5680
5822
|
};
|
|
5681
5823
|
}
|
|
5682
5824
|
show() {
|
|
5683
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
5825
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(V.PANEL_ID) || this.grid.toggleToolPanelSection(V.PANEL_ID);
|
|
5684
5826
|
}
|
|
5685
5827
|
hide() {
|
|
5686
5828
|
this.grid.closeToolPanel();
|
|
5687
5829
|
}
|
|
5688
5830
|
toggle() {
|
|
5689
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
5831
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(V.PANEL_ID);
|
|
5690
5832
|
}
|
|
5691
5833
|
isColumnVisible(e) {
|
|
5692
5834
|
return this.grid.isColumnVisible(e);
|
|
@@ -5716,7 +5858,7 @@ class B extends A {
|
|
|
5716
5858
|
return this.grid.getAllColumns();
|
|
5717
5859
|
}
|
|
5718
5860
|
isPanelVisible() {
|
|
5719
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
5861
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(V.PANEL_ID);
|
|
5720
5862
|
}
|
|
5721
5863
|
renderPanelContent(e) {
|
|
5722
5864
|
const t = document.createElement("div");
|
|
@@ -5775,12 +5917,12 @@ class B extends A {
|
|
|
5775
5917
|
return;
|
|
5776
5918
|
const d = l > s ? l - 1 : l;
|
|
5777
5919
|
if (d !== s) {
|
|
5778
|
-
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field,
|
|
5920
|
+
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, f = h ? c.findIndex((p) => p.field === h) : c.length, g = {
|
|
5779
5921
|
field: o,
|
|
5780
5922
|
fromIndex: s,
|
|
5781
|
-
toIndex:
|
|
5923
|
+
toIndex: f
|
|
5782
5924
|
};
|
|
5783
|
-
this.emit("column-reorder-request",
|
|
5925
|
+
this.emit("column-reorder-request", g), setTimeout(() => {
|
|
5784
5926
|
this.rebuildToggles(n);
|
|
5785
5927
|
}, 0);
|
|
5786
5928
|
}
|
|
@@ -5788,7 +5930,7 @@ class B extends A {
|
|
|
5788
5930
|
}
|
|
5789
5931
|
}
|
|
5790
5932
|
export {
|
|
5791
|
-
|
|
5933
|
+
_ as BaseGridPlugin,
|
|
5792
5934
|
pn as ClipboardPlugin,
|
|
5793
5935
|
mn as ColumnVirtualizationPlugin,
|
|
5794
5936
|
it as ContextMenuPlugin,
|
|
@@ -5798,7 +5940,7 @@ export {
|
|
|
5798
5940
|
Nn as DataGridElement,
|
|
5799
5941
|
wn as EditingPlugin,
|
|
5800
5942
|
bn as ExportPlugin,
|
|
5801
|
-
|
|
5943
|
+
q as FilteringPlugin,
|
|
5802
5944
|
qn as FitModeEnum,
|
|
5803
5945
|
Hn as GridCSSVars,
|
|
5804
5946
|
Kn as GridClasses,
|
|
@@ -5812,7 +5954,7 @@ export {
|
|
|
5812
5954
|
Bn as PLUGIN_QUERIES,
|
|
5813
5955
|
Cn as PinnedColumnsPlugin,
|
|
5814
5956
|
En as PinnedRowsPlugin,
|
|
5815
|
-
|
|
5957
|
+
B as PivotPlugin,
|
|
5816
5958
|
Vn as PluginEvents,
|
|
5817
5959
|
Wn as PluginManager,
|
|
5818
5960
|
Rn as PrintPlugin,
|
|
@@ -5822,15 +5964,15 @@ export {
|
|
|
5822
5964
|
kn as ResponsivePlugin,
|
|
5823
5965
|
An as RowReorderPlugin,
|
|
5824
5966
|
_n as SelectionPlugin,
|
|
5825
|
-
|
|
5826
|
-
|
|
5967
|
+
Ln as ServerSidePlugin,
|
|
5968
|
+
Tn as TreePlugin,
|
|
5827
5969
|
In as UndoRedoPlugin,
|
|
5828
|
-
|
|
5970
|
+
V as VisibilityPlugin,
|
|
5829
5971
|
jn as builtInSort,
|
|
5830
5972
|
Un as createGrid,
|
|
5831
5973
|
Yn as defaultComparator,
|
|
5832
|
-
|
|
5833
|
-
|
|
5974
|
+
Dt as defaultEditorFor,
|
|
5975
|
+
Ct as defaultPasteHandler,
|
|
5834
5976
|
Ki as printGridIsolated,
|
|
5835
5977
|
Xn as queryGrid
|
|
5836
5978
|
};
|