@verbb/formie-browser 1.0.14 → 1.0.15
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/CHANGELOG.md +30 -0
- package/dist/chunks/{address-country-Dn71jroa.js → address-country-BcEQKw0T.js} +1 -1
- package/dist/chunks/{address-finder-O49uDRoR.js → address-finder-BWGINCSA.js} +1 -1
- package/dist/chunks/{address-state-ByYatUur.js → address-state-DI3ndhMU.js} +98 -88
- package/dist/chunks/{api-DYYsVIub.js → api-BK9b340y.js} +16 -16
- package/dist/chunks/{api-D6kJ7kXZ.js → api-Dxl_CKw-.js} +30 -25
- package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
- package/dist/chunks/{bpoint-D0RKFM4F.js → bpoint-BwtuyN_O.js} +1 -1
- package/dist/chunks/{captcha-eu-DERJbXnH.js → captcha-eu-DWLoQFKB.js} +2 -2
- package/dist/chunks/{combobox-CWNdx4Fk.js → combobox-Ba08_cHL.js} +259 -258
- package/dist/chunks/{conditions-DqNHLTbN.js → conditions-Ceeg6ReZ.js} +113 -110
- package/dist/chunks/{date-picker-RUnevF7l.js → date-picker-DaPvMrop.js} +12 -11
- package/dist/chunks/{eway-or6dtjoT.js → eway-uw0DzU-L.js} +3 -3
- package/dist/chunks/{file-upload-Bm-TXyNB.js → file-upload-B8_mH012.js} +28 -16
- package/dist/chunks/{friendly-captcha-v1-GFqCt1Mh.js → friendly-captcha-v1-CVXaXgDO.js} +1 -1
- package/dist/chunks/{friendly-captcha-v2-WoW246JG.js → friendly-captcha-v2-DkeIVTKI.js} +1 -1
- package/dist/chunks/{go-cardless-DzJ-0FKg.js → go-cardless-c4wLJdOt.js} +1 -1
- package/dist/chunks/{google-address-C1P1nTDM.js → google-address-JHYvjwgN.js} +13 -8
- package/dist/chunks/{hcaptcha-D0T8aIHz.js → hcaptcha-Dt3ELLlP.js} +2 -2
- package/dist/chunks/{loqate-DD1S7PY9.js → loqate-m51iPyO1.js} +1 -1
- package/dist/chunks/{mollie-DG8Ju83x.js → mollie-Bn0PX173.js} +1 -1
- package/dist/chunks/{moneris-C8m3Fvqu.js → moneris-BRbUvI4t.js} +1 -1
- package/dist/chunks/{opayo-B3EvrVxw.js → opayo-BwWdInEP.js} +2 -2
- package/dist/chunks/{paddle-BIYR9Um3.js → paddle-CympHVvd.js} +2 -2
- package/dist/chunks/{paypal-B_yxIo2d.js → paypal-h75h6wae.js} +2 -2
- package/dist/chunks/{payway-CeOzS0sL.js → payway-C9rHTCC_.js} +2 -2
- package/dist/chunks/{phone-country-bAqje17P.js → phone-country-B8fv-L5_.js} +1 -1
- package/dist/chunks/{place-kit-BE5gi3vo.js → place-kit-BnZGQ-L1.js} +8 -8
- package/dist/chunks/{recaptcha-enterprise-CruXddZq.js → recaptcha-enterprise-CUs8BO6V.js} +2 -2
- package/dist/chunks/{recaptcha-shared-AQRMDMme.js → recaptcha-shared-DTbTw-MF.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-CCnJYCnG.js → recaptcha-v2-checkbox-P1McW4Pv.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-BuVqRRYn.js → recaptcha-v2-invisible-FGDqozSP.js} +2 -2
- package/dist/chunks/{recaptcha-v3-CloqhO2A.js → recaptcha-v3-CflUHeZD.js} +2 -2
- package/dist/chunks/{repeater-DwE27jI1.js → repeater-CyhDbozO.js} +47 -33
- package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
- package/dist/chunks/skip-CEW89ExY.js +7 -0
- package/dist/chunks/{snaptcha-C04kNGYQ.js → snaptcha-C3QLYxFT.js} +1 -1
- package/dist/chunks/{square-DEzxv9D9.js → square-C1z5DPVw.js} +2 -2
- package/dist/chunks/{stripe-CVPQGDz3.js → stripe-Dmkdkq1y.js} +2 -2
- package/dist/chunks/{summary-BF_8mrXI.js → summary-Bn-g5SDx.js} +1 -1
- package/dist/chunks/{table-DnIBdeKF.js → table-j7MlLLCc.js} +1 -1
- package/dist/chunks/{turnstile-n9DNyPxi.js → turnstile-ptihQfLl.js} +2 -2
- package/dist/chunks/{upload-manager-BbiUosZq.js → upload-manager-BW7l-BhF.js} +248 -236
- package/dist/index.js +548 -535
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts +3 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +10 -0
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/address/place-kit.d.ts.map +1 -1
- package/dist/js/modules/fields/address-state.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/repeater.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/dist/js/utils/async.d.ts +1 -0
- package/dist/js/utils/async.d.ts.map +1 -1
- package/dist/js/validation/rules/required.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/js/core/create-formie-client.ts +17 -10
- package/src/js/core/submit-result-state.ts +17 -0
- package/src/js/core/submit-result-ui.ts +4 -3
- package/src/js/modules/address/google-address.ts +95 -37
- package/src/js/modules/address/place-kit.ts +13 -7
- package/src/js/modules/fields/address-country.ts +5 -5
- package/src/js/modules/fields/address-state.ts +74 -23
- package/src/js/modules/fields/combobox.ts +3 -0
- package/src/js/modules/fields/conditions/effects.ts +4 -5
- package/src/js/modules/fields/conditions.ts +6 -0
- package/src/js/modules/fields/date-picker.ts +6 -3
- package/src/js/modules/fields/file-upload.ts +44 -14
- package/src/js/modules/fields/phone-country.ts +2 -2
- package/src/js/modules/fields/repeater.ts +55 -4
- package/src/js/modules/fields/upload-manager.ts +54 -18
- package/src/js/utils/async.ts +34 -0
- package/src/js/validation/rules/required.ts +12 -0
- package/src/js/validation/validator.ts +14 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { c as e, d as t, l as n } from "./dist-ZLeW0zZ3.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { a as r } from "./event-names-BCI2FLD8.js";
|
|
3
|
+
import { t as i } from "./debug-BV0DvdHx.js";
|
|
4
|
+
import { n as a } from "./theme-classes-DAQuEqdP.js";
|
|
5
|
+
import { t as o } from "./field-references.keys-58ZSTrCW.js";
|
|
6
|
+
import { r as s } from "./shared-OKhSay59.js";
|
|
6
7
|
//#region src/js/modules/fields/conditions/config.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var c = "[data-formie-conditions]";
|
|
9
|
+
function l(e) {
|
|
9
10
|
if (!e || typeof e != "object") return null;
|
|
10
11
|
let t = e, n = t.transformerParams;
|
|
11
12
|
return {
|
|
@@ -19,11 +20,11 @@ function c(e) {
|
|
|
19
20
|
isValid: t.isValid !== !1
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
let t = Array.from(e.querySelectorAll(
|
|
23
|
+
function u(e) {
|
|
24
|
+
let t = Array.from(e.querySelectorAll(c));
|
|
24
25
|
return e.matches("[data-formie-conditions]") ? [e, ...t] : t;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function d(e) {
|
|
27
28
|
let t = e.getAttribute("data-formie-conditions");
|
|
28
29
|
if (!t) return null;
|
|
29
30
|
try {
|
|
@@ -36,7 +37,7 @@ function u(e) {
|
|
|
36
37
|
let t = e && typeof e == "object" ? e : {};
|
|
37
38
|
return {
|
|
38
39
|
field: typeof t.field == "string" ? t.field : "",
|
|
39
|
-
source:
|
|
40
|
+
source: l(t.source),
|
|
40
41
|
condition: String(t.operator ?? t.condition ?? ""),
|
|
41
42
|
valueType: t.valueType,
|
|
42
43
|
browserSafe: t.browserSafe !== !1,
|
|
@@ -75,73 +76,73 @@ function u(e) {
|
|
|
75
76
|
}
|
|
76
77
|
//#endregion
|
|
77
78
|
//#region src/js/modules/fields/conditions/effects.ts
|
|
78
|
-
var
|
|
79
|
-
function
|
|
79
|
+
var f = "data-formie-conditions-disabled", p = "data-formie-preserve-disabled", m = "data-formie-conditionally-hidden", h = "data-formie-page-hidden", g = "fui-cp-muted-conditional-field", _ = "fui-cp-muted-conditional-field--expanded", v = "data-formie-cp-muted", y = "data-formie-row-hidden", b = "data-formie-field-count", x = "[data-formie-row], [data-formie-subfield-row], [data-formie-nested-field-row]", S = ":scope > [data-formie-field]";
|
|
80
|
+
function C(e) {
|
|
80
81
|
e.querySelectorAll("input, select, textarea").forEach((e) => {
|
|
81
82
|
(e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio" ? e.checked = !1 : e.type !== "hidden" && (e.value = "")), e instanceof HTMLSelectElement && (e.multiple ? Array.from(e.options).forEach((e) => {
|
|
82
83
|
e.selected = !1;
|
|
83
84
|
}) : e.selectedIndex = -1), e instanceof HTMLTextAreaElement && (e.value = ""));
|
|
84
85
|
}), e.dispatchEvent(new CustomEvent("formie:field:clear", { bubbles: !0 }));
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
let n =
|
|
88
|
-
return t ? (
|
|
87
|
+
function w(e, t) {
|
|
88
|
+
let n = m, r = a(e, "conditionalHidden"), i = e.hasAttribute(n);
|
|
89
|
+
return t ? (i || e.setAttribute(n, "true"), e.classList.add(...r)) : (i && e.removeAttribute(n), e.classList.remove(...r)), i !== t;
|
|
89
90
|
}
|
|
90
|
-
var
|
|
91
|
-
function
|
|
91
|
+
var T = "button[type=\"submit\"], button[data-formie-action], input[type=\"submit\"]";
|
|
92
|
+
function E(e, t) {
|
|
92
93
|
if (e instanceof HTMLButtonElement || e instanceof HTMLInputElement) {
|
|
93
94
|
if (t) {
|
|
94
|
-
e.hasAttribute(
|
|
95
|
+
e.hasAttribute(f) || (e.hasAttribute("disabled") && e.setAttribute(p, "true"), e.setAttribute(f, "true")), e.setAttribute("disabled", "true");
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
|
-
e.hasAttribute(
|
|
98
|
+
e.hasAttribute(f) && (e.hasAttribute(p) ? (e.setAttribute("disabled", "true"), e.removeAttribute(p)) : e.removeAttribute("disabled"), e.removeAttribute(f));
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
e.matches(
|
|
102
|
-
|
|
101
|
+
function D(e, t) {
|
|
102
|
+
e.matches(T) && E(e, t), e.querySelectorAll(T).forEach((e) => {
|
|
103
|
+
E(e, t);
|
|
103
104
|
}), e.querySelectorAll("input, textarea, select").forEach((e) => {
|
|
104
105
|
if (t) {
|
|
105
|
-
e.hasAttribute(
|
|
106
|
+
e.hasAttribute(f) || (e.hasAttribute("disabled") && e.setAttribute(p, "true"), e.setAttribute(f, "true")), e.setAttribute("disabled", "true");
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
|
-
e.hasAttribute(
|
|
109
|
+
e.hasAttribute(f) && (e.hasAttribute(p) ? (e.setAttribute("disabled", "true"), e.removeAttribute(p)) : e.removeAttribute("disabled"), e.removeAttribute(f));
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
|
-
function D(e) {
|
|
112
|
-
return !e.hasAttribute(p) && !e.hasAttribute(m) && !e.hasAttribute(v) && !e.hasAttribute("hidden");
|
|
113
|
-
}
|
|
114
112
|
function O(e) {
|
|
115
|
-
|
|
113
|
+
return !e.hasAttribute(m) && !e.hasAttribute(h) && !e.hasAttribute(y) && !e.hasAttribute("hidden");
|
|
114
|
+
}
|
|
115
|
+
function ee(e) {
|
|
116
|
+
let t = a(e, "rowHidden"), n = Array.from(e.querySelectorAll(S)).filter((e) => O(e)).length;
|
|
116
117
|
if (n > 0) {
|
|
117
118
|
let r = String(n);
|
|
118
|
-
e.getAttribute(
|
|
119
|
+
e.getAttribute(b) !== r && e.setAttribute(b, r), e.hasAttribute(y) && e.removeAttribute(y), e.classList.remove(...t);
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
|
-
e.hasAttribute(
|
|
122
|
+
e.hasAttribute(b) && e.removeAttribute(b), e.hasAttribute(y) || e.setAttribute(y, "true"), e.classList.add(...t);
|
|
122
123
|
}
|
|
123
124
|
function k(e) {
|
|
124
|
-
e.removeAttribute(
|
|
125
|
+
e.removeAttribute(v), e.classList.remove(g), e.classList.remove(_);
|
|
125
126
|
}
|
|
126
127
|
function A(e) {
|
|
127
|
-
e.removeAttribute(
|
|
128
|
+
e.removeAttribute(m), e.classList.remove(...a(e, "conditionalHidden"));
|
|
128
129
|
}
|
|
129
130
|
function j(e) {
|
|
130
|
-
let t = e.closest(
|
|
131
|
-
for (; t;)
|
|
131
|
+
let t = e.closest(x);
|
|
132
|
+
for (; t;) ee(t), t = t.parentElement?.closest(x) || null;
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function te(e, t, n, r = {}) {
|
|
134
135
|
if (r.disabledOnly) {
|
|
135
136
|
let r = e.hasAttribute("data-formie-conditionally-disabled") !== t;
|
|
136
|
-
return e.toggleAttribute("data-formie-conditionally-disabled", t),
|
|
137
|
+
return e.toggleAttribute("data-formie-conditionally-disabled", t), D(e, t), t && n && r && C(e), r;
|
|
137
138
|
}
|
|
138
139
|
if (r.displayMode === "muted") return M(e, t);
|
|
139
140
|
let i = !1;
|
|
140
|
-
return (e.hasAttribute(
|
|
141
|
+
return (e.hasAttribute(v) || e.classList.contains(g) || e.classList.contains(_)) && (k(e), i = !0), i = w(e, t) || i, D(e, t), j(e), t && n && i && C(e), i;
|
|
141
142
|
}
|
|
142
143
|
function M(e, t) {
|
|
143
144
|
let n = !1;
|
|
144
|
-
return t ? ((e.hasAttribute(
|
|
145
|
+
return t ? ((e.hasAttribute(m) || e.hasAttribute(h)) && (A(e), n = !0), e.hasAttribute(v) || (e.setAttribute(v, "true"), n = !0), e.classList.contains(g) || (e.classList.add(g), n = !0)) : ((e.hasAttribute(v) || e.classList.contains(g) || e.classList.contains(_)) && (k(e), n = !0), (e.hasAttribute(m) || e.hasAttribute(h)) && (A(e), n = !0)), j(e), n;
|
|
145
146
|
}
|
|
146
147
|
//#endregion
|
|
147
148
|
//#region src/js/modules/fields/conditions/references.ts
|
|
@@ -158,23 +159,23 @@ function I(e) {
|
|
|
158
159
|
function L(e) {
|
|
159
160
|
return e.closest(P);
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
+
function ne(e) {
|
|
162
163
|
return Array.from(e.querySelectorAll(N)).filter((e) => F(e) && !!e.name);
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function re(e) {
|
|
165
166
|
let t = e.getAttribute("name") || "";
|
|
166
167
|
return Array.from(t.matchAll(/\[([^\]]+)\]/g)).map((e) => e[1] || "").filter(Boolean);
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function ie(e, t) {
|
|
169
170
|
if (!t) return !0;
|
|
170
171
|
let n = t.split(/[.:]/).filter(Boolean);
|
|
171
172
|
if (!n.length) return !0;
|
|
172
|
-
let r =
|
|
173
|
+
let r = re(e);
|
|
173
174
|
return r.length < n.length ? !1 : n.every((e, t) => r[r.length - n.length + t] === e);
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
+
function ae(e, t) {
|
|
176
177
|
if (!t) return e;
|
|
177
|
-
let n = e.filter((e) =>
|
|
178
|
+
let n = e.filter((e) => ie(e, t));
|
|
178
179
|
return n.length ? n : e;
|
|
179
180
|
}
|
|
180
181
|
function R(e, t) {
|
|
@@ -189,18 +190,18 @@ function z(e) {
|
|
|
189
190
|
function B(e, t, n) {
|
|
190
191
|
let r = z(n);
|
|
191
192
|
if (!r || r.target !== "field" || !r.handle) return [];
|
|
192
|
-
let i =
|
|
193
|
-
if (c.length) return (
|
|
194
|
-
let l =
|
|
195
|
-
if (d.length || f.length) return
|
|
193
|
+
let i = s(r.handle), a = !!r.transformerParams.scope, c = Array.from(e.querySelectorAll(`[data-formie-field-handle="${i}"]`));
|
|
194
|
+
if (c.length) return (a ? c : R(t, c)).flatMap((e) => ae(ne(e), r.selector));
|
|
195
|
+
let l = o(r.handle), u = s(l), d = Array.from(e.querySelectorAll(`[name="${u}"]`)).filter((e) => F(e)), f = Array.from(e.querySelectorAll(`[name="${u}[]"]`)).filter((e) => F(e));
|
|
196
|
+
if (d.length || f.length) return a ? [...d, ...f] : R(t, [...d, ...f]);
|
|
196
197
|
if (!r.handle.includes("__ROW__")) return [];
|
|
197
198
|
let p = I(t);
|
|
198
|
-
if (p && !
|
|
199
|
-
let t =
|
|
200
|
-
if (i.length ||
|
|
199
|
+
if (p && !a) {
|
|
200
|
+
let t = o(r.handle.replace(/__ROW__/g, p)), n = s(t), i = Array.from(e.querySelectorAll(`[name="${n}"]`)).filter((e) => F(e)), a = Array.from(e.querySelectorAll(`[name="${n}[]"]`)).filter((e) => F(e));
|
|
201
|
+
if (i.length || a.length) return [...i, ...a];
|
|
201
202
|
}
|
|
202
|
-
if (!
|
|
203
|
-
let m =
|
|
203
|
+
if (!a) return [];
|
|
204
|
+
let m = o(r.handle).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/__ROW__/g, "\\d+"), h = new RegExp(m);
|
|
204
205
|
return Array.from(e.querySelectorAll("[name]")).filter((e) => F(e) && h.test(e.getAttribute("name") || ""));
|
|
205
206
|
}
|
|
206
207
|
//#endregion
|
|
@@ -234,7 +235,7 @@ function q(e, t) {
|
|
|
234
235
|
function J(e) {
|
|
235
236
|
return (e.id ? e.ownerDocument.querySelector(`label[for="${e.id}"]`)?.textContent?.trim() : "") || e.closest("label")?.textContent?.trim() || "";
|
|
236
237
|
}
|
|
237
|
-
function
|
|
238
|
+
function oe(e, t = "") {
|
|
238
239
|
let n = e[0];
|
|
239
240
|
if (!n) return [];
|
|
240
241
|
if (n instanceof HTMLInputElement) {
|
|
@@ -259,7 +260,7 @@ function X(e, t = null) {
|
|
|
259
260
|
let r = q(e, t), i = n.get(r) || [];
|
|
260
261
|
i.push(e), n.set(r, i);
|
|
261
262
|
});
|
|
262
|
-
let r = Array.from(n.values()).flatMap((e) =>
|
|
263
|
+
let r = Array.from(n.values()).flatMap((e) => oe(e, t?.selector || ""));
|
|
263
264
|
return (r.length === 0 || r.every((e) => e === "")) && t?.defaultValue ? [t.defaultValue] : r;
|
|
264
265
|
}
|
|
265
266
|
function Z(e, n, r, i) {
|
|
@@ -296,7 +297,7 @@ function Z(e, n, r, i) {
|
|
|
296
297
|
}
|
|
297
298
|
//#endregion
|
|
298
299
|
//#region src/js/modules/fields/conditions/evaluator.ts
|
|
299
|
-
function
|
|
300
|
+
function se(t, r, i = {}) {
|
|
300
301
|
let a = i.root, o = i.from || a, s = t.conditions.map((t) => {
|
|
301
302
|
let n = r(t), i = z(t), s = i?.target === "submission" && a && o ? K(a, i, o) : X(n, i);
|
|
302
303
|
if (t.browserSafe === !1 || i?.transformerId || i?.isValid === !1 || !n.length && i?.target !== "submission") return {
|
|
@@ -313,12 +314,12 @@ function oe(t, r, i = {}) {
|
|
|
313
314
|
}
|
|
314
315
|
//#endregion
|
|
315
316
|
//#region src/js/modules/fields/conditions.ts
|
|
316
|
-
var Q =
|
|
317
|
+
var Q = i("conditions");
|
|
317
318
|
function $(e) {
|
|
318
319
|
let t = /* @__PURE__ */ new Set();
|
|
319
320
|
return e.filter((e) => !t.has(e) && (t.add(e), !0));
|
|
320
321
|
}
|
|
321
|
-
var
|
|
322
|
+
var ce = {
|
|
322
323
|
moduleId: "formie:conditions",
|
|
323
324
|
version: 2,
|
|
324
325
|
surfaces: [
|
|
@@ -330,84 +331,84 @@ var se = {
|
|
|
330
331
|
match: (e) => e.target instanceof HTMLElement && (e.target.matches("[data-formie-conditions]") || !!e.target.querySelector("[data-formie-conditions]")),
|
|
331
332
|
setup: async (e) => {
|
|
332
333
|
let t = e.target instanceof HTMLElement ? e.target : e.root;
|
|
333
|
-
if (!
|
|
334
|
+
if (!u(t).length) {
|
|
334
335
|
Q.log("No condition nodes in scope.");
|
|
335
336
|
return;
|
|
336
337
|
}
|
|
337
|
-
let n = [],
|
|
338
|
+
let n = [], i = [], a = /* @__PURE__ */ new Set(), o = !1, s = !1, l = () => {
|
|
338
339
|
n.forEach((e) => {
|
|
339
340
|
e();
|
|
340
341
|
}), n.length = 0;
|
|
341
|
-
},
|
|
342
|
-
let n =
|
|
342
|
+
}, f = () => u(t).flatMap((e) => {
|
|
343
|
+
let n = d(e);
|
|
343
344
|
return n ? [{
|
|
344
345
|
node: e,
|
|
345
346
|
settings: n,
|
|
346
347
|
sourceInputs: $(n.conditions.flatMap((n) => B(t, e, n)))
|
|
347
348
|
}] : [];
|
|
348
|
-
}),
|
|
349
|
-
let t = new Map(e.map((e) => [e.node, e])), n = /* @__PURE__ */ new Set(), r = [],
|
|
350
|
-
|
|
349
|
+
}), p = (e) => {
|
|
350
|
+
let t = new Map(e.map((e) => [e.node, e])), n = /* @__PURE__ */ new Set(), r = [], i = [];
|
|
351
|
+
a = /* @__PURE__ */ new Set();
|
|
351
352
|
let o = (e) => {
|
|
352
353
|
if (n.has(e.node)) return;
|
|
353
|
-
let
|
|
354
|
-
if (
|
|
355
|
-
r.slice(
|
|
354
|
+
let s = r.indexOf(e.node);
|
|
355
|
+
if (s >= 0) {
|
|
356
|
+
r.slice(s).forEach((e) => a.add(e));
|
|
356
357
|
return;
|
|
357
358
|
}
|
|
358
359
|
r.push(e.node);
|
|
359
360
|
let l = (e) => {
|
|
360
|
-
for (let n = e?.closest(
|
|
361
|
+
for (let n = e?.closest(c); n; n = n.parentElement?.closest(c)) {
|
|
361
362
|
let e = t.get(n);
|
|
362
363
|
e && o(e);
|
|
363
364
|
}
|
|
364
365
|
};
|
|
365
|
-
l(e.node.parentElement), e.sourceInputs.forEach((e) => l(e)), r.pop(), n.add(e.node),
|
|
366
|
+
l(e.node.parentElement), e.sourceInputs.forEach((e) => l(e)), r.pop(), n.add(e.node), i.push(e);
|
|
366
367
|
};
|
|
367
|
-
return e.forEach(o),
|
|
368
|
-
},
|
|
368
|
+
return e.forEach(o), a.size && Q.warn("Condition dependency cycle.", { count: a.size }), i;
|
|
369
|
+
}, m = e.options?.cpDisplayMode === "muted" ? "muted" : "hide", h = !1, g = () => {
|
|
369
370
|
let n = !1;
|
|
370
|
-
return
|
|
371
|
-
let
|
|
371
|
+
return i.forEach((r) => {
|
|
372
|
+
let i = a.has(r.node) ? {
|
|
372
373
|
finalResult: !1,
|
|
373
374
|
shouldHide: ["show", "enable"].includes(r.settings.showRule),
|
|
374
375
|
diagnostics: [{ code: "dependencyCycle" }]
|
|
375
|
-
} :
|
|
376
|
+
} : se(r.settings, (e) => B(t, r.node, e), {
|
|
376
377
|
root: t,
|
|
377
378
|
from: r.node
|
|
378
|
-
}), o = r.node.hasAttribute("data-formie-page") ? "hide" :
|
|
379
|
+
}), o = r.node.hasAttribute("data-formie-page") ? "hide" : m, s = te(r.node, i.shouldHide, r.settings.clearOnHide, {
|
|
379
380
|
displayMode: o,
|
|
380
381
|
disabledOnly: ["enable", "disable"].includes(r.settings.showRule)
|
|
381
382
|
});
|
|
382
383
|
n ||= s, Q.log("Condition evaluated.", {
|
|
383
|
-
shouldHide:
|
|
384
|
-
finalResult:
|
|
384
|
+
shouldHide: i.shouldHide,
|
|
385
|
+
finalResult: i.finalResult,
|
|
385
386
|
stateChanged: s
|
|
386
387
|
}), e.emit("formie:conditions:evaluated", {
|
|
387
388
|
node: r.node,
|
|
388
|
-
shouldHide:
|
|
389
|
-
finalResult:
|
|
389
|
+
shouldHide: i.shouldHide,
|
|
390
|
+
finalResult: i.finalResult,
|
|
390
391
|
clearOnHide: r.settings.clearOnHide,
|
|
391
|
-
diagnostics:
|
|
392
|
+
diagnostics: a.has(r.node) ? [{ code: "dependencyCycle" }] : []
|
|
392
393
|
});
|
|
393
394
|
}), n;
|
|
394
|
-
},
|
|
395
|
-
if (!
|
|
396
|
-
|
|
395
|
+
}, _ = () => {
|
|
396
|
+
if (!h) {
|
|
397
|
+
h = !0;
|
|
397
398
|
try {
|
|
398
|
-
|
|
399
|
+
g();
|
|
399
400
|
} finally {
|
|
400
|
-
|
|
401
|
+
h = !1;
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
|
-
}, _ = () => {
|
|
404
|
-
m || a || (a = !0, requestAnimationFrame(() => {
|
|
405
|
-
a = !1, !m && g();
|
|
406
|
-
}));
|
|
407
404
|
}, v = () => {
|
|
408
|
-
|
|
405
|
+
h || o || (o = !0, requestAnimationFrame(() => {
|
|
406
|
+
o = !1, !h && _();
|
|
407
|
+
}));
|
|
408
|
+
}, y = () => {
|
|
409
|
+
if ($(i.flatMap((e) => e.sourceInputs)).forEach((e) => {
|
|
409
410
|
let t = () => {
|
|
410
|
-
|
|
411
|
+
v();
|
|
411
412
|
};
|
|
412
413
|
Y(e).forEach((n) => {
|
|
413
414
|
e.addEventListener(n, t);
|
|
@@ -419,31 +420,33 @@ var se = {
|
|
|
419
420
|
}), e.form) {
|
|
420
421
|
let t = () => {
|
|
421
422
|
window.setTimeout(() => {
|
|
422
|
-
|
|
423
|
+
v();
|
|
423
424
|
}, 0);
|
|
424
425
|
};
|
|
425
|
-
e.form.addEventListener("reset", t)
|
|
426
|
-
|
|
426
|
+
e.form.addEventListener("reset", t);
|
|
427
|
+
let i = r("reset");
|
|
428
|
+
e.form.addEventListener(i, _), n.push(() => {
|
|
429
|
+
e.form?.removeEventListener("reset", t), e.form?.removeEventListener(i, _);
|
|
427
430
|
});
|
|
428
|
-
let
|
|
429
|
-
|
|
431
|
+
let a = () => {
|
|
432
|
+
v();
|
|
430
433
|
};
|
|
431
|
-
e.form.addEventListener(H,
|
|
432
|
-
e.form?.removeEventListener(H,
|
|
434
|
+
e.form.addEventListener(H, a), n.push(() => {
|
|
435
|
+
e.form?.removeEventListener(H, a);
|
|
433
436
|
});
|
|
434
437
|
}
|
|
435
|
-
}, y = () => {
|
|
436
|
-
c(), r = f(d()), v(), Q.log("Rebuilt condition graph.", { entryCount: r.length }), _();
|
|
437
438
|
}, b = () => {
|
|
438
|
-
|
|
439
|
-
|
|
439
|
+
l(), i = p(f()), y(), Q.log("Rebuilt condition graph.", { entryCount: i.length }), v();
|
|
440
|
+
}, x = () => {
|
|
441
|
+
h || s || (s = !0, requestAnimationFrame(() => {
|
|
442
|
+
s = !1, !h && b();
|
|
440
443
|
}));
|
|
441
|
-
},
|
|
442
|
-
if (
|
|
444
|
+
}, S = new MutationObserver((e) => {
|
|
445
|
+
if (h) return;
|
|
443
446
|
let t = e.some((e) => e.type === "childList" && (e.addedNodes.length > 0 || e.removedNodes.length > 0)), n = e.some((e) => e.type === "attributes");
|
|
444
|
-
t ?
|
|
447
|
+
t ? x() : n && v();
|
|
445
448
|
});
|
|
446
|
-
return
|
|
449
|
+
return S.observe(t, {
|
|
447
450
|
childList: !0,
|
|
448
451
|
subtree: !0,
|
|
449
452
|
attributes: !0,
|
|
@@ -455,10 +458,10 @@ var se = {
|
|
|
455
458
|
"data-formie-row-hidden",
|
|
456
459
|
V
|
|
457
460
|
]
|
|
458
|
-
}),
|
|
459
|
-
|
|
461
|
+
}), b(), await e.emit("formie:module:conditions:init", { count: i.length }), Q.log("Module setup complete.", { entryCount: i.length }), { destroy: () => {
|
|
462
|
+
l(), S.disconnect(), Q.log("Module destroy."), e.emit("formie:module:conditions:destroy", {});
|
|
460
463
|
} };
|
|
461
464
|
}
|
|
462
465
|
};
|
|
463
466
|
//#endregion
|
|
464
|
-
export {
|
|
467
|
+
export { ce as conditionsModule };
|
|
@@ -5198,30 +5198,31 @@ function fe() {
|
|
|
5198
5198
|
}
|
|
5199
5199
|
function P(e, t) {
|
|
5200
5200
|
if (!e) return null;
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5201
|
+
let n = B(e);
|
|
5202
|
+
if (n) return n;
|
|
5203
|
+
let r = e.trim().match(/^([+-]?\d+)\s*(day|days|week|weeks|month|months|year|years)$/i);
|
|
5204
|
+
if (!r) return null;
|
|
5205
|
+
let i = parseInt(r[1] || "0", 10), a = (r[2] || "").toLowerCase(), o = /* @__PURE__ */ new Date();
|
|
5206
|
+
switch (a) {
|
|
5206
5207
|
case "day":
|
|
5207
5208
|
case "days":
|
|
5208
|
-
|
|
5209
|
+
o.setDate(o.getDate() + i);
|
|
5209
5210
|
break;
|
|
5210
5211
|
case "week":
|
|
5211
5212
|
case "weeks":
|
|
5212
|
-
|
|
5213
|
+
o.setDate(o.getDate() + i * 7);
|
|
5213
5214
|
break;
|
|
5214
5215
|
case "month":
|
|
5215
5216
|
case "months":
|
|
5216
|
-
|
|
5217
|
+
o.setMonth(o.getMonth() + i);
|
|
5217
5218
|
break;
|
|
5218
5219
|
case "year":
|
|
5219
5220
|
case "years":
|
|
5220
|
-
|
|
5221
|
+
o.setFullYear(o.getFullYear() + i);
|
|
5221
5222
|
break;
|
|
5222
5223
|
default: return null;
|
|
5223
5224
|
}
|
|
5224
|
-
return t === "min" ?
|
|
5225
|
+
return t === "min" ? o.setHours(0, 0, 0, 0) : o.setHours(23, 59, 59, 999), o;
|
|
5225
5226
|
}
|
|
5226
5227
|
function pe(e) {
|
|
5227
5228
|
return (e.getIsDate ? e.dateFormat || "" : e.getIsTime ? e.timeFormat || "" : `${e.dateFormat || ""} ${e.timeFormat || ""}`.trim()).replaceAll("A", "K").replaceAll("a", "K").replaceAll("s", "S").replaceAll("g", "h").replaceAll("h", "G");
|
|
@@ -5250,7 +5251,7 @@ function z(e, t) {
|
|
|
5250
5251
|
return !t.getIsTime && !t.getIsDateTime ? `${n}-${r}-${i}` : `${n}-${r}-${i} ${R(e.getHours())}:${R(e.getMinutes())}:${R(e.getSeconds())}`;
|
|
5251
5252
|
}
|
|
5252
5253
|
function B(e) {
|
|
5253
|
-
let t = new Date(e);
|
|
5254
|
+
let t = new Date(/^\d{4}-\d{2}-\d{2}$/.test(e) ? `${e}T00:00:00` : e);
|
|
5254
5255
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
5255
5256
|
}
|
|
5256
5257
|
function V(e, t, n, r) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./api-
|
|
2
|
-
import { r as t } from "./async-
|
|
3
|
-
import { r as n } from "./scripts-
|
|
1
|
+
import { t as e } from "./api-Dxl_CKw-.js";
|
|
2
|
+
import { r as t } from "./async-2GdXNFCE.js";
|
|
3
|
+
import { r as n } from "./scripts-DrccjrFv.js";
|
|
4
4
|
//#region src/js/modules/payments/eway.ts
|
|
5
5
|
var r = [{
|
|
6
6
|
id: "FORMIE_EWAY_SCRIPT_MIN",
|
|
@@ -56,7 +56,10 @@ function M(e) {
|
|
|
56
56
|
return !n && !r ? null : {
|
|
57
57
|
assetId: n,
|
|
58
58
|
filename: r,
|
|
59
|
-
url: i
|
|
59
|
+
url: i,
|
|
60
|
+
uploadUid: w(e.uploadUid) || null,
|
|
61
|
+
attachToken: w(e.attachToken) || null,
|
|
62
|
+
viewToken: w(e.viewToken ?? e.uploadToken) || null
|
|
60
63
|
};
|
|
61
64
|
}
|
|
62
65
|
function N(e) {
|
|
@@ -77,13 +80,17 @@ function P(e) {
|
|
|
77
80
|
})).filter((e) => e.filename !== "") : [];
|
|
78
81
|
}
|
|
79
82
|
function F(e, t) {
|
|
80
|
-
return A(e, t).map((
|
|
81
|
-
assetId: C(
|
|
82
|
-
filename: ""
|
|
83
|
+
return A(e, t).map((t) => ({
|
|
84
|
+
assetId: C(t.getAttribute(h)) ?? C(t.value),
|
|
85
|
+
filename: "",
|
|
86
|
+
viewToken: t.getAttribute("data-formie-file-upload-token"),
|
|
87
|
+
uploadUid: t.name.endsWith("[uploadUid]") ? t.value : null,
|
|
88
|
+
attachToken: k(e).find((e) => e.name === t.name.replace(/\[uploadUid\]$/, "[attachToken]"))?.value
|
|
83
89
|
})).filter((e) => e.assetId !== null);
|
|
84
90
|
}
|
|
85
91
|
function I(e, t) {
|
|
86
92
|
return e.length ? e.map((e, n) => ({
|
|
93
|
+
...e,
|
|
87
94
|
assetId: e.assetId,
|
|
88
95
|
filename: t[n]?.filename || ""
|
|
89
96
|
})) : t;
|
|
@@ -140,7 +147,12 @@ function U(e, t, n) {
|
|
|
140
147
|
}), n.forEach((e, t) => {
|
|
141
148
|
if (!e.assetId) return;
|
|
142
149
|
let n = document.createElement("input");
|
|
143
|
-
n.type = "hidden"
|
|
150
|
+
n.type = "hidden";
|
|
151
|
+
let a = e.uploadUid && e.attachToken;
|
|
152
|
+
if (n.name = `${i}[${t}][${a ? "uploadUid" : "assetId"}]`, n.value = a ? e.uploadUid : String(e.assetId), n.setAttribute(g, "true"), n.setAttribute(h, String(e.assetId)), e.viewToken && n.setAttribute("data-formie-file-upload-token", e.viewToken), r.insertAdjacentElement("afterend", n), r = n, a) {
|
|
153
|
+
let n = document.createElement("input");
|
|
154
|
+
n.type = "hidden", n.name = `${i}[${t}][attachToken]`, n.value = e.attachToken, n.setAttribute(g, "true"), r.insertAdjacentElement("afterend", n), r = n;
|
|
155
|
+
}
|
|
144
156
|
}), t.value = "";
|
|
145
157
|
}
|
|
146
158
|
function W(e) {
|
|
@@ -153,23 +165,23 @@ function G(e, t, n) {
|
|
|
153
165
|
a && i.append("handle", a), o && i.append("fieldHandle", o);
|
|
154
166
|
let s = r?.querySelector("input[name=\"submissionUid\"]");
|
|
155
167
|
return s instanceof HTMLInputElement && s.value.trim() && i.append("submissionUid", s.value.trim()), n.forEach((e) => {
|
|
156
|
-
i.append("assetIds[]", String(e));
|
|
168
|
+
e.assetId && (i.append("assetIds[]", String(e.assetId)), e.viewToken && i.append(`uploadTokens[${e.assetId}]`, e.viewToken));
|
|
157
169
|
}), i;
|
|
158
170
|
}
|
|
159
171
|
async function K(e, t, n) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let a = t.getAttribute(p)?.trim() || "/actions/formie/file-upload/hydrate", o = N((await r(a, {
|
|
172
|
+
if (!n.map((e) => e.assetId).filter((e) => e !== null).length) return n;
|
|
173
|
+
let i = t.getAttribute(p)?.trim() || "/actions/formie/file-upload/hydrate", a = N((await r(i, {
|
|
163
174
|
profile: e.closest("form")?.dataset.formieRequestProfile,
|
|
164
175
|
method: "POST",
|
|
165
|
-
body: G(e, t,
|
|
176
|
+
body: G(e, t, n)
|
|
166
177
|
})).assets);
|
|
167
|
-
if (!
|
|
168
|
-
let
|
|
178
|
+
if (!a.length) return n;
|
|
179
|
+
let o = new Map(a.map((e) => [e.assetId, e]));
|
|
169
180
|
return n.map((e) => {
|
|
170
|
-
if (!e.assetId || !
|
|
171
|
-
let t =
|
|
181
|
+
if (!e.assetId || !o.has(e.assetId)) return e;
|
|
182
|
+
let t = o.get(e.assetId);
|
|
172
183
|
return {
|
|
184
|
+
...e,
|
|
173
185
|
assetId: e.assetId,
|
|
174
186
|
filename: t.filename || e.filename,
|
|
175
187
|
url: t.url ?? e.url
|
|
@@ -180,11 +192,11 @@ function q(e, t) {
|
|
|
180
192
|
let n = e.detail;
|
|
181
193
|
if (!S(n)) return [];
|
|
182
194
|
let r = w(n.fieldHandle), i = w(n.inputKey), a = w(n.inputName ?? n.name), o = S(n.data) ? n.data : null, s = w(o?.fieldHandle), c = w(o?.inputKey), l = w(o?.inputName ?? o?.name), u = [], d = !1, f = !1, p = !1;
|
|
183
|
-
if (i !== "" && i === t.inputKey && (d = !0, u.push(n.assets, n.assetIds, n.data)), a !== "" && a === t.inputName && (f = !0, u.push(n.assets, n.assetIds, n.data)), r === t.fieldHandle && (p = !0, u.push(n.assets, n.assetIds, n.data)), o) {
|
|
195
|
+
if (i !== "" && i === t.inputKey && (d = !0, u.push(n.uploadedAssets, n.assets, n.assetIds, n.data)), a !== "" && a === t.inputName && (f = !0, u.push(n.uploadedAssets, n.assets, n.assetIds, n.data)), r === t.fieldHandle && (p = !0, u.push(n.uploadedAssets, n.assets, n.assetIds, n.data)), o) {
|
|
184
196
|
let e = [
|
|
197
|
+
o.uploadedAssets,
|
|
185
198
|
o.assets,
|
|
186
199
|
o.assetIds,
|
|
187
|
-
o.uploadedAssets,
|
|
188
200
|
o.data
|
|
189
201
|
];
|
|
190
202
|
c !== "" && c === t.inputKey && (d = !0, u.push(...e)), l !== "" && l === t.inputName && (f = !0, u.push(...e)), s === t.fieldHandle && (p = !0, u.push(...e));
|