@reformer/core 2.0.0-beta.6 → 2.0.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/compute-from.d.ts +2 -0
- package/dist/behaviors/compute-from.js +31 -0
- package/dist/behaviors/copy-from.d.ts +2 -0
- package/dist/behaviors/copy-from.js +29 -0
- package/dist/behaviors/enable-when.d.ts +2 -0
- package/dist/behaviors/enable-when.js +25 -0
- package/dist/behaviors/reset-when.d.ts +2 -0
- package/dist/behaviors/reset-when.js +24 -0
- package/dist/behaviors/revalidate-when.d.ts +2 -0
- package/dist/behaviors/revalidate-when.js +18 -0
- package/dist/behaviors/sync-fields.d.ts +2 -0
- package/dist/behaviors/sync-fields.js +41 -0
- package/dist/behaviors/transform-value.d.ts +2 -0
- package/dist/behaviors/transform-value.js +45 -0
- package/dist/behaviors/watch-field.d.ts +2 -0
- package/dist/behaviors/watch-field.js +21 -0
- package/dist/behaviors.js +26 -19
- package/dist/core/behavior/behavior-context.d.ts +26 -12
- package/dist/core/behavior/behavior-registry.d.ts +15 -27
- package/dist/core/behavior/behaviors/compute-from.d.ts +50 -21
- package/dist/core/behavior/behaviors/copy-from.d.ts +39 -14
- package/dist/core/behavior/behaviors/enable-when.d.ts +88 -19
- package/dist/core/behavior/behaviors/reset-when.d.ts +31 -18
- package/dist/core/behavior/behaviors/revalidate-when.d.ts +40 -17
- package/dist/core/behavior/behaviors/sync-fields.d.ts +34 -14
- package/dist/core/behavior/behaviors/transform-value.d.ts +116 -44
- package/dist/core/behavior/behaviors/watch-field.d.ts +66 -21
- package/dist/core/behavior/compose-behavior.d.ts +2 -12
- package/dist/core/behavior/index.d.ts +0 -1
- package/dist/core/behavior/types.d.ts +2 -8
- package/dist/core/factories/node-factory.d.ts +6 -29
- package/dist/core/nodes/array-node.d.ts +39 -19
- package/dist/core/nodes/field-node.d.ts +43 -24
- package/dist/core/nodes/form-node.d.ts +18 -20
- package/dist/core/nodes/group-node.d.ts +25 -21
- package/dist/core/types/deep-schema.d.ts +2 -12
- package/dist/core/types/field-path.d.ts +1 -1
- package/dist/core/types/form-context.d.ts +26 -26
- package/dist/core/types/form-proxy.d.ts +2 -32
- package/dist/core/types/index.d.ts +16 -4
- package/dist/core/types/validation-schema.d.ts +3 -12
- package/dist/core/utils/abstract-registry.d.ts +74 -0
- package/dist/core/utils/aggregate-signals.d.ts +71 -0
- package/dist/core/utils/create-form.d.ts +1 -18
- package/dist/core/utils/error-handler.d.ts +1 -18
- package/dist/core/utils/field-path-navigator.d.ts +1 -1
- package/dist/core/utils/field-path.d.ts +23 -11
- package/dist/core/utils/form-observer.d.ts +176 -0
- package/dist/core/utils/form-proxy-builder.d.ts +25 -0
- package/dist/core/utils/form-submitter.d.ts +121 -0
- package/dist/core/utils/index.d.ts +9 -2
- package/dist/core/utils/registry-helpers.d.ts +0 -7
- package/dist/core/utils/safe-effect.d.ts +73 -0
- package/dist/core/utils/status-machine.d.ts +153 -0
- package/dist/core/utils/type-guards.d.ts +5 -23
- package/dist/core/utils/unique-id.d.ts +53 -0
- package/dist/core/validation/core/apply-when.d.ts +3 -9
- package/dist/core/validation/core/apply.d.ts +2 -13
- package/dist/core/validation/core/validate-async.d.ts +2 -8
- package/dist/core/validation/core/validate-tree.d.ts +0 -6
- package/dist/core/validation/core/validate.d.ts +1 -7
- package/dist/core/validation/index.d.ts +8 -2
- package/dist/core/validation/validate-form.d.ts +1 -38
- package/dist/core/validation/validation-applicator.d.ts +2 -21
- package/dist/core/validation/validation-context.d.ts +58 -42
- package/dist/core/validation/validation-registry.d.ts +11 -25
- package/dist/core/validation/validators/array-validators.d.ts +2 -12
- package/dist/core/validation/validators/date-utils.d.ts +26 -0
- package/dist/core/validation/validators/email.d.ts +2 -9
- package/dist/core/validation/validators/future-date.d.ts +35 -0
- package/dist/core/validation/validators/index.d.ts +7 -1
- package/dist/core/validation/validators/is-date.d.ts +36 -0
- package/dist/core/validation/validators/max-age.d.ts +36 -0
- package/dist/core/validation/validators/max-date.d.ts +36 -0
- package/dist/core/validation/validators/max-length.d.ts +3 -10
- package/dist/core/validation/validators/max.d.ts +3 -10
- package/dist/core/validation/validators/min-age.d.ts +36 -0
- package/dist/core/validation/validators/min-date.d.ts +36 -0
- package/dist/core/validation/validators/min-length.d.ts +3 -10
- package/dist/core/validation/validators/min.d.ts +3 -10
- package/dist/core/validation/validators/number.d.ts +2 -9
- package/dist/core/validation/validators/past-date.d.ts +35 -0
- package/dist/core/validation/validators/pattern.d.ts +2 -9
- package/dist/core/validation/validators/phone.d.ts +2 -9
- package/dist/core/validation/validators/required.d.ts +2 -9
- package/dist/core/validation/validators/url.d.ts +2 -9
- package/dist/date-utils-xUWFslTj.js +29 -0
- package/dist/field-path-DuKdGcIE.js +66 -0
- package/dist/hooks/types.d.ts +1 -1
- package/dist/hooks/useArrayLength.d.ts +31 -0
- package/dist/hooks/useFormControl.d.ts +4 -4
- package/dist/hooks/useFormControlValue.d.ts +2 -2
- package/dist/hooks/useHiddenCondition.d.ts +25 -0
- package/dist/hooks/useSignalSubscription.d.ts +1 -1
- package/dist/index-D25LsbRm.js +73 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1100 -740
- package/dist/registry-helpers-Bv_BJ1s-.js +615 -0
- package/dist/safe-effect-Dh8uw81c.js +20 -0
- package/dist/validate-C3XiA_zf.js +10 -0
- package/dist/validators/email.d.ts +2 -0
- package/dist/validators/email.js +13 -0
- package/dist/validators/future-date.d.ts +2 -0
- package/dist/validators/future-date.js +20 -0
- package/dist/validators/is-date.d.ts +2 -0
- package/dist/validators/is-date.js +12 -0
- package/dist/validators/max-age.d.ts +2 -0
- package/dist/validators/max-age.js +20 -0
- package/dist/validators/max-date.d.ts +2 -0
- package/dist/validators/max-date.js +20 -0
- package/dist/validators/max-length.d.ts +2 -0
- package/dist/validators/max-length.js +11 -0
- package/dist/validators/max.d.ts +2 -0
- package/dist/validators/max.js +11 -0
- package/dist/validators/min-age.d.ts +2 -0
- package/dist/validators/min-age.js +20 -0
- package/dist/validators/min-date.d.ts +2 -0
- package/dist/validators/min-date.js +20 -0
- package/dist/validators/min-length.d.ts +2 -0
- package/dist/validators/min-length.js +11 -0
- package/dist/validators/min.d.ts +2 -0
- package/dist/validators/min.js +11 -0
- package/dist/validators/number.d.ts +2 -0
- package/dist/validators/number.js +35 -0
- package/dist/validators/past-date.d.ts +2 -0
- package/dist/validators/past-date.js +20 -0
- package/dist/validators/pattern.d.ts +2 -0
- package/dist/validators/pattern.js +11 -0
- package/dist/validators/phone.d.ts +2 -0
- package/dist/validators/phone.js +35 -0
- package/dist/validators/required.d.ts +2 -0
- package/dist/validators/required.js +15 -0
- package/dist/validators/url.d.ts +2 -0
- package/dist/validators/url.js +19 -0
- package/dist/validators-BGsNOgT1.js +207 -0
- package/dist/validators.js +54 -29
- package/llms.txt +7878 -311
- package/package.json +83 -9
- package/dist/behaviors-2HSqHPb4.js +0 -508
- package/dist/core/behavior/create-field-path.d.ts +0 -7
- package/dist/core/context/form-context-impl.d.ts +0 -29
- package/dist/core/utils/debounce.d.ts +0 -160
- package/dist/core/utils/resources.d.ts +0 -41
- package/dist/core/validation/field-path.d.ts +0 -7
- package/dist/core/validation/validators/date.d.ts +0 -38
- package/dist/registry-helpers-BRxAr6nG.js +0 -490
- package/dist/validators-gXoHPdqM.js +0 -418
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reformer/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.8",
|
|
4
4
|
"description": "Reactive form state management library for React with signals-based architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,15 +18,91 @@
|
|
|
18
18
|
"./validators": {
|
|
19
19
|
"types": "./dist/validators.d.ts",
|
|
20
20
|
"import": "./dist/validators.js"
|
|
21
|
+
},
|
|
22
|
+
"./validators/required": {
|
|
23
|
+
"types": "./dist/validators/required.d.ts",
|
|
24
|
+
"import": "./dist/validators/required.js"
|
|
25
|
+
},
|
|
26
|
+
"./validators/email": {
|
|
27
|
+
"types": "./dist/validators/email.d.ts",
|
|
28
|
+
"import": "./dist/validators/email.js"
|
|
29
|
+
},
|
|
30
|
+
"./validators/min": {
|
|
31
|
+
"types": "./dist/validators/min.d.ts",
|
|
32
|
+
"import": "./dist/validators/min.js"
|
|
33
|
+
},
|
|
34
|
+
"./validators/max": {
|
|
35
|
+
"types": "./dist/validators/max.d.ts",
|
|
36
|
+
"import": "./dist/validators/max.js"
|
|
37
|
+
},
|
|
38
|
+
"./validators/min-length": {
|
|
39
|
+
"types": "./dist/validators/min-length.d.ts",
|
|
40
|
+
"import": "./dist/validators/min-length.js"
|
|
41
|
+
},
|
|
42
|
+
"./validators/max-length": {
|
|
43
|
+
"types": "./dist/validators/max-length.d.ts",
|
|
44
|
+
"import": "./dist/validators/max-length.js"
|
|
45
|
+
},
|
|
46
|
+
"./validators/pattern": {
|
|
47
|
+
"types": "./dist/validators/pattern.d.ts",
|
|
48
|
+
"import": "./dist/validators/pattern.js"
|
|
49
|
+
},
|
|
50
|
+
"./validators/url": {
|
|
51
|
+
"types": "./dist/validators/url.d.ts",
|
|
52
|
+
"import": "./dist/validators/url.js"
|
|
53
|
+
},
|
|
54
|
+
"./validators/phone": {
|
|
55
|
+
"types": "./dist/validators/phone.d.ts",
|
|
56
|
+
"import": "./dist/validators/phone.js"
|
|
57
|
+
},
|
|
58
|
+
"./validators/number": {
|
|
59
|
+
"types": "./dist/validators/number.d.ts",
|
|
60
|
+
"import": "./dist/validators/number.js"
|
|
61
|
+
},
|
|
62
|
+
"./validators/date": {
|
|
63
|
+
"types": "./dist/validators/date.d.ts",
|
|
64
|
+
"import": "./dist/validators/date.js"
|
|
65
|
+
},
|
|
66
|
+
"./behaviors/copy-from": {
|
|
67
|
+
"types": "./dist/behaviors/copy-from.d.ts",
|
|
68
|
+
"import": "./dist/behaviors/copy-from.js"
|
|
69
|
+
},
|
|
70
|
+
"./behaviors/enable-when": {
|
|
71
|
+
"types": "./dist/behaviors/enable-when.d.ts",
|
|
72
|
+
"import": "./dist/behaviors/enable-when.js"
|
|
73
|
+
},
|
|
74
|
+
"./behaviors/compute-from": {
|
|
75
|
+
"types": "./dist/behaviors/compute-from.d.ts",
|
|
76
|
+
"import": "./dist/behaviors/compute-from.js"
|
|
77
|
+
},
|
|
78
|
+
"./behaviors/watch-field": {
|
|
79
|
+
"types": "./dist/behaviors/watch-field.d.ts",
|
|
80
|
+
"import": "./dist/behaviors/watch-field.js"
|
|
81
|
+
},
|
|
82
|
+
"./behaviors/revalidate-when": {
|
|
83
|
+
"types": "./dist/behaviors/revalidate-when.d.ts",
|
|
84
|
+
"import": "./dist/behaviors/revalidate-when.js"
|
|
85
|
+
},
|
|
86
|
+
"./behaviors/sync-fields": {
|
|
87
|
+
"types": "./dist/behaviors/sync-fields.d.ts",
|
|
88
|
+
"import": "./dist/behaviors/sync-fields.js"
|
|
89
|
+
},
|
|
90
|
+
"./behaviors/reset-when": {
|
|
91
|
+
"types": "./dist/behaviors/reset-when.d.ts",
|
|
92
|
+
"import": "./dist/behaviors/reset-when.js"
|
|
93
|
+
},
|
|
94
|
+
"./behaviors/transform-value": {
|
|
95
|
+
"types": "./dist/behaviors/transform-value.d.ts",
|
|
96
|
+
"import": "./dist/behaviors/transform-value.js"
|
|
21
97
|
}
|
|
22
98
|
},
|
|
23
99
|
"sideEffects": false,
|
|
24
100
|
"scripts": {
|
|
25
|
-
"generate:llms": "
|
|
26
|
-
"build": "npm run generate:llms && vite build
|
|
27
|
-
"build:stackblitz": "vite build
|
|
101
|
+
"generate:llms": "node ../../scripts/generate-llms-txt .",
|
|
102
|
+
"build": "npm run generate:llms && vite build",
|
|
103
|
+
"build:stackblitz": "vite build",
|
|
28
104
|
"dev": "vite",
|
|
29
|
-
"test": "vitest",
|
|
105
|
+
"test": "node ../../scripts/run-vitest.mjs",
|
|
30
106
|
"test:watch": "vitest watch"
|
|
31
107
|
},
|
|
32
108
|
"keywords": [
|
|
@@ -65,13 +141,12 @@
|
|
|
65
141
|
"LLMs.txt"
|
|
66
142
|
],
|
|
67
143
|
"peerDependencies": {
|
|
144
|
+
"@preact/signals-core": "^1.8.0",
|
|
68
145
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
69
146
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
70
147
|
},
|
|
71
148
|
"dependencies": {
|
|
72
|
-
"
|
|
73
|
-
"use-sync-external-store": "^1.2.0",
|
|
74
|
-
"uuid": "^13.0.0"
|
|
149
|
+
"use-sync-external-store": "^1.2.0"
|
|
75
150
|
},
|
|
76
151
|
"devDependencies": {
|
|
77
152
|
"@types/use-sync-external-store": "^0.0.6",
|
|
@@ -79,7 +154,6 @@
|
|
|
79
154
|
"tsx": "^4.19.2",
|
|
80
155
|
"@types/react": "^19.2.7",
|
|
81
156
|
"@types/react-dom": "^19.2.3",
|
|
82
|
-
"@types/uuid": "^10.0.0",
|
|
83
157
|
"@vitejs/plugin-react": "^5.1.0",
|
|
84
158
|
"@vitest/utils": "^4.0.8",
|
|
85
159
|
"react": "^19.2.1",
|
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
import { b as w, c as E, d as I, B as L } from "./registry-helpers-BRxAr6nG.js";
|
|
2
|
-
var $ = /* @__PURE__ */ Symbol.for("preact-signals");
|
|
3
|
-
function B() {
|
|
4
|
-
if (y > 1)
|
|
5
|
-
y--;
|
|
6
|
-
else {
|
|
7
|
-
for (var e, t = !1; P !== void 0; ) {
|
|
8
|
-
var i = P;
|
|
9
|
-
for (P = void 0, N++; i !== void 0; ) {
|
|
10
|
-
var n = i.o;
|
|
11
|
-
if (i.o = void 0, i.f &= -3, !(8 & i.f) && W(i)) try {
|
|
12
|
-
i.c();
|
|
13
|
-
} catch (s) {
|
|
14
|
-
t || (e = s, t = !0);
|
|
15
|
-
}
|
|
16
|
-
i = n;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if (N = 0, y--, t) throw e;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function rt(e) {
|
|
23
|
-
if (y > 0) return e();
|
|
24
|
-
y++;
|
|
25
|
-
try {
|
|
26
|
-
return e();
|
|
27
|
-
} finally {
|
|
28
|
-
B();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
var o = void 0;
|
|
32
|
-
function C(e) {
|
|
33
|
-
var t = o;
|
|
34
|
-
o = void 0;
|
|
35
|
-
try {
|
|
36
|
-
return e();
|
|
37
|
-
} finally {
|
|
38
|
-
o = t;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
var P = void 0, y = 0, N = 0, V = 0;
|
|
42
|
-
function A(e) {
|
|
43
|
-
if (o !== void 0) {
|
|
44
|
-
var t = e.n;
|
|
45
|
-
if (t === void 0 || t.t !== o)
|
|
46
|
-
return t = { i: 0, S: e, p: o.s, n: void 0, t: o, e: void 0, x: void 0, r: t }, o.s !== void 0 && (o.s.n = t), o.s = t, e.n = t, 32 & o.f && e.S(t), t;
|
|
47
|
-
if (t.i === -1)
|
|
48
|
-
return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = o.s, t.n = void 0, o.s.n = t, o.s = t), t;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function d(e, t) {
|
|
52
|
-
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
53
|
-
}
|
|
54
|
-
d.prototype.brand = $;
|
|
55
|
-
d.prototype.h = function() {
|
|
56
|
-
return !0;
|
|
57
|
-
};
|
|
58
|
-
d.prototype.S = function(e) {
|
|
59
|
-
var t = this, i = this.t;
|
|
60
|
-
i !== e && e.e === void 0 && (e.x = i, this.t = e, i !== void 0 ? i.e = e : C(function() {
|
|
61
|
-
var n;
|
|
62
|
-
(n = t.W) == null || n.call(t);
|
|
63
|
-
}));
|
|
64
|
-
};
|
|
65
|
-
d.prototype.U = function(e) {
|
|
66
|
-
var t = this;
|
|
67
|
-
if (this.t !== void 0) {
|
|
68
|
-
var i = e.e, n = e.x;
|
|
69
|
-
i !== void 0 && (i.x = n, e.e = void 0), n !== void 0 && (n.e = i, e.x = void 0), e === this.t && (this.t = n, n === void 0 && C(function() {
|
|
70
|
-
var s;
|
|
71
|
-
(s = t.Z) == null || s.call(t);
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
d.prototype.subscribe = function(e) {
|
|
76
|
-
var t = this;
|
|
77
|
-
return g(function() {
|
|
78
|
-
var i = t.value, n = o;
|
|
79
|
-
o = void 0;
|
|
80
|
-
try {
|
|
81
|
-
e(i);
|
|
82
|
-
} finally {
|
|
83
|
-
o = n;
|
|
84
|
-
}
|
|
85
|
-
}, { name: "sub" });
|
|
86
|
-
};
|
|
87
|
-
d.prototype.valueOf = function() {
|
|
88
|
-
return this.value;
|
|
89
|
-
};
|
|
90
|
-
d.prototype.toString = function() {
|
|
91
|
-
return this.value + "";
|
|
92
|
-
};
|
|
93
|
-
d.prototype.toJSON = function() {
|
|
94
|
-
return this.value;
|
|
95
|
-
};
|
|
96
|
-
d.prototype.peek = function() {
|
|
97
|
-
var e = o;
|
|
98
|
-
o = void 0;
|
|
99
|
-
try {
|
|
100
|
-
return this.value;
|
|
101
|
-
} finally {
|
|
102
|
-
o = e;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
Object.defineProperty(d.prototype, "value", { get: function() {
|
|
106
|
-
var e = A(this);
|
|
107
|
-
return e !== void 0 && (e.i = this.i), this.v;
|
|
108
|
-
}, set: function(e) {
|
|
109
|
-
if (e !== this.v) {
|
|
110
|
-
if (N > 100) throw new Error("Cycle detected");
|
|
111
|
-
this.v = e, this.i++, V++, y++;
|
|
112
|
-
try {
|
|
113
|
-
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
114
|
-
} finally {
|
|
115
|
-
B();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
} });
|
|
119
|
-
function ot(e, t) {
|
|
120
|
-
return new d(e, t);
|
|
121
|
-
}
|
|
122
|
-
function W(e) {
|
|
123
|
-
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
124
|
-
return !1;
|
|
125
|
-
}
|
|
126
|
-
function j(e) {
|
|
127
|
-
for (var t = e.s; t !== void 0; t = t.n) {
|
|
128
|
-
var i = t.S.n;
|
|
129
|
-
if (i !== void 0 && (t.r = i), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
130
|
-
e.s = t;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function k(e) {
|
|
136
|
-
for (var t = e.s, i = void 0; t !== void 0; ) {
|
|
137
|
-
var n = t.p;
|
|
138
|
-
t.i === -1 ? (t.S.U(t), n !== void 0 && (n.n = t.n), t.n !== void 0 && (t.n.p = n)) : i = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = n;
|
|
139
|
-
}
|
|
140
|
-
e.s = i;
|
|
141
|
-
}
|
|
142
|
-
function _(e, t) {
|
|
143
|
-
d.call(this, void 0), this.x = e, this.s = void 0, this.g = V - 1, this.f = 4, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
144
|
-
}
|
|
145
|
-
_.prototype = new d();
|
|
146
|
-
_.prototype.h = function() {
|
|
147
|
-
if (this.f &= -3, 1 & this.f) return !1;
|
|
148
|
-
if ((36 & this.f) == 32 || (this.f &= -5, this.g === V)) return !0;
|
|
149
|
-
if (this.g = V, this.f |= 1, this.i > 0 && !W(this))
|
|
150
|
-
return this.f &= -2, !0;
|
|
151
|
-
var e = o;
|
|
152
|
-
try {
|
|
153
|
-
j(this), o = this;
|
|
154
|
-
var t = this.x();
|
|
155
|
-
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
156
|
-
} catch (i) {
|
|
157
|
-
this.v = i, this.f |= 16, this.i++;
|
|
158
|
-
}
|
|
159
|
-
return o = e, k(this), this.f &= -2, !0;
|
|
160
|
-
};
|
|
161
|
-
_.prototype.S = function(e) {
|
|
162
|
-
if (this.t === void 0) {
|
|
163
|
-
this.f |= 36;
|
|
164
|
-
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
165
|
-
}
|
|
166
|
-
d.prototype.S.call(this, e);
|
|
167
|
-
};
|
|
168
|
-
_.prototype.U = function(e) {
|
|
169
|
-
if (this.t !== void 0 && (d.prototype.U.call(this, e), this.t === void 0)) {
|
|
170
|
-
this.f &= -33;
|
|
171
|
-
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
_.prototype.N = function() {
|
|
175
|
-
if (!(2 & this.f)) {
|
|
176
|
-
this.f |= 6;
|
|
177
|
-
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
Object.defineProperty(_.prototype, "value", { get: function() {
|
|
181
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
|
182
|
-
var e = A(this);
|
|
183
|
-
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
|
|
184
|
-
return this.v;
|
|
185
|
-
} });
|
|
186
|
-
function st(e, t) {
|
|
187
|
-
return new _(e, t);
|
|
188
|
-
}
|
|
189
|
-
function M(e) {
|
|
190
|
-
var t = e.u;
|
|
191
|
-
if (e.u = void 0, typeof t == "function") {
|
|
192
|
-
y++;
|
|
193
|
-
var i = o;
|
|
194
|
-
o = void 0;
|
|
195
|
-
try {
|
|
196
|
-
t();
|
|
197
|
-
} catch (n) {
|
|
198
|
-
throw e.f &= -2, e.f |= 8, O(e), n;
|
|
199
|
-
} finally {
|
|
200
|
-
o = i, B();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function O(e) {
|
|
205
|
-
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
|
|
206
|
-
e.x = void 0, e.s = void 0, M(e);
|
|
207
|
-
}
|
|
208
|
-
function z(e) {
|
|
209
|
-
if (o !== this) throw new Error("Out-of-order effect");
|
|
210
|
-
k(this), o = e, this.f &= -2, 8 & this.f && O(this), B();
|
|
211
|
-
}
|
|
212
|
-
function S(e, t) {
|
|
213
|
-
this.x = e, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = t?.name;
|
|
214
|
-
}
|
|
215
|
-
S.prototype.c = function() {
|
|
216
|
-
var e = this.S();
|
|
217
|
-
try {
|
|
218
|
-
if (8 & this.f || this.x === void 0) return;
|
|
219
|
-
var t = this.x();
|
|
220
|
-
typeof t == "function" && (this.u = t);
|
|
221
|
-
} finally {
|
|
222
|
-
e();
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
S.prototype.S = function() {
|
|
226
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
|
227
|
-
this.f |= 1, this.f &= -9, M(this), j(this), y++;
|
|
228
|
-
var e = o;
|
|
229
|
-
return o = this, z.bind(this, e);
|
|
230
|
-
};
|
|
231
|
-
S.prototype.N = function() {
|
|
232
|
-
2 & this.f || (this.f |= 2, this.o = P, P = this);
|
|
233
|
-
};
|
|
234
|
-
S.prototype.d = function() {
|
|
235
|
-
this.f |= 8, 1 & this.f || O(this);
|
|
236
|
-
};
|
|
237
|
-
S.prototype.dispose = function() {
|
|
238
|
-
this.d();
|
|
239
|
-
};
|
|
240
|
-
function g(e, t) {
|
|
241
|
-
var i = new S(e, t);
|
|
242
|
-
try {
|
|
243
|
-
i.c();
|
|
244
|
-
} catch (s) {
|
|
245
|
-
throw i.d(), s;
|
|
246
|
-
}
|
|
247
|
-
var n = i.d.bind(i);
|
|
248
|
-
return n[Symbol.dispose] = n, n;
|
|
249
|
-
}
|
|
250
|
-
function F(e, t, i) {
|
|
251
|
-
const { debounce: n, immediate: s = !1 } = i || {}, f = (u, l, h) => {
|
|
252
|
-
const a = u.getFieldByPath(e.__path);
|
|
253
|
-
return a ? (s && queueMicrotask(() => {
|
|
254
|
-
const r = a.value.value;
|
|
255
|
-
t(r, l);
|
|
256
|
-
}), g(() => {
|
|
257
|
-
const r = a.value.value;
|
|
258
|
-
h(() => {
|
|
259
|
-
t(r, l);
|
|
260
|
-
});
|
|
261
|
-
})) : null;
|
|
262
|
-
};
|
|
263
|
-
w().register(f, { debounce: n });
|
|
264
|
-
}
|
|
265
|
-
function J(e, t, i) {
|
|
266
|
-
const { when: n, fields: s = "all", transform: f, debounce: u } = i || {};
|
|
267
|
-
F(
|
|
268
|
-
e,
|
|
269
|
-
(l, h) => {
|
|
270
|
-
if (n) {
|
|
271
|
-
const c = h.form.getValue();
|
|
272
|
-
if (!n(c)) return;
|
|
273
|
-
}
|
|
274
|
-
const a = f ? f(l) : l, r = h.form.getFieldByPath(t.__path);
|
|
275
|
-
if (r)
|
|
276
|
-
if (s === "all" || !s)
|
|
277
|
-
r.setValue(a, { emitEvent: !1 });
|
|
278
|
-
else {
|
|
279
|
-
const c = {};
|
|
280
|
-
s.forEach((v) => {
|
|
281
|
-
l && typeof l == "object" && (c[v] = l[v]);
|
|
282
|
-
}), "patchValue" in r && r.patchValue(c);
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
{ debounce: u }
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
function R(e, t, i) {
|
|
289
|
-
const { debounce: n, resetOnDisable: s = !1 } = i || {}, f = (u, l, h) => {
|
|
290
|
-
const a = u.getFieldByPath(e.__path);
|
|
291
|
-
return a ? g(() => {
|
|
292
|
-
const r = u.value.value;
|
|
293
|
-
h(() => {
|
|
294
|
-
t(r) ? a.enable() : (a.disable(), s && a.reset());
|
|
295
|
-
});
|
|
296
|
-
}) : null;
|
|
297
|
-
};
|
|
298
|
-
w().register(f, { debounce: n });
|
|
299
|
-
}
|
|
300
|
-
function G(e, t, i) {
|
|
301
|
-
R(e, (n) => !t(n), i);
|
|
302
|
-
}
|
|
303
|
-
function H(e, t, i, n) {
|
|
304
|
-
const { debounce: s, condition: f } = n || {}, u = (l, h, a) => {
|
|
305
|
-
const r = l.getFieldByPath(t.__path);
|
|
306
|
-
if (!r) return null;
|
|
307
|
-
const c = e.map((v) => l.getFieldByPath(v.__path)).filter((v) => v !== void 0);
|
|
308
|
-
return c.length === 0 ? null : g(() => {
|
|
309
|
-
const v = c.map((b) => b.value.value);
|
|
310
|
-
a(() => {
|
|
311
|
-
if (f) {
|
|
312
|
-
const x = l.getValue();
|
|
313
|
-
if (!f(x)) return;
|
|
314
|
-
}
|
|
315
|
-
const b = {};
|
|
316
|
-
e.forEach((x, q) => {
|
|
317
|
-
const D = x.__path.split(".").pop() || x.__path;
|
|
318
|
-
b[D] = v[q];
|
|
319
|
-
});
|
|
320
|
-
const m = i(b);
|
|
321
|
-
r.value.peek() !== m && queueMicrotask(() => {
|
|
322
|
-
r.setValue(m, { emitEvent: !1 });
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
w().register(u, { debounce: s });
|
|
328
|
-
}
|
|
329
|
-
function K(e, t, i) {
|
|
330
|
-
const { debounce: n } = i || {}, s = (f, u, l) => {
|
|
331
|
-
const h = f.getFieldByPath(e.__path);
|
|
332
|
-
if (!h) return null;
|
|
333
|
-
const a = t.map((r) => f.getFieldByPath(r.__path)).filter((r) => r !== void 0);
|
|
334
|
-
return a.length === 0 ? null : g(() => {
|
|
335
|
-
a.forEach((r) => r.value.value), l(() => {
|
|
336
|
-
h.validate();
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
};
|
|
340
|
-
w().register(s, { debounce: n });
|
|
341
|
-
}
|
|
342
|
-
function Q(e, t, i) {
|
|
343
|
-
const { debounce: n, transform: s } = i || {}, f = (u, l, h) => {
|
|
344
|
-
const a = u.getFieldByPath(e.__path), r = u.getFieldByPath(t.__path);
|
|
345
|
-
if (!a || !r) return null;
|
|
346
|
-
let c = !1;
|
|
347
|
-
const v = g(() => {
|
|
348
|
-
const m = a.value.value;
|
|
349
|
-
c || h(() => {
|
|
350
|
-
c = !0;
|
|
351
|
-
try {
|
|
352
|
-
const U = s ? s(m) : m;
|
|
353
|
-
r.setValue(U, { emitEvent: !1 });
|
|
354
|
-
} finally {
|
|
355
|
-
c = !1;
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}), b = g(() => {
|
|
359
|
-
const m = r.value.value;
|
|
360
|
-
c || h(() => {
|
|
361
|
-
c = !0;
|
|
362
|
-
try {
|
|
363
|
-
a.setValue(m, { emitEvent: !1 });
|
|
364
|
-
} finally {
|
|
365
|
-
c = !1;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
});
|
|
369
|
-
return () => {
|
|
370
|
-
v(), b();
|
|
371
|
-
};
|
|
372
|
-
};
|
|
373
|
-
w().register(f, { debounce: n });
|
|
374
|
-
}
|
|
375
|
-
function X(e, t, i) {
|
|
376
|
-
const { debounce: n, resetValue: s = null, onlyIfDirty: f = !1 } = i || {}, u = (l, h, a) => {
|
|
377
|
-
const r = l.getFieldByPath(e.__path);
|
|
378
|
-
return r ? g(() => {
|
|
379
|
-
const c = l.value.value;
|
|
380
|
-
a(() => {
|
|
381
|
-
if (t(c)) {
|
|
382
|
-
if (f && !r.dirty.value)
|
|
383
|
-
return;
|
|
384
|
-
r.setValue(s), r.markAsPristine(), r.markAsUntouched();
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
}) : null;
|
|
388
|
-
};
|
|
389
|
-
w().register(u, { debounce: n });
|
|
390
|
-
}
|
|
391
|
-
function T(e, t, i) {
|
|
392
|
-
const { onUserChangeOnly: n = !1, emitEvent: s = !0, debounce: f } = i || {};
|
|
393
|
-
F(
|
|
394
|
-
e,
|
|
395
|
-
(u, l) => {
|
|
396
|
-
const h = l.form.getFieldByPath(e.__path);
|
|
397
|
-
if (!h || n && !h.touched.value)
|
|
398
|
-
return;
|
|
399
|
-
const a = t(u);
|
|
400
|
-
a !== u && h.setValue(a, { emitEvent: s });
|
|
401
|
-
},
|
|
402
|
-
{ debounce: f }
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
function p(e, t) {
|
|
406
|
-
return (i, n) => {
|
|
407
|
-
T(i, e, { ...t, ...n });
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
const Y = {
|
|
411
|
-
/** Перевести в верхний регистр */
|
|
412
|
-
toUpperCase: p((e) => e?.toUpperCase()),
|
|
413
|
-
/** Перевести в нижний регистр */
|
|
414
|
-
toLowerCase: p((e) => e?.toLowerCase()),
|
|
415
|
-
/** Удалить пробелы с краев */
|
|
416
|
-
trim: p((e) => e?.trim()),
|
|
417
|
-
/** Удалить все пробелы */
|
|
418
|
-
removeSpaces: p((e) => e?.replace(/\s/g, "")),
|
|
419
|
-
/** Оставить только цифры */
|
|
420
|
-
digitsOnly: p((e) => e?.replace(/\D/g, "")),
|
|
421
|
-
/** Округлить число */
|
|
422
|
-
round: p(
|
|
423
|
-
(e) => typeof e == "number" ? Math.round(e) : e
|
|
424
|
-
),
|
|
425
|
-
/** Округлить до 2 знаков после запятой */
|
|
426
|
-
roundTo2: p(
|
|
427
|
-
(e) => typeof e == "number" ? Math.round(e * 100) / 100 : e
|
|
428
|
-
)
|
|
429
|
-
};
|
|
430
|
-
function Z(e) {
|
|
431
|
-
if (!e)
|
|
432
|
-
return E();
|
|
433
|
-
const t = e.__path;
|
|
434
|
-
return tt(t);
|
|
435
|
-
}
|
|
436
|
-
function tt(e) {
|
|
437
|
-
return new Proxy({}, {
|
|
438
|
-
get(t, i) {
|
|
439
|
-
return typeof i == "symbol" ? void 0 : {
|
|
440
|
-
__path: e ? `${e}.${i}` : i,
|
|
441
|
-
__key: i
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
function et(e, t) {
|
|
447
|
-
const i = (Array.isArray(e) ? e : [e]).filter(Boolean), n = Array.isArray(t) ? t : [t];
|
|
448
|
-
for (const s of i) {
|
|
449
|
-
const f = Z(s);
|
|
450
|
-
for (const u of n)
|
|
451
|
-
u(f);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
function it(e, t, i) {
|
|
455
|
-
if (!e) return;
|
|
456
|
-
let n = !1;
|
|
457
|
-
F(
|
|
458
|
-
e,
|
|
459
|
-
(s, f) => {
|
|
460
|
-
if (!n && t(s)) {
|
|
461
|
-
const u = E();
|
|
462
|
-
i(u), n = !0;
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
{ immediate: !0 }
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
469
|
-
__proto__: null,
|
|
470
|
-
BehaviorContextImpl: I,
|
|
471
|
-
BehaviorRegistry: L,
|
|
472
|
-
apply: et,
|
|
473
|
-
applyWhen: it,
|
|
474
|
-
computeFrom: H,
|
|
475
|
-
copyFrom: J,
|
|
476
|
-
createFieldPath: E,
|
|
477
|
-
createTransformer: p,
|
|
478
|
-
disableWhen: G,
|
|
479
|
-
enableWhen: R,
|
|
480
|
-
resetWhen: X,
|
|
481
|
-
revalidateWhen: K,
|
|
482
|
-
syncFields: Q,
|
|
483
|
-
toBehaviorFieldPath: Z,
|
|
484
|
-
transformValue: T,
|
|
485
|
-
transformers: Y,
|
|
486
|
-
watchField: F
|
|
487
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
488
|
-
export {
|
|
489
|
-
g as E,
|
|
490
|
-
et as a,
|
|
491
|
-
it as b,
|
|
492
|
-
J as c,
|
|
493
|
-
ot as d,
|
|
494
|
-
R as e,
|
|
495
|
-
G as f,
|
|
496
|
-
H as g,
|
|
497
|
-
F as h,
|
|
498
|
-
at as i,
|
|
499
|
-
K as j,
|
|
500
|
-
X as k,
|
|
501
|
-
T as l,
|
|
502
|
-
p as m,
|
|
503
|
-
Y as n,
|
|
504
|
-
rt as r,
|
|
505
|
-
Q as s,
|
|
506
|
-
Z as t,
|
|
507
|
-
st as w
|
|
508
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Реализация единого FormContext
|
|
3
|
-
*
|
|
4
|
-
* Используется как базовая реализация для behavior и validation контекстов
|
|
5
|
-
*/
|
|
6
|
-
import type { GroupNode } from '../nodes/group-node';
|
|
7
|
-
import type { FormContext } from '../types/form-context';
|
|
8
|
-
import type { FormProxy } from '../types/form-proxy';
|
|
9
|
-
/**
|
|
10
|
-
* Базовая реализация FormContext
|
|
11
|
-
*
|
|
12
|
-
* Предоставляет:
|
|
13
|
-
* - `form` - типизированный Proxy-доступ к форме
|
|
14
|
-
* - `setFieldValue` - безопасная установка значения (emitEvent: false)
|
|
15
|
-
*/
|
|
16
|
-
export declare class FormContextImpl<TForm> implements FormContext<TForm> {
|
|
17
|
-
/**
|
|
18
|
-
* Форма с типизированным Proxy-доступом к полям
|
|
19
|
-
*/
|
|
20
|
-
readonly form: FormProxy<TForm>;
|
|
21
|
-
protected readonly _groupNode: GroupNode<TForm>;
|
|
22
|
-
constructor(groupNode: GroupNode<TForm>);
|
|
23
|
-
/**
|
|
24
|
-
* Безопасно установить значение поля по строковому пути
|
|
25
|
-
*
|
|
26
|
-
* Автоматически использует emitEvent: false для предотвращения циклов
|
|
27
|
-
*/
|
|
28
|
-
setFieldValue(path: string, value: unknown): void;
|
|
29
|
-
}
|