@toolbox-web/grid-react 1.6.0 → 1.7.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/{grid-detail-panel-CR7YUhdN.js → grid-detail-panel-BZFcujsZ.js} +10 -10
- package/chunks/grid-responsive-card-CSZhDCoN.js +45 -0
- package/chunks/portal-bridge-CvxNt40O.js +68 -0
- package/chunks/{react-column-config-B8Isgp88.js → react-column-config-BOe_PgL1.js} +28 -28
- package/chunks/{react-grid-adapter-DeV_qtlr.js → react-grid-adapter-BuuCl9rO.js} +65 -45
- package/features/editing.js +1 -1
- package/features/filtering.js +3 -3
- package/features/grouping-columns.js +1 -1
- package/features/grouping-rows.js +1 -1
- package/features/index.d.ts.map +1 -1
- package/features/index.js +1 -0
- package/features/master-detail.js +3 -3
- package/features/pinned-rows.js +1 -1
- package/features/responsive.js +3 -3
- package/features/row-drag-drop.js +1 -0
- package/features/sticky-rows.d.ts +1 -0
- package/features/sticky-rows.d.ts.map +1 -0
- package/features/sticky-rows.js +1 -0
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +331 -311
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/feature-props.d.ts +23 -5
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/portal-bridge.d.ts +15 -0
- package/lib/portal-bridge.d.ts.map +1 -1
- package/lib/portal-manager.d.ts +27 -0
- package/lib/portal-manager.d.ts.map +1 -1
- package/lib/react-grid-adapter.d.ts +18 -2
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/lib/use-grid-overlay.d.ts +3 -3
- package/package.json +1 -1
- package/chunks/grid-responsive-card-BB28Zl2O.js +0 -45
- package/chunks/portal-bridge-CH_xMkYc.js +0 -52
package/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { DataGridElement as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { g as
|
|
5
|
-
import { G as
|
|
6
|
-
import { s as ee } from "./chunks/portal-bridge-
|
|
7
|
-
import { flushSync as re, createPortal as
|
|
8
|
-
import { p as
|
|
9
|
-
import { G as we, c as
|
|
10
|
-
import { e as
|
|
11
|
-
import { createPluginsFromFeatures as
|
|
12
|
-
import { G as
|
|
13
|
-
import { G as
|
|
14
|
-
function
|
|
1
|
+
import { jsx as S, Fragment as V, jsxs as de } from "react/jsx-runtime";
|
|
2
|
+
import { DataGridElement as ie } from "@toolbox-web/grid";
|
|
3
|
+
import { createContext as se, useContext as A, forwardRef as ce, useRef as h, useReducer as ge, useImperativeHandle as ue, useLayoutEffect as ae, Component as pe, useMemo as E, useEffect as P, createElement as me, Children as Ce, isValidElement as ye, useCallback as x, useState as X } from "react";
|
|
4
|
+
import { g as he } from "./chunks/grid-responsive-card-CSZhDCoN.js";
|
|
5
|
+
import { G as lr } from "./chunks/grid-responsive-card-CSZhDCoN.js";
|
|
6
|
+
import { s as ee } from "./chunks/portal-bridge-CvxNt40O.js";
|
|
7
|
+
import { flushSync as re, createPortal as ve } from "react-dom";
|
|
8
|
+
import { p as Re } from "./chunks/react-column-config-BOe_PgL1.js";
|
|
9
|
+
import { G as we, c as be, d as Pe } from "./chunks/react-grid-adapter-BuuCl9rO.js";
|
|
10
|
+
import { e as dr } from "./chunks/react-grid-adapter-BuuCl9rO.js";
|
|
11
|
+
import { createPluginsFromFeatures as Se } from "@toolbox-web/grid/features/registry";
|
|
12
|
+
import { G as le } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
13
|
+
import { G as pr } from "./chunks/grid-detail-panel-BZFcujsZ.js";
|
|
14
|
+
function Ge(r) {
|
|
15
15
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
16
16
|
}
|
|
17
17
|
function te(r) {
|
|
18
|
-
return r.toLowerCase() === "id" ? "ID" : r.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(
|
|
18
|
+
return r.toLowerCase() === "id" ? "ID" : r.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(Ge).join(" ");
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
function
|
|
20
|
+
const xe = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
|
|
21
|
+
function Ee(r) {
|
|
22
22
|
const t = r.lastIndexOf(":");
|
|
23
23
|
if (t > 0) {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
24
|
+
const s = r.slice(t + 1).toLowerCase();
|
|
25
|
+
if (xe.has(s)) {
|
|
26
|
+
const i = r.slice(0, t);
|
|
27
27
|
return {
|
|
28
|
-
field:
|
|
29
|
-
header: te(
|
|
30
|
-
type:
|
|
28
|
+
field: i,
|
|
29
|
+
header: te(i),
|
|
30
|
+
type: s
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -36,16 +36,16 @@ function xe(r) {
|
|
|
36
36
|
header: te(r)
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return r.map((t) => typeof t == "string" ?
|
|
39
|
+
function De(r) {
|
|
40
|
+
return r.map((t) => typeof t == "string" ? Ee(t) : t);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return t ? r.map((
|
|
42
|
+
function Fe(r, t) {
|
|
43
|
+
return t ? r.map((s) => ({ ...t, ...s })) : r;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Qe(r) {
|
|
46
46
|
return r.some((t) => typeof t == "string");
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const $ = {
|
|
49
49
|
onCellClick: "cell-click",
|
|
50
50
|
onRowClick: "row-click",
|
|
51
51
|
onCellActivate: "cell-activate",
|
|
@@ -87,19 +87,19 @@ const B = {
|
|
|
87
87
|
onPrintStart: "print-start",
|
|
88
88
|
onPrintComplete: "print-complete",
|
|
89
89
|
onTbwScroll: "tbw-scroll"
|
|
90
|
-
}, H =
|
|
91
|
-
function Qe() {
|
|
92
|
-
return L(H);
|
|
93
|
-
}
|
|
94
|
-
const Le = H, N = ie(null), Ae = ({ defaults: r, children: t }) => /* @__PURE__ */ w(N.Provider, { value: r, children: t });
|
|
90
|
+
}, H = se(null), Ae = ({ icons: r, children: t }) => /* @__PURE__ */ S(H.Provider, { value: r, children: t });
|
|
95
91
|
function Xe() {
|
|
96
|
-
return
|
|
92
|
+
return A(H);
|
|
97
93
|
}
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
const Le = H, N = se(null), Te = ({ defaults: r, children: t }) => /* @__PURE__ */ S(N.Provider, { value: r, children: t });
|
|
95
|
+
function er() {
|
|
96
|
+
return A(N);
|
|
97
|
+
}
|
|
98
|
+
function rr(r) {
|
|
99
|
+
return A(N)?.[r];
|
|
100
100
|
}
|
|
101
101
|
const ke = N;
|
|
102
|
-
class Ie extends
|
|
102
|
+
class Ie extends pe {
|
|
103
103
|
state = { failed: !1 };
|
|
104
104
|
static getDerivedStateFromError() {
|
|
105
105
|
return { failed: !0 };
|
|
@@ -111,77 +111,97 @@ class Ie extends ge {
|
|
|
111
111
|
return this.state.failed ? null : this.props.children;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
const Me = ce(function(t, s) {
|
|
115
|
+
const i = h(/* @__PURE__ */ new Map()), [, f] = ge((p) => p + 1, 0), m = h(!1), d = h(0), a = h(0), v = h(!1), y = h(!1), R = () => {
|
|
116
|
+
m.current || (m.current = !0, queueMicrotask(() => {
|
|
117
|
+
m.current = !1, !y.current && (re(f), w());
|
|
118
118
|
}));
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
}, w = () => {
|
|
120
|
+
d.current || (d.current = requestAnimationFrame(() => {
|
|
121
|
+
d.current = 0, !y.current && f();
|
|
122
122
|
}));
|
|
123
|
-
},
|
|
124
|
-
console.error(`[grid-react] Portal "${
|
|
123
|
+
}, b = (p, n) => {
|
|
124
|
+
console.error(`[grid-react] Portal "${p}" crashed; dropping.`, n), i.current.delete(p), w();
|
|
125
125
|
};
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
ue(
|
|
127
|
+
s,
|
|
128
128
|
() => ({
|
|
129
|
-
renderPortal(
|
|
130
|
-
|
|
129
|
+
renderPortal(p, n, g) {
|
|
130
|
+
y.current || (i.current.set(p, { container: n, element: g }), R());
|
|
131
131
|
},
|
|
132
|
-
removePortal(
|
|
133
|
-
|
|
132
|
+
removePortal(p, n) {
|
|
133
|
+
if (y.current) {
|
|
134
|
+
i.current.delete(p);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
i.current.delete(p) && (a.current > 0 ? v.current = !0 : n ? re(f) : R());
|
|
138
|
+
},
|
|
139
|
+
beginBatch() {
|
|
140
|
+
a.current++;
|
|
141
|
+
},
|
|
142
|
+
endBatch() {
|
|
143
|
+
a.current !== 0 && (a.current--, a.current === 0 && v.current && (v.current = !1, f()));
|
|
134
144
|
},
|
|
135
145
|
clear() {
|
|
136
|
-
|
|
146
|
+
if (y.current) {
|
|
147
|
+
i.current.clear();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
i.current.size > 0 && (i.current.clear(), d.current && (cancelAnimationFrame(d.current), d.current = 0), R());
|
|
137
151
|
}
|
|
138
152
|
}),
|
|
139
153
|
// forceRender is stable (useReducer dispatch), refs are stable
|
|
140
154
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
155
|
[]
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
156
|
+
), ae(() => {
|
|
157
|
+
y.current = !1;
|
|
158
|
+
const p = i.current;
|
|
159
|
+
return () => {
|
|
160
|
+
y.current = !0, d.current && (cancelAnimationFrame(d.current), d.current = 0), p.clear();
|
|
161
|
+
};
|
|
162
|
+
}, []);
|
|
163
|
+
const D = [];
|
|
164
|
+
let G = null;
|
|
165
|
+
for (const [p, { container: n, element: g }] of i.current) {
|
|
166
|
+
if (!n.isConnected) {
|
|
167
|
+
(G ??= []).push(p);
|
|
148
168
|
continue;
|
|
149
169
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
|
|
170
|
+
D.push(
|
|
171
|
+
ve(
|
|
172
|
+
/* @__PURE__ */ S(Ie, { portalKey: p, onError: b, children: g }),
|
|
173
|
+
n,
|
|
174
|
+
p
|
|
155
175
|
)
|
|
156
176
|
);
|
|
157
177
|
}
|
|
158
|
-
if (
|
|
159
|
-
const
|
|
178
|
+
if (G) {
|
|
179
|
+
const p = G;
|
|
160
180
|
queueMicrotask(() => {
|
|
161
|
-
for (const
|
|
181
|
+
for (const n of p) i.current.delete(n);
|
|
162
182
|
});
|
|
163
183
|
}
|
|
164
|
-
return /* @__PURE__ */
|
|
165
|
-
}),
|
|
184
|
+
return /* @__PURE__ */ S(V, { children: D });
|
|
185
|
+
}), Ne = {
|
|
166
186
|
undoRedo: ["editing"],
|
|
167
187
|
clipboard: ["selection"]
|
|
168
188
|
};
|
|
169
|
-
function
|
|
189
|
+
function Oe(r) {
|
|
170
190
|
const t = new Set(r);
|
|
171
|
-
for (const
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
for (const f of
|
|
191
|
+
for (const s of r) {
|
|
192
|
+
const i = Ne[s];
|
|
193
|
+
if (i)
|
|
194
|
+
for (const f of i)
|
|
175
195
|
t.has(f) || console.warn(
|
|
176
|
-
`[DataGrid] Feature "${
|
|
196
|
+
`[DataGrid] Feature "${s}" requires "${f}" to be enabled. Add the "${f}" prop to your DataGrid.`
|
|
177
197
|
);
|
|
178
198
|
}
|
|
179
199
|
}
|
|
180
|
-
function
|
|
200
|
+
function je(r) {
|
|
181
201
|
const t = [];
|
|
182
|
-
for (const [
|
|
183
|
-
|
|
184
|
-
return
|
|
202
|
+
for (const [s, i] of Object.entries(r))
|
|
203
|
+
i === void 0 || i === !1 || t.push(s);
|
|
204
|
+
return Oe(t), Se(r);
|
|
185
205
|
}
|
|
186
206
|
let ne = !1, _ = null;
|
|
187
207
|
const oe = [
|
|
@@ -211,157 +231,157 @@ const oe = [
|
|
|
211
231
|
"tooltip"
|
|
212
232
|
];
|
|
213
233
|
function q() {
|
|
214
|
-
return ne || (_ = new we(),
|
|
234
|
+
return ne || (_ = new we(), ie.registerAdapter(_), ne = !0), _;
|
|
215
235
|
}
|
|
216
236
|
q();
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
|
|
237
|
+
function ze(r) {
|
|
238
|
+
const s = r.getPluginByName?.("masterDetail");
|
|
239
|
+
s && typeof s.refreshDetailRenderer == "function" && s.refreshDetailRenderer();
|
|
220
240
|
}
|
|
221
|
-
function
|
|
222
|
-
const
|
|
223
|
-
if (!r.querySelector("tbw-grid-responsive-card") || !
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
const
|
|
227
|
-
|
|
241
|
+
function Be(r, t) {
|
|
242
|
+
const s = r;
|
|
243
|
+
if (!r.querySelector("tbw-grid-responsive-card") || !he(r)) return;
|
|
244
|
+
const m = s.getPluginByName?.("responsive");
|
|
245
|
+
if (m && typeof m.setCardRenderer == "function") {
|
|
246
|
+
const d = t.createResponsiveCardRenderer(r);
|
|
247
|
+
d && m.setCardRenderer(d);
|
|
228
248
|
}
|
|
229
249
|
}
|
|
230
250
|
function $e(r) {
|
|
231
251
|
const t = {};
|
|
232
|
-
return
|
|
233
|
-
if (
|
|
234
|
-
if (
|
|
235
|
-
const
|
|
252
|
+
return Ce.forEach(r, (s) => {
|
|
253
|
+
if (ye(s)) {
|
|
254
|
+
if (s.type && s.type.displayName === "GridDetailPanel") {
|
|
255
|
+
const i = s.props;
|
|
236
256
|
t.masterDetail = {
|
|
237
257
|
// Use props from the child component for configuration
|
|
238
|
-
showExpandColumn:
|
|
239
|
-
animation:
|
|
258
|
+
showExpandColumn: i.showExpandColumn ?? !0,
|
|
259
|
+
animation: i.animation ?? "slide"
|
|
240
260
|
// detailRenderer will be wired up by refreshMasterDetailRenderer after mount
|
|
241
261
|
};
|
|
242
262
|
}
|
|
243
|
-
|
|
263
|
+
s.type && s.type.displayName === "GridResponsiveCard" && (t.responsive = !0);
|
|
244
264
|
}
|
|
245
265
|
}), t;
|
|
246
266
|
}
|
|
247
|
-
const
|
|
267
|
+
const tr = ce(function(t, s) {
|
|
248
268
|
const {
|
|
249
269
|
// Core props
|
|
250
|
-
rows:
|
|
270
|
+
rows: i,
|
|
251
271
|
gridConfig: f,
|
|
252
|
-
columns:
|
|
253
|
-
columnDefaults:
|
|
254
|
-
fitMode:
|
|
255
|
-
sortable:
|
|
256
|
-
filterable:
|
|
257
|
-
selectable:
|
|
258
|
-
loading:
|
|
259
|
-
customStyles:
|
|
260
|
-
className:
|
|
272
|
+
columns: m,
|
|
273
|
+
columnDefaults: d,
|
|
274
|
+
fitMode: a,
|
|
275
|
+
sortable: v,
|
|
276
|
+
filterable: y,
|
|
277
|
+
selectable: R,
|
|
278
|
+
loading: w,
|
|
279
|
+
customStyles: b,
|
|
280
|
+
className: D,
|
|
261
281
|
style: G,
|
|
262
|
-
children:
|
|
282
|
+
children: p,
|
|
263
283
|
// Plugin props
|
|
264
|
-
plugins:
|
|
284
|
+
plugins: n,
|
|
265
285
|
// SSR mode (deprecated - see SSRProps)
|
|
266
|
-
ssr:
|
|
286
|
+
ssr: g,
|
|
267
287
|
// Legacy event handlers
|
|
268
288
|
onRowsChange: C,
|
|
269
289
|
// Feature props and event props are in ...rest
|
|
270
|
-
...
|
|
271
|
-
} = t, c =
|
|
272
|
-
const
|
|
273
|
-
return
|
|
274
|
-
}).filter(Boolean).join("|"), [
|
|
290
|
+
...l
|
|
291
|
+
} = t, c = h(null), M = h(null), K = h(!1), U = A(ke), O = A(Le), fe = E(() => oe.map((e) => {
|
|
292
|
+
const o = l[e];
|
|
293
|
+
return o !== void 0 ? `${e}:${JSON.stringify(o)}` : "";
|
|
294
|
+
}).filter(Boolean).join("|"), [l]), Y = E(() => {
|
|
275
295
|
const e = {};
|
|
276
|
-
for (const
|
|
277
|
-
|
|
296
|
+
for (const o of oe)
|
|
297
|
+
o in l && l[o] !== void 0 && (e[o] = l[o]);
|
|
278
298
|
return e;
|
|
279
|
-
}, [
|
|
280
|
-
const e = f?.features,
|
|
281
|
-
for (const [
|
|
282
|
-
e &&
|
|
283
|
-
return { ...
|
|
284
|
-
}, [Y, J, f]), j = E(() =>
|
|
285
|
-
if (
|
|
286
|
-
const e = new Set(
|
|
287
|
-
return [...
|
|
299
|
+
}, [fe]), J = E(() => $e(p), [p]), W = E(() => {
|
|
300
|
+
const e = f?.features, o = {};
|
|
301
|
+
for (const [u, F] of Object.entries(J))
|
|
302
|
+
e && u in e && e[u] !== void 0 && e[u] !== !1 || (o[u] = F);
|
|
303
|
+
return { ...o, ...Y };
|
|
304
|
+
}, [Y, J, f]), j = E(() => n || g ? [] : je(W), [W, n, g]), L = E(() => {
|
|
305
|
+
if (n) {
|
|
306
|
+
const e = new Set(n.map((u) => u.name)), o = j.filter((u) => !e.has(u.name));
|
|
307
|
+
return [...n, ...o];
|
|
288
308
|
}
|
|
289
309
|
return j;
|
|
290
|
-
}, [
|
|
291
|
-
const e =
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
|
|
310
|
+
}, [n, j]), T = E(() => m && Fe(De(m), d), [m, d]), k = E(() => {
|
|
311
|
+
const e = Re(f), o = {};
|
|
312
|
+
if (v !== void 0 && (o.sortable = v), y !== void 0 && (o.filterable = y), R !== void 0 && (o.selectable = R), O) {
|
|
313
|
+
const u = e?.icons || f?.icons || {};
|
|
314
|
+
o.icons = { ...O, ...u };
|
|
295
315
|
}
|
|
296
|
-
if (
|
|
297
|
-
const
|
|
316
|
+
if (L.length > 0 && e) {
|
|
317
|
+
const u = e.plugins || [], F = new Set(u.map((I) => I.name)), B = L.filter((I) => !F.has(I.name));
|
|
298
318
|
return {
|
|
299
319
|
...e,
|
|
300
|
-
...
|
|
301
|
-
plugins: [...
|
|
320
|
+
...o,
|
|
321
|
+
plugins: [...u, ...B]
|
|
302
322
|
};
|
|
303
323
|
}
|
|
304
|
-
return
|
|
305
|
-
}, [f,
|
|
306
|
-
|
|
324
|
+
return L.length > 0 && !e ? { ...o, plugins: L } : Object.keys(o).length > 0 ? { ...e, ...o } : e;
|
|
325
|
+
}, [f, L, v, y, R, O]);
|
|
326
|
+
P(() => {
|
|
307
327
|
q().setTypeDefaults(U);
|
|
308
|
-
}, [U]),
|
|
309
|
-
c.current && (c.current.rows =
|
|
310
|
-
}, [
|
|
311
|
-
c.current &&
|
|
312
|
-
}, [
|
|
313
|
-
c.current &&
|
|
314
|
-
}, [
|
|
315
|
-
c.current &&
|
|
316
|
-
}, [
|
|
317
|
-
c.current &&
|
|
318
|
-
}, [
|
|
328
|
+
}, [U]), P(() => {
|
|
329
|
+
c.current && (c.current.rows = i);
|
|
330
|
+
}, [i]), P(() => {
|
|
331
|
+
c.current && k && (c.current.gridConfig = k);
|
|
332
|
+
}, [k]), P(() => {
|
|
333
|
+
c.current && T && (c.current.columns = T);
|
|
334
|
+
}, [T]), P(() => {
|
|
335
|
+
c.current && a !== void 0 && (c.current.fitMode = a);
|
|
336
|
+
}, [a]), P(() => {
|
|
337
|
+
c.current && w !== void 0 && (c.current.loading = w);
|
|
338
|
+
}, [w]), P(() => {
|
|
319
339
|
const e = c.current;
|
|
320
340
|
if (!e) return;
|
|
321
|
-
const
|
|
322
|
-
e.__frameworkAdapter =
|
|
323
|
-
let
|
|
341
|
+
const o = q();
|
|
342
|
+
e.__frameworkAdapter = o, ze(e), Be(e, o);
|
|
343
|
+
let u = !1;
|
|
324
344
|
const F = requestAnimationFrame(() => {
|
|
325
|
-
|
|
345
|
+
u || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
|
|
326
346
|
});
|
|
327
347
|
return () => {
|
|
328
|
-
|
|
348
|
+
u = !0, cancelAnimationFrame(F);
|
|
329
349
|
};
|
|
330
|
-
}, []),
|
|
331
|
-
if (!c.current || !
|
|
332
|
-
const e = c.current,
|
|
333
|
-
let
|
|
350
|
+
}, []), P(() => {
|
|
351
|
+
if (!c.current || !b) return;
|
|
352
|
+
const e = c.current, o = "react-custom-styles";
|
|
353
|
+
let u = !0;
|
|
334
354
|
return e.ready?.().then(() => {
|
|
335
|
-
|
|
355
|
+
u && b && (e.registerStyles?.(o, b), M.current = o);
|
|
336
356
|
}), () => {
|
|
337
|
-
|
|
357
|
+
u = !1, M.current && (e.unregisterStyles?.(M.current), M.current = null);
|
|
338
358
|
};
|
|
339
|
-
}, [
|
|
359
|
+
}, [b]), P(() => {
|
|
340
360
|
const e = c.current;
|
|
341
361
|
if (!e) return;
|
|
342
|
-
const
|
|
343
|
-
return C &&
|
|
344
|
-
|
|
362
|
+
const o = [];
|
|
363
|
+
return C && o.push(e.on("rows-change", (u) => C(u.rows))), () => {
|
|
364
|
+
o.forEach((u) => u());
|
|
345
365
|
};
|
|
346
366
|
}, [C]);
|
|
347
|
-
const Z = E(() => Object.keys(
|
|
348
|
-
for (const e of Object.keys(
|
|
349
|
-
Q.current[e] =
|
|
350
|
-
|
|
367
|
+
const Z = E(() => Object.keys($).filter((e) => typeof l[e] == "function").sort().join("|"), [l]), Q = h({});
|
|
368
|
+
for (const e of Object.keys($))
|
|
369
|
+
Q.current[e] = l[e];
|
|
370
|
+
P(() => {
|
|
351
371
|
const e = c.current;
|
|
352
372
|
if (!e) return;
|
|
353
|
-
const
|
|
354
|
-
for (const [
|
|
355
|
-
Z.includes(
|
|
356
|
-
e.on(F, (
|
|
357
|
-
Q.current[
|
|
373
|
+
const o = [];
|
|
374
|
+
for (const [u, F] of Object.entries($))
|
|
375
|
+
Z.includes(u) && o.push(
|
|
376
|
+
e.on(F, (B, I) => {
|
|
377
|
+
Q.current[u]?.(B, I);
|
|
358
378
|
})
|
|
359
379
|
);
|
|
360
380
|
return () => {
|
|
361
|
-
|
|
381
|
+
o.forEach((u) => u());
|
|
362
382
|
};
|
|
363
|
-
}, [Z]),
|
|
364
|
-
|
|
383
|
+
}, [Z]), ue(
|
|
384
|
+
s,
|
|
365
385
|
() => ({
|
|
366
386
|
get element() {
|
|
367
387
|
return c.current;
|
|
@@ -378,23 +398,23 @@ const rr = se(function(t, i) {
|
|
|
378
398
|
async toggleGroup(e) {
|
|
379
399
|
return c.current?.toggleGroup?.(e);
|
|
380
400
|
},
|
|
381
|
-
registerStyles(e,
|
|
382
|
-
c.current?.registerStyles?.(e,
|
|
401
|
+
registerStyles(e, o) {
|
|
402
|
+
c.current?.registerStyles?.(e, o);
|
|
383
403
|
},
|
|
384
404
|
unregisterStyles(e) {
|
|
385
405
|
c.current?.unregisterStyles?.(e);
|
|
386
406
|
},
|
|
387
|
-
setRowLoading(e,
|
|
388
|
-
c.current?.setRowLoading?.(e,
|
|
407
|
+
setRowLoading(e, o) {
|
|
408
|
+
c.current?.setRowLoading?.(e, o);
|
|
389
409
|
},
|
|
390
|
-
setCellLoading(e,
|
|
391
|
-
c.current?.setCellLoading?.(e,
|
|
410
|
+
setCellLoading(e, o, u) {
|
|
411
|
+
c.current?.setCellLoading?.(e, o, u);
|
|
392
412
|
},
|
|
393
413
|
isRowLoading(e) {
|
|
394
414
|
return c.current?.isRowLoading?.(e) ?? !1;
|
|
395
415
|
},
|
|
396
|
-
isCellLoading(e,
|
|
397
|
-
return c.current?.isCellLoading?.(e,
|
|
416
|
+
isCellLoading(e, o) {
|
|
417
|
+
return c.current?.isCellLoading?.(e, o) ?? !1;
|
|
398
418
|
},
|
|
399
419
|
clearAllLoading() {
|
|
400
420
|
c.current?.clearAllLoading?.();
|
|
@@ -402,193 +422,193 @@ const rr = se(function(t, i) {
|
|
|
402
422
|
}),
|
|
403
423
|
[]
|
|
404
424
|
);
|
|
405
|
-
const z =
|
|
406
|
-
return
|
|
425
|
+
const z = h(null);
|
|
426
|
+
return ae(() => {
|
|
407
427
|
const e = c.current;
|
|
408
428
|
return e && z.current && ee(e, z.current), () => {
|
|
409
429
|
e && ee(e, null);
|
|
410
430
|
};
|
|
411
|
-
}, []), /* @__PURE__ */
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
|
|
414
|
-
|
|
431
|
+
}, []), /* @__PURE__ */ de(V, { children: [
|
|
432
|
+
/* @__PURE__ */ S(Me, { ref: z }),
|
|
433
|
+
me(
|
|
434
|
+
ie.activeTag,
|
|
415
435
|
{
|
|
416
436
|
ref: (e) => {
|
|
417
437
|
if (c.current = e, e && !K.current) {
|
|
418
438
|
K.current = !0;
|
|
419
|
-
const
|
|
420
|
-
|
|
439
|
+
const o = e;
|
|
440
|
+
k && (o.gridConfig = k), i && (o.rows = i), T && (o.columns = T);
|
|
421
441
|
}
|
|
422
442
|
},
|
|
423
|
-
class:
|
|
424
|
-
style: G
|
|
425
|
-
|
|
426
|
-
}
|
|
443
|
+
class: D,
|
|
444
|
+
style: G
|
|
445
|
+
},
|
|
446
|
+
/* @__PURE__ */ S(le.Provider, { value: c, children: p })
|
|
427
447
|
)
|
|
428
448
|
] });
|
|
429
449
|
});
|
|
430
|
-
function
|
|
450
|
+
function nr(r) {
|
|
431
451
|
const {
|
|
432
452
|
field: t,
|
|
433
|
-
header:
|
|
434
|
-
type:
|
|
453
|
+
header: s,
|
|
454
|
+
type: i,
|
|
435
455
|
editable: f,
|
|
436
|
-
sortable:
|
|
437
|
-
resizable:
|
|
438
|
-
width:
|
|
439
|
-
minWidth:
|
|
440
|
-
hidden:
|
|
441
|
-
lockVisible:
|
|
442
|
-
children:
|
|
443
|
-
editor:
|
|
444
|
-
options:
|
|
456
|
+
sortable: m,
|
|
457
|
+
resizable: d,
|
|
458
|
+
width: a,
|
|
459
|
+
minWidth: v,
|
|
460
|
+
hidden: y,
|
|
461
|
+
lockVisible: R,
|
|
462
|
+
children: w,
|
|
463
|
+
editor: b,
|
|
464
|
+
options: D,
|
|
445
465
|
multi: G,
|
|
446
|
-
format:
|
|
447
|
-
} = r,
|
|
466
|
+
format: p
|
|
467
|
+
} = r, n = h(null), g = x(
|
|
448
468
|
(c) => {
|
|
449
|
-
|
|
469
|
+
n.current = c, c && (w && be(c, w), b && Pe(c, b));
|
|
450
470
|
},
|
|
451
|
-
[
|
|
452
|
-
), C = typeof
|
|
471
|
+
[w, b]
|
|
472
|
+
), C = typeof a == "number" ? `${a}px` : a, l = {
|
|
453
473
|
field: t,
|
|
454
|
-
ref:
|
|
474
|
+
ref: g
|
|
455
475
|
};
|
|
456
|
-
return
|
|
476
|
+
return s !== void 0 && (l.header = s), i !== void 0 && (l.type = i), f !== void 0 && (l.editable = f), m !== void 0 && (l.sortable = m), d !== void 0 && (l.resizable = d), C !== void 0 && (l.width = C), v !== void 0 && (l["min-width"] = v), y !== void 0 && (l.hidden = y), R !== void 0 && (l["lock-visible"] = R), G !== void 0 && (l.multi = G), p && (l["data-has-format"] = "true"), D && (l["data-has-options"] = "true"), /* @__PURE__ */ S("tbw-grid-column", { ...l });
|
|
457
477
|
}
|
|
458
|
-
function
|
|
459
|
-
return /* @__PURE__ */
|
|
478
|
+
function or({ children: r }) {
|
|
479
|
+
return /* @__PURE__ */ S("tbw-grid-tool-buttons", { children: r });
|
|
460
480
|
}
|
|
461
|
-
const
|
|
462
|
-
let
|
|
463
|
-
return t && (
|
|
481
|
+
const ir = ({ icons: r, defaults: t, children: s }) => {
|
|
482
|
+
let i = s;
|
|
483
|
+
return t && (i = /* @__PURE__ */ S(Te, { defaults: t, children: i })), r && (i = /* @__PURE__ */ S(Ae, { icons: r, children: i })), /* @__PURE__ */ S(V, { children: i });
|
|
464
484
|
};
|
|
465
|
-
function
|
|
466
|
-
const t =
|
|
467
|
-
|
|
468
|
-
let
|
|
485
|
+
function sr(r) {
|
|
486
|
+
const t = h(null), [s, i] = X(!1), [f, m] = X(null), d = h(null), a = x(() => r ? (d.current ??= document.querySelector(r), d.current) : t.current?.element ?? null, [r]);
|
|
487
|
+
P(() => {
|
|
488
|
+
let n = !0;
|
|
469
489
|
return (async () => {
|
|
470
490
|
try {
|
|
471
491
|
if (r) {
|
|
472
492
|
const C = document.querySelector(r);
|
|
473
493
|
if (!C) return;
|
|
474
|
-
if (
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
|
|
494
|
+
if (d.current = C, await C.ready?.(), n) {
|
|
495
|
+
i(!0);
|
|
496
|
+
const l = await C.getConfig?.();
|
|
497
|
+
n && l && m(l);
|
|
478
498
|
}
|
|
479
499
|
} else {
|
|
480
500
|
const C = t.current;
|
|
481
501
|
if (!C) return;
|
|
482
|
-
if (await C.ready?.(),
|
|
483
|
-
|
|
484
|
-
const
|
|
485
|
-
|
|
502
|
+
if (await C.ready?.(), n) {
|
|
503
|
+
i(!0);
|
|
504
|
+
const l = await C.getConfig?.();
|
|
505
|
+
n && l && m(l);
|
|
486
506
|
}
|
|
487
507
|
}
|
|
488
508
|
} catch {
|
|
489
509
|
}
|
|
490
510
|
})(), () => {
|
|
491
|
-
|
|
511
|
+
n = !1;
|
|
492
512
|
};
|
|
493
513
|
}, [r]);
|
|
494
|
-
const
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
return await
|
|
498
|
-
const
|
|
499
|
-
return
|
|
500
|
-
}, [
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
await
|
|
514
|
+
const v = x(async () => {
|
|
515
|
+
const n = a();
|
|
516
|
+
if (n)
|
|
517
|
+
return await n.getConfig?.() ?? null;
|
|
518
|
+
const g = t.current;
|
|
519
|
+
return g ? await g.getConfig?.() ?? null : null;
|
|
520
|
+
}, [a]), y = x(async () => {
|
|
521
|
+
const n = a();
|
|
522
|
+
if (n) {
|
|
523
|
+
await n.forceLayout?.();
|
|
504
524
|
return;
|
|
505
525
|
}
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
}, [
|
|
509
|
-
async (
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
512
|
-
await
|
|
526
|
+
const g = t.current;
|
|
527
|
+
g && await g.forceLayout?.();
|
|
528
|
+
}, [a]), R = x(
|
|
529
|
+
async (n) => {
|
|
530
|
+
const g = a();
|
|
531
|
+
if (g) {
|
|
532
|
+
await g.toggleGroup?.(n);
|
|
513
533
|
return;
|
|
514
534
|
}
|
|
515
535
|
const C = t.current;
|
|
516
|
-
C && await C.toggleGroup?.(
|
|
536
|
+
C && await C.toggleGroup?.(n);
|
|
517
537
|
},
|
|
518
|
-
[
|
|
519
|
-
),
|
|
520
|
-
(
|
|
521
|
-
[
|
|
522
|
-
),
|
|
523
|
-
((
|
|
524
|
-
[
|
|
525
|
-
),
|
|
526
|
-
(
|
|
527
|
-
const C =
|
|
538
|
+
[a]
|
|
539
|
+
), w = x(
|
|
540
|
+
(n) => a()?.getPlugin?.(n),
|
|
541
|
+
[a]
|
|
542
|
+
), b = x(
|
|
543
|
+
((n) => a()?.getPluginByName?.(n)),
|
|
544
|
+
[a]
|
|
545
|
+
), D = x(
|
|
546
|
+
(n, g) => {
|
|
547
|
+
const C = a();
|
|
528
548
|
if (C) {
|
|
529
|
-
C.registerStyles?.(
|
|
549
|
+
C.registerStyles?.(n, g);
|
|
530
550
|
return;
|
|
531
551
|
}
|
|
532
|
-
t.current?.registerStyles?.(
|
|
552
|
+
t.current?.registerStyles?.(n, g);
|
|
533
553
|
},
|
|
534
|
-
[
|
|
554
|
+
[a]
|
|
535
555
|
), G = x(
|
|
536
|
-
(
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
539
|
-
|
|
556
|
+
(n) => {
|
|
557
|
+
const g = a();
|
|
558
|
+
if (g) {
|
|
559
|
+
g.unregisterStyles?.(n);
|
|
540
560
|
return;
|
|
541
561
|
}
|
|
542
|
-
t.current?.unregisterStyles?.(
|
|
562
|
+
t.current?.unregisterStyles?.(n);
|
|
543
563
|
},
|
|
544
|
-
[
|
|
545
|
-
),
|
|
564
|
+
[a]
|
|
565
|
+
), p = x(() => f?.columns ? f.columns.filter((n) => !n.hidden) : [], [f]);
|
|
546
566
|
return {
|
|
547
567
|
ref: t,
|
|
548
|
-
element:
|
|
549
|
-
isReady:
|
|
568
|
+
element: a(),
|
|
569
|
+
isReady: s,
|
|
550
570
|
config: f,
|
|
551
|
-
getConfig:
|
|
552
|
-
forceLayout:
|
|
553
|
-
toggleGroup:
|
|
554
|
-
getPlugin:
|
|
555
|
-
getPluginByName:
|
|
556
|
-
registerStyles:
|
|
571
|
+
getConfig: v,
|
|
572
|
+
forceLayout: y,
|
|
573
|
+
toggleGroup: R,
|
|
574
|
+
getPlugin: w,
|
|
575
|
+
getPluginByName: b,
|
|
576
|
+
registerStyles: D,
|
|
557
577
|
unregisterStyles: G,
|
|
558
|
-
getVisibleColumns:
|
|
578
|
+
getVisibleColumns: p
|
|
559
579
|
};
|
|
560
580
|
}
|
|
561
|
-
function
|
|
562
|
-
const { open:
|
|
563
|
-
|
|
564
|
-
if (!
|
|
565
|
-
const
|
|
566
|
-
if (!
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
569
|
-
return
|
|
570
|
-
|
|
581
|
+
function cr(r, t = {}) {
|
|
582
|
+
const { open: s = !0, gridElement: i } = t, f = A(le);
|
|
583
|
+
P(() => {
|
|
584
|
+
if (!s) return;
|
|
585
|
+
const m = r.current;
|
|
586
|
+
if (!m) return;
|
|
587
|
+
const d = i ?? m.closest("tbw-grid, [data-tbw-grid]") ?? f?.current ?? null;
|
|
588
|
+
if (d)
|
|
589
|
+
return d.registerExternalFocusContainer?.(m), () => {
|
|
590
|
+
d.unregisterExternalFocusContainer?.(m);
|
|
571
591
|
};
|
|
572
|
-
}, [
|
|
592
|
+
}, [s, i, f, r]);
|
|
573
593
|
}
|
|
574
594
|
export {
|
|
575
|
-
|
|
595
|
+
tr as DataGrid,
|
|
576
596
|
we as GridAdapter,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
597
|
+
nr as GridColumn,
|
|
598
|
+
pr as GridDetailPanel,
|
|
599
|
+
Ae as GridIconProvider,
|
|
600
|
+
ir as GridProvider,
|
|
601
|
+
lr as GridResponsiveCard,
|
|
602
|
+
or as GridToolButtons,
|
|
603
|
+
dr as GridToolPanel,
|
|
604
|
+
Te as GridTypeProvider,
|
|
605
|
+
Fe as applyColumnDefaults,
|
|
606
|
+
Qe as hasColumnShorthands,
|
|
607
|
+
De as normalizeColumns,
|
|
608
|
+
Ee as parseColumnShorthand,
|
|
609
|
+
sr as useGrid,
|
|
610
|
+
Xe as useGridIcons,
|
|
611
|
+
cr as useGridOverlay,
|
|
612
|
+
er as useGridTypeDefaults,
|
|
613
|
+
rr as useTypeDefault
|
|
594
614
|
};
|