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