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