@toolbox-web/grid-react 2.0.0 → 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 +116 -85
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/row-diff.d.ts +20 -0
- package/lib/row-diff.d.ts.map +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import { t as _ } from "./chunks/grid-element-context-DpuQsoie.js";
|
|
|
7
7
|
import { t as v } from "./chunks/grid-detail-panel-CLdX0T_A.js";
|
|
8
8
|
import { t as y } from "./chunks/grid-responsive-card-Dx5U6Prm.js";
|
|
9
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
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { createPortal as
|
|
13
|
-
import { createPluginsFromFeatures as
|
|
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
14
|
//#region libs/grid-react/src/lib/column-shorthand.ts
|
|
15
|
-
function
|
|
15
|
+
function R(e) {
|
|
16
16
|
let { field: t, header: n, type: r } = x(e);
|
|
17
17
|
return r === void 0 ? {
|
|
18
18
|
field: t,
|
|
@@ -23,21 +23,21 @@ function B(e) {
|
|
|
23
23
|
type: r
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return e.map((e) => typeof e == "string" ?
|
|
26
|
+
function z(e) {
|
|
27
|
+
return e.map((e) => typeof e == "string" ? R(e) : e);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function B(e, t) {
|
|
30
30
|
return t ? e.map((e) => ({
|
|
31
31
|
...t,
|
|
32
32
|
...e
|
|
33
33
|
})) : e;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function V(e) {
|
|
36
36
|
return e.some((e) => typeof e == "string");
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region libs/grid-react/src/lib/event-props.ts
|
|
40
|
-
var
|
|
40
|
+
var H = {
|
|
41
41
|
onCellClick: "cell-click",
|
|
42
42
|
onRowClick: "row-click",
|
|
43
43
|
onCellActivate: "cell-activate",
|
|
@@ -81,24 +81,24 @@ var W = {
|
|
|
81
81
|
onPrintComplete: "print-complete",
|
|
82
82
|
onTbwScroll: "tbw-scroll",
|
|
83
83
|
onRender: "render"
|
|
84
|
-
},
|
|
84
|
+
}, U = C(null), W = ({ icons: e, children: t }) => /* @__PURE__ */ P(U.Provider, {
|
|
85
85
|
value: e,
|
|
86
86
|
children: t
|
|
87
87
|
});
|
|
88
|
-
function
|
|
89
|
-
return E(
|
|
88
|
+
function G() {
|
|
89
|
+
return E(U);
|
|
90
90
|
}
|
|
91
|
-
var
|
|
91
|
+
var ie = U, K = C(null), q = ({ defaults: e, children: t }) => /* @__PURE__ */ P(K.Provider, {
|
|
92
92
|
value: e,
|
|
93
93
|
children: t
|
|
94
94
|
});
|
|
95
|
-
function
|
|
96
|
-
return E(
|
|
95
|
+
function J() {
|
|
96
|
+
return E(K);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return E(
|
|
98
|
+
function Y(e) {
|
|
99
|
+
return E(K)?.[e];
|
|
100
100
|
}
|
|
101
|
-
var
|
|
101
|
+
var ae = K, X = class extends S {
|
|
102
102
|
state = { failed: !1 };
|
|
103
103
|
static getDerivedStateFromError() {
|
|
104
104
|
return { failed: !0 };
|
|
@@ -109,10 +109,10 @@ var re = J, ie = class extends S {
|
|
|
109
109
|
render() {
|
|
110
110
|
return this.state.failed ? null : this.props.children;
|
|
111
111
|
}
|
|
112
|
-
},
|
|
113
|
-
let n =
|
|
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
114
|
i.current || (i.current = !0, queueMicrotask(() => {
|
|
115
|
-
i.current = !1, !c.current && (
|
|
115
|
+
i.current = !1, !c.current && (I(r), u());
|
|
116
116
|
}));
|
|
117
117
|
}, u = () => {
|
|
118
118
|
a.current ||= requestAnimationFrame(() => {
|
|
@@ -121,7 +121,7 @@ var re = J, ie = class extends S {
|
|
|
121
121
|
}, d = (e, t) => {
|
|
122
122
|
console.error(`[grid-react] Portal "${e}" crashed; dropping.`, t), n.current.delete(e), u();
|
|
123
123
|
};
|
|
124
|
-
|
|
124
|
+
te(t, () => ({
|
|
125
125
|
renderPortal(e, t, r) {
|
|
126
126
|
c.current || (n.current.set(e, {
|
|
127
127
|
container: t,
|
|
@@ -133,7 +133,7 @@ var re = J, ie = class extends S {
|
|
|
133
133
|
n.current.delete(e);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
n.current.delete(e) && (o.current > 0 ? s.current = !0 : t ?
|
|
136
|
+
n.current.delete(e) && (o.current > 0 ? s.current = !0 : t ? I(r) : l());
|
|
137
137
|
},
|
|
138
138
|
beginBatch() {
|
|
139
139
|
o.current++;
|
|
@@ -148,7 +148,7 @@ var re = J, ie = class extends S {
|
|
|
148
148
|
}
|
|
149
149
|
n.current.size > 0 && (n.current.clear(), a.current &&= (cancelAnimationFrame(a.current), 0), l());
|
|
150
150
|
}
|
|
151
|
-
}), []),
|
|
151
|
+
}), []), ne(() => {
|
|
152
152
|
c.current = !1;
|
|
153
153
|
let e = n.current;
|
|
154
154
|
return () => {
|
|
@@ -161,7 +161,7 @@ var re = J, ie = class extends S {
|
|
|
161
161
|
(p ??= []).push(e);
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
164
|
-
f.push(
|
|
164
|
+
f.push(F(/* @__PURE__ */ P(X, {
|
|
165
165
|
portalKey: e,
|
|
166
166
|
onError: d,
|
|
167
167
|
children: r
|
|
@@ -173,34 +173,52 @@ var re = J, ie = class extends S {
|
|
|
173
173
|
for (let t of e) n.current.delete(t);
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
})
|
|
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;
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region libs/grid-react/src/lib/use-sync-plugins.ts
|
|
195
|
+
var Z = {
|
|
178
196
|
undoRedo: ["editing"],
|
|
179
197
|
clipboard: ["selection"]
|
|
180
198
|
};
|
|
181
|
-
function
|
|
199
|
+
function ce(e) {
|
|
182
200
|
let t = new Set(e);
|
|
183
201
|
for (let n of e) {
|
|
184
|
-
let e =
|
|
202
|
+
let e = Z[n];
|
|
185
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.`);
|
|
186
204
|
}
|
|
187
205
|
}
|
|
188
|
-
function
|
|
206
|
+
function le(e) {
|
|
189
207
|
let t = [];
|
|
190
208
|
for (let [n, r] of Object.entries(e)) r === void 0 || r === !1 || t.push(n);
|
|
191
|
-
return
|
|
209
|
+
return ce(t), L(e);
|
|
192
210
|
}
|
|
193
211
|
//#endregion
|
|
194
212
|
//#region libs/grid-react/src/lib/data-grid.tsx
|
|
195
|
-
var
|
|
213
|
+
var ue = !1, Q = null;
|
|
196
214
|
function $() {
|
|
197
|
-
return
|
|
215
|
+
return ue ||= (Q = new c(), b.registerAdapter(Q), !0), Q;
|
|
198
216
|
}
|
|
199
217
|
$();
|
|
200
|
-
var
|
|
201
|
-
function
|
|
202
|
-
let t =
|
|
203
|
-
return t === void 0 && (t = ++
|
|
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;
|
|
204
222
|
}
|
|
205
223
|
a("GridDetailPanel", (e) => {
|
|
206
224
|
let t = e.props;
|
|
@@ -209,42 +227,42 @@ a("GridDetailPanel", (e) => {
|
|
|
209
227
|
animation: t.animation ?? "slide"
|
|
210
228
|
} };
|
|
211
229
|
}), a("GridResponsiveCard", () => ({ responsive: !0 }));
|
|
212
|
-
var
|
|
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 =
|
|
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(() => {
|
|
214
232
|
let e = {}, t = T;
|
|
215
233
|
for (let n of l()) {
|
|
216
234
|
let r = t[n];
|
|
217
235
|
r !== void 0 && (e[n] = r);
|
|
218
236
|
}
|
|
219
237
|
return e;
|
|
220
|
-
}, [
|
|
238
|
+
}, [k(() => l().map((e) => {
|
|
221
239
|
let t = T[e];
|
|
222
240
|
if (t === void 0) return "";
|
|
223
241
|
let n;
|
|
224
242
|
try {
|
|
225
243
|
n = JSON.stringify(t) ?? "undefined";
|
|
226
244
|
} catch {
|
|
227
|
-
n = typeof t == "object" && t ? `ref#${
|
|
245
|
+
n = typeof t == "object" && t ? `ref#${pe(t)}` : `prim:${String(t)}`;
|
|
228
246
|
}
|
|
229
247
|
return `${e}:${n}`;
|
|
230
|
-
}).filter(Boolean).join("|"), [T])]),
|
|
248
|
+
}).filter(Boolean).join("|"), [T])]), U = k(() => n(S), [S]), W = k(() => {
|
|
231
249
|
let e = i?.features, t = {};
|
|
232
|
-
for (let [n, r] of Object.entries(
|
|
250
|
+
for (let [n, r] of Object.entries(U)) e && n in e && e[n] !== void 0 && e[n] !== !1 || (t[n] = r);
|
|
233
251
|
return {
|
|
234
252
|
...t,
|
|
235
|
-
...
|
|
253
|
+
...V
|
|
236
254
|
};
|
|
237
255
|
}, [
|
|
238
|
-
|
|
239
|
-
|
|
256
|
+
V,
|
|
257
|
+
U,
|
|
240
258
|
i
|
|
241
|
-
]), G =
|
|
259
|
+
]), G = k(() => C ? [] : le(W), [W, C]), K = k(() => {
|
|
242
260
|
if (C) {
|
|
243
261
|
let e = new Set(C.map((e) => e.name)), t = G.filter((t) => !e.has(t.name));
|
|
244
262
|
return [...C, ...t];
|
|
245
263
|
}
|
|
246
264
|
return G;
|
|
247
|
-
}, [C, G]), q =
|
|
265
|
+
}, [C, G]), q = k(() => a && B(z(a), o), [a, o]), J = k(() => {
|
|
248
266
|
let e = g(i), t = {};
|
|
249
267
|
if (u !== void 0 && (t.sortable = u), d !== void 0 && (t.filterable = d), p !== void 0 && (t.selectable = p), R) {
|
|
250
268
|
let n = e?.icons || i?.icons || {};
|
|
@@ -277,9 +295,22 @@ var pe = w(function(e, t) {
|
|
|
277
295
|
R
|
|
278
296
|
]);
|
|
279
297
|
D(() => {
|
|
298
|
+
I.current = J?.getRowId;
|
|
299
|
+
}, [J]), D(() => {
|
|
280
300
|
$().setTypeDefaults(L);
|
|
281
301
|
}, [L]), D(() => {
|
|
282
|
-
|
|
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;
|
|
283
314
|
}, [r]), D(() => {
|
|
284
315
|
O.current && J && (O.current.gridConfig = J);
|
|
285
316
|
}, [J]), D(() => {
|
|
@@ -304,9 +335,9 @@ var pe = w(function(e, t) {
|
|
|
304
335
|
if (!O.current || !v) return;
|
|
305
336
|
let e = O.current, t = "react-custom-styles", n = !0;
|
|
306
337
|
return e.ready?.().then(() => {
|
|
307
|
-
n && v && (e.registerStyles?.(t, v),
|
|
338
|
+
n && v && (e.registerStyles?.(t, v), A.current = t);
|
|
308
339
|
}), () => {
|
|
309
|
-
n = !1,
|
|
340
|
+
n = !1, A.current &&= (e.unregisterStyles?.(A.current), null);
|
|
310
341
|
};
|
|
311
342
|
}, [v]), D(() => {
|
|
312
343
|
let e = O.current;
|
|
@@ -316,19 +347,19 @@ var pe = w(function(e, t) {
|
|
|
316
347
|
t.forEach((e) => e());
|
|
317
348
|
};
|
|
318
349
|
}, [w]);
|
|
319
|
-
let Y =
|
|
320
|
-
for (let e of Object.keys(
|
|
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];
|
|
321
352
|
D(() => {
|
|
322
353
|
let e = O.current;
|
|
323
354
|
if (!e) return;
|
|
324
355
|
let t = [];
|
|
325
|
-
for (let [n, r] of Object.entries(
|
|
356
|
+
for (let [n, r] of Object.entries(H)) Y.includes(n) && t.push(e.on(r, (e, t) => {
|
|
326
357
|
X.current[n]?.(e, t);
|
|
327
358
|
}));
|
|
328
359
|
return () => {
|
|
329
360
|
t.forEach((e) => e());
|
|
330
361
|
};
|
|
331
|
-
}, [Y]),
|
|
362
|
+
}, [Y]), te(t, () => ({
|
|
332
363
|
get element() {
|
|
333
364
|
return O.current;
|
|
334
365
|
},
|
|
@@ -366,42 +397,42 @@ var pe = w(function(e, t) {
|
|
|
366
397
|
O.current?.clearAllLoading?.();
|
|
367
398
|
}
|
|
368
399
|
}), []);
|
|
369
|
-
let Z =
|
|
370
|
-
return
|
|
400
|
+
let Z = j(null);
|
|
401
|
+
return ne(() => {
|
|
371
402
|
let e = O.current;
|
|
372
403
|
return e && Z.current && f(e, Z.current), () => {
|
|
373
404
|
e && f(e, null);
|
|
374
405
|
};
|
|
375
|
-
}, []), /* @__PURE__ */
|
|
406
|
+
}, []), /* @__PURE__ */ re(N, { children: [/* @__PURE__ */ P(oe, { ref: Z }), ee(b.activeTag, {
|
|
376
407
|
ref: (e) => {
|
|
377
|
-
if (O.current = e, e && !
|
|
378
|
-
|
|
408
|
+
if (O.current = e, e && !M.current) {
|
|
409
|
+
M.current = !0;
|
|
379
410
|
let t = e;
|
|
380
411
|
J && (t.gridConfig = J), r && (t.rows = r), q && (t.columns = q);
|
|
381
412
|
}
|
|
382
413
|
},
|
|
383
414
|
class: y,
|
|
384
415
|
style: x
|
|
385
|
-
}, /* @__PURE__ */
|
|
416
|
+
}, /* @__PURE__ */ P(_.Provider, {
|
|
386
417
|
value: O,
|
|
387
418
|
children: S
|
|
388
419
|
}))] });
|
|
389
420
|
});
|
|
390
421
|
//#endregion
|
|
391
422
|
//#region libs/grid-react/src/lib/grid-column.tsx
|
|
392
|
-
function
|
|
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 =
|
|
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) => {
|
|
394
425
|
y.current = e, e && (m && o(e, m), h && i(e, h));
|
|
395
426
|
}, [m, h]), x = typeof l == "number" ? `${l}px` : l, S = {
|
|
396
427
|
field: t,
|
|
397
428
|
ref: b
|
|
398
429
|
};
|
|
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__ */
|
|
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 });
|
|
400
431
|
}
|
|
401
432
|
//#endregion
|
|
402
433
|
//#region libs/grid-react/src/lib/grid-header-content.tsx
|
|
403
|
-
function
|
|
404
|
-
let r = O(), i = e ?? `tbw-header-content-${r}`, a = E(_), [o, s] =
|
|
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);
|
|
405
436
|
return D(() => {
|
|
406
437
|
let e = a?.current;
|
|
407
438
|
if (!e) return;
|
|
@@ -438,13 +469,13 @@ function he({ id: e, order: t = 100, children: n }) {
|
|
|
438
469
|
}
|
|
439
470
|
//#endregion
|
|
440
471
|
//#region libs/grid-react/src/lib/grid-tool-button.tsx
|
|
441
|
-
function
|
|
442
|
-
return /* @__PURE__ */
|
|
472
|
+
function _e({ children: e }) {
|
|
473
|
+
return /* @__PURE__ */ P("tbw-grid-tool-buttons", { children: e });
|
|
443
474
|
}
|
|
444
475
|
//#endregion
|
|
445
476
|
//#region libs/grid-react/src/lib/grid-toolbar-content.tsx
|
|
446
|
-
function
|
|
447
|
-
let r = O(), i = e ?? `tbw-toolbar-content-${r}`, a = E(_), [o, s] =
|
|
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);
|
|
448
479
|
return D(() => {
|
|
449
480
|
let e = a?.current;
|
|
450
481
|
if (!e) return;
|
|
@@ -481,38 +512,38 @@ function _e({ id: e, order: t = 100, children: n }) {
|
|
|
481
512
|
}
|
|
482
513
|
//#endregion
|
|
483
514
|
//#region libs/grid-react/src/lib/grid-type.tsx
|
|
484
|
-
function
|
|
515
|
+
function ye(e) {
|
|
485
516
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
486
517
|
}
|
|
487
|
-
function
|
|
488
|
-
let { name: n, params: r, children: i, editor: a } = t, o =
|
|
518
|
+
function be(t) {
|
|
519
|
+
let { name: n, params: r, children: i, editor: a } = t, o = j(null), c = {
|
|
489
520
|
name: n,
|
|
490
521
|
ref: T((t) => {
|
|
491
522
|
o.current = t, t && (i && e(t, i), a && s(t, a));
|
|
492
523
|
}, [i, a])
|
|
493
524
|
};
|
|
494
|
-
if (r) for (let [e, t] of Object.entries(r)) c[`data-${
|
|
495
|
-
return /* @__PURE__ */
|
|
525
|
+
if (r) for (let [e, t] of Object.entries(r)) c[`data-${ye(e)}`] = String(t);
|
|
526
|
+
return /* @__PURE__ */ re("tbw-grid-type", {
|
|
496
527
|
...c,
|
|
497
|
-
children: [i ? /* @__PURE__ */
|
|
528
|
+
children: [i ? /* @__PURE__ */ P("tbw-grid-column-view", {}) : null, a ? /* @__PURE__ */ P("tbw-grid-column-editor", {}) : null]
|
|
498
529
|
});
|
|
499
530
|
}
|
|
500
531
|
//#endregion
|
|
501
532
|
//#region libs/grid-react/src/lib/grid-provider.tsx
|
|
502
|
-
var
|
|
533
|
+
var xe = ({ icons: e, defaults: t, children: n }) => {
|
|
503
534
|
let r = n;
|
|
504
|
-
return t && (r = /* @__PURE__ */
|
|
535
|
+
return t && (r = /* @__PURE__ */ P(q, {
|
|
505
536
|
defaults: t,
|
|
506
537
|
children: r
|
|
507
|
-
})), e && (r = /* @__PURE__ */
|
|
538
|
+
})), e && (r = /* @__PURE__ */ P(W, {
|
|
508
539
|
icons: e,
|
|
509
540
|
children: r
|
|
510
|
-
})), /* @__PURE__ */
|
|
541
|
+
})), /* @__PURE__ */ P(N, { children: r });
|
|
511
542
|
};
|
|
512
543
|
//#endregion
|
|
513
544
|
//#region libs/grid-react/src/lib/use-grid.ts
|
|
514
|
-
function
|
|
515
|
-
let t =
|
|
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]);
|
|
516
547
|
D(() => {
|
|
517
548
|
let n = !0;
|
|
518
549
|
return (async () => {
|
|
@@ -592,7 +623,7 @@ function xe(e) {
|
|
|
592
623
|
}
|
|
593
624
|
//#endregion
|
|
594
625
|
//#region libs/grid-react/src/lib/use-grid-overlay.ts
|
|
595
|
-
function
|
|
626
|
+
function Ce(e, t = {}) {
|
|
596
627
|
let { open: n = !0, gridElement: r } = t, i = E(_);
|
|
597
628
|
D(() => {
|
|
598
629
|
if (!n) return;
|
|
@@ -610,4 +641,4 @@ function Se(e, t = {}) {
|
|
|
610
641
|
]);
|
|
611
642
|
}
|
|
612
643
|
//#endregion
|
|
613
|
-
export {
|
|
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 };
|
package/lib/data-grid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/data-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,aAAa,CAAC;AAErB,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,iBAAiB,CAAC;AAO1E,OAAO,EAAqB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"data-grid.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/data-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;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AAK,IAAI,CAAC;IACzE,yCAAyC;IACzC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,0CAA0C;IAC1C,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACzD,uDAAuD;IACvD,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,eAAO,MAAM,QAAQ,EAmhBf,CAAC,IAAI,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;CAAE,KAAK,KAAK,CAAC,YAAY,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RowUpdate {
|
|
2
|
+
id: string;
|
|
3
|
+
changes: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Computes the minimal set of row updates needed when only values have changed
|
|
7
|
+
* (same row count, same row IDs in the same order).
|
|
8
|
+
*
|
|
9
|
+
* Returns an array of updates (possibly empty) when the diff is value-only, or
|
|
10
|
+
* `null` when a structural change is detected (different count, different IDs
|
|
11
|
+
* in sequence, or initial load from an empty snapshot).
|
|
12
|
+
*
|
|
13
|
+
* Used by the DataGrid component to decide whether to call `grid.updateRows()`
|
|
14
|
+
* (value-only, fast path) or `grid.rows =` (full replace). Kept as a pure
|
|
15
|
+
* helper so it can be unit-tested without React.
|
|
16
|
+
*
|
|
17
|
+
* @since 3.5.0
|
|
18
|
+
*/
|
|
19
|
+
export declare function computeRowDiff<T>(next: T[], prev: T[], getId: (row: T) => string): RowUpdate[] | null;
|
|
20
|
+
//# sourceMappingURL=row-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-diff.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/row-diff.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,EAAE,GAAG,IAAI,CAerG"}
|