@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.
@@ -1,293 +1,308 @@
1
- import { jsx as i, jsxs as d, Fragment as he } from "react/jsx-runtime";
2
- import h, { useRef as be } from "react";
3
- import ve from "lodash";
4
- import { useForm as ye, Controller as f } from "react-hook-form";
5
- import { getNestedChildrenFromMap as ge } from "../../utils/ontology.js";
6
- import { i as Te, d as xe } from "../../utils-Bq0ye5vf.js";
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 Ie } from "../container/index.js";
9
- import { Box as n, Typography as b, TextField as g, FormGroup as we, FormControlLabel as te, Checkbox as ie, Button as I } from "@mui/material";
10
- import { TreeSelect as Pe } from "../tree-select/index.js";
11
- import Ce from "./components/policy-list/index.js";
12
- import Le from "./components/variables/index.js";
13
- import { DisseminationList as Oe } from "../data-security-selectors/dissemination-list/index.js";
14
- import { SecurityLevel as pe } from "../data-security-selectors/security-level/index.js";
15
- const Ve = {
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 Se(e, le) {
23
- var p, V, S, F, k, R, E, B, D, _, A, W, q, N, K, M, U, j, G, H, J, $, Q, Y, z, X, Z;
24
- const P = be(null), {
25
- register: C,
26
- handleSubmit: ne,
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: ae, isDirty: de },
29
- getValues: L,
28
+ formState: { errors: me, isDirty: O },
29
+ getValues: V,
30
30
  setValue: T,
31
- reset: re
32
- } = ye({
31
+ reset: fe,
32
+ watch: p
33
+ } = we({
33
34
  defaultValues: e.defaultValues
34
- }), [oe, ce] = h.useState([]), [x, O] = h.useState(), [Fe, se] = h.useState(0), me = h.useMemo(() => {
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((l) => {
37
- l.creatable || t.push(String(l.id));
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 }, l = e.mappedTemplates.get(t.templateId);
43
- if (l) {
44
- const a = l.properties.filter(
45
- (o) => o.privacyPreservationMethod === "ENCRYPTION"
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 (a.length > 0)
48
- for (let o = 0; o < a.length; o++) {
49
- const r = a[o], c = ve.get(t, `variables.${r.propertyId}`);
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 Te(Ve), v = await xe(m, String(c));
52
- v.data && (T(`variables.${r.propertyId}`, v.data), se((y) => y + 1));
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 w = () => {
59
- const t = L("templateId");
60
- x && O(void 0);
61
- const l = ge(e.mappedTemplates);
62
- ce(l);
63
- for (const a of e.mappedTemplates.values())
64
- if (a.id === t) {
65
- O(a);
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(le, () => ({
70
+ h.useImperativeHandle(ce, () => ({
70
71
  requestSubmit() {
71
72
  var t;
72
- (t = P.current) == null || t.requestSubmit();
73
+ (t = C.current) == null || t.requestSubmit();
73
74
  },
74
75
  resetForm() {
75
- re({
76
+ fe({
76
77
  title: "",
77
78
  description: "",
78
79
  templateId: 0,
79
80
  variables: {}
80
- }), w();
81
+ }), P();
81
82
  },
82
- setFormValue(t, l) {
83
- T(t, l);
83
+ setFormValue(t, n) {
84
+ T(t, n);
84
85
  },
85
86
  getFormValue(t) {
86
- return L(t);
87
+ return V(t);
88
+ },
89
+ isDirty() {
90
+ return O;
87
91
  }
88
- })), h.useEffect(() => (w(), () => {
92
+ })), h.useEffect(() => (P(), () => {
89
93
  }), [e.mappedTemplates]), h.useEffect(() => {
90
- e.onSelectedTemplateChange && e.onSelectedTemplateChange(x);
91
- }, [x]);
92
- const fe = () => {
94
+ e.onSelectedTemplateChange && e.onSelectedTemplateChange(I);
95
+ }, [I]);
96
+ const ge = () => {
93
97
  if (e.onCancel) {
94
- e.onCancel(de);
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
- Ie,
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__ */ d(
119
+ children: /* @__PURE__ */ o(
111
120
  "form",
112
121
  {
113
- ref: P,
114
- onSubmit: ne(e.onSubmit),
122
+ ref: C,
123
+ onSubmit: se(e.onSubmit),
115
124
  style: { display: "flex", flexDirection: "column" },
116
125
  children: [
117
- !((V = (p = e.fieldOptions) == null ? void 0 : p.title) != null && V.hidden) && /* @__PURE__ */ i(
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__ */ d(n, { display: "flex", alignItems: "center", children: [
122
- /* @__PURE__ */ i(b, { width: "32%", children: "Title *" }),
123
- /* @__PURE__ */ i(n, { width: "68%", children: t })
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__ */ d(n, { mb: 2, children: [
134
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
126
135
  /* @__PURE__ */ i(
127
- g,
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
- ...C("title", { required: !0 }),
133
- ...ae.title && {
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
- e.fieldOptions && ((S = e.fieldOptions.title) == null ? void 0 : S.helperText)
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
- !((k = (F = e.fieldOptions) == null ? void 0 : F.description) != null && k.hidden) && /* @__PURE__ */ i(
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__ */ d(n, { display: "flex", alignItems: "center", children: [
148
- /* @__PURE__ */ i(b, { width: "32%", children: "Description" }),
149
- /* @__PURE__ */ i(n, { width: "68%", children: t })
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__ */ d(n, { mb: 2, children: [
162
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
152
163
  /* @__PURE__ */ i(
153
- g,
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: (E = (R = e.fieldOptions) == null ? void 0 : R.description) == null ? void 0 : E.minRows,
160
- ...C("description")
171
+ minRows: (N = (A = e.fieldOptions) == null ? void 0 : A.description) == null ? void 0 : N.minRows,
172
+ ...L("description")
161
173
  }
162
174
  ),
163
- e.fieldOptions && ((B = e.fieldOptions.description) == null ? void 0 : B.helperText)
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
- !((_ = (D = e.fieldOptions) == null ? void 0 : D.templateId) != null && _.hidden) && /* @__PURE__ */ i(
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__ */ d(n, { display: "flex", alignItems: "center", children: [
172
- /* @__PURE__ */ i(b, { width: "32%", children: "Template" }),
173
- /* @__PURE__ */ i(n, { width: "68%", children: t })
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__ */ d(we, { sx: { mb: 2 }, children: [
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: l } }) => {
182
- var a, o;
183
- if ((o = (a = e.fieldOptions) == null ? void 0 : a.templateId) != null && o.disabled) {
184
- const r = t ? e.mappedTemplates.get(t) : void 0;
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
- g,
201
+ x,
187
202
  {
188
203
  label: "Template",
189
204
  variant: e.inputVariant,
190
205
  fullWidth: !0,
191
206
  disabled: !0,
192
- value: r == null ? void 0 : r.name,
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
- Pe,
213
+ pe,
199
214
  {
200
215
  label: e.labelPosition === "default" ? "Template" : void 0,
201
- data: oe,
216
+ data: ue,
202
217
  selected: t === 0 ? "" : [String(t)],
203
- disabled: me,
218
+ disabled: ve,
204
219
  variant: e.inputVariant,
205
- onChange: (r, c) => {
220
+ onChange: (a, c) => {
206
221
  const m = {
207
222
  target: {
208
- value: c ? Number(r) : 0
223
+ value: c ? Number(a) : 0
209
224
  }
210
225
  };
211
- l(m), w();
226
+ n(m), P();
212
227
  }
213
228
  }
214
229
  );
215
230
  }
216
231
  }
217
232
  ),
218
- e.fieldOptions && ((A = e.fieldOptions.templateId) == null ? void 0 : A.helperText)
233
+ e.fieldOptions && ((K = e.fieldOptions.templateId) == null ? void 0 : K.helperText)
219
234
  ] })
220
235
  }
221
236
  ),
222
- "aliasList" in e.defaultValues && !((q = (W = e.fieldOptions) == null ? void 0 : W.aliasList) != null && q.hidden) && /* @__PURE__ */ i(
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: l, ...a } }) => {
228
- var r;
229
- const o = (c) => {
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((ee) => ee.trimStart())
247
+ value: c.target.value.split(",").map((ae) => ae.trimStart())
233
248
  }
234
249
  };
235
- l(y);
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__ */ d(n, { display: "flex", alignItems: "center", children: [
242
- /* @__PURE__ */ i(b, { width: "32%", children: "Alias List" }),
243
- /* @__PURE__ */ i(n, { width: "68%", children: c })
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__ */ d(n, { mb: 2, children: [
260
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
246
261
  /* @__PURE__ */ i(
247
- g,
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: o,
255
- ...a
269
+ onChange: r,
270
+ ...d
256
271
  }
257
272
  ),
258
- e.fieldOptions && ((r = e.fieldOptions.aliasList) == null ? void 0 : r.helperText)
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 && !((K = (N = e.fieldOptions) == null ? void 0 : N.appliedPolicies) != null && K.hidden) && /* @__PURE__ */ i(
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: l } }) => {
271
- var a;
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: (o) => /* @__PURE__ */ d(n, { display: "flex", alignItems: "center", children: [
277
- /* @__PURE__ */ i(b, { width: "32%", children: "Policy List" }),
278
- /* @__PURE__ */ i(n, { width: "68%", children: o })
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__ */ d(n, { mb: 2, children: [
295
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
281
296
  /* @__PURE__ */ i(
282
- Ce,
297
+ Se,
283
298
  {
284
299
  policyList: e.policyList,
285
300
  labelPosition: e.labelPosition,
286
301
  value: t || void 0,
287
- onChange: l
302
+ onChange: n
288
303
  }
289
304
  ),
290
- e.fieldOptions && ((a = e.fieldOptions.appliedPolicies) == null ? void 0 : a.helperText)
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: l } }) => /* @__PURE__ */ i(
303
- Le,
317
+ render: ({ field: { value: t, onChange: n } }) => /* @__PURE__ */ i(
318
+ Fe,
304
319
  {
305
- template: x,
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: l
326
+ onChange: n
312
327
  }
313
328
  )
314
329
  }
315
330
  ),
316
- "fileInBase64" in e.defaultValues && !((U = (M = e.fieldOptions) == null ? void 0 : M.fileInBase64) != null && U.hidden) && /* @__PURE__ */ d(he, { children: [
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: l, ...a } }) => {
323
- var r;
324
- const o = (c) => {
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 ue = y.target.result.split("base64,")[1];
329
- t(ue);
343
+ const ye = y.target.result.split("base64,")[1];
344
+ t(ye);
330
345
  };
331
- const v = c.target.files[0];
332
- T("originalFileName", v.name), T("contentType", v.type), m.readAsDataURL(v);
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__ */ d(n, { display: "flex", alignItems: "center", children: [
340
- /* @__PURE__ */ i(b, { width: "32%", children: "File to Upload" }),
341
- /* @__PURE__ */ i(n, { width: "68%", children: c })
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__ */ d(n, { mb: 2, children: [
358
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
344
359
  /* @__PURE__ */ i(
345
- g,
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: o,
354
- ...a
368
+ onChange: r,
369
+ ...d
355
370
  }
356
371
  ),
357
- e.fieldOptions && ((r = e.fieldOptions.fileInBase64) == null ? void 0 : r.helperText)
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
- !((G = (j = e.fieldOptions) == null ? void 0 : j.redacted) != null && G.hidden) && /* @__PURE__ */ i(
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__ */ d(n, { display: "flex", alignItems: "center", children: [
369
- /* @__PURE__ */ i(b, { width: "32%", children: "Redacted" }),
370
- /* @__PURE__ */ i(n, { width: "68%", children: t })
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__ */ d(n, { mb: 2, children: [
387
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
373
388
  /* @__PURE__ */ i(
374
- te,
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, ...l } }) => /* @__PURE__ */ i(ie, { checked: !!t, ...l })
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 && ((H = e.fieldOptions.redacted) == null ? void 0 : H.helperText)
402
+ e.fieldOptions && ((z = e.fieldOptions.redacted) == null ? void 0 : z.helperText)
388
403
  ] })
389
404
  }
390
405
  ),
391
- !(($ = (J = e.fieldOptions) == null ? void 0 : J.contentEncrypted) != null && $.hidden) && /* @__PURE__ */ i(
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__ */ d(n, { display: "flex", alignItems: "center", children: [
396
- /* @__PURE__ */ i(b, { width: "32%", children: "Content Encrypted" }),
397
- /* @__PURE__ */ i(n, { width: "68%", children: t })
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__ */ d(n, { mb: 2, children: [
414
+ children: /* @__PURE__ */ o(l, { mb: 2, children: [
400
415
  /* @__PURE__ */ i(
401
- te,
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, ...l } }) => /* @__PURE__ */ i(ie, { checked: !!t, ...l })
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 && ((Q = e.fieldOptions.contentEncrypted) == null ? void 0 : Q.helperText)
429
+ e.fieldOptions && ((ee = e.fieldOptions.contentEncrypted) == null ? void 0 : ee.helperText)
415
430
  ] })
416
431
  }
417
432
  )
418
433
  ] }),
419
- !((z = (Y = e.fieldOptions) == null ? void 0 : Y.disseminationList) != null && z.hidden) && /* @__PURE__ */ i(
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: l }, fieldState: a }) => {
428
- const o = t || [], r = (c) => {
429
- l(c);
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
- Oe,
447
+ ke,
433
448
  {
434
- selectedIds: o,
449
+ selectedIds: r,
435
450
  memberedGroups: e.memberedGroups,
436
- showError: !!a.error,
451
+ showError: !!d.error,
437
452
  variant: e.inputVariant,
438
453
  labelPosition: e.labelPosition,
439
- onChange: r
454
+ onChange: a
440
455
  }
441
456
  );
442
457
  }
443
458
  }
444
459
  ),
445
- !((Z = (X = e.fieldOptions) == null ? void 0 : X.securityLevelId) != null && Z.hidden) && /* @__PURE__ */ i(n, { mt: 2, children: /* @__PURE__ */ i(
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: l }, fieldState: a }) => {
454
- var r, c;
455
- const o = (m) => {
456
- l(m);
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
- pe,
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: (r = e.securityLevelConfig) == null ? void 0 : r.templateKeys,
481
+ templateKeys: (a = e.securityLevelConfig) == null ? void 0 : a.templateKeys,
467
482
  templateType: (c = e.securityLevelConfig) == null ? void 0 : c.templateType,
468
- showError: !!a.error,
483
+ showError: !!d.error,
469
484
  variant: e.inputVariant,
470
485
  labelPosition: e.labelPosition,
471
- onChange: o
486
+ onChange: r
472
487
  }
473
488
  );
474
489
  }
475
490
  }
476
491
  ) }),
477
- /* @__PURE__ */ d(n, { display: "flex", justifyContent: "space-between", mt: 3, children: [
492
+ /* @__PURE__ */ o(l, { display: "flex", justifyContent: "space-between", mt: 3, children: [
478
493
  /* @__PURE__ */ i(
479
- I,
494
+ w,
480
495
  {
481
496
  color: "primary",
482
497
  variant: "text",
483
498
  disabled: e.loading,
484
499
  sx: { textTransform: "none" },
485
- onClick: fe,
500
+ onClick: ge,
486
501
  children: "Cancel"
487
502
  }
488
503
  ),
489
- /* @__PURE__ */ d(n, { children: [
504
+ /* @__PURE__ */ o(l, { children: [
490
505
  e.onRemove !== void 0 && /* @__PURE__ */ i(
491
- I,
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, l) => /* @__PURE__ */ i(
503
- I,
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
- l
529
+ n
515
530
  )) : /* @__PURE__ */ i(
516
- I,
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 Ge = h.forwardRef(Se);
549
+ const Ye = h.forwardRef(Be);
535
550
  export {
536
- Ge as InstanceForm
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<
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.5.38",
4
+ "version": "1.5.40",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",