@reformer/core 1.1.0-beta.8 → 2.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-DzYL8kY_.js +499 -0
- package/dist/behaviors.js +14 -14
- package/dist/core/behavior/create-field-path.d.ts +3 -16
- package/dist/core/nodes/group-node.d.ts +14 -193
- package/dist/core/utils/field-path.d.ts +48 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/validation/field-path.d.ts +3 -39
- package/dist/core/validation/validation-context.d.ts +23 -0
- package/dist/hooks/types.d.ts +328 -0
- package/dist/hooks/useFormControl.d.ts +13 -37
- package/dist/hooks/useFormControlValue.d.ts +167 -0
- package/dist/hooks/useSignalSubscription.d.ts +17 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +492 -986
- package/dist/{registry-helpers-BfCZcMkO.js → registry-helpers-BRxAr6nG.js} +136 -72
- package/dist/{validators-DjXtDVoE.js → validators-gXoHPdqM.js} +194 -231
- package/dist/validators.js +25 -25
- package/llms.txt +317 -172
- package/package.json +8 -4
- package/dist/behaviors-BRaiR-UY.js +0 -528
- package/dist/core/behavior/behavior-applicator.d.ts +0 -71
- package/dist/core/nodes/group-node/field-registry.d.ts +0 -191
- package/dist/core/nodes/group-node/index.d.ts +0 -11
- package/dist/core/nodes/group-node/proxy-builder.d.ts +0 -71
- package/dist/core/nodes/group-node/state-manager.d.ts +0 -184
|
@@ -1,160 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
return d("");
|
|
4
|
-
}
|
|
5
|
-
function d(r) {
|
|
6
|
-
return new Proxy({}, {
|
|
7
|
-
get(e, t) {
|
|
8
|
-
if (typeof t == "symbol")
|
|
9
|
-
return;
|
|
10
|
-
if (t === "__path")
|
|
11
|
-
return r || t;
|
|
12
|
-
if (t === "__key") {
|
|
13
|
-
const n = r.split(".");
|
|
14
|
-
return n[n.length - 1] || t;
|
|
15
|
-
}
|
|
16
|
-
if (t === "then" || t === "catch" || t === "finally" || t === "constructor" || t === "toString" || t === "valueOf" || t === "toJSON")
|
|
17
|
-
return;
|
|
18
|
-
const a = r ? `${r}.${t}` : t, s = {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
__key: t,
|
|
21
|
-
__path: a,
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
__formType: void 0,
|
|
24
|
-
__fieldType: void 0
|
|
25
|
-
};
|
|
26
|
-
return new Proxy(s, {
|
|
27
|
-
get(n, i) {
|
|
28
|
-
if (typeof i != "symbol") {
|
|
29
|
-
if (i === "__path") return a;
|
|
30
|
-
if (i === "__key") return t;
|
|
31
|
-
if (i !== "__formType" && i !== "__fieldType" && !(i === "then" || i === "catch" || i === "finally" || i === "constructor" || i === "toString" || i === "valueOf" || i === "toJSON"))
|
|
32
|
-
return d(`${a}.${i}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function f(r) {
|
|
40
|
-
if (typeof r == "string")
|
|
41
|
-
return r;
|
|
42
|
-
if (r && typeof r == "object") {
|
|
43
|
-
const e = r.__path;
|
|
44
|
-
if (typeof e == "string")
|
|
45
|
-
return e;
|
|
46
|
-
}
|
|
47
|
-
throw new Error("Invalid field path node: " + JSON.stringify(r));
|
|
48
|
-
}
|
|
49
|
-
function _(r) {
|
|
50
|
-
const e = f(r);
|
|
51
|
-
return d(e);
|
|
52
|
-
}
|
|
53
|
-
function N(r) {
|
|
54
|
-
if (r && typeof r == "object" && "__key" in r)
|
|
55
|
-
return r.__key;
|
|
56
|
-
if (typeof r == "string") {
|
|
57
|
-
const e = r.split(".");
|
|
58
|
-
return e[e.length - 1];
|
|
59
|
-
}
|
|
60
|
-
throw new Error("Invalid field path node");
|
|
61
|
-
}
|
|
62
|
-
function m(r, e, t) {
|
|
1
|
+
import { e as u, g as c, t as d, c as o, V as y, a as w } from "./registry-helpers-BRxAr6nG.js";
|
|
2
|
+
function m(r, e, a) {
|
|
63
3
|
if (!r) return;
|
|
64
|
-
const
|
|
65
|
-
|
|
4
|
+
const t = u(r);
|
|
5
|
+
c().registerSync(t, e, a);
|
|
66
6
|
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
|
|
7
|
+
function V(r, e, a) {
|
|
8
|
+
const t = u(r);
|
|
9
|
+
c().registerAsync(t, e, a);
|
|
70
10
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
11
|
+
function $(r, e) {
|
|
12
|
+
c().registerTree(r, e);
|
|
73
13
|
}
|
|
74
|
-
function
|
|
14
|
+
function b(r, e) {
|
|
75
15
|
if (!Array.isArray(r) && !Array.isArray(e) && r && !("__key" in r) && !("__path" in r)) {
|
|
76
16
|
e(r);
|
|
77
17
|
return;
|
|
78
18
|
}
|
|
79
|
-
const
|
|
19
|
+
const a = (Array.isArray(r) ? r : [r]).filter(
|
|
80
20
|
Boolean
|
|
81
|
-
),
|
|
82
|
-
for (const
|
|
83
|
-
const
|
|
84
|
-
for (const
|
|
85
|
-
|
|
21
|
+
), t = Array.isArray(e) ? e : [e];
|
|
22
|
+
for (const n of a) {
|
|
23
|
+
const s = d(n);
|
|
24
|
+
for (const l of t)
|
|
25
|
+
l(s);
|
|
86
26
|
}
|
|
87
27
|
}
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
|
|
28
|
+
function D(r, e, a) {
|
|
29
|
+
const t = u(r);
|
|
30
|
+
c().enterCondition(t, e);
|
|
91
31
|
try {
|
|
92
|
-
const
|
|
93
|
-
|
|
32
|
+
const n = o();
|
|
33
|
+
a(n);
|
|
94
34
|
} finally {
|
|
95
|
-
|
|
35
|
+
c().exitCondition();
|
|
96
36
|
}
|
|
97
37
|
}
|
|
98
|
-
function
|
|
99
|
-
r && m(r, (
|
|
38
|
+
function N(r, e) {
|
|
39
|
+
r && m(r, (a) => a == null || a === "" ? {
|
|
100
40
|
code: "required",
|
|
101
41
|
message: e?.message || "Поле обязательно для заполнения",
|
|
102
42
|
params: e?.params
|
|
103
|
-
} : typeof
|
|
43
|
+
} : typeof a == "boolean" && a !== !0 ? {
|
|
104
44
|
code: "required",
|
|
105
45
|
message: e?.message || "Поле обязательно для заполнения",
|
|
106
46
|
params: e?.params
|
|
107
47
|
} : null);
|
|
108
48
|
}
|
|
109
|
-
function
|
|
110
|
-
r && m(r, (
|
|
49
|
+
function P(r, e, a) {
|
|
50
|
+
r && m(r, (t) => t == null ? null : t < e ? {
|
|
111
51
|
code: "min",
|
|
112
|
-
message:
|
|
113
|
-
params: { min: e, actual:
|
|
52
|
+
message: a?.message || `Минимальное значение: ${e}`,
|
|
53
|
+
params: { min: e, actual: t, ...a?.params }
|
|
114
54
|
} : null);
|
|
115
55
|
}
|
|
116
|
-
function
|
|
117
|
-
r && m(r, (
|
|
56
|
+
function R(r, e, a) {
|
|
57
|
+
r && m(r, (t) => t == null ? null : t > e ? {
|
|
118
58
|
code: "max",
|
|
119
|
-
message:
|
|
120
|
-
params: { max: e, actual:
|
|
59
|
+
message: a?.message || `Максимальное значение: ${e}`,
|
|
60
|
+
params: { max: e, actual: t, ...a?.params }
|
|
121
61
|
} : null);
|
|
122
62
|
}
|
|
123
|
-
function
|
|
124
|
-
r && m(r, (
|
|
63
|
+
function x(r, e, a) {
|
|
64
|
+
r && m(r, (t) => t && t.length < e ? {
|
|
125
65
|
code: "minLength",
|
|
126
|
-
message:
|
|
127
|
-
params: { minLength: e, actualLength:
|
|
66
|
+
message: a?.message || `Минимальная длина: ${e} символов`,
|
|
67
|
+
params: { minLength: e, actualLength: t.length, ...a?.params }
|
|
128
68
|
} : null);
|
|
129
69
|
}
|
|
130
|
-
function
|
|
131
|
-
r && m(r, (
|
|
70
|
+
function F(r, e, a) {
|
|
71
|
+
r && m(r, (t) => t && t.length > e ? {
|
|
132
72
|
code: "maxLength",
|
|
133
|
-
message:
|
|
134
|
-
params: { maxLength: e, actualLength:
|
|
73
|
+
message: a?.message || `Максимальная длина: ${e} символов`,
|
|
74
|
+
params: { maxLength: e, actualLength: t.length, ...a?.params }
|
|
135
75
|
} : null);
|
|
136
76
|
}
|
|
137
|
-
function
|
|
77
|
+
function C(r, e) {
|
|
138
78
|
if (!r) return;
|
|
139
|
-
const
|
|
140
|
-
m(r, (
|
|
79
|
+
const a = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
80
|
+
m(r, (t) => t ? a.test(t) ? null : {
|
|
141
81
|
code: "email",
|
|
142
82
|
message: e?.message || "Неверный формат email",
|
|
143
83
|
params: e?.params
|
|
144
84
|
} : null);
|
|
145
85
|
}
|
|
146
|
-
function
|
|
147
|
-
r && m(r, (
|
|
86
|
+
function L(r, e, a) {
|
|
87
|
+
r && m(r, (t) => t ? e.test(t) ? null : {
|
|
148
88
|
code: "pattern",
|
|
149
|
-
message:
|
|
150
|
-
params: { pattern: e.source, ...
|
|
89
|
+
message: a?.message || "Значение не соответствует требуемому формату",
|
|
90
|
+
params: { pattern: e.source, ...a?.params }
|
|
151
91
|
} : null);
|
|
152
92
|
}
|
|
153
|
-
function
|
|
93
|
+
function T(r, e) {
|
|
154
94
|
if (!r) return;
|
|
155
|
-
const
|
|
156
|
-
m(r, (
|
|
157
|
-
(
|
|
95
|
+
const a = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/i, t = /^https?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/i;
|
|
96
|
+
m(r, (n) => n ? (e?.requireProtocol ? t : a).test(n) ? e?.allowedProtocols && e.allowedProtocols.length > 0 && !e.allowedProtocols.some(
|
|
97
|
+
(f) => n.toLowerCase().startsWith(`${f}://`)
|
|
158
98
|
) ? {
|
|
159
99
|
code: "url_protocol",
|
|
160
100
|
message: e?.message || `URL должен использовать один из протоколов: ${e.allowedProtocols.join(", ")}`,
|
|
@@ -165,9 +105,9 @@ function S(r, e) {
|
|
|
165
105
|
params: e?.params
|
|
166
106
|
} : null);
|
|
167
107
|
}
|
|
168
|
-
function
|
|
108
|
+
function I(r, e) {
|
|
169
109
|
if (!r) return;
|
|
170
|
-
const
|
|
110
|
+
const a = e?.format || "any", t = {
|
|
171
111
|
// Международный формат: +1234567890 или +1 234 567 8900
|
|
172
112
|
international: /^\+?[1-9]\d{1,14}$/,
|
|
173
113
|
// Российский формат: +7 (XXX) XXX-XX-XX, 8 (XXX) XXX-XX-XX, и вариации
|
|
@@ -177,11 +117,11 @@ function j(r, e) {
|
|
|
177
117
|
// Любой формат: минимум 10 цифр с возможными разделителями
|
|
178
118
|
any: /^[\+]?[(]?[0-9]{1,4}[)]?[-\s\.]?[(]?[0-9]{1,4}[)]?[-\s\.]?[0-9]{1,9}$/
|
|
179
119
|
};
|
|
180
|
-
m(r, (
|
|
181
|
-
if (!
|
|
120
|
+
m(r, (n) => {
|
|
121
|
+
if (!n)
|
|
182
122
|
return null;
|
|
183
|
-
if (!a
|
|
184
|
-
const
|
|
123
|
+
if (!t[a].test(n)) {
|
|
124
|
+
const l = {
|
|
185
125
|
international: "Введите телефон в международном формате (например, +1234567890)",
|
|
186
126
|
ru: "Введите российский номер телефона (например, +7 900 123-45-67)",
|
|
187
127
|
us: "Введите американский номер телефона (например, (123) 456-7890)",
|
|
@@ -189,173 +129,173 @@ function j(r, e) {
|
|
|
189
129
|
};
|
|
190
130
|
return {
|
|
191
131
|
code: "phone",
|
|
192
|
-
message: e?.message ||
|
|
193
|
-
params: { format:
|
|
132
|
+
message: e?.message || l[a],
|
|
133
|
+
params: { format: a, ...e?.params }
|
|
194
134
|
};
|
|
195
135
|
}
|
|
196
136
|
return null;
|
|
197
137
|
});
|
|
198
138
|
}
|
|
199
|
-
function
|
|
200
|
-
r && m(r, (
|
|
139
|
+
function q(r, e) {
|
|
140
|
+
r && m(r, (a) => a == null ? null : typeof a != "number" || isNaN(a) ? {
|
|
201
141
|
code: "number",
|
|
202
142
|
message: e?.message || "Значение должно быть числом",
|
|
203
143
|
params: e?.params
|
|
204
|
-
} : e?.integer && !Number.isInteger(
|
|
144
|
+
} : e?.integer && !Number.isInteger(a) ? {
|
|
205
145
|
code: "number_integer",
|
|
206
146
|
message: e?.message || "Значение должно быть целым числом",
|
|
207
147
|
params: e?.params
|
|
208
|
-
} : e?.min !== void 0 &&
|
|
148
|
+
} : e?.min !== void 0 && a < e.min ? {
|
|
209
149
|
code: "number_min",
|
|
210
150
|
message: e?.message || `Значение должно быть не менее ${e.min}`,
|
|
211
151
|
params: { min: e.min, ...e?.params }
|
|
212
|
-
} : e?.max !== void 0 &&
|
|
152
|
+
} : e?.max !== void 0 && a > e.max ? {
|
|
213
153
|
code: "number_max",
|
|
214
154
|
message: e?.message || `Значение должно быть не более ${e.max}`,
|
|
215
155
|
params: { max: e.max, ...e?.params }
|
|
216
|
-
} : e?.multipleOf !== void 0 &&
|
|
156
|
+
} : e?.multipleOf !== void 0 && a % e.multipleOf !== 0 ? {
|
|
217
157
|
code: "number_multiple",
|
|
218
158
|
message: e?.message || `Значение должно быть кратно ${e.multipleOf}`,
|
|
219
159
|
params: { multipleOf: e.multipleOf, ...e?.params }
|
|
220
|
-
} : e?.allowNegative === !1 &&
|
|
160
|
+
} : e?.allowNegative === !1 && a < 0 ? {
|
|
221
161
|
code: "number_negative",
|
|
222
162
|
message: e?.message || "Отрицательные числа не допускаются",
|
|
223
163
|
params: e?.params
|
|
224
|
-
} : e?.allowZero === !1 &&
|
|
164
|
+
} : e?.allowZero === !1 && a === 0 ? {
|
|
225
165
|
code: "number_zero",
|
|
226
166
|
message: e?.message || "Ноль не допускается",
|
|
227
167
|
params: e?.params
|
|
228
168
|
} : null);
|
|
229
169
|
}
|
|
230
170
|
function z(r, e) {
|
|
231
|
-
r && m(r, (
|
|
232
|
-
if (!
|
|
171
|
+
r && m(r, (a) => {
|
|
172
|
+
if (!a)
|
|
233
173
|
return null;
|
|
234
|
-
let
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
else if (typeof
|
|
238
|
-
|
|
174
|
+
let t;
|
|
175
|
+
if (a instanceof Date)
|
|
176
|
+
t = a;
|
|
177
|
+
else if (typeof a == "string")
|
|
178
|
+
t = new Date(a);
|
|
239
179
|
else
|
|
240
180
|
return {
|
|
241
181
|
code: "date_invalid",
|
|
242
182
|
message: e?.message || "Неверный формат даты",
|
|
243
183
|
params: e?.params
|
|
244
184
|
};
|
|
245
|
-
if (isNaN(
|
|
185
|
+
if (isNaN(t.getTime()))
|
|
246
186
|
return {
|
|
247
187
|
code: "date_invalid",
|
|
248
188
|
message: e?.message || "Неверный формат даты",
|
|
249
189
|
params: e?.params
|
|
250
190
|
};
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
191
|
+
const n = /* @__PURE__ */ new Date();
|
|
192
|
+
if (n.setHours(0, 0, 0, 0), e?.minDate) {
|
|
193
|
+
const s = new Date(e.minDate);
|
|
194
|
+
if (s.setHours(0, 0, 0, 0), t < s)
|
|
255
195
|
return {
|
|
256
196
|
code: "date_min",
|
|
257
|
-
message: e?.message || `Дата должна быть не ранее ${
|
|
197
|
+
message: e?.message || `Дата должна быть не ранее ${s.toLocaleDateString()}`,
|
|
258
198
|
params: { minDate: e.minDate, ...e?.params }
|
|
259
199
|
};
|
|
260
200
|
}
|
|
261
201
|
if (e?.maxDate) {
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
202
|
+
const s = new Date(e.maxDate);
|
|
203
|
+
if (s.setHours(0, 0, 0, 0), t > s)
|
|
264
204
|
return {
|
|
265
205
|
code: "date_max",
|
|
266
|
-
message: e?.message || `Дата должна быть не позднее ${
|
|
206
|
+
message: e?.message || `Дата должна быть не позднее ${s.toLocaleDateString()}`,
|
|
267
207
|
params: { maxDate: e.maxDate, ...e?.params }
|
|
268
208
|
};
|
|
269
209
|
}
|
|
270
|
-
if (e?.noFuture &&
|
|
210
|
+
if (e?.noFuture && t > n)
|
|
271
211
|
return {
|
|
272
212
|
code: "date_future",
|
|
273
213
|
message: e?.message || "Дата не может быть в будущем",
|
|
274
214
|
params: e?.params
|
|
275
215
|
};
|
|
276
|
-
if (e?.noPast &&
|
|
216
|
+
if (e?.noPast && t < n)
|
|
277
217
|
return {
|
|
278
218
|
code: "date_past",
|
|
279
219
|
message: e?.message || "Дата не может быть в прошлом",
|
|
280
220
|
params: e?.params
|
|
281
221
|
};
|
|
282
222
|
if (e?.minAge !== void 0 || e?.maxAge !== void 0) {
|
|
283
|
-
const
|
|
284
|
-
(
|
|
223
|
+
const s = Math.floor(
|
|
224
|
+
(n.getTime() - t.getTime()) / 315576e5
|
|
285
225
|
);
|
|
286
|
-
if (e?.minAge !== void 0 &&
|
|
226
|
+
if (e?.minAge !== void 0 && s < e.minAge)
|
|
287
227
|
return {
|
|
288
228
|
code: "date_min_age",
|
|
289
229
|
message: e?.message || `Минимальный возраст: ${e.minAge} лет`,
|
|
290
|
-
params: { minAge: e.minAge, currentAge:
|
|
230
|
+
params: { minAge: e.minAge, currentAge: s, ...e?.params }
|
|
291
231
|
};
|
|
292
|
-
if (e?.maxAge !== void 0 &&
|
|
232
|
+
if (e?.maxAge !== void 0 && s > e.maxAge)
|
|
293
233
|
return {
|
|
294
234
|
code: "date_max_age",
|
|
295
235
|
message: e?.message || `Максимальный возраст: ${e.maxAge} лет`,
|
|
296
|
-
params: { maxAge: e.maxAge, currentAge:
|
|
236
|
+
params: { maxAge: e.maxAge, currentAge: s, ...e?.params }
|
|
297
237
|
};
|
|
298
238
|
}
|
|
299
239
|
return null;
|
|
300
240
|
});
|
|
301
241
|
}
|
|
302
|
-
function
|
|
303
|
-
r &&
|
|
242
|
+
function B(r, e) {
|
|
243
|
+
r && x(r, 1, {
|
|
304
244
|
message: e?.message || "Массив не должен быть пустым",
|
|
305
245
|
params: { minLength: 1, ...e?.params }
|
|
306
246
|
});
|
|
307
247
|
}
|
|
308
|
-
function
|
|
248
|
+
function j(r, e) {
|
|
309
249
|
if (!r) return;
|
|
310
|
-
const
|
|
311
|
-
|
|
250
|
+
const a = u(r);
|
|
251
|
+
c().registerArrayItemValidation(a, e);
|
|
312
252
|
}
|
|
313
|
-
function
|
|
253
|
+
function i(r) {
|
|
314
254
|
return r == null ? !1 : typeof r == "object" && "value" in r && "setValue" in r && "getValue" in r && "validate" in r;
|
|
315
255
|
}
|
|
316
|
-
function
|
|
317
|
-
return r == null ? !1 :
|
|
256
|
+
function h(r) {
|
|
257
|
+
return r == null ? !1 : i(r) && "validators" in r && "asyncValidators" in r && // FieldNode имеет markAsTouched метод
|
|
318
258
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
319
259
|
typeof r.markAsTouched == "function" && // У FieldNode нет fields или items
|
|
320
260
|
!("fields" in r) && !("items" in r);
|
|
321
261
|
}
|
|
322
262
|
function A(r) {
|
|
323
|
-
return r == null ? !1 :
|
|
263
|
+
return r == null ? !1 : i(r) && "applyValidationSchema" in r && "applyBehaviorSchema" in r && "getFieldByPath" in r && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode)
|
|
324
264
|
!("items" in r) && !("push" in r) && !("removeAt" in r);
|
|
325
265
|
}
|
|
326
|
-
function
|
|
327
|
-
return r == null ? !1 :
|
|
266
|
+
function _(r) {
|
|
267
|
+
return r == null ? !1 : i(r) && "items" in r && "length" in r && "push" in r && "removeAt" in r && "at" in r && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
328
268
|
typeof r.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
329
269
|
typeof r.removeAt == "function";
|
|
330
270
|
}
|
|
331
|
-
function
|
|
332
|
-
return
|
|
271
|
+
function K(r) {
|
|
272
|
+
return h(r) ? "FieldNode" : A(r) ? "GroupNode" : _(r) ? "ArrayNode" : i(r) ? "FormNode" : "Unknown";
|
|
333
273
|
}
|
|
334
274
|
function g(r) {
|
|
335
|
-
return
|
|
275
|
+
return h(r) ? [r] : A(r) ? Array.from(r.getAllFields()).flatMap(g) : _(r) ? r.map((e) => g(e)).flat() : [];
|
|
336
276
|
}
|
|
337
277
|
async function E(r, e) {
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
let
|
|
278
|
+
const a = new y();
|
|
279
|
+
a.beginRegistration();
|
|
280
|
+
let t = [], n = !1;
|
|
341
281
|
try {
|
|
342
|
-
const
|
|
343
|
-
e(
|
|
344
|
-
const
|
|
345
|
-
return await Promise.all(
|
|
346
|
-
} catch (
|
|
347
|
-
throw
|
|
282
|
+
const s = o();
|
|
283
|
+
e(s), t = a.getCurrentContext()?.getValidators() || [], a.cancelRegistration(), n = !0, r.clearErrors();
|
|
284
|
+
const f = g(r);
|
|
285
|
+
return await Promise.all(f.map((p) => p.validate())), t.length > 0 && await r.applyContextualValidators(t), r.valid.value;
|
|
286
|
+
} catch (s) {
|
|
287
|
+
throw n || a.cancelRegistration(), s;
|
|
348
288
|
}
|
|
349
289
|
}
|
|
350
|
-
class
|
|
290
|
+
class k {
|
|
351
291
|
_form;
|
|
352
292
|
control;
|
|
353
293
|
/**
|
|
354
294
|
* Форма с типизированным Proxy-доступом к полям
|
|
355
295
|
*/
|
|
356
296
|
form;
|
|
357
|
-
constructor(e,
|
|
358
|
-
this._form = e, this.control =
|
|
297
|
+
constructor(e, a, t) {
|
|
298
|
+
this._form = e, this.control = t, this.form = e._proxyInstance || e.getProxy();
|
|
359
299
|
}
|
|
360
300
|
/**
|
|
361
301
|
* Получить текущее значение поля (внутренний метод для validation-applicator)
|
|
@@ -368,9 +308,9 @@ class O {
|
|
|
368
308
|
* Безопасно установить значение поля по строковому пути
|
|
369
309
|
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
370
310
|
*/
|
|
371
|
-
setFieldValue(e,
|
|
372
|
-
const
|
|
373
|
-
|
|
311
|
+
setFieldValue(e, a) {
|
|
312
|
+
const t = this._form.getFieldByPath(e);
|
|
313
|
+
t && i(t) && t.setValue(a, { emitEvent: !1 });
|
|
374
314
|
}
|
|
375
315
|
}
|
|
376
316
|
class M {
|
|
@@ -386,70 +326,93 @@ class M {
|
|
|
386
326
|
* Безопасно установить значение поля по строковому пути
|
|
387
327
|
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
388
328
|
*/
|
|
389
|
-
setFieldValue(e,
|
|
390
|
-
const
|
|
391
|
-
|
|
329
|
+
setFieldValue(e, a) {
|
|
330
|
+
const t = this._form.getFieldByPath(e);
|
|
331
|
+
t && i(t) && t.setValue(a, { emitEvent: !1 });
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
class S {
|
|
335
|
+
_form;
|
|
336
|
+
arrayValue;
|
|
337
|
+
/**
|
|
338
|
+
* Форма с типизированным Proxy-доступом к полям
|
|
339
|
+
*/
|
|
340
|
+
form;
|
|
341
|
+
constructor(e, a, t) {
|
|
342
|
+
this._form = e, this.arrayValue = t, this.form = e._proxyInstance || e.getProxy();
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Получить текущее значение массива (для валидатора)
|
|
346
|
+
* @internal
|
|
347
|
+
*/
|
|
348
|
+
value() {
|
|
349
|
+
return this.arrayValue;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Безопасно установить значение поля по строковому пути
|
|
353
|
+
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
354
|
+
*/
|
|
355
|
+
setFieldValue(e, a) {
|
|
356
|
+
const t = this._form.getFieldByPath(e);
|
|
357
|
+
t && i(t) && t.setValue(a, { emitEvent: !1 });
|
|
392
358
|
}
|
|
393
359
|
}
|
|
394
360
|
const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
395
361
|
__proto__: null,
|
|
396
362
|
TreeValidationContextImpl: M,
|
|
397
|
-
ValidationContextImpl:
|
|
363
|
+
ValidationContextImpl: k,
|
|
398
364
|
ValidationRegistry: y,
|
|
399
|
-
apply:
|
|
400
|
-
applyWhen:
|
|
365
|
+
apply: b,
|
|
366
|
+
applyWhen: D,
|
|
401
367
|
createFieldPath: o,
|
|
402
368
|
date: z,
|
|
403
|
-
email:
|
|
404
|
-
extractKey:
|
|
405
|
-
extractPath:
|
|
406
|
-
max:
|
|
407
|
-
maxLength:
|
|
408
|
-
min:
|
|
409
|
-
minLength:
|
|
410
|
-
notEmpty:
|
|
411
|
-
number:
|
|
412
|
-
pattern:
|
|
413
|
-
phone:
|
|
414
|
-
required:
|
|
415
|
-
toFieldPath:
|
|
416
|
-
url:
|
|
369
|
+
email: C,
|
|
370
|
+
extractKey: w,
|
|
371
|
+
extractPath: u,
|
|
372
|
+
max: R,
|
|
373
|
+
maxLength: F,
|
|
374
|
+
min: P,
|
|
375
|
+
minLength: x,
|
|
376
|
+
notEmpty: B,
|
|
377
|
+
number: q,
|
|
378
|
+
pattern: L,
|
|
379
|
+
phone: I,
|
|
380
|
+
required: N,
|
|
381
|
+
toFieldPath: d,
|
|
382
|
+
url: T,
|
|
417
383
|
validate: m,
|
|
418
|
-
validateAsync:
|
|
384
|
+
validateAsync: V,
|
|
419
385
|
validateForm: E,
|
|
420
|
-
validateItems:
|
|
421
|
-
validateTree:
|
|
386
|
+
validateItems: j,
|
|
387
|
+
validateTree: $
|
|
422
388
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
423
389
|
export {
|
|
424
|
-
|
|
425
|
-
N as B,
|
|
426
|
-
_ as C,
|
|
390
|
+
S as A,
|
|
427
391
|
M as T,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
392
|
+
k as V,
|
|
393
|
+
_ as a,
|
|
394
|
+
U as b,
|
|
395
|
+
i as c,
|
|
432
396
|
A as d,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
397
|
+
m as e,
|
|
398
|
+
V as f,
|
|
399
|
+
K as g,
|
|
400
|
+
$ as h,
|
|
401
|
+
h as i,
|
|
402
|
+
b as j,
|
|
403
|
+
D as k,
|
|
404
|
+
R as l,
|
|
405
|
+
P as m,
|
|
406
|
+
x as n,
|
|
407
|
+
F as o,
|
|
408
|
+
C as p,
|
|
409
|
+
L as q,
|
|
410
|
+
N as r,
|
|
447
411
|
I as s,
|
|
448
|
-
|
|
449
|
-
|
|
412
|
+
q as t,
|
|
413
|
+
T as u,
|
|
450
414
|
E as v,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
B as z
|
|
415
|
+
z as w,
|
|
416
|
+
B as x,
|
|
417
|
+
j as y
|
|
455
418
|
};
|