@solspace/freeform-vue 0.1.19 → 1.0.0
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/index.css +1 -1
- package/dist/index.js +509 -453
- package/dist/index.js.map +1 -1
- package/dist/renderers/builtin/CardsField.d.ts +2 -0
- package/dist/renderers/builtin/CheckboxField.d.ts +2 -0
- package/dist/renderers/builtin/CheckboxesField.d.ts +2 -0
- package/dist/renderers/builtin/ConfirmField.d.ts +2 -0
- package/dist/renderers/builtin/DatetimeField.d.ts +2 -0
- package/dist/renderers/builtin/EmailField.d.ts +2 -0
- package/dist/renderers/builtin/FileDndField.d.ts +2 -0
- package/dist/renderers/builtin/FileField.d.ts +2 -0
- package/dist/renderers/builtin/HiddenField.d.ts +2 -0
- package/dist/renderers/builtin/HtmlField.d.ts +2 -0
- package/dist/renderers/builtin/ImageField.d.ts +2 -0
- package/dist/renderers/builtin/MolliePaymentField.d.ts +2 -0
- package/dist/renderers/builtin/MultipleSelectField.d.ts +2 -0
- package/dist/renderers/builtin/NumberField.d.ts +2 -0
- package/dist/renderers/builtin/OpinionScaleField.d.ts +2 -0
- package/dist/renderers/builtin/PasswordField.d.ts +2 -0
- package/dist/renderers/builtin/PayPalPaymentField.d.ts +2 -0
- package/dist/renderers/builtin/PhoneField.d.ts +2 -0
- package/dist/renderers/builtin/RadioField.d.ts +2 -0
- package/dist/renderers/builtin/RatingField.d.ts +2 -0
- package/dist/renderers/builtin/RegexField.d.ts +2 -0
- package/dist/renderers/builtin/SelectField.d.ts +2 -0
- package/dist/renderers/builtin/SquarePaymentField.d.ts +2 -0
- package/dist/renderers/builtin/StripePaymentField.d.ts +2 -0
- package/dist/renderers/builtin/TextField.d.ts +2 -0
- package/dist/renderers/builtin/TextareaField.d.ts +2 -0
- package/dist/renderers/builtin/UnsupportedField.d.ts +2 -0
- package/dist/renderers/builtin/WebsiteField.d.ts +2 -0
- package/dist/renderers/builtin/fields.d.ts +28 -29
- package/dist/renderers/builtin/inputProps.d.ts +12 -0
- package/dist/version.d.ts +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeProps as u, normalizeClass as d, normalizeProps as f, normalizeStyle as p, onMounted as m, onScopeDispose as h, onUnmounted as g, openBlock as _, reactive as
|
|
2
|
-
import { canAddTableRow as
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeProps as u, normalizeClass as d, normalizeProps as f, normalizeStyle as p, onMounted as m, onScopeDispose as h, onUnmounted as g, openBlock as _, reactive as v, ref as y, renderList as b, renderSlot as x, resolveComponent as S, resolveDynamicComponent as C, shallowRef as w, toDisplayString as T, toValue as E, unref as D, watch as O, watchEffect as k, withCtx as A } from "vue";
|
|
2
|
+
import { canAddTableRow as j, canRemoveTableRow as M, collectExtensionSubmitMeta as ee, createFormState as N, createFreeformClient as te, emptyTableRow as ne, evaluateCalculation as P, getCalculationConfig as re, getSignatureConfig as F, getTableConfig as ie, isSignatureValueEmpty as I, normalizeTableRows as L, prepareSubmitValues as ae, resolveTableColumnOptions as R, runExtensionAfterSubmit as oe, runExtensionSetups as se } from "@solspace/freeform-core";
|
|
3
3
|
//#region src/components/FormLoader.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var z = ["data-variant"], B = {
|
|
5
5
|
key: 0,
|
|
@@ -29,7 +29,7 @@ var z = ["data-variant"], B = {
|
|
|
29
29
|
class: d(["ff-loader-root", t.loaderClass])
|
|
30
30
|
}, [t.variant === "skeleton" ? (_(), i("div", B, [
|
|
31
31
|
r[0] ||= a("div", { class: "ff-loader-line ff-loader-line--title" }, null, -1),
|
|
32
|
-
(_(), i(e, null,
|
|
32
|
+
(_(), i(e, null, b(3, (e) => a("div", {
|
|
33
33
|
key: e,
|
|
34
34
|
class: "ff-loader-field"
|
|
35
35
|
}, [a("div", {
|
|
@@ -46,9 +46,9 @@ var z = ["data-variant"], B = {
|
|
|
46
46
|
class: "ff-loader-line ff-loader-line--button",
|
|
47
47
|
style: { animationDelay: "0.36s" }
|
|
48
48
|
}, null, -1)
|
|
49
|
-
])) : (_(), i("div", ce)), a("p", le,
|
|
49
|
+
])) : (_(), i("div", ce)), a("p", le, T(t.message), 1)], 10, z));
|
|
50
50
|
}
|
|
51
|
-
}), [["__scopeId", "data-v-
|
|
51
|
+
}), [["__scopeId", "data-v-5a3e01c4"]]), H = {
|
|
52
52
|
name: "default",
|
|
53
53
|
framework: "vue",
|
|
54
54
|
classNameStrategy: "merge",
|
|
@@ -126,7 +126,7 @@ function de(e = {}) {
|
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/version.ts
|
|
129
|
-
var fe = "0.
|
|
129
|
+
var fe = "1.0.0", pe = "@solspace/freeform-vue";
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/utils/securityMeta.ts
|
|
132
132
|
function me(e) {
|
|
@@ -153,7 +153,7 @@ function he(e, t) {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
function ge(e) {
|
|
156
|
-
let n = t(() =>
|
|
156
|
+
let n = t(() => E(e)), r = t(() => n.value.theme ?? H), i = t(() => n.value.renderers ?? {}), a = t(() => n.value.allowRawHtml ?? !1), o = w(null), s = w(null), c = w(/* @__PURE__ */ new Map()), l = w(/* @__PURE__ */ new Map()), u = w([]), d = y(0), f = y(null), p = y(n.value.manifest ?? null), m = y(!n.value.manifest), g = y(null), _ = y(!1), b = y(!1), x = y(null), S = y({
|
|
157
157
|
values: {},
|
|
158
158
|
touched: {},
|
|
159
159
|
fieldErrors: {},
|
|
@@ -162,29 +162,29 @@ function ge(e) {
|
|
|
162
162
|
currentPageIndex: 0,
|
|
163
163
|
visibilityVersion: 0
|
|
164
164
|
});
|
|
165
|
-
|
|
165
|
+
O(() => n.value.extensions, (e) => {
|
|
166
166
|
u.value = e ?? [];
|
|
167
167
|
}, { immediate: !0 });
|
|
168
|
-
function
|
|
168
|
+
function C() {
|
|
169
169
|
let e = s.value;
|
|
170
|
-
e && (d.value += 1,
|
|
170
|
+
e && (d.value += 1, S.value = he(e, d.value));
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
o.value ||=
|
|
172
|
+
function T() {
|
|
173
|
+
o.value ||= te({
|
|
174
174
|
baseUrl: n.value.baseUrl,
|
|
175
|
-
clientVersion: n.value.clientVersion ?? "0.
|
|
175
|
+
clientVersion: n.value.clientVersion ?? "1.0.0",
|
|
176
176
|
fetch: n.value.fetch,
|
|
177
177
|
credentials: n.value.credentials
|
|
178
178
|
});
|
|
179
179
|
for (let e of u.value) o.value.extensions.register(e);
|
|
180
180
|
return o.value;
|
|
181
181
|
}
|
|
182
|
-
|
|
183
|
-
let e =
|
|
182
|
+
O(() => n.value.extensions, () => {
|
|
183
|
+
let e = T();
|
|
184
184
|
for (let t of u.value) e.extensions.register(t);
|
|
185
|
-
}),
|
|
185
|
+
}), O(p, (e) => {
|
|
186
186
|
e && se(u.value, { manifest: e });
|
|
187
|
-
}),
|
|
187
|
+
}), O(() => [
|
|
188
188
|
n.value.handle,
|
|
189
189
|
n.value.profile,
|
|
190
190
|
n.value.properties,
|
|
@@ -192,12 +192,12 @@ function ge(e) {
|
|
|
192
192
|
n.value.initialValues
|
|
193
193
|
], () => {
|
|
194
194
|
if (n.value.manifest) {
|
|
195
|
-
s.value =
|
|
195
|
+
s.value = N({
|
|
196
196
|
manifest: n.value.manifest,
|
|
197
197
|
initialValues: n.value.initialValues,
|
|
198
198
|
draftToken: n.value.draftToken,
|
|
199
199
|
draftKey: n.value.draftKey
|
|
200
|
-
}), p.value = n.value.manifest,
|
|
200
|
+
}), p.value = n.value.manifest, C(), m.value = !1;
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
if (!n.value.handle && !n.value.profile) {
|
|
@@ -208,18 +208,18 @@ function ge(e) {
|
|
|
208
208
|
(async () => {
|
|
209
209
|
m.value = !0, g.value = null;
|
|
210
210
|
try {
|
|
211
|
-
let t = await
|
|
211
|
+
let t = await T().loadManifest({
|
|
212
212
|
handle: n.value.handle,
|
|
213
213
|
profile: n.value.profile,
|
|
214
214
|
properties: n.value.properties
|
|
215
215
|
});
|
|
216
216
|
if (e) return;
|
|
217
|
-
s.value =
|
|
217
|
+
s.value = N({
|
|
218
218
|
manifest: t,
|
|
219
219
|
initialValues: n.value.initialValues,
|
|
220
220
|
draftToken: n.value.draftToken,
|
|
221
221
|
draftKey: n.value.draftKey
|
|
222
|
-
}), p.value = t,
|
|
222
|
+
}), p.value = t, C(), n.value.onManifestLoaded?.(t);
|
|
223
223
|
} catch (t) {
|
|
224
224
|
e || (g.value = t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load manifest."));
|
|
225
225
|
} finally {
|
|
@@ -228,23 +228,23 @@ function ge(e) {
|
|
|
228
228
|
})(), h(() => {
|
|
229
229
|
e = !0;
|
|
230
230
|
});
|
|
231
|
-
}, { immediate: !0 }),
|
|
231
|
+
}, { immediate: !0 }), O(() => [n.value.draftToken, n.value.draftKey], () => {
|
|
232
232
|
let e = s.value;
|
|
233
233
|
e && (n.value.draftToken !== void 0 && (e.draftToken = n.value.draftToken ?? null), n.value.draftKey !== void 0 && (e.draftKey = n.value.draftKey ?? null));
|
|
234
234
|
});
|
|
235
|
-
function
|
|
236
|
-
s.value?.setValue(e, t),
|
|
235
|
+
function D(e, t) {
|
|
236
|
+
s.value?.setValue(e, t), C();
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function A(e) {
|
|
239
239
|
return s.value?.getValue(e);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function j(e) {
|
|
242
242
|
return s.value?.isFieldVisible(e) ?? !1;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function M(e) {
|
|
245
245
|
return s.value?.isFieldEnabled(e) ?? !0;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function ne(e) {
|
|
248
248
|
let t = s.value, n = p.value?.fields[e], r = t?.getValue(e);
|
|
249
249
|
return {
|
|
250
250
|
id: `freeform-${e}`,
|
|
@@ -252,22 +252,22 @@ function ge(e) {
|
|
|
252
252
|
value: r ?? "",
|
|
253
253
|
onChange: (t) => {
|
|
254
254
|
let n = t.target;
|
|
255
|
-
|
|
255
|
+
D(e, n.value);
|
|
256
256
|
},
|
|
257
257
|
onBlur: () => {
|
|
258
258
|
let t = s.value;
|
|
259
259
|
t && (t.touched = {
|
|
260
260
|
...t.touched,
|
|
261
261
|
[e]: !0
|
|
262
|
-
},
|
|
262
|
+
}, C());
|
|
263
263
|
},
|
|
264
|
-
disabled: !
|
|
264
|
+
disabled: !M(e),
|
|
265
265
|
required: n?.required ?? !1,
|
|
266
266
|
placeholder: n?.placeholder ?? void 0,
|
|
267
267
|
"aria-invalid": (t?.fieldErrors[e]?.length ?? 0) > 0
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
async function
|
|
270
|
+
async function P(e = "submit") {
|
|
271
271
|
let t = s.value, r = p.value;
|
|
272
272
|
if (!(!t || !r)) {
|
|
273
273
|
_.value = !0;
|
|
@@ -275,14 +275,14 @@ function ge(e) {
|
|
|
275
275
|
let i = t.getValuesForSubmit(), { values: a, files: o } = ae(i, r.fields), s = {
|
|
276
276
|
...t.getSubmitContext(),
|
|
277
277
|
sourceUrl: typeof window < "u" ? window.location.href : void 0
|
|
278
|
-
}, c = me(r), l = await
|
|
278
|
+
}, c = me(r), l = await ee(u.value, {
|
|
279
279
|
manifest: r,
|
|
280
280
|
intent: e,
|
|
281
281
|
values: a,
|
|
282
282
|
meta: c,
|
|
283
283
|
context: s,
|
|
284
284
|
baseUrl: n.value.baseUrl
|
|
285
|
-
}), d = await
|
|
285
|
+
}), d = await T().submit({
|
|
286
286
|
manifest: r,
|
|
287
287
|
request: {
|
|
288
288
|
values: a,
|
|
@@ -290,22 +290,22 @@ function ge(e) {
|
|
|
290
290
|
context: s,
|
|
291
291
|
meta: {
|
|
292
292
|
client: pe,
|
|
293
|
-
clientVersion: n.value.clientVersion ?? "0.
|
|
293
|
+
clientVersion: n.value.clientVersion ?? "1.0.0",
|
|
294
294
|
...l
|
|
295
295
|
}
|
|
296
296
|
},
|
|
297
297
|
files: Object.keys(o).length > 0 ? o : void 0
|
|
298
298
|
});
|
|
299
|
-
return t.applySubmitResponse(d),
|
|
299
|
+
return t.applySubmitResponse(d), C(), await oe(u.value, {
|
|
300
300
|
manifest: r,
|
|
301
301
|
intent: e,
|
|
302
302
|
response: d,
|
|
303
303
|
baseUrl: n.value.baseUrl
|
|
304
|
-
}), d.complete && (
|
|
304
|
+
}), d.complete && (b.value = !0, x.value = d.message ?? r.settings.successMessage ?? "Thank you for your submission."), d.success ? n.value.onSuccess?.(d) : n.value.onError?.(d), d;
|
|
305
305
|
} catch (e) {
|
|
306
306
|
if (e instanceof Error && (e.name === "StripePaymentRedirectError" || e.name === "MolliePaymentRedirectError")) return;
|
|
307
307
|
let r = e instanceof Error ? e : /* @__PURE__ */ Error("Something went wrong while submitting the form.");
|
|
308
|
-
t && (t.formErrors = [r.message], t.fieldErrors = {}, t.pageErrors = [],
|
|
308
|
+
t && (t.formErrors = [r.message], t.fieldErrors = {}, t.pageErrors = [], C()), n.value.onError?.({
|
|
309
309
|
success: !1,
|
|
310
310
|
status: "error",
|
|
311
311
|
complete: !1,
|
|
@@ -321,8 +321,8 @@ function ge(e) {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
let
|
|
325
|
-
|
|
324
|
+
let re = () => P("validate"), F = () => P("next"), ie = () => P("back"), I = () => P("saveDraft");
|
|
325
|
+
O(() => [
|
|
326
326
|
p.value,
|
|
327
327
|
n.value.draftToken,
|
|
328
328
|
n.value.draftKey
|
|
@@ -331,26 +331,26 @@ function ge(e) {
|
|
|
331
331
|
let e = n.value.draftToken, t = n.value.draftKey;
|
|
332
332
|
if (!e || !t) return;
|
|
333
333
|
let r = `${e}:${t}`;
|
|
334
|
-
f.value !== r && (f.value = r,
|
|
334
|
+
f.value !== r && (f.value = r, P("validate"));
|
|
335
335
|
});
|
|
336
336
|
function L() {
|
|
337
|
-
p.value && (s.value =
|
|
337
|
+
p.value && (s.value = N({
|
|
338
338
|
manifest: p.value,
|
|
339
339
|
initialValues: n.value.initialValues,
|
|
340
340
|
draftToken: n.value.draftToken,
|
|
341
341
|
draftKey: n.value.draftKey
|
|
342
|
-
}),
|
|
342
|
+
}), b.value = !1, x.value = null, C());
|
|
343
343
|
}
|
|
344
344
|
async function R(e) {
|
|
345
345
|
e?.preventDefault();
|
|
346
346
|
let t = p.value;
|
|
347
347
|
if (!t) return;
|
|
348
|
-
let n = t.layout.pages, r = n.length === 0 ||
|
|
348
|
+
let n = t.layout.pages, r = n.length === 0 || S.value.currentPageIndex >= n.length - 1;
|
|
349
349
|
if (t.settings.multiPage && !r) {
|
|
350
|
-
await
|
|
350
|
+
await F();
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
await
|
|
353
|
+
await P("submit");
|
|
354
354
|
}
|
|
355
355
|
function z(e, t) {
|
|
356
356
|
let r = p.value;
|
|
@@ -370,12 +370,12 @@ function ge(e) {
|
|
|
370
370
|
element: t,
|
|
371
371
|
value: s.value?.getValue(e),
|
|
372
372
|
setValue: (t) => {
|
|
373
|
-
s.value?.setValue(e, t),
|
|
373
|
+
s.value?.setValue(e, t), C();
|
|
374
374
|
},
|
|
375
375
|
getValues: () => s.value?.getValuesForSubmit() ?? {},
|
|
376
376
|
baseUrl: n.value.baseUrl,
|
|
377
377
|
requestSubmit: () => {
|
|
378
|
-
|
|
378
|
+
P("submit");
|
|
379
379
|
}
|
|
380
380
|
});
|
|
381
381
|
if (a) {
|
|
@@ -419,24 +419,24 @@ function ge(e) {
|
|
|
419
419
|
let e = p.value;
|
|
420
420
|
return e ? {
|
|
421
421
|
manifest: e,
|
|
422
|
-
values:
|
|
423
|
-
touched:
|
|
424
|
-
fieldErrors:
|
|
425
|
-
formErrors:
|
|
426
|
-
pageErrors:
|
|
427
|
-
currentPageIndex:
|
|
422
|
+
values: S.value.values,
|
|
423
|
+
touched: S.value.touched,
|
|
424
|
+
fieldErrors: S.value.fieldErrors,
|
|
425
|
+
formErrors: S.value.formErrors,
|
|
426
|
+
pageErrors: S.value.pageErrors,
|
|
427
|
+
currentPageIndex: S.value.currentPageIndex,
|
|
428
428
|
isSubmitting: _.value,
|
|
429
|
-
isComplete:
|
|
430
|
-
successMessage:
|
|
431
|
-
setValue:
|
|
432
|
-
getValue:
|
|
433
|
-
isFieldVisible:
|
|
434
|
-
isFieldEnabled:
|
|
435
|
-
getFieldProps:
|
|
436
|
-
submit:
|
|
437
|
-
validate:
|
|
438
|
-
goNext:
|
|
439
|
-
goBack:
|
|
429
|
+
isComplete: b.value,
|
|
430
|
+
successMessage: x.value,
|
|
431
|
+
setValue: D,
|
|
432
|
+
getValue: A,
|
|
433
|
+
isFieldVisible: j,
|
|
434
|
+
isFieldEnabled: M,
|
|
435
|
+
getFieldProps: ne,
|
|
436
|
+
submit: P,
|
|
437
|
+
validate: re,
|
|
438
|
+
goNext: F,
|
|
439
|
+
goBack: ie,
|
|
440
440
|
saveDraft: I,
|
|
441
441
|
reset: L,
|
|
442
442
|
handleSubmit: R,
|
|
@@ -453,22 +453,22 @@ function ge(e) {
|
|
|
453
453
|
isSubmitting: !1,
|
|
454
454
|
isComplete: !1,
|
|
455
455
|
successMessage: null,
|
|
456
|
-
setValue:
|
|
457
|
-
getValue:
|
|
458
|
-
isFieldVisible:
|
|
459
|
-
isFieldEnabled:
|
|
460
|
-
getFieldProps:
|
|
461
|
-
submit:
|
|
462
|
-
validate:
|
|
463
|
-
goNext:
|
|
464
|
-
goBack:
|
|
456
|
+
setValue: D,
|
|
457
|
+
getValue: A,
|
|
458
|
+
isFieldVisible: j,
|
|
459
|
+
isFieldEnabled: M,
|
|
460
|
+
getFieldProps: ne,
|
|
461
|
+
submit: P,
|
|
462
|
+
validate: re,
|
|
463
|
+
goNext: F,
|
|
464
|
+
goBack: ie,
|
|
465
465
|
saveDraft: I,
|
|
466
466
|
reset: L,
|
|
467
467
|
handleSubmit: R,
|
|
468
468
|
mountFieldExtension: z,
|
|
469
469
|
mountCaptcha: B
|
|
470
|
-
}, V =
|
|
471
|
-
return
|
|
470
|
+
}, V = v({});
|
|
471
|
+
return k(() => {
|
|
472
472
|
let e = ce.value;
|
|
473
473
|
if (!e) {
|
|
474
474
|
Object.assign(V, {
|
|
@@ -494,15 +494,129 @@ function ge(e) {
|
|
|
494
494
|
}), V;
|
|
495
495
|
}
|
|
496
496
|
//#endregion
|
|
497
|
+
//#region src/renderers/builtin/CardsField.tsx
|
|
498
|
+
function _e(e) {
|
|
499
|
+
let t = (e.field.frontend?.config?.cards ?? []) || [], n = Number(e.field.frontend?.config?.maxSelectedValues ?? 0), r = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [], i = n === 1;
|
|
500
|
+
return s("div", {
|
|
501
|
+
class: e.classNames.input,
|
|
502
|
+
style: {
|
|
503
|
+
display: "grid",
|
|
504
|
+
gap: "0.75rem",
|
|
505
|
+
gridTemplateColumns: `repeat(${Math.min(Number(e.field.frontend?.config?.cardsPerRow ?? 3) || 3, 4)}, minmax(0, 1fr))`
|
|
506
|
+
}
|
|
507
|
+
}, [t.map((t) => {
|
|
508
|
+
let a = r.includes(t.value);
|
|
509
|
+
return s("label", {
|
|
510
|
+
key: t.value,
|
|
511
|
+
class: e.classNames.optionLabel,
|
|
512
|
+
style: e.classNames.optionLabel ? void 0 : {
|
|
513
|
+
border: a ? "2px solid currentColor" : "1px solid #ccc",
|
|
514
|
+
borderRadius: "0.5rem",
|
|
515
|
+
padding: "0.75rem",
|
|
516
|
+
cursor: "pointer"
|
|
517
|
+
}
|
|
518
|
+
}, [
|
|
519
|
+
s("input", {
|
|
520
|
+
type: i ? "radio" : "checkbox",
|
|
521
|
+
class: e.classNames.optionInput,
|
|
522
|
+
name: `${e.field.handle}${i ? "" : "[]"}`,
|
|
523
|
+
value: t.value,
|
|
524
|
+
checked: a,
|
|
525
|
+
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
526
|
+
onChange: (a) => {
|
|
527
|
+
if (i) {
|
|
528
|
+
e.form.setValue(e.field.handle, [t.value]);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
let o = new Set(r);
|
|
532
|
+
if (a.target.checked) {
|
|
533
|
+
if (n > 0 && o.size >= n) return;
|
|
534
|
+
o.add(t.value);
|
|
535
|
+
} else o.delete(t.value);
|
|
536
|
+
e.form.setValue(e.field.handle, [...o]);
|
|
537
|
+
}
|
|
538
|
+
}, null),
|
|
539
|
+
t.imageUrl ? s("img", {
|
|
540
|
+
src: t.imageUrl,
|
|
541
|
+
alt: "",
|
|
542
|
+
style: {
|
|
543
|
+
width: "100%",
|
|
544
|
+
height: "auto",
|
|
545
|
+
display: "block",
|
|
546
|
+
marginBottom: "0.5rem"
|
|
547
|
+
}
|
|
548
|
+
}, null) : null,
|
|
549
|
+
s("strong", null, [t.label]),
|
|
550
|
+
t.description ? s("div", null, [t.description]) : null
|
|
551
|
+
]);
|
|
552
|
+
})]);
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/renderers/builtin/CheckboxesField.tsx
|
|
556
|
+
function ve(e) {
|
|
557
|
+
let t = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [];
|
|
558
|
+
return s("div", { class: e.classNames.input }, [(e.field.options ?? []).map((n) => s("label", {
|
|
559
|
+
key: n.value,
|
|
560
|
+
class: e.classNames.optionLabel
|
|
561
|
+
}, [s("input", {
|
|
562
|
+
type: "checkbox",
|
|
563
|
+
class: e.classNames.optionInput,
|
|
564
|
+
name: `${e.field.handle}[]`,
|
|
565
|
+
value: n.value,
|
|
566
|
+
checked: t.includes(n.value),
|
|
567
|
+
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
568
|
+
onChange: (r) => {
|
|
569
|
+
let i = new Set(t);
|
|
570
|
+
r.target.checked ? i.add(n.value) : i.delete(n.value), e.form.setValue(e.field.handle, [...i]);
|
|
571
|
+
}
|
|
572
|
+
}, null), s("span", null, [n.label])]))]);
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/renderers/builtin/inputProps.ts
|
|
576
|
+
function U(e) {
|
|
577
|
+
let t = e.input;
|
|
578
|
+
return {
|
|
579
|
+
...t,
|
|
580
|
+
placeholder: t.placeholder ?? void 0
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/renderers/builtin/CheckboxField.tsx
|
|
585
|
+
function ye(e) {
|
|
586
|
+
let t = U(e), n = t.value === "1" || e.value === !0 || t.value === "true";
|
|
587
|
+
return s("label", { class: e.classNames.optionLabel ?? e.classNames.input }, [s("input", {
|
|
588
|
+
type: "checkbox",
|
|
589
|
+
class: e.classNames.optionInput,
|
|
590
|
+
id: t.id,
|
|
591
|
+
name: t.name,
|
|
592
|
+
checked: n,
|
|
593
|
+
disabled: t.disabled,
|
|
594
|
+
"aria-invalid": t["aria-invalid"],
|
|
595
|
+
onChange: (t) => {
|
|
596
|
+
e.form.setValue(e.field.handle, t.target.checked ? "1" : "");
|
|
597
|
+
},
|
|
598
|
+
onBlur: t.onBlur
|
|
599
|
+
}, null), s("span", null, [e.field.label])]);
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/renderers/builtin/ConfirmField.tsx
|
|
603
|
+
function be(e) {
|
|
604
|
+
let t = U(e), n = e.field.frontend?.config?.targetType === "password" ? "password" : "text";
|
|
605
|
+
return s("input", u({
|
|
606
|
+
type: n,
|
|
607
|
+
class: e.classNames.input
|
|
608
|
+
}, t), null);
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
497
611
|
//#region src/composables/useFieldExtension.ts
|
|
498
|
-
function
|
|
499
|
-
let n =
|
|
612
|
+
function xe(e, t) {
|
|
613
|
+
let n = y(null), r;
|
|
500
614
|
function i() {
|
|
501
615
|
r?.(), r = void 0;
|
|
502
616
|
let i = n.value;
|
|
503
617
|
!i || !e.frontend?.extension || t.isFieldVisible(e.handle) && (r = t.mountFieldExtension(e.handle, i));
|
|
504
618
|
}
|
|
505
|
-
return m(i),
|
|
619
|
+
return m(i), O(() => [
|
|
506
620
|
e.frontend?.extension,
|
|
507
621
|
e.handle,
|
|
508
622
|
t.isFieldVisible(e.handle)
|
|
@@ -512,7 +626,7 @@ function _e(e, t) {
|
|
|
512
626
|
}
|
|
513
627
|
//#endregion
|
|
514
628
|
//#region src/components/ExtensionHost.vue?vue&type=script&setup=true&lang.ts
|
|
515
|
-
var
|
|
629
|
+
var Se = ["hidden"], W = /* @__PURE__ */ c({
|
|
516
630
|
__name: "ExtensionHost",
|
|
517
631
|
props: {
|
|
518
632
|
field: {},
|
|
@@ -523,7 +637,7 @@ var ve = ["hidden"], U = /* @__PURE__ */ c({
|
|
|
523
637
|
hidden: { type: Boolean }
|
|
524
638
|
},
|
|
525
639
|
setup(e) {
|
|
526
|
-
let t = e, n =
|
|
640
|
+
let t = e, n = xe(t.field, t.form);
|
|
527
641
|
function r(e) {
|
|
528
642
|
n.value = e ?? null;
|
|
529
643
|
}
|
|
@@ -532,95 +646,111 @@ var ve = ["hidden"], U = /* @__PURE__ */ c({
|
|
|
532
646
|
class: t.class,
|
|
533
647
|
[e.dataAttr || ""]: e.dataValue ?? e.field.handle,
|
|
534
648
|
hidden: e.hidden || void 0
|
|
535
|
-
}), [
|
|
649
|
+
}), [x(n.$slots, "default")], 16, Se));
|
|
536
650
|
}
|
|
537
651
|
});
|
|
538
652
|
//#endregion
|
|
539
|
-
//#region src/renderers/builtin/
|
|
540
|
-
function W(e) {
|
|
541
|
-
let t = e.input;
|
|
542
|
-
return {
|
|
543
|
-
...t,
|
|
544
|
-
placeholder: t.placeholder ?? void 0
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
function ye(e) {
|
|
548
|
-
let t = W(e);
|
|
549
|
-
return s("input", u({
|
|
550
|
-
type: "text",
|
|
551
|
-
class: e.classNames.input
|
|
552
|
-
}, t), null);
|
|
553
|
-
}
|
|
554
|
-
function be(e) {
|
|
555
|
-
let t = W(e);
|
|
556
|
-
return s("input", u({
|
|
557
|
-
type: "url",
|
|
558
|
-
class: e.classNames.input
|
|
559
|
-
}, t), null);
|
|
560
|
-
}
|
|
561
|
-
function xe(e) {
|
|
562
|
-
let t = W(e), n = e.field.validation?.pattern || (e.field.frontend?.config?.pattern ?? void 0);
|
|
563
|
-
return s("input", u({
|
|
564
|
-
type: "text",
|
|
565
|
-
class: e.classNames.input,
|
|
566
|
-
pattern: n || void 0
|
|
567
|
-
}, t), null);
|
|
568
|
-
}
|
|
569
|
-
function Se(e) {
|
|
570
|
-
let t = W(e);
|
|
571
|
-
return s("input", u({
|
|
572
|
-
type: "password",
|
|
573
|
-
class: e.classNames.input
|
|
574
|
-
}, t), null);
|
|
575
|
-
}
|
|
653
|
+
//#region src/renderers/builtin/DatetimeField.tsx
|
|
576
654
|
function Ce(e) {
|
|
577
|
-
let t =
|
|
578
|
-
return s(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
655
|
+
let t = U(e), n = e.field.frontend?.config ?? {}, r = n.useNativeTypes ? n.nativeInputType || "datetime-local" : "text";
|
|
656
|
+
return s(W, {
|
|
657
|
+
field: e.field,
|
|
658
|
+
form: e.form,
|
|
659
|
+
dataAttr: "data-freeform-datetime"
|
|
660
|
+
}, { default: () => [s("input", u({
|
|
661
|
+
type: r,
|
|
662
|
+
class: e.classNames.input,
|
|
663
|
+
"data-datepicker": "",
|
|
664
|
+
"data-datepicker-enabled": n.useDatepicker ? "1" : "0"
|
|
665
|
+
}, t), null)] });
|
|
582
666
|
}
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/renderers/builtin/EmailField.tsx
|
|
583
669
|
function we(e) {
|
|
584
|
-
let t =
|
|
670
|
+
let t = U(e);
|
|
585
671
|
return s("input", u({
|
|
586
672
|
type: "email",
|
|
587
673
|
class: e.classNames.input
|
|
588
674
|
}, t), null);
|
|
589
675
|
}
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/renderers/builtin/FileDndField.tsx
|
|
590
678
|
function Te(e) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
class: e.classNames.input
|
|
595
|
-
|
|
679
|
+
return s(W, {
|
|
680
|
+
field: e.field,
|
|
681
|
+
form: e.form,
|
|
682
|
+
class: e.classNames.input,
|
|
683
|
+
dataAttr: "data-freeform-file-dnd"
|
|
684
|
+
}, null);
|
|
596
685
|
}
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/renderers/builtin/FileField.tsx
|
|
688
|
+
function G(e) {
|
|
689
|
+
let t = U(e), n = e.field.frontend?.config ?? {};
|
|
690
|
+
return s("input", {
|
|
691
|
+
type: "file",
|
|
692
|
+
class: e.classNames.input,
|
|
693
|
+
id: t.id,
|
|
694
|
+
name: t.name,
|
|
695
|
+
disabled: t.disabled,
|
|
696
|
+
"aria-invalid": t["aria-invalid"],
|
|
697
|
+
accept: n.accept || void 0,
|
|
698
|
+
multiple: !!(n.multiple ?? (n.maxFiles ?? 1) > 1),
|
|
699
|
+
onChange: (t) => {
|
|
700
|
+
let n = t.target.files;
|
|
701
|
+
if (!n || n.length === 0) {
|
|
702
|
+
e.form.setValue(e.field.handle, null);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
e.form.setValue(e.field.handle, n.length === 1 ? n[0] : Array.from(n));
|
|
706
|
+
},
|
|
707
|
+
onBlur: t.onBlur
|
|
708
|
+
}, null);
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/renderers/builtin/HiddenField.tsx
|
|
597
712
|
function Ee(e) {
|
|
598
|
-
let t =
|
|
599
|
-
return s("input", u({
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
713
|
+
let t = U(e);
|
|
714
|
+
return s("input", u({ type: "hidden" }, t), null);
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
717
|
+
//#region src/renderers/builtin/HtmlField.tsx
|
|
718
|
+
function K(e) {
|
|
719
|
+
let t = e.classNames.content ?? e.classNames.input ?? "ff-field__content", n = e.field.content?.rendered?.html?.trim();
|
|
720
|
+
return e.allowRawHtml && n ? s("div", {
|
|
721
|
+
class: t,
|
|
722
|
+
innerHTML: n
|
|
723
|
+
}, null) : e.field.instructions ? s("div", {
|
|
724
|
+
class: t,
|
|
725
|
+
role: "note"
|
|
726
|
+
}, [e.field.instructions]) : null;
|
|
603
727
|
}
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/renderers/builtin/ImageField.tsx
|
|
604
730
|
function De(e) {
|
|
605
|
-
let t =
|
|
606
|
-
return s("
|
|
731
|
+
let t = e.classNames.content ?? e.classNames.input ?? "ff-field__content", n = e.field.frontend?.config ?? {}, r = e.field.content?.image, i = r?.src || n.src, a = r?.srcset || n.srcset, o = r?.alt || n.alt || e.field.label || "";
|
|
732
|
+
return i ? s("img", {
|
|
733
|
+
class: t,
|
|
734
|
+
src: i,
|
|
735
|
+
srcset: a || void 0,
|
|
736
|
+
alt: o
|
|
737
|
+
}, null) : null;
|
|
607
738
|
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/renderers/builtin/MolliePaymentField.tsx
|
|
608
741
|
function Oe(e) {
|
|
609
|
-
|
|
610
|
-
|
|
742
|
+
return s(W, {
|
|
743
|
+
field: e.field,
|
|
744
|
+
form: e.form,
|
|
611
745
|
class: e.classNames.input,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
function G(e) {
|
|
616
|
-
let t = W(e), n = String(t.value ?? "");
|
|
617
|
-
return s("select", u({ class: e.classNames.input }, t, { value: n }), [e.field.placeholder ? s("option", { value: "" }, [e.field.placeholder]) : null, (e.field.options ?? []).map((e) => s("option", {
|
|
618
|
-
key: e.value,
|
|
619
|
-
value: e.value
|
|
620
|
-
}, [e.label]))]);
|
|
746
|
+
dataAttr: "data-freeform-mollie",
|
|
747
|
+
hidden: !0
|
|
748
|
+
}, null);
|
|
621
749
|
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/renderers/builtin/MultipleSelectField.tsx
|
|
622
752
|
function ke(e) {
|
|
623
|
-
let t =
|
|
753
|
+
let t = U(e), n = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [];
|
|
624
754
|
return s("select", {
|
|
625
755
|
class: e.classNames.input,
|
|
626
756
|
id: t.id,
|
|
@@ -639,59 +769,18 @@ function ke(e) {
|
|
|
639
769
|
value: e.value
|
|
640
770
|
}, [e.label]))]);
|
|
641
771
|
}
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/renderers/builtin/NumberField.tsx
|
|
642
774
|
function Ae(e) {
|
|
643
|
-
let t =
|
|
644
|
-
return s("
|
|
645
|
-
type: "
|
|
646
|
-
class: e.classNames.
|
|
647
|
-
|
|
648
|
-
name: t.name,
|
|
649
|
-
checked: n,
|
|
650
|
-
disabled: t.disabled,
|
|
651
|
-
"aria-invalid": t["aria-invalid"],
|
|
652
|
-
onChange: (t) => {
|
|
653
|
-
e.form.setValue(e.field.handle, t.target.checked ? "1" : "");
|
|
654
|
-
},
|
|
655
|
-
onBlur: t.onBlur
|
|
656
|
-
}, null), s("span", null, [e.field.label])]);
|
|
775
|
+
let t = U(e);
|
|
776
|
+
return s("input", u({
|
|
777
|
+
type: "number",
|
|
778
|
+
class: e.classNames.input
|
|
779
|
+
}, t), null);
|
|
657
780
|
}
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/renderers/builtin/OpinionScaleField.tsx
|
|
658
783
|
function je(e) {
|
|
659
|
-
let t = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [];
|
|
660
|
-
return s("div", { class: e.classNames.input }, [(e.field.options ?? []).map((n) => s("label", {
|
|
661
|
-
key: n.value,
|
|
662
|
-
class: e.classNames.optionLabel
|
|
663
|
-
}, [s("input", {
|
|
664
|
-
type: "checkbox",
|
|
665
|
-
class: e.classNames.optionInput,
|
|
666
|
-
name: `${e.field.handle}[]`,
|
|
667
|
-
value: n.value,
|
|
668
|
-
checked: t.includes(n.value),
|
|
669
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
670
|
-
onChange: (r) => {
|
|
671
|
-
let i = new Set(t);
|
|
672
|
-
r.target.checked ? i.add(n.value) : i.delete(n.value), e.form.setValue(e.field.handle, [...i]);
|
|
673
|
-
}
|
|
674
|
-
}, null), s("span", null, [n.label])]))]);
|
|
675
|
-
}
|
|
676
|
-
function K(e) {
|
|
677
|
-
let t = String(e.value ?? "");
|
|
678
|
-
return s("div", {
|
|
679
|
-
class: e.classNames.input,
|
|
680
|
-
role: "radiogroup"
|
|
681
|
-
}, [(e.field.options ?? []).map((n) => s("label", {
|
|
682
|
-
key: n.value,
|
|
683
|
-
class: e.classNames.optionLabel
|
|
684
|
-
}, [s("input", {
|
|
685
|
-
type: "radio",
|
|
686
|
-
class: e.classNames.optionInput,
|
|
687
|
-
name: e.field.handle,
|
|
688
|
-
value: n.value,
|
|
689
|
-
checked: t === n.value,
|
|
690
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
691
|
-
onChange: () => e.form.setValue(e.field.handle, n.value)
|
|
692
|
-
}, null), s("span", null, [n.label])]))]);
|
|
693
|
-
}
|
|
694
|
-
function Me(e) {
|
|
695
784
|
let t = String(e.value ?? ""), n = e.field.frontend?.config?.legends ?? [];
|
|
696
785
|
return s("div", { class: e.classNames.input }, [s("div", {
|
|
697
786
|
role: "radiogroup",
|
|
@@ -722,7 +811,57 @@ function Me(e) {
|
|
|
722
811
|
fontSize: "0.875rem"
|
|
723
812
|
} }, [n.map((e) => s("span", { key: e }, [e]))]) : null]);
|
|
724
813
|
}
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region src/renderers/builtin/PasswordField.tsx
|
|
816
|
+
function Me(e) {
|
|
817
|
+
let t = U(e);
|
|
818
|
+
return s("input", u({
|
|
819
|
+
type: "password",
|
|
820
|
+
class: e.classNames.input
|
|
821
|
+
}, t), null);
|
|
822
|
+
}
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/renderers/builtin/PayPalPaymentField.tsx
|
|
725
825
|
function Ne(e) {
|
|
826
|
+
return s(W, {
|
|
827
|
+
field: e.field,
|
|
828
|
+
form: e.form,
|
|
829
|
+
class: e.classNames.input,
|
|
830
|
+
dataAttr: "data-freeform-paypal"
|
|
831
|
+
}, null);
|
|
832
|
+
}
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/renderers/builtin/PhoneField.tsx
|
|
835
|
+
function Pe(e) {
|
|
836
|
+
let t = U(e);
|
|
837
|
+
return s("input", u({
|
|
838
|
+
type: "tel",
|
|
839
|
+
class: e.classNames.input
|
|
840
|
+
}, t), null);
|
|
841
|
+
}
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/renderers/builtin/RadioField.tsx
|
|
844
|
+
function q(e) {
|
|
845
|
+
let t = String(e.value ?? "");
|
|
846
|
+
return s("div", {
|
|
847
|
+
class: e.classNames.input,
|
|
848
|
+
role: "radiogroup"
|
|
849
|
+
}, [(e.field.options ?? []).map((n) => s("label", {
|
|
850
|
+
key: n.value,
|
|
851
|
+
class: e.classNames.optionLabel
|
|
852
|
+
}, [s("input", {
|
|
853
|
+
type: "radio",
|
|
854
|
+
class: e.classNames.optionInput,
|
|
855
|
+
name: e.field.handle,
|
|
856
|
+
value: n.value,
|
|
857
|
+
checked: t === n.value,
|
|
858
|
+
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
859
|
+
onChange: () => e.form.setValue(e.field.handle, n.value)
|
|
860
|
+
}, null), s("span", null, [n.label])]))]);
|
|
861
|
+
}
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region src/renderers/builtin/RatingField.tsx
|
|
864
|
+
function Fe(e) {
|
|
726
865
|
let t = String(e.value ?? ""), n = e.field.frontend?.config ?? {}, r = n.colorIdle || "#dddddd", i = n.colorSelected || "#ff7700";
|
|
727
866
|
return s("div", {
|
|
728
867
|
class: e.classNames.input,
|
|
@@ -758,164 +897,81 @@ function Ne(e) {
|
|
|
758
897
|
]);
|
|
759
898
|
})]);
|
|
760
899
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
return s("div", {
|
|
764
|
-
class: e.classNames.input,
|
|
765
|
-
style: {
|
|
766
|
-
display: "grid",
|
|
767
|
-
gap: "0.75rem",
|
|
768
|
-
gridTemplateColumns: `repeat(${Math.min(Number(e.field.frontend?.config?.cardsPerRow ?? 3) || 3, 4)}, minmax(0, 1fr))`
|
|
769
|
-
}
|
|
770
|
-
}, [t.map((t) => {
|
|
771
|
-
let a = r.includes(t.value);
|
|
772
|
-
return s("label", {
|
|
773
|
-
key: t.value,
|
|
774
|
-
class: e.classNames.optionLabel,
|
|
775
|
-
style: e.classNames.optionLabel ? void 0 : {
|
|
776
|
-
border: a ? "2px solid currentColor" : "1px solid #ccc",
|
|
777
|
-
borderRadius: "0.5rem",
|
|
778
|
-
padding: "0.75rem",
|
|
779
|
-
cursor: "pointer"
|
|
780
|
-
}
|
|
781
|
-
}, [
|
|
782
|
-
s("input", {
|
|
783
|
-
type: i ? "radio" : "checkbox",
|
|
784
|
-
class: e.classNames.optionInput,
|
|
785
|
-
name: `${e.field.handle}${i ? "" : "[]"}`,
|
|
786
|
-
value: t.value,
|
|
787
|
-
checked: a,
|
|
788
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
789
|
-
onChange: (a) => {
|
|
790
|
-
if (i) {
|
|
791
|
-
e.form.setValue(e.field.handle, [t.value]);
|
|
792
|
-
return;
|
|
793
|
-
}
|
|
794
|
-
let o = new Set(r);
|
|
795
|
-
if (a.target.checked) {
|
|
796
|
-
if (n > 0 && o.size >= n) return;
|
|
797
|
-
o.add(t.value);
|
|
798
|
-
} else o.delete(t.value);
|
|
799
|
-
e.form.setValue(e.field.handle, [...o]);
|
|
800
|
-
}
|
|
801
|
-
}, null),
|
|
802
|
-
t.imageUrl ? s("img", {
|
|
803
|
-
src: t.imageUrl,
|
|
804
|
-
alt: "",
|
|
805
|
-
style: {
|
|
806
|
-
width: "100%",
|
|
807
|
-
height: "auto",
|
|
808
|
-
display: "block",
|
|
809
|
-
marginBottom: "0.5rem"
|
|
810
|
-
}
|
|
811
|
-
}, null) : null,
|
|
812
|
-
s("strong", null, [t.label]),
|
|
813
|
-
t.description ? s("div", null, [t.description]) : null
|
|
814
|
-
]);
|
|
815
|
-
})]);
|
|
816
|
-
}
|
|
817
|
-
function q(e) {
|
|
818
|
-
let t = W(e), n = e.field.frontend?.config ?? {};
|
|
819
|
-
return s("input", {
|
|
820
|
-
type: "file",
|
|
821
|
-
class: e.classNames.input,
|
|
822
|
-
id: t.id,
|
|
823
|
-
name: t.name,
|
|
824
|
-
disabled: t.disabled,
|
|
825
|
-
"aria-invalid": t["aria-invalid"],
|
|
826
|
-
accept: n.accept || void 0,
|
|
827
|
-
multiple: !!(n.multiple ?? (n.maxFiles ?? 1) > 1),
|
|
828
|
-
onChange: (t) => {
|
|
829
|
-
let n = t.target.files;
|
|
830
|
-
if (!n || n.length === 0) {
|
|
831
|
-
e.form.setValue(e.field.handle, null);
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
e.form.setValue(e.field.handle, n.length === 1 ? n[0] : Array.from(n));
|
|
835
|
-
},
|
|
836
|
-
onBlur: t.onBlur
|
|
837
|
-
}, null);
|
|
838
|
-
}
|
|
839
|
-
function Fe(e) {
|
|
840
|
-
return s(U, {
|
|
841
|
-
field: e.field,
|
|
842
|
-
form: e.form,
|
|
843
|
-
class: e.classNames.input,
|
|
844
|
-
dataAttr: "data-freeform-file-dnd"
|
|
845
|
-
}, null);
|
|
846
|
-
}
|
|
900
|
+
//#endregion
|
|
901
|
+
//#region src/renderers/builtin/RegexField.tsx
|
|
847
902
|
function Ie(e) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
903
|
+
let t = U(e), n = e.field.validation?.pattern || (e.field.frontend?.config?.pattern ?? void 0);
|
|
904
|
+
return s("input", u({
|
|
905
|
+
type: "text",
|
|
851
906
|
class: e.classNames.input,
|
|
852
|
-
|
|
853
|
-
}, null);
|
|
907
|
+
pattern: n || void 0
|
|
908
|
+
}, t), null);
|
|
854
909
|
}
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/renderers/builtin/SelectField.tsx
|
|
912
|
+
function J(e) {
|
|
913
|
+
let t = U(e), n = String(t.value ?? "");
|
|
914
|
+
return s("select", u({ class: e.classNames.input }, t, { value: n }), [e.field.placeholder ? s("option", { value: "" }, [e.field.placeholder]) : null, (e.field.options ?? []).map((e) => s("option", {
|
|
915
|
+
key: e.value,
|
|
916
|
+
value: e.value
|
|
917
|
+
}, [e.label]))]);
|
|
918
|
+
}
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/renderers/builtin/SquarePaymentField.tsx
|
|
855
921
|
function Le(e) {
|
|
856
|
-
return s(
|
|
922
|
+
return s(W, {
|
|
857
923
|
field: e.field,
|
|
858
924
|
form: e.form,
|
|
859
925
|
class: e.classNames.input,
|
|
860
926
|
dataAttr: "data-freeform-square"
|
|
861
927
|
}, null);
|
|
862
928
|
}
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region src/renderers/builtin/StripePaymentField.tsx
|
|
863
931
|
function Re(e) {
|
|
864
|
-
return s(
|
|
932
|
+
return s(W, {
|
|
865
933
|
field: e.field,
|
|
866
934
|
form: e.form,
|
|
867
935
|
class: e.classNames.input,
|
|
868
|
-
dataAttr: "data-freeform-
|
|
936
|
+
dataAttr: "data-freeform-stripe"
|
|
869
937
|
}, null);
|
|
870
938
|
}
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/renderers/builtin/TextareaField.tsx
|
|
871
941
|
function ze(e) {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
form: e.form,
|
|
942
|
+
let t = U(e);
|
|
943
|
+
return s("textarea", u({
|
|
875
944
|
class: e.classNames.input,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
}, null);
|
|
879
|
-
}
|
|
880
|
-
function J(e) {
|
|
881
|
-
let t = e.classNames.content ?? e.classNames.input ?? "ff-field__content", n = e.field.content?.rendered?.html?.trim();
|
|
882
|
-
return e.allowRawHtml && n ? s("div", {
|
|
883
|
-
class: t,
|
|
884
|
-
innerHTML: n
|
|
885
|
-
}, null) : e.field.instructions ? s("div", {
|
|
886
|
-
class: t,
|
|
887
|
-
role: "note"
|
|
888
|
-
}, [e.field.instructions]) : null;
|
|
945
|
+
rows: 4
|
|
946
|
+
}, t), null);
|
|
889
947
|
}
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region src/renderers/builtin/TextField.tsx
|
|
890
950
|
function Be(e) {
|
|
891
|
-
let t = e
|
|
892
|
-
return
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
alt: o
|
|
897
|
-
}, null) : null;
|
|
951
|
+
let t = U(e);
|
|
952
|
+
return s("input", u({
|
|
953
|
+
type: "text",
|
|
954
|
+
class: e.classNames.input
|
|
955
|
+
}, t), null);
|
|
898
956
|
}
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region src/renderers/builtin/UnsupportedField.tsx
|
|
899
959
|
function Ve(e) {
|
|
900
|
-
let t = W(e), n = e.field.frontend?.config ?? {}, r = n.useNativeTypes ? n.nativeInputType || "datetime-local" : "text";
|
|
901
|
-
return s(U, {
|
|
902
|
-
field: e.field,
|
|
903
|
-
form: e.form,
|
|
904
|
-
dataAttr: "data-freeform-datetime"
|
|
905
|
-
}, { default: () => [s("input", u({
|
|
906
|
-
type: r,
|
|
907
|
-
class: e.classNames.input,
|
|
908
|
-
"data-datepicker": "",
|
|
909
|
-
"data-datepicker-enabled": n.useDatepicker ? "1" : "0"
|
|
910
|
-
}, t), null)] });
|
|
911
|
-
}
|
|
912
|
-
function He(e) {
|
|
913
960
|
return s("div", {
|
|
914
961
|
class: e.classNames.input,
|
|
915
962
|
role: "alert"
|
|
916
963
|
}, [o("Unsupported field type: "), e.field.type]);
|
|
917
964
|
}
|
|
918
965
|
//#endregion
|
|
966
|
+
//#region src/renderers/builtin/WebsiteField.tsx
|
|
967
|
+
function He(e) {
|
|
968
|
+
let t = U(e);
|
|
969
|
+
return s("input", u({
|
|
970
|
+
type: "url",
|
|
971
|
+
class: e.classNames.input
|
|
972
|
+
}, t), null);
|
|
973
|
+
}
|
|
974
|
+
//#endregion
|
|
919
975
|
//#region src/renderers/builtin/CalculationField.tsx
|
|
920
976
|
var Ue = /* @__PURE__ */ c({
|
|
921
977
|
name: "CalculationFieldRenderer",
|
|
@@ -935,8 +991,8 @@ var Ue = /* @__PURE__ */ c({
|
|
|
935
991
|
value: { required: !0 }
|
|
936
992
|
},
|
|
937
993
|
setup(e) {
|
|
938
|
-
let t =
|
|
939
|
-
return r.value = e.form.setValue,
|
|
994
|
+
let t = re(e.field.frontend?.config), n = t.inputType ?? "regularTextInput", r = w(e.form.setValue);
|
|
995
|
+
return r.value = e.form.setValue, O(() => [
|
|
940
996
|
e.field.handle,
|
|
941
997
|
t.calculations,
|
|
942
998
|
t.decimalCount,
|
|
@@ -944,7 +1000,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
944
1000
|
], () => {
|
|
945
1001
|
let n = !1, i = t.calculations ?? "";
|
|
946
1002
|
return (async () => {
|
|
947
|
-
let a = await
|
|
1003
|
+
let a = await P(i, e.form.values, t.decimalCount);
|
|
948
1004
|
if (n) return;
|
|
949
1005
|
let o = a == null ? "" : String(a), s = e.form.getValue(e.field.handle);
|
|
950
1006
|
String(s ?? "") !== o && r.value(e.field.handle, o);
|
|
@@ -998,7 +1054,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
998
1054
|
}
|
|
999
1055
|
},
|
|
1000
1056
|
setup(e) {
|
|
1001
|
-
let t =
|
|
1057
|
+
let t = w(null), n = w(!1), r = y(!I(e.value)), i = F(e.field), a = i.width ?? 400, c = i.height ?? 100, l = e.form.isFieldEnabled(e.field.handle), u = i.penColor || "#000000", d = i.backgroundColor || "rgba(0,0,0,0)", f = i.borderColor || "#999999", p = i.penDotSize ?? 2.5;
|
|
1002
1058
|
function h(e) {
|
|
1003
1059
|
e.fillStyle = d, e.fillRect(0, 0, a, c);
|
|
1004
1060
|
}
|
|
@@ -1006,11 +1062,11 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1006
1062
|
let n = t.value;
|
|
1007
1063
|
n && e.form.setValue(e.field.handle, n.toDataURL("image/png"));
|
|
1008
1064
|
}
|
|
1009
|
-
function
|
|
1065
|
+
function v() {
|
|
1010
1066
|
let n = t.value, i = n?.getContext("2d");
|
|
1011
1067
|
!n || !i || (i.clearRect(0, 0, a, c), h(i), r.value = !1, e.form.setValue(e.field.handle, ""));
|
|
1012
1068
|
}
|
|
1013
|
-
function
|
|
1069
|
+
function b() {
|
|
1014
1070
|
let n = t.value;
|
|
1015
1071
|
if (!n) return;
|
|
1016
1072
|
let i = typeof window < "u" && window.devicePixelRatio || 1;
|
|
@@ -1025,10 +1081,10 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1025
1081
|
} else r.value = !1;
|
|
1026
1082
|
}
|
|
1027
1083
|
}
|
|
1028
|
-
m(
|
|
1084
|
+
m(b), O(() => [a, c], b), g(() => {
|
|
1029
1085
|
n.value = !1;
|
|
1030
1086
|
});
|
|
1031
|
-
function
|
|
1087
|
+
function x(e) {
|
|
1032
1088
|
let n = t.value;
|
|
1033
1089
|
if (!n) return {
|
|
1034
1090
|
x: 0,
|
|
@@ -1040,7 +1096,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1040
1096
|
y: (e.clientY - r.top) / r.height * c
|
|
1041
1097
|
};
|
|
1042
1098
|
}
|
|
1043
|
-
function
|
|
1099
|
+
function S() {
|
|
1044
1100
|
n.value && (n.value = !1, _());
|
|
1045
1101
|
}
|
|
1046
1102
|
return () => s("div", {
|
|
@@ -1066,23 +1122,23 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1066
1122
|
let r = t.value, i = r?.getContext("2d");
|
|
1067
1123
|
if (!i || !r) return;
|
|
1068
1124
|
n.value = !0, r.setPointerCapture(e.pointerId), i.strokeStyle = u, i.lineWidth = p, i.lineCap = "round", i.lineJoin = "round";
|
|
1069
|
-
let { x: a, y: o } =
|
|
1125
|
+
let { x: a, y: o } = x(e);
|
|
1070
1126
|
i.beginPath(), i.moveTo(a, o);
|
|
1071
1127
|
},
|
|
1072
1128
|
onPointermove: (e) => {
|
|
1073
1129
|
if (!n.value) return;
|
|
1074
1130
|
let i = t.value?.getContext("2d");
|
|
1075
1131
|
if (!i) return;
|
|
1076
|
-
let { x: a, y: o } =
|
|
1132
|
+
let { x: a, y: o } = x(e);
|
|
1077
1133
|
i.lineTo(a, o), i.stroke(), r.value = !0;
|
|
1078
1134
|
},
|
|
1079
|
-
onPointerup:
|
|
1080
|
-
onPointercancel:
|
|
1081
|
-
onPointerleave:
|
|
1135
|
+
onPointerup: S,
|
|
1136
|
+
onPointercancel: S,
|
|
1137
|
+
onPointerleave: S
|
|
1082
1138
|
}, null), i.showClearButton === !1 ? null : s("button", {
|
|
1083
1139
|
type: "button",
|
|
1084
1140
|
disabled: !r.value || !l,
|
|
1085
|
-
onClick:
|
|
1141
|
+
onClick: v
|
|
1086
1142
|
}, [o("Clear")])]);
|
|
1087
1143
|
}
|
|
1088
1144
|
}), Ge = /* @__PURE__ */ c({
|
|
@@ -1103,8 +1159,8 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1103
1159
|
}
|
|
1104
1160
|
},
|
|
1105
1161
|
setup(e) {
|
|
1106
|
-
let n = t(() =>
|
|
1107
|
-
|
|
1162
|
+
let n = t(() => ie(e.field)), r = t(() => n.value.columns ?? []), i = t(() => e.form.isFieldEnabled(e.field.handle)), a = t(() => L(e.value, r.value, n.value)), o = w(!1);
|
|
1163
|
+
O(() => [e.field.handle, e.value], () => {
|
|
1108
1164
|
o.value || (!Array.isArray(e.value) || e.value.length === 0) && (o.value = !0, e.form.setValue(e.field.handle, a.value));
|
|
1109
1165
|
}, { immediate: !0 });
|
|
1110
1166
|
let c = (t) => {
|
|
@@ -1114,7 +1170,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1114
1170
|
r[e][t] = n, c(r);
|
|
1115
1171
|
};
|
|
1116
1172
|
return () => {
|
|
1117
|
-
let t = a.value, o = r.value, u = n.value, d = i.value, f =
|
|
1173
|
+
let t = a.value, o = r.value, u = n.value, d = i.value, f = j(t, u);
|
|
1118
1174
|
return s("div", {
|
|
1119
1175
|
class: e.classNames.input,
|
|
1120
1176
|
"data-freeform-table": ""
|
|
@@ -1196,7 +1252,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1196
1252
|
l(r, i, e.target.value);
|
|
1197
1253
|
}
|
|
1198
1254
|
}, null)]);
|
|
1199
|
-
}), s("td", null, [
|
|
1255
|
+
}), s("td", null, [M(t, r, u) ? s("button", {
|
|
1200
1256
|
type: "button",
|
|
1201
1257
|
disabled: !d,
|
|
1202
1258
|
onClick: () => {
|
|
@@ -1205,7 +1261,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1205
1261
|
}, [u.removeButtonLabel || "Remove"]) : null])]))])]), f ? s("button", {
|
|
1206
1262
|
type: "button",
|
|
1207
1263
|
disabled: !d,
|
|
1208
|
-
onClick: () => c([...t,
|
|
1264
|
+
onClick: () => c([...t, ne(o)])
|
|
1209
1265
|
}, [u.addButtonLabel || "Add"]) : null]);
|
|
1210
1266
|
};
|
|
1211
1267
|
}
|
|
@@ -1415,78 +1471,78 @@ var et = Y("DefaultSubmitButton"), tt = Y("DefaultNextButton", "button"), nt = Y
|
|
|
1415
1471
|
}
|
|
1416
1472
|
}), X = {
|
|
1417
1473
|
frontend: {
|
|
1418
|
-
text:
|
|
1419
|
-
textarea:
|
|
1474
|
+
text: Be,
|
|
1475
|
+
textarea: ze,
|
|
1420
1476
|
email: we,
|
|
1421
|
-
number:
|
|
1422
|
-
phone:
|
|
1423
|
-
website:
|
|
1424
|
-
regex:
|
|
1425
|
-
password:
|
|
1426
|
-
confirm:
|
|
1427
|
-
hidden:
|
|
1428
|
-
dropdown:
|
|
1429
|
-
select:
|
|
1477
|
+
number: Ae,
|
|
1478
|
+
phone: Pe,
|
|
1479
|
+
website: He,
|
|
1480
|
+
regex: Ie,
|
|
1481
|
+
password: Me,
|
|
1482
|
+
confirm: be,
|
|
1483
|
+
hidden: Ee,
|
|
1484
|
+
dropdown: J,
|
|
1485
|
+
select: J,
|
|
1430
1486
|
"multiple-select": ke,
|
|
1431
|
-
checkbox:
|
|
1432
|
-
checkboxes:
|
|
1433
|
-
radios:
|
|
1434
|
-
radio:
|
|
1435
|
-
"opinion-scale":
|
|
1436
|
-
rating:
|
|
1437
|
-
cards:
|
|
1438
|
-
datetime:
|
|
1439
|
-
file:
|
|
1440
|
-
"file-upload":
|
|
1441
|
-
"file-dnd":
|
|
1442
|
-
html:
|
|
1443
|
-
"rich-text":
|
|
1444
|
-
image:
|
|
1487
|
+
checkbox: ye,
|
|
1488
|
+
checkboxes: ve,
|
|
1489
|
+
radios: q,
|
|
1490
|
+
radio: q,
|
|
1491
|
+
"opinion-scale": je,
|
|
1492
|
+
rating: Fe,
|
|
1493
|
+
cards: _e,
|
|
1494
|
+
datetime: Ce,
|
|
1495
|
+
file: G,
|
|
1496
|
+
"file-upload": G,
|
|
1497
|
+
"file-dnd": Te,
|
|
1498
|
+
html: K,
|
|
1499
|
+
"rich-text": K,
|
|
1500
|
+
image: De,
|
|
1445
1501
|
table: Ge,
|
|
1446
1502
|
signature: We,
|
|
1447
1503
|
calculation: Ue,
|
|
1448
|
-
"payment.stripe":
|
|
1504
|
+
"payment.stripe": Re,
|
|
1449
1505
|
"payment.square": Le,
|
|
1450
|
-
"payment.paypal":
|
|
1451
|
-
"payment.mollie":
|
|
1506
|
+
"payment.paypal": Ne,
|
|
1507
|
+
"payment.mollie": Oe
|
|
1452
1508
|
},
|
|
1453
1509
|
types: {
|
|
1454
|
-
text:
|
|
1455
|
-
textarea:
|
|
1510
|
+
text: Be,
|
|
1511
|
+
textarea: ze,
|
|
1456
1512
|
email: we,
|
|
1457
|
-
number:
|
|
1458
|
-
phone:
|
|
1459
|
-
website:
|
|
1460
|
-
regex:
|
|
1461
|
-
password:
|
|
1462
|
-
confirm:
|
|
1463
|
-
hidden:
|
|
1464
|
-
select:
|
|
1465
|
-
dropdown:
|
|
1513
|
+
number: Ae,
|
|
1514
|
+
phone: Pe,
|
|
1515
|
+
website: He,
|
|
1516
|
+
regex: Ie,
|
|
1517
|
+
password: Me,
|
|
1518
|
+
confirm: be,
|
|
1519
|
+
hidden: Ee,
|
|
1520
|
+
select: J,
|
|
1521
|
+
dropdown: J,
|
|
1466
1522
|
"multiple-select": ke,
|
|
1467
|
-
checkbox:
|
|
1468
|
-
checkboxes:
|
|
1469
|
-
radio:
|
|
1470
|
-
radios:
|
|
1471
|
-
radiobox:
|
|
1472
|
-
"opinion-scale":
|
|
1473
|
-
rating:
|
|
1474
|
-
cards:
|
|
1475
|
-
datetime:
|
|
1476
|
-
file:
|
|
1477
|
-
"file-upload":
|
|
1478
|
-
"file-dnd":
|
|
1479
|
-
html:
|
|
1480
|
-
"rich-text":
|
|
1481
|
-
image:
|
|
1523
|
+
checkbox: ye,
|
|
1524
|
+
checkboxes: ve,
|
|
1525
|
+
radio: q,
|
|
1526
|
+
radios: q,
|
|
1527
|
+
radiobox: q,
|
|
1528
|
+
"opinion-scale": je,
|
|
1529
|
+
rating: Fe,
|
|
1530
|
+
cards: _e,
|
|
1531
|
+
datetime: Ce,
|
|
1532
|
+
file: G,
|
|
1533
|
+
"file-upload": G,
|
|
1534
|
+
"file-dnd": Te,
|
|
1535
|
+
html: K,
|
|
1536
|
+
"rich-text": K,
|
|
1537
|
+
image: De,
|
|
1482
1538
|
table: Ge,
|
|
1483
1539
|
signature: We,
|
|
1484
1540
|
calculation: Ue,
|
|
1485
|
-
stripe:
|
|
1541
|
+
stripe: Re,
|
|
1486
1542
|
square: Le,
|
|
1487
|
-
paypal:
|
|
1488
|
-
mollie:
|
|
1489
|
-
_unsupported:
|
|
1543
|
+
paypal: Ne,
|
|
1544
|
+
mollie: Oe,
|
|
1545
|
+
_unsupported: Ve
|
|
1490
1546
|
}
|
|
1491
1547
|
}, at = {
|
|
1492
1548
|
Form: Ke,
|
|
@@ -1502,7 +1558,7 @@ var et = Y("DefaultSubmitButton"), tt = Y("DefaultNextButton", "button"), nt = Y
|
|
|
1502
1558
|
BackButton: nt,
|
|
1503
1559
|
SaveButton: rt,
|
|
1504
1560
|
SuccessMessage: it,
|
|
1505
|
-
UnsupportedField:
|
|
1561
|
+
UnsupportedField: Ve
|
|
1506
1562
|
};
|
|
1507
1563
|
//#endregion
|
|
1508
1564
|
//#region src/theme/mergeClassNames.ts
|
|
@@ -1526,7 +1582,7 @@ var st = ["data-freeform-captcha", "data-freeform-captcha-provider"], ct = /* @_
|
|
|
1526
1582
|
captcha: {}
|
|
1527
1583
|
},
|
|
1528
1584
|
setup(e) {
|
|
1529
|
-
let t = e, n =
|
|
1585
|
+
let t = e, n = y(null), r;
|
|
1530
1586
|
function a(e) {
|
|
1531
1587
|
return [
|
|
1532
1588
|
e.name,
|
|
@@ -1543,7 +1599,7 @@ var st = ["data-freeform-captcha", "data-freeform-captcha-provider"], ct = /* @_
|
|
|
1543
1599
|
function o() {
|
|
1544
1600
|
r?.(), r = void 0, n.value && (r = t.form.mountCaptcha(t.captcha, n.value));
|
|
1545
1601
|
}
|
|
1546
|
-
m(o),
|
|
1602
|
+
m(o), O(() => a(t.captcha), o), g(() => {
|
|
1547
1603
|
r?.();
|
|
1548
1604
|
});
|
|
1549
1605
|
function s(e) {
|
|
@@ -1621,15 +1677,15 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1621
1677
|
let s = o, c = t(() => s.theme.classNameStrategy ?? "merge"), u = t(() => s.form.fieldErrors[s.field.handle] ?? []), p = t(() => dt(s.theme, s.field, u.value.length > 0)), m = t(() => ({
|
|
1622
1678
|
...at,
|
|
1623
1679
|
...s.theme.renderers?.components
|
|
1624
|
-
})), h = t(() => lt(s.field, s.renderers, s.theme)), g = t(() => s.form.values[s.field.handle]),
|
|
1625
|
-
if (!
|
|
1680
|
+
})), h = t(() => lt(s.field, s.renderers, s.theme)), g = t(() => s.form.values[s.field.handle]), v = t(() => s.field.type === "checkbox"), y = t(() => s.field.type === "html" || s.field.type === "rich-text" || s.field.type === "image"), x = t(() => s.field.type === "hidden" || s.field.type === "mollie" || s.field.frontend?.renderer === "payment.mollie" || s.field.frontend?.extension === "payment.mollie"), w = t(() => !v.value && !y.value && !x.value && s.theme.defaults?.renderLabels !== !1), T = t(() => !y.value && !x.value && s.theme.defaults?.renderInstructions !== !1), E = t(() => s.theme.defaults?.renderErrors !== !1), O = t(() => {
|
|
1681
|
+
if (!y.value) return !0;
|
|
1626
1682
|
if (s.field.type === "image") {
|
|
1627
1683
|
let e = s.field.frontend?.config ?? {};
|
|
1628
1684
|
return !!(s.field.content?.image?.src || e.src);
|
|
1629
1685
|
}
|
|
1630
1686
|
let e = s.field.content?.rendered?.html?.trim();
|
|
1631
1687
|
return !!(s.allowRawHtml && e || s.field.instructions);
|
|
1632
|
-
}),
|
|
1688
|
+
}), k = t(() => Z(p.value.field, s.field.required ? p.value.fieldRequired : void 0, u.value.length ? p.value.fieldHasErrors : void 0, !s.form.isFieldVisible(s.field.handle) || x.value ? p.value.fieldHidden : void 0, c.value === "merge" ? `ff-field--${Q(s.field.type)}` : void 0, c.value === "merge" ? `ff-field--${Q(s.field.handle)}` : void 0)), j = t(() => ({
|
|
1633
1689
|
field: s.field,
|
|
1634
1690
|
form: s.form,
|
|
1635
1691
|
value: g.value,
|
|
@@ -1642,27 +1698,27 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1642
1698
|
renderErrors: () => null
|
|
1643
1699
|
}));
|
|
1644
1700
|
return (t, s) => {
|
|
1645
|
-
let g =
|
|
1646
|
-
return
|
|
1701
|
+
let g = S("FieldRenderer", !0);
|
|
1702
|
+
return O.value ? (_(), i(e, { key: 0 }, [x.value ? (_(), n(C(m.value.FieldWrapper), {
|
|
1647
1703
|
key: 0,
|
|
1648
1704
|
field: o.field,
|
|
1649
1705
|
form: o.form,
|
|
1650
|
-
class: d(
|
|
1706
|
+
class: d(k.value)
|
|
1651
1707
|
}, {
|
|
1652
|
-
default:
|
|
1708
|
+
default: A(() => [(_(), n(C(h.value), f(l(j.value)), null, 16))]),
|
|
1653
1709
|
_: 1
|
|
1654
1710
|
}, 8, [
|
|
1655
1711
|
"field",
|
|
1656
1712
|
"form",
|
|
1657
1713
|
"class"
|
|
1658
|
-
])) : o.field.type === "group" ? (_(), n(
|
|
1714
|
+
])) : o.field.type === "group" ? (_(), n(C(m.value.FieldWrapper), {
|
|
1659
1715
|
key: 1,
|
|
1660
1716
|
field: o.field,
|
|
1661
1717
|
form: o.form,
|
|
1662
|
-
class: d(
|
|
1718
|
+
class: d(k.value)
|
|
1663
1719
|
}, {
|
|
1664
|
-
default:
|
|
1665
|
-
|
|
1720
|
+
default: A(() => [
|
|
1721
|
+
w.value ? (_(), n(C(m.value.Label), {
|
|
1666
1722
|
key: 0,
|
|
1667
1723
|
field: o.field,
|
|
1668
1724
|
class: d(p.value.label),
|
|
@@ -1672,7 +1728,7 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1672
1728
|
"class",
|
|
1673
1729
|
"required-indicator"
|
|
1674
1730
|
])) : r("", !0),
|
|
1675
|
-
|
|
1731
|
+
T.value ? (_(), n(C(m.value.Instructions), {
|
|
1676
1732
|
key: 1,
|
|
1677
1733
|
field: o.field,
|
|
1678
1734
|
class: d(p.value.instructions)
|
|
@@ -1680,11 +1736,11 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1680
1736
|
a("div", {
|
|
1681
1737
|
class: d(p.value.input),
|
|
1682
1738
|
"data-freeform-group": o.field.handle
|
|
1683
|
-
}, [(_(!0), i(e, null,
|
|
1739
|
+
}, [(_(!0), i(e, null, b(o.field.layout?.rows ?? [], (t) => (_(), n(C(m.value.Row), {
|
|
1684
1740
|
key: t.uid,
|
|
1685
|
-
class: d(
|
|
1741
|
+
class: d(D(Z)(p.value.row, c.value === "merge" ? `ff-row--${t.fields.length}-fields` : void 0))
|
|
1686
1742
|
}, {
|
|
1687
|
-
default:
|
|
1743
|
+
default: A(() => [(_(!0), i(e, null, b(t.fields, (e) => (_(), n(g, {
|
|
1688
1744
|
key: e,
|
|
1689
1745
|
field: o.form.manifest.fields[e],
|
|
1690
1746
|
form: o.form,
|
|
@@ -1700,7 +1756,7 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1700
1756
|
]))), 128))]),
|
|
1701
1757
|
_: 2
|
|
1702
1758
|
}, 1032, ["class"]))), 128))], 10, ft),
|
|
1703
|
-
|
|
1759
|
+
E.value ? (_(), n(C(m.value.Errors), {
|
|
1704
1760
|
key: 2,
|
|
1705
1761
|
errors: u.value,
|
|
1706
1762
|
class: d(p.value.errors),
|
|
@@ -1716,14 +1772,14 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1716
1772
|
"field",
|
|
1717
1773
|
"form",
|
|
1718
1774
|
"class"
|
|
1719
|
-
])) : (_(), n(
|
|
1775
|
+
])) : (_(), n(C(m.value.FieldWrapper), {
|
|
1720
1776
|
key: 2,
|
|
1721
1777
|
field: o.field,
|
|
1722
1778
|
form: o.form,
|
|
1723
|
-
class: d(
|
|
1779
|
+
class: d(k.value)
|
|
1724
1780
|
}, {
|
|
1725
|
-
default:
|
|
1726
|
-
|
|
1781
|
+
default: A(() => [
|
|
1782
|
+
w.value ? (_(), n(C(m.value.Label), {
|
|
1727
1783
|
key: 0,
|
|
1728
1784
|
field: o.field,
|
|
1729
1785
|
class: d(p.value.label),
|
|
@@ -1733,13 +1789,13 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1733
1789
|
"class",
|
|
1734
1790
|
"required-indicator"
|
|
1735
1791
|
])) : r("", !0),
|
|
1736
|
-
|
|
1792
|
+
T.value ? (_(), n(C(m.value.Instructions), {
|
|
1737
1793
|
key: 1,
|
|
1738
1794
|
field: o.field,
|
|
1739
1795
|
class: d(p.value.instructions)
|
|
1740
1796
|
}, null, 8, ["field", "class"])) : r("", !0),
|
|
1741
|
-
(_(), n(
|
|
1742
|
-
|
|
1797
|
+
(_(), n(C(h.value), f(l(j.value)), null, 16)),
|
|
1798
|
+
E.value ? (_(), n(C(m.value.Errors), {
|
|
1743
1799
|
key: 2,
|
|
1744
1800
|
errors: u.value,
|
|
1745
1801
|
class: d(p.value.errors),
|
|
@@ -1786,18 +1842,18 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1786
1842
|
function g(e) {
|
|
1787
1843
|
o.form.handleSubmit(e);
|
|
1788
1844
|
}
|
|
1789
|
-
return (t, o) => a.form.isComplete && a.form.successMessage ? (_(), n(
|
|
1845
|
+
return (t, o) => a.form.isComplete && a.form.successMessage ? (_(), n(C(s.value.SuccessMessage), {
|
|
1790
1846
|
key: 0,
|
|
1791
1847
|
message: a.form.successMessage,
|
|
1792
1848
|
class: d(a.form.theme.classNames?.success)
|
|
1793
|
-
}, null, 8, ["message", "class"])) : (_(), n(
|
|
1849
|
+
}, null, 8, ["message", "class"])) : (_(), n(C(s.value.Form), {
|
|
1794
1850
|
key: 1,
|
|
1795
1851
|
form: a.form,
|
|
1796
1852
|
class: d(u.value),
|
|
1797
1853
|
"on-submit": g
|
|
1798
1854
|
}, {
|
|
1799
|
-
default:
|
|
1800
|
-
a.form.formErrors.length > 0 ? (_(), n(
|
|
1855
|
+
default: A(() => [
|
|
1856
|
+
a.form.formErrors.length > 0 ? (_(), n(C(s.value.Errors), {
|
|
1801
1857
|
key: 0,
|
|
1802
1858
|
errors: a.form.formErrors,
|
|
1803
1859
|
class: d(a.form.theme.classNames?.errors),
|
|
@@ -1807,22 +1863,22 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1807
1863
|
"class",
|
|
1808
1864
|
"error-class"
|
|
1809
1865
|
])) : r("", !0),
|
|
1810
|
-
(_(), n(
|
|
1866
|
+
(_(), n(C(s.value.Page), {
|
|
1811
1867
|
form: a.form,
|
|
1812
1868
|
"page-index": a.form.currentPageIndex,
|
|
1813
|
-
class: d(
|
|
1869
|
+
class: d(D(Z)(a.form.theme.classNames?.page, c.value === "merge" ? `ff-page--${a.form.currentPageIndex}` : void 0))
|
|
1814
1870
|
}, {
|
|
1815
|
-
default:
|
|
1871
|
+
default: A(() => [(_(!0), i(e, null, b(f.value.rows, (t) => (_(), i(e, { key: t.uid }, [t.fields.filter((e) => {
|
|
1816
1872
|
let t = a.form.manifest.fields[e];
|
|
1817
1873
|
return t ? h(t) : !1;
|
|
1818
|
-
}).length > 0 ? (_(), n(
|
|
1874
|
+
}).length > 0 ? (_(), n(C(s.value.Row), {
|
|
1819
1875
|
key: 0,
|
|
1820
|
-
class: d(
|
|
1876
|
+
class: d(D(Z)(a.form.theme.classNames?.row, c.value === "merge" ? `ff-row--${t.fields.filter((e) => {
|
|
1821
1877
|
let t = a.form.manifest.fields[e];
|
|
1822
1878
|
return t ? h(t) : !1;
|
|
1823
1879
|
}).length}-fields` : void 0))
|
|
1824
1880
|
}, {
|
|
1825
|
-
default:
|
|
1881
|
+
default: A(() => [(_(!0), i(e, null, b(t.fields.filter((e) => {
|
|
1826
1882
|
let t = a.form.manifest.fields[e];
|
|
1827
1883
|
return t ? h(t) : !1;
|
|
1828
1884
|
}), (e) => (_(), n(pt, {
|
|
@@ -1847,14 +1903,14 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1847
1903
|
"page-index",
|
|
1848
1904
|
"class"
|
|
1849
1905
|
])),
|
|
1850
|
-
(_(!0), i(e, null,
|
|
1906
|
+
(_(!0), i(e, null, b(a.form.manifest.security.captchas ?? [], (e) => (_(), n(ct, {
|
|
1851
1907
|
key: e.name,
|
|
1852
1908
|
form: a.form,
|
|
1853
1909
|
captcha: e
|
|
1854
1910
|
}, null, 8, ["form", "captcha"]))), 128)),
|
|
1855
|
-
(_(), n(
|
|
1856
|
-
default:
|
|
1857
|
-
!m.value && f.value.buttons?.back ? (_(), n(
|
|
1911
|
+
(_(), n(C(s.value.ButtonRow), { class: d(a.form.theme.classNames?.buttons) }, {
|
|
1912
|
+
default: A(() => [
|
|
1913
|
+
!m.value && f.value.buttons?.back ? (_(), n(C(s.value.BackButton), {
|
|
1858
1914
|
key: 0,
|
|
1859
1915
|
label: f.value.buttons.back.label,
|
|
1860
1916
|
class: d(a.form.theme.classNames?.backButton),
|
|
@@ -1866,7 +1922,7 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1866
1922
|
"disabled",
|
|
1867
1923
|
"on-click"
|
|
1868
1924
|
])) : r("", !0),
|
|
1869
|
-
a.form.manifest.settings.multiPage && !p.value && f.value.buttons?.submit ? (_(), n(
|
|
1925
|
+
a.form.manifest.settings.multiPage && !p.value && f.value.buttons?.submit ? (_(), n(C(s.value.NextButton), {
|
|
1870
1926
|
key: 1,
|
|
1871
1927
|
label: f.value.buttons.submit.label,
|
|
1872
1928
|
class: d(a.form.theme.classNames?.nextButton),
|
|
@@ -1878,7 +1934,7 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1878
1934
|
"disabled",
|
|
1879
1935
|
"on-click"
|
|
1880
1936
|
])) : r("", !0),
|
|
1881
|
-
(!a.form.manifest.settings.multiPage || p.value) && f.value.buttons?.submit ? (_(), n(
|
|
1937
|
+
(!a.form.manifest.settings.multiPage || p.value) && f.value.buttons?.submit ? (_(), n(C(s.value.SubmitButton), {
|
|
1882
1938
|
key: 2,
|
|
1883
1939
|
label: f.value.buttons.submit.label,
|
|
1884
1940
|
class: d(a.form.theme.classNames?.submitButton),
|
|
@@ -1888,7 +1944,7 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1888
1944
|
"class",
|
|
1889
1945
|
"disabled"
|
|
1890
1946
|
])) : r("", !0),
|
|
1891
|
-
f.value.buttons?.save ? (_(), n(
|
|
1947
|
+
f.value.buttons?.save ? (_(), n(C(s.value.SaveButton), {
|
|
1892
1948
|
key: 3,
|
|
1893
1949
|
label: f.value.buttons.save.label,
|
|
1894
1950
|
class: d(a.form.theme.classNames?.saveButton),
|
|
@@ -1933,7 +1989,7 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1933
1989
|
},
|
|
1934
1990
|
setup(e) {
|
|
1935
1991
|
let i = e, o = ge(() => i), c = t(() => o.manifest ? o : null);
|
|
1936
|
-
return (t, l) => t.$slots.default ?
|
|
1992
|
+
return (t, l) => t.$slots.default ? x(t.$slots, "default", { form: D(o) }, void 0, void 0, 0) : D(o).loading ? x(t.$slots, "loading", {}, () => [s(V, { message: e.loadingMessage ?? "Loading form…" }, null, 8, ["message"])], void 0, 1) : D(o).error ? x(t.$slots, "error", { error: D(o).error }, () => [a("div", ht, T(D(o).error.message), 1)], void 0, 2) : c.value ? (_(), n(mt, {
|
|
1937
1993
|
key: 3,
|
|
1938
1994
|
form: c.value,
|
|
1939
1995
|
class: d(i.class)
|
|
@@ -1941,6 +1997,6 @@ var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
|
1941
1997
|
}
|
|
1942
1998
|
});
|
|
1943
1999
|
//#endregion
|
|
1944
|
-
export { pe as CLIENT_NAME, V as FormLoader, gt as Freeform, mt as FreeformView, fe as PACKAGE_VERSION, at as builtinComponents, X as builtinRenderers, de as createTheme, H as defaultTheme, Z as joinClassNames, ot as mergeClassNames, lt as resolveFieldRenderer, dt as resolveThemeClassNames, Q as toBemModifier,
|
|
2000
|
+
export { pe as CLIENT_NAME, V as FormLoader, gt as Freeform, mt as FreeformView, fe as PACKAGE_VERSION, at as builtinComponents, X as builtinRenderers, de as createTheme, H as defaultTheme, Z as joinClassNames, ot as mergeClassNames, lt as resolveFieldRenderer, dt as resolveThemeClassNames, Q as toBemModifier, xe as useFieldExtension, ge as useFreeform };
|
|
1945
2001
|
|
|
1946
2002
|
//# sourceMappingURL=index.js.map
|