@reformer/core 1.1.0 → 2.0.0-beta.3
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.d.ts +6 -2
- package/dist/behaviors.js +19 -227
- package/dist/core/behavior/behavior-context.d.ts +6 -2
- package/dist/core/behavior/create-field-path.d.ts +3 -16
- package/dist/core/nodes/group-node.d.ts +14 -193
- package/dist/core/types/form-context.d.ts +10 -4
- package/dist/core/utils/field-path.d.ts +48 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/validation/core/validate-tree.d.ts +10 -4
- 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 +6 -1
- package/dist/index.js +2886 -8
- package/dist/{create-field-path-CdPF3lIK.js → registry-helpers-BRxAr6nG.js} +133 -347
- package/dist/validators-gXoHPdqM.js +418 -0
- package/dist/validators.d.ts +6 -2
- package/dist/validators.js +29 -296
- package/llms.txt +1283 -22
- package/package.json +8 -4
- package/dist/core/behavior/behavior-applicator.d.ts +0 -71
- package/dist/core/behavior/behavior-applicator.js +0 -92
- package/dist/core/behavior/behavior-context.js +0 -38
- package/dist/core/behavior/behavior-registry.js +0 -198
- package/dist/core/behavior/behaviors/compute-from.js +0 -84
- package/dist/core/behavior/behaviors/copy-from.js +0 -64
- package/dist/core/behavior/behaviors/enable-when.js +0 -81
- package/dist/core/behavior/behaviors/index.js +0 -11
- package/dist/core/behavior/behaviors/reset-when.js +0 -63
- package/dist/core/behavior/behaviors/revalidate-when.js +0 -51
- package/dist/core/behavior/behaviors/sync-fields.js +0 -66
- package/dist/core/behavior/behaviors/transform-value.js +0 -110
- package/dist/core/behavior/behaviors/watch-field.js +0 -56
- package/dist/core/behavior/compose-behavior.js +0 -166
- package/dist/core/behavior/create-field-path.js +0 -69
- package/dist/core/behavior/index.js +0 -17
- package/dist/core/behavior/types.js +0 -7
- package/dist/core/context/form-context-impl.js +0 -37
- package/dist/core/factories/index.js +0 -6
- package/dist/core/factories/node-factory.js +0 -281
- package/dist/core/nodes/array-node.js +0 -534
- package/dist/core/nodes/field-node.js +0 -510
- package/dist/core/nodes/form-node.js +0 -343
- package/dist/core/nodes/group-node/field-registry.d.ts +0 -191
- package/dist/core/nodes/group-node/field-registry.js +0 -215
- package/dist/core/nodes/group-node/index.d.ts +0 -11
- package/dist/core/nodes/group-node/index.js +0 -11
- package/dist/core/nodes/group-node/proxy-builder.d.ts +0 -71
- package/dist/core/nodes/group-node/proxy-builder.js +0 -161
- package/dist/core/nodes/group-node/state-manager.d.ts +0 -184
- package/dist/core/nodes/group-node/state-manager.js +0 -265
- package/dist/core/nodes/group-node.js +0 -770
- package/dist/core/types/deep-schema.js +0 -11
- package/dist/core/types/field-path.js +0 -4
- package/dist/core/types/form-context.js +0 -25
- package/dist/core/types/group-node-proxy.js +0 -31
- package/dist/core/types/index.js +0 -4
- package/dist/core/types/validation-schema.js +0 -10
- package/dist/core/utils/create-form.js +0 -24
- package/dist/core/utils/debounce.js +0 -197
- package/dist/core/utils/error-handler.js +0 -226
- package/dist/core/utils/field-path-navigator.js +0 -374
- package/dist/core/utils/index.js +0 -14
- package/dist/core/utils/registry-helpers.js +0 -79
- package/dist/core/utils/registry-stack.js +0 -86
- package/dist/core/utils/resources.js +0 -69
- package/dist/core/utils/subscription-manager.js +0 -214
- package/dist/core/utils/type-guards.js +0 -169
- package/dist/core/validation/core/apply-when.js +0 -41
- package/dist/core/validation/core/apply.js +0 -38
- package/dist/core/validation/core/index.js +0 -8
- package/dist/core/validation/core/validate-async.js +0 -45
- package/dist/core/validation/core/validate-tree.js +0 -37
- package/dist/core/validation/core/validate.js +0 -38
- package/dist/core/validation/field-path.js +0 -147
- package/dist/core/validation/index.js +0 -33
- package/dist/core/validation/validate-form.js +0 -152
- package/dist/core/validation/validation-applicator.js +0 -217
- package/dist/core/validation/validation-context.js +0 -75
- package/dist/core/validation/validation-registry.js +0 -298
- package/dist/core/validation/validators/array-validators.js +0 -86
- package/dist/core/validation/validators/date.js +0 -117
- package/dist/core/validation/validators/email.js +0 -60
- package/dist/core/validation/validators/index.js +0 -14
- package/dist/core/validation/validators/max-length.js +0 -60
- package/dist/core/validation/validators/max.js +0 -60
- package/dist/core/validation/validators/min-length.js +0 -60
- package/dist/core/validation/validators/min.js +0 -60
- package/dist/core/validation/validators/number.js +0 -90
- package/dist/core/validation/validators/pattern.js +0 -62
- package/dist/core/validation/validators/phone.js +0 -58
- package/dist/core/validation/validators/required.js +0 -69
- package/dist/core/validation/validators/url.js +0 -55
- package/dist/hooks/useFormControl.js +0 -298
- package/dist/node-factory-D7DOnSSN.js +0 -3200
|
@@ -0,0 +1,418 @@
|
|
|
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) {
|
|
3
|
+
if (!r) return;
|
|
4
|
+
const t = u(r);
|
|
5
|
+
c().registerSync(t, e, a);
|
|
6
|
+
}
|
|
7
|
+
function V(r, e, a) {
|
|
8
|
+
const t = u(r);
|
|
9
|
+
c().registerAsync(t, e, a);
|
|
10
|
+
}
|
|
11
|
+
function $(r, e) {
|
|
12
|
+
c().registerTree(r, e);
|
|
13
|
+
}
|
|
14
|
+
function b(r, e) {
|
|
15
|
+
if (!Array.isArray(r) && !Array.isArray(e) && r && !("__key" in r) && !("__path" in r)) {
|
|
16
|
+
e(r);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const a = (Array.isArray(r) ? r : [r]).filter(
|
|
20
|
+
Boolean
|
|
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);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function D(r, e, a) {
|
|
29
|
+
const t = u(r);
|
|
30
|
+
c().enterCondition(t, e);
|
|
31
|
+
try {
|
|
32
|
+
const n = o();
|
|
33
|
+
a(n);
|
|
34
|
+
} finally {
|
|
35
|
+
c().exitCondition();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function N(r, e) {
|
|
39
|
+
r && m(r, (a) => a == null || a === "" ? {
|
|
40
|
+
code: "required",
|
|
41
|
+
message: e?.message || "Поле обязательно для заполнения",
|
|
42
|
+
params: e?.params
|
|
43
|
+
} : typeof a == "boolean" && a !== !0 ? {
|
|
44
|
+
code: "required",
|
|
45
|
+
message: e?.message || "Поле обязательно для заполнения",
|
|
46
|
+
params: e?.params
|
|
47
|
+
} : null);
|
|
48
|
+
}
|
|
49
|
+
function P(r, e, a) {
|
|
50
|
+
r && m(r, (t) => t == null ? null : t < e ? {
|
|
51
|
+
code: "min",
|
|
52
|
+
message: a?.message || `Минимальное значение: ${e}`,
|
|
53
|
+
params: { min: e, actual: t, ...a?.params }
|
|
54
|
+
} : null);
|
|
55
|
+
}
|
|
56
|
+
function R(r, e, a) {
|
|
57
|
+
r && m(r, (t) => t == null ? null : t > e ? {
|
|
58
|
+
code: "max",
|
|
59
|
+
message: a?.message || `Максимальное значение: ${e}`,
|
|
60
|
+
params: { max: e, actual: t, ...a?.params }
|
|
61
|
+
} : null);
|
|
62
|
+
}
|
|
63
|
+
function x(r, e, a) {
|
|
64
|
+
r && m(r, (t) => t && t.length < e ? {
|
|
65
|
+
code: "minLength",
|
|
66
|
+
message: a?.message || `Минимальная длина: ${e} символов`,
|
|
67
|
+
params: { minLength: e, actualLength: t.length, ...a?.params }
|
|
68
|
+
} : null);
|
|
69
|
+
}
|
|
70
|
+
function F(r, e, a) {
|
|
71
|
+
r && m(r, (t) => t && t.length > e ? {
|
|
72
|
+
code: "maxLength",
|
|
73
|
+
message: a?.message || `Максимальная длина: ${e} символов`,
|
|
74
|
+
params: { maxLength: e, actualLength: t.length, ...a?.params }
|
|
75
|
+
} : null);
|
|
76
|
+
}
|
|
77
|
+
function C(r, e) {
|
|
78
|
+
if (!r) return;
|
|
79
|
+
const a = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
80
|
+
m(r, (t) => t ? a.test(t) ? null : {
|
|
81
|
+
code: "email",
|
|
82
|
+
message: e?.message || "Неверный формат email",
|
|
83
|
+
params: e?.params
|
|
84
|
+
} : null);
|
|
85
|
+
}
|
|
86
|
+
function L(r, e, a) {
|
|
87
|
+
r && m(r, (t) => t ? e.test(t) ? null : {
|
|
88
|
+
code: "pattern",
|
|
89
|
+
message: a?.message || "Значение не соответствует требуемому формату",
|
|
90
|
+
params: { pattern: e.source, ...a?.params }
|
|
91
|
+
} : null);
|
|
92
|
+
}
|
|
93
|
+
function T(r, e) {
|
|
94
|
+
if (!r) return;
|
|
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}://`)
|
|
98
|
+
) ? {
|
|
99
|
+
code: "url_protocol",
|
|
100
|
+
message: e?.message || `URL должен использовать один из протоколов: ${e.allowedProtocols.join(", ")}`,
|
|
101
|
+
params: { allowedProtocols: e.allowedProtocols, ...e?.params }
|
|
102
|
+
} : null : {
|
|
103
|
+
code: "url",
|
|
104
|
+
message: e?.message || "Неверный формат URL",
|
|
105
|
+
params: e?.params
|
|
106
|
+
} : null);
|
|
107
|
+
}
|
|
108
|
+
function I(r, e) {
|
|
109
|
+
if (!r) return;
|
|
110
|
+
const a = e?.format || "any", t = {
|
|
111
|
+
// Международный формат: +1234567890 или +1 234 567 8900
|
|
112
|
+
international: /^\+?[1-9]\d{1,14}$/,
|
|
113
|
+
// Российский формат: +7 (XXX) XXX-XX-XX, 8 (XXX) XXX-XX-XX, и вариации
|
|
114
|
+
ru: /^(\+7|7|8)?[\s\-]?\(?[489][0-9]{2}\)?[\s\-]?[0-9]{3}[\s\-]?[0-9]{2}[\s\-]?[0-9]{2}$/,
|
|
115
|
+
// US формат: (123) 456-7890, 123-456-7890, 1234567890
|
|
116
|
+
us: /^(\+?1)?[\s\-]?\(?[2-9]\d{2}\)?[\s\-]?\d{3}[\s\-]?\d{4}$/,
|
|
117
|
+
// Любой формат: минимум 10 цифр с возможными разделителями
|
|
118
|
+
any: /^[\+]?[(]?[0-9]{1,4}[)]?[-\s\.]?[(]?[0-9]{1,4}[)]?[-\s\.]?[0-9]{1,9}$/
|
|
119
|
+
};
|
|
120
|
+
m(r, (n) => {
|
|
121
|
+
if (!n)
|
|
122
|
+
return null;
|
|
123
|
+
if (!t[a].test(n)) {
|
|
124
|
+
const l = {
|
|
125
|
+
international: "Введите телефон в международном формате (например, +1234567890)",
|
|
126
|
+
ru: "Введите российский номер телефона (например, +7 900 123-45-67)",
|
|
127
|
+
us: "Введите американский номер телефона (например, (123) 456-7890)",
|
|
128
|
+
any: "Неверный формат телефона"
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
code: "phone",
|
|
132
|
+
message: e?.message || l[a],
|
|
133
|
+
params: { format: a, ...e?.params }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function q(r, e) {
|
|
140
|
+
r && m(r, (a) => a == null ? null : typeof a != "number" || isNaN(a) ? {
|
|
141
|
+
code: "number",
|
|
142
|
+
message: e?.message || "Значение должно быть числом",
|
|
143
|
+
params: e?.params
|
|
144
|
+
} : e?.integer && !Number.isInteger(a) ? {
|
|
145
|
+
code: "number_integer",
|
|
146
|
+
message: e?.message || "Значение должно быть целым числом",
|
|
147
|
+
params: e?.params
|
|
148
|
+
} : e?.min !== void 0 && a < e.min ? {
|
|
149
|
+
code: "number_min",
|
|
150
|
+
message: e?.message || `Значение должно быть не менее ${e.min}`,
|
|
151
|
+
params: { min: e.min, ...e?.params }
|
|
152
|
+
} : e?.max !== void 0 && a > e.max ? {
|
|
153
|
+
code: "number_max",
|
|
154
|
+
message: e?.message || `Значение должно быть не более ${e.max}`,
|
|
155
|
+
params: { max: e.max, ...e?.params }
|
|
156
|
+
} : e?.multipleOf !== void 0 && a % e.multipleOf !== 0 ? {
|
|
157
|
+
code: "number_multiple",
|
|
158
|
+
message: e?.message || `Значение должно быть кратно ${e.multipleOf}`,
|
|
159
|
+
params: { multipleOf: e.multipleOf, ...e?.params }
|
|
160
|
+
} : e?.allowNegative === !1 && a < 0 ? {
|
|
161
|
+
code: "number_negative",
|
|
162
|
+
message: e?.message || "Отрицательные числа не допускаются",
|
|
163
|
+
params: e?.params
|
|
164
|
+
} : e?.allowZero === !1 && a === 0 ? {
|
|
165
|
+
code: "number_zero",
|
|
166
|
+
message: e?.message || "Ноль не допускается",
|
|
167
|
+
params: e?.params
|
|
168
|
+
} : null);
|
|
169
|
+
}
|
|
170
|
+
function z(r, e) {
|
|
171
|
+
r && m(r, (a) => {
|
|
172
|
+
if (!a)
|
|
173
|
+
return null;
|
|
174
|
+
let t;
|
|
175
|
+
if (a instanceof Date)
|
|
176
|
+
t = a;
|
|
177
|
+
else if (typeof a == "string")
|
|
178
|
+
t = new Date(a);
|
|
179
|
+
else
|
|
180
|
+
return {
|
|
181
|
+
code: "date_invalid",
|
|
182
|
+
message: e?.message || "Неверный формат даты",
|
|
183
|
+
params: e?.params
|
|
184
|
+
};
|
|
185
|
+
if (isNaN(t.getTime()))
|
|
186
|
+
return {
|
|
187
|
+
code: "date_invalid",
|
|
188
|
+
message: e?.message || "Неверный формат даты",
|
|
189
|
+
params: e?.params
|
|
190
|
+
};
|
|
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)
|
|
195
|
+
return {
|
|
196
|
+
code: "date_min",
|
|
197
|
+
message: e?.message || `Дата должна быть не ранее ${s.toLocaleDateString()}`,
|
|
198
|
+
params: { minDate: e.minDate, ...e?.params }
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (e?.maxDate) {
|
|
202
|
+
const s = new Date(e.maxDate);
|
|
203
|
+
if (s.setHours(0, 0, 0, 0), t > s)
|
|
204
|
+
return {
|
|
205
|
+
code: "date_max",
|
|
206
|
+
message: e?.message || `Дата должна быть не позднее ${s.toLocaleDateString()}`,
|
|
207
|
+
params: { maxDate: e.maxDate, ...e?.params }
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (e?.noFuture && t > n)
|
|
211
|
+
return {
|
|
212
|
+
code: "date_future",
|
|
213
|
+
message: e?.message || "Дата не может быть в будущем",
|
|
214
|
+
params: e?.params
|
|
215
|
+
};
|
|
216
|
+
if (e?.noPast && t < n)
|
|
217
|
+
return {
|
|
218
|
+
code: "date_past",
|
|
219
|
+
message: e?.message || "Дата не может быть в прошлом",
|
|
220
|
+
params: e?.params
|
|
221
|
+
};
|
|
222
|
+
if (e?.minAge !== void 0 || e?.maxAge !== void 0) {
|
|
223
|
+
const s = Math.floor(
|
|
224
|
+
(n.getTime() - t.getTime()) / 315576e5
|
|
225
|
+
);
|
|
226
|
+
if (e?.minAge !== void 0 && s < e.minAge)
|
|
227
|
+
return {
|
|
228
|
+
code: "date_min_age",
|
|
229
|
+
message: e?.message || `Минимальный возраст: ${e.minAge} лет`,
|
|
230
|
+
params: { minAge: e.minAge, currentAge: s, ...e?.params }
|
|
231
|
+
};
|
|
232
|
+
if (e?.maxAge !== void 0 && s > e.maxAge)
|
|
233
|
+
return {
|
|
234
|
+
code: "date_max_age",
|
|
235
|
+
message: e?.message || `Максимальный возраст: ${e.maxAge} лет`,
|
|
236
|
+
params: { maxAge: e.maxAge, currentAge: s, ...e?.params }
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return null;
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function B(r, e) {
|
|
243
|
+
r && x(r, 1, {
|
|
244
|
+
message: e?.message || "Массив не должен быть пустым",
|
|
245
|
+
params: { minLength: 1, ...e?.params }
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function j(r, e) {
|
|
249
|
+
if (!r) return;
|
|
250
|
+
const a = u(r);
|
|
251
|
+
c().registerArrayItemValidation(a, e);
|
|
252
|
+
}
|
|
253
|
+
function i(r) {
|
|
254
|
+
return r == null ? !1 : typeof r == "object" && "value" in r && "setValue" in r && "getValue" in r && "validate" in r;
|
|
255
|
+
}
|
|
256
|
+
function h(r) {
|
|
257
|
+
return r == null ? !1 : i(r) && "validators" in r && "asyncValidators" in r && // FieldNode имеет markAsTouched метод
|
|
258
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
|
+
typeof r.markAsTouched == "function" && // У FieldNode нет fields или items
|
|
260
|
+
!("fields" in r) && !("items" in r);
|
|
261
|
+
}
|
|
262
|
+
function A(r) {
|
|
263
|
+
return r == null ? !1 : i(r) && "applyValidationSchema" in r && "applyBehaviorSchema" in r && "getFieldByPath" in r && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode)
|
|
264
|
+
!("items" in r) && !("push" in r) && !("removeAt" in r);
|
|
265
|
+
}
|
|
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
|
|
268
|
+
typeof r.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
269
|
+
typeof r.removeAt == "function";
|
|
270
|
+
}
|
|
271
|
+
function K(r) {
|
|
272
|
+
return h(r) ? "FieldNode" : A(r) ? "GroupNode" : _(r) ? "ArrayNode" : i(r) ? "FormNode" : "Unknown";
|
|
273
|
+
}
|
|
274
|
+
function g(r) {
|
|
275
|
+
return h(r) ? [r] : A(r) ? Array.from(r.getAllFields()).flatMap(g) : _(r) ? r.map((e) => g(e)).flat() : [];
|
|
276
|
+
}
|
|
277
|
+
async function E(r, e) {
|
|
278
|
+
const a = new y();
|
|
279
|
+
a.beginRegistration();
|
|
280
|
+
let t = [], n = !1;
|
|
281
|
+
try {
|
|
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;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
class k {
|
|
291
|
+
_form;
|
|
292
|
+
control;
|
|
293
|
+
/**
|
|
294
|
+
* Форма с типизированным Proxy-доступом к полям
|
|
295
|
+
*/
|
|
296
|
+
form;
|
|
297
|
+
constructor(e, a, t) {
|
|
298
|
+
this._form = e, this.control = t, this.form = e._proxyInstance || e.getProxy();
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Получить текущее значение поля (внутренний метод для validation-applicator)
|
|
302
|
+
* @internal
|
|
303
|
+
*/
|
|
304
|
+
value() {
|
|
305
|
+
return this.control.value.value;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Безопасно установить значение поля по строковому пути
|
|
309
|
+
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
310
|
+
*/
|
|
311
|
+
setFieldValue(e, a) {
|
|
312
|
+
const t = this._form.getFieldByPath(e);
|
|
313
|
+
t && i(t) && t.setValue(a, { emitEvent: !1 });
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
class M {
|
|
317
|
+
_form;
|
|
318
|
+
/**
|
|
319
|
+
* Форма с типизированным Proxy-доступом к полям
|
|
320
|
+
*/
|
|
321
|
+
form;
|
|
322
|
+
constructor(e) {
|
|
323
|
+
this._form = e, this.form = e._proxyInstance || e.getProxy();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Безопасно установить значение поля по строковому пути
|
|
327
|
+
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
328
|
+
*/
|
|
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 });
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
361
|
+
__proto__: null,
|
|
362
|
+
TreeValidationContextImpl: M,
|
|
363
|
+
ValidationContextImpl: k,
|
|
364
|
+
ValidationRegistry: y,
|
|
365
|
+
apply: b,
|
|
366
|
+
applyWhen: D,
|
|
367
|
+
createFieldPath: o,
|
|
368
|
+
date: z,
|
|
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,
|
|
383
|
+
validate: m,
|
|
384
|
+
validateAsync: V,
|
|
385
|
+
validateForm: E,
|
|
386
|
+
validateItems: j,
|
|
387
|
+
validateTree: $
|
|
388
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
389
|
+
export {
|
|
390
|
+
S as A,
|
|
391
|
+
M as T,
|
|
392
|
+
k as V,
|
|
393
|
+
_ as a,
|
|
394
|
+
U as b,
|
|
395
|
+
i as c,
|
|
396
|
+
A as d,
|
|
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,
|
|
411
|
+
I as s,
|
|
412
|
+
q as t,
|
|
413
|
+
T as u,
|
|
414
|
+
E as v,
|
|
415
|
+
z as w,
|
|
416
|
+
B as x,
|
|
417
|
+
j as y
|
|
418
|
+
};
|
package/dist/validators.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* Re-export validators from the main index to ensure single module instance.
|
|
3
|
+
* This prevents static registry isolation issues when consuming the library.
|
|
4
|
+
*/
|
|
5
|
+
export { validators as default } from './index';
|
|
6
|
+
export * from './core/validation';
|