reactaform 1.9.1 → 1.9.2
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/reactaform.es.js
CHANGED
|
@@ -446,30 +446,30 @@ class ne {
|
|
|
446
446
|
return n !== void 0 ? n : t;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const
|
|
449
|
+
const or = typeof process < "u" && process.env.NODE_ENV === "test";
|
|
450
450
|
function lt(e, r = 300, t) {
|
|
451
|
-
const n = pe(),
|
|
451
|
+
const n = pe(), o = pe(e), a = pe(null), c = t?.leading === !0, s = t?.trailing !== !1;
|
|
452
452
|
Ue(() => {
|
|
453
|
-
|
|
453
|
+
o.current = e;
|
|
454
454
|
}, [e]), Ue(() => () => {
|
|
455
455
|
n.current && clearTimeout(n.current);
|
|
456
456
|
}, []);
|
|
457
457
|
const i = (f) => {
|
|
458
|
-
|
|
458
|
+
o.current(...f);
|
|
459
459
|
}, d = ge(() => {
|
|
460
|
-
n.current && (clearTimeout(n.current), n.current = void 0),
|
|
460
|
+
n.current && (clearTimeout(n.current), n.current = void 0), a.current = null;
|
|
461
461
|
}, []), m = ge(() => {
|
|
462
|
-
n.current && (clearTimeout(n.current), n.current = void 0), s &&
|
|
462
|
+
n.current && (clearTimeout(n.current), n.current = void 0), s && a.current && (i(a.current), a.current = null);
|
|
463
463
|
}, [s]);
|
|
464
464
|
return { callback: ge(
|
|
465
465
|
(...f) => {
|
|
466
|
-
if (
|
|
466
|
+
if (or) {
|
|
467
467
|
i(f);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
470
|
const b = c && !n.current;
|
|
471
|
-
|
|
472
|
-
n.current = void 0, s &&
|
|
471
|
+
a.current = f, b && i(f), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
472
|
+
n.current = void 0, s && a.current && (i(a.current), a.current = null);
|
|
473
473
|
}, r);
|
|
474
474
|
},
|
|
475
475
|
[c, s, r]
|
|
@@ -488,8 +488,8 @@ const V = {
|
|
|
488
488
|
}, U = (...e) => {
|
|
489
489
|
const r = [];
|
|
490
490
|
for (const t of e)
|
|
491
|
-
t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n,
|
|
492
|
-
|
|
491
|
+
t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n, o]) => {
|
|
492
|
+
o && r.push(n);
|
|
493
493
|
}));
|
|
494
494
|
return r.join(" ");
|
|
495
495
|
};
|
|
@@ -499,16 +499,16 @@ function ie(e) {
|
|
|
499
499
|
function ut(e) {
|
|
500
500
|
if (!e) return !1;
|
|
501
501
|
const r = e.trim();
|
|
502
|
-
let t = 0, n = 0,
|
|
502
|
+
let t = 0, n = 0, o = 0;
|
|
503
503
|
if (r.startsWith("#")) {
|
|
504
504
|
const c = r.substring(1);
|
|
505
|
-
c.length === 3 || c.length === 4 ? (t = parseInt(c[0] + c[0], 16), n = parseInt(c[1] + c[1], 16),
|
|
505
|
+
c.length === 3 || c.length === 4 ? (t = parseInt(c[0] + c[0], 16), n = parseInt(c[1] + c[1], 16), o = parseInt(c[2] + c[2], 16)) : (c.length === 6 || c.length === 8) && (t = parseInt(c.substring(0, 2), 16), n = parseInt(c.substring(2, 4), 16), o = parseInt(c.substring(4, 6), 16));
|
|
506
506
|
} else if (r.startsWith("rgb")) {
|
|
507
507
|
const c = r.match(/\d+(\.\d+)?/g);
|
|
508
|
-
c && c.length >= 3 && (t = Math.min(255, Math.max(0, parseFloat(c[0]))), n = Math.min(255, Math.max(0, parseFloat(c[1]))),
|
|
508
|
+
c && c.length >= 3 && (t = Math.min(255, Math.max(0, parseFloat(c[0]))), n = Math.min(255, Math.max(0, parseFloat(c[1]))), o = Math.min(255, Math.max(0, parseFloat(c[2]))));
|
|
509
509
|
} else
|
|
510
510
|
return !1;
|
|
511
|
-
return (t * 299 + n * 587 +
|
|
511
|
+
return (t * 299 + n * 587 + o * 114) / 1e3 < 128;
|
|
512
512
|
}
|
|
513
513
|
const mt = () => /* @__PURE__ */ D(
|
|
514
514
|
"svg",
|
|
@@ -527,7 +527,7 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
527
527
|
]
|
|
528
528
|
}
|
|
529
529
|
), dt = ({ content: e, size: r = "medium", animation: t = !0 }) => {
|
|
530
|
-
const { t: n, theme:
|
|
530
|
+
const { t: n, theme: o, formStyle: a, fieldStyle: c } = B(), [s, i] = l.useState(!1), [d, m] = l.useState({ x: 0, y: 0 }), [u, f] = l.useState(!1), b = l.useRef(null), C = l.useRef(null), N = l.useRef(null), h = l.useId(), y = ie(o), [E, F] = l.useState(void 0);
|
|
531
531
|
l.useLayoutEffect(() => {
|
|
532
532
|
if (!b.current) return;
|
|
533
533
|
const I = "rgba(255,255,255,0.1)", g = getComputedStyle(b.current).getPropertyValue("--reactaform-primary-bg").trim();
|
|
@@ -587,11 +587,11 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
587
587
|
return (S && j ? j[S] : void 0) ?? {};
|
|
588
588
|
};
|
|
589
589
|
return {
|
|
590
|
-
icon: { ...v.icon, ...g(
|
|
591
|
-
text: { ...v.text, ...g(
|
|
590
|
+
icon: { ...v.icon, ...g(a, "tooltip", "icon"), ...g(c, "tooltip", "icon") },
|
|
591
|
+
text: { ...v.text, ...g(a, "tooltip", "text"), ...g(c, "tooltip", "text") },
|
|
592
592
|
textVisible: v.textVisible
|
|
593
593
|
};
|
|
594
|
-
}, [y, r, t,
|
|
594
|
+
}, [y, r, t, a, c, E]);
|
|
595
595
|
l.useLayoutEffect(() => {
|
|
596
596
|
if (!s || !b.current || !C.current) {
|
|
597
597
|
f(!1);
|
|
@@ -649,26 +649,26 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
649
649
|
),
|
|
650
650
|
s && ($ ? de.createPortal(R, $) : R)
|
|
651
651
|
] });
|
|
652
|
-
},
|
|
652
|
+
}, ar = l.memo(dt), ve = l.memo(({
|
|
653
653
|
field: e,
|
|
654
654
|
error: r,
|
|
655
655
|
children: t,
|
|
656
656
|
showLabel: n = !0
|
|
657
657
|
}) => {
|
|
658
|
-
const { t:
|
|
658
|
+
const { t: o } = B(), a = e.labelLayout === "column-center" ? "center" : "left", c = l.useMemo(() => {
|
|
659
659
|
const d = {
|
|
660
660
|
display: "flex",
|
|
661
661
|
flexDirection: "column",
|
|
662
662
|
gap: "var(--reactaform-label-gap, 4px)"
|
|
663
663
|
};
|
|
664
|
-
return d["--label-align"] =
|
|
665
|
-
}, [
|
|
666
|
-
textAlign:
|
|
664
|
+
return d["--label-align"] = a, d;
|
|
665
|
+
}, [a]), s = l.useMemo(() => ({
|
|
666
|
+
textAlign: a,
|
|
667
667
|
width: "100%",
|
|
668
668
|
minWidth: "unset",
|
|
669
669
|
display: "block",
|
|
670
670
|
marginBottom: "10px"
|
|
671
|
-
}), [
|
|
671
|
+
}), [a]), i = l.useMemo(() => ({
|
|
672
672
|
display: "flex",
|
|
673
673
|
alignItems: "center",
|
|
674
674
|
gap: "var(--reactaform-inline-gap, 8px)",
|
|
@@ -682,12 +682,12 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
682
682
|
className: V.label,
|
|
683
683
|
htmlFor: e.name,
|
|
684
684
|
style: s,
|
|
685
|
-
children:
|
|
685
|
+
children: o(e.displayName)
|
|
686
686
|
}
|
|
687
687
|
),
|
|
688
688
|
/* @__PURE__ */ D("div", { style: i, children: [
|
|
689
689
|
/* @__PURE__ */ p("div", { style: { flex: 1, minWidth: 0 }, children: t }),
|
|
690
|
-
e.tooltip && /* @__PURE__ */ p(
|
|
690
|
+
e.tooltip && /* @__PURE__ */ p(ar, { content: e.tooltip })
|
|
691
691
|
] }),
|
|
692
692
|
r && /* @__PURE__ */ p(Me, { id: `${e.name}-error`, children: r })
|
|
693
693
|
] });
|
|
@@ -699,7 +699,7 @@ const ir = l.memo(({
|
|
|
699
699
|
children: t,
|
|
700
700
|
rightAlign: n = !1
|
|
701
701
|
}) => {
|
|
702
|
-
const { t:
|
|
702
|
+
const { t: o } = B(), a = l.useMemo(() => ({
|
|
703
703
|
display: "flex",
|
|
704
704
|
alignItems: "center",
|
|
705
705
|
gap: "3px"
|
|
@@ -712,13 +712,13 @@ const ir = l.memo(({
|
|
|
712
712
|
className: V.label,
|
|
713
713
|
htmlFor: e.name,
|
|
714
714
|
style: { textAlign: "left" },
|
|
715
|
-
children:
|
|
715
|
+
children: o(e.displayName)
|
|
716
716
|
}
|
|
717
717
|
),
|
|
718
718
|
/* @__PURE__ */ D("div", { children: [
|
|
719
|
-
/* @__PURE__ */ D("div", { style:
|
|
719
|
+
/* @__PURE__ */ D("div", { style: a, children: [
|
|
720
720
|
n ? /* @__PURE__ */ p("div", { style: { display: "flex", flex: 1, justifyContent: "flex-end" }, children: t }) : t,
|
|
721
|
-
e.tooltip && /* @__PURE__ */ p(
|
|
721
|
+
e.tooltip && /* @__PURE__ */ p(ar, { content: e.tooltip })
|
|
722
722
|
] }),
|
|
723
723
|
r && /* @__PURE__ */ p(Me, { id: `${e.name}-error`, children: r })
|
|
724
724
|
] })
|
|
@@ -783,8 +783,8 @@ sr.displayName = "InstanceName";
|
|
|
783
783
|
class ft extends ne {
|
|
784
784
|
registerInCategory(r, t, n) {
|
|
785
785
|
this.get(r) || this.register(r, {});
|
|
786
|
-
const
|
|
787
|
-
|
|
786
|
+
const o = this.get(r);
|
|
787
|
+
o[t] = n;
|
|
788
788
|
}
|
|
789
789
|
getFromCategory(r, t) {
|
|
790
790
|
return this.get(r)?.[t];
|
|
@@ -804,7 +804,7 @@ function gt(e, r, t) {
|
|
|
804
804
|
lr.registerInCategory(e, r, t);
|
|
805
805
|
}
|
|
806
806
|
function ht(e, r) {
|
|
807
|
-
if (
|
|
807
|
+
if (on(e)) {
|
|
808
808
|
console.warn(
|
|
809
809
|
`[ReactaForm] Can't override builtin type field validation handler for type "${e}".`
|
|
810
810
|
);
|
|
@@ -831,22 +831,22 @@ const We = /* @__PURE__ */ new Map(), _e = /* @__PURE__ */ new Map();
|
|
|
831
831
|
function fr(e, r, t, n) {
|
|
832
832
|
if (!r || !r.validationHandlerName)
|
|
833
833
|
return null;
|
|
834
|
-
let
|
|
834
|
+
let o, a;
|
|
835
835
|
if (typeof r.validationHandlerName == "string")
|
|
836
|
-
|
|
836
|
+
o = e, a = r.validationHandlerName;
|
|
837
837
|
else if (Array.isArray(r.validationHandlerName)) {
|
|
838
838
|
const [i, d] = r.validationHandlerName;
|
|
839
839
|
if (d)
|
|
840
|
-
|
|
840
|
+
o = i, a = d;
|
|
841
841
|
else if (i)
|
|
842
|
-
|
|
842
|
+
o = e, a = i;
|
|
843
843
|
else
|
|
844
844
|
return null;
|
|
845
845
|
} else
|
|
846
846
|
return null;
|
|
847
|
-
const c = `${
|
|
847
|
+
const c = `${o}:${a}`;
|
|
848
848
|
let s = We.get(c);
|
|
849
|
-
if (s === void 0 && (s = ur(
|
|
849
|
+
if (s === void 0 && (s = ur(o, a) || null, We.set(c, s)), s)
|
|
850
850
|
try {
|
|
851
851
|
return s(r.name, t, n) || null;
|
|
852
852
|
} catch (i) {
|
|
@@ -854,15 +854,15 @@ function fr(e, r, t, n) {
|
|
|
854
854
|
}
|
|
855
855
|
return null;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function uo(e, r, t, n) {
|
|
858
858
|
return fr(e, r, t, n);
|
|
859
859
|
}
|
|
860
860
|
function pr(e, r, t, n) {
|
|
861
|
-
const
|
|
862
|
-
if (
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
865
|
-
return
|
|
861
|
+
const o = dr(r.type);
|
|
862
|
+
if (o) {
|
|
863
|
+
const a = o(r, t, n);
|
|
864
|
+
if (a)
|
|
865
|
+
return a;
|
|
866
866
|
} else if (String(t ?? "").trim() === "")
|
|
867
867
|
return r.required ? n("Value required") : null;
|
|
868
868
|
return fr(e, r, t, n);
|
|
@@ -871,21 +871,21 @@ async function yt(e, r, t) {
|
|
|
871
871
|
if (!e || typeof e.validationHandlerName != "string")
|
|
872
872
|
return null;
|
|
873
873
|
const n = e.validationHandlerName;
|
|
874
|
-
let
|
|
875
|
-
if (
|
|
874
|
+
let o = _e.get(n);
|
|
875
|
+
if (o === void 0 && (o = mr(n) || null, _e.set(n, o)), o)
|
|
876
876
|
try {
|
|
877
|
-
const
|
|
878
|
-
return bt(
|
|
879
|
-
} catch (
|
|
880
|
-
return [String(
|
|
877
|
+
const a = o(r, t);
|
|
878
|
+
return bt(a) ? await a || null : a || null;
|
|
879
|
+
} catch (a) {
|
|
880
|
+
return [String(a instanceof Error ? a.message : a)];
|
|
881
881
|
}
|
|
882
882
|
return null;
|
|
883
883
|
}
|
|
884
884
|
function T(e, r) {
|
|
885
|
-
const { definitionName: t, t: n, fieldValidationMode:
|
|
885
|
+
const { definitionName: t, t: n, fieldValidationMode: o } = B();
|
|
886
886
|
return l.useCallback(
|
|
887
|
-
(
|
|
888
|
-
[t, e, n,
|
|
887
|
+
(a) => o === "onEdit" || o === "realTime" ? pr(t, e, a, n) : r ?? null,
|
|
888
|
+
[t, e, n, o, r]
|
|
889
889
|
);
|
|
890
890
|
}
|
|
891
891
|
const gr = ({
|
|
@@ -893,12 +893,12 @@ const gr = ({
|
|
|
893
893
|
value: r = !1,
|
|
894
894
|
onChange: t,
|
|
895
895
|
onError: n,
|
|
896
|
-
error:
|
|
896
|
+
error: o
|
|
897
897
|
}) => {
|
|
898
|
-
const { t:
|
|
898
|
+
const { t: a } = B(), s = T(e, o)(r);
|
|
899
899
|
l.useEffect(() => {
|
|
900
|
-
|
|
901
|
-
}, [s,
|
|
900
|
+
o || n?.(s);
|
|
901
|
+
}, [s, o, n]);
|
|
902
902
|
const i = l.useCallback(
|
|
903
903
|
(u) => {
|
|
904
904
|
t?.(u.target.checked);
|
|
@@ -926,7 +926,7 @@ const gr = ({
|
|
|
926
926
|
className: V.label,
|
|
927
927
|
htmlFor: m,
|
|
928
928
|
style: { textAlign: "left", justifyContent: "flex-start" },
|
|
929
|
-
children:
|
|
929
|
+
children: a(e.displayName)
|
|
930
930
|
}
|
|
931
931
|
),
|
|
932
932
|
/* @__PURE__ */ p(
|
|
@@ -958,24 +958,24 @@ const gr = ({
|
|
|
958
958
|
gr.displayName = "CheckboxInput";
|
|
959
959
|
const vt = l.memo(gr);
|
|
960
960
|
function _({ value: e, onChange: r, onError: t, validate: n }) {
|
|
961
|
-
const
|
|
961
|
+
const o = l.useRef(null), a = l.useRef(null), c = l.useRef(t), [s, i] = l.useState(null);
|
|
962
962
|
l.useEffect(() => {
|
|
963
963
|
c.current = t;
|
|
964
964
|
}, [t]), l.useEffect(() => {
|
|
965
965
|
const m = String(e ?? "");
|
|
966
|
-
if (!(document.activeElement ===
|
|
966
|
+
if (!(document.activeElement === o.current)) {
|
|
967
967
|
const f = n(m);
|
|
968
|
-
f !==
|
|
968
|
+
f !== a.current && (a.current = f, c.current?.(f ?? null), i(f)), o.current && o.current.value !== m && (o.current.value = m);
|
|
969
969
|
}
|
|
970
970
|
}, [e, n]);
|
|
971
971
|
const d = l.useCallback(
|
|
972
972
|
(m) => {
|
|
973
973
|
const u = m.target.value, f = n(u);
|
|
974
|
-
f !==
|
|
974
|
+
f !== a.current && (a.current = f, i(f), c.current?.(f ?? null)), r?.(u);
|
|
975
975
|
},
|
|
976
976
|
[r, n]
|
|
977
977
|
);
|
|
978
|
-
return { inputRef:
|
|
978
|
+
return { inputRef: o, error: s, handleChange: d };
|
|
979
979
|
}
|
|
980
980
|
const Ke = [
|
|
981
981
|
{ label: "Black", value: "#000000" },
|
|
@@ -1008,9 +1008,9 @@ const Ke = [
|
|
|
1008
1008
|
value: r,
|
|
1009
1009
|
onChange: t,
|
|
1010
1010
|
onError: n,
|
|
1011
|
-
error:
|
|
1011
|
+
error: o
|
|
1012
1012
|
}) => {
|
|
1013
|
-
const { t:
|
|
1013
|
+
const { t: a } = B(), c = T(e, o), s = l.useMemo(
|
|
1014
1014
|
() => he(r),
|
|
1015
1015
|
[r]
|
|
1016
1016
|
), { inputRef: i, error: d, handleChange: m } = _({
|
|
@@ -1067,7 +1067,7 @@ const Ke = [
|
|
|
1067
1067
|
),
|
|
1068
1068
|
"aria-invalid": !!d,
|
|
1069
1069
|
children: [
|
|
1070
|
-
Ke.map((M) => /* @__PURE__ */ p("option", { value: M.value, children:
|
|
1070
|
+
Ke.map((M) => /* @__PURE__ */ p("option", { value: M.value, children: a(M.label) }, M.value)),
|
|
1071
1071
|
!h && /* @__PURE__ */ D("option", { value: u, children: [
|
|
1072
1072
|
"(",
|
|
1073
1073
|
y,
|
|
@@ -1122,8 +1122,8 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1122
1122
|
return Ge(e) ? e : "";
|
|
1123
1123
|
const t = Ge(e);
|
|
1124
1124
|
if (t) {
|
|
1125
|
-
const n = t.getUTCFullYear(),
|
|
1126
|
-
return `${n}-${
|
|
1125
|
+
const n = t.getUTCFullYear(), o = String(t.getUTCMonth() + 1).padStart(2, "0"), a = String(t.getUTCDate()).padStart(2, "0");
|
|
1126
|
+
return `${n}-${o}-${a}`;
|
|
1127
1127
|
}
|
|
1128
1128
|
return "";
|
|
1129
1129
|
}, br = ({
|
|
@@ -1131,13 +1131,13 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1131
1131
|
value: r,
|
|
1132
1132
|
onChange: t,
|
|
1133
1133
|
onError: n,
|
|
1134
|
-
error:
|
|
1134
|
+
error: o
|
|
1135
1135
|
}) => {
|
|
1136
|
-
const
|
|
1136
|
+
const a = T(e, o), c = Je(r), { inputRef: s, error: i, handleChange: d } = _({
|
|
1137
1137
|
value: c,
|
|
1138
1138
|
onChange: t,
|
|
1139
1139
|
onError: n,
|
|
1140
|
-
validate:
|
|
1140
|
+
validate: a
|
|
1141
1141
|
});
|
|
1142
1142
|
return /* @__PURE__ */ p(O, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1143
1143
|
"input",
|
|
@@ -1157,13 +1157,13 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1157
1157
|
};
|
|
1158
1158
|
br.displayName = "DateInput";
|
|
1159
1159
|
const kt = l.memo(br), yr = ({ field: e }) => {
|
|
1160
|
-
const { t: r } = B(), { displayText: t = "", textAlign: n = "left", allowHtml:
|
|
1160
|
+
const { t: r } = B(), { displayText: t = "", textAlign: n = "left", allowHtml: o = !1 } = e;
|
|
1161
1161
|
return /* @__PURE__ */ p(
|
|
1162
1162
|
"div",
|
|
1163
1163
|
{
|
|
1164
1164
|
className: V.description,
|
|
1165
1165
|
style: { textAlign: n },
|
|
1166
|
-
...
|
|
1166
|
+
...o ? { dangerouslySetInnerHTML: { __html: r(t) } } : { children: r(t) }
|
|
1167
1167
|
}
|
|
1168
1168
|
);
|
|
1169
1169
|
};
|
|
@@ -1173,13 +1173,13 @@ const It = l.memo(yr), vr = ({
|
|
|
1173
1173
|
value: r,
|
|
1174
1174
|
onChange: t,
|
|
1175
1175
|
onError: n,
|
|
1176
|
-
error:
|
|
1176
|
+
error: o
|
|
1177
1177
|
}) => {
|
|
1178
|
-
const { t:
|
|
1178
|
+
const { t: a, theme: c, formStyle: s, fieldStyle: i } = B(), d = l.useRef(null), m = l.useRef(n), [u, f] = l.useState(!1), [b, C] = l.useState(null);
|
|
1179
1179
|
l.useEffect(() => {
|
|
1180
1180
|
m.current = n;
|
|
1181
1181
|
}, [n]);
|
|
1182
|
-
const N = T(e,
|
|
1182
|
+
const N = T(e, o), [h, y] = l.useState(null), E = l.useRef(null);
|
|
1183
1183
|
l.useEffect(() => {
|
|
1184
1184
|
const g = String(r ?? "");
|
|
1185
1185
|
let w = N(g);
|
|
@@ -1198,8 +1198,8 @@ const It = l.memo(yr), vr = ({
|
|
|
1198
1198
|
w !== E.current && (E.current = w, y(w), m.current?.(w ?? null)), t?.(g), f(!1);
|
|
1199
1199
|
}, $ = l.useMemo(() => {
|
|
1200
1200
|
const g = e.options.find((w) => String(w.value) === String(r));
|
|
1201
|
-
return g ?
|
|
1202
|
-
}, [e.options, r,
|
|
1201
|
+
return g ? a(g.label) : "";
|
|
1202
|
+
}, [e.options, r, a]), R = (g, w, x) => {
|
|
1203
1203
|
if (!w) return {};
|
|
1204
1204
|
const S = g?.[w];
|
|
1205
1205
|
return (x && S ? S[x] : void 0) ?? {};
|
|
@@ -1258,7 +1258,7 @@ const It = l.memo(yr), vr = ({
|
|
|
1258
1258
|
onClose: () => f(!1),
|
|
1259
1259
|
controlRef: d,
|
|
1260
1260
|
theme: c,
|
|
1261
|
-
t:
|
|
1261
|
+
t: a
|
|
1262
1262
|
}
|
|
1263
1263
|
)
|
|
1264
1264
|
] });
|
|
@@ -1267,15 +1267,15 @@ const It = l.memo(yr), vr = ({
|
|
|
1267
1267
|
options: r,
|
|
1268
1268
|
selectedValue: t,
|
|
1269
1269
|
onSelect: n,
|
|
1270
|
-
onClose:
|
|
1271
|
-
controlRef:
|
|
1270
|
+
onClose: o,
|
|
1271
|
+
controlRef: a,
|
|
1272
1272
|
theme: c,
|
|
1273
1273
|
t: s
|
|
1274
1274
|
}) => {
|
|
1275
1275
|
const i = l.useRef(null), [d, m] = l.useState(-1), { formStyle: u, fieldStyle: f } = B(), b = ie(c ?? "light");
|
|
1276
1276
|
l.useLayoutEffect(() => {
|
|
1277
|
-
if (!
|
|
1278
|
-
const v =
|
|
1277
|
+
if (!a.current) return;
|
|
1278
|
+
const v = a.current.closest("[data-reactaform-theme]"), g = document.getElementById("popup-root");
|
|
1279
1279
|
if (v && g) {
|
|
1280
1280
|
const w = getComputedStyle(v);
|
|
1281
1281
|
g.style.setProperty(
|
|
@@ -1289,7 +1289,7 @@ const It = l.memo(yr), vr = ({
|
|
|
1289
1289
|
w.getPropertyValue("--reactaform-option-menu-hover-bg")
|
|
1290
1290
|
);
|
|
1291
1291
|
}
|
|
1292
|
-
}, [
|
|
1292
|
+
}, [a]);
|
|
1293
1293
|
const C = (v, g, w) => {
|
|
1294
1294
|
if (!g) return {};
|
|
1295
1295
|
const k = v?.[g];
|
|
@@ -1320,10 +1320,10 @@ const It = l.memo(yr), vr = ({
|
|
|
1320
1320
|
l.useEffect(() => {
|
|
1321
1321
|
const v = (g) => {
|
|
1322
1322
|
const w = g.target;
|
|
1323
|
-
!i.current?.contains(w) && !
|
|
1323
|
+
!i.current?.contains(w) && !a.current?.contains(w) && o();
|
|
1324
1324
|
};
|
|
1325
1325
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
1326
|
-
}, [
|
|
1326
|
+
}, [o, a]), l.useEffect(() => {
|
|
1327
1327
|
if (i.current && r.length > 0) {
|
|
1328
1328
|
const v = r.findIndex((g) => String(g.value) === t);
|
|
1329
1329
|
requestAnimationFrame(() => m(v >= 0 ? v : 0));
|
|
@@ -1338,7 +1338,7 @@ const It = l.memo(yr), vr = ({
|
|
|
1338
1338
|
if (typeof window > "u") return;
|
|
1339
1339
|
const v = () => {
|
|
1340
1340
|
let x = e.x, k = e.y, S = y;
|
|
1341
|
-
const A =
|
|
1341
|
+
const A = a?.current;
|
|
1342
1342
|
if (A) {
|
|
1343
1343
|
const j = A.getBoundingClientRect();
|
|
1344
1344
|
x = j.left, k = j.bottom, S = Math.max(80, Math.round(j.width));
|
|
@@ -1347,11 +1347,11 @@ const It = l.memo(yr), vr = ({
|
|
|
1347
1347
|
};
|
|
1348
1348
|
v(), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v);
|
|
1349
1349
|
let g = null;
|
|
1350
|
-
const w =
|
|
1350
|
+
const w = a?.current;
|
|
1351
1351
|
return typeof ResizeObserver < "u" && w && (g = new ResizeObserver(() => v()), g.observe(w)), () => {
|
|
1352
1352
|
window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v), g && w && g.unobserve(w);
|
|
1353
1353
|
};
|
|
1354
|
-
}, [
|
|
1354
|
+
}, [a, e.x, e.y]), typeof window > "u") return null;
|
|
1355
1355
|
let I = document.getElementById("popup-root");
|
|
1356
1356
|
return I || (I = document.createElement("div"), I.id = "popup-root", document.body.appendChild(I)), de.createPortal(
|
|
1357
1357
|
/* @__PURE__ */ p(
|
|
@@ -1401,7 +1401,7 @@ const It = l.memo(yr), vr = ({
|
|
|
1401
1401
|
S.preventDefault(), S.stopPropagation(), n(String(v.value));
|
|
1402
1402
|
break;
|
|
1403
1403
|
case "Escape":
|
|
1404
|
-
S.preventDefault(),
|
|
1404
|
+
S.preventDefault(), o(), a?.current?.focus();
|
|
1405
1405
|
break;
|
|
1406
1406
|
}
|
|
1407
1407
|
},
|
|
@@ -1431,13 +1431,13 @@ const Mt = l.memo(vr), xr = ({
|
|
|
1431
1431
|
value: r,
|
|
1432
1432
|
onChange: t,
|
|
1433
1433
|
onError: n,
|
|
1434
|
-
error:
|
|
1434
|
+
error: o
|
|
1435
1435
|
}) => {
|
|
1436
|
-
const
|
|
1436
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1437
1437
|
value: r,
|
|
1438
1438
|
onChange: t,
|
|
1439
1439
|
onError: n,
|
|
1440
|
-
validate:
|
|
1440
|
+
validate: a
|
|
1441
1441
|
});
|
|
1442
1442
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1443
1443
|
"input",
|
|
@@ -1458,7 +1458,7 @@ const Ft = l.memo(xr), wr = ({ field: e }) => {
|
|
|
1458
1458
|
const { theme: r } = B(), {
|
|
1459
1459
|
color: t = ie(r) ? "#444444" : "#CCCCCC",
|
|
1460
1460
|
thickness: n = 1,
|
|
1461
|
-
margin:
|
|
1461
|
+
margin: o = "8px 0"
|
|
1462
1462
|
} = e;
|
|
1463
1463
|
return /* @__PURE__ */ p(
|
|
1464
1464
|
"div",
|
|
@@ -1468,20 +1468,20 @@ const Ft = l.memo(xr), wr = ({ field: e }) => {
|
|
|
1468
1468
|
height: "0",
|
|
1469
1469
|
// ensures only 1 line
|
|
1470
1470
|
borderTop: `${n}px solid ${t}`,
|
|
1471
|
-
margin:
|
|
1471
|
+
margin: o
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
1474
|
);
|
|
1475
1475
|
};
|
|
1476
1476
|
wr.displayName = "FieldSeparator";
|
|
1477
|
-
const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, error:
|
|
1478
|
-
const { t:
|
|
1477
|
+
const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
|
|
1478
|
+
const { t: a, theme: c } = B(), [s, i] = l.useState(!1), d = l.useRef(null), m = l.useRef(n), u = l.useRef(null), [f, b] = l.useState(null), C = ie(c);
|
|
1479
1479
|
l.useEffect(() => {
|
|
1480
1480
|
m.current = n;
|
|
1481
1481
|
}, [n]);
|
|
1482
1482
|
const N = (g, w) => w.some(
|
|
1483
1483
|
(x) => x.name === g.name && x.size === g.size && x.lastModified === g.lastModified
|
|
1484
|
-
), h = T(e,
|
|
1484
|
+
), h = T(e, o);
|
|
1485
1485
|
l.useEffect(() => {
|
|
1486
1486
|
const g = h(r ?? []);
|
|
1487
1487
|
t?.(r), g !== u.current && (u.current = g, b(g), m.current?.(g ?? null));
|
|
@@ -1566,7 +1566,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1566
1566
|
{
|
|
1567
1567
|
type: "button",
|
|
1568
1568
|
onClick: () => $(Array.isArray(r) ? x : void 0),
|
|
1569
|
-
"aria-label":
|
|
1569
|
+
"aria-label": a("Remove file"),
|
|
1570
1570
|
style: {
|
|
1571
1571
|
background: "transparent",
|
|
1572
1572
|
border: "none",
|
|
@@ -1630,7 +1630,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1630
1630
|
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), d.current?.click());
|
|
1631
1631
|
},
|
|
1632
1632
|
role: "button",
|
|
1633
|
-
"aria-label": e.multiple ?
|
|
1633
|
+
"aria-label": e.multiple ? a("Choose Files or Drag & Drop") : a("Choose File or Drag & Drop"),
|
|
1634
1634
|
"aria-invalid": !!f,
|
|
1635
1635
|
"aria-describedby": f ? `${e.name}-error` : void 0,
|
|
1636
1636
|
children: [
|
|
@@ -1660,7 +1660,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1660
1660
|
color: "var(--reactaform-text-color, #111827)",
|
|
1661
1661
|
flex: 1,
|
|
1662
1662
|
textAlign: "left"
|
|
1663
|
-
}, children: s ?
|
|
1663
|
+
}, children: s ? a("Drop files here") : e.multiple ? a("Choose Files or Drag & Drop") : a("Choose File or Drag & Drop") })
|
|
1664
1664
|
]
|
|
1665
1665
|
}
|
|
1666
1666
|
),
|
|
@@ -1673,13 +1673,13 @@ const Vt = l.memo(Sr), Cr = ({
|
|
|
1673
1673
|
value: r,
|
|
1674
1674
|
onChange: t,
|
|
1675
1675
|
onError: n,
|
|
1676
|
-
error:
|
|
1676
|
+
error: o
|
|
1677
1677
|
}) => {
|
|
1678
|
-
const
|
|
1678
|
+
const a = T(e, o), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
|
|
1679
1679
|
value: c,
|
|
1680
1680
|
onChange: t,
|
|
1681
1681
|
onError: n,
|
|
1682
|
-
validate:
|
|
1682
|
+
validate: a
|
|
1683
1683
|
});
|
|
1684
1684
|
return /* @__PURE__ */ p(O, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1685
1685
|
"input",
|
|
@@ -1702,13 +1702,13 @@ const At = l.memo(Cr), Nr = ({
|
|
|
1702
1702
|
value: r,
|
|
1703
1703
|
onChange: t,
|
|
1704
1704
|
onError: n,
|
|
1705
|
-
error:
|
|
1705
|
+
error: o
|
|
1706
1706
|
}) => {
|
|
1707
|
-
const
|
|
1707
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1708
1708
|
value: r,
|
|
1709
1709
|
onChange: t,
|
|
1710
1710
|
onError: n,
|
|
1711
|
-
validate:
|
|
1711
|
+
validate: a
|
|
1712
1712
|
});
|
|
1713
1713
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1714
1714
|
"input",
|
|
@@ -1742,7 +1742,7 @@ function Dt() {
|
|
|
1742
1742
|
return "/";
|
|
1743
1743
|
}
|
|
1744
1744
|
const kr = ({ field: e, value: r }) => {
|
|
1745
|
-
const { language: t, t: n } = B(),
|
|
1745
|
+
const { language: t, t: n } = B(), o = e.alignment || "center", a = {
|
|
1746
1746
|
left: "flex-start",
|
|
1747
1747
|
center: "center",
|
|
1748
1748
|
right: "flex-end"
|
|
@@ -1786,7 +1786,7 @@ const kr = ({ field: e, value: r }) => {
|
|
|
1786
1786
|
"data-testid": "image-wrapper",
|
|
1787
1787
|
style: {
|
|
1788
1788
|
display: "flex",
|
|
1789
|
-
justifyContent: o
|
|
1789
|
+
justifyContent: a[o] || "center",
|
|
1790
1790
|
margin: "0 0"
|
|
1791
1791
|
},
|
|
1792
1792
|
children: /* @__PURE__ */ p(
|
|
@@ -1807,13 +1807,13 @@ const zt = l.memo(kr), Ir = ({
|
|
|
1807
1807
|
value: r,
|
|
1808
1808
|
onChange: t,
|
|
1809
1809
|
onError: n,
|
|
1810
|
-
error:
|
|
1810
|
+
error: o
|
|
1811
1811
|
}) => {
|
|
1812
|
-
const
|
|
1812
|
+
const a = T(e, o), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
|
|
1813
1813
|
value: c,
|
|
1814
1814
|
onChange: t,
|
|
1815
1815
|
onError: n,
|
|
1816
|
-
validate:
|
|
1816
|
+
validate: a
|
|
1817
1817
|
});
|
|
1818
1818
|
return /* @__PURE__ */ p(O, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1819
1819
|
"input",
|
|
@@ -1836,13 +1836,13 @@ const Pt = l.memo(Ir), Er = ({
|
|
|
1836
1836
|
value: r,
|
|
1837
1837
|
onChange: t,
|
|
1838
1838
|
onError: n,
|
|
1839
|
-
error:
|
|
1839
|
+
error: o
|
|
1840
1840
|
}) => {
|
|
1841
|
-
const
|
|
1841
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1842
1842
|
value: r,
|
|
1843
1843
|
onChange: t,
|
|
1844
1844
|
onError: n,
|
|
1845
|
-
validate:
|
|
1845
|
+
validate: a
|
|
1846
1846
|
});
|
|
1847
1847
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1848
1848
|
"input",
|
|
@@ -1864,13 +1864,13 @@ const Lt = l.memo(Er), Mr = ({
|
|
|
1864
1864
|
value: r,
|
|
1865
1865
|
onChange: t,
|
|
1866
1866
|
onError: n,
|
|
1867
|
-
error:
|
|
1867
|
+
error: o
|
|
1868
1868
|
}) => {
|
|
1869
|
-
const
|
|
1869
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1870
1870
|
value: r,
|
|
1871
1871
|
onChange: t,
|
|
1872
1872
|
onError: n,
|
|
1873
|
-
validate:
|
|
1873
|
+
validate: a
|
|
1874
1874
|
});
|
|
1875
1875
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1876
1876
|
"textarea",
|
|
@@ -1897,13 +1897,13 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1897
1897
|
value: r,
|
|
1898
1898
|
onChange: t,
|
|
1899
1899
|
onError: n,
|
|
1900
|
-
error:
|
|
1900
|
+
error: o
|
|
1901
1901
|
}) => {
|
|
1902
|
-
const
|
|
1902
|
+
const a = l.useRef(
|
|
1903
1903
|
n
|
|
1904
1904
|
);
|
|
1905
1905
|
l.useEffect(() => {
|
|
1906
|
-
|
|
1906
|
+
a.current = n;
|
|
1907
1907
|
}, [n]);
|
|
1908
1908
|
const { t: c, theme: s, formStyle: i, fieldStyle: d } = B(), m = (x, k, S) => {
|
|
1909
1909
|
if (!k) return {};
|
|
@@ -1915,10 +1915,10 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1915
1915
|
), y = l.useMemo(() => {
|
|
1916
1916
|
const x = Array.isArray(r) ? r : [], k = new Set(h.map((S) => S.value));
|
|
1917
1917
|
return x.filter((S) => k.has(S));
|
|
1918
|
-
}, [r, h]), E = T(e,
|
|
1918
|
+
}, [r, h]), E = T(e, o), [F, M] = l.useState(null), $ = l.useRef(null);
|
|
1919
1919
|
l.useEffect(() => {
|
|
1920
1920
|
const x = E(Array.isArray(r) ? r : []);
|
|
1921
|
-
x !== $.current && ($.current = x, M(x),
|
|
1921
|
+
x !== $.current && ($.current = x, M(x), a.current?.(x ?? null));
|
|
1922
1922
|
}, [r, E]);
|
|
1923
1923
|
const R = () => {
|
|
1924
1924
|
if (!u.current) return;
|
|
@@ -1926,7 +1926,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1926
1926
|
N({ x: x.left, y: x.bottom }), b((k) => !k);
|
|
1927
1927
|
}, I = (x) => {
|
|
1928
1928
|
const k = y.includes(x) ? y.filter((A) => A !== x) : [...y, x], S = E(k);
|
|
1929
|
-
S !== $.current && ($.current = S, M(S),
|
|
1929
|
+
S !== $.current && ($.current = S, M(S), a.current?.(S ?? null)), t?.(k);
|
|
1930
1930
|
}, v = l.useMemo(
|
|
1931
1931
|
() => ({
|
|
1932
1932
|
height: "var(--reactaform-input-height, 2.5rem)",
|
|
@@ -2032,14 +2032,14 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2032
2032
|
options: r,
|
|
2033
2033
|
selectedValues: t,
|
|
2034
2034
|
onToggleOption: n,
|
|
2035
|
-
onClose:
|
|
2036
|
-
controlRef:
|
|
2035
|
+
onClose: o,
|
|
2036
|
+
controlRef: a,
|
|
2037
2037
|
theme: c
|
|
2038
2038
|
}) => {
|
|
2039
2039
|
const s = l.useRef(null), [i, d] = l.useState(-1), { formStyle: m, fieldStyle: u } = B(), f = ie(c ?? "light");
|
|
2040
2040
|
l.useLayoutEffect(() => {
|
|
2041
|
-
if (!
|
|
2042
|
-
const I =
|
|
2041
|
+
if (!a.current) return;
|
|
2042
|
+
const I = a.current.closest("[data-reactaform-theme]"), v = document.getElementById("popup-root");
|
|
2043
2043
|
if (I && v) {
|
|
2044
2044
|
const g = getComputedStyle(I);
|
|
2045
2045
|
v.style.setProperty(
|
|
@@ -2053,7 +2053,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2053
2053
|
g.getPropertyValue("--reactaform-option-menu-hover-bg")
|
|
2054
2054
|
);
|
|
2055
2055
|
}
|
|
2056
|
-
}, [
|
|
2056
|
+
}, [a]);
|
|
2057
2057
|
const b = (I, v, g) => {
|
|
2058
2058
|
if (!v) return {};
|
|
2059
2059
|
const x = I?.[v];
|
|
@@ -2090,10 +2090,10 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2090
2090
|
l.useEffect(() => {
|
|
2091
2091
|
const I = (v) => {
|
|
2092
2092
|
const g = v.target;
|
|
2093
|
-
!s.current?.contains(g) && !
|
|
2093
|
+
!s.current?.contains(g) && !a.current?.contains(g) && o();
|
|
2094
2094
|
};
|
|
2095
2095
|
return document.addEventListener("mousedown", I), () => document.removeEventListener("mousedown", I);
|
|
2096
|
-
}, [
|
|
2096
|
+
}, [o, a]), l.useEffect(() => {
|
|
2097
2097
|
s.current && r.length > 0 && requestAnimationFrame(
|
|
2098
2098
|
() => d((I) => I === -1 ? 0 : I)
|
|
2099
2099
|
);
|
|
@@ -2109,7 +2109,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2109
2109
|
if (typeof window > "u") return;
|
|
2110
2110
|
const I = () => {
|
|
2111
2111
|
let w = e.x, x = e.y, k = h;
|
|
2112
|
-
const S =
|
|
2112
|
+
const S = a?.current;
|
|
2113
2113
|
if (S) {
|
|
2114
2114
|
const A = S.getBoundingClientRect();
|
|
2115
2115
|
w = A.left, x = A.bottom, k = Math.max(80, Math.round(A.width));
|
|
@@ -2118,11 +2118,11 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2118
2118
|
};
|
|
2119
2119
|
I(), window.addEventListener("scroll", I, !0), window.addEventListener("resize", I);
|
|
2120
2120
|
let v = null;
|
|
2121
|
-
const g =
|
|
2121
|
+
const g = a?.current;
|
|
2122
2122
|
return typeof ResizeObserver < "u" && g && (v = new ResizeObserver(() => I()), v.observe(g)), () => {
|
|
2123
2123
|
window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), v && g && v.unobserve(g);
|
|
2124
2124
|
};
|
|
2125
|
-
}, [
|
|
2125
|
+
}, [a, e.x, e.y]), typeof window > "u") return null;
|
|
2126
2126
|
let R = document.getElementById("popup-root");
|
|
2127
2127
|
return R || (R = document.createElement("div"), R.id = "popup-root", document.body.appendChild(R)), de.createPortal(
|
|
2128
2128
|
/* @__PURE__ */ p(
|
|
@@ -2172,7 +2172,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2172
2172
|
k.preventDefault(), k.stopPropagation(), n(I.value);
|
|
2173
2173
|
break;
|
|
2174
2174
|
case "Escape":
|
|
2175
|
-
k.preventDefault(),
|
|
2175
|
+
k.preventDefault(), o(), a?.current?.focus();
|
|
2176
2176
|
break;
|
|
2177
2177
|
}
|
|
2178
2178
|
},
|
|
@@ -2220,13 +2220,13 @@ const jt = l.memo(Fr), $r = ({
|
|
|
2220
2220
|
value: r,
|
|
2221
2221
|
onChange: t,
|
|
2222
2222
|
onError: n,
|
|
2223
|
-
error:
|
|
2223
|
+
error: o
|
|
2224
2224
|
}) => {
|
|
2225
|
-
const
|
|
2225
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2226
2226
|
value: String(r ?? ""),
|
|
2227
2227
|
onChange: t,
|
|
2228
2228
|
onError: n,
|
|
2229
|
-
validate:
|
|
2229
|
+
validate: a
|
|
2230
2230
|
}), d = Math.max(1, Math.round(e.step ?? 1));
|
|
2231
2231
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2232
2232
|
"input",
|
|
@@ -2255,13 +2255,13 @@ const Bt = l.memo($r), Vr = ({
|
|
|
2255
2255
|
value: r,
|
|
2256
2256
|
onChange: t,
|
|
2257
2257
|
onError: n,
|
|
2258
|
-
error:
|
|
2258
|
+
error: o
|
|
2259
2259
|
}) => {
|
|
2260
|
-
const
|
|
2260
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2261
2261
|
value: r,
|
|
2262
2262
|
onChange: t,
|
|
2263
2263
|
onError: n,
|
|
2264
|
-
validate:
|
|
2264
|
+
validate: a
|
|
2265
2265
|
});
|
|
2266
2266
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2267
2267
|
"input",
|
|
@@ -2283,9 +2283,9 @@ const Ht = l.memo(Vr), Ar = ({
|
|
|
2283
2283
|
value: r,
|
|
2284
2284
|
onChange: t,
|
|
2285
2285
|
onError: n,
|
|
2286
|
-
error:
|
|
2286
|
+
error: o
|
|
2287
2287
|
}) => {
|
|
2288
|
-
const { t:
|
|
2288
|
+
const { t: a } = B(), c = T(e, o), s = e.layout?.toLowerCase() === "horizontal" ? "row" : "column", i = l.useRef(n);
|
|
2289
2289
|
l.useEffect(() => {
|
|
2290
2290
|
i.current = n;
|
|
2291
2291
|
}, [n]);
|
|
@@ -2365,7 +2365,7 @@ const Ht = l.memo(Vr), Ar = ({
|
|
|
2365
2365
|
flex: s === "column" ? 1 : void 0,
|
|
2366
2366
|
fontWeight: 400
|
|
2367
2367
|
},
|
|
2368
|
-
children:
|
|
2368
|
+
children: a(h.label)
|
|
2369
2369
|
}
|
|
2370
2370
|
)
|
|
2371
2371
|
]
|
|
@@ -2388,8 +2388,8 @@ const qt = l.memo(Ar), Ut = {
|
|
|
2388
2388
|
marginRight: "0.25rem",
|
|
2389
2389
|
userSelect: "none",
|
|
2390
2390
|
transition: "color 0.12s ease"
|
|
2391
|
-
}, Rr = ({ field: e, value: r, onChange: t, onError: n, error:
|
|
2392
|
-
const { t:
|
|
2391
|
+
}, Rr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
|
|
2392
|
+
const { t: a } = B(), c = T(e, o), s = e.max ?? 5, i = e.icon?.trim() || "★", [d, m] = l.useState(null), u = l.useRef([]), f = l.useMemo(() => Math.min(Math.max(r ?? 0, 0), s), [r, s]), b = l.useMemo(() => c(f) ?? null, [c, f]);
|
|
2393
2393
|
l.useEffect(() => {
|
|
2394
2394
|
n?.(b);
|
|
2395
2395
|
}, [b, n]);
|
|
@@ -2436,7 +2436,7 @@ const qt = l.memo(Ar), Ut = {
|
|
|
2436
2436
|
tabIndex: f > 0 ? y === f - 1 ? 0 : -1 : y === 0 ? 0 : -1,
|
|
2437
2437
|
"aria-checked": E,
|
|
2438
2438
|
"aria-label": `Rating ${y + 1}`,
|
|
2439
|
-
title:
|
|
2439
|
+
title: a(`${e.displayName} ${y + 1}`),
|
|
2440
2440
|
onClick: () => C(y + 1),
|
|
2441
2441
|
onKeyDown: ($) => N($, y),
|
|
2442
2442
|
onMouseEnter: () => m(y),
|
|
@@ -2456,9 +2456,9 @@ const _t = l.memo(Rr), Dr = ({
|
|
|
2456
2456
|
value: r,
|
|
2457
2457
|
onChange: t,
|
|
2458
2458
|
onError: n,
|
|
2459
|
-
error:
|
|
2459
|
+
error: o
|
|
2460
2460
|
}) => {
|
|
2461
|
-
const { t:
|
|
2461
|
+
const { t: a } = B(), c = T(e, o), { inputRef: s, error: i, handleChange: d } = _({
|
|
2462
2462
|
value: r,
|
|
2463
2463
|
onChange: t,
|
|
2464
2464
|
onError: n,
|
|
@@ -2484,7 +2484,7 @@ const _t = l.memo(Rr), Dr = ({
|
|
|
2484
2484
|
{
|
|
2485
2485
|
type: "button",
|
|
2486
2486
|
onClick: f,
|
|
2487
|
-
"aria-label":
|
|
2487
|
+
"aria-label": a(m ? "Hide password" : "Show password"),
|
|
2488
2488
|
style: {
|
|
2489
2489
|
background: "transparent",
|
|
2490
2490
|
border: "none",
|
|
@@ -2500,15 +2500,15 @@ const _t = l.memo(Rr), Dr = ({
|
|
|
2500
2500
|
] }) });
|
|
2501
2501
|
};
|
|
2502
2502
|
Dr.displayName = "PasswordInput";
|
|
2503
|
-
const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, error:
|
|
2504
|
-
const
|
|
2503
|
+
const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
|
|
2504
|
+
const a = T(e, o), c = e.min ?? 0, s = e.max ?? 100, [i, d] = l.useState(
|
|
2505
2505
|
() => isNaN(Number(r)) ? String(c) : String(Number(r))
|
|
2506
2506
|
);
|
|
2507
2507
|
l.useEffect(() => {
|
|
2508
2508
|
const b = isNaN(Number(r)) ? String(c) : String(Number(r));
|
|
2509
2509
|
d(b);
|
|
2510
2510
|
}, [r, c]);
|
|
2511
|
-
const m = l.useMemo(() =>
|
|
2511
|
+
const m = l.useMemo(() => a(i) ?? null, [a, i]);
|
|
2512
2512
|
l.useEffect(() => {
|
|
2513
2513
|
n?.(m);
|
|
2514
2514
|
}, [m, n]);
|
|
@@ -2567,9 +2567,9 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2567
2567
|
value: r,
|
|
2568
2568
|
onChange: t,
|
|
2569
2569
|
onError: n,
|
|
2570
|
-
error:
|
|
2570
|
+
error: o
|
|
2571
2571
|
}) => {
|
|
2572
|
-
const { t:
|
|
2572
|
+
const { t: a, formStyle: c, fieldStyle: s } = B(), d = T(e, o)(r);
|
|
2573
2573
|
l.useEffect(() => {
|
|
2574
2574
|
n?.(d);
|
|
2575
2575
|
}, [d, n]);
|
|
@@ -2638,7 +2638,7 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2638
2638
|
className: V.label,
|
|
2639
2639
|
htmlFor: e.name,
|
|
2640
2640
|
style: { textAlign: "left", justifyContent: "flex-start" },
|
|
2641
|
-
children:
|
|
2641
|
+
children: a(e.displayName)
|
|
2642
2642
|
}
|
|
2643
2643
|
),
|
|
2644
2644
|
/* @__PURE__ */ D("label", { style: b, children: [
|
|
@@ -2649,7 +2649,7 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2649
2649
|
type: "checkbox",
|
|
2650
2650
|
checked: y,
|
|
2651
2651
|
readOnly: !0,
|
|
2652
|
-
"aria-label":
|
|
2652
|
+
"aria-label": a(e.displayName),
|
|
2653
2653
|
"aria-invalid": !1,
|
|
2654
2654
|
"aria-describedby": void 0,
|
|
2655
2655
|
style: C,
|
|
@@ -2691,13 +2691,13 @@ const Jt = l.memo(Pr), xe = ({
|
|
|
2691
2691
|
value: r,
|
|
2692
2692
|
onChange: t,
|
|
2693
2693
|
onError: n,
|
|
2694
|
-
error:
|
|
2694
|
+
error: o
|
|
2695
2695
|
}) => {
|
|
2696
|
-
const
|
|
2696
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2697
2697
|
value: r,
|
|
2698
2698
|
onChange: t,
|
|
2699
2699
|
onError: n,
|
|
2700
|
-
validate:
|
|
2700
|
+
validate: a
|
|
2701
2701
|
});
|
|
2702
2702
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2703
2703
|
"input",
|
|
@@ -2720,13 +2720,13 @@ const Lr = ({
|
|
|
2720
2720
|
value: r,
|
|
2721
2721
|
onChange: t,
|
|
2722
2722
|
onError: n,
|
|
2723
|
-
error:
|
|
2723
|
+
error: o
|
|
2724
2724
|
}) => {
|
|
2725
|
-
const
|
|
2725
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2726
2726
|
value: r,
|
|
2727
2727
|
onChange: t,
|
|
2728
2728
|
onError: n,
|
|
2729
|
-
validate:
|
|
2729
|
+
validate: a
|
|
2730
2730
|
});
|
|
2731
2731
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2732
2732
|
"input",
|
|
@@ -2753,27 +2753,27 @@ function Xt({
|
|
|
2753
2753
|
onClose: t,
|
|
2754
2754
|
onClickOption: n
|
|
2755
2755
|
}) {
|
|
2756
|
-
const
|
|
2756
|
+
const o = l.useRef(null), a = l.useRef(!1), [c, s] = l.useState({
|
|
2757
2757
|
top: e?.y ?? 0,
|
|
2758
2758
|
left: e?.x ?? 0,
|
|
2759
2759
|
ready: !1
|
|
2760
2760
|
}), i = typeof window < "u" ? document.getElementById("popup-root") || document.body : null;
|
|
2761
2761
|
return l.useEffect(() => {
|
|
2762
2762
|
function d(m) {
|
|
2763
|
-
|
|
2763
|
+
a.current || m.target.dataset?.popupMenu === "item" || o.current && m.target instanceof Node && !o.current.contains(m.target) && t();
|
|
2764
2764
|
}
|
|
2765
2765
|
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
2766
2766
|
}, [t]), l.useLayoutEffect(() => {
|
|
2767
|
-
if (!
|
|
2767
|
+
if (!o.current || !e || e.x == null || e.y == null)
|
|
2768
2768
|
return;
|
|
2769
|
-
const d =
|
|
2769
|
+
const d = o.current.getBoundingClientRect(), m = window.innerWidth, u = window.innerHeight;
|
|
2770
2770
|
let f = e.x, b = e.y;
|
|
2771
2771
|
f + d.width > m && (f = Math.max(0, m - d.width - 10)), b + d.height > u && (b = Math.max(0, e.y - d.height - 5)), s({ top: b, left: f, ready: !0 });
|
|
2772
2772
|
}, [e, r]), !i || r === void 0 || r.length === 0 || !e || e.x == null || e.y == null ? null : de.createPortal(
|
|
2773
2773
|
/* @__PURE__ */ p(
|
|
2774
2774
|
"div",
|
|
2775
2775
|
{
|
|
2776
|
-
ref:
|
|
2776
|
+
ref: o,
|
|
2777
2777
|
onMouseDown: (d) => {
|
|
2778
2778
|
d.stopPropagation();
|
|
2779
2779
|
},
|
|
@@ -2797,11 +2797,11 @@ function Xt({
|
|
|
2797
2797
|
{
|
|
2798
2798
|
"data-popup-menu": "item",
|
|
2799
2799
|
onMouseDown: (u) => {
|
|
2800
|
-
u.stopPropagation(),
|
|
2800
|
+
u.stopPropagation(), a.current = !0;
|
|
2801
2801
|
},
|
|
2802
2802
|
onClick: (u) => {
|
|
2803
2803
|
u.stopPropagation(), u.preventDefault(), n(d), t(), setTimeout(() => {
|
|
2804
|
-
|
|
2804
|
+
a.current = !1;
|
|
2805
2805
|
}, 100);
|
|
2806
2806
|
},
|
|
2807
2807
|
style: {
|
|
@@ -2949,22 +2949,22 @@ const $e = {
|
|
|
2949
2949
|
...Object.keys(Ae)
|
|
2950
2950
|
]);
|
|
2951
2951
|
for (const e of Zt) {
|
|
2952
|
-
const r = {}, t = $e[e] ?? [], n = Ve[e] ?? {},
|
|
2953
|
-
for (const
|
|
2954
|
-
const c = n[
|
|
2955
|
-
r[
|
|
2956
|
-
name: typeof c == "string" ? c : String(
|
|
2957
|
-
shortName:
|
|
2958
|
-
factor:
|
|
2952
|
+
const r = {}, t = $e[e] ?? [], n = Ve[e] ?? {}, o = Ae[e] ?? {};
|
|
2953
|
+
for (const a of t) {
|
|
2954
|
+
const c = n[a];
|
|
2955
|
+
r[a] = {
|
|
2956
|
+
name: typeof c == "string" ? c : String(a),
|
|
2957
|
+
shortName: a,
|
|
2958
|
+
factor: a in o ? o[a] : void 0
|
|
2959
2959
|
};
|
|
2960
2960
|
}
|
|
2961
|
-
for (const [
|
|
2962
|
-
if (!r[
|
|
2963
|
-
const s = typeof c == "string" ? c : String(
|
|
2964
|
-
r[
|
|
2961
|
+
for (const [a, c] of Object.entries(n))
|
|
2962
|
+
if (!r[a]) {
|
|
2963
|
+
const s = typeof c == "string" ? c : String(a);
|
|
2964
|
+
r[a] = { name: s, shortName: a, factor: a in o ? o[a] : void 0 };
|
|
2965
2965
|
}
|
|
2966
|
-
for (const [
|
|
2967
|
-
r[
|
|
2966
|
+
for (const [a, c] of Object.entries(o))
|
|
2967
|
+
r[a] || (r[a] = { name: String(a), shortName: String(a), factor: c });
|
|
2968
2968
|
Re[e] = r;
|
|
2969
2969
|
}
|
|
2970
2970
|
function Or(e, r, t) {
|
|
@@ -2984,15 +2984,15 @@ function Tr(e) {
|
|
|
2984
2984
|
const r = Re[e];
|
|
2985
2985
|
if (!r) return null;
|
|
2986
2986
|
const t = {}, n = [];
|
|
2987
|
-
for (const [
|
|
2988
|
-
typeof c.factor == "number" && (t[
|
|
2987
|
+
for (const [a, c] of Object.entries(r))
|
|
2988
|
+
typeof c.factor == "number" && (t[a] = c.factor), n.push(a);
|
|
2989
2989
|
return {
|
|
2990
2990
|
default: Object.keys(r)[0] ?? "",
|
|
2991
2991
|
units: n,
|
|
2992
2992
|
factors: t
|
|
2993
2993
|
};
|
|
2994
2994
|
}
|
|
2995
|
-
const
|
|
2995
|
+
const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2996
2996
|
__proto__: null,
|
|
2997
2997
|
convertTemperature: Or,
|
|
2998
2998
|
dimensionUnitDisplayMap: Ve,
|
|
@@ -3005,8 +3005,8 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3005
3005
|
inputValue: r,
|
|
3006
3006
|
selectedUnit: t,
|
|
3007
3007
|
dimension: n,
|
|
3008
|
-
unitFactors:
|
|
3009
|
-
onConversionSelect:
|
|
3008
|
+
unitFactors: o,
|
|
3009
|
+
onConversionSelect: a,
|
|
3010
3010
|
t: c
|
|
3011
3011
|
}) => {
|
|
3012
3012
|
const [s, i] = l.useState(!1), [d, m] = l.useState(null), [u, f] = l.useState([]), b = l.useCallback(
|
|
@@ -3018,7 +3018,7 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3018
3018
|
m({ x: E.left, y: E.bottom });
|
|
3019
3019
|
const F = [];
|
|
3020
3020
|
if (n === "temperature")
|
|
3021
|
-
|
|
3021
|
+
o.units.forEach(($) => {
|
|
3022
3022
|
const R = Or(t, $, y);
|
|
3023
3023
|
Number.isFinite(R) && F.push({
|
|
3024
3024
|
label: `${R.toFixed(6)} ${c($)}`,
|
|
@@ -3027,8 +3027,8 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3027
3027
|
});
|
|
3028
3028
|
});
|
|
3029
3029
|
else {
|
|
3030
|
-
const $ =
|
|
3031
|
-
$ !== void 0 && Object.entries(
|
|
3030
|
+
const $ = o.factors[t];
|
|
3031
|
+
$ !== void 0 && Object.entries(o.factors).forEach(([R, I]) => {
|
|
3032
3032
|
const v = y / $ * I;
|
|
3033
3033
|
Number.isFinite(v) && F.push({
|
|
3034
3034
|
label: `${v.toFixed(6)} ${c(R)}`,
|
|
@@ -3039,12 +3039,12 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3039
3039
|
}
|
|
3040
3040
|
f(F), i(F.length > 0);
|
|
3041
3041
|
},
|
|
3042
|
-
[e, r, t, n,
|
|
3042
|
+
[e, r, t, n, o, c]
|
|
3043
3043
|
), C = l.useCallback(
|
|
3044
3044
|
(h) => {
|
|
3045
|
-
i(!1), m(null),
|
|
3045
|
+
i(!1), m(null), a(h);
|
|
3046
3046
|
},
|
|
3047
|
-
[
|
|
3047
|
+
[a]
|
|
3048
3048
|
), N = l.useCallback(() => {
|
|
3049
3049
|
i(!1), m(null);
|
|
3050
3050
|
}, []);
|
|
@@ -3088,36 +3088,36 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3088
3088
|
});
|
|
3089
3089
|
jr.displayName = "ConversionButton";
|
|
3090
3090
|
const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
3091
|
-
const { t:
|
|
3091
|
+
const { t: o } = B(), a = T(e), c = e.dimension, s = l.useMemo(() => c ? Tr(c) : null, [c]), i = String(r?.[0] ?? ""), d = String(r?.[1] ?? s?.default ?? ""), [m, u] = l.useState(i), [f, b] = l.useState(d);
|
|
3092
3092
|
l.useEffect(() => {
|
|
3093
3093
|
u(i);
|
|
3094
3094
|
}, [i]), l.useEffect(() => {
|
|
3095
3095
|
b(d);
|
|
3096
3096
|
}, [d]);
|
|
3097
|
-
const C =
|
|
3097
|
+
const C = a([m, f]);
|
|
3098
3098
|
l.useEffect(() => {
|
|
3099
3099
|
n?.(C);
|
|
3100
3100
|
}, [C, n]);
|
|
3101
3101
|
const N = l.useCallback(
|
|
3102
3102
|
(M) => {
|
|
3103
3103
|
const $ = M.target.value;
|
|
3104
|
-
u($),
|
|
3104
|
+
u($), a([$, f]), t?.([$, f]);
|
|
3105
3105
|
},
|
|
3106
|
-
[f,
|
|
3106
|
+
[f, a, t]
|
|
3107
3107
|
), h = l.useCallback(
|
|
3108
3108
|
(M) => {
|
|
3109
3109
|
const $ = M.target.value;
|
|
3110
|
-
b($),
|
|
3110
|
+
b($), a([m, $]), t?.([m, $]);
|
|
3111
3111
|
},
|
|
3112
|
-
[m,
|
|
3112
|
+
[m, a, t]
|
|
3113
3113
|
), y = l.useCallback(
|
|
3114
3114
|
(M) => {
|
|
3115
3115
|
u(M.value), b(M.unit), t?.([M.value, M.unit]);
|
|
3116
3116
|
},
|
|
3117
3117
|
[t]
|
|
3118
3118
|
), E = l.useMemo(
|
|
3119
|
-
() => s ? s.units.map((M) => /* @__PURE__ */ p("option", { value: M, children:
|
|
3120
|
-
[s,
|
|
3119
|
+
() => s ? s.units.map((M) => /* @__PURE__ */ p("option", { value: M, children: o(M) }, M)) : [],
|
|
3120
|
+
[s, o]
|
|
3121
3121
|
);
|
|
3122
3122
|
if (!c || !s) return null;
|
|
3123
3123
|
const F = !!C || !m.trim();
|
|
@@ -3157,7 +3157,7 @@ const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
3157
3157
|
dimension: c,
|
|
3158
3158
|
unitFactors: s,
|
|
3159
3159
|
onConversionSelect: y,
|
|
3160
|
-
t:
|
|
3160
|
+
t: o
|
|
3161
3161
|
}
|
|
3162
3162
|
)
|
|
3163
3163
|
] }) });
|
|
@@ -3168,13 +3168,13 @@ const Qt = l.memo(Br), Hr = ({
|
|
|
3168
3168
|
value: r,
|
|
3169
3169
|
onChange: t,
|
|
3170
3170
|
onError: n,
|
|
3171
|
-
error:
|
|
3171
|
+
error: o
|
|
3172
3172
|
}) => {
|
|
3173
|
-
const
|
|
3173
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
3174
3174
|
value: r,
|
|
3175
3175
|
onChange: t,
|
|
3176
3176
|
onError: n,
|
|
3177
|
-
validate:
|
|
3177
|
+
validate: a
|
|
3178
3178
|
});
|
|
3179
3179
|
return /* @__PURE__ */ p(O, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
3180
3180
|
"input",
|
|
@@ -3193,19 +3193,19 @@ const Qt = l.memo(Br), Hr = ({
|
|
|
3193
3193
|
};
|
|
3194
3194
|
Hr.displayName = "UrlInput";
|
|
3195
3195
|
const en = l.memo(Hr), se = new ne();
|
|
3196
|
-
function
|
|
3196
|
+
function fo(e, r) {
|
|
3197
3197
|
se.register(e, r);
|
|
3198
3198
|
}
|
|
3199
3199
|
function rn(e) {
|
|
3200
3200
|
return se.get(e);
|
|
3201
3201
|
}
|
|
3202
|
-
function
|
|
3202
|
+
function po(e) {
|
|
3203
3203
|
return se.has(e);
|
|
3204
3204
|
}
|
|
3205
|
-
function
|
|
3205
|
+
function go(e) {
|
|
3206
3206
|
return se.unregister(e);
|
|
3207
3207
|
}
|
|
3208
|
-
function
|
|
3208
|
+
function ho() {
|
|
3209
3209
|
return se.list();
|
|
3210
3210
|
}
|
|
3211
3211
|
const qr = ({
|
|
@@ -3214,7 +3214,7 @@ const qr = ({
|
|
|
3214
3214
|
handleChange: t,
|
|
3215
3215
|
handleError: n
|
|
3216
3216
|
}) => {
|
|
3217
|
-
const { t:
|
|
3217
|
+
const { t: o } = B(), [a, c] = l.useState(!1), [s, i] = l.useState(null), d = l.useCallback(async () => {
|
|
3218
3218
|
if (!e.action) {
|
|
3219
3219
|
console.warn(`Button "${e.name}" has no action defined`);
|
|
3220
3220
|
return;
|
|
@@ -3227,16 +3227,16 @@ const qr = ({
|
|
|
3227
3227
|
}
|
|
3228
3228
|
c(!0), i(null);
|
|
3229
3229
|
try {
|
|
3230
|
-
await f(r, t, n,
|
|
3230
|
+
await f(r, t, n, o);
|
|
3231
3231
|
} catch (b) {
|
|
3232
3232
|
const C = b instanceof Error ? b.message : String(b);
|
|
3233
3233
|
console.error(`Button handler "${e.action}" failed:`, C), i(C);
|
|
3234
3234
|
} finally {
|
|
3235
3235
|
c(!1);
|
|
3236
3236
|
}
|
|
3237
|
-
}, [e, r, t, n,
|
|
3238
|
-
cursor:
|
|
3239
|
-
opacity:
|
|
3237
|
+
}, [e, r, t, n, o]), u = { ...{
|
|
3238
|
+
cursor: a ? "wait" : "pointer",
|
|
3239
|
+
opacity: a ? 0.6 : 1
|
|
3240
3240
|
} };
|
|
3241
3241
|
return e.width && typeof e.width == "number" && e.width > 0 && (u.width = `${e.width}px`), /* @__PURE__ */ p(O, { field: e, rightAlign: !0, error: s, children: /* @__PURE__ */ p(
|
|
3242
3242
|
"button",
|
|
@@ -3244,11 +3244,11 @@ const qr = ({
|
|
|
3244
3244
|
type: "button",
|
|
3245
3245
|
className: V.button,
|
|
3246
3246
|
onClick: d,
|
|
3247
|
-
disabled:
|
|
3248
|
-
"aria-label":
|
|
3249
|
-
"aria-busy":
|
|
3247
|
+
disabled: a,
|
|
3248
|
+
"aria-label": o(e.displayName),
|
|
3249
|
+
"aria-busy": a,
|
|
3250
3250
|
style: u,
|
|
3251
|
-
children: a
|
|
3251
|
+
children: o(a ? "Processing..." : e.displayName)
|
|
3252
3252
|
}
|
|
3253
3253
|
) });
|
|
3254
3254
|
};
|
|
@@ -3315,11 +3315,11 @@ const tn = l.memo(qr), nn = {
|
|
|
3315
3315
|
unit: Qt,
|
|
3316
3316
|
url: en
|
|
3317
3317
|
};
|
|
3318
|
-
function
|
|
3318
|
+
function on(e) {
|
|
3319
3319
|
return e in De;
|
|
3320
3320
|
}
|
|
3321
|
-
function
|
|
3322
|
-
const { wait: t = 200, leading: n, trailing:
|
|
3321
|
+
function an(e, r) {
|
|
3322
|
+
const { wait: t = 200, leading: n, trailing: o } = r, a = l.memo((c) => {
|
|
3323
3323
|
const s = l.useRef(c.onChange);
|
|
3324
3324
|
l.useEffect(() => {
|
|
3325
3325
|
s.current = c.onChange;
|
|
@@ -3329,14 +3329,14 @@ function on(e, r) {
|
|
|
3329
3329
|
s.current?.(...m);
|
|
3330
3330
|
},
|
|
3331
3331
|
t,
|
|
3332
|
-
{ leading: n, trailing:
|
|
3332
|
+
{ leading: n, trailing: o }
|
|
3333
3333
|
);
|
|
3334
3334
|
return l.useEffect(() => d, [d]), l.createElement(
|
|
3335
3335
|
e,
|
|
3336
3336
|
{ ...c, onChange: i }
|
|
3337
3337
|
);
|
|
3338
3338
|
});
|
|
3339
|
-
return
|
|
3339
|
+
return a.displayName = "DebouncedFieldWrapper", a;
|
|
3340
3340
|
}
|
|
3341
3341
|
function Ur(e, r, t) {
|
|
3342
3342
|
const n = r;
|
|
@@ -3344,15 +3344,15 @@ function Ur(e, r, t) {
|
|
|
3344
3344
|
console.warn(`Can't overwrite base component type "${e}".`);
|
|
3345
3345
|
return;
|
|
3346
3346
|
}
|
|
3347
|
-
const
|
|
3348
|
-
if (
|
|
3347
|
+
const o = nn[e];
|
|
3348
|
+
if (o === !1) {
|
|
3349
3349
|
me.register(e, n);
|
|
3350
3350
|
return;
|
|
3351
3351
|
}
|
|
3352
|
-
const
|
|
3353
|
-
|
|
3352
|
+
const a = o ?? { wait: 200 };
|
|
3353
|
+
or ? me.register(e, n) : me.register(
|
|
3354
3354
|
e,
|
|
3355
|
-
|
|
3355
|
+
an(n, a)
|
|
3356
3356
|
);
|
|
3357
3357
|
}
|
|
3358
3358
|
function Wr(e, r) {
|
|
@@ -3368,15 +3368,15 @@ function sn() {
|
|
|
3368
3368
|
}), Ye = !0);
|
|
3369
3369
|
}
|
|
3370
3370
|
const ze = l.memo(
|
|
3371
|
-
({ field: e, valuesMap: r, handleChange: t, handleError: n, errorsMap:
|
|
3372
|
-
const
|
|
3371
|
+
({ field: e, valuesMap: r, handleChange: t, handleError: n, errorsMap: o }) => {
|
|
3372
|
+
const a = _r(e.type), c = r[e.name], s = o ? o[e.name] ?? null : void 0, i = l.useMemo(() => c, [c]), d = l.useCallback(
|
|
3373
3373
|
(u) => t(e.name, u),
|
|
3374
3374
|
[t, e.name]
|
|
3375
3375
|
), m = l.useCallback(
|
|
3376
3376
|
(u) => n?.(e.name, u),
|
|
3377
3377
|
[n, e.name]
|
|
3378
3378
|
);
|
|
3379
|
-
return
|
|
3379
|
+
return a ? e.type === "button" ? /* @__PURE__ */ p(a, { ...{
|
|
3380
3380
|
field: e,
|
|
3381
3381
|
value: null,
|
|
3382
3382
|
valuesMap: r,
|
|
@@ -3384,7 +3384,7 @@ const ze = l.memo(
|
|
|
3384
3384
|
handleError: n || (() => {
|
|
3385
3385
|
})
|
|
3386
3386
|
} }) : /* @__PURE__ */ p(
|
|
3387
|
-
|
|
3387
|
+
a,
|
|
3388
3388
|
{
|
|
3389
3389
|
field: e,
|
|
3390
3390
|
value: i,
|
|
@@ -3398,7 +3398,7 @@ const ze = l.memo(
|
|
|
3398
3398
|
);
|
|
3399
3399
|
ze.displayName = "FieldRenderer";
|
|
3400
3400
|
const Kr = l.memo(
|
|
3401
|
-
({ groupName: e, defaultOpen: r = !0, fields: t, valuesMap: n, handleChange:
|
|
3401
|
+
({ groupName: e, defaultOpen: r = !0, fields: t, valuesMap: n, handleChange: o, handleError: a, errorsMap: c, t: s }) => {
|
|
3402
3402
|
const [i, d] = l.useState(r), m = l.useCallback(() => d((u) => !u), []);
|
|
3403
3403
|
return /* @__PURE__ */ D("fieldset", { className: "reactaform-group", children: [
|
|
3404
3404
|
/* @__PURE__ */ D("legend", { onClick: m, className: "reactaform-group_legend", children: [
|
|
@@ -3410,8 +3410,8 @@ const Kr = l.memo(
|
|
|
3410
3410
|
{
|
|
3411
3411
|
field: u,
|
|
3412
3412
|
valuesMap: n,
|
|
3413
|
-
handleChange:
|
|
3414
|
-
handleError:
|
|
3413
|
+
handleChange: o,
|
|
3414
|
+
handleError: a,
|
|
3415
3415
|
errorsMap: c
|
|
3416
3416
|
},
|
|
3417
3417
|
u.name
|
|
@@ -3421,62 +3421,62 @@ const Kr = l.memo(
|
|
|
3421
3421
|
);
|
|
3422
3422
|
Kr.displayName = "FieldGroup";
|
|
3423
3423
|
const Pe = (e, r, t, n) => {
|
|
3424
|
-
const
|
|
3425
|
-
if (!
|
|
3426
|
-
const
|
|
3424
|
+
const o = r[e];
|
|
3425
|
+
if (!o?.children) return;
|
|
3426
|
+
const a = t[e], c = a != null ? String(a) : "", s = o.children[c];
|
|
3427
3427
|
if (Array.isArray(s))
|
|
3428
3428
|
for (const i of s)
|
|
3429
3429
|
typeof i == "string" && r[i] && (n[i] = !0, Pe(i, r, t, n));
|
|
3430
3430
|
}, Gr = (e, r, t) => {
|
|
3431
3431
|
const n = r[e];
|
|
3432
3432
|
if (!n?.children) return;
|
|
3433
|
-
const
|
|
3434
|
-
for (const
|
|
3435
|
-
typeof
|
|
3433
|
+
const o = Object.values(n.children).flat();
|
|
3434
|
+
for (const a of o)
|
|
3435
|
+
typeof a == "string" && a in t && (t[a] = !1, Gr(a, r, t));
|
|
3436
3436
|
}, cn = (e, r, t, n) => {
|
|
3437
|
-
const
|
|
3438
|
-
return e.forEach((
|
|
3439
|
-
(!
|
|
3440
|
-
}),
|
|
3441
|
-
}, ln = (e, r, t, n,
|
|
3442
|
-
const
|
|
3443
|
-
if (Gr(n, r,
|
|
3444
|
-
const s = String(
|
|
3437
|
+
const o = { ...t };
|
|
3438
|
+
return e.forEach((a) => {
|
|
3439
|
+
(!a.parents || Object.keys(a.parents).length === 0) && (o[a.name] = !0, Pe(a.name, n, r, o));
|
|
3440
|
+
}), o;
|
|
3441
|
+
}, ln = (e, r, t, n, o) => {
|
|
3442
|
+
const a = { ...e }, c = r[n];
|
|
3443
|
+
if (Gr(n, r, a), o != null && c?.children) {
|
|
3444
|
+
const s = String(o), i = c.children[s];
|
|
3445
3445
|
if (Array.isArray(i))
|
|
3446
3446
|
for (const d of i)
|
|
3447
|
-
typeof d == "string" && r[d] && (
|
|
3447
|
+
typeof d == "string" && r[d] && (a[d] = !0, Pe(d, r, t, a));
|
|
3448
3448
|
}
|
|
3449
|
-
return
|
|
3449
|
+
return a;
|
|
3450
3450
|
}, un = (e, r) => {
|
|
3451
3451
|
const t = /* @__PURE__ */ new Map();
|
|
3452
|
-
let n = null,
|
|
3452
|
+
let n = null, o = null, a = 0;
|
|
3453
3453
|
for (const c of e) {
|
|
3454
3454
|
const s = c.group;
|
|
3455
3455
|
if (!s) {
|
|
3456
|
-
n = null,
|
|
3456
|
+
n = null, o = null;
|
|
3457
3457
|
continue;
|
|
3458
3458
|
}
|
|
3459
3459
|
if (s === n)
|
|
3460
|
-
r[c.name].group =
|
|
3460
|
+
r[c.name].group = o ?? s;
|
|
3461
3461
|
else {
|
|
3462
3462
|
if (!t.has(s))
|
|
3463
|
-
t.set(s, 1),
|
|
3463
|
+
t.set(s, 1), o = null, r[c.name].group = s;
|
|
3464
3464
|
else {
|
|
3465
3465
|
const i = t.get(s), d = `${s}(${i})`;
|
|
3466
|
-
t.set(s, i + 1),
|
|
3466
|
+
t.set(s, i + 1), o = d, r[c.name].group = d, a++;
|
|
3467
3467
|
}
|
|
3468
3468
|
n = s;
|
|
3469
3469
|
}
|
|
3470
3470
|
}
|
|
3471
|
-
return
|
|
3471
|
+
return a;
|
|
3472
3472
|
}, mn = (e, r = {}) => {
|
|
3473
3473
|
const { includeEmpty: t = !0 } = r, n = [];
|
|
3474
|
-
let
|
|
3474
|
+
let o = null, a = [], c = 0;
|
|
3475
3475
|
for (const i of e) {
|
|
3476
3476
|
const d = i.group || null;
|
|
3477
|
-
d !==
|
|
3477
|
+
d !== o ? ((a.length > 0 || t) && n.push({ name: o, fields: a }), o = d, a = [i]) : a.push(i);
|
|
3478
3478
|
}
|
|
3479
|
-
(
|
|
3479
|
+
(a.length > 0 || t) && n.push({ name: o, fields: a }), c = n.filter((i) => i.fields.length === 0).length;
|
|
3480
3480
|
const s = Math.max(0, ...n.map((i) => i.fields.length));
|
|
3481
3481
|
return {
|
|
3482
3482
|
groups: n,
|
|
@@ -3504,12 +3504,12 @@ Jr(
|
|
|
3504
3504
|
version: e.version,
|
|
3505
3505
|
definition: e.name,
|
|
3506
3506
|
values: t
|
|
3507
|
-
},
|
|
3508
|
-
alert(
|
|
3507
|
+
}, o = JSON.stringify(n, null, 2);
|
|
3508
|
+
alert(o);
|
|
3509
3509
|
}
|
|
3510
3510
|
);
|
|
3511
|
-
async function pn(e, r, t, n,
|
|
3512
|
-
const s =
|
|
3511
|
+
async function pn(e, r, t, n, o, a, c) {
|
|
3512
|
+
const s = o ? Object.values(o).filter(Boolean) : [];
|
|
3513
3513
|
if (s.length > 0)
|
|
3514
3514
|
return {
|
|
3515
3515
|
success: !1,
|
|
@@ -3580,9 +3580,9 @@ async function pn(e, r, t, n, a, o, c) {
|
|
|
3580
3580
|
};
|
|
3581
3581
|
}
|
|
3582
3582
|
const m = (u) => u ? Array.isArray(u) ? u.map((f) => String(f)) : typeof u == "string" ? u.trim() ? [u] : [] : [String(u)] : [];
|
|
3583
|
-
if (
|
|
3583
|
+
if (a)
|
|
3584
3584
|
try {
|
|
3585
|
-
const u = await
|
|
3585
|
+
const u = await a(e, r?.name ?? null, i, n), f = m(u);
|
|
3586
3586
|
if (f.length > 0)
|
|
3587
3587
|
return {
|
|
3588
3588
|
success: !1,
|
|
@@ -3665,14 +3665,14 @@ const Yr = ({
|
|
|
3665
3665
|
) : null;
|
|
3666
3666
|
Yr.displayName = "SubmissionMessage";
|
|
3667
3667
|
const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
3668
|
-
const [n,
|
|
3668
|
+
const [n, o] = l.useState(!1);
|
|
3669
3669
|
return /* @__PURE__ */ p(
|
|
3670
3670
|
"button",
|
|
3671
3671
|
{
|
|
3672
3672
|
onClick: e,
|
|
3673
3673
|
disabled: r,
|
|
3674
|
-
onMouseEnter: () =>
|
|
3675
|
-
onMouseLeave: () =>
|
|
3674
|
+
onMouseEnter: () => o(!0),
|
|
3675
|
+
onMouseLeave: () => o(!1),
|
|
3676
3676
|
style: {
|
|
3677
3677
|
padding: "var(--reactaform-button-padding, var(--reactaform-space) 12px)",
|
|
3678
3678
|
backgroundColor: r ? "var(--reactaform-button-disabled-bg, #cccccc)" : "var(--reactaform-button-bg, var(--reactaform-success-color))",
|
|
@@ -3695,15 +3695,15 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3695
3695
|
instance: r,
|
|
3696
3696
|
onSubmit: t = void 0,
|
|
3697
3697
|
onValidation: n = void 0,
|
|
3698
|
-
chunkSize:
|
|
3699
|
-
chunkDelay:
|
|
3698
|
+
chunkSize: o = 50,
|
|
3699
|
+
chunkDelay: a = 50
|
|
3700
3700
|
}) => {
|
|
3701
3701
|
const { properties: c, displayName: s } = e, i = B(), { t: d, formStyle: m, language: u, displayInstanceName: f } = i, b = {
|
|
3702
3702
|
...i,
|
|
3703
3703
|
definitionName: e?.name ?? i.definitionName
|
|
3704
3704
|
}, [C, N] = l.useState("en"), [h, y] = l.useState([]), [E, F] = l.useState({}), [M, $] = l.useState(
|
|
3705
3705
|
{}
|
|
3706
|
-
), [R, I] = l.useState({}), [v, g] = l.useState({}), [w, x] = l.useState(null), [k, S] = l.useState(null), [A, j] = l.useState(0), [K, ce] = l.useState(!1), [je,
|
|
3706
|
+
), [R, I] = l.useState({}), [v, g] = l.useState({}), [w, x] = l.useState(null), [k, S] = l.useState(null), [A, j] = l.useState(0), [K, ce] = l.useState(!1), [je, oe] = l.useState(r.name || ""), Y = l.useRef(r), fe = l.useRef(!1);
|
|
3707
3707
|
l.useEffect(() => {
|
|
3708
3708
|
const z = Object.fromEntries(
|
|
3709
3709
|
c.map((L) => [
|
|
@@ -3714,9 +3714,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3714
3714
|
c.forEach((L) => {
|
|
3715
3715
|
L.parents && Object.entries(L.parents).forEach(([Q, re]) => {
|
|
3716
3716
|
const X = z[Q];
|
|
3717
|
-
X && re.forEach((
|
|
3717
|
+
X && re.forEach((at) => {
|
|
3718
3718
|
X.children || (X.children = {});
|
|
3719
|
-
const qe = String(
|
|
3719
|
+
const qe = String(at);
|
|
3720
3720
|
X.children[qe] = [
|
|
3721
3721
|
...X.children[qe] || [],
|
|
3722
3722
|
L.name
|
|
@@ -3739,18 +3739,18 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3739
3739
|
const J = Object.fromEntries(q.map((L) => [L.name, !1])), G = requestAnimationFrame(() => {
|
|
3740
3740
|
y(q), F(z), $(P), I(
|
|
3741
3741
|
cn(q, P, J, z)
|
|
3742
|
-
), ce(!0),
|
|
3742
|
+
), ce(!0), oe(r.name);
|
|
3743
3743
|
});
|
|
3744
3744
|
return () => cancelAnimationFrame(G);
|
|
3745
3745
|
}, [c, r, e]), l.useEffect(() => {
|
|
3746
3746
|
if (!K || A >= h.length) return;
|
|
3747
3747
|
const z = setTimeout(() => {
|
|
3748
3748
|
j(
|
|
3749
|
-
(q) => Math.min(q +
|
|
3749
|
+
(q) => Math.min(q + o, h.length)
|
|
3750
3750
|
);
|
|
3751
|
-
},
|
|
3751
|
+
}, a);
|
|
3752
3752
|
return () => clearTimeout(z);
|
|
3753
|
-
}, [K, A, h.length,
|
|
3753
|
+
}, [K, A, h.length, o, a]);
|
|
3754
3754
|
const Be = l.useCallback(
|
|
3755
3755
|
(z, q) => {
|
|
3756
3756
|
x(null), S(null), $((J) => ({ ...J, [z]: q }));
|
|
@@ -3777,10 +3777,10 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3777
3777
|
let z = 0;
|
|
3778
3778
|
return z = requestAnimationFrame(() => {
|
|
3779
3779
|
if (fe.current) {
|
|
3780
|
-
fe.current = !1, Y.current = r,
|
|
3780
|
+
fe.current = !1, Y.current = r, oe(r.name || "");
|
|
3781
3781
|
return;
|
|
3782
3782
|
}
|
|
3783
|
-
Y.current = r, x(null), S(null),
|
|
3783
|
+
Y.current = r, x(null), S(null), oe(r.name || "");
|
|
3784
3784
|
}), () => cancelAnimationFrame(z);
|
|
3785
3785
|
}, [r, r.name]);
|
|
3786
3786
|
const He = l.useCallback((z, q) => {
|
|
@@ -3806,9 +3806,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3806
3806
|
const P = await pn(e, Y.current, M, d, q, t, n), J = typeof P.message == "string" ? P.message : String(P.message), G = Object.values(P.errors ?? {}).join(`
|
|
3807
3807
|
`);
|
|
3808
3808
|
x(G ? J + `
|
|
3809
|
-
` + G : J), S(P.success), P.success || (Y.current.name = z ?? Y.current.name,
|
|
3810
|
-
},
|
|
3811
|
-
() => b.fieldValidationMode === "realTime" ? Object.values(v).some(Boolean) : !1,
|
|
3809
|
+
` + G : J), S(P.success), P.success || (Y.current.name = z ?? Y.current.name, oe(z ?? ""));
|
|
3810
|
+
}, ot = l.useMemo(
|
|
3811
|
+
() => b.fieldValidationMode === "onEdit" || b.fieldValidationMode === "realTime" ? Object.values(v).some(Boolean) : !1,
|
|
3812
3812
|
[v, b.fieldValidationMode]
|
|
3813
3813
|
);
|
|
3814
3814
|
return /* @__PURE__ */ p(Ee.Provider, { value: b, children: /* @__PURE__ */ D("div", { style: m.container, children: [
|
|
@@ -3829,7 +3829,7 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3829
3829
|
{
|
|
3830
3830
|
name: je,
|
|
3831
3831
|
onChange: (z) => {
|
|
3832
|
-
|
|
3832
|
+
oe(z), x(null), S(null);
|
|
3833
3833
|
}
|
|
3834
3834
|
}
|
|
3835
3835
|
),
|
|
@@ -3872,7 +3872,7 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3872
3872
|
}
|
|
3873
3873
|
)
|
|
3874
3874
|
] }),
|
|
3875
|
-
/* @__PURE__ */ p(gn, { onClick: nt, disabled:
|
|
3875
|
+
/* @__PURE__ */ p(gn, { onClick: nt, disabled: ot, t: d })
|
|
3876
3876
|
] }) });
|
|
3877
3877
|
}, Xr = {
|
|
3878
3878
|
en: { name: "English", nativeName: "English" },
|
|
@@ -3905,15 +3905,15 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3905
3905
|
uk: { name: "Ukrainian", nativeName: "Українська" },
|
|
3906
3906
|
vi: { name: "Vietnamese", nativeName: "Tiếng Việt" },
|
|
3907
3907
|
"zh-tw": { name: "Chinese (Traditional)", nativeName: "繁體中文" }
|
|
3908
|
-
},
|
|
3908
|
+
}, bo = () => Xr, be = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set(), we = /* @__PURE__ */ new Map(), bn = async (e) => {
|
|
3909
3909
|
try {
|
|
3910
3910
|
let r = {};
|
|
3911
3911
|
const t = e.toLowerCase();
|
|
3912
3912
|
if (t === "en")
|
|
3913
3913
|
r = {};
|
|
3914
3914
|
else if (Xr[t]) {
|
|
3915
|
-
const
|
|
3916
|
-
|
|
3915
|
+
const o = `https://reactaform.com/locales/${t}/common.json`, a = await fetch(o);
|
|
3916
|
+
a.ok && (r = await a.json());
|
|
3917
3917
|
} else
|
|
3918
3918
|
r = {};
|
|
3919
3919
|
return {
|
|
@@ -3968,9 +3968,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3968
3968
|
try {
|
|
3969
3969
|
let n = r;
|
|
3970
3970
|
!r.includes("/") && !r.includes(".") && (n = `/locales/${e}/${r}.json`);
|
|
3971
|
-
const
|
|
3972
|
-
if (!
|
|
3973
|
-
return
|
|
3971
|
+
const o = await fetch(n);
|
|
3972
|
+
if (!o.ok)
|
|
3973
|
+
return o.status === 404 ? (le.set(t, {}), we.set(t, {
|
|
3974
3974
|
loadedAt: /* @__PURE__ */ new Date(),
|
|
3975
3975
|
size: 0,
|
|
3976
3976
|
source: "user"
|
|
@@ -3981,14 +3981,14 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3981
3981
|
}) : (te.add(t), {
|
|
3982
3982
|
success: !1,
|
|
3983
3983
|
translations: {},
|
|
3984
|
-
error: `HTTP ${
|
|
3984
|
+
error: `HTTP ${o.status}`,
|
|
3985
3985
|
fromCache: !1
|
|
3986
3986
|
});
|
|
3987
|
-
const
|
|
3988
|
-
!
|
|
3989
|
-
`Translation file at ${n} has unexpected content-type: ${
|
|
3987
|
+
const a = o.headers.get("content-type") || "";
|
|
3988
|
+
!a.includes("application/json") && !a.includes("text/json") && Zr() && console.warn(
|
|
3989
|
+
`Translation file at ${n} has unexpected content-type: ${a}`
|
|
3990
3990
|
);
|
|
3991
|
-
const c = await
|
|
3991
|
+
const c = await o.text();
|
|
3992
3992
|
if (!c) {
|
|
3993
3993
|
const d = "Empty translation file";
|
|
3994
3994
|
return te.add(t), { success: !1, translations: {}, error: d };
|
|
@@ -4024,11 +4024,11 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
4024
4024
|
fromCache: !1
|
|
4025
4025
|
};
|
|
4026
4026
|
} catch (n) {
|
|
4027
|
-
const
|
|
4027
|
+
const o = `Failed to load user translations: ${n instanceof Error ? n.message : "Unknown error"}`;
|
|
4028
4028
|
return te.add(t), {
|
|
4029
4029
|
success: !1,
|
|
4030
4030
|
translations: {},
|
|
4031
|
-
error:
|
|
4031
|
+
error: o
|
|
4032
4032
|
};
|
|
4033
4033
|
}
|
|
4034
4034
|
};
|
|
@@ -4042,15 +4042,15 @@ function Zr() {
|
|
|
4042
4042
|
}
|
|
4043
4043
|
function xn(e, r) {
|
|
4044
4044
|
return r.length === 0 ? e : e.replace(/\{\{(\d+)\}\}/g, (t, n) => {
|
|
4045
|
-
const
|
|
4046
|
-
return
|
|
4045
|
+
const o = parseInt(n, 10) - 1, a = r[o];
|
|
4046
|
+
return a == null ? t : String(a);
|
|
4047
4047
|
});
|
|
4048
4048
|
}
|
|
4049
|
-
const wn = (e, r, t) => (n, ...
|
|
4050
|
-
let
|
|
4051
|
-
return !n || typeof n != "string" ? String(n || "") : (e.toLowerCase() === "en" ? (
|
|
4049
|
+
const wn = (e, r, t) => (n, ...o) => {
|
|
4050
|
+
let a = n, c = !1;
|
|
4051
|
+
return !n || typeof n != "string" ? String(n || "") : (e.toLowerCase() === "en" ? (a = n, c = !0) : n in t ? (a = t[n], c = !0) : n in r ? (a = r[n], c = !0) : a = n, a = xn(a, o), !c && Zr() && console.debug(
|
|
4052
4052
|
`Missing translation for "${n}" in language "${e}"`
|
|
4053
|
-
),
|
|
4053
|
+
), a);
|
|
4054
4054
|
};
|
|
4055
4055
|
function Sn(e) {
|
|
4056
4056
|
return /^[-+]?\d*$/.test(e);
|
|
@@ -4065,26 +4065,26 @@ const Nn = ",", kn = (e) => !e || e.trim() === "" ? [] : e.split(Nn).map((r) =>
|
|
|
4065
4065
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4066
4066
|
if (!Sn(n))
|
|
4067
4067
|
return t("Must be a valid integer");
|
|
4068
|
-
const
|
|
4069
|
-
if (Number.isNaN(
|
|
4070
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
4068
|
+
const o = parseInt(n, 10);
|
|
4069
|
+
if (Number.isNaN(o)) return t("Must be a valid integer");
|
|
4070
|
+
if (e.min !== void 0 && (e.minInclusive ? o < e.min : o <= e.min))
|
|
4071
4071
|
return t(
|
|
4072
4072
|
"Must be {{1}} {{2}}",
|
|
4073
4073
|
e.minInclusive ? "≥" : ">",
|
|
4074
4074
|
e.min
|
|
4075
4075
|
);
|
|
4076
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
4076
|
+
if (e.max !== void 0 && (e.maxInclusive ? o > e.max : o >= e.max))
|
|
4077
4077
|
return t(
|
|
4078
4078
|
"Must be {{1}} {{2}}",
|
|
4079
4079
|
e.maxInclusive ? "≤" : "<",
|
|
4080
4080
|
e.max
|
|
4081
4081
|
);
|
|
4082
4082
|
if (e.step !== void 0) {
|
|
4083
|
-
const
|
|
4084
|
-
if (!Number.isInteger(
|
|
4083
|
+
const a = Number(e.step);
|
|
4084
|
+
if (!Number.isInteger(a))
|
|
4085
4085
|
return t("Invalid step value");
|
|
4086
|
-
if (
|
|
4087
|
-
return t("Must be a multiple of {{1}}",
|
|
4086
|
+
if (o % a !== 0)
|
|
4087
|
+
return t("Must be a multiple of {{1}}", a);
|
|
4088
4088
|
}
|
|
4089
4089
|
};
|
|
4090
4090
|
function In(e, r, t) {
|
|
@@ -4093,19 +4093,19 @@ function In(e, r, t) {
|
|
|
4093
4093
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4094
4094
|
if (!Cn(n))
|
|
4095
4095
|
return t("Each value must be a valid integer");
|
|
4096
|
-
const
|
|
4097
|
-
if (e.minCount !== void 0 &&
|
|
4096
|
+
const o = kn(n);
|
|
4097
|
+
if (e.minCount !== void 0 && o.length < e.minCount)
|
|
4098
4098
|
return t("Minimum number of values: {{1}}", `${e.minCount}`);
|
|
4099
|
-
if (e.maxCount !== void 0 &&
|
|
4099
|
+
if (e.maxCount !== void 0 && o.length > e.maxCount)
|
|
4100
4100
|
return t("Maximum number of values: {{1}}", `${e.maxCount}`);
|
|
4101
|
-
for (const
|
|
4102
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
4101
|
+
for (const a of o) {
|
|
4102
|
+
if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
|
|
4103
4103
|
return t(
|
|
4104
4104
|
"Each value must be {{1}} {{2}}",
|
|
4105
4105
|
e.minInclusive ? "≥" : ">",
|
|
4106
4106
|
e.min
|
|
4107
4107
|
);
|
|
4108
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
4108
|
+
if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
|
|
4109
4109
|
return t(
|
|
4110
4110
|
"Each value must be {{1}} {{2}}",
|
|
4111
4111
|
e.maxInclusive ? "≤" : "<",
|
|
@@ -4117,23 +4117,23 @@ function Qr(e, r, t) {
|
|
|
4117
4117
|
const n = String(r);
|
|
4118
4118
|
if (n.trim() === "")
|
|
4119
4119
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4120
|
-
const
|
|
4121
|
-
if (Number.isNaN(
|
|
4120
|
+
const o = Number(n);
|
|
4121
|
+
if (Number.isNaN(o)) return t("Must be a valid float");
|
|
4122
4122
|
if (e.min !== void 0) {
|
|
4123
|
-
const
|
|
4124
|
-
if (
|
|
4123
|
+
const a = e.type === "slider" ? !0 : e.minInclusive ?? !0;
|
|
4124
|
+
if (a ? o < e.min : o <= e.min)
|
|
4125
4125
|
return t(
|
|
4126
4126
|
"Must be {{1}} {{2}}",
|
|
4127
|
-
|
|
4127
|
+
a ? "≥" : ">",
|
|
4128
4128
|
e.min
|
|
4129
4129
|
);
|
|
4130
4130
|
}
|
|
4131
4131
|
if (e.max !== void 0) {
|
|
4132
|
-
const
|
|
4133
|
-
if (
|
|
4132
|
+
const a = e.type === "slider" ? !0 : e.maxInclusive ?? !0;
|
|
4133
|
+
if (a ? o > e.max : o >= e.max)
|
|
4134
4134
|
return t(
|
|
4135
4135
|
"Must be {{1}} {{2}}",
|
|
4136
|
-
|
|
4136
|
+
a ? "≤" : "<",
|
|
4137
4137
|
e.max
|
|
4138
4138
|
);
|
|
4139
4139
|
}
|
|
@@ -4149,19 +4149,19 @@ function Vn(e, r, t) {
|
|
|
4149
4149
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4150
4150
|
if (!Mn(n))
|
|
4151
4151
|
return t("Each value must be a valid float");
|
|
4152
|
-
const
|
|
4153
|
-
if (e.minCount !== void 0 &&
|
|
4152
|
+
const o = $n(n);
|
|
4153
|
+
if (e.minCount !== void 0 && o.length < e.minCount)
|
|
4154
4154
|
return t("Minimum number of values: {{1}}", e.minCount);
|
|
4155
|
-
if (e.maxCount !== void 0 &&
|
|
4155
|
+
if (e.maxCount !== void 0 && o.length > e.maxCount)
|
|
4156
4156
|
return t("Maximum number of values: {{1}}", e.maxCount);
|
|
4157
|
-
for (const
|
|
4158
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
4157
|
+
for (const a of o) {
|
|
4158
|
+
if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
|
|
4159
4159
|
return t(
|
|
4160
4160
|
"Each value must be {{1}} {{2}}",
|
|
4161
4161
|
e.minInclusive ? "≥" : ">",
|
|
4162
4162
|
e.min
|
|
4163
4163
|
);
|
|
4164
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
4164
|
+
if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
|
|
4165
4165
|
return t(
|
|
4166
4166
|
"Each value must be {{1}} {{2}}",
|
|
4167
4167
|
e.maxInclusive ? "≤" : "<",
|
|
@@ -4170,10 +4170,10 @@ function Vn(e, r, t) {
|
|
|
4170
4170
|
}
|
|
4171
4171
|
}
|
|
4172
4172
|
const ye = /* @__PURE__ */ new WeakMap();
|
|
4173
|
-
function Oe(e, r, t, n, ...
|
|
4173
|
+
function Oe(e, r, t, n, ...o) {
|
|
4174
4174
|
if (e.pattern == null)
|
|
4175
4175
|
return;
|
|
4176
|
-
const
|
|
4176
|
+
const a = String(r);
|
|
4177
4177
|
let c = null;
|
|
4178
4178
|
if (e.pattern) {
|
|
4179
4179
|
const s = ye.get(e);
|
|
@@ -4187,15 +4187,15 @@ function Oe(e, r, t, n, ...a) {
|
|
|
4187
4187
|
ye.set(e, { pattern: e.pattern, regex: null }), c = null;
|
|
4188
4188
|
}
|
|
4189
4189
|
}
|
|
4190
|
-
if (c && !c.test(
|
|
4191
|
-
return e.patternErrorMessage ? t(e.patternErrorMessage) : n ? t(n, ...
|
|
4190
|
+
if (c && !c.test(a))
|
|
4191
|
+
return e.patternErrorMessage ? t(e.patternErrorMessage) : n ? t(n, ...o) : t("Input does not match pattern: {{1}}", e.pattern);
|
|
4192
4192
|
}
|
|
4193
4193
|
function ue(e, r, t) {
|
|
4194
4194
|
const n = String(r);
|
|
4195
4195
|
if (n === "")
|
|
4196
4196
|
return e.minLength !== void 0 || e.maxLength !== void 0 ? e.required ? t("Value required when minLength or maxLength is set") : void 0 : e.required ? t("Value required") : void 0;
|
|
4197
|
-
const
|
|
4198
|
-
return n.length <
|
|
4197
|
+
const o = Math.max(e.minLength ?? 0, 0);
|
|
4198
|
+
return n.length < o ? t("Must be at least {{1}} characters", o) : e.maxLength !== void 0 && n.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : Oe(e, r, t, "Invalid text format");
|
|
4199
4199
|
}
|
|
4200
4200
|
const Se = (e) => {
|
|
4201
4201
|
if (!e) return null;
|
|
@@ -4211,20 +4211,20 @@ const Se = (e) => {
|
|
|
4211
4211
|
function Rn(e, r, t) {
|
|
4212
4212
|
if (r == null || String(r).trim() === "")
|
|
4213
4213
|
return e.required ? t("Value required") : void 0;
|
|
4214
|
-
const n = String(r).trim(),
|
|
4215
|
-
if (
|
|
4214
|
+
const n = String(r).trim(), o = Se(n);
|
|
4215
|
+
if (o === null)
|
|
4216
4216
|
return t("Invalid date format");
|
|
4217
|
-
const { minTime:
|
|
4218
|
-
if (
|
|
4217
|
+
const { minTime: a, maxTime: c } = An(e);
|
|
4218
|
+
if (a !== null && o < a)
|
|
4219
4219
|
return t("Date must be on or after {{1}}", e.minDate);
|
|
4220
|
-
if (c !== null &&
|
|
4220
|
+
if (c !== null && o > c)
|
|
4221
4221
|
return t("Date must be on or before {{1}}", e.maxDate);
|
|
4222
4222
|
}
|
|
4223
4223
|
function Dn(e, r, t) {
|
|
4224
4224
|
const n = String(r);
|
|
4225
4225
|
if (!n || n.trim() === "")
|
|
4226
4226
|
return e.required || e.min || e.max ? t("Value required") : void 0;
|
|
4227
|
-
const
|
|
4227
|
+
const o = (c) => {
|
|
4228
4228
|
const s = c.split(":").map((m) => parseInt(m, 10));
|
|
4229
4229
|
if (s.some((m) => Number.isNaN(m))) return NaN;
|
|
4230
4230
|
const i = s.length;
|
|
@@ -4241,16 +4241,16 @@ function Dn(e, r, t) {
|
|
|
4241
4241
|
else
|
|
4242
4242
|
return NaN;
|
|
4243
4243
|
return d;
|
|
4244
|
-
},
|
|
4245
|
-
if (Number.isNaN(
|
|
4244
|
+
}, a = o(n);
|
|
4245
|
+
if (Number.isNaN(a)) return t("Invalid time format");
|
|
4246
4246
|
if (e.min && typeof e.min == "string") {
|
|
4247
|
-
const c =
|
|
4248
|
-
if (!Number.isNaN(c) &&
|
|
4247
|
+
const c = o(e.min);
|
|
4248
|
+
if (!Number.isNaN(c) && a < c)
|
|
4249
4249
|
return t("Time must be on or after {{1}}", e.min);
|
|
4250
4250
|
}
|
|
4251
4251
|
if (e.max && typeof e.max == "string") {
|
|
4252
|
-
const c =
|
|
4253
|
-
if (!Number.isNaN(c) &&
|
|
4252
|
+
const c = o(e.max);
|
|
4253
|
+
if (!Number.isNaN(c) && a > c)
|
|
4254
4254
|
return t("Time must be on or before {{1}}", e.max);
|
|
4255
4255
|
}
|
|
4256
4256
|
}
|
|
@@ -4291,8 +4291,8 @@ function jn(e, r, t) {
|
|
|
4291
4291
|
}
|
|
4292
4292
|
}
|
|
4293
4293
|
function Bn(e, r, t) {
|
|
4294
|
-
const n = Array.isArray(r) ? r : [],
|
|
4295
|
-
return String(
|
|
4294
|
+
const n = Array.isArray(r) ? r : [], o = n[0], a = n[1] ? String(n[1]).trim() : "";
|
|
4295
|
+
return String(o ?? "").trim() === "" || a === "" ? e.required ? t("Value required") : void 0 : Qr(e, o, t);
|
|
4296
4296
|
}
|
|
4297
4297
|
function Hn(e, r, t) {
|
|
4298
4298
|
if (Array.isArray(r))
|
|
@@ -4306,17 +4306,17 @@ function qn(e, r, t) {
|
|
|
4306
4306
|
const n = String(r);
|
|
4307
4307
|
if (n === "" || n === null || n === void 0)
|
|
4308
4308
|
return e.required ? t("Value required") : void 0;
|
|
4309
|
-
if (!e.options?.some((
|
|
4309
|
+
if (!e.options?.some((o) => String(o.value) === n))
|
|
4310
4310
|
return t("Invalid option selected");
|
|
4311
4311
|
}
|
|
4312
4312
|
function Un(e, r, t) {
|
|
4313
|
-
const
|
|
4314
|
-
if (
|
|
4313
|
+
const o = String(r ?? "").trim();
|
|
4314
|
+
if (o === "")
|
|
4315
4315
|
return e.required ? t("Value required") : void 0;
|
|
4316
|
-
const
|
|
4317
|
-
if (
|
|
4316
|
+
const a = o.split(",").map((c) => c.trim()).filter((c) => c !== "");
|
|
4317
|
+
if (a.length === 0)
|
|
4318
4318
|
return e.required ? t("Value required") : void 0;
|
|
4319
|
-
for (const c of
|
|
4319
|
+
for (const c of a)
|
|
4320
4320
|
if (!e.options?.some((s) => String(s.value) === c))
|
|
4321
4321
|
return t("Invalid option selected");
|
|
4322
4322
|
}
|
|
@@ -4332,22 +4332,22 @@ function Gn(e, r, t) {
|
|
|
4332
4332
|
const n = String(r ?? "").trim();
|
|
4333
4333
|
if (n === "")
|
|
4334
4334
|
return e.required ? t("Value required") : void 0;
|
|
4335
|
-
let
|
|
4336
|
-
if (typeof r != "number" && (
|
|
4335
|
+
let o = r;
|
|
4336
|
+
if (typeof r != "number" && (o = parseFloat(n)), Number.isNaN(o) || o <= 0)
|
|
4337
4337
|
return t("Invalid value");
|
|
4338
|
-
if (e.max !== void 0 &&
|
|
4338
|
+
if (e.max !== void 0 && o > e.max)
|
|
4339
4339
|
return t("Must be ≤ {{1}}", e.max);
|
|
4340
4340
|
}
|
|
4341
4341
|
function Jn(e, r, t) {
|
|
4342
4342
|
const n = String(r);
|
|
4343
4343
|
if (n.trim() === "")
|
|
4344
4344
|
return e.required ? t("Value required") : void 0;
|
|
4345
|
-
const
|
|
4346
|
-
if (Number.isNaN(
|
|
4347
|
-
const
|
|
4348
|
-
if (
|
|
4349
|
-
return t("Must be ≥ {{1}}",
|
|
4350
|
-
if (
|
|
4345
|
+
const o = Number(n);
|
|
4346
|
+
if (Number.isNaN(o)) return t("Must be a valid float");
|
|
4347
|
+
const a = e.min ?? 0, c = e.max ?? 100;
|
|
4348
|
+
if (o < a)
|
|
4349
|
+
return t("Must be ≥ {{1}}", a);
|
|
4350
|
+
if (o > c)
|
|
4351
4351
|
return t("Must be ≤ {{1}}", c);
|
|
4352
4352
|
}
|
|
4353
4353
|
let Qe = !1;
|
|
@@ -4462,13 +4462,13 @@ const Yn = (e) => ({
|
|
|
4462
4462
|
definitionName: r = "",
|
|
4463
4463
|
defaultStyle: t,
|
|
4464
4464
|
defaultLanguage: n = "en",
|
|
4465
|
-
defaultTheme:
|
|
4466
|
-
defaultLocalizeName:
|
|
4467
|
-
defaultFieldValidationMode: c = "
|
|
4465
|
+
defaultTheme: o = "light",
|
|
4466
|
+
defaultLocalizeName: a = "",
|
|
4467
|
+
defaultFieldValidationMode: c = "onEdit",
|
|
4468
4468
|
className: s = "reactaform-container",
|
|
4469
4469
|
defaultDisplayInstanceName: i = !0
|
|
4470
4470
|
}) => {
|
|
4471
|
-
const d = r, m =
|
|
4471
|
+
const d = r, m = a, u = o, f = n, b = l.useMemo(
|
|
4472
4472
|
() => t ?? {},
|
|
4473
4473
|
[t]
|
|
4474
4474
|
), [C, N] = l.useState({}), [h, y] = l.useState({});
|
|
@@ -4557,7 +4557,7 @@ function Qn(e) {
|
|
|
4557
4557
|
}
|
|
4558
4558
|
return null;
|
|
4559
4559
|
}
|
|
4560
|
-
async function
|
|
4560
|
+
async function yo(e, r = {}) {
|
|
4561
4561
|
const { validateSchema: t = !0 } = r;
|
|
4562
4562
|
try {
|
|
4563
4563
|
if (!e || typeof e != "string")
|
|
@@ -4565,26 +4565,26 @@ async function ba(e, r = {}) {
|
|
|
4565
4565
|
const n = e.trim();
|
|
4566
4566
|
if (!n)
|
|
4567
4567
|
return { success: !1, error: "jsonData is empty" };
|
|
4568
|
-
let
|
|
4568
|
+
let o;
|
|
4569
4569
|
try {
|
|
4570
|
-
|
|
4571
|
-
} catch (
|
|
4570
|
+
o = JSON.parse(n);
|
|
4571
|
+
} catch (a) {
|
|
4572
4572
|
return {
|
|
4573
4573
|
success: !1,
|
|
4574
|
-
error: `Invalid JSON format: ${
|
|
4574
|
+
error: `Invalid JSON format: ${a instanceof Error ? a.message : "Unknown parsing error"}`
|
|
4575
4575
|
};
|
|
4576
4576
|
}
|
|
4577
4577
|
if (t) {
|
|
4578
|
-
const
|
|
4579
|
-
if (
|
|
4580
|
-
return { success: !1, error: `Schema validation failed: ${
|
|
4578
|
+
const a = Qn(o);
|
|
4579
|
+
if (a)
|
|
4580
|
+
return { success: !1, error: `Schema validation failed: ${a}` };
|
|
4581
4581
|
}
|
|
4582
|
-
return { success: !0, definition:
|
|
4582
|
+
return { success: !0, definition: o };
|
|
4583
4583
|
} catch (n) {
|
|
4584
4584
|
return { success: !1, error: `Unexpected error loading definition: ${n instanceof Error ? n.message : "Unknown error"}` };
|
|
4585
4585
|
}
|
|
4586
4586
|
}
|
|
4587
|
-
function
|
|
4587
|
+
function eo(e, r) {
|
|
4588
4588
|
try {
|
|
4589
4589
|
if (!e)
|
|
4590
4590
|
return { success: !1, error: "Definition is required" };
|
|
@@ -4596,13 +4596,13 @@ function ea(e, r) {
|
|
|
4596
4596
|
version: e.version ?? "1.0.0",
|
|
4597
4597
|
values: {}
|
|
4598
4598
|
}, n = e.properties || [];
|
|
4599
|
-
return Array.isArray(n) && n.forEach((
|
|
4600
|
-
const
|
|
4601
|
-
if (
|
|
4602
|
-
const c =
|
|
4603
|
-
t.values[
|
|
4599
|
+
return Array.isArray(n) && n.forEach((o) => {
|
|
4600
|
+
const a = o;
|
|
4601
|
+
if (a.type === "unit") {
|
|
4602
|
+
const c = a.defaultUnit, s = Number(a.defaultValue) || void 0;
|
|
4603
|
+
t.values[a.name] = [s || 0, c || "m"];
|
|
4604
4604
|
} else
|
|
4605
|
-
|
|
4605
|
+
a.defaultValue !== void 0 && (t.values[a.name] = a.defaultValue);
|
|
4606
4606
|
}), { success: !0, instance: t };
|
|
4607
4607
|
} catch (t) {
|
|
4608
4608
|
return {
|
|
@@ -4611,7 +4611,7 @@ function ea(e, r) {
|
|
|
4611
4611
|
};
|
|
4612
4612
|
}
|
|
4613
4613
|
}
|
|
4614
|
-
function
|
|
4614
|
+
function vo(e) {
|
|
4615
4615
|
try {
|
|
4616
4616
|
if (!e)
|
|
4617
4617
|
return { success: !1, error: "Instance data is required" };
|
|
@@ -4635,7 +4635,7 @@ function ya(e) {
|
|
|
4635
4635
|
};
|
|
4636
4636
|
}
|
|
4637
4637
|
}
|
|
4638
|
-
function
|
|
4638
|
+
function xo(e, r, t) {
|
|
4639
4639
|
try {
|
|
4640
4640
|
if (!e)
|
|
4641
4641
|
return { success: !1, error: "Instance is required" };
|
|
@@ -4648,9 +4648,9 @@ function va(e, r, t) {
|
|
|
4648
4648
|
definition: r.name,
|
|
4649
4649
|
version: r.version,
|
|
4650
4650
|
values: {}
|
|
4651
|
-
},
|
|
4651
|
+
}, o = n.values, a = {};
|
|
4652
4652
|
(r.properties || []).forEach((i) => {
|
|
4653
|
-
|
|
4653
|
+
a[i.name] = i;
|
|
4654
4654
|
});
|
|
4655
4655
|
const c = (i, d, m) => {
|
|
4656
4656
|
if (i == null) return i;
|
|
@@ -4695,14 +4695,14 @@ function va(e, r, t) {
|
|
|
4695
4695
|
return i;
|
|
4696
4696
|
}, s = e.values || {};
|
|
4697
4697
|
Object.keys(s).forEach((i) => {
|
|
4698
|
-
const d = s[i], m =
|
|
4698
|
+
const d = s[i], m = a[i];
|
|
4699
4699
|
if (!m)
|
|
4700
4700
|
return;
|
|
4701
4701
|
const u = Array.isArray(d) ? "array" : d === null ? "null" : typeof d, f = (m.type || "").toLowerCase();
|
|
4702
|
-
u === f || f === "string" && typeof d == "string" ?
|
|
4702
|
+
u === f || f === "string" && typeof d == "string" ? o[i] = d : o[i] = c(d, f, m);
|
|
4703
4703
|
}), (r.properties || []).forEach((i) => {
|
|
4704
4704
|
const d = i.name;
|
|
4705
|
-
d in
|
|
4705
|
+
d in o || (o[d] = i.defaultValue);
|
|
4706
4706
|
});
|
|
4707
4707
|
try {
|
|
4708
4708
|
typeof t == "function" && t?.(e, n, r);
|
|
@@ -4717,30 +4717,30 @@ function va(e, r, t) {
|
|
|
4717
4717
|
};
|
|
4718
4718
|
}
|
|
4719
4719
|
}
|
|
4720
|
-
function
|
|
4720
|
+
function ro(e) {
|
|
4721
4721
|
const [r, t] = l.useState(null);
|
|
4722
4722
|
return l.useEffect(() => {
|
|
4723
4723
|
const n = document.querySelector("[data-reactaform-theme]");
|
|
4724
4724
|
if (!n) return;
|
|
4725
|
-
const
|
|
4726
|
-
if (!
|
|
4727
|
-
const
|
|
4728
|
-
|
|
4725
|
+
const o = n.closest("[data-reactaform-theme]");
|
|
4726
|
+
if (!o) return;
|
|
4727
|
+
const a = () => t(o.getAttribute("data-reactaform-theme"));
|
|
4728
|
+
a();
|
|
4729
4729
|
const c = new MutationObserver((s) => {
|
|
4730
4730
|
for (const i of s)
|
|
4731
|
-
i.type === "attributes" && i.attributeName === "data-reactaform-theme" &&
|
|
4731
|
+
i.type === "attributes" && i.attributeName === "data-reactaform-theme" && a();
|
|
4732
4732
|
});
|
|
4733
|
-
return c.observe(
|
|
4733
|
+
return c.observe(o, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => c.disconnect();
|
|
4734
4734
|
}, [e]), r;
|
|
4735
4735
|
}
|
|
4736
|
-
const
|
|
4736
|
+
const wo = ({
|
|
4737
4737
|
definitionData: e,
|
|
4738
4738
|
instance: r,
|
|
4739
4739
|
language: t,
|
|
4740
4740
|
className: n,
|
|
4741
|
-
theme:
|
|
4742
|
-
style:
|
|
4743
|
-
fieldValidationMode: c = "
|
|
4741
|
+
theme: o,
|
|
4742
|
+
style: a,
|
|
4743
|
+
fieldValidationMode: c = "onEdit",
|
|
4744
4744
|
displayInstanceName: s = !0,
|
|
4745
4745
|
onSubmit: i = void 0,
|
|
4746
4746
|
onValidation: d = void 0
|
|
@@ -4751,7 +4751,7 @@ const xa = ({
|
|
|
4751
4751
|
} catch {
|
|
4752
4752
|
return null;
|
|
4753
4753
|
}
|
|
4754
|
-
}, [e]), u = { fontSize: "inherit", fontFamily: "inherit", ...
|
|
4754
|
+
}, [e]), u = { fontSize: "inherit", fontFamily: "inherit", ...a }, f = ro(), b = o ?? f ?? "light", C = t ?? "en";
|
|
4755
4755
|
l.useEffect(() => {
|
|
4756
4756
|
let h = document.getElementById("popup-root");
|
|
4757
4757
|
h || (h = document.createElement("div"), h.id = "popup-root", document.body.appendChild(h));
|
|
@@ -4759,7 +4759,7 @@ const xa = ({
|
|
|
4759
4759
|
const N = l.useMemo(() => {
|
|
4760
4760
|
if (r) return r;
|
|
4761
4761
|
if (!m) return null;
|
|
4762
|
-
const h =
|
|
4762
|
+
const h = eo(m, m.name);
|
|
4763
4763
|
return !h.success || !h.instance ? null : h.instance;
|
|
4764
4764
|
}, [r, m]);
|
|
4765
4765
|
return m ? N ? /* @__PURE__ */ p(
|
|
@@ -4813,73 +4813,73 @@ function rt(e, r, t) {
|
|
|
4813
4813
|
return !1;
|
|
4814
4814
|
}
|
|
4815
4815
|
}
|
|
4816
|
-
function
|
|
4816
|
+
function to(e) {
|
|
4817
4817
|
const r = [];
|
|
4818
4818
|
if (e.components)
|
|
4819
4819
|
for (const t of Object.keys(e.components)) {
|
|
4820
4820
|
const n = _r(t);
|
|
4821
4821
|
if (n) {
|
|
4822
|
-
let
|
|
4823
|
-
for (const [
|
|
4822
|
+
let o;
|
|
4823
|
+
for (const [a, c] of Z)
|
|
4824
4824
|
if (c.components && c.components[t] === n) {
|
|
4825
|
-
|
|
4825
|
+
o = a;
|
|
4826
4826
|
break;
|
|
4827
4827
|
}
|
|
4828
|
-
|
|
4828
|
+
o && o !== e.name && r.push({
|
|
4829
4829
|
type: "component",
|
|
4830
4830
|
name: t,
|
|
4831
|
-
existingPlugin:
|
|
4831
|
+
existingPlugin: o,
|
|
4832
4832
|
newPlugin: e.name
|
|
4833
4833
|
});
|
|
4834
4834
|
}
|
|
4835
4835
|
}
|
|
4836
4836
|
if (e.fieldCustomValidators)
|
|
4837
4837
|
for (const [t, n] of Object.entries(e.fieldCustomValidators))
|
|
4838
|
-
for (const
|
|
4839
|
-
const c = W.fieldValidators.get(t)?.get(
|
|
4840
|
-
ur(t,
|
|
4838
|
+
for (const o of Object.keys(n)) {
|
|
4839
|
+
const c = W.fieldValidators.get(t)?.get(o);
|
|
4840
|
+
ur(t, o) && c && c !== e.name && r.push({
|
|
4841
4841
|
type: "fieldCustomValidator",
|
|
4842
|
-
name: `${t}:${
|
|
4842
|
+
name: `${t}:${o}`,
|
|
4843
4843
|
existingPlugin: c,
|
|
4844
4844
|
newPlugin: e.name
|
|
4845
4845
|
});
|
|
4846
4846
|
}
|
|
4847
4847
|
if (e.fieldTypeValidators)
|
|
4848
4848
|
for (const t of Object.keys(e.fieldTypeValidators)) {
|
|
4849
|
-
const n = dr(t),
|
|
4850
|
-
n &&
|
|
4849
|
+
const n = dr(t), o = W.fieldTypeValidators.get(t);
|
|
4850
|
+
n && o && o !== e.name && r.push({
|
|
4851
4851
|
type: "fieldTypeValidator",
|
|
4852
4852
|
name: `type:${t}`,
|
|
4853
|
-
existingPlugin:
|
|
4853
|
+
existingPlugin: o,
|
|
4854
4854
|
newPlugin: e.name
|
|
4855
4855
|
});
|
|
4856
4856
|
}
|
|
4857
4857
|
if (e.formValidators)
|
|
4858
4858
|
for (const t of Object.keys(e.formValidators)) {
|
|
4859
|
-
const n = mr(t),
|
|
4860
|
-
n &&
|
|
4859
|
+
const n = mr(t), o = W.formValidators.get(t);
|
|
4860
|
+
n && o && o !== e.name && r.push({
|
|
4861
4861
|
type: "formValidator",
|
|
4862
4862
|
name: t,
|
|
4863
|
-
existingPlugin:
|
|
4863
|
+
existingPlugin: o,
|
|
4864
4864
|
newPlugin: e.name
|
|
4865
4865
|
});
|
|
4866
4866
|
}
|
|
4867
4867
|
if (e.submissionHandlers)
|
|
4868
4868
|
for (const t of Object.keys(e.submissionHandlers)) {
|
|
4869
|
-
const n = fn(t),
|
|
4870
|
-
n &&
|
|
4869
|
+
const n = fn(t), o = W.submissionHandlers.get(t);
|
|
4870
|
+
n && o && o !== e.name && r.push({
|
|
4871
4871
|
type: "submissionHandler",
|
|
4872
4872
|
name: t,
|
|
4873
|
-
existingPlugin:
|
|
4873
|
+
existingPlugin: o,
|
|
4874
4874
|
newPlugin: e.name
|
|
4875
4875
|
});
|
|
4876
4876
|
}
|
|
4877
4877
|
return r;
|
|
4878
4878
|
}
|
|
4879
|
-
function
|
|
4879
|
+
function ae(e, r, t, n, o, a, c, s) {
|
|
4880
4880
|
for (const i of Object.keys(e)) {
|
|
4881
4881
|
let d;
|
|
4882
|
-
if (s ? d =
|
|
4882
|
+
if (s ? d = o.find((m) => m.type === "fieldCustomValidator" && m.name === `${s}:${i}`) : e === n.components ? d = o.find((m) => m.type === "component" && m.name === i) : e === n.formValidators ? d = o.find((m) => m.type === "formValidator" && m.name === i) : e === n.fieldTypeValidators ? d = o.find((m) => m.type === "fieldTypeValidator" && m.name === `type:${i}`) : e === n.submissionHandlers && (d = o.find((m) => m.type === "submissionHandler" && m.name === i)), rt(d || null, a, c))
|
|
4883
4883
|
if (s) {
|
|
4884
4884
|
const m = r.get(s) || /* @__PURE__ */ new Map();
|
|
4885
4885
|
m.set(i, n.name), r.set(s, m), t(i, e[i]);
|
|
@@ -4890,19 +4890,19 @@ function oe(e, r, t, n, a, o, c, s) {
|
|
|
4890
4890
|
) : r.set(i, n.name), t(i, e[i]);
|
|
4891
4891
|
}
|
|
4892
4892
|
}
|
|
4893
|
-
function
|
|
4893
|
+
function So(e, r) {
|
|
4894
4894
|
const t = r?.conflictResolution || "error";
|
|
4895
4895
|
if (Z.has(e.name)) {
|
|
4896
|
-
const
|
|
4896
|
+
const o = {
|
|
4897
4897
|
type: "plugin",
|
|
4898
4898
|
name: e.name,
|
|
4899
4899
|
existingPlugin: e.name,
|
|
4900
4900
|
newPlugin: e.name
|
|
4901
4901
|
};
|
|
4902
|
-
if (!rt(
|
|
4902
|
+
if (!rt(o, t, r?.onConflict)) return;
|
|
4903
4903
|
}
|
|
4904
|
-
const n =
|
|
4905
|
-
if (e.components &&
|
|
4904
|
+
const n = to(e);
|
|
4905
|
+
if (e.components && ae(
|
|
4906
4906
|
e.components,
|
|
4907
4907
|
W.components,
|
|
4908
4908
|
Wr,
|
|
@@ -4911,18 +4911,18 @@ function wa(e, r) {
|
|
|
4911
4911
|
t,
|
|
4912
4912
|
r?.onConflict
|
|
4913
4913
|
), e.fieldCustomValidators)
|
|
4914
|
-
for (const [
|
|
4915
|
-
|
|
4916
|
-
|
|
4914
|
+
for (const [o, a] of Object.entries(e.fieldCustomValidators))
|
|
4915
|
+
ae(
|
|
4916
|
+
a,
|
|
4917
4917
|
W.fieldValidators,
|
|
4918
|
-
(c, s) => gt(
|
|
4918
|
+
(c, s) => gt(o, c, s),
|
|
4919
4919
|
e,
|
|
4920
4920
|
n,
|
|
4921
4921
|
t,
|
|
4922
4922
|
r?.onConflict,
|
|
4923
|
-
|
|
4923
|
+
o
|
|
4924
4924
|
);
|
|
4925
|
-
e.formValidators &&
|
|
4925
|
+
e.formValidators && ae(
|
|
4926
4926
|
e.formValidators,
|
|
4927
4927
|
W.formValidators,
|
|
4928
4928
|
pt,
|
|
@@ -4930,7 +4930,7 @@ function wa(e, r) {
|
|
|
4930
4930
|
n,
|
|
4931
4931
|
t,
|
|
4932
4932
|
r?.onConflict
|
|
4933
|
-
), e.fieldTypeValidators &&
|
|
4933
|
+
), e.fieldTypeValidators && ae(
|
|
4934
4934
|
e.fieldTypeValidators,
|
|
4935
4935
|
W.fieldTypeValidators,
|
|
4936
4936
|
ht,
|
|
@@ -4938,7 +4938,7 @@ function wa(e, r) {
|
|
|
4938
4938
|
n,
|
|
4939
4939
|
t,
|
|
4940
4940
|
r?.onConflict
|
|
4941
|
-
), e.submissionHandlers &&
|
|
4941
|
+
), e.submissionHandlers && ae(
|
|
4942
4942
|
e.submissionHandlers,
|
|
4943
4943
|
W.submissionHandlers,
|
|
4944
4944
|
Jr,
|
|
@@ -4948,7 +4948,7 @@ function wa(e, r) {
|
|
|
4948
4948
|
r?.onConflict
|
|
4949
4949
|
), e.setup && e.setup(), Z.set(e.name, e);
|
|
4950
4950
|
}
|
|
4951
|
-
function
|
|
4951
|
+
function Co(e, r = !1) {
|
|
4952
4952
|
const t = Z.get(e);
|
|
4953
4953
|
if (!t) return !1;
|
|
4954
4954
|
if (t.cleanup && t.cleanup(), r) {
|
|
@@ -4956,12 +4956,12 @@ function Sa(e, r = !1) {
|
|
|
4956
4956
|
for (const n of Object.keys(t.components))
|
|
4957
4957
|
W.components.delete(n);
|
|
4958
4958
|
if (t.fieldCustomValidators)
|
|
4959
|
-
for (const [n,
|
|
4960
|
-
const
|
|
4961
|
-
if (
|
|
4962
|
-
for (const c of Object.keys(
|
|
4963
|
-
|
|
4964
|
-
|
|
4959
|
+
for (const [n, o] of Object.entries(t.fieldCustomValidators)) {
|
|
4960
|
+
const a = W.fieldValidators.get(n);
|
|
4961
|
+
if (a) {
|
|
4962
|
+
for (const c of Object.keys(o))
|
|
4963
|
+
a.delete(c);
|
|
4964
|
+
a.size === 0 && W.fieldValidators.delete(n);
|
|
4965
4965
|
}
|
|
4966
4966
|
}
|
|
4967
4967
|
if (t.formValidators)
|
|
@@ -4976,16 +4976,16 @@ function Sa(e, r = !1) {
|
|
|
4976
4976
|
}
|
|
4977
4977
|
return Z.delete(e), !0;
|
|
4978
4978
|
}
|
|
4979
|
-
function
|
|
4979
|
+
function No(e) {
|
|
4980
4980
|
return Z.get(e);
|
|
4981
4981
|
}
|
|
4982
|
-
function
|
|
4982
|
+
function ko() {
|
|
4983
4983
|
return Array.from(Z.values());
|
|
4984
4984
|
}
|
|
4985
|
-
function
|
|
4985
|
+
function Io(e) {
|
|
4986
4986
|
return Z.has(e);
|
|
4987
4987
|
}
|
|
4988
|
-
function
|
|
4988
|
+
function Eo(e) {
|
|
4989
4989
|
for (const [r, t] of Object.entries(e))
|
|
4990
4990
|
Wr(r, t);
|
|
4991
4991
|
}
|
|
@@ -5010,12 +5010,12 @@ function Ce(e) {
|
|
|
5010
5010
|
return !!r && typeof r.name == "string" && typeof r.size == "number";
|
|
5011
5011
|
}
|
|
5012
5012
|
}
|
|
5013
|
-
function
|
|
5013
|
+
function Mo(e, r, t = {}) {
|
|
5014
5014
|
try {
|
|
5015
5015
|
const {
|
|
5016
5016
|
includeMetadata: n = !1,
|
|
5017
|
-
dateFormat:
|
|
5018
|
-
fileHandling:
|
|
5017
|
+
dateFormat: o = "iso",
|
|
5018
|
+
fileHandling: a = "metadata",
|
|
5019
5019
|
prettify: c = !1,
|
|
5020
5020
|
excludeFields: s = [],
|
|
5021
5021
|
includeOnlyFields: i = []
|
|
@@ -5038,7 +5038,7 @@ function Ea(e, r, t = {}) {
|
|
|
5038
5038
|
if (y === void 0) continue;
|
|
5039
5039
|
const E = C.get(h);
|
|
5040
5040
|
try {
|
|
5041
|
-
u[h] =
|
|
5041
|
+
u[h] = no(y, E, { dateFormat: o, fileHandling: a });
|
|
5042
5042
|
} catch (F) {
|
|
5043
5043
|
d.push(`Error serializing field '${h}': ${String(F)}`), u[h] = null;
|
|
5044
5044
|
}
|
|
@@ -5064,8 +5064,8 @@ function Ea(e, r, t = {}) {
|
|
|
5064
5064
|
};
|
|
5065
5065
|
}
|
|
5066
5066
|
}
|
|
5067
|
-
function
|
|
5068
|
-
const { dateFormat: n = "iso", fileHandling:
|
|
5067
|
+
function no(e, r, t = {}) {
|
|
5068
|
+
const { dateFormat: n = "iso", fileHandling: o = "metadata" } = t;
|
|
5069
5069
|
if (e == null)
|
|
5070
5070
|
return null;
|
|
5071
5071
|
if (r)
|
|
@@ -5075,7 +5075,7 @@ function na(e, r, t = {}) {
|
|
|
5075
5075
|
case "date-time":
|
|
5076
5076
|
return er(e, n);
|
|
5077
5077
|
case "file":
|
|
5078
|
-
return rr(e,
|
|
5078
|
+
return rr(e, o);
|
|
5079
5079
|
case "int":
|
|
5080
5080
|
case "integer":
|
|
5081
5081
|
return typeof e == "string" ? parseInt(e, 10) : e;
|
|
@@ -5086,11 +5086,11 @@ function na(e, r, t = {}) {
|
|
|
5086
5086
|
return typeof e == "string" ? e === "true" : !!e;
|
|
5087
5087
|
case "int-array":
|
|
5088
5088
|
case "float-array":
|
|
5089
|
-
return Array.isArray(e) ? e.map((
|
|
5089
|
+
return Array.isArray(e) ? e.map((a) => typeof a == "string" ? Number(a) : a) : e;
|
|
5090
5090
|
default:
|
|
5091
5091
|
return e;
|
|
5092
5092
|
}
|
|
5093
|
-
return e instanceof Date ? er(e, n) : Ce(e) || Array.isArray(e) && Ce(e[0]) ? rr(e,
|
|
5093
|
+
return e instanceof Date ? er(e, n) : Ce(e) || Array.isArray(e) && Ce(e[0]) ? rr(e, o) : e;
|
|
5094
5094
|
}
|
|
5095
5095
|
function er(e, r) {
|
|
5096
5096
|
let t = null;
|
|
@@ -5134,12 +5134,12 @@ function tr(e, r) {
|
|
|
5134
5134
|
_note: "Base64 encoding requires async implementation"
|
|
5135
5135
|
};
|
|
5136
5136
|
}
|
|
5137
|
-
function
|
|
5137
|
+
function Fo(e, r, t = {}) {
|
|
5138
5138
|
try {
|
|
5139
5139
|
const {
|
|
5140
5140
|
strict: n = !1,
|
|
5141
|
-
validateTypes:
|
|
5142
|
-
preserveUnknownFields:
|
|
5141
|
+
validateTypes: o = !0,
|
|
5142
|
+
preserveUnknownFields: a = !0,
|
|
5143
5143
|
dateFormat: c = "auto"
|
|
5144
5144
|
} = t;
|
|
5145
5145
|
if (!e || typeof e != "string")
|
|
@@ -5169,13 +5169,13 @@ function Ma(e, r, t = {}) {
|
|
|
5169
5169
|
continue;
|
|
5170
5170
|
}
|
|
5171
5171
|
try {
|
|
5172
|
-
m[h] =
|
|
5172
|
+
m[h] = oo(y, N, { validateTypes: o, dateFormat: c });
|
|
5173
5173
|
} catch (E) {
|
|
5174
5174
|
const F = `Error deserializing field '${h}': ${String(E)}`;
|
|
5175
5175
|
n ? d.push(F) : (i.push(F), m[h] = y);
|
|
5176
5176
|
}
|
|
5177
5177
|
}
|
|
5178
|
-
if (
|
|
5178
|
+
if (a)
|
|
5179
5179
|
for (const [N, h] of Object.entries(s))
|
|
5180
5180
|
!b.has(N) && N !== "_metadata" && (n && i.push(`Unknown field '${N}' preserved`), m[N] = h);
|
|
5181
5181
|
const C = d.length > 0;
|
|
@@ -5192,8 +5192,8 @@ function Ma(e, r, t = {}) {
|
|
|
5192
5192
|
};
|
|
5193
5193
|
}
|
|
5194
5194
|
}
|
|
5195
|
-
function
|
|
5196
|
-
const { validateTypes: n = !0, dateFormat:
|
|
5195
|
+
function oo(e, r, t = {}) {
|
|
5196
|
+
const { validateTypes: n = !0, dateFormat: o = "auto" } = t;
|
|
5197
5197
|
if (e == null)
|
|
5198
5198
|
return e;
|
|
5199
5199
|
try {
|
|
@@ -5201,7 +5201,7 @@ function aa(e, r, t = {}) {
|
|
|
5201
5201
|
case "date":
|
|
5202
5202
|
case "datetime":
|
|
5203
5203
|
case "date-time":
|
|
5204
|
-
return
|
|
5204
|
+
return ao(e, o, n);
|
|
5205
5205
|
case "int":
|
|
5206
5206
|
case "integer":
|
|
5207
5207
|
return Ne(e, n);
|
|
@@ -5209,7 +5209,7 @@ function aa(e, r, t = {}) {
|
|
|
5209
5209
|
case "number":
|
|
5210
5210
|
return ke(e, n);
|
|
5211
5211
|
case "boolean":
|
|
5212
|
-
return
|
|
5212
|
+
return io(e, n);
|
|
5213
5213
|
case "int-array":
|
|
5214
5214
|
return nr(e, "integer", n);
|
|
5215
5215
|
case "float-array":
|
|
@@ -5223,13 +5223,13 @@ function aa(e, r, t = {}) {
|
|
|
5223
5223
|
default:
|
|
5224
5224
|
return e;
|
|
5225
5225
|
}
|
|
5226
|
-
} catch (
|
|
5226
|
+
} catch (a) {
|
|
5227
5227
|
if (n)
|
|
5228
|
-
throw new Error(`Type conversion failed: ${String(
|
|
5228
|
+
throw new Error(`Type conversion failed: ${String(a)}`);
|
|
5229
5229
|
return e;
|
|
5230
5230
|
}
|
|
5231
5231
|
}
|
|
5232
|
-
function
|
|
5232
|
+
function $o(e, r = {}) {
|
|
5233
5233
|
try {
|
|
5234
5234
|
const { prettify: t = !0, includeMetadata: n = !0 } = r;
|
|
5235
5235
|
if (!e || typeof e != "object")
|
|
@@ -5237,16 +5237,16 @@ function Fa(e, r = {}) {
|
|
|
5237
5237
|
success: !1,
|
|
5238
5238
|
error: "Definition must be a valid object"
|
|
5239
5239
|
};
|
|
5240
|
-
const
|
|
5241
|
-
return n && (
|
|
5240
|
+
const o = { ...e };
|
|
5241
|
+
return n && (o._metadata = {
|
|
5242
5242
|
serializedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5243
|
-
version:
|
|
5244
|
-
propertyCount: (Array.isArray(
|
|
5243
|
+
version: o.version || "1.0.0",
|
|
5244
|
+
propertyCount: (Array.isArray(o.properties) ? o.properties.length : 0) || 0
|
|
5245
5245
|
}), {
|
|
5246
5246
|
success: !0,
|
|
5247
|
-
data: t ? JSON.stringify(
|
|
5247
|
+
data: t ? JSON.stringify(o, null, 2) : JSON.stringify(o),
|
|
5248
5248
|
metadata: {
|
|
5249
|
-
fieldCount: (Array.isArray(
|
|
5249
|
+
fieldCount: (Array.isArray(o.properties) ? o.properties.length : 0) || 0,
|
|
5250
5250
|
excludedFields: [],
|
|
5251
5251
|
warnings: []
|
|
5252
5252
|
}
|
|
@@ -5258,13 +5258,13 @@ function Fa(e, r = {}) {
|
|
|
5258
5258
|
};
|
|
5259
5259
|
}
|
|
5260
5260
|
}
|
|
5261
|
-
function
|
|
5261
|
+
function Vo(e, r = {}) {
|
|
5262
5262
|
try {
|
|
5263
5263
|
const { strict: t = !1, validateTypes: n = !0 } = r;
|
|
5264
|
-
let
|
|
5264
|
+
let o;
|
|
5265
5265
|
if (typeof e == "string")
|
|
5266
5266
|
try {
|
|
5267
|
-
|
|
5267
|
+
o = JSON.parse(e);
|
|
5268
5268
|
} catch (m) {
|
|
5269
5269
|
return {
|
|
5270
5270
|
success: !1,
|
|
@@ -5272,43 +5272,43 @@ function $a(e, r = {}) {
|
|
|
5272
5272
|
};
|
|
5273
5273
|
}
|
|
5274
5274
|
else if (e && typeof e == "object")
|
|
5275
|
-
|
|
5275
|
+
o = { ...e };
|
|
5276
5276
|
else
|
|
5277
5277
|
return {
|
|
5278
5278
|
success: !1,
|
|
5279
5279
|
error: "Input must be a string or object"
|
|
5280
5280
|
};
|
|
5281
|
-
const
|
|
5281
|
+
const a = [], c = [], s = ["name", "version", "displayName"];
|
|
5282
5282
|
for (const m of s)
|
|
5283
|
-
if (!(m in
|
|
5283
|
+
if (!(m in o) || !o[m])
|
|
5284
5284
|
if (t)
|
|
5285
5285
|
c.push(`Required field '${m}' is missing`);
|
|
5286
5286
|
else
|
|
5287
|
-
switch (
|
|
5287
|
+
switch (a.push(`Missing field '${m}', using default`), m) {
|
|
5288
5288
|
case "name":
|
|
5289
|
-
|
|
5289
|
+
o.name = "unnamed-definition";
|
|
5290
5290
|
break;
|
|
5291
5291
|
case "version":
|
|
5292
|
-
|
|
5292
|
+
o.version = "1.0.0";
|
|
5293
5293
|
break;
|
|
5294
5294
|
case "displayName":
|
|
5295
|
-
|
|
5295
|
+
o.displayName = o.name || "Unnamed Definition";
|
|
5296
5296
|
break;
|
|
5297
5297
|
}
|
|
5298
|
-
const i = Array.isArray(
|
|
5299
|
-
i ?
|
|
5298
|
+
const i = Array.isArray(o.properties) ? o.properties : null;
|
|
5299
|
+
i ? o.properties = i.map((m, u) => {
|
|
5300
5300
|
const f = ee(m) ? m : {}, b = { ...f };
|
|
5301
5301
|
if (!f.name) {
|
|
5302
5302
|
const C = `Property at index ${u} missing 'name'`;
|
|
5303
|
-
t ? c.push(C) : (
|
|
5303
|
+
t ? c.push(C) : (a.push(`${C}, using 'field_${u}'`), b.name = `field_${u}`);
|
|
5304
5304
|
}
|
|
5305
|
-
return f.displayName || (b.displayName = f.name || `Field ${u}`), f.type || (t && n ? c.push(`Property '${f.name || u}' missing 'type'`) : (
|
|
5306
|
-
}) : t ? c.push("Properties must be an array") : (
|
|
5305
|
+
return f.displayName || (b.displayName = f.name || `Field ${u}`), f.type || (t && n ? c.push(`Property '${f.name || u}' missing 'type'`) : (a.push(`Property '${f.name || u}' missing 'type', using 'string'`), b.type = "string")), f.defaultValue === void 0 && (b.defaultValue = null), f.required === void 0 && (b.required = !1), b;
|
|
5306
|
+
}) : t ? c.push("Properties must be an array") : (a.push("Properties not found or invalid, using empty array"), o.properties = []);
|
|
5307
5307
|
const d = c.length > 0;
|
|
5308
5308
|
return {
|
|
5309
5309
|
success: !d,
|
|
5310
|
-
data:
|
|
5311
|
-
warnings:
|
|
5310
|
+
data: o,
|
|
5311
|
+
warnings: a.length > 0 ? a : void 0,
|
|
5312
5312
|
validationErrors: d ? c : void 0
|
|
5313
5313
|
};
|
|
5314
5314
|
} catch (t) {
|
|
@@ -5318,7 +5318,7 @@ function $a(e, r = {}) {
|
|
|
5318
5318
|
};
|
|
5319
5319
|
}
|
|
5320
5320
|
}
|
|
5321
|
-
function
|
|
5321
|
+
function ao(e, r, t) {
|
|
5322
5322
|
if (e instanceof Date)
|
|
5323
5323
|
return e;
|
|
5324
5324
|
if (typeof e == "number") {
|
|
@@ -5383,7 +5383,7 @@ function ke(e, r) {
|
|
|
5383
5383
|
throw new Error(`Cannot convert ${typeof e} to number`);
|
|
5384
5384
|
return e;
|
|
5385
5385
|
}
|
|
5386
|
-
function
|
|
5386
|
+
function io(e, r) {
|
|
5387
5387
|
if (typeof e == "boolean")
|
|
5388
5388
|
return e;
|
|
5389
5389
|
if (typeof e == "string") {
|
|
@@ -5402,22 +5402,22 @@ function ia(e, r) {
|
|
|
5402
5402
|
function nr(e, r, t) {
|
|
5403
5403
|
if (!Array.isArray(e)) {
|
|
5404
5404
|
if (typeof e == "string")
|
|
5405
|
-
return e.split(",").map((
|
|
5405
|
+
return e.split(",").map((o) => o.trim()).filter(Boolean).map((o) => r === "integer" ? Ne(o, t) : ke(o, t));
|
|
5406
5406
|
if (t)
|
|
5407
5407
|
throw new Error(`Expected array, got ${typeof e}`);
|
|
5408
5408
|
return e;
|
|
5409
5409
|
}
|
|
5410
|
-
return e.map((n,
|
|
5410
|
+
return e.map((n, o) => {
|
|
5411
5411
|
try {
|
|
5412
5412
|
return r === "integer" ? Ne(n, t) : ke(n, t);
|
|
5413
|
-
} catch (
|
|
5413
|
+
} catch (a) {
|
|
5414
5414
|
if (t)
|
|
5415
|
-
throw new Error(`Array element ${
|
|
5415
|
+
throw new Error(`Array element ${o}: ${a}`);
|
|
5416
5416
|
return n;
|
|
5417
5417
|
}
|
|
5418
5418
|
});
|
|
5419
5419
|
}
|
|
5420
|
-
function
|
|
5420
|
+
function so() {
|
|
5421
5421
|
if (!document.getElementById("reactaform-styles"))
|
|
5422
5422
|
try {
|
|
5423
5423
|
const e = document.createElement("style");
|
|
@@ -5425,47 +5425,47 @@ function sa() {
|
|
|
5425
5425
|
} catch {
|
|
5426
5426
|
}
|
|
5427
5427
|
}
|
|
5428
|
-
typeof document < "u" &&
|
|
5428
|
+
typeof document < "u" && so();
|
|
5429
5429
|
export {
|
|
5430
5430
|
V as CSS_CLASSES,
|
|
5431
|
-
|
|
5431
|
+
wo as ReactaForm,
|
|
5432
5432
|
Zn as ReactaFormProvider,
|
|
5433
5433
|
hn as ReactaFormRenderer,
|
|
5434
5434
|
O as StandardFieldLayout,
|
|
5435
|
-
|
|
5435
|
+
mo as Units,
|
|
5436
5436
|
U as combineClasses,
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5437
|
+
eo as createInstanceFromDefinition,
|
|
5438
|
+
Vo as deserializeDefinition,
|
|
5439
|
+
Fo as deserializeInstance,
|
|
5440
|
+
ko as getAllPlugins,
|
|
5441
5441
|
rn as getButtonHandler,
|
|
5442
5442
|
_r as getComponent,
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5443
|
+
No as getPlugin,
|
|
5444
|
+
bo as getSupportedLanguages,
|
|
5445
|
+
po as hasButtonHandler,
|
|
5446
|
+
Io as hasPlugin,
|
|
5447
|
+
so as injectReactaFormStyles,
|
|
5448
5448
|
ie as isDarkTheme,
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5449
|
+
ho as listButtonHandlers,
|
|
5450
|
+
vo as loadInstance,
|
|
5451
|
+
yo as loadJsonDefinition,
|
|
5452
|
+
fo as registerButtonHandler,
|
|
5453
5453
|
Wr as registerComponent,
|
|
5454
|
-
|
|
5454
|
+
Eo as registerComponents,
|
|
5455
5455
|
gt as registerFieldCustomValidationHandler,
|
|
5456
5456
|
ht as registerFieldTypeValidationHandler,
|
|
5457
5457
|
pt as registerFormValidationHandler,
|
|
5458
|
-
|
|
5458
|
+
So as registerPlugin,
|
|
5459
5459
|
Jr as registerSubmissionHandler,
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5460
|
+
$o as serializeDefinition,
|
|
5461
|
+
Mo as serializeInstance,
|
|
5462
|
+
go as unregisterButtonHandler,
|
|
5463
|
+
Co as unregisterPlugin,
|
|
5464
|
+
xo as upgradeInstanceToLatestDefinition,
|
|
5465
5465
|
lt as useDebouncedCallback,
|
|
5466
5466
|
T as useFieldValidator,
|
|
5467
5467
|
B as useReactaFormContext,
|
|
5468
5468
|
_ as useUncontrolledValidatedInput,
|
|
5469
|
-
|
|
5469
|
+
uo as validateFieldValue,
|
|
5470
5470
|
fr as validateFieldWithCustomHandler
|
|
5471
5471
|
};
|