@reformer/core 5.0.2 → 7.0.0-beta.1

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.
Files changed (131) hide show
  1. package/README.md +7 -5
  2. package/dist/behaviors-O9a1Djj9.js +147 -0
  3. package/dist/behaviors.d.ts +131 -4
  4. package/dist/behaviors.js +298 -27
  5. package/dist/core/model/behaviors.d.ts +123 -0
  6. package/dist/core/model/form-model.d.ts +18 -0
  7. package/dist/core/model/index.d.ts +12 -0
  8. package/dist/core/model/types.d.ts +112 -0
  9. package/dist/core/model/validate-model.d.ts +46 -0
  10. package/dist/core/nodes/array-node.d.ts +34 -2
  11. package/dist/core/nodes/group-node.d.ts +19 -71
  12. package/dist/core/nodes/model-array-node.d.ts +71 -0
  13. package/dist/core/types/deep-schema.d.ts +16 -2
  14. package/dist/core/types/form-proxy.d.ts +17 -6
  15. package/dist/core/types/index.d.ts +5 -23
  16. package/dist/core/types/validation-schema.d.ts +15 -66
  17. package/dist/core/utils/create-form.d.ts +24 -0
  18. package/dist/core/utils/derived-registry.d.ts +5 -0
  19. package/dist/core/utils/index.d.ts +4 -4
  20. package/dist/core/utils/signal-node-registry.d.ts +12 -0
  21. package/dist/core/utils/type-guards.d.ts +2 -3
  22. package/dist/core/validation/index.d.ts +5 -11
  23. package/dist/core/validation/validators/email.d.ts +5 -29
  24. package/dist/core/validation/validators/future-date.d.ts +6 -28
  25. package/dist/core/validation/validators/index.d.ts +11 -4
  26. package/dist/core/validation/validators/integer.d.ts +13 -0
  27. package/dist/core/validation/validators/is-date.d.ts +5 -28
  28. package/dist/core/validation/validators/is-number.d.ts +14 -0
  29. package/dist/core/validation/validators/max-age.d.ts +6 -29
  30. package/dist/core/validation/validators/max-date.d.ts +6 -29
  31. package/dist/core/validation/validators/max-length.d.ts +5 -30
  32. package/dist/core/validation/validators/max.d.ts +7 -29
  33. package/dist/core/validation/validators/min-age.d.ts +6 -29
  34. package/dist/core/validation/validators/min-date.d.ts +6 -29
  35. package/dist/core/validation/validators/min-length.d.ts +5 -30
  36. package/dist/core/validation/validators/min.d.ts +7 -29
  37. package/dist/core/validation/validators/multiple-of.d.ts +13 -0
  38. package/dist/core/validation/validators/non-negative.d.ts +13 -0
  39. package/dist/core/validation/validators/non-zero.d.ts +13 -0
  40. package/dist/core/validation/validators/past-date.d.ts +5 -28
  41. package/dist/core/validation/validators/pattern.d.ts +5 -32
  42. package/dist/core/validation/validators/phone.d.ts +9 -19
  43. package/dist/core/validation/validators/required.d.ts +10 -31
  44. package/dist/core/validation/validators/url.d.ts +13 -15
  45. package/dist/index.d.ts +3 -4
  46. package/dist/index.js +1299 -875
  47. package/dist/validators/email.js +7 -9
  48. package/dist/validators/future-date.js +11 -12
  49. package/dist/validators/integer.d.ts +2 -0
  50. package/dist/validators/integer.js +10 -0
  51. package/dist/validators/is-date.js +6 -7
  52. package/dist/validators/is-number.d.ts +2 -0
  53. package/dist/validators/is-number.js +10 -0
  54. package/dist/validators/max-age.js +11 -12
  55. package/dist/validators/max-date.js +11 -12
  56. package/dist/validators/max-length.js +12 -8
  57. package/dist/validators/max.js +5 -6
  58. package/dist/validators/min-age.js +10 -11
  59. package/dist/validators/min-date.js +12 -13
  60. package/dist/validators/min-length.js +12 -8
  61. package/dist/validators/min.js +6 -7
  62. package/dist/validators/multiple-of.d.ts +2 -0
  63. package/dist/validators/multiple-of.js +10 -0
  64. package/dist/validators/non-negative.d.ts +2 -0
  65. package/dist/validators/non-negative.js +10 -0
  66. package/dist/validators/non-zero.d.ts +2 -0
  67. package/dist/validators/non-zero.js +10 -0
  68. package/dist/validators/past-date.js +11 -12
  69. package/dist/validators/pattern.js +6 -7
  70. package/dist/validators/phone.js +14 -32
  71. package/dist/validators/required.js +9 -10
  72. package/dist/validators/url.js +19 -16
  73. package/dist/validators.js +67 -54
  74. package/llms.txt +959 -2584
  75. package/package.json +19 -35
  76. package/dist/behaviors/compute-from.d.ts +0 -2
  77. package/dist/behaviors/compute-from.js +0 -31
  78. package/dist/behaviors/copy-from.d.ts +0 -2
  79. package/dist/behaviors/copy-from.js +0 -29
  80. package/dist/behaviors/enable-when.d.ts +0 -2
  81. package/dist/behaviors/enable-when.js +0 -25
  82. package/dist/behaviors/reset-when.d.ts +0 -2
  83. package/dist/behaviors/reset-when.js +0 -24
  84. package/dist/behaviors/revalidate-when.d.ts +0 -2
  85. package/dist/behaviors/revalidate-when.js +0 -18
  86. package/dist/behaviors/sync-fields.d.ts +0 -2
  87. package/dist/behaviors/sync-fields.js +0 -41
  88. package/dist/behaviors/transform-value.d.ts +0 -2
  89. package/dist/behaviors/transform-value.js +0 -45
  90. package/dist/behaviors/watch-field.d.ts +0 -2
  91. package/dist/behaviors/watch-field.js +0 -21
  92. package/dist/core/behavior/behavior-context.d.ts +0 -47
  93. package/dist/core/behavior/behavior-registry.d.ts +0 -85
  94. package/dist/core/behavior/behaviors/compute-from.d.ts +0 -70
  95. package/dist/core/behavior/behaviors/copy-from.d.ts +0 -56
  96. package/dist/core/behavior/behaviors/enable-when.d.ts +0 -118
  97. package/dist/core/behavior/behaviors/index.d.ts +0 -11
  98. package/dist/core/behavior/behaviors/reset-when.d.ts +0 -64
  99. package/dist/core/behavior/behaviors/revalidate-when.d.ts +0 -53
  100. package/dist/core/behavior/behaviors/sync-fields.d.ts +0 -48
  101. package/dist/core/behavior/behaviors/transform-value.d.ts +0 -192
  102. package/dist/core/behavior/behaviors/watch-field.d.ts +0 -80
  103. package/dist/core/behavior/compose-behavior.d.ts +0 -96
  104. package/dist/core/behavior/index.d.ts +0 -11
  105. package/dist/core/behavior/types.d.ts +0 -146
  106. package/dist/core/types/field-path.d.ts +0 -42
  107. package/dist/core/types/form-context.d.ts +0 -89
  108. package/dist/core/utils/field-path-navigator.d.ts +0 -240
  109. package/dist/core/utils/field-path.d.ts +0 -60
  110. package/dist/core/utils/registry-helpers.d.ts +0 -43
  111. package/dist/core/validation/core/apply-when.d.ts +0 -22
  112. package/dist/core/validation/core/apply.d.ts +0 -52
  113. package/dist/core/validation/core/index.d.ts +0 -8
  114. package/dist/core/validation/core/validate-async.d.ts +0 -36
  115. package/dist/core/validation/core/validate-tree.d.ts +0 -35
  116. package/dist/core/validation/core/validate.d.ts +0 -26
  117. package/dist/core/validation/validate-form.d.ts +0 -48
  118. package/dist/core/validation/validation-applicator.d.ts +0 -70
  119. package/dist/core/validation/validation-context.d.ts +0 -86
  120. package/dist/core/validation/validation-registry.d.ts +0 -142
  121. package/dist/core/validation/validators/array-validators.d.ts +0 -53
  122. package/dist/core/validation/validators/number.d.ts +0 -31
  123. package/dist/field-path-DuKdGcIE.js +0 -66
  124. package/dist/hooks/useHiddenCondition.d.ts +0 -25
  125. package/dist/index-D25LsbRm.js +0 -73
  126. package/dist/registry-helpers-Bv_BJ1s-.js +0 -615
  127. package/dist/safe-effect-Dh8uw81c.js +0 -20
  128. package/dist/validate-C3XiA_zf.js +0 -10
  129. package/dist/validators/number.d.ts +0 -2
  130. package/dist/validators/number.js +0 -35
  131. package/dist/validators-BGsNOgT1.js +0 -207
@@ -1,20 +0,0 @@
1
- function a(e) {
2
- return (...u) => {
3
- queueMicrotask(() => e(...u));
4
- };
5
- }
6
- function t(e) {
7
- queueMicrotask(e);
8
- }
9
- function c(e, u) {
10
- return () => {
11
- u(() => {
12
- queueMicrotask(e);
13
- });
14
- };
15
- }
16
- export {
17
- c as a,
18
- t as r,
19
- a as s
20
- };
@@ -1,10 +0,0 @@
1
- import { e as i } from "./field-path-DuKdGcIE.js";
2
- import { g as o } from "./registry-helpers-Bv_BJ1s-.js";
3
- function c(t, r, a) {
4
- if (!t) return;
5
- const e = i(t);
6
- o().registerSync(e, r, a);
7
- }
8
- export {
9
- c as v
10
- };
@@ -1,2 +0,0 @@
1
- export * from '../core/validation/validators/number'
2
- export {}
@@ -1,35 +0,0 @@
1
- import { v as a } from "../validate-C3XiA_zf.js";
2
- function g(r, e) {
3
- r && a(r, (m) => m == null ? null : typeof m != "number" || isNaN(m) ? {
4
- code: "number",
5
- message: e?.message || "Значение должно быть числом",
6
- params: e?.params
7
- } : e?.integer && !Number.isInteger(m) ? {
8
- code: "number_integer",
9
- message: e?.message || "Значение должно быть целым числом",
10
- params: e?.params
11
- } : e?.min !== void 0 && m < e.min ? {
12
- code: "number_min",
13
- message: e?.message || `Значение должно быть не менее ${e.min}`,
14
- params: { min: e.min, ...e?.params }
15
- } : e?.max !== void 0 && m > e.max ? {
16
- code: "number_max",
17
- message: e?.message || `Значение должно быть не более ${e.max}`,
18
- params: { max: e.max, ...e?.params }
19
- } : e?.multipleOf !== void 0 && m % e.multipleOf !== 0 ? {
20
- code: "number_multiple",
21
- message: e?.message || `Значение должно быть кратно ${e.multipleOf}`,
22
- params: { multipleOf: e.multipleOf, ...e?.params }
23
- } : e?.allowNegative === !1 && m < 0 ? {
24
- code: "number_negative",
25
- message: e?.message || "Отрицательные числа не допускаются",
26
- params: e?.params
27
- } : e?.allowZero === !1 && m === 0 ? {
28
- code: "number_zero",
29
- message: e?.message || "Ноль не допускается",
30
- params: e?.params
31
- } : null);
32
- }
33
- export {
34
- g as number
35
- };
@@ -1,207 +0,0 @@
1
- import { g as a, V as u } from "./registry-helpers-Bv_BJ1s-.js";
2
- import { e as m, t as y, c, a as _ } from "./field-path-DuKdGcIE.js";
3
- import { v as N } from "./validate-C3XiA_zf.js";
4
- import { required as C } from "./validators/required.js";
5
- import { min as P } from "./validators/min.js";
6
- import { max as F } from "./validators/max.js";
7
- import { minLength as d } from "./validators/min-length.js";
8
- import { maxLength as b } from "./validators/max-length.js";
9
- import { email as B } from "./validators/email.js";
10
- import { pattern as T } from "./validators/pattern.js";
11
- import { url as I } from "./validators/url.js";
12
- import { phone as R } from "./validators/phone.js";
13
- import { number as w } from "./validators/number.js";
14
- import { isDate as D } from "./validators/is-date.js";
15
- import { minDate as j } from "./validators/min-date.js";
16
- import { maxDate as k } from "./validators/max-date.js";
17
- import { pastDate as E } from "./validators/past-date.js";
18
- import { futureDate as K } from "./validators/future-date.js";
19
- import { minAge as L } from "./validators/min-age.js";
20
- import { maxAge as G } from "./validators/max-age.js";
21
- function M(t, r, i) {
22
- const e = m(t);
23
- a().registerAsync(e, r, i);
24
- }
25
- function q(t, r) {
26
- a().registerTree(t, r);
27
- }
28
- function z(t, r) {
29
- if (!Array.isArray(t) && !Array.isArray(r) && t && !("__key" in t) && !("__path" in t)) {
30
- r(t);
31
- return;
32
- }
33
- const i = (Array.isArray(t) ? t : [t]).filter(
34
- Boolean
35
- ), e = Array.isArray(r) ? r : [r];
36
- for (const n of i) {
37
- const o = y(n);
38
- for (const p of e)
39
- p(o);
40
- }
41
- }
42
- function S(t, r, i) {
43
- const e = m(t);
44
- a().enterCondition(e, r);
45
- try {
46
- const n = c();
47
- i(n);
48
- } finally {
49
- a().exitCondition();
50
- }
51
- }
52
- function U(t, r) {
53
- t && d(t, 1, {
54
- message: r?.message || "Массив не должен быть пустым",
55
- params: { minLength: 1, ...r?.params }
56
- });
57
- }
58
- function W(t, r) {
59
- if (!t) return;
60
- const i = m(t);
61
- a().registerArrayItemValidation(i, r);
62
- }
63
- function s(t) {
64
- return t == null ? !1 : typeof t == "object" && "value" in t && "setValue" in t && "getValue" in t && "validate" in t;
65
- }
66
- function g(t) {
67
- return t == null ? !1 : s(t) && "validators" in t && "asyncValidators" in t && // FieldNode имеет markAsTouched метод
68
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
- typeof t.markAsTouched == "function" && // У FieldNode нет fields или items
70
- !("fields" in t) && !("items" in t);
71
- }
72
- function h(t) {
73
- return t == null ? !1 : s(t) && "applyValidationSchema" in t && "applyBehaviorSchema" in t && "getFieldByPath" in t && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode)
74
- !("items" in t) && !("push" in t) && !("removeAt" in t);
75
- }
76
- function A(t) {
77
- 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
78
- typeof t.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
- typeof t.removeAt == "function";
80
- }
81
- function yt(t) {
82
- return g(t) ? "FieldNode" : h(t) ? "GroupNode" : A(t) ? "ArrayNode" : s(t) ? "FormNode" : "Unknown";
83
- }
84
- function f(t) {
85
- return g(t) ? [t] : h(t) ? Array.from(t.getAllFields()).flatMap(f) : A(t) ? t.map((r) => f(r)).flat() : [];
86
- }
87
- async function H(t, r) {
88
- const i = new u();
89
- i.beginRegistration();
90
- let e = [], n = !1;
91
- try {
92
- const o = c();
93
- r(o), e = i.getCurrentContext()?.getValidators() || [], i.cancelRegistration(), n = !0, t.clearErrors();
94
- const x = f(t);
95
- return await Promise.allSettled(x.map((V) => V.validate())), e.length > 0 && await t.applyContextualValidators(e), t.valid.value;
96
- } catch (o) {
97
- throw n || i.cancelRegistration(), o;
98
- }
99
- }
100
- class l {
101
- _form;
102
- /**
103
- * Форма с типизированным Proxy-доступом к полям
104
- */
105
- form;
106
- constructor(r) {
107
- this._form = r, this.form = r._proxyInstance || r.getProxy();
108
- }
109
- /**
110
- * Безопасно установить значение поля по строковому пути
111
- * Автоматически использует emitEvent: false для предотвращения циклов
112
- */
113
- setFieldValue(r, i) {
114
- const e = this._form.getFieldByPath(r);
115
- e && s(e) && e.setValue(i, { emitEvent: !1 });
116
- }
117
- /**
118
- * Получить поле формы по строковому пути
119
- */
120
- getFieldByPath(r) {
121
- return this._form.getFieldByPath(r);
122
- }
123
- }
124
- class J extends l {
125
- control;
126
- constructor(r, i, e) {
127
- super(r), this.control = e;
128
- }
129
- /**
130
- * Получить текущее значение поля (внутренний метод для validation-applicator)
131
- * @internal
132
- */
133
- value() {
134
- return this.control.value.value;
135
- }
136
- }
137
- class Q extends l {
138
- constructor(r) {
139
- super(r);
140
- }
141
- }
142
- class dt extends l {
143
- arrayValue;
144
- constructor(r, i, e) {
145
- super(r), this.arrayValue = e;
146
- }
147
- /**
148
- * Получить текущее значение массива (для валидатора)
149
- * @internal
150
- */
151
- value() {
152
- return this.arrayValue;
153
- }
154
- }
155
- const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
156
- __proto__: null,
157
- TreeValidationContextImpl: Q,
158
- ValidationContextImpl: J,
159
- ValidationRegistry: u,
160
- apply: z,
161
- applyWhen: S,
162
- createFieldPath: c,
163
- email: B,
164
- extractKey: _,
165
- extractPath: m,
166
- futureDate: K,
167
- isDate: D,
168
- max: F,
169
- maxAge: G,
170
- maxDate: k,
171
- maxLength: b,
172
- min: P,
173
- minAge: L,
174
- minDate: j,
175
- minLength: d,
176
- notEmpty: U,
177
- number: w,
178
- pastDate: E,
179
- pattern: T,
180
- phone: R,
181
- required: C,
182
- toFieldPath: y,
183
- url: I,
184
- validate: N,
185
- validateAsync: M,
186
- validateForm: H,
187
- validateItems: W,
188
- validateTree: q
189
- }, Symbol.toStringTag, { value: "Module" }));
190
- export {
191
- dt as A,
192
- Q as T,
193
- J as V,
194
- A as a,
195
- gt as b,
196
- s as c,
197
- h as d,
198
- M as e,
199
- q as f,
200
- yt as g,
201
- z as h,
202
- g as i,
203
- S as j,
204
- W as k,
205
- U as n,
206
- H as v
207
- };