@hybridcore/ui 1.5.47 → 1.5.49
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,41 +1,41 @@
|
|
|
1
|
-
import { jsxs as f, jsx as i, Fragment as
|
|
1
|
+
import { jsxs as f, jsx as i, Fragment as T } 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 pe, Box as m, Typography as
|
|
3
|
+
import { Dialog as de, DialogTitle as pe, Box as m, Typography as b, TextField as R, IconButton as J, DialogContent as se, DialogActions as ce, Button as W, FormControl as V, Select as _, MenuItem as k } from "@mui/material";
|
|
4
4
|
import { DataGrid as fe } from "@mui/x-data-grid";
|
|
5
|
-
import { useState as
|
|
5
|
+
import { useState as G, useEffect as ue } from "react";
|
|
6
6
|
import h from "lodash";
|
|
7
7
|
import { d as ye } from "../../ol-lGwSyEIV.js";
|
|
8
8
|
import { V as he } from "../../index-OtGK6phq.js";
|
|
9
9
|
import { RangeSelector as me } from "../range-selector/index.js";
|
|
10
10
|
const $e = ({
|
|
11
11
|
open: F,
|
|
12
|
-
data:
|
|
13
|
-
objectTemplate:
|
|
12
|
+
data: H,
|
|
13
|
+
objectTemplate: P,
|
|
14
14
|
agent: a,
|
|
15
|
-
enableValueInput:
|
|
15
|
+
enableValueInput: S,
|
|
16
16
|
loading: B,
|
|
17
17
|
agentTemplates: K,
|
|
18
18
|
catalogueInstances: v,
|
|
19
19
|
objectInstance: I,
|
|
20
|
-
disableCatalogueSource:
|
|
21
|
-
disableObjectSource:
|
|
22
|
-
scenario:
|
|
20
|
+
disableCatalogueSource: U,
|
|
21
|
+
disableObjectSource: q,
|
|
22
|
+
scenario: M,
|
|
23
23
|
mapboxAccessToken: E,
|
|
24
|
-
onSubmit:
|
|
24
|
+
onSubmit: g,
|
|
25
25
|
onClose: O
|
|
26
26
|
}) => {
|
|
27
|
-
const [
|
|
27
|
+
const [$, j] = G(H), [L, N] = G(/* @__PURE__ */ new Map());
|
|
28
28
|
ue(() => (N(/* @__PURE__ */ new Map()), () => {
|
|
29
29
|
}), [F]);
|
|
30
30
|
const Q = () => {
|
|
31
|
-
a ?
|
|
31
|
+
a ? g(a, !0) : g($);
|
|
32
32
|
}, D = (n) => {
|
|
33
33
|
const { name: d, value: p } = n.target;
|
|
34
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
|
-
a &&
|
|
38
|
-
},
|
|
37
|
+
a && g({ ...a, [n]: d });
|
|
38
|
+
}, A = (n, d, p, o) => (r) => {
|
|
39
39
|
if (a) {
|
|
40
40
|
let t = [...a.propertyInfoMap];
|
|
41
41
|
const e = t.findIndex(
|
|
@@ -48,7 +48,7 @@ const $e = ({
|
|
|
48
48
|
value: l,
|
|
49
49
|
source: p ? p || "" : t[e].source,
|
|
50
50
|
sourceField: o !== void 0 ? o || "" : t[e].sourceField
|
|
51
|
-
}),
|
|
51
|
+
}), g && g({ ...a, propertyInfoMap: t });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}, Y = (n) => () => {
|
|
@@ -70,7 +70,7 @@ const $e = ({
|
|
|
70
70
|
v
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
t && (
|
|
73
|
+
t && (A(d, p)({ value: t }), N((e) => {
|
|
74
74
|
const l = new Map(e);
|
|
75
75
|
return l.set(
|
|
76
76
|
`${h.get(a, "referenceObjectInstanceId")}:${d}:${p}`,
|
|
@@ -97,11 +97,11 @@ const $e = ({
|
|
|
97
97
|
o[r] && (o.splice(r, 1, {
|
|
98
98
|
...o[r],
|
|
99
99
|
randomInfo: p
|
|
100
|
-
}),
|
|
100
|
+
}), g && g({ ...a, propertyInfoMap: o }));
|
|
101
101
|
}
|
|
102
102
|
}, ee = (n) => (d) => {
|
|
103
103
|
const p = d.target.name;
|
|
104
|
-
let o = [
|
|
104
|
+
let o = [...$];
|
|
105
105
|
const r = o[n], t = r.propertyMappings.findIndex(
|
|
106
106
|
(l) => l.key === p
|
|
107
107
|
), e = r.propertyMappings[t];
|
|
@@ -113,7 +113,7 @@ const $e = ({
|
|
|
113
113
|
o,
|
|
114
114
|
`${n}.propertyMappings.${t}.sourceField`,
|
|
115
115
|
""
|
|
116
|
-
), j(o), a &&
|
|
116
|
+
), j(o), a && A(
|
|
117
117
|
r.key,
|
|
118
118
|
e.key,
|
|
119
119
|
String(d.target.value),
|
|
@@ -121,7 +121,7 @@ const $e = ({
|
|
|
121
121
|
)({ value: "" });
|
|
122
122
|
}, re = (n) => (d) => {
|
|
123
123
|
const p = d.target.name;
|
|
124
|
-
let o = [
|
|
124
|
+
let o = [...$];
|
|
125
125
|
const r = o[n], t = r.propertyMappings.findIndex(
|
|
126
126
|
(l) => l.key === p
|
|
127
127
|
), e = r.propertyMappings[t];
|
|
@@ -129,7 +129,7 @@ const $e = ({
|
|
|
129
129
|
o,
|
|
130
130
|
`${n}.propertyMappings.${t}.sourceField`,
|
|
131
131
|
d.target.value
|
|
132
|
-
), j(o),
|
|
132
|
+
), j(o), S && a) {
|
|
133
133
|
const l = h.get(
|
|
134
134
|
o,
|
|
135
135
|
`${n}.propertyMappings.${t}.source`
|
|
@@ -140,7 +140,7 @@ const $e = ({
|
|
|
140
140
|
I.variables,
|
|
141
141
|
`${e.dataType.type}.${d.target.value}`
|
|
142
142
|
) || "";
|
|
143
|
-
|
|
143
|
+
A(
|
|
144
144
|
r.key,
|
|
145
145
|
e.key,
|
|
146
146
|
void 0,
|
|
@@ -158,7 +158,7 @@ const $e = ({
|
|
|
158
158
|
u.variables,
|
|
159
159
|
`${e.dataType.type}.${d.target.value}`
|
|
160
160
|
) || "";
|
|
161
|
-
|
|
161
|
+
A(
|
|
162
162
|
r.key,
|
|
163
163
|
e.key,
|
|
164
164
|
void 0,
|
|
@@ -178,16 +178,16 @@ const $e = ({
|
|
|
178
178
|
disableColumnMenu: !0,
|
|
179
179
|
flex: 2.5,
|
|
180
180
|
renderCell: (r) => {
|
|
181
|
-
var x,
|
|
181
|
+
var x, w;
|
|
182
182
|
const { key: t, dataType: e } = r.row;
|
|
183
|
-
let l = "", u = /* @__PURE__ */ i(
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
(
|
|
183
|
+
let l = "", u = /* @__PURE__ */ i(T, {}), y = /* @__PURE__ */ i(T, {}), c = r.row.source;
|
|
184
|
+
if (S && a) {
|
|
185
|
+
const s = a.propertyInfoMap.find(
|
|
186
|
+
(C) => C.key === t && C.policyKey === n.key
|
|
187
187
|
);
|
|
188
|
-
if (
|
|
189
|
-
const { valid:
|
|
190
|
-
l =
|
|
188
|
+
if (s) {
|
|
189
|
+
const { valid: C, validationErrors: z } = s;
|
|
190
|
+
l = s.value, c = s.source, C === !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
|
-
)),
|
|
199
|
-
`${h.get(a, "referenceObjectInstanceId")}:${
|
|
198
|
+
)), c && (L.get(
|
|
199
|
+
`${h.get(a, "referenceObjectInstanceId")}:${s.policyKey}:${s.key}`
|
|
200
200
|
) === "Updated" ? y = /* @__PURE__ */ i(oe, { color: "success", sx: { mr: 1 }, titleAccess: "Updated" }) : y = /* @__PURE__ */ i(
|
|
201
201
|
J,
|
|
202
202
|
{
|
|
203
|
-
onClick: Y(
|
|
204
|
-
title: `Reload value from the ${
|
|
203
|
+
onClick: Y(s),
|
|
204
|
+
title: `Reload value from the ${c === "OBJECT" ? "Object" : "Catalogue"}`,
|
|
205
205
|
children: /* @__PURE__ */ i(ae, {})
|
|
206
206
|
}
|
|
207
207
|
));
|
|
208
208
|
}
|
|
209
|
-
if (
|
|
210
|
-
const
|
|
211
|
-
return /* @__PURE__ */ f(
|
|
209
|
+
if (c === "STATIC") {
|
|
210
|
+
const C = (x = M == null ? void 0 : M.environment.context) != null && x.boundingBox ? ye(M.environment.context.boundingBox) : void 0;
|
|
211
|
+
return /* @__PURE__ */ f(T, { children: [
|
|
212
212
|
/* @__PURE__ */ i(
|
|
213
213
|
he,
|
|
214
214
|
{
|
|
@@ -224,23 +224,23 @@ const $e = ({
|
|
|
224
224
|
variant: "outlined",
|
|
225
225
|
value: l,
|
|
226
226
|
size: "small",
|
|
227
|
-
defaultExtent:
|
|
228
|
-
onChange:
|
|
227
|
+
defaultExtent: C,
|
|
228
|
+
onChange: A(n.key, t)
|
|
229
229
|
}
|
|
230
230
|
),
|
|
231
231
|
u
|
|
232
232
|
] });
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
235
|
-
return /* @__PURE__ */ f(
|
|
234
|
+
if (c === "RANDOM" || c === "SMART_RANDOM")
|
|
235
|
+
return /* @__PURE__ */ f(T, { children: [
|
|
236
236
|
/* @__PURE__ */ i(
|
|
237
237
|
me,
|
|
238
238
|
{
|
|
239
239
|
type: e.type,
|
|
240
|
-
value:
|
|
241
|
-
innerType: (
|
|
242
|
-
minDate:
|
|
243
|
-
maxDate:
|
|
240
|
+
value: s == null ? void 0 : s.randomInfo,
|
|
241
|
+
innerType: (w = e.innerType) == null ? void 0 : w.type,
|
|
242
|
+
minDate: M ? M.startTime : "",
|
|
243
|
+
maxDate: M ? M.endTime : "",
|
|
244
244
|
mapboxAccessToken: E,
|
|
245
245
|
onChange: Z(n.key, t)
|
|
246
246
|
}
|
|
@@ -286,7 +286,7 @@ const $e = ({
|
|
|
286
286
|
title: r.row.name || r.row.key,
|
|
287
287
|
children: [
|
|
288
288
|
r.row.name || r.row.key,
|
|
289
|
-
r.row.required ? /* @__PURE__ */ i(
|
|
289
|
+
r.row.required ? /* @__PURE__ */ i(b, { color: "red", ml: 1, title: "Required", display: "inline", children: "*" }) : null
|
|
290
290
|
]
|
|
291
291
|
}
|
|
292
292
|
)
|
|
@@ -346,9 +346,10 @@ const $e = ({
|
|
|
346
346
|
name: String(r.id),
|
|
347
347
|
value: t,
|
|
348
348
|
children: [
|
|
349
|
-
|
|
350
|
-
!
|
|
351
|
-
|
|
349
|
+
/* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(b, { fontStyle: "italic", color: "GrayText", children: "Undefined" }) }),
|
|
350
|
+
!q && /* @__PURE__ */ i(k, { value: "OBJECT", children: "OBJECT" }),
|
|
351
|
+
!U && n.catalogInstances.map((e) => /* @__PURE__ */ i(k, { value: e.id, children: e.name }, e.id)),
|
|
352
|
+
S && ["STATIC", "RANDOM", "SMART_RANDOM"].map((e) => /* @__PURE__ */ i(k, { value: e, children: e }, e))
|
|
352
353
|
]
|
|
353
354
|
}
|
|
354
355
|
) });
|
|
@@ -365,31 +366,31 @@ const $e = ({
|
|
|
365
366
|
const { dataType: t } = r.row;
|
|
366
367
|
let e = r.row.source, l = r.row.sourceField;
|
|
367
368
|
if (a) {
|
|
368
|
-
const
|
|
369
|
+
const c = a.propertyInfoMap.find(
|
|
369
370
|
(x) => x.policyKey === n.key && x.key === r.id
|
|
370
371
|
);
|
|
371
|
-
|
|
372
|
+
c && (e = c.source, l = c.sourceField || "");
|
|
372
373
|
}
|
|
373
374
|
let u = l || "";
|
|
374
375
|
if (e === "RANDOM" || e === "STATIC" || e === "SMART_RANDOM")
|
|
375
|
-
return /* @__PURE__ */ i(
|
|
376
|
+
return /* @__PURE__ */ i(T, {});
|
|
376
377
|
let y = [];
|
|
377
378
|
if (e === "OBJECT")
|
|
378
|
-
y =
|
|
379
|
-
value:
|
|
380
|
-
text:
|
|
379
|
+
y = P.properties.map((c) => ({
|
|
380
|
+
value: c.propertyId,
|
|
381
|
+
text: c.name
|
|
381
382
|
}));
|
|
382
383
|
else if (e !== null) {
|
|
383
|
-
const
|
|
384
|
-
(
|
|
384
|
+
const c = Number(e), x = v == null ? void 0 : v.find(
|
|
385
|
+
(w) => w.id === c
|
|
385
386
|
);
|
|
386
387
|
if (x && K) {
|
|
387
|
-
const
|
|
388
|
-
(
|
|
388
|
+
const w = K.find(
|
|
389
|
+
(s) => s.templateKey === x.template.templateKey
|
|
389
390
|
);
|
|
390
|
-
|
|
391
|
-
value:
|
|
392
|
-
text:
|
|
391
|
+
w && (y = w.properties.filter((s) => s.type === t.type).sort((s, C) => s.name < C.name ? -1 : s.name > C.name ? 1 : 0).map((s) => ({
|
|
392
|
+
value: s.propertyId,
|
|
393
|
+
text: s.name
|
|
393
394
|
})));
|
|
394
395
|
}
|
|
395
396
|
}
|
|
@@ -400,8 +401,8 @@ const $e = ({
|
|
|
400
401
|
name: String(r.id),
|
|
401
402
|
value: u,
|
|
402
403
|
children: [
|
|
403
|
-
y.map((
|
|
404
|
-
y.length === 0 && /* @__PURE__ */ f(
|
|
404
|
+
y.map((c, x) => /* @__PURE__ */ i(k, { value: c.value, children: c.text }, x)),
|
|
405
|
+
y.length === 0 && /* @__PURE__ */ f(k, { disabled: !0, children: [
|
|
405
406
|
"No ",
|
|
406
407
|
t.type,
|
|
407
408
|
" property found!"
|
|
@@ -412,7 +413,7 @@ const $e = ({
|
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
];
|
|
415
|
-
return
|
|
416
|
+
return S ? [...o, p] : o;
|
|
416
417
|
};
|
|
417
418
|
return /* @__PURE__ */ f(de, { open: F, fullWidth: !0, maxWidth: "lg", onClose: O, children: [
|
|
418
419
|
/* @__PURE__ */ f(
|
|
@@ -423,9 +424,9 @@ const $e = ({
|
|
|
423
424
|
display: "flex",
|
|
424
425
|
justifyContent: "space-between",
|
|
425
426
|
children: [
|
|
426
|
-
/* @__PURE__ */ i(m, { children: a === void 0 ? /* @__PURE__ */ f(
|
|
427
|
-
/* @__PURE__ */ i(
|
|
428
|
-
/* @__PURE__ */ i(
|
|
427
|
+
/* @__PURE__ */ i(m, { children: a === void 0 ? /* @__PURE__ */ f(T, { children: [
|
|
428
|
+
/* @__PURE__ */ i(b, { variant: "h6", children: "Property Mapping" }),
|
|
429
|
+
/* @__PURE__ */ i(b, { variant: "caption", children: "Map policy properties with object template or catalog istance properties" })
|
|
429
430
|
] }) : /* @__PURE__ */ f(m, { display: "flex", flex: 1, alignItems: "flex-start", children: [
|
|
430
431
|
/* @__PURE__ */ f(
|
|
431
432
|
m,
|
|
@@ -501,7 +502,7 @@ const $e = ({
|
|
|
501
502
|
]
|
|
502
503
|
}
|
|
503
504
|
),
|
|
504
|
-
/* @__PURE__ */ i(se, { sx: { minHeight: 300 }, children:
|
|
505
|
+
/* @__PURE__ */ i(se, { sx: { minHeight: 300 }, children: $.map((n, d) => /* @__PURE__ */ f(
|
|
505
506
|
m,
|
|
506
507
|
{
|
|
507
508
|
boxShadow: (p) => p.shadows[1],
|
|
@@ -511,9 +512,9 @@ const $e = ({
|
|
|
511
512
|
borderRadius: 1,
|
|
512
513
|
children: [
|
|
513
514
|
/* @__PURE__ */ f(m, { display: "flex", alignItems: "center", p: 2, children: [
|
|
514
|
-
/* @__PURE__ */ i(
|
|
515
|
+
/* @__PURE__ */ i(b, { children: n.catalogInstances.map((p) => p.name).join(", ") }),
|
|
515
516
|
/* @__PURE__ */ i(ie, { color: "disabled", sx: { mx: 1 } }),
|
|
516
|
-
/* @__PURE__ */ i(
|
|
517
|
+
/* @__PURE__ */ i(b, { variant: "caption", color: "GrayText", children: n.name || n.key })
|
|
517
518
|
] }),
|
|
518
519
|
/* @__PURE__ */ i(
|
|
519
520
|
fe,
|
|
@@ -521,7 +522,7 @@ const $e = ({
|
|
|
521
522
|
columns: te(n, d),
|
|
522
523
|
rows: n.propertyMappings,
|
|
523
524
|
autoHeight: !0,
|
|
524
|
-
density:
|
|
525
|
+
density: S ? "comfortable" : "standard",
|
|
525
526
|
sx: {
|
|
526
527
|
border: "none",
|
|
527
528
|
"& .MuiDataGrid-columnHeadersInner": {
|
|
@@ -544,7 +545,7 @@ const $e = ({
|
|
|
544
545
|
{
|
|
545
546
|
color: "primary",
|
|
546
547
|
variant: "contained",
|
|
547
|
-
disabled:
|
|
548
|
+
disabled: $.length === 0 || B,
|
|
548
549
|
onClick: Q,
|
|
549
550
|
children: B ? "Saving..." : "Save"
|
|
550
551
|
}
|