@toolbox-web/grid-react 0.18.4 → 0.18.5
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/portal-bridge-B0mjqzak.js +42 -0
- package/features/filtering.d.ts.map +1 -1
- package/features/filtering.js +32 -33
- package/features/grouping-columns.js +19 -21
- package/features/grouping-rows.js +15 -18
- package/features/pinned-rows.js +14 -17
- package/index.js +646 -624
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/portal-bridge.d.ts +56 -0
- package/lib/portal-bridge.d.ts.map +1 -0
- package/lib/portal-manager.d.ts +26 -0
- package/lib/portal-manager.d.ts.map +1 -0
- package/lib/react-column-config.d.ts +2 -2
- package/lib/react-column-config.d.ts.map +1 -1
- package/lib/react-grid-adapter.d.ts +17 -10
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { flushSync as d } from "react-dom";
|
|
2
|
+
import { createRoot as p } from "react-dom/client";
|
|
3
|
+
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
4
|
+
let m = 0;
|
|
5
|
+
function w(t, e) {
|
|
6
|
+
e ? r.set(t, e) : r.delete(t);
|
|
7
|
+
}
|
|
8
|
+
function g(t, e) {
|
|
9
|
+
if (e) return e;
|
|
10
|
+
const n = t.closest("tbw-grid");
|
|
11
|
+
if (n) return n;
|
|
12
|
+
if (r.size === 1) return r.keys().next().value;
|
|
13
|
+
}
|
|
14
|
+
function f(t) {
|
|
15
|
+
const e = c.get(t);
|
|
16
|
+
if (e) {
|
|
17
|
+
try {
|
|
18
|
+
e.unmount();
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
c.delete(t);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function b(t, e, n, u) {
|
|
25
|
+
const o = n ?? `p-${m++}`, s = g(t, u), l = s ? r.get(s) : void 0;
|
|
26
|
+
if (l)
|
|
27
|
+
f(o), s && i.set(o, s), l.renderPortal(o, t, e);
|
|
28
|
+
else {
|
|
29
|
+
let a = c.get(o);
|
|
30
|
+
a || (a = p(t), c.set(o, a)), d(() => a.render(e));
|
|
31
|
+
}
|
|
32
|
+
return o;
|
|
33
|
+
}
|
|
34
|
+
function x(t) {
|
|
35
|
+
const e = i.get(t);
|
|
36
|
+
(e ? r.get(e) : void 0)?.removePortal(t), i.delete(t), f(t);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
b as a,
|
|
40
|
+
x as r,
|
|
41
|
+
w as s
|
|
42
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtering.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/features/filtering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,WAAW,EAEjB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"filtering.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/features/filtering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,WAAW,EAEjB,MAAM,qCAAqC,CAAC;AAmC7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAE9G;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;IAEtD;;OAEG;IACH,UAAU,EAAE,MAAM,WAAW,EAAE,CAAC;IAEhC;;;OAGG;IACH,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAEjF;;;OAGG;IACH,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAE1D;;;OAGG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAE1E;;OAEG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAE5C;;OAEG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;IAElC;;OAEG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;IAE9C;;OAEG;IACH,eAAe,EAAE,MAAM,WAAW,EAAE,CAAC;IAErC;;OAEG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IAE3C;;OAEG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CAC7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAuHpE"}
|
package/features/filtering.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { FilteringPlugin as
|
|
1
|
+
import { FilteringPlugin as F } from "@toolbox-web/grid/plugins/filtering";
|
|
2
2
|
import { useContext as G, useCallback as n } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { createRoot as y } from "react-dom/client";
|
|
3
|
+
import { r as h, a as k } from "../chunks/portal-bridge-B0mjqzak.js";
|
|
5
4
|
import { registerFeature as E } from "@toolbox-web/grid/features/registry";
|
|
6
|
-
import { G as
|
|
5
|
+
import { G as R } from "../chunks/grid-element-context-BU3WvNtM.js";
|
|
7
6
|
E("filtering", (l) => {
|
|
8
|
-
if (typeof l == "boolean") return new
|
|
9
|
-
if (!l) return new
|
|
7
|
+
if (typeof l == "boolean") return new F();
|
|
8
|
+
if (!l) return new F();
|
|
10
9
|
const o = l, e = { ...o };
|
|
11
10
|
if (typeof o.filterPanelRenderer == "function" && o.filterPanelRenderer.length <= 1) {
|
|
12
|
-
const
|
|
13
|
-
e.filterPanelRenderer = (
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const f = o.filterPanelRenderer, a = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
e.filterPanelRenderer = (g, c) => {
|
|
13
|
+
const d = a.get(g);
|
|
14
|
+
d && h(d);
|
|
15
|
+
const s = document.createElement("div");
|
|
16
|
+
s.style.display = "contents";
|
|
17
|
+
const u = k(s, f(c));
|
|
18
|
+
a.set(g, u), g.appendChild(s);
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
return new
|
|
21
|
+
return new F(e);
|
|
23
22
|
});
|
|
24
|
-
function
|
|
25
|
-
const o = G(
|
|
23
|
+
function v(l) {
|
|
24
|
+
const o = G(R), e = n(() => (l ? document.querySelector(l) : o?.current)?.getPluginByName("filtering"), [o, l]), f = n(
|
|
26
25
|
(t, i, r) => {
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
26
|
+
const p = e();
|
|
27
|
+
if (!p) {
|
|
29
28
|
console.warn(
|
|
30
29
|
`[tbw-grid:filtering] FilteringPlugin not found.
|
|
31
30
|
|
|
@@ -34,10 +33,10 @@ function x(l) {
|
|
|
34
33
|
);
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
|
-
|
|
36
|
+
p.setFilter(t, i, r);
|
|
38
37
|
},
|
|
39
38
|
[e]
|
|
40
|
-
), a = n((t) => e()?.getFilter(t), [e]),
|
|
39
|
+
), a = n((t) => e()?.getFilter(t), [e]), g = n(() => e()?.getFilters() ?? [], [e]), c = n(
|
|
41
40
|
(t, i) => {
|
|
42
41
|
const r = e();
|
|
43
42
|
if (!r) {
|
|
@@ -52,7 +51,7 @@ function x(l) {
|
|
|
52
51
|
r.setFilterModel(t, i);
|
|
53
52
|
},
|
|
54
53
|
[e]
|
|
55
|
-
),
|
|
54
|
+
), d = n(
|
|
56
55
|
(t) => {
|
|
57
56
|
const i = e();
|
|
58
57
|
if (!i) {
|
|
@@ -67,7 +66,7 @@ function x(l) {
|
|
|
67
66
|
i.clearAllFilters(t);
|
|
68
67
|
},
|
|
69
68
|
[e]
|
|
70
|
-
),
|
|
69
|
+
), s = n(
|
|
71
70
|
(t, i) => {
|
|
72
71
|
const r = e();
|
|
73
72
|
if (!r) {
|
|
@@ -82,10 +81,10 @@ function x(l) {
|
|
|
82
81
|
r.clearFieldFilter(t, i);
|
|
83
82
|
},
|
|
84
83
|
[e]
|
|
85
|
-
),
|
|
84
|
+
), u = n((t) => e()?.isFieldFiltered(t) ?? !1, [e]), m = n(() => e()?.getFilteredRowCount() ?? 0, [e]), w = n((t) => e()?.getUniqueValues(t) ?? [], [e]), b = n(() => e()?.getStaleFilters() ?? [], [e]), P = n(
|
|
86
85
|
(t) => e()?.getBlankMode(t) ?? "all",
|
|
87
86
|
[e]
|
|
88
|
-
),
|
|
87
|
+
), y = n(
|
|
89
88
|
(t, i) => {
|
|
90
89
|
const r = e();
|
|
91
90
|
if (!r) {
|
|
@@ -102,20 +101,20 @@ function x(l) {
|
|
|
102
101
|
[e]
|
|
103
102
|
);
|
|
104
103
|
return {
|
|
105
|
-
setFilter:
|
|
104
|
+
setFilter: f,
|
|
106
105
|
getFilter: a,
|
|
107
|
-
getFilters:
|
|
108
|
-
setFilterModel:
|
|
109
|
-
clearAllFilters:
|
|
110
|
-
clearFieldFilter:
|
|
111
|
-
isFieldFiltered:
|
|
106
|
+
getFilters: g,
|
|
107
|
+
setFilterModel: c,
|
|
108
|
+
clearAllFilters: d,
|
|
109
|
+
clearFieldFilter: s,
|
|
110
|
+
isFieldFiltered: u,
|
|
112
111
|
getFilteredRowCount: m,
|
|
113
112
|
getUniqueValues: w,
|
|
114
113
|
getStaleFilters: b,
|
|
115
114
|
getBlankMode: P,
|
|
116
|
-
toggleBlankFilter:
|
|
115
|
+
toggleBlankFilter: y
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
118
|
export {
|
|
120
|
-
|
|
119
|
+
v as useGridFiltering
|
|
121
120
|
};
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { GroupingColumnsPlugin as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return (
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
r.render(o(e));
|
|
12
|
-
}), n;
|
|
1
|
+
import { GroupingColumnsPlugin as u } from "@toolbox-web/grid/plugins/grouping-columns";
|
|
2
|
+
import { a as s } from "../chunks/portal-bridge-B0mjqzak.js";
|
|
3
|
+
import { registerFeature as i } from "@toolbox-web/grid/features/registry";
|
|
4
|
+
function p(n) {
|
|
5
|
+
const e = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
return (o) => {
|
|
7
|
+
const r = document.createElement("div");
|
|
8
|
+
r.style.display = "contents";
|
|
9
|
+
const t = s(r, n(o));
|
|
10
|
+
return e.set(r, t), r;
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
if (typeof
|
|
17
|
-
if (!
|
|
18
|
-
const e =
|
|
13
|
+
i("groupingColumns", (n) => {
|
|
14
|
+
if (typeof n == "boolean") return new u();
|
|
15
|
+
if (!n) return new u();
|
|
16
|
+
const e = n, o = { ...e };
|
|
19
17
|
if (typeof e.groupHeaderRenderer == "function") {
|
|
20
18
|
const r = e.groupHeaderRenderer;
|
|
21
|
-
|
|
19
|
+
o.groupHeaderRenderer = p(r);
|
|
22
20
|
}
|
|
23
|
-
return Array.isArray(e.columnGroups) && (
|
|
21
|
+
return Array.isArray(e.columnGroups) && (o.columnGroups = e.columnGroups.map((r) => {
|
|
24
22
|
if (typeof r.renderer != "function") return r;
|
|
25
|
-
const
|
|
26
|
-
return { ...r, renderer:
|
|
27
|
-
})), new
|
|
23
|
+
const t = r.renderer;
|
|
24
|
+
return { ...r, renderer: p(t) };
|
|
25
|
+
})), new u(o);
|
|
28
26
|
});
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { GroupingRowsPlugin as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return c(() => {
|
|
16
|
-
u.render(p(i));
|
|
17
|
-
}), o;
|
|
1
|
+
import { GroupingRowsPlugin as n } from "@toolbox-web/grid/plugins/grouping-rows";
|
|
2
|
+
import { a as c } from "../chunks/portal-bridge-B0mjqzak.js";
|
|
3
|
+
import { registerFeature as a } from "@toolbox-web/grid/features/registry";
|
|
4
|
+
a("groupingRows", (r) => {
|
|
5
|
+
if (typeof r == "boolean") return new n();
|
|
6
|
+
if (!r) return new n();
|
|
7
|
+
const o = r, t = { ...o };
|
|
8
|
+
if (typeof o.groupRowRenderer == "function") {
|
|
9
|
+
const p = o.groupRowRenderer, s = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
t.groupRowRenderer = (i) => {
|
|
11
|
+
const e = document.createElement("div");
|
|
12
|
+
e.style.display = "contents";
|
|
13
|
+
const u = c(e, p(i));
|
|
14
|
+
return s.set(e, u), e;
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
|
-
return new t
|
|
17
|
+
return new n(t);
|
|
21
18
|
});
|
package/features/pinned-rows.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import "@toolbox-web/grid/features/pinned-rows";
|
|
2
2
|
import { PinnedRowsPlugin as o } from "@toolbox-web/grid/plugins/pinned-rows";
|
|
3
|
-
import {
|
|
4
|
-
import { createRoot as f } from "react-dom/client";
|
|
3
|
+
import { a as u } from "../chunks/portal-bridge-B0mjqzak.js";
|
|
5
4
|
import { registerFeature as p } from "@toolbox-web/grid/features/registry";
|
|
6
|
-
p("pinnedRows", (
|
|
7
|
-
if (typeof
|
|
8
|
-
if (!
|
|
9
|
-
const t =
|
|
10
|
-
return Array.isArray(t.customPanels) && (s.customPanels = t.customPanels.map((
|
|
11
|
-
if (typeof
|
|
12
|
-
const i =
|
|
5
|
+
p("pinnedRows", (n) => {
|
|
6
|
+
if (typeof n == "boolean") return new o();
|
|
7
|
+
if (!n) return new o();
|
|
8
|
+
const t = n, s = { ...t };
|
|
9
|
+
return Array.isArray(t.customPanels) && (s.customPanels = t.customPanels.map((e) => {
|
|
10
|
+
if (typeof e.render != "function") return e;
|
|
11
|
+
const i = e.render, c = /* @__PURE__ */ new WeakMap();
|
|
13
12
|
return {
|
|
14
|
-
...
|
|
15
|
-
render: (
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const m =
|
|
19
|
-
return
|
|
20
|
-
m.render(i(c));
|
|
21
|
-
}), n;
|
|
13
|
+
...e,
|
|
14
|
+
render: (a) => {
|
|
15
|
+
const r = document.createElement("div");
|
|
16
|
+
r.style.display = "contents";
|
|
17
|
+
const m = u(r, i(a));
|
|
18
|
+
return c.set(r, m), r;
|
|
22
19
|
}
|
|
23
20
|
};
|
|
24
21
|
})), new o(s);
|