@hybridcore/ui 1.5.38 → 1.5.41
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/index.js +255 -240
- package/dist/main.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,293 +1,308 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { getNestedChildrenFromMap as
|
|
6
|
-
import { i as
|
|
7
|
-
import { ConditionalWrapper as
|
|
8
|
-
import { Container as
|
|
9
|
-
import { Box as
|
|
10
|
-
import { TreeSelect as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { DisseminationList as
|
|
14
|
-
import { SecurityLevel as
|
|
15
|
-
const
|
|
1
|
+
import { jsx as i, jsxs as o, Fragment as xe } from "react/jsx-runtime";
|
|
2
|
+
import v, { useRef as Te } from "react";
|
|
3
|
+
import Ie from "lodash";
|
|
4
|
+
import { useForm as we, Controller as u } from "react-hook-form";
|
|
5
|
+
import { getNestedChildrenFromMap as Ce } from "../../utils/ontology.js";
|
|
6
|
+
import { i as Le, d as Oe } from "../../utils-Bq0ye5vf.js";
|
|
7
|
+
import { ConditionalWrapper as h } from "../conditional-wrapper/index.js";
|
|
8
|
+
import { Container as Ve } from "../container/index.js";
|
|
9
|
+
import { Box as l, Typography as y, TextField as x, FormHelperText as re, FormGroup as Se, FormControlLabel as oe, Checkbox as ce, Button as w } from "@mui/material";
|
|
10
|
+
import { TreeSelect as Fe } from "../tree-select/index.js";
|
|
11
|
+
import ke from "./components/policy-list/index.js";
|
|
12
|
+
import Re from "./components/variables/index.js";
|
|
13
|
+
import { DisseminationList as Ee } from "../data-security-selectors/dissemination-list/index.js";
|
|
14
|
+
import { SecurityLevel as Pe } from "../data-security-selectors/security-level/index.js";
|
|
15
|
+
const Be = {
|
|
16
16
|
alg: "A256GCM",
|
|
17
17
|
ext: !0,
|
|
18
18
|
k: "_El6rHQxC5E7NdO5DiMDITjF7f65wrlaJmFVagVE9Ic",
|
|
19
19
|
key_ops: ["encrypt", "decrypt"],
|
|
20
20
|
kty: "oct"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
var
|
|
24
|
-
const
|
|
25
|
-
register:
|
|
26
|
-
handleSubmit:
|
|
27
|
-
control:
|
|
28
|
-
formState: { errors:
|
|
29
|
-
getValues:
|
|
22
|
+
function De(e, se) {
|
|
23
|
+
var R, E, P, B, D, A, N, _, W, q, $, K, M, U, j, G, H, J, Q, Y, z, X, Z, ee, te, ie, ne, le, ae;
|
|
24
|
+
const L = Te(null), {
|
|
25
|
+
register: O,
|
|
26
|
+
handleSubmit: me,
|
|
27
|
+
control: m,
|
|
28
|
+
formState: { errors: fe, isDirty: V },
|
|
29
|
+
getValues: S,
|
|
30
30
|
setValue: T,
|
|
31
|
-
reset:
|
|
32
|
-
|
|
31
|
+
reset: ue,
|
|
32
|
+
watch: F
|
|
33
|
+
} = we({
|
|
33
34
|
defaultValues: e.defaultValues
|
|
34
|
-
}), [
|
|
35
|
+
}), c = (e == null ? void 0 : e.labelPosition) ?? "default", [he, ve] = v.useState([]), [I, k] = v.useState(), [Ae, ge] = v.useState(0), ye = v.useMemo(() => {
|
|
35
36
|
const t = [];
|
|
36
|
-
return e.mappedTemplates.forEach((
|
|
37
|
-
|
|
37
|
+
return e.mappedTemplates.forEach((n) => {
|
|
38
|
+
n.creatable || t.push(String(n.id));
|
|
38
39
|
}), t;
|
|
39
40
|
}, [e.mappedTemplates]);
|
|
40
|
-
|
|
41
|
+
v.useEffect(() => {
|
|
41
42
|
(async () => {
|
|
42
|
-
const t = { ...e.defaultValues },
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
(
|
|
43
|
+
const t = { ...e.defaultValues }, n = e.mappedTemplates.get(t.templateId);
|
|
44
|
+
if (n) {
|
|
45
|
+
const d = n.properties.filter(
|
|
46
|
+
(r) => r.privacyPreservationMethod === "ENCRYPTION"
|
|
46
47
|
);
|
|
47
|
-
if (
|
|
48
|
-
for (let
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
|
|
48
|
+
if (d.length > 0)
|
|
49
|
+
for (let r = 0; r < d.length; r++) {
|
|
50
|
+
const a = d[r], s = Ie.get(t, `variables.${a.propertyId}`);
|
|
51
|
+
if (s && e.keyAuth) {
|
|
52
|
+
const f = await Le(Be), b = await Oe(f, String(s));
|
|
53
|
+
b.data && (T(`variables.${a.propertyId}`, b.data), ge((p) => p + 1));
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
})();
|
|
57
58
|
}, [e.defaultValues, e.mappedTemplates, e.keyAuth]);
|
|
58
|
-
const
|
|
59
|
-
const t =
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
for (const
|
|
64
|
-
if (
|
|
65
|
-
|
|
59
|
+
const C = () => {
|
|
60
|
+
const t = S("templateId");
|
|
61
|
+
I && k(void 0);
|
|
62
|
+
const n = Ce(e.mappedTemplates);
|
|
63
|
+
ve(n);
|
|
64
|
+
for (const d of e.mappedTemplates.values())
|
|
65
|
+
if (d.id === t) {
|
|
66
|
+
k(d);
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
|
-
|
|
70
|
+
v.useImperativeHandle(se, () => ({
|
|
70
71
|
requestSubmit() {
|
|
71
72
|
var t;
|
|
72
|
-
(t =
|
|
73
|
+
(t = L.current) == null || t.requestSubmit();
|
|
73
74
|
},
|
|
74
75
|
resetForm() {
|
|
75
|
-
|
|
76
|
+
ue({
|
|
76
77
|
title: "",
|
|
77
78
|
description: "",
|
|
78
79
|
templateId: 0,
|
|
79
80
|
variables: {}
|
|
80
|
-
}),
|
|
81
|
+
}), C();
|
|
81
82
|
},
|
|
82
|
-
setFormValue(t,
|
|
83
|
-
T(t,
|
|
83
|
+
setFormValue(t, n) {
|
|
84
|
+
T(t, n);
|
|
84
85
|
},
|
|
85
86
|
getFormValue(t) {
|
|
86
|
-
return
|
|
87
|
+
return S(t);
|
|
88
|
+
},
|
|
89
|
+
isDirty() {
|
|
90
|
+
return V;
|
|
87
91
|
}
|
|
88
|
-
})),
|
|
89
|
-
}), [e.mappedTemplates]),
|
|
90
|
-
e.onSelectedTemplateChange && e.onSelectedTemplateChange(
|
|
91
|
-
}, [
|
|
92
|
-
const
|
|
92
|
+
})), v.useEffect(() => (C(), () => {
|
|
93
|
+
}), [e.mappedTemplates]), v.useEffect(() => {
|
|
94
|
+
e.onSelectedTemplateChange && e.onSelectedTemplateChange(I);
|
|
95
|
+
}, [I]);
|
|
96
|
+
const be = () => {
|
|
93
97
|
if (e.onCancel) {
|
|
94
|
-
e.onCancel(
|
|
98
|
+
e.onCancel(V);
|
|
95
99
|
return;
|
|
96
100
|
}
|
|
101
|
+
}, g = (t) => {
|
|
102
|
+
var r, a;
|
|
103
|
+
if (!t) return;
|
|
104
|
+
const n = (a = (r = e == null ? void 0 : e.fieldOptions) == null ? void 0 : r[t]) == null ? void 0 : a.maxChar;
|
|
105
|
+
return n != null && !Number.isNaN(Number(n)) ? Number(n) : void 0;
|
|
97
106
|
};
|
|
98
107
|
return /* @__PURE__ */ i(
|
|
99
|
-
|
|
108
|
+
h,
|
|
100
109
|
{
|
|
101
110
|
condition: e.variant === void 0 || e.variant === "inline",
|
|
102
111
|
wrapper: (t) => /* @__PURE__ */ i(
|
|
103
|
-
|
|
112
|
+
Ve,
|
|
104
113
|
{
|
|
105
114
|
disableHeader: !0,
|
|
106
115
|
sx: { position: "relative", overflow: "visible" },
|
|
107
116
|
children: t
|
|
108
117
|
}
|
|
109
118
|
),
|
|
110
|
-
children: /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ o(
|
|
111
120
|
"form",
|
|
112
121
|
{
|
|
113
|
-
ref:
|
|
114
|
-
onSubmit:
|
|
122
|
+
ref: L,
|
|
123
|
+
onSubmit: me(e.onSubmit),
|
|
115
124
|
style: { display: "flex", flexDirection: "column" },
|
|
116
125
|
children: [
|
|
117
|
-
!((
|
|
118
|
-
|
|
126
|
+
!((E = (R = e.fieldOptions) == null ? void 0 : R.title) != null && E.hidden) && /* @__PURE__ */ i(
|
|
127
|
+
h,
|
|
119
128
|
{
|
|
120
|
-
condition:
|
|
121
|
-
wrapper: (t) => /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */ i(
|
|
123
|
-
/* @__PURE__ */ i(
|
|
129
|
+
condition: c === "left",
|
|
130
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
131
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Title *" }),
|
|
132
|
+
/* @__PURE__ */ i(l, { width: "68%", children: t })
|
|
124
133
|
] }),
|
|
125
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
126
135
|
/* @__PURE__ */ i(
|
|
127
|
-
|
|
136
|
+
x,
|
|
128
137
|
{
|
|
129
|
-
label:
|
|
138
|
+
label: c === "default" ? "Title *" : void 0,
|
|
130
139
|
variant: e.inputVariant,
|
|
140
|
+
inputProps: g("title") ? { maxLength: g("title") } : void 0,
|
|
131
141
|
fullWidth: !0,
|
|
132
|
-
...
|
|
133
|
-
...
|
|
142
|
+
...O("title", { required: !0 }),
|
|
143
|
+
...fe.title && {
|
|
134
144
|
helperText: "This field is required!",
|
|
135
145
|
error: !0
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
),
|
|
139
|
-
|
|
149
|
+
g("title") && /* @__PURE__ */ i(re, { sx: { textAlign: "right", mt: 0.5 }, children: `${(P = F("title")) == null ? void 0 : P.length}/${g("title")}` }),
|
|
150
|
+
e.fieldOptions && ((B = e.fieldOptions.title) == null ? void 0 : B.helperText)
|
|
140
151
|
] })
|
|
141
152
|
}
|
|
142
153
|
),
|
|
143
|
-
!((
|
|
144
|
-
|
|
154
|
+
!((A = (D = e.fieldOptions) == null ? void 0 : D.description) != null && A.hidden) && /* @__PURE__ */ i(
|
|
155
|
+
h,
|
|
145
156
|
{
|
|
146
|
-
condition:
|
|
147
|
-
wrapper: (t) => /* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */ i(
|
|
149
|
-
/* @__PURE__ */ i(
|
|
157
|
+
condition: c === "left",
|
|
158
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
159
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Description" }),
|
|
160
|
+
/* @__PURE__ */ i(l, { width: "68%", children: t })
|
|
150
161
|
] }),
|
|
151
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
152
163
|
/* @__PURE__ */ i(
|
|
153
|
-
|
|
164
|
+
x,
|
|
154
165
|
{
|
|
155
|
-
label:
|
|
166
|
+
label: c === "default" ? "Description" : void 0,
|
|
167
|
+
inputProps: g("description") ? { maxLength: g("description") } : void 0,
|
|
156
168
|
variant: e.inputVariant,
|
|
157
169
|
fullWidth: !0,
|
|
158
170
|
multiline: !0,
|
|
159
|
-
minRows: (
|
|
160
|
-
...
|
|
171
|
+
minRows: (_ = (N = e.fieldOptions) == null ? void 0 : N.description) == null ? void 0 : _.minRows,
|
|
172
|
+
...O("description")
|
|
161
173
|
}
|
|
162
174
|
),
|
|
163
|
-
|
|
175
|
+
g("description") && /* @__PURE__ */ i(re, { sx: { textAlign: "right", mt: 0.5 }, children: `${(W = F("description")) == null ? void 0 : W.length}/${g(
|
|
176
|
+
"description"
|
|
177
|
+
)}` }),
|
|
178
|
+
e.fieldOptions && ((q = e.fieldOptions.description) == null ? void 0 : q.helperText)
|
|
164
179
|
] })
|
|
165
180
|
}
|
|
166
181
|
),
|
|
167
|
-
!((
|
|
168
|
-
|
|
182
|
+
!((K = ($ = e.fieldOptions) == null ? void 0 : $.templateId) != null && K.hidden) && /* @__PURE__ */ i(
|
|
183
|
+
h,
|
|
169
184
|
{
|
|
170
|
-
condition:
|
|
171
|
-
wrapper: (t) => /* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */ i(
|
|
173
|
-
/* @__PURE__ */ i(
|
|
185
|
+
condition: c === "left",
|
|
186
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
187
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Template" }),
|
|
188
|
+
/* @__PURE__ */ i(l, { width: "68%", children: t })
|
|
174
189
|
] }),
|
|
175
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ o(Se, { sx: { mb: 2 }, children: [
|
|
176
191
|
/* @__PURE__ */ i(
|
|
177
|
-
|
|
192
|
+
u,
|
|
178
193
|
{
|
|
179
194
|
name: "templateId",
|
|
180
|
-
control:
|
|
181
|
-
render: ({ field: { value: t, onChange:
|
|
182
|
-
var
|
|
183
|
-
if ((
|
|
184
|
-
const
|
|
195
|
+
control: m,
|
|
196
|
+
render: ({ field: { value: t, onChange: n } }) => {
|
|
197
|
+
var d, r;
|
|
198
|
+
if ((r = (d = e.fieldOptions) == null ? void 0 : d.templateId) != null && r.disabled) {
|
|
199
|
+
const a = t ? e.mappedTemplates.get(t) : void 0;
|
|
185
200
|
return /* @__PURE__ */ i(
|
|
186
|
-
|
|
201
|
+
x,
|
|
187
202
|
{
|
|
188
203
|
label: "Template",
|
|
189
204
|
variant: e.inputVariant,
|
|
190
205
|
fullWidth: !0,
|
|
191
206
|
disabled: !0,
|
|
192
|
-
value:
|
|
207
|
+
value: a == null ? void 0 : a.name,
|
|
193
208
|
InputLabelProps: { shrink: !0 }
|
|
194
209
|
}
|
|
195
210
|
);
|
|
196
211
|
}
|
|
197
212
|
return /* @__PURE__ */ i(
|
|
198
|
-
|
|
213
|
+
Fe,
|
|
199
214
|
{
|
|
200
|
-
label:
|
|
201
|
-
data:
|
|
215
|
+
label: c === "default" ? "Template" : void 0,
|
|
216
|
+
data: he,
|
|
202
217
|
selected: t === 0 ? "" : [String(t)],
|
|
203
|
-
disabled:
|
|
218
|
+
disabled: ye,
|
|
204
219
|
variant: e.inputVariant,
|
|
205
|
-
onChange: (
|
|
206
|
-
const
|
|
220
|
+
onChange: (a, s) => {
|
|
221
|
+
const f = {
|
|
207
222
|
target: {
|
|
208
|
-
value:
|
|
223
|
+
value: s ? Number(a) : 0
|
|
209
224
|
}
|
|
210
225
|
};
|
|
211
|
-
|
|
226
|
+
n(f), C();
|
|
212
227
|
}
|
|
213
228
|
}
|
|
214
229
|
);
|
|
215
230
|
}
|
|
216
231
|
}
|
|
217
232
|
),
|
|
218
|
-
e.fieldOptions && ((
|
|
233
|
+
e.fieldOptions && ((M = e.fieldOptions.templateId) == null ? void 0 : M.helperText)
|
|
219
234
|
] })
|
|
220
235
|
}
|
|
221
236
|
),
|
|
222
|
-
"aliasList" in e.defaultValues && !((
|
|
223
|
-
|
|
237
|
+
"aliasList" in e.defaultValues && !((j = (U = e.fieldOptions) == null ? void 0 : U.aliasList) != null && j.hidden) && /* @__PURE__ */ i(
|
|
238
|
+
u,
|
|
224
239
|
{
|
|
225
240
|
name: "aliasList",
|
|
226
|
-
control:
|
|
227
|
-
render: ({ field: { value: t, onChange:
|
|
228
|
-
var
|
|
229
|
-
const
|
|
230
|
-
const
|
|
241
|
+
control: m,
|
|
242
|
+
render: ({ field: { value: t, onChange: n, ...d } }) => {
|
|
243
|
+
var a;
|
|
244
|
+
const r = (s) => {
|
|
245
|
+
const p = {
|
|
231
246
|
target: {
|
|
232
|
-
value:
|
|
247
|
+
value: s.target.value.split(",").map((de) => de.trimStart())
|
|
233
248
|
}
|
|
234
249
|
};
|
|
235
|
-
|
|
250
|
+
n(p);
|
|
236
251
|
};
|
|
237
252
|
return /* @__PURE__ */ i(
|
|
238
|
-
|
|
253
|
+
h,
|
|
239
254
|
{
|
|
240
|
-
condition:
|
|
241
|
-
wrapper: (
|
|
242
|
-
/* @__PURE__ */ i(
|
|
243
|
-
/* @__PURE__ */ i(
|
|
255
|
+
condition: c === "left",
|
|
256
|
+
wrapper: (s) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
257
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Alias List" }),
|
|
258
|
+
/* @__PURE__ */ i(l, { width: "68%", children: s })
|
|
244
259
|
] }),
|
|
245
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
246
261
|
/* @__PURE__ */ i(
|
|
247
|
-
|
|
262
|
+
x,
|
|
248
263
|
{
|
|
249
|
-
label:
|
|
264
|
+
label: c === "default" ? "Alias List" : void 0,
|
|
250
265
|
variant: e.inputVariant,
|
|
251
266
|
fullWidth: !0,
|
|
252
267
|
value: t,
|
|
253
268
|
helperText: "Add list values with the comma (,) separated string",
|
|
254
|
-
onChange:
|
|
255
|
-
...
|
|
269
|
+
onChange: r,
|
|
270
|
+
...d
|
|
256
271
|
}
|
|
257
272
|
),
|
|
258
|
-
e.fieldOptions && ((
|
|
273
|
+
e.fieldOptions && ((a = e.fieldOptions.aliasList) == null ? void 0 : a.helperText)
|
|
259
274
|
] })
|
|
260
275
|
}
|
|
261
276
|
);
|
|
262
277
|
}
|
|
263
278
|
}
|
|
264
279
|
),
|
|
265
|
-
"appliedPolicies" in e.defaultValues && !((
|
|
266
|
-
|
|
280
|
+
"appliedPolicies" in e.defaultValues && !((H = (G = e.fieldOptions) == null ? void 0 : G.appliedPolicies) != null && H.hidden) && /* @__PURE__ */ i(
|
|
281
|
+
u,
|
|
267
282
|
{
|
|
268
283
|
name: "appliedPolicies",
|
|
269
|
-
control:
|
|
270
|
-
render: ({ field: { value: t, onChange:
|
|
271
|
-
var
|
|
284
|
+
control: m,
|
|
285
|
+
render: ({ field: { value: t, onChange: n } }) => {
|
|
286
|
+
var d;
|
|
272
287
|
return /* @__PURE__ */ i(
|
|
273
|
-
|
|
288
|
+
h,
|
|
274
289
|
{
|
|
275
|
-
condition:
|
|
276
|
-
wrapper: (
|
|
277
|
-
/* @__PURE__ */ i(
|
|
278
|
-
/* @__PURE__ */ i(
|
|
290
|
+
condition: c === "left",
|
|
291
|
+
wrapper: (r) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
292
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Policy List" }),
|
|
293
|
+
/* @__PURE__ */ i(l, { width: "68%", children: r })
|
|
279
294
|
] }),
|
|
280
|
-
children: /* @__PURE__ */
|
|
295
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
281
296
|
/* @__PURE__ */ i(
|
|
282
|
-
|
|
297
|
+
ke,
|
|
283
298
|
{
|
|
284
299
|
policyList: e.policyList,
|
|
285
|
-
labelPosition:
|
|
300
|
+
labelPosition: c,
|
|
286
301
|
value: t || void 0,
|
|
287
|
-
onChange:
|
|
302
|
+
onChange: n
|
|
288
303
|
}
|
|
289
304
|
),
|
|
290
|
-
e.fieldOptions && ((
|
|
305
|
+
e.fieldOptions && ((d = e.fieldOptions.appliedPolicies) == null ? void 0 : d.helperText)
|
|
291
306
|
] })
|
|
292
307
|
}
|
|
293
308
|
);
|
|
@@ -295,200 +310,200 @@ function Se(e, le) {
|
|
|
295
310
|
}
|
|
296
311
|
),
|
|
297
312
|
/* @__PURE__ */ i(
|
|
298
|
-
|
|
313
|
+
u,
|
|
299
314
|
{
|
|
300
315
|
name: "variables",
|
|
301
|
-
control:
|
|
302
|
-
render: ({ field: { value: t, onChange:
|
|
303
|
-
|
|
316
|
+
control: m,
|
|
317
|
+
render: ({ field: { value: t, onChange: n } }) => /* @__PURE__ */ i(
|
|
318
|
+
Re,
|
|
304
319
|
{
|
|
305
|
-
template:
|
|
320
|
+
template: I,
|
|
306
321
|
value: t,
|
|
307
322
|
mapboxAccessToken: e.mapboxAccessToken,
|
|
308
323
|
variant: e.inputVariant,
|
|
309
|
-
labelPosition:
|
|
324
|
+
labelPosition: c,
|
|
310
325
|
fieldOptions: e.fieldOptions,
|
|
311
|
-
onChange:
|
|
326
|
+
onChange: n
|
|
312
327
|
}
|
|
313
328
|
)
|
|
314
329
|
}
|
|
315
330
|
),
|
|
316
|
-
"fileInBase64" in e.defaultValues && !((
|
|
331
|
+
"fileInBase64" in e.defaultValues && !((Q = (J = e.fieldOptions) == null ? void 0 : J.fileInBase64) != null && Q.hidden) && /* @__PURE__ */ o(xe, { children: [
|
|
317
332
|
/* @__PURE__ */ i(
|
|
318
|
-
|
|
333
|
+
u,
|
|
319
334
|
{
|
|
320
335
|
name: "fileInBase64",
|
|
321
|
-
control:
|
|
322
|
-
render: ({ field: { onChange: t, value:
|
|
323
|
-
var
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
t(
|
|
336
|
+
control: m,
|
|
337
|
+
render: ({ field: { onChange: t, value: n, ...d } }) => {
|
|
338
|
+
var a;
|
|
339
|
+
const r = (s) => {
|
|
340
|
+
if (s.target.files) {
|
|
341
|
+
const f = new FileReader();
|
|
342
|
+
f.onload = async (p) => {
|
|
343
|
+
const pe = p.target.result.split("base64,")[1];
|
|
344
|
+
t(pe);
|
|
330
345
|
};
|
|
331
|
-
const
|
|
332
|
-
T("originalFileName",
|
|
346
|
+
const b = s.target.files[0];
|
|
347
|
+
T("originalFileName", b.name), T("contentType", b.type), f.readAsDataURL(b);
|
|
333
348
|
}
|
|
334
349
|
};
|
|
335
350
|
return /* @__PURE__ */ i(
|
|
336
|
-
|
|
351
|
+
h,
|
|
337
352
|
{
|
|
338
|
-
condition:
|
|
339
|
-
wrapper: (
|
|
340
|
-
/* @__PURE__ */ i(
|
|
341
|
-
/* @__PURE__ */ i(
|
|
353
|
+
condition: c === "left",
|
|
354
|
+
wrapper: (s) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
355
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "File to Upload" }),
|
|
356
|
+
/* @__PURE__ */ i(l, { width: "68%", children: s })
|
|
342
357
|
] }),
|
|
343
|
-
children: /* @__PURE__ */
|
|
358
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
344
359
|
/* @__PURE__ */ i(
|
|
345
|
-
|
|
360
|
+
x,
|
|
346
361
|
{
|
|
347
362
|
type: "file",
|
|
348
|
-
label:
|
|
363
|
+
label: c === "default" ? "File to Upload" : void 0,
|
|
349
364
|
variant: e.inputVariant,
|
|
350
365
|
fullWidth: !0,
|
|
351
366
|
helperText: "Select a file to upload",
|
|
352
367
|
InputLabelProps: { shrink: !0 },
|
|
353
|
-
onChange:
|
|
354
|
-
...
|
|
368
|
+
onChange: r,
|
|
369
|
+
...d
|
|
355
370
|
}
|
|
356
371
|
),
|
|
357
|
-
e.fieldOptions && ((
|
|
372
|
+
e.fieldOptions && ((a = e.fieldOptions.fileInBase64) == null ? void 0 : a.helperText)
|
|
358
373
|
] })
|
|
359
374
|
}
|
|
360
375
|
);
|
|
361
376
|
}
|
|
362
377
|
}
|
|
363
378
|
),
|
|
364
|
-
!((
|
|
365
|
-
|
|
379
|
+
!((z = (Y = e.fieldOptions) == null ? void 0 : Y.redacted) != null && z.hidden) && /* @__PURE__ */ i(
|
|
380
|
+
h,
|
|
366
381
|
{
|
|
367
|
-
condition:
|
|
368
|
-
wrapper: (t) => /* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ i(
|
|
370
|
-
/* @__PURE__ */ i(
|
|
382
|
+
condition: c === "left",
|
|
383
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
384
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Redacted" }),
|
|
385
|
+
/* @__PURE__ */ i(l, { width: "68%", children: t })
|
|
371
386
|
] }),
|
|
372
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
373
388
|
/* @__PURE__ */ i(
|
|
374
|
-
|
|
389
|
+
oe,
|
|
375
390
|
{
|
|
376
391
|
control: /* @__PURE__ */ i(
|
|
377
|
-
|
|
392
|
+
u,
|
|
378
393
|
{
|
|
379
394
|
name: "redacted",
|
|
380
|
-
control:
|
|
381
|
-
render: ({ field: { value: t, ...
|
|
395
|
+
control: m,
|
|
396
|
+
render: ({ field: { value: t, ...n } }) => /* @__PURE__ */ i(ce, { checked: !!t, ...n })
|
|
382
397
|
}
|
|
383
398
|
),
|
|
384
|
-
label:
|
|
399
|
+
label: c === "default" ? "Redacted" : void 0
|
|
385
400
|
}
|
|
386
401
|
),
|
|
387
|
-
e.fieldOptions && ((
|
|
402
|
+
e.fieldOptions && ((X = e.fieldOptions.redacted) == null ? void 0 : X.helperText)
|
|
388
403
|
] })
|
|
389
404
|
}
|
|
390
405
|
),
|
|
391
|
-
!((
|
|
392
|
-
|
|
406
|
+
!((ee = (Z = e.fieldOptions) == null ? void 0 : Z.contentEncrypted) != null && ee.hidden) && /* @__PURE__ */ i(
|
|
407
|
+
h,
|
|
393
408
|
{
|
|
394
|
-
condition:
|
|
395
|
-
wrapper: (t) => /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */ i(
|
|
397
|
-
/* @__PURE__ */ i(
|
|
409
|
+
condition: c === "left",
|
|
410
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
411
|
+
/* @__PURE__ */ i(y, { width: "32%", children: "Content Encrypted" }),
|
|
412
|
+
/* @__PURE__ */ i(l, { width: "68%", children: t })
|
|
398
413
|
] }),
|
|
399
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
400
415
|
/* @__PURE__ */ i(
|
|
401
|
-
|
|
416
|
+
oe,
|
|
402
417
|
{
|
|
403
418
|
control: /* @__PURE__ */ i(
|
|
404
|
-
|
|
419
|
+
u,
|
|
405
420
|
{
|
|
406
421
|
name: "contentEncrypted",
|
|
407
|
-
control:
|
|
408
|
-
render: ({ field: { value: t, ...
|
|
422
|
+
control: m,
|
|
423
|
+
render: ({ field: { value: t, ...n } }) => /* @__PURE__ */ i(ce, { checked: !!t, ...n })
|
|
409
424
|
}
|
|
410
425
|
),
|
|
411
|
-
label:
|
|
426
|
+
label: c === "default" ? "Content Encrypted" : void 0
|
|
412
427
|
}
|
|
413
428
|
),
|
|
414
|
-
e.fieldOptions && ((
|
|
429
|
+
e.fieldOptions && ((te = e.fieldOptions.contentEncrypted) == null ? void 0 : te.helperText)
|
|
415
430
|
] })
|
|
416
431
|
}
|
|
417
432
|
)
|
|
418
433
|
] }),
|
|
419
|
-
!((
|
|
420
|
-
|
|
434
|
+
!((ne = (ie = e.fieldOptions) == null ? void 0 : ie.disseminationList) != null && ne.hidden) && /* @__PURE__ */ i(
|
|
435
|
+
u,
|
|
421
436
|
{
|
|
422
437
|
name: "disseminationList",
|
|
423
438
|
rules: {
|
|
424
439
|
required: !0
|
|
425
440
|
},
|
|
426
|
-
control:
|
|
427
|
-
render: ({ field: { value: t, onChange:
|
|
428
|
-
const
|
|
429
|
-
|
|
441
|
+
control: m,
|
|
442
|
+
render: ({ field: { value: t, onChange: n }, fieldState: d }) => {
|
|
443
|
+
const r = t || [], a = (s) => {
|
|
444
|
+
n(s);
|
|
430
445
|
};
|
|
431
446
|
return /* @__PURE__ */ i(
|
|
432
|
-
|
|
447
|
+
Ee,
|
|
433
448
|
{
|
|
434
|
-
selectedIds:
|
|
449
|
+
selectedIds: r,
|
|
435
450
|
memberedGroups: e.memberedGroups,
|
|
436
|
-
showError: !!
|
|
451
|
+
showError: !!d.error,
|
|
437
452
|
variant: e.inputVariant,
|
|
438
|
-
labelPosition:
|
|
439
|
-
onChange:
|
|
453
|
+
labelPosition: c,
|
|
454
|
+
onChange: a
|
|
440
455
|
}
|
|
441
456
|
);
|
|
442
457
|
}
|
|
443
458
|
}
|
|
444
459
|
),
|
|
445
|
-
!((
|
|
446
|
-
|
|
460
|
+
!((ae = (le = e.fieldOptions) == null ? void 0 : le.securityLevelId) != null && ae.hidden) && /* @__PURE__ */ i(l, { mt: 2, children: /* @__PURE__ */ i(
|
|
461
|
+
u,
|
|
447
462
|
{
|
|
448
463
|
name: "securityLevelId",
|
|
449
464
|
rules: {
|
|
450
465
|
required: !0
|
|
451
466
|
},
|
|
452
|
-
control:
|
|
453
|
-
render: ({ field: { value: t, onChange:
|
|
454
|
-
var
|
|
455
|
-
const
|
|
456
|
-
|
|
467
|
+
control: m,
|
|
468
|
+
render: ({ field: { value: t, onChange: n }, fieldState: d }) => {
|
|
469
|
+
var a, s;
|
|
470
|
+
const r = (f) => {
|
|
471
|
+
n(f);
|
|
457
472
|
};
|
|
458
473
|
return /* @__PURE__ */ i(
|
|
459
|
-
|
|
474
|
+
Pe,
|
|
460
475
|
{
|
|
461
476
|
value: t || 0,
|
|
462
477
|
ontologyId: e.ontologyId,
|
|
463
478
|
appRoles: e.appRoles,
|
|
464
479
|
securityLevels: e.securityLevels,
|
|
465
480
|
minLevelId: e.minSecurityLevel,
|
|
466
|
-
templateKeys: (
|
|
467
|
-
templateType: (
|
|
468
|
-
showError: !!
|
|
481
|
+
templateKeys: (a = e.securityLevelConfig) == null ? void 0 : a.templateKeys,
|
|
482
|
+
templateType: (s = e.securityLevelConfig) == null ? void 0 : s.templateType,
|
|
483
|
+
showError: !!d.error,
|
|
469
484
|
variant: e.inputVariant,
|
|
470
|
-
labelPosition:
|
|
471
|
-
onChange:
|
|
485
|
+
labelPosition: c,
|
|
486
|
+
onChange: r
|
|
472
487
|
}
|
|
473
488
|
);
|
|
474
489
|
}
|
|
475
490
|
}
|
|
476
491
|
) }),
|
|
477
|
-
/* @__PURE__ */
|
|
492
|
+
/* @__PURE__ */ o(l, { display: "flex", justifyContent: "space-between", mt: 3, children: [
|
|
478
493
|
/* @__PURE__ */ i(
|
|
479
|
-
|
|
494
|
+
w,
|
|
480
495
|
{
|
|
481
496
|
color: "primary",
|
|
482
497
|
variant: "text",
|
|
483
498
|
disabled: e.loading,
|
|
484
499
|
sx: { textTransform: "none" },
|
|
485
|
-
onClick:
|
|
500
|
+
onClick: be,
|
|
486
501
|
children: "Cancel"
|
|
487
502
|
}
|
|
488
503
|
),
|
|
489
|
-
/* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ o(l, { children: [
|
|
490
505
|
e.onRemove !== void 0 && /* @__PURE__ */ i(
|
|
491
|
-
|
|
506
|
+
w,
|
|
492
507
|
{
|
|
493
508
|
type: "button",
|
|
494
509
|
color: "error",
|
|
@@ -499,8 +514,8 @@ function Se(e, le) {
|
|
|
499
514
|
children: e.removeLoading ? "Deleting..." : "Delete"
|
|
500
515
|
}
|
|
501
516
|
),
|
|
502
|
-
e.saveButtons ? e.saveButtons.map((t,
|
|
503
|
-
|
|
517
|
+
e.saveButtons ? e.saveButtons.map((t, n) => /* @__PURE__ */ i(
|
|
518
|
+
w,
|
|
504
519
|
{
|
|
505
520
|
type: "submit",
|
|
506
521
|
color: "primary",
|
|
@@ -511,9 +526,9 @@ function Se(e, le) {
|
|
|
511
526
|
onClick: t.onClick,
|
|
512
527
|
children: t.label
|
|
513
528
|
},
|
|
514
|
-
|
|
529
|
+
n
|
|
515
530
|
)) : /* @__PURE__ */ i(
|
|
516
|
-
|
|
531
|
+
w,
|
|
517
532
|
{
|
|
518
533
|
type: "submit",
|
|
519
534
|
color: "primary",
|
|
@@ -531,7 +546,7 @@ function Se(e, le) {
|
|
|
531
546
|
}
|
|
532
547
|
);
|
|
533
548
|
}
|
|
534
|
-
const
|
|
549
|
+
const ze = v.forwardRef(De);
|
|
535
550
|
export {
|
|
536
|
-
|
|
551
|
+
ze as InstanceForm
|
|
537
552
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -244,6 +244,7 @@ declare interface FieldOptions {
|
|
|
244
244
|
minDate?: Dayjs;
|
|
245
245
|
helperText?: React.ReactNode;
|
|
246
246
|
component?: React.ReactNode;
|
|
247
|
+
maxChar?: number;
|
|
247
248
|
[key: string]: string | number | object | boolean;
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -270,7 +271,7 @@ declare function importKey(jwk: any): Promise<CryptoKey>;
|
|
|
270
271
|
|
|
271
272
|
export declare const InstanceForm: <T extends ONTOLOGY.Object | ONTOLOGY.Event | ONTOLOGY.Agent | ONTOLOGY.File, K extends INSTANCE.CreateObjectDTO | INSTANCE.UpdateObjectDTO | INSTANCE.CreateEventDTO | INSTANCE.UpdateEventDTO | INSTANCE.CreateAgentDTO | INSTANCE.CreateFileDTO | INSTANCE.UpdateFileDTO>(props: InstanceFormProps<T, K> & default_2.RefAttributes<InstanceFormHandle>) => default_2.ReactNode | null;
|
|
272
273
|
|
|
273
|
-
declare interface InstanceFormHandle {
|
|
274
|
+
export declare interface InstanceFormHandle {
|
|
274
275
|
/**
|
|
275
276
|
*
|
|
276
277
|
* @returns
|
|
@@ -290,6 +291,10 @@ declare interface InstanceFormHandle {
|
|
|
290
291
|
* @returns
|
|
291
292
|
*/
|
|
292
293
|
getFormValue: (name: any) => any;
|
|
294
|
+
/**
|
|
295
|
+
* @returns whether any form field has been modified
|
|
296
|
+
*/
|
|
297
|
+
isDirty(): boolean;
|
|
293
298
|
}
|
|
294
299
|
|
|
295
300
|
declare interface InstanceFormProps<
|