@hybridcore/ui 1.4.23 → 1.4.24
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,78 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { CollapsibleCard as
|
|
4
|
-
import
|
|
1
|
+
import { jsx as a, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import u from "lodash";
|
|
3
|
+
import { CollapsibleCard as v } from "../collapsible-card/index.js";
|
|
4
|
+
import h from "./property.js";
|
|
5
5
|
const N = ({
|
|
6
6
|
values: o,
|
|
7
7
|
templates: d,
|
|
8
|
-
inputVariant:
|
|
9
|
-
|
|
8
|
+
inputVariant: c,
|
|
9
|
+
fieldOptions: s,
|
|
10
|
+
onChange: g
|
|
10
11
|
}) => {
|
|
11
|
-
const
|
|
12
|
+
const m = (f) => (n) => {
|
|
12
13
|
if (f) {
|
|
13
|
-
let e = o.find((
|
|
14
|
+
let e = o.find((r) => r.templateKey === f);
|
|
14
15
|
if (e) {
|
|
15
|
-
const
|
|
16
|
+
const r = u.keys(n)[0];
|
|
16
17
|
let t = e.filters.findIndex(
|
|
17
|
-
(
|
|
18
|
+
(l) => l.fieldName === r
|
|
18
19
|
);
|
|
19
|
-
const i =
|
|
20
|
-
|
|
21
|
-
fieldName:
|
|
20
|
+
const i = u.get(n, r);
|
|
21
|
+
u.values(i).filter((l) => !(u.isArray(l) && l.length === 0 || l === "")).length === 0 && t !== -1 ? e.filters.splice(t, 1) : t !== -1 ? e.filters[t] = {
|
|
22
|
+
fieldName: r,
|
|
22
23
|
value: i
|
|
23
24
|
} : e.filters.push({
|
|
24
|
-
fieldName:
|
|
25
|
+
fieldName: r,
|
|
25
26
|
value: i
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
g(o);
|
|
29
30
|
} else console.warn("Template could not be found!");
|
|
30
31
|
};
|
|
31
32
|
if (o.length === 1) {
|
|
32
|
-
const f = o[0],
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
const f = o[0], n = d.get(f.templateKey);
|
|
34
|
+
return /* @__PURE__ */ a(p, { children: n == null ? void 0 : n.properties.filter((e) => {
|
|
35
|
+
var r;
|
|
36
|
+
return s ? !((r = s[e.propertyId]) != null && r.hidden) : !0;
|
|
37
|
+
}).map((e, r) => {
|
|
34
38
|
let t = {};
|
|
35
39
|
const i = f.filters.find(
|
|
36
|
-
(
|
|
40
|
+
(l) => l.fieldName === e.propertyId
|
|
37
41
|
);
|
|
38
|
-
return i && (t = i.value), /* @__PURE__ */
|
|
39
|
-
|
|
42
|
+
return i && (t = i.value), /* @__PURE__ */ a(
|
|
43
|
+
h,
|
|
40
44
|
{
|
|
41
45
|
property: e,
|
|
42
46
|
value: t,
|
|
43
47
|
size: "small",
|
|
44
|
-
variant:
|
|
45
|
-
onChange:
|
|
48
|
+
variant: c,
|
|
49
|
+
onChange: m(n == null ? void 0 : n.templateKey)
|
|
46
50
|
},
|
|
47
|
-
|
|
51
|
+
r
|
|
48
52
|
);
|
|
49
53
|
}) });
|
|
50
54
|
}
|
|
51
|
-
return o.map((f,
|
|
55
|
+
return o.map((f, n) => {
|
|
52
56
|
const e = d.get(f.templateKey);
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
57
|
+
return /* @__PURE__ */ a(
|
|
58
|
+
v,
|
|
55
59
|
{
|
|
56
60
|
header: e == null ? void 0 : e.name,
|
|
57
|
-
content: /* @__PURE__ */
|
|
61
|
+
content: /* @__PURE__ */ a(p, { children: e == null ? void 0 : e.properties.filter((r) => {
|
|
62
|
+
var t;
|
|
63
|
+
return s ? !((t = s[r.propertyId]) != null && t.hidden) : !0;
|
|
64
|
+
}).map((r, t) => {
|
|
58
65
|
let i = {};
|
|
59
|
-
const
|
|
60
|
-
(
|
|
66
|
+
const l = f.filters.find(
|
|
67
|
+
(y) => y.fieldName === r.propertyId
|
|
61
68
|
);
|
|
62
|
-
return
|
|
63
|
-
|
|
69
|
+
return l && (i = l.value), /* @__PURE__ */ a(
|
|
70
|
+
h,
|
|
64
71
|
{
|
|
65
|
-
property:
|
|
72
|
+
property: r,
|
|
66
73
|
value: i,
|
|
67
74
|
size: "small",
|
|
68
|
-
variant:
|
|
69
|
-
onChange:
|
|
75
|
+
variant: c,
|
|
76
|
+
onChange: m(e == null ? void 0 : e.templateKey)
|
|
70
77
|
},
|
|
71
78
|
t
|
|
72
79
|
);
|
|
73
80
|
}) })
|
|
74
81
|
},
|
|
75
|
-
|
|
82
|
+
n
|
|
76
83
|
);
|
|
77
84
|
});
|
|
78
85
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -560,6 +560,9 @@ declare interface Props_10 {
|
|
|
560
560
|
values: FV.TemplateFilter[];
|
|
561
561
|
templates: Map<string | number, ONTOLOGY.TemplateType>;
|
|
562
562
|
inputVariant?: "standard" | "outlined" | "filled";
|
|
563
|
+
fieldOptions?: {
|
|
564
|
+
[key: string]: FieldOptions;
|
|
565
|
+
};
|
|
563
566
|
onChange(values: FV.TemplateFilter[]): void;
|
|
564
567
|
}
|
|
565
568
|
|