@overmap-ai/forms 1.0.4-conditional-arrows-2.17 → 1.0.4-conditional-arrows-2.19
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/forms.js +514 -507
- package/dist/forms.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/forms.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (s, i, e) => (
|
|
1
|
+
var jt = Object.defineProperty;
|
|
2
|
+
var Ut = (s, i, e) => i in s ? jt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
|
|
3
|
+
var m = (s, i, e) => (Ut(s, typeof i != "symbol" ? i + "" : i, e), e);
|
|
4
4
|
import { jsx as r, jsxs as b, Fragment as bt } from "react/jsx-runtime";
|
|
5
|
-
import { Flex as y, Text as
|
|
5
|
+
import { Flex as y, Text as $, useSeverityColor as fe, Checkbox as Ht, CheckCircledIcon as Gt, TextField as ce, FontFamilyIcon as Xt, CalendarIcon as Kt, InputIcon as Yt, TextArea as Zt, RowsIcon as Qt, Select as yt, Box as he, IconButton as ge, PlusIcon as Oe, Badge as He, Cross1Icon as wt, ListBulletIcon as Jt, DropdownMenuIcon as ei, MultiSelect as ti, CheckboxIcon as ii, Card as ve, Heading as Ne, Button as G, UploadIcon as vt, ButtonList as Re, divButtonProps as ni, StarFilledIcon as ri, StarIcon as oi, QuestionMarkCircledIcon as si, PersonIcon as li, Tooltip as ai, Avatar as ci, Separator as di, Dialog as ui, Pencil1Icon as fi, TrashIcon as mi, CopyIcon as pi, DropdownMenu as hi, DotsVerticalIcon as gi, useAlertDialog as bi, Em as yi, Strong as ut, useToast as wi, Tabs as J } from "@overmap-ai/blocks";
|
|
6
6
|
import { useField as Je, useFormikContext as me, useFormik as et, FormikProvider as tt } from "formik";
|
|
7
|
-
import vi, { useMemo as
|
|
7
|
+
import vi, { useMemo as v, memo as T, useCallback as F, useState as X, useEffect as xe, useRef as xi, forwardRef as Ie, useReducer as Ii } from "react";
|
|
8
8
|
import { DragDropContext as xt, Droppable as it, Draggable as nt } from "@hello-pangea/dnd";
|
|
9
|
-
import { slugify as
|
|
9
|
+
import { slugify as Ci, useAppSelector as _, selectFormRevision as It, useSDK as Ct, selectSubmissionAttachments as Fi, selectFilteredUserForms as Ti, selectUserFormMapping as Si, selectOrganization as Ft, selectUser as rt, selectNumberOfUserForms as zi, selectCurrentUser as Tt, classNames as St, isToday as Ei, getLocalDateString as Ai, selectLatestFormRevision as Li, useFileSrc as Pi, selectSubmissionsForForm as $i } from "@overmap-ai/core";
|
|
10
10
|
import de from "lodash.get";
|
|
11
11
|
import ot from "lodash.set";
|
|
12
|
-
import ft from "react-xarrows";
|
|
13
|
-
class
|
|
12
|
+
import ft, { useXarrow as zt, Xwrapper as ki } from "react-xarrows";
|
|
13
|
+
class Et {
|
|
14
14
|
constructor(i) {
|
|
15
15
|
m(this, "type");
|
|
16
16
|
m(this, "identifier");
|
|
@@ -34,7 +34,7 @@ class zt {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
class M extends
|
|
37
|
+
class M extends Et {
|
|
38
38
|
constructor(e) {
|
|
39
39
|
const { label: t, required: n, fieldValidators: o = [], formValidators: a = [], ...c } = e;
|
|
40
40
|
super(c);
|
|
@@ -91,27 +91,27 @@ class M extends zt {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
m(M, "fieldTypeName"), m(M, "fieldTypeDescription");
|
|
94
|
-
const
|
|
95
|
-
description:
|
|
96
|
-
sectionContainer:
|
|
94
|
+
const Vi = "_description_1se5r_1", Di = "_sectionContainer_1se5r_5", be = {
|
|
95
|
+
description: Vi,
|
|
96
|
+
sectionContainer: Di
|
|
97
97
|
}, W = (s) => {
|
|
98
98
|
const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: a } = s;
|
|
99
99
|
return /* @__PURE__ */ r(y, { direction: "column", gap: "1", asChild: !0, ...a, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
|
|
100
|
-
/* @__PURE__ */ r(
|
|
100
|
+
/* @__PURE__ */ r($, { severity: t, id: o, children: i }),
|
|
101
101
|
e
|
|
102
102
|
] }) });
|
|
103
103
|
}, j = (s) => {
|
|
104
104
|
const { helpText: i, children: e, severity: t } = s;
|
|
105
105
|
return /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
|
|
106
106
|
e,
|
|
107
|
-
/* @__PURE__ */ r(y, { direction: "column", children: /* @__PURE__ */ r(
|
|
107
|
+
/* @__PURE__ */ r(y, { direction: "column", children: /* @__PURE__ */ r($, { size: "1", severity: t, className: be.description, children: i }) })
|
|
108
108
|
] });
|
|
109
|
-
},
|
|
110
|
-
const { id: i, field: e, formId: t, ...n } = s, [o, a, c] = Je(e.getId()), { touched: l } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`,
|
|
109
|
+
}, U = (s) => {
|
|
110
|
+
const { id: i, field: e, formId: t, ...n } = s, [o, a, c] = Je(e.getId()), { touched: l } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, p = `${u}-label`, g = e.required ? `${e.label} *` : e.label, h = v(() => ({
|
|
111
111
|
...o,
|
|
112
112
|
onChange: (C) => {
|
|
113
|
-
const
|
|
114
|
-
c.setValue(
|
|
113
|
+
const w = e.getValueFromChangeEvent(C);
|
|
114
|
+
c.setValue(w, !1).then(), (l || !e.onlyValidateAfterTouched) && c.setError(e.getError(w));
|
|
115
115
|
},
|
|
116
116
|
onBlur: (C) => {
|
|
117
117
|
c.setTouched(!0, !1).then(), c.setError(e.getError(e.getValueFromChangeEvent(C)));
|
|
@@ -122,16 +122,16 @@ const $i = "_description_zyr02_1", ki = "_sectionContainer_zyr02_5", be = {
|
|
|
122
122
|
helpText: f,
|
|
123
123
|
severity: d,
|
|
124
124
|
inputId: u,
|
|
125
|
-
labelId:
|
|
126
|
-
label:
|
|
127
|
-
fieldProps:
|
|
125
|
+
labelId: p,
|
|
126
|
+
label: g,
|
|
127
|
+
fieldProps: h,
|
|
128
128
|
helpers: c,
|
|
129
129
|
field: e
|
|
130
130
|
},
|
|
131
|
-
{ ...n, "aria-labelledby":
|
|
131
|
+
{ ...n, "aria-labelledby": p }
|
|
132
132
|
];
|
|
133
|
-
},
|
|
134
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] =
|
|
133
|
+
}, _i = [!0, "true"], Mi = T(function(i) {
|
|
134
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = U(i), f = fe(n), d = _i.includes(c.value);
|
|
135
135
|
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(
|
|
136
136
|
W,
|
|
137
137
|
{
|
|
@@ -177,13 +177,13 @@ const $i = "_description_zyr02_1", ki = "_sectionContainer_zyr02_5", be = {
|
|
|
177
177
|
return new ee(e);
|
|
178
178
|
}
|
|
179
179
|
getInput(e) {
|
|
180
|
-
return /* @__PURE__ */ r(
|
|
180
|
+
return /* @__PURE__ */ r(Mi, { ...e, field: this });
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
m(ee, "fieldTypeName", "Checkbox"), m(ee, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(ee, "Icon",
|
|
183
|
+
m(ee, "fieldTypeName", "Checkbox"), m(ee, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(ee, "Icon", Gt);
|
|
184
184
|
let ue = ee;
|
|
185
|
-
const
|
|
186
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] =
|
|
185
|
+
const Oi = T(function(i) {
|
|
186
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = U(i), d = fe(n);
|
|
187
187
|
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
188
188
|
ce.Input,
|
|
189
189
|
{
|
|
@@ -268,13 +268,13 @@ const Di = z(function(i) {
|
|
|
268
268
|
return new B(e);
|
|
269
269
|
}
|
|
270
270
|
getInput(e) {
|
|
271
|
-
return /* @__PURE__ */ r(
|
|
271
|
+
return /* @__PURE__ */ r(Oi, { field: this, ...e });
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
-
m(B, "fieldTypeName", "Number"), m(B, "fieldTypeDescription", "Allows specifying a number within a given range."), m(B, "Icon",
|
|
275
|
-
let
|
|
276
|
-
const
|
|
277
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] =
|
|
274
|
+
m(B, "fieldTypeName", "Number"), m(B, "fieldTypeDescription", "Allows specifying a number within a given range."), m(B, "Icon", Xt), m(B, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(B, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
|
|
275
|
+
let Z = B;
|
|
276
|
+
const Ni = T(function(i) {
|
|
277
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = U(i), f = fe(n), d = c.value ? c.value.split("T")[0] : "";
|
|
278
278
|
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(ce.Input, { ...l, ...c, type: "date", id: e, color: f, value: d }) }) });
|
|
279
279
|
}), te = class te extends M {
|
|
280
280
|
constructor(e) {
|
|
@@ -293,7 +293,7 @@ const Oi = z(function(i) {
|
|
|
293
293
|
return new te(e);
|
|
294
294
|
}
|
|
295
295
|
getInput(e) {
|
|
296
|
-
return /* @__PURE__ */ r(
|
|
296
|
+
return /* @__PURE__ */ r(Ni, { field: this, ...e });
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
m(te, "fieldTypeName", "Date"), m(te, "fieldTypeDescription", "Allows specifying a date."), m(te, "Icon", Kt);
|
|
@@ -309,7 +309,7 @@ class Ae extends M {
|
|
|
309
309
|
static getFieldCreationSchema() {
|
|
310
310
|
return [
|
|
311
311
|
// min, max
|
|
312
|
-
new
|
|
312
|
+
new Z({
|
|
313
313
|
label: "Minimum length",
|
|
314
314
|
description: "Minimum number of characters",
|
|
315
315
|
required: !1,
|
|
@@ -319,7 +319,7 @@ class Ae extends M {
|
|
|
319
319
|
formValidators: [this._validateMin],
|
|
320
320
|
integers: !0
|
|
321
321
|
}),
|
|
322
|
-
new
|
|
322
|
+
new Z({
|
|
323
323
|
label: "Maximum length",
|
|
324
324
|
description: "Maximum number of characters",
|
|
325
325
|
required: !1,
|
|
@@ -367,8 +367,8 @@ m(Ae, "_validateMax", (e, t) => {
|
|
|
367
367
|
const { minimum_length: n } = t;
|
|
368
368
|
return typeof n != "number" ? null : n > e ? "Maximum cannot be less than minimum." : null;
|
|
369
369
|
});
|
|
370
|
-
const
|
|
371
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] =
|
|
370
|
+
const Ri = T(function(i) {
|
|
371
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = U(i), d = fe(n);
|
|
372
372
|
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(ce.Input, { ...f, ...c, type: l.inputType, id: e, color: d }) }) });
|
|
373
373
|
}), ie = class ie extends Ae {
|
|
374
374
|
constructor(e) {
|
|
@@ -387,14 +387,14 @@ const Mi = z(function(i) {
|
|
|
387
387
|
return new ie({ ...a, maxLength: t, minLength: n, inputType: o });
|
|
388
388
|
}
|
|
389
389
|
getInput(e) {
|
|
390
|
-
return /* @__PURE__ */ r(
|
|
390
|
+
return /* @__PURE__ */ r(Ri, { field: this, ...e });
|
|
391
391
|
}
|
|
392
392
|
};
|
|
393
|
-
m(ie, "fieldTypeName", "Short Text"), m(ie, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(ie, "Icon",
|
|
393
|
+
m(ie, "fieldTypeName", "Short Text"), m(ie, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(ie, "Icon", Yt);
|
|
394
394
|
let ye = ie;
|
|
395
|
-
const
|
|
396
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] =
|
|
397
|
-
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
395
|
+
const Bi = T(function(i) {
|
|
396
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = U(i);
|
|
397
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(Zt, { ...l, ...c, resize: "vertical", id: e, severity: n }) }) });
|
|
398
398
|
}), ne = class ne extends Ae {
|
|
399
399
|
constructor(i) {
|
|
400
400
|
const e = i.maxLength ? Math.min(5e3, i.maxLength) : 5e3, t = i.minLength ? Math.min(i.minLength, e) : void 0;
|
|
@@ -410,27 +410,27 @@ const Ni = z(function(i) {
|
|
|
410
410
|
return new ne({ ...n, maxLength: e, minLength: t });
|
|
411
411
|
}
|
|
412
412
|
getInput(i) {
|
|
413
|
-
return /* @__PURE__ */ r(
|
|
413
|
+
return /* @__PURE__ */ r(Bi, { field: this, ...i });
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
|
-
m(ne, "fieldTypeName", "Paragraph"), m(ne, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(ne, "Icon",
|
|
417
|
-
let
|
|
418
|
-
const
|
|
419
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] =
|
|
420
|
-
() => l.options.map((
|
|
416
|
+
m(ne, "fieldTypeName", "Paragraph"), m(ne, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(ne, "Icon", Qt);
|
|
417
|
+
let we = ne;
|
|
418
|
+
const qi = T(function(i) {
|
|
419
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = U(i), { onChange: d, onBlur: u } = c, p = v(
|
|
420
|
+
() => l.options.map((h) => ({ value: h.value, itemContent: h.label })),
|
|
421
421
|
[l.options]
|
|
422
|
-
),
|
|
423
|
-
(
|
|
424
|
-
d(
|
|
422
|
+
), g = F(
|
|
423
|
+
(h) => {
|
|
424
|
+
d(h), u(h);
|
|
425
425
|
},
|
|
426
426
|
[d, u]
|
|
427
427
|
);
|
|
428
428
|
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
429
429
|
yt,
|
|
430
430
|
{
|
|
431
|
-
items:
|
|
431
|
+
items: p,
|
|
432
432
|
...c,
|
|
433
|
-
onValueChange:
|
|
433
|
+
onValueChange: g,
|
|
434
434
|
placeholder: "Select one...",
|
|
435
435
|
id: e,
|
|
436
436
|
severity: n,
|
|
@@ -444,7 +444,7 @@ const Ri = z(function(i) {
|
|
|
444
444
|
label: null,
|
|
445
445
|
condition: null,
|
|
446
446
|
conditional: !1
|
|
447
|
-
}),
|
|
447
|
+
}), Wi = (s) => {
|
|
448
448
|
if (!s)
|
|
449
449
|
return;
|
|
450
450
|
const i = s.fields;
|
|
@@ -454,17 +454,17 @@ const Ri = z(function(i) {
|
|
|
454
454
|
n.type === "section" ? (e.length > 0 && (t.push(Le(`AUTO_section-${i.indexOf(n)}`, e)), e = []), t.push(n)) : e.push(n);
|
|
455
455
|
return e.length > 0 && t.push(Le("AUTO_section-last", e)), { ...s, fields: t, description: s.description ?? "" };
|
|
456
456
|
};
|
|
457
|
-
function
|
|
457
|
+
function Xe(s, i, e) {
|
|
458
458
|
const t = Array.from(s), [n] = t.splice(i, 1);
|
|
459
459
|
if (!n)
|
|
460
460
|
throw new Error("Could not find field to reorder.");
|
|
461
461
|
return t.splice(e, 0, n), t;
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function ji(s, i, e) {
|
|
464
464
|
const t = Array.from(s);
|
|
465
465
|
return t[i] = e, t;
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function At(s, i, e) {
|
|
468
468
|
const t = Array.from(s ?? []);
|
|
469
469
|
return t.splice(i, 0, e), t;
|
|
470
470
|
}
|
|
@@ -472,77 +472,77 @@ function Pe(s, i) {
|
|
|
472
472
|
const e = Array.from(s);
|
|
473
473
|
return e.splice(i, 1), e;
|
|
474
474
|
}
|
|
475
|
-
const
|
|
475
|
+
const Lt = (s, i) => {
|
|
476
476
|
if (typeof s == "string" && s.length > 0)
|
|
477
477
|
return s;
|
|
478
478
|
const e = /* @__PURE__ */ new Date();
|
|
479
|
-
return `${
|
|
480
|
-
},
|
|
479
|
+
return `${Ci(i)}-${e.getTime()}`;
|
|
480
|
+
}, Pt = (s, i) => {
|
|
481
481
|
if (!i)
|
|
482
482
|
return null;
|
|
483
483
|
for (const e of s)
|
|
484
484
|
if (e.type === "section") {
|
|
485
|
-
const t =
|
|
485
|
+
const t = Pt(e.fields, i);
|
|
486
486
|
if (t)
|
|
487
487
|
return t;
|
|
488
488
|
} else if (e.identifier === i)
|
|
489
489
|
return e;
|
|
490
490
|
return null;
|
|
491
|
-
}, Ee = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields),
|
|
491
|
+
}, Ee = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), $t = (s) => s.flatMap(
|
|
492
492
|
(i) => i.type === "section" ? [...i.fields.map((e) => e.label), i.label] : i.label
|
|
493
|
-
).filter((i) => i !== null),
|
|
493
|
+
).filter((i) => i !== null), Ke = (s, i) => {
|
|
494
494
|
let e = 1, t = `${s} (${e})`;
|
|
495
495
|
for (; i.includes(t); )
|
|
496
496
|
t = `${s} (${++e})`;
|
|
497
497
|
return t;
|
|
498
|
-
},
|
|
499
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] =
|
|
498
|
+
}, Ui = T(function(i) {
|
|
499
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = U(i), f = fe(n), d = v(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: p } = c, g = `${e}-droppable`, { disabled: h } = l, [S, I] = X(""), [C, w] = X(""), k = C || o, L = C ? "red" : f, x = F(
|
|
500
500
|
(E) => {
|
|
501
|
-
u(E),
|
|
501
|
+
u(E), p(E);
|
|
502
502
|
},
|
|
503
|
-
[u,
|
|
503
|
+
[u, p]
|
|
504
504
|
), P = F(
|
|
505
505
|
(E) => {
|
|
506
|
-
d.findIndex((
|
|
506
|
+
d.findIndex((N) => N.value === E.target.value.trim()) >= 0 ? w("All options must be unique") : E.target.value ? w("") : w("Option cannot be empty"), I(E.target.value);
|
|
507
507
|
},
|
|
508
508
|
[I, d]
|
|
509
|
-
),
|
|
509
|
+
), O = F(() => {
|
|
510
510
|
if (C)
|
|
511
511
|
return;
|
|
512
|
-
if (!
|
|
513
|
-
return
|
|
514
|
-
const E =
|
|
512
|
+
if (!S.trim())
|
|
513
|
+
return w("Option cannot be empty");
|
|
514
|
+
const E = S.trim();
|
|
515
515
|
x([...d, { value: E, label: E }]), I("");
|
|
516
|
-
}, [
|
|
516
|
+
}, [S, C, x, d]), K = F(
|
|
517
517
|
(E) => {
|
|
518
|
-
E.key === "Enter" && (E.preventDefault(),
|
|
518
|
+
E.key === "Enter" && (E.preventDefault(), O());
|
|
519
519
|
},
|
|
520
|
-
[
|
|
520
|
+
[O]
|
|
521
521
|
), q = F(
|
|
522
522
|
(E) => {
|
|
523
523
|
x(Pe(d, E));
|
|
524
524
|
},
|
|
525
525
|
[d, x]
|
|
526
|
-
),
|
|
526
|
+
), H = F(
|
|
527
527
|
(E) => {
|
|
528
528
|
if (!E.destination)
|
|
529
529
|
return;
|
|
530
|
-
const
|
|
531
|
-
x(
|
|
530
|
+
const N = E.source.index, Y = E.destination.index;
|
|
531
|
+
x(Xe(d, N, Y));
|
|
532
532
|
},
|
|
533
533
|
[x, d]
|
|
534
534
|
);
|
|
535
|
-
return /* @__PURE__ */ r(xt, { onDragEnd:
|
|
536
|
-
/* @__PURE__ */ r(j, { helpText:
|
|
537
|
-
/* @__PURE__ */ r(
|
|
535
|
+
return /* @__PURE__ */ r(xt, { onDragEnd: H, children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
|
|
536
|
+
/* @__PURE__ */ r(j, { helpText: k, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: (!h || d.length === 0) && /* @__PURE__ */ b(y, { gap: "2", children: [
|
|
537
|
+
/* @__PURE__ */ r(he, { grow: "1", children: /* @__PURE__ */ r(
|
|
538
538
|
ce.Input,
|
|
539
539
|
{
|
|
540
540
|
placeholder: "Press enter to add a new option",
|
|
541
541
|
...l,
|
|
542
542
|
...c,
|
|
543
|
-
value:
|
|
543
|
+
value: S,
|
|
544
544
|
onChange: P,
|
|
545
|
-
onKeyDown:
|
|
545
|
+
onKeyDown: K,
|
|
546
546
|
id: e,
|
|
547
547
|
color: L,
|
|
548
548
|
onBlur: void 0
|
|
@@ -553,19 +553,19 @@ const At = (s, i) => {
|
|
|
553
553
|
{
|
|
554
554
|
type: "button",
|
|
555
555
|
"aria-label": "Add option",
|
|
556
|
-
disabled: !!C ||
|
|
557
|
-
onClick:
|
|
558
|
-
children: /* @__PURE__ */ r(
|
|
556
|
+
disabled: !!C || h,
|
|
557
|
+
onClick: O,
|
|
558
|
+
children: /* @__PURE__ */ r(Oe, {})
|
|
559
559
|
}
|
|
560
560
|
)
|
|
561
561
|
] }) }) }),
|
|
562
|
-
/* @__PURE__ */ r(it, { droppableId:
|
|
563
|
-
d.map((
|
|
562
|
+
/* @__PURE__ */ r(it, { droppableId: g, children: (E) => /* @__PURE__ */ b(y, { ...E.droppableProps, ref: E.innerRef, direction: "column", children: [
|
|
563
|
+
d.map((N, Y) => /* @__PURE__ */ r(
|
|
564
564
|
nt,
|
|
565
565
|
{
|
|
566
|
-
draggableId: `${
|
|
566
|
+
draggableId: `${N.value}-draggable`,
|
|
567
567
|
index: Y,
|
|
568
|
-
isDragDisabled:
|
|
568
|
+
isDragDisabled: h,
|
|
569
569
|
children: ({ draggableProps: Ce, dragHandleProps: Fe, innerRef: Te }) => /* @__PURE__ */ r(
|
|
570
570
|
y,
|
|
571
571
|
{
|
|
@@ -577,8 +577,8 @@ const At = (s, i) => {
|
|
|
577
577
|
justify: "between",
|
|
578
578
|
mb: "1",
|
|
579
579
|
asChild: !0,
|
|
580
|
-
children: /* @__PURE__ */ b(
|
|
581
|
-
/* @__PURE__ */ r("span", { children:
|
|
580
|
+
children: /* @__PURE__ */ b(He, { color: "gray", size: "2", children: [
|
|
581
|
+
/* @__PURE__ */ r("span", { children: N.label }),
|
|
582
582
|
/* @__PURE__ */ r(
|
|
583
583
|
ge,
|
|
584
584
|
{
|
|
@@ -587,16 +587,16 @@ const At = (s, i) => {
|
|
|
587
587
|
type: "button",
|
|
588
588
|
"aria-label": "Delete option",
|
|
589
589
|
severity: "info",
|
|
590
|
-
disabled:
|
|
590
|
+
disabled: h,
|
|
591
591
|
onClick: () => q(Y),
|
|
592
|
-
children: /* @__PURE__ */ r(
|
|
592
|
+
children: /* @__PURE__ */ r(wt, {})
|
|
593
593
|
}
|
|
594
594
|
)
|
|
595
595
|
] })
|
|
596
596
|
}
|
|
597
597
|
)
|
|
598
598
|
},
|
|
599
|
-
|
|
599
|
+
N.value
|
|
600
600
|
)),
|
|
601
601
|
E.placeholder
|
|
602
602
|
] }) })
|
|
@@ -616,7 +616,7 @@ const At = (s, i) => {
|
|
|
616
616
|
throw new Error("Expected an array.");
|
|
617
617
|
}
|
|
618
618
|
getInput(e) {
|
|
619
|
-
return /* @__PURE__ */ r(
|
|
619
|
+
return /* @__PURE__ */ r(Ui, { field: this, ...e });
|
|
620
620
|
}
|
|
621
621
|
serialize() {
|
|
622
622
|
return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
|
|
@@ -640,9 +640,9 @@ const At = (s, i) => {
|
|
|
640
640
|
return new re(e);
|
|
641
641
|
}
|
|
642
642
|
};
|
|
643
|
-
m(re, "fieldTypeName", "Multi-string"), m(re, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(re, "Icon",
|
|
643
|
+
m(re, "fieldTypeName", "Multi-string"), m(re, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(re, "Icon", Jt);
|
|
644
644
|
let $e = re;
|
|
645
|
-
class
|
|
645
|
+
class kt extends M {
|
|
646
646
|
constructor(e) {
|
|
647
647
|
super(e);
|
|
648
648
|
m(this, "options");
|
|
@@ -672,7 +672,7 @@ class $t extends M {
|
|
|
672
672
|
];
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
const oe = class oe extends
|
|
675
|
+
const oe = class oe extends kt {
|
|
676
676
|
constructor(i) {
|
|
677
677
|
super({ ...i, type: "select" });
|
|
678
678
|
}
|
|
@@ -688,23 +688,23 @@ const oe = class oe extends $t {
|
|
|
688
688
|
return new oe(i);
|
|
689
689
|
}
|
|
690
690
|
getInput(i) {
|
|
691
|
-
return /* @__PURE__ */ r(
|
|
691
|
+
return /* @__PURE__ */ r(qi, { field: this, ...i });
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
|
-
m(oe, "fieldTypeName", "Dropdown"), m(oe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(oe, "Icon",
|
|
694
|
+
m(oe, "fieldTypeName", "Dropdown"), m(oe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(oe, "Icon", ei);
|
|
695
695
|
let ke = oe;
|
|
696
|
-
const
|
|
697
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] =
|
|
698
|
-
(
|
|
699
|
-
d(
|
|
696
|
+
const Hi = (s) => s ? Array.isArray(s) ? s : [s] : [], Gi = T(function(i) {
|
|
697
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = U(i), { onChange: d, onBlur: u } = c, p = v(() => Hi(c.value), [c.value]), g = F(
|
|
698
|
+
(h) => {
|
|
699
|
+
d(h), u(h);
|
|
700
700
|
},
|
|
701
701
|
[d, u]
|
|
702
702
|
);
|
|
703
703
|
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
704
|
-
|
|
704
|
+
ti,
|
|
705
705
|
{
|
|
706
|
-
value:
|
|
707
|
-
onValueChange:
|
|
706
|
+
value: p,
|
|
707
|
+
onValueChange: g,
|
|
708
708
|
options: l.options,
|
|
709
709
|
name: c.name,
|
|
710
710
|
placeholder: "Select one or more...",
|
|
@@ -713,7 +713,7 @@ const ji = (s) => s ? Array.isArray(s) ? s : [s] : [], Hi = z(function(i) {
|
|
|
713
713
|
...f
|
|
714
714
|
}
|
|
715
715
|
) }) });
|
|
716
|
-
}), se = class se extends
|
|
716
|
+
}), se = class se extends kt {
|
|
717
717
|
constructor(i) {
|
|
718
718
|
super({ ...i, type: "multi-select" });
|
|
719
719
|
}
|
|
@@ -734,19 +734,19 @@ const ji = (s) => s ? Array.isArray(s) ? s : [s] : [], Hi = z(function(i) {
|
|
|
734
734
|
return new se(i);
|
|
735
735
|
}
|
|
736
736
|
getInput(i) {
|
|
737
|
-
return /* @__PURE__ */ r(
|
|
737
|
+
return /* @__PURE__ */ r(Gi, { field: this, ...i });
|
|
738
738
|
}
|
|
739
739
|
};
|
|
740
|
-
m(se, "fieldTypeName", "Multi-select"), m(se, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(se, "Icon",
|
|
740
|
+
m(se, "fieldTypeName", "Multi-select"), m(se, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(se, "Icon", ii);
|
|
741
741
|
let Ve = se;
|
|
742
|
-
const
|
|
743
|
-
const [{ value: t }] = Je(i.options.clonedFieldIdentifier), n =
|
|
742
|
+
const Xi = T(function({ field: i, ...e }) {
|
|
743
|
+
const [{ value: t }] = Je(i.options.clonedFieldIdentifier), n = v(() => {
|
|
744
744
|
const o = i.options.getFieldToClone(t);
|
|
745
745
|
return o ? Be(o) : null;
|
|
746
746
|
}, [i.options, t]);
|
|
747
|
-
return
|
|
747
|
+
return _e(n, e);
|
|
748
748
|
});
|
|
749
|
-
class
|
|
749
|
+
class De extends M {
|
|
750
750
|
constructor(e, t) {
|
|
751
751
|
super({ ...e, type: "custom" });
|
|
752
752
|
m(this, "Component");
|
|
@@ -762,28 +762,28 @@ class _e extends M {
|
|
|
762
762
|
return /* @__PURE__ */ r(t, { field: this, ...e });
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
m(
|
|
766
|
-
class
|
|
765
|
+
m(De, "fieldTypeName", "Custom"), m(De, "fieldTypeDescription", "Allows re-rendering of field already in the form");
|
|
766
|
+
class Ki extends De {
|
|
767
767
|
constructor(i) {
|
|
768
|
-
super(i,
|
|
768
|
+
super(i, Xi);
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
|
-
const
|
|
772
|
-
const { field: e, ...t } = i, { label: n, description: o, fields: a, condition: c } = e, { values: l, setFieldValue: f } = me(), d = c != null && c.identifier ? de(l, c.identifier) : void 0, u =
|
|
771
|
+
const Yi = T(function(i) {
|
|
772
|
+
const { field: e, ...t } = i, { label: n, description: o, fields: a, condition: c } = e, { values: l, setFieldValue: f } = me(), d = c != null && c.identifier ? de(l, c.identifier) : void 0, u = v(() => _t(c, d), [c, d]);
|
|
773
773
|
xe(() => {
|
|
774
774
|
if (!u)
|
|
775
|
-
for (const
|
|
776
|
-
f(
|
|
775
|
+
for (const g of a)
|
|
776
|
+
f(g.getId(), "").then();
|
|
777
777
|
}, [u, a, f]);
|
|
778
|
-
const
|
|
779
|
-
return u ? n ? /* @__PURE__ */ r(
|
|
778
|
+
const p = Mt(a, t);
|
|
779
|
+
return u ? n ? /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
|
|
780
780
|
/* @__PURE__ */ b(y, { direction: "column", children: [
|
|
781
781
|
/* @__PURE__ */ r(Ne, { as: "h3", size: "3", children: n }),
|
|
782
|
-
/* @__PURE__ */ r(
|
|
782
|
+
/* @__PURE__ */ r($, { className: be.description, children: o })
|
|
783
783
|
] }),
|
|
784
|
-
|
|
785
|
-
] }) }) :
|
|
786
|
-
}), le = class le extends
|
|
784
|
+
p
|
|
785
|
+
] }) }) : p : null;
|
|
786
|
+
}), le = class le extends Et {
|
|
787
787
|
constructor(e) {
|
|
788
788
|
const { label: t = null, fields: n, condition: o = null, conditional: a, ...c } = e;
|
|
789
789
|
super({ ...c, type: "section" });
|
|
@@ -830,7 +830,7 @@ const Ki = z(function(i) {
|
|
|
830
830
|
// Declare a custom field that will be used to input a value for the condition. The value of the
|
|
831
831
|
// conditional field selected in the previous step must be equal to the value the user inputs into
|
|
832
832
|
// this field for the section to be rendered.
|
|
833
|
-
new
|
|
833
|
+
new Ki({
|
|
834
834
|
label: "Value",
|
|
835
835
|
identifier: "condition.value",
|
|
836
836
|
required: !0,
|
|
@@ -857,7 +857,7 @@ const Ki = z(function(i) {
|
|
|
857
857
|
var n;
|
|
858
858
|
if (e.type !== "section")
|
|
859
859
|
throw new Error("Invalid type");
|
|
860
|
-
const t = ((n = e.fields) == null ? void 0 : n.map(
|
|
860
|
+
const t = ((n = e.fields) == null ? void 0 : n.map(Vt)) ?? [];
|
|
861
861
|
return new le({ ...e, fields: t });
|
|
862
862
|
}
|
|
863
863
|
conditional() {
|
|
@@ -881,12 +881,12 @@ const Ki = z(function(i) {
|
|
|
881
881
|
return t;
|
|
882
882
|
}
|
|
883
883
|
getInput(e) {
|
|
884
|
-
return /* @__PURE__ */ r(
|
|
884
|
+
return /* @__PURE__ */ r(Yi, { field: this, ...e });
|
|
885
885
|
}
|
|
886
886
|
};
|
|
887
887
|
m(le, "fieldTypeName", "Section"), m(le, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
888
888
|
let Q = le;
|
|
889
|
-
const Zi = "_previewImage_1ig84_1",
|
|
889
|
+
const Zi = "_previewImage_1ig84_1", Qi = {
|
|
890
890
|
previewImage: Zi
|
|
891
891
|
}, st = (s) => {
|
|
892
892
|
const i = ["byte", "kilobyte", "megabyte"];
|
|
@@ -894,31 +894,31 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
894
894
|
for (; e > 1024 && t < i.length - 1; )
|
|
895
895
|
e /= 1024, t++;
|
|
896
896
|
return new Intl.NumberFormat([], { maximumFractionDigits: 2, style: "unit", unit: i[t] }).format(e);
|
|
897
|
-
},
|
|
897
|
+
}, Ji = T(function(i) {
|
|
898
898
|
var L;
|
|
899
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] =
|
|
899
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = U(i), { onChange: d } = c, u = fe(n), p = xi(null), { value: g } = c, h = v(() => o || (l.maxFileSize ? `Maximum file size: ${st(l.maxFileSize)}` : null), [l.maxFileSize, o]), S = F(() => {
|
|
900
900
|
var x;
|
|
901
|
-
(x =
|
|
901
|
+
(x = p.current) == null || x.click();
|
|
902
902
|
}, []), I = F(
|
|
903
903
|
(x) => {
|
|
904
|
-
const P = [...
|
|
904
|
+
const P = [...g];
|
|
905
905
|
P.splice(x, 1), d({ target: { files: P } });
|
|
906
906
|
},
|
|
907
|
-
[
|
|
908
|
-
), C =
|
|
907
|
+
[g, d]
|
|
908
|
+
), C = g ? "Select new files" : "Select files", w = g ? "Select new file" : "Select a file", k = l.maxFiles > 1 ? C : w;
|
|
909
909
|
return /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
|
|
910
|
-
/* @__PURE__ */ r(j, { helpText:
|
|
911
|
-
/* @__PURE__ */ r(y, { direction: "row", gap: "2", children: /* @__PURE__ */ r(
|
|
912
|
-
/* @__PURE__ */ r(
|
|
910
|
+
/* @__PURE__ */ r(j, { helpText: h, severity: n, children: /* @__PURE__ */ b(W, { severity: n, inputId: e, labelId: t, label: a, children: [
|
|
911
|
+
/* @__PURE__ */ r(y, { direction: "row", gap: "2", children: /* @__PURE__ */ r(he, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(G, { ...f, onClick: S, children: [
|
|
912
|
+
/* @__PURE__ */ r(vt, {}),
|
|
913
913
|
" ",
|
|
914
|
-
|
|
914
|
+
k
|
|
915
915
|
] }) }) }),
|
|
916
916
|
/* @__PURE__ */ r(
|
|
917
917
|
"input",
|
|
918
918
|
{
|
|
919
919
|
...f,
|
|
920
920
|
type: "file",
|
|
921
|
-
ref:
|
|
921
|
+
ref: p,
|
|
922
922
|
id: e,
|
|
923
923
|
accept: (L = l.extensions) == null ? void 0 : L.join(","),
|
|
924
924
|
multiple: l.maxFiles > 1,
|
|
@@ -929,8 +929,8 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
929
929
|
}
|
|
930
930
|
)
|
|
931
931
|
] }) }),
|
|
932
|
-
Array.isArray(
|
|
933
|
-
|
|
932
|
+
Array.isArray(g) && g.length > 0 && /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: g.map((x, P) => /* @__PURE__ */ r(
|
|
933
|
+
en,
|
|
934
934
|
{
|
|
935
935
|
field: l,
|
|
936
936
|
file: x,
|
|
@@ -940,14 +940,14 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
940
940
|
P
|
|
941
941
|
)) })
|
|
942
942
|
] });
|
|
943
|
-
}),
|
|
944
|
-
const [o, a] =
|
|
945
|
-
let u = null,
|
|
946
|
-
return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (
|
|
943
|
+
}), en = T(function({ file: i, field: e, onRemove: t, disabled: n }) {
|
|
944
|
+
const [o, a] = X(null), c = v(() => o && e.getError([o]), [e, o]), { url: l, name: f, size: d } = v(() => {
|
|
945
|
+
let u = null, p, g;
|
|
946
|
+
return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (p = o.name, g = st(o.size)) : (p = "Downloading...", g = "..."), { url: u, name: p, size: g };
|
|
947
947
|
}, [o]);
|
|
948
948
|
return xe(() => {
|
|
949
949
|
i instanceof Promise ? i.then(a) : a(i);
|
|
950
|
-
}, [i]), /* @__PURE__ */ r(
|
|
950
|
+
}, [i]), /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(y, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
|
|
951
951
|
/* @__PURE__ */ b(y, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
|
|
952
952
|
/* @__PURE__ */ r(
|
|
953
953
|
ge,
|
|
@@ -957,16 +957,16 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
957
957
|
"aria-label": `Remove ${f}`,
|
|
958
958
|
disabled: n,
|
|
959
959
|
onClick: t,
|
|
960
|
-
children: /* @__PURE__ */ r(
|
|
960
|
+
children: /* @__PURE__ */ r(wt, {})
|
|
961
961
|
}
|
|
962
962
|
),
|
|
963
963
|
/* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
|
|
964
|
-
/* @__PURE__ */ r(
|
|
965
|
-
/* @__PURE__ */ r(
|
|
966
|
-
c && /* @__PURE__ */ r(
|
|
964
|
+
/* @__PURE__ */ r($, { children: f }),
|
|
965
|
+
/* @__PURE__ */ r($, { size: "1", children: d }),
|
|
966
|
+
c && /* @__PURE__ */ r($, { size: "1", severity: "danger", children: c })
|
|
967
967
|
] })
|
|
968
968
|
] }),
|
|
969
|
-
l && /* @__PURE__ */ r("img", { className:
|
|
969
|
+
l && /* @__PURE__ */ r("img", { className: Qi.previewImage, src: l, alt: f })
|
|
970
970
|
] }) });
|
|
971
971
|
}), mt = 50 * 1024 * 1024, ae = class ae extends M {
|
|
972
972
|
constructor(e) {
|
|
@@ -986,7 +986,7 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
986
986
|
}
|
|
987
987
|
static getFieldCreationSchema() {
|
|
988
988
|
return [
|
|
989
|
-
new
|
|
989
|
+
new Z({
|
|
990
990
|
label: "How many files can be uploaded?",
|
|
991
991
|
description: "By default, only one file can be uploaded.",
|
|
992
992
|
required: !1,
|
|
@@ -994,7 +994,7 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
994
994
|
maximum: 10,
|
|
995
995
|
identifier: "maximum_files"
|
|
996
996
|
}),
|
|
997
|
-
new
|
|
997
|
+
new Z({
|
|
998
998
|
label: "What is the maximum size of each file?",
|
|
999
999
|
description: "Maximum file size in bytes.",
|
|
1000
1000
|
required: !1,
|
|
@@ -1057,28 +1057,28 @@ const Zi = "_previewImage_1ig84_1", Yi = {
|
|
|
1057
1057
|
return new ae(e);
|
|
1058
1058
|
}
|
|
1059
1059
|
getInput(e) {
|
|
1060
|
-
return /* @__PURE__ */ r(
|
|
1060
|
+
return /* @__PURE__ */ r(Ji, { field: this, ...e });
|
|
1061
1061
|
}
|
|
1062
1062
|
};
|
|
1063
|
-
m(ae, "fieldTypeName", "Upload"), m(ae, "fieldTypeDescription", "Allows a file to be uploaded."), m(ae, "Icon",
|
|
1063
|
+
m(ae, "fieldTypeName", "Upload"), m(ae, "fieldTypeDescription", "Allows a file to be uploaded."), m(ae, "Icon", vt);
|
|
1064
1064
|
let Ye = ae;
|
|
1065
1065
|
const lt = {
|
|
1066
1066
|
date: Ge,
|
|
1067
|
-
number:
|
|
1067
|
+
number: Z,
|
|
1068
1068
|
boolean: ue,
|
|
1069
1069
|
select: ke,
|
|
1070
1070
|
string: ye,
|
|
1071
|
-
text:
|
|
1072
|
-
custom:
|
|
1071
|
+
text: we,
|
|
1072
|
+
custom: De,
|
|
1073
1073
|
upload: Ye,
|
|
1074
1074
|
// TODO: Underscore
|
|
1075
1075
|
"multi-string": $e,
|
|
1076
1076
|
"multi-select": Ve
|
|
1077
|
-
},
|
|
1077
|
+
}, Vt = (s) => {
|
|
1078
1078
|
const i = s.type;
|
|
1079
1079
|
return lt[i].deserialize(s);
|
|
1080
|
-
}, Be = (s) => s.type === "section" ? Q.deserialize(s) :
|
|
1081
|
-
function
|
|
1080
|
+
}, Be = (s) => s.type === "section" ? Q.deserialize(s) : Vt(s);
|
|
1081
|
+
function Dt(s, i = {}) {
|
|
1082
1082
|
const { readonly: e = !1 } = i;
|
|
1083
1083
|
return {
|
|
1084
1084
|
title: s.title,
|
|
@@ -1087,13 +1087,13 @@ function Vt(s, i = {}) {
|
|
|
1087
1087
|
meta: { readonly: e }
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1090
|
+
function Ze(s) {
|
|
1091
1091
|
return !!(Array.isArray(s) && s.some((i) => i instanceof File || i instanceof Promise));
|
|
1092
1092
|
}
|
|
1093
1093
|
function _t(s, i) {
|
|
1094
1094
|
if (!s)
|
|
1095
1095
|
return !0;
|
|
1096
|
-
if (
|
|
1096
|
+
if (Ze(i) || Ze(s.value))
|
|
1097
1097
|
throw new Error("Conditions do not support file uploads");
|
|
1098
1098
|
const e = Array.isArray(i) ? i.map((n) => typeof n == "string" ? n : n.value) : i, t = Array.isArray(s.value) ? s.value.map((n) => typeof n == "string" ? n : n.value) : s.value;
|
|
1099
1099
|
if (Array.isArray(t) && Array.isArray(e)) {
|
|
@@ -1104,10 +1104,10 @@ function _t(s, i) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
return t === i;
|
|
1106
1106
|
}
|
|
1107
|
-
const
|
|
1108
|
-
const e =
|
|
1107
|
+
const _e = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), Mt = (s, i) => {
|
|
1108
|
+
const e = v(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
|
|
1109
1109
|
return /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: e });
|
|
1110
|
-
},
|
|
1110
|
+
}, Me = (s) => Object.keys(s).length > 0, Ot = async (s, i) => {
|
|
1111
1111
|
const e = {};
|
|
1112
1112
|
for (const t of s.fields)
|
|
1113
1113
|
if (t instanceof Q) {
|
|
@@ -1123,16 +1123,16 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1123
1123
|
const n = t.getId(), o = t.getError(de(i, n), i);
|
|
1124
1124
|
o && ot(e, n, o);
|
|
1125
1125
|
}
|
|
1126
|
-
if (
|
|
1126
|
+
if (Me(e))
|
|
1127
1127
|
return e;
|
|
1128
|
-
},
|
|
1128
|
+
}, tn = [null, void 0], at = (s, i) => s.reduce((e, t) => t instanceof Q ? { ...e, ...at(t.fields, i) } : (tn.includes(de(e, t.getId())) && ot(e, t.getId(), ""), e), i), nn = () => {
|
|
1129
1129
|
throw new Error("onSubmit must be provided if form is not readonly.");
|
|
1130
|
-
}, ct =
|
|
1130
|
+
}, ct = T(
|
|
1131
1131
|
Ie((s, i) => {
|
|
1132
1132
|
const {
|
|
1133
1133
|
schema: e,
|
|
1134
1134
|
values: t = {},
|
|
1135
|
-
onSubmit: n =
|
|
1135
|
+
onSubmit: n = nn,
|
|
1136
1136
|
submitText: o = "Submit",
|
|
1137
1137
|
cancelText: a,
|
|
1138
1138
|
onCancel: c,
|
|
@@ -1141,50 +1141,50 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1141
1141
|
hideTitle: f = !e.title,
|
|
1142
1142
|
hideDescription: d,
|
|
1143
1143
|
className: u
|
|
1144
|
-
} = s, { readonly:
|
|
1144
|
+
} = s, { readonly: p } = e.meta, g = v(() => crypto.randomUUID(), []), h = et({
|
|
1145
1145
|
initialValues: at(e.fields, t),
|
|
1146
1146
|
onSubmit: n,
|
|
1147
|
-
validate: (
|
|
1147
|
+
validate: (k) => Ot(e, k),
|
|
1148
1148
|
// only validate the entire form on submit
|
|
1149
1149
|
validateOnBlur: !1,
|
|
1150
1150
|
validateOnChange: !1
|
|
1151
|
-
}), { dirty:
|
|
1151
|
+
}), { dirty: S } = h, I = v(
|
|
1152
1152
|
() => typeof e.title == "string" ? /* @__PURE__ */ r(Ne, { children: e.title }) : e.title,
|
|
1153
1153
|
[e.title]
|
|
1154
|
-
), C =
|
|
1155
|
-
() => typeof e.description == "string" ? /* @__PURE__ */ r(
|
|
1154
|
+
), C = v(
|
|
1155
|
+
() => typeof e.description == "string" ? /* @__PURE__ */ r($, { className: be.description, children: e.description }) : e.description,
|
|
1156
1156
|
[e.description]
|
|
1157
|
-
),
|
|
1157
|
+
), w = Mt(e.fields, { formId: g, disabled: p });
|
|
1158
1158
|
return xe(() => {
|
|
1159
|
-
|
|
1160
|
-
}, [
|
|
1161
|
-
!f && /* @__PURE__ */ r(
|
|
1159
|
+
S && l && l();
|
|
1160
|
+
}, [S, l]), /* @__PURE__ */ r(tt, { value: h, children: /* @__PURE__ */ r(y, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: g, onSubmit: h.handleSubmit, children: [
|
|
1161
|
+
!f && /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
|
|
1162
1162
|
I,
|
|
1163
1163
|
!d && C
|
|
1164
1164
|
] }) }),
|
|
1165
|
-
|
|
1166
|
-
!
|
|
1165
|
+
w,
|
|
1166
|
+
!p && /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
|
|
1167
1167
|
a && /* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: c, children: a }),
|
|
1168
|
-
/* @__PURE__ */ r(G, { type: "submit", disabled: !
|
|
1168
|
+
/* @__PURE__ */ r(G, { type: "submit", disabled: !h.isValid, children: o })
|
|
1169
1169
|
] })
|
|
1170
1170
|
] }) }) });
|
|
1171
1171
|
})
|
|
1172
|
-
),
|
|
1172
|
+
), Rn = T(
|
|
1173
1173
|
Ie((s, i) => {
|
|
1174
|
-
const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o =
|
|
1174
|
+
const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = _(It(e.form_revision)), { sdk: a } = Ct();
|
|
1175
1175
|
if (!o)
|
|
1176
1176
|
throw new Error(
|
|
1177
1177
|
`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
|
|
1178
1178
|
);
|
|
1179
|
-
const c =
|
|
1180
|
-
const f =
|
|
1179
|
+
const c = v(() => Dt(o, { readonly: !0 }), [o]), l = v(() => {
|
|
1180
|
+
const f = Fi(e.offline_id)(a.store.getState()) ?? [], d = {};
|
|
1181
1181
|
for (const u of f) {
|
|
1182
|
-
const
|
|
1183
|
-
if (!
|
|
1182
|
+
const p = a.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((h) => {
|
|
1183
|
+
if (!h.success)
|
|
1184
1184
|
throw new Error(`Failed to download attachment ${u.file_name}.`);
|
|
1185
|
-
return
|
|
1186
|
-
}),
|
|
1187
|
-
|
|
1185
|
+
return h.body;
|
|
1186
|
+
}), g = d[u.field_identifier];
|
|
1187
|
+
g ? g.push(p) : d[u.field_identifier] = [p];
|
|
1188
1188
|
}
|
|
1189
1189
|
return { ...e.values, ...d };
|
|
1190
1190
|
}, [a.files, a.store, e.offline_id, e.values]);
|
|
@@ -1199,38 +1199,38 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1199
1199
|
}
|
|
1200
1200
|
);
|
|
1201
1201
|
})
|
|
1202
|
-
),
|
|
1203
|
-
favoriteIcon:
|
|
1204
|
-
regularIcon:
|
|
1205
|
-
}, je = "organization:",
|
|
1202
|
+
), rn = "_favoriteIcon_1bixi_1", on = "_regularIcon_1bixi_9", pt = {
|
|
1203
|
+
favoriteIcon: rn,
|
|
1204
|
+
regularIcon: on
|
|
1205
|
+
}, je = "organization:", Ue = "user:", Bn = T(
|
|
1206
1206
|
Ie((s, i) => {
|
|
1207
|
-
const { maxResults: e = 20, ...t } = s, [n, o] =
|
|
1208
|
-
const
|
|
1209
|
-
return a && (a.startsWith(je) ?
|
|
1210
|
-
}, [n, e, a]), d =
|
|
1211
|
-
(
|
|
1212
|
-
|
|
1207
|
+
const { maxResults: e = 20, ...t } = s, [n, o] = X(""), [a, c] = X(""), { sdk: l } = Ct(), f = v(() => {
|
|
1208
|
+
const w = { maxResults: e, searchTerm: n };
|
|
1209
|
+
return a && (a.startsWith(je) ? w.owner_organization = parseInt(a.slice(je.length)) : a.startsWith(Ue) && (w.owner_user = parseInt(a.slice(Ue.length)))), w;
|
|
1210
|
+
}, [n, e, a]), d = _(Ti(f)) ?? [], u = _(Si), p = F(
|
|
1211
|
+
(w) => {
|
|
1212
|
+
w.favorite ? l.userForms.unfavorite(w.offline_id).then() : l.userForms.favorite(w.offline_id).then();
|
|
1213
1213
|
},
|
|
1214
1214
|
[l]
|
|
1215
|
-
),
|
|
1216
|
-
const
|
|
1215
|
+
), g = v(() => {
|
|
1216
|
+
const w = l.store.getState(), k = {};
|
|
1217
1217
|
for (const L of Object.values(u)) {
|
|
1218
|
-
const x = Ft(L.owner_organization || -1)(
|
|
1219
|
-
x && (
|
|
1220
|
-
const P = rt(L.owner_user || -1)(
|
|
1221
|
-
P && (
|
|
1218
|
+
const x = Ft(L.owner_organization || -1)(w);
|
|
1219
|
+
x && (k[`${je}${x.id}`] = x.name);
|
|
1220
|
+
const P = rt(L.owner_user || -1)(w);
|
|
1221
|
+
P && (k[`${Ue}${P.id}`] = P.username);
|
|
1222
1222
|
}
|
|
1223
|
-
return Object.entries(
|
|
1224
|
-
}, [u, l.store]),
|
|
1225
|
-
o(
|
|
1226
|
-
}, []), I = (
|
|
1223
|
+
return Object.entries(k).map(([L, x]) => ({ itemContent: x, value: L }));
|
|
1224
|
+
}, [u, l.store]), h = F((w) => {
|
|
1225
|
+
o(w.currentTarget.value);
|
|
1226
|
+
}, []), I = (_(zi) || 0) - d.length, C = d.length == e && I > 0 ? `Only the first ${e} results are shown (${I} hidden)` : I > 0 && `${I} hidden forms`;
|
|
1227
1227
|
return /* @__PURE__ */ b(y, { ref: i, direction: "column", gap: "2", children: [
|
|
1228
1228
|
/* @__PURE__ */ b(y, { gap: "2", grow: "1", children: [
|
|
1229
|
-
/* @__PURE__ */ r(
|
|
1229
|
+
/* @__PURE__ */ r(he, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(ce.Root, { size: "3", children: /* @__PURE__ */ r(ce.Input, { placeholder: "Filter", value: n, onChange: h }) }) }),
|
|
1230
1230
|
/* @__PURE__ */ r(
|
|
1231
1231
|
yt,
|
|
1232
1232
|
{
|
|
1233
|
-
items:
|
|
1233
|
+
items: g,
|
|
1234
1234
|
value: a,
|
|
1235
1235
|
onValueChange: c,
|
|
1236
1236
|
placeholder: "Owner",
|
|
@@ -1238,79 +1238,79 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1238
1238
|
}
|
|
1239
1239
|
)
|
|
1240
1240
|
] }),
|
|
1241
|
-
d.length > 0 && /* @__PURE__ */ r(Re.Root, { children: d.map((
|
|
1242
|
-
|
|
1241
|
+
d.length > 0 && /* @__PURE__ */ r(Re.Root, { children: d.map((w) => /* @__PURE__ */ r(
|
|
1242
|
+
sn,
|
|
1243
1243
|
{
|
|
1244
1244
|
...t,
|
|
1245
|
-
form:
|
|
1246
|
-
handleToggleFavorite: () =>
|
|
1245
|
+
form: w,
|
|
1246
|
+
handleToggleFavorite: () => p(w)
|
|
1247
1247
|
},
|
|
1248
|
-
|
|
1248
|
+
w.offline_id
|
|
1249
1249
|
)) }),
|
|
1250
|
-
/* @__PURE__ */ r(
|
|
1250
|
+
/* @__PURE__ */ r(he, { px: "3", children: /* @__PURE__ */ r($, { size: "2", severity: "info", children: C }) })
|
|
1251
1251
|
] });
|
|
1252
1252
|
})
|
|
1253
|
-
),
|
|
1254
|
-
var
|
|
1255
|
-
const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (
|
|
1256
|
-
(
|
|
1257
|
-
|
|
1253
|
+
), sn = (s) => {
|
|
1254
|
+
var p;
|
|
1255
|
+
const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (p = _(Ft(i.owner_organization || -1))) == null ? void 0 : p.name, a = _(rt(i.owner_user || -1)), c = _(Tt).id, l = !!a && a.id === c, f = o ?? (l ? "You" : a == null ? void 0 : a.username) ?? "Unknown", d = F(
|
|
1256
|
+
(g) => {
|
|
1257
|
+
g.stopPropagation(), n();
|
|
1258
1258
|
},
|
|
1259
1259
|
[n]
|
|
1260
|
-
), u = /* @__PURE__ */ r(Re.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...
|
|
1260
|
+
), u = /* @__PURE__ */ r(Re.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...ni, children: [
|
|
1261
1261
|
/* @__PURE__ */ b(y, { grow: "1", align: "center", gap: "2", children: [
|
|
1262
1262
|
/* @__PURE__ */ r(
|
|
1263
1263
|
ge,
|
|
1264
1264
|
{
|
|
1265
|
-
className: St(i.favorite ?
|
|
1265
|
+
className: St(i.favorite ? pt.favoriteIcon : pt.regularIcon),
|
|
1266
1266
|
variant: "ghost",
|
|
1267
1267
|
onClick: d,
|
|
1268
1268
|
"aria-label": i.favorite ? "Favorite form" : "Standard form",
|
|
1269
1269
|
disabled: !t,
|
|
1270
|
-
children: i.favorite ? /* @__PURE__ */ r(
|
|
1270
|
+
children: i.favorite ? /* @__PURE__ */ r(ri, {}) : /* @__PURE__ */ r(oi, {})
|
|
1271
1271
|
}
|
|
1272
1272
|
),
|
|
1273
|
-
/* @__PURE__ */ r(
|
|
1274
|
-
i.latestRevision.description && /* @__PURE__ */ r(
|
|
1273
|
+
/* @__PURE__ */ r($, { noWrap: !0, children: i.latestRevision.title }),
|
|
1274
|
+
i.latestRevision.description && /* @__PURE__ */ r(si, {})
|
|
1275
1275
|
] }),
|
|
1276
1276
|
f && /* @__PURE__ */ b(y, { align: "center", gap: "2", children: [
|
|
1277
|
-
/* @__PURE__ */ r(
|
|
1277
|
+
/* @__PURE__ */ r(li, {}),
|
|
1278
1278
|
" ",
|
|
1279
1279
|
f
|
|
1280
1280
|
] })
|
|
1281
1281
|
] }) });
|
|
1282
|
-
return i.latestRevision.description ? /* @__PURE__ */ r(
|
|
1283
|
-
},
|
|
1284
|
-
submissionsContainer:
|
|
1285
|
-
stopHorizontalOverflow:
|
|
1286
|
-
},
|
|
1287
|
-
var
|
|
1288
|
-
const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: a } = i, c =
|
|
1282
|
+
return i.latestRevision.description ? /* @__PURE__ */ r(ai, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
|
|
1283
|
+
}, ln = "_submissionsContainer_9iirt_1", an = "_stopHorizontalOverflow_9iirt_6", Nt = {
|
|
1284
|
+
submissionsContainer: ln,
|
|
1285
|
+
stopHorizontalOverflow: an
|
|
1286
|
+
}, cn = T(function(i) {
|
|
1287
|
+
var w;
|
|
1288
|
+
const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: a } = i, c = _(Tt), l = _(rt("created_by" in e ? e.created_by : c.id)), f = Qe(e), d = Ei(f) ? f.toLocaleTimeString([], {
|
|
1289
1289
|
hour: "2-digit",
|
|
1290
1290
|
minute: "2-digit"
|
|
1291
|
-
}) :
|
|
1291
|
+
}) : Ai(f), u = _(It(e.form_revision));
|
|
1292
1292
|
if (!u)
|
|
1293
1293
|
throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
|
|
1294
|
-
const
|
|
1294
|
+
const p = (w = _(Li(u.form))) == null ? void 0 : w.revision, g = Pi({
|
|
1295
1295
|
file: (l == null ? void 0 : l.profile.file) ?? null,
|
|
1296
1296
|
fileSha1: (l == null ? void 0 : l.profile.file_sha1) ?? null
|
|
1297
|
-
}),
|
|
1297
|
+
}), h = (l == null ? void 0 : l.username.charAt(0).toUpperCase()) ?? "?", S = u.revision === p, I = vi.useCallback(() => {
|
|
1298
1298
|
t && t({ submission: e });
|
|
1299
1299
|
}, [e, t]), C = /* @__PURE__ */ r(Re.Item, { onClick: I, asChild: !0, children: /* @__PURE__ */ b(y, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
|
|
1300
|
-
/* @__PURE__ */ b(y, { gap: "2", align: "center", className:
|
|
1301
|
-
/* @__PURE__ */ r(
|
|
1302
|
-
/* @__PURE__ */ r(
|
|
1300
|
+
/* @__PURE__ */ b(y, { gap: "2", align: "center", className: Nt.stopHorizontalOverflow, children: [
|
|
1301
|
+
/* @__PURE__ */ r(ci, { src: g, size: "1", fallback: h }),
|
|
1302
|
+
/* @__PURE__ */ r($, { size: "2", noWrap: !0, children: o === "creator" ? (l || c).username : u.title })
|
|
1303
1303
|
] }),
|
|
1304
1304
|
/* @__PURE__ */ b(y, { gap: "2", align: "center", children: [
|
|
1305
|
-
!n && (u.revision ? /* @__PURE__ */ r(
|
|
1306
|
-
/* @__PURE__ */ r(
|
|
1305
|
+
!n && (u.revision ? /* @__PURE__ */ r(He, { variant: "soft", severity: S ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!p && /* @__PURE__ */ r(He, { children: "Original" })),
|
|
1306
|
+
/* @__PURE__ */ r($, { size: "2", noWrap: !0, children: d })
|
|
1307
1307
|
] })
|
|
1308
1308
|
] }) });
|
|
1309
1309
|
return a ? a(e, C) : C;
|
|
1310
1310
|
}), Qe = (s) => {
|
|
1311
1311
|
const i = "created_at" in s ? s.created_at : s.submitted_at;
|
|
1312
1312
|
return new Date(i);
|
|
1313
|
-
},
|
|
1313
|
+
}, qn = T(function(i) {
|
|
1314
1314
|
const {
|
|
1315
1315
|
formId: e,
|
|
1316
1316
|
submissions: t,
|
|
@@ -1322,38 +1322,38 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1322
1322
|
} = i;
|
|
1323
1323
|
if (!!e == !!t)
|
|
1324
1324
|
throw new Error("Either formId or submissions must be provided, but not both.");
|
|
1325
|
-
const f =
|
|
1326
|
-
t ? () => t :
|
|
1327
|
-
), d =
|
|
1328
|
-
() => f == null ? void 0 : f.sort((u,
|
|
1325
|
+
const f = _(
|
|
1326
|
+
t ? () => t : $i(e)
|
|
1327
|
+
), d = v(
|
|
1328
|
+
() => f == null ? void 0 : f.sort((u, p) => Qe(p).getTime() - Qe(u).getTime()),
|
|
1329
1329
|
[f]
|
|
1330
1330
|
);
|
|
1331
1331
|
return /* @__PURE__ */ r(
|
|
1332
1332
|
Re.Root,
|
|
1333
1333
|
{
|
|
1334
|
-
className: St(
|
|
1334
|
+
className: St(Nt.submissionsContainer, o),
|
|
1335
1335
|
size: "small",
|
|
1336
1336
|
variant: c,
|
|
1337
|
-
before: !n && /* @__PURE__ */ b(
|
|
1337
|
+
before: !n && /* @__PURE__ */ b($, { severity: "info", children: [
|
|
1338
1338
|
"There are ",
|
|
1339
1339
|
((f == null ? void 0 : f.length) || 0).toString(),
|
|
1340
1340
|
" submissions of this form."
|
|
1341
1341
|
] }),
|
|
1342
1342
|
after: a,
|
|
1343
|
-
children: d == null ? void 0 : d.map((u,
|
|
1344
|
-
|
|
1343
|
+
children: d == null ? void 0 : d.map((u, p) => /* @__PURE__ */ r(
|
|
1344
|
+
cn,
|
|
1345
1345
|
{
|
|
1346
1346
|
submission: u,
|
|
1347
1347
|
compact: n,
|
|
1348
1348
|
...l
|
|
1349
1349
|
},
|
|
1350
|
-
|
|
1350
|
+
p
|
|
1351
1351
|
))
|
|
1352
1352
|
}
|
|
1353
1353
|
);
|
|
1354
|
-
}),
|
|
1354
|
+
}), Wn = T(function(i) {
|
|
1355
1355
|
const { name: e, render: t } = i, { submitForm: n } = me(), [o, a, c] = Je(e);
|
|
1356
|
-
return
|
|
1356
|
+
return v(() => {
|
|
1357
1357
|
const l = (f) => c.setValue(f, !1);
|
|
1358
1358
|
return t({
|
|
1359
1359
|
value: o.value,
|
|
@@ -1361,22 +1361,22 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1361
1361
|
patchValue: n
|
|
1362
1362
|
});
|
|
1363
1363
|
}, [n, c, o.value, t]);
|
|
1364
|
-
}),
|
|
1364
|
+
}), jn = T(
|
|
1365
1365
|
Ie((s, i) => {
|
|
1366
|
-
const { children: e, schema: t, values: n, onPatch: o, onError: a, ...c } = s, l =
|
|
1367
|
-
(
|
|
1368
|
-
const
|
|
1369
|
-
for (const I in
|
|
1370
|
-
const C =
|
|
1371
|
-
C !== l[I] && C !== void 0 && (
|
|
1366
|
+
const { children: e, schema: t, values: n, onPatch: o, onError: a, ...c } = s, l = v(() => at(t.fields, n), [t.fields, n]), f = F(
|
|
1367
|
+
(h) => {
|
|
1368
|
+
const S = {};
|
|
1369
|
+
for (const I in h) {
|
|
1370
|
+
const C = h[I];
|
|
1371
|
+
C !== l[I] && C !== void 0 && (S[I] = C);
|
|
1372
1372
|
}
|
|
1373
|
-
|
|
1373
|
+
Me(S) && o(S);
|
|
1374
1374
|
},
|
|
1375
1375
|
[l, o]
|
|
1376
1376
|
), d = F(
|
|
1377
|
-
async (
|
|
1378
|
-
const
|
|
1379
|
-
return
|
|
1377
|
+
async (h) => {
|
|
1378
|
+
const S = await Ot(t, h);
|
|
1379
|
+
return S && a(S), S;
|
|
1380
1380
|
},
|
|
1381
1381
|
[t, a]
|
|
1382
1382
|
), u = et({
|
|
@@ -1386,53 +1386,53 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1386
1386
|
// only validate the entire form on submit
|
|
1387
1387
|
validateOnBlur: !1,
|
|
1388
1388
|
validateOnChange: !1
|
|
1389
|
-
}), { errors:
|
|
1389
|
+
}), { errors: p, resetForm: g } = u;
|
|
1390
1390
|
return xe(() => {
|
|
1391
|
-
|
|
1392
|
-
}, [
|
|
1391
|
+
Me(p) && g({ values: l, errors: {} });
|
|
1392
|
+
}, [p, l, g]), /* @__PURE__ */ r(tt, { value: u, children: /* @__PURE__ */ r("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
|
|
1393
1393
|
})
|
|
1394
|
-
),
|
|
1394
|
+
), Rt = {
|
|
1395
1395
|
...lt,
|
|
1396
1396
|
section: Q
|
|
1397
|
-
},
|
|
1397
|
+
}, dn = T(function(i) {
|
|
1398
1398
|
const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, a = e.Icon;
|
|
1399
1399
|
return /* @__PURE__ */ b(y, { gap: "4", align: "center", children: [
|
|
1400
1400
|
/* @__PURE__ */ r(G, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(y, { gap: "3", align: "center", grow: "1", children: [
|
|
1401
1401
|
/* @__PURE__ */ r(a, {}),
|
|
1402
1402
|
n
|
|
1403
1403
|
] }) }),
|
|
1404
|
-
/* @__PURE__ */ r(
|
|
1404
|
+
/* @__PURE__ */ r($, { children: o })
|
|
1405
1405
|
] });
|
|
1406
|
-
}),
|
|
1406
|
+
}), Bt = [
|
|
1407
1407
|
["string", "text"],
|
|
1408
1408
|
["select", "multi-select", "upload"],
|
|
1409
1409
|
["boolean", "date", "number", "multi-string"]
|
|
1410
|
-
],
|
|
1410
|
+
], un = Bt.length - 1, fn = T(function(i) {
|
|
1411
1411
|
const { setFieldType: e } = i;
|
|
1412
|
-
return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children:
|
|
1412
|
+
return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children: Bt.map((t, n) => /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
|
|
1413
1413
|
/* @__PURE__ */ r(y, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
|
|
1414
|
-
|
|
1414
|
+
dn,
|
|
1415
1415
|
{
|
|
1416
1416
|
field: lt[o],
|
|
1417
1417
|
setFieldType: () => e(o)
|
|
1418
1418
|
},
|
|
1419
1419
|
o
|
|
1420
1420
|
)) }),
|
|
1421
|
-
n <
|
|
1421
|
+
n < un && /* @__PURE__ */ r(di, { size: "4" })
|
|
1422
1422
|
] }, n)) });
|
|
1423
|
-
}),
|
|
1423
|
+
}), mn = (s) => (i) => {
|
|
1424
1424
|
if (!(!i || typeof i != "string") && s.includes(i.trim()))
|
|
1425
1425
|
return "This name is already taken.";
|
|
1426
|
-
},
|
|
1426
|
+
}, pn = (s, i) => {
|
|
1427
1427
|
const e = [
|
|
1428
1428
|
new ye({
|
|
1429
1429
|
label: "Label",
|
|
1430
1430
|
required: !0,
|
|
1431
1431
|
maxLength: 200,
|
|
1432
1432
|
identifier: "label",
|
|
1433
|
-
fieldValidators: [
|
|
1433
|
+
fieldValidators: [mn(s)]
|
|
1434
1434
|
}),
|
|
1435
|
-
new
|
|
1435
|
+
new we({
|
|
1436
1436
|
label: "Description",
|
|
1437
1437
|
required: !1,
|
|
1438
1438
|
maxLength: 1e3,
|
|
@@ -1443,10 +1443,10 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1443
1443
|
...e,
|
|
1444
1444
|
new ue({ label: "Required", description: null, required: !1, identifier: "required" })
|
|
1445
1445
|
];
|
|
1446
|
-
},
|
|
1447
|
-
const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: a } = i, c =
|
|
1448
|
-
const d =
|
|
1449
|
-
let u =
|
|
1446
|
+
}, hn = T(function(i) {
|
|
1447
|
+
const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: a } = i, c = Rt[e], l = me(), f = v(() => {
|
|
1448
|
+
const d = $t(l.values.fields).filter((p) => p !== (o == null ? void 0 : o.label));
|
|
1449
|
+
let u = pn(d, e);
|
|
1450
1450
|
if (c === Q) {
|
|
1451
1451
|
if (a === void 0)
|
|
1452
1452
|
throw new Error("Conditional source fields must be provided when changing sections.");
|
|
@@ -1473,85 +1473,85 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1473
1473
|
onCancel: t
|
|
1474
1474
|
}
|
|
1475
1475
|
);
|
|
1476
|
-
}),
|
|
1477
|
-
const { parentPath: e, index: t, children: n, initial: o, editing: a, conditionalSourceFields: c } = i, [l, f] =
|
|
1476
|
+
}), pe = T(function(i) {
|
|
1477
|
+
const { parentPath: e, index: t, children: n, initial: o, editing: a, conditionalSourceFields: c } = i, [l, f] = X(), d = (o == null ? void 0 : o.type) ?? l, u = d ? Rt[d].fieldTypeName : void 0, { setFieldValue: p, values: g } = me();
|
|
1478
1478
|
if (a && !o)
|
|
1479
1479
|
throw new Error("Initial field must be provided if editing is true.");
|
|
1480
|
-
const
|
|
1480
|
+
const h = !d && !a && !o, S = h ? "Choose a field type" : `${u} settings`, I = h ? "Select a field type to add to this section." : (u == null ? void 0 : u.toLowerCase()) === "section" ? "Customize your section" : `Customize your ${u == null ? void 0 : u.toLowerCase()} field.`, C = F(() => f(void 0), []), w = F((x) => {
|
|
1481
1481
|
f(void 0), x();
|
|
1482
|
-
}, []),
|
|
1482
|
+
}, []), k = F(
|
|
1483
1483
|
(x, P) => {
|
|
1484
|
-
const { label:
|
|
1484
|
+
const { label: O } = x;
|
|
1485
1485
|
if (!d)
|
|
1486
1486
|
throw new Error("Field type must be selected before creating a field.");
|
|
1487
|
-
if (!
|
|
1487
|
+
if (!O || typeof O != "string")
|
|
1488
1488
|
throw new Error("Label must be provided before creating a field.");
|
|
1489
|
-
const
|
|
1489
|
+
const K = Be({
|
|
1490
1490
|
type: d,
|
|
1491
1491
|
...x,
|
|
1492
|
-
identifier:
|
|
1493
|
-
}).serialize(), q = de(
|
|
1492
|
+
identifier: Lt(x.identifier, O)
|
|
1493
|
+
}).serialize(), q = de(g, e);
|
|
1494
1494
|
if (q === void 0)
|
|
1495
1495
|
throw new Error("Parent path must point to an existing field.");
|
|
1496
|
-
let
|
|
1496
|
+
let H;
|
|
1497
1497
|
if (!Array.isArray(q))
|
|
1498
1498
|
throw new Error("Parent path must point to an array.");
|
|
1499
|
-
a ?
|
|
1499
|
+
a ? H = ji(q, t, K) : H = At(q, t, K), p(e, H).then(), P();
|
|
1500
1500
|
},
|
|
1501
|
-
[a, d,
|
|
1501
|
+
[a, d, g, e, p, t]
|
|
1502
1502
|
), L = F(
|
|
1503
|
-
(x) =>
|
|
1504
|
-
|
|
1503
|
+
(x) => h ? /* @__PURE__ */ r(fn, { setFieldType: f }) : /* @__PURE__ */ r(
|
|
1504
|
+
hn,
|
|
1505
1505
|
{
|
|
1506
1506
|
conditionalSourceFields: c,
|
|
1507
1507
|
handleCancel: C,
|
|
1508
|
-
handleCreateField: (P) =>
|
|
1508
|
+
handleCreateField: (P) => k(P, x),
|
|
1509
1509
|
fieldType: d,
|
|
1510
1510
|
defaultField: o
|
|
1511
1511
|
}
|
|
1512
1512
|
),
|
|
1513
|
-
[c, C,
|
|
1513
|
+
[c, C, k, o, h, d]
|
|
1514
1514
|
);
|
|
1515
|
-
return /* @__PURE__ */ r(
|
|
1516
|
-
}),
|
|
1517
|
-
const { remove: e, editProps: t, insertAfterProps: n, duplicateProps: o, type: a } = i, c =
|
|
1515
|
+
return /* @__PURE__ */ r(ui, { onCloseInterrupt: w, title: S, description: I, content: L, children: n });
|
|
1516
|
+
}), gn = ({ children: s }) => /* @__PURE__ */ r(bt, { children: s }), qt = T(function(i) {
|
|
1517
|
+
const { remove: e, editProps: t, insertAfterProps: n, duplicateProps: o, type: a } = i, c = v(
|
|
1518
1518
|
() => [
|
|
1519
1519
|
{
|
|
1520
|
-
Wrapper:
|
|
1520
|
+
Wrapper: pe,
|
|
1521
1521
|
wrapperProps: t,
|
|
1522
|
-
Icon:
|
|
1522
|
+
Icon: fi,
|
|
1523
1523
|
text: "Edit"
|
|
1524
1524
|
},
|
|
1525
1525
|
{
|
|
1526
|
-
Icon:
|
|
1526
|
+
Icon: mi,
|
|
1527
1527
|
buttonProps: {
|
|
1528
1528
|
onClick: e
|
|
1529
1529
|
},
|
|
1530
1530
|
text: "Delete"
|
|
1531
1531
|
},
|
|
1532
1532
|
{
|
|
1533
|
-
Wrapper:
|
|
1533
|
+
Wrapper: pe,
|
|
1534
1534
|
wrapperProps: o,
|
|
1535
|
-
Icon:
|
|
1535
|
+
Icon: pi,
|
|
1536
1536
|
text: "Duplicate"
|
|
1537
1537
|
},
|
|
1538
1538
|
{
|
|
1539
|
-
Wrapper:
|
|
1539
|
+
Wrapper: pe,
|
|
1540
1540
|
wrapperProps: n,
|
|
1541
|
-
Icon:
|
|
1541
|
+
Icon: Oe,
|
|
1542
1542
|
text: `Add ${a === "section" ? "section" : "field"}`
|
|
1543
1543
|
}
|
|
1544
1544
|
],
|
|
1545
1545
|
[o, t, n, e, a]
|
|
1546
1546
|
);
|
|
1547
|
-
return /* @__PURE__ */ r(
|
|
1547
|
+
return /* @__PURE__ */ r(he, { display: "block", children: /* @__PURE__ */ r(
|
|
1548
1548
|
hi,
|
|
1549
1549
|
{
|
|
1550
|
-
trigger: /* @__PURE__ */ r(ge, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(
|
|
1550
|
+
trigger: /* @__PURE__ */ r(ge, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(gi, {}) }),
|
|
1551
1551
|
closeOnSelect: !1,
|
|
1552
1552
|
items: c.map((l) => {
|
|
1553
1553
|
var d;
|
|
1554
|
-
const f = l.Wrapper ??
|
|
1554
|
+
const f = l.Wrapper ?? gn;
|
|
1555
1555
|
return {
|
|
1556
1556
|
...l.buttonProps,
|
|
1557
1557
|
onSelect: (d = l.buttonProps) == null ? void 0 : d.onClick,
|
|
@@ -1563,15 +1563,15 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1563
1563
|
}).filter((l) => l !== null)
|
|
1564
1564
|
}
|
|
1565
1565
|
) });
|
|
1566
|
-
}), qe = "form-builder",
|
|
1567
|
-
const { field: e, index: t, sectionIndex: n, takenLabels: o, remove: a } = i, c =
|
|
1568
|
-
(
|
|
1569
|
-
if (
|
|
1570
|
-
throw new Error(`Expected a label for field ${
|
|
1571
|
-
return { ...
|
|
1566
|
+
}), qe = "form-builder", bn = T(function(i) {
|
|
1567
|
+
const { field: e, index: t, sectionIndex: n, takenLabels: o, remove: a } = i, c = v(() => Be(e), [e]), l = _e(c, { formId: qe, disabled: !0 }), f = zt(), d = F(
|
|
1568
|
+
(h) => {
|
|
1569
|
+
if (h.label === null)
|
|
1570
|
+
throw new Error(`Expected a label for field ${h.identifier}`);
|
|
1571
|
+
return { ...h, label: Ke(h.label, o), identifier: "" };
|
|
1572
1572
|
},
|
|
1573
1573
|
[o]
|
|
1574
|
-
),
|
|
1574
|
+
), u = v(
|
|
1575
1575
|
() => ({
|
|
1576
1576
|
index: t,
|
|
1577
1577
|
parentPath: `fields.${n}.fields`,
|
|
@@ -1579,14 +1579,14 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1579
1579
|
editing: !0
|
|
1580
1580
|
}),
|
|
1581
1581
|
[e, t, n]
|
|
1582
|
-
),
|
|
1582
|
+
), p = v(
|
|
1583
1583
|
() => ({
|
|
1584
1584
|
parentPath: `fields.${n}.fields`,
|
|
1585
1585
|
index: t + 1,
|
|
1586
|
-
initial:
|
|
1586
|
+
initial: d(e)
|
|
1587
1587
|
}),
|
|
1588
|
-
[
|
|
1589
|
-
),
|
|
1588
|
+
[d, e, t, n]
|
|
1589
|
+
), g = v(
|
|
1590
1590
|
() => ({
|
|
1591
1591
|
parentPath: `fields.${n}.fields`,
|
|
1592
1592
|
index: t + 1,
|
|
@@ -1594,41 +1594,52 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1594
1594
|
}),
|
|
1595
1595
|
[t, n]
|
|
1596
1596
|
);
|
|
1597
|
-
return /* @__PURE__ */ r(nt, { draggableId: e.identifier, index: t, children: (
|
|
1598
|
-
|
|
1597
|
+
return /* @__PURE__ */ r(nt, { draggableId: e.identifier, index: t, children: (h) => /* @__PURE__ */ r(
|
|
1598
|
+
ve,
|
|
1599
1599
|
{
|
|
1600
|
-
ref:
|
|
1601
|
-
...
|
|
1602
|
-
...
|
|
1600
|
+
ref: h.innerRef,
|
|
1601
|
+
...h.draggableProps,
|
|
1602
|
+
...h.dragHandleProps,
|
|
1603
|
+
onDragStart: f,
|
|
1603
1604
|
id: `${e.identifier}-card`,
|
|
1604
1605
|
mb: "4",
|
|
1605
1606
|
children: /* @__PURE__ */ b(y, { gap: "4", justify: "between", align: "center", children: [
|
|
1606
1607
|
l,
|
|
1607
1608
|
/* @__PURE__ */ r(
|
|
1608
|
-
|
|
1609
|
+
qt,
|
|
1609
1610
|
{
|
|
1610
1611
|
remove: a,
|
|
1611
|
-
editProps:
|
|
1612
|
-
duplicateProps:
|
|
1613
|
-
insertAfterProps:
|
|
1612
|
+
editProps: u,
|
|
1613
|
+
duplicateProps: p,
|
|
1614
|
+
insertAfterProps: g
|
|
1614
1615
|
}
|
|
1615
1616
|
)
|
|
1616
1617
|
] })
|
|
1617
1618
|
}
|
|
1618
1619
|
) });
|
|
1619
|
-
}),
|
|
1620
|
-
const { identifier:
|
|
1620
|
+
}), yn = T(function(i) {
|
|
1621
|
+
const { identifier: e, index: t, conditionalFieldCounts: n } = i, o = 3, a = n.filter((f) => f !== null).length, c = n[t] ?? 0, l = o / a * c;
|
|
1622
|
+
return /* @__PURE__ */ r(
|
|
1623
|
+
"div",
|
|
1624
|
+
{
|
|
1625
|
+
id: `${e}-floating-point`,
|
|
1626
|
+
style: {
|
|
1627
|
+
width: `${o - l}%`,
|
|
1628
|
+
marginLeft: `${l}%`
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
);
|
|
1632
|
+
}), wn = (s) => {
|
|
1633
|
+
const { identifier: i, condition: e } = s, t = { primary: "var(--gray-a4)", hover: "var(--primary-color)" }, [n, o] = X(t.primary), [a, c] = X(0), l = F(() => {
|
|
1621
1634
|
o(t.hover), c(1);
|
|
1622
1635
|
}, [t.hover]), f = F(() => {
|
|
1623
1636
|
o(t.primary), c(0);
|
|
1624
|
-
}, [t.primary]), d =
|
|
1637
|
+
}, [t.primary]), d = v(() => ({
|
|
1625
1638
|
strokeWidth: 1,
|
|
1626
1639
|
showHead: !1,
|
|
1627
1640
|
color: n,
|
|
1628
1641
|
zIndex: a,
|
|
1629
1642
|
arrowBodyProps: {
|
|
1630
|
-
pointerEvents: "stroke !important",
|
|
1631
|
-
// !important is needed to override the "all" set by draggable
|
|
1632
1643
|
onMouseEnter: l,
|
|
1633
1644
|
onMouseLeave: f
|
|
1634
1645
|
}
|
|
@@ -1658,61 +1669,61 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1658
1669
|
}
|
|
1659
1670
|
)
|
|
1660
1671
|
] }) : null;
|
|
1661
|
-
},
|
|
1662
|
-
var
|
|
1663
|
-
const { field: e, index: t, dropState: n, conditionalFieldCounts: o } = i, a = (
|
|
1664
|
-
(A,
|
|
1665
|
-
for (const
|
|
1666
|
-
const
|
|
1667
|
-
c(`fields.${
|
|
1672
|
+
}, vn = T(function(i) {
|
|
1673
|
+
var K, q, H, E, N, Y, Ce, Fe, Te;
|
|
1674
|
+
const { field: e, index: t, dropState: n, conditionalFieldCounts: o } = i, a = (K = n[e.identifier]) == null ? void 0 : K.disabled, { setFieldValue: c, values: l } = me(), f = bi(), d = zt(), u = $t(l.fields), p = F(
|
|
1675
|
+
(A, z) => {
|
|
1676
|
+
for (const D of A) {
|
|
1677
|
+
const V = z.indexOf(D);
|
|
1678
|
+
c(`fields.${V}.condition`, null).then(), c(`fields.${V}.conditional`, !1).then();
|
|
1668
1679
|
}
|
|
1669
1680
|
},
|
|
1670
1681
|
[c]
|
|
1671
|
-
),
|
|
1682
|
+
), g = F(
|
|
1672
1683
|
(A) => {
|
|
1673
|
-
var
|
|
1674
|
-
const
|
|
1675
|
-
if (!
|
|
1684
|
+
var V;
|
|
1685
|
+
const z = e.fields[A];
|
|
1686
|
+
if (!z)
|
|
1676
1687
|
throw new Error("Could not find field to remove.");
|
|
1677
|
-
const
|
|
1678
|
-
for (const
|
|
1679
|
-
((
|
|
1688
|
+
const D = [];
|
|
1689
|
+
for (const R of l.fields)
|
|
1690
|
+
((V = R.condition) == null ? void 0 : V.identifier) === z.identifier && D.push(R);
|
|
1680
1691
|
return {
|
|
1681
|
-
removing:
|
|
1682
|
-
affectedSections:
|
|
1692
|
+
removing: z,
|
|
1693
|
+
affectedSections: D,
|
|
1683
1694
|
action: () => c(`fields.${t}.fields`, Pe(e.fields, A))
|
|
1684
1695
|
};
|
|
1685
1696
|
},
|
|
1686
1697
|
[e.fields, l.fields, c, t]
|
|
1687
|
-
),
|
|
1698
|
+
), h = F(
|
|
1688
1699
|
(A) => {
|
|
1689
|
-
const { affectedSections:
|
|
1690
|
-
|
|
1700
|
+
const { affectedSections: z, action: D, removing: V } = g(A), R = () => {
|
|
1701
|
+
D().then(), p(z, l.fields);
|
|
1691
1702
|
};
|
|
1692
|
-
if (
|
|
1693
|
-
const We =
|
|
1703
|
+
if (z.length > 0) {
|
|
1704
|
+
const We = z.map((Se) => Se.label).join(", ");
|
|
1694
1705
|
return f({
|
|
1695
1706
|
title: "Remove condition?",
|
|
1696
|
-
description: `${
|
|
1707
|
+
description: `${V.label} is being used as a condition, deleting it will remove the condition from the ${We} section(s).`,
|
|
1697
1708
|
severity: "danger",
|
|
1698
1709
|
actionText: "Remove",
|
|
1699
|
-
onAction:
|
|
1710
|
+
onAction: R
|
|
1700
1711
|
});
|
|
1701
1712
|
}
|
|
1702
|
-
|
|
1713
|
+
R();
|
|
1703
1714
|
},
|
|
1704
|
-
[
|
|
1705
|
-
),
|
|
1706
|
-
const
|
|
1707
|
-
if (
|
|
1715
|
+
[g, p, l.fields, f]
|
|
1716
|
+
), S = F(() => {
|
|
1717
|
+
const z = e.fields.map((ze, Wt) => g(Wt)).flatMap((ze) => ze.affectedSections), D = z.length ? "Remove fields and conditions?" : "Remove fields?", V = e.fields.length, R = z.map((ze) => ze.label).join(", "), We = z.length ? `Deleting this section will remove the ${V} field(s) it contains and will remove the conditions from following sections: ${R}` : `Deleting this section will remove the ${V} field(s) it contains.`, Se = Pe(l.fields, t), dt = () => c("fields", Se);
|
|
1718
|
+
if (z.length > 0)
|
|
1708
1719
|
return f({
|
|
1709
|
-
title:
|
|
1720
|
+
title: D,
|
|
1710
1721
|
description: We,
|
|
1711
1722
|
severity: "danger",
|
|
1712
1723
|
actionText: "Remove",
|
|
1713
1724
|
onAction: () => {
|
|
1714
1725
|
dt().then(() => {
|
|
1715
|
-
|
|
1726
|
+
p(z, Se);
|
|
1716
1727
|
});
|
|
1717
1728
|
}
|
|
1718
1729
|
});
|
|
@@ -1721,26 +1732,26 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1721
1732
|
e.fields,
|
|
1722
1733
|
l.fields,
|
|
1723
1734
|
t,
|
|
1724
|
-
|
|
1735
|
+
g,
|
|
1725
1736
|
c,
|
|
1726
1737
|
f,
|
|
1727
|
-
|
|
1728
|
-
]),
|
|
1738
|
+
p
|
|
1739
|
+
]), I = F(
|
|
1729
1740
|
(A) => {
|
|
1730
1741
|
if (A.label === null)
|
|
1731
1742
|
throw new Error(`Expected a label for field ${A.identifier}`);
|
|
1732
|
-
const
|
|
1733
|
-
const
|
|
1743
|
+
const z = Ke(A.label, u), D = A.fields.map((V) => {
|
|
1744
|
+
const R = Ke(V.label, u);
|
|
1734
1745
|
return {
|
|
1735
|
-
|
|
1736
|
-
label:
|
|
1737
|
-
identifier:
|
|
1746
|
+
...V,
|
|
1747
|
+
label: R,
|
|
1748
|
+
identifier: Lt(void 0, R)
|
|
1738
1749
|
};
|
|
1739
1750
|
});
|
|
1740
|
-
return { ...A, label:
|
|
1751
|
+
return { ...A, label: z, fields: D, identifier: "" };
|
|
1741
1752
|
},
|
|
1742
|
-
[
|
|
1743
|
-
),
|
|
1753
|
+
[u]
|
|
1754
|
+
), C = v(
|
|
1744
1755
|
() => ({
|
|
1745
1756
|
index: t,
|
|
1746
1757
|
parentPath: "fields",
|
|
@@ -1749,7 +1760,7 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1749
1760
|
conditionalSourceFields: Ee(l.fields, t)
|
|
1750
1761
|
}),
|
|
1751
1762
|
[e, t, l.fields]
|
|
1752
|
-
),
|
|
1763
|
+
), w = v(
|
|
1753
1764
|
() => ({
|
|
1754
1765
|
index: t + 1,
|
|
1755
1766
|
parentPath: "fields",
|
|
@@ -1757,73 +1768,62 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1757
1768
|
conditionalSourceFields: Ee(l.fields, t + 1)
|
|
1758
1769
|
}),
|
|
1759
1770
|
[t, l.fields]
|
|
1760
|
-
),
|
|
1771
|
+
), k = v(
|
|
1761
1772
|
() => ({
|
|
1762
1773
|
parentPath: `fields.${t}.fields`,
|
|
1763
1774
|
index: e.fields.length,
|
|
1764
1775
|
initial: void 0
|
|
1765
1776
|
}),
|
|
1766
1777
|
[e.fields.length, t]
|
|
1767
|
-
),
|
|
1778
|
+
), L = v(
|
|
1768
1779
|
() => ({
|
|
1769
1780
|
index: t + 1,
|
|
1770
1781
|
parentPath: "fields",
|
|
1771
|
-
initial:
|
|
1782
|
+
initial: I(e),
|
|
1772
1783
|
conditionalSourceFields: Ee(l.fields, t + 1)
|
|
1773
1784
|
}),
|
|
1774
|
-
[
|
|
1775
|
-
),
|
|
1785
|
+
[I, e, t, l.fields]
|
|
1786
|
+
), x = v(
|
|
1776
1787
|
() => {
|
|
1777
|
-
var A,
|
|
1778
|
-
return (
|
|
1788
|
+
var A, z;
|
|
1789
|
+
return (z = Pt(l.fields, (A = e.condition) == null ? void 0 : A.identifier)) == null ? void 0 : z.label;
|
|
1779
1790
|
},
|
|
1780
1791
|
[(q = e.condition) == null ? void 0 : q.identifier, l.fields]
|
|
1781
|
-
),
|
|
1782
|
-
if (
|
|
1792
|
+
), P = Array.isArray((H = e.condition) == null ? void 0 : H.value) ? "contains all of" : "equals";
|
|
1793
|
+
if (Ze((E = e.condition) == null ? void 0 : E.value))
|
|
1783
1794
|
throw new Error("File values are not supported for conditions.");
|
|
1784
|
-
const
|
|
1785
|
-
|
|
1786
|
-
return /* @__PURE__ */ r(
|
|
1787
|
-
"div",
|
|
1788
|
-
{
|
|
1789
|
-
id: `${e.identifier}-floating-point`,
|
|
1790
|
-
style: {
|
|
1791
|
-
width: `${2 - $}%`,
|
|
1792
|
-
marginLeft: `${$}%`
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
);
|
|
1796
|
-
};
|
|
1797
|
-
return /* @__PURE__ */ r(nt, { draggableId: e.identifier, index: t, children: (A) => /* @__PURE__ */ b(
|
|
1795
|
+
const O = Array.isArray((N = e.condition) == null ? void 0 : N.value) ? (Ce = (Y = e.condition) == null ? void 0 : Y.value) == null ? void 0 : Ce.map((A) => typeof A == "string" ? A : A.label).join(", ") : (Te = (Fe = e.condition) == null ? void 0 : Fe.value) == null ? void 0 : Te.toString();
|
|
1796
|
+
return /* @__PURE__ */ r(nt, { draggableId: e.identifier, index: t, children: (A) => /* @__PURE__ */ r(
|
|
1798
1797
|
y,
|
|
1799
1798
|
{
|
|
1800
1799
|
className: be.sectionContainer,
|
|
1800
|
+
ref: A.innerRef,
|
|
1801
|
+
...A.draggableProps,
|
|
1801
1802
|
direction: "row",
|
|
1802
1803
|
justify: "center",
|
|
1803
1804
|
align: "center",
|
|
1804
1805
|
mb: "4",
|
|
1805
|
-
children: [
|
|
1806
|
+
children: /* @__PURE__ */ b(ki, { children: [
|
|
1806
1807
|
/* @__PURE__ */ r(
|
|
1807
|
-
|
|
1808
|
+
ve,
|
|
1808
1809
|
{
|
|
1809
|
-
ref: A.innerRef,
|
|
1810
|
-
...A.draggableProps,
|
|
1811
1810
|
...A.dragHandleProps,
|
|
1811
|
+
onDragStart: d,
|
|
1812
1812
|
id: `${e.identifier}-card`,
|
|
1813
1813
|
style: { flexGrow: "1" },
|
|
1814
1814
|
children: /* @__PURE__ */ b(y, { gap: "3", justify: "between", align: "center", children: [
|
|
1815
1815
|
/* @__PURE__ */ b(y, { direction: "column", gap: "2", grow: "1", children: [
|
|
1816
1816
|
/* @__PURE__ */ b(y, { direction: "column", children: [
|
|
1817
1817
|
/* @__PURE__ */ r(Ne, { as: "h3", size: "3", children: e.label }),
|
|
1818
|
-
/* @__PURE__ */ r(
|
|
1818
|
+
/* @__PURE__ */ r($, { className: be.description, children: e.description })
|
|
1819
1819
|
] }),
|
|
1820
|
-
e.condition && /* @__PURE__ */ r(
|
|
1820
|
+
e.condition && /* @__PURE__ */ r($, { size: "1", children: /* @__PURE__ */ b(yi, { children: [
|
|
1821
1821
|
"Display only if ",
|
|
1822
|
-
/* @__PURE__ */ r(ut, { children:
|
|
1822
|
+
/* @__PURE__ */ r(ut, { children: x }),
|
|
1823
1823
|
" ",
|
|
1824
|
-
|
|
1824
|
+
P,
|
|
1825
1825
|
" ",
|
|
1826
|
-
/* @__PURE__ */ r(ut, { children:
|
|
1826
|
+
/* @__PURE__ */ r(ut, { children: O })
|
|
1827
1827
|
] }) }),
|
|
1828
1828
|
/* @__PURE__ */ r(
|
|
1829
1829
|
it,
|
|
@@ -1831,28 +1831,28 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1831
1831
|
droppableId: e.identifier,
|
|
1832
1832
|
type: "SECTION",
|
|
1833
1833
|
isDropDisabled: a,
|
|
1834
|
-
children: (
|
|
1834
|
+
children: (z) => /* @__PURE__ */ b(
|
|
1835
1835
|
y,
|
|
1836
1836
|
{
|
|
1837
|
-
ref:
|
|
1838
|
-
...
|
|
1837
|
+
ref: z.innerRef,
|
|
1838
|
+
...z.droppableProps,
|
|
1839
1839
|
direction: "column",
|
|
1840
1840
|
gap: "0",
|
|
1841
1841
|
children: [
|
|
1842
|
-
e.fields.map((
|
|
1843
|
-
|
|
1842
|
+
e.fields.map((D, V) => /* @__PURE__ */ r(
|
|
1843
|
+
bn,
|
|
1844
1844
|
{
|
|
1845
|
-
field:
|
|
1846
|
-
index:
|
|
1845
|
+
field: D,
|
|
1846
|
+
index: V,
|
|
1847
1847
|
sectionIndex: t,
|
|
1848
|
-
remove: () =>
|
|
1849
|
-
takenLabels:
|
|
1848
|
+
remove: () => h(V),
|
|
1849
|
+
takenLabels: u
|
|
1850
1850
|
},
|
|
1851
|
-
|
|
1851
|
+
D.identifier
|
|
1852
1852
|
)),
|
|
1853
|
-
|
|
1854
|
-
/* @__PURE__ */ r(
|
|
1855
|
-
/* @__PURE__ */ r(
|
|
1853
|
+
z.placeholder,
|
|
1854
|
+
/* @__PURE__ */ r(pe, { ...k, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
|
|
1855
|
+
/* @__PURE__ */ r(Oe, {}),
|
|
1856
1856
|
" Add a field"
|
|
1857
1857
|
] }) })
|
|
1858
1858
|
]
|
|
@@ -1862,24 +1862,31 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1862
1862
|
)
|
|
1863
1863
|
] }),
|
|
1864
1864
|
/* @__PURE__ */ r(
|
|
1865
|
-
|
|
1865
|
+
qt,
|
|
1866
1866
|
{
|
|
1867
|
-
remove:
|
|
1868
|
-
insertAfterProps:
|
|
1869
|
-
editProps:
|
|
1870
|
-
duplicateProps:
|
|
1867
|
+
remove: S,
|
|
1868
|
+
insertAfterProps: w,
|
|
1869
|
+
editProps: C,
|
|
1870
|
+
duplicateProps: L,
|
|
1871
1871
|
type: "section"
|
|
1872
1872
|
}
|
|
1873
1873
|
)
|
|
1874
1874
|
] })
|
|
1875
1875
|
}
|
|
1876
1876
|
),
|
|
1877
|
-
o.some((
|
|
1878
|
-
|
|
1879
|
-
|
|
1877
|
+
o.some((z) => z !== null) && /* @__PURE__ */ r(
|
|
1878
|
+
yn,
|
|
1879
|
+
{
|
|
1880
|
+
identifier: e.identifier,
|
|
1881
|
+
index: t,
|
|
1882
|
+
conditionalFieldCounts: o
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
e.condition && /* @__PURE__ */ r(wn, { identifier: e.identifier, condition: e.condition })
|
|
1886
|
+
] })
|
|
1880
1887
|
}
|
|
1881
1888
|
) });
|
|
1882
|
-
}),
|
|
1889
|
+
}), xn = (s, i) => {
|
|
1883
1890
|
var t;
|
|
1884
1891
|
const e = { ...s };
|
|
1885
1892
|
switch (i.type) {
|
|
@@ -1894,7 +1901,7 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1894
1901
|
case "update":
|
|
1895
1902
|
return i.state;
|
|
1896
1903
|
}
|
|
1897
|
-
},
|
|
1904
|
+
}, In = (s, i) => {
|
|
1898
1905
|
if (i)
|
|
1899
1906
|
for (let e = 0; e < s.length; e++) {
|
|
1900
1907
|
const t = s[e];
|
|
@@ -1904,7 +1911,7 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1904
1911
|
return e;
|
|
1905
1912
|
}
|
|
1906
1913
|
}
|
|
1907
|
-
},
|
|
1914
|
+
}, ht = (s) => {
|
|
1908
1915
|
var e, t, n;
|
|
1909
1916
|
const i = {};
|
|
1910
1917
|
for (let o = 0; o < s.length; o++) {
|
|
@@ -1915,7 +1922,7 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1915
1922
|
(t = a.condition) != null && t.identifier && l.add(a.condition.identifier), i[a.identifier] = {
|
|
1916
1923
|
disabled: !1,
|
|
1917
1924
|
conditionFields: l,
|
|
1918
|
-
conditionIndex:
|
|
1925
|
+
conditionIndex: In(s, (n = a.condition) == null ? void 0 : n.identifier),
|
|
1919
1926
|
index: o,
|
|
1920
1927
|
label: a.label
|
|
1921
1928
|
};
|
|
@@ -1925,55 +1932,55 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1925
1932
|
for (const [e, t] of Object.entries(s))
|
|
1926
1933
|
if (t.identifier === i)
|
|
1927
1934
|
return [t, e];
|
|
1928
|
-
},
|
|
1929
|
-
const { values: i, setFieldValue: e } = me(), [t, n] =
|
|
1935
|
+
}, Cn = T(function() {
|
|
1936
|
+
const { values: i, setFieldValue: e } = me(), [t, n] = Ii(xn, i.fields, ht), { showInfo: o } = wi();
|
|
1930
1937
|
xe(() => {
|
|
1931
|
-
n({ type: "update", state:
|
|
1938
|
+
n({ type: "update", state: ht(i.fields) });
|
|
1932
1939
|
}, [n, i.fields]);
|
|
1933
1940
|
const a = F((d) => {
|
|
1934
1941
|
d.type === "SECTION" && n({ type: "hold", fieldId: d.draggableId });
|
|
1935
1942
|
}, []), c = F(
|
|
1936
1943
|
(d) => {
|
|
1937
|
-
const { source: u, destination:
|
|
1938
|
-
if (n({ type: "release" }), !
|
|
1944
|
+
const { source: u, destination: p, type: g, reason: h, draggableId: S } = d;
|
|
1945
|
+
if (n({ type: "release" }), !p || h === "CANCEL")
|
|
1939
1946
|
return;
|
|
1940
|
-
if (
|
|
1941
|
-
const L = t[
|
|
1947
|
+
if (g === "ROOT") {
|
|
1948
|
+
const L = t[S];
|
|
1942
1949
|
if (!L)
|
|
1943
1950
|
throw new Error("Could not find section context.");
|
|
1944
1951
|
let x = typeof L.conditionIndex < "u" ? (
|
|
1945
1952
|
// cannot move a section with a condition before the condition's field
|
|
1946
|
-
Math.max(L.conditionIndex + 1,
|
|
1947
|
-
) :
|
|
1953
|
+
Math.max(L.conditionIndex + 1, p.index)
|
|
1954
|
+
) : p.index;
|
|
1948
1955
|
for (const P of Object.values(t))
|
|
1949
1956
|
P.conditionIndex === u.index && (x = Math.min(x, P.index - 1));
|
|
1950
|
-
return x !=
|
|
1957
|
+
return x != p.index && o({
|
|
1951
1958
|
title: "Reordered sections",
|
|
1952
1959
|
description: "Sections with conditions must be below the fields they reference."
|
|
1953
|
-
}), e("fields",
|
|
1960
|
+
}), e("fields", Xe(i.fields, u.index, x));
|
|
1954
1961
|
}
|
|
1955
|
-
if (
|
|
1962
|
+
if (g !== "SECTION")
|
|
1956
1963
|
throw new Error("Unexpected droppable type.");
|
|
1957
|
-
const [I, C] = gt(i.fields, u.droppableId) ?? [], [
|
|
1958
|
-
if (!(I != null && I.fields) || !
|
|
1964
|
+
const [I, C] = gt(i.fields, u.droppableId) ?? [], [w, k] = gt(i.fields, p.droppableId) ?? [];
|
|
1965
|
+
if (!(I != null && I.fields) || !w)
|
|
1959
1966
|
throw new Error("Could not find section with fields.");
|
|
1960
|
-
if (I.identifier ===
|
|
1967
|
+
if (I.identifier === w.identifier)
|
|
1961
1968
|
e(
|
|
1962
1969
|
`fields.${C}.fields`,
|
|
1963
|
-
|
|
1970
|
+
Xe(I.fields, u.index, p.index)
|
|
1964
1971
|
).then();
|
|
1965
1972
|
else {
|
|
1966
1973
|
const L = I.fields[u.index];
|
|
1967
1974
|
if (!L)
|
|
1968
1975
|
throw new Error("Could not find field to reorder.");
|
|
1969
1976
|
e(`fields.${C}.fields`, Pe(I.fields, u.index)).then(), e(
|
|
1970
|
-
`fields.${
|
|
1971
|
-
|
|
1977
|
+
`fields.${k}.fields`,
|
|
1978
|
+
At(w.fields, p.index, L)
|
|
1972
1979
|
).then();
|
|
1973
1980
|
}
|
|
1974
1981
|
},
|
|
1975
1982
|
[i.fields, e, t, o]
|
|
1976
|
-
), l =
|
|
1983
|
+
), l = v(
|
|
1977
1984
|
() => ({
|
|
1978
1985
|
index: i.fields.length,
|
|
1979
1986
|
parentPath: "fields",
|
|
@@ -1993,56 +2000,56 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
1993
2000
|
direction: "column",
|
|
1994
2001
|
gap: "0",
|
|
1995
2002
|
children: [
|
|
1996
|
-
i.fields.map((u,
|
|
1997
|
-
|
|
2003
|
+
i.fields.map((u, p) => /* @__PURE__ */ r(
|
|
2004
|
+
vn,
|
|
1998
2005
|
{
|
|
1999
2006
|
field: u,
|
|
2000
|
-
index:
|
|
2007
|
+
index: p,
|
|
2001
2008
|
dropState: t,
|
|
2002
2009
|
conditionalFieldCounts: f()
|
|
2003
2010
|
},
|
|
2004
2011
|
u.label
|
|
2005
2012
|
)),
|
|
2006
2013
|
d.placeholder,
|
|
2007
|
-
/* @__PURE__ */ r(
|
|
2008
|
-
/* @__PURE__ */ r(
|
|
2014
|
+
/* @__PURE__ */ r(pe, { ...l, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
|
|
2015
|
+
/* @__PURE__ */ r(Oe, {}),
|
|
2009
2016
|
" Add a section"
|
|
2010
2017
|
] }) })
|
|
2011
2018
|
]
|
|
2012
2019
|
}
|
|
2013
2020
|
) }) });
|
|
2014
|
-
}),
|
|
2021
|
+
}), Fn = {
|
|
2015
2022
|
title: "",
|
|
2016
2023
|
description: "",
|
|
2017
2024
|
fields: []
|
|
2018
|
-
},
|
|
2025
|
+
}, Tn = new ye({
|
|
2019
2026
|
label: "Title",
|
|
2020
2027
|
minLength: 0,
|
|
2021
2028
|
maxLength: 100,
|
|
2022
2029
|
required: !0,
|
|
2023
2030
|
identifier: "title"
|
|
2024
|
-
}),
|
|
2031
|
+
}), Sn = { formId: qe, placeholder: "Give your form a title." }, zn = new we({
|
|
2025
2032
|
label: "Description",
|
|
2026
2033
|
minLength: 0,
|
|
2027
2034
|
maxLength: 1e3,
|
|
2028
2035
|
required: !1,
|
|
2029
2036
|
identifier: "description"
|
|
2030
|
-
}),
|
|
2037
|
+
}), En = { formId: qe, placeholder: "Explain the purpose of this form." }, An = () => {
|
|
2031
2038
|
alert("This is a form preview, your data will not be saved.");
|
|
2032
|
-
},
|
|
2039
|
+
}, Un = T(
|
|
2033
2040
|
Ie((s, i) => {
|
|
2034
|
-
const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: a = o } = s, c = F((
|
|
2035
|
-
const
|
|
2036
|
-
if (
|
|
2037
|
-
return
|
|
2041
|
+
const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: a = o } = s, c = F((g) => {
|
|
2042
|
+
const h = {};
|
|
2043
|
+
if (g.title || (h.title = "Title is required."), (!g.fields || g.fields.length === 0) && (h.fields = "At least one field is required."), Me(h))
|
|
2044
|
+
return h;
|
|
2038
2045
|
}, []), l = et({
|
|
2039
|
-
initialValues:
|
|
2046
|
+
initialValues: Wi(n) ?? Fn,
|
|
2040
2047
|
validate: c,
|
|
2041
|
-
onSubmit: (
|
|
2048
|
+
onSubmit: (g) => t(g),
|
|
2042
2049
|
// only validate the entire for on submit
|
|
2043
2050
|
validateOnChange: !1,
|
|
2044
2051
|
validateOnBlur: !1
|
|
2045
|
-
}), f =
|
|
2052
|
+
}), f = v(() => Dt(l.values), [l.values]), d = _e(Tn, Sn), u = _e(zn, En), p = v(
|
|
2046
2053
|
() => typeof a == "object" ? a : /* @__PURE__ */ r(Ne, { children: a }),
|
|
2047
2054
|
[a]
|
|
2048
2055
|
);
|
|
@@ -2052,8 +2059,8 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
2052
2059
|
/* @__PURE__ */ r(J.Trigger, { value: "preview", children: "Preview" })
|
|
2053
2060
|
] }),
|
|
2054
2061
|
/* @__PURE__ */ b(J.Content, { value: "edit", children: [
|
|
2055
|
-
|
|
2056
|
-
/* @__PURE__ */ b(
|
|
2062
|
+
p,
|
|
2063
|
+
/* @__PURE__ */ b($, { children: [
|
|
2057
2064
|
"Add a new form field by clicking a + button. Specify options for each field, then drag and drop to rearrange them. You can see what a submitted form might look like in the",
|
|
2058
2065
|
" ",
|
|
2059
2066
|
/* @__PURE__ */ r("em", { children: "Preview" }),
|
|
@@ -2065,8 +2072,8 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
2065
2072
|
/* @__PURE__ */ b(tt, { value: l, children: [
|
|
2066
2073
|
d,
|
|
2067
2074
|
u,
|
|
2068
|
-
/* @__PURE__ */ r(
|
|
2069
|
-
/* @__PURE__ */ r(
|
|
2075
|
+
/* @__PURE__ */ r(Cn, {}),
|
|
2076
|
+
/* @__PURE__ */ r($, { severity: "danger", size: "1", children: typeof l.errors.fields == "string" && l.errors.fields })
|
|
2070
2077
|
] }),
|
|
2071
2078
|
/* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
|
|
2072
2079
|
/* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
|
|
@@ -2074,40 +2081,40 @@ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
|
|
|
2074
2081
|
] })
|
|
2075
2082
|
] }) })
|
|
2076
2083
|
] }),
|
|
2077
|
-
/* @__PURE__ */ r(J.Content, { value: "preview", children: /* @__PURE__ */ r(ct, { schema: f, onSubmit:
|
|
2084
|
+
/* @__PURE__ */ r(J.Content, { value: "preview", children: /* @__PURE__ */ r(ct, { schema: f, onSubmit: An }) })
|
|
2078
2085
|
] }) });
|
|
2079
2086
|
})
|
|
2080
2087
|
);
|
|
2081
2088
|
export {
|
|
2082
2089
|
ue as BooleanField,
|
|
2083
|
-
|
|
2090
|
+
Mi as BooleanInput,
|
|
2084
2091
|
Ge as DateField,
|
|
2085
|
-
|
|
2092
|
+
Ni as DateInput,
|
|
2086
2093
|
Q as FieldSection,
|
|
2087
|
-
|
|
2088
|
-
|
|
2094
|
+
Bn as FormBrowser,
|
|
2095
|
+
Un as FormBuilder,
|
|
2089
2096
|
ct as FormRenderer,
|
|
2090
|
-
|
|
2091
|
-
|
|
2097
|
+
qn as FormSubmissionBrowser,
|
|
2098
|
+
Rn as FormSubmissionViewer,
|
|
2092
2099
|
Ve as MultiSelectField,
|
|
2093
|
-
|
|
2100
|
+
Gi as MultiSelectInput,
|
|
2094
2101
|
$e as MultiStringField,
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2102
|
+
Ui as MultiStringInput,
|
|
2103
|
+
Z as NumberField,
|
|
2104
|
+
Oi as NumberInput,
|
|
2105
|
+
Wn as PatchField,
|
|
2106
|
+
jn as PatchFormProvider,
|
|
2100
2107
|
ke as SelectField,
|
|
2101
|
-
|
|
2108
|
+
qi as SelectInput,
|
|
2102
2109
|
ye as StringField,
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2110
|
+
Ri as StringInput,
|
|
2111
|
+
we as TextField,
|
|
2112
|
+
Bi as TextInput,
|
|
2106
2113
|
Be as deserialize,
|
|
2107
|
-
|
|
2108
|
-
|
|
2114
|
+
Vt as deserializeField,
|
|
2115
|
+
Dt as formRevisionToSchema,
|
|
2109
2116
|
_t as isConditionMet,
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2117
|
+
_e as useFieldInput,
|
|
2118
|
+
Mt as useFieldInputs,
|
|
2119
|
+
Ze as valueIsFile
|
|
2113
2120
|
};
|