@hybridcore/ui 1.5.46 → 1.5.48
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,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as a, Fragment as D, jsxs as Y } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as j } from "react";
|
|
3
3
|
import { DataGrid as N } from "@mui/x-data-grid";
|
|
4
|
-
import { ButtonBase as
|
|
5
|
-
import { DataGridActions as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
4
|
+
import { ButtonBase as B, Box as S } from "@mui/material";
|
|
5
|
+
import { DataGridActions as $ } from "./styled.js";
|
|
6
|
+
import k from "dayjs";
|
|
7
|
+
import A from "lodash";
|
|
8
|
+
const K = ({
|
|
9
9
|
template: l,
|
|
10
10
|
data: h,
|
|
11
11
|
selectedIds: R = [],
|
|
@@ -17,8 +17,8 @@ const U = ({
|
|
|
17
17
|
onSelect: d,
|
|
18
18
|
onTitleClick: y
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
var w, g,
|
|
20
|
+
const F = j(() => {
|
|
21
|
+
var w, g, v, b, s, x, C, I;
|
|
22
22
|
return [
|
|
23
23
|
...(w = e == null ? void 0 : e.templateIcon) != null && w.hidden ? [] : [
|
|
24
24
|
{
|
|
@@ -28,17 +28,17 @@ const U = ({
|
|
|
28
28
|
filterable: !1,
|
|
29
29
|
align: "center",
|
|
30
30
|
width: 30,
|
|
31
|
-
renderCell: (g = e == null ? void 0 : e.templateIcon) != null && g.renderCell ? (
|
|
31
|
+
renderCell: (g = e == null ? void 0 : e.templateIcon) != null && g.renderCell ? (v = e == null ? void 0 : e.templateIcon) == null ? void 0 : v.renderCell : () => l ? /* @__PURE__ */ a(
|
|
32
32
|
"img",
|
|
33
33
|
{
|
|
34
34
|
src: l.icon,
|
|
35
35
|
height: 20,
|
|
36
36
|
style: { display: "inline", maxWidth: 20 }
|
|
37
37
|
}
|
|
38
|
-
) : /* @__PURE__ */
|
|
38
|
+
) : /* @__PURE__ */ a(D, {})
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
|
-
...(
|
|
41
|
+
...(b = e == null ? void 0 : e.title) != null && b.hidden ? [] : [
|
|
42
42
|
{
|
|
43
43
|
field: "title",
|
|
44
44
|
headerName: "Title",
|
|
@@ -46,10 +46,10 @@ const U = ({
|
|
|
46
46
|
sortable: !1,
|
|
47
47
|
filterable: !1,
|
|
48
48
|
valueGetter: (r) => r.row.title,
|
|
49
|
-
renderCell: (
|
|
49
|
+
renderCell: (s = e == null ? void 0 : e.title) != null && s.renderCell ? (x = e == null ? void 0 : e.title) == null ? void 0 : x.renderCell : (r) => {
|
|
50
50
|
const { row: t, value: c } = r;
|
|
51
|
-
return y ? /* @__PURE__ */
|
|
52
|
-
|
|
51
|
+
return y ? /* @__PURE__ */ a(
|
|
52
|
+
B,
|
|
53
53
|
{
|
|
54
54
|
onClick: () => y(t),
|
|
55
55
|
sx: { "&:hover": { textDecoration: "underline" } },
|
|
@@ -85,21 +85,21 @@ const U = ({
|
|
|
85
85
|
sortable: !1,
|
|
86
86
|
filterable: !1,
|
|
87
87
|
width: 150,
|
|
88
|
-
valueFormatter: (n) => n.value && r.type === "date" ?
|
|
89
|
-
valueGetter: (n) =>
|
|
88
|
+
valueFormatter: (n) => n.value && r.type === "date" ? k(n.value).format("DD/MM/YYYY HH:mm") : n.value,
|
|
89
|
+
valueGetter: (n) => A.get(n.row, t),
|
|
90
90
|
renderCell: e && ((c = e[r.propertyId]) == null ? void 0 : c.renderCell)
|
|
91
91
|
};
|
|
92
92
|
})
|
|
93
93
|
] : []
|
|
94
94
|
];
|
|
95
|
-
}, [l]),
|
|
96
|
-
|
|
95
|
+
}, [l]), H = (o) => {
|
|
96
|
+
d && d(o);
|
|
97
97
|
};
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ Y(S, { position: "relative", children: [
|
|
99
|
+
/* @__PURE__ */ a(
|
|
100
100
|
N,
|
|
101
101
|
{
|
|
102
|
-
columns:
|
|
102
|
+
columns: F,
|
|
103
103
|
rows: h,
|
|
104
104
|
autoHeight: !0,
|
|
105
105
|
density: "compact",
|
|
@@ -109,16 +109,16 @@ const U = ({
|
|
|
109
109
|
marginRight: u ? `${m}px` : 0
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
-
getRowId: (
|
|
112
|
+
getRowId: (o) => o.id,
|
|
113
113
|
hideFooterPagination: !0,
|
|
114
114
|
hideFooter: !0,
|
|
115
115
|
checkboxSelection: M,
|
|
116
|
-
rowSelectionModel:
|
|
117
|
-
onRowSelectionModelChange:
|
|
116
|
+
rowSelectionModel: R,
|
|
117
|
+
onRowSelectionModelChange: H,
|
|
118
118
|
keepNonExistentRowsSelected: !0
|
|
119
119
|
}
|
|
120
120
|
),
|
|
121
|
-
u !== void 0 && /* @__PURE__ */
|
|
121
|
+
u !== void 0 && /* @__PURE__ */ a($, { width: m, children: /* @__PURE__ */ a(
|
|
122
122
|
N,
|
|
123
123
|
{
|
|
124
124
|
columns: [
|
|
@@ -136,13 +136,13 @@ const U = ({
|
|
|
136
136
|
hideFooter: !0,
|
|
137
137
|
sx: { border: "none" },
|
|
138
138
|
slots: {
|
|
139
|
-
noRowsOverlay: () => /* @__PURE__ */
|
|
139
|
+
noRowsOverlay: () => /* @__PURE__ */ a(D, {})
|
|
140
140
|
},
|
|
141
|
-
getRowId: (
|
|
141
|
+
getRowId: (o) => o.id
|
|
142
142
|
}
|
|
143
143
|
) })
|
|
144
144
|
] });
|
|
145
145
|
};
|
|
146
146
|
export {
|
|
147
|
-
|
|
147
|
+
K as InstanceTable
|
|
148
148
|
};
|
|
@@ -19,22 +19,22 @@ const $e = ({
|
|
|
19
19
|
objectInstance: I,
|
|
20
20
|
disableCatalogueSource: G,
|
|
21
21
|
disableObjectSource: U,
|
|
22
|
-
scenario:
|
|
22
|
+
scenario: M,
|
|
23
23
|
mapboxAccessToken: E,
|
|
24
|
-
onSubmit:
|
|
24
|
+
onSubmit: g,
|
|
25
25
|
onClose: O
|
|
26
26
|
}) => {
|
|
27
27
|
const [k, j] = H(P), [L, N] = H(/* @__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(k);
|
|
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 &&
|
|
37
|
+
a && g({ ...a, [n]: d });
|
|
38
38
|
}, S = (n, d, p, o) => (r) => {
|
|
39
39
|
if (a) {
|
|
40
40
|
let t = [...a.propertyInfoMap];
|
|
@@ -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) => () => {
|
|
@@ -97,7 +97,7 @@ 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;
|
|
@@ -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(b, {}), y = /* @__PURE__ */ i(b, {}),
|
|
183
|
+
let l = "", u = /* @__PURE__ */ i(b, {}), y = /* @__PURE__ */ i(b, {}), c = r.row.source;
|
|
184
184
|
if (T && a) {
|
|
185
|
-
const
|
|
186
|
-
(
|
|
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,19 +195,19 @@ 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
|
|
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
211
|
return /* @__PURE__ */ f(b, { children: [
|
|
212
212
|
/* @__PURE__ */ i(
|
|
213
213
|
he,
|
|
@@ -224,23 +224,23 @@ const $e = ({
|
|
|
224
224
|
variant: "outlined",
|
|
225
225
|
value: l,
|
|
226
226
|
size: "small",
|
|
227
|
-
defaultExtent:
|
|
227
|
+
defaultExtent: C,
|
|
228
228
|
onChange: S(n.key, t)
|
|
229
229
|
}
|
|
230
230
|
),
|
|
231
231
|
u
|
|
232
232
|
] });
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
234
|
+
if (c === "RANDOM" || c === "SMART_RANDOM")
|
|
235
235
|
return /* @__PURE__ */ f(b, { 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
|
}
|
|
@@ -365,31 +365,31 @@ const $e = ({
|
|
|
365
365
|
const { dataType: t } = r.row;
|
|
366
366
|
let e = r.row.source, l = r.row.sourceField;
|
|
367
367
|
if (a) {
|
|
368
|
-
const
|
|
368
|
+
const c = a.propertyInfoMap.find(
|
|
369
369
|
(x) => x.policyKey === n.key && x.key === r.id
|
|
370
370
|
);
|
|
371
|
-
|
|
371
|
+
c && (e = c.source, l = c.sourceField || "");
|
|
372
372
|
}
|
|
373
373
|
let u = l || "";
|
|
374
374
|
if (e === "RANDOM" || e === "STATIC" || e === "SMART_RANDOM")
|
|
375
375
|
return /* @__PURE__ */ i(b, {});
|
|
376
376
|
let y = [];
|
|
377
377
|
if (e === "OBJECT")
|
|
378
|
-
y = q.properties.map((
|
|
379
|
-
value:
|
|
380
|
-
text:
|
|
378
|
+
y = q.properties.map((c) => ({
|
|
379
|
+
value: c.propertyId,
|
|
380
|
+
text: c.name
|
|
381
381
|
}));
|
|
382
382
|
else if (e !== null) {
|
|
383
|
-
const
|
|
384
|
-
(
|
|
383
|
+
const c = Number(e), x = v == null ? void 0 : v.find(
|
|
384
|
+
(w) => w.id === c
|
|
385
385
|
);
|
|
386
386
|
if (x && K) {
|
|
387
|
-
const
|
|
388
|
-
(
|
|
387
|
+
const w = K.find(
|
|
388
|
+
(s) => s.templateKey === x.template.templateKey
|
|
389
389
|
);
|
|
390
|
-
|
|
391
|
-
value:
|
|
392
|
-
text:
|
|
390
|
+
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) => ({
|
|
391
|
+
value: s.propertyId,
|
|
392
|
+
text: s.name
|
|
393
393
|
})));
|
|
394
394
|
}
|
|
395
395
|
}
|
|
@@ -400,7 +400,7 @@ const $e = ({
|
|
|
400
400
|
name: String(r.id),
|
|
401
401
|
value: u,
|
|
402
402
|
children: [
|
|
403
|
-
y.map((
|
|
403
|
+
y.map((c, x) => /* @__PURE__ */ i(A, { value: c.value, children: c.text }, x)),
|
|
404
404
|
y.length === 0 && /* @__PURE__ */ f(A, { disabled: !0, children: [
|
|
405
405
|
"No ",
|
|
406
406
|
t.type,
|