@hybridcore/ui 1.5.83 → 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,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Box as
|
|
3
|
-
import V from "
|
|
4
|
-
import Y from "
|
|
5
|
-
import { VariableRoot as
|
|
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
6
|
const T = [
|
|
7
7
|
"string",
|
|
8
8
|
"boolean",
|
|
@@ -15,43 +15,71 @@ const T = [
|
|
|
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
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
] });
|
|
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
|
+
}
|
|
54
|
+
function R({
|
|
55
|
+
type: e,
|
|
56
|
+
data: r,
|
|
57
|
+
filter: n,
|
|
58
|
+
properties: t,
|
|
59
|
+
hashPrefix: d,
|
|
60
|
+
fieldOptions: s
|
|
34
61
|
}) {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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);
|
|
53
81
|
}) });
|
|
54
82
|
}
|
|
55
83
|
export {
|
|
56
|
-
|
|
84
|
+
R as default
|
|
57
85
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as m, jsx as t, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { Typography as f, FormLabel as P, FormGroup as D, Button as W } from "@mui/material";
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { useState as T } from "react";
|
|
3
|
+
import { KeyboardArrowUp as k, KeyboardArrowDown as w } from "@mui/icons-material";
|
|
4
|
+
import { Typography as c, FormLabel as Y, FormGroup as D, Button as W } from "@mui/material";
|
|
6
5
|
import { DatePicker as C } from "@mui/x-date-pickers";
|
|
7
|
-
import
|
|
6
|
+
import f from "dayjs";
|
|
7
|
+
import { B as r } from "../../Box-B1AVyJ_s.js";
|
|
8
8
|
import { T as b } from "../../TextField-Bf46COnQ.js";
|
|
9
9
|
import { F as O } from "../../FormControlLabel-DzNokgFD.js";
|
|
10
|
-
import { C as
|
|
10
|
+
import { C as z } from "../../Checkbox-CrU2hpWB.js";
|
|
11
11
|
import { F as B } from "../../InputLabel-rrSJo8M_.js";
|
|
12
12
|
const R = ({
|
|
13
13
|
property: e,
|
|
14
14
|
value: a,
|
|
15
|
-
size:
|
|
16
|
-
variant:
|
|
15
|
+
size: d = "medium",
|
|
16
|
+
variant: u,
|
|
17
17
|
onChange: p
|
|
18
18
|
}) => {
|
|
19
19
|
var I, S, y, V, M;
|
|
@@ -23,31 +23,31 @@ const R = ({
|
|
|
23
23
|
o[l] = String(i), p({
|
|
24
24
|
[n.target.name]: o
|
|
25
25
|
});
|
|
26
|
-
},
|
|
26
|
+
}, F = (l) => {
|
|
27
27
|
var x;
|
|
28
28
|
const n = { ...a }, { value: o, checked: i, name: s } = l.target;
|
|
29
29
|
i ? (n.atLeastOneOf || (n.atLeastOneOf = []), n.atLeastOneOf.push(o)) : n.atLeastOneOf = (x = n.atLeastOneOf) == null ? void 0 : x.filter(
|
|
30
|
-
(
|
|
30
|
+
(L) => L !== o
|
|
31
31
|
), p({
|
|
32
32
|
[s]: n
|
|
33
33
|
});
|
|
34
34
|
}, g = (l) => (n) => {
|
|
35
35
|
let o = { ...a };
|
|
36
|
-
o[l] =
|
|
36
|
+
o[l] = f(n).format("YYYY-MM-DD"), p({
|
|
37
37
|
[e.propertyId]: o
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
if (["string", "text", "list"].includes(e.type))
|
|
41
|
-
return /* @__PURE__ */ m(
|
|
42
|
-
/* @__PURE__ */ t(
|
|
41
|
+
return /* @__PURE__ */ m(r, { mb: 1, children: [
|
|
42
|
+
/* @__PURE__ */ t(c, { variant: "caption", mb: 0.5, display: "block", children: e.name }),
|
|
43
43
|
/* @__PURE__ */ t(
|
|
44
44
|
b,
|
|
45
45
|
{
|
|
46
46
|
name: e.propertyId,
|
|
47
47
|
value: a.exact ?? e.defaultValue ?? "",
|
|
48
|
-
size:
|
|
48
|
+
size: d,
|
|
49
49
|
onChange: h("exact"),
|
|
50
|
-
variant:
|
|
50
|
+
variant: u,
|
|
51
51
|
type: "text",
|
|
52
52
|
multiline: e.type === "text",
|
|
53
53
|
disabled: !e.editable,
|
|
@@ -59,17 +59,17 @@ const R = ({
|
|
|
59
59
|
)
|
|
60
60
|
] });
|
|
61
61
|
if (["integer", "double", "long", "byte"].includes(e.type))
|
|
62
|
-
return /* @__PURE__ */ m(
|
|
63
|
-
/* @__PURE__ */ t(
|
|
64
|
-
/* @__PURE__ */ m(
|
|
62
|
+
return /* @__PURE__ */ m(r, { mb: 1, children: [
|
|
63
|
+
/* @__PURE__ */ t(c, { variant: "caption", mb: 0.5, display: "block", children: e.name }),
|
|
64
|
+
/* @__PURE__ */ m(r, { display: "flex", alignItems: "center", mb: 2, children: [
|
|
65
65
|
/* @__PURE__ */ t(
|
|
66
66
|
b,
|
|
67
67
|
{
|
|
68
68
|
name: e.propertyId,
|
|
69
69
|
value: a.min ?? e.defaultValue ?? "",
|
|
70
|
-
size:
|
|
70
|
+
size: d,
|
|
71
71
|
onChange: h("min"),
|
|
72
|
-
variant:
|
|
72
|
+
variant: u,
|
|
73
73
|
type: "number",
|
|
74
74
|
disabled: !e.editable,
|
|
75
75
|
fullWidth: !0,
|
|
@@ -79,15 +79,15 @@ const R = ({
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
|
-
/* @__PURE__ */ t(
|
|
82
|
+
/* @__PURE__ */ t(c, { px: 1, children: "-" }),
|
|
83
83
|
/* @__PURE__ */ t(
|
|
84
84
|
b,
|
|
85
85
|
{
|
|
86
86
|
name: e.propertyId,
|
|
87
87
|
value: a.max ?? e.defaultValue ?? "",
|
|
88
|
-
size:
|
|
88
|
+
size: d,
|
|
89
89
|
onChange: h("max"),
|
|
90
|
-
variant:
|
|
90
|
+
variant: u,
|
|
91
91
|
type: "number",
|
|
92
92
|
disabled: !e.editable,
|
|
93
93
|
fullWidth: !0,
|
|
@@ -100,23 +100,25 @@ const R = ({
|
|
|
100
100
|
] })
|
|
101
101
|
] });
|
|
102
102
|
if (e.type === "date") {
|
|
103
|
-
const l = "DD/MM/YYYY", n = "YYYY-MM-DD", o = a.min &&
|
|
104
|
-
return /* @__PURE__ */ m(
|
|
105
|
-
/* @__PURE__ */ t(
|
|
106
|
-
/* @__PURE__ */ m(
|
|
103
|
+
const l = "DD/MM/YYYY", n = "YYYY-MM-DD", o = a.min && f(a.min, n, !0).isValid() ? f(a.min, n) : null, i = a.max && f(a.max, n, !0).isValid() ? f(a.max, n) : null;
|
|
104
|
+
return /* @__PURE__ */ m(r, { mb: 1, children: [
|
|
105
|
+
/* @__PURE__ */ t(c, { variant: "caption", mb: 0.5, display: "block", children: e.name }),
|
|
106
|
+
/* @__PURE__ */ m(r, { display: "flex", alignItems: "center", children: [
|
|
107
107
|
/* @__PURE__ */ t(
|
|
108
108
|
C,
|
|
109
109
|
{
|
|
110
|
+
label: "From",
|
|
110
111
|
value: o,
|
|
111
112
|
format: l,
|
|
112
113
|
views: ["year", "month", "day"],
|
|
113
114
|
slotProps: {
|
|
114
115
|
textField: {
|
|
115
|
-
variant:
|
|
116
|
+
variant: u,
|
|
116
117
|
name: e.propertyId,
|
|
117
|
-
size:
|
|
118
|
+
size: d,
|
|
118
119
|
fullWidth: !0,
|
|
119
|
-
inputProps: { sx: { fontSize: 12 } }
|
|
120
|
+
inputProps: { sx: { fontSize: 12 } },
|
|
121
|
+
InputLabelProps: { sx: { fontSize: 12 } }
|
|
120
122
|
},
|
|
121
123
|
inputAdornment: {
|
|
122
124
|
sx: {
|
|
@@ -129,21 +131,23 @@ const R = ({
|
|
|
129
131
|
onChange: g("min")
|
|
130
132
|
}
|
|
131
133
|
),
|
|
132
|
-
/* @__PURE__ */ t(
|
|
134
|
+
/* @__PURE__ */ t(c, { px: 1, children: "-" }),
|
|
133
135
|
/* @__PURE__ */ t(
|
|
134
136
|
C,
|
|
135
137
|
{
|
|
138
|
+
label: "To",
|
|
136
139
|
value: i,
|
|
137
140
|
format: l,
|
|
138
141
|
minDate: o !== null ? o : void 0,
|
|
139
142
|
views: ["year", "month", "day"],
|
|
140
143
|
slotProps: {
|
|
141
144
|
textField: {
|
|
142
|
-
variant:
|
|
145
|
+
variant: u,
|
|
143
146
|
name: e.propertyId,
|
|
144
|
-
size:
|
|
147
|
+
size: d,
|
|
145
148
|
fullWidth: !0,
|
|
146
|
-
inputProps: { sx: { fontSize: 12 } }
|
|
149
|
+
inputProps: { sx: { fontSize: 12 } },
|
|
150
|
+
InputLabelProps: { sx: { fontSize: 12 } }
|
|
147
151
|
},
|
|
148
152
|
inputAdornment: {
|
|
149
153
|
sx: {
|
|
@@ -160,14 +164,14 @@ const R = ({
|
|
|
160
164
|
] });
|
|
161
165
|
}
|
|
162
166
|
if (e.type === "boolean")
|
|
163
|
-
return /* @__PURE__ */ t(
|
|
167
|
+
return /* @__PURE__ */ t(r, { mb: 1, children: /* @__PURE__ */ t(
|
|
164
168
|
O,
|
|
165
169
|
{
|
|
166
170
|
label: e.name,
|
|
167
171
|
control: /* @__PURE__ */ t(
|
|
168
|
-
|
|
172
|
+
z,
|
|
169
173
|
{
|
|
170
|
-
size:
|
|
174
|
+
size: d,
|
|
171
175
|
name: e.propertyId,
|
|
172
176
|
checked: !!a,
|
|
173
177
|
onChange: h("exact")
|
|
@@ -181,23 +185,23 @@ const R = ({
|
|
|
181
185
|
}
|
|
182
186
|
) });
|
|
183
187
|
if (e.type === "enum" || e.type === "composite-list" && ((S = (I = e.dataTypeInfo) == null ? void 0 : I.innerType) == null ? void 0 : S.type) === "enum") {
|
|
184
|
-
const [l, n] =
|
|
188
|
+
const [l, n] = T(!1), o = 10;
|
|
185
189
|
let i = [];
|
|
186
|
-
return (y = e.dataTypeInfo) != null && y.enumValues && (i = e.dataTypeInfo.enumValues), (M = (V = e.dataTypeInfo) == null ? void 0 : V.innerType) != null && M.enumValues && (i = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ m(
|
|
187
|
-
/* @__PURE__ */ m(B, { fullWidth: !0, component: "fieldset", variant:
|
|
188
|
-
/* @__PURE__ */ t(
|
|
190
|
+
return (y = e.dataTypeInfo) != null && y.enumValues && (i = e.dataTypeInfo.enumValues), (M = (V = e.dataTypeInfo) == null ? void 0 : V.innerType) != null && M.enumValues && (i = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ m(r, { mb: 1, children: [
|
|
191
|
+
/* @__PURE__ */ m(B, { fullWidth: !0, component: "fieldset", variant: u, children: [
|
|
192
|
+
/* @__PURE__ */ t(Y, { component: "legend", sx: { mb: 1, fontSize: 12 }, children: e.name }),
|
|
189
193
|
/* @__PURE__ */ t(D, { children: i.slice(0, l ? 9999 : o).map((s, x) => /* @__PURE__ */ t(
|
|
190
194
|
O,
|
|
191
195
|
{
|
|
192
196
|
label: s,
|
|
193
197
|
control: /* @__PURE__ */ t(
|
|
194
|
-
|
|
198
|
+
z,
|
|
195
199
|
{
|
|
196
200
|
name: e.propertyId,
|
|
197
201
|
value: s,
|
|
198
202
|
size: "small",
|
|
199
203
|
checked: a.atLeastOneOf ? a.atLeastOneOf.includes(s) : !1,
|
|
200
|
-
onChange:
|
|
204
|
+
onChange: F,
|
|
201
205
|
sx: {
|
|
202
206
|
p: 0,
|
|
203
207
|
mr: 1,
|
|
@@ -226,7 +230,7 @@ const R = ({
|
|
|
226
230
|
{
|
|
227
231
|
size: "small",
|
|
228
232
|
sx: { p: 0, textTransform: "none", fontSize: 12 },
|
|
229
|
-
endIcon: l ? /* @__PURE__ */ t(
|
|
233
|
+
endIcon: l ? /* @__PURE__ */ t(k, { sx: { fontSize: 14 } }) : /* @__PURE__ */ t(w, { sx: { fontSize: 14 } }),
|
|
230
234
|
onClick: () => n((s) => !s),
|
|
231
235
|
children: [
|
|
232
236
|
"Show ",
|
|
@@ -236,7 +240,7 @@ const R = ({
|
|
|
236
240
|
)
|
|
237
241
|
] });
|
|
238
242
|
}
|
|
239
|
-
return /* @__PURE__ */ t(
|
|
243
|
+
return /* @__PURE__ */ t(P, {});
|
|
240
244
|
};
|
|
241
245
|
export {
|
|
242
246
|
R as Property
|
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 {
|