@reformer/core 7.0.0-beta.1 → 7.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/core/factories/node-factory.d.ts +2 -1
- package/dist/core/model/behaviors.d.ts +13 -1
- package/dist/core/model/validate-model.d.ts +22 -0
- package/dist/core/nodes/field-node.d.ts +3 -3
- package/dist/core/nodes/group-node.d.ts +3 -5
- package/dist/core/nodes/model-array-node.d.ts +38 -0
- package/dist/core/types/validation-schema.d.ts +8 -2
- package/dist/core/utils/create-form.d.ts +83 -18
- package/dist/core/utils/derived-registry.d.ts +41 -2
- package/dist/core/utils/index.d.ts +0 -4
- package/dist/core/utils/signal-node-registry.d.ts +38 -4
- package/dist/core/validation/validators/email.d.ts +14 -4
- package/dist/core/validation/validators/future-date.d.ts +14 -4
- package/dist/core/validation/validators/index.d.ts +2 -1
- package/dist/core/validation/validators/integer.d.ts +13 -4
- package/dist/core/validation/validators/is-date.d.ts +14 -4
- package/dist/core/validation/validators/is-number.d.ts +15 -5
- package/dist/core/validation/validators/max-age.d.ts +16 -4
- package/dist/core/validation/validators/max-date.d.ts +16 -4
- package/dist/core/validation/validators/max-length.d.ts +18 -4
- package/dist/core/validation/validators/max.d.ts +15 -6
- package/dist/core/validation/validators/min-age.d.ts +16 -4
- package/dist/core/validation/validators/min-date.d.ts +16 -4
- package/dist/core/validation/validators/min-length.d.ts +18 -4
- package/dist/core/validation/validators/min.d.ts +15 -6
- package/dist/core/validation/validators/multiple-of.d.ts +15 -4
- package/dist/core/validation/validators/non-negative.d.ts +13 -4
- package/dist/core/validation/validators/non-zero.d.ts +13 -4
- package/dist/core/validation/validators/past-date.d.ts +14 -3
- package/dist/core/validation/validators/pattern.d.ts +24 -4
- package/dist/core/validation/validators/phone.d.ts +28 -4
- package/dist/core/validation/validators/required.d.ts +16 -5
- package/dist/core/validation/validators/url.d.ts +30 -7
- package/dist/hooks/useFormControlValue.d.ts +15 -10
- package/dist/index.js +562 -896
- package/llms.txt +2567 -2854
- package/package.json +1 -1
- package/dist/core/utils/abstract-registry.d.ts +0 -74
- package/dist/core/utils/form-observer.d.ts +0 -176
- package/dist/core/utils/registry-stack.d.ts +0 -69
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { signal as
|
|
2
|
-
import { i as
|
|
3
|
-
import { j as
|
|
4
|
-
import
|
|
5
|
-
import { default as
|
|
1
|
+
import { signal as y, computed as h, effect as _, batch as me, Signal as ie } from "@preact/signals-core";
|
|
2
|
+
import { i as B, d as ye, g as Y } from "./behaviors-O9a1Djj9.js";
|
|
3
|
+
import { j as rt, c as nt, k as at, e as ot, m as lt, a as ut, b as ct, r as ht, f as dt, h as ft, s as pt, t as vt, w as mt } from "./behaviors-O9a1Djj9.js";
|
|
4
|
+
import re, { useRef as q, useCallback as S } from "react";
|
|
5
|
+
import { default as gt } from "./validators.js";
|
|
6
6
|
class I {
|
|
7
7
|
// ============================================================================
|
|
8
8
|
// Protected состояние (для Template Method паттерна)
|
|
@@ -11,17 +11,17 @@ class I {
|
|
|
11
11
|
* Пользователь взаимодействовал с узлом (touched)
|
|
12
12
|
* Protected: наследники могут читать/изменять через методы
|
|
13
13
|
*/
|
|
14
|
-
_touched =
|
|
14
|
+
_touched = y(!1);
|
|
15
15
|
/**
|
|
16
16
|
* Значение узла было изменено (dirty)
|
|
17
17
|
* Protected: наследники могут читать/изменять через методы
|
|
18
18
|
*/
|
|
19
|
-
_dirty =
|
|
19
|
+
_dirty = y(!1);
|
|
20
20
|
/**
|
|
21
21
|
* Текущий статус узла
|
|
22
22
|
* Protected: наследники могут читать/изменять через методы
|
|
23
23
|
*/
|
|
24
|
-
_status =
|
|
24
|
+
_status = y("valid");
|
|
25
25
|
// ============================================================================
|
|
26
26
|
// Публичные computed signals (readonly для внешнего мира)
|
|
27
27
|
// ============================================================================
|
|
@@ -29,33 +29,33 @@ class I {
|
|
|
29
29
|
* Пользователь взаимодействовал с узлом (touched)
|
|
30
30
|
* Computed из _touched для предоставления readonly интерфейса
|
|
31
31
|
*/
|
|
32
|
-
touched =
|
|
32
|
+
touched = h(() => this._touched.value);
|
|
33
33
|
/**
|
|
34
34
|
* Пользователь не взаимодействовал с узлом (untouched)
|
|
35
35
|
*/
|
|
36
|
-
untouched =
|
|
36
|
+
untouched = h(() => !this._touched.value);
|
|
37
37
|
/**
|
|
38
38
|
* Значение узла было изменено (dirty)
|
|
39
39
|
* Computed из _dirty для предоставления readonly интерфейса
|
|
40
40
|
*/
|
|
41
|
-
dirty =
|
|
41
|
+
dirty = h(() => this._dirty.value);
|
|
42
42
|
/**
|
|
43
43
|
* Значение узла не было изменено (pristine)
|
|
44
44
|
*/
|
|
45
|
-
pristine =
|
|
45
|
+
pristine = h(() => !this._dirty.value);
|
|
46
46
|
/**
|
|
47
47
|
* Текущий статус узла
|
|
48
48
|
* Computed из _status для предоставления readonly интерфейса
|
|
49
49
|
*/
|
|
50
|
-
status =
|
|
50
|
+
status = h(() => this._status.value);
|
|
51
51
|
/**
|
|
52
52
|
* Узел отключен (disabled)
|
|
53
53
|
*/
|
|
54
|
-
disabled =
|
|
54
|
+
disabled = h(() => this._status.value === "disabled");
|
|
55
55
|
/**
|
|
56
56
|
* Узел включен (enabled)
|
|
57
57
|
*/
|
|
58
|
-
enabled =
|
|
58
|
+
enabled = h(() => this._status.value !== "disabled");
|
|
59
59
|
/**
|
|
60
60
|
* Получить ошибки валидации с фильтрацией
|
|
61
61
|
*
|
|
@@ -97,17 +97,17 @@ class I {
|
|
|
97
97
|
*/
|
|
98
98
|
getErrors(e) {
|
|
99
99
|
const t = this.errors.value;
|
|
100
|
-
return e ? t.filter((
|
|
101
|
-
if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(
|
|
100
|
+
return e ? t.filter((i) => {
|
|
101
|
+
if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(i.code) || e.message !== void 0 && !i.message.toLowerCase().includes(e.message.toLowerCase()))
|
|
102
102
|
return !1;
|
|
103
103
|
if (e.params !== void 0) {
|
|
104
|
-
if (!
|
|
104
|
+
if (!i.params)
|
|
105
105
|
return !1;
|
|
106
106
|
for (const [r, n] of Object.entries(e.params))
|
|
107
|
-
if (
|
|
107
|
+
if (i.params[r] !== n)
|
|
108
108
|
return !1;
|
|
109
109
|
}
|
|
110
|
-
return !(e.predicate !== void 0 && !e.predicate(
|
|
110
|
+
return !(e.predicate !== void 0 && !e.predicate(i));
|
|
111
111
|
}) : t;
|
|
112
112
|
}
|
|
113
113
|
// ============================================================================
|
|
@@ -280,7 +280,7 @@ class I {
|
|
|
280
280
|
onEnable() {
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
class
|
|
283
|
+
class K {
|
|
284
284
|
/**
|
|
285
285
|
* Хранилище подписок
|
|
286
286
|
* Ключ: уникальный идентификатор подписки
|
|
@@ -462,11 +462,11 @@ const O = {
|
|
|
462
462
|
/** ArrayNode.watchLength() */
|
|
463
463
|
WatchLength: "watchLength"
|
|
464
464
|
};
|
|
465
|
-
let
|
|
466
|
-
function
|
|
467
|
-
return `${
|
|
465
|
+
let ge = 0;
|
|
466
|
+
function N(s) {
|
|
467
|
+
return `${s}-${++ge}`;
|
|
468
468
|
}
|
|
469
|
-
var
|
|
469
|
+
var w = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(w || {});
|
|
470
470
|
class k {
|
|
471
471
|
/**
|
|
472
472
|
* Обработать ошибку согласно заданной стратегии
|
|
@@ -507,9 +507,9 @@ class k {
|
|
|
507
507
|
* }
|
|
508
508
|
* ```
|
|
509
509
|
*/
|
|
510
|
-
static handle(e, t,
|
|
510
|
+
static handle(e, t, i = "throw") {
|
|
511
511
|
const r = this.extractMessage(e);
|
|
512
|
-
switch (
|
|
512
|
+
switch (i) {
|
|
513
513
|
case "throw":
|
|
514
514
|
throw e;
|
|
515
515
|
case "log":
|
|
@@ -573,11 +573,11 @@ class k {
|
|
|
573
573
|
* // { code: 'required', message: 'This field is required', field: 'email' }
|
|
574
574
|
* ```
|
|
575
575
|
*/
|
|
576
|
-
static createValidationError(e, t,
|
|
576
|
+
static createValidationError(e, t, i) {
|
|
577
577
|
return {
|
|
578
578
|
code: e,
|
|
579
579
|
message: t,
|
|
580
|
-
params:
|
|
580
|
+
params: i ? { field: i } : void 0
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
@@ -599,7 +599,7 @@ class k {
|
|
|
599
599
|
return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
class
|
|
602
|
+
class be {
|
|
603
603
|
/** Внутренний сигнал статуса */
|
|
604
604
|
_status;
|
|
605
605
|
/** Публичный read-only сигнал статуса */
|
|
@@ -616,7 +616,7 @@ class Ee {
|
|
|
616
616
|
* @param initial - Начальный статус (по умолчанию 'valid')
|
|
617
617
|
*/
|
|
618
618
|
constructor(e = "valid") {
|
|
619
|
-
this._status =
|
|
619
|
+
this._status = y(e), this.status = h(() => this._status.value), this.valid = h(() => this._status.value === "valid"), this.invalid = h(() => this._status.value === "invalid"), this.pending = h(() => this._status.value === "pending"), this.disabled = h(() => this._status.value === "disabled");
|
|
620
620
|
}
|
|
621
621
|
/**
|
|
622
622
|
* Начать валидацию
|
|
@@ -744,7 +744,7 @@ class Ee {
|
|
|
744
744
|
return this._status.value !== "disabled";
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
-
class
|
|
747
|
+
class _e extends I {
|
|
748
748
|
// ============================================================================
|
|
749
749
|
// Приватные сигналы
|
|
750
750
|
// ============================================================================
|
|
@@ -798,13 +798,13 @@ class we extends I {
|
|
|
798
798
|
* Менеджер подписок для централизованного cleanup
|
|
799
799
|
* Использует SubscriptionManager вместо массива для управления подписками
|
|
800
800
|
*/
|
|
801
|
-
disposers = new
|
|
801
|
+
disposers = new K();
|
|
802
802
|
component;
|
|
803
803
|
// ============================================================================
|
|
804
804
|
// Конструктор
|
|
805
805
|
// ============================================================================
|
|
806
806
|
constructor(e) {
|
|
807
|
-
super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ??
|
|
807
|
+
super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? y(e.value), this.initialValue = this._value.peek(), this._errors = y([]), this._componentProps = y(e.componentProps || {}), this.statusMachine = new be(e.disabled ? "disabled" : "valid"), this.value = h(() => this._value.value), this.valid = h(() => this.statusMachine.valid.value), this.invalid = h(() => this.statusMachine.invalid.value), this.pending = h(() => this.statusMachine.pending.value), this.status = h(() => this.statusMachine.status.value), this.disabled = h(() => this.statusMachine.disabled.value), this.errors = h(() => this._errors.value), this.componentProps = h(() => this._componentProps.value), this.shouldShowError = h(
|
|
808
808
|
() => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
|
|
809
809
|
);
|
|
810
810
|
}
|
|
@@ -817,12 +817,12 @@ class we extends I {
|
|
|
817
817
|
setValue(e, t) {
|
|
818
818
|
if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
|
|
819
819
|
return;
|
|
820
|
-
const
|
|
820
|
+
const i = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
|
|
821
821
|
if (this.updateOn === "change") {
|
|
822
822
|
this.validate();
|
|
823
823
|
return;
|
|
824
824
|
}
|
|
825
|
-
r &&
|
|
825
|
+
r && i && this.validate();
|
|
826
826
|
}
|
|
827
827
|
patchValue(e) {
|
|
828
828
|
this.setValue(e);
|
|
@@ -915,17 +915,17 @@ class we extends I {
|
|
|
915
915
|
const t = e?.debounce ?? this.debounceMs;
|
|
916
916
|
if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
|
|
917
917
|
return this.validateImmediate();
|
|
918
|
-
const
|
|
918
|
+
const i = new AbortController();
|
|
919
919
|
return new Promise((r) => {
|
|
920
|
-
this.pendingValidation = { resolve: r, abortController:
|
|
921
|
-
if (this.validateDebounceTimer = void 0,
|
|
920
|
+
this.pendingValidation = { resolve: r, abortController: i }, this.validateDebounceTimer = setTimeout(async () => {
|
|
921
|
+
if (this.validateDebounceTimer = void 0, i.signal.aborted) {
|
|
922
922
|
r(!1);
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
this.pendingValidation = void 0;
|
|
926
|
-
const n = await this.validateImmediate(
|
|
926
|
+
const n = await this.validateImmediate(i);
|
|
927
927
|
r(n);
|
|
928
|
-
}, t),
|
|
928
|
+
}, t), i.signal.addEventListener(
|
|
929
929
|
"abort",
|
|
930
930
|
() => {
|
|
931
931
|
this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
|
|
@@ -947,12 +947,12 @@ class we extends I {
|
|
|
947
947
|
async validateImmediate(e) {
|
|
948
948
|
const t = e ?? new AbortController();
|
|
949
949
|
e || this.currentAbortController?.abort(), this.currentAbortController = t;
|
|
950
|
-
const { signal:
|
|
950
|
+
const { signal: i } = t, r = [];
|
|
951
951
|
for (const a of this.validators) {
|
|
952
952
|
const o = a(this._value.value);
|
|
953
953
|
o && r.push(o);
|
|
954
954
|
}
|
|
955
|
-
if (
|
|
955
|
+
if (i.aborted)
|
|
956
956
|
return !1;
|
|
957
957
|
if (r.length > 0) {
|
|
958
958
|
this._errors.value = r;
|
|
@@ -961,17 +961,17 @@ class we extends I {
|
|
|
961
961
|
return !1;
|
|
962
962
|
}
|
|
963
963
|
if (this.asyncValidators.length > 0) {
|
|
964
|
-
if (
|
|
964
|
+
if (i.aborted)
|
|
965
965
|
return !1;
|
|
966
966
|
this.statusMachine.startValidation();
|
|
967
967
|
try {
|
|
968
968
|
const a = await Promise.all(
|
|
969
969
|
this.asyncValidators.map(async (l) => {
|
|
970
|
-
if (
|
|
970
|
+
if (i.aborted)
|
|
971
971
|
throw new DOMException("Validation aborted", "AbortError");
|
|
972
972
|
try {
|
|
973
|
-
const u = await l(this._value.value, { signal:
|
|
974
|
-
if (
|
|
973
|
+
const u = await l(this._value.value, { signal: i });
|
|
974
|
+
if (i.aborted)
|
|
975
975
|
throw new DOMException("Validation aborted", "AbortError");
|
|
976
976
|
return u;
|
|
977
977
|
} catch (u) {
|
|
@@ -980,12 +980,12 @@ class we extends I {
|
|
|
980
980
|
return k.handle(
|
|
981
981
|
u,
|
|
982
982
|
"FieldNode AsyncValidator",
|
|
983
|
-
|
|
983
|
+
w.CONVERT
|
|
984
984
|
);
|
|
985
985
|
}
|
|
986
986
|
})
|
|
987
987
|
);
|
|
988
|
-
if (
|
|
988
|
+
if (i.aborted)
|
|
989
989
|
return !1;
|
|
990
990
|
const o = a.filter(Boolean);
|
|
991
991
|
if (o.length > 0) {
|
|
@@ -1000,11 +1000,11 @@ class we extends I {
|
|
|
1000
1000
|
throw a;
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
return
|
|
1003
|
+
return i.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((a) => a.severity !== "warning"));
|
|
1004
1004
|
}
|
|
1005
1005
|
setErrors(e) {
|
|
1006
1006
|
this._errors.value = e;
|
|
1007
|
-
const t = e.some((
|
|
1007
|
+
const t = e.some((i) => i.severity !== "warning");
|
|
1008
1008
|
this.statusMachine.setErrors(t);
|
|
1009
1009
|
}
|
|
1010
1010
|
clearErrors() {
|
|
@@ -1064,13 +1064,13 @@ class we extends I {
|
|
|
1064
1064
|
* @example
|
|
1065
1065
|
* ```typescript
|
|
1066
1066
|
* // Сценарий 1: Instant feedback после submit
|
|
1067
|
-
* const form =
|
|
1067
|
+
* const form = createForm({
|
|
1068
1068
|
* email: {
|
|
1069
1069
|
* value: '',
|
|
1070
1070
|
* component: Input,
|
|
1071
1071
|
* updateOn: 'submit', // Изначально валидация только при submit
|
|
1072
|
-
* validators: [required, email]
|
|
1073
|
-
* }
|
|
1072
|
+
* validators: [required, email],
|
|
1073
|
+
* },
|
|
1074
1074
|
* });
|
|
1075
1075
|
*
|
|
1076
1076
|
* await form.submit(async (values) => {
|
|
@@ -1122,12 +1122,12 @@ class we extends I {
|
|
|
1122
1122
|
* ```
|
|
1123
1123
|
*/
|
|
1124
1124
|
watch(e) {
|
|
1125
|
-
const t = new AbortController(),
|
|
1125
|
+
const t = new AbortController(), i = _(() => {
|
|
1126
1126
|
const n = this.value.value;
|
|
1127
1127
|
e(n, t.signal);
|
|
1128
|
-
}), r =
|
|
1128
|
+
}), r = N(O.Watch);
|
|
1129
1129
|
return this.disposers.add(r, () => {
|
|
1130
|
-
t.abort(),
|
|
1130
|
+
t.abort(), i();
|
|
1131
1131
|
});
|
|
1132
1132
|
}
|
|
1133
1133
|
/**
|
|
@@ -1153,11 +1153,11 @@ class we extends I {
|
|
|
1153
1153
|
* ```
|
|
1154
1154
|
*/
|
|
1155
1155
|
computeFrom(e, t) {
|
|
1156
|
-
const
|
|
1156
|
+
const i = _(() => {
|
|
1157
1157
|
const n = e.map((o) => o.value), a = t(...n);
|
|
1158
1158
|
this.setValue(a, { emitEvent: !1 });
|
|
1159
|
-
}), r =
|
|
1160
|
-
return this.disposers.add(r,
|
|
1159
|
+
}), r = N(O.ComputeFrom);
|
|
1160
|
+
return this.disposers.add(r, i);
|
|
1161
1161
|
}
|
|
1162
1162
|
/**
|
|
1163
1163
|
* Очистить все ресурсы и таймеры
|
|
@@ -1187,13 +1187,13 @@ class we extends I {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1191
|
-
const { getChildren: e, ownErrors: t, disabled:
|
|
1192
|
-
const
|
|
1190
|
+
function H(s) {
|
|
1191
|
+
const { getChildren: e, ownErrors: t, disabled: i } = s, r = h(() => t.value.length > 0 ? !1 : e().every((c) => c.disabled.value || c.valid.value)), n = h(() => !r.value), a = h(() => e().some((c) => c.pending.value)), o = h(() => e().some((c) => c.touched.value)), l = h(() => e().some((c) => c.dirty.value)), u = h(() => {
|
|
1192
|
+
const c = [...t.value];
|
|
1193
1193
|
for (const f of e())
|
|
1194
|
-
|
|
1195
|
-
return
|
|
1196
|
-
}),
|
|
1194
|
+
c.push(...f.errors.value);
|
|
1195
|
+
return c;
|
|
1196
|
+
}), m = h(() => i?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
|
|
1197
1197
|
return {
|
|
1198
1198
|
valid: r,
|
|
1199
1199
|
invalid: n,
|
|
@@ -1201,32 +1201,32 @@ function J(i) {
|
|
|
1201
1201
|
touched: o,
|
|
1202
1202
|
dirty: l,
|
|
1203
1203
|
errors: u,
|
|
1204
|
-
status:
|
|
1204
|
+
status: m
|
|
1205
1205
|
};
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
1208
|
-
return typeof
|
|
1207
|
+
function Ee(s) {
|
|
1208
|
+
return typeof s == "object" && s !== null && "getProxy" in s && typeof s.getProxy == "function";
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1211
|
-
return new Proxy(
|
|
1212
|
-
get: (t,
|
|
1213
|
-
if (
|
|
1214
|
-
return t[
|
|
1215
|
-
if (typeof
|
|
1216
|
-
const r = e.get(
|
|
1217
|
-
return r &&
|
|
1210
|
+
function Ae(s, e) {
|
|
1211
|
+
return new Proxy(s, {
|
|
1212
|
+
get: (t, i) => {
|
|
1213
|
+
if (i in t)
|
|
1214
|
+
return t[i];
|
|
1215
|
+
if (typeof i == "string" && e.has(i)) {
|
|
1216
|
+
const r = e.get(i);
|
|
1217
|
+
return r && Ee(r) ? r.getProxy() : r;
|
|
1218
1218
|
}
|
|
1219
1219
|
},
|
|
1220
|
-
set: (t,
|
|
1221
|
-
has: (t,
|
|
1220
|
+
set: (t, i, r) => typeof i == "string" && e.has(i) ? !1 : (t[i] = r, !0),
|
|
1221
|
+
has: (t, i) => typeof i == "string" && e.has(i) ? !0 : i in t,
|
|
1222
1222
|
ownKeys: (t) => {
|
|
1223
|
-
const
|
|
1224
|
-
return [.../* @__PURE__ */ new Set([...
|
|
1223
|
+
const i = Reflect.ownKeys(t), r = Array.from(e.keys());
|
|
1224
|
+
return [.../* @__PURE__ */ new Set([...i, ...r])];
|
|
1225
1225
|
},
|
|
1226
|
-
getOwnPropertyDescriptor: (t,
|
|
1226
|
+
getOwnPropertyDescriptor: (t, i) => typeof i == "string" && e.has(i) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, i)
|
|
1227
1227
|
});
|
|
1228
1228
|
}
|
|
1229
|
-
class
|
|
1229
|
+
class Se {
|
|
1230
1230
|
/**
|
|
1231
1231
|
* @param form - Форма для отправки
|
|
1232
1232
|
*/
|
|
@@ -1234,9 +1234,9 @@ class ke {
|
|
|
1234
1234
|
this.form = e;
|
|
1235
1235
|
}
|
|
1236
1236
|
/** Внутренний сигнал состояния отправки */
|
|
1237
|
-
_submitting =
|
|
1237
|
+
_submitting = y(!1);
|
|
1238
1238
|
/** Публичный read-only сигнал состояния отправки */
|
|
1239
|
-
submitting =
|
|
1239
|
+
submitting = h(() => this._submitting.value);
|
|
1240
1240
|
/**
|
|
1241
1241
|
* Отправить форму
|
|
1242
1242
|
*
|
|
@@ -1266,8 +1266,8 @@ class ke {
|
|
|
1266
1266
|
* ```
|
|
1267
1267
|
*/
|
|
1268
1268
|
async submit(e, t) {
|
|
1269
|
-
const { skipValidation:
|
|
1270
|
-
if (r || this.form.markAsTouched(), !
|
|
1269
|
+
const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
|
|
1270
|
+
if (r || this.form.markAsTouched(), !i && !await this.form.validate())
|
|
1271
1271
|
return null;
|
|
1272
1272
|
this._submitting.value = !0;
|
|
1273
1273
|
try {
|
|
@@ -1301,8 +1301,8 @@ class ke {
|
|
|
1301
1301
|
* ```
|
|
1302
1302
|
*/
|
|
1303
1303
|
async submitWithResult(e, t) {
|
|
1304
|
-
const { skipValidation:
|
|
1305
|
-
if (r || this.form.markAsTouched(), !
|
|
1304
|
+
const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
|
|
1305
|
+
if (r || this.form.markAsTouched(), !i && !await this.form.validate())
|
|
1306
1306
|
return { success: !1, data: null };
|
|
1307
1307
|
this._submitting.value = !0;
|
|
1308
1308
|
try {
|
|
@@ -1324,16 +1324,16 @@ class ke {
|
|
|
1324
1324
|
return this._submitting.value;
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
|
-
function
|
|
1327
|
+
function we(s) {
|
|
1328
1328
|
const e = [];
|
|
1329
|
-
for (const t of
|
|
1330
|
-
const
|
|
1331
|
-
if (!
|
|
1332
|
-
e.push(
|
|
1329
|
+
for (const t of s.split(".")) {
|
|
1330
|
+
const i = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
|
|
1331
|
+
if (!i) return [];
|
|
1332
|
+
e.push(i[2] !== void 0 ? { key: i[1], index: Number(i[2]) } : { key: i[1] });
|
|
1333
1333
|
}
|
|
1334
1334
|
return e;
|
|
1335
1335
|
}
|
|
1336
|
-
let
|
|
1336
|
+
let x = class ne extends I {
|
|
1337
1337
|
// ============================================================================
|
|
1338
1338
|
// Приватные поля
|
|
1339
1339
|
// ============================================================================
|
|
@@ -1346,7 +1346,7 @@ let T = class oe extends I {
|
|
|
1346
1346
|
/**
|
|
1347
1347
|
* Менеджер подписок для централизованного cleanup
|
|
1348
1348
|
*/
|
|
1349
|
-
disposers = new
|
|
1349
|
+
disposers = new K();
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Ссылка на Proxy-инстанс
|
|
1352
1352
|
*/
|
|
@@ -1358,7 +1358,7 @@ let T = class oe extends I {
|
|
|
1358
1358
|
/**
|
|
1359
1359
|
* Фабрика для создания узлов формы
|
|
1360
1360
|
*/
|
|
1361
|
-
nodeFactory = new
|
|
1361
|
+
nodeFactory = new ke();
|
|
1362
1362
|
// ============================================================================
|
|
1363
1363
|
// Приватные сигналы состояния (inline из StateManager)
|
|
1364
1364
|
// ============================================================================
|
|
@@ -1366,9 +1366,9 @@ let T = class oe extends I {
|
|
|
1366
1366
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1367
1367
|
formSubmitter;
|
|
1368
1368
|
/** Флаг disabled состояния */
|
|
1369
|
-
_disabled =
|
|
1369
|
+
_disabled = y(!1);
|
|
1370
1370
|
/** Form-level validation errors */
|
|
1371
|
-
_formErrors =
|
|
1371
|
+
_formErrors = y([]);
|
|
1372
1372
|
// ============================================================================
|
|
1373
1373
|
// Публичные computed signals
|
|
1374
1374
|
// ============================================================================
|
|
@@ -1382,19 +1382,19 @@ let T = class oe extends I {
|
|
|
1382
1382
|
status;
|
|
1383
1383
|
submitting;
|
|
1384
1384
|
constructor(e) {
|
|
1385
|
-
super(), this.formSubmitter = new
|
|
1386
|
-
const
|
|
1387
|
-
for (const [n, a] of Object.entries(
|
|
1385
|
+
super(), this.formSubmitter = new Se(this);
|
|
1386
|
+
const i = "form" in e ? e.form : e;
|
|
1387
|
+
for (const [n, a] of Object.entries(i)) {
|
|
1388
1388
|
const o = this.createNode(a);
|
|
1389
1389
|
this._fields.set(n, o);
|
|
1390
1390
|
}
|
|
1391
|
-
this.value =
|
|
1391
|
+
this.value = h(() => {
|
|
1392
1392
|
const n = {};
|
|
1393
1393
|
return this._fields.forEach((a, o) => {
|
|
1394
1394
|
n[o] = a.value.value;
|
|
1395
1395
|
}), n;
|
|
1396
1396
|
});
|
|
1397
|
-
const r =
|
|
1397
|
+
const r = H({
|
|
1398
1398
|
getChildren: () => Array.from(this._fields.values()),
|
|
1399
1399
|
ownErrors: this._formErrors,
|
|
1400
1400
|
disabled: this._disabled
|
|
@@ -1409,33 +1409,33 @@ let T = class oe extends I {
|
|
|
1409
1409
|
* @see buildFormProxy
|
|
1410
1410
|
*/
|
|
1411
1411
|
buildProxy() {
|
|
1412
|
-
return
|
|
1412
|
+
return Ae(this, this._fields);
|
|
1413
1413
|
}
|
|
1414
1414
|
// ============================================================================
|
|
1415
1415
|
// Реализация абстрактных методов FormNode
|
|
1416
1416
|
// ============================================================================
|
|
1417
1417
|
getValue() {
|
|
1418
1418
|
const e = {};
|
|
1419
|
-
return this._fields.forEach((t,
|
|
1420
|
-
e[
|
|
1419
|
+
return this._fields.forEach((t, i) => {
|
|
1420
|
+
e[i] = t.getValue();
|
|
1421
1421
|
}), e;
|
|
1422
1422
|
}
|
|
1423
1423
|
setValue(e, t) {
|
|
1424
|
-
for (const [
|
|
1425
|
-
const n = this._fields.get(
|
|
1424
|
+
for (const [i, r] of Object.entries(e)) {
|
|
1425
|
+
const n = this._fields.get(i);
|
|
1426
1426
|
if (n) {
|
|
1427
|
-
if (
|
|
1427
|
+
if (B(n.value)) continue;
|
|
1428
1428
|
n.setValue(r, t);
|
|
1429
1429
|
}
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
1432
|
patchValue(e) {
|
|
1433
|
-
|
|
1434
|
-
for (const [t,
|
|
1433
|
+
me(() => {
|
|
1434
|
+
for (const [t, i] of Object.entries(e)) {
|
|
1435
1435
|
const r = this._fields.get(t);
|
|
1436
|
-
if (r &&
|
|
1437
|
-
if (
|
|
1438
|
-
r.setValue(
|
|
1436
|
+
if (r && i !== void 0) {
|
|
1437
|
+
if (B(r.value)) continue;
|
|
1438
|
+
r.setValue(i, { emitEvent: !1 });
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
1441
|
});
|
|
@@ -1458,8 +1458,8 @@ let T = class oe extends I {
|
|
|
1458
1458
|
* ```
|
|
1459
1459
|
*/
|
|
1460
1460
|
reset(e) {
|
|
1461
|
-
this._fields.forEach((t,
|
|
1462
|
-
const r = e?.[
|
|
1461
|
+
this._fields.forEach((t, i) => {
|
|
1462
|
+
const r = e?.[i];
|
|
1463
1463
|
t.reset(r);
|
|
1464
1464
|
});
|
|
1465
1465
|
}
|
|
@@ -1516,14 +1516,12 @@ let T = class oe extends I {
|
|
|
1516
1516
|
* @example
|
|
1517
1517
|
* ```typescript
|
|
1518
1518
|
* const form = new GroupNode({
|
|
1519
|
-
*
|
|
1520
|
-
*
|
|
1521
|
-
* name: new FieldNode({ value: '' })
|
|
1522
|
-
* }
|
|
1519
|
+
* email: { value: '', component: Input },
|
|
1520
|
+
* name: { value: '', component: Input },
|
|
1523
1521
|
* });
|
|
1524
1522
|
*
|
|
1525
1523
|
* const proxy = form.getProxy();
|
|
1526
|
-
* console.log(proxy.email.value); // Прямой доступ к полю
|
|
1524
|
+
* console.log(proxy.email.value.value); // Прямой доступ к полю
|
|
1527
1525
|
* ```
|
|
1528
1526
|
*/
|
|
1529
1527
|
getProxy() {
|
|
@@ -1605,21 +1603,21 @@ let T = class oe extends I {
|
|
|
1605
1603
|
getFieldByPath(e) {
|
|
1606
1604
|
if (e.startsWith(".") || e.endsWith("."))
|
|
1607
1605
|
return;
|
|
1608
|
-
const t =
|
|
1606
|
+
const t = we(e);
|
|
1609
1607
|
if (t.length === 0)
|
|
1610
1608
|
return;
|
|
1611
|
-
let
|
|
1609
|
+
let i = this;
|
|
1612
1610
|
for (const r of t) {
|
|
1613
|
-
if (!(
|
|
1611
|
+
if (!(i instanceof ne) || (i = i.getField(r.key), !i)) return;
|
|
1614
1612
|
if (r.index !== void 0)
|
|
1615
|
-
if ("at" in
|
|
1616
|
-
const n =
|
|
1613
|
+
if ("at" in i && "length" in i && typeof i.at == "function") {
|
|
1614
|
+
const n = i.at(r.index);
|
|
1617
1615
|
if (!n) return;
|
|
1618
|
-
|
|
1616
|
+
i = n;
|
|
1619
1617
|
} else
|
|
1620
1618
|
return;
|
|
1621
1619
|
}
|
|
1622
|
-
return
|
|
1620
|
+
return i;
|
|
1623
1621
|
}
|
|
1624
1622
|
// ============================================================================
|
|
1625
1623
|
// Private методы для создания узлов
|
|
@@ -1648,16 +1646,16 @@ let T = class oe extends I {
|
|
|
1648
1646
|
/**
|
|
1649
1647
|
* Связывает два поля: при изменении source автоматически обновляется target
|
|
1650
1648
|
*/
|
|
1651
|
-
linkFields(e, t,
|
|
1649
|
+
linkFields(e, t, i) {
|
|
1652
1650
|
const r = this._fields.get(e), n = this._fields.get(t);
|
|
1653
1651
|
if (!r || !n) {
|
|
1654
1652
|
const l = r ? t : e;
|
|
1655
1653
|
throw new Error(`GroupNode.linkFields: field "${String(l)}" not found`);
|
|
1656
1654
|
}
|
|
1657
|
-
const a =
|
|
1658
|
-
const l = r.value.value, u =
|
|
1655
|
+
const a = _(() => {
|
|
1656
|
+
const l = r.value.value, u = i ? i(l) : l;
|
|
1659
1657
|
n.setValue(u, { emitEvent: !1 });
|
|
1660
|
-
}), o =
|
|
1658
|
+
}), o = N(O.LinkFields);
|
|
1661
1659
|
return this.disposers.add(o, a);
|
|
1662
1660
|
}
|
|
1663
1661
|
/**
|
|
@@ -1688,13 +1686,13 @@ let T = class oe extends I {
|
|
|
1688
1686
|
* ```
|
|
1689
1687
|
*/
|
|
1690
1688
|
watchField(e, t) {
|
|
1691
|
-
const
|
|
1692
|
-
if (!
|
|
1689
|
+
const i = this.getFieldByPath(e);
|
|
1690
|
+
if (!i)
|
|
1693
1691
|
throw new Error(`GroupNode.watchField: field "${e}" not found`);
|
|
1694
|
-
const r =
|
|
1695
|
-
const a =
|
|
1692
|
+
const r = _(() => {
|
|
1693
|
+
const a = i.value.value;
|
|
1696
1694
|
t(a);
|
|
1697
|
-
}), n =
|
|
1695
|
+
}), n = N(O.WatchField);
|
|
1698
1696
|
return this.disposers.add(n, r);
|
|
1699
1697
|
}
|
|
1700
1698
|
/**
|
|
@@ -1724,7 +1722,7 @@ let T = class oe extends I {
|
|
|
1724
1722
|
"dispose" in e && typeof e.dispose == "function" && e.dispose();
|
|
1725
1723
|
});
|
|
1726
1724
|
}
|
|
1727
|
-
},
|
|
1725
|
+
}, Q = class extends I {
|
|
1728
1726
|
// ============================================================================
|
|
1729
1727
|
// Приватные поля
|
|
1730
1728
|
// ============================================================================
|
|
@@ -1735,9 +1733,9 @@ let T = class oe extends I {
|
|
|
1735
1733
|
* Менеджер подписок для централизованного cleanup
|
|
1736
1734
|
* Использует SubscriptionManager вместо массива для управления подписками
|
|
1737
1735
|
*/
|
|
1738
|
-
disposers = new
|
|
1736
|
+
disposers = new K();
|
|
1739
1737
|
/** Array-level validation errors (e.g., "минимум 1 элемент") */
|
|
1740
|
-
_arrayErrors =
|
|
1738
|
+
_arrayErrors = y([]);
|
|
1741
1739
|
// ============================================================================
|
|
1742
1740
|
// Приватные поля для сохранения схем
|
|
1743
1741
|
// ============================================================================
|
|
@@ -1759,15 +1757,15 @@ let T = class oe extends I {
|
|
|
1759
1757
|
// Конструктор
|
|
1760
1758
|
// ============================================================================
|
|
1761
1759
|
constructor(e, t = []) {
|
|
1762
|
-
super(), this.itemSchema = e, this.initialItems = t, this.items =
|
|
1760
|
+
super(), this.itemSchema = e, this.initialItems = t, this.items = y([]);
|
|
1763
1761
|
for (const r of t)
|
|
1764
1762
|
this.push(r);
|
|
1765
|
-
this.length =
|
|
1766
|
-
const
|
|
1763
|
+
this.length = h(() => this.items.value.length), this.value = h(() => this.items.value.map((r) => r.value.value));
|
|
1764
|
+
const i = H({
|
|
1767
1765
|
getChildren: () => this.items.value,
|
|
1768
1766
|
ownErrors: this._arrayErrors
|
|
1769
1767
|
});
|
|
1770
|
-
this.valid =
|
|
1768
|
+
this.valid = i.valid, this.invalid = i.invalid, this.pending = i.pending, this.touched = i.touched, this.dirty = i.dirty, this.errors = i.errors, this.status = i.status;
|
|
1771
1769
|
}
|
|
1772
1770
|
// ============================================================================
|
|
1773
1771
|
// CRUD операции
|
|
@@ -1794,12 +1792,12 @@ let T = class oe extends I {
|
|
|
1794
1792
|
`ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
|
|
1795
1793
|
),
|
|
1796
1794
|
"ArrayNode.removeAt",
|
|
1797
|
-
|
|
1795
|
+
w.LOG
|
|
1798
1796
|
);
|
|
1799
1797
|
return;
|
|
1800
1798
|
}
|
|
1801
1799
|
const t = this.items.value[e];
|
|
1802
|
-
this.items.value = this.items.value.filter((
|
|
1800
|
+
this.items.value = this.items.value.filter((i, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
|
|
1803
1801
|
}
|
|
1804
1802
|
/**
|
|
1805
1803
|
* Вставить элемент в массив
|
|
@@ -1813,12 +1811,12 @@ let T = class oe extends I {
|
|
|
1813
1811
|
`ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
|
|
1814
1812
|
),
|
|
1815
1813
|
"ArrayNode.insert",
|
|
1816
|
-
|
|
1814
|
+
w.LOG
|
|
1817
1815
|
);
|
|
1818
1816
|
return;
|
|
1819
1817
|
}
|
|
1820
|
-
const
|
|
1821
|
-
r.splice(e, 0,
|
|
1818
|
+
const i = this.createItem(t), r = [...this.items.value];
|
|
1819
|
+
r.splice(e, 0, i), this.items.value = r;
|
|
1822
1820
|
}
|
|
1823
1821
|
/**
|
|
1824
1822
|
* Переместить элемент массива с позиции `from` на позицию `to`
|
|
@@ -1837,12 +1835,12 @@ let T = class oe extends I {
|
|
|
1837
1835
|
* ```
|
|
1838
1836
|
*/
|
|
1839
1837
|
move(e, t) {
|
|
1840
|
-
const
|
|
1841
|
-
if (e < 0 || e >=
|
|
1838
|
+
const i = this.items.value.length;
|
|
1839
|
+
if (e < 0 || e >= i || t < 0 || t >= i) {
|
|
1842
1840
|
k.handle(
|
|
1843
|
-
new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${
|
|
1841
|
+
new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${i})`),
|
|
1844
1842
|
"ArrayNode.move",
|
|
1845
|
-
|
|
1843
|
+
w.LOG
|
|
1846
1844
|
);
|
|
1847
1845
|
return;
|
|
1848
1846
|
}
|
|
@@ -1865,12 +1863,12 @@ let T = class oe extends I {
|
|
|
1865
1863
|
* ```
|
|
1866
1864
|
*/
|
|
1867
1865
|
swap(e, t) {
|
|
1868
|
-
const
|
|
1869
|
-
if (e < 0 || e >=
|
|
1866
|
+
const i = this.items.value.length;
|
|
1867
|
+
if (e < 0 || e >= i || t < 0 || t >= i) {
|
|
1870
1868
|
k.handle(
|
|
1871
|
-
new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${
|
|
1869
|
+
new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${i})`),
|
|
1872
1870
|
"ArrayNode.swap",
|
|
1873
|
-
|
|
1871
|
+
w.LOG
|
|
1874
1872
|
);
|
|
1875
1873
|
return;
|
|
1876
1874
|
}
|
|
@@ -1907,13 +1905,13 @@ let T = class oe extends I {
|
|
|
1907
1905
|
return this.items.value.map((e) => e.getValue());
|
|
1908
1906
|
}
|
|
1909
1907
|
setValue(e, t) {
|
|
1910
|
-
this.clear(), e.forEach((
|
|
1911
|
-
k.handle(
|
|
1908
|
+
this.clear(), e.forEach((i) => this.push(i)), t?.emitEvent !== !1 && this.validate().catch((i) => {
|
|
1909
|
+
k.handle(i, "ArrayNode.setValue", w.LOG);
|
|
1912
1910
|
});
|
|
1913
1911
|
}
|
|
1914
1912
|
patchValue(e) {
|
|
1915
|
-
e.forEach((t,
|
|
1916
|
-
this.items.value[
|
|
1913
|
+
e.forEach((t, i) => {
|
|
1914
|
+
this.items.value[i] && t !== void 0 && this.items.value[i].patchValue(t);
|
|
1917
1915
|
});
|
|
1918
1916
|
}
|
|
1919
1917
|
/**
|
|
@@ -2041,9 +2039,9 @@ let T = class oe extends I {
|
|
|
2041
2039
|
* @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode proxy
|
|
2042
2040
|
*/
|
|
2043
2041
|
forEach(e) {
|
|
2044
|
-
this.items.value.forEach((t,
|
|
2042
|
+
this.items.value.forEach((t, i) => {
|
|
2045
2043
|
const r = t.getProxy();
|
|
2046
|
-
e(r,
|
|
2044
|
+
e(r, i);
|
|
2047
2045
|
});
|
|
2048
2046
|
}
|
|
2049
2047
|
/**
|
|
@@ -2052,9 +2050,9 @@ let T = class oe extends I {
|
|
|
2052
2050
|
* @returns Новый массив результатов
|
|
2053
2051
|
*/
|
|
2054
2052
|
map(e) {
|
|
2055
|
-
return this.items.value.map((t,
|
|
2053
|
+
return this.items.value.map((t, i) => {
|
|
2056
2054
|
const r = t.getProxy();
|
|
2057
|
-
return e(r,
|
|
2055
|
+
return e(r, i);
|
|
2058
2056
|
});
|
|
2059
2057
|
}
|
|
2060
2058
|
// ============================================================================
|
|
@@ -2066,7 +2064,7 @@ let T = class oe extends I {
|
|
|
2066
2064
|
*/
|
|
2067
2065
|
createItem(e) {
|
|
2068
2066
|
if (this.isGroupSchema(this.itemSchema)) {
|
|
2069
|
-
const t = new
|
|
2067
|
+
const t = new x(this.itemSchema);
|
|
2070
2068
|
return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
|
|
2071
2069
|
}
|
|
2072
2070
|
throw new Error(
|
|
@@ -2153,14 +2151,14 @@ let T = class oe extends I {
|
|
|
2153
2151
|
* ```
|
|
2154
2152
|
*/
|
|
2155
2153
|
watchItems(e, t) {
|
|
2156
|
-
const
|
|
2154
|
+
const i = _(() => {
|
|
2157
2155
|
const n = this.items.value.map((a) => {
|
|
2158
|
-
if (a instanceof
|
|
2156
|
+
if (a instanceof x)
|
|
2159
2157
|
return a.getFieldByPath(e)?.value.value;
|
|
2160
2158
|
});
|
|
2161
2159
|
t(n);
|
|
2162
|
-
}), r =
|
|
2163
|
-
return this.disposers.add(r,
|
|
2160
|
+
}), r = N(O.WatchItems);
|
|
2161
|
+
return this.disposers.add(r, i);
|
|
2164
2162
|
}
|
|
2165
2163
|
/**
|
|
2166
2164
|
* Подписка на изменение длины массива
|
|
@@ -2185,11 +2183,11 @@ let T = class oe extends I {
|
|
|
2185
2183
|
* ```
|
|
2186
2184
|
*/
|
|
2187
2185
|
watchLength(e) {
|
|
2188
|
-
const t =
|
|
2186
|
+
const t = _(() => {
|
|
2189
2187
|
const r = this.length.value;
|
|
2190
2188
|
e(r);
|
|
2191
|
-
}),
|
|
2192
|
-
return this.disposers.add(
|
|
2189
|
+
}), i = N(O.WatchLength);
|
|
2190
|
+
return this.disposers.add(i, t);
|
|
2193
2191
|
}
|
|
2194
2192
|
/**
|
|
2195
2193
|
* Очистить все ресурсы узла
|
|
@@ -2252,7 +2250,7 @@ let T = class oe extends I {
|
|
|
2252
2250
|
});
|
|
2253
2251
|
}
|
|
2254
2252
|
};
|
|
2255
|
-
class
|
|
2253
|
+
class ke {
|
|
2256
2254
|
/**
|
|
2257
2255
|
* Создает узел формы на основе конфигурации
|
|
2258
2256
|
*
|
|
@@ -2302,16 +2300,16 @@ class Oe {
|
|
|
2302
2300
|
if (Array.isArray(e) && e.length >= 1)
|
|
2303
2301
|
return this.createArrayNodeFromArray(e);
|
|
2304
2302
|
if (this.isFieldConfig(e))
|
|
2305
|
-
return new
|
|
2303
|
+
return new _e(e);
|
|
2306
2304
|
if (this.isArrayConfig(e)) {
|
|
2307
2305
|
const t = e;
|
|
2308
|
-
return new
|
|
2306
|
+
return new Q(
|
|
2309
2307
|
t.schema,
|
|
2310
2308
|
t.initialItems
|
|
2311
2309
|
);
|
|
2312
2310
|
}
|
|
2313
2311
|
if (this.isGroupConfig(e))
|
|
2314
|
-
return new
|
|
2312
|
+
return new x(e);
|
|
2315
2313
|
throw new Error(
|
|
2316
2314
|
`NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
|
|
2317
2315
|
e
|
|
@@ -2345,11 +2343,11 @@ class Oe {
|
|
|
2345
2343
|
*/
|
|
2346
2344
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2347
2345
|
createArrayNodeFromArray(e) {
|
|
2348
|
-
const [t, ...
|
|
2346
|
+
const [t, ...i] = e, r = [];
|
|
2349
2347
|
this.isGroupConfig(t) && r.push(this.extractValues(t));
|
|
2350
|
-
for (const n of
|
|
2348
|
+
for (const n of i)
|
|
2351
2349
|
this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
|
|
2352
|
-
return new
|
|
2350
|
+
return new Q(t, r);
|
|
2353
2351
|
}
|
|
2354
2352
|
/**
|
|
2355
2353
|
* Извлечь значения из схемы (рекурсивно)
|
|
@@ -2387,8 +2385,8 @@ class Oe {
|
|
|
2387
2385
|
return e.map((t) => this.extractValues(t));
|
|
2388
2386
|
if (this.isGroupConfig(e)) {
|
|
2389
2387
|
const t = {};
|
|
2390
|
-
for (const [
|
|
2391
|
-
t[
|
|
2388
|
+
for (const [i, r] of Object.entries(e))
|
|
2389
|
+
t[i] = this.extractValues(r);
|
|
2392
2390
|
return t;
|
|
2393
2391
|
}
|
|
2394
2392
|
return e;
|
|
@@ -2468,89 +2466,35 @@ class Oe {
|
|
|
2468
2466
|
return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
|
|
2469
2467
|
}
|
|
2470
2468
|
}
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
/**
|
|
2474
|
-
* Добавить элемент в стек
|
|
2475
|
-
* @param item - Элемент для добавления
|
|
2476
|
-
*/
|
|
2477
|
-
push(e) {
|
|
2478
|
-
this.stack.push(e);
|
|
2479
|
-
}
|
|
2480
|
-
/**
|
|
2481
|
-
* Извлечь элемент из стека
|
|
2482
|
-
* @returns Извлеченный элемент или undefined если стек пуст
|
|
2483
|
-
*/
|
|
2484
|
-
pop() {
|
|
2485
|
-
return this.stack.pop();
|
|
2486
|
-
}
|
|
2487
|
-
/**
|
|
2488
|
-
* Получить текущий элемент (вершину стека) без извлечения
|
|
2489
|
-
* @returns Текущий элемент или null если стек пуст
|
|
2490
|
-
*/
|
|
2491
|
-
getCurrent() {
|
|
2492
|
-
return this.stack.length > 0 ? this.stack[this.stack.length - 1] : null;
|
|
2493
|
-
}
|
|
2494
|
-
/**
|
|
2495
|
-
* Извлечь элемент из стека с проверкой
|
|
2496
|
-
* Выводит предупреждение в DEV режиме если извлеченный элемент не совпадает с ожидаемым
|
|
2497
|
-
*
|
|
2498
|
-
* @param expected - Ожидаемый элемент
|
|
2499
|
-
* @param name - Имя реестра для отладки (например, 'ValidationRegistry')
|
|
2500
|
-
*/
|
|
2501
|
-
verify(e, t) {
|
|
2502
|
-
this.pop();
|
|
2503
|
-
}
|
|
2504
|
-
/**
|
|
2505
|
-
* Получить длину стека
|
|
2506
|
-
* @returns Количество элементов в стеке
|
|
2507
|
-
*/
|
|
2508
|
-
get length() {
|
|
2509
|
-
return this.stack.length;
|
|
2510
|
-
}
|
|
2511
|
-
/**
|
|
2512
|
-
* Проверить, пуст ли стек
|
|
2513
|
-
* @returns true если стек пуст
|
|
2514
|
-
*/
|
|
2515
|
-
isEmpty() {
|
|
2516
|
-
return this.stack.length === 0;
|
|
2517
|
-
}
|
|
2518
|
-
/**
|
|
2519
|
-
* Очистить стек
|
|
2520
|
-
*/
|
|
2521
|
-
clear() {
|
|
2522
|
-
this.stack = [];
|
|
2523
|
-
}
|
|
2469
|
+
function D(s) {
|
|
2470
|
+
return s == null ? !1 : typeof s == "object" && "value" in s && "setValue" in s && "getValue" in s && "validate" in s;
|
|
2524
2471
|
}
|
|
2525
|
-
function
|
|
2526
|
-
return
|
|
2527
|
-
}
|
|
2528
|
-
function Ne(i) {
|
|
2529
|
-
return i == null ? !1 : L(i) && "validators" in i && "asyncValidators" in i && // FieldNode имеет markAsTouched метод
|
|
2472
|
+
function Ve(s) {
|
|
2473
|
+
return s == null ? !1 : D(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
|
|
2530
2474
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2531
|
-
typeof
|
|
2532
|
-
!("fields" in
|
|
2475
|
+
typeof s.markAsTouched == "function" && // У FieldNode нет fields или items
|
|
2476
|
+
!("fields" in s) && !("items" in s);
|
|
2533
2477
|
}
|
|
2534
|
-
function
|
|
2535
|
-
return
|
|
2536
|
-
!("items" in
|
|
2478
|
+
function Oe(s) {
|
|
2479
|
+
return s == null ? !1 : D(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
|
|
2480
|
+
!("items" in s) && !("push" in s) && !("removeAt" in s);
|
|
2537
2481
|
}
|
|
2538
|
-
function
|
|
2539
|
-
return
|
|
2540
|
-
typeof
|
|
2541
|
-
typeof
|
|
2482
|
+
function Ne(s) {
|
|
2483
|
+
return s == null ? !1 : D(s) && "items" in s && "length" in s && "push" in s && "removeAt" in s && "at" in s && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2484
|
+
typeof s.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2485
|
+
typeof s.removeAt == "function";
|
|
2542
2486
|
}
|
|
2543
|
-
function
|
|
2544
|
-
return
|
|
2487
|
+
function He(s) {
|
|
2488
|
+
return Ve(s) ? "FieldNode" : Oe(s) ? "GroupNode" : Ne(s) ? "ArrayNode" : D(s) ? "FormNode" : "Unknown";
|
|
2545
2489
|
}
|
|
2546
|
-
class
|
|
2490
|
+
class Fe extends I {
|
|
2547
2491
|
/**
|
|
2548
2492
|
* @param control Реактивный массив модели (`model.<path>`).
|
|
2549
2493
|
* @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
|
|
2550
2494
|
* импорта с `create-form`). Обычно `(item) => createForm({ model: item, schema: itemSchema(item) })`.
|
|
2551
2495
|
*/
|
|
2552
2496
|
constructor(e, t) {
|
|
2553
|
-
super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync =
|
|
2497
|
+
super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = _(() => {
|
|
2554
2498
|
const r = e.length, n = [];
|
|
2555
2499
|
for (let a = 0; a < r; a++) {
|
|
2556
2500
|
const o = e.at(a);
|
|
@@ -2559,18 +2503,18 @@ class Pe extends I {
|
|
|
2559
2503
|
l || (l = t(o), this.cache.set(o, l)), n.push(l);
|
|
2560
2504
|
}
|
|
2561
2505
|
this.itemNodes.value = n;
|
|
2562
|
-
}), this.length =
|
|
2563
|
-
const
|
|
2506
|
+
}), this.length = h(() => this.itemNodes.value.length), this.value = h(() => this.itemNodes.value.map((r) => r.value.value));
|
|
2507
|
+
const i = H({
|
|
2564
2508
|
getChildren: () => this.itemNodes.value,
|
|
2565
2509
|
ownErrors: this._arrayErrors
|
|
2566
2510
|
});
|
|
2567
|
-
this.valid =
|
|
2511
|
+
this.valid = i.valid, this.invalid = i.invalid, this.pending = i.pending, this.touched = i.touched, this.dirty = i.dirty, this.errors = i.errors, this.status = i.status;
|
|
2568
2512
|
}
|
|
2569
|
-
itemNodes =
|
|
2513
|
+
itemNodes = y([]);
|
|
2570
2514
|
// Кэш per-item формы по идентичности фасада под-модели (фасады кэшируются в core).
|
|
2571
2515
|
cache = /* @__PURE__ */ new WeakMap();
|
|
2572
2516
|
initial;
|
|
2573
|
-
_arrayErrors =
|
|
2517
|
+
_arrayErrors = y([]);
|
|
2574
2518
|
disposeSync;
|
|
2575
2519
|
/**
|
|
2576
2520
|
* Сигнал per-item форм. Публичен в т.ч. чтобы `isArrayNode` распознавал узел как массив
|
|
@@ -2593,10 +2537,10 @@ class Pe extends I {
|
|
|
2593
2537
|
return this.itemNodes.value[e];
|
|
2594
2538
|
}
|
|
2595
2539
|
map(e) {
|
|
2596
|
-
return this.itemNodes.value.map((t,
|
|
2540
|
+
return this.itemNodes.value.map((t, i) => e(t, i));
|
|
2597
2541
|
}
|
|
2598
2542
|
forEach(e) {
|
|
2599
|
-
this.itemNodes.value.forEach((t,
|
|
2543
|
+
this.itemNodes.value.forEach((t, i) => e(t, i));
|
|
2600
2544
|
}
|
|
2601
2545
|
// ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
|
|
2602
2546
|
push(e) {
|
|
@@ -2664,374 +2608,99 @@ class Pe extends I {
|
|
|
2664
2608
|
this.disposeSync();
|
|
2665
2609
|
}
|
|
2666
2610
|
}
|
|
2667
|
-
const
|
|
2668
|
-
function
|
|
2669
|
-
if (
|
|
2670
|
-
if (Array.isArray(
|
|
2671
|
-
for (const n of
|
|
2611
|
+
const ae = (s) => s !== null && typeof s == "object" && !Array.isArray(s) && !(s instanceof Date) && !(typeof Blob < "u" && s instanceof Blob) && !(typeof File < "u" && s instanceof File);
|
|
2612
|
+
function G(s, e, t) {
|
|
2613
|
+
if (s == null || typeof s != "object") return;
|
|
2614
|
+
if (Array.isArray(s)) {
|
|
2615
|
+
for (const n of s) G(n, e, t);
|
|
2672
2616
|
return;
|
|
2673
2617
|
}
|
|
2674
|
-
const
|
|
2675
|
-
if (r && typeof r.__path == "string" && typeof
|
|
2676
|
-
t.set(r.__path,
|
|
2618
|
+
const i = s, r = i.array;
|
|
2619
|
+
if (r && typeof r.__path == "string" && typeof i.item == "function") {
|
|
2620
|
+
t.set(r.__path, i.item);
|
|
2677
2621
|
return;
|
|
2678
2622
|
}
|
|
2679
|
-
|
|
2680
|
-
component:
|
|
2681
|
-
componentProps:
|
|
2682
|
-
validators:
|
|
2683
|
-
asyncValidators:
|
|
2684
|
-
updateOn:
|
|
2685
|
-
disabled:
|
|
2686
|
-
debounce:
|
|
2623
|
+
i.value instanceof ie && e.set(i.value, {
|
|
2624
|
+
component: i.component,
|
|
2625
|
+
componentProps: i.componentProps,
|
|
2626
|
+
validators: i.validators,
|
|
2627
|
+
asyncValidators: i.asyncValidators,
|
|
2628
|
+
updateOn: i.updateOn,
|
|
2629
|
+
disabled: i.disabled,
|
|
2630
|
+
debounce: i.debounce
|
|
2687
2631
|
});
|
|
2688
|
-
for (const [n, a] of Object.entries(
|
|
2689
|
-
n !== "value" &&
|
|
2632
|
+
for (const [n, a] of Object.entries(i))
|
|
2633
|
+
n !== "value" && G(a, e, t);
|
|
2690
2634
|
}
|
|
2691
|
-
function
|
|
2635
|
+
function oe(s, e, t, i) {
|
|
2692
2636
|
const r = {};
|
|
2693
2637
|
for (const [n, a] of Object.entries(e)) {
|
|
2694
2638
|
const o = t === "" ? n : `${t}.${n}`;
|
|
2695
2639
|
if (Array.isArray(a))
|
|
2696
2640
|
continue;
|
|
2697
|
-
if (
|
|
2698
|
-
r[n] =
|
|
2641
|
+
if (ae(a)) {
|
|
2642
|
+
r[n] = oe(s, a, o, i);
|
|
2699
2643
|
continue;
|
|
2700
2644
|
}
|
|
2701
|
-
const l =
|
|
2645
|
+
const l = s.signalAt(o);
|
|
2702
2646
|
if (!l) throw new Error(`createForm({ model }): не найден сигнал для пути "${o}"`);
|
|
2703
|
-
const u =
|
|
2647
|
+
const u = i.get(l) ?? {}, { validators: m, asyncValidators: c, ...f } = u;
|
|
2704
2648
|
r[n] = { ...f, valueSignal: l };
|
|
2705
2649
|
}
|
|
2706
2650
|
return r;
|
|
2707
2651
|
}
|
|
2708
|
-
function
|
|
2709
|
-
for (const [
|
|
2710
|
-
const n = e === "" ?
|
|
2711
|
-
Array.isArray(r) || (
|
|
2652
|
+
function le(s, e, t) {
|
|
2653
|
+
for (const [i, r] of Object.entries(s)) {
|
|
2654
|
+
const n = e === "" ? i : `${e}.${i}`;
|
|
2655
|
+
Array.isArray(r) || (ae(r) ? le(r, n, t) : t.push(n));
|
|
2712
2656
|
}
|
|
2713
2657
|
}
|
|
2714
|
-
function
|
|
2715
|
-
const { model: e, schema: t, behavior:
|
|
2716
|
-
t !== void 0 &&
|
|
2717
|
-
const a =
|
|
2718
|
-
for (const [
|
|
2658
|
+
function ue(s) {
|
|
2659
|
+
const { model: e, schema: t, behavior: i } = s, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
2660
|
+
t !== void 0 && G(t, r, n);
|
|
2661
|
+
const a = oe(e, e.get(), "", r), o = new x(a), l = e.get();
|
|
2662
|
+
for (const [c, f] of Object.entries(l)) {
|
|
2719
2663
|
if (!Array.isArray(f)) continue;
|
|
2720
|
-
const d = n.get(
|
|
2664
|
+
const d = n.get(c);
|
|
2721
2665
|
if (!d) continue;
|
|
2722
|
-
const p = e[
|
|
2723
|
-
o.fields.set(
|
|
2724
|
-
}
|
|
2725
|
-
const u = o.getProxy(), y = [];
|
|
2726
|
-
he(e.get(), "", y);
|
|
2727
|
-
for (const h of y) {
|
|
2728
|
-
const f = e.signalAt(h), d = o.getFieldByPath(h);
|
|
2729
|
-
f && d && be(f, d);
|
|
2666
|
+
const p = e[c], v = (b) => ue({ model: b, schema: d(b) }), g = new Fe(p, v);
|
|
2667
|
+
o.fields.set(c, g);
|
|
2730
2668
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
const
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
}
|
|
2737
|
-
const j = /* @__PURE__ */ new Map();
|
|
2738
|
-
class P {
|
|
2739
|
-
/** Флаг активной регистрации */
|
|
2740
|
-
isRegistering = !1;
|
|
2741
|
-
/** Массив зарегистрированных элементов */
|
|
2742
|
-
registrations = [];
|
|
2743
|
-
/**
|
|
2744
|
-
* Получить стек для конкретного класса реестра
|
|
2745
|
-
* Создает новый стек если не существует
|
|
2746
|
-
*
|
|
2747
|
-
* @param ctor - Конструктор класса реестра
|
|
2748
|
-
* @returns RegistryStack для данного класса
|
|
2749
|
-
*/
|
|
2750
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2751
|
-
static getStack(e) {
|
|
2752
|
-
return j.has(e) || j.set(e, new Fe()), j.get(e);
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* Получить текущий активный реестр из стека
|
|
2756
|
-
* Должен быть переопределен в наследниках как static метод
|
|
2757
|
-
*
|
|
2758
|
-
* @param ctor - Конструктор класса реестра
|
|
2759
|
-
* @returns Текущий активный реестр или null
|
|
2760
|
-
*/
|
|
2761
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2762
|
-
static getCurrentFromStack(e) {
|
|
2763
|
-
return this.getStack(e).getCurrent();
|
|
2764
|
-
}
|
|
2765
|
-
/**
|
|
2766
|
-
* Начать регистрацию
|
|
2767
|
-
*
|
|
2768
|
-
* Помещает this в global stack для изоляции форм
|
|
2769
|
-
* Вызывает hook onBeginRegistration()
|
|
2770
|
-
*/
|
|
2771
|
-
beginRegistration() {
|
|
2772
|
-
this.isRegistering = !0, this.registrations = [], P.getStack(this.constructor).push(this), this.onBeginRegistration();
|
|
2773
|
-
}
|
|
2774
|
-
/**
|
|
2775
|
-
* Проверить, активна ли регистрация
|
|
2776
|
-
*/
|
|
2777
|
-
isActive() {
|
|
2778
|
-
return this.isRegistering;
|
|
2779
|
-
}
|
|
2780
|
-
/**
|
|
2781
|
-
* Получить зарегистрированные элементы
|
|
2782
|
-
*/
|
|
2783
|
-
getRegistrations() {
|
|
2784
|
-
return this.registrations;
|
|
2785
|
-
}
|
|
2786
|
-
/**
|
|
2787
|
-
* Hook: вызывается в начале регистрации
|
|
2788
|
-
* Может быть переопределен в наследниках для инициализации
|
|
2789
|
-
*/
|
|
2790
|
-
onBeginRegistration() {
|
|
2791
|
-
}
|
|
2792
|
-
/**
|
|
2793
|
-
* Завершить регистрацию и извлечь из стека
|
|
2794
|
-
*
|
|
2795
|
-
* @param registryName - Имя реестра для отладки
|
|
2796
|
-
*/
|
|
2797
|
-
completeRegistration(e) {
|
|
2798
|
-
this.isRegistering = !1, P.getStack(this.constructor).verify(this, e);
|
|
2799
|
-
}
|
|
2800
|
-
/**
|
|
2801
|
-
* Отменить регистрацию без применения
|
|
2802
|
-
*
|
|
2803
|
-
* @param registryName - Имя реестра для отладки
|
|
2804
|
-
*/
|
|
2805
|
-
cancelRegistration(e) {
|
|
2806
|
-
this.isRegistering = !1, this.registrations = [], P.getStack(this.constructor).verify(this, e);
|
|
2669
|
+
const u = o.getProxy(), m = [];
|
|
2670
|
+
le(e.get(), "", m);
|
|
2671
|
+
for (const c of m) {
|
|
2672
|
+
const f = e.signalAt(c), d = o.getFieldByPath(c);
|
|
2673
|
+
f && d && ye(f, d);
|
|
2807
2674
|
}
|
|
2675
|
+
return i && o.attachBehaviorCleanup(i.__run(e, u)), u;
|
|
2808
2676
|
}
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
* @param options - Опции observer
|
|
2813
|
-
*/
|
|
2814
|
-
constructor(e, t) {
|
|
2815
|
-
this.form = e, this.options = {
|
|
2816
|
-
enableLogging: !1,
|
|
2817
|
-
eventTypes: ["value", "status", "errors", "touched", "dirty"],
|
|
2818
|
-
pathFilter: [],
|
|
2819
|
-
...t
|
|
2820
|
-
};
|
|
2821
|
-
}
|
|
2822
|
-
listeners = /* @__PURE__ */ new Set();
|
|
2823
|
-
disposers = [];
|
|
2824
|
-
options;
|
|
2825
|
-
/**
|
|
2826
|
-
* Подписаться на события изменения
|
|
2827
|
-
*
|
|
2828
|
-
* @param callback - Функция обработки события
|
|
2829
|
-
* @returns Функция отписки
|
|
2830
|
-
*
|
|
2831
|
-
* @example
|
|
2832
|
-
* ```typescript
|
|
2833
|
-
* const unsubscribe = observer.subscribe((event) => {
|
|
2834
|
-
* // Отправить событие в analytics
|
|
2835
|
-
* analytics.track('form_change', event);
|
|
2836
|
-
* });
|
|
2837
|
-
* ```
|
|
2838
|
-
*/
|
|
2839
|
-
subscribe(e) {
|
|
2840
|
-
return this.listeners.add(e), () => this.listeners.delete(e);
|
|
2841
|
-
}
|
|
2842
|
-
/**
|
|
2843
|
-
* Включить трассировку формы
|
|
2844
|
-
*
|
|
2845
|
-
* Подписывается на изменения основных сигналов формы
|
|
2846
|
-
* и вызывает listeners при каждом изменении
|
|
2847
|
-
*
|
|
2848
|
-
* @returns Функция для отключения трассировки
|
|
2849
|
-
*
|
|
2850
|
-
* @example
|
|
2851
|
-
* ```typescript
|
|
2852
|
-
* const dispose = observer.enableTracing();
|
|
2853
|
-
*
|
|
2854
|
-
* // Позже, для отключения
|
|
2855
|
-
* dispose();
|
|
2856
|
-
* ```
|
|
2857
|
-
*/
|
|
2858
|
-
enableTracing() {
|
|
2859
|
-
if (this.shouldTrack("value")) {
|
|
2860
|
-
let e = this.form.value.value;
|
|
2861
|
-
const t = m(() => {
|
|
2862
|
-
const s = this.form.value.value;
|
|
2863
|
-
s !== e && (this.emit({
|
|
2864
|
-
type: "value",
|
|
2865
|
-
path: "",
|
|
2866
|
-
timestamp: Date.now(),
|
|
2867
|
-
oldValue: e,
|
|
2868
|
-
newValue: s
|
|
2869
|
-
}), e = s);
|
|
2870
|
-
});
|
|
2871
|
-
this.disposers.push(t);
|
|
2872
|
-
}
|
|
2873
|
-
if (this.shouldTrack("status")) {
|
|
2874
|
-
let e = this.form.status.value;
|
|
2875
|
-
const t = m(() => {
|
|
2876
|
-
const s = this.form.status.value;
|
|
2877
|
-
s !== e && (this.emit({
|
|
2878
|
-
type: "status",
|
|
2879
|
-
path: "",
|
|
2880
|
-
timestamp: Date.now(),
|
|
2881
|
-
oldValue: e,
|
|
2882
|
-
newValue: s
|
|
2883
|
-
}), e = s);
|
|
2884
|
-
});
|
|
2885
|
-
this.disposers.push(t);
|
|
2886
|
-
}
|
|
2887
|
-
if (this.shouldTrack("errors")) {
|
|
2888
|
-
let e = this.form.errors.value;
|
|
2889
|
-
const t = m(() => {
|
|
2890
|
-
const s = this.form.errors.value;
|
|
2891
|
-
s !== e && (this.emit({
|
|
2892
|
-
type: "errors",
|
|
2893
|
-
path: "",
|
|
2894
|
-
timestamp: Date.now(),
|
|
2895
|
-
oldValue: e,
|
|
2896
|
-
newValue: s
|
|
2897
|
-
}), e = s);
|
|
2898
|
-
});
|
|
2899
|
-
this.disposers.push(t);
|
|
2900
|
-
}
|
|
2901
|
-
if (this.shouldTrack("touched")) {
|
|
2902
|
-
let e = this.form.touched.value;
|
|
2903
|
-
const t = m(() => {
|
|
2904
|
-
const s = this.form.touched.value;
|
|
2905
|
-
s !== e && (this.emit({
|
|
2906
|
-
type: "touched",
|
|
2907
|
-
path: "",
|
|
2908
|
-
timestamp: Date.now(),
|
|
2909
|
-
oldValue: e,
|
|
2910
|
-
newValue: s
|
|
2911
|
-
}), e = s);
|
|
2912
|
-
});
|
|
2913
|
-
this.disposers.push(t);
|
|
2914
|
-
}
|
|
2915
|
-
if (this.shouldTrack("dirty")) {
|
|
2916
|
-
let e = this.form.dirty.value;
|
|
2917
|
-
const t = m(() => {
|
|
2918
|
-
const s = this.form.dirty.value;
|
|
2919
|
-
s !== e && (this.emit({
|
|
2920
|
-
type: "dirty",
|
|
2921
|
-
path: "",
|
|
2922
|
-
timestamp: Date.now(),
|
|
2923
|
-
oldValue: e,
|
|
2924
|
-
newValue: s
|
|
2925
|
-
}), e = s);
|
|
2926
|
-
});
|
|
2927
|
-
this.disposers.push(t);
|
|
2928
|
-
}
|
|
2929
|
-
return () => {
|
|
2930
|
-
this.disposers.forEach((e) => e()), this.disposers = [];
|
|
2931
|
-
};
|
|
2932
|
-
}
|
|
2933
|
-
/**
|
|
2934
|
-
* Наблюдать за конкретным полем
|
|
2935
|
-
*
|
|
2936
|
-
* @param path - Путь к полю
|
|
2937
|
-
* @returns Функция для отключения наблюдения
|
|
2938
|
-
*
|
|
2939
|
-
* @example
|
|
2940
|
-
* ```typescript
|
|
2941
|
-
* // Наблюдать за полем email
|
|
2942
|
-
* const dispose = observer.watchField('email');
|
|
2943
|
-
* ```
|
|
2944
|
-
*/
|
|
2945
|
-
watchField(e) {
|
|
2946
|
-
const t = this.form.getFieldByPath(e);
|
|
2947
|
-
if (!t)
|
|
2948
|
-
return () => {
|
|
2949
|
-
};
|
|
2950
|
-
const s = [];
|
|
2951
|
-
if (this.shouldTrack("value")) {
|
|
2952
|
-
let r = t.value.value;
|
|
2953
|
-
const n = m(() => {
|
|
2954
|
-
const a = t.value.value;
|
|
2955
|
-
a !== r && (this.emit({
|
|
2956
|
-
type: "value",
|
|
2957
|
-
path: e,
|
|
2958
|
-
timestamp: Date.now(),
|
|
2959
|
-
oldValue: r,
|
|
2960
|
-
newValue: a
|
|
2961
|
-
}), r = a);
|
|
2962
|
-
});
|
|
2963
|
-
s.push(n);
|
|
2964
|
-
}
|
|
2965
|
-
if (this.shouldTrack("status")) {
|
|
2966
|
-
let r = t.status.value;
|
|
2967
|
-
const n = m(() => {
|
|
2968
|
-
const a = t.status.value;
|
|
2969
|
-
a !== r && (this.emit({
|
|
2970
|
-
type: "status",
|
|
2971
|
-
path: e,
|
|
2972
|
-
timestamp: Date.now(),
|
|
2973
|
-
oldValue: r,
|
|
2974
|
-
newValue: a
|
|
2975
|
-
}), r = a);
|
|
2976
|
-
});
|
|
2977
|
-
s.push(n);
|
|
2978
|
-
}
|
|
2979
|
-
return () => s.forEach((r) => r());
|
|
2980
|
-
}
|
|
2981
|
-
/**
|
|
2982
|
-
* Отправить событие всем listeners
|
|
2983
|
-
*/
|
|
2984
|
-
emit(e) {
|
|
2985
|
-
this.matchesPathFilter(e.path) && (this.options.enableLogging && console.log(`[FormObserver] ${e.type} at "${e.path || "root"}":`, e.newValue), this.listeners.forEach((t) => {
|
|
2986
|
-
try {
|
|
2987
|
-
t(e);
|
|
2988
|
-
} catch {
|
|
2989
|
-
}
|
|
2990
|
-
}));
|
|
2991
|
-
}
|
|
2992
|
-
/**
|
|
2993
|
-
* Проверить, нужно ли отслеживать тип события
|
|
2994
|
-
*/
|
|
2995
|
-
shouldTrack(e) {
|
|
2996
|
-
return this.options.eventTypes.includes(e);
|
|
2997
|
-
}
|
|
2998
|
-
/**
|
|
2999
|
-
* Проверить, соответствует ли путь фильтру
|
|
3000
|
-
*/
|
|
3001
|
-
matchesPathFilter(e) {
|
|
3002
|
-
const { pathFilter: t } = this.options;
|
|
3003
|
-
return !t || Array.isArray(t) && t.length === 0 ? !0 : t instanceof RegExp ? t.test(e) : t.includes(e);
|
|
3004
|
-
}
|
|
3005
|
-
/**
|
|
3006
|
-
* Очистить все подписки и disposers
|
|
3007
|
-
*/
|
|
3008
|
-
dispose() {
|
|
3009
|
-
this.disposers.forEach((e) => e()), this.disposers = [], this.listeners.clear();
|
|
3010
|
-
}
|
|
2677
|
+
const xe = (s) => s != null && typeof s == "object" && "model" in s && typeof s.model?.signalAt == "function";
|
|
2678
|
+
function ze(s) {
|
|
2679
|
+
return xe(s) ? ue(s) : new x(s).getProxy();
|
|
3011
2680
|
}
|
|
3012
|
-
const
|
|
3013
|
-
if (Array.isArray(
|
|
3014
|
-
if (
|
|
2681
|
+
const P = (s) => !(s === null || typeof s != "object" || Array.isArray(s) || s instanceof Date || typeof Blob < "u" && s instanceof Blob || typeof File < "u" && s instanceof File), E = (s, e) => s === "" ? String(e) : `${s}.${e}`, U = (s) => /^\d+$/.test(s), A = (s) => {
|
|
2682
|
+
if (Array.isArray(s)) return s.map(A);
|
|
2683
|
+
if (P(s)) {
|
|
3015
2684
|
const e = {};
|
|
3016
|
-
for (const t of Object.keys(
|
|
2685
|
+
for (const t of Object.keys(s)) e[t] = A(s[t]);
|
|
3017
2686
|
return e;
|
|
3018
2687
|
}
|
|
3019
|
-
return
|
|
3020
|
-
},
|
|
3021
|
-
if (
|
|
3022
|
-
if (Array.isArray(
|
|
3023
|
-
return
|
|
3024
|
-
if (
|
|
3025
|
-
const t = Object.keys(
|
|
3026
|
-
return t.length !==
|
|
2688
|
+
return s;
|
|
2689
|
+
}, C = (s, e) => {
|
|
2690
|
+
if (s === e) return !0;
|
|
2691
|
+
if (Array.isArray(s) && Array.isArray(e))
|
|
2692
|
+
return s.length !== e.length ? !1 : s.every((t, i) => C(t, e[i]));
|
|
2693
|
+
if (P(s) && P(e)) {
|
|
2694
|
+
const t = Object.keys(s), i = Object.keys(e);
|
|
2695
|
+
return t.length !== i.length ? !1 : t.every((r) => C(s[r], e[r]));
|
|
3027
2696
|
}
|
|
3028
2697
|
return !1;
|
|
3029
2698
|
};
|
|
3030
2699
|
class Me {
|
|
3031
2700
|
constructor(e, t) {
|
|
3032
2701
|
this.path = t;
|
|
3033
|
-
const
|
|
3034
|
-
|
|
2702
|
+
const i = y(e);
|
|
2703
|
+
i.__path = t, this.signal = i, this.initial = A(e);
|
|
3035
2704
|
}
|
|
3036
2705
|
kind = "leaf";
|
|
3037
2706
|
signal;
|
|
@@ -3051,37 +2720,37 @@ class Me {
|
|
|
3051
2720
|
this.signal.value = e;
|
|
3052
2721
|
}
|
|
3053
2722
|
resetToInitial() {
|
|
3054
|
-
this.signal.value =
|
|
2723
|
+
this.signal.value = A(this.initial);
|
|
3055
2724
|
}
|
|
3056
2725
|
captureInitial() {
|
|
3057
|
-
this.initial =
|
|
2726
|
+
this.initial = A(this.signal.peek());
|
|
3058
2727
|
}
|
|
3059
2728
|
dirty() {
|
|
3060
|
-
return !
|
|
2729
|
+
return !C(this.signal.peek(), this.initial);
|
|
3061
2730
|
}
|
|
3062
2731
|
}
|
|
3063
|
-
class
|
|
2732
|
+
class ce {
|
|
3064
2733
|
constructor(e, t) {
|
|
3065
2734
|
this.path = t;
|
|
3066
|
-
for (const
|
|
3067
|
-
this.children.set(
|
|
2735
|
+
for (const i of Object.keys(e))
|
|
2736
|
+
this.children.set(i, F(e[i], E(t, i)));
|
|
3068
2737
|
}
|
|
3069
2738
|
kind = "group";
|
|
3070
2739
|
children = /* @__PURE__ */ new Map();
|
|
3071
2740
|
rebase(e) {
|
|
3072
2741
|
this.path = e;
|
|
3073
|
-
for (const [t,
|
|
2742
|
+
for (const [t, i] of this.children) i.rebase(E(e, t));
|
|
3074
2743
|
}
|
|
3075
2744
|
peek() {
|
|
3076
2745
|
const e = {};
|
|
3077
|
-
for (const [t,
|
|
2746
|
+
for (const [t, i] of this.children) e[t] = i.peek();
|
|
3078
2747
|
return e;
|
|
3079
2748
|
}
|
|
3080
2749
|
set(e) {
|
|
3081
2750
|
if (e == null || typeof e != "object") return;
|
|
3082
2751
|
const t = e;
|
|
3083
|
-
for (const [
|
|
3084
|
-
|
|
2752
|
+
for (const [i, r] of this.children)
|
|
2753
|
+
i in t && (r.kind === "leaf" && B(r.signal) || r.set(t[i]));
|
|
3085
2754
|
}
|
|
3086
2755
|
resetToInitial() {
|
|
3087
2756
|
for (const e of this.children.values()) e.resetToInitial();
|
|
@@ -3094,38 +2763,38 @@ class de {
|
|
|
3094
2763
|
return !1;
|
|
3095
2764
|
}
|
|
3096
2765
|
}
|
|
3097
|
-
class
|
|
2766
|
+
class Pe {
|
|
3098
2767
|
constructor(e, t) {
|
|
3099
|
-
this.path = t, this.items =
|
|
2768
|
+
this.path = t, this.items = y(e.map((i, r) => F(i, E(t, r)))), this.initial = A(e);
|
|
3100
2769
|
}
|
|
3101
2770
|
kind = "array";
|
|
3102
2771
|
items;
|
|
3103
2772
|
initial;
|
|
3104
2773
|
rebase(e) {
|
|
3105
|
-
this.path = e, this.items.peek().forEach((t,
|
|
2774
|
+
this.path = e, this.items.peek().forEach((t, i) => t.rebase(E(e, i)));
|
|
3106
2775
|
}
|
|
3107
2776
|
reindex() {
|
|
3108
2777
|
this.items.peek().forEach((e, t) => e.rebase(E(this.path, t)));
|
|
3109
2778
|
}
|
|
3110
2779
|
push(e) {
|
|
3111
2780
|
const t = this.items.peek();
|
|
3112
|
-
this.items.value = [...t,
|
|
2781
|
+
this.items.value = [...t, F(e, E(this.path, t.length))];
|
|
3113
2782
|
}
|
|
3114
2783
|
insertAt(e, t) {
|
|
3115
|
-
const
|
|
3116
|
-
|
|
2784
|
+
const i = [...this.items.peek()];
|
|
2785
|
+
i.splice(e, 0, F(t, E(this.path, e))), this.items.value = i, this.reindex();
|
|
3117
2786
|
}
|
|
3118
2787
|
removeAt(e) {
|
|
3119
2788
|
const t = [...this.items.peek()];
|
|
3120
2789
|
t.splice(e, 1), this.items.value = t, this.reindex();
|
|
3121
2790
|
}
|
|
3122
2791
|
move(e, t) {
|
|
3123
|
-
const
|
|
3124
|
-
r &&
|
|
2792
|
+
const i = [...this.items.peek()], [r] = i.splice(e, 1);
|
|
2793
|
+
r && i.splice(t, 0, r), this.items.value = i, this.reindex();
|
|
3125
2794
|
}
|
|
3126
2795
|
swap(e, t) {
|
|
3127
|
-
const
|
|
3128
|
-
e < 0 || t < 0 || e >=
|
|
2796
|
+
const i = [...this.items.peek()];
|
|
2797
|
+
e < 0 || t < 0 || e >= i.length || t >= i.length || e === t || ([i[e], i[t]] = [i[t], i[e]], this.items.value = i, this.reindex());
|
|
3129
2798
|
}
|
|
3130
2799
|
clear() {
|
|
3131
2800
|
this.items.value = [];
|
|
@@ -3135,88 +2804,88 @@ class De {
|
|
|
3135
2804
|
}
|
|
3136
2805
|
set(e) {
|
|
3137
2806
|
const t = Array.isArray(e) ? e : [];
|
|
3138
|
-
this.items.value = t.map((
|
|
2807
|
+
this.items.value = t.map((i, r) => F(i, E(this.path, r)));
|
|
3139
2808
|
}
|
|
3140
2809
|
resetToInitial() {
|
|
3141
|
-
this.set(
|
|
2810
|
+
this.set(A(this.initial));
|
|
3142
2811
|
}
|
|
3143
2812
|
captureInitial() {
|
|
3144
|
-
this.initial =
|
|
2813
|
+
this.initial = A(this.peek());
|
|
3145
2814
|
}
|
|
3146
2815
|
dirty() {
|
|
3147
|
-
return !
|
|
2816
|
+
return !C(this.peek(), this.initial);
|
|
3148
2817
|
}
|
|
3149
2818
|
}
|
|
3150
|
-
function
|
|
3151
|
-
return Array.isArray(
|
|
2819
|
+
function F(s, e) {
|
|
2820
|
+
return Array.isArray(s) ? new Pe(s, e) : P(s) ? new ce(s, e) : new Me(s, e);
|
|
3152
2821
|
}
|
|
3153
|
-
function
|
|
3154
|
-
if (
|
|
3155
|
-
return
|
|
2822
|
+
function T(s) {
|
|
2823
|
+
if (s)
|
|
2824
|
+
return s.kind === "leaf" ? s.read() : s.kind === "group" ? Ce(s) : he(s);
|
|
3156
2825
|
}
|
|
3157
|
-
function
|
|
2826
|
+
function Ce(s) {
|
|
3158
2827
|
return new Proxy(
|
|
3159
2828
|
{},
|
|
3160
2829
|
{
|
|
3161
|
-
get: (e, t) => t === "__path" ?
|
|
3162
|
-
set: (e, t,
|
|
2830
|
+
get: (e, t) => t === "__path" ? s.path : typeof t == "string" ? T(s.children.get(t)) : void 0,
|
|
2831
|
+
set: (e, t, i) => {
|
|
3163
2832
|
if (typeof t != "string") return !1;
|
|
3164
|
-
const r =
|
|
3165
|
-
return r && r.set(
|
|
2833
|
+
const r = s.children.get(t);
|
|
2834
|
+
return r && r.set(i), !0;
|
|
3166
2835
|
},
|
|
3167
|
-
has: (e, t) => typeof t == "string" &&
|
|
3168
|
-
ownKeys: () => [...
|
|
3169
|
-
getOwnPropertyDescriptor: (e, t) => typeof t == "string" &&
|
|
2836
|
+
has: (e, t) => typeof t == "string" && s.children.has(t),
|
|
2837
|
+
ownKeys: () => [...s.children.keys()],
|
|
2838
|
+
getOwnPropertyDescriptor: (e, t) => typeof t == "string" && s.children.has(t) ? { enumerable: !0, configurable: !0 } : void 0
|
|
3170
2839
|
}
|
|
3171
2840
|
);
|
|
3172
2841
|
}
|
|
3173
|
-
function
|
|
3174
|
-
if (
|
|
3175
|
-
return
|
|
2842
|
+
function j(s) {
|
|
2843
|
+
if (s)
|
|
2844
|
+
return s.kind === "group" ? de(s) : s.kind === "array" ? he(s) : s.read();
|
|
3176
2845
|
}
|
|
3177
|
-
function
|
|
2846
|
+
function he(s) {
|
|
3178
2847
|
const e = {
|
|
3179
2848
|
get length() {
|
|
3180
|
-
return
|
|
2849
|
+
return s.items.value.length;
|
|
3181
2850
|
},
|
|
3182
|
-
push: (t) =>
|
|
3183
|
-
insertAt: (t,
|
|
3184
|
-
removeAt: (t) =>
|
|
3185
|
-
move: (t,
|
|
3186
|
-
swap: (t,
|
|
3187
|
-
clear: () =>
|
|
3188
|
-
at: (t) =>
|
|
3189
|
-
map: (t) =>
|
|
3190
|
-
forEach: (t) =>
|
|
3191
|
-
toArray: () =>
|
|
2851
|
+
push: (t) => s.push(t),
|
|
2852
|
+
insertAt: (t, i) => s.insertAt(t, i),
|
|
2853
|
+
removeAt: (t) => s.removeAt(t),
|
|
2854
|
+
move: (t, i) => s.move(t, i),
|
|
2855
|
+
swap: (t, i) => s.swap(t, i),
|
|
2856
|
+
clear: () => s.clear(),
|
|
2857
|
+
at: (t) => j(s.items.value[t]),
|
|
2858
|
+
map: (t) => s.items.value.map((i, r) => t(j(i), r)),
|
|
2859
|
+
forEach: (t) => s.items.value.forEach((i, r) => t(j(i), r)),
|
|
2860
|
+
toArray: () => s.peek(),
|
|
3192
2861
|
[Symbol.iterator]: function* () {
|
|
3193
|
-
const t =
|
|
3194
|
-
for (let
|
|
2862
|
+
const t = s.items.value;
|
|
2863
|
+
for (let i = 0; i < t.length; i++) yield T(t[i]);
|
|
3195
2864
|
}
|
|
3196
2865
|
};
|
|
3197
2866
|
return new Proxy(e, {
|
|
3198
|
-
get: (t,
|
|
3199
|
-
has: (t,
|
|
2867
|
+
get: (t, i, r) => i === "__path" ? s.path : typeof i == "string" && U(i) ? T(s.items.value[Number(i)]) : Reflect.get(t, i, r),
|
|
2868
|
+
has: (t, i) => typeof i == "string" && U(i) ? Number(i) < s.items.value.length : Reflect.has(t, i)
|
|
3200
2869
|
});
|
|
3201
2870
|
}
|
|
3202
|
-
function
|
|
3203
|
-
if (
|
|
3204
|
-
if (
|
|
2871
|
+
function W(s) {
|
|
2872
|
+
if (s.kind === "leaf") return s.signal;
|
|
2873
|
+
if (s.kind === "group")
|
|
3205
2874
|
return new Proxy(
|
|
3206
2875
|
{},
|
|
3207
2876
|
{
|
|
3208
|
-
get: (t,
|
|
3209
|
-
if (
|
|
3210
|
-
if (typeof
|
|
3211
|
-
const r =
|
|
3212
|
-
return r ?
|
|
2877
|
+
get: (t, i) => {
|
|
2878
|
+
if (i === "__path") return s.path;
|
|
2879
|
+
if (typeof i != "string") return;
|
|
2880
|
+
const r = s.children.get(i);
|
|
2881
|
+
return r ? W(r) : void 0;
|
|
3213
2882
|
},
|
|
3214
|
-
has: (t,
|
|
3215
|
-
ownKeys: () => [...
|
|
3216
|
-
getOwnPropertyDescriptor: (t,
|
|
2883
|
+
has: (t, i) => typeof i == "string" && s.children.has(i),
|
|
2884
|
+
ownKeys: () => [...s.children.keys()],
|
|
2885
|
+
getOwnPropertyDescriptor: (t, i) => typeof i == "string" && s.children.has(i) ? { enumerable: !0, configurable: !0 } : void 0
|
|
3217
2886
|
}
|
|
3218
2887
|
);
|
|
3219
|
-
const e =
|
|
2888
|
+
const e = s;
|
|
3220
2889
|
return new Proxy(
|
|
3221
2890
|
{
|
|
3222
2891
|
get length() {
|
|
@@ -3224,29 +2893,29 @@ function K(i) {
|
|
|
3224
2893
|
}
|
|
3225
2894
|
},
|
|
3226
2895
|
{
|
|
3227
|
-
get: (t,
|
|
3228
|
-
if (
|
|
3229
|
-
if (typeof
|
|
3230
|
-
const n = e.items.value[Number(
|
|
3231
|
-
return n ?
|
|
2896
|
+
get: (t, i, r) => {
|
|
2897
|
+
if (i === "__path") return e.path;
|
|
2898
|
+
if (typeof i == "string" && U(i)) {
|
|
2899
|
+
const n = e.items.value[Number(i)];
|
|
2900
|
+
return n ? W(n) : void 0;
|
|
3232
2901
|
}
|
|
3233
|
-
return Reflect.get(t,
|
|
2902
|
+
return Reflect.get(t, i, r);
|
|
3234
2903
|
}
|
|
3235
2904
|
}
|
|
3236
2905
|
);
|
|
3237
2906
|
}
|
|
3238
|
-
function
|
|
2907
|
+
function Te(s, e) {
|
|
3239
2908
|
if (!e) return;
|
|
3240
|
-
let t =
|
|
3241
|
-
for (const
|
|
2909
|
+
let t = s;
|
|
2910
|
+
for (const i of e.split(".")) {
|
|
3242
2911
|
if (!t) return;
|
|
3243
|
-
if (t.kind === "group") t = t.children.get(
|
|
3244
|
-
else if (t.kind === "array") t = t.items.peek()[Number(
|
|
2912
|
+
if (t.kind === "group") t = t.children.get(i);
|
|
2913
|
+
else if (t.kind === "array") t = t.items.peek()[Number(i)];
|
|
3245
2914
|
else return;
|
|
3246
2915
|
}
|
|
3247
2916
|
return t && t.kind === "leaf" ? t.signal : void 0;
|
|
3248
2917
|
}
|
|
3249
|
-
const
|
|
2918
|
+
const X = /* @__PURE__ */ new Set([
|
|
3250
2919
|
"$",
|
|
3251
2920
|
"get",
|
|
3252
2921
|
"set",
|
|
@@ -3255,192 +2924,192 @@ const ee = /* @__PURE__ */ new Set([
|
|
|
3255
2924
|
"reset",
|
|
3256
2925
|
"captureInitial",
|
|
3257
2926
|
"signalAt"
|
|
3258
|
-
]),
|
|
3259
|
-
function
|
|
3260
|
-
const e =
|
|
2927
|
+
]), Z = /* @__PURE__ */ new WeakMap();
|
|
2928
|
+
function de(s) {
|
|
2929
|
+
const e = Z.get(s);
|
|
3261
2930
|
if (e) return e;
|
|
3262
2931
|
const t = {
|
|
3263
|
-
$:
|
|
3264
|
-
get: () =>
|
|
3265
|
-
set: (r) =>
|
|
3266
|
-
patch: (r) =>
|
|
3267
|
-
isDirty: () =>
|
|
3268
|
-
reset: () =>
|
|
3269
|
-
captureInitial: () =>
|
|
3270
|
-
signalAt: (r) =>
|
|
3271
|
-
},
|
|
2932
|
+
$: W(s),
|
|
2933
|
+
get: () => s.peek(),
|
|
2934
|
+
set: (r) => s.set(r),
|
|
2935
|
+
patch: (r) => s.set(r),
|
|
2936
|
+
isDirty: () => s.dirty(),
|
|
2937
|
+
reset: () => s.resetToInitial(),
|
|
2938
|
+
captureInitial: () => s.captureInitial(),
|
|
2939
|
+
signalAt: (r) => Te(s, r)
|
|
2940
|
+
}, i = new Proxy(
|
|
3272
2941
|
{},
|
|
3273
2942
|
{
|
|
3274
2943
|
get: (r, n) => {
|
|
3275
2944
|
if (typeof n != "string") return;
|
|
3276
|
-
const a =
|
|
3277
|
-
if (a) return
|
|
3278
|
-
if (
|
|
2945
|
+
const a = s.children.get(n);
|
|
2946
|
+
if (a) return T(a);
|
|
2947
|
+
if (X.has(n)) return t[n];
|
|
3279
2948
|
},
|
|
3280
2949
|
set: (r, n, a) => {
|
|
3281
2950
|
if (typeof n != "string") return !1;
|
|
3282
|
-
const o =
|
|
2951
|
+
const o = s.children.get(n);
|
|
3283
2952
|
return o ? (o.set(a), !0) : !1;
|
|
3284
2953
|
},
|
|
3285
|
-
has: (r, n) => typeof n == "string" && (
|
|
3286
|
-
ownKeys: () => [...
|
|
3287
|
-
getOwnPropertyDescriptor: (r, n) => typeof n == "string" &&
|
|
2954
|
+
has: (r, n) => typeof n == "string" && (s.children.has(n) || X.has(n)),
|
|
2955
|
+
ownKeys: () => [...s.children.keys()],
|
|
2956
|
+
getOwnPropertyDescriptor: (r, n) => typeof n == "string" && s.children.has(n) ? { enumerable: !0, configurable: !0 } : void 0
|
|
3288
2957
|
}
|
|
3289
2958
|
);
|
|
3290
|
-
return
|
|
2959
|
+
return Z.set(s, i), i;
|
|
3291
2960
|
}
|
|
3292
|
-
function
|
|
3293
|
-
const e = new
|
|
3294
|
-
return
|
|
2961
|
+
function Je(s) {
|
|
2962
|
+
const e = new ce(s, "");
|
|
2963
|
+
return de(e);
|
|
3295
2964
|
}
|
|
3296
|
-
const
|
|
3297
|
-
const e =
|
|
2965
|
+
const Ie = (s) => {
|
|
2966
|
+
const e = s.componentProps;
|
|
3298
2967
|
return e != null && typeof e == "object" && typeof e.itemComponent == "function" && e.control != null && typeof e.control.at == "function" && typeof e.control.length == "number";
|
|
3299
|
-
},
|
|
3300
|
-
function V(
|
|
3301
|
-
if (
|
|
3302
|
-
if (Array.isArray(
|
|
3303
|
-
for (const a of
|
|
2968
|
+
}, De = (s) => typeof s.when == "function" && Array.isArray(s.children);
|
|
2969
|
+
function V(s, e, t, i, r) {
|
|
2970
|
+
if (s == null || typeof s != "object") return;
|
|
2971
|
+
if (Array.isArray(s)) {
|
|
2972
|
+
for (const a of s) V(a, e, t, i, r);
|
|
3304
2973
|
return;
|
|
3305
2974
|
}
|
|
3306
|
-
const n =
|
|
3307
|
-
if (
|
|
3308
|
-
const a =
|
|
2975
|
+
const n = s;
|
|
2976
|
+
if (De(n)) {
|
|
2977
|
+
const a = i && !!n.when(e, t);
|
|
3309
2978
|
for (const o of n.children) V(o, e, t, a, r);
|
|
3310
2979
|
return;
|
|
3311
2980
|
}
|
|
3312
|
-
if (
|
|
2981
|
+
if (Ie(n)) {
|
|
3313
2982
|
const a = n.componentProps.control, o = n.componentProps.itemComponent, l = a.length;
|
|
3314
2983
|
for (let u = 0; u < l; u++) {
|
|
3315
|
-
const
|
|
3316
|
-
V(o(
|
|
2984
|
+
const m = a.at(u);
|
|
2985
|
+
V(o(m), m, t, i, r);
|
|
3317
2986
|
}
|
|
3318
2987
|
return;
|
|
3319
2988
|
}
|
|
3320
|
-
if (n.value instanceof
|
|
2989
|
+
if (n.value instanceof ie) {
|
|
3321
2990
|
const a = n.validators ?? [];
|
|
3322
|
-
a.length > 0 && (
|
|
2991
|
+
a.length > 0 && (i ? r.tasks.push({ signal: n.value, validators: a, scope: e }) : r.clearSignals.push(n.value));
|
|
3323
2992
|
for (const [o, l] of Object.entries(n))
|
|
3324
|
-
o === "value" || o === "validators" || V(l, e, t,
|
|
2993
|
+
o === "value" || o === "validators" || V(l, e, t, i, r);
|
|
3325
2994
|
return;
|
|
3326
2995
|
}
|
|
3327
|
-
for (const a of Object.values(n)) V(a, e, t,
|
|
2996
|
+
for (const a of Object.values(n)) V(a, e, t, i, r);
|
|
3328
2997
|
}
|
|
3329
|
-
function
|
|
2998
|
+
function z(s, e) {
|
|
3330
2999
|
const t = { tasks: [], clearSignals: [] };
|
|
3331
|
-
return V(e,
|
|
3000
|
+
return V(e, s, s, !0, t), t;
|
|
3332
3001
|
}
|
|
3333
|
-
const
|
|
3334
|
-
(
|
|
3002
|
+
const fe = (s, e, t) => {
|
|
3003
|
+
(s[e] ??= []).push(t);
|
|
3335
3004
|
};
|
|
3336
|
-
function
|
|
3337
|
-
const { tasks: t } =
|
|
3005
|
+
function Ye(s, e) {
|
|
3006
|
+
const { tasks: t } = z(s, e), i = {};
|
|
3338
3007
|
for (const { signal: r, validators: n, scope: a } of t) {
|
|
3339
3008
|
const o = r.peek();
|
|
3340
3009
|
for (const l of n) {
|
|
3341
|
-
const u = l(o, a,
|
|
3342
|
-
u && typeof u.then == "function" || u &&
|
|
3010
|
+
const u = l(o, a, s);
|
|
3011
|
+
u && typeof u.then == "function" || u && fe(i, r.__path, u);
|
|
3343
3012
|
}
|
|
3344
3013
|
}
|
|
3345
|
-
return { valid: Object.keys(
|
|
3014
|
+
return { valid: Object.keys(i).length === 0, errors: i };
|
|
3346
3015
|
}
|
|
3347
|
-
async function
|
|
3348
|
-
const { tasks: t } =
|
|
3349
|
-
return { valid: Object.keys(
|
|
3016
|
+
async function Qe(s, e) {
|
|
3017
|
+
const { tasks: t } = z(s, e), i = await pe(t, s);
|
|
3018
|
+
return { valid: Object.keys(i).length === 0, errors: i };
|
|
3350
3019
|
}
|
|
3351
|
-
async function
|
|
3020
|
+
async function pe(s, e) {
|
|
3352
3021
|
const t = {};
|
|
3353
3022
|
return await Promise.all(
|
|
3354
|
-
|
|
3355
|
-
const a =
|
|
3023
|
+
s.map(async ({ signal: i, validators: r, scope: n }) => {
|
|
3024
|
+
const a = i.peek();
|
|
3356
3025
|
for (const o of r) {
|
|
3357
3026
|
const l = await o(a, n, e);
|
|
3358
|
-
l &&
|
|
3027
|
+
l && fe(t, i.__path, l);
|
|
3359
3028
|
}
|
|
3360
3029
|
})
|
|
3361
3030
|
), t;
|
|
3362
3031
|
}
|
|
3363
|
-
async function
|
|
3364
|
-
const { tasks: t, clearSignals:
|
|
3032
|
+
async function Xe(s, e) {
|
|
3033
|
+
const { tasks: t, clearSignals: i } = z(s, e), r = await pe(t, s);
|
|
3365
3034
|
for (const { signal: n } of t)
|
|
3366
|
-
|
|
3367
|
-
for (const n of
|
|
3368
|
-
|
|
3035
|
+
Y(n)?.setErrors(r[n.__path] ?? []);
|
|
3036
|
+
for (const n of i)
|
|
3037
|
+
Y(n)?.setErrors([]);
|
|
3369
3038
|
return { valid: Object.keys(r).length === 0, errors: r };
|
|
3370
3039
|
}
|
|
3371
|
-
var
|
|
3372
|
-
var
|
|
3373
|
-
function
|
|
3374
|
-
if (
|
|
3375
|
-
|
|
3376
|
-
var
|
|
3377
|
-
function e(
|
|
3378
|
-
return
|
|
3379
|
-
}
|
|
3380
|
-
var t = typeof Object.is == "function" ? Object.is : e,
|
|
3381
|
-
function o(
|
|
3382
|
-
var d = f(), p =
|
|
3040
|
+
var M = { exports: {} }, R = {};
|
|
3041
|
+
var ee;
|
|
3042
|
+
function Le() {
|
|
3043
|
+
if (ee) return R;
|
|
3044
|
+
ee = 1;
|
|
3045
|
+
var s = re;
|
|
3046
|
+
function e(c, f) {
|
|
3047
|
+
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
|
|
3048
|
+
}
|
|
3049
|
+
var t = typeof Object.is == "function" ? Object.is : e, i = s.useState, r = s.useEffect, n = s.useLayoutEffect, a = s.useDebugValue;
|
|
3050
|
+
function o(c, f) {
|
|
3051
|
+
var d = f(), p = i({ inst: { value: d, getSnapshot: f } }), v = p[0].inst, g = p[1];
|
|
3383
3052
|
return n(
|
|
3384
3053
|
function() {
|
|
3385
|
-
v.value = d, v.getSnapshot = f, l(v) &&
|
|
3054
|
+
v.value = d, v.getSnapshot = f, l(v) && g({ inst: v });
|
|
3386
3055
|
},
|
|
3387
|
-
[
|
|
3056
|
+
[c, d, f]
|
|
3388
3057
|
), r(
|
|
3389
3058
|
function() {
|
|
3390
|
-
return l(v) &&
|
|
3391
|
-
l(v) &&
|
|
3059
|
+
return l(v) && g({ inst: v }), c(function() {
|
|
3060
|
+
l(v) && g({ inst: v });
|
|
3392
3061
|
});
|
|
3393
3062
|
},
|
|
3394
|
-
[
|
|
3063
|
+
[c]
|
|
3395
3064
|
), a(d), d;
|
|
3396
3065
|
}
|
|
3397
|
-
function l(
|
|
3398
|
-
var f =
|
|
3399
|
-
|
|
3066
|
+
function l(c) {
|
|
3067
|
+
var f = c.getSnapshot;
|
|
3068
|
+
c = c.value;
|
|
3400
3069
|
try {
|
|
3401
3070
|
var d = f();
|
|
3402
|
-
return !t(
|
|
3071
|
+
return !t(c, d);
|
|
3403
3072
|
} catch {
|
|
3404
3073
|
return !0;
|
|
3405
3074
|
}
|
|
3406
3075
|
}
|
|
3407
|
-
function u(
|
|
3076
|
+
function u(c, f) {
|
|
3408
3077
|
return f();
|
|
3409
3078
|
}
|
|
3410
|
-
var
|
|
3411
|
-
return
|
|
3079
|
+
var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : o;
|
|
3080
|
+
return R.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : m, R;
|
|
3412
3081
|
}
|
|
3413
|
-
var
|
|
3414
|
-
var
|
|
3415
|
-
function
|
|
3416
|
-
return
|
|
3417
|
-
function
|
|
3082
|
+
var $ = {};
|
|
3083
|
+
var te;
|
|
3084
|
+
function je() {
|
|
3085
|
+
return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
3086
|
+
function s(d, p) {
|
|
3418
3087
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
3419
3088
|
}
|
|
3420
3089
|
function e(d, p) {
|
|
3421
|
-
|
|
3090
|
+
m || r.startTransition === void 0 || (m = !0, console.error(
|
|
3422
3091
|
"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."
|
|
3423
3092
|
));
|
|
3424
3093
|
var v = p();
|
|
3425
|
-
if (!
|
|
3426
|
-
var
|
|
3427
|
-
n(v,
|
|
3094
|
+
if (!c) {
|
|
3095
|
+
var g = p();
|
|
3096
|
+
n(v, g) || (console.error(
|
|
3428
3097
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
3429
|
-
),
|
|
3098
|
+
), c = !0);
|
|
3430
3099
|
}
|
|
3431
|
-
|
|
3100
|
+
g = a({
|
|
3432
3101
|
inst: { value: v, getSnapshot: p }
|
|
3433
3102
|
});
|
|
3434
|
-
var
|
|
3103
|
+
var b = g[0].inst, L = g[1];
|
|
3435
3104
|
return l(
|
|
3436
3105
|
function() {
|
|
3437
|
-
|
|
3106
|
+
b.value = v, b.getSnapshot = p, t(b) && L({ inst: b });
|
|
3438
3107
|
},
|
|
3439
3108
|
[d, v, p]
|
|
3440
3109
|
), o(
|
|
3441
3110
|
function() {
|
|
3442
|
-
return t(
|
|
3443
|
-
t(
|
|
3111
|
+
return t(b) && L({ inst: b }), d(function() {
|
|
3112
|
+
t(b) && L({ inst: b });
|
|
3444
3113
|
});
|
|
3445
3114
|
},
|
|
3446
3115
|
[d]
|
|
@@ -3456,40 +3125,40 @@ function Be() {
|
|
|
3456
3125
|
return !0;
|
|
3457
3126
|
}
|
|
3458
3127
|
}
|
|
3459
|
-
function
|
|
3128
|
+
function i(d, p) {
|
|
3460
3129
|
return p();
|
|
3461
3130
|
}
|
|
3462
3131
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
3463
|
-
var r =
|
|
3464
|
-
|
|
3465
|
-
})()),
|
|
3132
|
+
var r = re, n = typeof Object.is == "function" ? Object.is : s, a = r.useState, o = r.useEffect, l = r.useLayoutEffect, u = r.useDebugValue, m = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? i : e;
|
|
3133
|
+
$.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
3134
|
+
})()), $;
|
|
3466
3135
|
}
|
|
3467
|
-
var
|
|
3468
|
-
function
|
|
3469
|
-
return
|
|
3136
|
+
var se;
|
|
3137
|
+
function Re() {
|
|
3138
|
+
return se || (se = 1, process.env.NODE_ENV === "production" ? M.exports = Le() : M.exports = je()), M.exports;
|
|
3470
3139
|
}
|
|
3471
|
-
var
|
|
3472
|
-
function
|
|
3473
|
-
if (
|
|
3474
|
-
if (
|
|
3475
|
-
for (let t = 0; t <
|
|
3476
|
-
if (
|
|
3140
|
+
var J = Re();
|
|
3141
|
+
function $e(s, e) {
|
|
3142
|
+
if (s === e) return !0;
|
|
3143
|
+
if (s.length !== e.length) return !1;
|
|
3144
|
+
for (let t = 0; t < s.length; t++)
|
|
3145
|
+
if (s[t] !== e[t]) return !1;
|
|
3477
3146
|
return !0;
|
|
3478
3147
|
}
|
|
3479
|
-
function
|
|
3480
|
-
const
|
|
3481
|
-
if (
|
|
3148
|
+
function ve(s, e, t) {
|
|
3149
|
+
const i = q(null);
|
|
3150
|
+
if (i.current === null) {
|
|
3482
3151
|
const a = {};
|
|
3483
|
-
for (const o in
|
|
3484
|
-
a[o] =
|
|
3485
|
-
|
|
3152
|
+
for (const o in s)
|
|
3153
|
+
a[o] = s[o].value;
|
|
3154
|
+
i.current = { ...a, __snapshot: null };
|
|
3486
3155
|
}
|
|
3487
|
-
const r =
|
|
3156
|
+
const r = S(
|
|
3488
3157
|
(a) => {
|
|
3489
3158
|
let o = !0;
|
|
3490
|
-
return
|
|
3491
|
-
for (const u in
|
|
3492
|
-
|
|
3159
|
+
return _(() => {
|
|
3160
|
+
for (const u in s)
|
|
3161
|
+
s[u].value;
|
|
3493
3162
|
if (o) {
|
|
3494
3163
|
o = !1;
|
|
3495
3164
|
return;
|
|
@@ -3497,16 +3166,16 @@ function ye(i, e, t) {
|
|
|
3497
3166
|
a();
|
|
3498
3167
|
});
|
|
3499
3168
|
},
|
|
3500
|
-
[
|
|
3501
|
-
), n =
|
|
3502
|
-
const a =
|
|
3503
|
-
for (const u in
|
|
3504
|
-
o[u] =
|
|
3169
|
+
[s]
|
|
3170
|
+
), n = S(() => {
|
|
3171
|
+
const a = i.current, o = {};
|
|
3172
|
+
for (const u in s)
|
|
3173
|
+
o[u] = s[u].value;
|
|
3505
3174
|
let l = !1;
|
|
3506
3175
|
for (const u of e) {
|
|
3507
|
-
const { key:
|
|
3508
|
-
if (
|
|
3509
|
-
if (
|
|
3176
|
+
const { key: m, useShallowArrayEqual: c } = u, f = o[m], d = a[m];
|
|
3177
|
+
if (c) {
|
|
3178
|
+
if (!$e(d, f)) {
|
|
3510
3179
|
l = !0;
|
|
3511
3180
|
break;
|
|
3512
3181
|
}
|
|
@@ -3517,23 +3186,23 @@ function ye(i, e, t) {
|
|
|
3517
3186
|
}
|
|
3518
3187
|
if (!l && a.__snapshot)
|
|
3519
3188
|
return a.__snapshot;
|
|
3520
|
-
for (const u in
|
|
3189
|
+
for (const u in s)
|
|
3521
3190
|
a[u] = o[u];
|
|
3522
3191
|
return a.__snapshot = t(o), a.__snapshot;
|
|
3523
|
-
}, [
|
|
3524
|
-
return
|
|
3192
|
+
}, [s, t]);
|
|
3193
|
+
return J.useSyncExternalStore(r, n, n);
|
|
3525
3194
|
}
|
|
3526
|
-
function
|
|
3195
|
+
function Be(s) {
|
|
3527
3196
|
const e = {
|
|
3528
|
-
value:
|
|
3529
|
-
disabled:
|
|
3530
|
-
errors:
|
|
3531
|
-
pending:
|
|
3532
|
-
valid:
|
|
3533
|
-
invalid:
|
|
3534
|
-
touched:
|
|
3535
|
-
shouldShowError:
|
|
3536
|
-
componentProps:
|
|
3197
|
+
value: s.value,
|
|
3198
|
+
disabled: s.disabled,
|
|
3199
|
+
errors: s.errors,
|
|
3200
|
+
pending: s.pending,
|
|
3201
|
+
valid: s.valid,
|
|
3202
|
+
invalid: s.invalid,
|
|
3203
|
+
touched: s.touched,
|
|
3204
|
+
shouldShowError: s.shouldShowError,
|
|
3205
|
+
componentProps: s.componentProps
|
|
3537
3206
|
}, t = [
|
|
3538
3207
|
{ key: "value" },
|
|
3539
3208
|
{ key: "disabled" },
|
|
@@ -3544,7 +3213,7 @@ function We(i) {
|
|
|
3544
3213
|
{ key: "touched" },
|
|
3545
3214
|
{ key: "shouldShowError" },
|
|
3546
3215
|
{ key: "componentProps" }
|
|
3547
|
-
],
|
|
3216
|
+
], i = S(
|
|
3548
3217
|
(r) => ({
|
|
3549
3218
|
value: r.value,
|
|
3550
3219
|
pending: r.pending,
|
|
@@ -3558,18 +3227,18 @@ function We(i) {
|
|
|
3558
3227
|
}),
|
|
3559
3228
|
[]
|
|
3560
3229
|
);
|
|
3561
|
-
return
|
|
3230
|
+
return ve(e, t, i);
|
|
3562
3231
|
}
|
|
3563
|
-
function
|
|
3232
|
+
function Ge(s) {
|
|
3564
3233
|
const e = {
|
|
3565
|
-
value:
|
|
3566
|
-
length:
|
|
3567
|
-
errors:
|
|
3568
|
-
pending:
|
|
3569
|
-
valid:
|
|
3570
|
-
invalid:
|
|
3571
|
-
touched:
|
|
3572
|
-
dirty:
|
|
3234
|
+
value: s.value,
|
|
3235
|
+
length: s.length,
|
|
3236
|
+
errors: s.errors,
|
|
3237
|
+
pending: s.pending,
|
|
3238
|
+
valid: s.valid,
|
|
3239
|
+
invalid: s.invalid,
|
|
3240
|
+
touched: s.touched,
|
|
3241
|
+
dirty: s.dirty
|
|
3573
3242
|
}, t = [
|
|
3574
3243
|
{ key: "value" },
|
|
3575
3244
|
{ key: "length" },
|
|
@@ -3579,7 +3248,7 @@ function qe(i) {
|
|
|
3579
3248
|
{ key: "invalid" },
|
|
3580
3249
|
{ key: "touched" },
|
|
3581
3250
|
{ key: "dirty" }
|
|
3582
|
-
],
|
|
3251
|
+
], i = S(
|
|
3583
3252
|
(r) => ({
|
|
3584
3253
|
value: r.value,
|
|
3585
3254
|
length: r.length,
|
|
@@ -3592,11 +3261,11 @@ function qe(i) {
|
|
|
3592
3261
|
}),
|
|
3593
3262
|
[]
|
|
3594
3263
|
);
|
|
3595
|
-
return
|
|
3264
|
+
return ve(e, t, i);
|
|
3596
3265
|
}
|
|
3597
|
-
function
|
|
3598
|
-
const e =
|
|
3599
|
-
return
|
|
3266
|
+
function Ze(s) {
|
|
3267
|
+
const e = s && "length" in s && "map" in s;
|
|
3268
|
+
return s ? e ? Ge(s) : Be(s) : {
|
|
3600
3269
|
value: [],
|
|
3601
3270
|
length: 0,
|
|
3602
3271
|
pending: !1,
|
|
@@ -3607,89 +3276,86 @@ function it(i) {
|
|
|
3607
3276
|
dirty: !1
|
|
3608
3277
|
};
|
|
3609
3278
|
}
|
|
3610
|
-
function
|
|
3611
|
-
const e =
|
|
3279
|
+
function et(s) {
|
|
3280
|
+
const e = q({ value: s.value.value }), t = S(
|
|
3612
3281
|
(r) => {
|
|
3613
3282
|
let n = !0;
|
|
3614
|
-
return
|
|
3615
|
-
if (
|
|
3283
|
+
return _(() => {
|
|
3284
|
+
if (s.value.value, n) {
|
|
3616
3285
|
n = !1;
|
|
3617
3286
|
return;
|
|
3618
3287
|
}
|
|
3619
3288
|
r();
|
|
3620
3289
|
});
|
|
3621
3290
|
},
|
|
3622
|
-
[
|
|
3623
|
-
),
|
|
3624
|
-
const r =
|
|
3291
|
+
[s]
|
|
3292
|
+
), i = S(() => {
|
|
3293
|
+
const r = s.value.value;
|
|
3625
3294
|
return e.current.value === r ? e.current.value : (e.current.value = r, r);
|
|
3626
|
-
}, [
|
|
3627
|
-
return
|
|
3295
|
+
}, [s]);
|
|
3296
|
+
return J.useSyncExternalStore(t, i, i);
|
|
3628
3297
|
}
|
|
3629
|
-
function
|
|
3630
|
-
const e =
|
|
3298
|
+
function tt(s) {
|
|
3299
|
+
const e = q({ length: s.length.value }), t = S(
|
|
3631
3300
|
(r) => {
|
|
3632
3301
|
let n = !0;
|
|
3633
|
-
return
|
|
3634
|
-
if (
|
|
3302
|
+
return _(() => {
|
|
3303
|
+
if (s.length.value, n) {
|
|
3635
3304
|
n = !1;
|
|
3636
3305
|
return;
|
|
3637
3306
|
}
|
|
3638
3307
|
r();
|
|
3639
3308
|
});
|
|
3640
3309
|
},
|
|
3641
|
-
[
|
|
3642
|
-
),
|
|
3643
|
-
const r =
|
|
3310
|
+
[s]
|
|
3311
|
+
), i = S(() => {
|
|
3312
|
+
const r = s.length.value;
|
|
3644
3313
|
return e.current.length === r ? e.current.length : (e.current.length = r, r);
|
|
3645
|
-
}, [
|
|
3646
|
-
return
|
|
3314
|
+
}, [s]);
|
|
3315
|
+
return J.useSyncExternalStore(t, i, i);
|
|
3647
3316
|
}
|
|
3648
3317
|
export {
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
we as FieldNode,
|
|
3318
|
+
Q as ArrayNode,
|
|
3319
|
+
w as ErrorStrategy,
|
|
3320
|
+
_e as FieldNode,
|
|
3653
3321
|
k as FormErrorHandler,
|
|
3654
3322
|
I as FormNode,
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
wt as validators,
|
|
3694
|
-
_t as watchField
|
|
3323
|
+
be as FormStatusMachine,
|
|
3324
|
+
Se as FormSubmitter,
|
|
3325
|
+
x as GroupNode,
|
|
3326
|
+
Fe as ModelArrayNode,
|
|
3327
|
+
ke as NodeFactory,
|
|
3328
|
+
K as SubscriptionManager,
|
|
3329
|
+
rt as computeFrom,
|
|
3330
|
+
nt as copyFrom,
|
|
3331
|
+
ze as createForm,
|
|
3332
|
+
ue as createFormFromModel,
|
|
3333
|
+
Je as createModel,
|
|
3334
|
+
at as disableWhen,
|
|
3335
|
+
ot as enableWhen,
|
|
3336
|
+
Y as getNodeForSignal,
|
|
3337
|
+
He as getNodeType,
|
|
3338
|
+
Ne as isArrayNode,
|
|
3339
|
+
B as isDerived,
|
|
3340
|
+
Ve as isFieldNode,
|
|
3341
|
+
D as isFormNode,
|
|
3342
|
+
Oe as isGroupNode,
|
|
3343
|
+
lt as markDerived,
|
|
3344
|
+
ye as registerSignalNode,
|
|
3345
|
+
ut as resetWhen,
|
|
3346
|
+
ct as revalidateWhen,
|
|
3347
|
+
ht as runOutsideEffect,
|
|
3348
|
+
dt as safeCallback,
|
|
3349
|
+
ft as safeDebouncedCallback,
|
|
3350
|
+
pt as syncFields,
|
|
3351
|
+
vt as transformValue,
|
|
3352
|
+
N as uniqueId,
|
|
3353
|
+
tt as useArrayLength,
|
|
3354
|
+
Ze as useFormControl,
|
|
3355
|
+
et as useFormControlValue,
|
|
3356
|
+
Xe as validateFormModel,
|
|
3357
|
+
Qe as validateModel,
|
|
3358
|
+
Ye as validateModelSync,
|
|
3359
|
+
gt as validators,
|
|
3360
|
+
mt as watchField
|
|
3695
3361
|
};
|