@toolbox-web/grid-react 1.8.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/features/clipboard.d.ts +1 -0
- package/features/clipboard.d.ts.map +1 -1
- package/features/column-virtualization.d.ts +1 -0
- package/features/column-virtualization.d.ts.map +1 -1
- package/features/context-menu.d.ts +1 -0
- package/features/context-menu.d.ts.map +1 -1
- package/features/editing.d.ts +1 -0
- package/features/editing.d.ts.map +1 -1
- package/features/export.d.ts +1 -0
- package/features/export.d.ts.map +1 -1
- package/features/filtering.d.ts +1 -0
- package/features/filtering.d.ts.map +1 -1
- package/features/grouping-columns.d.ts +1 -1
- package/features/grouping-columns.d.ts.map +1 -1
- package/features/grouping-rows.d.ts +1 -1
- package/features/grouping-rows.d.ts.map +1 -1
- package/features/index.d.ts.map +1 -1
- package/features/index.js +1 -0
- package/features/master-detail.d.ts +1 -0
- package/features/master-detail.d.ts.map +1 -1
- package/features/multi-sort.d.ts +1 -0
- package/features/multi-sort.d.ts.map +1 -1
- package/features/pinned-columns.d.ts +1 -0
- package/features/pinned-columns.d.ts.map +1 -1
- package/features/pinned-rows.d.ts +1 -0
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pivot.d.ts +1 -0
- package/features/pivot.d.ts.map +1 -1
- package/features/print.d.ts +1 -0
- package/features/print.d.ts.map +1 -1
- package/features/reorder-columns.d.ts +1 -0
- package/features/reorder-columns.d.ts.map +1 -1
- package/features/reorder-rows.d.ts +1 -0
- package/features/reorder-rows.d.ts.map +1 -1
- package/features/responsive.d.ts +1 -0
- package/features/responsive.d.ts.map +1 -1
- package/features/row-drag-drop.d.ts +1 -0
- package/features/row-drag-drop.d.ts.map +1 -1
- package/features/selection.d.ts +1 -0
- package/features/selection.d.ts.map +1 -1
- package/features/server-side.d.ts +1 -0
- package/features/server-side.d.ts.map +1 -1
- package/features/shell.d.ts +2 -0
- package/features/shell.d.ts.map +1 -0
- package/features/shell.js +1 -0
- package/features/sticky-rows.d.ts +1 -0
- package/features/sticky-rows.d.ts.map +1 -1
- package/features/tooltip.d.ts +1 -0
- package/features/tooltip.d.ts.map +1 -1
- package/features/tree.d.ts +1 -0
- package/features/tree.d.ts.map +1 -1
- package/features/undo-redo.d.ts +1 -0
- package/features/undo-redo.d.ts.map +1 -1
- package/features/visibility.d.ts +1 -0
- package/features/visibility.d.ts.map +1 -1
- package/index.js +226 -222
- package/lib/feature-props.d.ts +12 -0
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/grid-header-content.d.ts.map +1 -1
- package/lib/grid-toolbar-content.d.ts.map +1 -1
- package/lib/internal/feature-augmentations.d.ts +1 -0
- package/lib/internal/feature-augmentations.d.ts.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as x, Fragment as U, jsxs as he } from "react/jsx-runtime";
|
|
2
2
|
import { DataGridElement as ue } from "@toolbox-web/grid";
|
|
3
|
-
import { Children as ve, isValidElement as we, createContext as ae, useContext as T, forwardRef as le, useRef as P, useReducer as Re, useImperativeHandle as fe, useLayoutEffect as de, Component as be, useMemo as F, useEffect as b, createElement as Pe, useCallback as D, useId as ge, useState as
|
|
3
|
+
import { Children as ve, isValidElement as we, createContext as ae, useContext as T, forwardRef as le, useRef as P, useReducer as Re, useImperativeHandle as fe, useLayoutEffect as de, Component as be, useMemo as F, useEffect as b, createElement as Pe, useCallback as D, useId as ge, useState as N } from "react";
|
|
4
4
|
import { g as te, G as Ge, c as Se, d as xe } from "./chunks/react-grid-adapter-LBf2Mqhn.js";
|
|
5
5
|
import { e as hr, f as vr } from "./chunks/react-grid-adapter-LBf2Mqhn.js";
|
|
6
6
|
import { s as ne, r as pe, a as me } from "./chunks/portal-bridge-CvxNt40O.js";
|
|
@@ -10,22 +10,22 @@ import { r as Rr } from "./chunks/post-mount-refresh-hooks-Dt7mPoZC.js";
|
|
|
10
10
|
import { p as Fe } from "./chunks/react-column-config-BOe_PgL1.js";
|
|
11
11
|
import { r as Pr } from "./chunks/react-column-config-BOe_PgL1.js";
|
|
12
12
|
import { createPluginsFromFeatures as Te } from "@toolbox-web/grid/features/registry";
|
|
13
|
-
import { G as
|
|
13
|
+
import { G as O } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
14
14
|
import { G as Sr } from "./chunks/grid-detail-panel-BZFcujsZ.js";
|
|
15
15
|
import { G as Er } from "./chunks/grid-responsive-card-CSZhDCoN.js";
|
|
16
16
|
const q = /* @__PURE__ */ new Map();
|
|
17
|
-
function
|
|
17
|
+
function Ce(t, r) {
|
|
18
18
|
q.set(t, r);
|
|
19
19
|
}
|
|
20
20
|
function ke(t) {
|
|
21
21
|
const r = {};
|
|
22
|
-
return q.size === 0 || ve.forEach(t, (
|
|
23
|
-
if (!we(
|
|
24
|
-
const n =
|
|
25
|
-
if (typeof
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
const l = d
|
|
22
|
+
return q.size === 0 || ve.forEach(t, (d) => {
|
|
23
|
+
if (!we(d)) return;
|
|
24
|
+
const n = d.type, s = typeof n == "string" ? void 0 : n?.displayName;
|
|
25
|
+
if (typeof s != "string") return;
|
|
26
|
+
const g = q.get(s);
|
|
27
|
+
if (!g) return;
|
|
28
|
+
const l = g(d);
|
|
29
29
|
l && Object.assign(r, l);
|
|
30
30
|
}), r;
|
|
31
31
|
}
|
|
@@ -39,13 +39,13 @@ const Le = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "date
|
|
|
39
39
|
function Ae(t) {
|
|
40
40
|
const r = t.lastIndexOf(":");
|
|
41
41
|
if (r > 0) {
|
|
42
|
-
const
|
|
43
|
-
if (Le.has(
|
|
42
|
+
const d = t.slice(r + 1).toLowerCase();
|
|
43
|
+
if (Le.has(d)) {
|
|
44
44
|
const n = t.slice(0, r);
|
|
45
45
|
return {
|
|
46
46
|
field: n,
|
|
47
47
|
header: ie(n),
|
|
48
|
-
type:
|
|
48
|
+
type: d
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -57,13 +57,13 @@ function Ae(t) {
|
|
|
57
57
|
function Me(t) {
|
|
58
58
|
return t.map((r) => typeof r == "string" ? Ae(r) : r);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
return r ? t.map((
|
|
60
|
+
function Ne(t, r) {
|
|
61
|
+
return r ? t.map((d) => ({ ...r, ...d })) : t;
|
|
62
62
|
}
|
|
63
63
|
function or(t) {
|
|
64
64
|
return t.some((r) => typeof r == "string");
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const K = {
|
|
67
67
|
onCellClick: "cell-click",
|
|
68
68
|
onRowClick: "row-click",
|
|
69
69
|
onCellActivate: "cell-activate",
|
|
@@ -106,19 +106,19 @@ const B = {
|
|
|
106
106
|
onPrintComplete: "print-complete",
|
|
107
107
|
onTbwScroll: "tbw-scroll",
|
|
108
108
|
onRender: "render"
|
|
109
|
-
}, W = ae(null),
|
|
109
|
+
}, W = ae(null), Oe = ({ icons: t, children: r }) => /* @__PURE__ */ x(W.Provider, { value: t, children: r });
|
|
110
110
|
function ir() {
|
|
111
111
|
return T(W);
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const He = W, H = ae(null), $e = ({ defaults: t, children: r }) => /* @__PURE__ */ x(H.Provider, { value: t, children: r });
|
|
114
114
|
function sr() {
|
|
115
|
-
return T(
|
|
115
|
+
return T(H);
|
|
116
116
|
}
|
|
117
117
|
function cr(t) {
|
|
118
|
-
return T(
|
|
118
|
+
return T(H)?.[t];
|
|
119
119
|
}
|
|
120
|
-
const
|
|
121
|
-
class
|
|
120
|
+
const je = H;
|
|
121
|
+
class Be extends be {
|
|
122
122
|
state = { failed: !1 };
|
|
123
123
|
static getDerivedStateFromError() {
|
|
124
124
|
return { failed: !0 };
|
|
@@ -130,96 +130,96 @@ class He extends be {
|
|
|
130
130
|
return this.state.failed ? null : this.props.children;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
const n = P(/* @__PURE__ */ new Map()), [,
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
const ze = le(function(r, d) {
|
|
134
|
+
const n = P(/* @__PURE__ */ new Map()), [, s] = Re((C) => C + 1, 0), g = P(!1), l = P(0), u = P(0), v = P(!1), f = P(!1), w = () => {
|
|
135
|
+
g.current || (g.current = !0, queueMicrotask(() => {
|
|
136
|
+
g.current = !1, !f.current && (oe(s), R());
|
|
137
137
|
}));
|
|
138
|
-
},
|
|
138
|
+
}, R = () => {
|
|
139
139
|
l.current || (l.current = requestAnimationFrame(() => {
|
|
140
|
-
l.current = 0, !
|
|
140
|
+
l.current = 0, !f.current && s();
|
|
141
141
|
}));
|
|
142
|
-
},
|
|
143
|
-
console.error(`[grid-react] Portal "${
|
|
142
|
+
}, y = (C, o) => {
|
|
143
|
+
console.error(`[grid-react] Portal "${C}" crashed; dropping.`, o), n.current.delete(C), R();
|
|
144
144
|
};
|
|
145
145
|
fe(
|
|
146
|
-
|
|
146
|
+
d,
|
|
147
147
|
() => ({
|
|
148
|
-
renderPortal(
|
|
149
|
-
|
|
148
|
+
renderPortal(C, o, m) {
|
|
149
|
+
f.current || (n.current.set(C, { container: o, element: m }), w());
|
|
150
150
|
},
|
|
151
|
-
removePortal(
|
|
152
|
-
if (
|
|
153
|
-
n.current.delete(
|
|
151
|
+
removePortal(C, o) {
|
|
152
|
+
if (f.current) {
|
|
153
|
+
n.current.delete(C);
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
n.current.delete(
|
|
156
|
+
n.current.delete(C) && (u.current > 0 ? v.current = !0 : o ? oe(s) : w());
|
|
157
157
|
},
|
|
158
158
|
beginBatch() {
|
|
159
159
|
u.current++;
|
|
160
160
|
},
|
|
161
161
|
endBatch() {
|
|
162
|
-
u.current !== 0 && (u.current--, u.current === 0 &&
|
|
162
|
+
u.current !== 0 && (u.current--, u.current === 0 && v.current && (v.current = !1, s()));
|
|
163
163
|
},
|
|
164
164
|
clear() {
|
|
165
|
-
if (
|
|
165
|
+
if (f.current) {
|
|
166
166
|
n.current.clear();
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
n.current.size > 0 && (n.current.clear(), l.current && (cancelAnimationFrame(l.current), l.current = 0),
|
|
169
|
+
n.current.size > 0 && (n.current.clear(), l.current && (cancelAnimationFrame(l.current), l.current = 0), w());
|
|
170
170
|
}
|
|
171
171
|
}),
|
|
172
172
|
// forceRender is stable (useReducer dispatch), refs are stable
|
|
173
173
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
174
174
|
[]
|
|
175
175
|
), de(() => {
|
|
176
|
-
|
|
177
|
-
const
|
|
176
|
+
f.current = !1;
|
|
177
|
+
const C = n.current;
|
|
178
178
|
return () => {
|
|
179
|
-
|
|
179
|
+
f.current = !0, l.current && (cancelAnimationFrame(l.current), l.current = 0), C.clear();
|
|
180
180
|
};
|
|
181
181
|
}, []);
|
|
182
182
|
const G = [];
|
|
183
|
-
let
|
|
184
|
-
for (const [
|
|
183
|
+
let S = null;
|
|
184
|
+
for (const [C, { container: o, element: m }] of n.current) {
|
|
185
185
|
if (!o.isConnected) {
|
|
186
|
-
(
|
|
186
|
+
(S ??= []).push(C);
|
|
187
187
|
continue;
|
|
188
188
|
}
|
|
189
189
|
G.push(
|
|
190
190
|
Ee(
|
|
191
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ x(Be, { portalKey: C, onError: y, children: m }),
|
|
192
192
|
o,
|
|
193
|
-
|
|
193
|
+
C
|
|
194
194
|
)
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
197
|
+
if (S) {
|
|
198
|
+
const C = S;
|
|
199
199
|
queueMicrotask(() => {
|
|
200
|
-
for (const o of
|
|
200
|
+
for (const o of C) n.current.delete(o);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
}),
|
|
203
|
+
return /* @__PURE__ */ x(U, { children: G });
|
|
204
|
+
}), Ke = {
|
|
205
205
|
undoRedo: ["editing"],
|
|
206
206
|
clipboard: ["selection"]
|
|
207
207
|
};
|
|
208
208
|
function _e(t) {
|
|
209
209
|
const r = new Set(t);
|
|
210
|
-
for (const
|
|
211
|
-
const n =
|
|
210
|
+
for (const d of t) {
|
|
211
|
+
const n = Ke[d];
|
|
212
212
|
if (n)
|
|
213
|
-
for (const
|
|
214
|
-
r.has(
|
|
215
|
-
`[DataGrid] Feature "${
|
|
213
|
+
for (const s of n)
|
|
214
|
+
r.has(s) || console.warn(
|
|
215
|
+
`[DataGrid] Feature "${d}" requires "${s}" to be enabled. Add the "${s}" prop to your DataGrid.`
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function qe(t) {
|
|
220
220
|
const r = [];
|
|
221
|
-
for (const [
|
|
222
|
-
n === void 0 || n === !1 || r.push(
|
|
221
|
+
for (const [d, n] of Object.entries(t))
|
|
222
|
+
n === void 0 || n === !1 || r.push(d);
|
|
223
223
|
return _e(r), Te(t);
|
|
224
224
|
}
|
|
225
225
|
let se = !1, _ = null;
|
|
@@ -233,7 +233,7 @@ function Ue(t) {
|
|
|
233
233
|
let r = ce.get(t);
|
|
234
234
|
return r === void 0 && (r = ++Ve, ce.set(t, r)), r;
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
Ce("GridDetailPanel", (t) => {
|
|
237
237
|
const r = t.props;
|
|
238
238
|
return {
|
|
239
239
|
masterDetail: {
|
|
@@ -243,79 +243,79 @@ ye("GridDetailPanel", (t) => {
|
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
});
|
|
246
|
-
|
|
246
|
+
Ce("GridResponsiveCard", () => ({
|
|
247
247
|
// GridResponsiveCard only carries cardRowHeight; breakpoint is set via the
|
|
248
248
|
// responsive prop. Enable the plugin with defaults — user can override.
|
|
249
249
|
responsive: !0
|
|
250
250
|
}));
|
|
251
|
-
const ur = le(function(r,
|
|
251
|
+
const ur = le(function(r, d) {
|
|
252
252
|
const {
|
|
253
253
|
// Core props
|
|
254
254
|
rows: n,
|
|
255
|
-
gridConfig:
|
|
256
|
-
columns:
|
|
255
|
+
gridConfig: s,
|
|
256
|
+
columns: g,
|
|
257
257
|
columnDefaults: l,
|
|
258
258
|
fitMode: u,
|
|
259
|
-
sortable:
|
|
260
|
-
filterable:
|
|
261
|
-
selectable:
|
|
262
|
-
loading:
|
|
263
|
-
customStyles:
|
|
259
|
+
sortable: v,
|
|
260
|
+
filterable: f,
|
|
261
|
+
selectable: w,
|
|
262
|
+
loading: R,
|
|
263
|
+
customStyles: y,
|
|
264
264
|
className: G,
|
|
265
|
-
style:
|
|
266
|
-
children:
|
|
265
|
+
style: S,
|
|
266
|
+
children: C,
|
|
267
267
|
// Plugin props
|
|
268
268
|
plugins: o,
|
|
269
269
|
// SSR mode (deprecated - see SSRProps)
|
|
270
270
|
ssr: m,
|
|
271
271
|
// Legacy event handlers
|
|
272
|
-
onRowsChange:
|
|
272
|
+
onRowsChange: h,
|
|
273
273
|
// Feature props and event props are in ...rest
|
|
274
274
|
...p
|
|
275
|
-
} = r, a = P(null), M = P(null), J = P(!1), Y = T(
|
|
275
|
+
} = r, a = P(null), M = P(null), J = P(!1), Y = T(je), $ = T(He), ye = F(() => te().map((e) => {
|
|
276
276
|
const i = p[e];
|
|
277
277
|
if (i === void 0) return "";
|
|
278
|
-
let
|
|
278
|
+
let c;
|
|
279
279
|
try {
|
|
280
|
-
|
|
280
|
+
c = JSON.stringify(i) ?? "undefined";
|
|
281
281
|
} catch {
|
|
282
|
-
|
|
282
|
+
c = typeof i == "object" && i !== null ? `ref#${Ue(i)}` : `prim:${String(i)}`;
|
|
283
283
|
}
|
|
284
|
-
return `${e}:${
|
|
284
|
+
return `${e}:${c}`;
|
|
285
285
|
}).filter(Boolean).join("|"), [p]), Z = F(() => {
|
|
286
286
|
const e = {}, i = p;
|
|
287
|
-
for (const
|
|
288
|
-
const E = i[
|
|
289
|
-
E !== void 0 && (e[
|
|
287
|
+
for (const c of te()) {
|
|
288
|
+
const E = i[c];
|
|
289
|
+
E !== void 0 && (e[c] = E);
|
|
290
290
|
}
|
|
291
291
|
return e;
|
|
292
|
-
}, [
|
|
293
|
-
const e =
|
|
294
|
-
for (const [
|
|
295
|
-
e &&
|
|
292
|
+
}, [ye]), Q = F(() => ke(C), [C]), X = F(() => {
|
|
293
|
+
const e = s?.features, i = {};
|
|
294
|
+
for (const [c, E] of Object.entries(Q))
|
|
295
|
+
e && c in e && e[c] !== void 0 && e[c] !== !1 || (i[c] = E);
|
|
296
296
|
return { ...i, ...Z };
|
|
297
|
-
}, [Z, Q,
|
|
297
|
+
}, [Z, Q, s]), j = F(() => o || m ? [] : qe(X), [X, o, m]), k = F(() => {
|
|
298
298
|
if (o) {
|
|
299
|
-
const e = new Set(o.map((
|
|
299
|
+
const e = new Set(o.map((c) => c.name)), i = j.filter((c) => !e.has(c.name));
|
|
300
300
|
return [...o, ...i];
|
|
301
301
|
}
|
|
302
|
-
return
|
|
303
|
-
}, [o,
|
|
304
|
-
const e = Fe(
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
307
|
-
i.icons = {
|
|
302
|
+
return j;
|
|
303
|
+
}, [o, j]), I = F(() => g && Ne(Me(g), l), [g, l]), L = F(() => {
|
|
304
|
+
const e = Fe(s), i = {};
|
|
305
|
+
if (v !== void 0 && (i.sortable = v), f !== void 0 && (i.filterable = f), w !== void 0 && (i.selectable = w), $) {
|
|
306
|
+
const c = e?.icons || s?.icons || {};
|
|
307
|
+
i.icons = { ...$, ...c };
|
|
308
308
|
}
|
|
309
309
|
if (k.length > 0 && e) {
|
|
310
|
-
const
|
|
310
|
+
const c = e.plugins || [], E = new Set(c.map((A) => A.name)), z = k.filter((A) => !E.has(A.name));
|
|
311
311
|
return {
|
|
312
312
|
...e,
|
|
313
313
|
...i,
|
|
314
|
-
plugins: [...
|
|
314
|
+
plugins: [...c, ...z]
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
return k.length > 0 && !e ? { ...i, plugins: k } : Object.keys(i).length > 0 ? { ...e, ...i } : e;
|
|
318
|
-
}, [
|
|
318
|
+
}, [s, k, v, f, w, $]);
|
|
319
319
|
b(() => {
|
|
320
320
|
V().setTypeDefaults(Y);
|
|
321
321
|
}, [Y]), b(() => {
|
|
@@ -327,54 +327,54 @@ const ur = le(function(r, f) {
|
|
|
327
327
|
}, [I]), b(() => {
|
|
328
328
|
a.current && u !== void 0 && (a.current.fitMode = u);
|
|
329
329
|
}, [u]), b(() => {
|
|
330
|
-
a.current &&
|
|
331
|
-
}, [
|
|
330
|
+
a.current && R !== void 0 && (a.current.loading = R);
|
|
331
|
+
}, [R]), b(() => {
|
|
332
332
|
const e = a.current;
|
|
333
333
|
if (!e) return;
|
|
334
334
|
const i = V();
|
|
335
335
|
e.__frameworkAdapter = i, De(e);
|
|
336
|
-
let
|
|
336
|
+
let c = !1;
|
|
337
337
|
const E = requestAnimationFrame(() => {
|
|
338
|
-
|
|
338
|
+
c || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
|
|
339
339
|
});
|
|
340
340
|
return () => {
|
|
341
|
-
|
|
341
|
+
c = !0, cancelAnimationFrame(E);
|
|
342
342
|
};
|
|
343
343
|
}, []), b(() => {
|
|
344
|
-
if (!a.current || !
|
|
344
|
+
if (!a.current || !y) return;
|
|
345
345
|
const e = a.current, i = "react-custom-styles";
|
|
346
|
-
let
|
|
346
|
+
let c = !0;
|
|
347
347
|
return e.ready?.().then(() => {
|
|
348
|
-
|
|
348
|
+
c && y && (e.registerStyles?.(i, y), M.current = i);
|
|
349
349
|
}), () => {
|
|
350
|
-
|
|
350
|
+
c = !1, M.current && (e.unregisterStyles?.(M.current), M.current = null);
|
|
351
351
|
};
|
|
352
|
-
}, [
|
|
352
|
+
}, [y]), b(() => {
|
|
353
353
|
const e = a.current;
|
|
354
354
|
if (!e) return;
|
|
355
355
|
const i = [];
|
|
356
|
-
return
|
|
357
|
-
i.forEach((
|
|
356
|
+
return h && i.push(e.on("rows-change", (c) => h(c.rows))), () => {
|
|
357
|
+
i.forEach((c) => c());
|
|
358
358
|
};
|
|
359
|
-
}, [
|
|
360
|
-
const ee = F(() => Object.keys(
|
|
361
|
-
for (const e of Object.keys(
|
|
359
|
+
}, [h]);
|
|
360
|
+
const ee = F(() => Object.keys(K).filter((e) => typeof p[e] == "function").sort().join("|"), [p]), re = P({});
|
|
361
|
+
for (const e of Object.keys(K))
|
|
362
362
|
re.current[e] = p[e];
|
|
363
363
|
b(() => {
|
|
364
364
|
const e = a.current;
|
|
365
365
|
if (!e) return;
|
|
366
366
|
const i = [];
|
|
367
|
-
for (const [
|
|
368
|
-
ee.includes(
|
|
369
|
-
e.on(E, (
|
|
370
|
-
re.current[
|
|
367
|
+
for (const [c, E] of Object.entries(K))
|
|
368
|
+
ee.includes(c) && i.push(
|
|
369
|
+
e.on(E, (z, A) => {
|
|
370
|
+
re.current[c]?.(z, A);
|
|
371
371
|
})
|
|
372
372
|
);
|
|
373
373
|
return () => {
|
|
374
|
-
i.forEach((
|
|
374
|
+
i.forEach((c) => c());
|
|
375
375
|
};
|
|
376
376
|
}, [ee]), fe(
|
|
377
|
-
|
|
377
|
+
d,
|
|
378
378
|
() => ({
|
|
379
379
|
get element() {
|
|
380
380
|
return a.current;
|
|
@@ -400,8 +400,8 @@ const ur = le(function(r, f) {
|
|
|
400
400
|
setRowLoading(e, i) {
|
|
401
401
|
a.current?.setRowLoading?.(e, i);
|
|
402
402
|
},
|
|
403
|
-
setCellLoading(e, i,
|
|
404
|
-
a.current?.setCellLoading?.(e, i,
|
|
403
|
+
setCellLoading(e, i, c) {
|
|
404
|
+
a.current?.setCellLoading?.(e, i, c);
|
|
405
405
|
},
|
|
406
406
|
isRowLoading(e) {
|
|
407
407
|
return a.current?.isRowLoading?.(e) ?? !1;
|
|
@@ -415,14 +415,14 @@ const ur = le(function(r, f) {
|
|
|
415
415
|
}),
|
|
416
416
|
[]
|
|
417
417
|
);
|
|
418
|
-
const
|
|
418
|
+
const B = P(null);
|
|
419
419
|
return de(() => {
|
|
420
420
|
const e = a.current;
|
|
421
|
-
return e &&
|
|
421
|
+
return e && B.current && ne(e, B.current), () => {
|
|
422
422
|
e && ne(e, null);
|
|
423
423
|
};
|
|
424
424
|
}, []), /* @__PURE__ */ he(U, { children: [
|
|
425
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ x(ze, { ref: B }),
|
|
426
426
|
Pe(
|
|
427
427
|
ue.activeTag,
|
|
428
428
|
{
|
|
@@ -434,128 +434,132 @@ const ur = le(function(r, f) {
|
|
|
434
434
|
}
|
|
435
435
|
},
|
|
436
436
|
class: G,
|
|
437
|
-
style:
|
|
437
|
+
style: S
|
|
438
438
|
},
|
|
439
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ x(O.Provider, { value: a, children: C })
|
|
440
440
|
)
|
|
441
441
|
] });
|
|
442
442
|
});
|
|
443
443
|
function ar(t) {
|
|
444
444
|
const {
|
|
445
445
|
field: r,
|
|
446
|
-
header:
|
|
446
|
+
header: d,
|
|
447
447
|
type: n,
|
|
448
|
-
editable:
|
|
449
|
-
sortable:
|
|
448
|
+
editable: s,
|
|
449
|
+
sortable: g,
|
|
450
450
|
resizable: l,
|
|
451
451
|
width: u,
|
|
452
|
-
minWidth:
|
|
453
|
-
hidden:
|
|
454
|
-
lockVisible:
|
|
455
|
-
children:
|
|
456
|
-
editor:
|
|
452
|
+
minWidth: v,
|
|
453
|
+
hidden: f,
|
|
454
|
+
lockVisible: w,
|
|
455
|
+
children: R,
|
|
456
|
+
editor: y,
|
|
457
457
|
options: G,
|
|
458
|
-
multi:
|
|
459
|
-
format:
|
|
458
|
+
multi: S,
|
|
459
|
+
format: C
|
|
460
460
|
} = t, o = P(null), m = D(
|
|
461
461
|
(a) => {
|
|
462
|
-
o.current = a, a && (
|
|
462
|
+
o.current = a, a && (R && Se(a, R), y && xe(a, y));
|
|
463
463
|
},
|
|
464
|
-
[
|
|
465
|
-
),
|
|
464
|
+
[R, y]
|
|
465
|
+
), h = typeof u == "number" ? `${u}px` : u, p = {
|
|
466
466
|
field: r,
|
|
467
467
|
ref: m
|
|
468
468
|
};
|
|
469
|
-
return
|
|
469
|
+
return d !== void 0 && (p.header = d), n !== void 0 && (p.type = n), s !== void 0 && (p.editable = s), g !== void 0 && (p.sortable = g), l !== void 0 && (p.resizable = l), h !== void 0 && (p.width = h), v !== void 0 && (p["min-width"] = v), f !== void 0 && (p.hidden = f), w !== void 0 && (p["lock-visible"] = w), S !== void 0 && (p.multi = S), C && (p["data-has-format"] = "true"), G && (p["data-has-options"] = "true"), /* @__PURE__ */ x("tbw-grid-column", { ...p });
|
|
470
470
|
}
|
|
471
|
-
function lr({ id: t, order: r = 100, children:
|
|
472
|
-
const n = ge(),
|
|
471
|
+
function lr({ id: t, order: r = 100, children: d }) {
|
|
472
|
+
const n = ge(), s = t ?? `tbw-header-content-${n}`, g = T(O), [l, u] = N(null), v = P(null);
|
|
473
473
|
return b(() => {
|
|
474
|
-
const
|
|
475
|
-
if (!
|
|
476
|
-
const
|
|
477
|
-
let
|
|
474
|
+
const f = g?.current;
|
|
475
|
+
if (!f) return;
|
|
476
|
+
const w = v;
|
|
477
|
+
let R = !1;
|
|
478
478
|
return (async () => {
|
|
479
479
|
try {
|
|
480
|
-
await
|
|
480
|
+
await f.ready?.();
|
|
481
481
|
} catch {
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
id:
|
|
484
|
+
if (R) return;
|
|
485
|
+
const y = {
|
|
486
|
+
id: s,
|
|
487
487
|
order: r,
|
|
488
|
-
render: (
|
|
488
|
+
render: (S) => (u(S), () => {
|
|
489
489
|
})
|
|
490
|
-
};
|
|
491
|
-
|
|
490
|
+
}, G = f.getPluginByName?.("shell");
|
|
491
|
+
G?.registerHeaderContent ? G.registerHeaderContent(y) : f.registerHeaderContent?.(y);
|
|
492
492
|
})(), () => {
|
|
493
|
-
|
|
493
|
+
R = !0;
|
|
494
|
+
const y = f.getPluginByName?.("shell");
|
|
495
|
+
y?.unregisterHeaderContent ? y.unregisterHeaderContent(s) : f.unregisterHeaderContent?.(s), w.current && (pe(w.current, { sync: !0 }), w.current = null), u(null);
|
|
494
496
|
};
|
|
495
|
-
}, [
|
|
497
|
+
}, [g, s, r]), b(() => {
|
|
496
498
|
if (!l) return;
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
}, [
|
|
499
|
+
const f = g?.current ?? void 0;
|
|
500
|
+
v.current = me(l, d, v.current ?? void 0, f);
|
|
501
|
+
}, [d, l, g]), null;
|
|
500
502
|
}
|
|
501
503
|
function fr({ children: t }) {
|
|
502
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ x("tbw-grid-tool-buttons", { children: t });
|
|
503
505
|
}
|
|
504
|
-
function dr({ id: t, order: r = 100, children:
|
|
505
|
-
const n = ge(),
|
|
506
|
+
function dr({ id: t, order: r = 100, children: d }) {
|
|
507
|
+
const n = ge(), s = t ?? `tbw-toolbar-content-${n}`, g = T(O), [l, u] = N(null), v = P(null);
|
|
506
508
|
return b(() => {
|
|
507
|
-
const
|
|
508
|
-
if (!
|
|
509
|
-
const
|
|
510
|
-
let
|
|
509
|
+
const f = g?.current;
|
|
510
|
+
if (!f) return;
|
|
511
|
+
const w = v;
|
|
512
|
+
let R = !1;
|
|
511
513
|
return (async () => {
|
|
512
514
|
try {
|
|
513
|
-
await
|
|
515
|
+
await f.ready?.();
|
|
514
516
|
} catch {
|
|
515
517
|
return;
|
|
516
518
|
}
|
|
517
|
-
if (
|
|
518
|
-
const
|
|
519
|
-
id:
|
|
519
|
+
if (R) return;
|
|
520
|
+
const y = {
|
|
521
|
+
id: s,
|
|
520
522
|
order: r,
|
|
521
|
-
render: (
|
|
523
|
+
render: (S) => (u(S), () => {
|
|
522
524
|
})
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
+
}, G = f.getPluginByName?.("shell");
|
|
526
|
+
G?.registerToolbarContent ? G.registerToolbarContent(y) : f.registerToolbarContent?.(y);
|
|
525
527
|
})(), () => {
|
|
526
|
-
|
|
528
|
+
R = !0;
|
|
529
|
+
const y = f.getPluginByName?.("shell");
|
|
530
|
+
y?.unregisterToolbarContent ? y.unregisterToolbarContent(s) : f.unregisterToolbarContent?.(s), w.current && (pe(w.current, { sync: !0 }), w.current = null), u(null);
|
|
527
531
|
};
|
|
528
|
-
}, [
|
|
532
|
+
}, [g, s, r]), b(() => {
|
|
529
533
|
if (!l) return;
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
}, [
|
|
534
|
+
const f = g?.current ?? void 0;
|
|
535
|
+
v.current = me(l, d, v.current ?? void 0, f);
|
|
536
|
+
}, [d, l, g]), null;
|
|
533
537
|
}
|
|
534
|
-
const gr = ({ icons: t, defaults: r, children:
|
|
535
|
-
let n =
|
|
536
|
-
return r && (n = /* @__PURE__ */
|
|
538
|
+
const gr = ({ icons: t, defaults: r, children: d }) => {
|
|
539
|
+
let n = d;
|
|
540
|
+
return r && (n = /* @__PURE__ */ x($e, { defaults: r, children: n })), t && (n = /* @__PURE__ */ x(Oe, { icons: t, children: n })), /* @__PURE__ */ x(U, { children: n });
|
|
537
541
|
};
|
|
538
542
|
function pr(t) {
|
|
539
|
-
const r = P(null), [
|
|
543
|
+
const r = P(null), [d, n] = N(!1), [s, g] = N(null), l = P(null), u = D(() => t ? (l.current ??= document.querySelector(t), l.current) : r.current?.element ?? null, [t]);
|
|
540
544
|
b(() => {
|
|
541
545
|
let o = !0;
|
|
542
546
|
return (async () => {
|
|
543
547
|
try {
|
|
544
548
|
if (t) {
|
|
545
|
-
const
|
|
546
|
-
if (!
|
|
547
|
-
if (l.current =
|
|
549
|
+
const h = document.querySelector(t);
|
|
550
|
+
if (!h) return;
|
|
551
|
+
if (l.current = h, await h.ready?.(), o) {
|
|
548
552
|
n(!0);
|
|
549
|
-
const p = await
|
|
550
|
-
o && p &&
|
|
553
|
+
const p = await h.getConfig?.();
|
|
554
|
+
o && p && g(p);
|
|
551
555
|
}
|
|
552
556
|
} else {
|
|
553
|
-
const
|
|
554
|
-
if (!
|
|
555
|
-
if (await
|
|
557
|
+
const h = r.current;
|
|
558
|
+
if (!h) return;
|
|
559
|
+
if (await h.ready?.(), o) {
|
|
556
560
|
n(!0);
|
|
557
|
-
const p = await
|
|
558
|
-
o && p &&
|
|
561
|
+
const p = await h.getConfig?.();
|
|
562
|
+
o && p && g(p);
|
|
559
563
|
}
|
|
560
564
|
}
|
|
561
565
|
} catch {
|
|
@@ -564,13 +568,13 @@ function pr(t) {
|
|
|
564
568
|
o = !1;
|
|
565
569
|
};
|
|
566
570
|
}, [t]);
|
|
567
|
-
const
|
|
571
|
+
const v = D(async () => {
|
|
568
572
|
const o = u();
|
|
569
573
|
if (o)
|
|
570
574
|
return await o.getConfig?.() ?? null;
|
|
571
575
|
const m = r.current;
|
|
572
576
|
return m ? await m.getConfig?.() ?? null : null;
|
|
573
|
-
}, [u]),
|
|
577
|
+
}, [u]), f = D(async () => {
|
|
574
578
|
const o = u();
|
|
575
579
|
if (o) {
|
|
576
580
|
await o.forceLayout?.();
|
|
@@ -578,34 +582,34 @@ function pr(t) {
|
|
|
578
582
|
}
|
|
579
583
|
const m = r.current;
|
|
580
584
|
m && await m.forceLayout?.();
|
|
581
|
-
}, [u]),
|
|
585
|
+
}, [u]), w = D(
|
|
582
586
|
async (o) => {
|
|
583
587
|
const m = u();
|
|
584
588
|
if (m) {
|
|
585
589
|
await m.toggleGroup?.(o);
|
|
586
590
|
return;
|
|
587
591
|
}
|
|
588
|
-
const
|
|
589
|
-
|
|
592
|
+
const h = r.current;
|
|
593
|
+
h && await h.toggleGroup?.(o);
|
|
590
594
|
},
|
|
591
595
|
[u]
|
|
592
|
-
),
|
|
596
|
+
), R = D(
|
|
593
597
|
(o) => u()?.getPlugin?.(o),
|
|
594
598
|
[u]
|
|
595
|
-
),
|
|
599
|
+
), y = D(
|
|
596
600
|
((o) => u()?.getPluginByName?.(o)),
|
|
597
601
|
[u]
|
|
598
602
|
), G = D(
|
|
599
603
|
(o, m) => {
|
|
600
|
-
const
|
|
601
|
-
if (
|
|
602
|
-
|
|
604
|
+
const h = u();
|
|
605
|
+
if (h) {
|
|
606
|
+
h.registerStyles?.(o, m);
|
|
603
607
|
return;
|
|
604
608
|
}
|
|
605
609
|
r.current?.registerStyles?.(o, m);
|
|
606
610
|
},
|
|
607
611
|
[u]
|
|
608
|
-
),
|
|
612
|
+
), S = D(
|
|
609
613
|
(o) => {
|
|
610
614
|
const m = u();
|
|
611
615
|
if (m) {
|
|
@@ -615,34 +619,34 @@ function pr(t) {
|
|
|
615
619
|
r.current?.unregisterStyles?.(o);
|
|
616
620
|
},
|
|
617
621
|
[u]
|
|
618
|
-
),
|
|
622
|
+
), C = D(() => s?.columns ? s.columns.filter((o) => !o.hidden) : [], [s]);
|
|
619
623
|
return {
|
|
620
624
|
ref: r,
|
|
621
625
|
element: u(),
|
|
622
|
-
isReady:
|
|
623
|
-
config:
|
|
624
|
-
getConfig:
|
|
625
|
-
forceLayout:
|
|
626
|
-
toggleGroup:
|
|
627
|
-
getPlugin:
|
|
628
|
-
getPluginByName:
|
|
626
|
+
isReady: d,
|
|
627
|
+
config: s,
|
|
628
|
+
getConfig: v,
|
|
629
|
+
forceLayout: f,
|
|
630
|
+
toggleGroup: w,
|
|
631
|
+
getPlugin: R,
|
|
632
|
+
getPluginByName: y,
|
|
629
633
|
registerStyles: G,
|
|
630
|
-
unregisterStyles:
|
|
631
|
-
getVisibleColumns:
|
|
634
|
+
unregisterStyles: S,
|
|
635
|
+
getVisibleColumns: C
|
|
632
636
|
};
|
|
633
637
|
}
|
|
634
638
|
function mr(t, r = {}) {
|
|
635
|
-
const { open:
|
|
639
|
+
const { open: d = !0, gridElement: n } = r, s = T(O);
|
|
636
640
|
b(() => {
|
|
637
|
-
if (!f) return;
|
|
638
|
-
const d = t.current;
|
|
639
641
|
if (!d) return;
|
|
640
|
-
const
|
|
642
|
+
const g = t.current;
|
|
643
|
+
if (!g) return;
|
|
644
|
+
const l = n ?? g.closest("tbw-grid, [data-tbw-grid]") ?? s?.current ?? null;
|
|
641
645
|
if (l)
|
|
642
|
-
return l.registerExternalFocusContainer?.(
|
|
643
|
-
l.unregisterExternalFocusContainer?.(
|
|
646
|
+
return l.registerExternalFocusContainer?.(g), () => {
|
|
647
|
+
l.unregisterExternalFocusContainer?.(g);
|
|
644
648
|
};
|
|
645
|
-
}, [
|
|
649
|
+
}, [d, n, s, t]);
|
|
646
650
|
}
|
|
647
651
|
export {
|
|
648
652
|
ur as DataGrid,
|
|
@@ -650,18 +654,18 @@ export {
|
|
|
650
654
|
ar as GridColumn,
|
|
651
655
|
Sr as GridDetailPanel,
|
|
652
656
|
lr as GridHeaderContent,
|
|
653
|
-
|
|
657
|
+
Oe as GridIconProvider,
|
|
654
658
|
gr as GridProvider,
|
|
655
659
|
Er as GridResponsiveCard,
|
|
656
660
|
fr as GridToolButtons,
|
|
657
661
|
hr as GridToolPanel,
|
|
658
662
|
dr as GridToolbarContent,
|
|
659
|
-
|
|
660
|
-
|
|
663
|
+
$e as GridTypeProvider,
|
|
664
|
+
Ne as applyColumnDefaults,
|
|
661
665
|
or as hasColumnShorthands,
|
|
662
666
|
Me as normalizeColumns,
|
|
663
667
|
Ae as parseColumnShorthand,
|
|
664
|
-
|
|
668
|
+
Ce as registerChildFeatureDetector,
|
|
665
669
|
Pr as registerEditorMountHook,
|
|
666
670
|
vr as registerFeaturePropKey,
|
|
667
671
|
Rr as registerPostMountRefresh,
|