@reformer/core 1.1.0-beta.7 → 1.1.0-beta.8
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-BRaiR-UY.js +528 -0
- package/dist/behaviors.d.ts +6 -2
- package/dist/behaviors.js +18 -227
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3380 -10
- package/dist/validators-DjXtDVoE.js +455 -0
- package/dist/validators.d.ts +6 -2
- package/dist/validators.js +29 -281
- package/package.json +1 -1
- package/dist/core/behavior/behavior-applicator.js +0 -92
- package/dist/core/behavior/behavior-context.js +0 -43
- 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.js +0 -215
- package/dist/core/nodes/group-node/index.js +0 -11
- package/dist/core/nodes/group-node/proxy-builder.js +0 -161
- 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 -43
- 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/create-field-path-nXfTtl55.js +0 -283
- package/dist/hooks/useFormControl.js +0 -298
- package/dist/validation-context-cWXmh_Ho.js +0 -156
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { V as d } from "./registry-helpers-BfCZcMkO.js";
|
|
2
|
-
function g() {
|
|
3
|
-
return l("");
|
|
4
|
-
}
|
|
5
|
-
function l(t) {
|
|
6
|
-
return new Proxy({}, {
|
|
7
|
-
get(e, i) {
|
|
8
|
-
if (typeof i == "symbol")
|
|
9
|
-
return;
|
|
10
|
-
if (i === "__path")
|
|
11
|
-
return t || i;
|
|
12
|
-
if (i === "__key") {
|
|
13
|
-
const a = t.split(".");
|
|
14
|
-
return a[a.length - 1] || i;
|
|
15
|
-
}
|
|
16
|
-
if (i === "then" || i === "catch" || i === "finally" || i === "constructor" || i === "toString" || i === "valueOf" || i === "toJSON")
|
|
17
|
-
return;
|
|
18
|
-
const n = t ? `${t}.${i}` : i, o = {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
__key: i,
|
|
21
|
-
__path: n,
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
__formType: void 0,
|
|
24
|
-
__fieldType: void 0
|
|
25
|
-
};
|
|
26
|
-
return new Proxy(o, {
|
|
27
|
-
get(a, r) {
|
|
28
|
-
if (typeof r != "symbol") {
|
|
29
|
-
if (r === "__path") return n;
|
|
30
|
-
if (r === "__key") return i;
|
|
31
|
-
if (r !== "__formType" && r !== "__fieldType" && !(r === "then" || r === "catch" || r === "finally" || r === "constructor" || r === "toString" || r === "valueOf" || r === "toJSON"))
|
|
32
|
-
return l(`${n}.${r}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function m(t) {
|
|
40
|
-
if (typeof t == "string")
|
|
41
|
-
return t;
|
|
42
|
-
if (t && typeof t == "object") {
|
|
43
|
-
const e = t.__path;
|
|
44
|
-
if (typeof e == "string")
|
|
45
|
-
return e;
|
|
46
|
-
}
|
|
47
|
-
throw new Error("Invalid field path node: " + JSON.stringify(t));
|
|
48
|
-
}
|
|
49
|
-
function F(t) {
|
|
50
|
-
const e = m(t);
|
|
51
|
-
return l(e);
|
|
52
|
-
}
|
|
53
|
-
function V(t) {
|
|
54
|
-
if (t && typeof t == "object" && "__key" in t)
|
|
55
|
-
return t.__key;
|
|
56
|
-
if (typeof t == "string") {
|
|
57
|
-
const e = t.split(".");
|
|
58
|
-
return e[e.length - 1];
|
|
59
|
-
}
|
|
60
|
-
throw new Error("Invalid field path node");
|
|
61
|
-
}
|
|
62
|
-
function s(t) {
|
|
63
|
-
return t == null ? !1 : typeof t == "object" && "value" in t && "setValue" in t && "getValue" in t && "validate" in t;
|
|
64
|
-
}
|
|
65
|
-
function c(t) {
|
|
66
|
-
return t == null ? !1 : s(t) && "validators" in t && "asyncValidators" in t && // FieldNode имеет markAsTouched метод
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
-
typeof t.markAsTouched == "function" && // У FieldNode нет fields или items
|
|
69
|
-
!("fields" in t) && !("items" in t);
|
|
70
|
-
}
|
|
71
|
-
function u(t) {
|
|
72
|
-
return t == null ? !1 : s(t) && "applyValidationSchema" in t && "applyBehaviorSchema" in t && "getFieldByPath" in t && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode)
|
|
73
|
-
!("items" in t) && !("push" in t) && !("removeAt" in t);
|
|
74
|
-
}
|
|
75
|
-
function y(t) {
|
|
76
|
-
return t == null ? !1 : s(t) && "items" in t && "length" in t && "push" in t && "removeAt" in t && "at" in t && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
-
typeof t.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
-
typeof t.removeAt == "function";
|
|
79
|
-
}
|
|
80
|
-
function N(t) {
|
|
81
|
-
return c(t) ? "FieldNode" : u(t) ? "GroupNode" : y(t) ? "ArrayNode" : s(t) ? "FormNode" : "Unknown";
|
|
82
|
-
}
|
|
83
|
-
function f(t) {
|
|
84
|
-
return c(t) ? [t] : u(t) ? Array.from(t.getAllFields()).flatMap(f) : y(t) ? t.map((e) => f(e)).flat() : [];
|
|
85
|
-
}
|
|
86
|
-
async function w(t, e) {
|
|
87
|
-
const i = new d();
|
|
88
|
-
i.beginRegistration();
|
|
89
|
-
let n = [], o = !1;
|
|
90
|
-
try {
|
|
91
|
-
const a = g();
|
|
92
|
-
e(a), n = i.getCurrentContext()?.getValidators() || [], i.cancelRegistration(), o = !0, t.clearErrors();
|
|
93
|
-
const h = f(t);
|
|
94
|
-
return await Promise.all(h.map((_) => _.validate())), n.length > 0 && await t.applyContextualValidators(n), t.valid.value;
|
|
95
|
-
} catch (a) {
|
|
96
|
-
throw o || i.cancelRegistration(), a;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
class A {
|
|
100
|
-
_form;
|
|
101
|
-
control;
|
|
102
|
-
/**
|
|
103
|
-
* Форма с типизированным Proxy-доступом к полям
|
|
104
|
-
*/
|
|
105
|
-
form;
|
|
106
|
-
constructor(e, i, n) {
|
|
107
|
-
this._form = e, this.control = n, this.form = e._proxyInstance || e.getProxy();
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Получить текущее значение поля (внутренний метод для validation-applicator)
|
|
111
|
-
* @internal
|
|
112
|
-
*/
|
|
113
|
-
value() {
|
|
114
|
-
return this.control.value.value;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Безопасно установить значение поля по строковому пути
|
|
118
|
-
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
119
|
-
*/
|
|
120
|
-
setFieldValue(e, i) {
|
|
121
|
-
const n = this._form.getFieldByPath(e);
|
|
122
|
-
n && s(n) && n.setValue(i, { emitEvent: !1 });
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
class T {
|
|
126
|
-
_form;
|
|
127
|
-
/**
|
|
128
|
-
* Форма с типизированным Proxy-доступом к полям
|
|
129
|
-
*/
|
|
130
|
-
form;
|
|
131
|
-
constructor(e) {
|
|
132
|
-
this._form = e, this.form = e._proxyInstance || e.getProxy();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Безопасно установить значение поля по строковому пути
|
|
136
|
-
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
137
|
-
*/
|
|
138
|
-
setFieldValue(e, i) {
|
|
139
|
-
const n = this._form.getFieldByPath(e);
|
|
140
|
-
n && s(n) && n.setValue(i, { emitEvent: !1 });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
export {
|
|
144
|
-
T,
|
|
145
|
-
A as V,
|
|
146
|
-
s as a,
|
|
147
|
-
u as b,
|
|
148
|
-
g as c,
|
|
149
|
-
y as d,
|
|
150
|
-
m as e,
|
|
151
|
-
V as f,
|
|
152
|
-
N as g,
|
|
153
|
-
c as i,
|
|
154
|
-
F as t,
|
|
155
|
-
w as v
|
|
156
|
-
};
|