@toolbox-web/grid-react 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,38 +1,38 @@
1
- import { jsx as I } from "react/jsx-runtime";
2
- import { DataGridElement as ue } from "@toolbox-web/grid";
3
- import { useRef as P, useCallback as h, useEffect as w, createContext as fe, useContext as Q, forwardRef as ge, useMemo as D, useImperativeHandle as pe, Children as me, isValidElement as ye, useState as ie } from "react";
4
- import { flushSync as R } from "react-dom";
1
+ import { jsx as E, Fragment as me } from "react/jsx-runtime";
2
+ import { DataGridElement as ye } from "@toolbox-web/grid";
3
+ import { createContext as fe, useContext as j, useRef as G, useCallback as v, useEffect as w, forwardRef as he, useMemo as D, useImperativeHandle as we, Children as ve, isValidElement as Ce, useState as ae } from "react";
4
+ import { flushSync as b } from "react-dom";
5
5
  import { createRoot as S } from "react-dom/client";
6
- import { c as he } from "./chunks/feature-registry-Y3KvnN54.js";
7
- function we(r) {
8
- return r.charAt(0).toUpperCase() + r.slice(1);
6
+ import { c as Re } from "./chunks/feature-registry-Y3KvnN54.js";
7
+ function be(n) {
8
+ return n.charAt(0).toUpperCase() + n.slice(1);
9
9
  }
10
- function se(r) {
11
- return r.toLowerCase() === "id" ? "ID" : r.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(we).join(" ");
10
+ function le(n) {
11
+ return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(be).join(" ");
12
12
  }
13
- const ve = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
14
- function Ce(r) {
15
- const t = r.lastIndexOf(":");
13
+ const Ee = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
14
+ function Se(n) {
15
+ const t = n.lastIndexOf(":");
16
16
  if (t > 0) {
17
- const e = r.slice(t + 1).toLowerCase();
18
- if (ve.has(e)) {
19
- const n = r.slice(0, t);
17
+ const e = n.slice(t + 1).toLowerCase();
18
+ if (Ee.has(e)) {
19
+ const r = n.slice(0, t);
20
20
  return {
21
- field: n,
22
- header: se(n),
21
+ field: r,
22
+ header: le(r),
23
23
  type: e
24
24
  };
25
25
  }
26
26
  }
27
27
  return {
28
- field: r,
29
- header: se(r)
28
+ field: n,
29
+ header: le(n)
30
30
  };
31
31
  }
32
- function Re(r) {
33
- return r.map((t) => typeof t == "string" ? Ce(t) : t);
32
+ function xe(n) {
33
+ return n.map((t) => typeof t == "string" ? Se(t) : t);
34
34
  }
35
- const z = {
35
+ const W = {
36
36
  onCellClick: "cell-click",
37
37
  onRowClick: "row-click",
38
38
  onCellActivate: "cell-activate",
@@ -57,202 +57,206 @@ const z = {
57
57
  onExportComplete: "export-complete",
58
58
  onPrintStart: "print-start",
59
59
  onPrintComplete: "print-complete"
60
- }, W = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new Map();
61
- function le(r) {
62
- const t = r.querySelector("tbw-grid-responsive-card");
60
+ }, ee = fe(null), Pe = ({ icons: n, children: t }) => /* @__PURE__ */ E(ee.Provider, { value: n, children: t });
61
+ function et() {
62
+ return j(ee);
63
+ }
64
+ const De = ee, J = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new Map();
65
+ function ge(n) {
66
+ const t = n.querySelector("tbw-grid-responsive-card");
63
67
  if (t) {
64
- const n = W.get(t);
65
- if (n) return n;
68
+ const r = J.get(t);
69
+ if (r) return r;
66
70
  }
67
- const e = r.id || r.getAttribute("data-grid-id");
71
+ const e = n.id || n.getAttribute("data-grid-id");
68
72
  if (e)
69
- return $.get(e);
73
+ return U.get(e);
70
74
  }
71
- function be(r) {
72
- const { children: t, cardRowHeight: e = "auto" } = r, n = P(null), o = h(
75
+ function Ge(n) {
76
+ const { children: t, cardRowHeight: e = "auto" } = n, r = G(null), o = v(
73
77
  (i) => {
74
- if (n.current = i, !i) return;
75
- W.set(i, t);
76
- const s = i.closest("tbw-grid");
77
- if (s) {
78
- const l = s.id || s.getAttribute("data-grid-id");
79
- l && $.set(l, t);
78
+ if (r.current = i, !i) return;
79
+ J.set(i, t);
80
+ const c = i.closest("tbw-grid");
81
+ if (c) {
82
+ const d = c.id || c.getAttribute("data-grid-id");
83
+ d && U.set(d, t);
80
84
  }
81
85
  },
82
86
  [t]
83
87
  );
84
88
  w(() => () => {
85
- const i = n.current;
89
+ const i = r.current;
86
90
  if (i) {
87
- W.delete(i);
88
- const s = i.closest("tbw-grid");
89
- if (s) {
90
- const l = s.id || s.getAttribute("data-grid-id");
91
- l && $.delete(l);
91
+ J.delete(i);
92
+ const c = i.closest("tbw-grid");
93
+ if (c) {
94
+ const d = c.id || c.getAttribute("data-grid-id");
95
+ d && U.delete(d);
92
96
  }
93
97
  }
94
98
  }, []);
95
99
  const a = e === "auto" ? "auto" : String(e);
96
- return /* @__PURE__ */ I("tbw-grid-responsive-card", { ref: o, cardRowHeight: a });
100
+ return /* @__PURE__ */ E("tbw-grid-responsive-card", { ref: o, cardRowHeight: a });
97
101
  }
98
- be.displayName = "GridResponsiveCard";
99
- const H = fe(null), Je = ({ defaults: r, children: t }) => /* @__PURE__ */ I(H.Provider, { value: r, children: t });
100
- function Ue() {
101
- return Q(H);
102
+ Ge.displayName = "GridResponsiveCard";
103
+ const q = fe(null), Ae = ({ defaults: n, children: t }) => /* @__PURE__ */ E(q.Provider, { value: n, children: t });
104
+ function tt() {
105
+ return j(q);
102
106
  }
103
- function Ke(r) {
104
- return Q(H)?.[r];
107
+ function rt(n) {
108
+ return j(q)?.[n];
105
109
  }
106
- const Ee = H;
107
- function Se(r) {
110
+ const Ie = q;
111
+ function Ne(n) {
108
112
  const t = /* @__PURE__ */ new WeakMap();
109
113
  return (e) => {
110
- const n = e.cellEl;
111
- if (n) {
112
- const i = t.get(n);
114
+ const r = e.cellEl;
115
+ if (r) {
116
+ const i = t.get(r);
113
117
  if (i)
114
- return R(() => {
115
- i.root.render(r(e));
118
+ return b(() => {
119
+ i.root.render(n(e));
116
120
  }), i.container;
117
121
  }
118
122
  const o = document.createElement("div");
119
123
  o.className = "react-cell-renderer", o.style.display = "contents";
120
124
  const a = S(o);
121
- return R(() => {
122
- a.render(r(e));
123
- }), n && t.set(n, { root: a, container: o }), o;
125
+ return b(() => {
126
+ a.render(n(e));
127
+ }), r && t.set(r, { root: a, container: o }), o;
124
128
  };
125
129
  }
126
- function xe(r) {
130
+ function Te(n) {
127
131
  return (t) => {
128
132
  const e = document.createElement("div");
129
133
  e.className = "react-cell-editor", e.style.display = "contents";
130
- const n = S(e);
131
- return R(() => {
132
- n.render(r(t));
134
+ const r = S(e);
135
+ return b(() => {
136
+ r.render(n(t));
133
137
  }), e;
134
138
  };
135
139
  }
136
- function De(r) {
137
- if (!r) return;
138
- if (!r.columns) return r;
139
- const t = r.columns.map((e) => {
140
- const { renderer: n, editor: o, ...a } = e, i = { ...a };
141
- return n && (i.renderer = Se(n)), o && (i.editor = xe(o)), i;
140
+ function Ve(n) {
141
+ if (!n) return;
142
+ if (!n.columns) return n;
143
+ const t = n.columns.map((e) => {
144
+ const { renderer: r, editor: o, ...a } = e, i = { ...a };
145
+ return r && (i.renderer = Ne(r)), o && (i.editor = Te(o)), i;
142
146
  });
143
147
  return {
144
- ...r,
148
+ ...n,
145
149
  columns: t
146
150
  };
147
151
  }
148
- const J = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new Map();
149
- function Pe(r) {
150
- const t = r.querySelector("tbw-grid-detail");
152
+ const K = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new Map();
153
+ function ke(n) {
154
+ const t = n.querySelector("tbw-grid-detail");
151
155
  if (t) {
152
- const n = J.get(t);
153
- if (n) return n;
156
+ const r = K.get(t);
157
+ if (r) return r;
154
158
  }
155
- const e = r.id || r.getAttribute("data-grid-id");
159
+ const e = n.id || n.getAttribute("data-grid-id");
156
160
  if (e)
157
- return U.get(e);
161
+ return Y.get(e);
158
162
  }
159
- function Ge(r) {
160
- const { children: t, showExpandColumn: e = !0, animation: n = "slide" } = r, o = P(null), a = h(
161
- (s) => {
162
- if (o.current = s, !s) return;
163
- J.set(s, t);
164
- const l = s.closest("tbw-grid");
165
- if (l) {
166
- const m = l.id || l.getAttribute("data-grid-id");
167
- m && U.set(m, t);
163
+ function Le(n) {
164
+ const { children: t, showExpandColumn: e = !0, animation: r = "slide" } = n, o = G(null), a = v(
165
+ (c) => {
166
+ if (o.current = c, !c) return;
167
+ K.set(c, t);
168
+ const d = c.closest("tbw-grid");
169
+ if (d) {
170
+ const p = d.id || d.getAttribute("data-grid-id");
171
+ p && Y.set(p, t);
168
172
  }
169
173
  },
170
174
  [t]
171
175
  );
172
176
  return w(() => () => {
173
- const s = o.current;
174
- if (s) {
175
- J.delete(s);
176
- const l = s.closest("tbw-grid");
177
- if (l) {
178
- const v = l.id || l.getAttribute("data-grid-id");
179
- v && U.delete(v);
177
+ const c = o.current;
178
+ if (c) {
179
+ K.delete(c);
180
+ const d = c.closest("tbw-grid");
181
+ if (d) {
182
+ const C = d.id || d.getAttribute("data-grid-id");
183
+ C && Y.delete(C);
180
184
  }
181
- const m = s.parentNode;
182
- m && m.contains(s);
185
+ const p = c.parentNode;
186
+ p && p.contains(c);
183
187
  }
184
- }, []), /* @__PURE__ */ I(
188
+ }, []), /* @__PURE__ */ E(
185
189
  "tbw-grid-detail",
186
190
  {
187
191
  ref: a,
188
192
  showExpandColumn: e ? void 0 : "false",
189
- animation: n === !1 ? "false" : n
193
+ animation: r === !1 ? "false" : r
190
194
  }
191
195
  );
192
196
  }
193
- Ge.displayName = "GridDetailPanel";
194
- const K = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new Map();
195
- function Ae(r) {
196
- const t = K.get(r);
197
+ Le.displayName = "GridDetailPanel";
198
+ const Z = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new Map();
199
+ function Fe(n) {
200
+ const t = Z.get(n);
197
201
  if (t) return t;
198
- const e = r.id;
202
+ const e = n.id;
199
203
  if (e)
200
- return Y.get(e);
204
+ return Q.get(e);
201
205
  }
202
- function Ye(r) {
203
- const { id: t, title: e, icon: n, tooltip: o, order: a = 100, children: i } = r, s = P(null), l = h(
204
- (m) => {
205
- s.current = m, m && (K.set(m, i), t && Y.set(t, i));
206
+ function nt(n) {
207
+ const { id: t, title: e, icon: r, tooltip: o, order: a = 100, children: i } = n, c = G(null), d = v(
208
+ (p) => {
209
+ c.current = p, p && (Z.set(p, i), t && Q.set(t, i));
206
210
  },
207
211
  [i, t]
208
212
  );
209
213
  return w(() => () => {
210
- const m = s.current;
211
- m && (K.delete(m), t && Y.delete(t));
212
- }, [t]), /* @__PURE__ */ I(
214
+ const p = c.current;
215
+ p && (Z.delete(p), t && Q.delete(t));
216
+ }, [t]), /* @__PURE__ */ E(
213
217
  "tbw-grid-tool-panel",
214
218
  {
215
- ref: l,
219
+ ref: d,
216
220
  id: t,
217
221
  title: e,
218
- icon: n,
222
+ icon: r,
219
223
  tooltip: o,
220
224
  order: a?.toString()
221
225
  }
222
226
  );
223
227
  }
224
- const G = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new Map();
225
- function Ne(r, t) {
226
- const e = r.getAttribute("field"), n = G.get(r) ?? {};
227
- if (n.renderer = t, G.set(r, n), e) {
228
- const o = N.get(e) ?? {};
229
- o.renderer = t, N.set(e, o);
228
+ const N = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new Map();
229
+ function Me(n, t) {
230
+ const e = n.getAttribute("field"), r = N.get(n) ?? {};
231
+ if (r.renderer = t, N.set(n, r), e) {
232
+ const o = V.get(e) ?? {};
233
+ o.renderer = t, V.set(e, o);
230
234
  }
231
235
  }
232
- function Ie(r, t) {
233
- const e = r.getAttribute("field"), n = G.get(r) ?? {};
234
- if (n.editor = t, G.set(r, n), e) {
235
- const o = N.get(e) ?? {};
236
- o.editor = t, N.set(e, o);
236
+ function Oe(n, t) {
237
+ const e = n.getAttribute("field"), r = N.get(n) ?? {};
238
+ if (r.editor = t, N.set(n, r), e) {
239
+ const o = V.get(e) ?? {};
240
+ o.editor = t, V.set(e, o);
237
241
  }
238
242
  }
239
- function Te(r) {
240
- let t = G.get(r)?.renderer;
243
+ function Be(n) {
244
+ let t = N.get(n)?.renderer;
241
245
  if (!t) {
242
- const e = r.getAttribute("field");
243
- e && (t = N.get(e)?.renderer);
246
+ const e = n.getAttribute("field");
247
+ e && (t = V.get(e)?.renderer);
244
248
  }
245
249
  return t;
246
250
  }
247
- function Ve(r) {
248
- let t = G.get(r)?.editor;
251
+ function je(n) {
252
+ let t = N.get(n)?.editor;
249
253
  if (!t) {
250
- const e = r.getAttribute("field");
251
- e && (t = N.get(e)?.editor);
254
+ const e = n.getAttribute("field");
255
+ e && (t = V.get(e)?.editor);
252
256
  }
253
257
  return t;
254
258
  }
255
- class ke {
259
+ class He {
256
260
  mountedViews = [];
257
261
  typeDefaults = null;
258
262
  /**
@@ -270,13 +274,13 @@ class ke {
270
274
  */
271
275
  canHandle(t) {
272
276
  const e = t.getAttribute("field");
273
- let n = G.get(t);
274
- if (!n && e) {
275
- const i = N.get(e);
276
- i && (i.renderer || i.editor) && (n = i, G.set(t, n));
277
+ let r = N.get(t);
278
+ if (!r && e) {
279
+ const i = V.get(e);
280
+ i && (i.renderer || i.editor) && (r = i, N.set(t, r));
277
281
  }
278
- const o = n?.renderer !== void 0, a = n?.editor !== void 0;
279
- return n !== void 0 && (o || a);
282
+ const o = r?.renderer !== void 0, a = r?.editor !== void 0;
283
+ return r !== void 0 && (o || a);
280
284
  }
281
285
  /**
282
286
  * Creates a view renderer function that renders a React component
@@ -290,31 +294,31 @@ class ke {
290
294
  * allowing the grid to use its default rendering.
291
295
  */
292
296
  createRenderer(t) {
293
- const e = Te(t);
297
+ const e = Be(t);
294
298
  if (!e)
295
299
  return;
296
- const n = /* @__PURE__ */ new WeakMap();
300
+ const r = /* @__PURE__ */ new WeakMap();
297
301
  return (o) => {
298
302
  const a = o.cellEl;
299
303
  if (a) {
300
- const l = n.get(a);
301
- if (l)
302
- return R(() => {
303
- l.root.render(e(o));
304
- }), l.container;
305
- const m = document.createElement("div");
306
- m.className = "react-cell-renderer", m.style.display = "contents";
307
- const v = S(m);
308
- return R(() => {
309
- v.render(e(o));
310
- }), n.set(a, { root: v, container: m, lastRowIndex: o.rowIndex ?? -1 }), this.mountedViews.push({ root: v, container: m }), m;
304
+ const d = r.get(a);
305
+ if (d)
306
+ return b(() => {
307
+ d.root.render(e(o));
308
+ }), d.container;
309
+ const p = document.createElement("div");
310
+ p.className = "react-cell-renderer", p.style.display = "contents";
311
+ const C = S(p);
312
+ return b(() => {
313
+ C.render(e(o));
314
+ }), r.set(a, { root: C, container: p, lastRowIndex: o.rowIndex ?? -1 }), this.mountedViews.push({ root: C, container: p }), p;
311
315
  }
312
316
  const i = document.createElement("div");
313
317
  i.className = "react-cell-renderer", i.style.display = "contents";
314
- const s = S(i);
315
- return R(() => {
316
- s.render(e(o));
317
- }), this.mountedViews.push({ root: s, container: i }), i;
318
+ const c = S(i);
319
+ return b(() => {
320
+ c.render(e(o));
321
+ }), this.mountedViews.push({ root: c, container: i }), i;
318
322
  };
319
323
  }
320
324
  /**
@@ -322,13 +326,13 @@ class ke {
322
326
  * with commit/cancel callbacks passed as props.
323
327
  */
324
328
  createEditor(t) {
325
- const e = Ve(t);
326
- return e ? (n) => {
329
+ const e = je(t);
330
+ return e ? (r) => {
327
331
  const o = document.createElement("div");
328
332
  o.className = "react-cell-editor", o.style.display = "contents";
329
333
  const a = S(o);
330
- return R(() => {
331
- a.render(e(n));
334
+ return b(() => {
335
+ a.render(e(r));
332
336
  }), this.mountedViews.push({ root: a, container: o }), o;
333
337
  } : () => document.createElement("div");
334
338
  }
@@ -337,15 +341,15 @@ class ke {
337
341
  * Renders React components for expandable detail rows.
338
342
  */
339
343
  createDetailRenderer(t) {
340
- const e = Pe(t);
344
+ const e = ke(t);
341
345
  if (e)
342
- return (n, o) => {
346
+ return (r, o) => {
343
347
  const a = document.createElement("div");
344
348
  a.className = "react-detail-panel";
345
- const i = { row: n, rowIndex: o }, s = S(a);
346
- return R(() => {
347
- s.render(e(i));
348
- }), this.mountedViews.push({ root: s, container: a }), a;
349
+ const i = { row: r, rowIndex: o }, c = S(a);
350
+ return b(() => {
351
+ c.render(e(i));
352
+ }), this.mountedViews.push({ root: c, container: a }), a;
349
353
  };
350
354
  }
351
355
  /**
@@ -362,15 +366,15 @@ class ke {
362
366
  * Renders React components for card layout in responsive mode.
363
367
  */
364
368
  createResponsiveCardRenderer(t) {
365
- const e = le(t);
369
+ const e = ge(t);
366
370
  if (e)
367
- return (n, o) => {
371
+ return (r, o) => {
368
372
  const a = document.createElement("div");
369
373
  a.className = "react-responsive-card";
370
- const i = { row: n, index: o }, s = S(a);
371
- return R(() => {
372
- s.render(e(i));
373
- }), this.mountedViews.push({ root: s, container: a }), a;
374
+ const i = { row: r, index: o }, c = S(a);
375
+ return b(() => {
376
+ c.render(e(i));
377
+ }), this.mountedViews.push({ root: c, container: a }), a;
374
378
  };
375
379
  }
376
380
  /**
@@ -378,25 +382,25 @@ class ke {
378
382
  * Renders React components into tool panel containers.
379
383
  */
380
384
  createToolPanelRenderer(t) {
381
- const e = Ae(t);
385
+ const e = Fe(t);
382
386
  if (!e)
383
387
  return;
384
- const n = t.closest("tbw-grid");
388
+ const r = t.closest("tbw-grid");
385
389
  return (o) => {
386
390
  const a = {
387
- grid: n ?? o
391
+ grid: r ?? o
388
392
  }, i = S(o);
389
- return R(() => {
393
+ return b(() => {
390
394
  i.render(e(a));
391
395
  }), this.mountedViews.push({ root: i, container: o }), () => {
392
- const s = this.mountedViews.findIndex((l) => l.container === o);
393
- if (s !== -1) {
394
- const { root: l } = this.mountedViews[s];
396
+ const c = this.mountedViews.findIndex((d) => d.container === o);
397
+ if (c !== -1) {
398
+ const { root: d } = this.mountedViews[c];
395
399
  try {
396
- l.unmount();
400
+ d.unmount();
397
401
  } catch {
398
402
  }
399
- this.mountedViews.splice(s, 1);
403
+ this.mountedViews.splice(c, 1);
400
404
  }
401
405
  };
402
406
  };
@@ -431,10 +435,10 @@ class ke {
431
435
  const e = this.typeDefaults[t];
432
436
  if (!e)
433
437
  return;
434
- const n = {
438
+ const r = {
435
439
  editorParams: e.editorParams
436
440
  };
437
- return e.renderer && (n.renderer = this.createTypeRenderer(e.renderer)), e.editor && (n.editor = this.createTypeEditor(e.editor)), n;
441
+ return e.renderer && (r.renderer = this.createTypeRenderer(e.renderer)), e.editor && (r.editor = this.createTypeEditor(e.editor)), r;
438
442
  }
439
443
  /**
440
444
  * Creates a renderer function from a React render function for type defaults.
@@ -442,12 +446,12 @@ class ke {
442
446
  */
443
447
  createTypeRenderer(t) {
444
448
  return (e) => {
445
- const n = document.createElement("span");
446
- n.style.display = "contents";
447
- const o = S(n);
448
- return this.mountedViews.push({ root: o, container: n }), R(() => {
449
+ const r = document.createElement("span");
450
+ r.style.display = "contents";
451
+ const o = S(r);
452
+ return this.mountedViews.push({ root: o, container: r }), b(() => {
449
453
  o.render(t(e));
450
- }), n;
454
+ }), r;
451
455
  };
452
456
  }
453
457
  /**
@@ -456,12 +460,12 @@ class ke {
456
460
  */
457
461
  createTypeEditor(t) {
458
462
  return (e) => {
459
- const n = document.createElement("span");
460
- n.style.display = "contents";
461
- const o = S(n);
462
- return this.mountedViews.push({ root: o, container: n }), R(() => {
463
+ const r = document.createElement("span");
464
+ r.style.display = "contents";
465
+ const o = S(r);
466
+ return this.mountedViews.push({ root: o, container: r }), b(() => {
463
467
  o.render(t(e));
464
- }), n;
468
+ }), r;
465
469
  };
466
470
  }
467
471
  /**
@@ -480,41 +484,41 @@ class ke {
480
484
  * Unmount a specific container (called when cell is recycled).
481
485
  */
482
486
  unmount(t) {
483
- const e = this.mountedViews.findIndex((n) => n.container === t);
487
+ const e = this.mountedViews.findIndex((r) => r.container === t);
484
488
  if (e !== -1) {
485
- const { root: n } = this.mountedViews[e];
489
+ const { root: r } = this.mountedViews[e];
486
490
  try {
487
- n.unmount();
491
+ r.unmount();
488
492
  } catch {
489
493
  }
490
494
  this.mountedViews.splice(e, 1);
491
495
  }
492
496
  }
493
497
  }
494
- const Fe = {
498
+ const qe = {
495
499
  undoRedo: ["editing"],
496
500
  clipboard: ["selection"]
497
501
  };
498
- function Me(r) {
499
- const t = new Set(r);
500
- for (const e of r) {
501
- const n = Fe[e];
502
- if (n)
503
- for (const o of n)
502
+ function ze(n) {
503
+ const t = new Set(n);
504
+ for (const e of n) {
505
+ const r = qe[e];
506
+ if (r)
507
+ for (const o of r)
504
508
  t.has(o) || console.warn(
505
509
  `[DataGrid] Feature "${e}" requires "${o}" to be enabled. Add the "${o}" prop to your DataGrid.`
506
510
  );
507
511
  }
508
512
  }
509
- function Le(r) {
510
- const t = [], e = [], n = { ...r };
511
- n.multiSort !== void 0 ? delete n.sorting : n.sorting !== void 0 && (n.multiSort = n.sorting, delete n.sorting);
512
- for (const [i, s] of Object.entries(n)) {
513
- if (s === void 0 || s === !1) continue;
514
- const l = i;
515
- e.push(l);
513
+ function _e(n) {
514
+ const t = [], e = [], r = { ...n };
515
+ r.multiSort !== void 0 ? delete r.sorting : r.sorting !== void 0 && (r.multiSort = r.sorting, delete r.sorting);
516
+ for (const [i, c] of Object.entries(r)) {
517
+ if (c === void 0 || c === !1) continue;
518
+ const d = i;
519
+ e.push(d);
516
520
  }
517
- Me(e);
521
+ ze(e);
518
522
  const o = [
519
523
  "selection",
520
524
  "editing",
@@ -522,41 +526,41 @@ function Le(r) {
522
526
  ...e.filter((i) => i !== "selection" && i !== "editing")
523
527
  ], a = [...new Set(o)].filter((i) => e.includes(i));
524
528
  for (const i of a) {
525
- const s = r[i];
526
- if (s === void 0 || s === !1) continue;
527
- const l = he(i, s);
528
- l && t.push(l);
529
+ const c = n[i];
530
+ if (c === void 0 || c === !1) continue;
531
+ const d = Re(i, c);
532
+ d && t.push(d);
529
533
  }
530
534
  return t;
531
535
  }
532
- let ce = !1, _ = null;
533
- function Z() {
534
- return ce || (_ = new ke(), ue.registerAdapter(_), ce = !0), _;
536
+ let de = !1, $ = null;
537
+ function X() {
538
+ return de || ($ = new He(), ye.registerAdapter($), de = !0), $;
535
539
  }
536
- Z();
537
- function Oe(r) {
538
- const e = r.getPluginByName?.("masterDetail");
540
+ X();
541
+ function We(n) {
542
+ const e = n.getPluginByName?.("masterDetail");
539
543
  e && typeof e.refreshDetailRenderer == "function" && e.refreshDetailRenderer();
540
544
  }
541
- function Be(r, t) {
542
- const e = r;
543
- if (!r.querySelector("tbw-grid-responsive-card") || !le(r)) return;
545
+ function $e(n, t) {
546
+ const e = n;
547
+ if (!n.querySelector("tbw-grid-responsive-card") || !ge(n)) return;
544
548
  const a = e.getPluginByName?.("responsive");
545
549
  if (a && typeof a.setCardRenderer == "function") {
546
- const i = t.createResponsiveCardRenderer(r);
550
+ const i = t.createResponsiveCardRenderer(n);
547
551
  i && a.setCardRenderer(i);
548
552
  }
549
553
  }
550
- function je(r) {
554
+ function Je(n) {
551
555
  const t = {};
552
- return me.forEach(r, (e) => {
553
- if (ye(e)) {
556
+ return ve.forEach(n, (e) => {
557
+ if (Ce(e)) {
554
558
  if (e.type && e.type.displayName === "GridDetailPanel") {
555
- const n = e.props;
559
+ const r = e.props;
556
560
  t.masterDetail = {
557
561
  // Use props from the child component for configuration
558
- showExpandColumn: n.showExpandColumn ?? !0,
559
- animation: n.animation ?? "slide"
562
+ showExpandColumn: r.showExpandColumn ?? !0,
563
+ animation: r.animation ?? "slide"
560
564
  // detailRenderer will be wired up by refreshMasterDetailRenderer after mount
561
565
  };
562
566
  }
@@ -564,31 +568,32 @@ function je(r) {
564
568
  }
565
569
  }), t;
566
570
  }
567
- const Ze = ge(function(t, e) {
571
+ const ot = he(function(t, e) {
568
572
  const {
569
573
  // Core props
570
- rows: n,
574
+ rows: r,
571
575
  gridConfig: o,
572
576
  columns: a,
573
577
  columnDefaults: i,
574
- fitMode: s,
575
- sortable: l,
576
- filterable: m,
577
- selectable: v,
578
- editOn: x,
579
- customStyles: b,
580
- className: M,
581
- style: T,
582
- children: A,
578
+ fitMode: c,
579
+ sortable: d,
580
+ filterable: p,
581
+ selectable: C,
582
+ loading: x,
583
+ editOn: P,
584
+ customStyles: A,
585
+ className: k,
586
+ style: F,
587
+ children: T,
583
588
  // Plugin props
584
- plugins: E,
589
+ plugins: u,
585
590
  // SSR mode
586
- ssr: f,
591
+ ssr: g,
587
592
  // Legacy event handlers
588
- onRowsChange: p,
593
+ onRowsChange: m,
589
594
  // Feature props and event props are in ...rest
590
- ...g
591
- } = t, u = P(null), V = P(null), k = Q(Ee), X = [
595
+ ...h
596
+ } = t, f = G(null), I = G(null), te = j(Ie), z = j(De), re = [
592
597
  "selection",
593
598
  "editing",
594
599
  "filtering",
@@ -613,299 +618,327 @@ const Ze = ge(function(t, e) {
613
618
  "print",
614
619
  "pivot",
615
620
  "serverSide"
616
- ], de = D(() => X.map((c) => {
617
- const d = g[c];
618
- return d !== void 0 ? `${c}:${JSON.stringify(d)}` : "";
619
- }).filter(Boolean).join("|"), [g]), ee = D(() => {
620
- const c = {};
621
- for (const d of X)
622
- d in g && g[d] !== void 0 && (c[d] = g[d]);
623
- return c;
624
- }, [de]), te = D(() => je(A), [A]), re = D(() => ({ ...te, ...ee }), [ee, te]), q = D(() => E || f ? [] : Le(re), [re, E, f]), L = D(() => {
625
- if (E) {
626
- const c = new Set(E.map((y) => y.name)), d = q.filter((y) => !c.has(y.name));
627
- return [...E, ...d];
621
+ ], pe = D(() => re.map((s) => {
622
+ const l = h[s];
623
+ return l !== void 0 ? `${s}:${JSON.stringify(l)}` : "";
624
+ }).filter(Boolean).join("|"), [h]), ne = D(() => {
625
+ const s = {};
626
+ for (const l of re)
627
+ l in h && h[l] !== void 0 && (s[l] = h[l]);
628
+ return s;
629
+ }, [pe]), oe = D(() => Je(T), [T]), ie = D(() => ({ ...oe, ...ne }), [ne, oe]), _ = D(() => u || g ? [] : _e(ie), [ie, u, g]), M = D(() => {
630
+ if (u) {
631
+ const s = new Set(u.map((y) => y.name)), l = _.filter((y) => !s.has(y.name));
632
+ return [...u, ...l];
628
633
  }
629
- return q;
630
- }, [E, q]), O = D(() => {
634
+ return _;
635
+ }, [u, _]), O = D(() => {
631
636
  if (!a) return a;
632
- const c = Re(a);
633
- return i ? c.map((d) => ({
637
+ const s = xe(a);
638
+ return i ? s.map((l) => ({
634
639
  ...i,
635
- ...d
640
+ ...l
636
641
  // Individual column props override defaults
637
- })) : c;
642
+ })) : s;
638
643
  }, [a, i]), B = D(() => {
639
- const c = De(o), d = {};
640
- if (l !== void 0 && (d.sortable = l), m !== void 0 && (d.filterable = m), v !== void 0 && (d.selectable = v), L.length > 0 && c) {
641
- const y = c.plugins || [], C = new Set(y.map((F) => F.name)), j = L.filter((F) => !C.has(F.name));
644
+ const s = Ve(o), l = {};
645
+ if (d !== void 0 && (l.sortable = d), p !== void 0 && (l.filterable = p), C !== void 0 && (l.selectable = C), z) {
646
+ const y = s?.icons || o?.icons || {};
647
+ l.icons = { ...z, ...y };
648
+ }
649
+ if (M.length > 0 && s) {
650
+ const y = s.plugins || [], R = new Set(y.map((L) => L.name)), H = M.filter((L) => !R.has(L.name));
642
651
  return {
643
- ...c,
644
- ...d,
645
- plugins: [...y, ...j]
652
+ ...s,
653
+ ...l,
654
+ plugins: [...y, ...H]
646
655
  };
647
656
  }
648
- return L.length > 0 && !c ? { ...d, plugins: L } : Object.keys(d).length > 0 ? { ...c, ...d } : c;
649
- }, [o, L, l, m, v]);
657
+ return M.length > 0 && !s ? { ...l, plugins: M } : Object.keys(l).length > 0 ? { ...s, ...l } : s;
658
+ }, [o, M, d, p, C, z]);
650
659
  w(() => {
651
- Z().setTypeDefaults(k);
652
- }, [k]), w(() => {
653
- u.current && (u.current.rows = n);
654
- }, [n]), w(() => {
655
- u.current && B && (u.current.gridConfig = B);
660
+ X().setTypeDefaults(te);
661
+ }, [te]), w(() => {
662
+ f.current && (f.current.rows = r);
663
+ }, [r]), w(() => {
664
+ f.current && B && (f.current.gridConfig = B);
656
665
  }, [B]), w(() => {
657
- u.current && O && (u.current.columns = O);
666
+ f.current && O && (f.current.columns = O);
658
667
  }, [O]), w(() => {
659
- u.current && s !== void 0 && (u.current.fitMode = s);
660
- }, [s]), w(() => {
661
- u.current && x !== void 0 && (u.current.editOn = x);
668
+ f.current && c !== void 0 && (f.current.fitMode = c);
669
+ }, [c]), w(() => {
670
+ f.current && P !== void 0 && (f.current.editOn = P);
671
+ }, [P]), w(() => {
672
+ f.current && x !== void 0 && (f.current.loading = x);
662
673
  }, [x]), w(() => {
663
- const c = u.current;
664
- if (!c) return;
665
- const d = Z();
666
- c.__frameworkAdapter = d, Oe(c), Be(c, d);
674
+ const s = f.current;
675
+ if (!s) return;
676
+ const l = X();
677
+ s.__frameworkAdapter = l, We(s), $e(s, l);
667
678
  let y = !1;
668
- const C = requestAnimationFrame(() => {
669
- y || (typeof c.refreshColumns == "function" && c.refreshColumns(), typeof c.refreshShellHeader == "function" && c.refreshShellHeader());
679
+ const R = requestAnimationFrame(() => {
680
+ y || (typeof s.refreshColumns == "function" && s.refreshColumns(), typeof s.refreshShellHeader == "function" && s.refreshShellHeader());
670
681
  });
671
682
  return () => {
672
- y = !0, cancelAnimationFrame(C);
683
+ y = !0, cancelAnimationFrame(R);
673
684
  };
674
685
  }, []), w(() => {
675
- if (!u.current || !b) return;
676
- const c = u.current, d = "react-custom-styles";
686
+ if (!f.current || !A) return;
687
+ const s = f.current, l = "react-custom-styles";
677
688
  let y = !0;
678
- return c.ready?.().then(() => {
679
- y && b && (c.registerStyles?.(d, b), V.current = d);
689
+ return s.ready?.().then(() => {
690
+ y && A && (s.registerStyles?.(l, A), I.current = l);
680
691
  }), () => {
681
- y = !1, V.current && (c.unregisterStyles?.(V.current), V.current = null);
692
+ y = !1, I.current && (s.unregisterStyles?.(I.current), I.current = null);
682
693
  };
683
- }, [b]), w(() => {
684
- const c = u.current;
685
- if (!c) return;
686
- const d = [];
687
- if (p) {
688
- const y = ((C) => p(C.detail.rows));
689
- c.addEventListener("rows-change", y), d.push(["rows-change", y]);
694
+ }, [A]), w(() => {
695
+ const s = f.current;
696
+ if (!s) return;
697
+ const l = [];
698
+ if (m) {
699
+ const y = ((R) => m(R.detail.rows));
700
+ s.addEventListener("rows-change", y), l.push(["rows-change", y]);
690
701
  }
691
702
  return () => {
692
- d.forEach(([y, C]) => {
693
- c.removeEventListener(y, C);
703
+ l.forEach(([y, R]) => {
704
+ s.removeEventListener(y, R);
694
705
  });
695
706
  };
696
- }, [p]);
697
- const ne = D(() => Object.keys(z).filter((c) => typeof g[c] == "function").sort().join("|"), [g]), oe = P({});
698
- for (const c of Object.keys(z))
699
- oe.current[c] = g[c];
707
+ }, [m]);
708
+ const se = D(() => Object.keys(W).filter((s) => typeof h[s] == "function").sort().join("|"), [h]), ce = G({});
709
+ for (const s of Object.keys(W))
710
+ ce.current[s] = h[s];
700
711
  return w(() => {
701
- const c = u.current;
702
- if (!c) return;
703
- const d = [];
704
- for (const [y, C] of Object.entries(z))
705
- if (ne.includes(y)) {
706
- const j = ((F) => {
707
- oe.current[y]?.(F.detail, F);
712
+ const s = f.current;
713
+ if (!s) return;
714
+ const l = [];
715
+ for (const [y, R] of Object.entries(W))
716
+ if (se.includes(y)) {
717
+ const H = ((L) => {
718
+ ce.current[y]?.(L.detail, L);
708
719
  });
709
- c.addEventListener(C, j), d.push([C, j]);
720
+ s.addEventListener(R, H), l.push([R, H]);
710
721
  }
711
722
  return () => {
712
- d.forEach(([y, C]) => {
713
- c.removeEventListener(y, C);
723
+ l.forEach(([y, R]) => {
724
+ s.removeEventListener(y, R);
714
725
  });
715
726
  };
716
- }, [ne]), pe(
727
+ }, [se]), we(
717
728
  e,
718
729
  () => ({
719
730
  get element() {
720
- return u.current;
731
+ return f.current;
721
732
  },
722
733
  async getConfig() {
723
- return u.current?.getConfig?.() ?? {};
734
+ return f.current?.getConfig?.() ?? {};
724
735
  },
725
736
  async ready() {
726
- return u.current?.ready?.();
737
+ return f.current?.ready?.();
727
738
  },
728
739
  async forceLayout() {
729
- return u.current?.forceLayout?.();
740
+ return f.current?.forceLayout?.();
741
+ },
742
+ async toggleGroup(s) {
743
+ return f.current?.toggleGroup?.(s);
730
744
  },
731
- async toggleGroup(c) {
732
- return u.current?.toggleGroup?.(c);
745
+ registerStyles(s, l) {
746
+ f.current?.registerStyles?.(s, l);
733
747
  },
734
- registerStyles(c, d) {
735
- u.current?.registerStyles?.(c, d);
748
+ unregisterStyles(s) {
749
+ f.current?.unregisterStyles?.(s);
736
750
  },
737
- unregisterStyles(c) {
738
- u.current?.unregisterStyles?.(c);
751
+ setRowLoading(s, l) {
752
+ f.current?.setRowLoading?.(s, l);
753
+ },
754
+ setCellLoading(s, l, y) {
755
+ f.current?.setCellLoading?.(s, l, y);
756
+ },
757
+ isRowLoading(s) {
758
+ return f.current?.isRowLoading?.(s) ?? !1;
759
+ },
760
+ isCellLoading(s, l) {
761
+ return f.current?.isCellLoading?.(s, l) ?? !1;
762
+ },
763
+ clearAllLoading() {
764
+ f.current?.clearAllLoading?.();
739
765
  }
740
766
  }),
741
767
  []
742
- ), /* @__PURE__ */ I(
768
+ ), /* @__PURE__ */ E(
743
769
  "tbw-grid",
744
770
  {
745
- ref: (c) => {
746
- if (u.current = c, c) {
747
- const d = c;
748
- B && (d.gridConfig = B), n && (d.rows = n), O && (d.columns = O);
771
+ ref: (s) => {
772
+ if (f.current = s, s) {
773
+ const l = s;
774
+ B && (l.gridConfig = B), r && (l.rows = r), O && (l.columns = O);
749
775
  }
750
776
  },
751
- class: M,
752
- style: T,
753
- children: A
777
+ class: k,
778
+ style: F,
779
+ children: T
754
780
  }
755
781
  );
756
782
  });
757
- function Qe(r) {
783
+ function it(n) {
758
784
  const {
759
785
  field: t,
760
786
  header: e,
761
- type: n,
787
+ type: r,
762
788
  editable: o,
763
789
  sortable: a,
764
790
  resizable: i,
765
- width: s,
766
- minWidth: l,
767
- hidden: m,
768
- lockVisible: v,
791
+ width: c,
792
+ minWidth: d,
793
+ hidden: p,
794
+ lockVisible: C,
769
795
  children: x,
770
- editor: b,
771
- options: M,
772
- multi: T,
773
- format: A
774
- } = r, E = P(null), f = h(
775
- (u) => {
776
- E.current = u, u && (x && Ne(u, x), b && Ie(u, b));
796
+ editor: P,
797
+ options: A,
798
+ multi: k,
799
+ format: F
800
+ } = n, T = G(null), u = v(
801
+ (h) => {
802
+ T.current = h, h && (x && Me(h, x), P && Oe(h, P));
777
803
  },
778
- [x, b, t]
779
- ), p = typeof s == "number" ? `${s}px` : s, g = {
804
+ [x, P, t]
805
+ ), g = typeof c == "number" ? `${c}px` : c, m = {
780
806
  field: t,
781
- ref: f
807
+ ref: u
782
808
  };
783
- return e !== void 0 && (g.header = e), n !== void 0 && (g.type = n), o !== void 0 && (g.editable = o), a !== void 0 && (g.sortable = a), i !== void 0 && (g.resizable = i), p !== void 0 && (g.width = p), l !== void 0 && (g["min-width"] = l), m !== void 0 && (g.hidden = m), v !== void 0 && (g["lock-visible"] = v), T !== void 0 && (g.multi = T), A && (g["data-has-format"] = "true"), M && (g["data-has-options"] = "true"), /* @__PURE__ */ I("tbw-grid-column", { ...g });
809
+ return e !== void 0 && (m.header = e), r !== void 0 && (m.type = r), o !== void 0 && (m.editable = o), a !== void 0 && (m.sortable = a), i !== void 0 && (m.resizable = i), g !== void 0 && (m.width = g), d !== void 0 && (m["min-width"] = d), p !== void 0 && (m.hidden = p), C !== void 0 && (m["lock-visible"] = C), k !== void 0 && (m.multi = k), F && (m["data-has-format"] = "true"), A && (m["data-has-options"] = "true"), /* @__PURE__ */ E("tbw-grid-column", { ...m });
784
810
  }
785
- function Xe({ children: r }) {
786
- return /* @__PURE__ */ I("tbw-grid-tool-buttons", { children: r });
811
+ function st({ children: n }) {
812
+ return /* @__PURE__ */ E("tbw-grid-tool-buttons", { children: n });
787
813
  }
788
- function et() {
789
- const r = P(null), [t, e] = ie(!1), [n, o] = ie(null);
814
+ const ct = ({ icons: n, defaults: t, children: e }) => {
815
+ let r = e;
816
+ return t && (r = /* @__PURE__ */ E(Ae, { defaults: t, children: r })), n && (r = /* @__PURE__ */ E(Pe, { icons: n, children: r })), /* @__PURE__ */ E(me, { children: r });
817
+ };
818
+ function at() {
819
+ const n = G(null), [t, e] = ae(!1), [r, o] = ae(null);
790
820
  w(() => {
791
- const f = r.current;
792
- if (!f) return;
793
- let p = !0;
821
+ const u = n.current;
822
+ if (!u) return;
823
+ let g = !0;
794
824
  return (async () => {
795
825
  try {
796
- if (await f.ready?.(), p) {
826
+ if (await u.ready?.(), g) {
797
827
  e(!0);
798
- const u = await f.getConfig?.();
799
- p && u && o(u);
828
+ const h = await u.getConfig?.();
829
+ g && h && o(h);
800
830
  }
801
831
  } catch {
802
832
  }
803
833
  })(), () => {
804
- p = !1;
834
+ g = !1;
805
835
  };
806
836
  }, []);
807
- const a = h(async () => {
808
- const f = r.current;
809
- return f ? await f.getConfig?.() ?? null : null;
810
- }, []), i = h(async () => {
811
- const f = r.current;
812
- f && await f.forceLayout?.();
813
- }, []), s = h(async (f) => {
814
- const p = r.current;
815
- p && await p.toggleGroup?.(f);
816
- }, []), l = h((f, p) => {
817
- r.current?.registerStyles?.(f, p);
818
- }, []), m = h((f) => {
819
- r.current?.unregisterStyles?.(f);
820
- }, []), v = h(() => n?.columns ? n.columns.filter((f) => !f.hidden) : [], [n]), x = h(() => {
821
- const f = r.current?.element, p = f?.getPluginByName?.("selection");
822
- if (!p) {
837
+ const a = v(async () => {
838
+ const u = n.current;
839
+ return u ? await u.getConfig?.() ?? null : null;
840
+ }, []), i = v(async () => {
841
+ const u = n.current;
842
+ u && await u.forceLayout?.();
843
+ }, []), c = v(async (u) => {
844
+ const g = n.current;
845
+ g && await g.toggleGroup?.(u);
846
+ }, []), d = v((u, g) => {
847
+ n.current?.registerStyles?.(u, g);
848
+ }, []), p = v((u) => {
849
+ n.current?.unregisterStyles?.(u);
850
+ }, []), C = v(() => r?.columns ? r.columns.filter((u) => !u.hidden) : [], [r]), x = v(() => {
851
+ const u = n.current?.element, g = u?.getPluginByName?.("selection");
852
+ if (!g) {
823
853
  console.warn("[useGrid] selectAll requires SelectionPlugin");
824
854
  return;
825
855
  }
826
- if (p.config?.mode === "row") {
827
- const g = f?.rows ?? [], u = new Set(g.map((V, k) => k));
828
- p.selected = u, p.requestAfterRender?.();
856
+ if (g.config?.mode === "row") {
857
+ const m = u?.rows ?? [], h = new Set(m.map((f, I) => I));
858
+ g.selected = h, g.requestAfterRender?.();
829
859
  }
830
- }, []), b = h(() => {
831
- const p = r.current?.element?.getPluginByName?.("selection");
832
- p && p.clearSelection?.();
833
- }, []), M = h(() => {
834
- const p = r.current?.element?.getPluginByName?.("selection");
835
- return p ? new Set(p.selected ?? []) : /* @__PURE__ */ new Set();
836
- }, []), T = h(() => {
837
- const f = r.current?.element, p = f?.getPluginByName?.("selection");
838
- if (!p) return [];
839
- const g = f?.rows ?? [], u = p.selected ?? /* @__PURE__ */ new Set();
840
- return g.filter((V, k) => u.has(k));
841
- }, []), A = h((f) => {
842
- const g = r.current?.element?.getPluginByName?.("export");
843
- if (!g) {
860
+ }, []), P = v(() => {
861
+ const g = n.current?.element?.getPluginByName?.("selection");
862
+ g && g.clearSelection?.();
863
+ }, []), A = v(() => {
864
+ const g = n.current?.element?.getPluginByName?.("selection");
865
+ return g ? new Set(g.selected ?? []) : /* @__PURE__ */ new Set();
866
+ }, []), k = v(() => {
867
+ const u = n.current?.element, g = u?.getPluginByName?.("selection");
868
+ if (!g) return [];
869
+ const m = u?.rows ?? [], h = g.selected ?? /* @__PURE__ */ new Set();
870
+ return m.filter((f, I) => h.has(I));
871
+ }, []), F = v((u) => {
872
+ const m = n.current?.element?.getPluginByName?.("export");
873
+ if (!m) {
844
874
  console.warn("[useGrid] exportToCsv requires ExportPlugin (use export prop)");
845
875
  return;
846
876
  }
847
- g.exportCsv?.({ filename: f ?? "export.csv" });
848
- }, []), E = h((f) => {
849
- const g = r.current?.element?.getPluginByName?.("export");
850
- if (!g) {
877
+ m.exportCsv?.({ filename: u ?? "export.csv" });
878
+ }, []), T = v((u) => {
879
+ const m = n.current?.element?.getPluginByName?.("export");
880
+ if (!m) {
851
881
  console.warn("[useGrid] exportToJson requires ExportPlugin (use export prop)");
852
882
  return;
853
883
  }
854
- g.exportJson?.({ filename: f ?? "export.json" });
884
+ m.exportJson?.({ filename: u ?? "export.json" });
855
885
  }, []);
856
886
  return {
857
- ref: r,
858
- element: r.current?.element ?? null,
887
+ ref: n,
888
+ element: n.current?.element ?? null,
859
889
  isReady: t,
860
- config: n,
890
+ config: r,
861
891
  getConfig: a,
862
892
  forceLayout: i,
863
- toggleGroup: s,
864
- registerStyles: l,
865
- unregisterStyles: m,
866
- getVisibleColumns: v,
893
+ toggleGroup: c,
894
+ registerStyles: d,
895
+ unregisterStyles: p,
896
+ getVisibleColumns: C,
867
897
  // Selection methods
868
898
  selectAll: x,
869
- clearSelection: b,
870
- getSelectedIndices: M,
871
- getSelectedRows: T,
899
+ clearSelection: P,
900
+ getSelectedIndices: A,
901
+ getSelectedRows: k,
872
902
  // Export methods
873
- exportToCsv: A,
874
- exportToJson: E
903
+ exportToCsv: F,
904
+ exportToJson: T
875
905
  };
876
906
  }
877
- let ae = !1;
878
- function tt(r, t, e, n = []) {
879
- !ae && typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")) && (ae = !0, console.warn(
907
+ let ue = !1;
908
+ function lt(n, t, e, r = []) {
909
+ !ue && typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")) && (ue = !0, console.warn(
880
910
  `[useGridEvent] Deprecated: Use event props directly on DataGrid instead.
881
911
  Example: <DataGrid onSelectionChange={(e) => ...} />
882
912
  See migration guide: https://toolbox-web.dev/grid-react/migration`
883
913
  ));
884
- const o = P(e);
914
+ const o = G(e);
885
915
  w(() => {
886
916
  o.current = e;
887
- }, [e, ...n]), w(() => {
888
- const a = r.current, i = a && "element" in a ? a.element : a;
917
+ }, [e, ...r]), w(() => {
918
+ const a = n.current, i = a && "element" in a ? a.element : a;
889
919
  if (!i) return;
890
- const s = ((l) => {
891
- o.current(l);
920
+ const c = ((d) => {
921
+ o.current(d);
892
922
  });
893
- return i.addEventListener(t, s), () => {
894
- i.removeEventListener(t, s);
923
+ return i.addEventListener(t, c), () => {
924
+ i.removeEventListener(t, c);
895
925
  };
896
- }, [r, t]);
926
+ }, [n, t]);
897
927
  }
898
928
  export {
899
- Ze as DataGrid,
900
- Qe as GridColumn,
901
- Ge as GridDetailPanel,
902
- be as GridResponsiveCard,
903
- Xe as GridToolButtons,
904
- Ye as GridToolPanel,
905
- Je as GridTypeProvider,
906
- ke as ReactGridAdapter,
907
- et as useGrid,
908
- tt as useGridEvent,
909
- Ue as useGridTypeDefaults,
910
- Ke as useTypeDefault
929
+ ot as DataGrid,
930
+ it as GridColumn,
931
+ Le as GridDetailPanel,
932
+ Pe as GridIconProvider,
933
+ ct as GridProvider,
934
+ Ge as GridResponsiveCard,
935
+ st as GridToolButtons,
936
+ nt as GridToolPanel,
937
+ Ae as GridTypeProvider,
938
+ He as ReactGridAdapter,
939
+ at as useGrid,
940
+ lt as useGridEvent,
941
+ et as useGridIcons,
942
+ tt as useGridTypeDefaults,
943
+ rt as useTypeDefault
911
944
  };