@overmap-ai/forms 1.0.3-form-improvements.4 → 1.0.3-form-improvements.5
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/builder/utils.d.ts +1 -1
- package/dist/forms.js +185 -182
- package/dist/forms.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/forms.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (s, i, e) => (
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var Bt = (s, i, e) => i in s ? Nt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
|
|
3
|
+
var m = (s, i, e) => (Bt(s, typeof i != "symbol" ? i + "" : i, e), e);
|
|
4
4
|
import { jsx as r, jsxs as b, Fragment as pt } from "react/jsx-runtime";
|
|
5
|
-
import { Flex as y, Text as D, useSeverityColor as fe, Checkbox as
|
|
5
|
+
import { Flex as y, Text as D, useSeverityColor as fe, Checkbox as qt, CheckCircledIcon as Wt, TextField as le, FontFamilyIcon as jt, CalendarIcon as Ht, InputIcon as Ut, TextArea as Gt, RowsIcon as Kt, Select as ht, Box as he, IconButton as ae, PlusIcon as ke, Badge as qe, Cross1Icon as gt, ListBulletIcon as Yt, DropdownMenuIcon as Qt, MultiSelect as Xt, CheckboxIcon as Jt, Card as ye, Heading as De, Button as G, UploadIcon as bt, ButtonList as _e, divButtonProps as Zt, StarFilledIcon as ei, StarIcon as ti, QuestionMarkCircledIcon as ii, PersonIcon as ni, Tooltip as ri, Avatar as oi, Separator as si, Dialog as li, Pencil1Icon as ai, TrashIcon as ci, CopyIcon as di, DragHandleDots2Icon as ui, DropdownMenu as fi, DotsVerticalIcon as mi, useAlertDialog as pi, Em as hi, Strong as lt, useToast as gi, Tabs as X } from "@overmap-ai/blocks";
|
|
6
6
|
import { useField as Ye, useFormikContext as me, useFormik as Qe, FormikProvider as Xe } from "formik";
|
|
7
|
-
import
|
|
7
|
+
import bi, { useMemo as w, memo as T, useCallback as S, useState as ce, useEffect as ve, useRef as yi, forwardRef as we, useReducer as vi } from "react";
|
|
8
8
|
import { DragDropContext as yt, Droppable as Je, Draggable as Ze } from "@hello-pangea/dnd";
|
|
9
|
-
import { slugify as
|
|
9
|
+
import { slugify as wi, useAppSelector as $, selectFormRevision as vt, useSDK as wt, selectSubmissionAttachments as xi, selectFilteredUserForms as Ii, selectUserFormMapping as Fi, selectOrganization as xt, selectUser as et, selectNumberOfUserForms as Ci, selectCurrentUser as It, classNames as Ft, isToday as Ti, getLocalDateString as Si, selectLatestFormRevision as zi, useFileSrc as Ei, selectSubmissionsForForm as Ai } from "@overmap-ai/core";
|
|
10
10
|
import de from "lodash.get";
|
|
11
11
|
import tt from "lodash.set";
|
|
12
12
|
class Ct {
|
|
@@ -90,21 +90,21 @@ class M extends Ct {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
m(M, "fieldTypeName"), m(M, "fieldTypeDescription");
|
|
93
|
-
const
|
|
94
|
-
description:
|
|
95
|
-
},
|
|
93
|
+
const Pi = "_description_17zed_1", $e = {
|
|
94
|
+
description: Pi
|
|
95
|
+
}, W = (s) => {
|
|
96
96
|
const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: l } = s;
|
|
97
97
|
return /* @__PURE__ */ r(y, { direction: "column", gap: "1", asChild: !0, ...l, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
|
|
98
98
|
/* @__PURE__ */ r(D, { severity: t, id: o, children: i }),
|
|
99
99
|
e
|
|
100
100
|
] }) });
|
|
101
|
-
},
|
|
101
|
+
}, j = (s) => {
|
|
102
102
|
const { helpText: i, children: e, severity: t } = s;
|
|
103
103
|
return /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
|
|
104
104
|
e,
|
|
105
105
|
/* @__PURE__ */ r(y, { direction: "column", children: /* @__PURE__ */ r(D, { size: "1", severity: t, className: $e.description, children: i }) })
|
|
106
106
|
] });
|
|
107
|
-
},
|
|
107
|
+
}, H = (s) => {
|
|
108
108
|
const { id: i, field: e, formId: t, ...n } = s, [o, l, c] = Ye(e.getId()), { touched: a } = l, f = l.error ?? e.description, d = l.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, p = `${u}-label`, h = e.required ? `${e.label} *` : e.label, g = w(() => ({
|
|
109
109
|
...o,
|
|
110
110
|
onChange: (F) => {
|
|
@@ -128,10 +128,10 @@ const Ai = "_description_17zed_1", $e = {
|
|
|
128
128
|
},
|
|
129
129
|
{ ...n, "aria-labelledby": p }
|
|
130
130
|
];
|
|
131
|
-
},
|
|
132
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] =
|
|
133
|
-
return /* @__PURE__ */ r(
|
|
134
|
-
|
|
131
|
+
}, Li = [!0, "true"], Vi = T(function(i) {
|
|
132
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = Li.includes(c.value);
|
|
133
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(
|
|
134
|
+
W,
|
|
135
135
|
{
|
|
136
136
|
severity: n,
|
|
137
137
|
inputId: e,
|
|
@@ -139,7 +139,7 @@ const Ai = "_description_17zed_1", $e = {
|
|
|
139
139
|
label: l,
|
|
140
140
|
flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
|
|
141
141
|
children: /* @__PURE__ */ r(
|
|
142
|
-
|
|
142
|
+
qt,
|
|
143
143
|
{
|
|
144
144
|
...a,
|
|
145
145
|
...c,
|
|
@@ -175,14 +175,14 @@ const Ai = "_description_17zed_1", $e = {
|
|
|
175
175
|
return new J(e);
|
|
176
176
|
}
|
|
177
177
|
getInput(e) {
|
|
178
|
-
return /* @__PURE__ */ r(
|
|
178
|
+
return /* @__PURE__ */ r(Vi, { ...e, field: this });
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
|
-
m(J, "fieldTypeName", "Checkbox"), m(J, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(J, "Icon",
|
|
181
|
+
m(J, "fieldTypeName", "Checkbox"), m(J, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(J, "Icon", Wt);
|
|
182
182
|
let ue = J;
|
|
183
|
-
const
|
|
184
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] =
|
|
185
|
-
return /* @__PURE__ */ r(
|
|
183
|
+
const ki = T(function(i) {
|
|
184
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), d = fe(n);
|
|
185
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
|
|
186
186
|
le.Input,
|
|
187
187
|
{
|
|
188
188
|
...f,
|
|
@@ -195,7 +195,7 @@ const Vi = T(function(i) {
|
|
|
195
195
|
color: d
|
|
196
196
|
}
|
|
197
197
|
) }) });
|
|
198
|
-
}),
|
|
198
|
+
}), B = class B extends M {
|
|
199
199
|
constructor(e) {
|
|
200
200
|
const {
|
|
201
201
|
minimum: t = Number.MIN_SAFE_INTEGER,
|
|
@@ -215,7 +215,7 @@ const Vi = T(function(i) {
|
|
|
215
215
|
}
|
|
216
216
|
static getFieldCreationSchema() {
|
|
217
217
|
return [
|
|
218
|
-
new
|
|
218
|
+
new B({
|
|
219
219
|
label: "Minimum",
|
|
220
220
|
description: "Minimum value",
|
|
221
221
|
integers: !0,
|
|
@@ -223,7 +223,7 @@ const Vi = T(function(i) {
|
|
|
223
223
|
identifier: "minimum",
|
|
224
224
|
formValidators: [this._validateMin]
|
|
225
225
|
}),
|
|
226
|
-
new
|
|
226
|
+
new B({
|
|
227
227
|
label: "Maximum",
|
|
228
228
|
description: "Maximum value",
|
|
229
229
|
integers: !0,
|
|
@@ -263,17 +263,17 @@ const Vi = T(function(i) {
|
|
|
263
263
|
static deserialize(e) {
|
|
264
264
|
if (e.type !== "number")
|
|
265
265
|
throw new Error("Type mismatch.");
|
|
266
|
-
return new
|
|
266
|
+
return new B(e);
|
|
267
267
|
}
|
|
268
268
|
getInput(e) {
|
|
269
|
-
return /* @__PURE__ */ r(
|
|
269
|
+
return /* @__PURE__ */ r(ki, { field: this, ...e });
|
|
270
270
|
}
|
|
271
271
|
};
|
|
272
|
-
m(
|
|
273
|
-
let
|
|
274
|
-
const
|
|
275
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] =
|
|
276
|
-
return /* @__PURE__ */ r(
|
|
272
|
+
m(B, "fieldTypeName", "Number"), m(B, "fieldTypeDescription", "Allows specifying a number within a given range."), m(B, "Icon", jt), 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);
|
|
273
|
+
let Q = B;
|
|
274
|
+
const Di = T(function(i) {
|
|
275
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = c.value ? c.value.split("T")[0] : "";
|
|
276
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(le.Input, { ...a, ...c, type: "date", id: e, color: f, value: d }) }) });
|
|
277
277
|
}), Z = class Z extends M {
|
|
278
278
|
constructor(e) {
|
|
279
279
|
super({ ...e, type: "date" });
|
|
@@ -291,10 +291,10 @@ const ki = T(function(i) {
|
|
|
291
291
|
return new Z(e);
|
|
292
292
|
}
|
|
293
293
|
getInput(e) {
|
|
294
|
-
return /* @__PURE__ */ r(
|
|
294
|
+
return /* @__PURE__ */ r(Di, { field: this, ...e });
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
|
-
m(Z, "fieldTypeName", "Date"), m(Z, "fieldTypeDescription", "Allows specifying a date."), m(Z, "Icon",
|
|
297
|
+
m(Z, "fieldTypeName", "Date"), m(Z, "fieldTypeDescription", "Allows specifying a date."), m(Z, "Icon", Ht);
|
|
298
298
|
let We = Z;
|
|
299
299
|
class Ce extends M {
|
|
300
300
|
constructor(e) {
|
|
@@ -307,7 +307,7 @@ class Ce extends M {
|
|
|
307
307
|
static getFieldCreationSchema() {
|
|
308
308
|
return [
|
|
309
309
|
// min, max
|
|
310
|
-
new
|
|
310
|
+
new Q({
|
|
311
311
|
label: "Minimum length",
|
|
312
312
|
description: "Minimum number of characters",
|
|
313
313
|
required: !1,
|
|
@@ -317,7 +317,7 @@ class Ce extends M {
|
|
|
317
317
|
formValidators: [this._validateMin],
|
|
318
318
|
integers: !0
|
|
319
319
|
}),
|
|
320
|
-
new
|
|
320
|
+
new Q({
|
|
321
321
|
label: "Maximum length",
|
|
322
322
|
description: "Maximum number of characters",
|
|
323
323
|
required: !1,
|
|
@@ -365,9 +365,9 @@ m(Ce, "_validateMax", (e, t) => {
|
|
|
365
365
|
const { minimum_length: n } = t;
|
|
366
366
|
return typeof n != "number" ? null : n > e ? "Maximum cannot be less than minimum." : null;
|
|
367
367
|
});
|
|
368
|
-
const
|
|
369
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] =
|
|
370
|
-
return /* @__PURE__ */ r(
|
|
368
|
+
const _i = T(function(i) {
|
|
369
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), d = fe(n);
|
|
370
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(le.Input, { ...f, ...c, type: a.inputType, id: e, color: d }) }) });
|
|
371
371
|
}), ee = class ee extends Ce {
|
|
372
372
|
constructor(e) {
|
|
373
373
|
const { inputType: t = "text", ...n } = e, o = e.maxLength ? Math.min(500, e.maxLength) : 500, l = e.minLength ? Math.min(e.minLength, o) : void 0;
|
|
@@ -385,14 +385,14 @@ const Di = T(function(i) {
|
|
|
385
385
|
return new ee({ ...l, maxLength: t, minLength: n, inputType: o });
|
|
386
386
|
}
|
|
387
387
|
getInput(e) {
|
|
388
|
-
return /* @__PURE__ */ r(
|
|
388
|
+
return /* @__PURE__ */ r(_i, { field: this, ...e });
|
|
389
389
|
}
|
|
390
390
|
};
|
|
391
|
-
m(ee, "fieldTypeName", "Short Text"), m(ee, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(ee, "Icon",
|
|
391
|
+
m(ee, "fieldTypeName", "Short Text"), m(ee, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(ee, "Icon", Ut);
|
|
392
392
|
let ge = ee;
|
|
393
|
-
const
|
|
394
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] =
|
|
395
|
-
return /* @__PURE__ */ r(
|
|
393
|
+
const $i = T(function(i) {
|
|
394
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i);
|
|
395
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(Gt, { ...a, ...c, resize: "vertical", id: e, severity: n }) }) });
|
|
396
396
|
}), te = class te extends Ce {
|
|
397
397
|
constructor(i) {
|
|
398
398
|
const e = i.maxLength ? Math.min(5e3, i.maxLength) : 5e3, t = i.minLength ? Math.min(i.minLength, e) : void 0;
|
|
@@ -408,13 +408,13 @@ const _i = T(function(i) {
|
|
|
408
408
|
return new te({ ...n, maxLength: e, minLength: t });
|
|
409
409
|
}
|
|
410
410
|
getInput(i) {
|
|
411
|
-
return /* @__PURE__ */ r(
|
|
411
|
+
return /* @__PURE__ */ r($i, { field: this, ...i });
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
|
-
m(te, "fieldTypeName", "Paragraph"), m(te, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(te, "Icon",
|
|
414
|
+
m(te, "fieldTypeName", "Paragraph"), m(te, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(te, "Icon", Kt);
|
|
415
415
|
let be = te;
|
|
416
|
-
const
|
|
417
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] =
|
|
416
|
+
const Mi = T(function(i) {
|
|
417
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d, onBlur: u } = c, p = w(
|
|
418
418
|
() => a.options.map((g) => ({ value: g.value, itemContent: g.label })),
|
|
419
419
|
[a.options]
|
|
420
420
|
), h = S(
|
|
@@ -423,7 +423,7 @@ const $i = T(function(i) {
|
|
|
423
423
|
},
|
|
424
424
|
[d, u]
|
|
425
425
|
);
|
|
426
|
-
return /* @__PURE__ */ r(
|
|
426
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
|
|
427
427
|
ht,
|
|
428
428
|
{
|
|
429
429
|
items: p,
|
|
@@ -442,7 +442,7 @@ const $i = T(function(i) {
|
|
|
442
442
|
label: null,
|
|
443
443
|
condition: null,
|
|
444
444
|
conditional: !1
|
|
445
|
-
}),
|
|
445
|
+
}), Oi = (s) => {
|
|
446
446
|
if (!s)
|
|
447
447
|
return;
|
|
448
448
|
const i = s.fields;
|
|
@@ -458,7 +458,7 @@ function je(s, i, e) {
|
|
|
458
458
|
throw new Error("Could not find field to reorder.");
|
|
459
459
|
return t.splice(e, 0, n), t;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function Ri(s, i, e) {
|
|
462
462
|
const t = Array.from(s);
|
|
463
463
|
return t[i] = e, t;
|
|
464
464
|
}
|
|
@@ -470,23 +470,23 @@ function Se(s, i) {
|
|
|
470
470
|
const e = Array.from(s);
|
|
471
471
|
return e.splice(i, 1), e;
|
|
472
472
|
}
|
|
473
|
-
const
|
|
473
|
+
const St = (s, i) => {
|
|
474
474
|
if (typeof s == "string" && s.length > 0)
|
|
475
475
|
return s;
|
|
476
476
|
const e = /* @__PURE__ */ new Date();
|
|
477
|
-
return `${
|
|
478
|
-
},
|
|
477
|
+
return `${wi(i)}-${e.getTime()}`;
|
|
478
|
+
}, zt = (s, i) => {
|
|
479
479
|
if (!i)
|
|
480
480
|
return null;
|
|
481
481
|
for (const e of s)
|
|
482
482
|
if (e.type === "section") {
|
|
483
|
-
const t =
|
|
483
|
+
const t = zt(e.fields, i);
|
|
484
484
|
if (t)
|
|
485
485
|
return t;
|
|
486
486
|
} else if (e.identifier === i)
|
|
487
487
|
return e;
|
|
488
488
|
return null;
|
|
489
|
-
}, Fe = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields),
|
|
489
|
+
}, Fe = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Et = (s) => s.flatMap(
|
|
490
490
|
(i) => i.type === "section" ? [...i.fields.map((e) => e.label), i.label] : i.label
|
|
491
491
|
).filter((i) => i !== null), He = (s, i) => {
|
|
492
492
|
let e = 1, t = `${s} (${e})`;
|
|
@@ -494,7 +494,7 @@ const Ri = (s, i) => {
|
|
|
494
494
|
t = `${s} (${++e})`;
|
|
495
495
|
return t;
|
|
496
496
|
}, Ni = T(function(i) {
|
|
497
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] =
|
|
497
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = w(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: p } = c, h = `${e}-droppable`, { disabled: g } = a, [x, z] = ce(""), [F, v] = ce(""), P = F || o, L = F ? "red" : f, I = S(
|
|
498
498
|
(A) => {
|
|
499
499
|
u(A), p(A);
|
|
500
500
|
},
|
|
@@ -511,17 +511,17 @@ const Ri = (s, i) => {
|
|
|
511
511
|
return v("Option cannot be empty");
|
|
512
512
|
const A = x.trim();
|
|
513
513
|
I([...d, { value: A, label: A }]), z("");
|
|
514
|
-
}, [x, F, I, d]),
|
|
514
|
+
}, [x, F, I, d]), Y = S(
|
|
515
515
|
(A) => {
|
|
516
516
|
A.key === "Enter" && (A.preventDefault(), O());
|
|
517
517
|
},
|
|
518
518
|
[O]
|
|
519
|
-
),
|
|
519
|
+
), q = S(
|
|
520
520
|
(A) => {
|
|
521
521
|
I(Se(d, A));
|
|
522
522
|
},
|
|
523
523
|
[d, I]
|
|
524
|
-
),
|
|
524
|
+
), U = S(
|
|
525
525
|
(A) => {
|
|
526
526
|
if (!A.destination)
|
|
527
527
|
return;
|
|
@@ -530,8 +530,8 @@ const Ri = (s, i) => {
|
|
|
530
530
|
},
|
|
531
531
|
[I, d]
|
|
532
532
|
);
|
|
533
|
-
return /* @__PURE__ */ r(yt, { onDragEnd:
|
|
534
|
-
/* @__PURE__ */ r(
|
|
533
|
+
return /* @__PURE__ */ r(yt, { onDragEnd: U, children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
|
|
534
|
+
/* @__PURE__ */ r(j, { helpText: P, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: (!g || d.length === 0) && /* @__PURE__ */ b(y, { gap: "2", children: [
|
|
535
535
|
/* @__PURE__ */ r(he, { grow: "1", children: /* @__PURE__ */ r(
|
|
536
536
|
le.Input,
|
|
537
537
|
{
|
|
@@ -540,7 +540,7 @@ const Ri = (s, i) => {
|
|
|
540
540
|
...c,
|
|
541
541
|
value: x,
|
|
542
542
|
onChange: V,
|
|
543
|
-
onKeyDown:
|
|
543
|
+
onKeyDown: Y,
|
|
544
544
|
id: e,
|
|
545
545
|
color: L,
|
|
546
546
|
onBlur: void 0
|
|
@@ -586,7 +586,7 @@ const Ri = (s, i) => {
|
|
|
586
586
|
"aria-label": "Delete option",
|
|
587
587
|
severity: "info",
|
|
588
588
|
disabled: g,
|
|
589
|
-
onClick: () =>
|
|
589
|
+
onClick: () => q(C),
|
|
590
590
|
children: /* @__PURE__ */ r(gt, {})
|
|
591
591
|
}
|
|
592
592
|
)
|
|
@@ -638,9 +638,9 @@ const Ri = (s, i) => {
|
|
|
638
638
|
return new ie(e);
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
|
-
m(ie, "fieldTypeName", "Multi-string"), m(ie, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(ie, "Icon",
|
|
641
|
+
m(ie, "fieldTypeName", "Multi-string"), m(ie, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(ie, "Icon", Yt);
|
|
642
642
|
let ze = ie;
|
|
643
|
-
class
|
|
643
|
+
class At extends M {
|
|
644
644
|
constructor(e) {
|
|
645
645
|
super(e);
|
|
646
646
|
m(this, "options");
|
|
@@ -670,7 +670,7 @@ class Et extends M {
|
|
|
670
670
|
];
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
const ne = class ne extends
|
|
673
|
+
const ne = class ne extends At {
|
|
674
674
|
constructor(i) {
|
|
675
675
|
super({ ...i, type: "select" });
|
|
676
676
|
}
|
|
@@ -686,20 +686,20 @@ const ne = class ne extends Et {
|
|
|
686
686
|
return new ne(i);
|
|
687
687
|
}
|
|
688
688
|
getInput(i) {
|
|
689
|
-
return /* @__PURE__ */ r(
|
|
689
|
+
return /* @__PURE__ */ r(Mi, { field: this, ...i });
|
|
690
690
|
}
|
|
691
691
|
};
|
|
692
|
-
m(ne, "fieldTypeName", "Dropdown"), m(ne, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(ne, "Icon",
|
|
692
|
+
m(ne, "fieldTypeName", "Dropdown"), m(ne, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(ne, "Icon", Qt);
|
|
693
693
|
let Ee = ne;
|
|
694
694
|
const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = T(function(i) {
|
|
695
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] =
|
|
695
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d, onBlur: u } = c, p = w(() => Bi(c.value), [c.value]), h = S(
|
|
696
696
|
(g) => {
|
|
697
697
|
d(g), u(g);
|
|
698
698
|
},
|
|
699
699
|
[d, u]
|
|
700
700
|
);
|
|
701
|
-
return /* @__PURE__ */ r(
|
|
702
|
-
|
|
701
|
+
return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
|
|
702
|
+
Xt,
|
|
703
703
|
{
|
|
704
704
|
value: p,
|
|
705
705
|
onValueChange: h,
|
|
@@ -711,7 +711,7 @@ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = T(function(i) {
|
|
|
711
711
|
...f
|
|
712
712
|
}
|
|
713
713
|
) }) });
|
|
714
|
-
}), re = class re extends
|
|
714
|
+
}), re = class re extends At {
|
|
715
715
|
constructor(i) {
|
|
716
716
|
super({ ...i, type: "multi-select" });
|
|
717
717
|
}
|
|
@@ -735,7 +735,7 @@ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = T(function(i) {
|
|
|
735
735
|
return /* @__PURE__ */ r(qi, { field: this, ...i });
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
m(re, "fieldTypeName", "Multi-select"), m(re, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(re, "Icon",
|
|
738
|
+
m(re, "fieldTypeName", "Multi-select"), m(re, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(re, "Icon", Jt);
|
|
739
739
|
let Ae = re;
|
|
740
740
|
const Wi = T(function({ field: i, ...e }) {
|
|
741
741
|
const [{ value: t }] = Ye(i.options.clonedFieldIdentifier), n = w(() => {
|
|
@@ -767,13 +767,13 @@ class ji extends Pe {
|
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
const Hi = T(function(i) {
|
|
770
|
-
const { field: e, ...t } = i, { label: n, description: o, fields: l, condition: c } = e, { values: a, setFieldValue: f } = me(), d = c != null && c.identifier ? de(a, c.identifier) : void 0, u = w(() =>
|
|
770
|
+
const { field: e, ...t } = i, { label: n, description: o, fields: l, condition: c } = e, { values: a, setFieldValue: f } = me(), d = c != null && c.identifier ? de(a, c.identifier) : void 0, u = w(() => Vt(c, d), [c, d]);
|
|
771
771
|
ve(() => {
|
|
772
772
|
if (!u)
|
|
773
773
|
for (const h of l)
|
|
774
774
|
f(h.getId(), "").then();
|
|
775
775
|
}, [u, l, f]);
|
|
776
|
-
const p =
|
|
776
|
+
const p = kt(l, t);
|
|
777
777
|
return u ? n ? /* @__PURE__ */ r(ye, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
|
|
778
778
|
/* @__PURE__ */ b(y, { direction: "column", children: [
|
|
779
779
|
/* @__PURE__ */ r(De, { as: "h3", size: "3", children: n }),
|
|
@@ -855,7 +855,7 @@ const Hi = T(function(i) {
|
|
|
855
855
|
var n;
|
|
856
856
|
if (e.type !== "section")
|
|
857
857
|
throw new Error("Invalid type");
|
|
858
|
-
const t = ((n = e.fields) == null ? void 0 : n.map(
|
|
858
|
+
const t = ((n = e.fields) == null ? void 0 : n.map(Pt)) ?? [];
|
|
859
859
|
return new oe({ ...e, fields: t });
|
|
860
860
|
}
|
|
861
861
|
conditional() {
|
|
@@ -883,7 +883,7 @@ const Hi = T(function(i) {
|
|
|
883
883
|
}
|
|
884
884
|
};
|
|
885
885
|
m(oe, "fieldTypeName", "Section"), m(oe, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
886
|
-
let
|
|
886
|
+
let K = oe;
|
|
887
887
|
const Ui = "_previewImage_1ig84_1", Gi = {
|
|
888
888
|
previewImage: Ui
|
|
889
889
|
}, it = (s) => {
|
|
@@ -894,7 +894,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
|
|
|
894
894
|
return new Intl.NumberFormat([], { maximumFractionDigits: 2, style: "unit", unit: i[t] }).format(e);
|
|
895
895
|
}, Ki = T(function(i) {
|
|
896
896
|
var L;
|
|
897
|
-
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] =
|
|
897
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d } = c, u = fe(n), p = yi(null), { value: h } = c, g = w(() => o || (a.maxFileSize ? `Maximum file size: ${it(a.maxFileSize)}` : null), [a.maxFileSize, o]), x = S(() => {
|
|
898
898
|
var I;
|
|
899
899
|
(I = p.current) == null || I.click();
|
|
900
900
|
}, []), z = S(
|
|
@@ -905,8 +905,8 @@ const Ui = "_previewImage_1ig84_1", Gi = {
|
|
|
905
905
|
[h, d]
|
|
906
906
|
), F = h ? "Select new files" : "Select files", v = h ? "Select new file" : "Select a file", P = a.maxFiles > 1 ? F : v;
|
|
907
907
|
return /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
|
|
908
|
-
/* @__PURE__ */ r(
|
|
909
|
-
/* @__PURE__ */ r(y, { direction: "row", gap: "2", children: /* @__PURE__ */ r(he, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(
|
|
908
|
+
/* @__PURE__ */ r(j, { helpText: g, severity: n, children: /* @__PURE__ */ b(W, { severity: n, inputId: e, labelId: t, label: l, children: [
|
|
909
|
+
/* @__PURE__ */ r(y, { direction: "row", gap: "2", children: /* @__PURE__ */ r(he, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(G, { ...f, onClick: x, children: [
|
|
910
910
|
/* @__PURE__ */ r(bt, {}),
|
|
911
911
|
" ",
|
|
912
912
|
P
|
|
@@ -984,7 +984,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
|
|
|
984
984
|
}
|
|
985
985
|
static getFieldCreationSchema() {
|
|
986
986
|
return [
|
|
987
|
-
new
|
|
987
|
+
new Q({
|
|
988
988
|
label: "How many files can be uploaded?",
|
|
989
989
|
description: "By default, only one file can be uploaded.",
|
|
990
990
|
required: !1,
|
|
@@ -992,7 +992,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
|
|
|
992
992
|
maximum: 10,
|
|
993
993
|
identifier: "maximum_files"
|
|
994
994
|
}),
|
|
995
|
-
new
|
|
995
|
+
new Q({
|
|
996
996
|
label: "What is the maximum size of each file?",
|
|
997
997
|
description: "Maximum file size in bytes.",
|
|
998
998
|
required: !1,
|
|
@@ -1062,7 +1062,7 @@ m(se, "fieldTypeName", "Upload"), m(se, "fieldTypeDescription", "Allows a file t
|
|
|
1062
1062
|
let Ue = se;
|
|
1063
1063
|
const nt = {
|
|
1064
1064
|
date: We,
|
|
1065
|
-
number:
|
|
1065
|
+
number: Q,
|
|
1066
1066
|
boolean: ue,
|
|
1067
1067
|
select: Ee,
|
|
1068
1068
|
string: ge,
|
|
@@ -1072,11 +1072,11 @@ const nt = {
|
|
|
1072
1072
|
// TODO: Underscore
|
|
1073
1073
|
"multi-string": ze,
|
|
1074
1074
|
"multi-select": Ae
|
|
1075
|
-
},
|
|
1075
|
+
}, Pt = (s) => {
|
|
1076
1076
|
const i = s.type;
|
|
1077
1077
|
return nt[i].deserialize(s);
|
|
1078
|
-
}, Me = (s) => s.type === "section" ?
|
|
1079
|
-
function
|
|
1078
|
+
}, Me = (s) => s.type === "section" ? K.deserialize(s) : Pt(s);
|
|
1079
|
+
function Lt(s, i = {}) {
|
|
1080
1080
|
const { readonly: e = !1 } = i;
|
|
1081
1081
|
return {
|
|
1082
1082
|
title: s.title,
|
|
@@ -1088,7 +1088,7 @@ function Pt(s, i = {}) {
|
|
|
1088
1088
|
function Ge(s) {
|
|
1089
1089
|
return !!(Array.isArray(s) && s.some((i) => i instanceof File || i instanceof Promise));
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1091
|
+
function Vt(s, i) {
|
|
1092
1092
|
if (!s)
|
|
1093
1093
|
return !0;
|
|
1094
1094
|
if (Ge(i) || Ge(s.value))
|
|
@@ -1102,16 +1102,16 @@ function Lt(s, i) {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
return t === i;
|
|
1104
1104
|
}
|
|
1105
|
-
const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]),
|
|
1105
|
+
const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s, i) => {
|
|
1106
1106
|
const e = w(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
|
|
1107
1107
|
return /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: e });
|
|
1108
|
-
}, Ve = (s) => Object.keys(s).length > 0,
|
|
1108
|
+
}, Ve = (s) => Object.keys(s).length > 0, Dt = async (s, i) => {
|
|
1109
1109
|
const e = {};
|
|
1110
1110
|
for (const t of s.fields)
|
|
1111
|
-
if (t instanceof
|
|
1111
|
+
if (t instanceof K) {
|
|
1112
1112
|
if (t.condition) {
|
|
1113
1113
|
const { identifier: n } = t.condition;
|
|
1114
|
-
if (!
|
|
1114
|
+
if (!Vt(t.condition, de(i, n)))
|
|
1115
1115
|
continue;
|
|
1116
1116
|
}
|
|
1117
1117
|
Object.assign(e, t.getErrors(i));
|
|
@@ -1123,7 +1123,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1123
1123
|
}
|
|
1124
1124
|
if (Ve(e))
|
|
1125
1125
|
return e;
|
|
1126
|
-
}, Qi = [null, void 0], rt = (s, i) => s.reduce((e, t) => t instanceof
|
|
1126
|
+
}, Qi = [null, void 0], rt = (s, i) => s.reduce((e, t) => t instanceof K ? { ...e, ...rt(t.fields, i) } : (Qi.includes(de(e, t.getId())) && tt(e, t.getId(), ""), e), i), Xi = () => {
|
|
1127
1127
|
throw new Error("onSubmit must be provided if form is not readonly.");
|
|
1128
1128
|
}, ot = T(
|
|
1129
1129
|
we((s, i) => {
|
|
@@ -1142,7 +1142,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1142
1142
|
} = s, { readonly: p } = e.meta, h = w(() => crypto.randomUUID(), []), g = Qe({
|
|
1143
1143
|
initialValues: rt(e.fields, t),
|
|
1144
1144
|
onSubmit: n,
|
|
1145
|
-
validate: (P) =>
|
|
1145
|
+
validate: (P) => Dt(e, P),
|
|
1146
1146
|
// only validate the entire form on submit
|
|
1147
1147
|
validateOnBlur: !1,
|
|
1148
1148
|
validateOnChange: !1
|
|
@@ -1152,7 +1152,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1152
1152
|
), F = w(
|
|
1153
1153
|
() => typeof e.description == "string" ? /* @__PURE__ */ r(D, { className: $e.description, children: e.description }) : e.description,
|
|
1154
1154
|
[e.description]
|
|
1155
|
-
), v =
|
|
1155
|
+
), v = kt(e.fields, { formId: h, disabled: p });
|
|
1156
1156
|
return ve(() => {
|
|
1157
1157
|
x && a && a();
|
|
1158
1158
|
}, [x, a]), /* @__PURE__ */ r(Xe, { value: g, children: /* @__PURE__ */ r(y, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: h, onSubmit: g.handleSubmit, children: [
|
|
@@ -1162,8 +1162,8 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1162
1162
|
] }) }),
|
|
1163
1163
|
v,
|
|
1164
1164
|
!p && /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
|
|
1165
|
-
l && /* @__PURE__ */ r(
|
|
1166
|
-
/* @__PURE__ */ r(
|
|
1165
|
+
l && /* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: c, children: l }),
|
|
1166
|
+
/* @__PURE__ */ r(G, { type: "submit", disabled: !g.isValid, children: o })
|
|
1167
1167
|
] })
|
|
1168
1168
|
] }) }) });
|
|
1169
1169
|
})
|
|
@@ -1174,8 +1174,8 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1174
1174
|
throw new Error(
|
|
1175
1175
|
`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
|
|
1176
1176
|
);
|
|
1177
|
-
const c = w(() =>
|
|
1178
|
-
const f =
|
|
1177
|
+
const c = w(() => Lt(o, { readonly: !0 }), [o]), a = w(() => {
|
|
1178
|
+
const f = xi(e.offline_id)(l.store.getState()) ?? [], d = {};
|
|
1179
1179
|
for (const u of f) {
|
|
1180
1180
|
const p = l.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((g) => {
|
|
1181
1181
|
if (!g.success)
|
|
@@ -1205,7 +1205,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1205
1205
|
const { maxResults: e = 20, ...t } = s, [n, o] = ce(""), [l, c] = ce(""), { sdk: a } = wt(), f = w(() => {
|
|
1206
1206
|
const v = { maxResults: e, searchTerm: n };
|
|
1207
1207
|
return l && (l.startsWith(Ne) ? v.owner_organization = parseInt(l.slice(Ne.length)) : l.startsWith(Be) && (v.owner_user = parseInt(l.slice(Be.length)))), v;
|
|
1208
|
-
}, [n, e, l]), d = $(
|
|
1208
|
+
}, [n, e, l]), d = $(Ii(f)) ?? [], u = $(Fi), p = S(
|
|
1209
1209
|
(v) => {
|
|
1210
1210
|
v.favorite ? a.userForms.unfavorite(v.offline_id).then() : a.userForms.favorite(v.offline_id).then();
|
|
1211
1211
|
},
|
|
@@ -1221,7 +1221,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1221
1221
|
return Object.entries(P).map(([L, I]) => ({ itemContent: I, value: L }));
|
|
1222
1222
|
}, [u, a.store]), g = S((v) => {
|
|
1223
1223
|
o(v.currentTarget.value);
|
|
1224
|
-
}, []), z = ($(
|
|
1224
|
+
}, []), z = ($(Ci) || 0) - d.length, F = d.length == e && z > 0 ? `Only the first ${e} results are shown (${z} hidden)` : z > 0 && `${z} hidden forms`;
|
|
1225
1225
|
return /* @__PURE__ */ b(y, { ref: i, direction: "column", gap: "2", children: [
|
|
1226
1226
|
/* @__PURE__ */ b(y, { gap: "2", grow: "1", children: [
|
|
1227
1227
|
/* @__PURE__ */ r(he, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(le.Root, { size: "3", children: /* @__PURE__ */ r(le.Input, { placeholder: "Filter", value: n, onChange: g }) }) }),
|
|
@@ -1255,7 +1255,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1255
1255
|
h.stopPropagation(), n();
|
|
1256
1256
|
},
|
|
1257
1257
|
[n]
|
|
1258
|
-
), u = /* @__PURE__ */ r(_e.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...
|
|
1258
|
+
), u = /* @__PURE__ */ r(_e.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...Zt, children: [
|
|
1259
1259
|
/* @__PURE__ */ b(y, { grow: "1", align: "center", gap: "2", children: [
|
|
1260
1260
|
/* @__PURE__ */ r(
|
|
1261
1261
|
ae,
|
|
@@ -1265,38 +1265,38 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1265
1265
|
onClick: d,
|
|
1266
1266
|
"aria-label": i.favorite ? "Favorite form" : "Standard form",
|
|
1267
1267
|
disabled: !t,
|
|
1268
|
-
children: i.favorite ? /* @__PURE__ */ r(
|
|
1268
|
+
children: i.favorite ? /* @__PURE__ */ r(ei, {}) : /* @__PURE__ */ r(ti, {})
|
|
1269
1269
|
}
|
|
1270
1270
|
),
|
|
1271
1271
|
/* @__PURE__ */ r(D, { noWrap: !0, children: i.latestRevision.title }),
|
|
1272
|
-
i.latestRevision.description && /* @__PURE__ */ r(
|
|
1272
|
+
i.latestRevision.description && /* @__PURE__ */ r(ii, {})
|
|
1273
1273
|
] }),
|
|
1274
1274
|
f && /* @__PURE__ */ b(y, { align: "center", gap: "2", children: [
|
|
1275
|
-
/* @__PURE__ */ r(
|
|
1275
|
+
/* @__PURE__ */ r(ni, {}),
|
|
1276
1276
|
" ",
|
|
1277
1277
|
f
|
|
1278
1278
|
] })
|
|
1279
1279
|
] }) });
|
|
1280
|
-
return i.latestRevision.description ? /* @__PURE__ */ r(
|
|
1281
|
-
}, tn = "_submissionsContainer_9iirt_1", nn = "_stopHorizontalOverflow_9iirt_6",
|
|
1280
|
+
return i.latestRevision.description ? /* @__PURE__ */ r(ri, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
|
|
1281
|
+
}, tn = "_submissionsContainer_9iirt_1", nn = "_stopHorizontalOverflow_9iirt_6", _t = {
|
|
1282
1282
|
submissionsContainer: tn,
|
|
1283
1283
|
stopHorizontalOverflow: nn
|
|
1284
1284
|
}, rn = T(function(i) {
|
|
1285
1285
|
var v;
|
|
1286
|
-
const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: l } = i, c = $(It), a = $(et("created_by" in e ? e.created_by : c.id)), f = Ke(e), d =
|
|
1286
|
+
const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: l } = i, c = $(It), a = $(et("created_by" in e ? e.created_by : c.id)), f = Ke(e), d = Ti(f) ? f.toLocaleTimeString([], {
|
|
1287
1287
|
hour: "2-digit",
|
|
1288
1288
|
minute: "2-digit"
|
|
1289
|
-
}) :
|
|
1289
|
+
}) : Si(f), u = $(vt(e.form_revision));
|
|
1290
1290
|
if (!u)
|
|
1291
1291
|
throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
|
|
1292
|
-
const p = (v = $(
|
|
1292
|
+
const p = (v = $(zi(u.form))) == null ? void 0 : v.revision, h = Ei({
|
|
1293
1293
|
file: (a == null ? void 0 : a.profile.file) ?? null,
|
|
1294
1294
|
fileSha1: (a == null ? void 0 : a.profile.file_sha1) ?? null
|
|
1295
|
-
}), g = (a == null ? void 0 : a.username.charAt(0).toUpperCase()) ?? "?", x = u.revision === p, z =
|
|
1295
|
+
}), g = (a == null ? void 0 : a.username.charAt(0).toUpperCase()) ?? "?", x = u.revision === p, z = bi.useCallback(() => {
|
|
1296
1296
|
t && t({ submission: e });
|
|
1297
1297
|
}, [e, t]), F = /* @__PURE__ */ r(_e.Item, { onClick: z, asChild: !0, children: /* @__PURE__ */ b(y, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
|
|
1298
|
-
/* @__PURE__ */ b(y, { gap: "2", align: "center", className:
|
|
1299
|
-
/* @__PURE__ */ r(
|
|
1298
|
+
/* @__PURE__ */ b(y, { gap: "2", align: "center", className: _t.stopHorizontalOverflow, children: [
|
|
1299
|
+
/* @__PURE__ */ r(oi, { src: h, size: "1", fallback: g }),
|
|
1300
1300
|
/* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: o === "creator" ? (a || c).username : u.title })
|
|
1301
1301
|
] }),
|
|
1302
1302
|
/* @__PURE__ */ b(y, { gap: "2", align: "center", children: [
|
|
@@ -1321,7 +1321,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1321
1321
|
if (!!e == !!t)
|
|
1322
1322
|
throw new Error("Either formId or submissions must be provided, but not both.");
|
|
1323
1323
|
const f = $(
|
|
1324
|
-
t ? () => t :
|
|
1324
|
+
t ? () => t : Ai(e)
|
|
1325
1325
|
), d = w(
|
|
1326
1326
|
() => f == null ? void 0 : f.sort((u, p) => Ke(p).getTime() - Ke(u).getTime()),
|
|
1327
1327
|
[f]
|
|
@@ -1329,7 +1329,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1329
1329
|
return /* @__PURE__ */ r(
|
|
1330
1330
|
_e.Root,
|
|
1331
1331
|
{
|
|
1332
|
-
className: Ft(
|
|
1332
|
+
className: Ft(_t.submissionsContainer, o),
|
|
1333
1333
|
size: "small",
|
|
1334
1334
|
variant: c,
|
|
1335
1335
|
before: !n && /* @__PURE__ */ b(D, { severity: "info", children: [
|
|
@@ -1373,7 +1373,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1373
1373
|
[a, o]
|
|
1374
1374
|
), d = S(
|
|
1375
1375
|
async (g) => {
|
|
1376
|
-
const x = await
|
|
1376
|
+
const x = await Dt(t, g);
|
|
1377
1377
|
return x && l(x), x;
|
|
1378
1378
|
},
|
|
1379
1379
|
[t, l]
|
|
@@ -1389,25 +1389,25 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1389
1389
|
Ve(p) && h({ values: a, errors: {} });
|
|
1390
1390
|
}, [p, a, h]), /* @__PURE__ */ r(Xe, { value: u, children: /* @__PURE__ */ r("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
|
|
1391
1391
|
})
|
|
1392
|
-
),
|
|
1392
|
+
), $t = {
|
|
1393
1393
|
...nt,
|
|
1394
|
-
section:
|
|
1394
|
+
section: K
|
|
1395
1395
|
}, on = T(function(i) {
|
|
1396
1396
|
const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, l = e.Icon;
|
|
1397
1397
|
return /* @__PURE__ */ b(y, { gap: "4", align: "center", children: [
|
|
1398
|
-
/* @__PURE__ */ r(
|
|
1398
|
+
/* @__PURE__ */ r(G, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(y, { gap: "3", align: "center", grow: "1", children: [
|
|
1399
1399
|
/* @__PURE__ */ r(l, {}),
|
|
1400
1400
|
n
|
|
1401
1401
|
] }) }),
|
|
1402
1402
|
/* @__PURE__ */ r(D, { children: o })
|
|
1403
1403
|
] });
|
|
1404
|
-
}),
|
|
1404
|
+
}), Mt = [
|
|
1405
1405
|
["string", "text"],
|
|
1406
1406
|
["select", "multi-select", "upload"],
|
|
1407
1407
|
["boolean", "date", "number", "multi-string"]
|
|
1408
|
-
], sn =
|
|
1408
|
+
], sn = Mt.length - 1, ln = T(function(i) {
|
|
1409
1409
|
const { setFieldType: e } = i;
|
|
1410
|
-
return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children:
|
|
1410
|
+
return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children: Mt.map((t, n) => /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
|
|
1411
1411
|
/* @__PURE__ */ r(y, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
|
|
1412
1412
|
on,
|
|
1413
1413
|
{
|
|
@@ -1416,7 +1416,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1416
1416
|
},
|
|
1417
1417
|
o
|
|
1418
1418
|
)) }),
|
|
1419
|
-
n < sn && /* @__PURE__ */ r(
|
|
1419
|
+
n < sn && /* @__PURE__ */ r(si, { size: "4" })
|
|
1420
1420
|
] }, n)) });
|
|
1421
1421
|
}), an = (s) => (i) => {
|
|
1422
1422
|
if (console.log("in validate", s, i), !(!i || typeof i != "string") && s.includes(i.trim()))
|
|
@@ -1442,18 +1442,18 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1442
1442
|
new ue({ label: "Required", description: null, required: !1, identifier: "required" })
|
|
1443
1443
|
];
|
|
1444
1444
|
}, dn = T(function(i) {
|
|
1445
|
-
const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: l } = i, c =
|
|
1445
|
+
const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: l } = i, c = $t[e];
|
|
1446
1446
|
console.log("default field", o);
|
|
1447
1447
|
const a = me(), f = w(() => {
|
|
1448
|
-
const d =
|
|
1448
|
+
const d = Et(a.values.fields).filter((p) => p !== (o == null ? void 0 : o.label));
|
|
1449
1449
|
let u = cn(d, e);
|
|
1450
|
-
if (console.log(
|
|
1450
|
+
if (console.log("first set of errors", c, K, l), c === K) {
|
|
1451
1451
|
if (l === void 0)
|
|
1452
1452
|
throw new Error("Conditional source fields must be provided when changing sections.");
|
|
1453
1453
|
u = u.concat(c.getFieldCreationSchema(l));
|
|
1454
1454
|
} else {
|
|
1455
1455
|
if (!(c.prototype instanceof M))
|
|
1456
|
-
throw new Error(`Field must be an instance of BaseField. Got ${c}.`);
|
|
1456
|
+
throw console.log("badinstance"), new Error(`Field must be an instance of BaseField. Got ${c}.`);
|
|
1457
1457
|
u = [...u, ...c.getFieldCreationSchema()];
|
|
1458
1458
|
}
|
|
1459
1459
|
return {
|
|
@@ -1474,7 +1474,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1474
1474
|
}
|
|
1475
1475
|
);
|
|
1476
1476
|
}), pe = T(function(i) {
|
|
1477
|
-
const { parentPath: e, index: t, children: n, initial: o, editing: l, conditionalSourceFields: c } = i, [a, f] = ce(), d = (o == null ? void 0 : o.type) ?? a, u = d ?
|
|
1477
|
+
const { parentPath: e, index: t, children: n, initial: o, editing: l, conditionalSourceFields: c } = i, [a, f] = ce(), d = (o == null ? void 0 : o.type) ?? a, u = d ? $t[d].fieldTypeName : void 0, { setFieldValue: p, values: h } = me();
|
|
1478
1478
|
if (l && !o)
|
|
1479
1479
|
throw new Error("Initial field must be provided if editing is true.");
|
|
1480
1480
|
const g = !d && !l && !o, x = g ? "Choose a field type" : `${u} settings`, z = g ? "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.`, F = S(() => f(void 0), []), v = S((I) => {
|
|
@@ -1486,17 +1486,17 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1486
1486
|
throw new Error("Field type must be selected before creating a field.");
|
|
1487
1487
|
if (!O || typeof O != "string")
|
|
1488
1488
|
throw new Error("Label must be provided before creating a field.");
|
|
1489
|
-
const
|
|
1489
|
+
const Y = Me({
|
|
1490
1490
|
type: d,
|
|
1491
1491
|
...I,
|
|
1492
|
-
identifier:
|
|
1493
|
-
}).serialize(),
|
|
1494
|
-
if (
|
|
1492
|
+
identifier: St(I.identifier, O)
|
|
1493
|
+
}).serialize(), q = de(h, e);
|
|
1494
|
+
if (q === void 0)
|
|
1495
1495
|
throw new Error("Parent path must point to an existing field.");
|
|
1496
|
-
let
|
|
1497
|
-
if (!Array.isArray(
|
|
1496
|
+
let U;
|
|
1497
|
+
if (!Array.isArray(q))
|
|
1498
1498
|
throw new Error("Parent path must point to an array.");
|
|
1499
|
-
l ?
|
|
1499
|
+
l ? U = Ri(q, t, Y) : U = Tt(q, t, Y), p(e, U).then(), V();
|
|
1500
1500
|
},
|
|
1501
1501
|
[l, d, h, e, p, t]
|
|
1502
1502
|
), L = S(
|
|
@@ -1512,21 +1512,21 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1512
1512
|
),
|
|
1513
1513
|
[c, F, P, o, g, d]
|
|
1514
1514
|
);
|
|
1515
|
-
return /* @__PURE__ */ r(
|
|
1515
|
+
return /* @__PURE__ */ r(li, { onCloseInterrupt: v, title: x, description: z, content: L, children: n });
|
|
1516
1516
|
}), dt = ({ children: s }) => /* @__PURE__ */ r(pt, { children: s }), ut = (s, i) => ({
|
|
1517
1517
|
initial: s ? i : "none",
|
|
1518
1518
|
sm: s ? "none" : i
|
|
1519
|
-
}),
|
|
1519
|
+
}), Ot = T(function(i) {
|
|
1520
1520
|
const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o, duplicateProps: l } = i, c = w(
|
|
1521
1521
|
() => [
|
|
1522
1522
|
{
|
|
1523
1523
|
Wrapper: pe,
|
|
1524
1524
|
wrapperProps: n,
|
|
1525
|
-
Icon:
|
|
1525
|
+
Icon: ai,
|
|
1526
1526
|
text: "Edit"
|
|
1527
1527
|
},
|
|
1528
1528
|
{
|
|
1529
|
-
Icon:
|
|
1529
|
+
Icon: ci,
|
|
1530
1530
|
buttonProps: {
|
|
1531
1531
|
onClick: e
|
|
1532
1532
|
},
|
|
@@ -1535,7 +1535,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1535
1535
|
{
|
|
1536
1536
|
Wrapper: pe,
|
|
1537
1537
|
wrapperProps: l,
|
|
1538
|
-
Icon:
|
|
1538
|
+
Icon: di,
|
|
1539
1539
|
text: "Duplicate"
|
|
1540
1540
|
},
|
|
1541
1541
|
{
|
|
@@ -1548,7 +1548,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1548
1548
|
// Wrapping icon in a div so that the asChild turns the button into a div
|
|
1549
1549
|
// so that the drag handle props are not applied to the icon
|
|
1550
1550
|
// Note: b/c the <button> does not handle the space-press event correctly
|
|
1551
|
-
Icon: (a) => /* @__PURE__ */ r("div", { ...a, children: /* @__PURE__ */ r(
|
|
1551
|
+
Icon: (a) => /* @__PURE__ */ r("div", { ...a, children: /* @__PURE__ */ r(ui, {}) }),
|
|
1552
1552
|
text: "Reorder",
|
|
1553
1553
|
disableOnMobile: !0,
|
|
1554
1554
|
buttonProps: { ...t, asChild: !0 }
|
|
@@ -1562,9 +1562,9 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1562
1562
|
return /* @__PURE__ */ r(f, { ...a.wrapperProps, children: /* @__PURE__ */ r(ae, { type: "button", variant: "ghost", "aria-label": a.text, ...a.buttonProps, children: /* @__PURE__ */ r(a.Icon, {}) }) }, a.text);
|
|
1563
1563
|
}) }),
|
|
1564
1564
|
/* @__PURE__ */ r(he, { display: ut(!0, "block"), children: /* @__PURE__ */ r(
|
|
1565
|
-
|
|
1565
|
+
fi,
|
|
1566
1566
|
{
|
|
1567
|
-
trigger: /* @__PURE__ */ r(ae, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(
|
|
1567
|
+
trigger: /* @__PURE__ */ r(ae, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(mi, {}) }),
|
|
1568
1568
|
closeOnSelect: !1,
|
|
1569
1569
|
items: c.map((a) => {
|
|
1570
1570
|
var d;
|
|
@@ -1619,7 +1619,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1619
1619
|
children: /* @__PURE__ */ b(y, { gap: "4", justify: "between", align: "center", children: [
|
|
1620
1620
|
a,
|
|
1621
1621
|
/* @__PURE__ */ r(
|
|
1622
|
-
|
|
1622
|
+
Ot,
|
|
1623
1623
|
{
|
|
1624
1624
|
remove: l,
|
|
1625
1625
|
editProps: f,
|
|
@@ -1632,8 +1632,8 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1632
1632
|
}
|
|
1633
1633
|
) });
|
|
1634
1634
|
}), fn = T(function(i) {
|
|
1635
|
-
var V, O,
|
|
1636
|
-
const { field: e, index: t, dropState: n } = i, o = (V = n[e.identifier]) == null ? void 0 : V.disabled, { setFieldValue: l, values: c } = me(), a =
|
|
1635
|
+
var V, O, Y, q, U, A, R;
|
|
1636
|
+
const { field: e, index: t, dropState: n } = i, o = (V = n[e.identifier]) == null ? void 0 : V.disabled, { setFieldValue: l, values: c } = me(), a = pi(), f = Et(c.fields);
|
|
1637
1637
|
console.log("field section", e, t, c);
|
|
1638
1638
|
const d = S(
|
|
1639
1639
|
(C, E) => {
|
|
@@ -1650,8 +1650,8 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1650
1650
|
if (!E)
|
|
1651
1651
|
throw new Error("Could not find field to remove.");
|
|
1652
1652
|
const _ = [];
|
|
1653
|
-
for (const
|
|
1654
|
-
((k =
|
|
1653
|
+
for (const N of c.fields)
|
|
1654
|
+
((k = N.condition) == null ? void 0 : k.identifier) === E.identifier && _.push(N);
|
|
1655
1655
|
return {
|
|
1656
1656
|
removing: E,
|
|
1657
1657
|
affectedSections: _,
|
|
@@ -1661,7 +1661,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1661
1661
|
[e.fields, c.fields, l, t]
|
|
1662
1662
|
), p = S(
|
|
1663
1663
|
(C) => {
|
|
1664
|
-
const { affectedSections: E, action: _, removing: k } = u(C),
|
|
1664
|
+
const { affectedSections: E, action: _, removing: k } = u(C), N = () => {
|
|
1665
1665
|
_().then(), d(E, c.fields);
|
|
1666
1666
|
};
|
|
1667
1667
|
if (E.length > 0) {
|
|
@@ -1671,14 +1671,14 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1671
1671
|
description: `${k.label} is being used as a condition, deleting it will remove the condition from the ${Re} section(s).`,
|
|
1672
1672
|
severity: "danger",
|
|
1673
1673
|
actionText: "Remove",
|
|
1674
|
-
onAction:
|
|
1674
|
+
onAction: N
|
|
1675
1675
|
});
|
|
1676
1676
|
}
|
|
1677
|
-
|
|
1677
|
+
N();
|
|
1678
1678
|
},
|
|
1679
1679
|
[u, d, c.fields, a]
|
|
1680
1680
|
), h = S(() => {
|
|
1681
|
-
const E = e.fields.map((Ie,
|
|
1681
|
+
const E = e.fields.map((Ie, Rt) => u(Rt)).flatMap((Ie) => Ie.affectedSections), _ = E.length ? "Remove fields and conditions?" : "Remove fields?", k = e.fields.length, N = E.map((Ie) => Ie.label).join(", "), Re = E.length ? `Deleting this section will remove the ${k} field(s) it contains and will remove the conditions from following sections: ${N}` : `Deleting this section will remove the ${k} field(s) it contains.`, xe = Se(c.fields, t), st = () => l("fields", xe);
|
|
1682
1682
|
if (E.length > 0)
|
|
1683
1683
|
return a({
|
|
1684
1684
|
title: _,
|
|
@@ -1702,12 +1702,15 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1702
1702
|
d
|
|
1703
1703
|
]), g = S(
|
|
1704
1704
|
(C) => {
|
|
1705
|
-
const E = He(C.label ?? "", f), _ = C.fields.map((k) =>
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1705
|
+
const E = He(C.label ?? "", f), _ = C.fields.map((k) => {
|
|
1706
|
+
const N = He(k.label, f);
|
|
1707
|
+
return {
|
|
1708
|
+
...k,
|
|
1709
|
+
label: N,
|
|
1710
|
+
identifier: St(void 0, N)
|
|
1711
|
+
};
|
|
1712
|
+
});
|
|
1713
|
+
return { ...C, label: E, fields: _, identifier: "" };
|
|
1711
1714
|
},
|
|
1712
1715
|
[f]
|
|
1713
1716
|
), x = w(
|
|
@@ -1745,13 +1748,13 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1745
1748
|
), P = w(
|
|
1746
1749
|
() => {
|
|
1747
1750
|
var C, E;
|
|
1748
|
-
return (E =
|
|
1751
|
+
return (E = zt(c.fields, (C = e.condition) == null ? void 0 : C.identifier)) == null ? void 0 : E.label;
|
|
1749
1752
|
},
|
|
1750
1753
|
[(O = e.condition) == null ? void 0 : O.identifier, c.fields]
|
|
1751
|
-
), L = Array.isArray((
|
|
1752
|
-
if (Ge((
|
|
1754
|
+
), L = Array.isArray((Y = e.condition) == null ? void 0 : Y.value) ? "contains all of" : "equals";
|
|
1755
|
+
if (Ge((q = e.condition) == null ? void 0 : q.value))
|
|
1753
1756
|
throw new Error("File values are not supported for conditions.");
|
|
1754
|
-
const I = Array.isArray((
|
|
1757
|
+
const I = Array.isArray((U = e.condition) == null ? void 0 : U.value) ? (A = e.condition) == null ? void 0 : A.value.map((C) => typeof C == "string" ? C : C.label).join(", ") : (R = e.condition) == null ? void 0 : R.value.toString();
|
|
1755
1758
|
return /* @__PURE__ */ r(Ze, { draggableId: e.identifier, index: t, children: (C) => /* @__PURE__ */ r(
|
|
1756
1759
|
ye,
|
|
1757
1760
|
{
|
|
@@ -1765,7 +1768,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1765
1768
|
/* @__PURE__ */ r(De, { as: "h3", size: "3", children: e.label }),
|
|
1766
1769
|
/* @__PURE__ */ r(D, { className: $e.description, children: e.description })
|
|
1767
1770
|
] }),
|
|
1768
|
-
e.condition && /* @__PURE__ */ r(D, { size: "1", children: /* @__PURE__ */ b(
|
|
1771
|
+
e.condition && /* @__PURE__ */ r(D, { size: "1", children: /* @__PURE__ */ b(hi, { children: [
|
|
1769
1772
|
"Display only if ",
|
|
1770
1773
|
/* @__PURE__ */ r(lt, { children: P }),
|
|
1771
1774
|
" ",
|
|
@@ -1793,7 +1796,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1793
1796
|
_.identifier
|
|
1794
1797
|
)),
|
|
1795
1798
|
E.placeholder,
|
|
1796
|
-
/* @__PURE__ */ r(pe, { ...F, children: /* @__PURE__ */ b(
|
|
1799
|
+
/* @__PURE__ */ r(pe, { ...F, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
|
|
1797
1800
|
/* @__PURE__ */ r(ke, {}),
|
|
1798
1801
|
" Add a field"
|
|
1799
1802
|
] }) })
|
|
@@ -1802,7 +1805,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1802
1805
|
) })
|
|
1803
1806
|
] }),
|
|
1804
1807
|
/* @__PURE__ */ r(
|
|
1805
|
-
|
|
1808
|
+
Ot,
|
|
1806
1809
|
{
|
|
1807
1810
|
remove: h,
|
|
1808
1811
|
insertAfterProps: z,
|
|
@@ -1861,7 +1864,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1861
1864
|
if (t.identifier === i)
|
|
1862
1865
|
return [t, e];
|
|
1863
1866
|
}, hn = T(function() {
|
|
1864
|
-
const { values: i, setFieldValue: e } = me(), [t, n] =
|
|
1867
|
+
const { values: i, setFieldValue: e } = me(), [t, n] = vi(mn, i.fields, ft), { showInfo: o } = gi();
|
|
1865
1868
|
ve(() => {
|
|
1866
1869
|
n({ type: "update", state: ft(i.fields) });
|
|
1867
1870
|
}, [n, i.fields]);
|
|
@@ -1935,7 +1938,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1935
1938
|
d.label
|
|
1936
1939
|
)),
|
|
1937
1940
|
f.placeholder,
|
|
1938
|
-
/* @__PURE__ */ r(pe, { ...a, children: /* @__PURE__ */ b(
|
|
1941
|
+
/* @__PURE__ */ r(pe, { ...a, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
|
|
1939
1942
|
/* @__PURE__ */ r(ke, {}),
|
|
1940
1943
|
" Add a section"
|
|
1941
1944
|
] }) })
|
|
@@ -1967,13 +1970,13 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
1967
1970
|
if (h.title || (g.title = "Title is required."), (!h.fields || h.fields.length === 0) && (g.fields = "At least one field is required."), Ve(g))
|
|
1968
1971
|
return g;
|
|
1969
1972
|
}, []), a = Qe({
|
|
1970
|
-
initialValues:
|
|
1973
|
+
initialValues: Oi(n) ?? gn,
|
|
1971
1974
|
validate: c,
|
|
1972
1975
|
onSubmit: (h) => t(h),
|
|
1973
1976
|
// only validate the entire for on submit
|
|
1974
1977
|
validateOnChange: !1,
|
|
1975
1978
|
validateOnBlur: !1
|
|
1976
|
-
}), f = w(() =>
|
|
1979
|
+
}), f = w(() => Lt(a.values), [a.values]), d = Le(bn, yn), u = Le(vn, wn), p = w(
|
|
1977
1980
|
() => typeof l == "object" ? l : /* @__PURE__ */ r(De, { children: l }),
|
|
1978
1981
|
[l]
|
|
1979
1982
|
);
|
|
@@ -2000,8 +2003,8 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
2000
2003
|
/* @__PURE__ */ r(D, { severity: "danger", size: "1", children: typeof a.errors.fields == "string" && a.errors.fields })
|
|
2001
2004
|
] }),
|
|
2002
2005
|
/* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
|
|
2003
|
-
/* @__PURE__ */ r(
|
|
2004
|
-
/* @__PURE__ */ r(
|
|
2006
|
+
/* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
|
|
2007
|
+
/* @__PURE__ */ r(G, { type: "submit", disabled: !a.isValid, children: "Save" })
|
|
2005
2008
|
] })
|
|
2006
2009
|
] }) })
|
|
2007
2010
|
] }),
|
|
@@ -2011,10 +2014,10 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), Vt = (s,
|
|
|
2011
2014
|
);
|
|
2012
2015
|
export {
|
|
2013
2016
|
ue as BooleanField,
|
|
2014
|
-
|
|
2017
|
+
Vi as BooleanInput,
|
|
2015
2018
|
We as DateField,
|
|
2016
|
-
|
|
2017
|
-
|
|
2019
|
+
Di as DateInput,
|
|
2020
|
+
K as FieldSection,
|
|
2018
2021
|
Vn as FormBrowser,
|
|
2019
2022
|
$n as FormBuilder,
|
|
2020
2023
|
ot as FormRenderer,
|
|
@@ -2024,21 +2027,21 @@ export {
|
|
|
2024
2027
|
qi as MultiSelectInput,
|
|
2025
2028
|
ze as MultiStringField,
|
|
2026
2029
|
Ni as MultiStringInput,
|
|
2027
|
-
|
|
2028
|
-
|
|
2030
|
+
Q as NumberField,
|
|
2031
|
+
ki as NumberInput,
|
|
2029
2032
|
Dn as PatchField,
|
|
2030
2033
|
_n as PatchFormProvider,
|
|
2031
2034
|
Ee as SelectField,
|
|
2032
|
-
|
|
2035
|
+
Mi as SelectInput,
|
|
2033
2036
|
ge as StringField,
|
|
2034
|
-
|
|
2037
|
+
_i as StringInput,
|
|
2035
2038
|
be as TextField,
|
|
2036
|
-
|
|
2039
|
+
$i as TextInput,
|
|
2037
2040
|
Me as deserialize,
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
+
Pt as deserializeField,
|
|
2042
|
+
Lt as formRevisionToSchema,
|
|
2043
|
+
Vt as isConditionMet,
|
|
2041
2044
|
Le as useFieldInput,
|
|
2042
|
-
|
|
2045
|
+
kt as useFieldInputs,
|
|
2043
2046
|
Ge as valueIsFile
|
|
2044
2047
|
};
|