@acellera/pm-rjsf 0.0.4 → 0.0.6

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/pm-rjsf.js CHANGED
@@ -1,61 +1,61 @@
1
- import k from "react";
2
- import G from "@rjsf/mui";
3
- import { Accordion as $, AccordionSummary as K, AccordionDetails as U, FormLabel as L, Box as M, TextField as V, Grid as x, Tooltip as O, Typography as H, IconButton as X, Button as B, ButtonGroup as J, Menu as Y, MenuItem as E, ListItemIcon as R, ListItemText as D, ThemeProvider as Q, createTheme as Z } from "@mui/material";
4
- import { customizeValidator as ee } from "@rjsf/validator-ajv8";
5
- import te from "ajv/dist/2020";
6
- import { getTemplate as ne, getUiOptions as ie, ADDITIONAL_PROPERTY_FLAG as z, canExpand as le } from "@rjsf/utils";
7
- import { ExpandMore as oe, Delete as re, DriveFolderUpload as ae, CloudDownload as se, ArrowDropDown as ce } from "@mui/icons-material";
8
- function de() {
9
- return ee({
10
- AjvClass: te,
1
+ import A from "react";
2
+ import V from "@rjsf/mui";
3
+ import { getTemplate as H, getUiOptions as X, ADDITIONAL_PROPERTY_FLAG as $, canExpand as J, getDefaultFormState as Y } from "@rjsf/utils";
4
+ import { Accordion as Q, AccordionSummary as Z, AccordionDetails as ee, FormLabel as G, Box as B, TextField as te, Grid as v, Tooltip as F, Typography as ne, IconButton as ie, Button as w, ButtonGroup as re, Menu as oe, MenuItem as _, ListItemIcon as R, ListItemText as N, ThemeProvider as le, createTheme as se } from "@mui/material";
5
+ import { customizeValidator as ae } from "@rjsf/validator-ajv8";
6
+ import ce from "ajv/dist/2020";
7
+ import { ExpandMore as de, Delete as ue, DriveFolderUpload as me, CloudDownload as fe, ArrowDropDown as pe } from "@mui/icons-material";
8
+ function ye() {
9
+ return ae({
10
+ AjvClass: ce,
11
11
  customFormats: { path: () => !0 },
12
12
  ajvOptionsOverrides: { strict: !1 }
13
13
  });
14
14
  }
15
- const N = ["outdir", "scratchdir", "execdir"];
16
- function ue(e) {
15
+ const P = ["outdir", "scratchdir", "execdir"];
16
+ function he(e) {
17
17
  if (!e || !e.properties) return e;
18
18
  const t = { ...e.properties };
19
- for (const n of N) delete t[n];
20
- const i = (e.required || []).filter((n) => !N.includes(n));
19
+ for (const n of P) delete t[n];
20
+ const i = (e.required || []).filter((n) => !P.includes(n));
21
21
  return { ...e, properties: t, required: i };
22
22
  }
23
- function w(e) {
24
- if (Array.isArray(e)) return e.map(w);
23
+ function j(e) {
24
+ if (Array.isArray(e)) return e.map(j);
25
25
  if (e && typeof e == "object") {
26
26
  if (Array.isArray(e.anyOf)) {
27
27
  const i = e.anyOf.filter((n) => !(n && n.type === "null"));
28
28
  if (i.length === 1) {
29
- const { anyOf: n, ...o } = e;
30
- return w({ ...i[0], ...o });
29
+ const { anyOf: n, default: r, ...o } = e, c = { ...i[0], ...o };
30
+ return r != null && (c.default = r), j(c);
31
31
  }
32
32
  e = { ...e, anyOf: i };
33
33
  }
34
34
  if (Array.isArray(e.oneOf) && e.discriminator && e.discriminator.mapping) {
35
35
  const i = {};
36
- for (const [n, o] of Object.entries(e.discriminator.mapping))
37
- i[o.split("/").pop()] = n;
36
+ for (const [n, r] of Object.entries(e.discriminator.mapping))
37
+ i[r.split("/").pop()] = n;
38
38
  e = {
39
39
  ...e,
40
40
  oneOf: e.oneOf.map((n) => {
41
- const o = n && n.$ref ? n.$ref.split("/").pop() : null;
42
- return o && i[o] && !n.title ? { ...n, title: i[o] } : n;
41
+ const r = n && n.$ref ? n.$ref.split("/").pop() : null;
42
+ return r && i[r] && !n.title ? { ...n, title: i[r] } : n;
43
43
  })
44
44
  };
45
45
  }
46
46
  const t = {};
47
- for (const [i, n] of Object.entries(e)) t[i] = w(n);
47
+ for (const [i, n] of Object.entries(e)) t[i] = j(n);
48
48
  return t.const !== void 0 && t.enum === void 0 && (t.enum = [t.const], delete t.const), t;
49
49
  }
50
50
  return e;
51
51
  }
52
- function me(e) {
53
- return w(ue(e));
52
+ function be(e) {
53
+ return j(he(e));
54
54
  }
55
- const l = k.createElement, fe = /\.(?!smi|sdf)/;
56
- function pe(e) {
55
+ const s = A.createElement, ge = /\.(?!smi|sdf)/;
56
+ function Ae(e) {
57
57
  if (!e) return "";
58
- const t = String(e), i = t.match(fe);
58
+ const t = String(e), i = t.match(ge);
59
59
  if (i) {
60
60
  const n = t.slice(0, i.index).trim();
61
61
  if (n && n.split(/\s+/).length <= 4)
@@ -63,10 +63,10 @@ function pe(e) {
63
63
  }
64
64
  return t;
65
65
  }
66
- function _(e, t) {
67
- const i = pe(e);
68
- return i ? l(
69
- O,
66
+ function E(e, t) {
67
+ const i = Ae(e);
68
+ return i ? s(
69
+ F,
70
70
  {
71
71
  title: i,
72
72
  arrow: !0,
@@ -77,46 +77,46 @@ function _(e, t) {
77
77
  t
78
78
  ) : t;
79
79
  }
80
- const q = {
80
+ const K = {
81
81
  border: "1px solid",
82
82
  borderColor: "divider",
83
83
  borderRadius: 1,
84
84
  p: 1.5,
85
85
  mb: 1.5
86
86
  };
87
- function ye(e) {
88
- const { children: t, errors: i, help: n, hidden: o, schema: a, registry: u, uiSchema: m } = e;
89
- if (o) return l("div", { className: "hidden" }, t);
90
- const d = a && a.type, c = d === "object" || d === "array" || Array.isArray(d) && (d.includes("object") || d.includes("array"));
91
- let s;
92
- if (c)
93
- s = t;
87
+ function ke(e) {
88
+ const { children: t, errors: i, help: n, hidden: r, schema: o, registry: c, uiSchema: l } = e;
89
+ if (r) return s("div", { className: "hidden" }, t);
90
+ const m = o && o.type, u = m === "object" || m === "array" || Array.isArray(m) && (m.includes("object") || m.includes("array"));
91
+ let d;
92
+ if (u)
93
+ d = t;
94
94
  else {
95
- const p = a && a.description ? String(a.description) : "", h = d === "boolean" || Array.isArray(d) && d.includes("boolean"), y = l(
95
+ const b = o && o.description ? String(o.description) : "", y = m === "boolean" || Array.isArray(m) && m.includes("boolean"), g = s(
96
96
  "div",
97
- h ? { style: { display: "inline-block" } } : null,
97
+ y ? { style: { display: "inline-block" } } : null,
98
98
  t,
99
99
  i,
100
100
  n
101
101
  );
102
- s = _(p, y);
102
+ d = E(b, g);
103
103
  }
104
- const f = ne(
104
+ const f = H(
105
105
  "WrapIfAdditionalTemplate",
106
- u,
107
- ie(m)
106
+ c,
107
+ X(l)
108
108
  );
109
- return l(f, { ...e }, s);
109
+ return s(f, { ...e }, d);
110
110
  }
111
- function he(e) {
112
- const t = e.uiSchema || {}, i = e.registry.templates, n = [], o = /* @__PURE__ */ new Map();
113
- for (const c of e.properties) {
114
- const s = t[c.name] && t[c.name]["ui:options"] && t[c.name]["ui:options"].group;
115
- s ? (o.get(s) || o.set(s, []).get(s)).push(c) : n.push(c);
111
+ function xe(e) {
112
+ const t = e.uiSchema || {}, i = e.registry.templates, n = [], r = /* @__PURE__ */ new Map();
113
+ for (const u of e.properties) {
114
+ const d = t[u.name] && t[u.name]["ui:options"] && t[u.name]["ui:options"].group;
115
+ d ? (r.get(d) || r.set(d, []).get(d)).push(u) : n.push(u);
116
116
  }
117
- const a = [], u = z in (e.schema || {}), m = t["ui:options"] && t["ui:options"].group, d = m && m === e.title;
118
- e.title && !u && !d && a.push(
119
- l(i.TitleFieldTemplate, {
117
+ const o = [], c = $ in (e.schema || {}), l = t["ui:options"] && t["ui:options"].group, m = l && l === e.title;
118
+ e.title && !c && !m && o.push(
119
+ s(i.TitleFieldTemplate, {
120
120
  key: "__title",
121
121
  id: e.idSchema.$id + "__title",
122
122
  title: e.title,
@@ -126,14 +126,14 @@ function he(e) {
126
126
  registry: e.registry
127
127
  })
128
128
  );
129
- for (const c of n)
130
- a.push(l("div", { key: c.name, className: "pm-field" }, c.content));
131
- for (const [c, s] of o)
132
- a.push(
133
- l(
134
- $,
129
+ for (const u of n)
130
+ o.push(s("div", { key: u.name, className: "pm-field" }, u.content));
131
+ for (const [u, d] of r)
132
+ o.push(
133
+ s(
134
+ Q,
135
135
  {
136
- key: c,
136
+ key: u,
137
137
  variant: "outlined",
138
138
  disableGutters: !0,
139
139
  elevation: 0,
@@ -147,20 +147,20 @@ function he(e) {
147
147
  "& .MuiAccordionDetails-root": { pt: 0, pr: 2, pb: 1, pl: 2 }
148
148
  }
149
149
  },
150
- l(
151
- K,
152
- { expandIcon: l(oe, null) },
153
- c
150
+ s(
151
+ Z,
152
+ { expandIcon: s(de, null) },
153
+ u
154
154
  ),
155
- l(
156
- U,
155
+ s(
156
+ ee,
157
157
  null,
158
- s.map((f) => l("div", { key: f.name, className: "pm-field" }, f.content))
158
+ d.map((f) => s("div", { key: f.name, className: "pm-field" }, f.content))
159
159
  )
160
160
  )
161
161
  );
162
- return le(e.schema, e.uiSchema, e.formData) && a.push(
163
- l(i.ButtonTemplates.AddButton, {
162
+ return J(e.schema, e.uiSchema, e.formData) && o.push(
163
+ s(i.ButtonTemplates.AddButton, {
164
164
  key: "__add",
165
165
  className: "object-property-expand",
166
166
  onClick: e.onAddClick(e.schema),
@@ -168,86 +168,86 @@ function he(e) {
168
168
  uiSchema: e.uiSchema,
169
169
  registry: e.registry
170
170
  })
171
- ), l("div", null, a);
171
+ ), s("div", null, o);
172
172
  }
173
- function be(e) {
173
+ function Se(e) {
174
174
  const {
175
175
  children: t,
176
176
  classNames: i,
177
177
  style: n,
178
- disabled: o,
179
- id: a,
180
- label: u,
181
- onKeyChange: m,
182
- onDropPropertyClick: d,
183
- readonly: c,
184
- schema: s,
178
+ disabled: r,
179
+ id: o,
180
+ label: c,
181
+ onKeyChange: l,
182
+ onDropPropertyClick: m,
183
+ readonly: u,
184
+ schema: d,
185
185
  uiSchema: f,
186
- registry: p
186
+ registry: b
187
187
  } = e;
188
- if (!(z in s))
189
- return l("div", { className: i, style: n }, t);
190
- const h = p.templates.ButtonTemplates.RemoveButton, y = f && f["ui:options"] && f["ui:options"].keyLabel || u + " Key", I = a + "-key", T = /^newKey(-\d+)?$/.test(u || ""), v = s && s.description ? String(s.description) : "";
191
- return l(
192
- M,
193
- { sx: q },
194
- l(
188
+ if (!($ in d))
189
+ return s("div", { className: i, style: n }, t);
190
+ const y = b.templates.ButtonTemplates.RemoveButton, g = f && f["ui:options"] && f["ui:options"].keyLabel || c + " Key", T = o + "-key", I = /^newKey(-\d+)?$/.test(c || ""), k = d && d.description ? String(d.description) : "";
191
+ return s(
192
+ B,
193
+ { sx: K },
194
+ s(
195
195
  "div",
196
196
  { style: { display: "flex", gap: "1rem", alignItems: "flex-start" } },
197
- l(
197
+ s(
198
198
  "div",
199
199
  { style: { flex: "0 0 34%" } },
200
- _(
201
- v,
202
- l(V, {
203
- id: I,
204
- label: y,
200
+ E(
201
+ k,
202
+ s(te, {
203
+ id: T,
204
+ label: g,
205
205
  size: "small",
206
206
  fullWidth: !0,
207
- defaultValue: T ? "" : u,
208
- disabled: o || c,
207
+ defaultValue: I ? "" : c,
208
+ disabled: r || u,
209
209
  onBlur: (C) => {
210
- const g = C.target.value.trim();
211
- g && g !== u && m(g);
210
+ const p = C.target.value.trim();
211
+ p && p !== c && l(p);
212
212
  }
213
213
  })
214
214
  )
215
215
  ),
216
- l("div", { className: "pm-ap-value", style: { flex: "1 1 auto" } }, t),
217
- l(
216
+ s("div", { className: "pm-ap-value", style: { flex: "1 1 auto" } }, t),
217
+ s(
218
218
  "div",
219
219
  { style: { flex: "0 0 auto", paddingTop: ".5rem" } },
220
- l(h, {
221
- disabled: o || c,
222
- onClick: d(u),
220
+ s(y, {
221
+ disabled: r || u,
222
+ onClick: m(c),
223
223
  uiSchema: f,
224
- registry: p
224
+ registry: b
225
225
  })
226
226
  )
227
227
  )
228
228
  );
229
229
  }
230
- function ge() {
230
+ function ve() {
231
231
  return null;
232
232
  }
233
- function xe(e) {
233
+ function Te(e) {
234
234
  if (!e.title) return null;
235
- const t = e.schema && e.schema.description ? String(e.schema.description) : "", i = l(
236
- L,
235
+ const t = e.schema && e.schema.description ? String(e.schema.description) : "", i = s(
236
+ G,
237
237
  null,
238
238
  e.title,
239
- e.required ? l("span", { style: { color: "#b00" } }, " *") : null
239
+ e.required ? s("span", { style: { color: "#b00" } }, " *") : null
240
240
  );
241
- return l(
241
+ return s(
242
242
  "div",
243
243
  { style: { marginTop: "8px", marginBottom: "2px" } },
244
- _(t, l("span", null, i))
244
+ E(t, s("span", null, i))
245
245
  );
246
246
  }
247
- function ke(e) {
248
- const t = e.registry.templates, i = t.ArrayFieldItemTemplate, n = e.uiSchema && e.uiSchema["ui:title"] || e.title, o = [];
249
- return n && o.push(
250
- l(t.TitleFieldTemplate, {
247
+ function Ie(e) {
248
+ const t = e.registry.templates, i = t.ArrayFieldItemTemplate, n = e.uiSchema && e.uiSchema["ui:title"] || e.title, r = [];
249
+ return n && r.push(
250
+ s(t.TitleFieldTemplate, {
251
251
  key: "__t",
252
252
  id: e.idSchema.$id + "__title",
253
253
  title: n,
@@ -257,202 +257,202 @@ function ke(e) {
257
257
  registry: e.registry
258
258
  })
259
259
  ), (e.items || []).forEach(
260
- ({ key: a, ...u }) => o.push(l(i, { key: a, ...u }))
261
- ), e.canAdd && o.push(
262
- l(t.ButtonTemplates.AddButton, {
260
+ ({ key: o, ...c }) => r.push(s(i, { key: o, ...c }))
261
+ ), e.canAdd && r.push(
262
+ s(t.ButtonTemplates.AddButton, {
263
263
  key: "__add",
264
264
  onClick: e.onAddClick,
265
265
  disabled: e.disabled || e.readonly,
266
266
  uiSchema: e.uiSchema,
267
267
  registry: e.registry
268
268
  })
269
- ), l("div", null, o);
269
+ ), s("div", null, r);
270
270
  }
271
- function ve(e) {
271
+ function Ce(e) {
272
272
  const {
273
273
  children: t,
274
274
  hasToolbar: i,
275
275
  hasCopy: n,
276
- hasMoveDown: o,
277
- hasMoveUp: a,
278
- hasRemove: u,
279
- index: m,
280
- onCopyIndexClick: d,
281
- onDropIndexClick: c,
282
- onReorderClick: s,
276
+ hasMoveDown: r,
277
+ hasMoveUp: o,
278
+ hasRemove: c,
279
+ index: l,
280
+ onCopyIndexClick: m,
281
+ onDropIndexClick: u,
282
+ onReorderClick: d,
283
283
  disabled: f,
284
- readonly: p,
285
- uiSchema: h,
286
- registry: y
287
- } = e, { CopyButton: I, MoveDownButton: T, MoveUpButton: v, RemoveButton: C } = y.templates.ButtonTemplates, g = { flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: "bold", minWidth: 0 };
288
- return l(
289
- M,
290
- { sx: q },
291
- l(
292
- x,
284
+ readonly: b,
285
+ uiSchema: y,
286
+ registry: g
287
+ } = e, { CopyButton: T, MoveDownButton: I, MoveUpButton: k, RemoveButton: C } = g.templates.ButtonTemplates, p = { flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: "bold", minWidth: 0 };
288
+ return s(
289
+ B,
290
+ { sx: K },
291
+ s(
292
+ v,
293
293
  { container: !0, alignItems: "center", wrap: "nowrap" },
294
- l(x, { item: !0, xs: !0, style: { minWidth: 0 } }, t),
295
- i && l(
296
- x,
294
+ s(v, { item: !0, xs: !0, style: { minWidth: 0 } }, t),
295
+ i && s(
296
+ v,
297
297
  { item: !0 },
298
- (a || o) && l(v, {
299
- style: g,
300
- disabled: f || p || !a,
301
- onClick: s(m, m - 1),
302
- uiSchema: h,
303
- registry: y
298
+ (o || r) && s(k, {
299
+ style: p,
300
+ disabled: f || b || !o,
301
+ onClick: d(l, l - 1),
302
+ uiSchema: y,
303
+ registry: g
304
304
  }),
305
- (a || o) && l(T, {
306
- style: g,
307
- disabled: f || p || !o,
308
- onClick: s(m, m + 1),
309
- uiSchema: h,
310
- registry: y
305
+ (o || r) && s(I, {
306
+ style: p,
307
+ disabled: f || b || !r,
308
+ onClick: d(l, l + 1),
309
+ uiSchema: y,
310
+ registry: g
311
311
  }),
312
- n && l(I, {
313
- style: g,
314
- disabled: f || p,
315
- onClick: d(m),
316
- uiSchema: h,
317
- registry: y
312
+ n && s(T, {
313
+ style: p,
314
+ disabled: f || b,
315
+ onClick: m(l),
316
+ uiSchema: y,
317
+ registry: g
318
318
  }),
319
- u && l(C, {
320
- style: g,
321
- disabled: f || p,
322
- onClick: c(m),
323
- uiSchema: h,
324
- registry: y
319
+ c && s(C, {
320
+ style: p,
321
+ disabled: f || b,
322
+ onClick: u(l),
323
+ uiSchema: y,
324
+ registry: g
325
325
  })
326
326
  )
327
327
  )
328
328
  );
329
329
  }
330
- const Ie = {
331
- FieldTemplate: ye,
332
- ObjectFieldTemplate: he,
333
- WrapIfAdditionalTemplate: be,
334
- DescriptionFieldTemplate: ge,
335
- TitleFieldTemplate: xe,
336
- ArrayFieldTemplate: ke,
337
- ArrayFieldItemTemplate: ve
338
- }, r = k.createElement, P = [
339
- { key: "local", label: "From local file system", isInput: !0, Icon: ae },
340
- { key: "datacenter", label: "From datacenter", isInput: !1, Icon: se }
330
+ const Oe = {
331
+ FieldTemplate: ke,
332
+ ObjectFieldTemplate: xe,
333
+ WrapIfAdditionalTemplate: Se,
334
+ DescriptionFieldTemplate: ve,
335
+ TitleFieldTemplate: Te,
336
+ ArrayFieldTemplate: Ie,
337
+ ArrayFieldItemTemplate: Ce
338
+ }, a = A.createElement, L = [
339
+ { key: "local", label: "From local file system", isInput: !0, Icon: me },
340
+ { key: "datacenter", label: "From datacenter", isInput: !1, Icon: fe }
341
341
  ];
342
- function Te(e) {
343
- const { value: t, onChange: i, disabled: n = !1, readonly: o = !1, label: a, required: u } = e, m = /_\d+$/.test(e.id || ""), d = n || o, [c, s] = k.useState(null), [f, p] = k.useState(0), h = !!c, y = t ? String(t).split("/").pop() : "", I = (S) => S && i(S.name), T = () => i(void 0), v = P[f], C = a && !m ? r(
344
- x,
342
+ function je(e) {
343
+ const { value: t, onChange: i, disabled: n = !1, readonly: r = !1, label: o, required: c } = e, l = /_\d+$/.test(e.id || ""), m = n || r, [u, d] = A.useState(null), [f, b] = A.useState(0), y = !!u, g = t ? String(t).split("/").pop() : "", T = (S) => S && i(S.name), I = () => i(void 0), k = L[f], C = o && !l ? a(
344
+ v,
345
345
  { item: !0, zeroMinWidth: !0 },
346
- r(L, null, a, u ? " *" : null)
347
- ) : null, g = t ? r(
348
- x,
346
+ a(G, null, o, c ? " *" : null)
347
+ ) : null, p = t ? a(
348
+ v,
349
349
  { item: !0, xs: !0, zeroMinWidth: !0 },
350
- r(
351
- O,
352
- { title: y, arrow: !0, placement: "top" },
353
- r(H, { style: { textOverflow: "ellipsis", overflow: "hidden" } }, y)
350
+ a(
351
+ F,
352
+ { title: g, arrow: !0, placement: "top" },
353
+ a(ne, { style: { textOverflow: "ellipsis", overflow: "hidden" } }, g)
354
354
  )
355
- ) : r(x, { item: !0, xs: !0 }, null);
356
- let F;
355
+ ) : a(v, { item: !0, xs: !0 }, null);
356
+ let x;
357
357
  if (t)
358
- F = r(
359
- x,
358
+ x = a(
359
+ v,
360
360
  { item: !0, xs: "auto" },
361
- r(
362
- O,
361
+ a(
362
+ F,
363
363
  { title: "Clear", arrow: !0, placement: "right" },
364
- r(
364
+ a(
365
365
  "span",
366
366
  null,
367
- r(
368
- X,
369
- { onClick: T, size: "small", disabled: d },
370
- r(re, { fontSize: "small" })
367
+ a(
368
+ ie,
369
+ { onClick: I, size: "small", disabled: m },
370
+ a(ue, { fontSize: "small" })
371
371
  )
372
372
  )
373
373
  )
374
374
  );
375
375
  else {
376
- const S = v.isInput ? r(
377
- B,
376
+ const S = k.isInput ? a(
377
+ w,
378
378
  {
379
379
  component: "label",
380
- disabled: d,
381
- endIcon: r(v.Icon, null),
380
+ disabled: m,
381
+ endIcon: a(k.Icon, null),
382
382
  sx: { px: 1.2, borderRadius: "4px 0 0 4px", borderRight: 0 }
383
383
  },
384
384
  "Select",
385
- r("input", {
385
+ a("input", {
386
386
  type: "file",
387
387
  hidden: !0,
388
- onChange: (b) => I(b.target.files && b.target.files[0])
388
+ onChange: (h) => T(h.target.files && h.target.files[0])
389
389
  })
390
- ) : r(
391
- B,
390
+ ) : a(
391
+ w,
392
392
  {
393
- disabled: d,
394
- endIcon: r(v.Icon, null),
393
+ disabled: m,
394
+ endIcon: a(k.Icon, null),
395
395
  sx: { px: 1.2, borderRadius: "4px 0 0 4px", borderRight: 0 },
396
396
  onClick: () => {
397
397
  }
398
398
  },
399
399
  "Select"
400
400
  );
401
- F = r(
402
- x,
401
+ x = a(
402
+ v,
403
403
  { item: !0, xs: "auto" },
404
- r(
405
- J,
404
+ a(
405
+ re,
406
406
  {
407
407
  variant: "outlined",
408
- disabled: d,
408
+ disabled: m,
409
409
  sx: { "& .MuiButtonGroup-grouped": { minWidth: 0 } }
410
410
  },
411
411
  S,
412
- r(
413
- B,
412
+ a(
413
+ w,
414
414
  {
415
415
  size: "small",
416
- onClick: (b) => s(b.currentTarget),
416
+ onClick: (h) => d(h.currentTarget),
417
417
  sx: { width: "1em", borderRadius: "0 4px 4px 0" }
418
418
  },
419
- r(ce, null)
419
+ a(pe, null)
420
420
  )
421
421
  ),
422
- r(
423
- Y,
424
- { anchorEl: c, open: h, onClose: () => s(null) },
425
- P.map(
426
- (b, A) => b.isInput ? r(
427
- E,
428
- { key: b.key, component: "label", selected: A === f },
429
- r(R, null, r(b.Icon, null)),
430
- r(D, null, b.label),
431
- r("input", {
422
+ a(
423
+ oe,
424
+ { anchorEl: u, open: y, onClose: () => d(null) },
425
+ L.map(
426
+ (h, O) => h.isInput ? a(
427
+ _,
428
+ { key: h.key, component: "label", selected: O === f },
429
+ a(R, null, a(h.Icon, null)),
430
+ a(N, null, h.label),
431
+ a("input", {
432
432
  type: "file",
433
433
  hidden: !0,
434
- onChange: (j) => {
435
- p(A), s(null), I(j.target.files && j.target.files[0]);
434
+ onChange: (D) => {
435
+ b(O), d(null), T(D.target.files && D.target.files[0]);
436
436
  }
437
437
  })
438
- ) : r(
439
- E,
438
+ ) : a(
439
+ _,
440
440
  {
441
- key: b.key,
442
- selected: A === f,
441
+ key: h.key,
442
+ selected: O === f,
443
443
  onClick: () => {
444
- p(A), s(null);
444
+ b(O), d(null);
445
445
  }
446
446
  },
447
- r(R, null, r(b.Icon, null)),
448
- r(D, null, b.label)
447
+ a(R, null, a(h.Icon, null)),
448
+ a(N, null, h.label)
449
449
  )
450
450
  )
451
451
  )
452
452
  );
453
453
  }
454
- return r(
455
- x,
454
+ return a(
455
+ v,
456
456
  {
457
457
  container: !0,
458
458
  direction: "row",
@@ -463,24 +463,68 @@ function Te(e) {
463
463
  sx: { mt: 0.5 }
464
464
  },
465
465
  C,
466
- g,
467
- F
466
+ p,
467
+ x
468
468
  );
469
469
  }
470
- const Ce = `
470
+ const we = `
471
471
  .pm-field { margin: .5rem 0; }
472
472
  /* In an additionalProperties row, align the value's first field with the key
473
473
  field (drop its leading margin so both start at the row top). */
474
474
  .pm-ap-value > div > .pm-field:first-child { margin-top: 0; }
475
475
  `;
476
476
  let W = !1;
477
- function Se() {
477
+ function Fe() {
478
478
  if (W || typeof document > "u") return;
479
479
  W = !0;
480
480
  const e = document.createElement("style");
481
- e.setAttribute("data-pm-rjsf", ""), e.textContent = Ce, document.head.appendChild(e);
481
+ e.setAttribute("data-pm-rjsf", ""), e.textContent = we, document.head.appendChild(e);
482
482
  }
483
- const Ae = de(), we = (e) => Z(e || {}, {
483
+ const z = ye(), q = { emptyObjectFields: "skipEmptyDefaults" };
484
+ function M(e, t) {
485
+ if (e === t) return !0;
486
+ if (e == null || t == null || typeof e != "object" || typeof t != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
487
+ const i = Object.keys(e), n = Object.keys(t);
488
+ return i.length === n.length && i.every((r) => M(e[r], t[r]));
489
+ }
490
+ function U(e, t, i) {
491
+ if (M(e, t)) return;
492
+ if (e && typeof e == "object" && !Array.isArray(e) && t && typeof t == "object" && !Array.isArray(t)) {
493
+ const r = {};
494
+ for (const [o, c] of Object.entries(e)) {
495
+ if (i.has(o)) {
496
+ r[o] = c;
497
+ continue;
498
+ }
499
+ const l = U(c, t[o], i);
500
+ l !== void 0 && (r[o] = l);
501
+ }
502
+ return Object.keys(r).length ? r : void 0;
503
+ }
504
+ return e;
505
+ }
506
+ function Be(e) {
507
+ const t = /* @__PURE__ */ new Set();
508
+ return (function i(n) {
509
+ if (Array.isArray(n)) return n.forEach(i);
510
+ if (n && typeof n == "object") {
511
+ n.discriminator && n.discriminator.propertyName && t.add(n.discriminator.propertyName);
512
+ for (const r of Object.values(n)) i(r);
513
+ }
514
+ })(e), t;
515
+ }
516
+ function Ee(e) {
517
+ const t = /* @__PURE__ */ new Set(), i = e && e.properties || {};
518
+ for (const [n, r] of Object.entries(i))
519
+ if (r && Array.isArray(r.anyOf)) {
520
+ const o = r.anyOf.some((l) => l && l.type === "null"), c = r.anyOf.some(
521
+ (l) => l && (l.$ref || l.type === "object" || l.properties || Array.isArray(l.oneOf))
522
+ );
523
+ o && c && t.add(n);
524
+ }
525
+ return t;
526
+ }
527
+ const Me = (e) => se(e || {}, {
484
528
  components: {
485
529
  MuiTextField: { defaultProps: { size: "small", fullWidth: !0 } },
486
530
  MuiFormControl: { defaultProps: { size: "small", fullWidth: !0 } },
@@ -488,57 +532,73 @@ const Ae = de(), we = (e) => Z(e || {}, {
488
532
  MuiCheckbox: { defaultProps: { size: "small" } }
489
533
  }
490
534
  });
491
- function Fe(e, t) {
535
+ function De(e, t) {
492
536
  if (!e || typeof e != "object") return e;
493
537
  const i = t && typeof t == "object" ? t : {};
494
538
  let n = null;
495
- for (const [o, a] of Object.entries(e)) {
496
- const u = a && a["ui:options"] && a["ui:options"].enabledBy;
497
- if (!u) continue;
498
- const m = !i[u];
499
- !!a["ui:disabled"] !== m && (n = n || { ...e }, n[o] = { ...a, "ui:disabled": m });
539
+ for (const [r, o] of Object.entries(e)) {
540
+ const c = o && o["ui:options"] && o["ui:options"].enabledBy;
541
+ if (!c) continue;
542
+ const l = !i[c];
543
+ !!o["ui:disabled"] !== l && (n = n || { ...e }, n[r] = { ...o, "ui:disabled": l });
500
544
  }
501
545
  return n || e;
502
546
  }
503
- function De({ schema: e, uiSchema: t, widgets: i, formData: n, onChange: o, ...a }) {
504
- Se();
505
- const [u, m] = k.useState(n), d = n !== void 0 ? n : u, c = (h, y) => {
506
- m(h.formData), o && o(h, y);
507
- }, s = me(e), f = Fe(t, d), p = { file: Te, ...i || {} };
508
- return k.createElement(
509
- Q,
510
- { theme: we },
511
- k.createElement(
512
- M,
547
+ function qe({ schema: e, uiSchema: t, widgets: i, formData: n, onChange: r, onSubmit: o, ...c }) {
548
+ Fe();
549
+ const l = A.useMemo(() => be(e), [e]), m = A.useMemo(() => Be(l), [l]), u = A.useMemo(() => Ee(e), [e]), d = A.useMemo(
550
+ () => Y(z, l, void 0, l, !1, q),
551
+ [l]
552
+ ), [f, b] = A.useState(n !== void 0 ? n : d), y = n !== void 0 ? n : f, g = (p, x) => {
553
+ b(p.formData), r && r(p, x);
554
+ }, T = De(t, y), I = { file: je, ...i || {} }, k = (p) => p.filter((x) => {
555
+ const S = (x.property || "").split(".").filter(Boolean)[0];
556
+ if (!S || !u.has(S)) return !0;
557
+ const h = y ? y[S] : void 0;
558
+ return !(h === void 0 || M(h, d[S]));
559
+ }), C = o ? (p, x) => o({ ...p, formData: U(p.formData, d, m) ?? {} }, x) : void 0;
560
+ return A.createElement(
561
+ le,
562
+ { theme: Me },
563
+ A.createElement(
564
+ B,
513
565
  { sx: { color: "text.primary" } },
514
- k.createElement(G, {
515
- schema: s,
516
- uiSchema: f,
517
- validator: Ae,
518
- templates: Ie,
519
- widgets: p,
520
- formData: d,
521
- onChange: c,
522
- ...a
566
+ A.createElement(V, {
567
+ schema: l,
568
+ uiSchema: T,
569
+ validator: z,
570
+ templates: Oe,
571
+ widgets: I,
572
+ formData: y,
573
+ onChange: g,
574
+ onSubmit: C,
575
+ transformErrors: k,
576
+ // RJSF owns validation + error display. Native HTML5 validation hard-
577
+ // blocks submit when a `required` control is non-focusable (e.g. inside a
578
+ // collapsed accordion) and does so SILENTLY -- onSubmit never fires and
579
+ // nothing surfaces. Let RJSF validate instead so errors are visible.
580
+ noHtml5Validate: !0,
581
+ experimental_defaultFormStateBehavior: q,
582
+ ...c
523
583
  })
524
584
  )
525
585
  );
526
586
  }
527
587
  export {
528
- ke as ArrayFieldTemplate,
529
- ge as DescriptionFieldTemplate,
530
- ye as FieldTemplate,
531
- Te as FileWidget,
532
- he as GroupedObjectFieldTemplate,
533
- De as PMForm,
534
- Ce as PM_RJSF_CSS,
535
- N as SPECIAL_DIRS,
536
- xe as TitleFieldTemplate,
537
- be as WrapIfAdditionalTemplate,
538
- Se as injectStyles,
539
- de as makeValidator,
540
- me as prepareForRjsf,
541
- w as simplify,
542
- ue as stripSpecialDirs,
543
- Ie as templates
588
+ Ie as ArrayFieldTemplate,
589
+ ve as DescriptionFieldTemplate,
590
+ ke as FieldTemplate,
591
+ je as FileWidget,
592
+ xe as GroupedObjectFieldTemplate,
593
+ qe as PMForm,
594
+ we as PM_RJSF_CSS,
595
+ P as SPECIAL_DIRS,
596
+ Te as TitleFieldTemplate,
597
+ Se as WrapIfAdditionalTemplate,
598
+ Fe as injectStyles,
599
+ ye as makeValidator,
600
+ be as prepareForRjsf,
601
+ j as simplify,
602
+ he as stripSpecialDirs,
603
+ Oe as templates
544
604
  };