@toolbox-web/grid-react 0.15.0 → 0.16.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/chunks/{data-grid-O97pdLCY.js → data-grid-oxWjOqoA.js} +160 -173
- package/features/clipboard.d.ts +0 -17
- package/features/clipboard.d.ts.map +1 -1
- package/features/clipboard.js +1 -6
- package/features/column-virtualization.d.ts +0 -15
- package/features/column-virtualization.d.ts.map +1 -1
- package/features/column-virtualization.js +1 -6
- package/features/context-menu.d.ts +0 -15
- package/features/context-menu.d.ts.map +1 -1
- package/features/context-menu.js +1 -6
- package/features/editing.d.ts +0 -15
- package/features/editing.d.ts.map +1 -1
- package/features/editing.js +1 -3
- package/features/export.d.ts.map +1 -1
- package/features/export.js +25 -30
- package/features/filtering.js +25 -25
- package/features/grouping-columns.d.ts +0 -15
- package/features/grouping-columns.d.ts.map +1 -1
- package/features/grouping-columns.js +1 -6
- package/features/grouping-rows.d.ts +0 -15
- package/features/grouping-rows.d.ts.map +1 -1
- package/features/grouping-rows.js +1 -6
- package/features/index.js +21 -21
- package/features/master-detail.d.ts +0 -17
- package/features/master-detail.d.ts.map +1 -1
- package/features/master-detail.js +1 -6
- package/features/multi-sort.d.ts +0 -21
- package/features/multi-sort.d.ts.map +1 -1
- package/features/multi-sort.js +1 -3
- package/features/pinned-columns.d.ts +0 -15
- package/features/pinned-columns.d.ts.map +1 -1
- package/features/pinned-columns.js +1 -6
- package/features/pinned-rows.d.ts +0 -15
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pinned-rows.js +1 -6
- package/features/pivot.d.ts +0 -15
- package/features/pivot.d.ts.map +1 -1
- package/features/pivot.js +1 -3
- package/features/print.d.ts.map +1 -1
- package/features/print.js +13 -15
- package/features/reorder-columns.d.ts +1 -0
- package/features/reorder-columns.d.ts.map +1 -0
- package/features/reorder-columns.js +1 -0
- package/features/reorder-rows.d.ts +1 -0
- package/features/reorder-rows.d.ts.map +1 -0
- package/features/reorder-rows.js +1 -0
- package/features/reorder.d.ts +3 -13
- package/features/reorder.d.ts.map +1 -1
- package/features/reorder.js +1 -6
- package/features/responsive.d.ts +0 -15
- package/features/responsive.d.ts.map +1 -1
- package/features/responsive.js +1 -6
- package/features/row-reorder.d.ts +3 -13
- package/features/row-reorder.d.ts.map +1 -1
- package/features/row-reorder.js +1 -3
- package/features/selection.d.ts.map +1 -1
- package/features/selection.js +28 -30
- package/features/server-side.d.ts +0 -15
- package/features/server-side.d.ts.map +1 -1
- package/features/server-side.js +1 -3
- package/features/sorting.js +1 -1
- package/features/tree.d.ts +0 -15
- package/features/tree.d.ts.map +1 -1
- package/features/tree.js +1 -6
- package/features/undo-redo.d.ts.map +1 -1
- package/features/undo-redo.js +23 -28
- package/features/visibility.d.ts +0 -15
- package/features/visibility.d.ts.map +1 -1
- package/features/visibility.js +1 -6
- package/index.js +2 -2
- package/lib/data-grid.d.ts +2 -0
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/feature-props.d.ts +12 -4
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/feature-registry.d.ts +13 -47
- package/lib/feature-registry.d.ts.map +1 -1
- package/lib/grid-column.d.ts +2 -0
- package/lib/grid-column.d.ts.map +1 -1
- package/lib/grid-detail-panel.d.ts +2 -0
- package/lib/grid-detail-panel.d.ts.map +1 -1
- package/lib/grid-responsive-card.d.ts +2 -0
- package/lib/grid-responsive-card.d.ts.map +1 -1
- package/lib/grid-tool-button.d.ts +2 -0
- package/lib/grid-tool-button.d.ts.map +1 -1
- package/lib/grid-tool-panel.d.ts +2 -0
- package/lib/grid-tool-panel.d.ts.map +1 -1
- package/lib/use-sync-plugins.d.ts +2 -1
- package/lib/use-sync-plugins.d.ts.map +1 -1
- package/package.json +1 -1
- package/chunks/feature-registry-Y3KvnN54.js +0 -26
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as b } from "react/jsx-runtime";
|
|
2
2
|
import { DataGridElement as me } from "@toolbox-web/grid";
|
|
3
|
-
import { createContext as Z, useContext as V, useRef as
|
|
3
|
+
import { createContext as Z, useContext as V, useRef as x, useCallback as Q, useEffect as p, forwardRef as he, useMemo as C, useImperativeHandle as ye, Children as we, isValidElement as Ce } from "react";
|
|
4
4
|
import { flushSync as m } from "react-dom";
|
|
5
5
|
import { createRoot as y } from "react-dom/client";
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
6
|
+
import { createPluginsFromFeatures as Re } from "@toolbox-web/grid/features/registry";
|
|
7
|
+
function ve(n) {
|
|
8
8
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
9
9
|
}
|
|
10
10
|
function ae(n) {
|
|
11
|
-
return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(
|
|
11
|
+
return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(ve).join(" ");
|
|
12
12
|
}
|
|
13
13
|
const be = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
|
|
14
14
|
function Ee(n) {
|
|
@@ -32,7 +32,7 @@ function Ee(n) {
|
|
|
32
32
|
function Pe(n) {
|
|
33
33
|
return n.map((t) => typeof t == "string" ? Ee(t) : t);
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const z = {
|
|
36
36
|
onCellClick: "cell-click",
|
|
37
37
|
onRowClick: "row-click",
|
|
38
38
|
onCellActivate: "cell-activate",
|
|
@@ -72,15 +72,15 @@ function le(n) {
|
|
|
72
72
|
if (e)
|
|
73
73
|
return q.get(e);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const { children: t, cardRowHeight: e = "auto" } = n, r =
|
|
75
|
+
function xe(n) {
|
|
76
|
+
const { children: t, cardRowHeight: e = "auto" } = n, r = x(null), o = Q(
|
|
77
77
|
(s) => {
|
|
78
78
|
if (r.current = s, !s) return;
|
|
79
79
|
W.set(s, t);
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
|
|
80
|
+
const d = s.closest("tbw-grid");
|
|
81
|
+
if (d) {
|
|
82
|
+
const u = d.id || d.getAttribute("data-grid-id");
|
|
83
|
+
u && q.set(u, t);
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
[t]
|
|
@@ -89,17 +89,17 @@ function Se(n) {
|
|
|
89
89
|
const s = r.current;
|
|
90
90
|
if (s) {
|
|
91
91
|
W.delete(s);
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
|
|
92
|
+
const d = s.closest("tbw-grid");
|
|
93
|
+
if (d) {
|
|
94
|
+
const u = d.id || d.getAttribute("data-grid-id");
|
|
95
|
+
u && q.delete(u);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}, []);
|
|
99
99
|
const c = e === "auto" ? "auto" : String(e);
|
|
100
100
|
return /* @__PURE__ */ b("tbw-grid-responsive-card", { ref: o, cardRowHeight: c });
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
xe.displayName = "GridResponsiveCard";
|
|
103
103
|
const T = Z(null), Qe = ({ defaults: n, children: t }) => /* @__PURE__ */ b(T.Provider, { value: n, children: t });
|
|
104
104
|
function Xe() {
|
|
105
105
|
return V(T);
|
|
@@ -107,8 +107,8 @@ function Xe() {
|
|
|
107
107
|
function et(n) {
|
|
108
108
|
return V(T)?.[n];
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const Ae = T, I = [];
|
|
111
|
+
function Se(n) {
|
|
112
112
|
for (let t = I.length - 1; t >= 0; t--) {
|
|
113
113
|
const e = I[t];
|
|
114
114
|
if (n.contains(e.container) && e.container.classList.contains("react-cell-editor")) {
|
|
@@ -172,30 +172,30 @@ function Ne(n) {
|
|
|
172
172
|
if (e)
|
|
173
173
|
return K.get(e);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
const { children: t, showExpandColumn: e = !0, animation: r = "slide" } = n, o =
|
|
177
|
-
(
|
|
178
|
-
if (o.current =
|
|
179
|
-
B.set(
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
const g =
|
|
175
|
+
function Fe(n) {
|
|
176
|
+
const { children: t, showExpandColumn: e = !0, animation: r = "slide" } = n, o = x(null), c = Q(
|
|
177
|
+
(d) => {
|
|
178
|
+
if (o.current = d, !d) return;
|
|
179
|
+
B.set(d, t);
|
|
180
|
+
const u = d.closest("tbw-grid");
|
|
181
|
+
if (u) {
|
|
182
|
+
const g = u.id || u.getAttribute("data-grid-id");
|
|
183
183
|
g && K.set(g, t);
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
[t]
|
|
187
187
|
);
|
|
188
188
|
return p(() => () => {
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
B.delete(
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
const w =
|
|
189
|
+
const d = o.current;
|
|
190
|
+
if (d) {
|
|
191
|
+
B.delete(d);
|
|
192
|
+
const u = d.closest("tbw-grid");
|
|
193
|
+
if (u) {
|
|
194
|
+
const w = u.id || u.getAttribute("data-grid-id");
|
|
195
195
|
w && K.delete(w);
|
|
196
196
|
}
|
|
197
|
-
const g =
|
|
198
|
-
g && g.contains(
|
|
197
|
+
const g = d.parentNode;
|
|
198
|
+
g && g.contains(d);
|
|
199
199
|
}
|
|
200
200
|
}, []), /* @__PURE__ */ b(
|
|
201
201
|
"tbw-grid-detail",
|
|
@@ -206,9 +206,9 @@ function Le(n) {
|
|
|
206
206
|
}
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
Fe.displayName = "GridDetailPanel";
|
|
210
210
|
const U = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new Map();
|
|
211
|
-
function
|
|
211
|
+
function Le(n) {
|
|
212
212
|
const t = U.get(n);
|
|
213
213
|
if (t) return t;
|
|
214
214
|
const e = n.id;
|
|
@@ -216,19 +216,19 @@ function Fe(n) {
|
|
|
216
216
|
return J.get(e);
|
|
217
217
|
}
|
|
218
218
|
function tt(n) {
|
|
219
|
-
const { id: t, title: e, icon: r, tooltip: o, order: c = 100, children: s } = n,
|
|
219
|
+
const { id: t, title: e, icon: r, tooltip: o, order: c = 100, children: s } = n, d = x(null), u = Q(
|
|
220
220
|
(g) => {
|
|
221
|
-
|
|
221
|
+
d.current = g, g && (U.set(g, s), t && J.set(t, s));
|
|
222
222
|
},
|
|
223
223
|
[s, t]
|
|
224
224
|
);
|
|
225
225
|
return p(() => () => {
|
|
226
|
-
const g =
|
|
226
|
+
const g = d.current;
|
|
227
227
|
g && (U.delete(g), t && J.delete(t));
|
|
228
228
|
}, [t]), /* @__PURE__ */ b(
|
|
229
229
|
"tbw-grid-tool-panel",
|
|
230
230
|
{
|
|
231
|
-
ref:
|
|
231
|
+
ref: u,
|
|
232
232
|
id: t,
|
|
233
233
|
title: e,
|
|
234
234
|
icon: r,
|
|
@@ -237,23 +237,23 @@ function tt(n) {
|
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
-
const
|
|
240
|
+
const v = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new Map();
|
|
241
241
|
function rt(n, t) {
|
|
242
|
-
const e = n.getAttribute("field"), r =
|
|
243
|
-
if (r.renderer = t,
|
|
242
|
+
const e = n.getAttribute("field"), r = v.get(n) ?? {};
|
|
243
|
+
if (r.renderer = t, v.set(n, r), e) {
|
|
244
244
|
const o = E.get(e) ?? {};
|
|
245
245
|
o.renderer = t, E.set(e, o);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
function nt(n, t) {
|
|
249
|
-
const e = n.getAttribute("field"), r =
|
|
250
|
-
if (r.editor = t,
|
|
249
|
+
const e = n.getAttribute("field"), r = v.get(n) ?? {};
|
|
250
|
+
if (r.editor = t, v.set(n, r), e) {
|
|
251
251
|
const o = E.get(e) ?? {};
|
|
252
252
|
o.editor = t, E.set(e, o);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
function Te(n) {
|
|
256
|
-
let t =
|
|
256
|
+
let t = v.get(n)?.renderer;
|
|
257
257
|
if (!t) {
|
|
258
258
|
const e = n.getAttribute("field");
|
|
259
259
|
e && (t = E.get(e)?.renderer);
|
|
@@ -261,7 +261,7 @@ function Te(n) {
|
|
|
261
261
|
return t;
|
|
262
262
|
}
|
|
263
263
|
function ke(n) {
|
|
264
|
-
let t =
|
|
264
|
+
let t = v.get(n)?.editor;
|
|
265
265
|
if (!t) {
|
|
266
266
|
const e = n.getAttribute("field");
|
|
267
267
|
e && (t = E.get(e)?.editor);
|
|
@@ -288,10 +288,10 @@ class ue {
|
|
|
288
288
|
*/
|
|
289
289
|
canHandle(t) {
|
|
290
290
|
const e = t.getAttribute("field");
|
|
291
|
-
let r =
|
|
291
|
+
let r = v.get(t);
|
|
292
292
|
if (!r && e) {
|
|
293
293
|
const s = E.get(e);
|
|
294
|
-
s && (s.renderer || s.editor) && (r = s,
|
|
294
|
+
s && (s.renderer || s.editor) && (r = s, v.set(t, r));
|
|
295
295
|
}
|
|
296
296
|
const o = r?.renderer !== void 0, c = r?.editor !== void 0;
|
|
297
297
|
return r !== void 0 && (o || c);
|
|
@@ -315,11 +315,11 @@ class ue {
|
|
|
315
315
|
return (o) => {
|
|
316
316
|
const c = o.cellEl;
|
|
317
317
|
if (c) {
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
318
|
+
const u = r.get(c);
|
|
319
|
+
if (u)
|
|
320
320
|
return m(() => {
|
|
321
|
-
|
|
322
|
-
}),
|
|
321
|
+
u.root.render(e(o));
|
|
322
|
+
}), u.container;
|
|
323
323
|
const g = document.createElement("div");
|
|
324
324
|
g.className = "react-cell-renderer", g.style.display = "contents";
|
|
325
325
|
const w = y(g);
|
|
@@ -329,10 +329,10 @@ class ue {
|
|
|
329
329
|
}
|
|
330
330
|
const s = document.createElement("div");
|
|
331
331
|
s.className = "react-cell-renderer", s.style.display = "contents";
|
|
332
|
-
const
|
|
332
|
+
const d = y(s);
|
|
333
333
|
return m(() => {
|
|
334
|
-
|
|
335
|
-
}), this.mountedViews.push({ root:
|
|
334
|
+
d.render(e(o));
|
|
335
|
+
}), this.mountedViews.push({ root: d, container: s }), s;
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
/**
|
|
@@ -360,10 +360,10 @@ class ue {
|
|
|
360
360
|
return (r, o) => {
|
|
361
361
|
const c = document.createElement("div");
|
|
362
362
|
c.className = "react-detail-panel";
|
|
363
|
-
const s = { row: r, rowIndex: o },
|
|
363
|
+
const s = { row: r, rowIndex: o }, d = y(c);
|
|
364
364
|
return m(() => {
|
|
365
|
-
|
|
366
|
-
}), this.mountedViews.push({ root:
|
|
365
|
+
d.render(e(s));
|
|
366
|
+
}), this.mountedViews.push({ root: d, container: c }), c;
|
|
367
367
|
};
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
@@ -385,10 +385,10 @@ class ue {
|
|
|
385
385
|
return (r, o) => {
|
|
386
386
|
const c = document.createElement("div");
|
|
387
387
|
c.className = "react-responsive-card";
|
|
388
|
-
const s = { row: r, index: o },
|
|
388
|
+
const s = { row: r, index: o }, d = y(c);
|
|
389
389
|
return m(() => {
|
|
390
|
-
|
|
391
|
-
}), this.mountedViews.push({ root:
|
|
390
|
+
d.render(e(s));
|
|
391
|
+
}), this.mountedViews.push({ root: d, container: c }), c;
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
@@ -396,7 +396,7 @@ class ue {
|
|
|
396
396
|
* Renders React components into tool panel containers.
|
|
397
397
|
*/
|
|
398
398
|
createToolPanelRenderer(t) {
|
|
399
|
-
const e =
|
|
399
|
+
const e = Le(t);
|
|
400
400
|
if (!e)
|
|
401
401
|
return;
|
|
402
402
|
const r = t.closest("tbw-grid");
|
|
@@ -407,14 +407,14 @@ class ue {
|
|
|
407
407
|
return m(() => {
|
|
408
408
|
s.render(e(c));
|
|
409
409
|
}), this.mountedViews.push({ root: s, container: o }), () => {
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
const { root:
|
|
410
|
+
const d = this.mountedViews.findIndex((u) => u.container === o);
|
|
411
|
+
if (d !== -1) {
|
|
412
|
+
const { root: u } = this.mountedViews[d];
|
|
413
413
|
try {
|
|
414
|
-
|
|
414
|
+
u.unmount();
|
|
415
415
|
} catch {
|
|
416
416
|
}
|
|
417
|
-
this.mountedViews.splice(
|
|
417
|
+
this.mountedViews.splice(d, 1);
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
420
|
};
|
|
@@ -530,7 +530,7 @@ class ue {
|
|
|
530
530
|
this.editorViews.splice(e, 1);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
-
|
|
533
|
+
Se(t);
|
|
534
534
|
}
|
|
535
535
|
/**
|
|
536
536
|
* Unmount a specific container (called when cell is recycled).
|
|
@@ -563,39 +563,22 @@ function Oe(n) {
|
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
function je(n) {
|
|
566
|
-
const t = []
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
const l = s;
|
|
571
|
-
e.push(l);
|
|
572
|
-
}
|
|
573
|
-
Oe(e);
|
|
574
|
-
const o = [
|
|
575
|
-
"selection",
|
|
576
|
-
"editing",
|
|
577
|
-
// Then everything else in the order they were specified
|
|
578
|
-
...e.filter((s) => s !== "selection" && s !== "editing")
|
|
579
|
-
], c = [...new Set(o)].filter((s) => e.includes(s));
|
|
580
|
-
for (const s of c) {
|
|
581
|
-
const a = n[s];
|
|
582
|
-
if (a === void 0 || a === !1) continue;
|
|
583
|
-
const l = Ce(s, a);
|
|
584
|
-
l && t.push(l);
|
|
585
|
-
}
|
|
586
|
-
return t;
|
|
566
|
+
const t = [];
|
|
567
|
+
for (const [e, r] of Object.entries(n))
|
|
568
|
+
r === void 0 || r === !1 || t.push(e);
|
|
569
|
+
return Oe(t), Re(n);
|
|
587
570
|
}
|
|
588
|
-
let de = !1,
|
|
571
|
+
let de = !1, _ = null;
|
|
589
572
|
function Y() {
|
|
590
|
-
return de || (
|
|
573
|
+
return de || (_ = new ue(), me.registerAdapter(_), de = !0), _;
|
|
591
574
|
}
|
|
592
575
|
Y();
|
|
593
576
|
const He = Z(null);
|
|
594
|
-
function
|
|
577
|
+
function $e(n) {
|
|
595
578
|
const e = n.getPluginByName?.("masterDetail");
|
|
596
579
|
e && typeof e.refreshDetailRenderer == "function" && e.refreshDetailRenderer();
|
|
597
580
|
}
|
|
598
|
-
function
|
|
581
|
+
function ze(n, t) {
|
|
599
582
|
const e = n;
|
|
600
583
|
if (!n.querySelector("tbw-grid-responsive-card") || !le(n)) return;
|
|
601
584
|
const c = e.getPluginByName?.("responsive");
|
|
@@ -604,10 +587,10 @@ function _e(n, t) {
|
|
|
604
587
|
s && c.setCardRenderer(s);
|
|
605
588
|
}
|
|
606
589
|
}
|
|
607
|
-
function
|
|
590
|
+
function _e(n) {
|
|
608
591
|
const t = {};
|
|
609
592
|
return we.forEach(n, (e) => {
|
|
610
|
-
if (
|
|
593
|
+
if (Ce(e)) {
|
|
611
594
|
if (e.type && e.type.displayName === "GridDetailPanel") {
|
|
612
595
|
const r = e.props;
|
|
613
596
|
t.masterDetail = {
|
|
@@ -628,8 +611,8 @@ const it = he(function(t, e) {
|
|
|
628
611
|
gridConfig: o,
|
|
629
612
|
columns: c,
|
|
630
613
|
columnDefaults: s,
|
|
631
|
-
fitMode:
|
|
632
|
-
sortable:
|
|
614
|
+
fitMode: d,
|
|
615
|
+
sortable: u,
|
|
633
616
|
filterable: g,
|
|
634
617
|
selectable: w,
|
|
635
618
|
loading: k,
|
|
@@ -645,8 +628,8 @@ const it = he(function(t, e) {
|
|
|
645
628
|
// Legacy event handlers
|
|
646
629
|
onRowsChange: j,
|
|
647
630
|
// Feature props and event props are in ...rest
|
|
648
|
-
...
|
|
649
|
-
} = t,
|
|
631
|
+
...R
|
|
632
|
+
} = t, l = x(null), F = x(null), te = V(Ae), H = V(De), re = [
|
|
650
633
|
"selection",
|
|
651
634
|
"editing",
|
|
652
635
|
"filtering",
|
|
@@ -655,8 +638,12 @@ const it = he(function(t, e) {
|
|
|
655
638
|
// deprecated alias for multiSort
|
|
656
639
|
"clipboard",
|
|
657
640
|
"contextMenu",
|
|
641
|
+
"reorderColumns",
|
|
658
642
|
"reorder",
|
|
643
|
+
// deprecated alias for reorderColumns
|
|
659
644
|
"rowReorder",
|
|
645
|
+
// deprecated alias for reorderRows
|
|
646
|
+
"reorderRows",
|
|
660
647
|
"visibility",
|
|
661
648
|
"undoRedo",
|
|
662
649
|
"tree",
|
|
@@ -671,63 +658,63 @@ const it = he(function(t, e) {
|
|
|
671
658
|
"print",
|
|
672
659
|
"pivot",
|
|
673
660
|
"serverSide"
|
|
674
|
-
], pe =
|
|
675
|
-
const
|
|
676
|
-
return
|
|
677
|
-
}).filter(Boolean).join("|"), [
|
|
661
|
+
], pe = C(() => re.map((i) => {
|
|
662
|
+
const a = R[i];
|
|
663
|
+
return a !== void 0 ? `${i}:${JSON.stringify(a)}` : "";
|
|
664
|
+
}).filter(Boolean).join("|"), [R]), ne = C(() => {
|
|
678
665
|
const i = {};
|
|
679
|
-
for (const
|
|
680
|
-
|
|
666
|
+
for (const a of re)
|
|
667
|
+
a in R && R[a] !== void 0 && (i[a] = R[a]);
|
|
681
668
|
return i;
|
|
682
|
-
}, [pe]), oe =
|
|
669
|
+
}, [pe]), oe = C(() => _e(O), [O]), ie = C(() => ({ ...oe, ...ne }), [ne, oe]), $ = C(() => P || ee ? [] : je(ie), [ie, P, ee]), A = C(() => {
|
|
683
670
|
if (P) {
|
|
684
|
-
const i = new Set(P.map((f) => f.name)),
|
|
685
|
-
return [...P, ...
|
|
671
|
+
const i = new Set(P.map((f) => f.name)), a = $.filter((f) => !i.has(f.name));
|
|
672
|
+
return [...P, ...a];
|
|
686
673
|
}
|
|
687
|
-
return
|
|
688
|
-
}, [P,
|
|
674
|
+
return $;
|
|
675
|
+
}, [P, $]), S = C(() => {
|
|
689
676
|
if (!c) return c;
|
|
690
677
|
const i = Pe(c);
|
|
691
|
-
return s ? i.map((
|
|
678
|
+
return s ? i.map((a) => ({
|
|
692
679
|
...s,
|
|
693
|
-
...
|
|
680
|
+
...a
|
|
694
681
|
// Individual column props override defaults
|
|
695
682
|
})) : i;
|
|
696
|
-
}, [c, s]), G =
|
|
697
|
-
const i = Ve(o),
|
|
698
|
-
if (
|
|
683
|
+
}, [c, s]), G = C(() => {
|
|
684
|
+
const i = Ve(o), a = {};
|
|
685
|
+
if (u !== void 0 && (a.sortable = u), g !== void 0 && (a.filterable = g), w !== void 0 && (a.selectable = w), H) {
|
|
699
686
|
const f = i?.icons || o?.icons || {};
|
|
700
|
-
|
|
687
|
+
a.icons = { ...H, ...f };
|
|
701
688
|
}
|
|
702
|
-
if (
|
|
703
|
-
const f = i.plugins || [], h = new Set(f.map((D) => D.name)),
|
|
689
|
+
if (A.length > 0 && i) {
|
|
690
|
+
const f = i.plugins || [], h = new Set(f.map((D) => D.name)), L = A.filter((D) => !h.has(D.name));
|
|
704
691
|
return {
|
|
705
692
|
...i,
|
|
706
|
-
...
|
|
707
|
-
plugins: [...f, ...
|
|
693
|
+
...a,
|
|
694
|
+
plugins: [...f, ...L]
|
|
708
695
|
};
|
|
709
696
|
}
|
|
710
|
-
return
|
|
711
|
-
}, [o,
|
|
697
|
+
return A.length > 0 && !i ? { ...a, plugins: A } : Object.keys(a).length > 0 ? { ...i, ...a } : i;
|
|
698
|
+
}, [o, A, u, g, w, H]);
|
|
712
699
|
p(() => {
|
|
713
700
|
Y().setTypeDefaults(te);
|
|
714
701
|
}, [te]), p(() => {
|
|
715
|
-
|
|
702
|
+
l.current && (l.current.rows = r);
|
|
716
703
|
}, [r]), p(() => {
|
|
717
|
-
|
|
704
|
+
l.current && G && (l.current.gridConfig = G);
|
|
718
705
|
}, [G]), p(() => {
|
|
719
|
-
|
|
720
|
-
}, [
|
|
721
|
-
|
|
722
|
-
}, [
|
|
723
|
-
|
|
706
|
+
l.current && S && (l.current.columns = S);
|
|
707
|
+
}, [S]), p(() => {
|
|
708
|
+
l.current && d !== void 0 && (l.current.fitMode = d);
|
|
709
|
+
}, [d]), p(() => {
|
|
710
|
+
l.current && M !== void 0 && (l.current.editOn = M);
|
|
724
711
|
}, [M]), p(() => {
|
|
725
|
-
|
|
712
|
+
l.current && k !== void 0 && (l.current.loading = k);
|
|
726
713
|
}, [k]), p(() => {
|
|
727
|
-
const i =
|
|
714
|
+
const i = l.current;
|
|
728
715
|
if (!i) return;
|
|
729
|
-
const
|
|
730
|
-
i.__frameworkAdapter =
|
|
716
|
+
const a = Y();
|
|
717
|
+
i.__frameworkAdapter = a, $e(i), ze(i, a);
|
|
731
718
|
let f = !1;
|
|
732
719
|
const h = requestAnimationFrame(() => {
|
|
733
720
|
f || (typeof i.refreshColumns == "function" && i.refreshColumns(), typeof i.refreshShellHeader == "function" && i.refreshShellHeader());
|
|
@@ -736,44 +723,44 @@ const it = he(function(t, e) {
|
|
|
736
723
|
f = !0, cancelAnimationFrame(h);
|
|
737
724
|
};
|
|
738
725
|
}, []), p(() => {
|
|
739
|
-
if (!
|
|
740
|
-
const i =
|
|
726
|
+
if (!l.current || !N) return;
|
|
727
|
+
const i = l.current, a = "react-custom-styles";
|
|
741
728
|
let f = !0;
|
|
742
729
|
return i.ready?.().then(() => {
|
|
743
|
-
f && N && (i.registerStyles?.(
|
|
730
|
+
f && N && (i.registerStyles?.(a, N), F.current = a);
|
|
744
731
|
}), () => {
|
|
745
|
-
f = !1,
|
|
732
|
+
f = !1, F.current && (i.unregisterStyles?.(F.current), F.current = null);
|
|
746
733
|
};
|
|
747
734
|
}, [N]), p(() => {
|
|
748
|
-
const i =
|
|
735
|
+
const i = l.current;
|
|
749
736
|
if (!i) return;
|
|
750
|
-
const
|
|
737
|
+
const a = [];
|
|
751
738
|
if (j) {
|
|
752
739
|
const f = ((h) => j(h.detail.rows));
|
|
753
|
-
i.addEventListener("rows-change", f),
|
|
740
|
+
i.addEventListener("rows-change", f), a.push(["rows-change", f]);
|
|
754
741
|
}
|
|
755
742
|
return () => {
|
|
756
|
-
|
|
743
|
+
a.forEach(([f, h]) => {
|
|
757
744
|
i.removeEventListener(f, h);
|
|
758
745
|
});
|
|
759
746
|
};
|
|
760
747
|
}, [j]);
|
|
761
|
-
const se =
|
|
762
|
-
for (const i of Object.keys(
|
|
763
|
-
ce.current[i] =
|
|
748
|
+
const se = C(() => Object.keys(z).filter((i) => typeof R[i] == "function").sort().join("|"), [R]), ce = x({});
|
|
749
|
+
for (const i of Object.keys(z))
|
|
750
|
+
ce.current[i] = R[i];
|
|
764
751
|
return p(() => {
|
|
765
|
-
const i =
|
|
752
|
+
const i = l.current;
|
|
766
753
|
if (!i) return;
|
|
767
|
-
const
|
|
768
|
-
for (const [f, h] of Object.entries(
|
|
754
|
+
const a = [];
|
|
755
|
+
for (const [f, h] of Object.entries(z))
|
|
769
756
|
if (se.includes(f)) {
|
|
770
|
-
const
|
|
757
|
+
const L = ((D) => {
|
|
771
758
|
ce.current[f]?.(D.detail, D);
|
|
772
759
|
});
|
|
773
|
-
i.addEventListener(h,
|
|
760
|
+
i.addEventListener(h, L), a.push([h, L]);
|
|
774
761
|
}
|
|
775
762
|
return () => {
|
|
776
|
-
|
|
763
|
+
a.forEach(([f, h]) => {
|
|
777
764
|
i.removeEventListener(f, h);
|
|
778
765
|
});
|
|
779
766
|
};
|
|
@@ -781,40 +768,40 @@ const it = he(function(t, e) {
|
|
|
781
768
|
e,
|
|
782
769
|
() => ({
|
|
783
770
|
get element() {
|
|
784
|
-
return
|
|
771
|
+
return l.current;
|
|
785
772
|
},
|
|
786
773
|
async getConfig() {
|
|
787
|
-
return
|
|
774
|
+
return l.current?.getConfig?.() ?? {};
|
|
788
775
|
},
|
|
789
776
|
async ready() {
|
|
790
|
-
return
|
|
777
|
+
return l.current?.ready?.();
|
|
791
778
|
},
|
|
792
779
|
async forceLayout() {
|
|
793
|
-
return
|
|
780
|
+
return l.current?.forceLayout?.();
|
|
794
781
|
},
|
|
795
782
|
async toggleGroup(i) {
|
|
796
|
-
return
|
|
783
|
+
return l.current?.toggleGroup?.(i);
|
|
797
784
|
},
|
|
798
|
-
registerStyles(i,
|
|
799
|
-
|
|
785
|
+
registerStyles(i, a) {
|
|
786
|
+
l.current?.registerStyles?.(i, a);
|
|
800
787
|
},
|
|
801
788
|
unregisterStyles(i) {
|
|
802
|
-
|
|
789
|
+
l.current?.unregisterStyles?.(i);
|
|
803
790
|
},
|
|
804
|
-
setRowLoading(i,
|
|
805
|
-
|
|
791
|
+
setRowLoading(i, a) {
|
|
792
|
+
l.current?.setRowLoading?.(i, a);
|
|
806
793
|
},
|
|
807
|
-
setCellLoading(i,
|
|
808
|
-
|
|
794
|
+
setCellLoading(i, a, f) {
|
|
795
|
+
l.current?.setCellLoading?.(i, a, f);
|
|
809
796
|
},
|
|
810
797
|
isRowLoading(i) {
|
|
811
|
-
return
|
|
798
|
+
return l.current?.isRowLoading?.(i) ?? !1;
|
|
812
799
|
},
|
|
813
|
-
isCellLoading(i,
|
|
814
|
-
return
|
|
800
|
+
isCellLoading(i, a) {
|
|
801
|
+
return l.current?.isCellLoading?.(i, a) ?? !1;
|
|
815
802
|
},
|
|
816
803
|
clearAllLoading() {
|
|
817
|
-
|
|
804
|
+
l.current?.clearAllLoading?.();
|
|
818
805
|
}
|
|
819
806
|
}),
|
|
820
807
|
[]
|
|
@@ -822,14 +809,14 @@ const it = he(function(t, e) {
|
|
|
822
809
|
"tbw-grid",
|
|
823
810
|
{
|
|
824
811
|
ref: (i) => {
|
|
825
|
-
if (
|
|
826
|
-
const
|
|
827
|
-
G && (
|
|
812
|
+
if (l.current = i, i) {
|
|
813
|
+
const a = i;
|
|
814
|
+
G && (a.gridConfig = G), r && (a.rows = r), S && (a.columns = S);
|
|
828
815
|
}
|
|
829
816
|
},
|
|
830
817
|
class: fe,
|
|
831
818
|
style: ge,
|
|
832
|
-
children: /* @__PURE__ */ b(He.Provider, { value:
|
|
819
|
+
children: /* @__PURE__ */ b(He.Provider, { value: l, children: O })
|
|
833
820
|
}
|
|
834
821
|
);
|
|
835
822
|
});
|
|
@@ -840,8 +827,8 @@ export {
|
|
|
840
827
|
nt as a,
|
|
841
828
|
Qe as b,
|
|
842
829
|
Ye as c,
|
|
843
|
-
|
|
844
|
-
|
|
830
|
+
Fe as d,
|
|
831
|
+
xe as e,
|
|
845
832
|
tt as f,
|
|
846
833
|
et as g,
|
|
847
834
|
Ze as h,
|
package/features/clipboard.d.ts
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clipboard feature for @toolbox-web/grid-react
|
|
3
|
-
*
|
|
4
|
-
* Import this module to enable the `clipboard` prop on DataGrid.
|
|
5
|
-
* Requires the selection feature to be enabled.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* import '@toolbox-web/grid-react/features/selection';
|
|
10
|
-
* import '@toolbox-web/grid-react/features/clipboard';
|
|
11
|
-
*
|
|
12
|
-
* <DataGrid selection="range" clipboard />
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* @packageDocumentation
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
18
1
|
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/features/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/features/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,sCAAsC,CAAC"}
|