@reformer/core 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/behaviors/compute-from.js +3 -3
- package/dist/behaviors/enable-when.js +5 -5
- package/dist/behaviors/reset-when.js +1 -1
- package/dist/behaviors/revalidate-when.js +1 -1
- package/dist/behaviors/sync-fields.js +5 -5
- package/dist/behaviors/watch-field.js +3 -3
- package/dist/behaviors.js +2 -2
- package/dist/core/types/field-path.d.ts +2 -2
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/validation-schema.d.ts +21 -50
- package/dist/core/validation/core/index.d.ts +0 -1
- package/dist/core/validation/core/validate-async.d.ts +9 -15
- package/dist/core/validation/core/validate.d.ts +15 -15
- package/dist/core/validation/index.d.ts +5 -3
- package/dist/core/validation/validation-applicator.d.ts +2 -56
- package/dist/core/validation/validation-registry.d.ts +18 -16
- package/dist/core/validation/validators/array-validators.d.ts +6 -31
- package/dist/core/validation/validators/email.d.ts +5 -29
- package/dist/core/validation/validators/future-date.d.ts +6 -28
- package/dist/core/validation/validators/index.d.ts +12 -4
- package/dist/core/validation/validators/integer.d.ts +13 -0
- package/dist/core/validation/validators/is-date.d.ts +5 -28
- package/dist/core/validation/validators/is-number.d.ts +14 -0
- package/dist/core/validation/validators/max-age.d.ts +6 -29
- package/dist/core/validation/validators/max-date.d.ts +6 -29
- package/dist/core/validation/validators/max-length.d.ts +5 -30
- package/dist/core/validation/validators/max.d.ts +7 -29
- package/dist/core/validation/validators/min-age.d.ts +6 -29
- package/dist/core/validation/validators/min-date.d.ts +6 -29
- package/dist/core/validation/validators/min-length.d.ts +5 -30
- package/dist/core/validation/validators/min.d.ts +7 -29
- package/dist/core/validation/validators/multiple-of.d.ts +13 -0
- package/dist/core/validation/validators/non-negative.d.ts +13 -0
- package/dist/core/validation/validators/non-zero.d.ts +13 -0
- package/dist/core/validation/validators/past-date.d.ts +5 -28
- package/dist/core/validation/validators/pattern.d.ts +5 -32
- package/dist/core/validation/validators/phone.d.ts +9 -19
- package/dist/core/validation/validators/required.d.ts +10 -31
- package/dist/core/validation/validators/url.d.ts +13 -15
- package/dist/{index-D25LsbRm.js → index-DLh_Ryb2.js} +1 -1
- package/dist/index.js +465 -397
- package/dist/{registry-helpers-Bv_BJ1s-.js → registry-helpers-CLPXad2B.js} +152 -292
- package/dist/validators/email.js +7 -9
- package/dist/validators/future-date.js +11 -12
- package/dist/validators/integer.d.ts +2 -0
- package/dist/validators/integer.js +10 -0
- package/dist/validators/is-date.js +6 -7
- package/dist/validators/is-number.d.ts +2 -0
- package/dist/validators/is-number.js +10 -0
- package/dist/validators/max-age.js +11 -12
- package/dist/validators/max-date.js +11 -12
- package/dist/validators/max-length.js +12 -8
- package/dist/validators/max.js +5 -6
- package/dist/validators/min-age.js +10 -11
- package/dist/validators/min-date.js +12 -13
- package/dist/validators/min-length.js +12 -8
- package/dist/validators/min.js +6 -7
- package/dist/validators/multiple-of.d.ts +2 -0
- package/dist/validators/multiple-of.js +10 -0
- package/dist/validators/non-negative.d.ts +2 -0
- package/dist/validators/non-negative.js +10 -0
- package/dist/validators/non-zero.d.ts +2 -0
- package/dist/validators/non-zero.js +10 -0
- package/dist/validators/past-date.js +11 -12
- package/dist/validators/pattern.js +6 -7
- package/dist/validators/phone.js +14 -32
- package/dist/validators/required.js +9 -10
- package/dist/validators/url.js +19 -16
- package/dist/validators-xJyP-jLZ.js +169 -0
- package/dist/validators.js +54 -50
- package/llms.txt +505 -790
- package/package.json +20 -4
- package/dist/core/validation/core/validate-tree.d.ts +0 -35
- package/dist/core/validation/validation-context.d.ts +0 -86
- package/dist/core/validation/validators/number.d.ts +0 -31
- package/dist/validate-C3XiA_zf.js +0 -10
- package/dist/validators/number.d.ts +0 -2
- package/dist/validators/number.js +0 -35
- package/dist/validators-BGsNOgT1.js +0 -207
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { signal as g, computed as d, effect as m, batch as j } from "@preact/signals-core";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as
|
|
7
|
-
import { a as
|
|
8
|
-
import
|
|
9
|
-
import { i as
|
|
10
|
-
import { r as
|
|
2
|
+
import { i as q, a as M } from "./validators-xJyP-jLZ.js";
|
|
3
|
+
import { g as Ve, c as Ae, d as ke, v as xe, b as Fe } from "./validators-xJyP-jLZ.js";
|
|
4
|
+
import { V as K, B as H } from "./registry-helpers-CLPXad2B.js";
|
|
5
|
+
import { A as Oe, R as Te, g as Ce, b as De } from "./registry-helpers-CLPXad2B.js";
|
|
6
|
+
import { c as N } from "./field-path-DuKdGcIE.js";
|
|
7
|
+
import { a as Me, e as Ne, t as Ie } from "./field-path-DuKdGcIE.js";
|
|
8
|
+
import $, { useRef as T, useCallback as b, useSyncExternalStore as z } from "react";
|
|
9
|
+
import { i as Be } from "./index-DLh_Ryb2.js";
|
|
10
|
+
import { r as $e, s as Ue, a as We } from "./safe-effect-Dh8uw81c.js";
|
|
11
11
|
class C {
|
|
12
12
|
// ============================================================================
|
|
13
13
|
// Protected состояние (для Template Method паттерна)
|
|
@@ -108,8 +108,8 @@ class C {
|
|
|
108
108
|
if (e.params !== void 0) {
|
|
109
109
|
if (!s.params)
|
|
110
110
|
return !1;
|
|
111
|
-
for (const [i,
|
|
112
|
-
if (s.params[i] !==
|
|
111
|
+
for (const [i, a] of Object.entries(e.params))
|
|
112
|
+
if (s.params[i] !== a)
|
|
113
113
|
return !1;
|
|
114
114
|
}
|
|
115
115
|
return !(e.predicate !== void 0 && !e.predicate(s));
|
|
@@ -467,11 +467,144 @@ const w = {
|
|
|
467
467
|
/** ArrayNode.watchLength() */
|
|
468
468
|
WatchLength: "watchLength"
|
|
469
469
|
};
|
|
470
|
-
let
|
|
471
|
-
function
|
|
472
|
-
return `${
|
|
470
|
+
let J = 0;
|
|
471
|
+
function V(r) {
|
|
472
|
+
return `${r}-${++J}`;
|
|
473
473
|
}
|
|
474
|
-
|
|
474
|
+
var S = /* @__PURE__ */ ((r) => (r.THROW = "throw", r.LOG = "log", r.CONVERT = "convert", r))(S || {});
|
|
475
|
+
class k {
|
|
476
|
+
/**
|
|
477
|
+
* Обработать ошибку согласно заданной стратегии
|
|
478
|
+
*
|
|
479
|
+
* @param error Ошибка для обработки (Error | string | unknown)
|
|
480
|
+
* @param context Контекст ошибки для логирования (например, 'AsyncValidator', 'BehaviorRegistry')
|
|
481
|
+
* @param strategy Стратегия обработки (THROW | LOG | CONVERT)
|
|
482
|
+
* @returns ValidationError если strategy = CONVERT, undefined если strategy = LOG, никогда не возвращается если strategy = THROW
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* // THROW - пробросить ошибку
|
|
487
|
+
* try {
|
|
488
|
+
* riskyOperation();
|
|
489
|
+
* } catch (error) {
|
|
490
|
+
* FormErrorHandler.handle(error, 'RiskyOperation', ErrorStrategy.THROW);
|
|
491
|
+
* // Этот код никогда не выполнится
|
|
492
|
+
* }
|
|
493
|
+
*
|
|
494
|
+
* // LOG - залогировать и продолжить
|
|
495
|
+
* try {
|
|
496
|
+
* nonCriticalOperation();
|
|
497
|
+
* } catch (error) {
|
|
498
|
+
* FormErrorHandler.handle(error, 'NonCritical', ErrorStrategy.LOG);
|
|
499
|
+
* // Продолжаем выполнение
|
|
500
|
+
* }
|
|
501
|
+
*
|
|
502
|
+
* // CONVERT - конвертировать в ValidationError
|
|
503
|
+
* try {
|
|
504
|
+
* await validator(value);
|
|
505
|
+
* } catch (error) {
|
|
506
|
+
* const validationError = FormErrorHandler.handle(
|
|
507
|
+
* error,
|
|
508
|
+
* 'AsyncValidator',
|
|
509
|
+
* ErrorStrategy.CONVERT
|
|
510
|
+
* );
|
|
511
|
+
* return validationError;
|
|
512
|
+
* }
|
|
513
|
+
* ```
|
|
514
|
+
*/
|
|
515
|
+
static handle(e, t, s = "throw") {
|
|
516
|
+
const i = this.extractMessage(e);
|
|
517
|
+
switch (s) {
|
|
518
|
+
case "throw":
|
|
519
|
+
throw e;
|
|
520
|
+
case "log":
|
|
521
|
+
return;
|
|
522
|
+
case "convert":
|
|
523
|
+
return {
|
|
524
|
+
code: "validator_error",
|
|
525
|
+
message: i,
|
|
526
|
+
params: { field: t }
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Извлечь сообщение из ошибки
|
|
532
|
+
*
|
|
533
|
+
* Обрабатывает различные типы ошибок:
|
|
534
|
+
* - Error объекты → error.message
|
|
535
|
+
* - Строки → возвращает как есть
|
|
536
|
+
* - Объекты с message → извлекает message
|
|
537
|
+
* - Другое → String(error)
|
|
538
|
+
*
|
|
539
|
+
* @param error Ошибка для извлечения сообщения
|
|
540
|
+
* @returns Сообщение ошибки
|
|
541
|
+
* @private
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```typescript
|
|
545
|
+
* FormErrorHandler.extractMessage(new Error('Test'));
|
|
546
|
+
* // 'Test'
|
|
547
|
+
*
|
|
548
|
+
* FormErrorHandler.extractMessage('String error');
|
|
549
|
+
* // 'String error'
|
|
550
|
+
*
|
|
551
|
+
* FormErrorHandler.extractMessage({ message: 'Object error' });
|
|
552
|
+
* // 'Object error'
|
|
553
|
+
*
|
|
554
|
+
* FormErrorHandler.extractMessage(null);
|
|
555
|
+
* // 'null'
|
|
556
|
+
* ```
|
|
557
|
+
*/
|
|
558
|
+
static extractMessage(e) {
|
|
559
|
+
return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e ? String(e.message) : String(e);
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Создать ValidationError с заданными параметрами
|
|
563
|
+
*
|
|
564
|
+
* Утилитная функция для создания ValidationError объектов
|
|
565
|
+
*
|
|
566
|
+
* @param code Код ошибки
|
|
567
|
+
* @param message Сообщение ошибки
|
|
568
|
+
* @param field Поле (опционально)
|
|
569
|
+
* @returns ValidationError объект
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```typescript
|
|
573
|
+
* const error = FormErrorHandler.createValidationError(
|
|
574
|
+
* 'required',
|
|
575
|
+
* 'This field is required',
|
|
576
|
+
* 'email'
|
|
577
|
+
* );
|
|
578
|
+
* // { code: 'required', message: 'This field is required', field: 'email' }
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
static createValidationError(e, t, s) {
|
|
582
|
+
return {
|
|
583
|
+
code: e,
|
|
584
|
+
message: t,
|
|
585
|
+
params: s ? { field: s } : void 0
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Проверить, является ли объект ValidationError
|
|
590
|
+
*
|
|
591
|
+
* Type guard для ValidationError
|
|
592
|
+
*
|
|
593
|
+
* @param value Значение для проверки
|
|
594
|
+
* @returns true если value является ValidationError
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```typescript
|
|
598
|
+
* if (FormErrorHandler.isValidationError(result)) {
|
|
599
|
+
* console.log(result.code); // OK, типобезопасно
|
|
600
|
+
* }
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
603
|
+
static isValidationError(e) {
|
|
604
|
+
return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
class Y {
|
|
475
608
|
/** Внутренний сигнал статуса */
|
|
476
609
|
_status;
|
|
477
610
|
/** Публичный read-only сигнал статуса */
|
|
@@ -616,7 +749,7 @@ class Z {
|
|
|
616
749
|
return this._status.value !== "disabled";
|
|
617
750
|
}
|
|
618
751
|
}
|
|
619
|
-
class
|
|
752
|
+
class Q extends C {
|
|
620
753
|
// ============================================================================
|
|
621
754
|
// Приватные сигналы
|
|
622
755
|
// ============================================================================
|
|
@@ -676,7 +809,7 @@ class ee extends C {
|
|
|
676
809
|
// Конструктор
|
|
677
810
|
// ============================================================================
|
|
678
811
|
constructor(e) {
|
|
679
|
-
super(), this.initialValue = e.value, this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = g(e.value), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new
|
|
812
|
+
super(), this.initialValue = e.value, this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = g(e.value), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new Y(e.disabled ? "disabled" : "valid"), this.value = d(() => this._value.value), this.valid = d(() => this.statusMachine.valid.value), this.invalid = d(() => this.statusMachine.invalid.value), this.pending = d(() => this.statusMachine.pending.value), this.status = d(() => this.statusMachine.status.value), this.disabled = d(() => this.statusMachine.disabled.value), this.errors = d(() => this._errors.value), this.componentProps = d(() => this._componentProps.value), this.shouldShowError = d(
|
|
680
813
|
() => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
|
|
681
814
|
);
|
|
682
815
|
}
|
|
@@ -795,8 +928,8 @@ class ee extends C {
|
|
|
795
928
|
return;
|
|
796
929
|
}
|
|
797
930
|
this.pendingValidation = void 0;
|
|
798
|
-
const
|
|
799
|
-
i(
|
|
931
|
+
const a = await this.validateImmediate(s);
|
|
932
|
+
i(a);
|
|
800
933
|
}, t), s.signal.addEventListener(
|
|
801
934
|
"abort",
|
|
802
935
|
() => {
|
|
@@ -838,21 +971,21 @@ class ee extends C {
|
|
|
838
971
|
this.statusMachine.startValidation();
|
|
839
972
|
try {
|
|
840
973
|
const n = await Promise.all(
|
|
841
|
-
this.asyncValidators.map(async (
|
|
974
|
+
this.asyncValidators.map(async (u) => {
|
|
842
975
|
if (s.aborted)
|
|
843
976
|
throw new DOMException("Validation aborted", "AbortError");
|
|
844
977
|
try {
|
|
845
|
-
const
|
|
978
|
+
const l = await u(this._value.value, { signal: s });
|
|
846
979
|
if (s.aborted)
|
|
847
980
|
throw new DOMException("Validation aborted", "AbortError");
|
|
848
|
-
return
|
|
849
|
-
} catch (
|
|
850
|
-
if (
|
|
851
|
-
throw
|
|
852
|
-
return
|
|
853
|
-
|
|
981
|
+
return l;
|
|
982
|
+
} catch (l) {
|
|
983
|
+
if (l instanceof DOMException && l.name === "AbortError")
|
|
984
|
+
throw l;
|
|
985
|
+
return k.handle(
|
|
986
|
+
l,
|
|
854
987
|
"FieldNode AsyncValidator",
|
|
855
|
-
|
|
988
|
+
S.CONVERT
|
|
856
989
|
);
|
|
857
990
|
}
|
|
858
991
|
})
|
|
@@ -862,8 +995,8 @@ class ee extends C {
|
|
|
862
995
|
const o = n.filter(Boolean);
|
|
863
996
|
if (o.length > 0) {
|
|
864
997
|
this._errors.value = o;
|
|
865
|
-
const
|
|
866
|
-
if (this.statusMachine.completeValidation(
|
|
998
|
+
const u = o.some((l) => l.severity !== "warning");
|
|
999
|
+
if (this.statusMachine.completeValidation(u), u)
|
|
867
1000
|
return !1;
|
|
868
1001
|
}
|
|
869
1002
|
} catch (n) {
|
|
@@ -995,9 +1128,9 @@ class ee extends C {
|
|
|
995
1128
|
*/
|
|
996
1129
|
watch(e) {
|
|
997
1130
|
const t = new AbortController(), s = m(() => {
|
|
998
|
-
const
|
|
999
|
-
e(
|
|
1000
|
-
}), i =
|
|
1131
|
+
const a = this.value.value;
|
|
1132
|
+
e(a, t.signal);
|
|
1133
|
+
}), i = V(w.Watch);
|
|
1001
1134
|
return this.disposers.add(i, () => {
|
|
1002
1135
|
t.abort(), s();
|
|
1003
1136
|
});
|
|
@@ -1026,9 +1159,9 @@ class ee extends C {
|
|
|
1026
1159
|
*/
|
|
1027
1160
|
computeFrom(e, t) {
|
|
1028
1161
|
const s = m(() => {
|
|
1029
|
-
const
|
|
1162
|
+
const a = e.map((o) => o.value), n = t(...a);
|
|
1030
1163
|
this.setValue(n, { emitEvent: !1 });
|
|
1031
|
-
}), i =
|
|
1164
|
+
}), i = V(w.ComputeFrom);
|
|
1032
1165
|
return this.disposers.add(i, s);
|
|
1033
1166
|
}
|
|
1034
1167
|
/**
|
|
@@ -1059,138 +1192,73 @@ class ee extends C {
|
|
|
1059
1192
|
}
|
|
1060
1193
|
}
|
|
1061
1194
|
}
|
|
1062
|
-
|
|
1195
|
+
function X(r) {
|
|
1196
|
+
const e = r;
|
|
1197
|
+
return typeof e.getProxy == "function" ? e.getProxy() : r;
|
|
1198
|
+
}
|
|
1199
|
+
class Z {
|
|
1063
1200
|
form;
|
|
1064
1201
|
constructor(e) {
|
|
1065
1202
|
this.form = e;
|
|
1066
1203
|
}
|
|
1067
1204
|
/**
|
|
1068
|
-
* Применить валидаторы к полям
|
|
1069
|
-
*
|
|
1070
|
-
* Этапы применения:
|
|
1071
|
-
* 1. Разделение валидаторов на field и tree
|
|
1072
|
-
* 2. Применение field валидаторов (sync/async)
|
|
1073
|
-
* 3. Применение tree валидаторов (кросс-полевая валидация)
|
|
1074
|
-
*
|
|
1075
|
-
* @param validators Зарегистрированные валидаторы
|
|
1205
|
+
* Применить валидаторы к полям формы.
|
|
1076
1206
|
*/
|
|
1077
1207
|
async apply(e) {
|
|
1078
|
-
const
|
|
1079
|
-
await this.applyFieldValidators(t)
|
|
1208
|
+
const t = this.groupValidators(e);
|
|
1209
|
+
await this.applyFieldValidators(t);
|
|
1080
1210
|
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Группировка валидаторов по типам
|
|
1083
|
-
*
|
|
1084
|
-
* Разделяет валидаторы на:
|
|
1085
|
-
* - Field validators (sync/async) - группируются по fieldPath
|
|
1086
|
-
* - Tree validators - применяются ко всей форме
|
|
1087
|
-
*
|
|
1088
|
-
* @param validators Все зарегистрированные валидаторы
|
|
1089
|
-
* @returns Сгруппированные валидаторы
|
|
1090
|
-
*/
|
|
1091
1211
|
groupValidators(e) {
|
|
1092
|
-
const t = /* @__PURE__ */ new Map()
|
|
1093
|
-
for (const
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
return { validatorsByField: t, treeValidators: s };
|
|
1212
|
+
const t = /* @__PURE__ */ new Map();
|
|
1213
|
+
for (const s of e) {
|
|
1214
|
+
if (s.type === "array-items")
|
|
1215
|
+
continue;
|
|
1216
|
+
const i = t.get(s.fieldPath) || [];
|
|
1217
|
+
i.push(s), t.set(s.fieldPath, i);
|
|
1218
|
+
}
|
|
1219
|
+
return t;
|
|
1101
1220
|
}
|
|
1102
1221
|
/**
|
|
1103
|
-
* Применение
|
|
1104
|
-
*
|
|
1105
|
-
* Для каждого поля:
|
|
1106
|
-
* 1. Найти FieldNode по пути
|
|
1107
|
-
* 2. Проверить условия (condition)
|
|
1108
|
-
* 3. Выполнить sync/async валидаторы
|
|
1109
|
-
* 4. Установить ошибки на поле
|
|
1110
|
-
*
|
|
1111
|
-
* @param validatorsByField Валидаторы, сгруппированные по полям
|
|
1222
|
+
* Применение sync/async валидаторов к полям.
|
|
1112
1223
|
*/
|
|
1113
1224
|
async applyFieldValidators(e) {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1225
|
+
const t = this.form.getProxy();
|
|
1226
|
+
for (const [s, i] of e) {
|
|
1227
|
+
const a = this.form.getFieldByPath(s);
|
|
1228
|
+
if (!a) {
|
|
1229
|
+
console.warn(`Field ${s} not found in GroupNode`);
|
|
1118
1230
|
continue;
|
|
1119
1231
|
}
|
|
1120
|
-
if (!
|
|
1121
|
-
process.env.NODE_ENV !== "production" && console.warn(`Validation can only run on FieldNode or ArrayNode, skipping ${
|
|
1232
|
+
if (!q(a) && !M(a)) {
|
|
1233
|
+
process.env.NODE_ENV !== "production" && console.warn(`Validation can only run on FieldNode or ArrayNode, skipping ${s}`);
|
|
1122
1234
|
continue;
|
|
1123
1235
|
}
|
|
1124
|
-
const
|
|
1125
|
-
let
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
n = new J(this.form, t, i);
|
|
1131
|
-
for (const o of s)
|
|
1132
|
-
if (!(o.condition && !this.checkCondition(o.condition)))
|
|
1236
|
+
const n = [];
|
|
1237
|
+
let o;
|
|
1238
|
+
M(a) ? o = a.getValue() : o = a.value.value;
|
|
1239
|
+
const u = X(a);
|
|
1240
|
+
for (const l of i)
|
|
1241
|
+
if (!(l.condition && !this.checkCondition(l.condition)))
|
|
1133
1242
|
try {
|
|
1134
|
-
let
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
l = await v(u, n);
|
|
1243
|
+
let f = null;
|
|
1244
|
+
if (l.type === "sync") {
|
|
1245
|
+
const h = l.validator;
|
|
1246
|
+
f = h(o, u, t);
|
|
1247
|
+
} else if (l.type === "async") {
|
|
1248
|
+
const h = l.validator;
|
|
1249
|
+
f = await h(o, u, t);
|
|
1142
1250
|
}
|
|
1143
|
-
|
|
1144
|
-
} catch (
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
`ValidationApplicator: validator for ${
|
|
1148
|
-
|
|
1251
|
+
f && n.push(f);
|
|
1252
|
+
} catch (f) {
|
|
1253
|
+
k.handle(
|
|
1254
|
+
f,
|
|
1255
|
+
`ValidationApplicator: validator for ${s}`,
|
|
1256
|
+
S.LOG
|
|
1149
1257
|
);
|
|
1150
1258
|
}
|
|
1151
|
-
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
/**
|
|
1155
|
-
* Применение tree валидаторов (кросс-полевая валидация)
|
|
1156
|
-
*
|
|
1157
|
-
* Tree валидаторы имеют доступ ко всей форме через TreeValidationContext.
|
|
1158
|
-
* Ошибки устанавливаются на targetField (если указано).
|
|
1159
|
-
*
|
|
1160
|
-
* @param treeValidators Список tree валидаторов
|
|
1161
|
-
*/
|
|
1162
|
-
applyTreeValidators(e) {
|
|
1163
|
-
for (const t of e) {
|
|
1164
|
-
const s = new Y(this.form);
|
|
1165
|
-
if (!(t.condition && !this.checkCondition(t.condition)))
|
|
1166
|
-
try {
|
|
1167
|
-
if (t.type !== "tree")
|
|
1168
|
-
continue;
|
|
1169
|
-
const i = t.validator, r = i(s);
|
|
1170
|
-
if (r && t.options && "targetField" in t.options) {
|
|
1171
|
-
const n = t.options.targetField;
|
|
1172
|
-
if (n) {
|
|
1173
|
-
const o = this.form.getFieldByPath(String(n));
|
|
1174
|
-
if (o && M(o)) {
|
|
1175
|
-
const l = o.errors.value;
|
|
1176
|
-
o.setErrors([...l, r]);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
} catch (i) {
|
|
1181
|
-
S.handle(i, "ValidationApplicator: tree validator", V.LOG);
|
|
1182
|
-
}
|
|
1259
|
+
n.length > 0 ? a.setErrors(n) : a.errors.value.length > 0 && !a.errors.value.some((l) => l.code !== "contextual") && a.clearErrors();
|
|
1183
1260
|
}
|
|
1184
1261
|
}
|
|
1185
|
-
/**
|
|
1186
|
-
* Проверка условия (condition) для валидатора
|
|
1187
|
-
*
|
|
1188
|
-
* Условие определяет, должен ли валидатор выполняться.
|
|
1189
|
-
* Использует getFieldByPath для поддержки вложенных путей.
|
|
1190
|
-
*
|
|
1191
|
-
* @param condition Условие валидатора
|
|
1192
|
-
* @returns true, если условие выполнено
|
|
1193
|
-
*/
|
|
1194
1262
|
checkCondition(e) {
|
|
1195
1263
|
const t = this.form.getFieldByPath(e.fieldPath);
|
|
1196
1264
|
if (!t)
|
|
@@ -1199,7 +1267,7 @@ class te {
|
|
|
1199
1267
|
return e.conditionFn(s);
|
|
1200
1268
|
}
|
|
1201
1269
|
}
|
|
1202
|
-
class
|
|
1270
|
+
class ee {
|
|
1203
1271
|
/**
|
|
1204
1272
|
* Парсит путь в массив сегментов
|
|
1205
1273
|
*
|
|
@@ -1227,8 +1295,8 @@ class se {
|
|
|
1227
1295
|
parsePath(e) {
|
|
1228
1296
|
const t = [];
|
|
1229
1297
|
let s = "", i = !1;
|
|
1230
|
-
for (let
|
|
1231
|
-
const n = e[
|
|
1298
|
+
for (let a = 0; a < e.length; a++) {
|
|
1299
|
+
const n = e[a];
|
|
1232
1300
|
n === "[" ? (i = !0, s += n) : n === "]" ? (i = !1, s += n) : n === "." && !i ? s && (this.addSegment(t, s), s = "") : s += n;
|
|
1233
1301
|
}
|
|
1234
1302
|
return s && this.addSegment(t, s), t;
|
|
@@ -1278,11 +1346,11 @@ class se {
|
|
|
1278
1346
|
getValueByPath(e, t) {
|
|
1279
1347
|
const s = this.parsePath(t);
|
|
1280
1348
|
let i = e;
|
|
1281
|
-
for (const
|
|
1349
|
+
for (const a of s) {
|
|
1282
1350
|
if (i == null) return;
|
|
1283
|
-
if (i = i[
|
|
1351
|
+
if (i = i[a.key], a.index !== void 0) {
|
|
1284
1352
|
if (!Array.isArray(i)) return;
|
|
1285
|
-
i = i[
|
|
1353
|
+
i = i[a.index];
|
|
1286
1354
|
}
|
|
1287
1355
|
}
|
|
1288
1356
|
return i;
|
|
@@ -1318,27 +1386,27 @@ class se {
|
|
|
1318
1386
|
const i = this.parsePath(t);
|
|
1319
1387
|
if (i.length === 0)
|
|
1320
1388
|
throw new Error("Cannot set value: empty path");
|
|
1321
|
-
let
|
|
1389
|
+
let a = e;
|
|
1322
1390
|
for (let o = 0; o < i.length - 1; o++) {
|
|
1323
|
-
const
|
|
1324
|
-
let
|
|
1325
|
-
if (
|
|
1326
|
-
if (!Array.isArray(
|
|
1327
|
-
throw new Error(`Expected array at path segment: ${
|
|
1328
|
-
|
|
1391
|
+
const u = i[o];
|
|
1392
|
+
let l = a[u.key];
|
|
1393
|
+
if (u.index !== void 0) {
|
|
1394
|
+
if (!Array.isArray(l))
|
|
1395
|
+
throw new Error(`Expected array at path segment: ${u.key}, but got ${typeof l}`);
|
|
1396
|
+
a = l[u.index];
|
|
1329
1397
|
} else
|
|
1330
|
-
|
|
1398
|
+
l == null && (a[u.key] = {}, l = a[u.key]), a = l;
|
|
1331
1399
|
}
|
|
1332
1400
|
const n = i[i.length - 1];
|
|
1333
1401
|
if (n.index !== void 0) {
|
|
1334
|
-
const o =
|
|
1402
|
+
const o = a[n.key];
|
|
1335
1403
|
if (!Array.isArray(o))
|
|
1336
1404
|
throw new Error(
|
|
1337
1405
|
`Expected array at path segment: ${n.key}, but got ${typeof o}`
|
|
1338
1406
|
);
|
|
1339
1407
|
o[n.index] = s;
|
|
1340
1408
|
} else
|
|
1341
|
-
|
|
1409
|
+
a[n.key] = s;
|
|
1342
1410
|
}
|
|
1343
1411
|
/**
|
|
1344
1412
|
* Получить значение из FormNode по пути
|
|
@@ -1437,61 +1505,61 @@ class se {
|
|
|
1437
1505
|
getNodeByPath(e, t) {
|
|
1438
1506
|
const s = this.parsePath(t);
|
|
1439
1507
|
let i = e;
|
|
1440
|
-
for (const
|
|
1508
|
+
for (const a of s) {
|
|
1441
1509
|
if (i == null) return null;
|
|
1442
1510
|
const n = i;
|
|
1443
1511
|
if (n.fields && n.fields instanceof Map) {
|
|
1444
|
-
if (i = n.fields.get(
|
|
1512
|
+
if (i = n.fields.get(a.key), a.index === void 0) {
|
|
1445
1513
|
if (i == null) return null;
|
|
1446
1514
|
continue;
|
|
1447
1515
|
}
|
|
1448
|
-
} else if (
|
|
1516
|
+
} else if (a.index !== void 0 && n.items) {
|
|
1449
1517
|
const o = n.items.value || n.items;
|
|
1450
|
-
if (!Array.isArray(o) || (i = o[
|
|
1518
|
+
if (!Array.isArray(o) || (i = o[a.index], i == null)) return null;
|
|
1451
1519
|
continue;
|
|
1452
|
-
} else if (
|
|
1453
|
-
if (i = n[
|
|
1520
|
+
} else if (a.index === void 0) {
|
|
1521
|
+
if (i = n[a.key], i == null) return null;
|
|
1454
1522
|
continue;
|
|
1455
1523
|
}
|
|
1456
|
-
if (i &&
|
|
1524
|
+
if (i && a.index !== void 0 && i.items) {
|
|
1457
1525
|
const o = i.items.value || i.items;
|
|
1458
1526
|
if (!Array.isArray(o)) return null;
|
|
1459
|
-
i = o[
|
|
1460
|
-
} else if (i &&
|
|
1527
|
+
i = o[a.index];
|
|
1528
|
+
} else if (i && a.index !== void 0 && !i.items)
|
|
1461
1529
|
return null;
|
|
1462
1530
|
if (i == null) return null;
|
|
1463
1531
|
}
|
|
1464
1532
|
return i;
|
|
1465
1533
|
}
|
|
1466
1534
|
}
|
|
1467
|
-
function
|
|
1468
|
-
const { getChildren: e, ownErrors: t, disabled: s } =
|
|
1535
|
+
function U(r) {
|
|
1536
|
+
const { getChildren: e, ownErrors: t, disabled: s } = r, i = d(() => t.value.length > 0 ? !1 : e().every((h) => h.disabled.value || h.valid.value)), a = d(() => !i.value), n = d(() => e().some((h) => h.pending.value)), o = d(() => e().some((h) => h.touched.value)), u = d(() => e().some((h) => h.dirty.value)), l = d(() => {
|
|
1469
1537
|
const h = [...t.value];
|
|
1470
|
-
for (const
|
|
1471
|
-
h.push(...
|
|
1538
|
+
for (const v of e())
|
|
1539
|
+
h.push(...v.errors.value);
|
|
1472
1540
|
return h;
|
|
1473
|
-
}),
|
|
1541
|
+
}), f = d(() => s?.value ? "disabled" : n.value ? "pending" : a.value ? "invalid" : "valid");
|
|
1474
1542
|
return {
|
|
1475
1543
|
valid: i,
|
|
1476
|
-
invalid:
|
|
1544
|
+
invalid: a,
|
|
1477
1545
|
pending: n,
|
|
1478
1546
|
touched: o,
|
|
1479
|
-
dirty:
|
|
1480
|
-
errors:
|
|
1481
|
-
status:
|
|
1547
|
+
dirty: u,
|
|
1548
|
+
errors: l,
|
|
1549
|
+
status: f
|
|
1482
1550
|
};
|
|
1483
1551
|
}
|
|
1484
|
-
function
|
|
1485
|
-
return typeof
|
|
1552
|
+
function te(r) {
|
|
1553
|
+
return typeof r == "object" && r !== null && "getProxy" in r && typeof r.getProxy == "function";
|
|
1486
1554
|
}
|
|
1487
|
-
function
|
|
1488
|
-
return new Proxy(
|
|
1555
|
+
function se(r, e) {
|
|
1556
|
+
return new Proxy(r, {
|
|
1489
1557
|
get: (t, s) => {
|
|
1490
1558
|
if (s in t)
|
|
1491
1559
|
return t[s];
|
|
1492
1560
|
if (typeof s == "string" && e.has(s)) {
|
|
1493
1561
|
const i = e.get(s);
|
|
1494
|
-
return i &&
|
|
1562
|
+
return i && te(i) ? i.getProxy() : i;
|
|
1495
1563
|
}
|
|
1496
1564
|
},
|
|
1497
1565
|
set: (t, s, i) => typeof s == "string" && e.has(s) ? !1 : (t[s] = i, !0),
|
|
@@ -1503,7 +1571,7 @@ function re(a, e) {
|
|
|
1503
1571
|
getOwnPropertyDescriptor: (t, s) => typeof s == "string" && e.has(s) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, s)
|
|
1504
1572
|
});
|
|
1505
1573
|
}
|
|
1506
|
-
class
|
|
1574
|
+
class ie {
|
|
1507
1575
|
/**
|
|
1508
1576
|
* @param form - Форма для отправки
|
|
1509
1577
|
*/
|
|
@@ -1584,11 +1652,11 @@ class ae {
|
|
|
1584
1652
|
this._submitting.value = !0;
|
|
1585
1653
|
try {
|
|
1586
1654
|
return { success: !0, data: await e(this.form.getValue()) };
|
|
1587
|
-
} catch (
|
|
1655
|
+
} catch (a) {
|
|
1588
1656
|
return {
|
|
1589
1657
|
success: !1,
|
|
1590
1658
|
data: null,
|
|
1591
|
-
error:
|
|
1659
|
+
error: a instanceof Error ? a : new Error(String(a))
|
|
1592
1660
|
};
|
|
1593
1661
|
} finally {
|
|
1594
1662
|
this._submitting.value = !1;
|
|
@@ -1601,7 +1669,7 @@ class ae {
|
|
|
1601
1669
|
return this._submitting.value;
|
|
1602
1670
|
}
|
|
1603
1671
|
}
|
|
1604
|
-
class
|
|
1672
|
+
class A extends C {
|
|
1605
1673
|
// ============================================================================
|
|
1606
1674
|
// Приватные поля
|
|
1607
1675
|
// ============================================================================
|
|
@@ -1622,11 +1690,11 @@ class k extends C {
|
|
|
1622
1690
|
/**
|
|
1623
1691
|
* Навигатор для работы с путями к полям
|
|
1624
1692
|
*/
|
|
1625
|
-
pathNavigator = new
|
|
1693
|
+
pathNavigator = new ee();
|
|
1626
1694
|
/**
|
|
1627
1695
|
* Фабрика для создания узлов формы
|
|
1628
1696
|
*/
|
|
1629
|
-
nodeFactory = new
|
|
1697
|
+
nodeFactory = new re();
|
|
1630
1698
|
/**
|
|
1631
1699
|
* Реестр валидаторов для этой формы
|
|
1632
1700
|
* Может быть инжектирован через config._validationRegistry для тестирования
|
|
@@ -1640,7 +1708,7 @@ class k extends C {
|
|
|
1640
1708
|
/**
|
|
1641
1709
|
* Аппликатор для применения валидаторов к форме
|
|
1642
1710
|
*/
|
|
1643
|
-
validationApplicator = new
|
|
1711
|
+
validationApplicator = new Z(this);
|
|
1644
1712
|
// ============================================================================
|
|
1645
1713
|
// Приватные сигналы состояния (inline из StateManager)
|
|
1646
1714
|
// ============================================================================
|
|
@@ -1664,25 +1732,25 @@ class k extends C {
|
|
|
1664
1732
|
status;
|
|
1665
1733
|
submitting;
|
|
1666
1734
|
constructor(e) {
|
|
1667
|
-
super(), this.formSubmitter = new
|
|
1668
|
-
const t = "form" in e, s = t ? e : void 0, i = t ? e.form : e,
|
|
1735
|
+
super(), this.formSubmitter = new ie(this);
|
|
1736
|
+
const t = "form" in e, s = t ? e : void 0, i = t ? e.form : e, a = t ? e.behavior : void 0, n = t ? e.validation : void 0;
|
|
1669
1737
|
this.validationRegistry = s?._validationRegistry ?? new K(), this.behaviorRegistry = s?._behaviorRegistry ?? new H();
|
|
1670
|
-
for (const [
|
|
1671
|
-
const
|
|
1672
|
-
this._fields.set(
|
|
1738
|
+
for (const [u, l] of Object.entries(i)) {
|
|
1739
|
+
const f = this.createNode(l);
|
|
1740
|
+
this._fields.set(u, f);
|
|
1673
1741
|
}
|
|
1674
1742
|
this.value = d(() => {
|
|
1675
|
-
const
|
|
1676
|
-
return this._fields.forEach((
|
|
1677
|
-
|
|
1678
|
-
}),
|
|
1743
|
+
const u = {};
|
|
1744
|
+
return this._fields.forEach((l, f) => {
|
|
1745
|
+
u[f] = l.value.value;
|
|
1746
|
+
}), u;
|
|
1679
1747
|
});
|
|
1680
|
-
const o =
|
|
1748
|
+
const o = U({
|
|
1681
1749
|
getChildren: () => Array.from(this._fields.values()),
|
|
1682
1750
|
ownErrors: this._formErrors,
|
|
1683
1751
|
disabled: this._disabled
|
|
1684
1752
|
});
|
|
1685
|
-
this.valid = o.valid, this.invalid = o.invalid, this.pending = o.pending, this.touched = o.touched, this.dirty = o.dirty, this.errors = o.errors, this.status = o.status, this.submitting = this.formSubmitter.submitting,
|
|
1753
|
+
this.valid = o.valid, this.invalid = o.invalid, this.pending = o.pending, this.touched = o.touched, this.dirty = o.dirty, this.errors = o.errors, this.status = o.status, this.submitting = this.formSubmitter.submitting, a && this.applyBehaviorSchema(a), n && this.applyValidationSchema(n);
|
|
1686
1754
|
}
|
|
1687
1755
|
// ============================================================================
|
|
1688
1756
|
// Приватный метод для создания Proxy
|
|
@@ -1692,7 +1760,7 @@ class k extends C {
|
|
|
1692
1760
|
* @see buildFormProxy
|
|
1693
1761
|
*/
|
|
1694
1762
|
buildProxy() {
|
|
1695
|
-
return
|
|
1763
|
+
return se(this, this._fields);
|
|
1696
1764
|
}
|
|
1697
1765
|
// ============================================================================
|
|
1698
1766
|
// Реализация абстрактных методов FormNode
|
|
@@ -1705,8 +1773,8 @@ class k extends C {
|
|
|
1705
1773
|
}
|
|
1706
1774
|
setValue(e, t) {
|
|
1707
1775
|
for (const [s, i] of Object.entries(e)) {
|
|
1708
|
-
const
|
|
1709
|
-
|
|
1776
|
+
const a = this._fields.get(s);
|
|
1777
|
+
a && a.setValue(i, t);
|
|
1710
1778
|
}
|
|
1711
1779
|
}
|
|
1712
1780
|
patchValue(e) {
|
|
@@ -1861,7 +1929,7 @@ class k extends C {
|
|
|
1861
1929
|
applyValidationSchema(e) {
|
|
1862
1930
|
this.validationRegistry.beginRegistration();
|
|
1863
1931
|
try {
|
|
1864
|
-
const t =
|
|
1932
|
+
const t = N();
|
|
1865
1933
|
e(t);
|
|
1866
1934
|
const s = this.getProxy();
|
|
1867
1935
|
this.validationRegistry.endRegistration(s);
|
|
@@ -1876,7 +1944,7 @@ class k extends C {
|
|
|
1876
1944
|
applyBehaviorSchema(e) {
|
|
1877
1945
|
this.behaviorRegistry.beginRegistration();
|
|
1878
1946
|
try {
|
|
1879
|
-
const t =
|
|
1947
|
+
const t = N();
|
|
1880
1948
|
return e(t), this.behaviorRegistry.endRegistration(this.getProxy()).cleanup;
|
|
1881
1949
|
} catch (t) {
|
|
1882
1950
|
throw console.error("Error applying behavior schema:", t), t;
|
|
@@ -1919,12 +1987,12 @@ class k extends C {
|
|
|
1919
1987
|
return;
|
|
1920
1988
|
let s = this;
|
|
1921
1989
|
for (const i of t) {
|
|
1922
|
-
if (!(s instanceof
|
|
1990
|
+
if (!(s instanceof A) || (s = s.getField(i.key), !s)) return;
|
|
1923
1991
|
if (i.index !== void 0)
|
|
1924
1992
|
if ("at" in s && "length" in s && typeof s.at == "function") {
|
|
1925
|
-
const
|
|
1926
|
-
if (!
|
|
1927
|
-
s =
|
|
1993
|
+
const a = s.at(i.index);
|
|
1994
|
+
if (!a) return;
|
|
1995
|
+
s = a;
|
|
1928
1996
|
} else
|
|
1929
1997
|
return;
|
|
1930
1998
|
}
|
|
@@ -1973,15 +2041,15 @@ class k extends C {
|
|
|
1973
2041
|
* Связывает два поля: при изменении source автоматически обновляется target
|
|
1974
2042
|
*/
|
|
1975
2043
|
linkFields(e, t, s) {
|
|
1976
|
-
const i = this._fields.get(e),
|
|
1977
|
-
if (!i || !
|
|
1978
|
-
const
|
|
1979
|
-
throw new Error(`GroupNode.linkFields: field "${String(
|
|
2044
|
+
const i = this._fields.get(e), a = this._fields.get(t);
|
|
2045
|
+
if (!i || !a) {
|
|
2046
|
+
const u = i ? t : e;
|
|
2047
|
+
throw new Error(`GroupNode.linkFields: field "${String(u)}" not found`);
|
|
1980
2048
|
}
|
|
1981
2049
|
const n = m(() => {
|
|
1982
|
-
const
|
|
1983
|
-
|
|
1984
|
-
}), o =
|
|
2050
|
+
const u = i.value.value, l = s ? s(u) : u;
|
|
2051
|
+
a.setValue(l, { emitEvent: !1 });
|
|
2052
|
+
}), o = V(w.LinkFields);
|
|
1985
2053
|
return this.disposers.add(o, n);
|
|
1986
2054
|
}
|
|
1987
2055
|
/**
|
|
@@ -2018,8 +2086,8 @@ class k extends C {
|
|
|
2018
2086
|
const i = m(() => {
|
|
2019
2087
|
const n = s.value.value;
|
|
2020
2088
|
t(n);
|
|
2021
|
-
}),
|
|
2022
|
-
return this.disposers.add(
|
|
2089
|
+
}), a = V(w.WatchField);
|
|
2090
|
+
return this.disposers.add(a, i);
|
|
2023
2091
|
}
|
|
2024
2092
|
/**
|
|
2025
2093
|
* Hook: вызывается после disable()
|
|
@@ -2042,7 +2110,7 @@ class k extends C {
|
|
|
2042
2110
|
});
|
|
2043
2111
|
}
|
|
2044
2112
|
}
|
|
2045
|
-
class
|
|
2113
|
+
class I extends C {
|
|
2046
2114
|
// ============================================================================
|
|
2047
2115
|
// Приватные поля
|
|
2048
2116
|
// ============================================================================
|
|
@@ -2081,7 +2149,7 @@ class L extends C {
|
|
|
2081
2149
|
for (const i of t)
|
|
2082
2150
|
this.push(i);
|
|
2083
2151
|
this.length = d(() => this.items.value.length), this.value = d(() => this.items.value.map((i) => i.value.value));
|
|
2084
|
-
const s =
|
|
2152
|
+
const s = U({
|
|
2085
2153
|
getChildren: () => this.items.value,
|
|
2086
2154
|
ownErrors: this._arrayErrors
|
|
2087
2155
|
});
|
|
@@ -2107,12 +2175,12 @@ class L extends C {
|
|
|
2107
2175
|
*/
|
|
2108
2176
|
removeAt(e) {
|
|
2109
2177
|
if (e < 0 || e >= this.items.value.length) {
|
|
2110
|
-
|
|
2178
|
+
k.handle(
|
|
2111
2179
|
new Error(
|
|
2112
2180
|
`ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
|
|
2113
2181
|
),
|
|
2114
2182
|
"ArrayNode.removeAt",
|
|
2115
|
-
|
|
2183
|
+
S.LOG
|
|
2116
2184
|
);
|
|
2117
2185
|
return;
|
|
2118
2186
|
}
|
|
@@ -2126,12 +2194,12 @@ class L extends C {
|
|
|
2126
2194
|
*/
|
|
2127
2195
|
insert(e, t) {
|
|
2128
2196
|
if (e < 0 || e > this.items.value.length) {
|
|
2129
|
-
|
|
2197
|
+
k.handle(
|
|
2130
2198
|
new Error(
|
|
2131
2199
|
`ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
|
|
2132
2200
|
),
|
|
2133
2201
|
"ArrayNode.insert",
|
|
2134
|
-
|
|
2202
|
+
S.LOG
|
|
2135
2203
|
);
|
|
2136
2204
|
return;
|
|
2137
2205
|
}
|
|
@@ -2168,7 +2236,7 @@ class L extends C {
|
|
|
2168
2236
|
}
|
|
2169
2237
|
setValue(e, t) {
|
|
2170
2238
|
this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
|
|
2171
|
-
|
|
2239
|
+
k.handle(s, "ArrayNode.setValue", S.LOG);
|
|
2172
2240
|
});
|
|
2173
2241
|
}
|
|
2174
2242
|
patchValue(e) {
|
|
@@ -2326,7 +2394,7 @@ class L extends C {
|
|
|
2326
2394
|
*/
|
|
2327
2395
|
createItem(e) {
|
|
2328
2396
|
if (this.isGroupSchema(this.itemSchema)) {
|
|
2329
|
-
const t = new
|
|
2397
|
+
const t = new A(this.itemSchema);
|
|
2330
2398
|
return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
|
|
2331
2399
|
}
|
|
2332
2400
|
throw new Error(
|
|
@@ -2414,12 +2482,12 @@ class L extends C {
|
|
|
2414
2482
|
*/
|
|
2415
2483
|
watchItems(e, t) {
|
|
2416
2484
|
const s = m(() => {
|
|
2417
|
-
const
|
|
2418
|
-
if (n instanceof
|
|
2485
|
+
const a = this.items.value.map((n) => {
|
|
2486
|
+
if (n instanceof A)
|
|
2419
2487
|
return n.getFieldByPath(e)?.value.value;
|
|
2420
2488
|
});
|
|
2421
|
-
t(
|
|
2422
|
-
}), i =
|
|
2489
|
+
t(a);
|
|
2490
|
+
}), i = V(w.WatchItems);
|
|
2423
2491
|
return this.disposers.add(i, s);
|
|
2424
2492
|
}
|
|
2425
2493
|
/**
|
|
@@ -2448,7 +2516,7 @@ class L extends C {
|
|
|
2448
2516
|
const t = m(() => {
|
|
2449
2517
|
const i = this.length.value;
|
|
2450
2518
|
e(i);
|
|
2451
|
-
}), s =
|
|
2519
|
+
}), s = V(w.WatchLength);
|
|
2452
2520
|
return this.disposers.add(s, t);
|
|
2453
2521
|
}
|
|
2454
2522
|
/**
|
|
@@ -2512,7 +2580,7 @@ class L extends C {
|
|
|
2512
2580
|
});
|
|
2513
2581
|
}
|
|
2514
2582
|
}
|
|
2515
|
-
class
|
|
2583
|
+
class re {
|
|
2516
2584
|
/**
|
|
2517
2585
|
* Создает узел формы на основе конфигурации
|
|
2518
2586
|
*
|
|
@@ -2562,16 +2630,16 @@ class ne {
|
|
|
2562
2630
|
if (Array.isArray(e) && e.length >= 1)
|
|
2563
2631
|
return this.createArrayNodeFromArray(e);
|
|
2564
2632
|
if (this.isFieldConfig(e))
|
|
2565
|
-
return new
|
|
2633
|
+
return new Q(e);
|
|
2566
2634
|
if (this.isArrayConfig(e)) {
|
|
2567
2635
|
const t = e;
|
|
2568
|
-
return new
|
|
2636
|
+
return new I(
|
|
2569
2637
|
t.schema,
|
|
2570
2638
|
t.initialItems
|
|
2571
2639
|
);
|
|
2572
2640
|
}
|
|
2573
2641
|
if (this.isGroupConfig(e))
|
|
2574
|
-
return new
|
|
2642
|
+
return new A(e);
|
|
2575
2643
|
throw new Error(
|
|
2576
2644
|
`NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
|
|
2577
2645
|
e
|
|
@@ -2607,9 +2675,9 @@ class ne {
|
|
|
2607
2675
|
createArrayNodeFromArray(e) {
|
|
2608
2676
|
const [t, ...s] = e, i = [];
|
|
2609
2677
|
this.isGroupConfig(t) && i.push(this.extractValues(t));
|
|
2610
|
-
for (const
|
|
2611
|
-
this.isGroupConfig(
|
|
2612
|
-
return new
|
|
2678
|
+
for (const a of s)
|
|
2679
|
+
this.isGroupConfig(a) ? i.push(this.extractValues(a)) : i.push(a);
|
|
2680
|
+
return new I(t, i);
|
|
2613
2681
|
}
|
|
2614
2682
|
/**
|
|
2615
2683
|
* Извлечь значения из схемы (рекурсивно)
|
|
@@ -2728,10 +2796,10 @@ class ne {
|
|
|
2728
2796
|
return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
|
|
2729
2797
|
}
|
|
2730
2798
|
}
|
|
2731
|
-
function
|
|
2732
|
-
return new
|
|
2799
|
+
function ye(r) {
|
|
2800
|
+
return new A(r).getProxy();
|
|
2733
2801
|
}
|
|
2734
|
-
class
|
|
2802
|
+
class me {
|
|
2735
2803
|
/**
|
|
2736
2804
|
* @param form - Форма для наблюдения
|
|
2737
2805
|
* @param options - Опции observer
|
|
@@ -2875,7 +2943,7 @@ class be {
|
|
|
2875
2943
|
const s = [];
|
|
2876
2944
|
if (this.shouldTrack("value")) {
|
|
2877
2945
|
let i = t.value.value;
|
|
2878
|
-
const
|
|
2946
|
+
const a = m(() => {
|
|
2879
2947
|
const n = t.value.value;
|
|
2880
2948
|
n !== i && (this.emit({
|
|
2881
2949
|
type: "value",
|
|
@@ -2885,11 +2953,11 @@ class be {
|
|
|
2885
2953
|
newValue: n
|
|
2886
2954
|
}), i = n);
|
|
2887
2955
|
});
|
|
2888
|
-
s.push(
|
|
2956
|
+
s.push(a);
|
|
2889
2957
|
}
|
|
2890
2958
|
if (this.shouldTrack("status")) {
|
|
2891
2959
|
let i = t.status.value;
|
|
2892
|
-
const
|
|
2960
|
+
const a = m(() => {
|
|
2893
2961
|
const n = t.status.value;
|
|
2894
2962
|
n !== i && (this.emit({
|
|
2895
2963
|
type: "status",
|
|
@@ -2899,7 +2967,7 @@ class be {
|
|
|
2899
2967
|
newValue: n
|
|
2900
2968
|
}), i = n);
|
|
2901
2969
|
});
|
|
2902
|
-
s.push(
|
|
2970
|
+
s.push(a);
|
|
2903
2971
|
}
|
|
2904
2972
|
return () => s.forEach((i) => i());
|
|
2905
2973
|
}
|
|
@@ -2934,63 +3002,63 @@ class be {
|
|
|
2934
3002
|
this.disposers.forEach((e) => e()), this.disposers = [], this.listeners.clear();
|
|
2935
3003
|
}
|
|
2936
3004
|
}
|
|
2937
|
-
var x = { exports: {} },
|
|
2938
|
-
var
|
|
2939
|
-
function
|
|
2940
|
-
if (
|
|
2941
|
-
|
|
2942
|
-
var
|
|
2943
|
-
function e(h,
|
|
2944
|
-
return h ===
|
|
2945
|
-
}
|
|
2946
|
-
var t = typeof Object.is == "function" ? Object.is : e, s =
|
|
2947
|
-
function o(h,
|
|
2948
|
-
var c =
|
|
2949
|
-
return
|
|
3005
|
+
var x = { exports: {} }, P = {};
|
|
3006
|
+
var L;
|
|
3007
|
+
function ae() {
|
|
3008
|
+
if (L) return P;
|
|
3009
|
+
L = 1;
|
|
3010
|
+
var r = $;
|
|
3011
|
+
function e(h, v) {
|
|
3012
|
+
return h === v && (h !== 0 || 1 / h === 1 / v) || h !== h && v !== v;
|
|
3013
|
+
}
|
|
3014
|
+
var t = typeof Object.is == "function" ? Object.is : e, s = r.useState, i = r.useEffect, a = r.useLayoutEffect, n = r.useDebugValue;
|
|
3015
|
+
function o(h, v) {
|
|
3016
|
+
var c = v(), p = s({ inst: { value: c, getSnapshot: v } }), y = p[0].inst, E = p[1];
|
|
3017
|
+
return a(
|
|
2950
3018
|
function() {
|
|
2951
|
-
y.value = c, y.getSnapshot =
|
|
3019
|
+
y.value = c, y.getSnapshot = v, u(y) && E({ inst: y });
|
|
2952
3020
|
},
|
|
2953
|
-
[h, c,
|
|
3021
|
+
[h, c, v]
|
|
2954
3022
|
), i(
|
|
2955
3023
|
function() {
|
|
2956
|
-
return
|
|
2957
|
-
|
|
3024
|
+
return u(y) && E({ inst: y }), h(function() {
|
|
3025
|
+
u(y) && E({ inst: y });
|
|
2958
3026
|
});
|
|
2959
3027
|
},
|
|
2960
3028
|
[h]
|
|
2961
3029
|
), n(c), c;
|
|
2962
3030
|
}
|
|
2963
|
-
function
|
|
2964
|
-
var
|
|
3031
|
+
function u(h) {
|
|
3032
|
+
var v = h.getSnapshot;
|
|
2965
3033
|
h = h.value;
|
|
2966
3034
|
try {
|
|
2967
|
-
var c =
|
|
3035
|
+
var c = v();
|
|
2968
3036
|
return !t(h, c);
|
|
2969
3037
|
} catch {
|
|
2970
3038
|
return !0;
|
|
2971
3039
|
}
|
|
2972
3040
|
}
|
|
2973
|
-
function
|
|
2974
|
-
return
|
|
3041
|
+
function l(h, v) {
|
|
3042
|
+
return v();
|
|
2975
3043
|
}
|
|
2976
|
-
var
|
|
2977
|
-
return
|
|
3044
|
+
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l : o;
|
|
3045
|
+
return P.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : f, P;
|
|
2978
3046
|
}
|
|
2979
3047
|
var O = {};
|
|
2980
|
-
var
|
|
2981
|
-
function
|
|
2982
|
-
return
|
|
2983
|
-
function
|
|
3048
|
+
var B;
|
|
3049
|
+
function ne() {
|
|
3050
|
+
return B || (B = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
3051
|
+
function r(c, p) {
|
|
2984
3052
|
return c === p && (c !== 0 || 1 / c === 1 / p) || c !== c && p !== p;
|
|
2985
3053
|
}
|
|
2986
3054
|
function e(c, p) {
|
|
2987
|
-
|
|
3055
|
+
f || i.startTransition === void 0 || (f = !0, console.error(
|
|
2988
3056
|
"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."
|
|
2989
3057
|
));
|
|
2990
3058
|
var y = p();
|
|
2991
3059
|
if (!h) {
|
|
2992
3060
|
var E = p();
|
|
2993
|
-
|
|
3061
|
+
a(y, E) || (console.error(
|
|
2994
3062
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
2995
3063
|
), h = !0);
|
|
2996
3064
|
}
|
|
@@ -2998,7 +3066,7 @@ function le() {
|
|
|
2998
3066
|
inst: { value: y, getSnapshot: p }
|
|
2999
3067
|
});
|
|
3000
3068
|
var _ = E[0].inst, F = E[1];
|
|
3001
|
-
return
|
|
3069
|
+
return u(
|
|
3002
3070
|
function() {
|
|
3003
3071
|
_.value = y, _.getSnapshot = p, t(_) && F({ inst: _ });
|
|
3004
3072
|
},
|
|
@@ -3010,14 +3078,14 @@ function le() {
|
|
|
3010
3078
|
});
|
|
3011
3079
|
},
|
|
3012
3080
|
[c]
|
|
3013
|
-
),
|
|
3081
|
+
), l(y), y;
|
|
3014
3082
|
}
|
|
3015
3083
|
function t(c) {
|
|
3016
3084
|
var p = c.getSnapshot;
|
|
3017
3085
|
c = c.value;
|
|
3018
3086
|
try {
|
|
3019
3087
|
var y = p();
|
|
3020
|
-
return !
|
|
3088
|
+
return !a(c, y);
|
|
3021
3089
|
} catch {
|
|
3022
3090
|
return !0;
|
|
3023
3091
|
}
|
|
@@ -3026,36 +3094,36 @@ function le() {
|
|
|
3026
3094
|
return p();
|
|
3027
3095
|
}
|
|
3028
3096
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
3029
|
-
var i =
|
|
3030
|
-
O.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore :
|
|
3097
|
+
var i = $, a = typeof Object.is == "function" ? Object.is : r, n = i.useState, o = i.useEffect, u = i.useLayoutEffect, l = i.useDebugValue, f = !1, h = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
|
|
3098
|
+
O.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
3031
3099
|
})()), O;
|
|
3032
3100
|
}
|
|
3033
|
-
var
|
|
3034
|
-
function
|
|
3035
|
-
return
|
|
3101
|
+
var G;
|
|
3102
|
+
function oe() {
|
|
3103
|
+
return G || (G = 1, process.env.NODE_ENV === "production" ? x.exports = ae() : x.exports = ne()), x.exports;
|
|
3036
3104
|
}
|
|
3037
|
-
var R =
|
|
3038
|
-
function
|
|
3039
|
-
if (
|
|
3040
|
-
if (
|
|
3041
|
-
for (let t = 0; t <
|
|
3042
|
-
if (
|
|
3105
|
+
var R = oe();
|
|
3106
|
+
function le(r, e) {
|
|
3107
|
+
if (r === e) return !0;
|
|
3108
|
+
if (r.length !== e.length) return !1;
|
|
3109
|
+
for (let t = 0; t < r.length; t++)
|
|
3110
|
+
if (r[t] !== e[t]) return !1;
|
|
3043
3111
|
return !0;
|
|
3044
3112
|
}
|
|
3045
|
-
function
|
|
3046
|
-
const s =
|
|
3113
|
+
function W(r, e, t) {
|
|
3114
|
+
const s = T(null);
|
|
3047
3115
|
if (s.current === null) {
|
|
3048
3116
|
const n = {};
|
|
3049
|
-
for (const o in
|
|
3050
|
-
n[o] =
|
|
3117
|
+
for (const o in r)
|
|
3118
|
+
n[o] = r[o].value;
|
|
3051
3119
|
s.current = { ...n, __snapshot: null };
|
|
3052
3120
|
}
|
|
3053
3121
|
const i = b(
|
|
3054
3122
|
(n) => {
|
|
3055
3123
|
let o = !0;
|
|
3056
3124
|
return m(() => {
|
|
3057
|
-
for (const
|
|
3058
|
-
|
|
3125
|
+
for (const l in r)
|
|
3126
|
+
r[l].value;
|
|
3059
3127
|
if (o) {
|
|
3060
3128
|
o = !1;
|
|
3061
3129
|
return;
|
|
@@ -3063,43 +3131,43 @@ function q(a, e, t) {
|
|
|
3063
3131
|
n();
|
|
3064
3132
|
});
|
|
3065
3133
|
},
|
|
3066
|
-
[
|
|
3067
|
-
),
|
|
3134
|
+
[r]
|
|
3135
|
+
), a = b(() => {
|
|
3068
3136
|
const n = s.current, o = {};
|
|
3069
|
-
for (const
|
|
3070
|
-
o[
|
|
3071
|
-
let
|
|
3072
|
-
for (const
|
|
3073
|
-
const { key:
|
|
3137
|
+
for (const l in r)
|
|
3138
|
+
o[l] = r[l].value;
|
|
3139
|
+
let u = !1;
|
|
3140
|
+
for (const l of e) {
|
|
3141
|
+
const { key: f, useShallowArrayEqual: h } = l, v = o[f], c = n[f];
|
|
3074
3142
|
if (h) {
|
|
3075
|
-
if (!
|
|
3076
|
-
|
|
3143
|
+
if (!le(c, v)) {
|
|
3144
|
+
u = !0;
|
|
3077
3145
|
break;
|
|
3078
3146
|
}
|
|
3079
|
-
} else if (c !==
|
|
3080
|
-
|
|
3147
|
+
} else if (c !== v) {
|
|
3148
|
+
u = !0;
|
|
3081
3149
|
break;
|
|
3082
3150
|
}
|
|
3083
3151
|
}
|
|
3084
|
-
if (!
|
|
3152
|
+
if (!u && n.__snapshot)
|
|
3085
3153
|
return n.__snapshot;
|
|
3086
|
-
for (const
|
|
3087
|
-
n[
|
|
3154
|
+
for (const l in r)
|
|
3155
|
+
n[l] = o[l];
|
|
3088
3156
|
return n.__snapshot = t(o), n.__snapshot;
|
|
3089
|
-
}, [
|
|
3090
|
-
return R.useSyncExternalStore(i,
|
|
3157
|
+
}, [r, t]);
|
|
3158
|
+
return R.useSyncExternalStore(i, a, a);
|
|
3091
3159
|
}
|
|
3092
|
-
function
|
|
3160
|
+
function ue(r) {
|
|
3093
3161
|
const e = {
|
|
3094
|
-
value:
|
|
3095
|
-
disabled:
|
|
3096
|
-
errors:
|
|
3097
|
-
pending:
|
|
3098
|
-
valid:
|
|
3099
|
-
invalid:
|
|
3100
|
-
touched:
|
|
3101
|
-
shouldShowError:
|
|
3102
|
-
componentProps:
|
|
3162
|
+
value: r.value,
|
|
3163
|
+
disabled: r.disabled,
|
|
3164
|
+
errors: r.errors,
|
|
3165
|
+
pending: r.pending,
|
|
3166
|
+
valid: r.valid,
|
|
3167
|
+
invalid: r.invalid,
|
|
3168
|
+
touched: r.touched,
|
|
3169
|
+
shouldShowError: r.shouldShowError,
|
|
3170
|
+
componentProps: r.componentProps
|
|
3103
3171
|
}, t = [
|
|
3104
3172
|
{ key: "value" },
|
|
3105
3173
|
{ key: "disabled" },
|
|
@@ -3124,18 +3192,18 @@ function de(a) {
|
|
|
3124
3192
|
}),
|
|
3125
3193
|
[]
|
|
3126
3194
|
);
|
|
3127
|
-
return
|
|
3195
|
+
return W(e, t, s);
|
|
3128
3196
|
}
|
|
3129
|
-
function
|
|
3197
|
+
function he(r) {
|
|
3130
3198
|
const e = {
|
|
3131
|
-
value:
|
|
3132
|
-
length:
|
|
3133
|
-
errors:
|
|
3134
|
-
pending:
|
|
3135
|
-
valid:
|
|
3136
|
-
invalid:
|
|
3137
|
-
touched:
|
|
3138
|
-
dirty:
|
|
3199
|
+
value: r.value,
|
|
3200
|
+
length: r.length,
|
|
3201
|
+
errors: r.errors,
|
|
3202
|
+
pending: r.pending,
|
|
3203
|
+
valid: r.valid,
|
|
3204
|
+
invalid: r.invalid,
|
|
3205
|
+
touched: r.touched,
|
|
3206
|
+
dirty: r.dirty
|
|
3139
3207
|
}, t = [
|
|
3140
3208
|
{ key: "value" },
|
|
3141
3209
|
{ key: "length" },
|
|
@@ -3158,11 +3226,11 @@ function ce(a) {
|
|
|
3158
3226
|
}),
|
|
3159
3227
|
[]
|
|
3160
3228
|
);
|
|
3161
|
-
return
|
|
3229
|
+
return W(e, t, s);
|
|
3162
3230
|
}
|
|
3163
|
-
function
|
|
3164
|
-
const e =
|
|
3165
|
-
return
|
|
3231
|
+
function ge(r) {
|
|
3232
|
+
const e = r && "length" in r && "map" in r;
|
|
3233
|
+
return r ? e ? he(r) : ue(r) : {
|
|
3166
3234
|
value: [],
|
|
3167
3235
|
length: 0,
|
|
3168
3236
|
pending: !1,
|
|
@@ -3173,99 +3241,99 @@ function Ee(a) {
|
|
|
3173
3241
|
dirty: !1
|
|
3174
3242
|
};
|
|
3175
3243
|
}
|
|
3176
|
-
function
|
|
3177
|
-
const e =
|
|
3244
|
+
function be(r) {
|
|
3245
|
+
const e = T({ value: r.value.value }), t = b(
|
|
3178
3246
|
(i) => {
|
|
3179
|
-
let
|
|
3247
|
+
let a = !0;
|
|
3180
3248
|
return m(() => {
|
|
3181
|
-
if (
|
|
3182
|
-
|
|
3249
|
+
if (r.value.value, a) {
|
|
3250
|
+
a = !1;
|
|
3183
3251
|
return;
|
|
3184
3252
|
}
|
|
3185
3253
|
i();
|
|
3186
3254
|
});
|
|
3187
3255
|
},
|
|
3188
|
-
[
|
|
3256
|
+
[r]
|
|
3189
3257
|
), s = b(() => {
|
|
3190
|
-
const i =
|
|
3258
|
+
const i = r.value.value;
|
|
3191
3259
|
return e.current.value === i ? e.current.value : (e.current.value = i, i);
|
|
3192
|
-
}, [
|
|
3260
|
+
}, [r]);
|
|
3193
3261
|
return R.useSyncExternalStore(t, s, s);
|
|
3194
3262
|
}
|
|
3195
|
-
function
|
|
3196
|
-
const e =
|
|
3263
|
+
function Ee(r) {
|
|
3264
|
+
const e = T({ length: r.length.value }), t = b(
|
|
3197
3265
|
(i) => {
|
|
3198
|
-
let
|
|
3266
|
+
let a = !0;
|
|
3199
3267
|
return m(() => {
|
|
3200
|
-
if (
|
|
3201
|
-
|
|
3268
|
+
if (r.length.value, a) {
|
|
3269
|
+
a = !1;
|
|
3202
3270
|
return;
|
|
3203
3271
|
}
|
|
3204
3272
|
i();
|
|
3205
3273
|
});
|
|
3206
3274
|
},
|
|
3207
|
-
[
|
|
3275
|
+
[r]
|
|
3208
3276
|
), s = b(() => {
|
|
3209
|
-
const i =
|
|
3277
|
+
const i = r.length.value;
|
|
3210
3278
|
return e.current.length === i ? e.current.length : (e.current.length = i, i);
|
|
3211
|
-
}, [
|
|
3279
|
+
}, [r]);
|
|
3212
3280
|
return R.useSyncExternalStore(t, s, s);
|
|
3213
3281
|
}
|
|
3214
|
-
function
|
|
3282
|
+
function _e(r, e, t) {
|
|
3215
3283
|
const s = b(
|
|
3216
|
-
(
|
|
3284
|
+
(a) => {
|
|
3217
3285
|
const n = e, o = [];
|
|
3218
|
-
for (const
|
|
3219
|
-
const
|
|
3220
|
-
if (
|
|
3221
|
-
const
|
|
3222
|
-
o.push(
|
|
3286
|
+
for (const u of Object.keys(n)) {
|
|
3287
|
+
const l = n[u];
|
|
3288
|
+
if (l && typeof l == "object" && l.value && typeof l.value.subscribe == "function") {
|
|
3289
|
+
const f = l.value.subscribe(a);
|
|
3290
|
+
o.push(f);
|
|
3223
3291
|
}
|
|
3224
3292
|
}
|
|
3225
3293
|
return () => {
|
|
3226
|
-
o.forEach((
|
|
3294
|
+
o.forEach((u) => u());
|
|
3227
3295
|
};
|
|
3228
3296
|
},
|
|
3229
3297
|
[e]
|
|
3230
|
-
), i = b(() =>
|
|
3231
|
-
return
|
|
3298
|
+
), i = b(() => r ? r(e, t) : !1, [r, e, t]);
|
|
3299
|
+
return z(s, i, i);
|
|
3232
3300
|
}
|
|
3233
3301
|
export {
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3302
|
+
Oe as AbstractRegistry,
|
|
3303
|
+
I as ArrayNode,
|
|
3304
|
+
S as ErrorStrategy,
|
|
3305
|
+
Q as FieldNode,
|
|
3306
|
+
ee as FieldPathNavigator,
|
|
3307
|
+
k as FormErrorHandler,
|
|
3240
3308
|
C as FormNode,
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3309
|
+
me as FormObserver,
|
|
3310
|
+
Y as FormStatusMachine,
|
|
3311
|
+
ie as FormSubmitter,
|
|
3312
|
+
A as GroupNode,
|
|
3313
|
+
re as NodeFactory,
|
|
3314
|
+
Te as RegistryStack,
|
|
3247
3315
|
D as SubscriptionManager,
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3316
|
+
Be as behaviors,
|
|
3317
|
+
N as createFieldPath,
|
|
3318
|
+
ye as createForm,
|
|
3319
|
+
Me as extractKey,
|
|
3320
|
+
Ne as extractPath,
|
|
3321
|
+
Ce as getCurrentBehaviorRegistry,
|
|
3322
|
+
De as getCurrentValidationRegistry,
|
|
3323
|
+
Ve as getNodeType,
|
|
3324
|
+
M as isArrayNode,
|
|
3325
|
+
q as isFieldNode,
|
|
3326
|
+
Ae as isFormNode,
|
|
3327
|
+
ke as isGroupNode,
|
|
3328
|
+
$e as runOutsideEffect,
|
|
3329
|
+
Ue as safeCallback,
|
|
3330
|
+
We as safeDebouncedCallback,
|
|
3331
|
+
Ie as toFieldPath,
|
|
3332
|
+
V as uniqueId,
|
|
3333
|
+
Ee as useArrayLength,
|
|
3334
|
+
ge as useFormControl,
|
|
3335
|
+
be as useFormControlValue,
|
|
3336
|
+
_e as useHiddenCondition,
|
|
3337
|
+
xe as validateForm,
|
|
3338
|
+
Fe as validators
|
|
3271
3339
|
};
|