@reformer/core 2.0.0-beta.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { d as y, w as u, E, r as U } from "./behaviors-
|
|
2
|
-
import { i as Ee } from "./behaviors-
|
|
3
|
-
import { i as
|
|
4
|
-
import { g as
|
|
5
|
-
import { V as H, B as W, c as
|
|
6
|
-
import { R as
|
|
1
|
+
import { d as y, w as u, E, r as U } from "./behaviors-DzYL8kY_.js";
|
|
2
|
+
import { i as Ee } from "./behaviors-DzYL8kY_.js";
|
|
3
|
+
import { i as T, a as R, A as j, V as q, T as K } from "./validators-gXoHPdqM.js";
|
|
4
|
+
import { g as be, c as Ve, d as we, v as Ae, b as ke } from "./validators-gXoHPdqM.js";
|
|
5
|
+
import { V as H, B as W, c as I } from "./registry-helpers-BRxAr6nG.js";
|
|
6
|
+
import { R as Fe, a as Oe, e as Pe, b as Te, g as Re, t as Ie } from "./registry-helpers-BRxAr6nG.js";
|
|
7
7
|
import { v4 as z } from "uuid";
|
|
8
|
-
import B, { useRef as L, useCallback as
|
|
9
|
-
class
|
|
8
|
+
import B, { useRef as L, useCallback as S } from "react";
|
|
9
|
+
class O {
|
|
10
10
|
// ============================================================================
|
|
11
11
|
// Protected состояние (для Template Method паттерна)
|
|
12
12
|
// ============================================================================
|
|
@@ -106,8 +106,8 @@ class F {
|
|
|
106
106
|
if (e.params !== void 0) {
|
|
107
107
|
if (!i.params)
|
|
108
108
|
return !1;
|
|
109
|
-
for (const [
|
|
110
|
-
if (i.params[
|
|
109
|
+
for (const [s, a] of Object.entries(e.params))
|
|
110
|
+
if (i.params[s] !== a)
|
|
111
111
|
return !1;
|
|
112
112
|
}
|
|
113
113
|
return !(e.predicate !== void 0 && !e.predicate(i));
|
|
@@ -451,8 +451,8 @@ class P {
|
|
|
451
451
|
this.clear();
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
var
|
|
455
|
-
class
|
|
454
|
+
var w = /* @__PURE__ */ ((r) => (r.THROW = "throw", r.LOG = "log", r.CONVERT = "convert", r))(w || {});
|
|
455
|
+
class F {
|
|
456
456
|
/**
|
|
457
457
|
* Обработать ошибку согласно заданной стратегии
|
|
458
458
|
*
|
|
@@ -493,7 +493,7 @@ class O {
|
|
|
493
493
|
* ```
|
|
494
494
|
*/
|
|
495
495
|
static handle(e, t, i = "throw") {
|
|
496
|
-
const
|
|
496
|
+
const s = this.extractMessage(e);
|
|
497
497
|
switch (i) {
|
|
498
498
|
case "throw":
|
|
499
499
|
throw e;
|
|
@@ -502,7 +502,7 @@ class O {
|
|
|
502
502
|
case "convert":
|
|
503
503
|
return {
|
|
504
504
|
code: "validator_error",
|
|
505
|
-
message:
|
|
505
|
+
message: s,
|
|
506
506
|
params: { field: t }
|
|
507
507
|
};
|
|
508
508
|
}
|
|
@@ -584,7 +584,7 @@ class O {
|
|
|
584
584
|
return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
class J extends
|
|
587
|
+
class J extends O {
|
|
588
588
|
// ============================================================================
|
|
589
589
|
// Приватные сигналы
|
|
590
590
|
// ============================================================================
|
|
@@ -618,7 +618,6 @@ class J extends F {
|
|
|
618
618
|
updateOn;
|
|
619
619
|
initialValue;
|
|
620
620
|
currentValidationId = 0;
|
|
621
|
-
currentAbortController;
|
|
622
621
|
debounceMs;
|
|
623
622
|
validateDebounceTimer;
|
|
624
623
|
validateDebounceResolve;
|
|
@@ -645,12 +644,12 @@ class J extends F {
|
|
|
645
644
|
setValue(e, t) {
|
|
646
645
|
if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
|
|
647
646
|
return;
|
|
648
|
-
const i = this.validators.length > 0 || this.asyncValidators.length > 0,
|
|
647
|
+
const i = this.validators.length > 0 || this.asyncValidators.length > 0, s = this._errors.value.length > 0;
|
|
649
648
|
if (this.updateOn === "change") {
|
|
650
649
|
this.validate();
|
|
651
650
|
return;
|
|
652
651
|
}
|
|
653
|
-
|
|
652
|
+
s && i && this.validate();
|
|
654
653
|
}
|
|
655
654
|
patchValue(e) {
|
|
656
655
|
this.setValue(e);
|
|
@@ -730,14 +729,14 @@ class J extends F {
|
|
|
730
729
|
async validate(e) {
|
|
731
730
|
const t = e?.debounce ?? this.debounceMs;
|
|
732
731
|
return t > 0 && this.asyncValidators.length > 0 ? new Promise((i) => {
|
|
733
|
-
const
|
|
732
|
+
const s = this.currentValidationId;
|
|
734
733
|
this.validateDebounceResolve && this.validateDebounceResolve(!1), this.validateDebounceTimer && clearTimeout(this.validateDebounceTimer), this.validateDebounceResolve = i, this.validateDebounceTimer = setTimeout(async () => {
|
|
735
|
-
if (this.validateDebounceResolve = void 0,
|
|
734
|
+
if (this.validateDebounceResolve = void 0, s !== this.currentValidationId) {
|
|
736
735
|
i(!1);
|
|
737
736
|
return;
|
|
738
737
|
}
|
|
739
|
-
const
|
|
740
|
-
i(
|
|
738
|
+
const a = await this.validateImmediate();
|
|
739
|
+
i(a);
|
|
741
740
|
}, t);
|
|
742
741
|
}) : this.validateImmediate();
|
|
743
742
|
}
|
|
@@ -745,64 +744,47 @@ class J extends F {
|
|
|
745
744
|
* Немедленная валидация без debounce
|
|
746
745
|
* @private
|
|
747
746
|
* @remarks
|
|
748
|
-
* Защищена от race conditions
|
|
749
|
-
* -
|
|
750
|
-
* -
|
|
751
|
-
* -
|
|
747
|
+
* Защищена от race conditions:
|
|
748
|
+
* - Проверка validationId после синхронной валидации
|
|
749
|
+
* - Проверка перед установкой pending
|
|
750
|
+
* - Проверка после Promise.all
|
|
751
|
+
* - Проверка перед обработкой async результатов
|
|
752
|
+
* - Проверка перед очисткой errors
|
|
752
753
|
*/
|
|
753
754
|
async validateImmediate() {
|
|
754
|
-
this.
|
|
755
|
-
const e = new AbortController();
|
|
756
|
-
this.currentAbortController = e;
|
|
757
|
-
const { signal: t } = e;
|
|
758
|
-
++this.currentValidationId;
|
|
759
|
-
const i = [];
|
|
755
|
+
const e = ++this.currentValidationId, t = [];
|
|
760
756
|
for (const s of this.validators) {
|
|
761
|
-
const
|
|
762
|
-
|
|
757
|
+
const a = s(this._value.value);
|
|
758
|
+
a && t.push(a);
|
|
763
759
|
}
|
|
764
|
-
if (
|
|
760
|
+
if (e !== this.currentValidationId)
|
|
765
761
|
return !1;
|
|
766
|
-
if (
|
|
767
|
-
return this._errors.value =
|
|
762
|
+
if (t.length > 0)
|
|
763
|
+
return this._errors.value = t, this._status.value = "invalid", !1;
|
|
768
764
|
if (this.asyncValidators.length > 0) {
|
|
769
|
-
if (
|
|
765
|
+
if (e !== this.currentValidationId)
|
|
770
766
|
return !1;
|
|
771
767
|
this._pending.value = !0, this._status.value = "pending";
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
})
|
|
792
|
-
);
|
|
793
|
-
if (t.aborted)
|
|
794
|
-
return !1;
|
|
795
|
-
this._pending.value = !1;
|
|
796
|
-
const n = s.filter(Boolean);
|
|
797
|
-
if (n.length > 0)
|
|
798
|
-
return this._errors.value = n, this._status.value = "invalid", !1;
|
|
799
|
-
} catch (s) {
|
|
800
|
-
if (s instanceof DOMException && s.name === "AbortError")
|
|
801
|
-
return !1;
|
|
802
|
-
throw s;
|
|
803
|
-
}
|
|
768
|
+
const s = await Promise.all(
|
|
769
|
+
this.asyncValidators.map(async (o) => {
|
|
770
|
+
try {
|
|
771
|
+
return await o(this._value.value);
|
|
772
|
+
} catch (n) {
|
|
773
|
+
return F.handle(
|
|
774
|
+
n,
|
|
775
|
+
"FieldNode AsyncValidator",
|
|
776
|
+
w.CONVERT
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
})
|
|
780
|
+
);
|
|
781
|
+
if (e !== this.currentValidationId || (this._pending.value = !1, e !== this.currentValidationId))
|
|
782
|
+
return !1;
|
|
783
|
+
const a = s.filter(Boolean);
|
|
784
|
+
if (a.length > 0)
|
|
785
|
+
return this._errors.value = a, this._status.value = "invalid", !1;
|
|
804
786
|
}
|
|
805
|
-
return
|
|
787
|
+
return e !== this.currentValidationId ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this._status.value = "valid"), this._errors.value.length === 0);
|
|
806
788
|
}
|
|
807
789
|
setErrors(e) {
|
|
808
790
|
this._errors.value = e, this._status.value = e.length > 0 ? "invalid" : "valid";
|
|
@@ -915,8 +897,8 @@ class J extends F {
|
|
|
915
897
|
*/
|
|
916
898
|
watch(e) {
|
|
917
899
|
const t = E(() => {
|
|
918
|
-
const
|
|
919
|
-
e(
|
|
900
|
+
const s = this.value.value;
|
|
901
|
+
e(s);
|
|
920
902
|
}), i = `watch-${Date.now()}-${Math.random()}`;
|
|
921
903
|
return this.disposers.add(i, t);
|
|
922
904
|
}
|
|
@@ -944,22 +926,15 @@ class J extends F {
|
|
|
944
926
|
*/
|
|
945
927
|
computeFrom(e, t) {
|
|
946
928
|
const i = E(() => {
|
|
947
|
-
const
|
|
948
|
-
this.setValue(
|
|
949
|
-
}),
|
|
950
|
-
return this.disposers.add(
|
|
929
|
+
const a = e.map((n) => n.value), o = t(...a);
|
|
930
|
+
this.setValue(o, { emitEvent: !1 });
|
|
931
|
+
}), s = `computeFrom-${Date.now()}-${Math.random()}`;
|
|
932
|
+
return this.disposers.add(s, i);
|
|
951
933
|
}
|
|
952
934
|
/**
|
|
953
935
|
* Очистить все ресурсы и таймеры
|
|
954
936
|
* Должен вызываться при unmount компонента
|
|
955
937
|
*
|
|
956
|
-
* @remarks
|
|
957
|
-
* Освобождает все ресурсы:
|
|
958
|
-
* - Отписывает все subscriptions через SubscriptionManager
|
|
959
|
-
* - Очищает debounce таймер
|
|
960
|
-
* - Resolve'ит висячий debounce промис (предотвращает утечку памяти)
|
|
961
|
-
* - Отменяет текущую async валидацию через AbortController
|
|
962
|
-
*
|
|
963
938
|
* @example
|
|
964
939
|
* ```typescript
|
|
965
940
|
* useEffect(() => {
|
|
@@ -970,7 +945,7 @@ class J extends F {
|
|
|
970
945
|
* ```
|
|
971
946
|
*/
|
|
972
947
|
dispose() {
|
|
973
|
-
this.disposers.dispose(), this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0)
|
|
948
|
+
this.disposers.dispose(), this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0);
|
|
974
949
|
}
|
|
975
950
|
}
|
|
976
951
|
class Y {
|
|
@@ -1004,12 +979,12 @@ class Y {
|
|
|
1004
979
|
*/
|
|
1005
980
|
groupValidators(e) {
|
|
1006
981
|
const t = /* @__PURE__ */ new Map(), i = [];
|
|
1007
|
-
for (const
|
|
1008
|
-
if (
|
|
1009
|
-
i.push(
|
|
982
|
+
for (const s of e)
|
|
983
|
+
if (s.type === "tree")
|
|
984
|
+
i.push(s);
|
|
1010
985
|
else {
|
|
1011
|
-
const
|
|
1012
|
-
|
|
986
|
+
const a = t.get(s.fieldPath) || [];
|
|
987
|
+
a.push(s), t.set(s.fieldPath, a);
|
|
1013
988
|
}
|
|
1014
989
|
return { validatorsByField: t, treeValidators: i };
|
|
1015
990
|
}
|
|
@@ -1026,36 +1001,36 @@ class Y {
|
|
|
1026
1001
|
*/
|
|
1027
1002
|
async applyFieldValidators(e) {
|
|
1028
1003
|
for (const [t, i] of e) {
|
|
1029
|
-
const
|
|
1030
|
-
if (!
|
|
1004
|
+
const s = this.form.getFieldByPath(t);
|
|
1005
|
+
if (!s) {
|
|
1031
1006
|
console.warn(`Field ${t} not found in GroupNode`);
|
|
1032
1007
|
continue;
|
|
1033
1008
|
}
|
|
1034
|
-
if (!
|
|
1009
|
+
if (!T(s) && !R(s)) {
|
|
1035
1010
|
process.env.NODE_ENV !== "production" && console.warn(`Validation can only run on FieldNode or ArrayNode, skipping ${t}`);
|
|
1036
1011
|
continue;
|
|
1037
1012
|
}
|
|
1038
|
-
const
|
|
1039
|
-
let
|
|
1040
|
-
if (
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1013
|
+
const a = [];
|
|
1014
|
+
let o;
|
|
1015
|
+
if (R(s)) {
|
|
1016
|
+
const n = s.getValue();
|
|
1017
|
+
o = new j(this.form, t, n);
|
|
1043
1018
|
} else
|
|
1044
|
-
|
|
1045
|
-
for (const
|
|
1046
|
-
if (!(
|
|
1019
|
+
o = new q(this.form, t, s);
|
|
1020
|
+
for (const n of i)
|
|
1021
|
+
if (!(n.condition && !this.checkCondition(n.condition)))
|
|
1047
1022
|
try {
|
|
1048
1023
|
let l = null;
|
|
1049
|
-
const d =
|
|
1050
|
-
|
|
1024
|
+
const d = o.value(), m = n.validator;
|
|
1025
|
+
n.type === "sync" ? l = m(d, o) : n.type === "async" && (l = await m(d, o)), l && a.push(l);
|
|
1051
1026
|
} catch (l) {
|
|
1052
|
-
|
|
1027
|
+
F.handle(
|
|
1053
1028
|
l,
|
|
1054
1029
|
`ValidationApplicator: validator for ${t}`,
|
|
1055
|
-
|
|
1030
|
+
w.LOG
|
|
1056
1031
|
);
|
|
1057
1032
|
}
|
|
1058
|
-
|
|
1033
|
+
a.length > 0 ? s.setErrors(a) : s.errors.value.length > 0 && !s.errors.value.some((n) => n.code !== "contextual") && s.clearErrors();
|
|
1059
1034
|
}
|
|
1060
1035
|
}
|
|
1061
1036
|
/**
|
|
@@ -1073,19 +1048,19 @@ class Y {
|
|
|
1073
1048
|
try {
|
|
1074
1049
|
if (t.type !== "tree")
|
|
1075
1050
|
continue;
|
|
1076
|
-
const
|
|
1077
|
-
if (
|
|
1078
|
-
const
|
|
1079
|
-
if (
|
|
1080
|
-
const
|
|
1081
|
-
if (
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1051
|
+
const s = t.validator(i);
|
|
1052
|
+
if (s && t.options && "targetField" in t.options) {
|
|
1053
|
+
const a = t.options.targetField;
|
|
1054
|
+
if (a) {
|
|
1055
|
+
const o = this.form.getFieldByPath(String(a));
|
|
1056
|
+
if (o && T(o)) {
|
|
1057
|
+
const n = o.errors.value;
|
|
1058
|
+
o.setErrors([...n, s]);
|
|
1084
1059
|
}
|
|
1085
1060
|
}
|
|
1086
1061
|
}
|
|
1087
|
-
} catch (
|
|
1088
|
-
|
|
1062
|
+
} catch (s) {
|
|
1063
|
+
F.handle(s, "ValidationApplicator: tree validator", w.LOG);
|
|
1089
1064
|
}
|
|
1090
1065
|
}
|
|
1091
1066
|
}
|
|
@@ -1133,10 +1108,10 @@ class Q {
|
|
|
1133
1108
|
*/
|
|
1134
1109
|
parsePath(e) {
|
|
1135
1110
|
const t = [];
|
|
1136
|
-
let i = "",
|
|
1137
|
-
for (let
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1111
|
+
let i = "", s = !1;
|
|
1112
|
+
for (let a = 0; a < e.length; a++) {
|
|
1113
|
+
const o = e[a];
|
|
1114
|
+
o === "[" ? (s = !0, i += o) : o === "]" ? (s = !1, i += o) : o === "." && !s ? i && (this.addSegment(t, i), i = "") : i += o;
|
|
1140
1115
|
}
|
|
1141
1116
|
return i && this.addSegment(t, i), t;
|
|
1142
1117
|
}
|
|
@@ -1184,15 +1159,15 @@ class Q {
|
|
|
1184
1159
|
*/
|
|
1185
1160
|
getValueByPath(e, t) {
|
|
1186
1161
|
const i = this.parsePath(t);
|
|
1187
|
-
let
|
|
1188
|
-
for (const
|
|
1189
|
-
if (
|
|
1190
|
-
if (
|
|
1191
|
-
if (!Array.isArray(
|
|
1192
|
-
|
|
1162
|
+
let s = e;
|
|
1163
|
+
for (const a of i) {
|
|
1164
|
+
if (s == null) return;
|
|
1165
|
+
if (s = s[a.key], a.index !== void 0) {
|
|
1166
|
+
if (!Array.isArray(s)) return;
|
|
1167
|
+
s = s[a.index];
|
|
1193
1168
|
}
|
|
1194
1169
|
}
|
|
1195
|
-
return
|
|
1170
|
+
return s;
|
|
1196
1171
|
}
|
|
1197
1172
|
/**
|
|
1198
1173
|
* Устанавливает значение по пути в объекте (мутирует объект)
|
|
@@ -1222,30 +1197,30 @@ class Q {
|
|
|
1222
1197
|
* ```
|
|
1223
1198
|
*/
|
|
1224
1199
|
setValueByPath(e, t, i) {
|
|
1225
|
-
const
|
|
1226
|
-
if (
|
|
1200
|
+
const s = this.parsePath(t);
|
|
1201
|
+
if (s.length === 0)
|
|
1227
1202
|
throw new Error("Cannot set value: empty path");
|
|
1228
|
-
let
|
|
1229
|
-
for (let
|
|
1230
|
-
const l =
|
|
1231
|
-
let d =
|
|
1203
|
+
let a = e;
|
|
1204
|
+
for (let n = 0; n < s.length - 1; n++) {
|
|
1205
|
+
const l = s[n];
|
|
1206
|
+
let d = a[l.key];
|
|
1232
1207
|
if (l.index !== void 0) {
|
|
1233
1208
|
if (!Array.isArray(d))
|
|
1234
1209
|
throw new Error(`Expected array at path segment: ${l.key}, but got ${typeof d}`);
|
|
1235
|
-
|
|
1210
|
+
a = d[l.index];
|
|
1236
1211
|
} else
|
|
1237
|
-
d == null && (
|
|
1212
|
+
d == null && (a[l.key] = {}, d = a[l.key]), a = d;
|
|
1238
1213
|
}
|
|
1239
|
-
const
|
|
1240
|
-
if (
|
|
1241
|
-
const
|
|
1242
|
-
if (!Array.isArray(
|
|
1214
|
+
const o = s[s.length - 1];
|
|
1215
|
+
if (o.index !== void 0) {
|
|
1216
|
+
const n = a[o.key];
|
|
1217
|
+
if (!Array.isArray(n))
|
|
1243
1218
|
throw new Error(
|
|
1244
|
-
`Expected array at path segment: ${
|
|
1219
|
+
`Expected array at path segment: ${o.key}, but got ${typeof n}`
|
|
1245
1220
|
);
|
|
1246
|
-
o
|
|
1221
|
+
n[o.index] = i;
|
|
1247
1222
|
} else
|
|
1248
|
-
|
|
1223
|
+
a[o.key] = i;
|
|
1249
1224
|
}
|
|
1250
1225
|
/**
|
|
1251
1226
|
* Получить значение из FormNode по пути
|
|
@@ -1343,35 +1318,35 @@ class Q {
|
|
|
1343
1318
|
*/
|
|
1344
1319
|
getNodeByPath(e, t) {
|
|
1345
1320
|
const i = this.parsePath(t);
|
|
1346
|
-
let
|
|
1347
|
-
for (const
|
|
1348
|
-
if (
|
|
1349
|
-
const
|
|
1350
|
-
if (
|
|
1351
|
-
if (
|
|
1352
|
-
if (
|
|
1321
|
+
let s = e;
|
|
1322
|
+
for (const a of i) {
|
|
1323
|
+
if (s == null) return null;
|
|
1324
|
+
const o = s;
|
|
1325
|
+
if (o.fields && o.fields instanceof Map) {
|
|
1326
|
+
if (s = o.fields.get(a.key), a.index === void 0) {
|
|
1327
|
+
if (s == null) return null;
|
|
1353
1328
|
continue;
|
|
1354
1329
|
}
|
|
1355
|
-
} else if (
|
|
1356
|
-
const
|
|
1357
|
-
if (!Array.isArray(
|
|
1330
|
+
} else if (a.index !== void 0 && o.items) {
|
|
1331
|
+
const n = o.items.value || o.items;
|
|
1332
|
+
if (!Array.isArray(n) || (s = n[a.index], s == null)) return null;
|
|
1358
1333
|
continue;
|
|
1359
|
-
} else if (
|
|
1360
|
-
if (
|
|
1334
|
+
} else if (a.index === void 0) {
|
|
1335
|
+
if (s = o[a.key], s == null) return null;
|
|
1361
1336
|
continue;
|
|
1362
1337
|
}
|
|
1363
|
-
if (
|
|
1364
|
-
const
|
|
1365
|
-
if (!Array.isArray(
|
|
1366
|
-
|
|
1367
|
-
} else if (
|
|
1338
|
+
if (s && a.index !== void 0 && s.items) {
|
|
1339
|
+
const n = s.items.value || s.items;
|
|
1340
|
+
if (!Array.isArray(n)) return null;
|
|
1341
|
+
s = n[a.index];
|
|
1342
|
+
} else if (s && a.index !== void 0 && !s.items)
|
|
1368
1343
|
return null;
|
|
1369
|
-
if (
|
|
1344
|
+
if (s == null) return null;
|
|
1370
1345
|
}
|
|
1371
|
-
return
|
|
1346
|
+
return s;
|
|
1372
1347
|
}
|
|
1373
1348
|
}
|
|
1374
|
-
class
|
|
1349
|
+
class b extends O {
|
|
1375
1350
|
// ============================================================================
|
|
1376
1351
|
// Приватные поля
|
|
1377
1352
|
// ============================================================================
|
|
@@ -1432,30 +1407,30 @@ class S extends F {
|
|
|
1432
1407
|
submitting;
|
|
1433
1408
|
constructor(e) {
|
|
1434
1409
|
super();
|
|
1435
|
-
const t = "form" in e, i = t ? e.form : e,
|
|
1436
|
-
for (const [
|
|
1410
|
+
const t = "form" in e, i = t ? e.form : e, s = t ? e.behavior : void 0, a = t ? e.validation : void 0;
|
|
1411
|
+
for (const [n, l] of Object.entries(i)) {
|
|
1437
1412
|
const d = this.createNode(l);
|
|
1438
|
-
this._fields.set(
|
|
1413
|
+
this._fields.set(n, d);
|
|
1439
1414
|
}
|
|
1440
1415
|
this.value = u(() => {
|
|
1441
|
-
const
|
|
1416
|
+
const n = {};
|
|
1442
1417
|
return this._fields.forEach((l, d) => {
|
|
1443
|
-
|
|
1444
|
-
}),
|
|
1445
|
-
}), this.valid = u(() => this._formErrors.value.length > 0 ? !1 : Array.from(this._fields.values()).every((
|
|
1446
|
-
() => Array.from(this._fields.values()).some((
|
|
1418
|
+
n[d] = l.value.value;
|
|
1419
|
+
}), n;
|
|
1420
|
+
}), this.valid = u(() => this._formErrors.value.length > 0 ? !1 : Array.from(this._fields.values()).every((n) => n.valid.value)), this.invalid = u(() => !this.valid.value), this.pending = u(
|
|
1421
|
+
() => Array.from(this._fields.values()).some((n) => n.pending.value)
|
|
1447
1422
|
), this.touched = u(
|
|
1448
|
-
() => Array.from(this._fields.values()).some((
|
|
1423
|
+
() => Array.from(this._fields.values()).some((n) => n.touched.value)
|
|
1449
1424
|
), this.dirty = u(
|
|
1450
|
-
() => Array.from(this._fields.values()).some((
|
|
1425
|
+
() => Array.from(this._fields.values()).some((n) => n.dirty.value)
|
|
1451
1426
|
), this.errors = u(() => {
|
|
1452
|
-
const
|
|
1427
|
+
const n = [...this._formErrors.value];
|
|
1453
1428
|
return this._fields.forEach((l) => {
|
|
1454
|
-
|
|
1455
|
-
}),
|
|
1429
|
+
n.push(...l.errors.value);
|
|
1430
|
+
}), n;
|
|
1456
1431
|
}), this.status = u(() => this._disabled.value ? "disabled" : this.pending.value ? "pending" : this.invalid.value ? "invalid" : "valid"), this.submitting = u(() => this._submitting.value);
|
|
1457
|
-
const
|
|
1458
|
-
return this._proxyInstance =
|
|
1432
|
+
const o = this.buildProxy();
|
|
1433
|
+
return this._proxyInstance = o, s && this.applyBehaviorSchema(s), a && this.applyValidationSchema(a), o;
|
|
1459
1434
|
}
|
|
1460
1435
|
// ============================================================================
|
|
1461
1436
|
// Приватный метод для создания Proxy (inline из ProxyBuilder)
|
|
@@ -1472,11 +1447,11 @@ class S extends F {
|
|
|
1472
1447
|
if (typeof i == "string" && e._fields.has(i))
|
|
1473
1448
|
return e._fields.get(i);
|
|
1474
1449
|
},
|
|
1475
|
-
set: (t, i,
|
|
1450
|
+
set: (t, i, s) => typeof i == "string" && e._fields.has(i) ? !1 : (t[i] = s, !0),
|
|
1476
1451
|
has: (t, i) => typeof i == "string" && e._fields.has(i) ? !0 : i in t,
|
|
1477
1452
|
ownKeys: (t) => {
|
|
1478
|
-
const i = Reflect.ownKeys(t),
|
|
1479
|
-
return [.../* @__PURE__ */ new Set([...i, ...
|
|
1453
|
+
const i = Reflect.ownKeys(t), s = Array.from(e._fields.keys());
|
|
1454
|
+
return [.../* @__PURE__ */ new Set([...i, ...s])];
|
|
1480
1455
|
},
|
|
1481
1456
|
getOwnPropertyDescriptor: (t, i) => typeof i == "string" && e._fields.has(i) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, i)
|
|
1482
1457
|
});
|
|
@@ -1491,16 +1466,16 @@ class S extends F {
|
|
|
1491
1466
|
}), e;
|
|
1492
1467
|
}
|
|
1493
1468
|
setValue(e, t) {
|
|
1494
|
-
for (const [i,
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1469
|
+
for (const [i, s] of Object.entries(e)) {
|
|
1470
|
+
const a = this._fields.get(i);
|
|
1471
|
+
a && a.setValue(s, t);
|
|
1497
1472
|
}
|
|
1498
1473
|
}
|
|
1499
1474
|
patchValue(e) {
|
|
1500
1475
|
U(() => {
|
|
1501
1476
|
for (const [t, i] of Object.entries(e)) {
|
|
1502
|
-
const
|
|
1503
|
-
|
|
1477
|
+
const s = this._fields.get(t);
|
|
1478
|
+
s && i !== void 0 && s.setValue(i);
|
|
1504
1479
|
}
|
|
1505
1480
|
});
|
|
1506
1481
|
}
|
|
@@ -1523,8 +1498,8 @@ class S extends F {
|
|
|
1523
1498
|
*/
|
|
1524
1499
|
reset(e) {
|
|
1525
1500
|
this._fields.forEach((t, i) => {
|
|
1526
|
-
const
|
|
1527
|
-
t.reset(
|
|
1501
|
+
const s = e?.[i];
|
|
1502
|
+
t.reset(s);
|
|
1528
1503
|
});
|
|
1529
1504
|
}
|
|
1530
1505
|
/**
|
|
@@ -1639,7 +1614,7 @@ class S extends F {
|
|
|
1639
1614
|
applyValidationSchema(e) {
|
|
1640
1615
|
this.validationRegistry.beginRegistration();
|
|
1641
1616
|
try {
|
|
1642
|
-
const t =
|
|
1617
|
+
const t = I();
|
|
1643
1618
|
e(t);
|
|
1644
1619
|
const i = this.getProxy();
|
|
1645
1620
|
this.validationRegistry.endRegistration(i);
|
|
@@ -1654,7 +1629,7 @@ class S extends F {
|
|
|
1654
1629
|
applyBehaviorSchema(e) {
|
|
1655
1630
|
this.behaviorRegistry.beginRegistration();
|
|
1656
1631
|
try {
|
|
1657
|
-
const t =
|
|
1632
|
+
const t = I();
|
|
1658
1633
|
return e(t), this.behaviorRegistry.endRegistration(this.getProxy()).cleanup;
|
|
1659
1634
|
} catch (t) {
|
|
1660
1635
|
throw console.error("Error applying behavior schema:", t), t;
|
|
@@ -1696,13 +1671,13 @@ class S extends F {
|
|
|
1696
1671
|
if (t.length === 0)
|
|
1697
1672
|
return;
|
|
1698
1673
|
let i = this;
|
|
1699
|
-
for (const
|
|
1700
|
-
if (!(i instanceof
|
|
1701
|
-
if (
|
|
1674
|
+
for (const s of t) {
|
|
1675
|
+
if (!(i instanceof b) || (i = i.getField(s.key), !i)) return;
|
|
1676
|
+
if (s.index !== void 0)
|
|
1702
1677
|
if ("at" in i && "length" in i && typeof i.at == "function") {
|
|
1703
|
-
const
|
|
1704
|
-
if (!
|
|
1705
|
-
i =
|
|
1678
|
+
const a = i.at(s.index);
|
|
1679
|
+
if (!a) return;
|
|
1680
|
+
i = a;
|
|
1706
1681
|
} else
|
|
1707
1682
|
return;
|
|
1708
1683
|
}
|
|
@@ -1751,15 +1726,15 @@ class S extends F {
|
|
|
1751
1726
|
* Связывает два поля: при изменении source автоматически обновляется target
|
|
1752
1727
|
*/
|
|
1753
1728
|
linkFields(e, t, i) {
|
|
1754
|
-
const
|
|
1755
|
-
if (!
|
|
1729
|
+
const s = this._fields.get(e), a = this._fields.get(t);
|
|
1730
|
+
if (!s || !a)
|
|
1756
1731
|
return () => {
|
|
1757
1732
|
};
|
|
1758
|
-
const
|
|
1759
|
-
const l =
|
|
1760
|
-
|
|
1761
|
-
}),
|
|
1762
|
-
return this.disposers.add(
|
|
1733
|
+
const o = E(() => {
|
|
1734
|
+
const l = s.value.value, d = i ? i(l) : l;
|
|
1735
|
+
a.setValue(d, { emitEvent: !1 });
|
|
1736
|
+
}), n = `linkFields-${Date.now()}-${Math.random()}`;
|
|
1737
|
+
return this.disposers.add(n, o);
|
|
1763
1738
|
}
|
|
1764
1739
|
/**
|
|
1765
1740
|
* Подписка на изменения вложенного поля по строковому пути
|
|
@@ -1793,11 +1768,11 @@ class S extends F {
|
|
|
1793
1768
|
if (!i)
|
|
1794
1769
|
return () => {
|
|
1795
1770
|
};
|
|
1796
|
-
const
|
|
1797
|
-
const
|
|
1798
|
-
t(
|
|
1799
|
-
}),
|
|
1800
|
-
return this.disposers.add(
|
|
1771
|
+
const s = E(() => {
|
|
1772
|
+
const o = i.value.value;
|
|
1773
|
+
t(o);
|
|
1774
|
+
}), a = `watchField-${Date.now()}-${Math.random()}`;
|
|
1775
|
+
return this.disposers.add(a, s);
|
|
1801
1776
|
}
|
|
1802
1777
|
/**
|
|
1803
1778
|
* Hook: вызывается после disable()
|
|
@@ -1820,7 +1795,7 @@ class S extends F {
|
|
|
1820
1795
|
});
|
|
1821
1796
|
}
|
|
1822
1797
|
}
|
|
1823
|
-
class
|
|
1798
|
+
class C extends O {
|
|
1824
1799
|
// ============================================================================
|
|
1825
1800
|
// Приватные поля
|
|
1826
1801
|
// ============================================================================
|
|
@@ -1858,8 +1833,8 @@ class T extends F {
|
|
|
1858
1833
|
this.push(i);
|
|
1859
1834
|
this.length = u(() => this.items.value.length), this.value = u(() => this.items.value.map((i) => i.value.value)), this.valid = u(() => this.items.value.every((i) => i.valid.value)), this.invalid = u(() => !this.valid.value), this.pending = u(() => this.items.value.some((i) => i.pending.value)), this.touched = u(() => this.items.value.some((i) => i.touched.value)), this.dirty = u(() => this.items.value.some((i) => i.dirty.value)), this.errors = u(() => {
|
|
1860
1835
|
const i = [];
|
|
1861
|
-
return this.items.value.forEach((
|
|
1862
|
-
i.push(...
|
|
1836
|
+
return this.items.value.forEach((s) => {
|
|
1837
|
+
i.push(...s.errors.value);
|
|
1863
1838
|
}), i;
|
|
1864
1839
|
}), this.status = u(() => this.pending.value ? "pending" : this.invalid.value ? "invalid" : "valid");
|
|
1865
1840
|
}
|
|
@@ -1889,8 +1864,8 @@ class T extends F {
|
|
|
1889
1864
|
insert(e, t) {
|
|
1890
1865
|
if (e < 0 || e > this.items.value.length)
|
|
1891
1866
|
return;
|
|
1892
|
-
const i = this.createItem(t),
|
|
1893
|
-
|
|
1867
|
+
const i = this.createItem(t), s = [...this.items.value];
|
|
1868
|
+
s.splice(e, 0, i), this.items.value = s;
|
|
1894
1869
|
}
|
|
1895
1870
|
/**
|
|
1896
1871
|
* Удалить все элементы массива
|
|
@@ -2044,7 +2019,7 @@ class T extends F {
|
|
|
2044
2019
|
*/
|
|
2045
2020
|
createItem(e) {
|
|
2046
2021
|
if (this.isGroupSchema(this.itemSchema)) {
|
|
2047
|
-
const t = new
|
|
2022
|
+
const t = new b(this.itemSchema);
|
|
2048
2023
|
return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
|
|
2049
2024
|
}
|
|
2050
2025
|
throw new Error(
|
|
@@ -2132,13 +2107,13 @@ class T extends F {
|
|
|
2132
2107
|
*/
|
|
2133
2108
|
watchItems(e, t) {
|
|
2134
2109
|
const i = E(() => {
|
|
2135
|
-
const
|
|
2136
|
-
if (
|
|
2137
|
-
return
|
|
2110
|
+
const a = this.items.value.map((o) => {
|
|
2111
|
+
if (o instanceof b)
|
|
2112
|
+
return o.getFieldByPath(e)?.value.value;
|
|
2138
2113
|
});
|
|
2139
|
-
t(
|
|
2140
|
-
}),
|
|
2141
|
-
return this.disposers.add(
|
|
2114
|
+
t(a);
|
|
2115
|
+
}), s = `watchItems-${Date.now()}-${Math.random()}`;
|
|
2116
|
+
return this.disposers.add(s, i);
|
|
2142
2117
|
}
|
|
2143
2118
|
/**
|
|
2144
2119
|
* Подписка на изменение длины массива
|
|
@@ -2164,8 +2139,8 @@ class T extends F {
|
|
|
2164
2139
|
*/
|
|
2165
2140
|
watchLength(e) {
|
|
2166
2141
|
const t = E(() => {
|
|
2167
|
-
const
|
|
2168
|
-
e(
|
|
2142
|
+
const s = this.length.value;
|
|
2143
|
+
e(s);
|
|
2169
2144
|
}), i = `watchLength-${Date.now()}-${Math.random()}`;
|
|
2170
2145
|
return this.disposers.add(i, t);
|
|
2171
2146
|
}
|
|
@@ -2283,13 +2258,13 @@ class X {
|
|
|
2283
2258
|
return new J(e);
|
|
2284
2259
|
if (this.isArrayConfig(e)) {
|
|
2285
2260
|
const t = e;
|
|
2286
|
-
return new
|
|
2261
|
+
return new C(
|
|
2287
2262
|
t.schema,
|
|
2288
2263
|
t.initialItems
|
|
2289
2264
|
);
|
|
2290
2265
|
}
|
|
2291
2266
|
if (this.isGroupConfig(e))
|
|
2292
|
-
return new
|
|
2267
|
+
return new b(e);
|
|
2293
2268
|
throw new Error(
|
|
2294
2269
|
`NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
|
|
2295
2270
|
e
|
|
@@ -2323,11 +2298,11 @@ class X {
|
|
|
2323
2298
|
*/
|
|
2324
2299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2325
2300
|
createArrayNodeFromArray(e) {
|
|
2326
|
-
const [t, ...i] = e,
|
|
2327
|
-
this.isGroupConfig(t) &&
|
|
2328
|
-
for (const
|
|
2329
|
-
this.isGroupConfig(
|
|
2330
|
-
return new
|
|
2301
|
+
const [t, ...i] = e, s = [];
|
|
2302
|
+
this.isGroupConfig(t) && s.push(this.extractValues(t));
|
|
2303
|
+
for (const a of i)
|
|
2304
|
+
this.isGroupConfig(a) ? s.push(this.extractValues(a)) : s.push(a);
|
|
2305
|
+
return new C(t, s);
|
|
2331
2306
|
}
|
|
2332
2307
|
/**
|
|
2333
2308
|
* Извлечь значения из схемы (рекурсивно)
|
|
@@ -2365,8 +2340,8 @@ class X {
|
|
|
2365
2340
|
return e.map((t) => this.extractValues(t));
|
|
2366
2341
|
if (this.isGroupConfig(e)) {
|
|
2367
2342
|
const t = {};
|
|
2368
|
-
for (const [i,
|
|
2369
|
-
t[i] = this.extractValues(
|
|
2343
|
+
for (const [i, s] of Object.entries(e))
|
|
2344
|
+
t[i] = this.extractValues(s);
|
|
2370
2345
|
return t;
|
|
2371
2346
|
}
|
|
2372
2347
|
return e;
|
|
@@ -2496,10 +2471,10 @@ class fe {
|
|
|
2496
2471
|
}
|
|
2497
2472
|
this.timer = setTimeout(async () => {
|
|
2498
2473
|
try {
|
|
2499
|
-
const
|
|
2500
|
-
t(
|
|
2501
|
-
} catch (
|
|
2502
|
-
i(
|
|
2474
|
+
const s = await e();
|
|
2475
|
+
t(s);
|
|
2476
|
+
} catch (s) {
|
|
2477
|
+
i(s);
|
|
2503
2478
|
}
|
|
2504
2479
|
}, this.delay);
|
|
2505
2480
|
});
|
|
@@ -2571,25 +2546,25 @@ class fe {
|
|
|
2571
2546
|
return this.timer !== void 0;
|
|
2572
2547
|
}
|
|
2573
2548
|
}
|
|
2574
|
-
function ve(
|
|
2575
|
-
return new
|
|
2549
|
+
function ve(r) {
|
|
2550
|
+
return new b(r);
|
|
2576
2551
|
}
|
|
2577
|
-
function Z(
|
|
2552
|
+
function Z(r) {
|
|
2578
2553
|
return {
|
|
2579
2554
|
type: "static",
|
|
2580
2555
|
load: async () => ({
|
|
2581
|
-
items:
|
|
2582
|
-
totalCount:
|
|
2556
|
+
items: r,
|
|
2557
|
+
totalCount: r.length
|
|
2583
2558
|
})
|
|
2584
2559
|
};
|
|
2585
2560
|
}
|
|
2586
|
-
function ee(
|
|
2561
|
+
function ee(r) {
|
|
2587
2562
|
let e = null;
|
|
2588
2563
|
return {
|
|
2589
2564
|
type: "preload",
|
|
2590
2565
|
load: async (t) => {
|
|
2591
2566
|
if (!e) {
|
|
2592
|
-
const i = await
|
|
2567
|
+
const i = await r(t);
|
|
2593
2568
|
e = {
|
|
2594
2569
|
items: i,
|
|
2595
2570
|
totalCount: i.length
|
|
@@ -2599,11 +2574,11 @@ function ee(a) {
|
|
|
2599
2574
|
}
|
|
2600
2575
|
};
|
|
2601
2576
|
}
|
|
2602
|
-
function te(
|
|
2577
|
+
function te(r) {
|
|
2603
2578
|
return {
|
|
2604
2579
|
type: "partial",
|
|
2605
2580
|
load: async (e) => {
|
|
2606
|
-
const t = await
|
|
2581
|
+
const t = await r(e);
|
|
2607
2582
|
return {
|
|
2608
2583
|
items: t,
|
|
2609
2584
|
totalCount: t.length
|
|
@@ -2617,31 +2592,31 @@ const pe = {
|
|
|
2617
2592
|
preload: ee,
|
|
2618
2593
|
partial: te
|
|
2619
2594
|
};
|
|
2620
|
-
var
|
|
2621
|
-
var
|
|
2595
|
+
var V = { exports: {} }, k = {};
|
|
2596
|
+
var D;
|
|
2622
2597
|
function ie() {
|
|
2623
|
-
if (
|
|
2624
|
-
|
|
2625
|
-
var
|
|
2598
|
+
if (D) return k;
|
|
2599
|
+
D = 1;
|
|
2600
|
+
var r = B;
|
|
2626
2601
|
function e(c, f) {
|
|
2627
2602
|
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
|
|
2628
2603
|
}
|
|
2629
|
-
var t = typeof Object.is == "function" ? Object.is : e, i =
|
|
2630
|
-
function
|
|
2604
|
+
var t = typeof Object.is == "function" ? Object.is : e, i = r.useState, s = r.useEffect, a = r.useLayoutEffect, o = r.useDebugValue;
|
|
2605
|
+
function n(c, f) {
|
|
2631
2606
|
var h = f(), v = i({ inst: { value: h, getSnapshot: f } }), p = v[0].inst, g = v[1];
|
|
2632
|
-
return
|
|
2607
|
+
return a(
|
|
2633
2608
|
function() {
|
|
2634
2609
|
p.value = h, p.getSnapshot = f, l(p) && g({ inst: p });
|
|
2635
2610
|
},
|
|
2636
2611
|
[c, h, f]
|
|
2637
|
-
),
|
|
2612
|
+
), s(
|
|
2638
2613
|
function() {
|
|
2639
2614
|
return l(p) && g({ inst: p }), c(function() {
|
|
2640
2615
|
l(p) && g({ inst: p });
|
|
2641
2616
|
});
|
|
2642
2617
|
},
|
|
2643
2618
|
[c]
|
|
2644
|
-
),
|
|
2619
|
+
), o(h), h;
|
|
2645
2620
|
}
|
|
2646
2621
|
function l(c) {
|
|
2647
2622
|
var f = c.getSnapshot;
|
|
@@ -2656,40 +2631,40 @@ function ie() {
|
|
|
2656
2631
|
function d(c, f) {
|
|
2657
2632
|
return f();
|
|
2658
2633
|
}
|
|
2659
|
-
var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d :
|
|
2660
|
-
return k.useSyncExternalStore =
|
|
2634
|
+
var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : n;
|
|
2635
|
+
return k.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : m, k;
|
|
2661
2636
|
}
|
|
2662
2637
|
var x = {};
|
|
2663
|
-
var
|
|
2664
|
-
function
|
|
2665
|
-
return
|
|
2666
|
-
function
|
|
2638
|
+
var N;
|
|
2639
|
+
function se() {
|
|
2640
|
+
return N || (N = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
2641
|
+
function r(h, v) {
|
|
2667
2642
|
return h === v && (h !== 0 || 1 / h === 1 / v) || h !== h && v !== v;
|
|
2668
2643
|
}
|
|
2669
2644
|
function e(h, v) {
|
|
2670
|
-
m ||
|
|
2645
|
+
m || s.startTransition === void 0 || (m = !0, console.error(
|
|
2671
2646
|
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
2672
2647
|
));
|
|
2673
2648
|
var p = v();
|
|
2674
2649
|
if (!c) {
|
|
2675
2650
|
var g = v();
|
|
2676
|
-
|
|
2651
|
+
a(p, g) || (console.error(
|
|
2677
2652
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
2678
2653
|
), c = !0);
|
|
2679
2654
|
}
|
|
2680
|
-
g =
|
|
2655
|
+
g = o({
|
|
2681
2656
|
inst: { value: p, getSnapshot: v }
|
|
2682
2657
|
});
|
|
2683
|
-
var _ = g[0].inst,
|
|
2658
|
+
var _ = g[0].inst, A = g[1];
|
|
2684
2659
|
return l(
|
|
2685
2660
|
function() {
|
|
2686
|
-
_.value = p, _.getSnapshot = v, t(_) &&
|
|
2661
|
+
_.value = p, _.getSnapshot = v, t(_) && A({ inst: _ });
|
|
2687
2662
|
},
|
|
2688
2663
|
[h, p, v]
|
|
2689
|
-
),
|
|
2664
|
+
), n(
|
|
2690
2665
|
function() {
|
|
2691
|
-
return t(_) &&
|
|
2692
|
-
t(_) &&
|
|
2666
|
+
return t(_) && A({ inst: _ }), h(function() {
|
|
2667
|
+
t(_) && A({ inst: _ });
|
|
2693
2668
|
});
|
|
2694
2669
|
},
|
|
2695
2670
|
[h]
|
|
@@ -2700,7 +2675,7 @@ function re() {
|
|
|
2700
2675
|
h = h.value;
|
|
2701
2676
|
try {
|
|
2702
2677
|
var p = v();
|
|
2703
|
-
return !
|
|
2678
|
+
return !a(h, p);
|
|
2704
2679
|
} catch {
|
|
2705
2680
|
return !0;
|
|
2706
2681
|
}
|
|
@@ -2709,51 +2684,51 @@ function re() {
|
|
|
2709
2684
|
return v();
|
|
2710
2685
|
}
|
|
2711
2686
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
2712
|
-
var
|
|
2713
|
-
x.useSyncExternalStore =
|
|
2687
|
+
var s = B, a = typeof Object.is == "function" ? Object.is : r, o = s.useState, n = s.useEffect, l = s.useLayoutEffect, d = s.useDebugValue, m = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? i : e;
|
|
2688
|
+
x.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
2714
2689
|
})()), x;
|
|
2715
2690
|
}
|
|
2716
|
-
var
|
|
2717
|
-
function
|
|
2718
|
-
return
|
|
2691
|
+
var M;
|
|
2692
|
+
function re() {
|
|
2693
|
+
return M || (M = 1, process.env.NODE_ENV === "production" ? V.exports = ie() : V.exports = se()), V.exports;
|
|
2719
2694
|
}
|
|
2720
|
-
var $ =
|
|
2721
|
-
function ae(
|
|
2722
|
-
if (
|
|
2723
|
-
if (
|
|
2724
|
-
for (let t = 0; t <
|
|
2725
|
-
if (
|
|
2695
|
+
var $ = re();
|
|
2696
|
+
function ae(r, e) {
|
|
2697
|
+
if (r === e) return !0;
|
|
2698
|
+
if (r.length !== e.length) return !1;
|
|
2699
|
+
for (let t = 0; t < r.length; t++)
|
|
2700
|
+
if (r[t] !== e[t]) return !1;
|
|
2726
2701
|
return !0;
|
|
2727
2702
|
}
|
|
2728
|
-
function G(
|
|
2703
|
+
function G(r, e, t) {
|
|
2729
2704
|
const i = L(null);
|
|
2730
2705
|
if (i.current === null) {
|
|
2731
|
-
const
|
|
2732
|
-
for (const
|
|
2733
|
-
n
|
|
2734
|
-
i.current = { ...
|
|
2735
|
-
}
|
|
2736
|
-
const
|
|
2737
|
-
(
|
|
2738
|
-
let
|
|
2706
|
+
const o = {};
|
|
2707
|
+
for (const n in r)
|
|
2708
|
+
o[n] = r[n].value;
|
|
2709
|
+
i.current = { ...o, __snapshot: null };
|
|
2710
|
+
}
|
|
2711
|
+
const s = S(
|
|
2712
|
+
(o) => {
|
|
2713
|
+
let n = !0;
|
|
2739
2714
|
return E(() => {
|
|
2740
|
-
for (const d in
|
|
2741
|
-
|
|
2742
|
-
if (
|
|
2743
|
-
|
|
2715
|
+
for (const d in r)
|
|
2716
|
+
r[d].value;
|
|
2717
|
+
if (n) {
|
|
2718
|
+
n = !1;
|
|
2744
2719
|
return;
|
|
2745
2720
|
}
|
|
2746
|
-
|
|
2721
|
+
o();
|
|
2747
2722
|
});
|
|
2748
2723
|
},
|
|
2749
|
-
[
|
|
2750
|
-
),
|
|
2751
|
-
const
|
|
2752
|
-
for (const d in
|
|
2753
|
-
|
|
2724
|
+
[r]
|
|
2725
|
+
), a = S(() => {
|
|
2726
|
+
const o = i.current, n = {};
|
|
2727
|
+
for (const d in r)
|
|
2728
|
+
n[d] = r[d].value;
|
|
2754
2729
|
let l = !1;
|
|
2755
2730
|
for (const d of e) {
|
|
2756
|
-
const { key: m, useShallowArrayEqual: c } = d, f =
|
|
2731
|
+
const { key: m, useShallowArrayEqual: c } = d, f = n[m], h = o[m];
|
|
2757
2732
|
if (c) {
|
|
2758
2733
|
if (!ae(h, f)) {
|
|
2759
2734
|
l = !0;
|
|
@@ -2764,25 +2739,25 @@ function G(a, e, t) {
|
|
|
2764
2739
|
break;
|
|
2765
2740
|
}
|
|
2766
2741
|
}
|
|
2767
|
-
if (!l &&
|
|
2768
|
-
return
|
|
2769
|
-
for (const d in
|
|
2770
|
-
|
|
2771
|
-
return
|
|
2772
|
-
}, [
|
|
2773
|
-
return $.useSyncExternalStore(
|
|
2742
|
+
if (!l && o.__snapshot)
|
|
2743
|
+
return o.__snapshot;
|
|
2744
|
+
for (const d in r)
|
|
2745
|
+
o[d] = n[d];
|
|
2746
|
+
return o.__snapshot = t(n), o.__snapshot;
|
|
2747
|
+
}, [r, t]);
|
|
2748
|
+
return $.useSyncExternalStore(s, a, a);
|
|
2774
2749
|
}
|
|
2775
|
-
function ne(
|
|
2750
|
+
function ne(r) {
|
|
2776
2751
|
const e = {
|
|
2777
|
-
value:
|
|
2778
|
-
disabled:
|
|
2779
|
-
errors:
|
|
2780
|
-
pending:
|
|
2781
|
-
valid:
|
|
2782
|
-
invalid:
|
|
2783
|
-
touched:
|
|
2784
|
-
shouldShowError:
|
|
2785
|
-
componentProps:
|
|
2752
|
+
value: r.value,
|
|
2753
|
+
disabled: r.disabled,
|
|
2754
|
+
errors: r.errors,
|
|
2755
|
+
pending: r.pending,
|
|
2756
|
+
valid: r.valid,
|
|
2757
|
+
invalid: r.invalid,
|
|
2758
|
+
touched: r.touched,
|
|
2759
|
+
shouldShowError: r.shouldShowError,
|
|
2760
|
+
componentProps: r.componentProps
|
|
2786
2761
|
}, t = [
|
|
2787
2762
|
{ key: "value" },
|
|
2788
2763
|
{ key: "disabled" },
|
|
@@ -2793,32 +2768,32 @@ function ne(a) {
|
|
|
2793
2768
|
{ key: "touched" },
|
|
2794
2769
|
{ key: "shouldShowError" },
|
|
2795
2770
|
{ key: "componentProps" }
|
|
2796
|
-
], i =
|
|
2797
|
-
(
|
|
2798
|
-
value:
|
|
2799
|
-
pending:
|
|
2800
|
-
disabled:
|
|
2801
|
-
errors:
|
|
2802
|
-
valid:
|
|
2803
|
-
invalid:
|
|
2804
|
-
touched:
|
|
2805
|
-
shouldShowError:
|
|
2806
|
-
componentProps:
|
|
2771
|
+
], i = S(
|
|
2772
|
+
(s) => ({
|
|
2773
|
+
value: s.value,
|
|
2774
|
+
pending: s.pending,
|
|
2775
|
+
disabled: s.disabled,
|
|
2776
|
+
errors: s.errors,
|
|
2777
|
+
valid: s.valid,
|
|
2778
|
+
invalid: s.invalid,
|
|
2779
|
+
touched: s.touched,
|
|
2780
|
+
shouldShowError: s.shouldShowError,
|
|
2781
|
+
componentProps: s.componentProps
|
|
2807
2782
|
}),
|
|
2808
2783
|
[]
|
|
2809
2784
|
);
|
|
2810
2785
|
return G(e, t, i);
|
|
2811
2786
|
}
|
|
2812
|
-
function oe(
|
|
2787
|
+
function oe(r) {
|
|
2813
2788
|
const e = {
|
|
2814
|
-
value:
|
|
2815
|
-
length:
|
|
2816
|
-
errors:
|
|
2817
|
-
pending:
|
|
2818
|
-
valid:
|
|
2819
|
-
invalid:
|
|
2820
|
-
touched:
|
|
2821
|
-
dirty:
|
|
2789
|
+
value: r.value,
|
|
2790
|
+
length: r.length,
|
|
2791
|
+
errors: r.errors,
|
|
2792
|
+
pending: r.pending,
|
|
2793
|
+
valid: r.valid,
|
|
2794
|
+
invalid: r.invalid,
|
|
2795
|
+
touched: r.touched,
|
|
2796
|
+
dirty: r.dirty
|
|
2822
2797
|
}, t = [
|
|
2823
2798
|
{ key: "value" },
|
|
2824
2799
|
{ key: "length" },
|
|
@@ -2828,24 +2803,24 @@ function oe(a) {
|
|
|
2828
2803
|
{ key: "invalid" },
|
|
2829
2804
|
{ key: "touched" },
|
|
2830
2805
|
{ key: "dirty" }
|
|
2831
|
-
], i =
|
|
2832
|
-
(
|
|
2833
|
-
value:
|
|
2834
|
-
length:
|
|
2835
|
-
pending:
|
|
2836
|
-
errors:
|
|
2837
|
-
valid:
|
|
2838
|
-
invalid:
|
|
2839
|
-
touched:
|
|
2840
|
-
dirty:
|
|
2806
|
+
], i = S(
|
|
2807
|
+
(s) => ({
|
|
2808
|
+
value: s.value,
|
|
2809
|
+
length: s.length,
|
|
2810
|
+
pending: s.pending,
|
|
2811
|
+
errors: s.errors,
|
|
2812
|
+
valid: s.valid,
|
|
2813
|
+
invalid: s.invalid,
|
|
2814
|
+
touched: s.touched,
|
|
2815
|
+
dirty: s.dirty
|
|
2841
2816
|
}),
|
|
2842
2817
|
[]
|
|
2843
2818
|
);
|
|
2844
2819
|
return G(e, t, i);
|
|
2845
2820
|
}
|
|
2846
|
-
function ye(
|
|
2847
|
-
const e =
|
|
2848
|
-
return
|
|
2821
|
+
function ye(r) {
|
|
2822
|
+
const e = r && "length" in r && "map" in r;
|
|
2823
|
+
return r ? e ? oe(r) : ne(r) : {
|
|
2849
2824
|
value: [],
|
|
2850
2825
|
length: 0,
|
|
2851
2826
|
pending: !1,
|
|
@@ -2856,56 +2831,56 @@ function ye(a) {
|
|
|
2856
2831
|
dirty: !1
|
|
2857
2832
|
};
|
|
2858
2833
|
}
|
|
2859
|
-
function me(
|
|
2860
|
-
const e = L({ value:
|
|
2861
|
-
(
|
|
2862
|
-
let
|
|
2834
|
+
function me(r) {
|
|
2835
|
+
const e = L({ value: r.value.value }), t = S(
|
|
2836
|
+
(s) => {
|
|
2837
|
+
let a = !0;
|
|
2863
2838
|
return E(() => {
|
|
2864
|
-
if (
|
|
2865
|
-
|
|
2839
|
+
if (r.value.value, a) {
|
|
2840
|
+
a = !1;
|
|
2866
2841
|
return;
|
|
2867
2842
|
}
|
|
2868
|
-
|
|
2843
|
+
s();
|
|
2869
2844
|
});
|
|
2870
2845
|
},
|
|
2871
|
-
[
|
|
2872
|
-
), i =
|
|
2873
|
-
const
|
|
2874
|
-
return e.current.value ===
|
|
2875
|
-
}, [
|
|
2846
|
+
[r]
|
|
2847
|
+
), i = S(() => {
|
|
2848
|
+
const s = r.value.value;
|
|
2849
|
+
return e.current.value === s ? e.current.value : (e.current.value = s, s);
|
|
2850
|
+
}, [r]);
|
|
2876
2851
|
return $.useSyncExternalStore(t, i, i);
|
|
2877
2852
|
}
|
|
2878
2853
|
export {
|
|
2879
|
-
|
|
2854
|
+
C as ArrayNode,
|
|
2880
2855
|
fe as Debouncer,
|
|
2881
|
-
|
|
2856
|
+
w as ErrorStrategy,
|
|
2882
2857
|
J as FieldNode,
|
|
2883
2858
|
Q as FieldPathNavigator,
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2859
|
+
F as FormErrorHandler,
|
|
2860
|
+
O as FormNode,
|
|
2861
|
+
b as GroupNode,
|
|
2887
2862
|
X as NodeFactory,
|
|
2888
|
-
|
|
2863
|
+
Fe as RegistryStack,
|
|
2889
2864
|
pe as Resources,
|
|
2890
2865
|
P as SubscriptionManager,
|
|
2891
2866
|
Ee as behaviors,
|
|
2892
|
-
|
|
2867
|
+
I as createFieldPath,
|
|
2893
2868
|
ve as createForm,
|
|
2894
|
-
|
|
2869
|
+
Oe as extractKey,
|
|
2895
2870
|
Pe as extractPath,
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2871
|
+
Te as getCurrentBehaviorRegistry,
|
|
2872
|
+
Re as getCurrentValidationRegistry,
|
|
2873
|
+
be as getNodeType,
|
|
2874
|
+
R as isArrayNode,
|
|
2875
|
+
T as isFieldNode,
|
|
2876
|
+
Ve as isFormNode,
|
|
2877
|
+
we as isGroupNode,
|
|
2903
2878
|
te as partialResource,
|
|
2904
2879
|
ee as preloadResource,
|
|
2905
2880
|
Z as staticResource,
|
|
2906
|
-
|
|
2881
|
+
Ie as toFieldPath,
|
|
2907
2882
|
ye as useFormControl,
|
|
2908
2883
|
me as useFormControlValue,
|
|
2909
|
-
|
|
2884
|
+
Ae as validateForm,
|
|
2910
2885
|
ke as validators
|
|
2911
2886
|
};
|