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