@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.
Files changed (34) hide show
  1. package/chunks/{grid-detail-panel-CR7YUhdN.js → grid-detail-panel-BZFcujsZ.js} +10 -10
  2. package/chunks/grid-responsive-card-CSZhDCoN.js +45 -0
  3. package/chunks/portal-bridge-CvxNt40O.js +68 -0
  4. package/chunks/{react-column-config-B8Isgp88.js → react-column-config-BOe_PgL1.js} +28 -28
  5. package/chunks/{react-grid-adapter-DeV_qtlr.js → react-grid-adapter-BuuCl9rO.js} +65 -45
  6. package/features/editing.js +1 -1
  7. package/features/filtering.js +3 -3
  8. package/features/grouping-columns.js +1 -1
  9. package/features/grouping-rows.js +1 -1
  10. package/features/index.d.ts.map +1 -1
  11. package/features/index.js +1 -0
  12. package/features/master-detail.js +3 -3
  13. package/features/pinned-rows.js +1 -1
  14. package/features/responsive.js +3 -3
  15. package/features/row-drag-drop.js +1 -0
  16. package/features/sticky-rows.d.ts +1 -0
  17. package/features/sticky-rows.d.ts.map +1 -0
  18. package/features/sticky-rows.js +1 -0
  19. package/index.d.ts +2 -1
  20. package/index.d.ts.map +1 -1
  21. package/index.js +331 -311
  22. package/lib/data-grid.d.ts.map +1 -1
  23. package/lib/feature-props.d.ts +23 -5
  24. package/lib/feature-props.d.ts.map +1 -1
  25. package/lib/portal-bridge.d.ts +15 -0
  26. package/lib/portal-bridge.d.ts.map +1 -1
  27. package/lib/portal-manager.d.ts +27 -0
  28. package/lib/portal-manager.d.ts.map +1 -1
  29. package/lib/react-grid-adapter.d.ts +18 -2
  30. package/lib/react-grid-adapter.d.ts.map +1 -1
  31. package/lib/use-grid-overlay.d.ts +3 -3
  32. package/package.json +1 -1
  33. package/chunks/grid-responsive-card-BB28Zl2O.js +0 -45
  34. package/chunks/portal-bridge-CH_xMkYc.js +0 -52
package/index.js CHANGED
@@ -1,33 +1,33 @@
1
- import { jsx as w, Fragment as V, jsxs as le } from "react/jsx-runtime";
2
- import { DataGridElement as fe } from "@toolbox-web/grid";
3
- import { createContext as ie, useContext as L, forwardRef as se, useRef as b, useReducer as de, useImperativeHandle as ce, Component as ge, useMemo as E, useEffect as v, useLayoutEffect as pe, Children as me, isValidElement as Ce, useCallback as x, useState as X } from "react";
4
- import { g as ye } from "./chunks/grid-responsive-card-BB28Zl2O.js";
5
- import { G as ur } from "./chunks/grid-responsive-card-BB28Zl2O.js";
6
- import { s as ee } from "./chunks/portal-bridge-CH_xMkYc.js";
7
- import { flushSync as re, createPortal as he } from "react-dom";
8
- import { p as ve } from "./chunks/react-column-config-B8Isgp88.js";
9
- import { G as we, c as Re, d as Pe } from "./chunks/react-grid-adapter-DeV_qtlr.js";
10
- import { e as fr } from "./chunks/react-grid-adapter-DeV_qtlr.js";
11
- import { createPluginsFromFeatures as be } from "@toolbox-web/grid/features/registry";
12
- import { G as ae } from "./chunks/grid-element-context-BU3WvNtM.js";
13
- import { G as gr } from "./chunks/grid-detail-panel-CR7YUhdN.js";
14
- function Se(r) {
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(Se).join(" ");
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 Ge = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
21
- function xe(r) {
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 i = r.slice(t + 1).toLowerCase();
25
- if (Ge.has(i)) {
26
- const o = r.slice(0, t);
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: o,
29
- header: te(o),
30
- type: i
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 Ee(r) {
40
- return r.map((t) => typeof t == "string" ? xe(t) : t);
39
+ function De(r) {
40
+ return r.map((t) => typeof t == "string" ? Ee(t) : t);
41
41
  }
42
- function De(r, t) {
43
- return t ? r.map((i) => ({ ...t, ...i })) : r;
42
+ function Fe(r, t) {
43
+ return t ? r.map((s) => ({ ...t, ...s })) : r;
44
44
  }
45
- function Ze(r) {
45
+ function Qe(r) {
46
46
  return r.some((t) => typeof t == "string");
47
47
  }
48
- const B = {
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 = ie(null), Fe = ({ icons: r, children: t }) => /* @__PURE__ */ w(H.Provider, { value: r, children: t });
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 L(N);
92
+ return A(H);
97
93
  }
98
- function er(r) {
99
- return L(N)?.[r];
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 ge {
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 Te = se(function(t, i) {
115
- const o = b(/* @__PURE__ */ new Map()), [, f] = de((d) => d + 1, 0), g = b(!1), p = b(0), l = () => {
116
- g.current || (g.current = !0, queueMicrotask(() => {
117
- g.current = !1, re(f), R();
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
- }, R = () => {
120
- p.current || (p.current = requestAnimationFrame(() => {
121
- p.current = 0, f();
119
+ }, w = () => {
120
+ d.current || (d.current = requestAnimationFrame(() => {
121
+ d.current = 0, !y.current && f();
122
122
  }));
123
- }, S = (d, y) => {
124
- console.error(`[grid-react] Portal "${d}" crashed; dropping.`, y), o.current.delete(d), R();
123
+ }, b = (p, n) => {
124
+ console.error(`[grid-react] Portal "${p}" crashed; dropping.`, n), i.current.delete(p), w();
125
125
  };
126
- ce(
127
- i,
126
+ ue(
127
+ s,
128
128
  () => ({
129
- renderPortal(d, y, G) {
130
- o.current.set(d, { container: y, element: G }), l();
129
+ renderPortal(p, n, g) {
130
+ y.current || (i.current.set(p, { container: n, element: g }), R());
131
131
  },
132
- removePortal(d, y) {
133
- o.current.delete(d) && (y ? re(f) : l());
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
- o.current.size > 0 && (o.current.clear(), p.current && (cancelAnimationFrame(p.current), p.current = 0), l());
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
- const P = [];
144
- let h = null;
145
- for (const [d, { container: y, element: G }] of o.current) {
146
- if (!y.isConnected) {
147
- (h ??= []).push(d);
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
- P.push(
151
- he(
152
- /* @__PURE__ */ w(Ie, { portalKey: d, onError: S, children: G }),
153
- y,
154
- d
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 (h) {
159
- const d = h;
178
+ if (G) {
179
+ const p = G;
160
180
  queueMicrotask(() => {
161
- for (const y of d) o.current.delete(y);
181
+ for (const n of p) i.current.delete(n);
162
182
  });
163
183
  }
164
- return /* @__PURE__ */ w(V, { children: P });
165
- }), Me = {
184
+ return /* @__PURE__ */ S(V, { children: D });
185
+ }), Ne = {
166
186
  undoRedo: ["editing"],
167
187
  clipboard: ["selection"]
168
188
  };
169
- function Ne(r) {
189
+ function Oe(r) {
170
190
  const t = new Set(r);
171
- for (const i of r) {
172
- const o = Me[i];
173
- if (o)
174
- for (const f of o)
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 "${i}" requires "${f}" to be enabled. Add the "${f}" prop to your DataGrid.`
196
+ `[DataGrid] Feature "${s}" requires "${f}" to be enabled. Add the "${f}" prop to your DataGrid.`
177
197
  );
178
198
  }
179
199
  }
180
- function Oe(r) {
200
+ function je(r) {
181
201
  const t = [];
182
- for (const [i, o] of Object.entries(r))
183
- o === void 0 || o === !1 || t.push(i);
184
- return Ne(t), be(r);
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(), fe.registerAdapter(_), ne = !0), _;
234
+ return ne || (_ = new we(), ie.registerAdapter(_), ne = !0), _;
215
235
  }
216
236
  q();
217
- function je(r) {
218
- const i = r.getPluginByName?.("masterDetail");
219
- i && typeof i.refreshDetailRenderer == "function" && i.refreshDetailRenderer();
237
+ function ze(r) {
238
+ const s = r.getPluginByName?.("masterDetail");
239
+ s && typeof s.refreshDetailRenderer == "function" && s.refreshDetailRenderer();
220
240
  }
221
- function ze(r, t) {
222
- const i = r;
223
- if (!r.querySelector("tbw-grid-responsive-card") || !ye(r)) return;
224
- const g = i.getPluginByName?.("responsive");
225
- if (g && typeof g.setCardRenderer == "function") {
226
- const p = t.createResponsiveCardRenderer(r);
227
- p && g.setCardRenderer(p);
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 me.forEach(r, (i) => {
233
- if (Ce(i)) {
234
- if (i.type && i.type.displayName === "GridDetailPanel") {
235
- const o = i.props;
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: o.showExpandColumn ?? !0,
239
- animation: o.animation ?? "slide"
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
- i.type && i.type.displayName === "GridResponsiveCard" && (t.responsive = !0);
263
+ s.type && s.type.displayName === "GridResponsiveCard" && (t.responsive = !0);
244
264
  }
245
265
  }), t;
246
266
  }
247
- const rr = se(function(t, i) {
267
+ const tr = ce(function(t, s) {
248
268
  const {
249
269
  // Core props
250
- rows: o,
270
+ rows: i,
251
271
  gridConfig: f,
252
- columns: g,
253
- columnDefaults: p,
254
- fitMode: l,
255
- sortable: R,
256
- filterable: S,
257
- selectable: P,
258
- loading: h,
259
- customStyles: d,
260
- className: y,
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: D,
282
+ children: p,
263
283
  // Plugin props
264
- plugins: s,
284
+ plugins: n,
265
285
  // SSR mode (deprecated - see SSRProps)
266
- ssr: m,
286
+ ssr: g,
267
287
  // Legacy event handlers
268
288
  onRowsChange: C,
269
289
  // Feature props and event props are in ...rest
270
- ...u
271
- } = t, c = b(null), M = b(null), K = b(!1), U = L(ke), O = L(Le), ue = E(() => oe.map((e) => {
272
- const n = u[e];
273
- return n !== void 0 ? `${e}:${JSON.stringify(n)}` : "";
274
- }).filter(Boolean).join("|"), [u]), Y = E(() => {
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 n of oe)
277
- n in u && u[n] !== void 0 && (e[n] = u[n]);
296
+ for (const o of oe)
297
+ o in l && l[o] !== void 0 && (e[o] = l[o]);
278
298
  return e;
279
- }, [ue]), J = E(() => $e(D), [D]), W = E(() => {
280
- const e = f?.features, n = {};
281
- for (const [a, F] of Object.entries(J))
282
- e && a in e && e[a] !== void 0 && e[a] !== !1 || (n[a] = F);
283
- return { ...n, ...Y };
284
- }, [Y, J, f]), j = E(() => s || m ? [] : Oe(W), [W, s, m]), A = E(() => {
285
- if (s) {
286
- const e = new Set(s.map((a) => a.name)), n = j.filter((a) => !e.has(a.name));
287
- return [...s, ...n];
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
- }, [s, j]), k = E(() => g && De(Ee(g), p), [g, p]), I = E(() => {
291
- const e = ve(f), n = {};
292
- if (R !== void 0 && (n.sortable = R), S !== void 0 && (n.filterable = S), P !== void 0 && (n.selectable = P), O) {
293
- const a = e?.icons || f?.icons || {};
294
- n.icons = { ...O, ...a };
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 (A.length > 0 && e) {
297
- const a = e.plugins || [], F = new Set(a.map((T) => T.name)), $ = A.filter((T) => !F.has(T.name));
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
- ...n,
301
- plugins: [...a, ...$]
320
+ ...o,
321
+ plugins: [...u, ...B]
302
322
  };
303
323
  }
304
- return A.length > 0 && !e ? { ...n, plugins: A } : Object.keys(n).length > 0 ? { ...e, ...n } : e;
305
- }, [f, A, R, S, P, O]);
306
- v(() => {
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]), v(() => {
309
- c.current && (c.current.rows = o);
310
- }, [o]), v(() => {
311
- c.current && I && (c.current.gridConfig = I);
312
- }, [I]), v(() => {
313
- c.current && k && (c.current.columns = k);
314
- }, [k]), v(() => {
315
- c.current && l !== void 0 && (c.current.fitMode = l);
316
- }, [l]), v(() => {
317
- c.current && h !== void 0 && (c.current.loading = h);
318
- }, [h]), v(() => {
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 n = q();
322
- e.__frameworkAdapter = n, je(e), ze(e, n);
323
- let a = !1;
341
+ const o = q();
342
+ e.__frameworkAdapter = o, ze(e), Be(e, o);
343
+ let u = !1;
324
344
  const F = requestAnimationFrame(() => {
325
- a || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
345
+ u || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
326
346
  });
327
347
  return () => {
328
- a = !0, cancelAnimationFrame(F);
348
+ u = !0, cancelAnimationFrame(F);
329
349
  };
330
- }, []), v(() => {
331
- if (!c.current || !d) return;
332
- const e = c.current, n = "react-custom-styles";
333
- let a = !0;
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
- a && d && (e.registerStyles?.(n, d), M.current = n);
355
+ u && b && (e.registerStyles?.(o, b), M.current = o);
336
356
  }), () => {
337
- a = !1, M.current && (e.unregisterStyles?.(M.current), M.current = null);
357
+ u = !1, M.current && (e.unregisterStyles?.(M.current), M.current = null);
338
358
  };
339
- }, [d]), v(() => {
359
+ }, [b]), P(() => {
340
360
  const e = c.current;
341
361
  if (!e) return;
342
- const n = [];
343
- return C && n.push(e.on("rows-change", (a) => C(a.rows))), () => {
344
- n.forEach((a) => a());
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(B).filter((e) => typeof u[e] == "function").sort().join("|"), [u]), Q = b({});
348
- for (const e of Object.keys(B))
349
- Q.current[e] = u[e];
350
- v(() => {
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 n = [];
354
- for (const [a, F] of Object.entries(B))
355
- Z.includes(a) && n.push(
356
- e.on(F, ($, T) => {
357
- Q.current[a]?.($, T);
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
- n.forEach((a) => a());
381
+ o.forEach((u) => u());
362
382
  };
363
- }, [Z]), ce(
364
- i,
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, n) {
382
- c.current?.registerStyles?.(e, n);
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, n) {
388
- c.current?.setRowLoading?.(e, n);
407
+ setRowLoading(e, o) {
408
+ c.current?.setRowLoading?.(e, o);
389
409
  },
390
- setCellLoading(e, n, a) {
391
- c.current?.setCellLoading?.(e, n, a);
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, n) {
397
- return c.current?.isCellLoading?.(e, n) ?? !1;
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 = b(null);
406
- return pe(() => {
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__ */ le(V, { children: [
412
- /* @__PURE__ */ w(Te, { ref: z }),
413
- /* @__PURE__ */ w(
414
- "tbw-grid",
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 n = e;
420
- I && (n.gridConfig = I), o && (n.rows = o), k && (n.columns = k);
439
+ const o = e;
440
+ k && (o.gridConfig = k), i && (o.rows = i), T && (o.columns = T);
421
441
  }
422
442
  },
423
- class: y,
424
- style: G,
425
- children: /* @__PURE__ */ w(ae.Provider, { value: c, children: D })
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 tr(r) {
450
+ function nr(r) {
431
451
  const {
432
452
  field: t,
433
- header: i,
434
- type: o,
453
+ header: s,
454
+ type: i,
435
455
  editable: f,
436
- sortable: g,
437
- resizable: p,
438
- width: l,
439
- minWidth: R,
440
- hidden: S,
441
- lockVisible: P,
442
- children: h,
443
- editor: d,
444
- options: y,
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: D
447
- } = r, s = b(null), m = x(
466
+ format: p
467
+ } = r, n = h(null), g = x(
448
468
  (c) => {
449
- s.current = c, c && (h && Re(c, h), d && Pe(c, d));
469
+ n.current = c, c && (w && be(c, w), b && Pe(c, b));
450
470
  },
451
- [h, d, t]
452
- ), C = typeof l == "number" ? `${l}px` : l, u = {
471
+ [w, b]
472
+ ), C = typeof a == "number" ? `${a}px` : a, l = {
453
473
  field: t,
454
- ref: m
474
+ ref: g
455
475
  };
456
- return i !== void 0 && (u.header = i), o !== void 0 && (u.type = o), f !== void 0 && (u.editable = f), g !== void 0 && (u.sortable = g), p !== void 0 && (u.resizable = p), C !== void 0 && (u.width = C), R !== void 0 && (u["min-width"] = R), S !== void 0 && (u.hidden = S), P !== void 0 && (u["lock-visible"] = P), G !== void 0 && (u.multi = G), D && (u["data-has-format"] = "true"), y && (u["data-has-options"] = "true"), /* @__PURE__ */ w("tbw-grid-column", { ...u });
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 nr({ children: r }) {
459
- return /* @__PURE__ */ w("tbw-grid-tool-buttons", { children: r });
478
+ function or({ children: r }) {
479
+ return /* @__PURE__ */ S("tbw-grid-tool-buttons", { children: r });
460
480
  }
461
- const or = ({ icons: r, defaults: t, children: i }) => {
462
- let o = i;
463
- return t && (o = /* @__PURE__ */ w(Ae, { defaults: t, children: o })), r && (o = /* @__PURE__ */ w(Fe, { icons: r, children: o })), /* @__PURE__ */ w(V, { children: o });
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 ir(r) {
466
- const t = b(null), [i, o] = X(!1), [f, g] = X(null), p = b(null), l = x(() => r ? (p.current ??= document.querySelector(r), p.current) : t.current?.element ?? null, [r]);
467
- v(() => {
468
- let s = !0;
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 (p.current = C, await C.ready?.(), s) {
475
- o(!0);
476
- const u = await C.getConfig?.();
477
- s && u && g(u);
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?.(), s) {
483
- o(!0);
484
- const u = await C.getConfig?.();
485
- s && u && g(u);
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
- s = !1;
511
+ n = !1;
492
512
  };
493
513
  }, [r]);
494
- const R = x(async () => {
495
- const s = l();
496
- if (s)
497
- return await s.getConfig?.() ?? null;
498
- const m = t.current;
499
- return m ? await m.getConfig?.() ?? null : null;
500
- }, [l]), S = x(async () => {
501
- const s = l();
502
- if (s) {
503
- await s.forceLayout?.();
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 m = t.current;
507
- m && await m.forceLayout?.();
508
- }, [l]), P = x(
509
- async (s) => {
510
- const m = l();
511
- if (m) {
512
- await m.toggleGroup?.(s);
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?.(s);
536
+ C && await C.toggleGroup?.(n);
517
537
  },
518
- [l]
519
- ), h = x(
520
- (s) => l()?.getPlugin?.(s),
521
- [l]
522
- ), d = x(
523
- ((s) => l()?.getPluginByName?.(s)),
524
- [l]
525
- ), y = x(
526
- (s, m) => {
527
- const C = l();
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?.(s, m);
549
+ C.registerStyles?.(n, g);
530
550
  return;
531
551
  }
532
- t.current?.registerStyles?.(s, m);
552
+ t.current?.registerStyles?.(n, g);
533
553
  },
534
- [l]
554
+ [a]
535
555
  ), G = x(
536
- (s) => {
537
- const m = l();
538
- if (m) {
539
- m.unregisterStyles?.(s);
556
+ (n) => {
557
+ const g = a();
558
+ if (g) {
559
+ g.unregisterStyles?.(n);
540
560
  return;
541
561
  }
542
- t.current?.unregisterStyles?.(s);
562
+ t.current?.unregisterStyles?.(n);
543
563
  },
544
- [l]
545
- ), D = x(() => f?.columns ? f.columns.filter((s) => !s.hidden) : [], [f]);
564
+ [a]
565
+ ), p = x(() => f?.columns ? f.columns.filter((n) => !n.hidden) : [], [f]);
546
566
  return {
547
567
  ref: t,
548
- element: l(),
549
- isReady: i,
568
+ element: a(),
569
+ isReady: s,
550
570
  config: f,
551
- getConfig: R,
552
- forceLayout: S,
553
- toggleGroup: P,
554
- getPlugin: h,
555
- getPluginByName: d,
556
- registerStyles: y,
571
+ getConfig: v,
572
+ forceLayout: y,
573
+ toggleGroup: R,
574
+ getPlugin: w,
575
+ getPluginByName: b,
576
+ registerStyles: D,
557
577
  unregisterStyles: G,
558
- getVisibleColumns: D
578
+ getVisibleColumns: p
559
579
  };
560
580
  }
561
- function sr(r, t = {}) {
562
- const { open: i = !0, gridElement: o } = t, f = L(ae);
563
- v(() => {
564
- if (!i) return;
565
- const g = r.current;
566
- if (!g) return;
567
- const p = o ?? g.closest("tbw-grid") ?? f?.current ?? null;
568
- if (p)
569
- return p.registerExternalFocusContainer?.(g), () => {
570
- p.unregisterExternalFocusContainer?.(g);
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
- }, [i, o, f, r]);
592
+ }, [s, i, f, r]);
573
593
  }
574
594
  export {
575
- rr as DataGrid,
595
+ tr as DataGrid,
576
596
  we as GridAdapter,
577
- tr as GridColumn,
578
- gr as GridDetailPanel,
579
- Fe as GridIconProvider,
580
- or as GridProvider,
581
- ur as GridResponsiveCard,
582
- nr as GridToolButtons,
583
- fr as GridToolPanel,
584
- Ae as GridTypeProvider,
585
- De as applyColumnDefaults,
586
- Ze as hasColumnShorthands,
587
- Ee as normalizeColumns,
588
- xe as parseColumnShorthand,
589
- ir as useGrid,
590
- Qe as useGridIcons,
591
- sr as useGridOverlay,
592
- Xe as useGridTypeDefaults,
593
- er as useTypeDefault
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
  };