@overmap-ai/forms 1.0.1 → 1.0.2
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/fields/BaseField/BaseField.d.ts +8 -0
- package/dist/fields/BooleanField/BooleanField.d.ts +3 -1
- package/dist/fields/DateField/DateField.d.ts +2 -0
- package/dist/fields/DateField/DateInput.d.ts +2 -2
- package/dist/fields/MultiStringField/MultiStringField.d.ts +2 -0
- package/dist/fields/NumberField/NumberField.d.ts +2 -1
- package/dist/fields/SelectField/BaseSelectField.d.ts +1 -0
- package/dist/fields/SelectField/MultiSelectField.d.ts +1 -0
- package/dist/fields/SelectField/SelectField.d.ts +1 -0
- package/dist/fields/UploadField/UploadField.d.ts +29 -0
- package/dist/fields/UploadField/UploadInput.d.ts +4 -0
- package/dist/fields/UploadField/index.d.ts +2 -0
- package/dist/fields/UploadField/utils.d.ts +1 -0
- package/dist/fields/constants.d.ts +2 -0
- package/dist/fields/utils.d.ts +2 -1
- package/dist/forms.js +980 -767
- package/dist/forms.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/dist/typings.d.ts +7 -1
- package/package.json +2 -2
package/dist/forms.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as r, jsxs as b, Fragment as
|
|
5
|
-
import { Flex as v, Text as
|
|
6
|
-
import { useField as
|
|
7
|
-
import
|
|
8
|
-
import { DragDropContext as
|
|
9
|
-
import { slugify as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
class
|
|
1
|
+
var Dt = Object.defineProperty;
|
|
2
|
+
var _t = (s, i, e) => i in s ? Dt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
|
|
3
|
+
var m = (s, i, e) => (_t(s, typeof i != "symbol" ? i + "" : i, e), e);
|
|
4
|
+
import { jsx as r, jsxs as b, Fragment as dt } from "react/jsx-runtime";
|
|
5
|
+
import { Flex as v, Text as D, useSeverityColor as de, Checkbox as Mt, CheckCircledIcon as $t, TextField as oe, FontFamilyIcon as Ot, CalendarIcon as Rt, InputIcon as Nt, TextArea as Bt, RowsIcon as qt, Select as ut, Box as me, IconButton as se, PlusIcon as Le, Badge as Oe, Cross1Icon as ft, ListBulletIcon as Wt, DropdownMenuIcon as jt, MultiSelect as Ht, CheckboxIcon as Ut, Card as ge, Heading as Pe, Button as j, UploadIcon as mt, ButtonList as Ve, divButtonProps as Gt, StarFilledIcon as Kt, StarIcon as Yt, QuestionMarkCircledIcon as Qt, PersonIcon as Xt, Tooltip as Jt, Avatar as Zt, Separator as ei, Dialog as ti, Pencil1Icon as ii, TrashIcon as ni, DragHandleDots2Icon as ri, DropdownMenu as oi, DotsVerticalIcon as si, useAlertDialog as li, Em as ai, Strong as nt, useToast as ci, Tabs as Y } from "@overmap-ai/blocks";
|
|
6
|
+
import { useField as He, useFormikContext as ue, useFormik as Ue, FormikProvider as Ge } from "formik";
|
|
7
|
+
import di, { useMemo as C, memo as T, useCallback as z, useState as le, useEffect as be, useRef as ui, forwardRef as ye, useReducer as fi } from "react";
|
|
8
|
+
import { DragDropContext as ht, Droppable as Ke, Draggable as Ye } from "@hello-pangea/dnd";
|
|
9
|
+
import { slugify as mi, useAppSelector as _, selectFormRevision as pt, useSDK as gt, selectSubmissionAttachments as hi, selectFilteredUserForms as pi, selectUserFormMapping as gi, selectOrganization as bt, selectUser as Qe, selectNumberOfUserForms as bi, selectCurrentUser as yt, classNames as vt, isToday as yi, getLocalDateString as vi, selectLatestFormRevision as wi, useFileSrc as xi, selectSubmissionsForForm as Ii } from "@overmap-ai/core";
|
|
10
|
+
import ae from "lodash.get";
|
|
11
|
+
import Xe from "lodash.set";
|
|
12
|
+
class wt {
|
|
13
13
|
constructor(i) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
m(this, "type");
|
|
15
|
+
m(this, "identifier");
|
|
16
|
+
m(this, "description");
|
|
17
17
|
const { description: e = null, identifier: t, type: n } = i;
|
|
18
18
|
this.identifier = t, this.description = e, this.type = n;
|
|
19
19
|
}
|
|
@@ -33,15 +33,22 @@ class ht {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
class
|
|
36
|
+
class M extends wt {
|
|
37
37
|
constructor(e) {
|
|
38
|
-
const { label: t, required: n, fieldValidators:
|
|
38
|
+
const { label: t, required: n, fieldValidators: o = [], formValidators: a = [], ...l } = e;
|
|
39
39
|
super(l);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
m(this, "required");
|
|
41
|
+
m(this, "formValidators");
|
|
42
|
+
m(this, "fieldValidators");
|
|
43
|
+
m(this, "label");
|
|
44
|
+
/**
|
|
45
|
+
* By default, validation doesn't execute on `onChange` events when editing fields
|
|
46
|
+
* until the field has been `touched`. This can be overridden by setting this to `false`
|
|
47
|
+
* if you want to validate on every `onChange` event. This is important for fields like booleans
|
|
48
|
+
* which don't have a `onBlur` event (which is used to set the `touched` state).
|
|
49
|
+
*/
|
|
50
|
+
m(this, "onlyValidateAfterTouched", !0);
|
|
51
|
+
this.label = t, this.required = n, this.fieldValidators = o, this.formValidators = a;
|
|
45
52
|
}
|
|
46
53
|
static getFieldCreationSchema() {
|
|
47
54
|
return [];
|
|
@@ -49,19 +56,22 @@ class R extends ht {
|
|
|
49
56
|
isBlank(e) {
|
|
50
57
|
return e == null || e === "";
|
|
51
58
|
}
|
|
59
|
+
getValueFromChangeEvent(e) {
|
|
60
|
+
return e.target.value;
|
|
61
|
+
}
|
|
52
62
|
getError(e, t) {
|
|
53
63
|
if (this.required && this.isBlank(e))
|
|
54
64
|
return "This field is required.";
|
|
55
65
|
for (const n of this.getFieldValidators()) {
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
66
|
+
const o = n(e);
|
|
67
|
+
if (o)
|
|
68
|
+
return o;
|
|
59
69
|
}
|
|
60
70
|
if (t)
|
|
61
71
|
for (const n of this.getFormValidators()) {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
72
|
+
const o = n(e, t);
|
|
73
|
+
if (o)
|
|
74
|
+
return o;
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
77
|
// TODO: We can probably combine _serialize and serialize.
|
|
@@ -79,102 +89,100 @@ class R extends ht {
|
|
|
79
89
|
return [...this.formValidators];
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
description:
|
|
85
|
-
},
|
|
86
|
-
const { label: i, children: e, severity: t, inputId: n, labelId:
|
|
92
|
+
m(M, "fieldTypeName"), m(M, "fieldTypeDescription");
|
|
93
|
+
const Ci = "_description_17zed_1", ke = {
|
|
94
|
+
description: Ci
|
|
95
|
+
}, B = (s) => {
|
|
96
|
+
const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: a } = s;
|
|
87
97
|
return /* @__PURE__ */ r(v, { direction: "column", gap: "1", asChild: !0, ...a, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
|
|
88
|
-
/* @__PURE__ */ r(
|
|
98
|
+
/* @__PURE__ */ r(D, { severity: t, id: o, children: i }),
|
|
89
99
|
e
|
|
90
100
|
] }) });
|
|
91
|
-
},
|
|
92
|
-
const { helpText: i, children: e, severity: t } =
|
|
101
|
+
}, q = (s) => {
|
|
102
|
+
const { helpText: i, children: e, severity: t } = s;
|
|
93
103
|
return /* @__PURE__ */ b(v, { direction: "column", gap: "1", children: [
|
|
94
104
|
e,
|
|
95
|
-
/* @__PURE__ */ r(v, { direction: "column", children: /* @__PURE__ */ r(
|
|
105
|
+
/* @__PURE__ */ r(v, { direction: "column", children: /* @__PURE__ */ r(D, { size: "1", severity: t, className: ke.description, children: i }) })
|
|
96
106
|
] });
|
|
97
|
-
},
|
|
98
|
-
const { id: i, field: e, formId: t, ...n } =
|
|
99
|
-
...
|
|
100
|
-
onChange: (
|
|
101
|
-
|
|
107
|
+
}, W = (s) => {
|
|
108
|
+
const { id: i, field: e, formId: t, ...n } = s, [o, a, l] = He(e.getId()), { touched: c } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, h = `${u}-label`, p = e.required ? `${e.label} *` : e.label, g = C(() => ({
|
|
109
|
+
...o,
|
|
110
|
+
onChange: (F) => {
|
|
111
|
+
const w = e.getValueFromChangeEvent(F);
|
|
112
|
+
l.setValue(w, !1).then(), (c || !e.onlyValidateAfterTouched) && l.setError(e.getError(w));
|
|
102
113
|
},
|
|
103
|
-
onBlur: (
|
|
104
|
-
l.setTouched(!0, !1).then(), l.setError(e.getError(
|
|
114
|
+
onBlur: (F) => {
|
|
115
|
+
l.setTouched(!0, !1).then(), l.setError(e.getError(e.getValueFromChangeEvent(F)));
|
|
105
116
|
}
|
|
106
|
-
}), [e,
|
|
117
|
+
}), [e, o, l, c]);
|
|
107
118
|
return [
|
|
108
119
|
{
|
|
109
120
|
helpText: f,
|
|
110
|
-
severity:
|
|
111
|
-
inputId:
|
|
121
|
+
severity: d,
|
|
122
|
+
inputId: u,
|
|
112
123
|
labelId: h,
|
|
113
|
-
label:
|
|
124
|
+
label: p,
|
|
114
125
|
fieldProps: g,
|
|
115
126
|
helpers: l,
|
|
116
127
|
field: e
|
|
117
128
|
},
|
|
118
129
|
{ ...n, "aria-labelledby": h }
|
|
119
130
|
];
|
|
120
|
-
},
|
|
121
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
throw new Error("indeterminate CheckedState value is not supported");
|
|
125
|
-
h(w, !1).then(), m(!0, !1).then(), g(a.getError(w));
|
|
126
|
-
},
|
|
127
|
-
[h, m, g, a]
|
|
128
|
-
);
|
|
129
|
-
return /* @__PURE__ */ r(j, { helpText: s, severity: n, children: /* @__PURE__ */ r(
|
|
130
|
-
W,
|
|
131
|
+
}, Fi = [!0, "true"], Ti = T(function(i) {
|
|
132
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i), f = de(n), d = Fi.includes(l.value);
|
|
133
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(
|
|
134
|
+
B,
|
|
131
135
|
{
|
|
132
136
|
severity: n,
|
|
133
137
|
inputId: e,
|
|
134
138
|
labelId: t,
|
|
135
|
-
label:
|
|
139
|
+
label: a,
|
|
136
140
|
flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
|
|
137
141
|
children: /* @__PURE__ */ r(
|
|
138
|
-
|
|
142
|
+
Mt,
|
|
139
143
|
{
|
|
140
|
-
...u,
|
|
141
144
|
...c,
|
|
145
|
+
...l,
|
|
142
146
|
id: e,
|
|
143
|
-
color:
|
|
144
|
-
value:
|
|
145
|
-
checked:
|
|
146
|
-
onCheckedChange:
|
|
147
|
+
color: f,
|
|
148
|
+
value: d.toString(),
|
|
149
|
+
checked: d,
|
|
150
|
+
onCheckedChange: l.onChange,
|
|
147
151
|
onChange: void 0,
|
|
148
152
|
onBlur: void 0
|
|
149
153
|
}
|
|
150
154
|
)
|
|
151
155
|
}
|
|
152
156
|
) });
|
|
153
|
-
}),
|
|
154
|
-
constructor(
|
|
155
|
-
super({ ...
|
|
157
|
+
}), Q = class Q extends M {
|
|
158
|
+
constructor(e) {
|
|
159
|
+
super({ ...e, type: "boolean" });
|
|
160
|
+
m(this, "onlyValidateAfterTouched", !1);
|
|
156
161
|
}
|
|
157
162
|
// if a BooleanField is required, `false` is considered blank
|
|
158
|
-
isBlank(
|
|
159
|
-
return this.required && !
|
|
163
|
+
isBlank(e) {
|
|
164
|
+
return this.required && !e;
|
|
165
|
+
}
|
|
166
|
+
getValueFromChangeEvent(e) {
|
|
167
|
+
return typeof e == "boolean" ? e : e.target.checked;
|
|
160
168
|
}
|
|
161
169
|
serialize() {
|
|
162
170
|
return super._serialize();
|
|
163
171
|
}
|
|
164
|
-
static deserialize(
|
|
165
|
-
if (
|
|
172
|
+
static deserialize(e) {
|
|
173
|
+
if (e.type !== "boolean")
|
|
166
174
|
throw new Error("Type mismatch.");
|
|
167
|
-
return new
|
|
175
|
+
return new Q(e);
|
|
168
176
|
}
|
|
169
|
-
getInput(
|
|
170
|
-
return /* @__PURE__ */ r(
|
|
177
|
+
getInput(e) {
|
|
178
|
+
return /* @__PURE__ */ r(Ti, { ...e, field: this });
|
|
171
179
|
}
|
|
172
180
|
};
|
|
173
|
-
|
|
174
|
-
let
|
|
175
|
-
const
|
|
176
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
177
|
-
return /* @__PURE__ */ r(
|
|
181
|
+
m(Q, "fieldTypeName", "Checkbox"), m(Q, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(Q, "Icon", $t);
|
|
182
|
+
let ce = Q;
|
|
183
|
+
const Si = T(function(i) {
|
|
184
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), d = de(n);
|
|
185
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
178
186
|
oe.Input,
|
|
179
187
|
{
|
|
180
188
|
...f,
|
|
@@ -184,26 +192,30 @@ const yi = z(function(i) {
|
|
|
184
192
|
min: c.minimum,
|
|
185
193
|
max: c.maximum,
|
|
186
194
|
step: c.integers ? 1 : 0.1,
|
|
187
|
-
color:
|
|
195
|
+
color: d
|
|
188
196
|
}
|
|
189
197
|
) }) });
|
|
190
|
-
}),
|
|
198
|
+
}), O = class O extends M {
|
|
191
199
|
constructor(e) {
|
|
192
200
|
const {
|
|
193
201
|
minimum: t = Number.MIN_SAFE_INTEGER,
|
|
194
202
|
maximum: n = Number.MAX_SAFE_INTEGER,
|
|
195
|
-
integers:
|
|
203
|
+
integers: o = !1,
|
|
196
204
|
...a
|
|
197
205
|
} = e;
|
|
198
206
|
super({ ...a, type: "number" });
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.minimum = t, this.maximum = n, this.integers =
|
|
207
|
+
m(this, "minimum");
|
|
208
|
+
m(this, "maximum");
|
|
209
|
+
m(this, "integers");
|
|
210
|
+
this.minimum = t, this.maximum = n, this.integers = o;
|
|
211
|
+
}
|
|
212
|
+
getValueFromChangeEvent(e) {
|
|
213
|
+
const t = Number.parseFloat(e.target.value);
|
|
214
|
+
return Number.isNaN(t) ? "" : t;
|
|
203
215
|
}
|
|
204
216
|
static getFieldCreationSchema() {
|
|
205
217
|
return [
|
|
206
|
-
new
|
|
218
|
+
new O({
|
|
207
219
|
label: "Minimum",
|
|
208
220
|
description: "Minimum value",
|
|
209
221
|
integers: !0,
|
|
@@ -211,7 +223,7 @@ const yi = z(function(i) {
|
|
|
211
223
|
identifier: "minimum",
|
|
212
224
|
formValidators: [this._validateMin]
|
|
213
225
|
}),
|
|
214
|
-
new
|
|
226
|
+
new O({
|
|
215
227
|
label: "Maximum",
|
|
216
228
|
description: "Maximum value",
|
|
217
229
|
integers: !0,
|
|
@@ -219,7 +231,7 @@ const yi = z(function(i) {
|
|
|
219
231
|
identifier: "maximum",
|
|
220
232
|
formValidators: [this._validateMax]
|
|
221
233
|
}),
|
|
222
|
-
new
|
|
234
|
+
new ce({
|
|
223
235
|
label: "Integers",
|
|
224
236
|
description: "Whole numbers only",
|
|
225
237
|
required: !1,
|
|
@@ -229,14 +241,14 @@ const yi = z(function(i) {
|
|
|
229
241
|
}
|
|
230
242
|
getFieldValidators() {
|
|
231
243
|
const e = super.getFieldValidators(), t = this.minimum, n = this.maximum;
|
|
232
|
-
return typeof t == "number" && e.push((
|
|
233
|
-
if (typeof
|
|
244
|
+
return typeof t == "number" && e.push((o) => {
|
|
245
|
+
if (typeof o == "number" && o < t)
|
|
234
246
|
return `Must be at least ${this.minimum}.`;
|
|
235
|
-
}), typeof n == "number" && e.push((
|
|
236
|
-
if (typeof
|
|
247
|
+
}), typeof n == "number" && e.push((o) => {
|
|
248
|
+
if (typeof o == "number" && o > n)
|
|
237
249
|
return `Must be at most ${this.maximum}.`;
|
|
238
|
-
}), this.integers && e.push((
|
|
239
|
-
if (typeof
|
|
250
|
+
}), this.integers && e.push((o) => {
|
|
251
|
+
if (typeof o == "number" && !Number.isInteger(o))
|
|
240
252
|
return "Must be a whole number.";
|
|
241
253
|
}), e;
|
|
242
254
|
}
|
|
@@ -251,64 +263,51 @@ const yi = z(function(i) {
|
|
|
251
263
|
static deserialize(e) {
|
|
252
264
|
if (e.type !== "number")
|
|
253
265
|
throw new Error("Type mismatch.");
|
|
254
|
-
return new
|
|
266
|
+
return new O(e);
|
|
255
267
|
}
|
|
256
268
|
getInput(e) {
|
|
257
|
-
return /* @__PURE__ */ r(
|
|
269
|
+
return /* @__PURE__ */ r(Si, { field: this, ...e });
|
|
258
270
|
}
|
|
259
271
|
};
|
|
260
|
-
|
|
261
|
-
let
|
|
262
|
-
const
|
|
263
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
);
|
|
270
|
-
return /* @__PURE__ */ r(j, { helpText: s, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
271
|
-
oe.Input,
|
|
272
|
-
{
|
|
273
|
-
...u,
|
|
274
|
-
...c,
|
|
275
|
-
type: "date",
|
|
276
|
-
id: e,
|
|
277
|
-
color: d,
|
|
278
|
-
value: g,
|
|
279
|
-
onChange: y
|
|
280
|
-
}
|
|
281
|
-
) }) });
|
|
282
|
-
}), J = class J extends R {
|
|
283
|
-
constructor(i) {
|
|
284
|
-
super({ ...i, type: "date" });
|
|
272
|
+
m(O, "fieldTypeName", "Number"), m(O, "fieldTypeDescription", "Allows specifying a number within a given range."), m(O, "Icon", Ot), m(O, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(O, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
|
|
273
|
+
let U = O;
|
|
274
|
+
const zi = T(function(i) {
|
|
275
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i), f = de(n), d = l.value ? l.value.split("T")[0] : "";
|
|
276
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(oe.Input, { ...c, ...l, type: "date", id: e, color: f, value: d }) }) });
|
|
277
|
+
}), X = class X extends M {
|
|
278
|
+
constructor(e) {
|
|
279
|
+
super({ ...e, type: "date" });
|
|
280
|
+
m(this, "onlyValidateAfterTouched", !1);
|
|
285
281
|
}
|
|
286
282
|
serialize() {
|
|
287
283
|
return super._serialize();
|
|
288
284
|
}
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
getValueFromChangeEvent(e) {
|
|
286
|
+
return new Date(e.target.value).toISOString();
|
|
287
|
+
}
|
|
288
|
+
static deserialize(e) {
|
|
289
|
+
if (e.type !== "date")
|
|
291
290
|
throw new Error("Type mismatch.");
|
|
292
|
-
return new
|
|
291
|
+
return new X(e);
|
|
293
292
|
}
|
|
294
|
-
getInput(
|
|
295
|
-
return /* @__PURE__ */ r(
|
|
293
|
+
getInput(e) {
|
|
294
|
+
return /* @__PURE__ */ r(zi, { field: this, ...e });
|
|
296
295
|
}
|
|
297
296
|
};
|
|
298
|
-
|
|
299
|
-
let
|
|
300
|
-
class
|
|
297
|
+
m(X, "fieldTypeName", "Date"), m(X, "fieldTypeDescription", "Allows specifying a date."), m(X, "Icon", Rt);
|
|
298
|
+
let Re = X;
|
|
299
|
+
class we extends M {
|
|
301
300
|
constructor(e) {
|
|
302
|
-
const { minLength: t, maxLength: n = 5e3, ...
|
|
303
|
-
super(
|
|
304
|
-
|
|
305
|
-
|
|
301
|
+
const { minLength: t, maxLength: n = 5e3, ...o } = e;
|
|
302
|
+
super(o);
|
|
303
|
+
m(this, "minLength");
|
|
304
|
+
m(this, "maxLength");
|
|
306
305
|
this.minLength = t ? Math.max(t, 0) : void 0, this.maxLength = n ? Math.max(n, 0) : 5e3;
|
|
307
306
|
}
|
|
308
307
|
static getFieldCreationSchema() {
|
|
309
308
|
return [
|
|
310
309
|
// min, max
|
|
311
|
-
new
|
|
310
|
+
new U({
|
|
312
311
|
label: "Minimum length",
|
|
313
312
|
description: "Minimum number of characters",
|
|
314
313
|
required: !1,
|
|
@@ -318,7 +317,7 @@ class be extends R {
|
|
|
318
317
|
formValidators: [this._validateMin],
|
|
319
318
|
integers: !0
|
|
320
319
|
}),
|
|
321
|
-
new
|
|
320
|
+
new U({
|
|
322
321
|
label: "Maximum length",
|
|
323
322
|
description: "Maximum number of characters",
|
|
324
323
|
required: !1,
|
|
@@ -356,24 +355,24 @@ class be extends R {
|
|
|
356
355
|
* This function validates that the value given for "minimum length" (when creating a new field) is less than or
|
|
357
356
|
* equal to the value given for "maximum length".
|
|
358
357
|
*/
|
|
359
|
-
|
|
358
|
+
m(we, "_validateMin", (e, t) => typeof t.maximum_length == "number" && typeof e == "number" && t.maximum_length < e ? "Minimum cannot be greater than maximum." : null), /**
|
|
360
359
|
* This function validates that the value given for "maximum length" (when creating a new field) is greater than or
|
|
361
360
|
* equal to the value given for "minimum length".
|
|
362
361
|
*/
|
|
363
|
-
|
|
362
|
+
m(we, "_validateMax", (e, t) => {
|
|
364
363
|
if (typeof e != "number")
|
|
365
364
|
return null;
|
|
366
365
|
const { minimum_length: n } = t;
|
|
367
366
|
return typeof n != "number" ? null : n > e ? "Maximum cannot be less than minimum." : null;
|
|
368
367
|
});
|
|
369
|
-
const
|
|
370
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
371
|
-
return /* @__PURE__ */ r(
|
|
372
|
-
}),
|
|
368
|
+
const Ei = T(function(i) {
|
|
369
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), d = de(n);
|
|
370
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(oe.Input, { ...f, ...l, type: c.inputType, id: e, color: d }) }) });
|
|
371
|
+
}), J = class J extends we {
|
|
373
372
|
constructor(e) {
|
|
374
|
-
const { inputType: t = "text", ...n } = e,
|
|
375
|
-
super({ ...n, maxLength:
|
|
376
|
-
|
|
373
|
+
const { inputType: t = "text", ...n } = e, o = e.maxLength ? Math.min(500, e.maxLength) : 500, a = e.minLength ? Math.min(e.minLength, o) : void 0;
|
|
374
|
+
super({ ...n, maxLength: o, minLength: a, type: "string" });
|
|
375
|
+
m(this, "inputType");
|
|
377
376
|
this.inputType = t;
|
|
378
377
|
}
|
|
379
378
|
serialize() {
|
|
@@ -382,19 +381,19 @@ const wi = z(function(i) {
|
|
|
382
381
|
static deserialize(e) {
|
|
383
382
|
if (e.type !== "string")
|
|
384
383
|
throw new Error("Type mismatch.");
|
|
385
|
-
const { maximum_length: t, minimum_length: n, input_type:
|
|
386
|
-
return new
|
|
384
|
+
const { maximum_length: t, minimum_length: n, input_type: o, ...a } = e;
|
|
385
|
+
return new J({ ...a, maxLength: t, minLength: n, inputType: o });
|
|
387
386
|
}
|
|
388
387
|
getInput(e) {
|
|
389
|
-
return /* @__PURE__ */ r(
|
|
388
|
+
return /* @__PURE__ */ r(Ei, { field: this, ...e });
|
|
390
389
|
}
|
|
391
390
|
};
|
|
392
|
-
|
|
393
|
-
let
|
|
394
|
-
const
|
|
395
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
396
|
-
return /* @__PURE__ */ r(
|
|
397
|
-
}),
|
|
391
|
+
m(J, "fieldTypeName", "Short Text"), m(J, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(J, "Icon", Nt);
|
|
392
|
+
let he = J;
|
|
393
|
+
const Ai = T(function(i) {
|
|
394
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i);
|
|
395
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(Bt, { ...c, ...l, resize: "vertical", id: e, severity: n }) }) });
|
|
396
|
+
}), Z = class Z extends we {
|
|
398
397
|
constructor(i) {
|
|
399
398
|
const e = i.maxLength ? Math.min(5e3, i.maxLength) : 5e3, t = i.minLength ? Math.min(i.minLength, e) : void 0;
|
|
400
399
|
super({ ...i, maxLength: e, minLength: t, type: "text" });
|
|
@@ -406,198 +405,209 @@ const Ii = z(function(i) {
|
|
|
406
405
|
if (i.type !== "text")
|
|
407
406
|
throw new Error("Type mismatch.");
|
|
408
407
|
const { maximum_length: e, minimum_length: t, ...n } = i;
|
|
409
|
-
return new
|
|
408
|
+
return new Z({ ...n, maxLength: e, minLength: t });
|
|
410
409
|
}
|
|
411
410
|
getInput(i) {
|
|
412
|
-
return /* @__PURE__ */ r(
|
|
411
|
+
return /* @__PURE__ */ r(Ai, { field: this, ...i });
|
|
413
412
|
}
|
|
414
413
|
};
|
|
415
|
-
|
|
416
|
-
let
|
|
417
|
-
const
|
|
418
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
419
|
-
() => c.options.map((
|
|
414
|
+
m(Z, "fieldTypeName", "Paragraph"), m(Z, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(Z, "Icon", qt);
|
|
415
|
+
let pe = Z;
|
|
416
|
+
const Li = T(function(i) {
|
|
417
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), { onChange: d, onBlur: u } = l, h = C(
|
|
418
|
+
() => c.options.map((g) => ({ value: g.value, itemContent: g.label })),
|
|
420
419
|
[c.options]
|
|
421
|
-
),
|
|
422
|
-
(
|
|
423
|
-
d(
|
|
420
|
+
), p = z(
|
|
421
|
+
(g) => {
|
|
422
|
+
d(g), u(g);
|
|
424
423
|
},
|
|
425
|
-
[
|
|
424
|
+
[d, u]
|
|
426
425
|
);
|
|
427
|
-
return /* @__PURE__ */ r(
|
|
428
|
-
|
|
426
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
427
|
+
ut,
|
|
429
428
|
{
|
|
430
|
-
items:
|
|
429
|
+
items: h,
|
|
431
430
|
...l,
|
|
432
|
-
onValueChange:
|
|
431
|
+
onValueChange: p,
|
|
433
432
|
placeholder: "Select one...",
|
|
434
433
|
id: e,
|
|
435
434
|
severity: n,
|
|
436
|
-
...
|
|
435
|
+
...f
|
|
437
436
|
}
|
|
438
437
|
) }) });
|
|
439
|
-
}),
|
|
438
|
+
}), xe = (s = "", i = []) => ({
|
|
440
439
|
type: "section",
|
|
441
440
|
fields: i,
|
|
442
|
-
identifier:
|
|
441
|
+
identifier: s,
|
|
443
442
|
label: null,
|
|
444
443
|
condition: null,
|
|
445
444
|
conditional: !1
|
|
446
|
-
}),
|
|
447
|
-
if (!
|
|
445
|
+
}), Pi = (s) => {
|
|
446
|
+
if (!s)
|
|
448
447
|
return;
|
|
449
|
-
const i =
|
|
448
|
+
const i = s.fields;
|
|
450
449
|
let e = [];
|
|
451
450
|
const t = [];
|
|
452
451
|
for (const n of i)
|
|
453
|
-
n.type === "section" ? (e.length > 0 && (t.push(
|
|
454
|
-
return e.length > 0 && t.push(
|
|
452
|
+
n.type === "section" ? (e.length > 0 && (t.push(xe(`AUTO_section-${i.indexOf(n)}`, e)), e = []), t.push(n)) : e.push(n);
|
|
453
|
+
return e.length > 0 && t.push(xe("AUTO_section-last", e)), { ...s, fields: t, description: s.description ?? "" };
|
|
455
454
|
};
|
|
456
|
-
function
|
|
457
|
-
const t = Array.from(
|
|
455
|
+
function Ne(s, i, e) {
|
|
456
|
+
const t = Array.from(s), [n] = t.splice(i, 1);
|
|
458
457
|
if (!n)
|
|
459
458
|
throw new Error("Could not find field to reorder.");
|
|
460
459
|
return t.splice(e, 0, n), t;
|
|
461
460
|
}
|
|
462
|
-
function
|
|
463
|
-
const t = Array.from(
|
|
461
|
+
function Vi(s, i, e) {
|
|
462
|
+
const t = Array.from(s);
|
|
464
463
|
return t[i] = e, t;
|
|
465
464
|
}
|
|
466
|
-
function
|
|
467
|
-
const t = Array.from(
|
|
465
|
+
function xt(s, i, e) {
|
|
466
|
+
const t = Array.from(s ?? []);
|
|
468
467
|
return t.splice(i, 0, e), t;
|
|
469
468
|
}
|
|
470
|
-
function
|
|
471
|
-
const e = Array.from(
|
|
469
|
+
function Ie(s, i) {
|
|
470
|
+
const e = Array.from(s);
|
|
472
471
|
return e.splice(i, 1), e;
|
|
473
472
|
}
|
|
474
|
-
const
|
|
473
|
+
const ki = (s, i) => {
|
|
474
|
+
if (typeof s == "string" && s.length > 0)
|
|
475
|
+
return s;
|
|
476
|
+
const e = /* @__PURE__ */ new Date();
|
|
477
|
+
return `${mi(i)}-${e.getTime()}`;
|
|
478
|
+
}, It = (s, i) => {
|
|
475
479
|
if (!i)
|
|
476
480
|
return null;
|
|
477
|
-
for (const e of
|
|
481
|
+
for (const e of s)
|
|
478
482
|
if (e.type === "section") {
|
|
479
|
-
const t =
|
|
483
|
+
const t = It(e.fields, i);
|
|
480
484
|
if (t)
|
|
481
485
|
return t;
|
|
482
486
|
} else if (e.identifier === i)
|
|
483
487
|
return e;
|
|
484
488
|
return null;
|
|
485
|
-
},
|
|
486
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
487
|
-
(
|
|
488
|
-
|
|
489
|
+
}, Be = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Di = T(function(i) {
|
|
490
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i), f = de(n), d = C(() => Array.isArray(l.value) ? l.value : [], [l.value]), { onChange: u, onBlur: h } = l, p = `${e}-droppable`, { disabled: g } = c, [I, S] = le(""), [F, w] = le(""), A = F || o, L = F ? "red" : f, x = z(
|
|
491
|
+
(y) => {
|
|
492
|
+
u(y), h(y);
|
|
489
493
|
},
|
|
490
|
-
[
|
|
491
|
-
),
|
|
492
|
-
(
|
|
493
|
-
|
|
494
|
+
[u, h]
|
|
495
|
+
), V = z(
|
|
496
|
+
(y) => {
|
|
497
|
+
d.findIndex((P) => P.value === y.target.value.trim()) >= 0 ? w("All options must be unique") : y.target.value ? w("") : w("Option cannot be empty"), S(y.target.value);
|
|
494
498
|
},
|
|
495
|
-
[
|
|
496
|
-
),
|
|
497
|
-
if (
|
|
499
|
+
[S, d]
|
|
500
|
+
), $ = z(() => {
|
|
501
|
+
if (F)
|
|
498
502
|
return;
|
|
499
|
-
if (!
|
|
500
|
-
return
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
(
|
|
505
|
-
|
|
503
|
+
if (!I.trim())
|
|
504
|
+
return w("Option cannot be empty");
|
|
505
|
+
const y = I.trim();
|
|
506
|
+
x([...d, { value: y, label: y }]), S("");
|
|
507
|
+
}, [I, F, x, d]), H = z(
|
|
508
|
+
(y) => {
|
|
509
|
+
y.key === "Enter" && (y.preventDefault(), $());
|
|
506
510
|
},
|
|
507
|
-
[
|
|
508
|
-
),
|
|
509
|
-
(
|
|
510
|
-
|
|
511
|
+
[$]
|
|
512
|
+
), R = z(
|
|
513
|
+
(y) => {
|
|
514
|
+
x(Ie(d, y));
|
|
511
515
|
},
|
|
512
|
-
[
|
|
513
|
-
),
|
|
514
|
-
(
|
|
515
|
-
if (!
|
|
516
|
+
[d, x]
|
|
517
|
+
), E = z(
|
|
518
|
+
(y) => {
|
|
519
|
+
if (!y.destination)
|
|
516
520
|
return;
|
|
517
|
-
const
|
|
518
|
-
|
|
521
|
+
const P = y.source.index, k = y.destination.index;
|
|
522
|
+
x(Ne(d, P, k));
|
|
519
523
|
},
|
|
520
|
-
[
|
|
524
|
+
[x, d]
|
|
521
525
|
);
|
|
522
|
-
return /* @__PURE__ */ r(
|
|
523
|
-
/* @__PURE__ */ r(
|
|
524
|
-
/* @__PURE__ */ r(
|
|
526
|
+
return /* @__PURE__ */ r(ht, { onDragEnd: E, children: /* @__PURE__ */ b(v, { direction: "column", gap: "2", children: [
|
|
527
|
+
/* @__PURE__ */ r(q, { helpText: A, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: (!g || d.length === 0) && /* @__PURE__ */ b(v, { gap: "2", children: [
|
|
528
|
+
/* @__PURE__ */ r(me, { grow: "1", children: /* @__PURE__ */ r(
|
|
525
529
|
oe.Input,
|
|
526
530
|
{
|
|
527
531
|
placeholder: "Press enter to add a new option",
|
|
528
|
-
...
|
|
532
|
+
...c,
|
|
529
533
|
...l,
|
|
530
|
-
value:
|
|
531
|
-
onChange:
|
|
532
|
-
onKeyDown:
|
|
534
|
+
value: I,
|
|
535
|
+
onChange: V,
|
|
536
|
+
onKeyDown: H,
|
|
533
537
|
id: e,
|
|
534
|
-
color:
|
|
538
|
+
color: L,
|
|
535
539
|
onBlur: void 0
|
|
536
540
|
}
|
|
537
541
|
) }),
|
|
538
542
|
/* @__PURE__ */ r(
|
|
539
|
-
|
|
543
|
+
se,
|
|
540
544
|
{
|
|
541
545
|
type: "button",
|
|
542
546
|
"aria-label": "Add option",
|
|
543
|
-
disabled: !!
|
|
544
|
-
onClick:
|
|
545
|
-
children: /* @__PURE__ */ r(
|
|
547
|
+
disabled: !!F || g,
|
|
548
|
+
onClick: $,
|
|
549
|
+
children: /* @__PURE__ */ r(Le, {})
|
|
546
550
|
}
|
|
547
551
|
)
|
|
548
552
|
] }) }) }),
|
|
549
|
-
/* @__PURE__ */ r(
|
|
550
|
-
|
|
551
|
-
|
|
553
|
+
/* @__PURE__ */ r(Ke, { droppableId: p, children: (y) => /* @__PURE__ */ b(v, { ...y.droppableProps, ref: y.innerRef, direction: "column", children: [
|
|
554
|
+
d.map((P, k) => /* @__PURE__ */ r(
|
|
555
|
+
Ye,
|
|
552
556
|
{
|
|
553
|
-
draggableId: `${
|
|
554
|
-
index:
|
|
555
|
-
isDragDisabled:
|
|
556
|
-
children: ({ draggableProps:
|
|
557
|
+
draggableId: `${P.value}-draggable`,
|
|
558
|
+
index: k,
|
|
559
|
+
isDragDisabled: g,
|
|
560
|
+
children: ({ draggableProps: N, dragHandleProps: fe, innerRef: K }) => /* @__PURE__ */ r(
|
|
557
561
|
v,
|
|
558
562
|
{
|
|
559
|
-
...
|
|
560
|
-
...
|
|
561
|
-
ref:
|
|
563
|
+
...fe,
|
|
564
|
+
...N,
|
|
565
|
+
ref: K,
|
|
562
566
|
gap: "2",
|
|
563
567
|
align: "center",
|
|
564
568
|
justify: "between",
|
|
565
569
|
mb: "1",
|
|
566
570
|
asChild: !0,
|
|
567
|
-
children: /* @__PURE__ */ b(
|
|
568
|
-
/* @__PURE__ */ r("span", { children:
|
|
571
|
+
children: /* @__PURE__ */ b(Oe, { color: "gray", size: "2", children: [
|
|
572
|
+
/* @__PURE__ */ r("span", { children: P.label }),
|
|
569
573
|
/* @__PURE__ */ r(
|
|
570
|
-
|
|
574
|
+
se,
|
|
571
575
|
{
|
|
572
576
|
size: "small",
|
|
573
577
|
variant: "ghost",
|
|
574
578
|
type: "button",
|
|
575
579
|
"aria-label": "Delete option",
|
|
576
580
|
severity: "info",
|
|
577
|
-
disabled:
|
|
578
|
-
onClick: () =>
|
|
579
|
-
children: /* @__PURE__ */ r(
|
|
581
|
+
disabled: g,
|
|
582
|
+
onClick: () => R(k),
|
|
583
|
+
children: /* @__PURE__ */ r(ft, {})
|
|
580
584
|
}
|
|
581
585
|
)
|
|
582
586
|
] })
|
|
583
587
|
}
|
|
584
588
|
)
|
|
585
589
|
},
|
|
586
|
-
|
|
590
|
+
P.value
|
|
587
591
|
)),
|
|
588
|
-
|
|
592
|
+
y.placeholder
|
|
589
593
|
] }) })
|
|
590
594
|
] }) });
|
|
591
|
-
}),
|
|
595
|
+
}), ee = class ee extends M {
|
|
592
596
|
constructor(e) {
|
|
593
|
-
const { minimum_length: t, maximum_length: n, ...
|
|
594
|
-
super({ ...
|
|
595
|
-
|
|
596
|
-
|
|
597
|
+
const { minimum_length: t, maximum_length: n, ...o } = e;
|
|
598
|
+
super({ ...o, type: "multi-string" });
|
|
599
|
+
m(this, "minLength");
|
|
600
|
+
m(this, "maxLength");
|
|
601
|
+
m(this, "onlyValidateAfterTouched", !1);
|
|
597
602
|
this.minLength = t ?? 0, this.maxLength = n ?? 1 / 0;
|
|
598
603
|
}
|
|
604
|
+
getValueFromChangeEvent(e) {
|
|
605
|
+
if (Array.isArray(e))
|
|
606
|
+
return e;
|
|
607
|
+
throw new Error("Expected an array.");
|
|
608
|
+
}
|
|
599
609
|
getInput(e) {
|
|
600
|
-
return /* @__PURE__ */ r(
|
|
610
|
+
return /* @__PURE__ */ r(Di, { field: this, ...e });
|
|
601
611
|
}
|
|
602
612
|
serialize() {
|
|
603
613
|
return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
|
|
@@ -618,15 +628,16 @@ const Fi = (o, i) => typeof o == "string" && o.length > 0 ? o : at(i), mt = (o,
|
|
|
618
628
|
static deserialize(e) {
|
|
619
629
|
if (e.type !== "multi-string")
|
|
620
630
|
throw new Error("Type mismatch.");
|
|
621
|
-
return new
|
|
631
|
+
return new ee(e);
|
|
622
632
|
}
|
|
623
633
|
};
|
|
624
|
-
|
|
625
|
-
let
|
|
626
|
-
class
|
|
634
|
+
m(ee, "fieldTypeName", "Multi-string"), m(ee, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(ee, "Icon", Wt);
|
|
635
|
+
let Ce = ee;
|
|
636
|
+
class Ct extends M {
|
|
627
637
|
constructor(e) {
|
|
628
638
|
super(e);
|
|
629
|
-
|
|
639
|
+
m(this, "options");
|
|
640
|
+
m(this, "onlyValidateAfterTouched", !1);
|
|
630
641
|
const t = /* @__PURE__ */ new Set();
|
|
631
642
|
this.options = e.options.map((n) => (typeof n == "string" && (n = { label: n, value: n }), t.add(n.label), n)), t.size !== e.options.length && console.error(
|
|
632
643
|
`${e.options.length - t.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,
|
|
@@ -641,7 +652,7 @@ class gt extends R {
|
|
|
641
652
|
}
|
|
642
653
|
static getFieldCreationSchema() {
|
|
643
654
|
return [
|
|
644
|
-
new
|
|
655
|
+
new Ce({
|
|
645
656
|
label: "Options",
|
|
646
657
|
description: "List possible options for the user to select from.",
|
|
647
658
|
required: !0,
|
|
@@ -652,48 +663,56 @@ class gt extends R {
|
|
|
652
663
|
];
|
|
653
664
|
}
|
|
654
665
|
}
|
|
655
|
-
const
|
|
666
|
+
const te = class te extends Ct {
|
|
656
667
|
constructor(i) {
|
|
657
668
|
super({ ...i, type: "select" });
|
|
658
669
|
}
|
|
670
|
+
getValueFromChangeEvent(i) {
|
|
671
|
+
return typeof i == "string" ? i : i.target.value;
|
|
672
|
+
}
|
|
659
673
|
serialize() {
|
|
660
674
|
return super._serialize();
|
|
661
675
|
}
|
|
662
676
|
static deserialize(i) {
|
|
663
677
|
if (i.type !== "select")
|
|
664
678
|
throw new Error("Type mismatch.");
|
|
665
|
-
return new
|
|
679
|
+
return new te(i);
|
|
666
680
|
}
|
|
667
681
|
getInput(i) {
|
|
668
|
-
return /* @__PURE__ */ r(
|
|
682
|
+
return /* @__PURE__ */ r(Li, { field: this, ...i });
|
|
669
683
|
}
|
|
670
684
|
};
|
|
671
|
-
|
|
672
|
-
let
|
|
673
|
-
const
|
|
674
|
-
const [{ inputId: e, labelId: t, severity: n, helpText:
|
|
675
|
-
(
|
|
676
|
-
d(
|
|
685
|
+
m(te, "fieldTypeName", "Dropdown"), m(te, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(te, "Icon", jt);
|
|
686
|
+
let Fe = te;
|
|
687
|
+
const _i = (s) => s ? Array.isArray(s) ? s : [s] : [], Mi = T(function(i) {
|
|
688
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), { onChange: d, onBlur: u } = l, h = C(() => _i(l.value), [l.value]), p = z(
|
|
689
|
+
(g) => {
|
|
690
|
+
d(g), u(g);
|
|
677
691
|
},
|
|
678
|
-
[
|
|
692
|
+
[d, u]
|
|
679
693
|
);
|
|
680
|
-
return /* @__PURE__ */ r(
|
|
681
|
-
|
|
694
|
+
return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
|
|
695
|
+
Ht,
|
|
682
696
|
{
|
|
683
|
-
value:
|
|
684
|
-
onValueChange:
|
|
697
|
+
value: h,
|
|
698
|
+
onValueChange: p,
|
|
685
699
|
options: c.options,
|
|
686
700
|
name: l.name,
|
|
687
701
|
placeholder: "Select one or more...",
|
|
688
702
|
id: e,
|
|
689
703
|
severity: n,
|
|
690
|
-
...
|
|
704
|
+
...f
|
|
691
705
|
}
|
|
692
706
|
) }) });
|
|
693
|
-
}),
|
|
707
|
+
}), ie = class ie extends Ct {
|
|
694
708
|
constructor(i) {
|
|
695
709
|
super({ ...i, type: "multi-select" });
|
|
696
710
|
}
|
|
711
|
+
getValueFromChangeEvent(i) {
|
|
712
|
+
if (Array.isArray(i))
|
|
713
|
+
return i;
|
|
714
|
+
throw new Error("Expected an array.");
|
|
715
|
+
}
|
|
697
716
|
isBlank(i) {
|
|
698
717
|
return super.isBlank(i) || i.length === 0;
|
|
699
718
|
}
|
|
@@ -703,27 +722,27 @@ const Ei = z(function(i) {
|
|
|
703
722
|
static deserialize(i) {
|
|
704
723
|
if (i.type !== "multi-select")
|
|
705
724
|
throw new Error("Type mismatch.");
|
|
706
|
-
return new
|
|
725
|
+
return new ie(i);
|
|
707
726
|
}
|
|
708
727
|
getInput(i) {
|
|
709
|
-
return /* @__PURE__ */ r(
|
|
728
|
+
return /* @__PURE__ */ r(Mi, { field: this, ...i });
|
|
710
729
|
}
|
|
711
730
|
};
|
|
712
|
-
|
|
713
|
-
let
|
|
714
|
-
const
|
|
715
|
-
const [{ value: t }] =
|
|
716
|
-
const
|
|
717
|
-
return
|
|
731
|
+
m(ie, "fieldTypeName", "Multi-select"), m(ie, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(ie, "Icon", Ut);
|
|
732
|
+
let Te = ie;
|
|
733
|
+
const $i = T(function({ field: i, ...e }) {
|
|
734
|
+
const [{ value: t }] = He(i.options.clonedFieldIdentifier), n = C(() => {
|
|
735
|
+
const o = i.options.getFieldToClone(t);
|
|
736
|
+
return o ? De(o) : null;
|
|
718
737
|
}, [i.options, t]);
|
|
719
|
-
return
|
|
738
|
+
return ze(n, e);
|
|
720
739
|
});
|
|
721
|
-
class
|
|
740
|
+
class Se extends M {
|
|
722
741
|
constructor(e, t) {
|
|
723
742
|
super({ ...e, type: "custom" });
|
|
724
|
-
|
|
743
|
+
m(this, "Component");
|
|
725
744
|
// identifier of the field whose value is the label of the field to re-render
|
|
726
|
-
|
|
745
|
+
m(this, "options");
|
|
727
746
|
this.options = e, this.Component = t;
|
|
728
747
|
}
|
|
729
748
|
serialize() {
|
|
@@ -734,46 +753,46 @@ class xe extends R {
|
|
|
734
753
|
return /* @__PURE__ */ r(t, { field: this, ...e });
|
|
735
754
|
}
|
|
736
755
|
}
|
|
737
|
-
|
|
738
|
-
class
|
|
756
|
+
m(Se, "fieldTypeName", "Custom"), m(Se, "fieldTypeDescription", "Allows re-rendering of field already in the form");
|
|
757
|
+
class Oi extends Se {
|
|
739
758
|
constructor(i) {
|
|
740
|
-
super(i,
|
|
759
|
+
super(i, $i);
|
|
741
760
|
}
|
|
742
761
|
}
|
|
743
|
-
const
|
|
744
|
-
const { field: e, ...t } = i, { label: n, description:
|
|
745
|
-
|
|
746
|
-
if (!
|
|
747
|
-
for (const
|
|
748
|
-
f(
|
|
749
|
-
}, [
|
|
750
|
-
const h =
|
|
751
|
-
return
|
|
762
|
+
const Ri = T(function(i) {
|
|
763
|
+
const { field: e, ...t } = i, { label: n, description: o, fields: a, condition: l } = e, { values: c, setFieldValue: f } = ue(), d = l != null && l.identifier ? ae(c, l.identifier) : void 0, u = C(() => St(l, d), [l, d]);
|
|
764
|
+
be(() => {
|
|
765
|
+
if (!u)
|
|
766
|
+
for (const p of a)
|
|
767
|
+
f(p.getId(), "").then();
|
|
768
|
+
}, [u, a, f]);
|
|
769
|
+
const h = zt(a, t);
|
|
770
|
+
return u ? n ? /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ b(v, { direction: "column", gap: "3", children: [
|
|
752
771
|
/* @__PURE__ */ b(v, { direction: "column", children: [
|
|
753
|
-
/* @__PURE__ */ r(
|
|
754
|
-
/* @__PURE__ */ r(
|
|
772
|
+
/* @__PURE__ */ r(Pe, { as: "h3", size: "3", children: n }),
|
|
773
|
+
/* @__PURE__ */ r(D, { className: ke.description, children: o })
|
|
755
774
|
] }),
|
|
756
775
|
h
|
|
757
776
|
] }) }) : h : null;
|
|
758
|
-
}),
|
|
777
|
+
}), ne = class ne extends wt {
|
|
759
778
|
constructor(e) {
|
|
760
|
-
const { label: t = null, fields: n, condition:
|
|
779
|
+
const { label: t = null, fields: n, condition: o = null, conditional: a, ...l } = e;
|
|
761
780
|
super({ ...l, type: "section" });
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
this.fields = n, this.condition =
|
|
781
|
+
m(this, "label");
|
|
782
|
+
m(this, "fields");
|
|
783
|
+
m(this, "condition");
|
|
784
|
+
this.fields = n, this.condition = o, this.label = t, a === !1 && (this.condition = null);
|
|
766
785
|
}
|
|
767
786
|
static getFieldCreationSchema(e) {
|
|
768
787
|
return e.length === 0 ? [] : [
|
|
769
|
-
new
|
|
788
|
+
new ce({
|
|
770
789
|
label: "Conditional",
|
|
771
790
|
description: "Conditionally show or hide this section.",
|
|
772
791
|
identifier: "conditional",
|
|
773
792
|
required: !1
|
|
774
793
|
}),
|
|
775
794
|
// Declare a section that will hold options for the condition (if any).
|
|
776
|
-
new
|
|
795
|
+
new ne({
|
|
777
796
|
label: "Conditional settings",
|
|
778
797
|
identifier: "conditional-settings",
|
|
779
798
|
// This section will only be rendered if the above "Conditional" field is checked.
|
|
@@ -785,24 +804,24 @@ const Pi = z(function(i) {
|
|
|
785
804
|
fields: [
|
|
786
805
|
// Declare a select field that will be used to select the field against which we will check the
|
|
787
806
|
// condition. This must be selected before the next field is rendered.
|
|
788
|
-
new
|
|
807
|
+
new Fe({
|
|
789
808
|
label: "Field",
|
|
790
809
|
description: "The field to use for the condition.",
|
|
791
810
|
// The options (for the field against which we will check the condition) are all the labels of
|
|
792
811
|
// the fields in the previous section(s) (or fields declared before with no section) that
|
|
793
812
|
// support conditions. We pass in both the label and the identifier of each supported field. The
|
|
794
813
|
// identifier becomes the value of the option.
|
|
795
|
-
options: e.map((t) => t.label ? {
|
|
814
|
+
options: e.map((t) => !t.label || t.type === "upload" ? null : {
|
|
796
815
|
label: t.label,
|
|
797
816
|
value: t.identifier
|
|
798
|
-
}
|
|
817
|
+
}).filter((t) => !!t),
|
|
799
818
|
identifier: "condition.identifier",
|
|
800
819
|
required: !0
|
|
801
820
|
}),
|
|
802
821
|
// Declare a custom field that will be used to input a value for the condition. The value of the
|
|
803
822
|
// conditional field selected in the previous step must be equal to the value the user inputs into
|
|
804
823
|
// this field for the section to be rendered.
|
|
805
|
-
new
|
|
824
|
+
new Oi({
|
|
806
825
|
label: "Value",
|
|
807
826
|
identifier: "condition.value",
|
|
808
827
|
required: !0,
|
|
@@ -810,7 +829,7 @@ const Pi = z(function(i) {
|
|
|
810
829
|
getFieldToClone(t) {
|
|
811
830
|
if (!t)
|
|
812
831
|
return null;
|
|
813
|
-
const n = e.find((
|
|
832
|
+
const n = e.find((o) => o.identifier === t);
|
|
814
833
|
return n ? {
|
|
815
834
|
...n,
|
|
816
835
|
// Override some options to make it make sense in the context and to make it work with the framework.
|
|
@@ -829,8 +848,8 @@ const Pi = z(function(i) {
|
|
|
829
848
|
var n;
|
|
830
849
|
if (e.type !== "section")
|
|
831
850
|
throw new Error("Invalid type");
|
|
832
|
-
const t = ((n = e.fields) == null ? void 0 : n.map(
|
|
833
|
-
return new
|
|
851
|
+
const t = ((n = e.fields) == null ? void 0 : n.map(Ft)) ?? [];
|
|
852
|
+
return new ne({ ...e, fields: t });
|
|
834
853
|
}
|
|
835
854
|
conditional() {
|
|
836
855
|
return this.condition !== null;
|
|
@@ -847,45 +866,227 @@ const Pi = z(function(i) {
|
|
|
847
866
|
getErrors(e) {
|
|
848
867
|
const t = {};
|
|
849
868
|
for (const n of this.fields) {
|
|
850
|
-
const
|
|
851
|
-
a &&
|
|
869
|
+
const o = n.getId(), a = n.getError(ae(e, o), e);
|
|
870
|
+
a && Xe(t, n.getId(), a);
|
|
852
871
|
}
|
|
853
872
|
return t;
|
|
854
873
|
}
|
|
855
874
|
getInput(e) {
|
|
856
|
-
return /* @__PURE__ */ r(
|
|
875
|
+
return /* @__PURE__ */ r(Ri, { field: this, ...e });
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
m(ne, "fieldTypeName", "Section"), m(ne, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
879
|
+
let G = ne;
|
|
880
|
+
const Ni = "_previewImage_1ig84_1", Bi = {
|
|
881
|
+
previewImage: Ni
|
|
882
|
+
}, Je = (s) => {
|
|
883
|
+
const i = ["byte", "kilobyte", "megabyte"];
|
|
884
|
+
let e = s, t = 0;
|
|
885
|
+
for (; e > 1024 && t < i.length - 1; )
|
|
886
|
+
e /= 1024, t++;
|
|
887
|
+
return new Intl.NumberFormat([], { maximumFractionDigits: 2, style: "unit", unit: i[t] }).format(e);
|
|
888
|
+
}, qi = T(function(i) {
|
|
889
|
+
var L;
|
|
890
|
+
const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), { onChange: d } = l, u = de(n), h = ui(null), { value: p } = l, g = C(() => o || (c.maxFileSize ? `Maximum file size: ${Je(c.maxFileSize)}` : null), [c.maxFileSize, o]), I = z(() => {
|
|
891
|
+
var x;
|
|
892
|
+
(x = h.current) == null || x.click();
|
|
893
|
+
}, []), S = z(
|
|
894
|
+
(x) => {
|
|
895
|
+
const V = [...p];
|
|
896
|
+
V.splice(x, 1), d({ target: { files: V } });
|
|
897
|
+
},
|
|
898
|
+
[p, d]
|
|
899
|
+
), F = p ? "Select new files" : "Select files", w = p ? "Select new file" : "Select a file", A = c.maxFiles > 1 ? F : w;
|
|
900
|
+
return /* @__PURE__ */ b(v, { direction: "column", gap: "2", children: [
|
|
901
|
+
/* @__PURE__ */ r(q, { helpText: g, severity: n, children: /* @__PURE__ */ b(B, { severity: n, inputId: e, labelId: t, label: a, children: [
|
|
902
|
+
/* @__PURE__ */ r(v, { direction: "row", gap: "2", children: /* @__PURE__ */ r(me, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(j, { ...f, onClick: I, children: [
|
|
903
|
+
/* @__PURE__ */ r(mt, {}),
|
|
904
|
+
" ",
|
|
905
|
+
A
|
|
906
|
+
] }) }) }),
|
|
907
|
+
/* @__PURE__ */ r(
|
|
908
|
+
"input",
|
|
909
|
+
{
|
|
910
|
+
...f,
|
|
911
|
+
type: "file",
|
|
912
|
+
ref: h,
|
|
913
|
+
id: e,
|
|
914
|
+
accept: (L = c.extensions) == null ? void 0 : L.join(","),
|
|
915
|
+
multiple: c.maxFiles > 1,
|
|
916
|
+
color: u,
|
|
917
|
+
style: { display: "none" },
|
|
918
|
+
...l,
|
|
919
|
+
value: ""
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
] }) }),
|
|
923
|
+
Array.isArray(p) && p.length > 0 && /* @__PURE__ */ r(v, { direction: "column", gap: "2", children: p.map((x, V) => /* @__PURE__ */ r(
|
|
924
|
+
Wi,
|
|
925
|
+
{
|
|
926
|
+
field: c,
|
|
927
|
+
file: x,
|
|
928
|
+
onRemove: () => S(V),
|
|
929
|
+
disabled: f.disabled
|
|
930
|
+
},
|
|
931
|
+
V
|
|
932
|
+
)) })
|
|
933
|
+
] });
|
|
934
|
+
}), Wi = T(function({ file: i, field: e, onRemove: t, disabled: n }) {
|
|
935
|
+
const [o, a] = le(null), l = C(() => o && e.getError([o]), [e, o]), { url: c, name: f, size: d } = C(() => {
|
|
936
|
+
let u = null, h, p;
|
|
937
|
+
return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (h = o.name, p = Je(o.size)) : (h = "Downloading...", p = "..."), { url: u, name: h, size: p };
|
|
938
|
+
}, [o]);
|
|
939
|
+
return be(() => {
|
|
940
|
+
i instanceof Promise ? i.then(a) : a(i);
|
|
941
|
+
}, [i]), /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ b(v, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
|
|
942
|
+
/* @__PURE__ */ b(v, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
|
|
943
|
+
/* @__PURE__ */ r(
|
|
944
|
+
se,
|
|
945
|
+
{
|
|
946
|
+
severity: "info",
|
|
947
|
+
variant: "outline",
|
|
948
|
+
"aria-label": `Remove ${f}`,
|
|
949
|
+
disabled: n,
|
|
950
|
+
onClick: t,
|
|
951
|
+
children: /* @__PURE__ */ r(ft, {})
|
|
952
|
+
}
|
|
953
|
+
),
|
|
954
|
+
/* @__PURE__ */ b(v, { direction: "column", gap: "1", children: [
|
|
955
|
+
/* @__PURE__ */ r(D, { children: f }),
|
|
956
|
+
/* @__PURE__ */ r(D, { size: "1", children: d }),
|
|
957
|
+
l && /* @__PURE__ */ r(D, { size: "1", severity: "danger", children: l })
|
|
958
|
+
] })
|
|
959
|
+
] }),
|
|
960
|
+
c && /* @__PURE__ */ r("img", { className: Bi.previewImage, src: c, alt: f })
|
|
961
|
+
] }) });
|
|
962
|
+
}), rt = 50 * 1024 * 1024, re = class re extends M {
|
|
963
|
+
constructor(e) {
|
|
964
|
+
const { extensions: t, maximum_files: n, maximum_size: o, ...a } = e;
|
|
965
|
+
super({ ...a, type: "upload" });
|
|
966
|
+
m(this, "extensions");
|
|
967
|
+
m(this, "maxFileSize");
|
|
968
|
+
m(this, "maxFiles");
|
|
969
|
+
m(this, "onlyValidateAfterTouched", !1);
|
|
970
|
+
this.maxFileSize = typeof o == "number" ? o : void 0, this.maxFiles = Math.max(typeof n == "number" ? n : 1, 1), this.extensions = t;
|
|
971
|
+
}
|
|
972
|
+
getValueFromChangeEvent(e) {
|
|
973
|
+
return Array.from(e.target.files || []);
|
|
974
|
+
}
|
|
975
|
+
isBlank(e) {
|
|
976
|
+
return super.isBlank(e) || e.length === 0;
|
|
977
|
+
}
|
|
978
|
+
static getFieldCreationSchema() {
|
|
979
|
+
return [
|
|
980
|
+
new U({
|
|
981
|
+
label: "How many files can be uploaded?",
|
|
982
|
+
description: "By default, only one file can be uploaded.",
|
|
983
|
+
required: !1,
|
|
984
|
+
minimum: 1,
|
|
985
|
+
maximum: 10,
|
|
986
|
+
identifier: "maximum_files"
|
|
987
|
+
}),
|
|
988
|
+
new U({
|
|
989
|
+
label: "What is the maximum size of each file?",
|
|
990
|
+
description: "Maximum file size in bytes.",
|
|
991
|
+
required: !1,
|
|
992
|
+
identifier: "maximum_size",
|
|
993
|
+
minimum: 1,
|
|
994
|
+
maximum: rt,
|
|
995
|
+
integers: !0
|
|
996
|
+
}),
|
|
997
|
+
new Te({
|
|
998
|
+
label: "Accepted file types",
|
|
999
|
+
description: "Types of allowed files to upload. If left blank, all files will be accepted.",
|
|
1000
|
+
required: !1,
|
|
1001
|
+
identifier: "extensions",
|
|
1002
|
+
options: [
|
|
1003
|
+
{
|
|
1004
|
+
value: "image/*",
|
|
1005
|
+
label: "Images"
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
value: "audio/*",
|
|
1009
|
+
label: "Audio files"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
value: "video/*",
|
|
1013
|
+
label: "Videos"
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
value: "text/*",
|
|
1017
|
+
label: "Text files"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
value: "application/*",
|
|
1021
|
+
label: "Application files (includes PDFs and Word documents)"
|
|
1022
|
+
}
|
|
1023
|
+
]
|
|
1024
|
+
})
|
|
1025
|
+
];
|
|
1026
|
+
}
|
|
1027
|
+
getFieldValidators() {
|
|
1028
|
+
const e = super.getFieldValidators(), t = this.maxFileSize ?? rt, n = this.maxFiles ?? 1;
|
|
1029
|
+
return e.push((o) => {
|
|
1030
|
+
if (o && o.some((a) => a.size > t))
|
|
1031
|
+
return `Files must be at most ${Je(t)}.`;
|
|
1032
|
+
}), e.push((o) => {
|
|
1033
|
+
if (o && o.length > n)
|
|
1034
|
+
return `You can only upload ${n} files.`;
|
|
1035
|
+
}), e;
|
|
1036
|
+
}
|
|
1037
|
+
serialize() {
|
|
1038
|
+
return {
|
|
1039
|
+
...super._serialize(),
|
|
1040
|
+
extensions: this.extensions,
|
|
1041
|
+
maximum_size: this.maxFileSize,
|
|
1042
|
+
maximum_files: this.maxFiles
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
static deserialize(e) {
|
|
1046
|
+
if (e.type !== "upload")
|
|
1047
|
+
throw new Error("Type mismatch.");
|
|
1048
|
+
return new re(e);
|
|
1049
|
+
}
|
|
1050
|
+
getInput(e) {
|
|
1051
|
+
return /* @__PURE__ */ r(qi, { field: this, ...e });
|
|
857
1052
|
}
|
|
858
1053
|
};
|
|
859
|
-
|
|
860
|
-
let
|
|
861
|
-
const
|
|
862
|
-
date:
|
|
863
|
-
number:
|
|
864
|
-
boolean:
|
|
865
|
-
select:
|
|
866
|
-
string:
|
|
867
|
-
text:
|
|
868
|
-
custom:
|
|
1054
|
+
m(re, "fieldTypeName", "Upload"), m(re, "fieldTypeDescription", "Allows a file to be uploaded."), m(re, "Icon", mt);
|
|
1055
|
+
let qe = re;
|
|
1056
|
+
const Ze = {
|
|
1057
|
+
date: Re,
|
|
1058
|
+
number: U,
|
|
1059
|
+
boolean: ce,
|
|
1060
|
+
select: Fe,
|
|
1061
|
+
string: he,
|
|
1062
|
+
text: pe,
|
|
1063
|
+
custom: Se,
|
|
1064
|
+
upload: qe,
|
|
869
1065
|
// TODO: Underscore
|
|
870
|
-
"multi-string":
|
|
871
|
-
"multi-select":
|
|
872
|
-
},
|
|
873
|
-
const i =
|
|
874
|
-
return
|
|
875
|
-
}, De = (
|
|
876
|
-
function
|
|
1066
|
+
"multi-string": Ce,
|
|
1067
|
+
"multi-select": Te
|
|
1068
|
+
}, Ft = (s) => {
|
|
1069
|
+
const i = s.type;
|
|
1070
|
+
return Ze[i].deserialize(s);
|
|
1071
|
+
}, De = (s) => s.type === "section" ? G.deserialize(s) : Ft(s);
|
|
1072
|
+
function Tt(s, i = {}) {
|
|
877
1073
|
const { readonly: e = !1 } = i;
|
|
878
1074
|
return {
|
|
879
|
-
title:
|
|
880
|
-
description:
|
|
881
|
-
fields:
|
|
1075
|
+
title: s.title,
|
|
1076
|
+
description: s.description,
|
|
1077
|
+
fields: s.fields.map((t) => De(t)),
|
|
882
1078
|
meta: { readonly: e }
|
|
883
1079
|
};
|
|
884
1080
|
}
|
|
885
|
-
function
|
|
886
|
-
|
|
1081
|
+
function We(s) {
|
|
1082
|
+
return !!(Array.isArray(s) && s.some((i) => i instanceof File || i instanceof Promise));
|
|
1083
|
+
}
|
|
1084
|
+
function St(s, i) {
|
|
1085
|
+
if (!s)
|
|
887
1086
|
return !0;
|
|
888
|
-
|
|
1087
|
+
if (We(i) || We(s.value))
|
|
1088
|
+
throw new Error("Conditions do not support file uploads");
|
|
1089
|
+
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;
|
|
889
1090
|
if (Array.isArray(t) && Array.isArray(e)) {
|
|
890
1091
|
for (const n of t)
|
|
891
1092
|
if (!e.includes(n))
|
|
@@ -894,122 +1095,133 @@ function vt(o, i) {
|
|
|
894
1095
|
}
|
|
895
1096
|
return t === i;
|
|
896
1097
|
}
|
|
897
|
-
const
|
|
898
|
-
const e =
|
|
1098
|
+
const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s, i) => {
|
|
1099
|
+
const e = C(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
|
|
899
1100
|
return /* @__PURE__ */ r(v, { direction: "column", gap: "2", children: e });
|
|
900
|
-
},
|
|
1101
|
+
}, Ee = (s) => Object.keys(s).length > 0, Et = async (s, i) => {
|
|
901
1102
|
const e = {};
|
|
902
|
-
for (const t of
|
|
903
|
-
if (t instanceof
|
|
1103
|
+
for (const t of s.fields)
|
|
1104
|
+
if (t instanceof G) {
|
|
904
1105
|
if (t.condition) {
|
|
905
1106
|
const { identifier: n } = t.condition;
|
|
906
|
-
if (!
|
|
1107
|
+
if (!St(t.condition, ae(i, n)))
|
|
907
1108
|
continue;
|
|
908
1109
|
}
|
|
909
1110
|
Object.assign(e, t.getErrors(i));
|
|
910
1111
|
} else {
|
|
911
|
-
if (!(t instanceof
|
|
1112
|
+
if (!(t instanceof M))
|
|
912
1113
|
throw new Error("Invalid field type");
|
|
913
|
-
const n = t.getId(),
|
|
914
|
-
|
|
1114
|
+
const n = t.getId(), o = t.getError(ae(i, n), i);
|
|
1115
|
+
o && Xe(e, n, o);
|
|
915
1116
|
}
|
|
916
|
-
if (
|
|
1117
|
+
if (Ee(e))
|
|
917
1118
|
return e;
|
|
918
|
-
},
|
|
1119
|
+
}, ji = [null, void 0], et = (s, i) => s.reduce((e, t) => t instanceof G ? { ...e, ...et(t.fields, i) } : (ji.includes(ae(e, t.getId())) && Xe(e, t.getId(), ""), e), i), Hi = () => {
|
|
919
1120
|
throw new Error("onSubmit must be provided if form is not readonly.");
|
|
920
|
-
},
|
|
921
|
-
|
|
1121
|
+
}, tt = T(
|
|
1122
|
+
ye((s, i) => {
|
|
922
1123
|
const {
|
|
923
1124
|
schema: e,
|
|
924
1125
|
values: t = {},
|
|
925
|
-
onSubmit: n =
|
|
926
|
-
submitText:
|
|
1126
|
+
onSubmit: n = Hi,
|
|
1127
|
+
submitText: o = "Submit",
|
|
927
1128
|
cancelText: a,
|
|
928
1129
|
onCancel: l,
|
|
929
1130
|
onDirty: c,
|
|
930
1131
|
// if the title isn't provided, hide it by default
|
|
931
1132
|
hideTitle: f = !e.title,
|
|
932
|
-
hideDescription:
|
|
933
|
-
className:
|
|
934
|
-
} =
|
|
935
|
-
initialValues:
|
|
1133
|
+
hideDescription: d,
|
|
1134
|
+
className: u
|
|
1135
|
+
} = s, { readonly: h } = e.meta, p = C(() => crypto.randomUUID(), []), g = Ue({
|
|
1136
|
+
initialValues: et(e.fields, t),
|
|
936
1137
|
onSubmit: n,
|
|
937
|
-
validate: (
|
|
1138
|
+
validate: (A) => Et(e, A),
|
|
938
1139
|
// only validate the entire form on submit
|
|
939
1140
|
validateOnBlur: !1,
|
|
940
1141
|
validateOnChange: !1
|
|
941
|
-
}), { dirty:
|
|
942
|
-
() => typeof e.title == "string" ? /* @__PURE__ */ r(
|
|
1142
|
+
}), { dirty: I } = g, S = C(
|
|
1143
|
+
() => typeof e.title == "string" ? /* @__PURE__ */ r(Pe, { children: e.title }) : e.title,
|
|
943
1144
|
[e.title]
|
|
944
|
-
),
|
|
945
|
-
() => typeof e.description == "string" ? /* @__PURE__ */ r(
|
|
1145
|
+
), F = C(
|
|
1146
|
+
() => typeof e.description == "string" ? /* @__PURE__ */ r(D, { className: ke.description, children: e.description }) : e.description,
|
|
946
1147
|
[e.description]
|
|
947
|
-
),
|
|
948
|
-
return
|
|
949
|
-
|
|
950
|
-
}, [
|
|
951
|
-
!f && /* @__PURE__ */ r(
|
|
952
|
-
|
|
953
|
-
!
|
|
1148
|
+
), w = zt(e.fields, { formId: p, disabled: h });
|
|
1149
|
+
return be(() => {
|
|
1150
|
+
I && c && c();
|
|
1151
|
+
}, [I, c]), /* @__PURE__ */ r(Ge, { value: g, children: /* @__PURE__ */ r(v, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: p, onSubmit: g.handleSubmit, children: [
|
|
1152
|
+
!f && /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ b(v, { direction: "column", gap: "1", children: [
|
|
1153
|
+
S,
|
|
1154
|
+
!d && F
|
|
954
1155
|
] }) }),
|
|
955
|
-
|
|
1156
|
+
w,
|
|
956
1157
|
!h && /* @__PURE__ */ b(v, { justify: "end", gap: "2", children: [
|
|
957
|
-
a && /* @__PURE__ */ r(
|
|
958
|
-
/* @__PURE__ */ r(
|
|
1158
|
+
a && /* @__PURE__ */ r(j, { type: "button", variant: "soft", onClick: l, children: a }),
|
|
1159
|
+
/* @__PURE__ */ r(j, { type: "submit", disabled: !g.isValid, children: o })
|
|
959
1160
|
] })
|
|
960
1161
|
] }) }) });
|
|
961
1162
|
})
|
|
962
|
-
),
|
|
963
|
-
|
|
964
|
-
const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } =
|
|
965
|
-
if (!
|
|
1163
|
+
), Tn = T(
|
|
1164
|
+
ye((s, i) => {
|
|
1165
|
+
const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = _(pt(e.form_revision)), { sdk: a } = gt();
|
|
1166
|
+
if (!o)
|
|
966
1167
|
throw new Error(
|
|
967
1168
|
`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
|
|
968
1169
|
);
|
|
969
|
-
const
|
|
1170
|
+
const l = C(() => Tt(o, { readonly: !0 }), [o]), c = C(() => {
|
|
1171
|
+
const f = hi(e.offline_id)(a.store.getState()) ?? [], d = {};
|
|
1172
|
+
for (const u of f) {
|
|
1173
|
+
const h = a.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((g) => {
|
|
1174
|
+
if (!g.success)
|
|
1175
|
+
throw new Error(`Failed to download attachment ${u.file_name}.`);
|
|
1176
|
+
return g.body;
|
|
1177
|
+
}), p = d[u.field_identifier];
|
|
1178
|
+
p ? p.push(h) : d[u.field_identifier] = [h];
|
|
1179
|
+
}
|
|
1180
|
+
return { ...e.values, ...d };
|
|
1181
|
+
}, [a.files, a.store, e.offline_id, e.values]);
|
|
970
1182
|
return /* @__PURE__ */ r(
|
|
971
|
-
|
|
1183
|
+
tt,
|
|
972
1184
|
{
|
|
973
1185
|
ref: i,
|
|
974
|
-
schema:
|
|
975
|
-
values:
|
|
1186
|
+
schema: l,
|
|
1187
|
+
values: c,
|
|
976
1188
|
hideDescription: !t,
|
|
977
1189
|
hideTitle: !n
|
|
978
1190
|
}
|
|
979
1191
|
);
|
|
980
1192
|
})
|
|
981
|
-
),
|
|
982
|
-
favoriteIcon:
|
|
983
|
-
regularIcon:
|
|
984
|
-
},
|
|
985
|
-
|
|
986
|
-
const { maxResults: e = 20, ...t } =
|
|
987
|
-
const
|
|
988
|
-
return a && (a.startsWith(
|
|
989
|
-
}, [n, e, a]),
|
|
990
|
-
(
|
|
991
|
-
|
|
1193
|
+
), Ui = "_favoriteIcon_1bixi_1", Gi = "_regularIcon_1bixi_9", ot = {
|
|
1194
|
+
favoriteIcon: Ui,
|
|
1195
|
+
regularIcon: Gi
|
|
1196
|
+
}, Me = "organization:", $e = "user:", Sn = T(
|
|
1197
|
+
ye((s, i) => {
|
|
1198
|
+
const { maxResults: e = 20, ...t } = s, [n, o] = le(""), [a, l] = le(""), { sdk: c } = gt(), f = C(() => {
|
|
1199
|
+
const w = { maxResults: e, searchTerm: n };
|
|
1200
|
+
return a && (a.startsWith(Me) ? w.owner_organization = parseInt(a.slice(Me.length)) : a.startsWith($e) && (w.owner_user = parseInt(a.slice($e.length)))), w;
|
|
1201
|
+
}, [n, e, a]), d = _(pi(f)) ?? [], u = _(gi), h = z(
|
|
1202
|
+
(w) => {
|
|
1203
|
+
w.favorite ? c.userForms.unfavorite(w.offline_id).then() : c.userForms.favorite(w.offline_id).then();
|
|
992
1204
|
},
|
|
993
1205
|
[c]
|
|
994
|
-
),
|
|
995
|
-
const
|
|
996
|
-
for (const
|
|
997
|
-
const
|
|
998
|
-
|
|
999
|
-
const
|
|
1000
|
-
|
|
1206
|
+
), p = C(() => {
|
|
1207
|
+
const w = c.store.getState(), A = {};
|
|
1208
|
+
for (const L of Object.values(u)) {
|
|
1209
|
+
const x = bt(L.owner_organization || -1)(w);
|
|
1210
|
+
x && (A[`${Me}${x.id}`] = x.name);
|
|
1211
|
+
const V = Qe(L.owner_user || -1)(w);
|
|
1212
|
+
V && (A[`${$e}${V.id}`] = V.username);
|
|
1001
1213
|
}
|
|
1002
|
-
return Object.entries(
|
|
1003
|
-
}, [
|
|
1004
|
-
|
|
1005
|
-
}, []),
|
|
1214
|
+
return Object.entries(A).map(([L, x]) => ({ itemContent: x, value: L }));
|
|
1215
|
+
}, [u, c.store]), g = z((w) => {
|
|
1216
|
+
o(w.currentTarget.value);
|
|
1217
|
+
}, []), S = (_(bi) || 0) - d.length, F = d.length == e && S > 0 ? `Only the first ${e} results are shown (${S} hidden)` : S > 0 && `${S} hidden forms`;
|
|
1006
1218
|
return /* @__PURE__ */ b(v, { ref: i, direction: "column", gap: "2", children: [
|
|
1007
1219
|
/* @__PURE__ */ b(v, { gap: "2", grow: "1", children: [
|
|
1008
|
-
/* @__PURE__ */ r(
|
|
1220
|
+
/* @__PURE__ */ r(me, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(oe.Root, { size: "3", children: /* @__PURE__ */ r(oe.Input, { placeholder: "Filter", value: n, onChange: g }) }) }),
|
|
1009
1221
|
/* @__PURE__ */ r(
|
|
1010
|
-
|
|
1222
|
+
ut,
|
|
1011
1223
|
{
|
|
1012
|
-
items:
|
|
1224
|
+
items: p,
|
|
1013
1225
|
value: a,
|
|
1014
1226
|
onValueChange: l,
|
|
1015
1227
|
placeholder: "Owner",
|
|
@@ -1017,112 +1229,112 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1017
1229
|
}
|
|
1018
1230
|
)
|
|
1019
1231
|
] }),
|
|
1020
|
-
|
|
1021
|
-
|
|
1232
|
+
d.length > 0 && /* @__PURE__ */ r(Ve.Root, { children: d.map((w) => /* @__PURE__ */ r(
|
|
1233
|
+
Ki,
|
|
1022
1234
|
{
|
|
1023
1235
|
...t,
|
|
1024
|
-
form:
|
|
1025
|
-
handleToggleFavorite: () => h(
|
|
1236
|
+
form: w,
|
|
1237
|
+
handleToggleFavorite: () => h(w)
|
|
1026
1238
|
},
|
|
1027
|
-
|
|
1239
|
+
w.offline_id
|
|
1028
1240
|
)) }),
|
|
1029
|
-
/* @__PURE__ */ r(
|
|
1241
|
+
/* @__PURE__ */ r(me, { px: "3", children: /* @__PURE__ */ r(D, { size: "2", severity: "info", children: F }) })
|
|
1030
1242
|
] });
|
|
1031
1243
|
})
|
|
1032
|
-
),
|
|
1244
|
+
), Ki = (s) => {
|
|
1033
1245
|
var h;
|
|
1034
|
-
const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } =
|
|
1035
|
-
(
|
|
1036
|
-
|
|
1246
|
+
const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (h = _(bt(i.owner_organization || -1))) == null ? void 0 : h.name, a = _(Qe(i.owner_user || -1)), l = _(yt).id, c = !!a && a.id === l, f = o ?? (c ? "You" : a == null ? void 0 : a.username) ?? "Unknown", d = z(
|
|
1247
|
+
(p) => {
|
|
1248
|
+
p.stopPropagation(), n();
|
|
1037
1249
|
},
|
|
1038
1250
|
[n]
|
|
1039
|
-
),
|
|
1251
|
+
), u = /* @__PURE__ */ r(Ve.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(v, { justify: "between", gap: "2", py: "2", px: "3", ...Gt, children: [
|
|
1040
1252
|
/* @__PURE__ */ b(v, { grow: "1", align: "center", gap: "2", children: [
|
|
1041
1253
|
/* @__PURE__ */ r(
|
|
1042
|
-
|
|
1254
|
+
se,
|
|
1043
1255
|
{
|
|
1044
|
-
className:
|
|
1256
|
+
className: vt(i.favorite ? ot.favoriteIcon : ot.regularIcon),
|
|
1045
1257
|
variant: "ghost",
|
|
1046
|
-
onClick:
|
|
1258
|
+
onClick: d,
|
|
1047
1259
|
"aria-label": i.favorite ? "Favorite form" : "Standard form",
|
|
1048
1260
|
disabled: !t,
|
|
1049
|
-
children: i.favorite ? /* @__PURE__ */ r(
|
|
1261
|
+
children: i.favorite ? /* @__PURE__ */ r(Kt, {}) : /* @__PURE__ */ r(Yt, {})
|
|
1050
1262
|
}
|
|
1051
1263
|
),
|
|
1052
|
-
/* @__PURE__ */ r(
|
|
1053
|
-
i.latestRevision.description && /* @__PURE__ */ r(
|
|
1264
|
+
/* @__PURE__ */ r(D, { noWrap: !0, children: i.latestRevision.title }),
|
|
1265
|
+
i.latestRevision.description && /* @__PURE__ */ r(Qt, {})
|
|
1054
1266
|
] }),
|
|
1055
1267
|
f && /* @__PURE__ */ b(v, { align: "center", gap: "2", children: [
|
|
1056
|
-
/* @__PURE__ */ r(
|
|
1268
|
+
/* @__PURE__ */ r(Xt, {}),
|
|
1057
1269
|
" ",
|
|
1058
1270
|
f
|
|
1059
1271
|
] })
|
|
1060
1272
|
] }) });
|
|
1061
|
-
return i.latestRevision.description ? /* @__PURE__ */ r(
|
|
1062
|
-
},
|
|
1063
|
-
submissionsContainer:
|
|
1064
|
-
stopHorizontalOverflow:
|
|
1065
|
-
},
|
|
1066
|
-
var
|
|
1067
|
-
const { submission: e, onSubmissionClick: t, compact: n, labelType:
|
|
1273
|
+
return i.latestRevision.description ? /* @__PURE__ */ r(Jt, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
|
|
1274
|
+
}, Yi = "_submissionsContainer_9iirt_1", Qi = "_stopHorizontalOverflow_9iirt_6", At = {
|
|
1275
|
+
submissionsContainer: Yi,
|
|
1276
|
+
stopHorizontalOverflow: Qi
|
|
1277
|
+
}, Xi = T(function(i) {
|
|
1278
|
+
var w;
|
|
1279
|
+
const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: a } = i, l = _(yt), c = _(Qe("created_by" in e ? e.created_by : l.id)), f = je(e), d = yi(f) ? f.toLocaleTimeString([], {
|
|
1068
1280
|
hour: "2-digit",
|
|
1069
1281
|
minute: "2-digit"
|
|
1070
|
-
}) :
|
|
1071
|
-
if (!
|
|
1282
|
+
}) : vi(f), u = _(pt(e.form_revision));
|
|
1283
|
+
if (!u)
|
|
1072
1284
|
throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
|
|
1073
|
-
const h = (
|
|
1285
|
+
const h = (w = _(wi(u.form))) == null ? void 0 : w.revision, p = xi({
|
|
1074
1286
|
file: (c == null ? void 0 : c.profile.file) ?? null,
|
|
1075
1287
|
fileSha1: (c == null ? void 0 : c.profile.file_sha1) ?? null
|
|
1076
|
-
}), g = (c == null ? void 0 : c.username.charAt(0).toUpperCase()) ?? "?",
|
|
1288
|
+
}), g = (c == null ? void 0 : c.username.charAt(0).toUpperCase()) ?? "?", I = u.revision === h, S = di.useCallback(() => {
|
|
1077
1289
|
t && t({ submission: e });
|
|
1078
|
-
}, [e, t]),
|
|
1079
|
-
/* @__PURE__ */ b(v, { gap: "2", align: "center", className:
|
|
1080
|
-
/* @__PURE__ */ r(
|
|
1081
|
-
/* @__PURE__ */ r(
|
|
1290
|
+
}, [e, t]), F = /* @__PURE__ */ r(Ve.Item, { onClick: S, asChild: !0, children: /* @__PURE__ */ b(v, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
|
|
1291
|
+
/* @__PURE__ */ b(v, { gap: "2", align: "center", className: At.stopHorizontalOverflow, children: [
|
|
1292
|
+
/* @__PURE__ */ r(Zt, { src: p, size: "1", fallback: g }),
|
|
1293
|
+
/* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: o === "creator" ? (c || l).username : u.title })
|
|
1082
1294
|
] }),
|
|
1083
1295
|
/* @__PURE__ */ b(v, { gap: "2", align: "center", children: [
|
|
1084
|
-
!n && (
|
|
1085
|
-
/* @__PURE__ */ r(
|
|
1296
|
+
!n && (u.revision ? /* @__PURE__ */ r(Oe, { variant: "soft", severity: I ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!h && /* @__PURE__ */ r(Oe, { children: "Original" })),
|
|
1297
|
+
/* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: d })
|
|
1086
1298
|
] })
|
|
1087
1299
|
] }) });
|
|
1088
|
-
return a ? a(e,
|
|
1089
|
-
}),
|
|
1090
|
-
const i = "created_at" in
|
|
1300
|
+
return a ? a(e, F) : F;
|
|
1301
|
+
}), je = (s) => {
|
|
1302
|
+
const i = "created_at" in s ? s.created_at : s.submitted_at;
|
|
1091
1303
|
return new Date(i);
|
|
1092
|
-
},
|
|
1304
|
+
}, zn = T(function(i) {
|
|
1093
1305
|
const {
|
|
1094
1306
|
formId: e,
|
|
1095
1307
|
submissions: t,
|
|
1096
1308
|
compact: n = !1,
|
|
1097
|
-
className:
|
|
1309
|
+
className: o,
|
|
1098
1310
|
after: a,
|
|
1099
1311
|
variant: l = "outline",
|
|
1100
1312
|
...c
|
|
1101
1313
|
} = i;
|
|
1102
1314
|
if (!!e == !!t)
|
|
1103
1315
|
throw new Error("Either formId or submissions must be provided, but not both.");
|
|
1104
|
-
const f =
|
|
1105
|
-
t ? () => t :
|
|
1106
|
-
),
|
|
1107
|
-
() => f == null ? void 0 : f.sort((
|
|
1316
|
+
const f = _(
|
|
1317
|
+
t ? () => t : Ii(e)
|
|
1318
|
+
), d = C(
|
|
1319
|
+
() => f == null ? void 0 : f.sort((u, h) => je(h).getTime() - je(u).getTime()),
|
|
1108
1320
|
[f]
|
|
1109
1321
|
);
|
|
1110
1322
|
return /* @__PURE__ */ r(
|
|
1111
|
-
|
|
1323
|
+
Ve.Root,
|
|
1112
1324
|
{
|
|
1113
|
-
className:
|
|
1325
|
+
className: vt(At.submissionsContainer, o),
|
|
1114
1326
|
size: "small",
|
|
1115
1327
|
variant: l,
|
|
1116
|
-
before: !n && /* @__PURE__ */ b(
|
|
1328
|
+
before: !n && /* @__PURE__ */ b(D, { severity: "info", children: [
|
|
1117
1329
|
"There are ",
|
|
1118
1330
|
((f == null ? void 0 : f.length) || 0).toString(),
|
|
1119
1331
|
" submissions of this form."
|
|
1120
1332
|
] }),
|
|
1121
1333
|
after: a,
|
|
1122
|
-
children:
|
|
1123
|
-
|
|
1334
|
+
children: d == null ? void 0 : d.map((u, h) => /* @__PURE__ */ r(
|
|
1335
|
+
Xi,
|
|
1124
1336
|
{
|
|
1125
|
-
submission:
|
|
1337
|
+
submission: u,
|
|
1126
1338
|
compact: n,
|
|
1127
1339
|
...c
|
|
1128
1340
|
},
|
|
@@ -1130,91 +1342,88 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1130
1342
|
))
|
|
1131
1343
|
}
|
|
1132
1344
|
);
|
|
1133
|
-
}),
|
|
1134
|
-
const { name: e, render: t } = i, { submitForm: n } =
|
|
1135
|
-
return
|
|
1345
|
+
}), En = T(function(i) {
|
|
1346
|
+
const { name: e, render: t } = i, { submitForm: n } = ue(), [o, a, l] = He(e);
|
|
1347
|
+
return C(() => {
|
|
1136
1348
|
const c = (f) => l.setValue(f, !1);
|
|
1137
1349
|
return t({
|
|
1138
|
-
value:
|
|
1350
|
+
value: o.value,
|
|
1139
1351
|
setValue: c,
|
|
1140
1352
|
patchValue: n
|
|
1141
1353
|
});
|
|
1142
|
-
}, [n, l,
|
|
1143
|
-
}),
|
|
1144
|
-
|
|
1145
|
-
const { children: e, schema: t, values: n, onPatch:
|
|
1354
|
+
}, [n, l, o.value, t]);
|
|
1355
|
+
}), An = T(
|
|
1356
|
+
ye((s, i) => {
|
|
1357
|
+
const { children: e, schema: t, values: n, onPatch: o, onError: a, ...l } = s, c = C(() => et(t.fields, n), [t.fields, n]), f = z(
|
|
1146
1358
|
(g) => {
|
|
1147
|
-
const
|
|
1148
|
-
for (const
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1359
|
+
const I = {};
|
|
1360
|
+
for (const S in g) {
|
|
1361
|
+
const F = g[S];
|
|
1362
|
+
F !== c[S] && F !== void 0 && (I[S] = F);
|
|
1151
1363
|
}
|
|
1152
|
-
|
|
1364
|
+
Ee(I) && o(I);
|
|
1153
1365
|
},
|
|
1154
|
-
[c,
|
|
1155
|
-
),
|
|
1366
|
+
[c, o]
|
|
1367
|
+
), d = z(
|
|
1156
1368
|
async (g) => {
|
|
1157
|
-
const
|
|
1158
|
-
return
|
|
1369
|
+
const I = await Et(t, g);
|
|
1370
|
+
return I && a(I), I;
|
|
1159
1371
|
},
|
|
1160
1372
|
[t, a]
|
|
1161
|
-
),
|
|
1373
|
+
), u = Ue({
|
|
1162
1374
|
initialValues: c,
|
|
1163
1375
|
onSubmit: f,
|
|
1164
|
-
validate:
|
|
1376
|
+
validate: d,
|
|
1165
1377
|
// only validate the entire form on submit
|
|
1166
1378
|
validateOnBlur: !1,
|
|
1167
1379
|
validateOnChange: !1
|
|
1168
|
-
}), { errors: h, resetForm:
|
|
1169
|
-
return
|
|
1170
|
-
|
|
1171
|
-
}, [h, c,
|
|
1380
|
+
}), { errors: h, resetForm: p } = u;
|
|
1381
|
+
return be(() => {
|
|
1382
|
+
Ee(h) && p({ values: c, errors: {} });
|
|
1383
|
+
}, [h, c, p]), /* @__PURE__ */ r(Ge, { value: u, children: /* @__PURE__ */ r("form", { ...l, ref: i, onSubmit: u.handleSubmit, children: e }) });
|
|
1172
1384
|
})
|
|
1173
|
-
),
|
|
1174
|
-
...
|
|
1175
|
-
section:
|
|
1176
|
-
},
|
|
1177
|
-
const { field: e, setFieldType: t } = i, n = e.fieldTypeName,
|
|
1385
|
+
), Lt = {
|
|
1386
|
+
...Ze,
|
|
1387
|
+
section: G
|
|
1388
|
+
}, Ji = T(function(i) {
|
|
1389
|
+
const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, a = e.Icon;
|
|
1178
1390
|
return /* @__PURE__ */ b(v, { gap: "4", align: "center", children: [
|
|
1179
|
-
/* @__PURE__ */ r(
|
|
1391
|
+
/* @__PURE__ */ r(j, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(v, { gap: "3", align: "center", grow: "1", children: [
|
|
1180
1392
|
/* @__PURE__ */ r(a, {}),
|
|
1181
1393
|
n
|
|
1182
1394
|
] }) }),
|
|
1183
|
-
/* @__PURE__ */ r(
|
|
1395
|
+
/* @__PURE__ */ r(D, { children: o })
|
|
1184
1396
|
] });
|
|
1185
|
-
}),
|
|
1397
|
+
}), Pt = [
|
|
1186
1398
|
["string", "text"],
|
|
1187
|
-
["select", "multi-select"],
|
|
1399
|
+
["select", "multi-select", "upload"],
|
|
1188
1400
|
["boolean", "date", "number", "multi-string"]
|
|
1189
|
-
],
|
|
1401
|
+
], Zi = Pt.length - 1, en = T(function(i) {
|
|
1190
1402
|
const { setFieldType: e } = i;
|
|
1191
|
-
return /* @__PURE__ */ r(v, { direction: "column", gap: "3", children:
|
|
1192
|
-
/* @__PURE__ */ r(v, { direction: "column", gap: "2", children: t.map((
|
|
1193
|
-
|
|
1403
|
+
return /* @__PURE__ */ r(v, { direction: "column", gap: "3", children: Pt.map((t, n) => /* @__PURE__ */ b(v, { direction: "column", gap: "3", children: [
|
|
1404
|
+
/* @__PURE__ */ r(v, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
|
|
1405
|
+
Ji,
|
|
1194
1406
|
{
|
|
1195
|
-
field:
|
|
1196
|
-
setFieldType: () => e(
|
|
1407
|
+
field: Ze[o],
|
|
1408
|
+
setFieldType: () => e(o)
|
|
1197
1409
|
},
|
|
1198
|
-
|
|
1410
|
+
o
|
|
1199
1411
|
)) }),
|
|
1200
|
-
n <
|
|
1412
|
+
n < Zi && /* @__PURE__ */ r(ei, { size: "4" })
|
|
1201
1413
|
] }, n)) });
|
|
1202
|
-
}),
|
|
1203
|
-
if (!i || typeof i != "string")
|
|
1204
|
-
return;
|
|
1205
|
-
const e = at(i);
|
|
1206
|
-
if (o.includes(e))
|
|
1414
|
+
}), tn = (s) => (i) => {
|
|
1415
|
+
if (!(!i || typeof i != "string") && s.includes(i.trim()))
|
|
1207
1416
|
return "This name is already taken.";
|
|
1208
|
-
},
|
|
1417
|
+
}, nn = (s, i) => {
|
|
1209
1418
|
const e = [
|
|
1210
|
-
new
|
|
1419
|
+
new he({
|
|
1211
1420
|
label: "Label",
|
|
1212
1421
|
required: !0,
|
|
1213
|
-
maxLength:
|
|
1422
|
+
maxLength: 200,
|
|
1214
1423
|
identifier: "label",
|
|
1215
|
-
fieldValidators: [
|
|
1424
|
+
fieldValidators: [tn(s)]
|
|
1216
1425
|
}),
|
|
1217
|
-
new
|
|
1426
|
+
new pe({
|
|
1218
1427
|
label: "Description",
|
|
1219
1428
|
required: !1,
|
|
1220
1429
|
maxLength: 1e3,
|
|
@@ -1223,132 +1432,132 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1223
1432
|
];
|
|
1224
1433
|
return i === "section" ? e : [
|
|
1225
1434
|
...e,
|
|
1226
|
-
new
|
|
1435
|
+
new ce({ label: "Required", description: null, required: !1, identifier: "required" })
|
|
1227
1436
|
];
|
|
1228
|
-
},
|
|
1229
|
-
const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField:
|
|
1230
|
-
const
|
|
1231
|
-
(h) => h.type === "section" ? [...h.fields.map((
|
|
1232
|
-
).filter((h) => h !== (
|
|
1233
|
-
let
|
|
1234
|
-
if (l ===
|
|
1437
|
+
}, rn = T(function(i) {
|
|
1438
|
+
const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: a } = i, l = Lt[e], c = ue(), f = C(() => {
|
|
1439
|
+
const d = c.values.fields.flatMap(
|
|
1440
|
+
(h) => h.type === "section" ? [...h.fields.map((p) => p.label), h.label] : h.label
|
|
1441
|
+
).filter((h) => h !== (o == null ? void 0 : o.label) && h !== null);
|
|
1442
|
+
let u = nn(d, e);
|
|
1443
|
+
if (l === G) {
|
|
1235
1444
|
if (a === void 0)
|
|
1236
1445
|
throw new Error("Conditional source fields must be provided when changing sections.");
|
|
1237
|
-
|
|
1446
|
+
u = u.concat(l.getFieldCreationSchema(a));
|
|
1238
1447
|
} else {
|
|
1239
|
-
if (!(l.prototype instanceof
|
|
1448
|
+
if (!(l.prototype instanceof M))
|
|
1240
1449
|
throw new Error(`Field must be an instance of BaseField. Got ${l}.`);
|
|
1241
|
-
|
|
1450
|
+
u = [...u, ...l.getFieldCreationSchema()];
|
|
1242
1451
|
}
|
|
1243
1452
|
return {
|
|
1244
|
-
fields:
|
|
1453
|
+
fields: u,
|
|
1245
1454
|
meta: { readonly: !1 },
|
|
1246
1455
|
// using the dialog title as the form title
|
|
1247
1456
|
title: null
|
|
1248
1457
|
};
|
|
1249
|
-
}, [c.values.fields, e, l,
|
|
1458
|
+
}, [c.values.fields, e, l, o == null ? void 0 : o.label, a]);
|
|
1250
1459
|
return /* @__PURE__ */ r(
|
|
1251
|
-
|
|
1460
|
+
tt,
|
|
1252
1461
|
{
|
|
1253
1462
|
schema: f,
|
|
1254
|
-
values:
|
|
1463
|
+
values: o,
|
|
1255
1464
|
onSubmit: n,
|
|
1256
|
-
cancelText:
|
|
1465
|
+
cancelText: o ? void 0 : "Back",
|
|
1257
1466
|
onCancel: t
|
|
1258
1467
|
}
|
|
1259
1468
|
);
|
|
1260
|
-
}),
|
|
1261
|
-
const { parentPath: e, index: t, children: n, initial:
|
|
1262
|
-
if (a && !
|
|
1469
|
+
}), Ae = T(function(i) {
|
|
1470
|
+
const { parentPath: e, index: t, children: n, initial: o, editing: a, conditionalSourceFields: l } = i, [c, f] = le(), d = (o == null ? void 0 : o.type) ?? c, u = d ? Lt[d].fieldTypeName : void 0, { setFieldValue: h, values: p } = ue();
|
|
1471
|
+
if (a && !o)
|
|
1263
1472
|
throw new Error("Initial field must be provided if editing is true.");
|
|
1264
|
-
const g = !
|
|
1265
|
-
f(void 0),
|
|
1266
|
-
}, []),
|
|
1267
|
-
(
|
|
1268
|
-
const { label:
|
|
1269
|
-
if (!
|
|
1473
|
+
const g = !d && !a && !o, I = g ? "Choose a field type" : `${u} settings`, S = 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 = z(() => f(void 0), []), w = z((x) => {
|
|
1474
|
+
f(void 0), x();
|
|
1475
|
+
}, []), A = z(
|
|
1476
|
+
(x, V) => {
|
|
1477
|
+
const { label: $ } = x;
|
|
1478
|
+
if (!d)
|
|
1270
1479
|
throw new Error("Field type must be selected before creating a field.");
|
|
1271
|
-
if (
|
|
1480
|
+
if (!$ || typeof $ != "string")
|
|
1272
1481
|
throw new Error("Label must be provided before creating a field.");
|
|
1273
|
-
const
|
|
1274
|
-
type:
|
|
1275
|
-
...
|
|
1276
|
-
identifier:
|
|
1277
|
-
}).serialize(),
|
|
1278
|
-
if (
|
|
1482
|
+
const H = De({
|
|
1483
|
+
type: d,
|
|
1484
|
+
...x,
|
|
1485
|
+
identifier: ki(x.identifier, $)
|
|
1486
|
+
}).serialize(), R = ae(p, e);
|
|
1487
|
+
if (R === void 0)
|
|
1279
1488
|
throw new Error("Parent path must point to an existing field.");
|
|
1280
|
-
let
|
|
1281
|
-
if (!Array.isArray(
|
|
1489
|
+
let E;
|
|
1490
|
+
if (!Array.isArray(R))
|
|
1282
1491
|
throw new Error("Parent path must point to an array.");
|
|
1283
|
-
a ?
|
|
1492
|
+
a ? E = Vi(R, t, H) : E = xt(R, t, H), h(e, E).then(), V();
|
|
1284
1493
|
},
|
|
1285
|
-
[a,
|
|
1286
|
-
),
|
|
1287
|
-
(
|
|
1288
|
-
|
|
1494
|
+
[a, d, p, e, h, t]
|
|
1495
|
+
), L = z(
|
|
1496
|
+
(x) => g ? /* @__PURE__ */ r(en, { setFieldType: f }) : /* @__PURE__ */ r(
|
|
1497
|
+
rn,
|
|
1289
1498
|
{
|
|
1290
1499
|
conditionalSourceFields: l,
|
|
1291
|
-
handleCancel:
|
|
1292
|
-
handleCreateField: (
|
|
1293
|
-
fieldType:
|
|
1294
|
-
defaultField:
|
|
1500
|
+
handleCancel: F,
|
|
1501
|
+
handleCreateField: (V) => A(V, x),
|
|
1502
|
+
fieldType: d,
|
|
1503
|
+
defaultField: o
|
|
1295
1504
|
}
|
|
1296
1505
|
),
|
|
1297
|
-
[l,
|
|
1506
|
+
[l, F, A, o, g, d]
|
|
1298
1507
|
);
|
|
1299
|
-
return /* @__PURE__ */ r(
|
|
1300
|
-
}),
|
|
1301
|
-
initial:
|
|
1302
|
-
sm:
|
|
1303
|
-
}),
|
|
1304
|
-
const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps:
|
|
1508
|
+
return /* @__PURE__ */ r(ti, { onCloseInterrupt: w, title: I, description: S, content: L, children: n });
|
|
1509
|
+
}), st = ({ children: s }) => /* @__PURE__ */ r(dt, { children: s }), lt = (s, i) => ({
|
|
1510
|
+
initial: s ? i : "none",
|
|
1511
|
+
sm: s ? "none" : i
|
|
1512
|
+
}), Vt = T(function(i) {
|
|
1513
|
+
const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o } = i, a = C(
|
|
1305
1514
|
() => [
|
|
1306
1515
|
{
|
|
1307
|
-
Wrapper:
|
|
1516
|
+
Wrapper: Ae,
|
|
1308
1517
|
wrapperProps: n,
|
|
1309
|
-
Icon:
|
|
1518
|
+
Icon: ii,
|
|
1310
1519
|
text: "Edit"
|
|
1311
1520
|
},
|
|
1312
1521
|
{
|
|
1313
|
-
Icon:
|
|
1522
|
+
Icon: ni,
|
|
1314
1523
|
buttonProps: {
|
|
1315
1524
|
onClick: e
|
|
1316
1525
|
},
|
|
1317
1526
|
text: "Delete"
|
|
1318
1527
|
},
|
|
1319
1528
|
{
|
|
1320
|
-
Wrapper:
|
|
1321
|
-
wrapperProps:
|
|
1322
|
-
Icon:
|
|
1529
|
+
Wrapper: Ae,
|
|
1530
|
+
wrapperProps: o,
|
|
1531
|
+
Icon: Le,
|
|
1323
1532
|
text: "Add after"
|
|
1324
1533
|
},
|
|
1325
1534
|
{
|
|
1326
1535
|
// Wrapping icon in a div so that the asChild turns the button into a div
|
|
1327
1536
|
// so that the drag handle props are not applied to the icon
|
|
1328
1537
|
// Note: b/c the <button> does not handle the space-press event correctly
|
|
1329
|
-
Icon: (l) => /* @__PURE__ */ r("div", { ...l, children: /* @__PURE__ */ r(
|
|
1538
|
+
Icon: (l) => /* @__PURE__ */ r("div", { ...l, children: /* @__PURE__ */ r(ri, {}) }),
|
|
1330
1539
|
text: "Reorder",
|
|
1331
1540
|
disableOnMobile: !0,
|
|
1332
1541
|
buttonProps: { ...t, asChild: !0 }
|
|
1333
1542
|
}
|
|
1334
1543
|
],
|
|
1335
|
-
[t, n,
|
|
1544
|
+
[t, n, o, e]
|
|
1336
1545
|
);
|
|
1337
|
-
return /* @__PURE__ */ b(
|
|
1338
|
-
/* @__PURE__ */ r(v, { gap: "4", display:
|
|
1339
|
-
const c = l.Wrapper ??
|
|
1340
|
-
return /* @__PURE__ */ r(c, { ...l.wrapperProps, children: /* @__PURE__ */ r(
|
|
1546
|
+
return /* @__PURE__ */ b(dt, { children: [
|
|
1547
|
+
/* @__PURE__ */ r(v, { gap: "4", display: lt(!1, "flex"), children: a.map((l) => {
|
|
1548
|
+
const c = l.Wrapper ?? st;
|
|
1549
|
+
return /* @__PURE__ */ r(c, { ...l.wrapperProps, children: /* @__PURE__ */ r(se, { type: "button", variant: "ghost", "aria-label": l.text, ...l.buttonProps, children: /* @__PURE__ */ r(l.Icon, {}) }) }, l.text);
|
|
1341
1550
|
}) }),
|
|
1342
|
-
/* @__PURE__ */ r(
|
|
1343
|
-
|
|
1551
|
+
/* @__PURE__ */ r(me, { display: lt(!0, "block"), children: /* @__PURE__ */ r(
|
|
1552
|
+
oi,
|
|
1344
1553
|
{
|
|
1345
|
-
trigger: /* @__PURE__ */ r(
|
|
1554
|
+
trigger: /* @__PURE__ */ r(se, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(si, {}) }),
|
|
1346
1555
|
closeOnSelect: !1,
|
|
1347
1556
|
items: a.map((l) => {
|
|
1348
1557
|
var f;
|
|
1349
1558
|
if (l.disableOnMobile)
|
|
1350
1559
|
return null;
|
|
1351
|
-
const c = l.Wrapper ??
|
|
1560
|
+
const c = l.Wrapper ?? st;
|
|
1352
1561
|
return {
|
|
1353
1562
|
...l.buttonProps,
|
|
1354
1563
|
onSelect: (f = l.buttonProps) == null ? void 0 : f.onClick,
|
|
@@ -1361,8 +1570,8 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1361
1570
|
}
|
|
1362
1571
|
) })
|
|
1363
1572
|
] });
|
|
1364
|
-
}),
|
|
1365
|
-
const { field: e, index: t, sectionIndex: n, remove:
|
|
1573
|
+
}), _e = "form-builder", on = T(function(i) {
|
|
1574
|
+
const { field: e, index: t, sectionIndex: n, remove: o } = i, a = C(() => De(e), [e]), l = ze(a, { formId: _e, disabled: !0 }), c = C(
|
|
1366
1575
|
() => ({
|
|
1367
1576
|
index: t,
|
|
1368
1577
|
parentPath: `fields.${n}.fields`,
|
|
@@ -1370,7 +1579,7 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1370
1579
|
editing: !0
|
|
1371
1580
|
}),
|
|
1372
1581
|
[e, t, n]
|
|
1373
|
-
), f =
|
|
1582
|
+
), f = C(
|
|
1374
1583
|
() => ({
|
|
1375
1584
|
parentPath: `fields.${n}.fields`,
|
|
1376
1585
|
index: t + 1,
|
|
@@ -1378,63 +1587,63 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1378
1587
|
}),
|
|
1379
1588
|
[t, n]
|
|
1380
1589
|
);
|
|
1381
|
-
return /* @__PURE__ */ r(
|
|
1382
|
-
|
|
1590
|
+
return /* @__PURE__ */ r(Ye, { draggableId: e.identifier, index: t, children: (d) => /* @__PURE__ */ r(
|
|
1591
|
+
ge,
|
|
1383
1592
|
{
|
|
1384
|
-
ref:
|
|
1385
|
-
...
|
|
1386
|
-
...
|
|
1593
|
+
ref: d.innerRef,
|
|
1594
|
+
...d.draggableProps,
|
|
1595
|
+
...d.dragHandleProps,
|
|
1387
1596
|
mb: "4",
|
|
1388
1597
|
children: /* @__PURE__ */ b(v, { gap: "4", justify: "between", align: "center", children: [
|
|
1389
1598
|
l,
|
|
1390
1599
|
/* @__PURE__ */ r(
|
|
1391
|
-
|
|
1600
|
+
Vt,
|
|
1392
1601
|
{
|
|
1393
|
-
remove:
|
|
1602
|
+
remove: o,
|
|
1394
1603
|
editProps: c,
|
|
1395
1604
|
insertAfterProps: f,
|
|
1396
|
-
dragHandleProps:
|
|
1605
|
+
dragHandleProps: d.dragHandleProps
|
|
1397
1606
|
}
|
|
1398
1607
|
)
|
|
1399
1608
|
] })
|
|
1400
1609
|
}
|
|
1401
1610
|
) });
|
|
1402
|
-
}),
|
|
1403
|
-
var
|
|
1404
|
-
const { field: e, index: t, dropState: n } = i,
|
|
1405
|
-
(
|
|
1406
|
-
for (const
|
|
1407
|
-
const
|
|
1408
|
-
a(`fields.${
|
|
1611
|
+
}), sn = T(function(i) {
|
|
1612
|
+
var A, L, x, V, $, H, R;
|
|
1613
|
+
const { field: e, index: t, dropState: n } = i, o = (A = n[e.identifier]) == null ? void 0 : A.disabled, { setFieldValue: a, values: l } = ue(), c = li(), f = z(
|
|
1614
|
+
(E, y) => {
|
|
1615
|
+
for (const P of E) {
|
|
1616
|
+
const k = y.indexOf(P);
|
|
1617
|
+
a(`fields.${k}.condition`, null).then(), a(`fields.${k}.conditional`, !1).then();
|
|
1409
1618
|
}
|
|
1410
1619
|
},
|
|
1411
1620
|
[a]
|
|
1412
|
-
),
|
|
1413
|
-
(
|
|
1414
|
-
var
|
|
1415
|
-
const
|
|
1416
|
-
if (!
|
|
1621
|
+
), d = z(
|
|
1622
|
+
(E) => {
|
|
1623
|
+
var k;
|
|
1624
|
+
const y = e.fields[E];
|
|
1625
|
+
if (!y)
|
|
1417
1626
|
throw new Error("Could not find field to remove.");
|
|
1418
|
-
const
|
|
1627
|
+
const P = [];
|
|
1419
1628
|
for (const N of l.fields)
|
|
1420
|
-
((
|
|
1629
|
+
((k = N.condition) == null ? void 0 : k.identifier) === y.identifier && P.push(N);
|
|
1421
1630
|
return {
|
|
1422
|
-
removing:
|
|
1423
|
-
affectedSections:
|
|
1424
|
-
action: () => a(`fields.${t}.fields`,
|
|
1631
|
+
removing: y,
|
|
1632
|
+
affectedSections: P,
|
|
1633
|
+
action: () => a(`fields.${t}.fields`, Ie(e.fields, E))
|
|
1425
1634
|
};
|
|
1426
1635
|
},
|
|
1427
1636
|
[e.fields, l.fields, a, t]
|
|
1428
|
-
),
|
|
1429
|
-
(
|
|
1430
|
-
const { affectedSections:
|
|
1431
|
-
|
|
1637
|
+
), u = z(
|
|
1638
|
+
(E) => {
|
|
1639
|
+
const { affectedSections: y, action: P, removing: k } = d(E), N = () => {
|
|
1640
|
+
P().then(), f(y, l.fields);
|
|
1432
1641
|
};
|
|
1433
|
-
if (
|
|
1434
|
-
const
|
|
1642
|
+
if (y.length > 0) {
|
|
1643
|
+
const fe = y.map((K) => K.label).join(", ");
|
|
1435
1644
|
return c({
|
|
1436
1645
|
title: "Remove condition?",
|
|
1437
|
-
description: `${
|
|
1646
|
+
description: `${k.label} is being used as a condition, deleting it will remove the condition from the ${fe} section(s).`,
|
|
1438
1647
|
severity: "danger",
|
|
1439
1648
|
actionText: "Remove",
|
|
1440
1649
|
onAction: N
|
|
@@ -1442,103 +1651,106 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1442
1651
|
}
|
|
1443
1652
|
N();
|
|
1444
1653
|
},
|
|
1445
|
-
[
|
|
1446
|
-
), h =
|
|
1447
|
-
const
|
|
1448
|
-
if (
|
|
1654
|
+
[d, f, l.fields, c]
|
|
1655
|
+
), h = z(() => {
|
|
1656
|
+
const y = e.fields.map((ve, kt) => d(kt)).flatMap((ve) => ve.affectedSections), P = y.length ? "Remove fields and conditions?" : "Remove fields?", k = e.fields.length, N = y.map((ve) => ve.label).join(", "), fe = y.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.`, K = Ie(l.fields, t), it = () => a("fields", K);
|
|
1657
|
+
if (y.length > 0)
|
|
1449
1658
|
return c({
|
|
1450
|
-
title:
|
|
1451
|
-
description:
|
|
1659
|
+
title: P,
|
|
1660
|
+
description: fe,
|
|
1452
1661
|
severity: "danger",
|
|
1453
1662
|
actionText: "Remove",
|
|
1454
1663
|
onAction: () => {
|
|
1455
|
-
|
|
1456
|
-
f(
|
|
1664
|
+
it().then(() => {
|
|
1665
|
+
f(y, K);
|
|
1457
1666
|
});
|
|
1458
1667
|
}
|
|
1459
1668
|
});
|
|
1460
|
-
|
|
1669
|
+
it().then();
|
|
1461
1670
|
}, [
|
|
1462
1671
|
e.fields,
|
|
1463
1672
|
l.fields,
|
|
1464
1673
|
t,
|
|
1465
|
-
|
|
1674
|
+
d,
|
|
1466
1675
|
a,
|
|
1467
1676
|
c,
|
|
1468
1677
|
f
|
|
1469
|
-
]),
|
|
1678
|
+
]), p = C(
|
|
1470
1679
|
() => ({
|
|
1471
1680
|
index: t,
|
|
1472
1681
|
parentPath: "fields",
|
|
1473
1682
|
initial: e,
|
|
1474
1683
|
editing: !0,
|
|
1475
|
-
conditionalSourceFields:
|
|
1684
|
+
conditionalSourceFields: Be(l.fields, t)
|
|
1476
1685
|
}),
|
|
1477
1686
|
[e, t, l.fields]
|
|
1478
|
-
), g =
|
|
1687
|
+
), g = C(
|
|
1479
1688
|
() => ({
|
|
1480
1689
|
index: t + 1,
|
|
1481
1690
|
parentPath: "fields",
|
|
1482
|
-
initial:
|
|
1483
|
-
conditionalSourceFields:
|
|
1691
|
+
initial: xe(),
|
|
1692
|
+
conditionalSourceFields: Be(l.fields, t + 1)
|
|
1484
1693
|
}),
|
|
1485
1694
|
[t, l.fields]
|
|
1486
|
-
),
|
|
1695
|
+
), I = C(
|
|
1487
1696
|
() => ({
|
|
1488
1697
|
parentPath: `fields.${t}.fields`,
|
|
1489
1698
|
index: e.fields.length,
|
|
1490
1699
|
initial: void 0
|
|
1491
1700
|
}),
|
|
1492
1701
|
[e.fields.length, t]
|
|
1493
|
-
),
|
|
1702
|
+
), S = C(
|
|
1494
1703
|
() => {
|
|
1495
|
-
var
|
|
1496
|
-
return (
|
|
1704
|
+
var E, y;
|
|
1705
|
+
return (y = It(l.fields, (E = e.condition) == null ? void 0 : E.identifier)) == null ? void 0 : y.label;
|
|
1497
1706
|
},
|
|
1498
|
-
[(
|
|
1499
|
-
),
|
|
1500
|
-
|
|
1501
|
-
|
|
1707
|
+
[(L = e.condition) == null ? void 0 : L.identifier, l.fields]
|
|
1708
|
+
), F = Array.isArray((x = e.condition) == null ? void 0 : x.value) ? "contains all of" : "equals";
|
|
1709
|
+
if (We((V = e.condition) == null ? void 0 : V.value))
|
|
1710
|
+
throw new Error("File values are not supported for conditions.");
|
|
1711
|
+
const w = Array.isArray(($ = e.condition) == null ? void 0 : $.value) ? (H = e.condition) == null ? void 0 : H.value.map((E) => typeof E == "string" ? E : E.label).join(", ") : (R = e.condition) == null ? void 0 : R.value.toString();
|
|
1712
|
+
return /* @__PURE__ */ r(Ye, { draggableId: e.identifier, index: t, children: (E) => /* @__PURE__ */ r(
|
|
1713
|
+
ge,
|
|
1502
1714
|
{
|
|
1503
|
-
ref:
|
|
1504
|
-
...
|
|
1505
|
-
...
|
|
1715
|
+
ref: E.innerRef,
|
|
1716
|
+
...E.draggableProps,
|
|
1717
|
+
...E.dragHandleProps,
|
|
1506
1718
|
mb: "4",
|
|
1507
1719
|
children: /* @__PURE__ */ b(v, { gap: "3", justify: "between", align: "center", children: [
|
|
1508
1720
|
/* @__PURE__ */ b(v, { direction: "column", gap: "2", grow: "1", children: [
|
|
1509
1721
|
/* @__PURE__ */ b(v, { direction: "column", children: [
|
|
1510
|
-
/* @__PURE__ */ r(
|
|
1511
|
-
/* @__PURE__ */ r(
|
|
1722
|
+
/* @__PURE__ */ r(Pe, { as: "h3", size: "3", children: e.label }),
|
|
1723
|
+
/* @__PURE__ */ r(D, { className: ke.description, children: e.description })
|
|
1512
1724
|
] }),
|
|
1513
|
-
e.condition && /* @__PURE__ */ r(
|
|
1725
|
+
e.condition && /* @__PURE__ */ r(D, { size: "1", children: /* @__PURE__ */ b(ai, { children: [
|
|
1514
1726
|
"Display only if ",
|
|
1515
|
-
/* @__PURE__ */ r(
|
|
1727
|
+
/* @__PURE__ */ r(nt, { children: S }),
|
|
1516
1728
|
" ",
|
|
1517
|
-
|
|
1729
|
+
F,
|
|
1518
1730
|
" ",
|
|
1519
|
-
/* @__PURE__ */ r(
|
|
1731
|
+
/* @__PURE__ */ r(nt, { children: w })
|
|
1520
1732
|
] }) }),
|
|
1521
|
-
/* @__PURE__ */ r(
|
|
1733
|
+
/* @__PURE__ */ r(Ke, { droppableId: e.identifier, type: "SECTION", isDropDisabled: o, children: (y) => /* @__PURE__ */ b(
|
|
1522
1734
|
v,
|
|
1523
1735
|
{
|
|
1524
|
-
ref:
|
|
1525
|
-
...
|
|
1736
|
+
ref: y.innerRef,
|
|
1737
|
+
...y.droppableProps,
|
|
1526
1738
|
direction: "column",
|
|
1527
1739
|
gap: "0",
|
|
1528
1740
|
children: [
|
|
1529
|
-
e.fields.map((
|
|
1530
|
-
|
|
1741
|
+
e.fields.map((P, k) => /* @__PURE__ */ r(
|
|
1742
|
+
on,
|
|
1531
1743
|
{
|
|
1532
|
-
field:
|
|
1533
|
-
index:
|
|
1744
|
+
field: P,
|
|
1745
|
+
index: k,
|
|
1534
1746
|
sectionIndex: t,
|
|
1535
|
-
remove: () =>
|
|
1747
|
+
remove: () => u(k)
|
|
1536
1748
|
},
|
|
1537
|
-
|
|
1749
|
+
P.identifier
|
|
1538
1750
|
)),
|
|
1539
|
-
|
|
1540
|
-
/* @__PURE__ */ r(
|
|
1541
|
-
/* @__PURE__ */ r(
|
|
1751
|
+
y.placeholder,
|
|
1752
|
+
/* @__PURE__ */ r(Ae, { ...I, children: /* @__PURE__ */ b(j, { type: "button", variant: "outline", children: [
|
|
1753
|
+
/* @__PURE__ */ r(Le, {}),
|
|
1542
1754
|
" Add a field"
|
|
1543
1755
|
] }) })
|
|
1544
1756
|
]
|
|
@@ -1546,20 +1758,20 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1546
1758
|
) })
|
|
1547
1759
|
] }),
|
|
1548
1760
|
/* @__PURE__ */ r(
|
|
1549
|
-
|
|
1761
|
+
Vt,
|
|
1550
1762
|
{
|
|
1551
1763
|
remove: h,
|
|
1552
1764
|
insertAfterProps: g,
|
|
1553
|
-
dragHandleProps:
|
|
1554
|
-
editProps:
|
|
1765
|
+
dragHandleProps: E.dragHandleProps,
|
|
1766
|
+
editProps: p
|
|
1555
1767
|
}
|
|
1556
1768
|
)
|
|
1557
1769
|
] })
|
|
1558
1770
|
}
|
|
1559
1771
|
) });
|
|
1560
|
-
}),
|
|
1772
|
+
}), ln = (s, i) => {
|
|
1561
1773
|
var t;
|
|
1562
|
-
const e = { ...
|
|
1774
|
+
const e = { ...s };
|
|
1563
1775
|
switch (i.type) {
|
|
1564
1776
|
case "release":
|
|
1565
1777
|
for (const n in e)
|
|
@@ -1572,95 +1784,95 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1572
1784
|
case "update":
|
|
1573
1785
|
return i.state;
|
|
1574
1786
|
}
|
|
1575
|
-
},
|
|
1787
|
+
}, an = (s, i) => {
|
|
1576
1788
|
if (i)
|
|
1577
|
-
for (let e = 0; e <
|
|
1578
|
-
const t =
|
|
1789
|
+
for (let e = 0; e < s.length; e++) {
|
|
1790
|
+
const t = s[e];
|
|
1579
1791
|
if (t) {
|
|
1580
1792
|
for (const n of t.fields)
|
|
1581
1793
|
if (n.identifier === i)
|
|
1582
1794
|
return e;
|
|
1583
1795
|
}
|
|
1584
1796
|
}
|
|
1585
|
-
},
|
|
1797
|
+
}, at = (s) => {
|
|
1586
1798
|
var e, t, n;
|
|
1587
1799
|
const i = {};
|
|
1588
|
-
for (let
|
|
1589
|
-
const a = o
|
|
1800
|
+
for (let o = 0; o < s.length; o++) {
|
|
1801
|
+
const a = s[o];
|
|
1590
1802
|
if (!a)
|
|
1591
1803
|
throw new Error("Field is undefined.");
|
|
1592
|
-
const l =
|
|
1804
|
+
const l = o > 0 ? (e = i[s[o - 1].identifier]) == null ? void 0 : e.conditionFields : void 0, c = new Set(l);
|
|
1593
1805
|
(t = a.condition) != null && t.identifier && c.add(a.condition.identifier), i[a.identifier] = {
|
|
1594
1806
|
disabled: !1,
|
|
1595
1807
|
conditionFields: c,
|
|
1596
|
-
conditionIndex:
|
|
1597
|
-
index:
|
|
1808
|
+
conditionIndex: an(s, (n = a.condition) == null ? void 0 : n.identifier),
|
|
1809
|
+
index: o,
|
|
1598
1810
|
label: a.label
|
|
1599
1811
|
};
|
|
1600
1812
|
}
|
|
1601
1813
|
return i;
|
|
1602
|
-
},
|
|
1603
|
-
for (const [e, t] of Object.entries(
|
|
1814
|
+
}, ct = (s, i) => {
|
|
1815
|
+
for (const [e, t] of Object.entries(s))
|
|
1604
1816
|
if (t.identifier === i)
|
|
1605
1817
|
return [t, e];
|
|
1606
|
-
},
|
|
1607
|
-
const { values: i, setFieldValue: e } =
|
|
1608
|
-
|
|
1609
|
-
n({ type: "update", state:
|
|
1818
|
+
}, cn = T(function() {
|
|
1819
|
+
const { values: i, setFieldValue: e } = ue(), [t, n] = fi(ln, i.fields, at), { showInfo: o } = ci();
|
|
1820
|
+
be(() => {
|
|
1821
|
+
n({ type: "update", state: at(i.fields) });
|
|
1610
1822
|
}, [n, i.fields]);
|
|
1611
|
-
const a =
|
|
1823
|
+
const a = z((f) => {
|
|
1612
1824
|
f.type === "SECTION" && n({ type: "hold", fieldId: f.draggableId });
|
|
1613
|
-
}, []), l =
|
|
1825
|
+
}, []), l = z(
|
|
1614
1826
|
(f) => {
|
|
1615
|
-
const { source:
|
|
1616
|
-
if (n({ type: "release" }), !
|
|
1827
|
+
const { source: d, destination: u, type: h, reason: p, draggableId: g } = f;
|
|
1828
|
+
if (n({ type: "release" }), !u || p === "CANCEL")
|
|
1617
1829
|
return;
|
|
1618
1830
|
if (h === "ROOT") {
|
|
1619
|
-
const
|
|
1620
|
-
if (!
|
|
1831
|
+
const A = t[g];
|
|
1832
|
+
if (!A)
|
|
1621
1833
|
throw new Error("Could not find section context.");
|
|
1622
|
-
let
|
|
1834
|
+
let L = typeof A.conditionIndex < "u" ? (
|
|
1623
1835
|
// cannot move a section with a condition before the condition's field
|
|
1624
|
-
Math.max(
|
|
1625
|
-
) :
|
|
1626
|
-
for (const
|
|
1627
|
-
|
|
1628
|
-
return
|
|
1836
|
+
Math.max(A.conditionIndex + 1, u.index)
|
|
1837
|
+
) : u.index;
|
|
1838
|
+
for (const x of Object.values(t))
|
|
1839
|
+
x.conditionIndex === d.index && (L = Math.min(L, x.index - 1));
|
|
1840
|
+
return L != u.index && o({
|
|
1629
1841
|
title: "Reordered sections",
|
|
1630
1842
|
description: "Sections with conditions must be below the fields they reference."
|
|
1631
|
-
}), e("fields",
|
|
1843
|
+
}), e("fields", Ne(i.fields, d.index, L));
|
|
1632
1844
|
}
|
|
1633
1845
|
if (h !== "SECTION")
|
|
1634
1846
|
throw new Error("Unexpected droppable type.");
|
|
1635
|
-
const [
|
|
1636
|
-
if (!(
|
|
1847
|
+
const [I, S] = ct(i.fields, d.droppableId) ?? [], [F, w] = ct(i.fields, u.droppableId) ?? [];
|
|
1848
|
+
if (!(I != null && I.fields) || !F)
|
|
1637
1849
|
throw new Error("Could not find section with fields.");
|
|
1638
|
-
if (
|
|
1850
|
+
if (I.identifier === F.identifier)
|
|
1639
1851
|
e(
|
|
1640
|
-
`fields.${
|
|
1641
|
-
|
|
1852
|
+
`fields.${S}.fields`,
|
|
1853
|
+
Ne(I.fields, d.index, u.index)
|
|
1642
1854
|
).then();
|
|
1643
1855
|
else {
|
|
1644
|
-
const
|
|
1645
|
-
if (!
|
|
1856
|
+
const A = I.fields[d.index];
|
|
1857
|
+
if (!A)
|
|
1646
1858
|
throw new Error("Could not find field to reorder.");
|
|
1647
|
-
e(`fields.${
|
|
1648
|
-
`fields.${
|
|
1649
|
-
|
|
1859
|
+
e(`fields.${S}.fields`, Ie(I.fields, d.index)).then(), e(
|
|
1860
|
+
`fields.${w}.fields`,
|
|
1861
|
+
xt(F.fields, u.index, A)
|
|
1650
1862
|
).then();
|
|
1651
1863
|
}
|
|
1652
1864
|
},
|
|
1653
|
-
[i.fields, e, t,
|
|
1654
|
-
), c =
|
|
1865
|
+
[i.fields, e, t, o]
|
|
1866
|
+
), c = C(
|
|
1655
1867
|
() => ({
|
|
1656
1868
|
index: i.fields.length,
|
|
1657
1869
|
parentPath: "fields",
|
|
1658
|
-
initial:
|
|
1659
|
-
conditionalSourceFields:
|
|
1870
|
+
initial: xe(),
|
|
1871
|
+
conditionalSourceFields: Be(i.fields, i.fields.length)
|
|
1660
1872
|
}),
|
|
1661
1873
|
[i.fields]
|
|
1662
1874
|
);
|
|
1663
|
-
return /* @__PURE__ */ r(
|
|
1875
|
+
return /* @__PURE__ */ r(ht, { onDragStart: a, onDragEnd: l, children: /* @__PURE__ */ r(Ke, { droppableId: "droppable", type: "ROOT", children: (f) => /* @__PURE__ */ b(
|
|
1664
1876
|
v,
|
|
1665
1877
|
{
|
|
1666
1878
|
ref: f.innerRef,
|
|
@@ -1668,66 +1880,66 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1668
1880
|
direction: "column",
|
|
1669
1881
|
gap: "0",
|
|
1670
1882
|
children: [
|
|
1671
|
-
i.fields.map((
|
|
1672
|
-
|
|
1883
|
+
i.fields.map((d, u) => /* @__PURE__ */ r(
|
|
1884
|
+
sn,
|
|
1673
1885
|
{
|
|
1674
|
-
field:
|
|
1675
|
-
index:
|
|
1886
|
+
field: d,
|
|
1887
|
+
index: u,
|
|
1676
1888
|
dropState: t
|
|
1677
1889
|
},
|
|
1678
|
-
|
|
1890
|
+
d.label
|
|
1679
1891
|
)),
|
|
1680
1892
|
f.placeholder,
|
|
1681
|
-
/* @__PURE__ */ r(
|
|
1682
|
-
/* @__PURE__ */ r(
|
|
1893
|
+
/* @__PURE__ */ r(Ae, { ...c, children: /* @__PURE__ */ b(j, { type: "button", variant: "outline", children: [
|
|
1894
|
+
/* @__PURE__ */ r(Le, {}),
|
|
1683
1895
|
" Add a section"
|
|
1684
1896
|
] }) })
|
|
1685
1897
|
]
|
|
1686
1898
|
}
|
|
1687
1899
|
) }) });
|
|
1688
|
-
}),
|
|
1900
|
+
}), dn = {
|
|
1689
1901
|
title: "",
|
|
1690
1902
|
description: "",
|
|
1691
1903
|
fields: []
|
|
1692
|
-
},
|
|
1904
|
+
}, un = new he({
|
|
1693
1905
|
label: "Title",
|
|
1694
1906
|
minLength: 0,
|
|
1695
1907
|
maxLength: 100,
|
|
1696
1908
|
required: !0,
|
|
1697
1909
|
identifier: "title"
|
|
1698
|
-
}),
|
|
1910
|
+
}), fn = { formId: _e, placeholder: "Give your form a title." }, mn = new pe({
|
|
1699
1911
|
label: "Description",
|
|
1700
1912
|
minLength: 0,
|
|
1701
1913
|
maxLength: 1e3,
|
|
1702
1914
|
required: !1,
|
|
1703
1915
|
identifier: "description"
|
|
1704
|
-
}),
|
|
1916
|
+
}), hn = { formId: _e, placeholder: "Explain the purpose of this form." }, pn = () => {
|
|
1705
1917
|
alert("This is a form preview, your data will not be saved.");
|
|
1706
|
-
},
|
|
1707
|
-
|
|
1708
|
-
const { onCancel: e, onSave: t, revision: n } =
|
|
1918
|
+
}, Ln = T(
|
|
1919
|
+
ye((s, i) => {
|
|
1920
|
+
const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: a = o } = s, l = z((p) => {
|
|
1709
1921
|
const g = {};
|
|
1710
|
-
if (
|
|
1922
|
+
if (p.title || (g.title = "Title is required."), (!p.fields || p.fields.length === 0) && (g.fields = "At least one field is required."), Ee(g))
|
|
1711
1923
|
return g;
|
|
1712
|
-
}, []), c =
|
|
1713
|
-
initialValues:
|
|
1924
|
+
}, []), c = Ue({
|
|
1925
|
+
initialValues: Pi(n) ?? dn,
|
|
1714
1926
|
validate: l,
|
|
1715
|
-
onSubmit: (
|
|
1927
|
+
onSubmit: (p) => t(p),
|
|
1716
1928
|
// only validate the entire for on submit
|
|
1717
1929
|
validateOnChange: !1,
|
|
1718
1930
|
validateOnBlur: !1
|
|
1719
|
-
}), f =
|
|
1720
|
-
() => typeof a == "object" ? a : /* @__PURE__ */ r(
|
|
1931
|
+
}), f = C(() => Tt(c.values), [c.values]), d = ze(un, fn), u = ze(mn, hn), h = C(
|
|
1932
|
+
() => typeof a == "object" ? a : /* @__PURE__ */ r(Pe, { children: a }),
|
|
1721
1933
|
[a]
|
|
1722
1934
|
);
|
|
1723
|
-
return /* @__PURE__ */ r(
|
|
1724
|
-
/* @__PURE__ */ b(
|
|
1725
|
-
/* @__PURE__ */ r(
|
|
1726
|
-
/* @__PURE__ */ r(
|
|
1935
|
+
return /* @__PURE__ */ r(Y.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ b(v, { direction: "column", gap: "2", children: [
|
|
1936
|
+
/* @__PURE__ */ b(Y.List, { children: [
|
|
1937
|
+
/* @__PURE__ */ r(Y.Trigger, { value: "edit", children: "Edit" }),
|
|
1938
|
+
/* @__PURE__ */ r(Y.Trigger, { value: "preview", children: "Preview" })
|
|
1727
1939
|
] }),
|
|
1728
|
-
/* @__PURE__ */ b(
|
|
1940
|
+
/* @__PURE__ */ b(Y.Content, { value: "edit", children: [
|
|
1729
1941
|
h,
|
|
1730
|
-
/* @__PURE__ */ b(
|
|
1942
|
+
/* @__PURE__ */ b(D, { children: [
|
|
1731
1943
|
"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",
|
|
1732
1944
|
" ",
|
|
1733
1945
|
/* @__PURE__ */ r("em", { children: "Preview" }),
|
|
@@ -1735,52 +1947,53 @@ const Ce = (o, i) => T(() => !i || !o ? null : o.getInput(i), [o, i]), wt = (o,
|
|
|
1735
1947
|
" ",
|
|
1736
1948
|
/* @__PURE__ */ r("strong", { children: "field values entered on this page will not be saved." })
|
|
1737
1949
|
] }),
|
|
1738
|
-
/* @__PURE__ */ r(v, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ b("form", { id:
|
|
1739
|
-
/* @__PURE__ */ b(
|
|
1740
|
-
u,
|
|
1950
|
+
/* @__PURE__ */ r(v, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ b("form", { id: _e, onSubmit: c.handleSubmit, children: [
|
|
1951
|
+
/* @__PURE__ */ b(Ge, { value: c, children: [
|
|
1741
1952
|
d,
|
|
1742
|
-
|
|
1743
|
-
/* @__PURE__ */ r(
|
|
1953
|
+
u,
|
|
1954
|
+
/* @__PURE__ */ r(cn, {}),
|
|
1955
|
+
/* @__PURE__ */ r(D, { severity: "danger", size: "1", children: typeof c.errors.fields == "string" && c.errors.fields })
|
|
1744
1956
|
] }),
|
|
1745
1957
|
/* @__PURE__ */ b(v, { justify: "end", gap: "2", children: [
|
|
1746
|
-
/* @__PURE__ */ r(
|
|
1747
|
-
/* @__PURE__ */ r(
|
|
1958
|
+
/* @__PURE__ */ r(j, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
|
|
1959
|
+
/* @__PURE__ */ r(j, { type: "submit", disabled: !c.isValid, children: "Save" })
|
|
1748
1960
|
] })
|
|
1749
1961
|
] }) })
|
|
1750
1962
|
] }),
|
|
1751
|
-
/* @__PURE__ */ r(
|
|
1963
|
+
/* @__PURE__ */ r(Y.Content, { value: "preview", children: /* @__PURE__ */ r(tt, { schema: f, onSubmit: pn }) })
|
|
1752
1964
|
] }) });
|
|
1753
1965
|
})
|
|
1754
1966
|
);
|
|
1755
1967
|
export {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1968
|
+
ce as BooleanField,
|
|
1969
|
+
Ti as BooleanInput,
|
|
1970
|
+
Re as DateField,
|
|
1971
|
+
zi as DateInput,
|
|
1972
|
+
G as FieldSection,
|
|
1973
|
+
Sn as FormBrowser,
|
|
1974
|
+
Ln as FormBuilder,
|
|
1975
|
+
tt as FormRenderer,
|
|
1976
|
+
zn as FormSubmissionBrowser,
|
|
1977
|
+
Tn as FormSubmissionViewer,
|
|
1978
|
+
Te as MultiSelectField,
|
|
1979
|
+
Mi as MultiSelectInput,
|
|
1980
|
+
Ce as MultiStringField,
|
|
1981
|
+
Di as MultiStringInput,
|
|
1982
|
+
U as NumberField,
|
|
1983
|
+
Si as NumberInput,
|
|
1984
|
+
En as PatchField,
|
|
1985
|
+
An as PatchFormProvider,
|
|
1986
|
+
Fe as SelectField,
|
|
1987
|
+
Li as SelectInput,
|
|
1988
|
+
he as StringField,
|
|
1989
|
+
Ei as StringInput,
|
|
1990
|
+
pe as TextField,
|
|
1991
|
+
Ai as TextInput,
|
|
1780
1992
|
De as deserialize,
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1993
|
+
Ft as deserializeField,
|
|
1994
|
+
Tt as formRevisionToSchema,
|
|
1995
|
+
St as isConditionMet,
|
|
1996
|
+
ze as useFieldInput,
|
|
1997
|
+
zt as useFieldInputs,
|
|
1998
|
+
We as valueIsFile
|
|
1786
1999
|
};
|