@hybridcore/ui 1.5.7 → 1.5.8
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.
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { SimpleTreeView as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Box as
|
|
7
|
-
import { SearchInput as
|
|
8
|
-
import { flattenNestedTemplates as
|
|
9
|
-
import { ArrowDropDown as
|
|
1
|
+
import { jsxs as d, Fragment as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import u from "react";
|
|
3
|
+
import { SimpleTreeView as B } from "@mui/x-tree-view";
|
|
4
|
+
import C from "./item/index.js";
|
|
5
|
+
import a from "lodash";
|
|
6
|
+
import { Box as F, Divider as L } from "@mui/material";
|
|
7
|
+
import { SearchInput as _ } from "../search-input/index.js";
|
|
8
|
+
import { flattenNestedTemplates as j } from "../../utils/ontology.js";
|
|
9
|
+
import { ArrowDropDown as y, ArrowRight as z } from "@mui/icons-material";
|
|
10
10
|
const H = ({
|
|
11
|
-
data:
|
|
12
|
-
idKey:
|
|
13
|
-
selected:
|
|
11
|
+
data: i,
|
|
12
|
+
idKey: s = "id",
|
|
13
|
+
selected: m,
|
|
14
14
|
expanded: f,
|
|
15
|
-
disabled:
|
|
15
|
+
disabled: c,
|
|
16
16
|
disableSearch: h,
|
|
17
17
|
onChange: S,
|
|
18
18
|
onExpansionToggle: x
|
|
19
19
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const [r, o] = u.useState(""), b = j(i), w = u.useMemo(() => r.length > 0 ? a.uniqBy(
|
|
21
|
+
b.filter(
|
|
22
|
+
(e) => e.name.toLowerCase().includes(r)
|
|
23
|
+
),
|
|
24
|
+
(e) => e.id
|
|
25
|
+
) : i, [r, i]);
|
|
26
|
+
let n = null;
|
|
24
27
|
const I = 500;
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
!h && /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */ t(
|
|
28
|
-
|
|
28
|
+
return /* @__PURE__ */ d(p, { children: [
|
|
29
|
+
!h && /* @__PURE__ */ d(p, { children: [
|
|
30
|
+
/* @__PURE__ */ t(F, { px: 1, pt: 0.75, children: /* @__PURE__ */ t(
|
|
31
|
+
_,
|
|
29
32
|
{
|
|
30
33
|
fullWidth: !0,
|
|
31
34
|
disableLabel: !0,
|
|
@@ -38,40 +41,40 @@ const H = ({
|
|
|
38
41
|
},
|
|
39
42
|
iconSize: "small",
|
|
40
43
|
onChange: (e) => {
|
|
41
|
-
|
|
44
|
+
n && clearTimeout(n), n = setTimeout(() => o(e.toLowerCase()), I);
|
|
42
45
|
},
|
|
43
46
|
onSubmit: (e) => {
|
|
44
|
-
|
|
47
|
+
o(e || "");
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
) }),
|
|
48
|
-
/* @__PURE__ */ t(
|
|
51
|
+
/* @__PURE__ */ t(L, { sx: { mt: 1.75 } })
|
|
49
52
|
] }),
|
|
50
53
|
/* @__PURE__ */ t(
|
|
51
|
-
|
|
54
|
+
B,
|
|
52
55
|
{
|
|
53
56
|
"aria-label": "tree view filter",
|
|
54
57
|
disableSelection: !0,
|
|
55
58
|
defaultExpandedItems: f,
|
|
56
59
|
slots: {
|
|
57
|
-
collapseIcon: () => /* @__PURE__ */ t(
|
|
58
|
-
expandIcon: () => /* @__PURE__ */ t(
|
|
60
|
+
collapseIcon: () => /* @__PURE__ */ t(y, {}),
|
|
61
|
+
expandIcon: () => /* @__PURE__ */ t(z, {})
|
|
59
62
|
},
|
|
60
63
|
onItemExpansionToggle: x,
|
|
61
64
|
children: w.map((e, g) => {
|
|
62
|
-
const
|
|
65
|
+
const l = String(e[s]), T = a.includes(m, l), D = a.includes(c, l);
|
|
63
66
|
return /* @__PURE__ */ t(
|
|
64
|
-
|
|
67
|
+
C,
|
|
65
68
|
{
|
|
66
|
-
id:
|
|
67
|
-
idKey:
|
|
69
|
+
id: l,
|
|
70
|
+
idKey: s,
|
|
68
71
|
name: e.name,
|
|
69
72
|
checked: T,
|
|
70
73
|
disabled: D,
|
|
71
|
-
disabledIds:
|
|
72
|
-
children: e.children,
|
|
74
|
+
disabledIds: c,
|
|
75
|
+
children: r ? [] : e.children,
|
|
73
76
|
onChange: S,
|
|
74
|
-
defaultSelected:
|
|
77
|
+
defaultSelected: m
|
|
75
78
|
},
|
|
76
79
|
g
|
|
77
80
|
);
|