@verbb/formie-browser 1.0.3 → 1.0.5
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 +65 -17
- package/dist/chunks/address-country-Rx6GQTND.js +68 -0
- package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
- package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
- package/dist/chunks/api-CmwLRq_n.js +780 -0
- package/dist/chunks/api-DMK8NSUI.js +407 -0
- package/dist/chunks/api-sPqGbOww.js +125 -0
- package/dist/chunks/async-nPFRNQ06.js +25 -0
- package/dist/chunks/bpoint-DSjqRv63.js +24 -0
- package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
- package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
- package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
- package/dist/chunks/chunk-3b4jIN3o.js +13 -0
- package/dist/chunks/combobox-D-2b42wn.js +1954 -0
- package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
- package/dist/chunks/constants-DVcJAvc5.js +38 -0
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
- package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
- package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
- package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
- package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
- package/dist/chunks/debug-BV0DvdHx.js +41 -0
- package/dist/chunks/dist-BF5GU3_9.js +2674 -0
- package/dist/chunks/event-names-BCI2FLD8.js +51 -0
- package/dist/chunks/eway-D3ctTbEk.js +70 -0
- package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
- package/dist/chunks/file-upload-D49m8-DR.js +287 -0
- package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
- package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
- package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
- package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
- package/dist/chunks/google-address-OhKilPWE.js +161 -0
- package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
- package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
- package/dist/chunks/http-D-JExro7.js +27 -0
- package/dist/chunks/i18n-BY1ds1BL.js +121 -0
- package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
- package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
- package/dist/chunks/mollie-COG-ko2D.js +23 -0
- package/dist/chunks/moneris-CMH8PlRc.js +117 -0
- package/dist/chunks/opayo-D2jsR5vh.js +113 -0
- package/dist/chunks/paddle-DxF88RfC.js +55 -0
- package/dist/chunks/paypal-b5pnwrA2.js +95 -0
- package/dist/chunks/payway-BJYu9DIR.js +55 -0
- package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
- package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
- package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
- package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
- package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
- package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
- package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
- package/dist/chunks/repeater-B5leVxZU.js +102 -0
- package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
- package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
- package/dist/chunks/sdk-BhHAYgga.js +1397 -0
- package/dist/chunks/shared-Bx9s0i0P.js +100 -0
- package/dist/chunks/signature-CpgqHCEx.js +463 -0
- package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
- package/dist/chunks/square-BP8RWAKB.js +40 -0
- package/dist/chunks/stripe-MihN63uC.js +184 -0
- package/dist/chunks/styles-BfoIZwJp.js +19 -0
- package/dist/chunks/summary-D3AjxpYN.js +114 -0
- package/dist/chunks/table-C-lkQN6I.js +78 -0
- package/dist/chunks/text-limit-B09elPDB.js +125 -0
- package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
- package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
- package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
- package/dist/css/formie-theme.css +2 -0
- package/dist/css/theme/fields/_address-state.css +94 -0
- package/dist/css/theme/fields/_combobox.css +246 -0
- package/dist/css/theme/fields/_select.css +13 -0
- package/dist/index.js +2447 -39
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/field-error-container.d.ts +4 -0
- package/dist/js/core/field-error-container.d.ts.map +1 -0
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts +4 -0
- package/dist/js/core/validation-focus.d.ts.map +1 -0
- package/dist/js/modules/address/api.d.ts +1 -0
- package/dist/js/modules/address/api.d.ts.map +1 -1
- package/dist/js/modules/address/constants.d.ts +22 -1
- package/dist/js/modules/address/constants.d.ts.map +1 -1
- package/dist/js/modules/address/host.d.ts +2 -2
- package/dist/js/modules/address/host.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +3 -0
- package/dist/js/modules/fields/address-country.d.ts.map +1 -0
- package/dist/js/modules/fields/address-state.d.ts +3 -0
- package/dist/js/modules/fields/address-state.d.ts.map +1 -0
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +17 -0
- package/dist/js/modules/fields/combobox.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-link.d.ts +3 -0
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-maps.d.ts +3 -0
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
- 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/index.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +7 -0
- package/dist/js/utils/country-from-ip.d.ts.map +1 -0
- package/dist/js/utils/field-references.d.ts +1 -0
- package/dist/js/utils/field-references.d.ts.map +1 -1
- package/dist/js/utils/field-references.row-scope.d.ts +11 -0
- package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
- package/dist/js/utils/i18n.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/css/formie-theme.css +2 -0
- package/src/css/theme/fields/_address-state.css +94 -0
- package/src/css/theme/fields/_combobox.css +246 -0
- package/src/css/theme/fields/_select.css +13 -0
- package/src/js/core/create-formie-client.ts +27 -0
- package/src/js/core/field-error-container.ts +39 -0
- package/src/js/core/submit-result-state.ts +12 -2
- package/src/js/core/submit-result-ui.ts +7 -13
- package/src/js/core/validation-focus.ts +117 -0
- package/src/js/modules/address/api.ts +7 -0
- package/src/js/modules/address/constants.ts +82 -2
- package/src/js/modules/address/host.ts +16 -6
- package/src/js/modules/address/loqate.ts +3 -17
- package/src/js/modules/fields/address-country.ts +156 -0
- package/src/js/modules/fields/address-state.ts +946 -0
- package/src/js/modules/fields/calculations.ts +32 -0
- package/src/js/modules/fields/checkbox-radio.ts +21 -15
- package/src/js/modules/fields/combobox.ts +188 -0
- package/src/js/modules/fields/custom-google-maps.ts +416 -0
- package/src/js/modules/fields/custom-link.ts +95 -0
- package/src/js/modules/fields/custom-maps.ts +339 -0
- package/src/js/modules/fields/date-picker.ts +96 -3
- package/src/js/modules/fields/file-upload.ts +12 -9
- package/src/js/modules/fields/index.ts +6 -0
- package/src/js/modules/fields/phone-country.ts +6 -0
- package/src/js/modules/fields/text-limit.ts +87 -22
- package/src/js/submit/pipeline.ts +11 -1
- package/src/js/utils/country-from-ip.ts +54 -0
- package/src/js/utils/field-references.row-scope.ts +303 -0
- package/src/js/utils/field-references.ts +1 -0
- package/src/js/utils/i18n.ts +184 -5
- package/src/js/validation/rules/email.ts +3 -2
- package/src/js/validation/rules/match.ts +2 -2
- package/src/js/validation/rules/minmax.ts +4 -4
- package/src/js/validation/rules/number.ts +9 -5
- package/src/js/validation/rules/pattern.ts +4 -4
- package/src/js/validation/rules/required.ts +1 -1
- package/src/js/validation/rules/url.ts +1 -1
- package/src/js/validation/validator.ts +7 -7
- package/dist/chunks/address-finder-BjMuEiwF.js +0 -37
- package/dist/chunks/bpoint-KudsBCo2.js +0 -26
- package/dist/chunks/calculations-DlGSkQ3W.js +0 -147
- package/dist/chunks/captcha-eu-CterYFok.js +0 -34
- package/dist/chunks/checkbox-radio-CBvgk3hR.js +0 -136
- package/dist/chunks/conditions-DYy1-Hwt.js +0 -459
- package/dist/chunks/date-picker-BlD--zfe.js +0 -4994
- package/dist/chunks/eway-qwc-B5Us.js +0 -74
- package/dist/chunks/file-upload-CIgHrXfp.js +0 -316
- package/dist/chunks/friendly-captcha-v1-EDFac33c.js +0 -33
- package/dist/chunks/friendly-captcha-v2-BDpSvFGR.js +0 -38
- package/dist/chunks/go-cardless-DuDMVsnz.js +0 -24
- package/dist/chunks/google-address-Bmjp01pH.js +0 -181
- package/dist/chunks/hcaptcha-BTQ6An6g.js +0 -56
- package/dist/chunks/hidden-DbPdOxKb.js +0 -31
- package/dist/chunks/index-BEsfee-D.js +0 -1839
- package/dist/chunks/index-BP7Unm5Y.js +0 -863
- package/dist/chunks/index-BcqwpPNE.js +0 -4314
- package/dist/chunks/loqate-BdNGv93o.js +0 -55
- package/dist/chunks/mollie-DFOjTuGX.js +0 -24
- package/dist/chunks/moneris-BbFfl-EL.js +0 -101
- package/dist/chunks/opayo-CmgYa9ya.js +0 -122
- package/dist/chunks/paddle-BUi7w1_o.js +0 -60
- package/dist/chunks/paypal-A-ePfh6k.js +0 -100
- package/dist/chunks/payway-BqFCbhyo.js +0 -56
- package/dist/chunks/phone-country-DPMiqk4L.js +0 -3765
- package/dist/chunks/place-kit-CX7tamAg.js +0 -42
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
- package/dist/chunks/recaptcha-enterprise-DxF6cW95.js +0 -71
- package/dist/chunks/recaptcha-shared-DhGcbiaq.js +0 -15
- package/dist/chunks/recaptcha-v2-checkbox-R9EfbZ4k.js +0 -41
- package/dist/chunks/recaptcha-v2-invisible-DV9hswAp.js +0 -59
- package/dist/chunks/recaptcha-v3-V0xc-Edh.js +0 -28
- package/dist/chunks/repeater-DKUT6TGI.js +0 -124
- package/dist/chunks/rich-text-SH7KiaKH.js +0 -304
- package/dist/chunks/scripts-D9N2d5rN.js +0 -36
- package/dist/chunks/sdk-3SicTWby.js +0 -1559
- package/dist/chunks/shared-BmntPmnW.js +0 -80
- package/dist/chunks/signature-BA3tQsGT.js +0 -550
- package/dist/chunks/snaptcha-DV7p6J9k.js +0 -8
- package/dist/chunks/square-Bs-ndqYK.js +0 -46
- package/dist/chunks/stripe-DkZAHxtn.js +0 -202
- package/dist/chunks/styles-C3aqgtek.js +0 -21
- package/dist/chunks/summary-Dq2i9TQk.js +0 -126
- package/dist/chunks/table-Cu4WfVcw.js +0 -95
- package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
- package/dist/chunks/turnstile-CId90tRr.js +0 -59
- package/dist/chunks/utils-BntI3W4S.js +0 -6149
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { r as A, d as E, a as p, e as M } from "./shared-BmntPmnW.js";
|
|
2
|
-
import { h as L } from "./index-BcqwpPNE.js";
|
|
3
|
-
const l = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]", d = "minmaxOptions", h = "data-formie-checkbox-radio-max-disabled", g = "checkbox-radio", x = "checkbox-radio", f = L("fields", "checkbox-radio");
|
|
4
|
-
function m(t) {
|
|
5
|
-
return t.hasAttribute("data-checkbox-toggle") || t.hasAttribute("data-formie-checkbox-toggle");
|
|
6
|
-
}
|
|
7
|
-
function b(t) {
|
|
8
|
-
const r = t(d);
|
|
9
|
-
if (!r || r === !0 || typeof r != "object")
|
|
10
|
-
return {
|
|
11
|
-
min: null,
|
|
12
|
-
max: null
|
|
13
|
-
};
|
|
14
|
-
const o = r;
|
|
15
|
-
return {
|
|
16
|
-
min: typeof o.min == "number" ? o.min : null,
|
|
17
|
-
max: typeof o.max == "number" ? o.max : null
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function T(t) {
|
|
21
|
-
A(t, x, (r) => {
|
|
22
|
-
r.addValidator(
|
|
23
|
-
d,
|
|
24
|
-
({ field: o, getRule: e }) => {
|
|
25
|
-
if (!o || !e(d))
|
|
26
|
-
return !0;
|
|
27
|
-
const n = Array.from(o.querySelectorAll('input[type="checkbox"]')).filter((u) => u instanceof HTMLInputElement && !m(u)).filter((u) => u.checked).length, { min: a, max: i } = b(e);
|
|
28
|
-
return !(a !== null && n < a || i !== null && n > i);
|
|
29
|
-
},
|
|
30
|
-
({ field: o, label: e, t: c, getRule: n }) => {
|
|
31
|
-
const { min: a, max: i } = o ? b(n) : { min: null, max: null };
|
|
32
|
-
return a !== null && i !== null ? c("{attribute} must select between {min} and {max}.", { attribute: e, min: a, max: i }) : a !== null ? c("{attribute} must select no less than {min}.", { attribute: e, min: a }) : i !== null ? c("{attribute} must select no greater than {max}.", { attribute: e, max: i }) : c("{attribute} has an invalid value.", { attribute: e });
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function q(t) {
|
|
38
|
-
p(t, x, [d]);
|
|
39
|
-
}
|
|
40
|
-
function s(t) {
|
|
41
|
-
t.checked ? t.setAttribute("checked", "") : t.removeAttribute("checked");
|
|
42
|
-
}
|
|
43
|
-
function k(t) {
|
|
44
|
-
const r = Array.from(t.querySelectorAll('input[type="checkbox"][required][data-formie-checkbox-input]')).filter((e) => e instanceof HTMLInputElement);
|
|
45
|
-
if (!r.length)
|
|
46
|
-
return;
|
|
47
|
-
const o = r.some((e) => e.checked);
|
|
48
|
-
r.forEach((e) => {
|
|
49
|
-
if (o) {
|
|
50
|
-
e.removeAttribute("required"), e.setAttribute("aria-required", "false");
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
e.setAttribute("required", "true"), e.setAttribute("aria-required", "true");
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function y(t) {
|
|
57
|
-
const r = parseInt(t.closest("[data-formie-field-handle]")?.getAttribute("data-formie-max-options") || "", 10);
|
|
58
|
-
if (!(r > 0))
|
|
59
|
-
return;
|
|
60
|
-
const o = Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((n) => n instanceof HTMLInputElement && !m(n)), c = o.filter((n) => n.checked).length >= r;
|
|
61
|
-
o.forEach((n) => {
|
|
62
|
-
const a = c && !n.checked, i = n.hasAttribute(h);
|
|
63
|
-
if (a) {
|
|
64
|
-
n.disabled || (n.disabled = !0, n.setAttribute(h, "true"));
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
i && (n.disabled = !1, n.removeAttribute(h));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function v(t, r) {
|
|
71
|
-
Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((e) => e instanceof HTMLInputElement && e !== r && !m(e)).forEach((e) => {
|
|
72
|
-
e.disabled && !e.checked || (e.checked = r.checked, s(e), e.dispatchEvent(new Event("change", { bubbles: !0 })), e.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function I(t, r) {
|
|
76
|
-
if (!t.checked || !t.name) {
|
|
77
|
-
s(t);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
Array.from(r.querySelectorAll(`input[type="radio"][name="${M(t.name)}"]`)).filter((e) => e instanceof HTMLInputElement).forEach((e) => {
|
|
81
|
-
s(e);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function C(t) {
|
|
85
|
-
const r = Array.from(t.querySelectorAll('input[type="checkbox"], input[type="radio"]')).filter((e) => e instanceof HTMLInputElement);
|
|
86
|
-
if (!r.length)
|
|
87
|
-
return f.log("No checkbox/radio inputs found for field."), () => {
|
|
88
|
-
};
|
|
89
|
-
const o = r.map((e) => {
|
|
90
|
-
const c = e.type === "radio" ? "change" : "click", n = () => {
|
|
91
|
-
s(e), e.type === "checkbox" && m(e) && v(t, e), e.type === "radio" && I(e, t), k(t), y(t), f.log("Input interaction processed.", {
|
|
92
|
-
inputName: e.name,
|
|
93
|
-
inputType: e.type,
|
|
94
|
-
checked: e.checked
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
return e.addEventListener(c, n), s(e), () => {
|
|
98
|
-
e.removeEventListener(c, n);
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
return k(t), y(t), E(t, g, "init", {
|
|
102
|
-
checkboxRadio: t
|
|
103
|
-
}), () => {
|
|
104
|
-
o.forEach((e) => {
|
|
105
|
-
e();
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
const H = {
|
|
110
|
-
id: g,
|
|
111
|
-
kind: "field",
|
|
112
|
-
match: (t) => t.target instanceof HTMLElement && (t.target.matches(l) || !!t.target.querySelector(l)),
|
|
113
|
-
setup: async (t) => {
|
|
114
|
-
if (!(t.target instanceof HTMLElement))
|
|
115
|
-
return;
|
|
116
|
-
const r = t.target.matches(l) ? [t.target] : Array.from(t.target.querySelectorAll(l)).filter((e) => e instanceof HTMLElement);
|
|
117
|
-
T(t.form), f.log("Module setup.", {
|
|
118
|
-
fieldCount: r.length
|
|
119
|
-
});
|
|
120
|
-
const o = r.map((e) => C(e));
|
|
121
|
-
return await t.emit("formie:module:checkbox-radio:init", {
|
|
122
|
-
count: r.length
|
|
123
|
-
}), {
|
|
124
|
-
destroy: () => {
|
|
125
|
-
o.forEach((e) => {
|
|
126
|
-
e();
|
|
127
|
-
}), q(t.form), f.log("Module destroy.", {
|
|
128
|
-
fieldCount: r.length
|
|
129
|
-
}), t.emit("formie:module:checkbox-radio:destroy", {});
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
export {
|
|
135
|
-
H as checkboxRadioModule
|
|
136
|
-
};
|
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
import { S as te, A as re } from "./index-BEsfee-D.js";
|
|
2
|
-
import { e as V } from "./shared-BmntPmnW.js";
|
|
3
|
-
import { j as F, h as ne } from "./index-BcqwpPNE.js";
|
|
4
|
-
const D = "[data-formie-conditions]";
|
|
5
|
-
function ie(e) {
|
|
6
|
-
if (!e || typeof e != "object")
|
|
7
|
-
return null;
|
|
8
|
-
const t = e, r = t.transformerParams;
|
|
9
|
-
return {
|
|
10
|
-
raw: typeof t.raw == "string" ? t.raw : "",
|
|
11
|
-
target: typeof t.target == "string" ? t.target : "",
|
|
12
|
-
handle: typeof t.handle == "string" ? t.handle : "",
|
|
13
|
-
selector: typeof t.selector == "string" ? t.selector : "",
|
|
14
|
-
defaultValue: typeof t.defaultValue == "string" ? t.defaultValue : "",
|
|
15
|
-
transformerId: typeof t.transformerId == "string" ? t.transformerId : "",
|
|
16
|
-
transformerParams: r && typeof r == "object" ? Object.fromEntries(Object.entries(r).map(([n, i]) => [n, String(i ?? "")])) : {},
|
|
17
|
-
isValid: t.isValid !== !1
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function $(e) {
|
|
21
|
-
const t = Array.from(e.querySelectorAll(D));
|
|
22
|
-
return e.matches(D) ? [e, ...t] : t;
|
|
23
|
-
}
|
|
24
|
-
function se(e) {
|
|
25
|
-
const t = e.getAttribute("data-formie-conditions");
|
|
26
|
-
if (!t)
|
|
27
|
-
return null;
|
|
28
|
-
try {
|
|
29
|
-
const r = JSON.parse(t), n = Array.isArray(r.conditions) ? r.conditions.filter((i) => {
|
|
30
|
-
if (!i || typeof i != "object")
|
|
31
|
-
return !1;
|
|
32
|
-
const s = i;
|
|
33
|
-
return typeof s.field == "string" && typeof s.condition == "string";
|
|
34
|
-
}).map((i) => {
|
|
35
|
-
const s = i;
|
|
36
|
-
return {
|
|
37
|
-
field: i.field,
|
|
38
|
-
source: ie(s.source),
|
|
39
|
-
condition: i.condition,
|
|
40
|
-
value: i.value
|
|
41
|
-
};
|
|
42
|
-
}) : [];
|
|
43
|
-
return {
|
|
44
|
-
showRule: r.showRule === "hide" ? "hide" : "show",
|
|
45
|
-
conditionRule: r.conditionRule === "any" ? "any" : "all",
|
|
46
|
-
clearOnHide: r.clearOnHide !== !1,
|
|
47
|
-
isNested: !!r.isNested,
|
|
48
|
-
conditions: n
|
|
49
|
-
};
|
|
50
|
-
} catch (r) {
|
|
51
|
-
return console.error("[formie] Invalid condition JSON.", r), null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const M = "data-formie-conditions-disabled", v = "data-formie-preserve-disabled", T = "data-formie-conditionally-hidden", C = "data-formie-page-hidden", O = "formie-conditionally-hidden", L = "fui-cp-muted-conditional-field", x = "fui-cp-muted-conditional-field--expanded", I = "data-formie-cp-muted", w = "formie-page-hidden", E = "data-formie-row-hidden", R = "formie-row-hidden", H = "data-formie-field-count", U = "[data-formie-row], [data-formie-subfield-row], [data-formie-nested-field-row]", oe = ":scope > [data-formie-field]";
|
|
55
|
-
function ae(e) {
|
|
56
|
-
e.querySelectorAll("input, select, textarea").forEach((t) => {
|
|
57
|
-
!(t instanceof HTMLInputElement) && !(t instanceof HTMLSelectElement) && !(t instanceof HTMLTextAreaElement) || (t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio" ? t.checked = !1 : t.type !== "hidden" && (t.value = "")), t instanceof HTMLSelectElement && (t.multiple ? Array.from(t.options).forEach((r) => {
|
|
58
|
-
r.selected = !1;
|
|
59
|
-
}) : t.selectedIndex = 0), t instanceof HTMLTextAreaElement && (t.value = ""));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function ue(e, t) {
|
|
63
|
-
const r = e.hasAttribute("data-formie-page"), n = r ? C : T, i = r ? w : O, s = e.hasAttribute(n);
|
|
64
|
-
return t ? (s || e.setAttribute(n, "true"), e.classList.contains(i) || e.classList.add(i)) : (s && e.removeAttribute(n), e.classList.contains(i) && e.classList.remove(i)), s !== t;
|
|
65
|
-
}
|
|
66
|
-
function le(e, t) {
|
|
67
|
-
e.querySelectorAll("input, textarea, select").forEach((r) => {
|
|
68
|
-
if (t) {
|
|
69
|
-
r.hasAttribute(M) || (r.hasAttribute("disabled") && r.setAttribute(v, "true"), r.setAttribute(M, "true")), r.setAttribute("disabled", "true");
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
r.hasAttribute(M) && (r.hasAttribute(v) ? (r.setAttribute("disabled", "true"), r.removeAttribute(v)) : r.removeAttribute("disabled"), r.removeAttribute(M));
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function ce(e) {
|
|
76
|
-
return !e.hasAttribute(T) && !e.hasAttribute(C) && !e.hasAttribute(E) && !e.hasAttribute("hidden");
|
|
77
|
-
}
|
|
78
|
-
function fe(e) {
|
|
79
|
-
const r = Array.from(e.querySelectorAll(oe)).filter((n) => ce(n)).length;
|
|
80
|
-
if (r > 0) {
|
|
81
|
-
const n = String(r);
|
|
82
|
-
e.getAttribute(H) !== n && e.setAttribute(H, n), e.hasAttribute(E) && e.removeAttribute(E), e.classList.contains(R) && e.classList.remove(R);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
e.hasAttribute(H) && e.removeAttribute(H), e.hasAttribute(E) || e.setAttribute(E, "true"), e.classList.contains(R) || e.classList.add(R);
|
|
86
|
-
}
|
|
87
|
-
function K(e) {
|
|
88
|
-
e.removeAttribute(I), e.classList.remove(L), e.classList.remove(x);
|
|
89
|
-
}
|
|
90
|
-
function B(e) {
|
|
91
|
-
e.removeAttribute(T), e.removeAttribute(C), e.classList.remove(O), e.classList.remove(w);
|
|
92
|
-
}
|
|
93
|
-
function Q(e) {
|
|
94
|
-
let t = e.closest(U);
|
|
95
|
-
for (; t; )
|
|
96
|
-
fe(t), t = t.parentElement?.closest(U) || null;
|
|
97
|
-
}
|
|
98
|
-
function de(e, t, r, n = {}) {
|
|
99
|
-
if (n.displayMode === "muted")
|
|
100
|
-
return me(e, t);
|
|
101
|
-
let i = !1;
|
|
102
|
-
return (e.hasAttribute(I) || e.classList.contains(L) || e.classList.contains(x)) && (K(e), i = !0), i = ue(e, t) || i, le(e, t), Q(e), t && r && i && ae(e), i;
|
|
103
|
-
}
|
|
104
|
-
function me(e, t) {
|
|
105
|
-
let r = !1;
|
|
106
|
-
return t ? ((e.hasAttribute(T) || e.hasAttribute(C) || e.classList.contains(O) || e.classList.contains(w)) && (B(e), r = !0), e.hasAttribute(I) || (e.setAttribute(I, "true"), r = !0), e.classList.contains(L) || (e.classList.add(L), r = !0)) : ((e.hasAttribute(I) || e.classList.contains(L) || e.classList.contains(x)) && (K(e), r = !0), (e.hasAttribute(T) || e.hasAttribute(C) || e.classList.contains(O) || e.classList.contains(w)) && (B(e), r = !0)), Q(e), r;
|
|
107
|
-
}
|
|
108
|
-
const X = "input, select, textarea", he = "[data-formie-repeater-item], [data-formie-table-row]";
|
|
109
|
-
function A(e) {
|
|
110
|
-
return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
|
|
111
|
-
}
|
|
112
|
-
function pe(e) {
|
|
113
|
-
const t = e.querySelector(X);
|
|
114
|
-
if (!t)
|
|
115
|
-
return null;
|
|
116
|
-
const r = t.getAttribute("name") || "", n = Array.from(r.matchAll(/\[(\d+)\]/g));
|
|
117
|
-
return n.length && n[n.length - 1]?.[1] || null;
|
|
118
|
-
}
|
|
119
|
-
function Y(e) {
|
|
120
|
-
return e.closest(he);
|
|
121
|
-
}
|
|
122
|
-
function ge(e) {
|
|
123
|
-
return Array.from(e.querySelectorAll(X)).filter((t) => A(t));
|
|
124
|
-
}
|
|
125
|
-
function Ae(e) {
|
|
126
|
-
const t = e.getAttribute("name") || "";
|
|
127
|
-
return Array.from(t.matchAll(/\[([^\]]+)\]/g)).map((r) => r[1] || "").filter(Boolean);
|
|
128
|
-
}
|
|
129
|
-
function be(e, t) {
|
|
130
|
-
if (!t)
|
|
131
|
-
return !0;
|
|
132
|
-
const r = t.split(/[.:]/).filter(Boolean);
|
|
133
|
-
if (!r.length)
|
|
134
|
-
return !0;
|
|
135
|
-
const n = Ae(e);
|
|
136
|
-
return n.length < r.length ? !1 : r.every((i, s) => n[n.length - r.length + s] === i);
|
|
137
|
-
}
|
|
138
|
-
function ye(e, t) {
|
|
139
|
-
if (!t)
|
|
140
|
-
return e;
|
|
141
|
-
const r = e.filter((n) => be(n, t));
|
|
142
|
-
return r.length ? r : e;
|
|
143
|
-
}
|
|
144
|
-
function j(e, t) {
|
|
145
|
-
const r = Y(e);
|
|
146
|
-
if (!r)
|
|
147
|
-
return t;
|
|
148
|
-
const n = t.filter((i) => Y(i) === r);
|
|
149
|
-
return n.length ? n : t;
|
|
150
|
-
}
|
|
151
|
-
function Z(e) {
|
|
152
|
-
return e.source?.target === "field" && e.source.handle ? e.source : null;
|
|
153
|
-
}
|
|
154
|
-
function W(e, t, r) {
|
|
155
|
-
const n = Z(r);
|
|
156
|
-
if (!n || n.target !== "field" || !n.handle)
|
|
157
|
-
return [];
|
|
158
|
-
const i = V(n.handle), s = Array.from(e.querySelectorAll(`[data-formie-field-handle="${i}"]`));
|
|
159
|
-
if (s.length)
|
|
160
|
-
return j(t, s).flatMap((f) => ye(ge(f), n.selector));
|
|
161
|
-
const l = F(n.handle), c = V(l), h = Array.from(e.querySelectorAll(`[name="${c}"]`)).filter((f) => A(f)), d = Array.from(e.querySelectorAll(`[name="${c}[]"]`)).filter((f) => A(f));
|
|
162
|
-
if (h.length || d.length)
|
|
163
|
-
return j(t, [...h, ...d]);
|
|
164
|
-
if (!n.handle.includes("__ROW__"))
|
|
165
|
-
return [];
|
|
166
|
-
const _ = pe(t);
|
|
167
|
-
if (_) {
|
|
168
|
-
const f = F(n.handle.replace(/__ROW__/g, _)), b = V(f), N = Array.from(e.querySelectorAll(`[name="${b}"]`)).filter((o) => A(o)), y = Array.from(e.querySelectorAll(`[name="${b}[]"]`)).filter((o) => A(o));
|
|
169
|
-
if (N.length || y.length)
|
|
170
|
-
return [...N, ...y];
|
|
171
|
-
}
|
|
172
|
-
const P = F(n.handle).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/__ROW__/g, "\\d+"), p = new RegExp(P);
|
|
173
|
-
return Array.from(e.querySelectorAll("[name]")).filter((f) => A(f) && p.test(f.getAttribute("name") || ""));
|
|
174
|
-
}
|
|
175
|
-
function Se(e) {
|
|
176
|
-
return e == null ? "" : String(e);
|
|
177
|
-
}
|
|
178
|
-
function Ee(e) {
|
|
179
|
-
if (typeof e == "boolean")
|
|
180
|
-
return e;
|
|
181
|
-
if (typeof e == "number")
|
|
182
|
-
return e !== 0;
|
|
183
|
-
const t = Se(e).trim().toLowerCase();
|
|
184
|
-
return !(!t || ["0", "false", "no", "off"].includes(t));
|
|
185
|
-
}
|
|
186
|
-
function Le(e) {
|
|
187
|
-
return e.toLowerCase().replace(/\b\w/g, (t) => t.toUpperCase());
|
|
188
|
-
}
|
|
189
|
-
function Ie(e, t) {
|
|
190
|
-
const r = Number.isFinite(Number(t.decimals)) ? Number(t.decimals) : 0, n = t.decimalPoint ?? ".", i = t.thousandsSeparator ?? ",", s = e.toFixed(r), [l, c = ""] = s.split("."), h = l.replace(/\B(?=(\d{3})+(?!\d))/g, i);
|
|
191
|
-
return r === 0 ? h : `${h}${n}${c}`;
|
|
192
|
-
}
|
|
193
|
-
function S(e) {
|
|
194
|
-
return String(e).padStart(2, "0");
|
|
195
|
-
}
|
|
196
|
-
function Te(e, t) {
|
|
197
|
-
return [
|
|
198
|
-
["Y", String(e.getFullYear())],
|
|
199
|
-
["m", S(e.getMonth() + 1)],
|
|
200
|
-
["d", S(e.getDate())],
|
|
201
|
-
["j", String(e.getDate())],
|
|
202
|
-
["H", S(e.getHours())],
|
|
203
|
-
["h", S((e.getHours() + 11) % 12 + 1)],
|
|
204
|
-
["i", S(e.getMinutes())],
|
|
205
|
-
["A", e.getHours() >= 12 ? "PM" : "AM"],
|
|
206
|
-
["F", e.toLocaleString(void 0, { month: "long" })]
|
|
207
|
-
].reduce((n, [i, s]) => n.replaceAll(i, s), t);
|
|
208
|
-
}
|
|
209
|
-
function Ce(e) {
|
|
210
|
-
switch (e) {
|
|
211
|
-
case "datetimeUs12":
|
|
212
|
-
return "m/d/Y h:i A";
|
|
213
|
-
case "datetimeEu12":
|
|
214
|
-
return "d/m/Y h:i A";
|
|
215
|
-
case "datetimeEu24":
|
|
216
|
-
return "d/m/Y H:i";
|
|
217
|
-
case "datetimeIso24":
|
|
218
|
-
return "Y-m-d H:i";
|
|
219
|
-
case "dateUs":
|
|
220
|
-
return "m/d/Y";
|
|
221
|
-
case "dateEu":
|
|
222
|
-
return "d/m/Y";
|
|
223
|
-
case "isoDate":
|
|
224
|
-
return "Y-m-d";
|
|
225
|
-
case "dateLong":
|
|
226
|
-
return "F j, Y";
|
|
227
|
-
case "time12":
|
|
228
|
-
return "h:i A";
|
|
229
|
-
case "time24":
|
|
230
|
-
return "H:i";
|
|
231
|
-
default:
|
|
232
|
-
return "";
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function _e(e, t) {
|
|
236
|
-
const r = t.transformerId, n = t.transformerParams;
|
|
237
|
-
switch (r) {
|
|
238
|
-
case "round":
|
|
239
|
-
case "floor":
|
|
240
|
-
case "ceil": {
|
|
241
|
-
const i = Number(e);
|
|
242
|
-
return Number.isFinite(i) ? String(r === "round" ? Math.round(i) : r === "floor" ? Math.floor(i) : Math.ceil(i)) : e;
|
|
243
|
-
}
|
|
244
|
-
case "format": {
|
|
245
|
-
const i = Number(e);
|
|
246
|
-
if (Number.isFinite(i) && e.trim() !== "")
|
|
247
|
-
return Ie(i, n);
|
|
248
|
-
const s = n.preset || "", l = s === "custom" ? n.pattern || "" : Ce(s);
|
|
249
|
-
if (!l)
|
|
250
|
-
return e;
|
|
251
|
-
const c = new Date(e);
|
|
252
|
-
return Number.isNaN(c.getTime()) ? e : Te(c, l);
|
|
253
|
-
}
|
|
254
|
-
case "lower":
|
|
255
|
-
return e.toLowerCase();
|
|
256
|
-
case "upper":
|
|
257
|
-
return e.toUpperCase();
|
|
258
|
-
case "title":
|
|
259
|
-
return Le(e);
|
|
260
|
-
case "capitalize":
|
|
261
|
-
return e && e.charAt(0).toUpperCase() + e.slice(1);
|
|
262
|
-
case "replace": {
|
|
263
|
-
const i = n.search || "";
|
|
264
|
-
return i ? e.split(i).join(n.replace || "") : e;
|
|
265
|
-
}
|
|
266
|
-
case "truncate": {
|
|
267
|
-
const i = Math.max(1, Number.parseInt(n.length || "50", 10) || 50), s = n.suffix || "...";
|
|
268
|
-
return e.length <= i ? e : `${e.slice(0, Math.max(0, i - s.length))}${s}`;
|
|
269
|
-
}
|
|
270
|
-
case "map":
|
|
271
|
-
return Ee(e) ? n.trueLabel || "Yes" : n.falseLabel || "No";
|
|
272
|
-
default:
|
|
273
|
-
return e;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function Ne(e, t) {
|
|
277
|
-
if (!t)
|
|
278
|
-
return e;
|
|
279
|
-
const r = t.transformerId ? e.map((n) => _e(n, t)) : e;
|
|
280
|
-
return (r.length === 0 || r.every((n) => n.trim() === "")) && t.defaultValue ? [t.defaultValue] : r;
|
|
281
|
-
}
|
|
282
|
-
function Me(e, t) {
|
|
283
|
-
return e.name || `__condition_input_${t}`;
|
|
284
|
-
}
|
|
285
|
-
function G(e) {
|
|
286
|
-
const t = e.id ? e.ownerDocument.querySelector(`label[for="${e.id}"]`)?.textContent?.trim() : "";
|
|
287
|
-
return t || e.closest("label")?.textContent?.trim() || "";
|
|
288
|
-
}
|
|
289
|
-
function Re(e, t = "") {
|
|
290
|
-
const r = e[0];
|
|
291
|
-
if (!r)
|
|
292
|
-
return [];
|
|
293
|
-
if (r instanceof HTMLInputElement) {
|
|
294
|
-
if (r.type === "checkbox") {
|
|
295
|
-
const n = e.filter((i) => i instanceof HTMLInputElement && i.checked);
|
|
296
|
-
return t === "label" ? n.map((i) => G(i)).filter(Boolean) : n.map((i) => i.value);
|
|
297
|
-
}
|
|
298
|
-
if (r.type === "radio") {
|
|
299
|
-
const n = e.filter((i) => i instanceof HTMLInputElement && i.checked);
|
|
300
|
-
return t === "label" ? n.map((i) => G(i)).filter(Boolean) : n.map((i) => i.value);
|
|
301
|
-
}
|
|
302
|
-
if (r.type === "file")
|
|
303
|
-
return Array.from(r.files || []).map((n) => n.name);
|
|
304
|
-
}
|
|
305
|
-
return r instanceof HTMLSelectElement && r.multiple ? t === "label" ? Array.from(r.selectedOptions).map((n) => n.label || n.text) : Array.from(r.selectedOptions).map((n) => n.value) : r instanceof HTMLSelectElement && t === "label" ? Array.from(r.selectedOptions).map((n) => n.label || n.text) : e.map((n) => n.value);
|
|
306
|
-
}
|
|
307
|
-
function z(e) {
|
|
308
|
-
return ["input", "change"];
|
|
309
|
-
}
|
|
310
|
-
function He(e, t = null) {
|
|
311
|
-
const r = /* @__PURE__ */ new Map();
|
|
312
|
-
e.forEach((i, s) => {
|
|
313
|
-
const l = Me(i, s), c = r.get(l) || [];
|
|
314
|
-
c.push(i), r.set(l, c);
|
|
315
|
-
});
|
|
316
|
-
const n = Array.from(r.values()).flatMap((i) => Re(i, t?.selector || ""));
|
|
317
|
-
return Ne(n, t);
|
|
318
|
-
}
|
|
319
|
-
function De(e) {
|
|
320
|
-
return e.closest("[data-formie-conditionally-hidden]") || e.closest("[data-formie-page-hidden]") || e.closest("[hidden]") || e.closest('[aria-hidden="true"]') ? !1 : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
|
|
321
|
-
}
|
|
322
|
-
function Oe(e) {
|
|
323
|
-
return e.length ? e.some((t) => De(t)) : null;
|
|
324
|
-
}
|
|
325
|
-
function we(e, t) {
|
|
326
|
-
const r = e.conditions.map((n) => {
|
|
327
|
-
const i = t(n), s = Z(n);
|
|
328
|
-
return te(n, He(i, s), {
|
|
329
|
-
visibility: Oe(i)
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
return re(e, r);
|
|
333
|
-
}
|
|
334
|
-
const q = 4, g = ne("conditions");
|
|
335
|
-
function J(e) {
|
|
336
|
-
const t = /* @__PURE__ */ new Set();
|
|
337
|
-
return e.filter((r) => t.has(r) ? !1 : (t.add(r), !0));
|
|
338
|
-
}
|
|
339
|
-
const ve = {
|
|
340
|
-
id: "conditions",
|
|
341
|
-
kind: "field",
|
|
342
|
-
match: (e) => e.target instanceof HTMLElement && (e.target.matches(D) || !!e.target.querySelector(D)),
|
|
343
|
-
setup: async (e) => {
|
|
344
|
-
const t = e.target instanceof HTMLElement ? e.target : e.root;
|
|
345
|
-
if (!$(t).length) {
|
|
346
|
-
g.log("No condition nodes in scope.");
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
const r = [];
|
|
350
|
-
let n = [], i = !1, s = !1;
|
|
351
|
-
const l = () => {
|
|
352
|
-
r.forEach((o) => {
|
|
353
|
-
o();
|
|
354
|
-
}), r.length = 0;
|
|
355
|
-
}, c = () => $(t).flatMap((o) => {
|
|
356
|
-
const a = se(o);
|
|
357
|
-
if (!a || !a.conditions.length)
|
|
358
|
-
return [];
|
|
359
|
-
const u = J(a.conditions.flatMap((m) => W(t, o, m)));
|
|
360
|
-
return [{
|
|
361
|
-
node: o,
|
|
362
|
-
settings: a,
|
|
363
|
-
sourceInputs: u
|
|
364
|
-
}];
|
|
365
|
-
}), h = e.options?.cpDisplayMode === "muted" ? "muted" : "hide";
|
|
366
|
-
let d = !1;
|
|
367
|
-
const _ = () => {
|
|
368
|
-
let o = !1;
|
|
369
|
-
return n.forEach((a) => {
|
|
370
|
-
const u = we(a.settings, (ee) => W(t, a.node, ee)), m = a.node.hasAttribute("data-formie-page") ? "hide" : h, k = de(
|
|
371
|
-
a.node,
|
|
372
|
-
u.shouldHide,
|
|
373
|
-
a.settings.clearOnHide,
|
|
374
|
-
{ displayMode: m }
|
|
375
|
-
);
|
|
376
|
-
o = o || k, g.log("Condition evaluated.", {
|
|
377
|
-
shouldHide: u.shouldHide,
|
|
378
|
-
finalResult: u.finalResult,
|
|
379
|
-
stateChanged: k
|
|
380
|
-
}), e.emit("formie:conditions:evaluated", {
|
|
381
|
-
node: a.node,
|
|
382
|
-
shouldHide: u.shouldHide,
|
|
383
|
-
finalResult: u.finalResult,
|
|
384
|
-
clearOnHide: a.settings.clearOnHide
|
|
385
|
-
});
|
|
386
|
-
}), o;
|
|
387
|
-
}, P = () => {
|
|
388
|
-
if (!d) {
|
|
389
|
-
d = !0;
|
|
390
|
-
try {
|
|
391
|
-
for (let o = 0; o < q && _(); o += 1)
|
|
392
|
-
o === q - 1 && g.warn("Reached max evaluation passes.", { maxPasses: q });
|
|
393
|
-
} finally {
|
|
394
|
-
d = !1;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}, p = () => {
|
|
398
|
-
d || i || (i = !0, requestAnimationFrame(() => {
|
|
399
|
-
i = !1, !d && P();
|
|
400
|
-
}));
|
|
401
|
-
}, f = () => {
|
|
402
|
-
if (J(n.flatMap((o) => o.sourceInputs)).forEach((o) => {
|
|
403
|
-
const a = () => {
|
|
404
|
-
p();
|
|
405
|
-
};
|
|
406
|
-
z().forEach((u) => {
|
|
407
|
-
o.addEventListener(u, a);
|
|
408
|
-
}), r.push(() => {
|
|
409
|
-
z().forEach((u) => {
|
|
410
|
-
o.removeEventListener(u, a);
|
|
411
|
-
});
|
|
412
|
-
});
|
|
413
|
-
}), e.form) {
|
|
414
|
-
const o = () => {
|
|
415
|
-
window.setTimeout(() => {
|
|
416
|
-
p();
|
|
417
|
-
}, 0);
|
|
418
|
-
};
|
|
419
|
-
e.form.addEventListener("reset", o), r.push(() => {
|
|
420
|
-
e.form?.removeEventListener("reset", o);
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
}, b = () => {
|
|
424
|
-
l(), n = c(), f(), g.log("Rebuilt condition graph.", {
|
|
425
|
-
entryCount: n.length
|
|
426
|
-
}), p();
|
|
427
|
-
}, N = () => {
|
|
428
|
-
d || s || (s = !0, requestAnimationFrame(() => {
|
|
429
|
-
s = !1, !d && b();
|
|
430
|
-
}));
|
|
431
|
-
}, y = new MutationObserver((o) => {
|
|
432
|
-
if (d)
|
|
433
|
-
return;
|
|
434
|
-
const a = o.some((m) => m.type === "childList" && (m.addedNodes.length > 0 || m.removedNodes.length > 0)), u = o.some((m) => m.type === "attributes");
|
|
435
|
-
a ? N() : u && p();
|
|
436
|
-
});
|
|
437
|
-
return y.observe(t, {
|
|
438
|
-
childList: !0,
|
|
439
|
-
subtree: !0,
|
|
440
|
-
attributes: !0,
|
|
441
|
-
attributeFilter: [
|
|
442
|
-
"hidden",
|
|
443
|
-
"aria-hidden",
|
|
444
|
-
"data-formie-conditionally-hidden",
|
|
445
|
-
"data-formie-page-hidden",
|
|
446
|
-
"data-formie-row-hidden"
|
|
447
|
-
]
|
|
448
|
-
}), b(), await e.emit("formie:module:conditions:init", {
|
|
449
|
-
count: n.length
|
|
450
|
-
}), g.log("Module setup complete.", { entryCount: n.length }), {
|
|
451
|
-
destroy: () => {
|
|
452
|
-
l(), y.disconnect(), g.log("Module destroy."), e.emit("formie:module:conditions:destroy", {});
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
export {
|
|
458
|
-
ve as conditionsModule
|
|
459
|
-
};
|