@solspace/freeform-vue 0.1.18 → 0.1.20
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 +873 -635
- 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 +10 -10
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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,
|
|
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,
|
|
6
6
|
class: "ff-loader-skeleton",
|
|
7
7
|
"aria-hidden": "true"
|
|
8
|
-
},
|
|
8
|
+
}, ce = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "ff-loader-spinner",
|
|
11
11
|
"aria-hidden": "true"
|
|
12
|
-
},
|
|
12
|
+
}, le = { class: "ff-loader-message" }, V = /*#__PURE__*/ ((e, t) => {
|
|
13
13
|
let n = e.__vccOpts || e;
|
|
14
14
|
for (let [e, r] of t) n[e] = r;
|
|
15
15
|
return n;
|
|
@@ -21,23 +21,23 @@ var z = ["data-variant"], B = {
|
|
|
21
21
|
variant: { default: "skeleton" }
|
|
22
22
|
},
|
|
23
23
|
setup(t) {
|
|
24
|
-
return (n, r) => (
|
|
24
|
+
return (n, r) => (_(), i("div", {
|
|
25
25
|
role: "status",
|
|
26
26
|
"aria-live": "polite",
|
|
27
27
|
"aria-busy": "true",
|
|
28
28
|
"data-variant": t.variant,
|
|
29
|
-
class:
|
|
30
|
-
}, [t.variant === "skeleton" ? (
|
|
29
|
+
class: d(["ff-loader-root", t.loaderClass])
|
|
30
|
+
}, [t.variant === "skeleton" ? (_(), i("div", B, [
|
|
31
31
|
r[0] ||= a("div", { class: "ff-loader-line ff-loader-line--title" }, null, -1),
|
|
32
|
-
(
|
|
32
|
+
(_(), i(e, null, b(3, (e) => a("div", {
|
|
33
33
|
key: e,
|
|
34
34
|
class: "ff-loader-field"
|
|
35
35
|
}, [a("div", {
|
|
36
36
|
class: "ff-loader-line ff-loader-line--label",
|
|
37
|
-
style:
|
|
37
|
+
style: p({ animationDelay: `${e * .12}s` })
|
|
38
38
|
}, null, 4), a("div", {
|
|
39
39
|
class: "ff-loader-line ff-loader-line--input",
|
|
40
|
-
style:
|
|
40
|
+
style: p({
|
|
41
41
|
width: e === 2 ? "62%" : "100%",
|
|
42
42
|
animationDelay: `${e * .12}s`
|
|
43
43
|
})
|
|
@@ -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
|
-
])) : (
|
|
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",
|
|
@@ -82,7 +82,7 @@ var z = ["data-variant"], B = {
|
|
|
82
82
|
colorScheme: "system"
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
function
|
|
85
|
+
function ue(e, t) {
|
|
86
86
|
if (!e && !t) return;
|
|
87
87
|
let n = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]), r = {};
|
|
88
88
|
for (let i of n) r[i] = {
|
|
@@ -91,7 +91,7 @@ function U(e, t) {
|
|
|
91
91
|
};
|
|
92
92
|
return r;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function de(e = {}) {
|
|
95
95
|
let t = e.classNameStrategy ?? H.classNameStrategy, n = t !== "replace";
|
|
96
96
|
return {
|
|
97
97
|
...H,
|
|
@@ -101,7 +101,7 @@ function le(e = {}) {
|
|
|
101
101
|
...H.classNames,
|
|
102
102
|
...e.classNames
|
|
103
103
|
} : { ...e.classNames },
|
|
104
|
-
classNamesByType:
|
|
104
|
+
classNamesByType: ue(n ? H.classNamesByType : void 0, e.classNamesByType),
|
|
105
105
|
defaults: {
|
|
106
106
|
...H.defaults,
|
|
107
107
|
...e.defaults
|
|
@@ -126,10 +126,10 @@ function le(e = {}) {
|
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/version.ts
|
|
129
|
-
var
|
|
129
|
+
var fe = "0.1.20", pe = "@solspace/freeform-vue";
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/utils/securityMeta.ts
|
|
132
|
-
function
|
|
132
|
+
function me(e) {
|
|
133
133
|
let t = {};
|
|
134
134
|
return e.security.honeypot?.name && (t.honeypot = {
|
|
135
135
|
name: e.security.honeypot.name,
|
|
@@ -141,7 +141,7 @@ function fe(e) {
|
|
|
141
141
|
}
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/composables/useFreeform.ts
|
|
144
|
-
function
|
|
144
|
+
function he(e, t) {
|
|
145
145
|
return {
|
|
146
146
|
values: { ...e.values },
|
|
147
147
|
touched: { ...e.touched },
|
|
@@ -152,8 +152,8 @@ function pe(e, t) {
|
|
|
152
152
|
visibilityVersion: t
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
let n = t(() =>
|
|
155
|
+
function ge(e) {
|
|
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 me(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, S.value =
|
|
170
|
+
e && (d.value += 1, S.value = he(e, d.value));
|
|
171
171
|
}
|
|
172
172
|
function T() {
|
|
173
|
-
o.value ||=
|
|
173
|
+
o.value ||= te({
|
|
174
174
|
baseUrl: n.value.baseUrl,
|
|
175
|
-
clientVersion: n.value.clientVersion ?? "0.1.
|
|
175
|
+
clientVersion: n.value.clientVersion ?? "0.1.20",
|
|
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
|
-
|
|
182
|
+
O(() => n.value.extensions, () => {
|
|
183
183
|
let e = T();
|
|
184
184
|
for (let t of u.value) e.extensions.register(t);
|
|
185
|
-
}),
|
|
186
|
-
e &&
|
|
187
|
-
}),
|
|
185
|
+
}), O(p, (e) => {
|
|
186
|
+
e && se(u.value, { manifest: e });
|
|
187
|
+
}), O(() => [
|
|
188
188
|
n.value.handle,
|
|
189
189
|
n.value.profile,
|
|
190
190
|
n.value.properties,
|
|
@@ -192,21 +192,21 @@ function me(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) {
|
|
204
|
-
g.value = /* @__PURE__ */ Error("Either handle, profile, or manifest is required."),
|
|
204
|
+
g.value = /* @__PURE__ */ Error("Either handle, profile, or manifest is required."), m.value = !1;
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
let e = !1;
|
|
208
208
|
(async () => {
|
|
209
|
-
|
|
209
|
+
m.value = !0, g.value = null;
|
|
210
210
|
try {
|
|
211
211
|
let t = await T().loadManifest({
|
|
212
212
|
handle: n.value.handle,
|
|
@@ -214,37 +214,37 @@ function me(e) {
|
|
|
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 {
|
|
226
|
-
e || (
|
|
226
|
+
e || (m.value = !1);
|
|
227
227
|
}
|
|
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
235
|
function D(e, t) {
|
|
236
|
-
s.value?.setValue(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}`,
|
|
@@ -259,23 +259,23 @@ function me(e) {
|
|
|
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;
|
|
274
274
|
try {
|
|
275
|
-
let i = t.getValuesForSubmit(), { values: a, files: o } =
|
|
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 =
|
|
278
|
+
}, c = me(r), l = await ee(u.value, {
|
|
279
279
|
manifest: r,
|
|
280
280
|
intent: e,
|
|
281
281
|
values: a,
|
|
@@ -289,14 +289,14 @@ function me(e) {
|
|
|
289
289
|
intent: e,
|
|
290
290
|
context: s,
|
|
291
291
|
meta: {
|
|
292
|
-
client:
|
|
293
|
-
clientVersion: n.value.clientVersion ?? "0.1.
|
|
292
|
+
client: pe,
|
|
293
|
+
clientVersion: n.value.clientVersion ?? "0.1.20",
|
|
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,
|
|
@@ -305,7 +305,7 @@ function me(e) {
|
|
|
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,
|
|
@@ -317,12 +317,12 @@ function me(e) {
|
|
|
317
317
|
});
|
|
318
318
|
return;
|
|
319
319
|
} finally {
|
|
320
|
-
|
|
320
|
+
_.value = !1;
|
|
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,17 +331,17 @@ function me(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
|
-
function
|
|
337
|
-
p.value && (s.value =
|
|
336
|
+
function L() {
|
|
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
|
-
}), b.value = !1, x.value = null,
|
|
342
|
+
}), b.value = !1, x.value = null, C());
|
|
343
343
|
}
|
|
344
|
-
async function
|
|
344
|
+
async function R(e) {
|
|
345
345
|
e?.preventDefault();
|
|
346
346
|
let t = p.value;
|
|
347
347
|
if (!t) return;
|
|
@@ -350,9 +350,9 @@ function me(e) {
|
|
|
350
350
|
await F();
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
await
|
|
353
|
+
await P("submit");
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function z(e, t) {
|
|
356
356
|
let r = p.value;
|
|
357
357
|
if (!r) return () => {};
|
|
358
358
|
c.value.set(e, t);
|
|
@@ -370,12 +370,12 @@ function me(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) {
|
|
@@ -390,7 +390,7 @@ function me(e) {
|
|
|
390
390
|
c.value.delete(e);
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function B(e, t) {
|
|
394
394
|
let n = p.value;
|
|
395
395
|
if (!n) return () => {};
|
|
396
396
|
let r = !1, i = [];
|
|
@@ -415,7 +415,7 @@ function me(e) {
|
|
|
415
415
|
};
|
|
416
416
|
return l.value.set(e.name, a), a;
|
|
417
417
|
}
|
|
418
|
-
let
|
|
418
|
+
let ce = t(() => {
|
|
419
419
|
let e = p.value;
|
|
420
420
|
return e ? {
|
|
421
421
|
manifest: e,
|
|
@@ -425,25 +425,25 @@ function me(e) {
|
|
|
425
425
|
formErrors: S.value.formErrors,
|
|
426
426
|
pageErrors: S.value.pageErrors,
|
|
427
427
|
currentPageIndex: S.value.currentPageIndex,
|
|
428
|
-
isSubmitting:
|
|
428
|
+
isSubmitting: _.value,
|
|
429
429
|
isComplete: b.value,
|
|
430
430
|
successMessage: x.value,
|
|
431
431
|
setValue: D,
|
|
432
|
-
getValue:
|
|
433
|
-
isFieldVisible:
|
|
434
|
-
isFieldEnabled:
|
|
435
|
-
getFieldProps:
|
|
436
|
-
submit:
|
|
437
|
-
validate:
|
|
432
|
+
getValue: A,
|
|
433
|
+
isFieldVisible: j,
|
|
434
|
+
isFieldEnabled: M,
|
|
435
|
+
getFieldProps: ne,
|
|
436
|
+
submit: P,
|
|
437
|
+
validate: re,
|
|
438
438
|
goNext: F,
|
|
439
|
-
goBack:
|
|
440
|
-
saveDraft:
|
|
441
|
-
reset:
|
|
442
|
-
handleSubmit:
|
|
443
|
-
mountFieldExtension:
|
|
444
|
-
mountCaptcha:
|
|
439
|
+
goBack: ie,
|
|
440
|
+
saveDraft: I,
|
|
441
|
+
reset: L,
|
|
442
|
+
handleSubmit: R,
|
|
443
|
+
mountFieldExtension: z,
|
|
444
|
+
mountCaptcha: B
|
|
445
445
|
} : null;
|
|
446
|
-
}),
|
|
446
|
+
}), le = {
|
|
447
447
|
values: {},
|
|
448
448
|
touched: {},
|
|
449
449
|
fieldErrors: {},
|
|
@@ -454,103 +454,179 @@ function me(e) {
|
|
|
454
454
|
isComplete: !1,
|
|
455
455
|
successMessage: null,
|
|
456
456
|
setValue: D,
|
|
457
|
-
getValue:
|
|
458
|
-
isFieldVisible:
|
|
459
|
-
isFieldEnabled:
|
|
460
|
-
getFieldProps:
|
|
461
|
-
submit:
|
|
462
|
-
validate:
|
|
457
|
+
getValue: A,
|
|
458
|
+
isFieldVisible: j,
|
|
459
|
+
isFieldEnabled: M,
|
|
460
|
+
getFieldProps: ne,
|
|
461
|
+
submit: P,
|
|
462
|
+
validate: re,
|
|
463
463
|
goNext: F,
|
|
464
|
-
goBack:
|
|
465
|
-
saveDraft:
|
|
466
|
-
reset:
|
|
467
|
-
handleSubmit:
|
|
468
|
-
mountFieldExtension:
|
|
469
|
-
mountCaptcha:
|
|
470
|
-
},
|
|
471
|
-
return
|
|
472
|
-
let e =
|
|
464
|
+
goBack: ie,
|
|
465
|
+
saveDraft: I,
|
|
466
|
+
reset: L,
|
|
467
|
+
handleSubmit: R,
|
|
468
|
+
mountFieldExtension: z,
|
|
469
|
+
mountCaptcha: B
|
|
470
|
+
}, V = v({});
|
|
471
|
+
return k(() => {
|
|
472
|
+
let e = ce.value;
|
|
473
473
|
if (!e) {
|
|
474
|
-
Object.assign(
|
|
475
|
-
loading:
|
|
474
|
+
Object.assign(V, {
|
|
475
|
+
loading: m.value,
|
|
476
476
|
error: g.value,
|
|
477
477
|
manifest: null,
|
|
478
478
|
theme: r.value,
|
|
479
479
|
renderers: i.value,
|
|
480
480
|
allowRawHtml: a.value,
|
|
481
|
-
...
|
|
481
|
+
...le
|
|
482
482
|
});
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
Object.assign(
|
|
485
|
+
Object.assign(V, {
|
|
486
486
|
...e,
|
|
487
|
-
loading:
|
|
487
|
+
loading: m.value,
|
|
488
488
|
error: g.value,
|
|
489
489
|
manifest: p.value,
|
|
490
490
|
theme: r.value,
|
|
491
491
|
renderers: i.value,
|
|
492
492
|
allowRawHtml: a.value
|
|
493
493
|
});
|
|
494
|
-
}),
|
|
494
|
+
}), V;
|
|
495
495
|
}
|
|
496
496
|
//#endregion
|
|
497
|
-
//#region src/
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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
|
+
}
|
|
534
610
|
//#endregion
|
|
535
611
|
//#region src/composables/useFieldExtension.ts
|
|
536
|
-
function
|
|
537
|
-
let n =
|
|
612
|
+
function xe(e, t) {
|
|
613
|
+
let n = y(null), r;
|
|
538
614
|
function i() {
|
|
539
615
|
r?.(), r = void 0;
|
|
540
616
|
let i = n.value;
|
|
541
617
|
!i || !e.frontend?.extension || t.isFieldVisible(e.handle) && (r = t.mountFieldExtension(e.handle, i));
|
|
542
618
|
}
|
|
543
|
-
return
|
|
619
|
+
return m(i), O(() => [
|
|
544
620
|
e.frontend?.extension,
|
|
545
621
|
e.handle,
|
|
546
622
|
t.isFieldVisible(e.handle)
|
|
547
|
-
], i),
|
|
623
|
+
], i), g(() => {
|
|
548
624
|
r?.();
|
|
549
625
|
}), n;
|
|
550
626
|
}
|
|
551
627
|
//#endregion
|
|
552
628
|
//#region src/components/ExtensionHost.vue?vue&type=script&setup=true&lang.ts
|
|
553
|
-
var
|
|
629
|
+
var Se = ["hidden"], W = /* @__PURE__ */ c({
|
|
554
630
|
__name: "ExtensionHost",
|
|
555
631
|
props: {
|
|
556
632
|
field: {},
|
|
@@ -561,104 +637,120 @@ var ve = ["hidden"], W = /* @__PURE__ */ c({
|
|
|
561
637
|
hidden: { type: Boolean }
|
|
562
638
|
},
|
|
563
639
|
setup(e) {
|
|
564
|
-
let t = e, n =
|
|
640
|
+
let t = e, n = xe(t.field, t.form);
|
|
565
641
|
function r(e) {
|
|
566
642
|
n.value = e ?? null;
|
|
567
643
|
}
|
|
568
|
-
return (n, a) => (
|
|
644
|
+
return (n, a) => (_(), i("div", f({
|
|
569
645
|
ref: r,
|
|
570
646
|
class: t.class,
|
|
571
647
|
[e.dataAttr || ""]: e.dataValue ?? e.field.handle,
|
|
572
648
|
hidden: e.hidden || void 0
|
|
573
|
-
}), [
|
|
649
|
+
}), [x(n.$slots, "default")], 16, Se));
|
|
574
650
|
}
|
|
575
651
|
});
|
|
576
652
|
//#endregion
|
|
577
|
-
//#region src/renderers/builtin/
|
|
578
|
-
function G(e) {
|
|
579
|
-
let t = e.input;
|
|
580
|
-
return {
|
|
581
|
-
...t,
|
|
582
|
-
placeholder: t.placeholder ?? void 0
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
function ye(e) {
|
|
586
|
-
let t = G(e);
|
|
587
|
-
return s("input", l({
|
|
588
|
-
type: "text",
|
|
589
|
-
class: e.classNames.input
|
|
590
|
-
}, t), null);
|
|
591
|
-
}
|
|
592
|
-
function be(e) {
|
|
593
|
-
let t = G(e);
|
|
594
|
-
return s("input", l({
|
|
595
|
-
type: "url",
|
|
596
|
-
class: e.classNames.input
|
|
597
|
-
}, t), null);
|
|
598
|
-
}
|
|
599
|
-
function xe(e) {
|
|
600
|
-
let t = G(e), n = e.field.validation?.pattern || (e.field.frontend?.config?.pattern ?? void 0);
|
|
601
|
-
return s("input", l({
|
|
602
|
-
type: "text",
|
|
603
|
-
class: e.classNames.input,
|
|
604
|
-
pattern: n || void 0
|
|
605
|
-
}, t), null);
|
|
606
|
-
}
|
|
607
|
-
function Se(e) {
|
|
608
|
-
let t = G(e);
|
|
609
|
-
return s("input", l({
|
|
610
|
-
type: "password",
|
|
611
|
-
class: e.classNames.input
|
|
612
|
-
}, t), null);
|
|
613
|
-
}
|
|
653
|
+
//#region src/renderers/builtin/DatetimeField.tsx
|
|
614
654
|
function Ce(e) {
|
|
615
|
-
let t =
|
|
616
|
-
return s(
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
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)] });
|
|
620
666
|
}
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/renderers/builtin/EmailField.tsx
|
|
621
669
|
function we(e) {
|
|
622
|
-
let t =
|
|
623
|
-
return s("input",
|
|
670
|
+
let t = U(e);
|
|
671
|
+
return s("input", u({
|
|
624
672
|
type: "email",
|
|
625
673
|
class: e.classNames.input
|
|
626
674
|
}, t), null);
|
|
627
675
|
}
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/renderers/builtin/FileDndField.tsx
|
|
628
678
|
function Te(e) {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
class: e.classNames.input
|
|
633
|
-
|
|
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);
|
|
634
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
|
|
635
712
|
function Ee(e) {
|
|
636
|
-
let t =
|
|
637
|
-
return s("input",
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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;
|
|
641
727
|
}
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/renderers/builtin/ImageField.tsx
|
|
642
730
|
function De(e) {
|
|
643
|
-
let t =
|
|
644
|
-
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;
|
|
645
738
|
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/renderers/builtin/MolliePaymentField.tsx
|
|
646
741
|
function Oe(e) {
|
|
647
|
-
|
|
648
|
-
|
|
742
|
+
return s(W, {
|
|
743
|
+
field: e.field,
|
|
744
|
+
form: e.form,
|
|
649
745
|
class: e.classNames.input,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
653
|
-
function K(e) {
|
|
654
|
-
let t = G(e), n = String(t.value ?? "");
|
|
655
|
-
return s("select", l({ class: e.classNames.input }, t, { value: n }), [e.field.placeholder ? s("option", { value: "" }, [e.field.placeholder]) : null, (e.field.options ?? []).map((e) => s("option", {
|
|
656
|
-
key: e.value,
|
|
657
|
-
value: e.value
|
|
658
|
-
}, [e.label]))]);
|
|
746
|
+
dataAttr: "data-freeform-mollie",
|
|
747
|
+
hidden: !0
|
|
748
|
+
}, null);
|
|
659
749
|
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/renderers/builtin/MultipleSelectField.tsx
|
|
660
752
|
function ke(e) {
|
|
661
|
-
let t =
|
|
753
|
+
let t = U(e), n = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [];
|
|
662
754
|
return s("select", {
|
|
663
755
|
class: e.classNames.input,
|
|
664
756
|
id: t.id,
|
|
@@ -677,59 +769,18 @@ function ke(e) {
|
|
|
677
769
|
value: e.value
|
|
678
770
|
}, [e.label]))]);
|
|
679
771
|
}
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/renderers/builtin/NumberField.tsx
|
|
680
774
|
function Ae(e) {
|
|
681
|
-
let t =
|
|
682
|
-
return s("
|
|
683
|
-
type: "
|
|
684
|
-
class: e.classNames.
|
|
685
|
-
|
|
686
|
-
name: t.name,
|
|
687
|
-
checked: n,
|
|
688
|
-
disabled: t.disabled,
|
|
689
|
-
"aria-invalid": t["aria-invalid"],
|
|
690
|
-
onChange: (t) => {
|
|
691
|
-
e.form.setValue(e.field.handle, t.target.checked ? "1" : "");
|
|
692
|
-
},
|
|
693
|
-
onBlur: t.onBlur
|
|
694
|
-
}, 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);
|
|
695
780
|
}
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/renderers/builtin/OpinionScaleField.tsx
|
|
696
783
|
function je(e) {
|
|
697
|
-
let t = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [];
|
|
698
|
-
return s("div", { class: e.classNames.input }, [(e.field.options ?? []).map((n) => s("label", {
|
|
699
|
-
key: n.value,
|
|
700
|
-
class: e.classNames.optionLabel
|
|
701
|
-
}, [s("input", {
|
|
702
|
-
type: "checkbox",
|
|
703
|
-
class: e.classNames.optionInput,
|
|
704
|
-
name: `${e.field.handle}[]`,
|
|
705
|
-
value: n.value,
|
|
706
|
-
checked: t.includes(n.value),
|
|
707
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
708
|
-
onChange: (r) => {
|
|
709
|
-
let i = new Set(t);
|
|
710
|
-
r.target.checked ? i.add(n.value) : i.delete(n.value), e.form.setValue(e.field.handle, [...i]);
|
|
711
|
-
}
|
|
712
|
-
}, null), s("span", null, [n.label])]))]);
|
|
713
|
-
}
|
|
714
|
-
function q(e) {
|
|
715
|
-
let t = String(e.value ?? "");
|
|
716
|
-
return s("div", {
|
|
717
|
-
class: e.classNames.input,
|
|
718
|
-
role: "radiogroup"
|
|
719
|
-
}, [(e.field.options ?? []).map((n) => s("label", {
|
|
720
|
-
key: n.value,
|
|
721
|
-
class: e.classNames.optionLabel
|
|
722
|
-
}, [s("input", {
|
|
723
|
-
type: "radio",
|
|
724
|
-
class: e.classNames.optionInput,
|
|
725
|
-
name: e.field.handle,
|
|
726
|
-
value: n.value,
|
|
727
|
-
checked: t === n.value,
|
|
728
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
729
|
-
onChange: () => e.form.setValue(e.field.handle, n.value)
|
|
730
|
-
}, null), s("span", null, [n.label])]))]);
|
|
731
|
-
}
|
|
732
|
-
function Me(e) {
|
|
733
784
|
let t = String(e.value ?? ""), n = e.field.frontend?.config?.legends ?? [];
|
|
734
785
|
return s("div", { class: e.classNames.input }, [s("div", {
|
|
735
786
|
role: "radiogroup",
|
|
@@ -760,7 +811,57 @@ function Me(e) {
|
|
|
760
811
|
fontSize: "0.875rem"
|
|
761
812
|
} }, [n.map((e) => s("span", { key: e }, [e]))]) : null]);
|
|
762
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
|
|
763
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) {
|
|
764
865
|
let t = String(e.value ?? ""), n = e.field.frontend?.config ?? {}, r = n.colorIdle || "#dddddd", i = n.colorSelected || "#ff7700";
|
|
765
866
|
return s("div", {
|
|
766
867
|
class: e.classNames.input,
|
|
@@ -778,118 +879,45 @@ function Ne(e) {
|
|
|
778
879
|
}
|
|
779
880
|
}, [
|
|
780
881
|
s("input", {
|
|
781
|
-
type: "radio",
|
|
782
|
-
class: e.classNames.optionInput,
|
|
783
|
-
name: e.field.handle,
|
|
784
|
-
value: n.value,
|
|
785
|
-
checked: t === n.value,
|
|
786
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
787
|
-
onChange: () => e.form.setValue(e.field.handle, n.value),
|
|
788
|
-
style: {
|
|
789
|
-
position: "absolute",
|
|
790
|
-
opacity: 0,
|
|
791
|
-
pointerEvents: "none"
|
|
792
|
-
}
|
|
793
|
-
}, null),
|
|
794
|
-
s("span", { "aria-hidden": "true" }, [o("★")]),
|
|
795
|
-
s("span", { class: "ff-sr-only" }, [n.label])
|
|
796
|
-
]);
|
|
797
|
-
})]);
|
|
798
|
-
}
|
|
799
|
-
function Pe(e) {
|
|
800
|
-
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;
|
|
801
|
-
return s("div", {
|
|
802
|
-
class: e.classNames.input,
|
|
803
|
-
style: {
|
|
804
|
-
display: "grid",
|
|
805
|
-
gap: "0.75rem",
|
|
806
|
-
gridTemplateColumns: `repeat(${Math.min(Number(e.field.frontend?.config?.cardsPerRow ?? 3) || 3, 4)}, minmax(0, 1fr))`
|
|
807
|
-
}
|
|
808
|
-
}, [t.map((t) => {
|
|
809
|
-
let a = r.includes(t.value);
|
|
810
|
-
return s("label", {
|
|
811
|
-
key: t.value,
|
|
812
|
-
class: e.classNames.optionLabel,
|
|
813
|
-
style: e.classNames.optionLabel ? void 0 : {
|
|
814
|
-
border: a ? "2px solid currentColor" : "1px solid #ccc",
|
|
815
|
-
borderRadius: "0.5rem",
|
|
816
|
-
padding: "0.75rem",
|
|
817
|
-
cursor: "pointer"
|
|
818
|
-
}
|
|
819
|
-
}, [
|
|
820
|
-
s("input", {
|
|
821
|
-
type: i ? "radio" : "checkbox",
|
|
822
|
-
class: e.classNames.optionInput,
|
|
823
|
-
name: `${e.field.handle}${i ? "" : "[]"}`,
|
|
824
|
-
value: t.value,
|
|
825
|
-
checked: a,
|
|
826
|
-
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
827
|
-
onChange: (a) => {
|
|
828
|
-
if (i) {
|
|
829
|
-
e.form.setValue(e.field.handle, [t.value]);
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
let o = new Set(r);
|
|
833
|
-
if (a.target.checked) {
|
|
834
|
-
if (n > 0 && o.size >= n) return;
|
|
835
|
-
o.add(t.value);
|
|
836
|
-
} else o.delete(t.value);
|
|
837
|
-
e.form.setValue(e.field.handle, [...o]);
|
|
838
|
-
}
|
|
839
|
-
}, null),
|
|
840
|
-
t.imageUrl ? s("img", {
|
|
841
|
-
src: t.imageUrl,
|
|
842
|
-
alt: "",
|
|
882
|
+
type: "radio",
|
|
883
|
+
class: e.classNames.optionInput,
|
|
884
|
+
name: e.field.handle,
|
|
885
|
+
value: n.value,
|
|
886
|
+
checked: t === n.value,
|
|
887
|
+
disabled: !e.form.isFieldEnabled(e.field.handle),
|
|
888
|
+
onChange: () => e.form.setValue(e.field.handle, n.value),
|
|
843
889
|
style: {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
marginBottom: "0.5rem"
|
|
890
|
+
position: "absolute",
|
|
891
|
+
opacity: 0,
|
|
892
|
+
pointerEvents: "none"
|
|
848
893
|
}
|
|
849
|
-
}, null)
|
|
850
|
-
s("
|
|
851
|
-
|
|
894
|
+
}, null),
|
|
895
|
+
s("span", { "aria-hidden": "true" }, [o("★")]),
|
|
896
|
+
s("span", { class: "ff-sr-only" }, [n.label])
|
|
852
897
|
]);
|
|
853
898
|
})]);
|
|
854
899
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
return s("input", {
|
|
858
|
-
type: "file",
|
|
859
|
-
class: e.classNames.input,
|
|
860
|
-
id: t.id,
|
|
861
|
-
name: t.name,
|
|
862
|
-
disabled: t.disabled,
|
|
863
|
-
"aria-invalid": t["aria-invalid"],
|
|
864
|
-
accept: n.accept || void 0,
|
|
865
|
-
multiple: !!(n.multiple ?? (n.maxFiles ?? 1) > 1),
|
|
866
|
-
onChange: (t) => {
|
|
867
|
-
let n = t.target.files;
|
|
868
|
-
if (!n || n.length === 0) {
|
|
869
|
-
e.form.setValue(e.field.handle, null);
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
e.form.setValue(e.field.handle, n.length === 1 ? n[0] : Array.from(n));
|
|
873
|
-
},
|
|
874
|
-
onBlur: t.onBlur
|
|
875
|
-
}, null);
|
|
876
|
-
}
|
|
877
|
-
function Fe(e) {
|
|
878
|
-
return s(W, {
|
|
879
|
-
field: e.field,
|
|
880
|
-
form: e.form,
|
|
881
|
-
class: e.classNames.input,
|
|
882
|
-
dataAttr: "data-freeform-file-dnd"
|
|
883
|
-
}, null);
|
|
884
|
-
}
|
|
900
|
+
//#endregion
|
|
901
|
+
//#region src/renderers/builtin/RegexField.tsx
|
|
885
902
|
function Ie(e) {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
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",
|
|
889
906
|
class: e.classNames.input,
|
|
890
|
-
|
|
891
|
-
}, null);
|
|
907
|
+
pattern: n || void 0
|
|
908
|
+
}, t), null);
|
|
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]))]);
|
|
892
918
|
}
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/renderers/builtin/SquarePaymentField.tsx
|
|
893
921
|
function Le(e) {
|
|
894
922
|
return s(W, {
|
|
895
923
|
field: e.field,
|
|
@@ -898,62 +926,52 @@ function Le(e) {
|
|
|
898
926
|
dataAttr: "data-freeform-square"
|
|
899
927
|
}, null);
|
|
900
928
|
}
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region src/renderers/builtin/StripePaymentField.tsx
|
|
901
931
|
function Re(e) {
|
|
902
932
|
return s(W, {
|
|
903
933
|
field: e.field,
|
|
904
934
|
form: e.form,
|
|
905
935
|
class: e.classNames.input,
|
|
906
|
-
dataAttr: "data-freeform-
|
|
936
|
+
dataAttr: "data-freeform-stripe"
|
|
907
937
|
}, null);
|
|
908
938
|
}
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/renderers/builtin/TextareaField.tsx
|
|
909
941
|
function ze(e) {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
form: e.form,
|
|
942
|
+
let t = U(e);
|
|
943
|
+
return s("textarea", u({
|
|
913
944
|
class: e.classNames.input,
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}, null);
|
|
917
|
-
}
|
|
918
|
-
function Y(e) {
|
|
919
|
-
let t = e.classNames.content ?? e.classNames.input ?? "ff-field__content", n = e.field.content?.rendered?.html?.trim();
|
|
920
|
-
return e.allowRawHtml && n ? s("div", {
|
|
921
|
-
class: t,
|
|
922
|
-
innerHTML: n
|
|
923
|
-
}, null) : e.field.instructions ? s("div", {
|
|
924
|
-
class: t,
|
|
925
|
-
role: "note"
|
|
926
|
-
}, [e.field.instructions]) : null;
|
|
945
|
+
rows: 4
|
|
946
|
+
}, t), null);
|
|
927
947
|
}
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region src/renderers/builtin/TextField.tsx
|
|
928
950
|
function Be(e) {
|
|
929
|
-
let t = e
|
|
930
|
-
return
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
alt: o
|
|
935
|
-
}, null) : null;
|
|
951
|
+
let t = U(e);
|
|
952
|
+
return s("input", u({
|
|
953
|
+
type: "text",
|
|
954
|
+
class: e.classNames.input
|
|
955
|
+
}, t), null);
|
|
936
956
|
}
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region src/renderers/builtin/UnsupportedField.tsx
|
|
937
959
|
function Ve(e) {
|
|
938
|
-
let t = G(e), n = e.field.frontend?.config ?? {}, r = n.useNativeTypes ? n.nativeInputType || "datetime-local" : "text";
|
|
939
|
-
return s(W, {
|
|
940
|
-
field: e.field,
|
|
941
|
-
form: e.form,
|
|
942
|
-
dataAttr: "data-freeform-datetime"
|
|
943
|
-
}, { default: () => [s("input", l({
|
|
944
|
-
type: r,
|
|
945
|
-
class: e.classNames.input,
|
|
946
|
-
"data-datepicker": "",
|
|
947
|
-
"data-datepicker-enabled": n.useDatepicker ? "1" : "0"
|
|
948
|
-
}, t), null)] });
|
|
949
|
-
}
|
|
950
|
-
function He(e) {
|
|
951
960
|
return s("div", {
|
|
952
961
|
class: e.classNames.input,
|
|
953
962
|
role: "alert"
|
|
954
963
|
}, [o("Unsupported field type: "), e.field.type]);
|
|
955
964
|
}
|
|
956
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
|
|
957
975
|
//#region src/renderers/builtin/CalculationField.tsx
|
|
958
976
|
var Ue = /* @__PURE__ */ c({
|
|
959
977
|
name: "CalculationFieldRenderer",
|
|
@@ -973,8 +991,8 @@ var Ue = /* @__PURE__ */ c({
|
|
|
973
991
|
value: { required: !0 }
|
|
974
992
|
},
|
|
975
993
|
setup(e) {
|
|
976
|
-
let t =
|
|
977
|
-
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(() => [
|
|
978
996
|
e.field.handle,
|
|
979
997
|
t.calculations,
|
|
980
998
|
t.decimalCount,
|
|
@@ -982,7 +1000,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
982
1000
|
], () => {
|
|
983
1001
|
let n = !1, i = t.calculations ?? "";
|
|
984
1002
|
return (async () => {
|
|
985
|
-
let a = await
|
|
1003
|
+
let a = await P(i, e.form.values, t.decimalCount);
|
|
986
1004
|
if (n) return;
|
|
987
1005
|
let o = a == null ? "" : String(a), s = e.form.getValue(e.field.handle);
|
|
988
1006
|
String(s ?? "") !== o && r.value(e.field.handle, o);
|
|
@@ -1036,17 +1054,17 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1036
1054
|
}
|
|
1037
1055
|
},
|
|
1038
1056
|
setup(e) {
|
|
1039
|
-
let t =
|
|
1040
|
-
function
|
|
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;
|
|
1058
|
+
function h(e) {
|
|
1041
1059
|
e.fillStyle = d, e.fillRect(0, 0, a, c);
|
|
1042
1060
|
}
|
|
1043
1061
|
function _() {
|
|
1044
1062
|
let n = t.value;
|
|
1045
1063
|
n && e.form.setValue(e.field.handle, n.toDataURL("image/png"));
|
|
1046
1064
|
}
|
|
1047
|
-
function
|
|
1065
|
+
function v() {
|
|
1048
1066
|
let n = t.value, i = n?.getContext("2d");
|
|
1049
|
-
!n || !i || (i.clearRect(0, 0, a, c),
|
|
1067
|
+
!n || !i || (i.clearRect(0, 0, a, c), h(i), r.value = !1, e.form.setValue(e.field.handle, ""));
|
|
1050
1068
|
}
|
|
1051
1069
|
function b() {
|
|
1052
1070
|
let n = t.value;
|
|
@@ -1055,7 +1073,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1055
1073
|
n.width = Math.floor(a * i), n.height = Math.floor(c * i), n.style.width = `${a}px`, n.style.height = `${c}px`;
|
|
1056
1074
|
let o = n.getContext("2d");
|
|
1057
1075
|
if (o) {
|
|
1058
|
-
if (o.setTransform(i, 0, 0, i, 0, 0),
|
|
1076
|
+
if (o.setTransform(i, 0, 0, i, 0, 0), h(o), o.strokeStyle = u, o.lineWidth = p, o.lineCap = "round", o.lineJoin = "round", typeof e.value == "string" && e.value.startsWith("data:")) {
|
|
1059
1077
|
let t = new Image();
|
|
1060
1078
|
t.onload = () => {
|
|
1061
1079
|
o.drawImage(t, 0, 0, a, c), r.value = !I(e.value);
|
|
@@ -1063,7 +1081,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1063
1081
|
} else r.value = !1;
|
|
1064
1082
|
}
|
|
1065
1083
|
}
|
|
1066
|
-
|
|
1084
|
+
m(b), O(() => [a, c], b), g(() => {
|
|
1067
1085
|
n.value = !1;
|
|
1068
1086
|
});
|
|
1069
1087
|
function x(e) {
|
|
@@ -1103,7 +1121,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1103
1121
|
if (!l) return;
|
|
1104
1122
|
let r = t.value, i = r?.getContext("2d");
|
|
1105
1123
|
if (!i || !r) return;
|
|
1106
|
-
n.value = !0, r.setPointerCapture(e.pointerId), i.strokeStyle = u, i.lineWidth =
|
|
1124
|
+
n.value = !0, r.setPointerCapture(e.pointerId), i.strokeStyle = u, i.lineWidth = p, i.lineCap = "round", i.lineJoin = "round";
|
|
1107
1125
|
let { x: a, y: o } = x(e);
|
|
1108
1126
|
i.beginPath(), i.moveTo(a, o);
|
|
1109
1127
|
},
|
|
@@ -1120,7 +1138,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1120
1138
|
}, null), i.showClearButton === !1 ? null : s("button", {
|
|
1121
1139
|
type: "button",
|
|
1122
1140
|
disabled: !r.value || !l,
|
|
1123
|
-
onClick:
|
|
1141
|
+
onClick: v
|
|
1124
1142
|
}, [o("Clear")])]);
|
|
1125
1143
|
}
|
|
1126
1144
|
}), Ge = /* @__PURE__ */ c({
|
|
@@ -1141,8 +1159,8 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1141
1159
|
}
|
|
1142
1160
|
},
|
|
1143
1161
|
setup(e) {
|
|
1144
|
-
let n = t(() =>
|
|
1145
|
-
|
|
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], () => {
|
|
1146
1164
|
o.value || (!Array.isArray(e.value) || e.value.length === 0) && (o.value = !0, e.form.setValue(e.field.handle, a.value));
|
|
1147
1165
|
}, { immediate: !0 });
|
|
1148
1166
|
let c = (t) => {
|
|
@@ -1152,7 +1170,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1152
1170
|
r[e][t] = n, c(r);
|
|
1153
1171
|
};
|
|
1154
1172
|
return () => {
|
|
1155
|
-
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);
|
|
1156
1174
|
return s("div", {
|
|
1157
1175
|
class: e.classNames.input,
|
|
1158
1176
|
"data-freeform-table": ""
|
|
@@ -1234,7 +1252,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1234
1252
|
l(r, i, e.target.value);
|
|
1235
1253
|
}
|
|
1236
1254
|
}, null)]);
|
|
1237
|
-
}), s("td", null, [
|
|
1255
|
+
}), s("td", null, [M(t, r, u) ? s("button", {
|
|
1238
1256
|
type: "button",
|
|
1239
1257
|
disabled: !d,
|
|
1240
1258
|
onClick: () => {
|
|
@@ -1243,7 +1261,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1243
1261
|
}, [u.removeButtonLabel || "Remove"]) : null])]))])]), f ? s("button", {
|
|
1244
1262
|
type: "button",
|
|
1245
1263
|
disabled: !d,
|
|
1246
|
-
onClick: () => c([...t,
|
|
1264
|
+
onClick: () => c([...t, ne(o)])
|
|
1247
1265
|
}, [u.addButtonLabel || "Add"]) : null]);
|
|
1248
1266
|
};
|
|
1249
1267
|
}
|
|
@@ -1398,7 +1416,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1398
1416
|
return () => s("div", { class: e.class }, [t.default?.()]);
|
|
1399
1417
|
}
|
|
1400
1418
|
});
|
|
1401
|
-
function
|
|
1419
|
+
function Y(e, t = "submit") {
|
|
1402
1420
|
return /* @__PURE__ */ c({
|
|
1403
1421
|
name: e,
|
|
1404
1422
|
props: {
|
|
@@ -1433,7 +1451,7 @@ function X(e, t = "submit") {
|
|
|
1433
1451
|
}
|
|
1434
1452
|
});
|
|
1435
1453
|
}
|
|
1436
|
-
var et =
|
|
1454
|
+
var et = Y("DefaultSubmitButton"), tt = Y("DefaultNextButton", "button"), nt = Y("DefaultBackButton", "button"), rt = Y("DefaultSaveButton", "button"), it = /* @__PURE__ */ c({
|
|
1437
1455
|
name: "DefaultSuccessMessage",
|
|
1438
1456
|
props: {
|
|
1439
1457
|
message: {
|
|
@@ -1451,80 +1469,80 @@ var et = X("DefaultSubmitButton"), tt = X("DefaultNextButton", "button"), nt = X
|
|
|
1451
1469
|
role: "status"
|
|
1452
1470
|
}, [e.message]);
|
|
1453
1471
|
}
|
|
1454
|
-
}),
|
|
1472
|
+
}), X = {
|
|
1455
1473
|
frontend: {
|
|
1456
|
-
text:
|
|
1457
|
-
textarea:
|
|
1474
|
+
text: Be,
|
|
1475
|
+
textarea: ze,
|
|
1458
1476
|
email: we,
|
|
1459
|
-
number:
|
|
1460
|
-
phone:
|
|
1461
|
-
website:
|
|
1462
|
-
regex:
|
|
1463
|
-
password:
|
|
1464
|
-
confirm:
|
|
1465
|
-
hidden:
|
|
1466
|
-
dropdown:
|
|
1467
|
-
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,
|
|
1468
1486
|
"multiple-select": ke,
|
|
1469
|
-
checkbox:
|
|
1470
|
-
checkboxes:
|
|
1487
|
+
checkbox: ye,
|
|
1488
|
+
checkboxes: ve,
|
|
1471
1489
|
radios: q,
|
|
1472
1490
|
radio: q,
|
|
1473
|
-
"opinion-scale":
|
|
1474
|
-
rating:
|
|
1475
|
-
cards:
|
|
1476
|
-
datetime:
|
|
1477
|
-
file:
|
|
1478
|
-
"file-upload":
|
|
1479
|
-
"file-dnd":
|
|
1480
|
-
html:
|
|
1481
|
-
"rich-text":
|
|
1482
|
-
image:
|
|
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,
|
|
1483
1501
|
table: Ge,
|
|
1484
1502
|
signature: We,
|
|
1485
1503
|
calculation: Ue,
|
|
1486
|
-
"payment.stripe":
|
|
1504
|
+
"payment.stripe": Re,
|
|
1487
1505
|
"payment.square": Le,
|
|
1488
|
-
"payment.paypal":
|
|
1489
|
-
"payment.mollie":
|
|
1506
|
+
"payment.paypal": Ne,
|
|
1507
|
+
"payment.mollie": Oe
|
|
1490
1508
|
},
|
|
1491
1509
|
types: {
|
|
1492
|
-
text:
|
|
1493
|
-
textarea:
|
|
1510
|
+
text: Be,
|
|
1511
|
+
textarea: ze,
|
|
1494
1512
|
email: we,
|
|
1495
|
-
number:
|
|
1496
|
-
phone:
|
|
1497
|
-
website:
|
|
1498
|
-
regex:
|
|
1499
|
-
password:
|
|
1500
|
-
confirm:
|
|
1501
|
-
hidden:
|
|
1502
|
-
select:
|
|
1503
|
-
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,
|
|
1504
1522
|
"multiple-select": ke,
|
|
1505
|
-
checkbox:
|
|
1506
|
-
checkboxes:
|
|
1523
|
+
checkbox: ye,
|
|
1524
|
+
checkboxes: ve,
|
|
1507
1525
|
radio: q,
|
|
1508
1526
|
radios: q,
|
|
1509
1527
|
radiobox: q,
|
|
1510
|
-
"opinion-scale":
|
|
1511
|
-
rating:
|
|
1512
|
-
cards:
|
|
1513
|
-
datetime:
|
|
1514
|
-
file:
|
|
1515
|
-
"file-upload":
|
|
1516
|
-
"file-dnd":
|
|
1517
|
-
html:
|
|
1518
|
-
"rich-text":
|
|
1519
|
-
image:
|
|
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,
|
|
1520
1538
|
table: Ge,
|
|
1521
1539
|
signature: We,
|
|
1522
1540
|
calculation: Ue,
|
|
1523
|
-
stripe:
|
|
1541
|
+
stripe: Re,
|
|
1524
1542
|
square: Le,
|
|
1525
|
-
paypal:
|
|
1526
|
-
mollie:
|
|
1527
|
-
_unsupported:
|
|
1543
|
+
paypal: Ne,
|
|
1544
|
+
mollie: Oe,
|
|
1545
|
+
_unsupported: Ve
|
|
1528
1546
|
}
|
|
1529
1547
|
}, at = {
|
|
1530
1548
|
Form: Ke,
|
|
@@ -1540,11 +1558,11 @@ var et = X("DefaultSubmitButton"), tt = X("DefaultNextButton", "button"), nt = X
|
|
|
1540
1558
|
BackButton: nt,
|
|
1541
1559
|
SaveButton: rt,
|
|
1542
1560
|
SuccessMessage: it,
|
|
1543
|
-
UnsupportedField:
|
|
1561
|
+
UnsupportedField: Ve
|
|
1544
1562
|
};
|
|
1545
1563
|
//#endregion
|
|
1546
1564
|
//#region src/theme/mergeClassNames.ts
|
|
1547
|
-
function
|
|
1565
|
+
function Z(...e) {
|
|
1548
1566
|
return e.filter((e) => typeof e == "string" && e.trim() !== "").join(" ").replace(/\s+/g, " ").trim() || void 0;
|
|
1549
1567
|
}
|
|
1550
1568
|
function ot(e, t, n) {
|
|
@@ -1552,162 +1570,47 @@ function ot(e, t, n) {
|
|
|
1552
1570
|
}
|
|
1553
1571
|
//#endregion
|
|
1554
1572
|
//#region src/theme/toBemModifier.ts
|
|
1555
|
-
function
|
|
1573
|
+
function Q(e) {
|
|
1556
1574
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").replace(/-+/g, "-").toLowerCase();
|
|
1557
1575
|
}
|
|
1558
1576
|
//#endregion
|
|
1559
|
-
//#region src/components/
|
|
1560
|
-
var ct = /* @__PURE__ */ c({
|
|
1561
|
-
__name: "
|
|
1577
|
+
//#region src/components/CaptchaHost.vue?vue&type=script&setup=true&lang.ts
|
|
1578
|
+
var st = ["data-freeform-captcha", "data-freeform-captcha-provider"], ct = /* @__PURE__ */ c({
|
|
1579
|
+
__name: "CaptchaHost",
|
|
1562
1580
|
props: {
|
|
1563
1581
|
form: {},
|
|
1564
|
-
|
|
1582
|
+
captcha: {}
|
|
1565
1583
|
},
|
|
1566
|
-
setup(
|
|
1567
|
-
let
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
let t = e.content?.rendered?.html?.trim();
|
|
1581
|
-
return !!(o.form.allowRawHtml && t || e.instructions);
|
|
1582
|
-
}
|
|
1583
|
-
return !0;
|
|
1584
|
+
setup(e) {
|
|
1585
|
+
let t = e, n = y(null), r;
|
|
1586
|
+
function a(e) {
|
|
1587
|
+
return [
|
|
1588
|
+
e.name,
|
|
1589
|
+
e.provider ?? "",
|
|
1590
|
+
e.siteKey ?? "",
|
|
1591
|
+
e.startMode ?? "",
|
|
1592
|
+
e.theme ?? "",
|
|
1593
|
+
e.locale ?? "",
|
|
1594
|
+
e.apiEndpoint ?? "",
|
|
1595
|
+
e.version ?? "",
|
|
1596
|
+
e.size ?? ""
|
|
1597
|
+
].join("|");
|
|
1584
1598
|
}
|
|
1585
|
-
function
|
|
1586
|
-
|
|
1599
|
+
function o() {
|
|
1600
|
+
r?.(), r = void 0, n.value && (r = t.form.mountCaptcha(t.captcha, n.value));
|
|
1587
1601
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
default: D(() => [
|
|
1601
|
-
a.form.formErrors.length > 0 ? (g(), n(S(s.value.Errors), {
|
|
1602
|
-
key: 0,
|
|
1603
|
-
errors: a.form.formErrors,
|
|
1604
|
-
class: u(a.form.theme.classNames?.errors),
|
|
1605
|
-
"error-class": a.form.theme.classNames?.error
|
|
1606
|
-
}, null, 8, [
|
|
1607
|
-
"errors",
|
|
1608
|
-
"class",
|
|
1609
|
-
"error-class"
|
|
1610
|
-
])) : r("", !0),
|
|
1611
|
-
(g(), n(S(s.value.Page), {
|
|
1612
|
-
form: a.form,
|
|
1613
|
-
"page-index": a.form.currentPageIndex,
|
|
1614
|
-
class: u(T(Q)(a.form.theme.classNames?.page, c.value === "merge" ? `ff-page--${a.form.currentPageIndex}` : void 0))
|
|
1615
|
-
}, {
|
|
1616
|
-
default: D(() => [(g(!0), i(e, null, y(f.value.rows, (t) => (g(), i(e, { key: t.uid }, [t.fields.filter((e) => {
|
|
1617
|
-
let t = a.form.manifest.fields[e];
|
|
1618
|
-
return t ? h(t) : !1;
|
|
1619
|
-
}).length > 0 ? (g(), n(S(s.value.Row), {
|
|
1620
|
-
key: 0,
|
|
1621
|
-
class: u(T(Q)(a.form.theme.classNames?.row, c.value === "merge" ? `ff-row--${t.fields.filter((e) => {
|
|
1622
|
-
let t = a.form.manifest.fields[e];
|
|
1623
|
-
return t ? h(t) : !1;
|
|
1624
|
-
}).length}-fields` : void 0))
|
|
1625
|
-
}, {
|
|
1626
|
-
default: D(() => [(g(!0), i(e, null, y(t.fields.filter((e) => {
|
|
1627
|
-
let t = a.form.manifest.fields[e];
|
|
1628
|
-
return t ? h(t) : !1;
|
|
1629
|
-
}), (e) => (g(), n(l, {
|
|
1630
|
-
key: e,
|
|
1631
|
-
field: a.form.manifest.fields[e],
|
|
1632
|
-
form: a.form,
|
|
1633
|
-
theme: a.form.theme,
|
|
1634
|
-
renderers: a.form.renderers,
|
|
1635
|
-
"allow-raw-html": a.form.allowRawHtml
|
|
1636
|
-
}, null, 8, [
|
|
1637
|
-
"field",
|
|
1638
|
-
"form",
|
|
1639
|
-
"theme",
|
|
1640
|
-
"renderers",
|
|
1641
|
-
"allow-raw-html"
|
|
1642
|
-
]))), 128))]),
|
|
1643
|
-
_: 2
|
|
1644
|
-
}, 1032, ["class"])) : r("", !0)], 64))), 128))]),
|
|
1645
|
-
_: 1
|
|
1646
|
-
}, 8, [
|
|
1647
|
-
"form",
|
|
1648
|
-
"page-index",
|
|
1649
|
-
"class"
|
|
1650
|
-
])),
|
|
1651
|
-
(g(!0), i(e, null, y(a.form.manifest.security.captchas ?? [], (e) => (g(), n(v, {
|
|
1652
|
-
key: e.name,
|
|
1653
|
-
form: a.form,
|
|
1654
|
-
captcha: e
|
|
1655
|
-
}, null, 8, ["form", "captcha"]))), 128)),
|
|
1656
|
-
(g(), n(S(s.value.ButtonRow), { class: u(a.form.theme.classNames?.buttons) }, {
|
|
1657
|
-
default: D(() => [
|
|
1658
|
-
!m.value && f.value.buttons?.back ? (g(), n(S(s.value.BackButton), {
|
|
1659
|
-
key: 0,
|
|
1660
|
-
label: f.value.buttons.back.label,
|
|
1661
|
-
class: u(a.form.theme.classNames?.backButton),
|
|
1662
|
-
disabled: a.form.isSubmitting,
|
|
1663
|
-
"on-click": () => void a.form.goBack()
|
|
1664
|
-
}, null, 40, [
|
|
1665
|
-
"label",
|
|
1666
|
-
"class",
|
|
1667
|
-
"disabled",
|
|
1668
|
-
"on-click"
|
|
1669
|
-
])) : r("", !0),
|
|
1670
|
-
a.form.manifest.settings.multiPage && !p.value && f.value.buttons?.submit ? (g(), n(S(s.value.NextButton), {
|
|
1671
|
-
key: 1,
|
|
1672
|
-
label: f.value.buttons.submit.label,
|
|
1673
|
-
class: u(a.form.theme.classNames?.nextButton),
|
|
1674
|
-
disabled: a.form.isSubmitting,
|
|
1675
|
-
"on-click": () => void a.form.goNext()
|
|
1676
|
-
}, null, 40, [
|
|
1677
|
-
"label",
|
|
1678
|
-
"class",
|
|
1679
|
-
"disabled",
|
|
1680
|
-
"on-click"
|
|
1681
|
-
])) : r("", !0),
|
|
1682
|
-
(!a.form.manifest.settings.multiPage || p.value) && f.value.buttons?.submit ? (g(), n(S(s.value.SubmitButton), {
|
|
1683
|
-
key: 2,
|
|
1684
|
-
label: f.value.buttons.submit.label,
|
|
1685
|
-
class: u(a.form.theme.classNames?.submitButton),
|
|
1686
|
-
disabled: a.form.isSubmitting
|
|
1687
|
-
}, null, 8, [
|
|
1688
|
-
"label",
|
|
1689
|
-
"class",
|
|
1690
|
-
"disabled"
|
|
1691
|
-
])) : r("", !0),
|
|
1692
|
-
f.value.buttons?.save ? (g(), n(S(s.value.SaveButton), {
|
|
1693
|
-
key: 3,
|
|
1694
|
-
label: f.value.buttons.save.label,
|
|
1695
|
-
class: u(a.form.theme.classNames?.saveButton),
|
|
1696
|
-
disabled: a.form.isSubmitting,
|
|
1697
|
-
"on-click": () => void a.form.saveDraft()
|
|
1698
|
-
}, null, 40, [
|
|
1699
|
-
"label",
|
|
1700
|
-
"class",
|
|
1701
|
-
"disabled",
|
|
1702
|
-
"on-click"
|
|
1703
|
-
])) : r("", !0)
|
|
1704
|
-
]),
|
|
1705
|
-
_: 1
|
|
1706
|
-
}, 8, ["class"]))
|
|
1707
|
-
]),
|
|
1708
|
-
_: 1
|
|
1709
|
-
}, 40, ["form", "class"]));
|
|
1710
|
-
};
|
|
1602
|
+
m(o), O(() => a(t.captcha), o), g(() => {
|
|
1603
|
+
r?.();
|
|
1604
|
+
});
|
|
1605
|
+
function s(e) {
|
|
1606
|
+
n.value = e ?? null;
|
|
1607
|
+
}
|
|
1608
|
+
return (t, n) => (_(), i("div", {
|
|
1609
|
+
ref: s,
|
|
1610
|
+
class: "ff-captcha",
|
|
1611
|
+
"data-freeform-captcha": e.captcha.name,
|
|
1612
|
+
"data-freeform-captcha-provider": e.captcha.provider ?? e.captcha.name
|
|
1613
|
+
}, null, 8, st));
|
|
1711
1614
|
}
|
|
1712
1615
|
});
|
|
1713
1616
|
//#endregion
|
|
@@ -1721,10 +1624,10 @@ function lt(e, t, n) {
|
|
|
1721
1624
|
n?.renderers?.handles?.[e.handle],
|
|
1722
1625
|
r ? n?.renderers?.frontend?.[r] : void 0,
|
|
1723
1626
|
n?.renderers?.types?.[e.type],
|
|
1724
|
-
r ?
|
|
1725
|
-
r ?
|
|
1726
|
-
|
|
1727
|
-
].find((e) => !!e) ??
|
|
1627
|
+
r ? X.frontend[r] : void 0,
|
|
1628
|
+
r ? X.types[r] : void 0,
|
|
1629
|
+
X.types[e.type]
|
|
1630
|
+
].find((e) => !!e) ?? X.types._unsupported;
|
|
1728
1631
|
}
|
|
1729
1632
|
//#endregion
|
|
1730
1633
|
//#region src/theme/resolveThemeClassNames.ts
|
|
@@ -1752,13 +1655,348 @@ function dt(e, t, n = !1) {
|
|
|
1752
1655
|
let o = t.frontend?.extension;
|
|
1753
1656
|
return o && (i = $(i, r?.[o])), n && i.inputError && (i = ut.has(t.type) ? {
|
|
1754
1657
|
...i,
|
|
1755
|
-
optionInput:
|
|
1658
|
+
optionInput: Z(i.optionInput, i.inputError)
|
|
1756
1659
|
} : {
|
|
1757
1660
|
...i,
|
|
1758
|
-
input:
|
|
1661
|
+
input: Z(i.input, i.inputError)
|
|
1759
1662
|
}), i;
|
|
1760
1663
|
}
|
|
1761
1664
|
//#endregion
|
|
1762
|
-
|
|
1665
|
+
//#region src/components/FieldRenderer.vue?vue&type=script&setup=true&lang.ts
|
|
1666
|
+
var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
1667
|
+
name: "FieldRenderer",
|
|
1668
|
+
__name: "FieldRenderer",
|
|
1669
|
+
props: {
|
|
1670
|
+
field: {},
|
|
1671
|
+
form: {},
|
|
1672
|
+
theme: {},
|
|
1673
|
+
renderers: {},
|
|
1674
|
+
allowRawHtml: { type: Boolean }
|
|
1675
|
+
},
|
|
1676
|
+
setup(o) {
|
|
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(() => ({
|
|
1678
|
+
...at,
|
|
1679
|
+
...s.theme.renderers?.components
|
|
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;
|
|
1682
|
+
if (s.field.type === "image") {
|
|
1683
|
+
let e = s.field.frontend?.config ?? {};
|
|
1684
|
+
return !!(s.field.content?.image?.src || e.src);
|
|
1685
|
+
}
|
|
1686
|
+
let e = s.field.content?.rendered?.html?.trim();
|
|
1687
|
+
return !!(s.allowRawHtml && e || s.field.instructions);
|
|
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(() => ({
|
|
1689
|
+
field: s.field,
|
|
1690
|
+
form: s.form,
|
|
1691
|
+
value: g.value,
|
|
1692
|
+
errors: u.value,
|
|
1693
|
+
input: s.form.getFieldProps(s.field.handle),
|
|
1694
|
+
classNames: p.value,
|
|
1695
|
+
allowRawHtml: s.allowRawHtml,
|
|
1696
|
+
renderLabel: () => null,
|
|
1697
|
+
renderInstructions: () => null,
|
|
1698
|
+
renderErrors: () => null
|
|
1699
|
+
}));
|
|
1700
|
+
return (t, s) => {
|
|
1701
|
+
let g = S("FieldRenderer", !0);
|
|
1702
|
+
return O.value ? (_(), i(e, { key: 0 }, [x.value ? (_(), n(C(m.value.FieldWrapper), {
|
|
1703
|
+
key: 0,
|
|
1704
|
+
field: o.field,
|
|
1705
|
+
form: o.form,
|
|
1706
|
+
class: d(k.value)
|
|
1707
|
+
}, {
|
|
1708
|
+
default: A(() => [(_(), n(C(h.value), f(l(j.value)), null, 16))]),
|
|
1709
|
+
_: 1
|
|
1710
|
+
}, 8, [
|
|
1711
|
+
"field",
|
|
1712
|
+
"form",
|
|
1713
|
+
"class"
|
|
1714
|
+
])) : o.field.type === "group" ? (_(), n(C(m.value.FieldWrapper), {
|
|
1715
|
+
key: 1,
|
|
1716
|
+
field: o.field,
|
|
1717
|
+
form: o.form,
|
|
1718
|
+
class: d(k.value)
|
|
1719
|
+
}, {
|
|
1720
|
+
default: A(() => [
|
|
1721
|
+
w.value ? (_(), n(C(m.value.Label), {
|
|
1722
|
+
key: 0,
|
|
1723
|
+
field: o.field,
|
|
1724
|
+
class: d(p.value.label),
|
|
1725
|
+
"required-indicator": o.theme.defaults?.requiredIndicator
|
|
1726
|
+
}, null, 8, [
|
|
1727
|
+
"field",
|
|
1728
|
+
"class",
|
|
1729
|
+
"required-indicator"
|
|
1730
|
+
])) : r("", !0),
|
|
1731
|
+
T.value ? (_(), n(C(m.value.Instructions), {
|
|
1732
|
+
key: 1,
|
|
1733
|
+
field: o.field,
|
|
1734
|
+
class: d(p.value.instructions)
|
|
1735
|
+
}, null, 8, ["field", "class"])) : r("", !0),
|
|
1736
|
+
a("div", {
|
|
1737
|
+
class: d(p.value.input),
|
|
1738
|
+
"data-freeform-group": o.field.handle
|
|
1739
|
+
}, [(_(!0), i(e, null, b(o.field.layout?.rows ?? [], (t) => (_(), n(C(m.value.Row), {
|
|
1740
|
+
key: t.uid,
|
|
1741
|
+
class: d(D(Z)(p.value.row, c.value === "merge" ? `ff-row--${t.fields.length}-fields` : void 0))
|
|
1742
|
+
}, {
|
|
1743
|
+
default: A(() => [(_(!0), i(e, null, b(t.fields, (e) => (_(), n(g, {
|
|
1744
|
+
key: e,
|
|
1745
|
+
field: o.form.manifest.fields[e],
|
|
1746
|
+
form: o.form,
|
|
1747
|
+
theme: o.theme,
|
|
1748
|
+
renderers: o.renderers,
|
|
1749
|
+
"allow-raw-html": o.allowRawHtml
|
|
1750
|
+
}, null, 8, [
|
|
1751
|
+
"field",
|
|
1752
|
+
"form",
|
|
1753
|
+
"theme",
|
|
1754
|
+
"renderers",
|
|
1755
|
+
"allow-raw-html"
|
|
1756
|
+
]))), 128))]),
|
|
1757
|
+
_: 2
|
|
1758
|
+
}, 1032, ["class"]))), 128))], 10, ft),
|
|
1759
|
+
E.value ? (_(), n(C(m.value.Errors), {
|
|
1760
|
+
key: 2,
|
|
1761
|
+
errors: u.value,
|
|
1762
|
+
class: d(p.value.errors),
|
|
1763
|
+
"error-class": p.value.error
|
|
1764
|
+
}, null, 8, [
|
|
1765
|
+
"errors",
|
|
1766
|
+
"class",
|
|
1767
|
+
"error-class"
|
|
1768
|
+
])) : r("", !0)
|
|
1769
|
+
]),
|
|
1770
|
+
_: 1
|
|
1771
|
+
}, 8, [
|
|
1772
|
+
"field",
|
|
1773
|
+
"form",
|
|
1774
|
+
"class"
|
|
1775
|
+
])) : (_(), n(C(m.value.FieldWrapper), {
|
|
1776
|
+
key: 2,
|
|
1777
|
+
field: o.field,
|
|
1778
|
+
form: o.form,
|
|
1779
|
+
class: d(k.value)
|
|
1780
|
+
}, {
|
|
1781
|
+
default: A(() => [
|
|
1782
|
+
w.value ? (_(), n(C(m.value.Label), {
|
|
1783
|
+
key: 0,
|
|
1784
|
+
field: o.field,
|
|
1785
|
+
class: d(p.value.label),
|
|
1786
|
+
"required-indicator": o.theme.defaults?.requiredIndicator
|
|
1787
|
+
}, null, 8, [
|
|
1788
|
+
"field",
|
|
1789
|
+
"class",
|
|
1790
|
+
"required-indicator"
|
|
1791
|
+
])) : r("", !0),
|
|
1792
|
+
T.value ? (_(), n(C(m.value.Instructions), {
|
|
1793
|
+
key: 1,
|
|
1794
|
+
field: o.field,
|
|
1795
|
+
class: d(p.value.instructions)
|
|
1796
|
+
}, null, 8, ["field", "class"])) : r("", !0),
|
|
1797
|
+
(_(), n(C(h.value), f(l(j.value)), null, 16)),
|
|
1798
|
+
E.value ? (_(), n(C(m.value.Errors), {
|
|
1799
|
+
key: 2,
|
|
1800
|
+
errors: u.value,
|
|
1801
|
+
class: d(p.value.errors),
|
|
1802
|
+
"error-class": p.value.error
|
|
1803
|
+
}, null, 8, [
|
|
1804
|
+
"errors",
|
|
1805
|
+
"class",
|
|
1806
|
+
"error-class"
|
|
1807
|
+
])) : r("", !0)
|
|
1808
|
+
]),
|
|
1809
|
+
_: 1
|
|
1810
|
+
}, 8, [
|
|
1811
|
+
"field",
|
|
1812
|
+
"form",
|
|
1813
|
+
"class"
|
|
1814
|
+
]))], 64)) : r("", !0);
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
}), mt = /* @__PURE__ */ c({
|
|
1818
|
+
__name: "FreeformView",
|
|
1819
|
+
props: {
|
|
1820
|
+
form: {},
|
|
1821
|
+
class: {}
|
|
1822
|
+
},
|
|
1823
|
+
setup(a) {
|
|
1824
|
+
let o = a, s = t(() => ({
|
|
1825
|
+
...at,
|
|
1826
|
+
...o.form.theme.renderers?.components
|
|
1827
|
+
})), c = t(() => o.form.theme.classNameStrategy ?? "merge"), l = t(() => o.form.theme.defaults?.colorScheme ?? "system"), u = t(() => Z(o.form.theme.classNames?.form, c.value === "merge" ? `ff-form--${Q(o.form.manifest.form.handle)}` : void 0, c.value === "merge" && (l.value === "light" || l.value === "dark") ? `ff-form--${l.value}` : void 0, o.class)), f = t(() => o.form.manifest.layout.pages[o.form.currentPageIndex] ?? o.form.manifest.layout.pages[0] ?? {
|
|
1828
|
+
rows: [],
|
|
1829
|
+
buttons: {}
|
|
1830
|
+
}), p = t(() => o.form.manifest.layout.pages.length === 0 || o.form.currentPageIndex >= o.form.manifest.layout.pages.length - 1), m = t(() => o.form.currentPageIndex === 0);
|
|
1831
|
+
function h(e) {
|
|
1832
|
+
if (e.type === "image") {
|
|
1833
|
+
let t = e.frontend?.config ?? {};
|
|
1834
|
+
return !!(e.content?.image?.src || t.src);
|
|
1835
|
+
}
|
|
1836
|
+
if (e.type === "html" || e.type === "rich-text") {
|
|
1837
|
+
let t = e.content?.rendered?.html?.trim();
|
|
1838
|
+
return !!(o.form.allowRawHtml && t || e.instructions);
|
|
1839
|
+
}
|
|
1840
|
+
return !0;
|
|
1841
|
+
}
|
|
1842
|
+
function g(e) {
|
|
1843
|
+
o.form.handleSubmit(e);
|
|
1844
|
+
}
|
|
1845
|
+
return (t, o) => a.form.isComplete && a.form.successMessage ? (_(), n(C(s.value.SuccessMessage), {
|
|
1846
|
+
key: 0,
|
|
1847
|
+
message: a.form.successMessage,
|
|
1848
|
+
class: d(a.form.theme.classNames?.success)
|
|
1849
|
+
}, null, 8, ["message", "class"])) : (_(), n(C(s.value.Form), {
|
|
1850
|
+
key: 1,
|
|
1851
|
+
form: a.form,
|
|
1852
|
+
class: d(u.value),
|
|
1853
|
+
"on-submit": g
|
|
1854
|
+
}, {
|
|
1855
|
+
default: A(() => [
|
|
1856
|
+
a.form.formErrors.length > 0 ? (_(), n(C(s.value.Errors), {
|
|
1857
|
+
key: 0,
|
|
1858
|
+
errors: a.form.formErrors,
|
|
1859
|
+
class: d(a.form.theme.classNames?.errors),
|
|
1860
|
+
"error-class": a.form.theme.classNames?.error
|
|
1861
|
+
}, null, 8, [
|
|
1862
|
+
"errors",
|
|
1863
|
+
"class",
|
|
1864
|
+
"error-class"
|
|
1865
|
+
])) : r("", !0),
|
|
1866
|
+
(_(), n(C(s.value.Page), {
|
|
1867
|
+
form: a.form,
|
|
1868
|
+
"page-index": a.form.currentPageIndex,
|
|
1869
|
+
class: d(D(Z)(a.form.theme.classNames?.page, c.value === "merge" ? `ff-page--${a.form.currentPageIndex}` : void 0))
|
|
1870
|
+
}, {
|
|
1871
|
+
default: A(() => [(_(!0), i(e, null, b(f.value.rows, (t) => (_(), i(e, { key: t.uid }, [t.fields.filter((e) => {
|
|
1872
|
+
let t = a.form.manifest.fields[e];
|
|
1873
|
+
return t ? h(t) : !1;
|
|
1874
|
+
}).length > 0 ? (_(), n(C(s.value.Row), {
|
|
1875
|
+
key: 0,
|
|
1876
|
+
class: d(D(Z)(a.form.theme.classNames?.row, c.value === "merge" ? `ff-row--${t.fields.filter((e) => {
|
|
1877
|
+
let t = a.form.manifest.fields[e];
|
|
1878
|
+
return t ? h(t) : !1;
|
|
1879
|
+
}).length}-fields` : void 0))
|
|
1880
|
+
}, {
|
|
1881
|
+
default: A(() => [(_(!0), i(e, null, b(t.fields.filter((e) => {
|
|
1882
|
+
let t = a.form.manifest.fields[e];
|
|
1883
|
+
return t ? h(t) : !1;
|
|
1884
|
+
}), (e) => (_(), n(pt, {
|
|
1885
|
+
key: e,
|
|
1886
|
+
field: a.form.manifest.fields[e],
|
|
1887
|
+
form: a.form,
|
|
1888
|
+
theme: a.form.theme,
|
|
1889
|
+
renderers: a.form.renderers,
|
|
1890
|
+
"allow-raw-html": a.form.allowRawHtml
|
|
1891
|
+
}, null, 8, [
|
|
1892
|
+
"field",
|
|
1893
|
+
"form",
|
|
1894
|
+
"theme",
|
|
1895
|
+
"renderers",
|
|
1896
|
+
"allow-raw-html"
|
|
1897
|
+
]))), 128))]),
|
|
1898
|
+
_: 2
|
|
1899
|
+
}, 1032, ["class"])) : r("", !0)], 64))), 128))]),
|
|
1900
|
+
_: 1
|
|
1901
|
+
}, 8, [
|
|
1902
|
+
"form",
|
|
1903
|
+
"page-index",
|
|
1904
|
+
"class"
|
|
1905
|
+
])),
|
|
1906
|
+
(_(!0), i(e, null, b(a.form.manifest.security.captchas ?? [], (e) => (_(), n(ct, {
|
|
1907
|
+
key: e.name,
|
|
1908
|
+
form: a.form,
|
|
1909
|
+
captcha: e
|
|
1910
|
+
}, null, 8, ["form", "captcha"]))), 128)),
|
|
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), {
|
|
1914
|
+
key: 0,
|
|
1915
|
+
label: f.value.buttons.back.label,
|
|
1916
|
+
class: d(a.form.theme.classNames?.backButton),
|
|
1917
|
+
disabled: a.form.isSubmitting,
|
|
1918
|
+
"on-click": () => void a.form.goBack()
|
|
1919
|
+
}, null, 40, [
|
|
1920
|
+
"label",
|
|
1921
|
+
"class",
|
|
1922
|
+
"disabled",
|
|
1923
|
+
"on-click"
|
|
1924
|
+
])) : r("", !0),
|
|
1925
|
+
a.form.manifest.settings.multiPage && !p.value && f.value.buttons?.submit ? (_(), n(C(s.value.NextButton), {
|
|
1926
|
+
key: 1,
|
|
1927
|
+
label: f.value.buttons.submit.label,
|
|
1928
|
+
class: d(a.form.theme.classNames?.nextButton),
|
|
1929
|
+
disabled: a.form.isSubmitting,
|
|
1930
|
+
"on-click": () => void a.form.goNext()
|
|
1931
|
+
}, null, 40, [
|
|
1932
|
+
"label",
|
|
1933
|
+
"class",
|
|
1934
|
+
"disabled",
|
|
1935
|
+
"on-click"
|
|
1936
|
+
])) : r("", !0),
|
|
1937
|
+
(!a.form.manifest.settings.multiPage || p.value) && f.value.buttons?.submit ? (_(), n(C(s.value.SubmitButton), {
|
|
1938
|
+
key: 2,
|
|
1939
|
+
label: f.value.buttons.submit.label,
|
|
1940
|
+
class: d(a.form.theme.classNames?.submitButton),
|
|
1941
|
+
disabled: a.form.isSubmitting
|
|
1942
|
+
}, null, 8, [
|
|
1943
|
+
"label",
|
|
1944
|
+
"class",
|
|
1945
|
+
"disabled"
|
|
1946
|
+
])) : r("", !0),
|
|
1947
|
+
f.value.buttons?.save ? (_(), n(C(s.value.SaveButton), {
|
|
1948
|
+
key: 3,
|
|
1949
|
+
label: f.value.buttons.save.label,
|
|
1950
|
+
class: d(a.form.theme.classNames?.saveButton),
|
|
1951
|
+
disabled: a.form.isSubmitting,
|
|
1952
|
+
"on-click": () => void a.form.saveDraft()
|
|
1953
|
+
}, null, 40, [
|
|
1954
|
+
"label",
|
|
1955
|
+
"class",
|
|
1956
|
+
"disabled",
|
|
1957
|
+
"on-click"
|
|
1958
|
+
])) : r("", !0)
|
|
1959
|
+
]),
|
|
1960
|
+
_: 1
|
|
1961
|
+
}, 8, ["class"]))
|
|
1962
|
+
]),
|
|
1963
|
+
_: 1
|
|
1964
|
+
}, 40, ["form", "class"]));
|
|
1965
|
+
}
|
|
1966
|
+
}), ht = { role: "alert" }, gt = /* @__PURE__ */ c({
|
|
1967
|
+
__name: "Freeform",
|
|
1968
|
+
props: {
|
|
1969
|
+
handle: {},
|
|
1970
|
+
profile: {},
|
|
1971
|
+
properties: {},
|
|
1972
|
+
baseUrl: {},
|
|
1973
|
+
manifest: {},
|
|
1974
|
+
initialValues: {},
|
|
1975
|
+
draftToken: {},
|
|
1976
|
+
draftKey: {},
|
|
1977
|
+
clientVersion: {},
|
|
1978
|
+
fetch: {},
|
|
1979
|
+
credentials: {},
|
|
1980
|
+
theme: {},
|
|
1981
|
+
renderers: {},
|
|
1982
|
+
extensions: {},
|
|
1983
|
+
allowRawHtml: { type: Boolean },
|
|
1984
|
+
onSuccess: { type: Function },
|
|
1985
|
+
onError: { type: Function },
|
|
1986
|
+
onManifestLoaded: { type: Function },
|
|
1987
|
+
class: {},
|
|
1988
|
+
loadingMessage: {}
|
|
1989
|
+
},
|
|
1990
|
+
setup(e) {
|
|
1991
|
+
let i = e, o = ge(() => i), c = t(() => o.manifest ? o : null);
|
|
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, {
|
|
1993
|
+
key: 3,
|
|
1994
|
+
form: c.value,
|
|
1995
|
+
class: d(i.class)
|
|
1996
|
+
}, null, 8, ["form", "class"])) : r("", !0);
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
//#endregion
|
|
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 };
|
|
1763
2001
|
|
|
1764
2002
|
//# sourceMappingURL=index.js.map
|