@acellera/pm-rjsf 0.0.2 → 0.0.4

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,65 +1,122 @@
1
- import p from "react";
2
- import T from "@rjsf/mui";
3
- import { customizeValidator as v } from "@rjsf/validator-ajv8";
4
- import A from "ajv/dist/2020";
5
- import { canExpand as F, ADDITIONAL_PROPERTY_FLAG as j } from "@rjsf/utils";
6
- function O() {
7
- return v({
8
- AjvClass: A,
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,
9
11
  customFormats: { path: () => !0 },
10
12
  ajvOptionsOverrides: { strict: !1 }
11
13
  });
12
14
  }
13
- const h = ["outdir", "scratchdir", "execdir"];
14
- function C(e) {
15
+ const N = ["outdir", "scratchdir", "execdir"];
16
+ function ue(e) {
15
17
  if (!e || !e.properties) return e;
16
- const r = { ...e.properties };
17
- for (const t of h) delete r[t];
18
- const n = (e.required || []).filter((t) => !h.includes(t));
19
- return { ...e, properties: r, required: n };
18
+ const t = { ...e.properties };
19
+ for (const n of N) delete t[n];
20
+ const i = (e.required || []).filter((n) => !N.includes(n));
21
+ return { ...e, properties: t, required: i };
20
22
  }
21
- function s(e) {
22
- if (Array.isArray(e)) return e.map(s);
23
+ function w(e) {
24
+ if (Array.isArray(e)) return e.map(w);
23
25
  if (e && typeof e == "object") {
24
26
  if (Array.isArray(e.anyOf)) {
25
- const n = e.anyOf.filter((t) => !(t && t.type === "null"));
26
- if (n.length === 1) {
27
- const { anyOf: t, ...a } = e;
28
- return s({ ...n[0], ...a });
27
+ const i = e.anyOf.filter((n) => !(n && n.type === "null"));
28
+ if (i.length === 1) {
29
+ const { anyOf: n, ...o } = e;
30
+ return w({ ...i[0], ...o });
29
31
  }
30
- e = { ...e, anyOf: n };
32
+ e = { ...e, anyOf: i };
31
33
  }
32
34
  if (Array.isArray(e.oneOf) && e.discriminator && e.discriminator.mapping) {
33
- const n = {};
34
- for (const [t, a] of Object.entries(e.discriminator.mapping))
35
- n[a.split("/").pop()] = t;
35
+ const i = {};
36
+ for (const [n, o] of Object.entries(e.discriminator.mapping))
37
+ i[o.split("/").pop()] = n;
36
38
  e = {
37
39
  ...e,
38
- oneOf: e.oneOf.map((t) => {
39
- const a = t && t.$ref ? t.$ref.split("/").pop() : null;
40
- return a && n[a] && !t.title ? { ...t, title: n[a] } : t;
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
43
  })
42
44
  };
43
45
  }
44
- const r = {};
45
- for (const [n, t] of Object.entries(e)) r[n] = s(t);
46
- return r;
46
+ const t = {};
47
+ for (const [i, n] of Object.entries(e)) t[i] = w(n);
48
+ return t.const !== void 0 && t.enum === void 0 && (t.enum = [t.const], delete t.const), t;
47
49
  }
48
50
  return e;
49
51
  }
50
- function B(e) {
51
- return s(C(e));
52
+ function me(e) {
53
+ return w(ue(e));
54
+ }
55
+ const l = k.createElement, fe = /\.(?!smi|sdf)/;
56
+ function pe(e) {
57
+ if (!e) return "";
58
+ const t = String(e), i = t.match(fe);
59
+ if (i) {
60
+ const n = t.slice(0, i.index).trim();
61
+ if (n && n.split(/\s+/).length <= 4)
62
+ return t.slice(i.index + 1).trim();
63
+ }
64
+ return t;
65
+ }
66
+ function _(e, t) {
67
+ const i = pe(e);
68
+ return i ? l(
69
+ O,
70
+ {
71
+ title: i,
72
+ arrow: !0,
73
+ placement: "top",
74
+ enterDelay: 400,
75
+ disableInteractive: !0
76
+ },
77
+ t
78
+ ) : t;
79
+ }
80
+ const q = {
81
+ border: "1px solid",
82
+ borderColor: "divider",
83
+ borderRadius: 1,
84
+ p: 1.5,
85
+ mb: 1.5
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;
94
+ else {
95
+ const p = a && a.description ? String(a.description) : "", h = d === "boolean" || Array.isArray(d) && d.includes("boolean"), y = l(
96
+ "div",
97
+ h ? { style: { display: "inline-block" } } : null,
98
+ t,
99
+ i,
100
+ n
101
+ );
102
+ s = _(p, y);
103
+ }
104
+ const f = ne(
105
+ "WrapIfAdditionalTemplate",
106
+ u,
107
+ ie(m)
108
+ );
109
+ return l(f, { ...e }, s);
52
110
  }
53
- const i = p.createElement;
54
- function I(e) {
55
- const r = e.uiSchema || {}, n = e.registry.templates, t = [], a = /* @__PURE__ */ new Map();
56
- for (const l of e.properties) {
57
- const c = r[l.name] && r[l.name]["ui:options"] && r[l.name]["ui:options"].group;
58
- c ? (a.get(c) || a.set(c, []).get(c)).push(l) : t.push(l);
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);
59
116
  }
60
- const d = [];
61
- e.title && d.push(
62
- i(n.TitleFieldTemplate, {
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, {
63
120
  key: "__title",
64
121
  id: e.idSchema.$id + "__title",
65
122
  title: e.title,
@@ -68,33 +125,42 @@ function I(e) {
68
125
  uiSchema: e.uiSchema,
69
126
  registry: e.registry
70
127
  })
71
- ), e.description && d.push(
72
- i(n.DescriptionFieldTemplate, {
73
- key: "__desc",
74
- id: e.idSchema.$id + "__description",
75
- description: e.description,
76
- schema: e.schema,
77
- uiSchema: e.uiSchema,
78
- registry: e.registry
79
- })
80
128
  );
81
- for (const l of t)
82
- d.push(i("div", { key: l.name, className: "pm-field" }, l.content));
83
- for (const [l, c] of a)
84
- d.push(
85
- i(
86
- "details",
87
- { key: l, className: "pm-group" },
88
- i("summary", null, l),
89
- i(
90
- "div",
91
- { className: "pm-body" },
92
- c.map((m) => i("div", { key: m.name, className: "pm-field" }, m.content))
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
+ $,
135
+ {
136
+ key: c,
137
+ variant: "outlined",
138
+ disableGutters: !0,
139
+ elevation: 0,
140
+ square: !1,
141
+ sx: {
142
+ width: "100%",
143
+ mt: 0,
144
+ overflowX: "auto",
145
+ "&:before": { display: "none" },
146
+ "& .MuiAccordionSummary-root": { minHeight: 0 },
147
+ "& .MuiAccordionDetails-root": { pt: 0, pr: 2, pb: 1, pl: 2 }
148
+ }
149
+ },
150
+ l(
151
+ K,
152
+ { expandIcon: l(oe, null) },
153
+ c
154
+ ),
155
+ l(
156
+ U,
157
+ null,
158
+ s.map((f) => l("div", { key: f.name, className: "pm-field" }, f.content))
93
159
  )
94
160
  )
95
161
  );
96
- return F(e.schema, e.uiSchema, e.formData) && d.push(
97
- i(n.ButtonTemplates.AddButton, {
162
+ return le(e.schema, e.uiSchema, e.formData) && a.push(
163
+ l(i.ButtonTemplates.AddButton, {
98
164
  key: "__add",
99
165
  className: "object-property-expand",
100
166
  onClick: e.onAddClick(e.schema),
@@ -102,183 +168,377 @@ function I(e) {
102
168
  uiSchema: e.uiSchema,
103
169
  registry: e.registry
104
170
  })
105
- ), i("div", null, d);
171
+ ), l("div", null, a);
106
172
  }
107
- function R(e) {
173
+ function be(e) {
108
174
  const {
109
- children: r,
110
- classNames: n,
111
- style: t,
112
- disabled: a,
113
- id: d,
114
- label: l,
115
- onKeyChange: c,
116
- onDropPropertyClick: m,
117
- readonly: u,
118
- schema: b,
119
- uiSchema: o,
120
- registry: f
175
+ children: t,
176
+ classNames: i,
177
+ style: n,
178
+ disabled: o,
179
+ id: a,
180
+ label: u,
181
+ onKeyChange: m,
182
+ onDropPropertyClick: d,
183
+ readonly: c,
184
+ schema: s,
185
+ uiSchema: f,
186
+ registry: p
121
187
  } = e;
122
- if (!(j in b))
123
- return i("div", { className: n, style: t }, r);
124
- const S = f.templates.ButtonTemplates.RemoveButton, k = o && o["ui:options"] && o["ui:options"].keyLabel || l + " Key", y = d + "-key", _ = {
125
- width: "100%",
126
- padding: ".5rem",
127
- border: "1px solid #ccc",
128
- borderRadius: "4px",
129
- font: "inherit",
130
- boxSizing: "border-box"
131
- };
132
- return i(
133
- "div",
134
- { style: { display: "flex", gap: "1rem", alignItems: "flex-start", marginBottom: ".75rem" } },
135
- i(
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(
136
195
  "div",
137
- { style: { flex: "0 0 30%" } },
138
- i("label", { htmlFor: y, style: { display: "block", marginBottom: ".25rem" } }, k),
139
- i("input", {
140
- id: y,
141
- type: "text",
142
- defaultValue: l,
143
- disabled: a || u,
144
- style: _,
145
- onBlur: (x) => c(x.target.value)
146
- })
147
- ),
148
- i("div", { style: { flex: "1 1 auto" } }, r),
149
- i(
150
- "div",
151
- { style: { flex: "0 0 auto", paddingTop: "1.6rem" } },
152
- i(S, {
153
- disabled: a || u,
154
- onClick: m(l),
155
- uiSchema: o,
156
- registry: f
157
- })
196
+ { style: { display: "flex", gap: "1rem", alignItems: "flex-start" } },
197
+ l(
198
+ "div",
199
+ { style: { flex: "0 0 34%" } },
200
+ _(
201
+ v,
202
+ l(V, {
203
+ id: I,
204
+ label: y,
205
+ size: "small",
206
+ fullWidth: !0,
207
+ defaultValue: T ? "" : u,
208
+ disabled: o || c,
209
+ onBlur: (C) => {
210
+ const g = C.target.value.trim();
211
+ g && g !== u && m(g);
212
+ }
213
+ })
214
+ )
215
+ ),
216
+ l("div", { className: "pm-ap-value", style: { flex: "1 1 auto" } }, t),
217
+ l(
218
+ "div",
219
+ { style: { flex: "0 0 auto", paddingTop: ".5rem" } },
220
+ l(h, {
221
+ disabled: o || c,
222
+ onClick: d(u),
223
+ uiSchema: f,
224
+ registry: p
225
+ })
226
+ )
158
227
  )
159
228
  );
160
229
  }
161
- function D(e) {
162
- const r = e.schema && e.schema.description || (typeof e.description == "string" ? e.description : "");
163
- if (!r) return null;
164
- const n = String(r);
165
- return i(
166
- "span",
167
- {
168
- title: n,
169
- "aria-label": n,
170
- style: {
171
- display: "inline-flex",
172
- alignItems: "center",
173
- justifyContent: "center",
174
- width: "18px",
175
- height: "18px",
176
- borderRadius: "50%",
177
- border: "1px solid #999",
178
- color: "#666",
179
- fontSize: "12px",
180
- lineHeight: 1,
181
- cursor: "help",
182
- marginLeft: "6px",
183
- verticalAlign: "middle"
184
- }
185
- },
186
- "?"
187
- );
230
+ function ge() {
231
+ return null;
188
232
  }
189
- function N(e) {
190
- return e.title ? i(
191
- "div",
192
- { style: { fontSize: ".9rem", fontWeight: 600, margin: ".4rem 0 .3rem" } },
233
+ function xe(e) {
234
+ if (!e.title) return null;
235
+ const t = e.schema && e.schema.description ? String(e.schema.description) : "", i = l(
236
+ L,
237
+ null,
193
238
  e.title,
194
- e.required ? i("span", { style: { color: "#b00" } }, " *") : null
195
- ) : null;
239
+ e.required ? l("span", { style: { color: "#b00" } }, " *") : null
240
+ );
241
+ return l(
242
+ "div",
243
+ { style: { marginTop: "8px", marginBottom: "2px" } },
244
+ _(t, l("span", null, i))
245
+ );
196
246
  }
197
- function w(e) {
198
- const r = e.registry.templates, n = r.ArrayFieldItemTemplate, t = e.uiSchema && e.uiSchema["ui:title"] || e.title, a = [];
199
- t && a.push(
200
- i(r.TitleFieldTemplate, {
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, {
201
251
  key: "__t",
202
252
  id: e.idSchema.$id + "__title",
203
- title: t,
253
+ title: n,
204
254
  required: e.required,
205
255
  schema: e.schema,
206
256
  uiSchema: e.uiSchema,
207
257
  registry: e.registry
208
258
  })
209
- );
210
- const d = e.schema && e.schema.description;
211
- return d && a.push(
212
- i(r.DescriptionFieldTemplate, {
213
- key: "__d",
214
- id: e.idSchema.$id + "__description",
215
- description: d,
216
- schema: e.schema,
217
- uiSchema: e.uiSchema,
218
- registry: e.registry
219
- })
220
259
  ), (e.items || []).forEach(
221
- ({ key: l, ...c }) => a.push(i(n, { key: l, ...c }))
222
- ), e.canAdd && a.push(
223
- i(r.ButtonTemplates.AddButton, {
260
+ ({ key: a, ...u }) => o.push(l(i, { key: a, ...u }))
261
+ ), e.canAdd && o.push(
262
+ l(t.ButtonTemplates.AddButton, {
224
263
  key: "__add",
225
264
  onClick: e.onAddClick,
226
265
  disabled: e.disabled || e.readonly,
227
266
  uiSchema: e.uiSchema,
228
267
  registry: e.registry
229
268
  })
230
- ), i("div", null, a);
269
+ ), l("div", null, o);
231
270
  }
232
- const q = {
233
- ObjectFieldTemplate: I,
234
- WrapIfAdditionalTemplate: R,
235
- DescriptionFieldTemplate: D,
236
- TitleFieldTemplate: N,
237
- ArrayFieldTemplate: w
238
- }, E = `
239
- .pm-field { margin: .5rem 0; }
240
- details.pm-group { border: 1px solid #e0e0e0; border-radius: 4px; margin: .75rem 0; }
241
- details.pm-group > summary {
242
- list-style: none; cursor: pointer; padding: .6rem .9rem; font-size: .9rem;
243
- font-weight: 600; display: flex; justify-content: space-between; align-items: center;
271
+ function ve(e) {
272
+ const {
273
+ children: t,
274
+ hasToolbar: i,
275
+ hasCopy: n,
276
+ hasMoveDown: o,
277
+ hasMoveUp: a,
278
+ hasRemove: u,
279
+ index: m,
280
+ onCopyIndexClick: d,
281
+ onDropIndexClick: c,
282
+ onReorderClick: s,
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,
293
+ { container: !0, alignItems: "center", wrap: "nowrap" },
294
+ l(x, { item: !0, xs: !0, style: { minWidth: 0 } }, t),
295
+ i && l(
296
+ x,
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
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
311
+ }),
312
+ n && l(I, {
313
+ style: g,
314
+ disabled: f || p,
315
+ onClick: d(m),
316
+ uiSchema: h,
317
+ registry: y
318
+ }),
319
+ u && l(C, {
320
+ style: g,
321
+ disabled: f || p,
322
+ onClick: c(m),
323
+ uiSchema: h,
324
+ registry: y
325
+ })
326
+ )
327
+ )
328
+ );
244
329
  }
245
- details.pm-group > summary::-webkit-details-marker { display: none; }
246
- details.pm-group > summary::after { content: "\\25be"; color: #888; font-weight: 400; }
247
- details.pm-group[open] > summary::after { content: "\\25b4"; }
248
- details.pm-group > .pm-body { padding: .25rem .9rem .6rem; }
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 }
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,
345
+ { item: !0, zeroMinWidth: !0 },
346
+ r(L, null, a, u ? " *" : null)
347
+ ) : null, g = t ? r(
348
+ x,
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)
354
+ )
355
+ ) : r(x, { item: !0, xs: !0 }, null);
356
+ let F;
357
+ if (t)
358
+ F = r(
359
+ x,
360
+ { item: !0, xs: "auto" },
361
+ r(
362
+ O,
363
+ { title: "Clear", arrow: !0, placement: "right" },
364
+ r(
365
+ "span",
366
+ null,
367
+ r(
368
+ X,
369
+ { onClick: T, size: "small", disabled: d },
370
+ r(re, { fontSize: "small" })
371
+ )
372
+ )
373
+ )
374
+ );
375
+ else {
376
+ const S = v.isInput ? r(
377
+ B,
378
+ {
379
+ component: "label",
380
+ disabled: d,
381
+ endIcon: r(v.Icon, null),
382
+ sx: { px: 1.2, borderRadius: "4px 0 0 4px", borderRight: 0 }
383
+ },
384
+ "Select",
385
+ r("input", {
386
+ type: "file",
387
+ hidden: !0,
388
+ onChange: (b) => I(b.target.files && b.target.files[0])
389
+ })
390
+ ) : r(
391
+ B,
392
+ {
393
+ disabled: d,
394
+ endIcon: r(v.Icon, null),
395
+ sx: { px: 1.2, borderRadius: "4px 0 0 4px", borderRight: 0 },
396
+ onClick: () => {
397
+ }
398
+ },
399
+ "Select"
400
+ );
401
+ F = r(
402
+ x,
403
+ { item: !0, xs: "auto" },
404
+ r(
405
+ J,
406
+ {
407
+ variant: "outlined",
408
+ disabled: d,
409
+ sx: { "& .MuiButtonGroup-grouped": { minWidth: 0 } }
410
+ },
411
+ S,
412
+ r(
413
+ B,
414
+ {
415
+ size: "small",
416
+ onClick: (b) => s(b.currentTarget),
417
+ sx: { width: "1em", borderRadius: "0 4px 4px 0" }
418
+ },
419
+ r(ce, null)
420
+ )
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", {
432
+ type: "file",
433
+ hidden: !0,
434
+ onChange: (j) => {
435
+ p(A), s(null), I(j.target.files && j.target.files[0]);
436
+ }
437
+ })
438
+ ) : r(
439
+ E,
440
+ {
441
+ key: b.key,
442
+ selected: A === f,
443
+ onClick: () => {
444
+ p(A), s(null);
445
+ }
446
+ },
447
+ r(R, null, r(b.Icon, null)),
448
+ r(D, null, b.label)
449
+ )
450
+ )
451
+ )
452
+ );
453
+ }
454
+ return r(
455
+ x,
456
+ {
457
+ container: !0,
458
+ direction: "row",
459
+ justifyContent: "space-between",
460
+ alignItems: "center",
461
+ spacing: 1,
462
+ wrap: "nowrap",
463
+ sx: { mt: 0.5 }
464
+ },
465
+ C,
466
+ g,
467
+ F
468
+ );
469
+ }
470
+ const Ce = `
471
+ .pm-field { margin: .5rem 0; }
472
+ /* In an additionalProperties row, align the value's first field with the key
473
+ field (drop its leading margin so both start at the row top). */
474
+ .pm-ap-value > div > .pm-field:first-child { margin-top: 0; }
249
475
  `;
250
- let g = !1;
251
- function L() {
252
- if (g || typeof document > "u") return;
253
- g = !0;
476
+ let W = !1;
477
+ function Se() {
478
+ if (W || typeof document > "u") return;
479
+ W = !0;
254
480
  const e = document.createElement("style");
255
- e.setAttribute("data-pm-rjsf", ""), e.textContent = E, document.head.appendChild(e);
481
+ e.setAttribute("data-pm-rjsf", ""), e.textContent = Ce, document.head.appendChild(e);
256
482
  }
257
- const P = O();
258
- function K({ schema: e, uiSchema: r, ...n }) {
259
- L();
260
- const t = B(e);
261
- return p.createElement(T, {
262
- schema: t,
263
- uiSchema: r,
264
- validator: P,
265
- templates: q,
266
- ...n
267
- });
483
+ const Ae = de(), we = (e) => Z(e || {}, {
484
+ components: {
485
+ MuiTextField: { defaultProps: { size: "small", fullWidth: !0 } },
486
+ MuiFormControl: { defaultProps: { size: "small", fullWidth: !0 } },
487
+ MuiSelect: { defaultProps: { size: "small" } },
488
+ MuiCheckbox: { defaultProps: { size: "small" } }
489
+ }
490
+ });
491
+ function Fe(e, t) {
492
+ if (!e || typeof e != "object") return e;
493
+ const i = t && typeof t == "object" ? t : {};
494
+ 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 });
500
+ }
501
+ return n || e;
502
+ }
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,
513
+ { 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
523
+ })
524
+ )
525
+ );
268
526
  }
269
527
  export {
270
- w as ArrayFieldTemplate,
271
- D as DescriptionFieldTemplate,
272
- I as GroupedObjectFieldTemplate,
273
- K as PMForm,
274
- E as PM_RJSF_CSS,
275
- h as SPECIAL_DIRS,
276
- N as TitleFieldTemplate,
277
- R as WrapIfAdditionalTemplate,
278
- L as injectStyles,
279
- O as makeValidator,
280
- B as prepareForRjsf,
281
- s as simplify,
282
- C as stripSpecialDirs,
283
- q as templates
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
284
544
  };