@toolbox-web/grid-react 1.1.1 → 1.2.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 +306 -285
- package/lib/react-grid-adapter.d.ts +9 -0
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/lib/use-grid.d.ts +7 -0
- package/lib/use-grid.d.ts.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as b, Fragment as ne, jsxs as Pe } from "react/jsx-runtime";
|
|
2
2
|
import { DataGridElement as be } from "@toolbox-web/grid";
|
|
3
|
-
import { createContext as
|
|
3
|
+
import { createContext as ye, useContext as O, useRef as k, useCallback as E, useEffect as P, forwardRef as he, useReducer as Ee, useImperativeHandle as ve, useMemo as S, useLayoutEffect as ke, Children as Se, isValidElement as De, useState as fe } from "react";
|
|
4
4
|
import { a as w, r as H, s as ge } from "./chunks/portal-bridge-DZ4yQkmm.js";
|
|
5
|
-
import { flushSync as
|
|
5
|
+
import { flushSync as V, createPortal as Ge } from "react-dom";
|
|
6
6
|
import { createPluginsFromFeatures as Ae } from "@toolbox-web/grid/features/registry";
|
|
7
7
|
import { G as Te } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
8
8
|
function xe(n) {
|
|
@@ -33,7 +33,7 @@ function Ne(n) {
|
|
|
33
33
|
function Fe(n) {
|
|
34
34
|
return n.map((e) => typeof e == "string" ? Ne(e) : e);
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const W = {
|
|
37
37
|
onCellClick: "cell-click",
|
|
38
38
|
onRowClick: "row-click",
|
|
39
39
|
onCellActivate: "cell-activate",
|
|
@@ -60,7 +60,7 @@ const B = {
|
|
|
60
60
|
onPrintStart: "print-start",
|
|
61
61
|
onPrintComplete: "print-complete",
|
|
62
62
|
onTbwScroll: "tbw-scroll"
|
|
63
|
-
}, oe =
|
|
63
|
+
}, oe = ye(null), Ie = ({ icons: n, children: e }) => /* @__PURE__ */ b(oe.Provider, { value: n, children: e });
|
|
64
64
|
function pt() {
|
|
65
65
|
return O(oe);
|
|
66
66
|
}
|
|
@@ -76,65 +76,65 @@ function Ce(n) {
|
|
|
76
76
|
return Z.get(t);
|
|
77
77
|
}
|
|
78
78
|
function Me(n) {
|
|
79
|
-
const { children: e, cardRowHeight: t = "auto" } = n, r =
|
|
80
|
-
(
|
|
81
|
-
if (r.current =
|
|
82
|
-
Y.set(
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
|
|
79
|
+
const { children: e, cardRowHeight: t = "auto" } = n, r = k(null), o = E(
|
|
80
|
+
(a) => {
|
|
81
|
+
if (r.current = a, !a) return;
|
|
82
|
+
Y.set(a, e);
|
|
83
|
+
const s = a.closest("tbw-grid");
|
|
84
|
+
if (s) {
|
|
85
|
+
const g = s.id || s.getAttribute("data-grid-id");
|
|
86
|
+
g && Z.set(g, e);
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
[e]
|
|
90
90
|
);
|
|
91
91
|
P(() => () => {
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
Y.delete(
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
|
|
92
|
+
const a = r.current;
|
|
93
|
+
if (a) {
|
|
94
|
+
Y.delete(a);
|
|
95
|
+
const s = a.closest("tbw-grid");
|
|
96
|
+
if (s) {
|
|
97
|
+
const g = s.id || s.getAttribute("data-grid-id");
|
|
98
|
+
g && Z.delete(g);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}, []);
|
|
102
|
-
const
|
|
103
|
-
return /* @__PURE__ */ b("tbw-grid-responsive-card", { ref: o, cardRowHeight:
|
|
102
|
+
const c = t === "auto" ? "auto" : String(t);
|
|
103
|
+
return /* @__PURE__ */ b("tbw-grid-responsive-card", { ref: o, cardRowHeight: c });
|
|
104
104
|
}
|
|
105
105
|
Me.displayName = "GridResponsiveCard";
|
|
106
|
-
const z =
|
|
107
|
-
function
|
|
106
|
+
const z = ye(null), He = ({ defaults: n, children: e }) => /* @__PURE__ */ b(z.Provider, { value: n, children: e });
|
|
107
|
+
function mt() {
|
|
108
108
|
return O(z);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function yt(n) {
|
|
111
111
|
return O(z)?.[n];
|
|
112
112
|
}
|
|
113
113
|
const Oe = z, je = he(function(e, t) {
|
|
114
|
-
const r =
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const r = k(/* @__PURE__ */ new Map()), [, o] = Ee((p) => p + 1, 0), c = k(!1), a = k(0), s = () => {
|
|
115
|
+
c.current || (c.current = !0, queueMicrotask(() => {
|
|
116
|
+
c.current = !1, V(o), g();
|
|
117
117
|
}));
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let
|
|
118
|
+
}, g = () => {
|
|
119
|
+
a.current || (a.current = requestAnimationFrame(() => {
|
|
120
|
+
a.current = 0;
|
|
121
|
+
let p = !1;
|
|
122
122
|
for (const [C, R] of r.current)
|
|
123
|
-
R.container.isConnected || (r.current.delete(C),
|
|
124
|
-
|
|
123
|
+
R.container.isConnected || (r.current.delete(C), p = !0);
|
|
124
|
+
p && V(o);
|
|
125
125
|
}));
|
|
126
126
|
};
|
|
127
127
|
ve(
|
|
128
128
|
t,
|
|
129
129
|
() => ({
|
|
130
|
-
renderPortal(
|
|
131
|
-
r.current.set(
|
|
130
|
+
renderPortal(p, C, R) {
|
|
131
|
+
r.current.set(p, { container: C, element: R }), s();
|
|
132
132
|
},
|
|
133
|
-
removePortal(
|
|
134
|
-
r.current.delete(
|
|
133
|
+
removePortal(p, C) {
|
|
134
|
+
r.current.delete(p) && (C ? V(o) : s());
|
|
135
135
|
},
|
|
136
136
|
clear() {
|
|
137
|
-
r.current.size > 0 && (r.current.clear(),
|
|
137
|
+
r.current.size > 0 && (r.current.clear(), a.current && (cancelAnimationFrame(a.current), a.current = 0), s());
|
|
138
138
|
}
|
|
139
139
|
}),
|
|
140
140
|
// forceRender is stable (useReducer dispatch), refs are stable
|
|
@@ -142,14 +142,14 @@ const Oe = z, je = he(function(e, t) {
|
|
|
142
142
|
[]
|
|
143
143
|
);
|
|
144
144
|
const d = [];
|
|
145
|
-
for (const [
|
|
146
|
-
d.push(Ge(R, C,
|
|
145
|
+
for (const [p, { container: C, element: R }] of r.current)
|
|
146
|
+
d.push(Ge(R, C, p));
|
|
147
147
|
return /* @__PURE__ */ b(ne, { children: d });
|
|
148
|
-
}), U = /* @__PURE__ */ Symbol("reactProcessed"),
|
|
148
|
+
}), U = /* @__PURE__ */ Symbol("reactProcessed"), D = [];
|
|
149
149
|
function ze(n) {
|
|
150
|
-
for (let e =
|
|
151
|
-
const t =
|
|
152
|
-
n.contains(t.container) && t.container.classList.contains("react-cell-editor") && (H(t.key),
|
|
150
|
+
for (let e = D.length - 1; e >= 0; e--) {
|
|
151
|
+
const t = D[e];
|
|
152
|
+
n.contains(t.container) && t.container.classList.contains("react-cell-editor") && (H(t.key), D.splice(e, 1));
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
function qe(n) {
|
|
@@ -157,14 +157,14 @@ function qe(n) {
|
|
|
157
157
|
return (t) => {
|
|
158
158
|
const r = t.cellEl;
|
|
159
159
|
if (r) {
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
return w(
|
|
160
|
+
const a = e.get(r);
|
|
161
|
+
if (a)
|
|
162
|
+
return w(a.container, n(t), a.portalKey), a.container;
|
|
163
163
|
}
|
|
164
164
|
const o = document.createElement("div");
|
|
165
165
|
o.className = "react-cell-renderer", o.style.display = "contents";
|
|
166
|
-
const
|
|
167
|
-
return r && e.set(r, { portalKey:
|
|
166
|
+
const c = w(o, n(t));
|
|
167
|
+
return r && e.set(r, { portalKey: c, container: o }), D.push({ key: c, container: o }), o;
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
function _e(n) {
|
|
@@ -172,7 +172,7 @@ function _e(n) {
|
|
|
172
172
|
const t = document.createElement("div");
|
|
173
173
|
t.className = "react-cell-editor", t.style.display = "contents";
|
|
174
174
|
const r = w(t, n(e));
|
|
175
|
-
return
|
|
175
|
+
return D.push({ key: r, container: t }), t;
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
function $e(n) {
|
|
@@ -180,18 +180,18 @@ function $e(n) {
|
|
|
180
180
|
const t = document.createElement("div");
|
|
181
181
|
t.className = "react-header-renderer", t.style.display = "contents";
|
|
182
182
|
const r = w(t, n(e));
|
|
183
|
-
return
|
|
183
|
+
return D.push({ key: r, container: t }), t;
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Be(n) {
|
|
187
187
|
return (e) => {
|
|
188
188
|
const t = document.createElement("div");
|
|
189
189
|
t.className = "react-header-label-renderer", t.style.display = "contents";
|
|
190
190
|
const r = w(t, n(e));
|
|
191
|
-
return
|
|
191
|
+
return D.push({ key: r, container: t }), t;
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Ve(n) {
|
|
195
195
|
return (e) => {
|
|
196
196
|
const t = n(e);
|
|
197
197
|
if (t instanceof HTMLElement || typeof t == "string")
|
|
@@ -199,7 +199,7 @@ function We(n) {
|
|
|
199
199
|
const r = document.createElement("div");
|
|
200
200
|
r.className = "react-loading-renderer", r.style.display = "contents";
|
|
201
201
|
const o = w(r, t);
|
|
202
|
-
return
|
|
202
|
+
return D.push({ key: o, container: r }), r;
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
function Re(n) {
|
|
@@ -209,7 +209,7 @@ function Re(n) {
|
|
|
209
209
|
const r = n.loadingRenderer;
|
|
210
210
|
n = {
|
|
211
211
|
...n,
|
|
212
|
-
loadingRenderer:
|
|
212
|
+
loadingRenderer: Ve(r)
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
if (!n.columns) {
|
|
@@ -217,8 +217,8 @@ function Re(n) {
|
|
|
217
217
|
return r[U] = !0, r;
|
|
218
218
|
}
|
|
219
219
|
const e = n.columns.map((r) => {
|
|
220
|
-
const { renderer: o, editor:
|
|
221
|
-
return o && (d.renderer = qe(o)),
|
|
220
|
+
const { renderer: o, editor: c, headerRenderer: a, headerLabelRenderer: s, ...g } = r, d = { ...g };
|
|
221
|
+
return o && (d.renderer = qe(o)), c && (d.editor = _e(c)), a && (d.headerRenderer = $e(a)), s && (d.headerLabelRenderer = Be(s)), d;
|
|
222
222
|
}), t = {
|
|
223
223
|
...n,
|
|
224
224
|
columns: e
|
|
@@ -226,7 +226,7 @@ function Re(n) {
|
|
|
226
226
|
return t[U] = !0, t;
|
|
227
227
|
}
|
|
228
228
|
const Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new Map();
|
|
229
|
-
function
|
|
229
|
+
function We(n) {
|
|
230
230
|
const e = n.querySelector("tbw-grid-detail");
|
|
231
231
|
if (e) {
|
|
232
232
|
const r = Q.get(e);
|
|
@@ -237,34 +237,34 @@ function Be(n) {
|
|
|
237
237
|
return X.get(t);
|
|
238
238
|
}
|
|
239
239
|
function Ue(n) {
|
|
240
|
-
const { children: e, showExpandColumn: t = !0, animation: r = "slide" } = n, o =
|
|
241
|
-
(
|
|
242
|
-
if (o.current =
|
|
243
|
-
Q.set(
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const d =
|
|
240
|
+
const { children: e, showExpandColumn: t = !0, animation: r = "slide" } = n, o = k(null), c = E(
|
|
241
|
+
(s) => {
|
|
242
|
+
if (o.current = s, !s) return;
|
|
243
|
+
Q.set(s, e);
|
|
244
|
+
const g = s.closest("tbw-grid");
|
|
245
|
+
if (g) {
|
|
246
|
+
const d = g.id || g.getAttribute("data-grid-id");
|
|
247
247
|
d && X.set(d, e);
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
250
|
[e]
|
|
251
251
|
);
|
|
252
252
|
return P(() => () => {
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
Q.delete(
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
258
|
-
const
|
|
259
|
-
|
|
253
|
+
const s = o.current;
|
|
254
|
+
if (s) {
|
|
255
|
+
Q.delete(s);
|
|
256
|
+
const g = s.closest("tbw-grid");
|
|
257
|
+
if (g) {
|
|
258
|
+
const p = g.id || g.getAttribute("data-grid-id");
|
|
259
|
+
p && X.delete(p);
|
|
260
260
|
}
|
|
261
|
-
const d =
|
|
262
|
-
d && d.contains(
|
|
261
|
+
const d = s.parentNode;
|
|
262
|
+
d && d.contains(s);
|
|
263
263
|
}
|
|
264
264
|
}, []), /* @__PURE__ */ b(
|
|
265
265
|
"tbw-grid-detail",
|
|
266
266
|
{
|
|
267
|
-
ref:
|
|
267
|
+
ref: c,
|
|
268
268
|
showExpandColumn: t ? void 0 : "false",
|
|
269
269
|
animation: r === !1 ? "false" : r
|
|
270
270
|
}
|
|
@@ -280,55 +280,55 @@ function Je(n) {
|
|
|
280
280
|
return te.get(t);
|
|
281
281
|
}
|
|
282
282
|
function ht(n) {
|
|
283
|
-
const { id: e, title: t, icon: r, tooltip: o, order:
|
|
283
|
+
const { id: e, title: t, icon: r, tooltip: o, order: c = 100, children: a } = n, s = k(null), g = E(
|
|
284
284
|
(d) => {
|
|
285
|
-
|
|
285
|
+
s.current = d, d && (ee.set(d, a), e && te.set(e, a));
|
|
286
286
|
},
|
|
287
|
-
[
|
|
287
|
+
[a, e]
|
|
288
288
|
);
|
|
289
289
|
return P(() => () => {
|
|
290
|
-
const d =
|
|
290
|
+
const d = s.current;
|
|
291
291
|
d && (ee.delete(d), e && te.delete(e));
|
|
292
292
|
}, [e]), /* @__PURE__ */ b(
|
|
293
293
|
"tbw-grid-tool-panel",
|
|
294
294
|
{
|
|
295
|
-
ref:
|
|
295
|
+
ref: g,
|
|
296
296
|
id: e,
|
|
297
297
|
title: t,
|
|
298
298
|
icon: r,
|
|
299
299
|
tooltip: o,
|
|
300
|
-
order:
|
|
300
|
+
order: c?.toString()
|
|
301
301
|
}
|
|
302
302
|
);
|
|
303
303
|
}
|
|
304
|
-
const
|
|
304
|
+
const G = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new Map();
|
|
305
305
|
function Ye(n, e) {
|
|
306
|
-
const t = n.getAttribute("field"), r =
|
|
307
|
-
if (r.renderer = e,
|
|
308
|
-
const o =
|
|
309
|
-
o.renderer = e,
|
|
306
|
+
const t = n.getAttribute("field"), r = G.get(n) ?? {};
|
|
307
|
+
if (r.renderer = e, G.set(n, r), t) {
|
|
308
|
+
const o = A.get(t) ?? {};
|
|
309
|
+
o.renderer = e, A.set(t, o);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
function Ze(n, e) {
|
|
313
|
-
const t = n.getAttribute("field"), r =
|
|
314
|
-
if (r.editor = e,
|
|
315
|
-
const o =
|
|
316
|
-
o.editor = e,
|
|
313
|
+
const t = n.getAttribute("field"), r = G.get(n) ?? {};
|
|
314
|
+
if (r.editor = e, G.set(n, r), t) {
|
|
315
|
+
const o = A.get(t) ?? {};
|
|
316
|
+
o.editor = e, A.set(t, o);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
function Qe(n) {
|
|
320
|
-
let e =
|
|
320
|
+
let e = G.get(n)?.renderer;
|
|
321
321
|
if (!e) {
|
|
322
322
|
const t = n.getAttribute("field");
|
|
323
|
-
t && (e =
|
|
323
|
+
t && (e = A.get(t)?.renderer);
|
|
324
324
|
}
|
|
325
325
|
return e;
|
|
326
326
|
}
|
|
327
327
|
function Xe(n) {
|
|
328
|
-
let e =
|
|
328
|
+
let e = G.get(n)?.editor;
|
|
329
329
|
if (!e) {
|
|
330
330
|
const t = n.getAttribute("field");
|
|
331
|
-
t && (e =
|
|
331
|
+
t && (e = A.get(t)?.editor);
|
|
332
332
|
}
|
|
333
333
|
return e;
|
|
334
334
|
}
|
|
@@ -363,13 +363,13 @@ class et {
|
|
|
363
363
|
*/
|
|
364
364
|
canHandle(e) {
|
|
365
365
|
const t = e.getAttribute("field");
|
|
366
|
-
let r =
|
|
366
|
+
let r = G.get(e);
|
|
367
367
|
if (!r && t) {
|
|
368
|
-
const
|
|
369
|
-
|
|
368
|
+
const a = A.get(t);
|
|
369
|
+
a && (a.renderer || a.editor) && (r = a, G.set(e, r));
|
|
370
370
|
}
|
|
371
|
-
const o = r?.renderer !== void 0,
|
|
372
|
-
return r !== void 0 && (o ||
|
|
371
|
+
const o = r?.renderer !== void 0, c = r?.editor !== void 0;
|
|
372
|
+
return r !== void 0 && (o || c);
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Creates a view renderer function that renders a React component
|
|
@@ -387,31 +387,31 @@ class et {
|
|
|
387
387
|
if (!t)
|
|
388
388
|
return;
|
|
389
389
|
const r = e.closest("tbw-grid"), o = /* @__PURE__ */ new WeakMap();
|
|
390
|
-
return (
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
393
|
-
const d = o.get(
|
|
390
|
+
return (c) => {
|
|
391
|
+
const a = c.cellEl;
|
|
392
|
+
if (a) {
|
|
393
|
+
const d = o.get(a);
|
|
394
394
|
if (d)
|
|
395
|
-
return w(d.container, t(
|
|
396
|
-
const
|
|
397
|
-
|
|
395
|
+
return w(d.container, t(c), d.portalKey), d.container;
|
|
396
|
+
const p = document.createElement("div");
|
|
397
|
+
p.className = "react-cell-renderer", p.style.display = "contents";
|
|
398
398
|
const C = w(
|
|
399
|
-
|
|
400
|
-
t(
|
|
399
|
+
p,
|
|
400
|
+
t(c),
|
|
401
401
|
void 0,
|
|
402
402
|
r ?? void 0
|
|
403
403
|
);
|
|
404
|
-
return o.set(
|
|
404
|
+
return o.set(a, { portalKey: C, container: p }), this.trackPortal(C, p, !1), p;
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
t(
|
|
406
|
+
const s = document.createElement("div");
|
|
407
|
+
s.className = "react-cell-renderer", s.style.display = "contents";
|
|
408
|
+
const g = w(
|
|
409
|
+
s,
|
|
410
|
+
t(c),
|
|
411
411
|
void 0,
|
|
412
412
|
r ?? void 0
|
|
413
413
|
);
|
|
414
|
-
return this.trackPortal(
|
|
414
|
+
return this.trackPortal(g, s, !1), s;
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
417
|
/**
|
|
@@ -424,15 +424,15 @@ class et {
|
|
|
424
424
|
return () => document.createElement("div");
|
|
425
425
|
const r = e.closest("tbw-grid") ?? void 0;
|
|
426
426
|
return (o) => {
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
427
|
+
const c = document.createElement("div");
|
|
428
|
+
c.className = "react-cell-editor", c.style.display = "contents";
|
|
429
|
+
const a = w(
|
|
430
|
+
c,
|
|
431
431
|
t(o),
|
|
432
432
|
void 0,
|
|
433
433
|
r
|
|
434
434
|
);
|
|
435
|
-
return this.trackPortal(
|
|
435
|
+
return this.trackPortal(a, c, !0), c;
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
438
|
/**
|
|
@@ -440,18 +440,18 @@ class et {
|
|
|
440
440
|
* Renders React components for expandable detail rows.
|
|
441
441
|
*/
|
|
442
442
|
createDetailRenderer(e) {
|
|
443
|
-
const t =
|
|
443
|
+
const t = We(e);
|
|
444
444
|
if (t)
|
|
445
445
|
return (r, o) => {
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
|
|
446
|
+
const c = document.createElement("div");
|
|
447
|
+
c.className = "react-detail-panel";
|
|
448
|
+
const s = w(
|
|
449
|
+
c,
|
|
450
450
|
t({ row: r, rowIndex: o }),
|
|
451
451
|
void 0,
|
|
452
452
|
e
|
|
453
453
|
);
|
|
454
|
-
return this.trackPortal(
|
|
454
|
+
return this.trackPortal(s, c, !1), c;
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
457
|
/**
|
|
@@ -471,17 +471,30 @@ class et {
|
|
|
471
471
|
const t = Ce(e);
|
|
472
472
|
if (t)
|
|
473
473
|
return (r, o) => {
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
|
|
474
|
+
const c = document.createElement("div");
|
|
475
|
+
c.className = "react-responsive-card";
|
|
476
|
+
const s = w(
|
|
477
|
+
c,
|
|
478
478
|
t({ row: r, index: o }),
|
|
479
479
|
void 0,
|
|
480
480
|
e
|
|
481
481
|
);
|
|
482
|
-
return this.trackPortal(
|
|
482
|
+
return this.trackPortal(s, c, !1), c;
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* FrameworkAdapter hook called by ResponsivePlugin during attach().
|
|
487
|
+
* Parses the `<tbw-grid-responsive-card>` element and delegates to
|
|
488
|
+
* {@link createResponsiveCardRenderer}. Needed for parity with the Vue
|
|
489
|
+
* and Angular adapters so ResponsivePlugin's standard lookup path works
|
|
490
|
+
* for React users as well, not just via the imperative
|
|
491
|
+
* `refreshResponsiveCardRenderer` hook in DataGrid.
|
|
492
|
+
*/
|
|
493
|
+
parseResponsiveCardElement(e) {
|
|
494
|
+
const t = e.closest("tbw-grid");
|
|
495
|
+
if (t)
|
|
496
|
+
return this.createResponsiveCardRenderer(t);
|
|
497
|
+
}
|
|
485
498
|
/**
|
|
486
499
|
* Creates a tool panel renderer from a light DOM element.
|
|
487
500
|
* Renders React components into tool panel containers.
|
|
@@ -492,11 +505,11 @@ class et {
|
|
|
492
505
|
return;
|
|
493
506
|
const r = e.closest("tbw-grid");
|
|
494
507
|
return (o) => {
|
|
495
|
-
const
|
|
508
|
+
const a = w(o, t({
|
|
496
509
|
grid: r ?? o
|
|
497
510
|
}), void 0, r ?? void 0);
|
|
498
|
-
return this.trackPortal(
|
|
499
|
-
H(
|
|
511
|
+
return this.trackPortal(a, o, !1), () => {
|
|
512
|
+
H(a, { sync: !0 }), this.untrackPortal(a);
|
|
500
513
|
};
|
|
501
514
|
};
|
|
502
515
|
}
|
|
@@ -543,8 +556,8 @@ class et {
|
|
|
543
556
|
return (r) => {
|
|
544
557
|
const o = document.createElement("span");
|
|
545
558
|
o.style.display = "contents";
|
|
546
|
-
const
|
|
547
|
-
return this.trackPortal(
|
|
559
|
+
const c = r.cellEl?.closest("tbw-grid") ?? t, a = w(o, e(r), void 0, c);
|
|
560
|
+
return this.trackPortal(a, o, !1), o;
|
|
548
561
|
};
|
|
549
562
|
}
|
|
550
563
|
/**
|
|
@@ -555,8 +568,8 @@ class et {
|
|
|
555
568
|
return (r) => {
|
|
556
569
|
const o = document.createElement("span");
|
|
557
570
|
o.style.display = "contents";
|
|
558
|
-
const
|
|
559
|
-
return this.trackPortal(
|
|
571
|
+
const c = w(o, e(r), void 0, t);
|
|
572
|
+
return this.trackPortal(c, o, !0), o;
|
|
560
573
|
};
|
|
561
574
|
}
|
|
562
575
|
/**
|
|
@@ -565,10 +578,10 @@ class et {
|
|
|
565
578
|
*/
|
|
566
579
|
createFilterPanelRenderer(e, t) {
|
|
567
580
|
return (r, o) => {
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
this.trackPortal(
|
|
581
|
+
const c = document.createElement("div");
|
|
582
|
+
c.style.display = "contents";
|
|
583
|
+
const a = r.closest("tbw-grid") ?? t, s = w(c, e(o), void 0, a);
|
|
584
|
+
this.trackPortal(s, c, !1), r.appendChild(c);
|
|
572
585
|
};
|
|
573
586
|
}
|
|
574
587
|
// #region Portal tracking helpers
|
|
@@ -588,7 +601,7 @@ class et {
|
|
|
588
601
|
destroy() {
|
|
589
602
|
for (const e of this.allPortalKeys)
|
|
590
603
|
H(e);
|
|
591
|
-
this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear(),
|
|
604
|
+
this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear(), A.clear();
|
|
592
605
|
}
|
|
593
606
|
/**
|
|
594
607
|
* Called when a cell's content is about to be wiped.
|
|
@@ -635,9 +648,9 @@ function nt(n) {
|
|
|
635
648
|
r === void 0 || r === !1 || e.push(t);
|
|
636
649
|
return rt(e), Ae(n);
|
|
637
650
|
}
|
|
638
|
-
let
|
|
651
|
+
let me = !1, J = null;
|
|
639
652
|
function re() {
|
|
640
|
-
return
|
|
653
|
+
return me || (J = new et(), be.registerAdapter(J), me = !0), J;
|
|
641
654
|
}
|
|
642
655
|
re();
|
|
643
656
|
function ot(n) {
|
|
@@ -647,10 +660,10 @@ function ot(n) {
|
|
|
647
660
|
function it(n, e) {
|
|
648
661
|
const t = n;
|
|
649
662
|
if (!n.querySelector("tbw-grid-responsive-card") || !Ce(n)) return;
|
|
650
|
-
const
|
|
651
|
-
if (
|
|
652
|
-
const
|
|
653
|
-
|
|
663
|
+
const c = t.getPluginByName?.("responsive");
|
|
664
|
+
if (c && typeof c.setCardRenderer == "function") {
|
|
665
|
+
const a = e.createResponsiveCardRenderer(n);
|
|
666
|
+
a && c.setCardRenderer(a);
|
|
654
667
|
}
|
|
655
668
|
}
|
|
656
669
|
function st(n) {
|
|
@@ -675,26 +688,26 @@ const vt = he(function(e, t) {
|
|
|
675
688
|
// Core props
|
|
676
689
|
rows: r,
|
|
677
690
|
gridConfig: o,
|
|
678
|
-
columns:
|
|
679
|
-
columnDefaults:
|
|
680
|
-
fitMode:
|
|
681
|
-
sortable:
|
|
691
|
+
columns: c,
|
|
692
|
+
columnDefaults: a,
|
|
693
|
+
fitMode: s,
|
|
694
|
+
sortable: g,
|
|
682
695
|
filterable: d,
|
|
683
|
-
selectable:
|
|
696
|
+
selectable: p,
|
|
684
697
|
loading: C,
|
|
685
698
|
customStyles: R,
|
|
686
699
|
className: K,
|
|
687
|
-
style:
|
|
688
|
-
children:
|
|
700
|
+
style: x,
|
|
701
|
+
children: T,
|
|
689
702
|
// Plugin props
|
|
690
|
-
plugins:
|
|
703
|
+
plugins: u,
|
|
691
704
|
// SSR mode
|
|
692
|
-
ssr:
|
|
705
|
+
ssr: h,
|
|
693
706
|
// Legacy event handlers
|
|
694
|
-
onRowsChange:
|
|
707
|
+
onRowsChange: v,
|
|
695
708
|
// Feature props and event props are in ...rest
|
|
696
|
-
...
|
|
697
|
-
} = e,
|
|
709
|
+
...m
|
|
710
|
+
} = e, f = k(null), j = k(null), ie = O(Oe), q = O(Le), se = [
|
|
698
711
|
"selection",
|
|
699
712
|
"editing",
|
|
700
713
|
"filtering",
|
|
@@ -718,58 +731,58 @@ const vt = he(function(e, t) {
|
|
|
718
731
|
"pivot",
|
|
719
732
|
"serverSide",
|
|
720
733
|
"tooltip"
|
|
721
|
-
], we =
|
|
722
|
-
const l =
|
|
734
|
+
], we = S(() => se.map((i) => {
|
|
735
|
+
const l = m[i];
|
|
723
736
|
return l !== void 0 ? `${i}:${JSON.stringify(l)}` : "";
|
|
724
|
-
}).filter(Boolean).join("|"), [
|
|
737
|
+
}).filter(Boolean).join("|"), [m]), ce = S(() => {
|
|
725
738
|
const i = {};
|
|
726
739
|
for (const l of se)
|
|
727
|
-
l in
|
|
740
|
+
l in m && m[l] !== void 0 && (i[l] = m[l]);
|
|
728
741
|
return i;
|
|
729
|
-
}, [we]), ae =
|
|
730
|
-
if (
|
|
731
|
-
const i = new Set(
|
|
732
|
-
return [...
|
|
742
|
+
}, [we]), ae = S(() => st(T), [T]), le = S(() => ({ ...ae, ...ce }), [ce, ae]), _ = S(() => u || h ? [] : nt(le), [le, u, h]), N = S(() => {
|
|
743
|
+
if (u) {
|
|
744
|
+
const i = new Set(u.map((y) => y.name)), l = _.filter((y) => !i.has(y.name));
|
|
745
|
+
return [...u, ...l];
|
|
733
746
|
}
|
|
734
747
|
return _;
|
|
735
|
-
}, [
|
|
736
|
-
if (!
|
|
737
|
-
const i = Fe(
|
|
738
|
-
return
|
|
739
|
-
...
|
|
748
|
+
}, [u, _]), F = S(() => {
|
|
749
|
+
if (!c) return c;
|
|
750
|
+
const i = Fe(c);
|
|
751
|
+
return a ? i.map((l) => ({
|
|
752
|
+
...a,
|
|
740
753
|
...l
|
|
741
754
|
// Individual column props override defaults
|
|
742
755
|
})) : i;
|
|
743
|
-
}, [
|
|
756
|
+
}, [c, a]), I = S(() => {
|
|
744
757
|
const i = Re(o), l = {};
|
|
745
|
-
if (
|
|
758
|
+
if (g !== void 0 && (l.sortable = g), d !== void 0 && (l.filterable = d), p !== void 0 && (l.selectable = p), q) {
|
|
746
759
|
const y = i?.icons || o?.icons || {};
|
|
747
760
|
l.icons = { ...q, ...y };
|
|
748
761
|
}
|
|
749
762
|
if (N.length > 0 && i) {
|
|
750
|
-
const y = i.plugins || [], L = new Set(y.map((M) => M.name)),
|
|
763
|
+
const y = i.plugins || [], L = new Set(y.map((M) => M.name)), B = N.filter((M) => !L.has(M.name));
|
|
751
764
|
return {
|
|
752
765
|
...i,
|
|
753
766
|
...l,
|
|
754
|
-
plugins: [...y, ...
|
|
767
|
+
plugins: [...y, ...B]
|
|
755
768
|
};
|
|
756
769
|
}
|
|
757
770
|
return N.length > 0 && !i ? { ...l, plugins: N } : Object.keys(l).length > 0 ? { ...i, ...l } : i;
|
|
758
|
-
}, [o, N,
|
|
771
|
+
}, [o, N, g, d, p, q]);
|
|
759
772
|
P(() => {
|
|
760
773
|
re().setTypeDefaults(ie);
|
|
761
774
|
}, [ie]), P(() => {
|
|
762
|
-
|
|
775
|
+
f.current && (f.current.rows = r);
|
|
763
776
|
}, [r]), P(() => {
|
|
764
|
-
|
|
777
|
+
f.current && I && (f.current.gridConfig = I);
|
|
765
778
|
}, [I]), P(() => {
|
|
766
|
-
|
|
779
|
+
f.current && F && (f.current.columns = F);
|
|
767
780
|
}, [F]), P(() => {
|
|
768
|
-
|
|
769
|
-
}, [
|
|
770
|
-
|
|
781
|
+
f.current && s !== void 0 && (f.current.fitMode = s);
|
|
782
|
+
}, [s]), P(() => {
|
|
783
|
+
f.current && C !== void 0 && (f.current.loading = C);
|
|
771
784
|
}, [C]), P(() => {
|
|
772
|
-
const i =
|
|
785
|
+
const i = f.current;
|
|
773
786
|
if (!i) return;
|
|
774
787
|
const l = re();
|
|
775
788
|
i.__frameworkAdapter = l, ot(i), it(i, l);
|
|
@@ -781,8 +794,8 @@ const vt = he(function(e, t) {
|
|
|
781
794
|
y = !0, cancelAnimationFrame(L);
|
|
782
795
|
};
|
|
783
796
|
}, []), P(() => {
|
|
784
|
-
if (!
|
|
785
|
-
const i =
|
|
797
|
+
if (!f.current || !R) return;
|
|
798
|
+
const i = f.current, l = "react-custom-styles";
|
|
786
799
|
let y = !0;
|
|
787
800
|
return i.ready?.().then(() => {
|
|
788
801
|
y && R && (i.registerStyles?.(l, R), j.current = l);
|
|
@@ -790,24 +803,24 @@ const vt = he(function(e, t) {
|
|
|
790
803
|
y = !1, j.current && (i.unregisterStyles?.(j.current), j.current = null);
|
|
791
804
|
};
|
|
792
805
|
}, [R]), P(() => {
|
|
793
|
-
const i =
|
|
806
|
+
const i = f.current;
|
|
794
807
|
if (!i) return;
|
|
795
808
|
const l = [];
|
|
796
|
-
return
|
|
809
|
+
return v && l.push(i.on("rows-change", (y) => v(y.rows))), () => {
|
|
797
810
|
l.forEach((y) => y());
|
|
798
811
|
};
|
|
799
|
-
}, [
|
|
800
|
-
const de =
|
|
801
|
-
for (const i of Object.keys(
|
|
802
|
-
ue.current[i] =
|
|
812
|
+
}, [v]);
|
|
813
|
+
const de = S(() => Object.keys(W).filter((i) => typeof m[i] == "function").sort().join("|"), [m]), ue = k({});
|
|
814
|
+
for (const i of Object.keys(W))
|
|
815
|
+
ue.current[i] = m[i];
|
|
803
816
|
P(() => {
|
|
804
|
-
const i =
|
|
817
|
+
const i = f.current;
|
|
805
818
|
if (!i) return;
|
|
806
819
|
const l = [];
|
|
807
|
-
for (const [y, L] of Object.entries(
|
|
820
|
+
for (const [y, L] of Object.entries(W))
|
|
808
821
|
de.includes(y) && l.push(
|
|
809
|
-
i.on(L, (
|
|
810
|
-
ue.current[y]?.(
|
|
822
|
+
i.on(L, (B, M) => {
|
|
823
|
+
ue.current[y]?.(B, M);
|
|
811
824
|
})
|
|
812
825
|
);
|
|
813
826
|
return () => {
|
|
@@ -817,47 +830,47 @@ const vt = he(function(e, t) {
|
|
|
817
830
|
t,
|
|
818
831
|
() => ({
|
|
819
832
|
get element() {
|
|
820
|
-
return
|
|
833
|
+
return f.current;
|
|
821
834
|
},
|
|
822
835
|
async getConfig() {
|
|
823
|
-
return
|
|
836
|
+
return f.current?.getConfig?.() ?? {};
|
|
824
837
|
},
|
|
825
838
|
async ready() {
|
|
826
|
-
return
|
|
839
|
+
return f.current?.ready?.();
|
|
827
840
|
},
|
|
828
841
|
async forceLayout() {
|
|
829
|
-
return
|
|
842
|
+
return f.current?.forceLayout?.();
|
|
830
843
|
},
|
|
831
844
|
async toggleGroup(i) {
|
|
832
|
-
return
|
|
845
|
+
return f.current?.toggleGroup?.(i);
|
|
833
846
|
},
|
|
834
847
|
registerStyles(i, l) {
|
|
835
|
-
|
|
848
|
+
f.current?.registerStyles?.(i, l);
|
|
836
849
|
},
|
|
837
850
|
unregisterStyles(i) {
|
|
838
|
-
|
|
851
|
+
f.current?.unregisterStyles?.(i);
|
|
839
852
|
},
|
|
840
853
|
setRowLoading(i, l) {
|
|
841
|
-
|
|
854
|
+
f.current?.setRowLoading?.(i, l);
|
|
842
855
|
},
|
|
843
856
|
setCellLoading(i, l, y) {
|
|
844
|
-
|
|
857
|
+
f.current?.setCellLoading?.(i, l, y);
|
|
845
858
|
},
|
|
846
859
|
isRowLoading(i) {
|
|
847
|
-
return
|
|
860
|
+
return f.current?.isRowLoading?.(i) ?? !1;
|
|
848
861
|
},
|
|
849
862
|
isCellLoading(i, l) {
|
|
850
|
-
return
|
|
863
|
+
return f.current?.isCellLoading?.(i, l) ?? !1;
|
|
851
864
|
},
|
|
852
865
|
clearAllLoading() {
|
|
853
|
-
|
|
866
|
+
f.current?.clearAllLoading?.();
|
|
854
867
|
}
|
|
855
868
|
}),
|
|
856
869
|
[]
|
|
857
870
|
);
|
|
858
|
-
const $ =
|
|
871
|
+
const $ = k(null);
|
|
859
872
|
return ke(() => {
|
|
860
|
-
const i =
|
|
873
|
+
const i = f.current;
|
|
861
874
|
return i && $.current && ge(i, $.current), () => {
|
|
862
875
|
i && ge(i, null);
|
|
863
876
|
};
|
|
@@ -867,14 +880,14 @@ const vt = he(function(e, t) {
|
|
|
867
880
|
"tbw-grid",
|
|
868
881
|
{
|
|
869
882
|
ref: (i) => {
|
|
870
|
-
if (
|
|
883
|
+
if (f.current = i, i) {
|
|
871
884
|
const l = i;
|
|
872
885
|
I && (l.gridConfig = I), r && (l.rows = r), F && (l.columns = F);
|
|
873
886
|
}
|
|
874
887
|
},
|
|
875
888
|
class: K,
|
|
876
|
-
style:
|
|
877
|
-
children: /* @__PURE__ */ b(Te.Provider, { value:
|
|
889
|
+
style: x,
|
|
890
|
+
children: /* @__PURE__ */ b(Te.Provider, { value: f, children: T })
|
|
878
891
|
}
|
|
879
892
|
)
|
|
880
893
|
] });
|
|
@@ -885,27 +898,27 @@ function Ct(n) {
|
|
|
885
898
|
header: t,
|
|
886
899
|
type: r,
|
|
887
900
|
editable: o,
|
|
888
|
-
sortable:
|
|
889
|
-
resizable:
|
|
890
|
-
width:
|
|
891
|
-
minWidth:
|
|
901
|
+
sortable: c,
|
|
902
|
+
resizable: a,
|
|
903
|
+
width: s,
|
|
904
|
+
minWidth: g,
|
|
892
905
|
hidden: d,
|
|
893
|
-
lockVisible:
|
|
906
|
+
lockVisible: p,
|
|
894
907
|
children: C,
|
|
895
908
|
editor: R,
|
|
896
909
|
options: K,
|
|
897
|
-
multi:
|
|
898
|
-
format:
|
|
899
|
-
} = n,
|
|
900
|
-
(
|
|
901
|
-
|
|
910
|
+
multi: x,
|
|
911
|
+
format: T
|
|
912
|
+
} = n, u = k(null), h = E(
|
|
913
|
+
(f) => {
|
|
914
|
+
u.current = f, f && (C && Ye(f, C), R && Ze(f, R));
|
|
902
915
|
},
|
|
903
916
|
[C, R, e]
|
|
904
|
-
),
|
|
917
|
+
), v = typeof s == "number" ? `${s}px` : s, m = {
|
|
905
918
|
field: e,
|
|
906
|
-
ref:
|
|
919
|
+
ref: h
|
|
907
920
|
};
|
|
908
|
-
return t !== void 0 && (
|
|
921
|
+
return t !== void 0 && (m.header = t), r !== void 0 && (m.type = r), o !== void 0 && (m.editable = o), c !== void 0 && (m.sortable = c), a !== void 0 && (m.resizable = a), v !== void 0 && (m.width = v), g !== void 0 && (m["min-width"] = g), d !== void 0 && (m.hidden = d), p !== void 0 && (m["lock-visible"] = p), x !== void 0 && (m.multi = x), T && (m["data-has-format"] = "true"), K && (m["data-has-options"] = "true"), /* @__PURE__ */ b("tbw-grid-column", { ...m });
|
|
909
922
|
}
|
|
910
923
|
function Rt({ children: n }) {
|
|
911
924
|
return /* @__PURE__ */ b("tbw-grid-tool-buttons", { children: n });
|
|
@@ -915,91 +928,99 @@ const wt = ({ icons: n, defaults: e, children: t }) => {
|
|
|
915
928
|
return e && (r = /* @__PURE__ */ b(He, { defaults: e, children: r })), n && (r = /* @__PURE__ */ b(Ie, { icons: n, children: r })), /* @__PURE__ */ b(ne, { children: r });
|
|
916
929
|
};
|
|
917
930
|
function Pt(n) {
|
|
918
|
-
const e =
|
|
931
|
+
const e = k(null), [t, r] = fe(!1), [o, c] = fe(null), a = k(null), s = E(() => n ? (a.current ??= document.querySelector(n), a.current) : e.current?.element ?? null, [n]);
|
|
919
932
|
P(() => {
|
|
920
|
-
let
|
|
933
|
+
let u = !0;
|
|
921
934
|
return (async () => {
|
|
922
935
|
try {
|
|
923
936
|
if (n) {
|
|
924
|
-
const
|
|
925
|
-
if (!
|
|
926
|
-
if (
|
|
937
|
+
const v = document.querySelector(n);
|
|
938
|
+
if (!v) return;
|
|
939
|
+
if (a.current = v, await v.ready?.(), u) {
|
|
927
940
|
r(!0);
|
|
928
|
-
const
|
|
929
|
-
|
|
941
|
+
const m = await v.getConfig?.();
|
|
942
|
+
u && m && c(m);
|
|
930
943
|
}
|
|
931
944
|
} else {
|
|
932
|
-
const
|
|
933
|
-
if (!
|
|
934
|
-
if (await
|
|
945
|
+
const v = e.current;
|
|
946
|
+
if (!v) return;
|
|
947
|
+
if (await v.ready?.(), u) {
|
|
935
948
|
r(!0);
|
|
936
|
-
const
|
|
937
|
-
|
|
949
|
+
const m = await v.getConfig?.();
|
|
950
|
+
u && m && c(m);
|
|
938
951
|
}
|
|
939
952
|
}
|
|
940
953
|
} catch {
|
|
941
954
|
}
|
|
942
955
|
})(), () => {
|
|
943
|
-
|
|
956
|
+
u = !1;
|
|
944
957
|
};
|
|
945
958
|
}, [n]);
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
if (
|
|
949
|
-
return await
|
|
950
|
-
const
|
|
951
|
-
return
|
|
952
|
-
}, [
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
await
|
|
959
|
+
const g = E(async () => {
|
|
960
|
+
const u = s();
|
|
961
|
+
if (u)
|
|
962
|
+
return await u.getConfig?.() ?? null;
|
|
963
|
+
const h = e.current;
|
|
964
|
+
return h ? await h.getConfig?.() ?? null : null;
|
|
965
|
+
}, [s]), d = E(async () => {
|
|
966
|
+
const u = s();
|
|
967
|
+
if (u) {
|
|
968
|
+
await u.forceLayout?.();
|
|
956
969
|
return;
|
|
957
970
|
}
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
}, [
|
|
961
|
-
async (
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
await
|
|
971
|
+
const h = e.current;
|
|
972
|
+
h && await h.forceLayout?.();
|
|
973
|
+
}, [s]), p = E(
|
|
974
|
+
async (u) => {
|
|
975
|
+
const h = s();
|
|
976
|
+
if (h) {
|
|
977
|
+
await h.toggleGroup?.(u);
|
|
965
978
|
return;
|
|
966
979
|
}
|
|
967
|
-
const
|
|
968
|
-
|
|
980
|
+
const v = e.current;
|
|
981
|
+
v && await v.toggleGroup?.(u);
|
|
969
982
|
},
|
|
970
|
-
[
|
|
971
|
-
), C =
|
|
972
|
-
(
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
983
|
+
[s]
|
|
984
|
+
), C = E(
|
|
985
|
+
(u) => s()?.getPlugin?.(u),
|
|
986
|
+
[s]
|
|
987
|
+
), R = E(
|
|
988
|
+
((u) => s()?.getPluginByName?.(u)),
|
|
989
|
+
[s]
|
|
990
|
+
), K = E(
|
|
991
|
+
(u, h) => {
|
|
992
|
+
const v = s();
|
|
993
|
+
if (v) {
|
|
994
|
+
v.registerStyles?.(u, h);
|
|
976
995
|
return;
|
|
977
996
|
}
|
|
978
|
-
e.current?.registerStyles?.(
|
|
997
|
+
e.current?.registerStyles?.(u, h);
|
|
979
998
|
},
|
|
980
|
-
[
|
|
981
|
-
),
|
|
982
|
-
(
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
|
|
999
|
+
[s]
|
|
1000
|
+
), x = E(
|
|
1001
|
+
(u) => {
|
|
1002
|
+
const h = s();
|
|
1003
|
+
if (h) {
|
|
1004
|
+
h.unregisterStyles?.(u);
|
|
986
1005
|
return;
|
|
987
1006
|
}
|
|
988
|
-
e.current?.unregisterStyles?.(
|
|
1007
|
+
e.current?.unregisterStyles?.(u);
|
|
989
1008
|
},
|
|
990
|
-
[
|
|
991
|
-
),
|
|
1009
|
+
[s]
|
|
1010
|
+
), T = E(() => o?.columns ? o.columns.filter((u) => !u.hidden) : [], [o]);
|
|
992
1011
|
return {
|
|
993
1012
|
ref: e,
|
|
994
|
-
element:
|
|
1013
|
+
element: s(),
|
|
995
1014
|
isReady: t,
|
|
996
1015
|
config: o,
|
|
997
|
-
getConfig:
|
|
1016
|
+
getConfig: g,
|
|
998
1017
|
forceLayout: d,
|
|
999
|
-
toggleGroup:
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1018
|
+
toggleGroup: p,
|
|
1019
|
+
getPlugin: C,
|
|
1020
|
+
getPluginByName: R,
|
|
1021
|
+
registerStyles: K,
|
|
1022
|
+
unregisterStyles: x,
|
|
1023
|
+
getVisibleColumns: T
|
|
1003
1024
|
};
|
|
1004
1025
|
}
|
|
1005
1026
|
export {
|
|
@@ -1015,6 +1036,6 @@ export {
|
|
|
1015
1036
|
He as GridTypeProvider,
|
|
1016
1037
|
Pt as useGrid,
|
|
1017
1038
|
pt as useGridIcons,
|
|
1018
|
-
|
|
1019
|
-
|
|
1039
|
+
mt as useGridTypeDefaults,
|
|
1040
|
+
yt as useTypeDefault
|
|
1020
1041
|
};
|
|
@@ -120,6 +120,15 @@ export declare class GridAdapter implements FrameworkAdapter {
|
|
|
120
120
|
* Renders React components for card layout in responsive mode.
|
|
121
121
|
*/
|
|
122
122
|
createResponsiveCardRenderer<TRow = unknown>(gridElement: HTMLElement): ((row: TRow, rowIndex: number) => HTMLElement) | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* FrameworkAdapter hook called by ResponsivePlugin during attach().
|
|
125
|
+
* Parses the `<tbw-grid-responsive-card>` element and delegates to
|
|
126
|
+
* {@link createResponsiveCardRenderer}. Needed for parity with the Vue
|
|
127
|
+
* and Angular adapters so ResponsivePlugin's standard lookup path works
|
|
128
|
+
* for React users as well, not just via the imperative
|
|
129
|
+
* `refreshResponsiveCardRenderer` hook in DataGrid.
|
|
130
|
+
*/
|
|
131
|
+
parseResponsiveCardElement<TRow = unknown>(cardElement: Element): ((row: TRow, rowIndex: number) => HTMLElement) | undefined;
|
|
123
132
|
/**
|
|
124
133
|
* Creates a tool panel renderer from a light DOM element.
|
|
125
134
|
* Renders React components into tool panel containers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,IAAI,cAAc,EAE5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAmC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAmB7F;;;GAGG;AACH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AAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAmBjC,oDAAoD;IACpD,OAAO,CAAC,WAAW;IAQnB,sDAAsD;IACtD,OAAO,CAAC,aAAa;IAQrB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAWf;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAYtC;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CAStC"}
|
|
1
|
+
{"version":3,"file":"react-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,IAAI,cAAc,EAE5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAmC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAmB7F;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,GAChE,IAAI,CAaN;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,CAAC,GAAG,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,GAChE,IAAI,CAYN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,GACnB,CAAC,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,CAAC,GAAG,SAAS,CAYvE;AAED;;;GAGG;AACH,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GAAG,IAAI;CAStC"}
|
package/lib/use-grid.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export interface UseGridReturn<TRow = unknown> {
|
|
|
18
18
|
forceLayout: () => Promise<void>;
|
|
19
19
|
/** Toggle a group row */
|
|
20
20
|
toggleGroup: (key: string) => Promise<void>;
|
|
21
|
+
/** Get a plugin by its class */
|
|
22
|
+
getPlugin: <T>(pluginClass: new (...args: unknown[]) => T) => T | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Get a plugin by its registered name (preferred).
|
|
25
|
+
* Uses the type-safe PluginNameMap for auto-completion and return type narrowing.
|
|
26
|
+
*/
|
|
27
|
+
getPluginByName: DataGridElement['getPluginByName'];
|
|
21
28
|
/** Register custom styles */
|
|
22
29
|
registerStyles: (id: string, css: string) => void;
|
|
23
30
|
/** Unregister custom styles */
|
package/lib/use-grid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-grid.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/use-grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,IAAI,GAAG,OAAO;IAC3C,2EAA2E;IAC3E,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/C,qFAAqF;IACrF,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtC,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAChC,sCAAsC;IACtC,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CA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