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