@companix/formkit 0.0.14 → 0.0.15
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/bundle.es.js +125 -120
- package/dist/manager/manager.d.ts +1 -0
- package/package.json +1 -1
package/dist/bundle.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as h, Fragment as j, jsxs as M } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as P, useState as R, useContext as q, useEffect as p, useMemo as A, useCallback as $, useRef as T } from "react";
|
|
3
3
|
import L from "fast-deep-equal";
|
|
4
4
|
const D = P({}), B = (n) => {
|
|
5
|
-
const [, r] = R([]), e = q(D),
|
|
5
|
+
const [, r] = R([]), e = q(D), o = e.getForm(n);
|
|
6
6
|
return p(() => {
|
|
7
7
|
const { unsubscribe: t } = e.subscribeToForm(n, () => {
|
|
8
8
|
r([]);
|
|
@@ -10,18 +10,18 @@ const D = P({}), B = (n) => {
|
|
|
10
10
|
return () => {
|
|
11
11
|
t();
|
|
12
12
|
};
|
|
13
|
-
}, []),
|
|
13
|
+
}, []), o?.value;
|
|
14
14
|
}, N = ({ canActivate: n, name: r, children: e }) => {
|
|
15
|
-
const
|
|
16
|
-
return n(
|
|
15
|
+
const o = B(r);
|
|
16
|
+
return n(o) ? /* @__PURE__ */ h(j, { children: e }) : null;
|
|
17
17
|
}, z = ({ item: { Form: n }, name: r }) => {
|
|
18
|
-
const [, e] = R([]),
|
|
18
|
+
const [, e] = R([]), o = q(D), { unregistry: t } = A(() => o.registry(r, () => {
|
|
19
19
|
e([]);
|
|
20
20
|
}), []), f = $(
|
|
21
21
|
(y) => {
|
|
22
22
|
if (y && y.focus) {
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const v = o.getForm(r);
|
|
24
|
+
v.focus = () => {
|
|
25
25
|
y.focus();
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -31,41 +31,41 @@ const D = P({}), B = (n) => {
|
|
|
31
31
|
p(() => () => {
|
|
32
32
|
t();
|
|
33
33
|
}, []);
|
|
34
|
-
const { value:
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
const { value: b, error: x } = o.getForm(r);
|
|
35
|
+
return /* @__PURE__ */ h(
|
|
36
36
|
n,
|
|
37
37
|
{
|
|
38
38
|
field: {
|
|
39
|
-
value:
|
|
39
|
+
value: b,
|
|
40
40
|
onChange: (y) => {
|
|
41
|
-
|
|
41
|
+
o.onChange(r, y);
|
|
42
42
|
},
|
|
43
43
|
onBlur: () => {
|
|
44
44
|
},
|
|
45
45
|
ref: f
|
|
46
46
|
},
|
|
47
47
|
isDirty: !1,
|
|
48
|
-
error:
|
|
49
|
-
disabled:
|
|
48
|
+
error: x,
|
|
49
|
+
disabled: o.disabled
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
}, G = ({ item: n, path: r }) => {
|
|
53
|
-
const { getController: e, items:
|
|
53
|
+
const { getController: e, items: o } = n, t = q(D), f = A(() => {
|
|
54
54
|
const l = {};
|
|
55
|
-
return
|
|
56
|
-
l[g] =
|
|
55
|
+
return o.forEach(({ name: g, getForm: s }) => {
|
|
56
|
+
l[g] = s(g, () => a(g));
|
|
57
57
|
}), l;
|
|
58
|
-
}, []),
|
|
58
|
+
}, []), b = $(() => {
|
|
59
59
|
const l = [];
|
|
60
|
-
return
|
|
60
|
+
return o.forEach(({ name: g }) => {
|
|
61
61
|
t.getForm([...r, g].join(".")).value !== void 0 && l.push(g);
|
|
62
62
|
}), l;
|
|
63
|
-
}, []),
|
|
63
|
+
}, []), x = A(() => b(), []), [y, v] = R(x);
|
|
64
64
|
p(() => {
|
|
65
65
|
const { unregistry: l } = t.registryExtraForm(
|
|
66
|
-
|
|
66
|
+
o.map(({ name: g }) => [...r, g].join(".")),
|
|
67
67
|
() => {
|
|
68
|
-
|
|
68
|
+
v(b());
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
71
|
return () => {
|
|
@@ -74,92 +74,92 @@ const D = P({}), B = (n) => {
|
|
|
74
74
|
}, []);
|
|
75
75
|
const d = $(
|
|
76
76
|
(l) => {
|
|
77
|
-
f[l] && !y.includes(l) &&
|
|
77
|
+
f[l] && !y.includes(l) && v((g) => [...g, l]);
|
|
78
78
|
},
|
|
79
79
|
[y]
|
|
80
80
|
), a = $((l) => {
|
|
81
|
-
|
|
81
|
+
v((g) => g.filter((s) => s !== l));
|
|
82
82
|
}, []);
|
|
83
83
|
return /* @__PURE__ */ M(j, { children: [
|
|
84
84
|
y.map((l) => {
|
|
85
85
|
const g = f[l];
|
|
86
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ h(C, { path: r, scheme: [g] }, `param-form--${l}`);
|
|
87
87
|
}),
|
|
88
88
|
e(d, y)
|
|
89
89
|
] });
|
|
90
|
-
},
|
|
91
|
-
|
|
90
|
+
}, C = ({ scheme: n, path: r }) => /* @__PURE__ */ h(j, { children: n.map((e, o) => e.type === "layout" ? /* @__PURE__ */ h(e.Layout, { children: /* @__PURE__ */ h(C, { path: r, scheme: e.childs }) }, `layout-form--${o}-${r.length}`) : e.type === "context" ? /* @__PURE__ */ h(
|
|
91
|
+
C,
|
|
92
92
|
{
|
|
93
93
|
path: [...r, e.context],
|
|
94
94
|
scheme: e.childs
|
|
95
95
|
},
|
|
96
|
-
`context-form--${
|
|
97
|
-
) : e.type === "condition" ? /* @__PURE__ */
|
|
96
|
+
`context-form--${o}-${e.context}-${r.length}`
|
|
97
|
+
) : e.type === "condition" ? /* @__PURE__ */ h(
|
|
98
98
|
N,
|
|
99
99
|
{
|
|
100
100
|
name: e.depended,
|
|
101
101
|
canActivate: e.canActivate,
|
|
102
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ h(C, { path: r, scheme: e.childs })
|
|
103
103
|
},
|
|
104
|
-
`condition--${
|
|
105
|
-
) : e.type === "extra" ? /* @__PURE__ */
|
|
104
|
+
`condition--${o}-${e.depended}-${r.length}`
|
|
105
|
+
) : e.type === "extra" ? /* @__PURE__ */ h(G, { path: r, item: e }, `partial-item--${o}-${r.length}`) : /* @__PURE__ */ h(
|
|
106
106
|
z,
|
|
107
107
|
{
|
|
108
108
|
name: [...r, e.name].join("."),
|
|
109
109
|
item: e
|
|
110
110
|
},
|
|
111
|
-
`form-item--${
|
|
112
|
-
)) }),
|
|
111
|
+
`form-item--${o}-${e.name}-${r.length}`
|
|
112
|
+
)) }), V = (n, r, e, o) => {
|
|
113
113
|
n.forEach((t) => {
|
|
114
|
-
if (t.type === "form" &&
|
|
115
|
-
|
|
114
|
+
if (t.type === "form" && o(t, [...r, t.name].join("."), e[t.name]), t.type === "context") {
|
|
115
|
+
V(t.childs, [...r, t.context], e[t.context] ?? {}, o);
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
if (t.type === "layout" || t.type === "condition") {
|
|
119
|
-
|
|
119
|
+
V(t.childs, r, e, o);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
t.type === "extra" && t.items.forEach(({ getForm: f, name:
|
|
123
|
-
|
|
124
|
-
})], r, e,
|
|
122
|
+
t.type === "extra" && t.items.forEach(({ getForm: f, name: b }) => {
|
|
123
|
+
V([f(b, () => {
|
|
124
|
+
})], r, e, o);
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
|
-
},
|
|
127
|
+
}, E = ({ scheme: n, values: r, path: e, forms: o }) => {
|
|
128
128
|
n.forEach((t) => {
|
|
129
129
|
if (t.type === "form") {
|
|
130
130
|
const f = [...e, t.name].join(".");
|
|
131
|
-
|
|
131
|
+
o[f].value !== void 0 && (r[t.name] = o[f].value);
|
|
132
132
|
}
|
|
133
133
|
if (t.type === "context") {
|
|
134
|
-
r[t.context] = {},
|
|
134
|
+
r[t.context] = {}, E({
|
|
135
135
|
scheme: t.childs,
|
|
136
136
|
path: [...e, t.context],
|
|
137
137
|
values: r[t.context],
|
|
138
|
-
forms:
|
|
138
|
+
forms: o
|
|
139
139
|
});
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
if (t.type === "layout") {
|
|
143
|
-
|
|
143
|
+
E({ scheme: t.childs, path: e, values: r, forms: o });
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
if (t.type === "condition") {
|
|
147
|
-
const f =
|
|
147
|
+
const f = o[t.depended]?.value;
|
|
148
148
|
if (t.canActivate(f)) {
|
|
149
|
-
|
|
149
|
+
E({ scheme: t.childs, path: e, values: r, forms: o });
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
t.type === "extra" && t.items.forEach(({ getForm: f, name:
|
|
154
|
-
|
|
155
|
-
})], path: e, values: r, forms:
|
|
153
|
+
t.type === "extra" && t.items.forEach(({ getForm: f, name: b }) => {
|
|
154
|
+
E({ scheme: [f(b, () => {
|
|
155
|
+
})], path: e, values: r, forms: o });
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
}, w = (n, r) => {
|
|
159
159
|
const e = {};
|
|
160
|
-
return
|
|
160
|
+
return E({ scheme: n, path: [], values: e, forms: r }), e;
|
|
161
161
|
}, H = (n, r) => {
|
|
162
|
-
const { onSubmit: e, onEqual:
|
|
162
|
+
const { onSubmit: e, onEqual: o, disabled: t, onDirty: f, onFormDirty: b, onChangeEvent: x, defaultValues: y } = r, v = { onSubmit: e }, d = {
|
|
163
163
|
isActive: !1,
|
|
164
164
|
isSubmitted: !1,
|
|
165
165
|
dirtyCount: 0
|
|
@@ -167,27 +167,27 @@ const D = P({}), B = (n) => {
|
|
|
167
167
|
subscribers: [],
|
|
168
168
|
names: {}
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
V(n, [], y ?? {}, (s, u, i) => {
|
|
171
171
|
a[u] = {
|
|
172
172
|
error: null,
|
|
173
173
|
isDirty: !1,
|
|
174
174
|
value: i,
|
|
175
175
|
// текущее (динамическое) состояние поля. Значение равно переданному дефолтному, либо: определяется как дефолтное значение компонента формы в момент его монтирования, а до этого - undefined.
|
|
176
|
-
startValue: i ??
|
|
176
|
+
startValue: i ?? s.defaultValue,
|
|
177
177
|
// начальное (стартовое) значение (равно переданному дефолтному, либо значению формы по умолчанию). Исходя из сравнения текущего значения со стартовым, можно понять, модифицированно ли поле
|
|
178
|
-
defaultValue:
|
|
178
|
+
defaultValue: s.defaultValue,
|
|
179
179
|
// дефолтное значение компонента формы
|
|
180
180
|
rerender: () => {
|
|
181
181
|
},
|
|
182
182
|
subscribers: [],
|
|
183
|
-
validate:
|
|
183
|
+
validate: s.validate
|
|
184
184
|
};
|
|
185
185
|
});
|
|
186
|
-
const g = (
|
|
187
|
-
f?.({ name:
|
|
186
|
+
const g = (s, u) => {
|
|
187
|
+
f?.({ name: s, isDirty: u }), u && d.dirtyCount === 0 && b?.(!0), !u && d.dirtyCount === 1 && b?.(!1), d.dirtyCount += u ? 1 : -1;
|
|
188
188
|
};
|
|
189
189
|
return {
|
|
190
|
-
submitRef:
|
|
190
|
+
submitRef: v,
|
|
191
191
|
scheme: n,
|
|
192
192
|
disabled: t,
|
|
193
193
|
activate() {
|
|
@@ -196,20 +196,20 @@ const D = P({}), B = (n) => {
|
|
|
196
196
|
disactivate() {
|
|
197
197
|
d.isActive = !1;
|
|
198
198
|
},
|
|
199
|
-
setError(
|
|
200
|
-
const i = this.getForm(
|
|
199
|
+
setError(s, u) {
|
|
200
|
+
const i = this.getForm(s);
|
|
201
201
|
i && (i.error = {
|
|
202
202
|
error: !0,
|
|
203
203
|
messages: [u.message]
|
|
204
204
|
}, i.rerender());
|
|
205
205
|
},
|
|
206
|
-
setFocus(
|
|
207
|
-
const u = this.getForm(
|
|
206
|
+
setFocus(s) {
|
|
207
|
+
const u = this.getForm(s);
|
|
208
208
|
u && u.focus && u.focus();
|
|
209
209
|
},
|
|
210
|
-
setValue(
|
|
211
|
-
const i = this.getForm(
|
|
212
|
-
i && i.value !== u && this.onChange(
|
|
210
|
+
setValue(s, u) {
|
|
211
|
+
const i = this.getForm(s);
|
|
212
|
+
i && i.value !== u && this.onChange(s, u);
|
|
213
213
|
},
|
|
214
214
|
getValues() {
|
|
215
215
|
return w(n, a);
|
|
@@ -218,71 +218,76 @@ const D = P({}), B = (n) => {
|
|
|
218
218
|
if (t)
|
|
219
219
|
return;
|
|
220
220
|
d.isSubmitted = !0;
|
|
221
|
-
let
|
|
221
|
+
let s = !1, u = !1;
|
|
222
222
|
for (const i in a) {
|
|
223
223
|
const c = a[i];
|
|
224
224
|
if (c.value !== void 0) {
|
|
225
|
-
const
|
|
226
|
-
|
|
225
|
+
const F = c.validate(c.value);
|
|
226
|
+
F && (u = !0, c.error = F, c.rerender(), !s && c.focus && (c.focus(), s = !0));
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
if (!u) {
|
|
230
230
|
if (d.dirtyCount === 0) {
|
|
231
|
-
|
|
231
|
+
o?.();
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
234
|
const i = w(n, a);
|
|
235
|
-
await
|
|
236
|
-
setError: (c,
|
|
237
|
-
const
|
|
238
|
-
|
|
235
|
+
await v.onSubmit(i, {
|
|
236
|
+
setError: (c, F) => {
|
|
237
|
+
const m = this.getForm(c);
|
|
238
|
+
m.error = {
|
|
239
239
|
error: !0,
|
|
240
|
-
messages: [
|
|
241
|
-
},
|
|
240
|
+
messages: [F.message]
|
|
241
|
+
}, m.rerender();
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
|
-
reset(
|
|
247
|
-
|
|
248
|
-
if (
|
|
246
|
+
reset(s, { asDirty: u }) {
|
|
247
|
+
V(n, [], s, (i, c, F) => {
|
|
248
|
+
if (F === void 0 && a[c].value === void 0)
|
|
249
249
|
return;
|
|
250
|
-
if (l.names[c] &&
|
|
251
|
-
a[c].value =
|
|
250
|
+
if (l.names[c] && F === void 0) {
|
|
251
|
+
a[c].value = void 0;
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
254
|
-
const
|
|
255
|
-
u || (a[c].startValue =
|
|
254
|
+
const m = F ?? i.defaultValue;
|
|
255
|
+
u || (a[c].startValue = m, a[c].isDirty = !1), a[c].value !== m && this.onChange(c, m);
|
|
256
256
|
}), u || (d.dirtyCount = 0, d.isSubmitted = !1), l.subscribers.forEach(({ visualizeEvalueatedForms: i }) => {
|
|
257
257
|
i();
|
|
258
258
|
});
|
|
259
259
|
},
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
setAsDefault() {
|
|
261
|
+
V(n, [], {}, ({}, s) => {
|
|
262
|
+
a[s].startValue = a[s].value, a[s].isDirty = !1;
|
|
263
|
+
}), d.dirtyCount = 0, d.isSubmitted = !1;
|
|
264
|
+
},
|
|
265
|
+
registry(s, u) {
|
|
266
|
+
return a[s].rerender = u, a[s].value === void 0 && (a[s].value = a[s].defaultValue), {
|
|
262
267
|
unregistry() {
|
|
263
|
-
if (a[
|
|
264
|
-
}, a[
|
|
265
|
-
a[
|
|
266
|
-
const i = !L(a[
|
|
267
|
-
a[
|
|
268
|
+
if (a[s].rerender = () => {
|
|
269
|
+
}, a[s].focus = void 0, d.isActive) {
|
|
270
|
+
a[s].value = void 0;
|
|
271
|
+
const i = !L(a[s].startValue, a[s].defaultValue);
|
|
272
|
+
a[s].isDirty !== i && g(s, i), a[s].isDirty = i;
|
|
268
273
|
}
|
|
269
274
|
}
|
|
270
275
|
};
|
|
271
276
|
},
|
|
272
|
-
getForm(
|
|
273
|
-
return a[
|
|
277
|
+
getForm(s) {
|
|
278
|
+
return a[s];
|
|
274
279
|
},
|
|
275
|
-
subscribeToForm(
|
|
276
|
-
const i = { callback: u }, c = this.getForm(
|
|
280
|
+
subscribeToForm(s, u) {
|
|
281
|
+
const i = { callback: u }, c = this.getForm(s);
|
|
277
282
|
return c.subscribers.push(i), {
|
|
278
283
|
unsubscribe: () => {
|
|
279
|
-
c.subscribers = c.subscribers.filter((
|
|
284
|
+
c.subscribers = c.subscribers.filter((F) => F !== i);
|
|
280
285
|
}
|
|
281
286
|
};
|
|
282
287
|
},
|
|
283
|
-
registryExtraForm(
|
|
288
|
+
registryExtraForm(s, u) {
|
|
284
289
|
const i = { visualizeEvalueatedForms: u };
|
|
285
|
-
return
|
|
290
|
+
return s.forEach((c) => {
|
|
286
291
|
l.names[c] = !0;
|
|
287
292
|
}), l.subscribers.push(i), {
|
|
288
293
|
unregistry() {
|
|
@@ -290,44 +295,44 @@ const D = P({}), B = (n) => {
|
|
|
290
295
|
}
|
|
291
296
|
};
|
|
292
297
|
},
|
|
293
|
-
onChange(
|
|
294
|
-
const i = this.getForm(
|
|
295
|
-
i.isDirty !== c && g(
|
|
296
|
-
|
|
298
|
+
onChange(s, u) {
|
|
299
|
+
const i = this.getForm(s), c = !L(u, i.startValue);
|
|
300
|
+
i.isDirty !== c && g(s, c), i.isDirty = c, x?.({ name: s, value: u }), (i.error || d.isSubmitted) && (i.error = i.validate(u) || null), i.value = u, i.rerender(), i.subscribers.forEach(({ callback: F }) => {
|
|
301
|
+
F();
|
|
297
302
|
});
|
|
298
303
|
}
|
|
299
304
|
};
|
|
300
305
|
}, Q = (n, r) => {
|
|
301
306
|
const e = T(null);
|
|
302
307
|
e.current === null && (e.current = H(n, r));
|
|
303
|
-
const
|
|
308
|
+
const o = e.current;
|
|
304
309
|
return p(() => {
|
|
305
310
|
e.current && (e.current.submitRef.onSubmit = r.onSubmit);
|
|
306
311
|
}, [r.onSubmit]), {
|
|
307
|
-
manager:
|
|
312
|
+
manager: o,
|
|
308
313
|
useValue: (t) => B(t),
|
|
309
314
|
reset: (t, f = {}) => {
|
|
310
|
-
|
|
315
|
+
o.reset(t, f);
|
|
311
316
|
},
|
|
312
317
|
setFocus: (t) => {
|
|
313
|
-
|
|
318
|
+
o.setFocus(t);
|
|
314
319
|
},
|
|
315
320
|
setError: (t, f) => {
|
|
316
|
-
|
|
321
|
+
o.setError(t, f);
|
|
317
322
|
},
|
|
318
323
|
setValue: (t, f) => {
|
|
319
|
-
|
|
324
|
+
o.setValue(t, f);
|
|
320
325
|
},
|
|
321
|
-
getValues: () =>
|
|
326
|
+
getValues: () => o.getValues(),
|
|
322
327
|
handleSubmit: async () => {
|
|
323
|
-
await
|
|
328
|
+
await o.handleSubmit();
|
|
324
329
|
}
|
|
325
330
|
};
|
|
326
331
|
}, U = ({ manager: n }) => (A(() => {
|
|
327
332
|
n.activate();
|
|
328
333
|
}, []), p(() => () => {
|
|
329
334
|
n.disactivate();
|
|
330
|
-
}, []), /* @__PURE__ */
|
|
335
|
+
}, []), /* @__PURE__ */ h(D.Provider, { value: n, children: /* @__PURE__ */ h(C, { scheme: n.scheme, path: [] }) })), S = (n) => {
|
|
331
336
|
try {
|
|
332
337
|
n();
|
|
333
338
|
} catch (r) {
|
|
@@ -342,26 +347,26 @@ const D = P({}), B = (n) => {
|
|
|
342
347
|
};
|
|
343
348
|
}
|
|
344
349
|
}, W = (n) => (r, e) => {
|
|
345
|
-
const
|
|
350
|
+
const o = n.getRequireCheck(e), { $rules: t = {}, ...f } = e, { validate: b, required: x } = t;
|
|
346
351
|
return {
|
|
347
352
|
type: "form",
|
|
348
353
|
name: r,
|
|
349
354
|
defaultValue: n.defaultValue,
|
|
350
355
|
Form: n.getForm(f),
|
|
351
356
|
validate: (y) => {
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
return
|
|
356
|
-
if (
|
|
357
|
-
const d = S(() =>
|
|
357
|
+
if (x) {
|
|
358
|
+
const v = S(() => o(y));
|
|
359
|
+
if (v)
|
|
360
|
+
return v;
|
|
361
|
+
if (b) {
|
|
362
|
+
const d = S(() => b(y));
|
|
358
363
|
if (d)
|
|
359
364
|
return d;
|
|
360
365
|
}
|
|
361
366
|
return;
|
|
362
367
|
}
|
|
363
|
-
if (
|
|
364
|
-
const d = S(() =>
|
|
368
|
+
if (b && !S(() => o(y))) {
|
|
369
|
+
const d = S(() => b(y));
|
|
365
370
|
if (d)
|
|
366
371
|
return d;
|
|
367
372
|
}
|
|
@@ -376,7 +381,7 @@ const D = P({}), B = (n) => {
|
|
|
376
381
|
getController: r
|
|
377
382
|
}) => ({
|
|
378
383
|
type: "extra",
|
|
379
|
-
items: n((e) => (
|
|
384
|
+
items: n((e) => (o) => ({ type: "registry", name: e, getForm: o })),
|
|
380
385
|
getController: r
|
|
381
386
|
}), Z = (n) => (...r) => ({
|
|
382
387
|
type: "context",
|
|
@@ -44,6 +44,7 @@ export interface FormManager<Values, FlattenValues, ClonedValues> {
|
|
|
44
44
|
setValue: <K extends keyof FlattenValues>(name: K, value: FlattenValues[K]) => void;
|
|
45
45
|
setError: SetError<FlattenValues>;
|
|
46
46
|
reset: (v: DeepPartial<ClonedValues>, options: ResetOptions) => void;
|
|
47
|
+
setAsDefault: () => void;
|
|
47
48
|
getValues: () => DeepPartial<ClonedValues>;
|
|
48
49
|
}
|
|
49
50
|
export declare const createFormManager: <Values extends FieldValues, Flatten, Cloned>(scheme: SchemeItems.All[], options: MainOptions<Values, Flatten, Cloned>) => FormManager<Values, Flatten, Cloned>;
|