@hybridcore/ui 1.5.4 → 1.5.7
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/instance-form/components/composite-list/index.js +1 -1
- package/dist/components/instance-form/components/policy-list/index.js +0 -1
- package/dist/components/instance-form/components/variable/index.js +2 -2
- package/dist/components/instance-form/components/variables/index.js +45 -41
- package/dist/components/instance-form/index.js +293 -276
- package/dist/components/property-mapping/index.js +47 -48
- package/dist/index-D-mTkx9Q.js +349 -0
- package/dist/main.d.ts +2 -1
- package/package.json +1 -1
- package/dist/index-JgBxaIU2.js +0 -353
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as c, jsx as i, Fragment as
|
|
1
|
+
import { jsxs as c, jsx as i, Fragment as b } from "react/jsx-runtime";
|
|
2
2
|
import { CloseOutlined as le, ChevronRight as ie, ErrorOutline as ne, Check as oe, Refresh as ae } from "@mui/icons-material";
|
|
3
|
-
import { Dialog as de, DialogTitle as
|
|
3
|
+
import { Dialog as de, DialogTitle as pe, Box as m, Typography as $, TextField as R, IconButton as J, DialogContent as se, DialogActions as ce, Button as W, FormControl as V, Select as _, MenuItem as A } from "@mui/material";
|
|
4
4
|
import { DataGrid as fe } from "@mui/x-data-grid";
|
|
5
5
|
import { useState as H, useEffect as ue } from "react";
|
|
6
6
|
import h from "lodash";
|
|
7
7
|
import { e as ye } from "../../ol-9hySGI6D.js";
|
|
8
|
-
import { V as he } from "../../index-
|
|
8
|
+
import { V as he } from "../../index-D-mTkx9Q.js";
|
|
9
9
|
import { RangeSelector as me } from "../range-selector/index.js";
|
|
10
10
|
const $e = ({
|
|
11
11
|
open: F,
|
|
@@ -30,12 +30,12 @@ const $e = ({
|
|
|
30
30
|
const Q = () => {
|
|
31
31
|
a ? M(a, !0) : M(k);
|
|
32
32
|
}, D = (n) => {
|
|
33
|
-
const { name: d, value:
|
|
34
|
-
let o =
|
|
33
|
+
const { name: d, value: p } = n.target;
|
|
34
|
+
let o = p;
|
|
35
35
|
d === "criticalityScore" && (o = o.replace(",", "."), o = o.replace(/[^\d.-]+/g, "")), X(d)(o);
|
|
36
36
|
}, X = (n) => (d) => {
|
|
37
37
|
a && M({ ...a, [n]: d });
|
|
38
|
-
}, S = (n, d,
|
|
38
|
+
}, S = (n, d, p, o) => (r) => {
|
|
39
39
|
if (a) {
|
|
40
40
|
let t = [...a.propertyInfoMap];
|
|
41
41
|
const e = t.findIndex(
|
|
@@ -46,13 +46,13 @@ const $e = ({
|
|
|
46
46
|
t.splice(e, 1, {
|
|
47
47
|
...t[e],
|
|
48
48
|
value: l,
|
|
49
|
-
source:
|
|
49
|
+
source: p ? p || "" : t[e].source,
|
|
50
50
|
sourceField: o !== void 0 ? o || "" : t[e].sourceField
|
|
51
51
|
}), M && M({ ...a, propertyInfoMap: t });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}, Y = (n) => () => {
|
|
55
|
-
const { policyKey: d, key:
|
|
55
|
+
const { policyKey: d, key: p, source: o, sourceField: r } = n;
|
|
56
56
|
let t = "";
|
|
57
57
|
if (o === "OBJECT")
|
|
58
58
|
t = h.get(
|
|
@@ -70,10 +70,10 @@ const $e = ({
|
|
|
70
70
|
v
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
t && (S(d,
|
|
73
|
+
t && (S(d, p)({ value: t }), N((e) => {
|
|
74
74
|
const l = new Map(e);
|
|
75
75
|
return l.set(
|
|
76
|
-
`${h.get(a, "referenceObjectInstanceId")}:${d}:${
|
|
76
|
+
`${h.get(a, "referenceObjectInstanceId")}:${d}:${p}`,
|
|
77
77
|
"Updated"
|
|
78
78
|
), l;
|
|
79
79
|
}), setTimeout(() => {
|
|
@@ -83,12 +83,12 @@ const $e = ({
|
|
|
83
83
|
`${h.get(
|
|
84
84
|
a,
|
|
85
85
|
"referenceObjectInstanceId"
|
|
86
|
-
)}:${d}:${
|
|
86
|
+
)}:${d}:${p}`,
|
|
87
87
|
"Default"
|
|
88
88
|
), l;
|
|
89
89
|
});
|
|
90
90
|
}, 2e3));
|
|
91
|
-
}, Z = (n, d) => (
|
|
91
|
+
}, Z = (n, d) => (p) => {
|
|
92
92
|
if (a) {
|
|
93
93
|
let o = [...a.propertyInfoMap];
|
|
94
94
|
const r = o.findIndex(
|
|
@@ -96,14 +96,14 @@ const $e = ({
|
|
|
96
96
|
);
|
|
97
97
|
o[r] && (o.splice(r, 1, {
|
|
98
98
|
...o[r],
|
|
99
|
-
randomInfo:
|
|
99
|
+
randomInfo: p
|
|
100
100
|
}), M && M({ ...a, propertyInfoMap: o }));
|
|
101
101
|
}
|
|
102
102
|
}, ee = (n) => (d) => {
|
|
103
|
-
const
|
|
103
|
+
const p = d.target.name;
|
|
104
104
|
let o = [...k];
|
|
105
105
|
const r = o[n], t = r.propertyMappings.findIndex(
|
|
106
|
-
(l) => l.key ===
|
|
106
|
+
(l) => l.key === p
|
|
107
107
|
), e = r.propertyMappings[t];
|
|
108
108
|
h.set(
|
|
109
109
|
o,
|
|
@@ -120,10 +120,10 @@ const $e = ({
|
|
|
120
120
|
""
|
|
121
121
|
)({ value: "" });
|
|
122
122
|
}, re = (n) => (d) => {
|
|
123
|
-
const
|
|
123
|
+
const p = d.target.name;
|
|
124
124
|
let o = [...k];
|
|
125
125
|
const r = o[n], t = r.propertyMappings.findIndex(
|
|
126
|
-
(l) => l.key ===
|
|
126
|
+
(l) => l.key === p
|
|
127
127
|
), e = r.propertyMappings[t];
|
|
128
128
|
if (h.set(
|
|
129
129
|
o,
|
|
@@ -170,7 +170,7 @@ const $e = ({
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}, te = (n, d) => {
|
|
173
|
-
let
|
|
173
|
+
let p = {
|
|
174
174
|
field: "value",
|
|
175
175
|
headerName: "Value",
|
|
176
176
|
sortable: !1,
|
|
@@ -180,14 +180,14 @@ const $e = ({
|
|
|
180
180
|
renderCell: (r) => {
|
|
181
181
|
var x, g;
|
|
182
182
|
const { key: t, dataType: e } = r.row;
|
|
183
|
-
let l = "", u = /* @__PURE__ */ i(
|
|
183
|
+
let l = "", u = /* @__PURE__ */ i(b, {}), y = /* @__PURE__ */ i(b, {}), s = r.row.source;
|
|
184
184
|
if (T && a) {
|
|
185
185
|
const f = a.propertyInfoMap.find(
|
|
186
|
-
(
|
|
186
|
+
(w) => w.key === t && w.policyKey === n.key
|
|
187
187
|
);
|
|
188
188
|
if (f) {
|
|
189
|
-
const { valid:
|
|
190
|
-
l = f.value,
|
|
189
|
+
const { valid: w, validationErrors: z } = f;
|
|
190
|
+
l = f.value, s = f.source, w === !1 && (u = /* @__PURE__ */ i(
|
|
191
191
|
ne,
|
|
192
192
|
{
|
|
193
193
|
color: "error",
|
|
@@ -195,20 +195,20 @@ const $e = ({
|
|
|
195
195
|
sx: { ml: 1 },
|
|
196
196
|
titleAccess: z ? z.join(", ") : "Value is not valid!"
|
|
197
197
|
}
|
|
198
|
-
)),
|
|
198
|
+
)), s && (L.get(
|
|
199
199
|
`${h.get(a, "referenceObjectInstanceId")}:${f.policyKey}:${f.key}`
|
|
200
200
|
) === "Updated" ? y = /* @__PURE__ */ i(oe, { color: "success", sx: { mr: 1 }, titleAccess: "Updated" }) : y = /* @__PURE__ */ i(
|
|
201
201
|
J,
|
|
202
202
|
{
|
|
203
203
|
onClick: Y(f),
|
|
204
|
-
title: `Reload value from the ${
|
|
204
|
+
title: `Reload value from the ${s === "OBJECT" ? "Object" : "Catalogue"}`,
|
|
205
205
|
children: /* @__PURE__ */ i(ae, {})
|
|
206
206
|
}
|
|
207
207
|
));
|
|
208
208
|
}
|
|
209
|
-
if (
|
|
210
|
-
const
|
|
211
|
-
return /* @__PURE__ */ c(
|
|
209
|
+
if (s === "STATIC") {
|
|
210
|
+
const w = (x = C == null ? void 0 : C.environment.context) != null && x.boundingBox ? ye(C.environment.context.boundingBox) : void 0;
|
|
211
|
+
return /* @__PURE__ */ c(b, { children: [
|
|
212
212
|
/* @__PURE__ */ i(
|
|
213
213
|
he,
|
|
214
214
|
{
|
|
@@ -224,16 +224,15 @@ const $e = ({
|
|
|
224
224
|
variant: "outlined",
|
|
225
225
|
value: l,
|
|
226
226
|
size: "small",
|
|
227
|
-
|
|
228
|
-
defaultExtent: b,
|
|
227
|
+
defaultExtent: w,
|
|
229
228
|
onChange: S(n.key, t)
|
|
230
229
|
}
|
|
231
230
|
),
|
|
232
231
|
u
|
|
233
232
|
] });
|
|
234
233
|
}
|
|
235
|
-
if (
|
|
236
|
-
return /* @__PURE__ */ c(
|
|
234
|
+
if (s === "RANDOM" || s === "SMART_RANDOM")
|
|
235
|
+
return /* @__PURE__ */ c(b, { children: [
|
|
237
236
|
/* @__PURE__ */ i(
|
|
238
237
|
me,
|
|
239
238
|
{
|
|
@@ -366,23 +365,23 @@ const $e = ({
|
|
|
366
365
|
const { dataType: t } = r.row;
|
|
367
366
|
let e = r.row.source, l = r.row.sourceField;
|
|
368
367
|
if (a) {
|
|
369
|
-
const
|
|
368
|
+
const s = a.propertyInfoMap.find(
|
|
370
369
|
(x) => x.policyKey === n.key && x.key === r.id
|
|
371
370
|
);
|
|
372
|
-
|
|
371
|
+
s && (e = s.source, l = s.sourceField || "");
|
|
373
372
|
}
|
|
374
373
|
let u = l || "";
|
|
375
374
|
if (e === "RANDOM" || e === "STATIC" || e === "SMART_RANDOM")
|
|
376
|
-
return /* @__PURE__ */ i(
|
|
375
|
+
return /* @__PURE__ */ i(b, {});
|
|
377
376
|
let y = [];
|
|
378
377
|
if (e === "OBJECT")
|
|
379
|
-
y = q.properties.map((
|
|
380
|
-
value:
|
|
381
|
-
text:
|
|
378
|
+
y = q.properties.map((s) => ({
|
|
379
|
+
value: s.propertyId,
|
|
380
|
+
text: s.name
|
|
382
381
|
}));
|
|
383
382
|
else if (e !== null) {
|
|
384
|
-
const
|
|
385
|
-
(g) => g.id ===
|
|
383
|
+
const s = Number(e), x = v == null ? void 0 : v.find(
|
|
384
|
+
(g) => g.id === s
|
|
386
385
|
);
|
|
387
386
|
if (x && K) {
|
|
388
387
|
const g = K.find(
|
|
@@ -401,7 +400,7 @@ const $e = ({
|
|
|
401
400
|
name: String(r.id),
|
|
402
401
|
value: u,
|
|
403
402
|
children: [
|
|
404
|
-
y.map((
|
|
403
|
+
y.map((s, x) => /* @__PURE__ */ i(A, { value: s.value, children: s.text }, x)),
|
|
405
404
|
y.length === 0 && /* @__PURE__ */ c(A, { disabled: !0, children: [
|
|
406
405
|
"No ",
|
|
407
406
|
t.type,
|
|
@@ -413,18 +412,18 @@ const $e = ({
|
|
|
413
412
|
}
|
|
414
413
|
}
|
|
415
414
|
];
|
|
416
|
-
return T ? [...o,
|
|
415
|
+
return T ? [...o, p] : o;
|
|
417
416
|
};
|
|
418
417
|
return /* @__PURE__ */ c(de, { open: F, fullWidth: !0, maxWidth: "lg", onClose: O, children: [
|
|
419
418
|
/* @__PURE__ */ c(
|
|
420
|
-
|
|
419
|
+
pe,
|
|
421
420
|
{
|
|
422
421
|
component: "div",
|
|
423
422
|
lineHeight: 1,
|
|
424
423
|
display: "flex",
|
|
425
424
|
justifyContent: "space-between",
|
|
426
425
|
children: [
|
|
427
|
-
/* @__PURE__ */ i(m, { children: a === void 0 ? /* @__PURE__ */ c(
|
|
426
|
+
/* @__PURE__ */ i(m, { children: a === void 0 ? /* @__PURE__ */ c(b, { children: [
|
|
428
427
|
/* @__PURE__ */ i($, { variant: "h6", children: "Property Mapping" }),
|
|
429
428
|
/* @__PURE__ */ i($, { variant: "caption", children: "Map policy properties with object template or catalog istance properties" })
|
|
430
429
|
] }) : /* @__PURE__ */ c(m, { display: "flex", flex: 1, alignItems: "flex-start", children: [
|
|
@@ -502,17 +501,17 @@ const $e = ({
|
|
|
502
501
|
]
|
|
503
502
|
}
|
|
504
503
|
),
|
|
505
|
-
/* @__PURE__ */ i(
|
|
504
|
+
/* @__PURE__ */ i(se, { sx: { minHeight: 300 }, children: k.map((n, d) => /* @__PURE__ */ c(
|
|
506
505
|
m,
|
|
507
506
|
{
|
|
508
|
-
boxShadow: (
|
|
507
|
+
boxShadow: (p) => p.shadows[1],
|
|
509
508
|
mt: 0.1,
|
|
510
509
|
mb: 2,
|
|
511
510
|
overflow: "hidden",
|
|
512
511
|
borderRadius: 1,
|
|
513
512
|
children: [
|
|
514
513
|
/* @__PURE__ */ c(m, { display: "flex", alignItems: "center", p: 2, children: [
|
|
515
|
-
/* @__PURE__ */ i($, { children: n.catalogInstances.map((
|
|
514
|
+
/* @__PURE__ */ i($, { children: n.catalogInstances.map((p) => p.name).join(", ") }),
|
|
516
515
|
/* @__PURE__ */ i(ie, { color: "disabled", sx: { mx: 1 } }),
|
|
517
516
|
/* @__PURE__ */ i($, { variant: "caption", color: "GrayText", children: n.name || n.key })
|
|
518
517
|
] }),
|
|
@@ -526,12 +525,12 @@ const $e = ({
|
|
|
526
525
|
sx: {
|
|
527
526
|
border: "none",
|
|
528
527
|
"& .MuiDataGrid-columnHeadersInner": {
|
|
529
|
-
backgroundColor: (
|
|
528
|
+
backgroundColor: (p) => p.palette.grey[200]
|
|
530
529
|
}
|
|
531
530
|
},
|
|
532
531
|
hideFooterPagination: !0,
|
|
533
532
|
hideFooter: !0,
|
|
534
|
-
getRowId: (
|
|
533
|
+
getRowId: (p) => p.key
|
|
535
534
|
}
|
|
536
535
|
)
|
|
537
536
|
]
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { jsxs as h, Fragment as M, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import I from "lodash";
|
|
3
|
+
import q from "dayjs";
|
|
4
|
+
import { FormControl as B, FormLabel as N, FormGroup as W, FormControlLabel as j, Checkbox as Y, Typography as P, Button as F, Chip as $, Dialog as v, DialogTitle as _, DialogContent as E, DialogActions as G, InputAdornment as H, Tooltip as K } from "@mui/material";
|
|
5
|
+
import { Container as R, Values as U, MiniButton as J } from "./components/instance-form/components/composite-list/styled.js";
|
|
6
|
+
import { KeyboardArrowUp as Q, KeyboardArrowDown as X, Add as Z, LockOutlined as z } from "@mui/icons-material";
|
|
7
|
+
import O from "./hooks/useToggle.js";
|
|
8
|
+
import { GeometryPicker as ee } from "./components/geometry-picker/index.js";
|
|
9
|
+
import { PhoneInput as ne } from "./components/phone-input/index.js";
|
|
10
|
+
import { DateTimePicker as ae } from "./components/date-time-picker/index.js";
|
|
11
|
+
import { T as p } from "./TextField-BjFXx91l.js";
|
|
12
|
+
import { F as le } from "./FormControlLabel-BNT5EI0b.js";
|
|
13
|
+
import { C as te } from "./Checkbox-B0P8LhCl.js";
|
|
14
|
+
import { F as oe, I as de } from "./InputLabel-ClDXuWBr.js";
|
|
15
|
+
import { S as ie } from "./Select-ush_fSWy.js";
|
|
16
|
+
import { M as re } from "./MenuItem-Lcjh1XlV.js";
|
|
17
|
+
import { B as L } from "./Box-SSMZuKnS.js";
|
|
18
|
+
import { useState as S } from "react";
|
|
19
|
+
function me({
|
|
20
|
+
property: i,
|
|
21
|
+
mapboxAccessToken: e,
|
|
22
|
+
value: a,
|
|
23
|
+
variant: u = "outlined",
|
|
24
|
+
size: r = "medium",
|
|
25
|
+
onChange: g
|
|
26
|
+
}) {
|
|
27
|
+
var C, V, l;
|
|
28
|
+
const d = O(!1), [m, T] = S(), [b, w] = S(!1), x = 10, A = (t) => {
|
|
29
|
+
T(I.get(t, i.propertyId));
|
|
30
|
+
}, y = () => {
|
|
31
|
+
g([...a || [], m]), T(""), d.action.close();
|
|
32
|
+
}, D = (t) => () => {
|
|
33
|
+
if (a) {
|
|
34
|
+
const o = [...a];
|
|
35
|
+
o.splice(t, 1), g(o);
|
|
36
|
+
}
|
|
37
|
+
}, k = (t) => {
|
|
38
|
+
const { value: o, checked: c } = t.target;
|
|
39
|
+
let s = I.isArray(a) ? a : [];
|
|
40
|
+
c ? s.push(o) : s = s.filter((f) => f !== o), g(s);
|
|
41
|
+
};
|
|
42
|
+
if (((V = (C = i.dataTypeInfo) == null ? void 0 : C.innerType) == null ? void 0 : V.type) === "enum") {
|
|
43
|
+
const { enumValues: t } = i.dataTypeInfo.innerType;
|
|
44
|
+
return /* @__PURE__ */ h(M, { children: [
|
|
45
|
+
/* @__PURE__ */ h(B, { fullWidth: !0, component: "fieldset", variant: u, children: [
|
|
46
|
+
/* @__PURE__ */ n(N, { component: "legend", sx: { mb: 1 }, children: i.name }),
|
|
47
|
+
/* @__PURE__ */ n(W, { children: t && t.length > 0 ? t.slice(0, b ? 9999 : x).map((o, c) => /* @__PURE__ */ n(
|
|
48
|
+
j,
|
|
49
|
+
{
|
|
50
|
+
label: o,
|
|
51
|
+
control: /* @__PURE__ */ n(
|
|
52
|
+
Y,
|
|
53
|
+
{
|
|
54
|
+
name: i.propertyId,
|
|
55
|
+
value: o,
|
|
56
|
+
size: "small",
|
|
57
|
+
checked: I.isArray(a) ? a.includes(o) : !1,
|
|
58
|
+
onChange: k
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
componentsProps: {
|
|
62
|
+
typography: {
|
|
63
|
+
variant: "body2"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
c
|
|
68
|
+
)) : /* @__PURE__ */ n(P, { variant: "caption", mb: 1, children: "No enum values!" }) })
|
|
69
|
+
] }),
|
|
70
|
+
I.isArray(t) && t.length > x && /* @__PURE__ */ h(
|
|
71
|
+
F,
|
|
72
|
+
{
|
|
73
|
+
size: "small",
|
|
74
|
+
sx: { p: 0, textTransform: "none" },
|
|
75
|
+
endIcon: b ? /* @__PURE__ */ n(Q, {}) : /* @__PURE__ */ n(X, {}),
|
|
76
|
+
onClick: () => w((o) => !o),
|
|
77
|
+
children: [
|
|
78
|
+
"Show ",
|
|
79
|
+
b ? "Less" : "More"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
return /* @__PURE__ */ h(M, { children: [
|
|
86
|
+
/* @__PURE__ */ h(R, { variant: u, children: [
|
|
87
|
+
/* @__PURE__ */ n(P, { children: i.name }),
|
|
88
|
+
/* @__PURE__ */ n(U, { children: I.isArray(a) && a.map((t, o) => {
|
|
89
|
+
var c, s;
|
|
90
|
+
return /* @__PURE__ */ n(
|
|
91
|
+
$,
|
|
92
|
+
{
|
|
93
|
+
label: ((s = (c = i.dataTypeInfo) == null ? void 0 : c.innerType) == null ? void 0 : s.type) === "date" ? q(t).format("DD/MM/YYYY HH:mm:ss") : t,
|
|
94
|
+
size: r,
|
|
95
|
+
onDelete: D(o)
|
|
96
|
+
},
|
|
97
|
+
o
|
|
98
|
+
);
|
|
99
|
+
}) }),
|
|
100
|
+
/* @__PURE__ */ n(
|
|
101
|
+
J,
|
|
102
|
+
{
|
|
103
|
+
startIcon: /* @__PURE__ */ n(Z, {}),
|
|
104
|
+
variant: "text",
|
|
105
|
+
onClick: d.action.open,
|
|
106
|
+
children: "Add"
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ h(
|
|
111
|
+
v,
|
|
112
|
+
{
|
|
113
|
+
open: d.state.isOpen,
|
|
114
|
+
onClose: d.action.close,
|
|
115
|
+
maxWidth: "sm",
|
|
116
|
+
fullWidth: !0,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ n(_, { children: "Add List Value" }),
|
|
119
|
+
/* @__PURE__ */ n(E, { children: (l = i.dataTypeInfo) != null && l.innerType ? /* @__PURE__ */ n(
|
|
120
|
+
ce,
|
|
121
|
+
{
|
|
122
|
+
mapboxAccessToken: e,
|
|
123
|
+
property: {
|
|
124
|
+
...i,
|
|
125
|
+
name: "Value",
|
|
126
|
+
type: i.dataTypeInfo.innerType.type
|
|
127
|
+
},
|
|
128
|
+
value: m,
|
|
129
|
+
onChange: A
|
|
130
|
+
}
|
|
131
|
+
) : null }),
|
|
132
|
+
/* @__PURE__ */ h(G, { children: [
|
|
133
|
+
/* @__PURE__ */ n(
|
|
134
|
+
F,
|
|
135
|
+
{
|
|
136
|
+
variant: "contained",
|
|
137
|
+
color: "inherit",
|
|
138
|
+
onClick: d.action.close,
|
|
139
|
+
children: "Cancel"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ n(F, { variant: "contained", color: "primary", onClick: y, children: "Ok" })
|
|
143
|
+
] })
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] });
|
|
148
|
+
}
|
|
149
|
+
function ce({
|
|
150
|
+
mapboxAccessToken: i,
|
|
151
|
+
property: e,
|
|
152
|
+
value: a,
|
|
153
|
+
variant: u = "standard",
|
|
154
|
+
size: r = "medium",
|
|
155
|
+
defaultExtent: g,
|
|
156
|
+
fieldOptions: d,
|
|
157
|
+
// keyAuth,
|
|
158
|
+
onChange: m
|
|
159
|
+
}) {
|
|
160
|
+
var k, C, V;
|
|
161
|
+
const T = (l) => {
|
|
162
|
+
const o = l.target.value.split(",").map((c) => c.trimStart());
|
|
163
|
+
m({
|
|
164
|
+
[e.propertyId]: o
|
|
165
|
+
});
|
|
166
|
+
}, b = (l) => {
|
|
167
|
+
const { name: t, type: o, checked: c, value: s } = l.target;
|
|
168
|
+
let f = s;
|
|
169
|
+
e.type === "double" && (f = f.replace(",", "."), f = f.replace(/[^\d.-]+/g, "")), m({
|
|
170
|
+
[t]: o === "checkbox" ? c : f
|
|
171
|
+
});
|
|
172
|
+
}, w = (l) => {
|
|
173
|
+
m({
|
|
174
|
+
[e.propertyId]: l
|
|
175
|
+
});
|
|
176
|
+
}, x = (l) => {
|
|
177
|
+
m({
|
|
178
|
+
[e.propertyId]: l.target.value
|
|
179
|
+
});
|
|
180
|
+
}, A = (l) => (t) => {
|
|
181
|
+
m({
|
|
182
|
+
[l]: t
|
|
183
|
+
});
|
|
184
|
+
}, y = (l) => (t) => {
|
|
185
|
+
m({
|
|
186
|
+
[l]: t
|
|
187
|
+
});
|
|
188
|
+
}, D = (l) => (t) => {
|
|
189
|
+
m({
|
|
190
|
+
[l]: t
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
if ([
|
|
194
|
+
"string",
|
|
195
|
+
"integer",
|
|
196
|
+
"double",
|
|
197
|
+
"text",
|
|
198
|
+
"long",
|
|
199
|
+
"byte",
|
|
200
|
+
"bank-account"
|
|
201
|
+
].includes(e.type))
|
|
202
|
+
return /* @__PURE__ */ n(
|
|
203
|
+
p,
|
|
204
|
+
{
|
|
205
|
+
label: e.name,
|
|
206
|
+
name: e.propertyId,
|
|
207
|
+
required: e.required,
|
|
208
|
+
value: a ?? e.defaultValue ?? "",
|
|
209
|
+
defaultValue: a,
|
|
210
|
+
onChange: b,
|
|
211
|
+
variant: u,
|
|
212
|
+
type: "text",
|
|
213
|
+
multiline: e.type === "text",
|
|
214
|
+
disabled: !e.editable,
|
|
215
|
+
fullWidth: !0,
|
|
216
|
+
InputProps: {
|
|
217
|
+
size: r,
|
|
218
|
+
...d && d[e.propertyId] && {
|
|
219
|
+
tabIndex: d[e.propertyId].order
|
|
220
|
+
},
|
|
221
|
+
...e.privacyPreservationMethod === "ENCRYPTION" ? {
|
|
222
|
+
endAdornment: /* @__PURE__ */ n(H, { position: "end", children: /* @__PURE__ */ n(K, { title: "Encrypted Field", children: /* @__PURE__ */ n(z, {}) }) })
|
|
223
|
+
} : {}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
if (e.type === "date") {
|
|
228
|
+
const l = a !== void 0 ? q(a).format() : a;
|
|
229
|
+
return /* @__PURE__ */ n(
|
|
230
|
+
ae,
|
|
231
|
+
{
|
|
232
|
+
label: e.name,
|
|
233
|
+
value: l,
|
|
234
|
+
variant: u,
|
|
235
|
+
size: r,
|
|
236
|
+
name: e.propertyId,
|
|
237
|
+
onChange: w,
|
|
238
|
+
...d && d[e.propertyId] && {
|
|
239
|
+
minDate: d[e.propertyId].minDate
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
if (e.type === "list") {
|
|
245
|
+
let l = "";
|
|
246
|
+
return e.defaultValue && (l = I.isArray(e.defaultValue) ? a.join(", ") : e.defaultValue), a && (l = I.isArray(a) ? a.join(",") : a), /* @__PURE__ */ n(
|
|
247
|
+
p,
|
|
248
|
+
{
|
|
249
|
+
label: e.name,
|
|
250
|
+
name: e.propertyId,
|
|
251
|
+
value: l,
|
|
252
|
+
onChange: T,
|
|
253
|
+
variant: u,
|
|
254
|
+
disabled: !e.editable,
|
|
255
|
+
required: e.required,
|
|
256
|
+
fullWidth: !0,
|
|
257
|
+
helperText: r === "small" ? null : "Add list values with the comma (,) separated string",
|
|
258
|
+
InputProps: {
|
|
259
|
+
size: r,
|
|
260
|
+
placeholder: r === "small" ? "Add list values with the comma (,) separated string" : "",
|
|
261
|
+
...d && d[e.propertyId] && {
|
|
262
|
+
tabIndex: d[e.propertyId].order
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
if (e.type === "boolean")
|
|
269
|
+
return /* @__PURE__ */ n(
|
|
270
|
+
le,
|
|
271
|
+
{
|
|
272
|
+
control: /* @__PURE__ */ n(
|
|
273
|
+
te,
|
|
274
|
+
{
|
|
275
|
+
name: e.propertyId,
|
|
276
|
+
checked: !!a,
|
|
277
|
+
onChange: b,
|
|
278
|
+
size: r
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
label: e.name
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
if (e.type === "enum") {
|
|
285
|
+
let l = [];
|
|
286
|
+
return (k = e.dataTypeInfo) != null && k.enumValues && (l = e.dataTypeInfo.enumValues), (V = (C = e.dataTypeInfo) == null ? void 0 : C.innerType) != null && V.enumValues && (l = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ h(
|
|
287
|
+
oe,
|
|
288
|
+
{
|
|
289
|
+
fullWidth: !0,
|
|
290
|
+
variant: u,
|
|
291
|
+
size: r,
|
|
292
|
+
required: e.required,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ n(de, { id: `${e.propertyId}-label`, children: e.name }),
|
|
295
|
+
/* @__PURE__ */ n(
|
|
296
|
+
ie,
|
|
297
|
+
{
|
|
298
|
+
label: e.name,
|
|
299
|
+
name: e.name,
|
|
300
|
+
labelId: `${e.propertyId}-label`,
|
|
301
|
+
id: e.propertyId,
|
|
302
|
+
value: a ?? "",
|
|
303
|
+
onChange: x,
|
|
304
|
+
inputProps: {
|
|
305
|
+
...d && d[e.propertyId] && {
|
|
306
|
+
tabIndex: d[e.propertyId].order
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
children: l.map((t, o) => /* @__PURE__ */ n(re, { value: t, children: t }, o))
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
return e.type === "geometry" ? /* @__PURE__ */ n(L, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
|
|
317
|
+
ee,
|
|
318
|
+
{
|
|
319
|
+
mapboxAccessToken: i,
|
|
320
|
+
label: e.name,
|
|
321
|
+
value: a ?? e.defaultValue ?? "",
|
|
322
|
+
defaultExtent: g,
|
|
323
|
+
variant: u,
|
|
324
|
+
onChange: A(e.propertyId)
|
|
325
|
+
}
|
|
326
|
+
) }) : e.type === "phone-number" ? /* @__PURE__ */ n(L, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
|
|
327
|
+
ne,
|
|
328
|
+
{
|
|
329
|
+
label: e.name,
|
|
330
|
+
placeholder: "Enter phone number",
|
|
331
|
+
value: a ?? e.defaultValue ?? "",
|
|
332
|
+
onChange: y(e.propertyId)
|
|
333
|
+
}
|
|
334
|
+
) }) : e.type === "composite-list" ? /* @__PURE__ */ n(L, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
|
|
335
|
+
me,
|
|
336
|
+
{
|
|
337
|
+
property: e,
|
|
338
|
+
value: a ?? e.defaultValue ?? "",
|
|
339
|
+
variant: u,
|
|
340
|
+
size: r,
|
|
341
|
+
mapboxAccessToken: i,
|
|
342
|
+
onChange: D(e.propertyId)
|
|
343
|
+
}
|
|
344
|
+
) }) : /* @__PURE__ */ n(M, {});
|
|
345
|
+
}
|
|
346
|
+
export {
|
|
347
|
+
me as C,
|
|
348
|
+
ce as V
|
|
349
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -228,6 +228,7 @@ declare interface FieldOptions {
|
|
|
228
228
|
hidden?: boolean;
|
|
229
229
|
disabled?: boolean;
|
|
230
230
|
minDate?: Dayjs;
|
|
231
|
+
helperText?: React.ReactNode;
|
|
231
232
|
[key: string]: string | number | object | boolean;
|
|
232
233
|
}
|
|
233
234
|
|
|
@@ -380,7 +381,7 @@ K extends
|
|
|
380
381
|
/**
|
|
381
382
|
*
|
|
382
383
|
*/
|
|
383
|
-
onCancel?(): void;
|
|
384
|
+
onCancel?(isDirty?: boolean): void;
|
|
384
385
|
}
|
|
385
386
|
|
|
386
387
|
export declare const InstanceHierarchyTable: FC<InstanceHierarchyTableProps>;
|