@hybridcore/ui 1.5.38 → 1.5.40
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 +198 -183
- 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 h, { useRef as
|
|
3
|
-
import
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { getNestedChildrenFromMap as
|
|
6
|
-
import { i as
|
|
1
|
+
import { jsx as i, jsxs as o, Fragment as xe } from "react/jsx-runtime";
|
|
2
|
+
import h, { useRef as Te } from "react";
|
|
3
|
+
import Ie from "lodash";
|
|
4
|
+
import { useForm as we, Controller as f } from "react-hook-form";
|
|
5
|
+
import { getNestedChildrenFromMap as Pe } from "../../utils/ontology.js";
|
|
6
|
+
import { i as Ce, d as Le } from "../../utils-Bq0ye5vf.js";
|
|
7
7
|
import { ConditionalWrapper as u } from "../conditional-wrapper/index.js";
|
|
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
|
|
8
|
+
import { Container as Oe } from "../container/index.js";
|
|
9
|
+
import { Box as l, Typography as v, TextField as x, FormHelperText as de, FormGroup as Ve, FormControlLabel as re, Checkbox as oe, Button as w } from "@mui/material";
|
|
10
|
+
import { TreeSelect as pe } from "../tree-select/index.js";
|
|
11
|
+
import Se from "./components/policy-list/index.js";
|
|
12
|
+
import Fe from "./components/variables/index.js";
|
|
13
|
+
import { DisseminationList as ke } from "../data-security-selectors/dissemination-list/index.js";
|
|
14
|
+
import { SecurityLevel as Re } from "../data-security-selectors/security-level/index.js";
|
|
15
|
+
const Ee = {
|
|
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:
|
|
22
|
+
function Be(e, ce) {
|
|
23
|
+
var F, k, R, E, B, D, A, N, _, W, q, $, K, M, U, j, G, H, J, Q, Y, z, X, Z, ee, te, ie, ne, le;
|
|
24
|
+
const C = Te(null), {
|
|
25
|
+
register: L,
|
|
26
|
+
handleSubmit: se,
|
|
27
27
|
control: s,
|
|
28
|
-
formState: { errors:
|
|
29
|
-
getValues:
|
|
28
|
+
formState: { errors: me, isDirty: O },
|
|
29
|
+
getValues: V,
|
|
30
30
|
setValue: T,
|
|
31
|
-
reset:
|
|
32
|
-
|
|
31
|
+
reset: fe,
|
|
32
|
+
watch: p
|
|
33
|
+
} = we({
|
|
33
34
|
defaultValues: e.defaultValues
|
|
34
|
-
}), [
|
|
35
|
+
}), [ue, he] = h.useState([]), [I, S] = h.useState(), [De, be] = h.useState(0), ve = h.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
|
h.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
|
|
48
|
+
if (d.length > 0)
|
|
49
|
+
for (let r = 0; r < d.length; r++) {
|
|
50
|
+
const a = d[r], c = Ie.get(t, `variables.${a.propertyId}`);
|
|
50
51
|
if (c && e.keyAuth) {
|
|
51
|
-
const m = await
|
|
52
|
-
|
|
52
|
+
const m = await Ce(Ee), g = await Le(m, String(c));
|
|
53
|
+
g.data && (T(`variables.${a.propertyId}`, g.data), be((y) => y + 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 P = () => {
|
|
60
|
+
const t = V("templateId");
|
|
61
|
+
I && S(void 0);
|
|
62
|
+
const n = Pe(e.mappedTemplates);
|
|
63
|
+
he(n);
|
|
64
|
+
for (const d of e.mappedTemplates.values())
|
|
65
|
+
if (d.id === t) {
|
|
66
|
+
S(d);
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
|
-
h.useImperativeHandle(
|
|
70
|
+
h.useImperativeHandle(ce, () => ({
|
|
70
71
|
requestSubmit() {
|
|
71
72
|
var t;
|
|
72
|
-
(t =
|
|
73
|
+
(t = C.current) == null || t.requestSubmit();
|
|
73
74
|
},
|
|
74
75
|
resetForm() {
|
|
75
|
-
|
|
76
|
+
fe({
|
|
76
77
|
title: "",
|
|
77
78
|
description: "",
|
|
78
79
|
templateId: 0,
|
|
79
80
|
variables: {}
|
|
80
|
-
}),
|
|
81
|
+
}), P();
|
|
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 V(t);
|
|
88
|
+
},
|
|
89
|
+
isDirty() {
|
|
90
|
+
return O;
|
|
87
91
|
}
|
|
88
|
-
})), h.useEffect(() => (
|
|
92
|
+
})), h.useEffect(() => (P(), () => {
|
|
89
93
|
}), [e.mappedTemplates]), h.useEffect(() => {
|
|
90
|
-
e.onSelectedTemplateChange && e.onSelectedTemplateChange(
|
|
91
|
-
}, [
|
|
92
|
-
const
|
|
94
|
+
e.onSelectedTemplateChange && e.onSelectedTemplateChange(I);
|
|
95
|
+
}, [I]);
|
|
96
|
+
const ge = () => {
|
|
93
97
|
if (e.onCancel) {
|
|
94
|
-
e.onCancel(
|
|
98
|
+
e.onCancel(O);
|
|
95
99
|
return;
|
|
96
100
|
}
|
|
101
|
+
}, b = (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
|
u,
|
|
100
109
|
{
|
|
101
110
|
condition: e.variant === void 0 || e.variant === "inline",
|
|
102
111
|
wrapper: (t) => /* @__PURE__ */ i(
|
|
103
|
-
|
|
112
|
+
Oe,
|
|
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: C,
|
|
123
|
+
onSubmit: se(e.onSubmit),
|
|
115
124
|
style: { display: "flex", flexDirection: "column" },
|
|
116
125
|
children: [
|
|
117
|
-
!((
|
|
126
|
+
!((k = (F = e.fieldOptions) == null ? void 0 : F.title) != null && k.hidden) && /* @__PURE__ */ i(
|
|
118
127
|
u,
|
|
119
128
|
{
|
|
120
129
|
condition: e.labelPosition === "left",
|
|
121
|
-
wrapper: (t) => /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */ i(
|
|
123
|
-
/* @__PURE__ */ i(
|
|
130
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
131
|
+
/* @__PURE__ */ i(v, { 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
138
|
label: e.labelPosition === "default" ? "Title *" : void 0,
|
|
130
139
|
variant: e.inputVariant,
|
|
140
|
+
inputProps: b("title") ? { maxLength: b("title") } : void 0,
|
|
131
141
|
fullWidth: !0,
|
|
132
|
-
...
|
|
133
|
-
...
|
|
142
|
+
...L("title", { required: !0 }),
|
|
143
|
+
...me.title && {
|
|
134
144
|
helperText: "This field is required!",
|
|
135
145
|
error: !0
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
),
|
|
139
|
-
|
|
149
|
+
b("title") && /* @__PURE__ */ i(de, { sx: { textAlign: "right", mt: 0.5 }, children: `${(R = p("title")) == null ? void 0 : R.length}/${b("title")}` }),
|
|
150
|
+
e.fieldOptions && ((E = e.fieldOptions.title) == null ? void 0 : E.helperText)
|
|
140
151
|
] })
|
|
141
152
|
}
|
|
142
153
|
),
|
|
143
|
-
!((
|
|
154
|
+
!((D = (B = e.fieldOptions) == null ? void 0 : B.description) != null && D.hidden) && /* @__PURE__ */ i(
|
|
144
155
|
u,
|
|
145
156
|
{
|
|
146
157
|
condition: e.labelPosition === "left",
|
|
147
|
-
wrapper: (t) => /* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */ i(
|
|
149
|
-
/* @__PURE__ */ i(
|
|
158
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
159
|
+
/* @__PURE__ */ i(v, { 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
166
|
label: e.labelPosition === "default" ? "Description" : void 0,
|
|
167
|
+
inputProps: b("description") ? { maxLength: b("description") } : void 0,
|
|
156
168
|
variant: e.inputVariant,
|
|
157
169
|
fullWidth: !0,
|
|
158
170
|
multiline: !0,
|
|
159
|
-
minRows: (
|
|
160
|
-
...
|
|
171
|
+
minRows: (N = (A = e.fieldOptions) == null ? void 0 : A.description) == null ? void 0 : N.minRows,
|
|
172
|
+
...L("description")
|
|
161
173
|
}
|
|
162
174
|
),
|
|
163
|
-
|
|
175
|
+
b("description") && /* @__PURE__ */ i(de, { sx: { textAlign: "right", mt: 0.5 }, children: `${(_ = p("description")) == null ? void 0 : _.length}/${b(
|
|
176
|
+
"description"
|
|
177
|
+
)}` }),
|
|
178
|
+
e.fieldOptions && ((W = e.fieldOptions.description) == null ? void 0 : W.helperText)
|
|
164
179
|
] })
|
|
165
180
|
}
|
|
166
181
|
),
|
|
167
|
-
!((
|
|
182
|
+
!(($ = (q = e.fieldOptions) == null ? void 0 : q.templateId) != null && $.hidden) && /* @__PURE__ */ i(
|
|
168
183
|
u,
|
|
169
184
|
{
|
|
170
185
|
condition: e.labelPosition === "left",
|
|
171
|
-
wrapper: (t) => /* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */ i(
|
|
173
|
-
/* @__PURE__ */ i(
|
|
186
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
187
|
+
/* @__PURE__ */ i(v, { width: "32%", children: "Template" }),
|
|
188
|
+
/* @__PURE__ */ i(l, { width: "68%", children: t })
|
|
174
189
|
] }),
|
|
175
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ o(Ve, { sx: { mb: 2 }, children: [
|
|
176
191
|
/* @__PURE__ */ i(
|
|
177
192
|
f,
|
|
178
193
|
{
|
|
179
194
|
name: "templateId",
|
|
180
195
|
control: s,
|
|
181
|
-
render: ({ field: { value: t, onChange:
|
|
182
|
-
var
|
|
183
|
-
if ((
|
|
184
|
-
const
|
|
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
|
+
pe,
|
|
199
214
|
{
|
|
200
215
|
label: e.labelPosition === "default" ? "Template" : void 0,
|
|
201
|
-
data:
|
|
216
|
+
data: ue,
|
|
202
217
|
selected: t === 0 ? "" : [String(t)],
|
|
203
|
-
disabled:
|
|
218
|
+
disabled: ve,
|
|
204
219
|
variant: e.inputVariant,
|
|
205
|
-
onChange: (
|
|
220
|
+
onChange: (a, c) => {
|
|
206
221
|
const m = {
|
|
207
222
|
target: {
|
|
208
|
-
value: c ? Number(
|
|
223
|
+
value: c ? Number(a) : 0
|
|
209
224
|
}
|
|
210
225
|
};
|
|
211
|
-
|
|
226
|
+
n(m), P();
|
|
212
227
|
}
|
|
213
228
|
}
|
|
214
229
|
);
|
|
215
230
|
}
|
|
216
231
|
}
|
|
217
232
|
),
|
|
218
|
-
e.fieldOptions && ((
|
|
233
|
+
e.fieldOptions && ((K = e.fieldOptions.templateId) == null ? void 0 : K.helperText)
|
|
219
234
|
] })
|
|
220
235
|
}
|
|
221
236
|
),
|
|
222
|
-
"aliasList" in e.defaultValues && !((
|
|
237
|
+
"aliasList" in e.defaultValues && !((U = (M = e.fieldOptions) == null ? void 0 : M.aliasList) != null && U.hidden) && /* @__PURE__ */ i(
|
|
223
238
|
f,
|
|
224
239
|
{
|
|
225
240
|
name: "aliasList",
|
|
226
241
|
control: s,
|
|
227
|
-
render: ({ field: { value: t, onChange:
|
|
228
|
-
var
|
|
229
|
-
const
|
|
242
|
+
render: ({ field: { value: t, onChange: n, ...d } }) => {
|
|
243
|
+
var a;
|
|
244
|
+
const r = (c) => {
|
|
230
245
|
const y = {
|
|
231
246
|
target: {
|
|
232
|
-
value: c.target.value.split(",").map((
|
|
247
|
+
value: c.target.value.split(",").map((ae) => ae.trimStart())
|
|
233
248
|
}
|
|
234
249
|
};
|
|
235
|
-
|
|
250
|
+
n(y);
|
|
236
251
|
};
|
|
237
252
|
return /* @__PURE__ */ i(
|
|
238
253
|
u,
|
|
239
254
|
{
|
|
240
255
|
condition: e.labelPosition === "left",
|
|
241
|
-
wrapper: (c) => /* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */ i(
|
|
243
|
-
/* @__PURE__ */ i(
|
|
256
|
+
wrapper: (c) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
257
|
+
/* @__PURE__ */ i(v, { width: "32%", children: "Alias List" }),
|
|
258
|
+
/* @__PURE__ */ i(l, { width: "68%", children: c })
|
|
244
259
|
] }),
|
|
245
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ o(l, { mb: 2, children: [
|
|
246
261
|
/* @__PURE__ */ i(
|
|
247
|
-
|
|
262
|
+
x,
|
|
248
263
|
{
|
|
249
264
|
label: e.labelPosition === "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 && !((
|
|
280
|
+
"appliedPolicies" in e.defaultValues && !((G = (j = e.fieldOptions) == null ? void 0 : j.appliedPolicies) != null && G.hidden) && /* @__PURE__ */ i(
|
|
266
281
|
f,
|
|
267
282
|
{
|
|
268
283
|
name: "appliedPolicies",
|
|
269
284
|
control: s,
|
|
270
|
-
render: ({ field: { value: t, onChange:
|
|
271
|
-
var
|
|
285
|
+
render: ({ field: { value: t, onChange: n } }) => {
|
|
286
|
+
var d;
|
|
272
287
|
return /* @__PURE__ */ i(
|
|
273
288
|
u,
|
|
274
289
|
{
|
|
275
290
|
condition: e.labelPosition === "left",
|
|
276
|
-
wrapper: (
|
|
277
|
-
/* @__PURE__ */ i(
|
|
278
|
-
/* @__PURE__ */ i(
|
|
291
|
+
wrapper: (r) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
292
|
+
/* @__PURE__ */ i(v, { 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
|
+
Se,
|
|
283
298
|
{
|
|
284
299
|
policyList: e.policyList,
|
|
285
300
|
labelPosition: e.labelPosition,
|
|
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
|
);
|
|
@@ -299,50 +314,50 @@ function Se(e, le) {
|
|
|
299
314
|
{
|
|
300
315
|
name: "variables",
|
|
301
316
|
control: s,
|
|
302
|
-
render: ({ field: { value: t, onChange:
|
|
303
|
-
|
|
317
|
+
render: ({ field: { value: t, onChange: n } }) => /* @__PURE__ */ i(
|
|
318
|
+
Fe,
|
|
304
319
|
{
|
|
305
|
-
template:
|
|
320
|
+
template: I,
|
|
306
321
|
value: t,
|
|
307
322
|
mapboxAccessToken: e.mapboxAccessToken,
|
|
308
323
|
variant: e.inputVariant,
|
|
309
324
|
labelPosition: e.labelPosition,
|
|
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 && !((J = (H = e.fieldOptions) == null ? void 0 : H.fileInBase64) != null && J.hidden) && /* @__PURE__ */ o(xe, { children: [
|
|
317
332
|
/* @__PURE__ */ i(
|
|
318
333
|
f,
|
|
319
334
|
{
|
|
320
335
|
name: "fileInBase64",
|
|
321
336
|
control: s,
|
|
322
|
-
render: ({ field: { onChange: t, value:
|
|
323
|
-
var
|
|
324
|
-
const
|
|
337
|
+
render: ({ field: { onChange: t, value: n, ...d } }) => {
|
|
338
|
+
var a;
|
|
339
|
+
const r = (c) => {
|
|
325
340
|
if (c.target.files) {
|
|
326
341
|
const m = new FileReader();
|
|
327
342
|
m.onload = async (y) => {
|
|
328
|
-
const
|
|
329
|
-
t(
|
|
343
|
+
const ye = y.target.result.split("base64,")[1];
|
|
344
|
+
t(ye);
|
|
330
345
|
};
|
|
331
|
-
const
|
|
332
|
-
T("originalFileName",
|
|
346
|
+
const g = c.target.files[0];
|
|
347
|
+
T("originalFileName", g.name), T("contentType", g.type), m.readAsDataURL(g);
|
|
333
348
|
}
|
|
334
349
|
};
|
|
335
350
|
return /* @__PURE__ */ i(
|
|
336
351
|
u,
|
|
337
352
|
{
|
|
338
353
|
condition: e.labelPosition === "left",
|
|
339
|
-
wrapper: (c) => /* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */ i(
|
|
341
|
-
/* @__PURE__ */ i(
|
|
354
|
+
wrapper: (c) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
355
|
+
/* @__PURE__ */ i(v, { width: "32%", children: "File to Upload" }),
|
|
356
|
+
/* @__PURE__ */ i(l, { width: "68%", children: c })
|
|
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
363
|
label: e.labelPosition === "default" ? "File to Upload" : void 0,
|
|
@@ -350,73 +365,73 @@ function Se(e, le) {
|
|
|
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
|
-
!((
|
|
379
|
+
!((Y = (Q = e.fieldOptions) == null ? void 0 : Q.redacted) != null && Y.hidden) && /* @__PURE__ */ i(
|
|
365
380
|
u,
|
|
366
381
|
{
|
|
367
382
|
condition: e.labelPosition === "left",
|
|
368
|
-
wrapper: (t) => /* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ i(
|
|
370
|
-
/* @__PURE__ */ i(
|
|
383
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
384
|
+
/* @__PURE__ */ i(v, { 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
|
+
re,
|
|
375
390
|
{
|
|
376
391
|
control: /* @__PURE__ */ i(
|
|
377
392
|
f,
|
|
378
393
|
{
|
|
379
394
|
name: "redacted",
|
|
380
395
|
control: s,
|
|
381
|
-
render: ({ field: { value: t, ...
|
|
396
|
+
render: ({ field: { value: t, ...n } }) => /* @__PURE__ */ i(oe, { checked: !!t, ...n })
|
|
382
397
|
}
|
|
383
398
|
),
|
|
384
399
|
label: e.labelPosition === "default" ? "Redacted" : void 0
|
|
385
400
|
}
|
|
386
401
|
),
|
|
387
|
-
e.fieldOptions && ((
|
|
402
|
+
e.fieldOptions && ((z = e.fieldOptions.redacted) == null ? void 0 : z.helperText)
|
|
388
403
|
] })
|
|
389
404
|
}
|
|
390
405
|
),
|
|
391
|
-
!((
|
|
406
|
+
!((Z = (X = e.fieldOptions) == null ? void 0 : X.contentEncrypted) != null && Z.hidden) && /* @__PURE__ */ i(
|
|
392
407
|
u,
|
|
393
408
|
{
|
|
394
409
|
condition: e.labelPosition === "left",
|
|
395
|
-
wrapper: (t) => /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */ i(
|
|
397
|
-
/* @__PURE__ */ i(
|
|
410
|
+
wrapper: (t) => /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", children: [
|
|
411
|
+
/* @__PURE__ */ i(v, { 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
|
+
re,
|
|
402
417
|
{
|
|
403
418
|
control: /* @__PURE__ */ i(
|
|
404
419
|
f,
|
|
405
420
|
{
|
|
406
421
|
name: "contentEncrypted",
|
|
407
422
|
control: s,
|
|
408
|
-
render: ({ field: { value: t, ...
|
|
423
|
+
render: ({ field: { value: t, ...n } }) => /* @__PURE__ */ i(oe, { checked: !!t, ...n })
|
|
409
424
|
}
|
|
410
425
|
),
|
|
411
426
|
label: e.labelPosition === "default" ? "Content Encrypted" : void 0
|
|
412
427
|
}
|
|
413
428
|
),
|
|
414
|
-
e.fieldOptions && ((
|
|
429
|
+
e.fieldOptions && ((ee = e.fieldOptions.contentEncrypted) == null ? void 0 : ee.helperText)
|
|
415
430
|
] })
|
|
416
431
|
}
|
|
417
432
|
)
|
|
418
433
|
] }),
|
|
419
|
-
!((
|
|
434
|
+
!((ie = (te = e.fieldOptions) == null ? void 0 : te.disseminationList) != null && ie.hidden) && /* @__PURE__ */ i(
|
|
420
435
|
f,
|
|
421
436
|
{
|
|
422
437
|
name: "disseminationList",
|
|
@@ -424,25 +439,25 @@ function Se(e, le) {
|
|
|
424
439
|
required: !0
|
|
425
440
|
},
|
|
426
441
|
control: s,
|
|
427
|
-
render: ({ field: { value: t, onChange:
|
|
428
|
-
const
|
|
429
|
-
|
|
442
|
+
render: ({ field: { value: t, onChange: n }, fieldState: d }) => {
|
|
443
|
+
const r = t || [], a = (c) => {
|
|
444
|
+
n(c);
|
|
430
445
|
};
|
|
431
446
|
return /* @__PURE__ */ i(
|
|
432
|
-
|
|
447
|
+
ke,
|
|
433
448
|
{
|
|
434
|
-
selectedIds:
|
|
449
|
+
selectedIds: r,
|
|
435
450
|
memberedGroups: e.memberedGroups,
|
|
436
|
-
showError: !!
|
|
451
|
+
showError: !!d.error,
|
|
437
452
|
variant: e.inputVariant,
|
|
438
453
|
labelPosition: e.labelPosition,
|
|
439
|
-
onChange:
|
|
454
|
+
onChange: a
|
|
440
455
|
}
|
|
441
456
|
);
|
|
442
457
|
}
|
|
443
458
|
}
|
|
444
459
|
),
|
|
445
|
-
!((
|
|
460
|
+
!((le = (ne = e.fieldOptions) == null ? void 0 : ne.securityLevelId) != null && le.hidden) && /* @__PURE__ */ i(l, { mt: 2, children: /* @__PURE__ */ i(
|
|
446
461
|
f,
|
|
447
462
|
{
|
|
448
463
|
name: "securityLevelId",
|
|
@@ -450,45 +465,45 @@ function Se(e, le) {
|
|
|
450
465
|
required: !0
|
|
451
466
|
},
|
|
452
467
|
control: s,
|
|
453
|
-
render: ({ field: { value: t, onChange:
|
|
454
|
-
var
|
|
455
|
-
const
|
|
456
|
-
|
|
468
|
+
render: ({ field: { value: t, onChange: n }, fieldState: d }) => {
|
|
469
|
+
var a, c;
|
|
470
|
+
const r = (m) => {
|
|
471
|
+
n(m);
|
|
457
472
|
};
|
|
458
473
|
return /* @__PURE__ */ i(
|
|
459
|
-
|
|
474
|
+
Re,
|
|
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: (
|
|
481
|
+
templateKeys: (a = e.securityLevelConfig) == null ? void 0 : a.templateKeys,
|
|
467
482
|
templateType: (c = e.securityLevelConfig) == null ? void 0 : c.templateType,
|
|
468
|
-
showError: !!
|
|
483
|
+
showError: !!d.error,
|
|
469
484
|
variant: e.inputVariant,
|
|
470
485
|
labelPosition: e.labelPosition,
|
|
471
|
-
onChange:
|
|
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: ge,
|
|
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 Ye = h.forwardRef(Be);
|
|
535
550
|
export {
|
|
536
|
-
|
|
551
|
+
Ye 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<
|