@hybridcore/ui 1.5.85 → 1.5.86
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,29 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as m } from "react";
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
3
2
|
import s from "lodash";
|
|
4
|
-
import n from "
|
|
5
|
-
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
import h from "./variable.js";
|
|
5
|
+
const $ = ({
|
|
6
6
|
template: r,
|
|
7
|
-
data: t
|
|
7
|
+
data: t,
|
|
8
|
+
fieldOptions: p
|
|
8
9
|
}) => {
|
|
9
|
-
const
|
|
10
|
+
const a = n(() => {
|
|
10
11
|
let e = /* @__PURE__ */ new Map();
|
|
11
12
|
return r.properties.forEach((o) => {
|
|
12
|
-
const
|
|
13
|
-
e.set(
|
|
13
|
+
const i = `${r.type}-${r.templateKey}-${o.propertyId}`;
|
|
14
|
+
e.set(i, o);
|
|
14
15
|
}), e;
|
|
15
16
|
}, [r]);
|
|
16
|
-
return s.keys(t.variables).map((e, o) => /* @__PURE__ */
|
|
17
|
-
|
|
17
|
+
return s.keys(t.variables).map((e, o) => /* @__PURE__ */ m(
|
|
18
|
+
h,
|
|
18
19
|
{
|
|
19
20
|
type: e,
|
|
20
21
|
data: s.get(t.variables, e),
|
|
21
|
-
properties:
|
|
22
|
-
hashPrefix: `${t.template.type}-${t.template.templateKey}
|
|
22
|
+
properties: a,
|
|
23
|
+
hashPrefix: `${t.template.type}-${t.template.templateKey}-`,
|
|
24
|
+
fieldOptions: p
|
|
23
25
|
},
|
|
24
26
|
o
|
|
25
27
|
));
|
|
26
28
|
};
|
|
27
29
|
export {
|
|
28
|
-
|
|
30
|
+
$ as InstanceVariableList
|
|
29
31
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Box as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { VariableRoot as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as a, Fragment as x, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { Box as i } from "@mui/material";
|
|
3
|
+
import V from "dayjs";
|
|
4
|
+
import Y from "lodash";
|
|
5
|
+
import { VariableRoot as v, VariableRow as g, VariableTitle as h, VariableValue as f } from "./styled.js";
|
|
6
|
+
const T = [
|
|
7
7
|
"string",
|
|
8
8
|
"boolean",
|
|
9
9
|
"date",
|
|
@@ -15,44 +15,69 @@ const D = [
|
|
|
15
15
|
"list",
|
|
16
16
|
"text",
|
|
17
17
|
"composite-list"
|
|
18
|
-
],
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
] }),
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
}, E = ({ title:
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
18
|
+
], b = ({ title: e, value: r }) => /* @__PURE__ */ m(g, { children: [
|
|
19
|
+
/* @__PURE__ */ a(h, { variant: "subtitle2", children: e }),
|
|
20
|
+
/* @__PURE__ */ a(f, { variant: "body2", children: r })
|
|
21
|
+
] }), j = ({ title: e, value: r }) => /* @__PURE__ */ a(b, { title: e, value: r }), D = ({ title: e, value: r }) => /* @__PURE__ */ a(b, { title: e, value: r ? "Yes" : "No" }), k = ({ title: e, value: r }) => {
|
|
22
|
+
const n = V(r).format("DD/MM/YYYY");
|
|
23
|
+
return /* @__PURE__ */ a(b, { title: e, value: n });
|
|
24
|
+
}, B = ({ title: e, value: r }) => {
|
|
25
|
+
const n = (r ?? []).join(", ");
|
|
26
|
+
return /* @__PURE__ */ a(b, { title: e, value: n });
|
|
27
|
+
}, E = ({ title: e, value: r }) => /* @__PURE__ */ m(g, { children: [
|
|
28
|
+
/* @__PURE__ */ a(h, { variant: "subtitle2", children: e }),
|
|
29
|
+
/* @__PURE__ */ a(f, { variant: "body2", children: /* @__PURE__ */ a("a", { href: r, target: "_blank", rel: "noopener noreferrer", children: r }) })
|
|
30
30
|
] });
|
|
31
|
+
function _(e, r, n, t) {
|
|
32
|
+
if (t != null && t.component) return t.component;
|
|
33
|
+
if (t != null && t.clickable) return /* @__PURE__ */ a(E, { title: n, value: r });
|
|
34
|
+
switch (e) {
|
|
35
|
+
case "string":
|
|
36
|
+
case "byte":
|
|
37
|
+
case "double":
|
|
38
|
+
case "integer":
|
|
39
|
+
case "long":
|
|
40
|
+
case "enum":
|
|
41
|
+
case "text":
|
|
42
|
+
return /* @__PURE__ */ a(j, { title: n, value: r });
|
|
43
|
+
case "boolean":
|
|
44
|
+
return /* @__PURE__ */ a(D, { title: n, value: r });
|
|
45
|
+
case "date":
|
|
46
|
+
return /* @__PURE__ */ a(k, { title: n, value: r });
|
|
47
|
+
case "list":
|
|
48
|
+
case "composite-list":
|
|
49
|
+
return /* @__PURE__ */ a(B, { title: n, value: r });
|
|
50
|
+
default:
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
31
54
|
function R({
|
|
32
|
-
type:
|
|
33
|
-
data:
|
|
34
|
-
filter:
|
|
35
|
-
properties:
|
|
36
|
-
hashPrefix:
|
|
55
|
+
type: e,
|
|
56
|
+
data: r,
|
|
57
|
+
filter: n,
|
|
58
|
+
properties: t,
|
|
59
|
+
hashPrefix: d,
|
|
60
|
+
fieldOptions: s
|
|
37
61
|
}) {
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
return e === "geometry" ? /* @__PURE__ */ a(x, {}) : /* @__PURE__ */ a(v, { children: Y.keys(r).filter((l) => {
|
|
63
|
+
var o;
|
|
64
|
+
const u = t.get(d + l);
|
|
65
|
+
return u && !u.visible || (o = s == null ? void 0 : s[l]) != null && o.hidden ? !1 : n === void 0 || n === "" || l.includes(n);
|
|
66
|
+
}).map((l, u) => {
|
|
67
|
+
const o = t.get(d + l), y = o ? o.name : "", c = s == null ? void 0 : s[l];
|
|
68
|
+
return T.includes(e) ? /* @__PURE__ */ m(
|
|
69
|
+
i,
|
|
70
|
+
{
|
|
71
|
+
mb: 1,
|
|
72
|
+
className: "variable",
|
|
73
|
+
...(c == null ? void 0 : c.order) && { order: c.order },
|
|
74
|
+
children: [
|
|
75
|
+
_(e, r[l], y, c),
|
|
76
|
+
c == null ? void 0 : c.helperText
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
u
|
|
80
|
+
) : /* @__PURE__ */ a(i, {}, u);
|
|
56
81
|
}) });
|
|
57
82
|
}
|
|
58
83
|
export {
|
package/dist/main.d.ts
CHANGED
|
@@ -283,6 +283,7 @@ declare interface FieldOptions {
|
|
|
283
283
|
order?: number;
|
|
284
284
|
hidden?: boolean;
|
|
285
285
|
disabled?: boolean;
|
|
286
|
+
clickable?: boolean;
|
|
286
287
|
minDate?: Dayjs;
|
|
287
288
|
helperText?: React.ReactNode;
|
|
288
289
|
placeholder?: string;
|
|
@@ -551,6 +552,9 @@ export declare const InstanceVariableList: FC<InstanceVariableListProps>;
|
|
|
551
552
|
export declare interface InstanceVariableListProps {
|
|
552
553
|
template: ONTOLOGY.TemplateType;
|
|
553
554
|
data: INSTANCE.InstanceType;
|
|
555
|
+
fieldOptions?: {
|
|
556
|
+
[key: string]: FieldOptions;
|
|
557
|
+
};
|
|
554
558
|
}
|
|
555
559
|
|
|
556
560
|
declare interface ItemProps {
|