@solspace/freeform-vue 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +576 -394
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
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 ee, ref as v, renderList as y, renderSlot as b, resolveComponent as x, resolveDynamicComponent as S, shallowRef as C, toDisplayString as w, toValue as T, unref as E, watch as D, watchEffect as O, withCtx as k } from "vue";
|
|
2
|
+
import { canAddTableRow as A, canRemoveTableRow as j, collectExtensionSubmitMeta as te, createFormState as ne, createFreeformClient as re, emptyTableRow as ie, evaluateCalculation as M, getCalculationConfig as N, getSignatureConfig as P, getTableConfig as F, 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, y(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,7 +46,7 @@ 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, w(t.message), 1)], 10, z));
|
|
50
50
|
}
|
|
51
51
|
}), [["__scopeId", "data-v-36bcdb81"]]), H = {
|
|
52
52
|
name: "default",
|
|
@@ -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.19", 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(() => T(e)), r = t(() => n.value.theme ?? H), i = t(() => n.value.renderers ?? {}), a = t(() => n.value.allowRawHtml ?? !1), o = C(null), s = C(null), c = C(/* @__PURE__ */ new Map()), l = C(/* @__PURE__ */ new Map()), u = C([]), d = v(0), f = v(null), p = v(n.value.manifest ?? null), m = v(!n.value.manifest), g = v(null), _ = v(!1), y = v(!1), b = v(null), x = v({
|
|
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
|
+
D(() => n.value.extensions, (e) => {
|
|
166
166
|
u.value = e ?? [];
|
|
167
167
|
}, { immediate: !0 });
|
|
168
|
-
function
|
|
168
|
+
function S() {
|
|
169
169
|
let e = s.value;
|
|
170
|
-
e && (d.value += 1,
|
|
170
|
+
e && (d.value += 1, x.value = he(e, d.value));
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function w() {
|
|
173
173
|
o.value ||= re({
|
|
174
174
|
baseUrl: n.value.baseUrl,
|
|
175
|
-
clientVersion: n.value.clientVersion ?? "0.1.
|
|
175
|
+
clientVersion: n.value.clientVersion ?? "0.1.19",
|
|
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
|
+
D(() => n.value.extensions, () => {
|
|
183
|
+
let e = w();
|
|
184
184
|
for (let t of u.value) e.extensions.register(t);
|
|
185
|
-
}),
|
|
186
|
-
e &&
|
|
187
|
-
}),
|
|
185
|
+
}), D(p, (e) => {
|
|
186
|
+
e && se(u.value, { manifest: e });
|
|
187
|
+
}), D(() => [
|
|
188
188
|
n.value.handle,
|
|
189
189
|
n.value.profile,
|
|
190
190
|
n.value.properties,
|
|
@@ -192,59 +192,59 @@ function me(e) {
|
|
|
192
192
|
n.value.initialValues
|
|
193
193
|
], () => {
|
|
194
194
|
if (n.value.manifest) {
|
|
195
|
-
s.value =
|
|
195
|
+
s.value = ne({
|
|
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, S(), 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
|
-
let t = await
|
|
211
|
+
let t = await w().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 = ne({
|
|
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, S(), 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 }), D(() => [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 E(e, t) {
|
|
236
|
+
s.value?.setValue(e, t), S();
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function k(e) {
|
|
239
239
|
return s.value?.getValue(e);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function A(e) {
|
|
242
242
|
return s.value?.isFieldVisible(e) ?? !1;
|
|
243
243
|
}
|
|
244
244
|
function j(e) {
|
|
245
245
|
return s.value?.isFieldEnabled(e) ?? !0;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function ie(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,14 +252,14 @@ function me(e) {
|
|
|
252
252
|
value: r ?? "",
|
|
253
253
|
onChange: (t) => {
|
|
254
254
|
let n = t.target;
|
|
255
|
-
|
|
255
|
+
E(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
|
+
}, S());
|
|
263
263
|
},
|
|
264
264
|
disabled: !j(e),
|
|
265
265
|
required: n?.required ?? !1,
|
|
@@ -267,45 +267,45 @@ function me(e) {
|
|
|
267
267
|
"aria-invalid": (t?.fieldErrors[e]?.length ?? 0) > 0
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
async function
|
|
270
|
+
async function M(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 te(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 w().submit({
|
|
286
286
|
manifest: r,
|
|
287
287
|
request: {
|
|
288
288
|
values: a,
|
|
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.19",
|
|
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), S(), 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 && (y.value = !0, b.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 = [], S()), 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 N = () => M("validate"), P = () => M("next"), F = () => M("back"), I = () => M("saveDraft");
|
|
325
|
+
D(() => [
|
|
326
326
|
p.value,
|
|
327
327
|
n.value.draftToken,
|
|
328
328
|
n.value.draftKey
|
|
@@ -331,28 +331,28 @@ 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, M("validate"));
|
|
335
335
|
});
|
|
336
|
-
function
|
|
337
|
-
p.value && (s.value =
|
|
336
|
+
function L() {
|
|
337
|
+
p.value && (s.value = ne({
|
|
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
|
+
}), y.value = !1, b.value = null, S());
|
|
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;
|
|
348
|
-
let n = t.layout.pages, r = n.length === 0 ||
|
|
348
|
+
let n = t.layout.pages, r = n.length === 0 || x.value.currentPageIndex >= n.length - 1;
|
|
349
349
|
if (t.settings.multiPage && !r) {
|
|
350
|
-
await
|
|
350
|
+
await P();
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
await
|
|
353
|
+
await M("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), S();
|
|
374
374
|
},
|
|
375
375
|
getValues: () => s.value?.getValuesForSubmit() ?? {},
|
|
376
376
|
baseUrl: n.value.baseUrl,
|
|
377
377
|
requestSubmit: () => {
|
|
378
|
-
|
|
378
|
+
M("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,35 +415,35 @@ 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,
|
|
422
|
-
values:
|
|
423
|
-
touched:
|
|
424
|
-
fieldErrors:
|
|
425
|
-
formErrors:
|
|
426
|
-
pageErrors:
|
|
427
|
-
currentPageIndex:
|
|
428
|
-
isSubmitting:
|
|
429
|
-
isComplete:
|
|
430
|
-
successMessage:
|
|
431
|
-
setValue:
|
|
432
|
-
getValue:
|
|
433
|
-
isFieldVisible:
|
|
422
|
+
values: x.value.values,
|
|
423
|
+
touched: x.value.touched,
|
|
424
|
+
fieldErrors: x.value.fieldErrors,
|
|
425
|
+
formErrors: x.value.formErrors,
|
|
426
|
+
pageErrors: x.value.pageErrors,
|
|
427
|
+
currentPageIndex: x.value.currentPageIndex,
|
|
428
|
+
isSubmitting: _.value,
|
|
429
|
+
isComplete: y.value,
|
|
430
|
+
successMessage: b.value,
|
|
431
|
+
setValue: E,
|
|
432
|
+
getValue: k,
|
|
433
|
+
isFieldVisible: A,
|
|
434
434
|
isFieldEnabled: j,
|
|
435
|
-
getFieldProps:
|
|
436
|
-
submit:
|
|
437
|
-
validate:
|
|
438
|
-
goNext:
|
|
439
|
-
goBack:
|
|
440
|
-
saveDraft:
|
|
441
|
-
reset:
|
|
442
|
-
handleSubmit:
|
|
443
|
-
mountFieldExtension:
|
|
444
|
-
mountCaptcha:
|
|
435
|
+
getFieldProps: ie,
|
|
436
|
+
submit: M,
|
|
437
|
+
validate: N,
|
|
438
|
+
goNext: P,
|
|
439
|
+
goBack: F,
|
|
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: {},
|
|
@@ -453,85 +453,47 @@ function me(e) {
|
|
|
453
453
|
isSubmitting: !1,
|
|
454
454
|
isComplete: !1,
|
|
455
455
|
successMessage: null,
|
|
456
|
-
setValue:
|
|
457
|
-
getValue:
|
|
458
|
-
isFieldVisible:
|
|
456
|
+
setValue: E,
|
|
457
|
+
getValue: k,
|
|
458
|
+
isFieldVisible: A,
|
|
459
459
|
isFieldEnabled: j,
|
|
460
|
-
getFieldProps:
|
|
461
|
-
submit:
|
|
462
|
-
validate:
|
|
463
|
-
goNext:
|
|
464
|
-
goBack:
|
|
465
|
-
saveDraft:
|
|
466
|
-
reset:
|
|
467
|
-
handleSubmit:
|
|
468
|
-
mountFieldExtension:
|
|
469
|
-
mountCaptcha:
|
|
470
|
-
},
|
|
471
|
-
return
|
|
472
|
-
let e =
|
|
460
|
+
getFieldProps: ie,
|
|
461
|
+
submit: M,
|
|
462
|
+
validate: N,
|
|
463
|
+
goNext: P,
|
|
464
|
+
goBack: F,
|
|
465
|
+
saveDraft: I,
|
|
466
|
+
reset: L,
|
|
467
|
+
handleSubmit: R,
|
|
468
|
+
mountFieldExtension: z,
|
|
469
|
+
mountCaptcha: B
|
|
470
|
+
}, V = ee({});
|
|
471
|
+
return O(() => {
|
|
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/components/Freeform.vue?vue&type=script&setup=true&lang.ts
|
|
498
|
-
var he = { role: "alert" }, ge = /* @__PURE__ */ c({
|
|
499
|
-
__name: "Freeform",
|
|
500
|
-
props: {
|
|
501
|
-
handle: {},
|
|
502
|
-
profile: {},
|
|
503
|
-
properties: {},
|
|
504
|
-
baseUrl: {},
|
|
505
|
-
manifest: {},
|
|
506
|
-
initialValues: {},
|
|
507
|
-
draftToken: {},
|
|
508
|
-
draftKey: {},
|
|
509
|
-
clientVersion: {},
|
|
510
|
-
fetch: {},
|
|
511
|
-
credentials: {},
|
|
512
|
-
theme: {},
|
|
513
|
-
renderers: {},
|
|
514
|
-
extensions: {},
|
|
515
|
-
allowRawHtml: { type: Boolean },
|
|
516
|
-
onSuccess: { type: Function },
|
|
517
|
-
onError: { type: Function },
|
|
518
|
-
onManifestLoaded: { type: Function },
|
|
519
|
-
class: {},
|
|
520
|
-
loadingMessage: {}
|
|
521
|
-
},
|
|
522
|
-
setup(e) {
|
|
523
|
-
let i = e, o = me(() => i), c = t(() => o.manifest ? o : null);
|
|
524
|
-
return (t, l) => {
|
|
525
|
-
let d = x("FormLoader"), f = x("FreeformView");
|
|
526
|
-
return t.$slots.default ? b(t.$slots, "default", { form: T(o) }, void 0, void 0, 0) : T(o).loading ? b(t.$slots, "loading", {}, () => [s(d, { message: e.loadingMessage ?? "Loading form…" }, null, 8, ["message"])], void 0, 1) : T(o).error ? b(t.$slots, "error", { error: T(o).error }, () => [a("div", he, w(T(o).error.message), 1)], void 0, 2) : c.value ? (g(), n(f, {
|
|
527
|
-
key: 3,
|
|
528
|
-
form: c.value,
|
|
529
|
-
class: u(i.class)
|
|
530
|
-
}, null, 8, ["form", "class"])) : r("", !0);
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
//#endregion
|
|
535
497
|
//#region src/composables/useFieldExtension.ts
|
|
536
498
|
function _e(e, t) {
|
|
537
499
|
let n = v(null), r;
|
|
@@ -540,17 +502,17 @@ function _e(e, t) {
|
|
|
540
502
|
let i = n.value;
|
|
541
503
|
!i || !e.frontend?.extension || t.isFieldVisible(e.handle) && (r = t.mountFieldExtension(e.handle, i));
|
|
542
504
|
}
|
|
543
|
-
return
|
|
505
|
+
return m(i), D(() => [
|
|
544
506
|
e.frontend?.extension,
|
|
545
507
|
e.handle,
|
|
546
508
|
t.isFieldVisible(e.handle)
|
|
547
|
-
], i),
|
|
509
|
+
], i), g(() => {
|
|
548
510
|
r?.();
|
|
549
511
|
}), n;
|
|
550
512
|
}
|
|
551
513
|
//#endregion
|
|
552
514
|
//#region src/components/ExtensionHost.vue?vue&type=script&setup=true&lang.ts
|
|
553
|
-
var ve = ["hidden"],
|
|
515
|
+
var ve = ["hidden"], U = /* @__PURE__ */ c({
|
|
554
516
|
__name: "ExtensionHost",
|
|
555
517
|
props: {
|
|
556
518
|
field: {},
|
|
@@ -565,7 +527,7 @@ var ve = ["hidden"], W = /* @__PURE__ */ c({
|
|
|
565
527
|
function r(e) {
|
|
566
528
|
n.value = e ?? null;
|
|
567
529
|
}
|
|
568
|
-
return (n, a) => (
|
|
530
|
+
return (n, a) => (_(), i("div", f({
|
|
569
531
|
ref: r,
|
|
570
532
|
class: t.class,
|
|
571
533
|
[e.dataAttr || ""]: e.dataValue ?? e.field.handle,
|
|
@@ -575,7 +537,7 @@ var ve = ["hidden"], W = /* @__PURE__ */ c({
|
|
|
575
537
|
});
|
|
576
538
|
//#endregion
|
|
577
539
|
//#region src/renderers/builtin/fields.tsx
|
|
578
|
-
function
|
|
540
|
+
function W(e) {
|
|
579
541
|
let t = e.input;
|
|
580
542
|
return {
|
|
581
543
|
...t,
|
|
@@ -583,82 +545,82 @@ function G(e) {
|
|
|
583
545
|
};
|
|
584
546
|
}
|
|
585
547
|
function ye(e) {
|
|
586
|
-
let t =
|
|
587
|
-
return s("input",
|
|
548
|
+
let t = W(e);
|
|
549
|
+
return s("input", u({
|
|
588
550
|
type: "text",
|
|
589
551
|
class: e.classNames.input
|
|
590
552
|
}, t), null);
|
|
591
553
|
}
|
|
592
554
|
function be(e) {
|
|
593
|
-
let t =
|
|
594
|
-
return s("input",
|
|
555
|
+
let t = W(e);
|
|
556
|
+
return s("input", u({
|
|
595
557
|
type: "url",
|
|
596
558
|
class: e.classNames.input
|
|
597
559
|
}, t), null);
|
|
598
560
|
}
|
|
599
561
|
function xe(e) {
|
|
600
|
-
let t =
|
|
601
|
-
return s("input",
|
|
562
|
+
let t = W(e), n = e.field.validation?.pattern || (e.field.frontend?.config?.pattern ?? void 0);
|
|
563
|
+
return s("input", u({
|
|
602
564
|
type: "text",
|
|
603
565
|
class: e.classNames.input,
|
|
604
566
|
pattern: n || void 0
|
|
605
567
|
}, t), null);
|
|
606
568
|
}
|
|
607
569
|
function Se(e) {
|
|
608
|
-
let t =
|
|
609
|
-
return s("input",
|
|
570
|
+
let t = W(e);
|
|
571
|
+
return s("input", u({
|
|
610
572
|
type: "password",
|
|
611
573
|
class: e.classNames.input
|
|
612
574
|
}, t), null);
|
|
613
575
|
}
|
|
614
576
|
function Ce(e) {
|
|
615
|
-
let t =
|
|
616
|
-
return s("input",
|
|
577
|
+
let t = W(e), n = e.field.frontend?.config?.targetType === "password" ? "password" : "text";
|
|
578
|
+
return s("input", u({
|
|
617
579
|
type: n,
|
|
618
580
|
class: e.classNames.input
|
|
619
581
|
}, t), null);
|
|
620
582
|
}
|
|
621
583
|
function we(e) {
|
|
622
|
-
let t =
|
|
623
|
-
return s("input",
|
|
584
|
+
let t = W(e);
|
|
585
|
+
return s("input", u({
|
|
624
586
|
type: "email",
|
|
625
587
|
class: e.classNames.input
|
|
626
588
|
}, t), null);
|
|
627
589
|
}
|
|
628
590
|
function Te(e) {
|
|
629
|
-
let t =
|
|
630
|
-
return s("input",
|
|
591
|
+
let t = W(e);
|
|
592
|
+
return s("input", u({
|
|
631
593
|
type: "number",
|
|
632
594
|
class: e.classNames.input
|
|
633
595
|
}, t), null);
|
|
634
596
|
}
|
|
635
597
|
function Ee(e) {
|
|
636
|
-
let t =
|
|
637
|
-
return s("input",
|
|
598
|
+
let t = W(e);
|
|
599
|
+
return s("input", u({
|
|
638
600
|
type: "tel",
|
|
639
601
|
class: e.classNames.input
|
|
640
602
|
}, t), null);
|
|
641
603
|
}
|
|
642
604
|
function De(e) {
|
|
643
|
-
let t =
|
|
644
|
-
return s("input",
|
|
605
|
+
let t = W(e);
|
|
606
|
+
return s("input", u({ type: "hidden" }, t), null);
|
|
645
607
|
}
|
|
646
608
|
function Oe(e) {
|
|
647
|
-
let t =
|
|
648
|
-
return s("textarea",
|
|
609
|
+
let t = W(e);
|
|
610
|
+
return s("textarea", u({
|
|
649
611
|
class: e.classNames.input,
|
|
650
612
|
rows: 4
|
|
651
613
|
}, t), null);
|
|
652
614
|
}
|
|
653
|
-
function
|
|
654
|
-
let t =
|
|
655
|
-
return s("select",
|
|
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", {
|
|
656
618
|
key: e.value,
|
|
657
619
|
value: e.value
|
|
658
620
|
}, [e.label]))]);
|
|
659
621
|
}
|
|
660
622
|
function ke(e) {
|
|
661
|
-
let t =
|
|
623
|
+
let t = W(e), n = Array.isArray(e.value) ? e.value.map(String) : e.value ? [String(e.value)] : [];
|
|
662
624
|
return s("select", {
|
|
663
625
|
class: e.classNames.input,
|
|
664
626
|
id: t.id,
|
|
@@ -678,7 +640,7 @@ function ke(e) {
|
|
|
678
640
|
}, [e.label]))]);
|
|
679
641
|
}
|
|
680
642
|
function Ae(e) {
|
|
681
|
-
let t =
|
|
643
|
+
let t = W(e), n = t.value === "1" || e.value === !0 || t.value === "true";
|
|
682
644
|
return s("label", { class: e.classNames.optionLabel ?? e.classNames.input }, [s("input", {
|
|
683
645
|
type: "checkbox",
|
|
684
646
|
class: e.classNames.optionInput,
|
|
@@ -711,7 +673,7 @@ function je(e) {
|
|
|
711
673
|
}
|
|
712
674
|
}, null), s("span", null, [n.label])]))]);
|
|
713
675
|
}
|
|
714
|
-
function
|
|
676
|
+
function K(e) {
|
|
715
677
|
let t = String(e.value ?? "");
|
|
716
678
|
return s("div", {
|
|
717
679
|
class: e.classNames.input,
|
|
@@ -852,8 +814,8 @@ function Pe(e) {
|
|
|
852
814
|
]);
|
|
853
815
|
})]);
|
|
854
816
|
}
|
|
855
|
-
function
|
|
856
|
-
let t =
|
|
817
|
+
function q(e) {
|
|
818
|
+
let t = W(e), n = e.field.frontend?.config ?? {};
|
|
857
819
|
return s("input", {
|
|
858
820
|
type: "file",
|
|
859
821
|
class: e.classNames.input,
|
|
@@ -875,7 +837,7 @@ function J(e) {
|
|
|
875
837
|
}, null);
|
|
876
838
|
}
|
|
877
839
|
function Fe(e) {
|
|
878
|
-
return s(
|
|
840
|
+
return s(U, {
|
|
879
841
|
field: e.field,
|
|
880
842
|
form: e.form,
|
|
881
843
|
class: e.classNames.input,
|
|
@@ -883,7 +845,7 @@ function Fe(e) {
|
|
|
883
845
|
}, null);
|
|
884
846
|
}
|
|
885
847
|
function Ie(e) {
|
|
886
|
-
return s(
|
|
848
|
+
return s(U, {
|
|
887
849
|
field: e.field,
|
|
888
850
|
form: e.form,
|
|
889
851
|
class: e.classNames.input,
|
|
@@ -891,7 +853,7 @@ function Ie(e) {
|
|
|
891
853
|
}, null);
|
|
892
854
|
}
|
|
893
855
|
function Le(e) {
|
|
894
|
-
return s(
|
|
856
|
+
return s(U, {
|
|
895
857
|
field: e.field,
|
|
896
858
|
form: e.form,
|
|
897
859
|
class: e.classNames.input,
|
|
@@ -899,7 +861,7 @@ function Le(e) {
|
|
|
899
861
|
}, null);
|
|
900
862
|
}
|
|
901
863
|
function Re(e) {
|
|
902
|
-
return s(
|
|
864
|
+
return s(U, {
|
|
903
865
|
field: e.field,
|
|
904
866
|
form: e.form,
|
|
905
867
|
class: e.classNames.input,
|
|
@@ -907,7 +869,7 @@ function Re(e) {
|
|
|
907
869
|
}, null);
|
|
908
870
|
}
|
|
909
871
|
function ze(e) {
|
|
910
|
-
return s(
|
|
872
|
+
return s(U, {
|
|
911
873
|
field: e.field,
|
|
912
874
|
form: e.form,
|
|
913
875
|
class: e.classNames.input,
|
|
@@ -915,7 +877,7 @@ function ze(e) {
|
|
|
915
877
|
hidden: !0
|
|
916
878
|
}, null);
|
|
917
879
|
}
|
|
918
|
-
function
|
|
880
|
+
function J(e) {
|
|
919
881
|
let t = e.classNames.content ?? e.classNames.input ?? "ff-field__content", n = e.field.content?.rendered?.html?.trim();
|
|
920
882
|
return e.allowRawHtml && n ? s("div", {
|
|
921
883
|
class: t,
|
|
@@ -935,12 +897,12 @@ function Be(e) {
|
|
|
935
897
|
}, null) : null;
|
|
936
898
|
}
|
|
937
899
|
function Ve(e) {
|
|
938
|
-
let t =
|
|
939
|
-
return s(
|
|
900
|
+
let t = W(e), n = e.field.frontend?.config ?? {}, r = n.useNativeTypes ? n.nativeInputType || "datetime-local" : "text";
|
|
901
|
+
return s(U, {
|
|
940
902
|
field: e.field,
|
|
941
903
|
form: e.form,
|
|
942
904
|
dataAttr: "data-freeform-datetime"
|
|
943
|
-
}, { default: () => [s("input",
|
|
905
|
+
}, { default: () => [s("input", u({
|
|
944
906
|
type: r,
|
|
945
907
|
class: e.classNames.input,
|
|
946
908
|
"data-datepicker": "",
|
|
@@ -974,7 +936,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
974
936
|
},
|
|
975
937
|
setup(e) {
|
|
976
938
|
let t = N(e.field.frontend?.config), n = t.inputType ?? "regularTextInput", r = C(e.form.setValue);
|
|
977
|
-
return r.value = e.form.setValue,
|
|
939
|
+
return r.value = e.form.setValue, D(() => [
|
|
978
940
|
e.field.handle,
|
|
979
941
|
t.calculations,
|
|
980
942
|
t.decimalCount,
|
|
@@ -1036,26 +998,26 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1036
998
|
}
|
|
1037
999
|
},
|
|
1038
1000
|
setup(e) {
|
|
1039
|
-
let t = C(null), n = C(!1), r = v(!I(e.value)), i = P(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",
|
|
1040
|
-
function
|
|
1001
|
+
let t = C(null), n = C(!1), r = v(!I(e.value)), i = P(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
|
+
function h(e) {
|
|
1041
1003
|
e.fillStyle = d, e.fillRect(0, 0, a, c);
|
|
1042
1004
|
}
|
|
1043
1005
|
function _() {
|
|
1044
1006
|
let n = t.value;
|
|
1045
1007
|
n && e.form.setValue(e.field.handle, n.toDataURL("image/png"));
|
|
1046
1008
|
}
|
|
1047
|
-
function
|
|
1009
|
+
function ee() {
|
|
1048
1010
|
let n = t.value, i = n?.getContext("2d");
|
|
1049
|
-
!n || !i || (i.clearRect(0, 0, a, c),
|
|
1011
|
+
!n || !i || (i.clearRect(0, 0, a, c), h(i), r.value = !1, e.form.setValue(e.field.handle, ""));
|
|
1050
1012
|
}
|
|
1051
|
-
function
|
|
1013
|
+
function y() {
|
|
1052
1014
|
let n = t.value;
|
|
1053
1015
|
if (!n) return;
|
|
1054
1016
|
let i = typeof window < "u" && window.devicePixelRatio || 1;
|
|
1055
1017
|
n.width = Math.floor(a * i), n.height = Math.floor(c * i), n.style.width = `${a}px`, n.style.height = `${c}px`;
|
|
1056
1018
|
let o = n.getContext("2d");
|
|
1057
1019
|
if (o) {
|
|
1058
|
-
if (o.setTransform(i, 0, 0, i, 0, 0),
|
|
1020
|
+
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
1021
|
let t = new Image();
|
|
1060
1022
|
t.onload = () => {
|
|
1061
1023
|
o.drawImage(t, 0, 0, a, c), r.value = !I(e.value);
|
|
@@ -1063,10 +1025,10 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1063
1025
|
} else r.value = !1;
|
|
1064
1026
|
}
|
|
1065
1027
|
}
|
|
1066
|
-
|
|
1028
|
+
m(y), D(() => [a, c], y), g(() => {
|
|
1067
1029
|
n.value = !1;
|
|
1068
1030
|
});
|
|
1069
|
-
function
|
|
1031
|
+
function b(e) {
|
|
1070
1032
|
let n = t.value;
|
|
1071
1033
|
if (!n) return {
|
|
1072
1034
|
x: 0,
|
|
@@ -1078,7 +1040,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1078
1040
|
y: (e.clientY - r.top) / r.height * c
|
|
1079
1041
|
};
|
|
1080
1042
|
}
|
|
1081
|
-
function
|
|
1043
|
+
function x() {
|
|
1082
1044
|
n.value && (n.value = !1, _());
|
|
1083
1045
|
}
|
|
1084
1046
|
return () => s("div", {
|
|
@@ -1103,24 +1065,24 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1103
1065
|
if (!l) return;
|
|
1104
1066
|
let r = t.value, i = r?.getContext("2d");
|
|
1105
1067
|
if (!i || !r) return;
|
|
1106
|
-
n.value = !0, r.setPointerCapture(e.pointerId), i.strokeStyle = u, i.lineWidth =
|
|
1107
|
-
let { x: a, y: o } =
|
|
1068
|
+
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 } = b(e);
|
|
1108
1070
|
i.beginPath(), i.moveTo(a, o);
|
|
1109
1071
|
},
|
|
1110
1072
|
onPointermove: (e) => {
|
|
1111
1073
|
if (!n.value) return;
|
|
1112
1074
|
let i = t.value?.getContext("2d");
|
|
1113
1075
|
if (!i) return;
|
|
1114
|
-
let { x: a, y: o } =
|
|
1076
|
+
let { x: a, y: o } = b(e);
|
|
1115
1077
|
i.lineTo(a, o), i.stroke(), r.value = !0;
|
|
1116
1078
|
},
|
|
1117
|
-
onPointerup:
|
|
1118
|
-
onPointercancel:
|
|
1119
|
-
onPointerleave:
|
|
1079
|
+
onPointerup: x,
|
|
1080
|
+
onPointercancel: x,
|
|
1081
|
+
onPointerleave: x
|
|
1120
1082
|
}, null), i.showClearButton === !1 ? null : s("button", {
|
|
1121
1083
|
type: "button",
|
|
1122
1084
|
disabled: !r.value || !l,
|
|
1123
|
-
onClick:
|
|
1085
|
+
onClick: ee
|
|
1124
1086
|
}, [o("Clear")])]);
|
|
1125
1087
|
}
|
|
1126
1088
|
}), Ge = /* @__PURE__ */ c({
|
|
@@ -1142,7 +1104,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1142
1104
|
},
|
|
1143
1105
|
setup(e) {
|
|
1144
1106
|
let n = t(() => F(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 = C(!1);
|
|
1145
|
-
|
|
1107
|
+
D(() => [e.field.handle, e.value], () => {
|
|
1146
1108
|
o.value || (!Array.isArray(e.value) || e.value.length === 0) && (o.value = !0, e.form.setValue(e.field.handle, a.value));
|
|
1147
1109
|
}, { immediate: !0 });
|
|
1148
1110
|
let c = (t) => {
|
|
@@ -1152,7 +1114,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1152
1114
|
r[e][t] = n, c(r);
|
|
1153
1115
|
};
|
|
1154
1116
|
return () => {
|
|
1155
|
-
let t = a.value, o = r.value, u = n.value, d = i.value, f =
|
|
1117
|
+
let t = a.value, o = r.value, u = n.value, d = i.value, f = A(t, u);
|
|
1156
1118
|
return s("div", {
|
|
1157
1119
|
class: e.classNames.input,
|
|
1158
1120
|
"data-freeform-table": ""
|
|
@@ -1234,7 +1196,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1234
1196
|
l(r, i, e.target.value);
|
|
1235
1197
|
}
|
|
1236
1198
|
}, null)]);
|
|
1237
|
-
}), s("td", null, [
|
|
1199
|
+
}), s("td", null, [j(t, r, u) ? s("button", {
|
|
1238
1200
|
type: "button",
|
|
1239
1201
|
disabled: !d,
|
|
1240
1202
|
onClick: () => {
|
|
@@ -1243,7 +1205,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1243
1205
|
}, [u.removeButtonLabel || "Remove"]) : null])]))])]), f ? s("button", {
|
|
1244
1206
|
type: "button",
|
|
1245
1207
|
disabled: !d,
|
|
1246
|
-
onClick: () => c([...t,
|
|
1208
|
+
onClick: () => c([...t, ie(o)])
|
|
1247
1209
|
}, [u.addButtonLabel || "Add"]) : null]);
|
|
1248
1210
|
};
|
|
1249
1211
|
}
|
|
@@ -1398,7 +1360,7 @@ var Ue = /* @__PURE__ */ c({
|
|
|
1398
1360
|
return () => s("div", { class: e.class }, [t.default?.()]);
|
|
1399
1361
|
}
|
|
1400
1362
|
});
|
|
1401
|
-
function
|
|
1363
|
+
function Y(e, t = "submit") {
|
|
1402
1364
|
return /* @__PURE__ */ c({
|
|
1403
1365
|
name: e,
|
|
1404
1366
|
props: {
|
|
@@ -1433,7 +1395,7 @@ function X(e, t = "submit") {
|
|
|
1433
1395
|
}
|
|
1434
1396
|
});
|
|
1435
1397
|
}
|
|
1436
|
-
var et =
|
|
1398
|
+
var et = Y("DefaultSubmitButton"), tt = Y("DefaultNextButton", "button"), nt = Y("DefaultBackButton", "button"), rt = Y("DefaultSaveButton", "button"), it = /* @__PURE__ */ c({
|
|
1437
1399
|
name: "DefaultSuccessMessage",
|
|
1438
1400
|
props: {
|
|
1439
1401
|
message: {
|
|
@@ -1451,7 +1413,7 @@ var et = X("DefaultSubmitButton"), tt = X("DefaultNextButton", "button"), nt = X
|
|
|
1451
1413
|
role: "status"
|
|
1452
1414
|
}, [e.message]);
|
|
1453
1415
|
}
|
|
1454
|
-
}),
|
|
1416
|
+
}), X = {
|
|
1455
1417
|
frontend: {
|
|
1456
1418
|
text: ye,
|
|
1457
1419
|
textarea: Oe,
|
|
@@ -1463,22 +1425,22 @@ var et = X("DefaultSubmitButton"), tt = X("DefaultNextButton", "button"), nt = X
|
|
|
1463
1425
|
password: Se,
|
|
1464
1426
|
confirm: Ce,
|
|
1465
1427
|
hidden: De,
|
|
1466
|
-
dropdown:
|
|
1467
|
-
select:
|
|
1428
|
+
dropdown: G,
|
|
1429
|
+
select: G,
|
|
1468
1430
|
"multiple-select": ke,
|
|
1469
1431
|
checkbox: Ae,
|
|
1470
1432
|
checkboxes: je,
|
|
1471
|
-
radios:
|
|
1472
|
-
radio:
|
|
1433
|
+
radios: K,
|
|
1434
|
+
radio: K,
|
|
1473
1435
|
"opinion-scale": Me,
|
|
1474
1436
|
rating: Ne,
|
|
1475
1437
|
cards: Pe,
|
|
1476
1438
|
datetime: Ve,
|
|
1477
|
-
file:
|
|
1478
|
-
"file-upload":
|
|
1439
|
+
file: q,
|
|
1440
|
+
"file-upload": q,
|
|
1479
1441
|
"file-dnd": Fe,
|
|
1480
|
-
html:
|
|
1481
|
-
"rich-text":
|
|
1442
|
+
html: J,
|
|
1443
|
+
"rich-text": J,
|
|
1482
1444
|
image: Be,
|
|
1483
1445
|
table: Ge,
|
|
1484
1446
|
signature: We,
|
|
@@ -1499,23 +1461,23 @@ var et = X("DefaultSubmitButton"), tt = X("DefaultNextButton", "button"), nt = X
|
|
|
1499
1461
|
password: Se,
|
|
1500
1462
|
confirm: Ce,
|
|
1501
1463
|
hidden: De,
|
|
1502
|
-
select:
|
|
1503
|
-
dropdown:
|
|
1464
|
+
select: G,
|
|
1465
|
+
dropdown: G,
|
|
1504
1466
|
"multiple-select": ke,
|
|
1505
1467
|
checkbox: Ae,
|
|
1506
1468
|
checkboxes: je,
|
|
1507
|
-
radio:
|
|
1508
|
-
radios:
|
|
1509
|
-
radiobox:
|
|
1469
|
+
radio: K,
|
|
1470
|
+
radios: K,
|
|
1471
|
+
radiobox: K,
|
|
1510
1472
|
"opinion-scale": Me,
|
|
1511
1473
|
rating: Ne,
|
|
1512
1474
|
cards: Pe,
|
|
1513
1475
|
datetime: Ve,
|
|
1514
|
-
file:
|
|
1515
|
-
"file-upload":
|
|
1476
|
+
file: q,
|
|
1477
|
+
"file-upload": q,
|
|
1516
1478
|
"file-dnd": Fe,
|
|
1517
|
-
html:
|
|
1518
|
-
"rich-text":
|
|
1479
|
+
html: J,
|
|
1480
|
+
"rich-text": J,
|
|
1519
1481
|
image: Be,
|
|
1520
1482
|
table: Ge,
|
|
1521
1483
|
signature: We,
|
|
@@ -1544,7 +1506,7 @@ var et = X("DefaultSubmitButton"), tt = X("DefaultNextButton", "button"), nt = X
|
|
|
1544
1506
|
};
|
|
1545
1507
|
//#endregion
|
|
1546
1508
|
//#region src/theme/mergeClassNames.ts
|
|
1547
|
-
function
|
|
1509
|
+
function Z(...e) {
|
|
1548
1510
|
return e.filter((e) => typeof e == "string" && e.trim() !== "").join(" ").replace(/\s+/g, " ").trim() || void 0;
|
|
1549
1511
|
}
|
|
1550
1512
|
function ot(e, t, n) {
|
|
@@ -1552,162 +1514,47 @@ function ot(e, t, n) {
|
|
|
1552
1514
|
}
|
|
1553
1515
|
//#endregion
|
|
1554
1516
|
//#region src/theme/toBemModifier.ts
|
|
1555
|
-
function
|
|
1517
|
+
function Q(e) {
|
|
1556
1518
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").replace(/-+/g, "-").toLowerCase();
|
|
1557
1519
|
}
|
|
1558
1520
|
//#endregion
|
|
1559
|
-
//#region src/components/
|
|
1560
|
-
var ct = /* @__PURE__ */ c({
|
|
1561
|
-
__name: "
|
|
1521
|
+
//#region src/components/CaptchaHost.vue?vue&type=script&setup=true&lang.ts
|
|
1522
|
+
var st = ["data-freeform-captcha", "data-freeform-captcha-provider"], ct = /* @__PURE__ */ c({
|
|
1523
|
+
__name: "CaptchaHost",
|
|
1562
1524
|
props: {
|
|
1563
1525
|
form: {},
|
|
1564
|
-
|
|
1526
|
+
captcha: {}
|
|
1565
1527
|
},
|
|
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;
|
|
1528
|
+
setup(e) {
|
|
1529
|
+
let t = e, n = v(null), r;
|
|
1530
|
+
function a(e) {
|
|
1531
|
+
return [
|
|
1532
|
+
e.name,
|
|
1533
|
+
e.provider ?? "",
|
|
1534
|
+
e.siteKey ?? "",
|
|
1535
|
+
e.startMode ?? "",
|
|
1536
|
+
e.theme ?? "",
|
|
1537
|
+
e.locale ?? "",
|
|
1538
|
+
e.apiEndpoint ?? "",
|
|
1539
|
+
e.version ?? "",
|
|
1540
|
+
e.size ?? ""
|
|
1541
|
+
].join("|");
|
|
1584
1542
|
}
|
|
1585
|
-
function
|
|
1586
|
-
|
|
1543
|
+
function o() {
|
|
1544
|
+
r?.(), r = void 0, n.value && (r = t.form.mountCaptcha(t.captcha, n.value));
|
|
1587
1545
|
}
|
|
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
|
-
};
|
|
1546
|
+
m(o), D(() => a(t.captcha), o), g(() => {
|
|
1547
|
+
r?.();
|
|
1548
|
+
});
|
|
1549
|
+
function s(e) {
|
|
1550
|
+
n.value = e ?? null;
|
|
1551
|
+
}
|
|
1552
|
+
return (t, n) => (_(), i("div", {
|
|
1553
|
+
ref: s,
|
|
1554
|
+
class: "ff-captcha",
|
|
1555
|
+
"data-freeform-captcha": e.captcha.name,
|
|
1556
|
+
"data-freeform-captcha-provider": e.captcha.provider ?? e.captcha.name
|
|
1557
|
+
}, null, 8, st));
|
|
1711
1558
|
}
|
|
1712
1559
|
});
|
|
1713
1560
|
//#endregion
|
|
@@ -1721,10 +1568,10 @@ function lt(e, t, n) {
|
|
|
1721
1568
|
n?.renderers?.handles?.[e.handle],
|
|
1722
1569
|
r ? n?.renderers?.frontend?.[r] : void 0,
|
|
1723
1570
|
n?.renderers?.types?.[e.type],
|
|
1724
|
-
r ?
|
|
1725
|
-
r ?
|
|
1726
|
-
|
|
1727
|
-
].find((e) => !!e) ??
|
|
1571
|
+
r ? X.frontend[r] : void 0,
|
|
1572
|
+
r ? X.types[r] : void 0,
|
|
1573
|
+
X.types[e.type]
|
|
1574
|
+
].find((e) => !!e) ?? X.types._unsupported;
|
|
1728
1575
|
}
|
|
1729
1576
|
//#endregion
|
|
1730
1577
|
//#region src/theme/resolveThemeClassNames.ts
|
|
@@ -1752,13 +1599,348 @@ function dt(e, t, n = !1) {
|
|
|
1752
1599
|
let o = t.frontend?.extension;
|
|
1753
1600
|
return o && (i = $(i, r?.[o])), n && i.inputError && (i = ut.has(t.type) ? {
|
|
1754
1601
|
...i,
|
|
1755
|
-
optionInput:
|
|
1602
|
+
optionInput: Z(i.optionInput, i.inputError)
|
|
1756
1603
|
} : {
|
|
1757
1604
|
...i,
|
|
1758
|
-
input:
|
|
1605
|
+
input: Z(i.input, i.inputError)
|
|
1759
1606
|
}), i;
|
|
1760
1607
|
}
|
|
1761
1608
|
//#endregion
|
|
1762
|
-
|
|
1609
|
+
//#region src/components/FieldRenderer.vue?vue&type=script&setup=true&lang.ts
|
|
1610
|
+
var ft = ["data-freeform-group"], pt = /* @__PURE__ */ c({
|
|
1611
|
+
name: "FieldRenderer",
|
|
1612
|
+
__name: "FieldRenderer",
|
|
1613
|
+
props: {
|
|
1614
|
+
field: {},
|
|
1615
|
+
form: {},
|
|
1616
|
+
theme: {},
|
|
1617
|
+
renderers: {},
|
|
1618
|
+
allowRawHtml: { type: Boolean }
|
|
1619
|
+
},
|
|
1620
|
+
setup(o) {
|
|
1621
|
+
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
|
+
...at,
|
|
1623
|
+
...s.theme.renderers?.components
|
|
1624
|
+
})), h = t(() => lt(s.field, s.renderers, s.theme)), g = t(() => s.form.values[s.field.handle]), ee = t(() => s.field.type === "checkbox"), v = t(() => s.field.type === "html" || s.field.type === "rich-text" || s.field.type === "image"), b = t(() => s.field.type === "hidden" || s.field.type === "mollie" || s.field.frontend?.renderer === "payment.mollie" || s.field.frontend?.extension === "payment.mollie"), C = t(() => !ee.value && !v.value && !b.value && s.theme.defaults?.renderLabels !== !1), w = t(() => !v.value && !b.value && s.theme.defaults?.renderInstructions !== !1), T = t(() => s.theme.defaults?.renderErrors !== !1), D = t(() => {
|
|
1625
|
+
if (!v.value) return !0;
|
|
1626
|
+
if (s.field.type === "image") {
|
|
1627
|
+
let e = s.field.frontend?.config ?? {};
|
|
1628
|
+
return !!(s.field.content?.image?.src || e.src);
|
|
1629
|
+
}
|
|
1630
|
+
let e = s.field.content?.rendered?.html?.trim();
|
|
1631
|
+
return !!(s.allowRawHtml && e || s.field.instructions);
|
|
1632
|
+
}), O = 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) || b.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)), A = t(() => ({
|
|
1633
|
+
field: s.field,
|
|
1634
|
+
form: s.form,
|
|
1635
|
+
value: g.value,
|
|
1636
|
+
errors: u.value,
|
|
1637
|
+
input: s.form.getFieldProps(s.field.handle),
|
|
1638
|
+
classNames: p.value,
|
|
1639
|
+
allowRawHtml: s.allowRawHtml,
|
|
1640
|
+
renderLabel: () => null,
|
|
1641
|
+
renderInstructions: () => null,
|
|
1642
|
+
renderErrors: () => null
|
|
1643
|
+
}));
|
|
1644
|
+
return (t, s) => {
|
|
1645
|
+
let g = x("FieldRenderer", !0);
|
|
1646
|
+
return D.value ? (_(), i(e, { key: 0 }, [b.value ? (_(), n(S(m.value.FieldWrapper), {
|
|
1647
|
+
key: 0,
|
|
1648
|
+
field: o.field,
|
|
1649
|
+
form: o.form,
|
|
1650
|
+
class: d(O.value)
|
|
1651
|
+
}, {
|
|
1652
|
+
default: k(() => [(_(), n(S(h.value), f(l(A.value)), null, 16))]),
|
|
1653
|
+
_: 1
|
|
1654
|
+
}, 8, [
|
|
1655
|
+
"field",
|
|
1656
|
+
"form",
|
|
1657
|
+
"class"
|
|
1658
|
+
])) : o.field.type === "group" ? (_(), n(S(m.value.FieldWrapper), {
|
|
1659
|
+
key: 1,
|
|
1660
|
+
field: o.field,
|
|
1661
|
+
form: o.form,
|
|
1662
|
+
class: d(O.value)
|
|
1663
|
+
}, {
|
|
1664
|
+
default: k(() => [
|
|
1665
|
+
C.value ? (_(), n(S(m.value.Label), {
|
|
1666
|
+
key: 0,
|
|
1667
|
+
field: o.field,
|
|
1668
|
+
class: d(p.value.label),
|
|
1669
|
+
"required-indicator": o.theme.defaults?.requiredIndicator
|
|
1670
|
+
}, null, 8, [
|
|
1671
|
+
"field",
|
|
1672
|
+
"class",
|
|
1673
|
+
"required-indicator"
|
|
1674
|
+
])) : r("", !0),
|
|
1675
|
+
w.value ? (_(), n(S(m.value.Instructions), {
|
|
1676
|
+
key: 1,
|
|
1677
|
+
field: o.field,
|
|
1678
|
+
class: d(p.value.instructions)
|
|
1679
|
+
}, null, 8, ["field", "class"])) : r("", !0),
|
|
1680
|
+
a("div", {
|
|
1681
|
+
class: d(p.value.input),
|
|
1682
|
+
"data-freeform-group": o.field.handle
|
|
1683
|
+
}, [(_(!0), i(e, null, y(o.field.layout?.rows ?? [], (t) => (_(), n(S(m.value.Row), {
|
|
1684
|
+
key: t.uid,
|
|
1685
|
+
class: d(E(Z)(p.value.row, c.value === "merge" ? `ff-row--${t.fields.length}-fields` : void 0))
|
|
1686
|
+
}, {
|
|
1687
|
+
default: k(() => [(_(!0), i(e, null, y(t.fields, (e) => (_(), n(g, {
|
|
1688
|
+
key: e,
|
|
1689
|
+
field: o.form.manifest.fields[e],
|
|
1690
|
+
form: o.form,
|
|
1691
|
+
theme: o.theme,
|
|
1692
|
+
renderers: o.renderers,
|
|
1693
|
+
"allow-raw-html": o.allowRawHtml
|
|
1694
|
+
}, null, 8, [
|
|
1695
|
+
"field",
|
|
1696
|
+
"form",
|
|
1697
|
+
"theme",
|
|
1698
|
+
"renderers",
|
|
1699
|
+
"allow-raw-html"
|
|
1700
|
+
]))), 128))]),
|
|
1701
|
+
_: 2
|
|
1702
|
+
}, 1032, ["class"]))), 128))], 10, ft),
|
|
1703
|
+
T.value ? (_(), n(S(m.value.Errors), {
|
|
1704
|
+
key: 2,
|
|
1705
|
+
errors: u.value,
|
|
1706
|
+
class: d(p.value.errors),
|
|
1707
|
+
"error-class": p.value.error
|
|
1708
|
+
}, null, 8, [
|
|
1709
|
+
"errors",
|
|
1710
|
+
"class",
|
|
1711
|
+
"error-class"
|
|
1712
|
+
])) : r("", !0)
|
|
1713
|
+
]),
|
|
1714
|
+
_: 1
|
|
1715
|
+
}, 8, [
|
|
1716
|
+
"field",
|
|
1717
|
+
"form",
|
|
1718
|
+
"class"
|
|
1719
|
+
])) : (_(), n(S(m.value.FieldWrapper), {
|
|
1720
|
+
key: 2,
|
|
1721
|
+
field: o.field,
|
|
1722
|
+
form: o.form,
|
|
1723
|
+
class: d(O.value)
|
|
1724
|
+
}, {
|
|
1725
|
+
default: k(() => [
|
|
1726
|
+
C.value ? (_(), n(S(m.value.Label), {
|
|
1727
|
+
key: 0,
|
|
1728
|
+
field: o.field,
|
|
1729
|
+
class: d(p.value.label),
|
|
1730
|
+
"required-indicator": o.theme.defaults?.requiredIndicator
|
|
1731
|
+
}, null, 8, [
|
|
1732
|
+
"field",
|
|
1733
|
+
"class",
|
|
1734
|
+
"required-indicator"
|
|
1735
|
+
])) : r("", !0),
|
|
1736
|
+
w.value ? (_(), n(S(m.value.Instructions), {
|
|
1737
|
+
key: 1,
|
|
1738
|
+
field: o.field,
|
|
1739
|
+
class: d(p.value.instructions)
|
|
1740
|
+
}, null, 8, ["field", "class"])) : r("", !0),
|
|
1741
|
+
(_(), n(S(h.value), f(l(A.value)), null, 16)),
|
|
1742
|
+
T.value ? (_(), n(S(m.value.Errors), {
|
|
1743
|
+
key: 2,
|
|
1744
|
+
errors: u.value,
|
|
1745
|
+
class: d(p.value.errors),
|
|
1746
|
+
"error-class": p.value.error
|
|
1747
|
+
}, null, 8, [
|
|
1748
|
+
"errors",
|
|
1749
|
+
"class",
|
|
1750
|
+
"error-class"
|
|
1751
|
+
])) : r("", !0)
|
|
1752
|
+
]),
|
|
1753
|
+
_: 1
|
|
1754
|
+
}, 8, [
|
|
1755
|
+
"field",
|
|
1756
|
+
"form",
|
|
1757
|
+
"class"
|
|
1758
|
+
]))], 64)) : r("", !0);
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
}), mt = /* @__PURE__ */ c({
|
|
1762
|
+
__name: "FreeformView",
|
|
1763
|
+
props: {
|
|
1764
|
+
form: {},
|
|
1765
|
+
class: {}
|
|
1766
|
+
},
|
|
1767
|
+
setup(a) {
|
|
1768
|
+
let o = a, s = t(() => ({
|
|
1769
|
+
...at,
|
|
1770
|
+
...o.form.theme.renderers?.components
|
|
1771
|
+
})), 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] ?? {
|
|
1772
|
+
rows: [],
|
|
1773
|
+
buttons: {}
|
|
1774
|
+
}), 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);
|
|
1775
|
+
function h(e) {
|
|
1776
|
+
if (e.type === "image") {
|
|
1777
|
+
let t = e.frontend?.config ?? {};
|
|
1778
|
+
return !!(e.content?.image?.src || t.src);
|
|
1779
|
+
}
|
|
1780
|
+
if (e.type === "html" || e.type === "rich-text") {
|
|
1781
|
+
let t = e.content?.rendered?.html?.trim();
|
|
1782
|
+
return !!(o.form.allowRawHtml && t || e.instructions);
|
|
1783
|
+
}
|
|
1784
|
+
return !0;
|
|
1785
|
+
}
|
|
1786
|
+
function g(e) {
|
|
1787
|
+
o.form.handleSubmit(e);
|
|
1788
|
+
}
|
|
1789
|
+
return (t, o) => a.form.isComplete && a.form.successMessage ? (_(), n(S(s.value.SuccessMessage), {
|
|
1790
|
+
key: 0,
|
|
1791
|
+
message: a.form.successMessage,
|
|
1792
|
+
class: d(a.form.theme.classNames?.success)
|
|
1793
|
+
}, null, 8, ["message", "class"])) : (_(), n(S(s.value.Form), {
|
|
1794
|
+
key: 1,
|
|
1795
|
+
form: a.form,
|
|
1796
|
+
class: d(u.value),
|
|
1797
|
+
"on-submit": g
|
|
1798
|
+
}, {
|
|
1799
|
+
default: k(() => [
|
|
1800
|
+
a.form.formErrors.length > 0 ? (_(), n(S(s.value.Errors), {
|
|
1801
|
+
key: 0,
|
|
1802
|
+
errors: a.form.formErrors,
|
|
1803
|
+
class: d(a.form.theme.classNames?.errors),
|
|
1804
|
+
"error-class": a.form.theme.classNames?.error
|
|
1805
|
+
}, null, 8, [
|
|
1806
|
+
"errors",
|
|
1807
|
+
"class",
|
|
1808
|
+
"error-class"
|
|
1809
|
+
])) : r("", !0),
|
|
1810
|
+
(_(), n(S(s.value.Page), {
|
|
1811
|
+
form: a.form,
|
|
1812
|
+
"page-index": a.form.currentPageIndex,
|
|
1813
|
+
class: d(E(Z)(a.form.theme.classNames?.page, c.value === "merge" ? `ff-page--${a.form.currentPageIndex}` : void 0))
|
|
1814
|
+
}, {
|
|
1815
|
+
default: k(() => [(_(!0), i(e, null, y(f.value.rows, (t) => (_(), i(e, { key: t.uid }, [t.fields.filter((e) => {
|
|
1816
|
+
let t = a.form.manifest.fields[e];
|
|
1817
|
+
return t ? h(t) : !1;
|
|
1818
|
+
}).length > 0 ? (_(), n(S(s.value.Row), {
|
|
1819
|
+
key: 0,
|
|
1820
|
+
class: d(E(Z)(a.form.theme.classNames?.row, c.value === "merge" ? `ff-row--${t.fields.filter((e) => {
|
|
1821
|
+
let t = a.form.manifest.fields[e];
|
|
1822
|
+
return t ? h(t) : !1;
|
|
1823
|
+
}).length}-fields` : void 0))
|
|
1824
|
+
}, {
|
|
1825
|
+
default: k(() => [(_(!0), i(e, null, y(t.fields.filter((e) => {
|
|
1826
|
+
let t = a.form.manifest.fields[e];
|
|
1827
|
+
return t ? h(t) : !1;
|
|
1828
|
+
}), (e) => (_(), n(pt, {
|
|
1829
|
+
key: e,
|
|
1830
|
+
field: a.form.manifest.fields[e],
|
|
1831
|
+
form: a.form,
|
|
1832
|
+
theme: a.form.theme,
|
|
1833
|
+
renderers: a.form.renderers,
|
|
1834
|
+
"allow-raw-html": a.form.allowRawHtml
|
|
1835
|
+
}, null, 8, [
|
|
1836
|
+
"field",
|
|
1837
|
+
"form",
|
|
1838
|
+
"theme",
|
|
1839
|
+
"renderers",
|
|
1840
|
+
"allow-raw-html"
|
|
1841
|
+
]))), 128))]),
|
|
1842
|
+
_: 2
|
|
1843
|
+
}, 1032, ["class"])) : r("", !0)], 64))), 128))]),
|
|
1844
|
+
_: 1
|
|
1845
|
+
}, 8, [
|
|
1846
|
+
"form",
|
|
1847
|
+
"page-index",
|
|
1848
|
+
"class"
|
|
1849
|
+
])),
|
|
1850
|
+
(_(!0), i(e, null, y(a.form.manifest.security.captchas ?? [], (e) => (_(), n(ct, {
|
|
1851
|
+
key: e.name,
|
|
1852
|
+
form: a.form,
|
|
1853
|
+
captcha: e
|
|
1854
|
+
}, null, 8, ["form", "captcha"]))), 128)),
|
|
1855
|
+
(_(), n(S(s.value.ButtonRow), { class: d(a.form.theme.classNames?.buttons) }, {
|
|
1856
|
+
default: k(() => [
|
|
1857
|
+
!m.value && f.value.buttons?.back ? (_(), n(S(s.value.BackButton), {
|
|
1858
|
+
key: 0,
|
|
1859
|
+
label: f.value.buttons.back.label,
|
|
1860
|
+
class: d(a.form.theme.classNames?.backButton),
|
|
1861
|
+
disabled: a.form.isSubmitting,
|
|
1862
|
+
"on-click": () => void a.form.goBack()
|
|
1863
|
+
}, null, 40, [
|
|
1864
|
+
"label",
|
|
1865
|
+
"class",
|
|
1866
|
+
"disabled",
|
|
1867
|
+
"on-click"
|
|
1868
|
+
])) : r("", !0),
|
|
1869
|
+
a.form.manifest.settings.multiPage && !p.value && f.value.buttons?.submit ? (_(), n(S(s.value.NextButton), {
|
|
1870
|
+
key: 1,
|
|
1871
|
+
label: f.value.buttons.submit.label,
|
|
1872
|
+
class: d(a.form.theme.classNames?.nextButton),
|
|
1873
|
+
disabled: a.form.isSubmitting,
|
|
1874
|
+
"on-click": () => void a.form.goNext()
|
|
1875
|
+
}, null, 40, [
|
|
1876
|
+
"label",
|
|
1877
|
+
"class",
|
|
1878
|
+
"disabled",
|
|
1879
|
+
"on-click"
|
|
1880
|
+
])) : r("", !0),
|
|
1881
|
+
(!a.form.manifest.settings.multiPage || p.value) && f.value.buttons?.submit ? (_(), n(S(s.value.SubmitButton), {
|
|
1882
|
+
key: 2,
|
|
1883
|
+
label: f.value.buttons.submit.label,
|
|
1884
|
+
class: d(a.form.theme.classNames?.submitButton),
|
|
1885
|
+
disabled: a.form.isSubmitting
|
|
1886
|
+
}, null, 8, [
|
|
1887
|
+
"label",
|
|
1888
|
+
"class",
|
|
1889
|
+
"disabled"
|
|
1890
|
+
])) : r("", !0),
|
|
1891
|
+
f.value.buttons?.save ? (_(), n(S(s.value.SaveButton), {
|
|
1892
|
+
key: 3,
|
|
1893
|
+
label: f.value.buttons.save.label,
|
|
1894
|
+
class: d(a.form.theme.classNames?.saveButton),
|
|
1895
|
+
disabled: a.form.isSubmitting,
|
|
1896
|
+
"on-click": () => void a.form.saveDraft()
|
|
1897
|
+
}, null, 40, [
|
|
1898
|
+
"label",
|
|
1899
|
+
"class",
|
|
1900
|
+
"disabled",
|
|
1901
|
+
"on-click"
|
|
1902
|
+
])) : r("", !0)
|
|
1903
|
+
]),
|
|
1904
|
+
_: 1
|
|
1905
|
+
}, 8, ["class"]))
|
|
1906
|
+
]),
|
|
1907
|
+
_: 1
|
|
1908
|
+
}, 40, ["form", "class"]));
|
|
1909
|
+
}
|
|
1910
|
+
}), ht = { role: "alert" }, gt = /* @__PURE__ */ c({
|
|
1911
|
+
__name: "Freeform",
|
|
1912
|
+
props: {
|
|
1913
|
+
handle: {},
|
|
1914
|
+
profile: {},
|
|
1915
|
+
properties: {},
|
|
1916
|
+
baseUrl: {},
|
|
1917
|
+
manifest: {},
|
|
1918
|
+
initialValues: {},
|
|
1919
|
+
draftToken: {},
|
|
1920
|
+
draftKey: {},
|
|
1921
|
+
clientVersion: {},
|
|
1922
|
+
fetch: {},
|
|
1923
|
+
credentials: {},
|
|
1924
|
+
theme: {},
|
|
1925
|
+
renderers: {},
|
|
1926
|
+
extensions: {},
|
|
1927
|
+
allowRawHtml: { type: Boolean },
|
|
1928
|
+
onSuccess: { type: Function },
|
|
1929
|
+
onError: { type: Function },
|
|
1930
|
+
onManifestLoaded: { type: Function },
|
|
1931
|
+
class: {},
|
|
1932
|
+
loadingMessage: {}
|
|
1933
|
+
},
|
|
1934
|
+
setup(e) {
|
|
1935
|
+
let i = e, o = ge(() => i), c = t(() => o.manifest ? o : null);
|
|
1936
|
+
return (t, l) => t.$slots.default ? b(t.$slots, "default", { form: E(o) }, void 0, void 0, 0) : E(o).loading ? b(t.$slots, "loading", {}, () => [s(V, { message: e.loadingMessage ?? "Loading form…" }, null, 8, ["message"])], void 0, 1) : E(o).error ? b(t.$slots, "error", { error: E(o).error }, () => [a("div", ht, w(E(o).error.message), 1)], void 0, 2) : c.value ? (_(), n(mt, {
|
|
1937
|
+
key: 3,
|
|
1938
|
+
form: c.value,
|
|
1939
|
+
class: d(i.class)
|
|
1940
|
+
}, null, 8, ["form", "class"])) : r("", !0);
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
//#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, _e as useFieldExtension, ge as useFreeform };
|
|
1763
1945
|
|
|
1764
1946
|
//# sourceMappingURL=index.js.map
|