@hybridcore/ui 1.4.37 → 1.4.38
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/dist/components/template-filters/components/filter/index.js +27 -23
- package/dist/components/tree-select/index.js +49 -46
- package/dist/components/treeview-filter/index.js +52 -41
- package/dist/components/treeview-filter/item/index.js +32 -36
- package/dist/components/treeview-filter/item/styled.js +14 -13
- package/dist/components/treeview-filter/item-label/index.js +1 -1
- package/dist/main.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,40 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as p, useState as g } from "react";
|
|
3
3
|
import { TreeViewFilter as h } from "../../../treeview-filter/index.js";
|
|
4
|
-
import { getNestedChildrenFromMap as
|
|
4
|
+
import { getNestedChildrenFromMap as y } from "../../../../utils/ontology.js";
|
|
5
5
|
const O = ({
|
|
6
|
-
templates:
|
|
7
|
-
filters:
|
|
8
|
-
|
|
6
|
+
templates: r,
|
|
7
|
+
filters: a,
|
|
8
|
+
defaultExpanded: d = [],
|
|
9
|
+
onChange: s
|
|
9
10
|
}) => {
|
|
10
|
-
const
|
|
11
|
-
() =>
|
|
12
|
-
[
|
|
13
|
-
), [
|
|
14
|
-
return /* @__PURE__ */
|
|
11
|
+
const m = p(() => y(r), [r]), f = p(
|
|
12
|
+
() => a.map((n) => n.templateKey),
|
|
13
|
+
[a]
|
|
14
|
+
), [c, i] = g(d);
|
|
15
|
+
return /* @__PURE__ */ x(
|
|
15
16
|
h,
|
|
16
17
|
{
|
|
17
|
-
data:
|
|
18
|
-
onChange: (
|
|
19
|
-
let
|
|
18
|
+
data: m,
|
|
19
|
+
onChange: (n, o) => {
|
|
20
|
+
let e = [...a];
|
|
20
21
|
if (o)
|
|
21
|
-
|
|
22
|
-
templateKey:
|
|
22
|
+
e.push({
|
|
23
|
+
templateKey: n,
|
|
23
24
|
filterOperator: "AND",
|
|
24
25
|
filters: [],
|
|
25
26
|
exclusionTemplateKeys: []
|
|
26
27
|
});
|
|
27
28
|
else {
|
|
28
|
-
const
|
|
29
|
-
|
|
29
|
+
const t = e.findIndex((l) => l.templateKey === n);
|
|
30
|
+
t !== -1 && e.splice(t, 1);
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
s && s(e);
|
|
32
33
|
},
|
|
33
34
|
idKey: "templateKey",
|
|
34
|
-
selected:
|
|
35
|
-
expanded:
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
selected: f,
|
|
36
|
+
expanded: c,
|
|
37
|
+
onExpansionToggle: (n, o, e) => {
|
|
38
|
+
i(e ? (t) => [
|
|
39
|
+
...t.filter((l) => l !== o),
|
|
40
|
+
o
|
|
41
|
+
] : (t) => t.filter((l) => l !== o));
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
);
|
|
@@ -1,70 +1,73 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { TreeViewFilter as
|
|
4
|
-
import
|
|
5
|
-
import { flattenNestedTemplates as
|
|
6
|
-
import { F as
|
|
1
|
+
import { jsxs as h, Fragment as W, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import u from "react";
|
|
3
|
+
import { TreeViewFilter as _ } from "../treeview-filter/index.js";
|
|
4
|
+
import s from "lodash";
|
|
5
|
+
import { flattenNestedTemplates as b } from "../../utils/ontology.js";
|
|
6
|
+
import { F as A, I as M } from "../../InputLabel-ClDXuWBr.js";
|
|
7
7
|
import { S as j } from "../../Select-ush_fSWy.js";
|
|
8
8
|
import { M as B } from "../../MenuItem-Lcjh1XlV.js";
|
|
9
9
|
import { D as k, a as w, b as L } from "../../DialogContent-CtA2aNum.js";
|
|
10
10
|
import { B as N } from "../../Button-jy67CcTH.js";
|
|
11
11
|
const U = ({
|
|
12
12
|
data: m,
|
|
13
|
-
label:
|
|
14
|
-
selected:
|
|
15
|
-
disabled:
|
|
16
|
-
idKey:
|
|
17
|
-
variant:
|
|
18
|
-
onChange:
|
|
13
|
+
label: c,
|
|
14
|
+
selected: r,
|
|
15
|
+
disabled: S,
|
|
16
|
+
idKey: i = "id",
|
|
17
|
+
variant: g = "outlined",
|
|
18
|
+
onChange: D
|
|
19
19
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
(
|
|
22
|
-
) : [], [
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
20
|
+
const [v, x] = u.useState(!1), [E, d] = u.useState([]), f = b(m), p = u.useMemo(() => s.isArray(r) ? r.map(
|
|
21
|
+
(n) => f.find((e) => String(s.get(e, i)) === n)
|
|
22
|
+
) : [], [r, f]), T = (n, e) => {
|
|
23
|
+
D(n, e);
|
|
24
|
+
}, F = () => {
|
|
25
|
+
x(!0), O();
|
|
26
|
+
}, C = () => {
|
|
27
|
+
x(!1);
|
|
28
|
+
}, I = (n, e, l) => {
|
|
29
|
+
d(l ? (a) => [
|
|
30
|
+
...a.filter((t) => t !== e),
|
|
31
|
+
e
|
|
32
|
+
] : (a) => a.filter((t) => t !== e));
|
|
30
33
|
}, O = () => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
}),
|
|
34
|
+
const n = [];
|
|
35
|
+
p.length > 0 && p.forEach((e) => {
|
|
36
|
+
const l = e == null ? void 0 : e.parentKeys, a = f.filter((t) => l == null ? void 0 : l.includes(t.templateKey)).map((t) => String(s.get(t, i)));
|
|
37
|
+
n.push(...a);
|
|
38
|
+
}), d(n);
|
|
36
39
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ h(W, { children: [
|
|
41
|
+
/* @__PURE__ */ h(A, { variant: g, fullWidth: !0, children: [
|
|
42
|
+
c !== void 0 && /* @__PURE__ */ o(M, { id: "select-label", children: c }),
|
|
43
|
+
/* @__PURE__ */ o(
|
|
41
44
|
j,
|
|
42
45
|
{
|
|
43
|
-
label:
|
|
44
|
-
variant:
|
|
46
|
+
label: c,
|
|
47
|
+
variant: g,
|
|
45
48
|
id: "select",
|
|
46
49
|
labelId: "select-label",
|
|
47
|
-
value:
|
|
50
|
+
value: r,
|
|
48
51
|
open: !1,
|
|
49
|
-
onOpen:
|
|
50
|
-
children:
|
|
52
|
+
onOpen: F,
|
|
53
|
+
children: p.length > 0 && p.map((n, e) => /* @__PURE__ */ o(B, { value: s.get(n, i) ?? "", children: n == null ? void 0 : n.name }, e))
|
|
51
54
|
}
|
|
52
55
|
)
|
|
53
56
|
] }),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
|
|
57
|
+
/* @__PURE__ */ h(k, { open: v, onClose: C, fullWidth: !0, maxWidth: "sm", children: [
|
|
58
|
+
/* @__PURE__ */ o(w, { sx: { p: 1, pt: 2 }, children: /* @__PURE__ */ o(
|
|
59
|
+
_,
|
|
57
60
|
{
|
|
58
61
|
data: m,
|
|
59
|
-
selected:
|
|
60
|
-
disabled:
|
|
61
|
-
expanded:
|
|
62
|
-
idKey:
|
|
63
|
-
|
|
64
|
-
onChange:
|
|
62
|
+
selected: s.isArray(r) ? r : void 0,
|
|
63
|
+
disabled: S,
|
|
64
|
+
expanded: E,
|
|
65
|
+
idKey: i,
|
|
66
|
+
onExpansionToggle: I,
|
|
67
|
+
onChange: T
|
|
65
68
|
}
|
|
66
69
|
) }),
|
|
67
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(N, { onClick: C, variant: "contained", fullWidth: !0, children: "OK" }) })
|
|
68
71
|
] })
|
|
69
72
|
] });
|
|
70
73
|
};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import { jsxs as c, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { SimpleTreeView as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Box as
|
|
7
|
-
import { SearchInput as
|
|
8
|
-
import { flattenNestedTemplates as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as c, Fragment as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import p from "react";
|
|
3
|
+
import { SimpleTreeView as C } from "@mui/x-tree-view";
|
|
4
|
+
import F from "./item/index.js";
|
|
5
|
+
import u from "lodash";
|
|
6
|
+
import { Box as L, Divider as _ } from "@mui/material";
|
|
7
|
+
import { SearchInput as j } from "../search-input/index.js";
|
|
8
|
+
import { flattenNestedTemplates as z } from "../../utils/ontology.js";
|
|
9
|
+
import { ArrowDropDown as A, ArrowRight as B } from "@mui/icons-material";
|
|
10
|
+
const H = ({
|
|
11
|
+
data: r,
|
|
12
|
+
idKey: a = "id",
|
|
13
|
+
selected: s,
|
|
14
|
+
expanded: f,
|
|
15
|
+
disabled: m,
|
|
16
|
+
disableSearch: h,
|
|
17
|
+
onChange: S,
|
|
18
|
+
onExpansionToggle: x
|
|
17
19
|
}) => {
|
|
18
|
-
const [
|
|
19
|
-
(e) => e.name.toLowerCase().includes(
|
|
20
|
-
) :
|
|
21
|
-
let
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */ c(
|
|
24
|
-
!
|
|
25
|
-
/* @__PURE__ */ t(
|
|
26
|
-
|
|
20
|
+
const [o, i] = p.useState(""), b = z(r), w = p.useMemo(() => o.length > 0 ? b.filter(
|
|
21
|
+
(e) => e.name.toLowerCase().includes(o)
|
|
22
|
+
) : r, [o, r]);
|
|
23
|
+
let l = null;
|
|
24
|
+
const I = 500;
|
|
25
|
+
return /* @__PURE__ */ c(d, { children: [
|
|
26
|
+
!h && /* @__PURE__ */ c(d, { children: [
|
|
27
|
+
/* @__PURE__ */ t(L, { px: 1, pt: 0.75, children: /* @__PURE__ */ t(
|
|
28
|
+
j,
|
|
27
29
|
{
|
|
28
30
|
fullWidth: !0,
|
|
29
31
|
disableLabel: !0,
|
|
@@ -36,33 +38,42 @@ const R = ({
|
|
|
36
38
|
},
|
|
37
39
|
iconSize: "small",
|
|
38
40
|
onChange: (e) => {
|
|
39
|
-
|
|
41
|
+
l && clearTimeout(l), l = setTimeout(() => i(e.toLowerCase()), I);
|
|
42
|
+
},
|
|
43
|
+
onSubmit: (e) => {
|
|
44
|
+
i(e || "");
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
) }),
|
|
43
|
-
/* @__PURE__ */ t(
|
|
48
|
+
/* @__PURE__ */ t(_, { sx: { mt: 1.75 } })
|
|
44
49
|
] }),
|
|
45
50
|
/* @__PURE__ */ t(
|
|
46
|
-
|
|
51
|
+
C,
|
|
47
52
|
{
|
|
48
53
|
"aria-label": "tree view filter",
|
|
49
54
|
disableSelection: !0,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
defaultExpandedItems: f,
|
|
56
|
+
slots: {
|
|
57
|
+
collapseIcon: () => /* @__PURE__ */ t(A, {}),
|
|
58
|
+
expandIcon: () => /* @__PURE__ */ t(B, {})
|
|
59
|
+
},
|
|
60
|
+
onItemExpansionToggle: x,
|
|
61
|
+
children: w.map((e, g) => {
|
|
62
|
+
const n = String(e[a]), T = u.includes(s, n), D = u.includes(m, n);
|
|
63
|
+
return /* @__PURE__ */ t(
|
|
64
|
+
F,
|
|
54
65
|
{
|
|
55
|
-
id:
|
|
56
|
-
idKey:
|
|
66
|
+
id: n,
|
|
67
|
+
idKey: a,
|
|
57
68
|
name: e.name,
|
|
58
|
-
checked:
|
|
59
|
-
disabled:
|
|
60
|
-
disabledIds:
|
|
69
|
+
checked: T,
|
|
70
|
+
disabled: D,
|
|
71
|
+
disabledIds: m,
|
|
61
72
|
children: e.children,
|
|
62
|
-
onChange:
|
|
63
|
-
defaultSelected:
|
|
73
|
+
onChange: S,
|
|
74
|
+
defaultSelected: s
|
|
64
75
|
},
|
|
65
|
-
|
|
76
|
+
g
|
|
66
77
|
);
|
|
67
78
|
})
|
|
68
79
|
}
|
|
@@ -70,5 +81,5 @@ const R = ({
|
|
|
70
81
|
] });
|
|
71
82
|
};
|
|
72
83
|
export {
|
|
73
|
-
|
|
84
|
+
H as TreeViewFilter
|
|
74
85
|
};
|
|
@@ -1,53 +1,49 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import I from "../item-label/index.js";
|
|
3
3
|
import a from "lodash";
|
|
4
|
-
import { ArrowRight as I } from "@mui/icons-material";
|
|
5
4
|
import { TreeItem as h } from "./styled.js";
|
|
6
5
|
function x({
|
|
7
|
-
id:
|
|
6
|
+
id: m,
|
|
8
7
|
idKey: n,
|
|
9
|
-
name:
|
|
10
|
-
checked:
|
|
11
|
-
disabled:
|
|
12
|
-
disabledIds:
|
|
13
|
-
onChange:
|
|
14
|
-
children:
|
|
15
|
-
defaultSelected:
|
|
8
|
+
name: p,
|
|
9
|
+
checked: i,
|
|
10
|
+
disabled: d,
|
|
11
|
+
disabledIds: o,
|
|
12
|
+
onChange: c,
|
|
13
|
+
children: s,
|
|
14
|
+
defaultSelected: l
|
|
16
15
|
}) {
|
|
17
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ e(
|
|
18
17
|
h,
|
|
19
18
|
{
|
|
20
|
-
itemId: String(
|
|
21
|
-
label: /* @__PURE__ */
|
|
22
|
-
|
|
19
|
+
itemId: String(m),
|
|
20
|
+
label: /* @__PURE__ */ e(
|
|
21
|
+
I,
|
|
23
22
|
{
|
|
24
|
-
id:
|
|
25
|
-
name:
|
|
26
|
-
checked:
|
|
27
|
-
disabled:
|
|
28
|
-
onChange:
|
|
23
|
+
id: m,
|
|
24
|
+
name: p,
|
|
25
|
+
checked: i,
|
|
26
|
+
disabled: d,
|
|
27
|
+
onChange: c
|
|
29
28
|
}
|
|
30
29
|
),
|
|
31
|
-
checked:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
children: r && r.map((o, u) => {
|
|
36
|
-
const m = String(o[n]), b = a.includes(p, m), d = a.includes(c, m);
|
|
37
|
-
return /* @__PURE__ */ t(
|
|
30
|
+
checked: i,
|
|
31
|
+
children: s && s.map((r, f) => {
|
|
32
|
+
const t = String(r[n]), u = a.includes(l, t), b = a.includes(o, t);
|
|
33
|
+
return /* @__PURE__ */ e(
|
|
38
34
|
x,
|
|
39
35
|
{
|
|
40
|
-
id:
|
|
36
|
+
id: t,
|
|
41
37
|
idKey: n,
|
|
42
|
-
name:
|
|
43
|
-
checked:
|
|
44
|
-
disabled:
|
|
45
|
-
disabledIds:
|
|
46
|
-
children:
|
|
47
|
-
onChange:
|
|
48
|
-
defaultSelected:
|
|
38
|
+
name: r.name,
|
|
39
|
+
checked: u,
|
|
40
|
+
disabled: b,
|
|
41
|
+
disabledIds: o,
|
|
42
|
+
children: r.children,
|
|
43
|
+
onChange: c,
|
|
44
|
+
defaultSelected: l
|
|
49
45
|
},
|
|
50
|
-
|
|
46
|
+
f
|
|
51
47
|
);
|
|
52
48
|
})
|
|
53
49
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { TreeItem as
|
|
2
|
-
import { styled as
|
|
3
|
-
const
|
|
4
|
-
({ theme:
|
|
1
|
+
import { TreeItem as r } from "@mui/x-tree-view";
|
|
2
|
+
import { styled as t, alpha as i } from "@mui/material";
|
|
3
|
+
const l = t(r)(
|
|
4
|
+
({ theme: o, checked: e }) => ({
|
|
5
5
|
position: "relative",
|
|
6
6
|
"& .MuiTreeItem-content": {
|
|
7
7
|
flexDirection: "row-reverse",
|
|
8
8
|
borderBottom: "1px solid",
|
|
9
|
-
borderBottomColor:
|
|
10
|
-
boxSizing: "border-box"
|
|
9
|
+
borderBottomColor: o.palette.divider,
|
|
10
|
+
boxSizing: "border-box",
|
|
11
|
+
borderRadius: 0
|
|
11
12
|
},
|
|
12
13
|
"& .MuiTreeItem-iconContainer": {
|
|
13
14
|
transition: ".3s all",
|
|
@@ -15,10 +16,10 @@ const m = r(t)(
|
|
|
15
16
|
fontSize: "20px !important"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
|
-
"& .MuiTreeItem-content.Mui-expanded .MuiTreeItem-iconContainer": {
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
...
|
|
19
|
+
// "& .MuiTreeItem-content.Mui-expanded .MuiTreeItem-iconContainer": {
|
|
20
|
+
// // transform: "rotate(90deg)",
|
|
21
|
+
// },
|
|
22
|
+
...e && {
|
|
22
23
|
"&:before": {
|
|
23
24
|
content: '""',
|
|
24
25
|
position: "absolute",
|
|
@@ -27,12 +28,12 @@ const m = r(t)(
|
|
|
27
28
|
bottom: 0,
|
|
28
29
|
right: 0,
|
|
29
30
|
borderLeft: "1px solid",
|
|
30
|
-
borderLeftColor:
|
|
31
|
-
backgroundColor: i(
|
|
31
|
+
borderLeftColor: o.palette.primary.main,
|
|
32
|
+
backgroundColor: i(o.palette.primary.main, 0.1)
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
})
|
|
35
36
|
);
|
|
36
37
|
export {
|
|
37
|
-
|
|
38
|
+
l as TreeItem
|
|
38
39
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -585,7 +585,11 @@ declare interface Props_11 {
|
|
|
585
585
|
disabled?: string[];
|
|
586
586
|
disableSearch?: boolean;
|
|
587
587
|
onChange?(id: string, checked: boolean): void;
|
|
588
|
-
|
|
588
|
+
onExpansionToggle?(
|
|
589
|
+
event: React.SyntheticEvent,
|
|
590
|
+
itemId: string,
|
|
591
|
+
isExpanded: boolean
|
|
592
|
+
): void;
|
|
589
593
|
}
|
|
590
594
|
|
|
591
595
|
declare interface Props_2 {
|
|
@@ -815,6 +819,7 @@ declare interface TabItem {
|
|
|
815
819
|
label: default_2.ReactNode;
|
|
816
820
|
templates: Map<string | number, ONTOLOGY.TemplateType>;
|
|
817
821
|
filters: FV.TemplateFilter[];
|
|
822
|
+
defaultExpanded?: string[];
|
|
818
823
|
onChange: (filters: FV.TemplateFilter[]) => void;
|
|
819
824
|
}
|
|
820
825
|
|