@toolbox-web/grid-react 1.5.2 → 1.6.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/react-column-config-B8Isgp88.js +125 -0
- package/chunks/{react-grid-adapter-BHfDzPhV.js → react-grid-adapter-DeV_qtlr.js} +1 -1
- package/features/editing.js +1 -1
- package/features/filtering.js +1 -1
- package/features/master-detail.js +1 -1
- package/features/responsive.js +1 -1
- package/index.js +3 -3
- package/lib/react-column-config.d.ts +16 -2
- package/lib/react-column-config.d.ts.map +1 -1
- package/package.json +1 -1
- package/chunks/react-column-config-Mex8do48.js +0 -109
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { a as u, r as f } from "./portal-bridge-CH_xMkYc.js";
|
|
2
|
+
const y = [];
|
|
3
|
+
function H(e) {
|
|
4
|
+
y.push(e);
|
|
5
|
+
}
|
|
6
|
+
function R(e, n) {
|
|
7
|
+
const r = [];
|
|
8
|
+
for (const t of y) {
|
|
9
|
+
const o = t({ container: e, gridEl: n });
|
|
10
|
+
o && r.push(o);
|
|
11
|
+
}
|
|
12
|
+
return () => {
|
|
13
|
+
for (const t of r) t();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const l = /* @__PURE__ */ Symbol("reactProcessed"), a = /* @__PURE__ */ new Map();
|
|
17
|
+
function K(e) {
|
|
18
|
+
const n = e.querySelectorAll(".react-cell-editor, .react-cell-renderer");
|
|
19
|
+
for (const r of n) {
|
|
20
|
+
const t = a.get(r);
|
|
21
|
+
t && (t.unsub?.(), f(t.key, { sync: !0 }), a.delete(r));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function i(e) {
|
|
25
|
+
const n = document.createElement("div");
|
|
26
|
+
return n.className = e, n.style.display = "contents", n;
|
|
27
|
+
}
|
|
28
|
+
function L(e) {
|
|
29
|
+
return () => {
|
|
30
|
+
const n = e.ownerDocument.activeElement;
|
|
31
|
+
n && e.contains(n) && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) && n.blur();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function E(e) {
|
|
35
|
+
const n = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
return (r) => {
|
|
37
|
+
const t = r.cellEl;
|
|
38
|
+
if (t) {
|
|
39
|
+
const c = n.get(t);
|
|
40
|
+
if (c) {
|
|
41
|
+
if (t.contains(c.container))
|
|
42
|
+
return u(c.container, e(r), c.portalKey), c.container;
|
|
43
|
+
f(c.portalKey, { sync: !0 }), n.delete(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const o = i("react-cell-renderer"), s = u(o, e(r));
|
|
47
|
+
return t && n.set(t, { portalKey: s, container: o }), a.set(o, { key: s }), o;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function k(e) {
|
|
51
|
+
return (n) => {
|
|
52
|
+
const r = i("react-cell-editor"), o = { key: u(r, e(n)) };
|
|
53
|
+
return a.set(r, o), queueMicrotask(() => {
|
|
54
|
+
const s = r.closest("tbw-grid");
|
|
55
|
+
s && (o.unsub = R(r, s));
|
|
56
|
+
}), r;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function w(e) {
|
|
60
|
+
return (n) => {
|
|
61
|
+
const r = i("react-header-renderer"), t = u(r, e(n));
|
|
62
|
+
return a.set(r, { key: t }), r;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function h(e) {
|
|
66
|
+
return (n) => {
|
|
67
|
+
const r = i("react-header-label-renderer"), t = u(r, e(n));
|
|
68
|
+
return a.set(r, { key: t }), r;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function M(e) {
|
|
72
|
+
return (n) => {
|
|
73
|
+
const r = e(n);
|
|
74
|
+
if (r instanceof HTMLElement || typeof r == "string")
|
|
75
|
+
return r;
|
|
76
|
+
const t = i("react-loading-renderer"), o = u(t, r);
|
|
77
|
+
return a.set(t, { key: o }), t;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function b(e) {
|
|
81
|
+
return (n) => {
|
|
82
|
+
const r = e(n);
|
|
83
|
+
if (r instanceof HTMLElement || typeof r == "string")
|
|
84
|
+
return r;
|
|
85
|
+
const t = i("react-empty-renderer"), o = u(t, r);
|
|
86
|
+
return a.set(t, { key: o }), t;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function T(e) {
|
|
90
|
+
if (!e) return;
|
|
91
|
+
if (e[l]) return e;
|
|
92
|
+
if (e.loadingRenderer && typeof e.loadingRenderer == "function") {
|
|
93
|
+
const t = e.loadingRenderer;
|
|
94
|
+
e = {
|
|
95
|
+
...e,
|
|
96
|
+
loadingRenderer: M(t)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (e.emptyRenderer && typeof e.emptyRenderer == "function") {
|
|
100
|
+
const t = e.emptyRenderer;
|
|
101
|
+
e = {
|
|
102
|
+
...e,
|
|
103
|
+
emptyRenderer: b(t)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (!e.columns) {
|
|
107
|
+
const t = e;
|
|
108
|
+
return t[l] = !0, t;
|
|
109
|
+
}
|
|
110
|
+
const n = e.columns.map((t) => {
|
|
111
|
+
const { renderer: o, editor: s, headerRenderer: c, headerLabelRenderer: p, ...m } = t, d = { ...m };
|
|
112
|
+
return o && (d.renderer = E(o)), s && (d.editor = k(s)), c && (d.headerRenderer = w(c)), p && (d.headerLabelRenderer = h(p)), d;
|
|
113
|
+
}), r = {
|
|
114
|
+
...e,
|
|
115
|
+
columns: n
|
|
116
|
+
};
|
|
117
|
+
return r[l] = !0, r;
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
K as c,
|
|
121
|
+
L as m,
|
|
122
|
+
R as n,
|
|
123
|
+
T as p,
|
|
124
|
+
H as r
|
|
125
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as b, n as m, c as K } from "./react-column-config-
|
|
1
|
+
import { p as b, n as m, c as K } from "./react-column-config-B8Isgp88.js";
|
|
2
2
|
import { jsx as T } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as k, useCallback as E, useEffect as w } from "react";
|
|
4
4
|
import { a as u, r as g } from "./portal-bridge-CH_xMkYc.js";
|
package/features/editing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@toolbox-web/grid/features/editing";
|
|
2
|
-
import { r, m as s } from "../chunks/react-column-config-
|
|
2
|
+
import { r, m as s } from "../chunks/react-column-config-B8Isgp88.js";
|
|
3
3
|
r(({ container: t, gridEl: e }) => {
|
|
4
4
|
const o = s(t);
|
|
5
5
|
return e.addEventListener("before-edit-close", o), () => e.removeEventListener("before-edit-close", o);
|
package/features/filtering.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useContext as h, useCallback as n } from "react";
|
|
|
3
3
|
import { registerFeature as E } from "@toolbox-web/grid/features/registry";
|
|
4
4
|
import { G as k } from "../chunks/grid-element-context-BU3WvNtM.js";
|
|
5
5
|
import { r as v, a as m } from "../chunks/portal-bridge-CH_xMkYc.js";
|
|
6
|
-
import { r as C } from "../chunks/react-grid-adapter-
|
|
6
|
+
import { r as C } from "../chunks/react-grid-adapter-DeV_qtlr.js";
|
|
7
7
|
E(
|
|
8
8
|
"filtering",
|
|
9
9
|
(l) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@toolbox-web/grid/features/master-detail";
|
|
2
2
|
import { g as c } from "../chunks/grid-detail-panel-CR7YUhdN.js";
|
|
3
3
|
import { a as s } from "../chunks/portal-bridge-CH_xMkYc.js";
|
|
4
|
-
import { a as d } from "../chunks/react-grid-adapter-
|
|
4
|
+
import { a as d } from "../chunks/react-grid-adapter-DeV_qtlr.js";
|
|
5
5
|
d((r, { trackPortal: n }) => {
|
|
6
6
|
const t = c(r);
|
|
7
7
|
if (t)
|
package/features/responsive.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@toolbox-web/grid/features/responsive";
|
|
2
2
|
import { g as i } from "../chunks/grid-responsive-card-BB28Zl2O.js";
|
|
3
3
|
import { a as c } from "../chunks/portal-bridge-CH_xMkYc.js";
|
|
4
|
-
import { b as d } from "../chunks/react-grid-adapter-
|
|
4
|
+
import { b as d } from "../chunks/react-grid-adapter-DeV_qtlr.js";
|
|
5
5
|
d((r, { trackPortal: o }) => {
|
|
6
6
|
const n = i(r);
|
|
7
7
|
if (n)
|
package/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import { g as ye } from "./chunks/grid-responsive-card-BB28Zl2O.js";
|
|
|
5
5
|
import { G as ur } from "./chunks/grid-responsive-card-BB28Zl2O.js";
|
|
6
6
|
import { s as ee } from "./chunks/portal-bridge-CH_xMkYc.js";
|
|
7
7
|
import { flushSync as re, createPortal as he } from "react-dom";
|
|
8
|
-
import { p as ve } from "./chunks/react-column-config-
|
|
9
|
-
import { G as we, c as Re, d as Pe } from "./chunks/react-grid-adapter-
|
|
10
|
-
import { e as fr } from "./chunks/react-grid-adapter-
|
|
8
|
+
import { p as ve } from "./chunks/react-column-config-B8Isgp88.js";
|
|
9
|
+
import { G as we, c as Re, d as Pe } from "./chunks/react-grid-adapter-DeV_qtlr.js";
|
|
10
|
+
import { e as fr } from "./chunks/react-grid-adapter-DeV_qtlr.js";
|
|
11
11
|
import { createPluginsFromFeatures as be } from "@toolbox-web/grid/features/registry";
|
|
12
12
|
import { G as ae } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
13
13
|
import { G as gr } from "./chunks/grid-detail-panel-CR7YUhdN.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnConfig as BaseColumnConfig, GridConfig as BaseGridConfig, CellRenderContext, ColumnEditorContext, HeaderCellContext, HeaderLabelContext, LoadingContext } from '@toolbox-web/grid';
|
|
1
|
+
import { ColumnConfig as BaseColumnConfig, GridConfig as BaseGridConfig, CellRenderContext, ColumnEditorContext, EmptyContext, HeaderCellContext, HeaderLabelContext, LoadingContext } from '@toolbox-web/grid';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Column configuration for React applications.
|
|
@@ -75,12 +75,19 @@ export interface ColumnConfig<TRow = unknown> extends Omit<BaseColumnConfig<TRow
|
|
|
75
75
|
* ```
|
|
76
76
|
* @since 0.0.1
|
|
77
77
|
*/
|
|
78
|
-
export type GridConfig<TRow = unknown> = Omit<BaseGridConfig<TRow>, 'columns' | 'loadingRenderer'> & {
|
|
78
|
+
export type GridConfig<TRow = unknown> = Omit<BaseGridConfig<TRow>, 'columns' | 'loadingRenderer' | 'emptyRenderer'> & {
|
|
79
79
|
columns?: ColumnConfig<TRow>[];
|
|
80
80
|
/**
|
|
81
81
|
* Custom loading renderer - can be a vanilla DOM function or a React render function returning JSX.
|
|
82
82
|
*/
|
|
83
83
|
loadingRenderer?: BaseGridConfig<TRow>['loadingRenderer'] | ((ctx: LoadingContext) => ReactNode);
|
|
84
|
+
/**
|
|
85
|
+
* Custom empty-state renderer shown when the grid has no rows and is not
|
|
86
|
+
* loading. Can be a vanilla DOM function (returning `HTMLElement | string`)
|
|
87
|
+
* or a React render function returning JSX. Set explicitly to `null` to
|
|
88
|
+
* suppress the built-in default message.
|
|
89
|
+
*/
|
|
90
|
+
emptyRenderer?: BaseGridConfig<TRow>['emptyRenderer'] | ((ctx: EmptyContext) => ReactNode);
|
|
84
91
|
};
|
|
85
92
|
/**
|
|
86
93
|
* Clean up config-based editor and renderer portals whose containers are
|
|
@@ -150,6 +157,13 @@ export declare function wrapReactHeaderLabelRenderer<TRow>(renderFn: (ctx: Heade
|
|
|
150
157
|
* Skips wrapping if the function already returns an HTMLElement or string (vanilla DOM renderer).
|
|
151
158
|
*/
|
|
152
159
|
export declare function wrapReactLoadingRenderer(renderFn: (ctx: LoadingContext) => ReactNode): (ctx: LoadingContext) => HTMLElement | string;
|
|
160
|
+
/**
|
|
161
|
+
* Wraps a React empty-state renderer into a DOM-returning function.
|
|
162
|
+
* Mirrors `wrapReactLoadingRenderer`: vanilla `HTMLElement | string` returns
|
|
163
|
+
* are passed through unchanged so consumers can mix DOM-only and React
|
|
164
|
+
* renderers freely.
|
|
165
|
+
*/
|
|
166
|
+
export declare function wrapReactEmptyRenderer(renderFn: (ctx: EmptyContext) => ReactNode): (ctx: EmptyContext) => HTMLElement | string;
|
|
153
167
|
/**
|
|
154
168
|
* Processes a GridConfig, converting React renderer/editor functions
|
|
155
169
|
* to DOM-returning functions that the grid core understands.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-column-config.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-column-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,gBAAgB,EAChC,UAAU,IAAI,cAAc,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,YAAY,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,IAAI,CACxD,gBAAgB,CAAC,IAAI,CAAC,EACtB,UAAU,GAAG,cAAc,GAAG,QAAQ,GAAG,gBAAgB,GAAG,qBAAqB,CAClF;IACC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;IAEvD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;IAEvD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;IAE7D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;CACpE;AAKD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,UAAU,CAAC,IAAI,GAAG,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"react-column-config.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-column-config.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { a as i, r as p } from "./portal-bridge-CH_xMkYc.js";
|
|
2
|
-
const y = [];
|
|
3
|
-
function C(e) {
|
|
4
|
-
y.push(e);
|
|
5
|
-
}
|
|
6
|
-
function R(e, t) {
|
|
7
|
-
const r = [];
|
|
8
|
-
for (const n of y) {
|
|
9
|
-
const o = n({ container: e, gridEl: t });
|
|
10
|
-
o && r.push(o);
|
|
11
|
-
}
|
|
12
|
-
return () => {
|
|
13
|
-
for (const n of r) n();
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const d = /* @__PURE__ */ Symbol("reactProcessed"), s = /* @__PURE__ */ new Map();
|
|
17
|
-
function H(e) {
|
|
18
|
-
const t = e.querySelectorAll(".react-cell-editor, .react-cell-renderer");
|
|
19
|
-
for (const r of t) {
|
|
20
|
-
const n = s.get(r);
|
|
21
|
-
n && (n.unsub?.(), p(n.key, { sync: !0 }), s.delete(r));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function l(e) {
|
|
25
|
-
const t = document.createElement("div");
|
|
26
|
-
return t.className = e, t.style.display = "contents", t;
|
|
27
|
-
}
|
|
28
|
-
function K(e) {
|
|
29
|
-
return () => {
|
|
30
|
-
const t = e.ownerDocument.activeElement;
|
|
31
|
-
t && e.contains(t) && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && t.blur();
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function E(e) {
|
|
35
|
-
const t = /* @__PURE__ */ new WeakMap();
|
|
36
|
-
return (r) => {
|
|
37
|
-
const n = r.cellEl;
|
|
38
|
-
if (n) {
|
|
39
|
-
const c = t.get(n);
|
|
40
|
-
if (c) {
|
|
41
|
-
if (n.contains(c.container))
|
|
42
|
-
return i(c.container, e(r), c.portalKey), c.container;
|
|
43
|
-
p(c.portalKey, { sync: !0 }), t.delete(n);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const o = l("react-cell-renderer"), a = i(o, e(r));
|
|
47
|
-
return n && t.set(n, { portalKey: a, container: o }), s.set(o, { key: a }), o;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function h(e) {
|
|
51
|
-
return (t) => {
|
|
52
|
-
const r = l("react-cell-editor"), o = { key: i(r, e(t)) };
|
|
53
|
-
return s.set(r, o), queueMicrotask(() => {
|
|
54
|
-
const a = r.closest("tbw-grid");
|
|
55
|
-
a && (o.unsub = R(r, a));
|
|
56
|
-
}), r;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function k(e) {
|
|
60
|
-
return (t) => {
|
|
61
|
-
const r = l("react-header-renderer"), n = i(r, e(t));
|
|
62
|
-
return s.set(r, { key: n }), r;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function w(e) {
|
|
66
|
-
return (t) => {
|
|
67
|
-
const r = l("react-header-label-renderer"), n = i(r, e(t));
|
|
68
|
-
return s.set(r, { key: n }), r;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function M(e) {
|
|
72
|
-
return (t) => {
|
|
73
|
-
const r = e(t);
|
|
74
|
-
if (r instanceof HTMLElement || typeof r == "string")
|
|
75
|
-
return r;
|
|
76
|
-
const n = l("react-loading-renderer"), o = i(n, r);
|
|
77
|
-
return s.set(n, { key: o }), n;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function L(e) {
|
|
81
|
-
if (!e) return;
|
|
82
|
-
if (e[d]) return e;
|
|
83
|
-
if (e.loadingRenderer && typeof e.loadingRenderer == "function") {
|
|
84
|
-
const n = e.loadingRenderer;
|
|
85
|
-
e = {
|
|
86
|
-
...e,
|
|
87
|
-
loadingRenderer: M(n)
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
if (!e.columns) {
|
|
91
|
-
const n = e;
|
|
92
|
-
return n[d] = !0, n;
|
|
93
|
-
}
|
|
94
|
-
const t = e.columns.map((n) => {
|
|
95
|
-
const { renderer: o, editor: a, headerRenderer: c, headerLabelRenderer: f, ...m } = n, u = { ...m };
|
|
96
|
-
return o && (u.renderer = E(o)), a && (u.editor = h(a)), c && (u.headerRenderer = k(c)), f && (u.headerLabelRenderer = w(f)), u;
|
|
97
|
-
}), r = {
|
|
98
|
-
...e,
|
|
99
|
-
columns: t
|
|
100
|
-
};
|
|
101
|
-
return r[d] = !0, r;
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
H as c,
|
|
105
|
-
K as m,
|
|
106
|
-
R as n,
|
|
107
|
-
L as p,
|
|
108
|
-
C as r
|
|
109
|
-
};
|