@reformer/core 11.0.0-beta.6 → 11.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/README.md +7 -3
- package/dist/behaviors.js +216 -179
- package/dist/create-model-BBRHhHwK.js +30 -0
- package/dist/en-CjAqn7h0.js +41 -0
- package/dist/form/behaviors/collections.d.ts +14 -1
- package/dist/form/behaviors/context.d.ts +18 -2
- package/dist/form/behaviors/index.d.ts +3 -1
- package/dist/form/behaviors/internals.d.ts +9 -1
- package/dist/form/behaviors/schema-operators.d.ts +76 -0
- package/dist/form/behaviors/types.d.ts +15 -3
- package/dist/form/create-core-form.d.ts +5 -3
- package/dist/form/create-form.d.ts +28 -53
- package/dist/form/form-bundle.d.ts +136 -0
- package/dist/form/index.d.ts +6 -1
- package/dist/form/nodes/field-node.d.ts +2 -2
- package/dist/form/nodes/group-node.d.ts +1 -1
- package/dist/form/nodes/model-array-node.d.ts +10 -5
- package/dist/form/schema-controller.d.ts +137 -0
- package/dist/form/schema-subtree.d.ts +28 -0
- package/dist/form/signal-node-registry.d.ts +22 -16
- package/dist/form/types/contracts.d.ts +6 -0
- package/dist/form/types/deep-schema.d.ts +2 -2
- package/dist/form/types/form-proxy.d.ts +1 -1
- package/dist/form/types/schema-node.d.ts +37 -12
- package/dist/form/types/validation-schema.d.ts +13 -1
- package/dist/form/validation/context.d.ts +6 -1
- package/dist/form/validation/index.d.ts +1 -1
- package/dist/form/validation/operators.d.ts +74 -7
- package/dist/form/validation/types.d.ts +2 -1
- package/dist/form/validators/validation-error.d.ts +8 -0
- package/dist/i18n/descriptor.d.ts +54 -0
- package/dist/i18n/en.json.d.ts +45 -0
- package/dist/i18n/loader.d.ts +71 -0
- package/dist/i18n/locale-store.d.ts +39 -0
- package/dist/i18n/locale.d.ts +90 -0
- package/dist/i18n/message-format.d.ts +116 -0
- package/dist/i18n/resolve-localized.d.ts +17 -0
- package/dist/i18n/ru.json.d.ts +45 -0
- package/dist/i18n/translator.d.ts +50 -0
- package/dist/i18n/validation-message.d.ts +18 -0
- package/dist/i18n.d.ts +31 -0
- package/dist/i18n.js +303 -0
- package/dist/index-BrNkQj1y.js +105 -0
- package/dist/index.js +737 -743
- package/dist/loader-Dv_Hl7JC.js +216 -0
- package/dist/locale/en.d.ts +2 -0
- package/dist/locale/en.js +5 -0
- package/dist/locale/en.json +42 -0
- package/dist/locale/index.d.ts +18 -0
- package/dist/locale/ru.d.ts +2 -0
- package/dist/locale/ru.js +41 -0
- package/dist/locale/ru.json +42 -0
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +9 -0
- package/dist/model/create-model.d.ts +17 -3
- package/dist/model/index.d.ts +8 -3
- package/dist/model/model-nodes.d.ts +67 -4
- package/dist/model/model-signals-proxy.d.ts +33 -1
- package/dist/model/model-value-proxy.d.ts +76 -0
- package/dist/model/types.d.ts +26 -9
- package/dist/model-value-proxy-caTmAiUd.js +419 -0
- package/dist/model.js +21 -17
- package/dist/node-BeV_lV5i.js +100 -0
- package/dist/platforms/react/form-bundle-context.d.ts +27 -0
- package/dist/platforms/react/hooks/types.d.ts +6 -3
- package/dist/platforms/react/hooks/useFormControlValue.d.ts +2 -1
- package/dist/platforms/react/i18n/context.d.ts +13 -0
- package/dist/platforms/react/i18n/hooks.d.ts +59 -0
- package/dist/platforms/react/i18n/provider.d.ts +52 -0
- package/dist/platforms/react/index.d.ts +1 -0
- package/dist/strategy-DgzELWno.js +204 -0
- package/dist/validation-error-B-U3RsV0.js +11 -0
- package/dist/validation.js +7 -6
- package/dist/validators/email.js +5 -8
- package/dist/validators/future-date.js +8 -11
- package/dist/validators/integer.js +4 -7
- package/dist/validators/is-date.js +5 -8
- package/dist/validators/is-number.js +4 -7
- package/dist/validators/max-age.js +8 -11
- package/dist/validators/max-date.js +8 -11
- package/dist/validators/max-length.js +5 -8
- package/dist/validators/max.js +4 -7
- package/dist/validators/min-age.js +8 -11
- package/dist/validators/min-date.js +8 -11
- package/dist/validators/min-length.js +5 -8
- package/dist/validators/min.js +4 -7
- package/dist/validators/multiple-of.js +5 -8
- package/dist/validators/non-negative.js +4 -7
- package/dist/validators/non-zero.js +4 -7
- package/dist/validators/past-date.js +8 -11
- package/dist/validators/pattern.js +5 -8
- package/dist/validators/phone.js +6 -9
- package/dist/validators/required.js +4 -7
- package/dist/validators/url.js +9 -14
- package/dist/validators.js +84 -106
- package/docs/llms/03-api-signatures.md +10 -4
- package/docs/llms/09-formschema.md +5 -5
- package/docs/llms/10-arrays.md +52 -3
- package/docs/llms/16-ui-components.md +2 -2
- package/docs/llms/18-conditional-fields.md +1 -1
- package/docs/llms/21-array-operations.md +26 -0
- package/docs/llms/28-submit-and-reset.md +3 -3
- package/docs/llms/29-async-preload.md +4 -4
- package/docs/llms/33-validation-strategy.md +2 -2
- package/docs/llms/34-i18n.md +272 -0
- package/docs/llms/35-unified-contract.md +246 -0
- package/llms-index.json +1 -1
- package/llms.txt +2746 -229
- package/package.json +22 -3
- package/dist/create-model-Dxh9cfLp.js +0 -97
- package/dist/model-signals-proxy-mV3WGdlO.js +0 -233
- package/dist/node-DGEFMTQu.js +0 -18
- package/dist/strategy-DA3JwxsR.js +0 -170
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ npm install @reformer/core@beta # Active development is underway, so you can try
|
|
|
31
31
|
## Quick Start
|
|
32
32
|
|
|
33
33
|
ReFormer is built around the **M1 architecture**: a reactive `FormModel` owns the values, a layout
|
|
34
|
-
schema binds field config (component / props) to the model's signals, and `
|
|
34
|
+
schema binds field config (component / props) to the model's signals, and `createFormFromModel({ model, schema })`
|
|
35
35
|
wires them into a typed form. Validation is a **separate** ambient contract — `defineValidationSchema`,
|
|
36
36
|
run on demand by `validateModel(model, schema)` — so the layout schema carries no validators.
|
|
37
37
|
|
|
@@ -39,7 +39,8 @@ run on demand by `validateModel(model, schema)` — so the layout schema carries
|
|
|
39
39
|
import { useMemo } from 'react';
|
|
40
40
|
import {
|
|
41
41
|
createModel,
|
|
42
|
-
|
|
42
|
+
createFormFromModel,
|
|
43
|
+
createLegacyForm,
|
|
43
44
|
useFormControl,
|
|
44
45
|
type FieldNode,
|
|
45
46
|
type ValidationError,
|
|
@@ -121,7 +122,10 @@ const behavior = defineFormBehavior<RegistrationForm>(({ model, form }) => {
|
|
|
121
122
|
|
|
122
123
|
// 6. Registration form component
|
|
123
124
|
function RegistrationFormExample() {
|
|
124
|
-
const form = useMemo(
|
|
125
|
+
const form = useMemo(
|
|
126
|
+
() => createFormFromModel<RegistrationForm>({ model, schema, behavior }),
|
|
127
|
+
[]
|
|
128
|
+
);
|
|
125
129
|
|
|
126
130
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
127
131
|
e.preventDefault();
|
package/dist/behaviors.js
CHANGED
|
@@ -1,60 +1,72 @@
|
|
|
1
|
-
import { effect as
|
|
2
|
-
import { d as $, a as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { effect as H } from "@preact/signals-core";
|
|
2
|
+
import { d as $, a as P, w as M, t as B, r as T, s as L, b as N } from "./behaviors-value-C7dSEhCc.js";
|
|
3
|
+
import { c as U, e as q } from "./node-BeV_lV5i.js";
|
|
4
|
+
import { j as z, i as J, c as E, u as S, h as b, m as _, g as K } from "./model-value-proxy-caTmAiUd.js";
|
|
5
|
+
import { g as v } from "./signal-node-registry-tiwel-TV.js";
|
|
6
|
+
let m = null;
|
|
7
|
+
function k(e) {
|
|
8
|
+
if (!m)
|
|
8
9
|
throw new Error(
|
|
9
10
|
`[@reformer/core/behaviors] "${e}" вызван вне defineFormBehavior(...) — операторы поведения можно вызывать только внутри схемы.`
|
|
10
11
|
);
|
|
11
|
-
return
|
|
12
|
+
return m;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
14
|
+
function a(e) {
|
|
15
|
+
k("onDispose").cleanups.push(e);
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
function g(e) {
|
|
18
|
+
m?.cleanups.push(e);
|
|
19
|
+
}
|
|
20
|
+
function ie() {
|
|
21
|
+
const e = k("getScope");
|
|
22
|
+
return x(e);
|
|
19
23
|
}
|
|
20
|
-
function
|
|
24
|
+
function F(e = "getController") {
|
|
25
|
+
return k(e).controller;
|
|
26
|
+
}
|
|
27
|
+
const x = (e) => ({
|
|
28
|
+
model: e.model,
|
|
29
|
+
form: e.form,
|
|
30
|
+
schema: e.controller.scopeOf(e.model)
|
|
31
|
+
});
|
|
32
|
+
function Q(e) {
|
|
21
33
|
return {
|
|
22
|
-
__run(t, n) {
|
|
23
|
-
const
|
|
24
|
-
|
|
34
|
+
__run(t, n, o = U()) {
|
|
35
|
+
const r = { cleanups: [], model: t, form: n, controller: o }, c = m;
|
|
36
|
+
m = r;
|
|
25
37
|
try {
|
|
26
|
-
e(
|
|
38
|
+
e(x(r));
|
|
27
39
|
} finally {
|
|
28
|
-
|
|
40
|
+
m = c;
|
|
29
41
|
}
|
|
30
42
|
return () => {
|
|
31
|
-
for (const
|
|
43
|
+
for (const s of r.cleanups) s();
|
|
32
44
|
};
|
|
33
45
|
}
|
|
34
46
|
};
|
|
35
47
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
48
|
+
function p(e) {
|
|
49
|
+
a(H(e));
|
|
38
50
|
}
|
|
39
|
-
function
|
|
51
|
+
function O(e) {
|
|
40
52
|
$(e);
|
|
41
53
|
}
|
|
42
|
-
const
|
|
43
|
-
function
|
|
54
|
+
const C = (e) => typeof e == "object" && e !== null && typeof e.peek == "function" && !J(e), y = (e) => C(e) || z(e), W = (e) => Array.isArray(e) ? e : [e];
|
|
55
|
+
function j(e) {
|
|
44
56
|
const t = {};
|
|
45
57
|
for (const n of Object.keys(e)) {
|
|
46
58
|
const o = e[n];
|
|
47
|
-
t[n] =
|
|
59
|
+
t[n] = y(o) ? o.value : j(o);
|
|
48
60
|
}
|
|
49
61
|
return t;
|
|
50
62
|
}
|
|
51
|
-
function
|
|
63
|
+
function A(e, t) {
|
|
52
64
|
for (const n of Object.keys(e)) {
|
|
53
65
|
const o = e[n];
|
|
54
|
-
|
|
66
|
+
y(o) ? o.value = t?.[n] : A(o, t?.[n] ?? {});
|
|
55
67
|
}
|
|
56
68
|
}
|
|
57
|
-
function
|
|
69
|
+
function D(e) {
|
|
58
70
|
return (t) => {
|
|
59
71
|
try {
|
|
60
72
|
t();
|
|
@@ -69,18 +81,10 @@ function S(e) {
|
|
|
69
81
|
}
|
|
70
82
|
};
|
|
71
83
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (!e) return;
|
|
77
|
-
const { form: t } = y();
|
|
78
|
-
return t.getFieldByPath(e);
|
|
79
|
-
}
|
|
80
|
-
function X(e, t, n) {
|
|
81
|
-
k(e), s(() => x(e));
|
|
82
|
-
const o = S(e);
|
|
83
|
-
h(() => {
|
|
84
|
+
function ae(e, t, n) {
|
|
85
|
+
E(e), a(() => S(e));
|
|
86
|
+
const o = D(e);
|
|
87
|
+
p(() => {
|
|
84
88
|
if (n?.when && !n.when()) return;
|
|
85
89
|
const r = t();
|
|
86
90
|
e.peek() !== r && o(() => {
|
|
@@ -88,96 +92,83 @@ function X(e, t, n) {
|
|
|
88
92
|
});
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
const r =
|
|
94
|
-
|
|
95
|
-
const c = e.map((
|
|
95
|
+
function fe(e, t, n, o) {
|
|
96
|
+
E(t), a(() => S(t));
|
|
97
|
+
const r = D(t);
|
|
98
|
+
p(() => {
|
|
99
|
+
const c = e.map((i) => i.value);
|
|
96
100
|
if (o?.when && !o.when(...c)) return;
|
|
97
|
-
const
|
|
98
|
-
t.peek() !==
|
|
99
|
-
t.value =
|
|
101
|
+
const s = n(...c);
|
|
102
|
+
t.peek() !== s && r(() => {
|
|
103
|
+
t.value = s;
|
|
100
104
|
});
|
|
101
105
|
});
|
|
102
106
|
}
|
|
103
|
-
function
|
|
104
|
-
if (
|
|
105
|
-
|
|
107
|
+
function le(e, t, n) {
|
|
108
|
+
if (y(e) && y(t)) {
|
|
109
|
+
a(P(e, t, n));
|
|
106
110
|
return;
|
|
107
111
|
}
|
|
108
112
|
const o = e, r = t;
|
|
109
|
-
|
|
110
|
-
const c =
|
|
111
|
-
n?.when && !n.when() ||
|
|
113
|
+
p(() => {
|
|
114
|
+
const c = j(o);
|
|
115
|
+
n?.when && !n.when() || O(() => A(r, c));
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
|
-
function
|
|
118
|
+
function X(e, t, n) {
|
|
115
119
|
let o;
|
|
116
120
|
const r = (c) => {
|
|
117
121
|
o?.abort(), o = new AbortController();
|
|
118
|
-
const { signal:
|
|
119
|
-
$(() => t(c, { signal:
|
|
122
|
+
const { signal: s } = o;
|
|
123
|
+
$(() => t(c, { signal: s }));
|
|
120
124
|
};
|
|
121
125
|
if (!n?.debounce)
|
|
122
|
-
|
|
126
|
+
a(M(e, r, { immediate: n?.immediate }));
|
|
123
127
|
else {
|
|
124
128
|
let c;
|
|
125
|
-
const
|
|
129
|
+
const s = M(
|
|
126
130
|
e,
|
|
127
|
-
(
|
|
128
|
-
c && clearTimeout(c), c = setTimeout(() => r(
|
|
131
|
+
(i) => {
|
|
132
|
+
c && clearTimeout(c), c = setTimeout(() => r(i), n.debounce);
|
|
129
133
|
},
|
|
130
134
|
{ immediate: n?.immediate }
|
|
131
135
|
);
|
|
132
|
-
|
|
133
|
-
c && clearTimeout(c),
|
|
136
|
+
a(() => {
|
|
137
|
+
c && clearTimeout(c), s();
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
|
-
|
|
140
|
+
a(() => o?.abort());
|
|
137
141
|
}
|
|
138
|
-
function
|
|
139
|
-
for (const o of
|
|
140
|
-
|
|
142
|
+
function Y(e, t, n) {
|
|
143
|
+
for (const o of W(e))
|
|
144
|
+
C(o) ? a(q(o, t, n)) : Z(o, t, n);
|
|
141
145
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
146
|
+
function ue(e, t, n) {
|
|
147
|
+
Y(e, () => !t(), n);
|
|
144
148
|
}
|
|
145
|
-
function
|
|
146
|
-
const o =
|
|
147
|
-
o &&
|
|
149
|
+
function Z(e, t, n) {
|
|
150
|
+
const o = v(e);
|
|
151
|
+
o && p(() => {
|
|
148
152
|
const r = t();
|
|
149
|
-
|
|
153
|
+
O(() => {
|
|
150
154
|
r ? o.enable() : (o.disable(), n?.resetOnDisable && o.reset());
|
|
151
155
|
});
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
158
|
+
function de(e, t) {
|
|
159
|
+
a(B(e, t));
|
|
156
160
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
161
|
+
function me(e, t, n) {
|
|
162
|
+
a(T(e, t, n));
|
|
159
163
|
}
|
|
160
|
-
function
|
|
161
|
-
|
|
164
|
+
function pe(e, t, n) {
|
|
165
|
+
a(L(e, t, n));
|
|
162
166
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
167
|
+
function he(e, t) {
|
|
168
|
+
a(N(e, t));
|
|
165
169
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{},
|
|
169
|
-
{
|
|
170
|
-
get: (t, n) => {
|
|
171
|
-
if (n === "$") return e;
|
|
172
|
-
if (typeof n != "string") return;
|
|
173
|
-
const o = e[n];
|
|
174
|
-
if (o != null)
|
|
175
|
-
return m(o) ? o.value : V(o);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
function N(e) {
|
|
170
|
+
const I = (e) => e.__path ?? "?", R = (e) => void F(e);
|
|
171
|
+
function ee(e) {
|
|
181
172
|
return new Proxy(
|
|
182
173
|
{},
|
|
183
174
|
{
|
|
@@ -192,111 +183,157 @@ function N(e) {
|
|
|
192
183
|
}
|
|
193
184
|
);
|
|
194
185
|
}
|
|
195
|
-
function
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const l = c.at(u);
|
|
207
|
-
if (l != null && (w.add(l), !a.has(l))) {
|
|
208
|
-
const b = i?.at?.(u) ?? N(r);
|
|
209
|
-
a.set(l, t.__run(l, b));
|
|
186
|
+
function te(e, t) {
|
|
187
|
+
const n = F("applyEach"), o = b(e);
|
|
188
|
+
if (!o) return;
|
|
189
|
+
const r = _(o), c = v(o), s = typeof c?.at == "function" ? c : void 0, i = s?.length, f = /* @__PURE__ */ new Map();
|
|
190
|
+
p(() => {
|
|
191
|
+
const h = i ? i.value : r.length, d = /* @__PURE__ */ new Set();
|
|
192
|
+
for (let l = 0; l < h; l++) {
|
|
193
|
+
const u = r.at(l);
|
|
194
|
+
if (u != null && (d.add(u), !f.has(u))) {
|
|
195
|
+
const G = s?.at?.(l) ?? ee(I(o));
|
|
196
|
+
f.set(u, t.__run(u, G, n));
|
|
210
197
|
}
|
|
211
198
|
}
|
|
212
|
-
for (const [
|
|
213
|
-
|
|
214
|
-
}),
|
|
215
|
-
for (const
|
|
216
|
-
|
|
199
|
+
for (const [l, u] of f)
|
|
200
|
+
d.has(l) || (u(), f.delete(l));
|
|
201
|
+
}), a(() => {
|
|
202
|
+
for (const h of f.values()) h();
|
|
203
|
+
f.clear();
|
|
217
204
|
});
|
|
218
205
|
}
|
|
219
|
-
function
|
|
206
|
+
function w(e) {
|
|
220
207
|
if (e == null || typeof e != "object") return;
|
|
221
208
|
const t = e;
|
|
222
209
|
if (typeof t.at == "function" && typeof t.length == "number") {
|
|
223
210
|
const n = t.length;
|
|
224
|
-
for (let o = 0; o < n; o++)
|
|
211
|
+
for (let o = 0; o < n; o++) w(t.at(o));
|
|
225
212
|
return;
|
|
226
213
|
}
|
|
227
|
-
for (const n of Object.keys(e))
|
|
214
|
+
for (const n of Object.keys(e)) w(e[n]);
|
|
228
215
|
}
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
216
|
+
function ye(e, t) {
|
|
217
|
+
R("exclusiveFlag");
|
|
218
|
+
const n = b(e);
|
|
219
|
+
if (!n) return;
|
|
220
|
+
const o = _(n);
|
|
221
|
+
te(
|
|
222
|
+
n,
|
|
223
|
+
Q(({ model: r }) => {
|
|
224
|
+
X(t(r), (c) => {
|
|
225
|
+
if (c)
|
|
226
|
+
for (let s = 0; s < o.length; s++) {
|
|
227
|
+
const i = o.at(s);
|
|
228
|
+
if (i && i !== r) {
|
|
229
|
+
const f = t(i);
|
|
230
|
+
f.peek() && (f.value = !1);
|
|
243
231
|
}
|
|
244
232
|
}
|
|
245
233
|
});
|
|
246
234
|
})
|
|
247
235
|
);
|
|
248
236
|
}
|
|
249
|
-
function
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
let
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
let
|
|
260
|
-
for (const { index:
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
263
|
-
for (const [l,
|
|
264
|
-
|
|
237
|
+
function _e(e, t) {
|
|
238
|
+
R("aggregateInto");
|
|
239
|
+
const n = b(e);
|
|
240
|
+
if (!n) return;
|
|
241
|
+
const o = _(n);
|
|
242
|
+
let r = !1, c = 0;
|
|
243
|
+
p(() => {
|
|
244
|
+
w(o), !r && (r = !0, O(() => {
|
|
245
|
+
r = !1;
|
|
246
|
+
const s = t(o.toArray());
|
|
247
|
+
let i = !1;
|
|
248
|
+
for (const { index: f, patch: h } of s) {
|
|
249
|
+
const d = o.at(f);
|
|
250
|
+
if (d)
|
|
251
|
+
for (const [l, u] of Object.entries(h))
|
|
252
|
+
d[l] !== u && (d[l] = u, i = !0);
|
|
265
253
|
}
|
|
266
|
-
if (
|
|
267
|
-
throw
|
|
268
|
-
`[@reformer/core/behaviors] aggregateInto("${
|
|
254
|
+
if (c = i ? c + 1 : 0, c > 50)
|
|
255
|
+
throw c = 0, new Error(
|
|
256
|
+
`[@reformer/core/behaviors] aggregateInto("${I(n)}"): запись не сходится (>50 проходов) — derive должна быть идемпотентной на фикспоинте.`
|
|
269
257
|
);
|
|
270
258
|
}));
|
|
271
259
|
});
|
|
272
260
|
}
|
|
273
|
-
function
|
|
274
|
-
const
|
|
275
|
-
for (const o of
|
|
276
|
-
const r = o
|
|
277
|
-
if (!
|
|
278
|
-
const
|
|
279
|
-
|
|
261
|
+
function ge(e, t) {
|
|
262
|
+
const n = F("apply");
|
|
263
|
+
for (const o of W(e)) {
|
|
264
|
+
const r = K(o);
|
|
265
|
+
if (!r) continue;
|
|
266
|
+
const c = _(r), s = v(r), i = s ? s.getProxy?.() ?? s : void 0;
|
|
267
|
+
a(t.__run(c, i, n));
|
|
280
268
|
}
|
|
281
269
|
}
|
|
270
|
+
function we(e, t) {
|
|
271
|
+
const { conditionRegistry: n } = e.__overrideMaps;
|
|
272
|
+
n.set(e.__selector, t), g(() => {
|
|
273
|
+
n.get(e.__selector) === t && n.delete(e.__selector);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function be(e, t, n) {
|
|
277
|
+
const { callbackRegistry: o } = e.__overrideMaps;
|
|
278
|
+
let r = o.get(e.__selector);
|
|
279
|
+
r || (r = /* @__PURE__ */ new Map(), o.set(e.__selector, r)), r.set(t, n);
|
|
280
|
+
const c = r;
|
|
281
|
+
g(() => {
|
|
282
|
+
c.get(t) === n && c.delete(t);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function ve(e, t) {
|
|
286
|
+
const { effectRegistry: n } = e.__overrideMaps;
|
|
287
|
+
n.push(t), g(() => {
|
|
288
|
+
const o = n.indexOf(t);
|
|
289
|
+
o !== -1 && n.splice(o, 1);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function V(e, t, n) {
|
|
293
|
+
const { lifecycleRegistry: o } = e.__overrideMaps;
|
|
294
|
+
o.set(e.__selector, {
|
|
295
|
+
...o.get(e.__selector) ?? {},
|
|
296
|
+
[t]: n
|
|
297
|
+
}), g(() => {
|
|
298
|
+
const r = o.get(e.__selector);
|
|
299
|
+
if (r?.[t] !== n) return;
|
|
300
|
+
const c = { ...r };
|
|
301
|
+
delete c[t], Object.keys(c).length === 0 ? o.delete(e.__selector) : o.set(e.__selector, c);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function ke(e, t) {
|
|
305
|
+
t();
|
|
306
|
+
}
|
|
307
|
+
function Fe(e, t) {
|
|
308
|
+
V(e, "onMount", t);
|
|
309
|
+
}
|
|
310
|
+
function Oe(e, t) {
|
|
311
|
+
V(e, "onUnmount", t);
|
|
312
|
+
}
|
|
282
313
|
export {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
314
|
+
_e as aggregateInto,
|
|
315
|
+
ge as apply,
|
|
316
|
+
te as applyEach,
|
|
317
|
+
ae as compute,
|
|
318
|
+
fe as computeFrom,
|
|
319
|
+
le as copyFrom,
|
|
320
|
+
O as defer,
|
|
321
|
+
Q as defineFormBehavior,
|
|
322
|
+
ue as disableWhen,
|
|
323
|
+
p as effect,
|
|
324
|
+
Y as enableWhen,
|
|
325
|
+
ye as exclusiveFlag,
|
|
326
|
+
ie as getScope,
|
|
327
|
+
we as hideWhen,
|
|
328
|
+
X as onChange,
|
|
329
|
+
be as onComponentEvent,
|
|
330
|
+
a as onDispose,
|
|
331
|
+
ke as onInit,
|
|
332
|
+
Fe as onMount,
|
|
333
|
+
Oe as onUnmount,
|
|
334
|
+
ve as renderEffect,
|
|
335
|
+
me as resetWhen,
|
|
336
|
+
he as revalidateWhen,
|
|
337
|
+
pe as syncFields,
|
|
338
|
+
de as transformValue
|
|
302
339
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { G as f, e as c, r as t, s } from "./model-value-proxy-caTmAiUd.js";
|
|
2
|
+
function n(o, e, a) {
|
|
3
|
+
if (o.kind === "leaf") {
|
|
4
|
+
e(o.signal);
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (o.kind === "group") {
|
|
8
|
+
for (const r of o.children.values()) n(r, e, a);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
a && e(s(o));
|
|
12
|
+
for (const r of o.items.value) n(r, e, a);
|
|
13
|
+
}
|
|
14
|
+
function u(o, e) {
|
|
15
|
+
const a = t.get(o);
|
|
16
|
+
a && n(a, e, !1);
|
|
17
|
+
}
|
|
18
|
+
function i(o, e) {
|
|
19
|
+
const a = t.get(o);
|
|
20
|
+
a && n(a, e, !0);
|
|
21
|
+
}
|
|
22
|
+
function g(o) {
|
|
23
|
+
const e = new f(o, "");
|
|
24
|
+
return c(e);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
i as a,
|
|
28
|
+
g as c,
|
|
29
|
+
u as e
|
|
30
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const a = {
|
|
2
|
+
"format.fileSize.b": "{value} B",
|
|
3
|
+
"format.fileSize.kb": "{value} KB",
|
|
4
|
+
"format.fileSize.mb": "{value} MB",
|
|
5
|
+
"format.fileSize.gb": "{value} GB",
|
|
6
|
+
"format.fileSize.tb": "{value} TB",
|
|
7
|
+
"validation.required": "This field is required",
|
|
8
|
+
"validation.pattern": "Invalid format",
|
|
9
|
+
"validation.email": "Enter a valid email address",
|
|
10
|
+
"validation.url": "Enter a valid URL",
|
|
11
|
+
"validation.url_protocol": "The URL must use one of these protocols: {allowedProtocols}",
|
|
12
|
+
"validation.phone": "Enter a valid phone number",
|
|
13
|
+
"validation.min": "Must be at least {min}",
|
|
14
|
+
"validation.max": "Must be at most {max}",
|
|
15
|
+
"validation.minLength": "Enter at least {minLength, plural, one{# character} other{# characters}}",
|
|
16
|
+
"validation.maxLength": "Enter no more than {maxLength, plural, one{# character} other{# characters}}",
|
|
17
|
+
"validation.isNumber": "Enter a number",
|
|
18
|
+
"validation.integer": "Enter a whole number",
|
|
19
|
+
"validation.multipleOf": "Must be a multiple of {multipleOf}",
|
|
20
|
+
"validation.nonNegative": "Must not be negative",
|
|
21
|
+
"validation.nonZero": "Must not be zero",
|
|
22
|
+
"validation.date_invalid": "Enter a valid date",
|
|
23
|
+
"validation.date_min": "The date must not be earlier than {minDate}",
|
|
24
|
+
"validation.date_max": "The date must not be later than {maxDate}",
|
|
25
|
+
"validation.date_past": "The date must not be in the past",
|
|
26
|
+
"validation.date_future": "The date must not be in the future",
|
|
27
|
+
"validation.date_min_age": "Age must be at least {minAge}",
|
|
28
|
+
"validation.date_max_age": "Age must be at most {maxAge}",
|
|
29
|
+
"validation.fileType": "File {fileName} has a type that is not allowed. Allowed: {accept}",
|
|
30
|
+
"validation.maxFileSize": "File {fileName} is larger than {maxFileSize}",
|
|
31
|
+
"validation.minFileSize": "File {fileName} is smaller than {minFileSize}",
|
|
32
|
+
"validation.maxFiles": "No more than {maxFiles, plural, one{# file} other{# files}}",
|
|
33
|
+
"validation.minFiles": "At least {minFiles, plural, one{# file} other{# files}}",
|
|
34
|
+
"validation.maxTotalFileSize": "The total size of the files exceeds {maxTotalFileSize}",
|
|
35
|
+
"validation.fileExists": "File {fileName} has already been added",
|
|
36
|
+
"validation.uploadAborted": "Upload cancelled",
|
|
37
|
+
"validation.uploadFailed": "Failed to upload {fileName}"
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
a as m
|
|
41
|
+
};
|
|
@@ -12,10 +12,14 @@ import { FormBehavior } from './types';
|
|
|
12
12
|
* рендерится, а её сигналы зарегистрированы (`enableWhen` резолвит ноду). Без материализации доступ
|
|
13
13
|
* к `form.*` бросит понятную ошибку (см. {@link unmaterializedRowForm}).
|
|
14
14
|
*
|
|
15
|
+
* Работает на любой глубине: массив в корне, в группе и в строке другого массива — в схеме строки
|
|
16
|
+
* можно снова вызвать `applyEach`.
|
|
17
|
+
*
|
|
15
18
|
* @example
|
|
16
19
|
* applyEach(model.$.items, defineFormBehavior<Item>(({ model: row, form }) => {
|
|
17
20
|
* compute(row.$.lineTotal, () => row.qty * row.price); // value-op — всегда
|
|
18
21
|
* enableWhen(row.$.discount, () => row.qty > 10); // node-op — нужна материализация массива
|
|
22
|
+
* applyEach(row.$.phones, phoneBehavior); // массив внутри строки
|
|
19
23
|
* }));
|
|
20
24
|
*/
|
|
21
25
|
export declare function applyEach<TItem>(array: object, itemSchema: FormBehavior<TItem>): void;
|
|
@@ -46,5 +50,14 @@ export declare function aggregateInto<TItem>(array: object, derive: (rows: TItem
|
|
|
46
50
|
index: number;
|
|
47
51
|
patch: Partial<TItem>;
|
|
48
52
|
}>): void;
|
|
49
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Применить под-схему к одному или нескольким полям-группам (переиспользование).
|
|
55
|
+
*
|
|
56
|
+
* Под-схема получает scope группы: `model` — настоящая под-модель (`model.$.field`, чтение и
|
|
57
|
+
* запись значений, `get`/`set`/`patch`), `form` — нода группы. Цель — ручка группы
|
|
58
|
+
* (`model.$.address`); работает и в корневой схеме, и в схеме строки массива.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* apply([model.$.registrationAddress, model.$.residenceAddress], addressBehavior);
|
|
62
|
+
*/
|
|
50
63
|
export declare function apply<TField>(targets: object | object[], subSchema: FormBehavior<TField>): void;
|