react-simple-formkit 2.2.2 → 2.2.4
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 +2 -1
- package/dist/react-simple-formkit.js +4 -4
- package/dist/react-simple-formkit.mjs +385 -380
- package/dist/react-simple-formkit.umd.js +4 -4
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import we, { createContext as Te, useContext as _e, useEffect as de, useState as ie, useRef as V, useCallback as d, useMemo as le, useLayoutEffect as be } from "react";
|
|
2
|
+
var ae = { exports: {} }, K = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -10,16 +10,16 @@ var ue = { exports: {} }, K = {};
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
12
|
var he;
|
|
13
|
-
function
|
|
13
|
+
function ke() {
|
|
14
14
|
if (he) return K;
|
|
15
15
|
he = 1;
|
|
16
|
-
var t = Symbol.for("react.transitional.element"),
|
|
17
|
-
function
|
|
16
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
17
|
+
function i(l, h, E) {
|
|
18
18
|
var g = null;
|
|
19
19
|
if (E !== void 0 && (g = "" + E), h.key !== void 0 && (g = "" + h.key), "key" in h) {
|
|
20
20
|
E = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
21
|
+
for (var m in h)
|
|
22
|
+
m !== "key" && (E[m] = h[m]);
|
|
23
23
|
} else E = h;
|
|
24
24
|
return h = E.ref, {
|
|
25
25
|
$$typeof: t,
|
|
@@ -29,7 +29,7 @@ function Te() {
|
|
|
29
29
|
props: E
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return K.Fragment =
|
|
32
|
+
return K.Fragment = n, K.jsx = i, K.jsxs = i, K;
|
|
33
33
|
}
|
|
34
34
|
var ee = {};
|
|
35
35
|
/**
|
|
@@ -42,78 +42,78 @@ var ee = {};
|
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
44
|
var Ee;
|
|
45
|
-
function
|
|
45
|
+
function Ae() {
|
|
46
46
|
return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
47
|
function t(e) {
|
|
48
48
|
if (e == null) return null;
|
|
49
49
|
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof ===
|
|
50
|
+
return e.$$typeof === $ ? null : e.displayName || e.name || null;
|
|
51
51
|
if (typeof e == "string") return e;
|
|
52
52
|
switch (e) {
|
|
53
|
-
case
|
|
53
|
+
case y:
|
|
54
54
|
return "Fragment";
|
|
55
|
-
case
|
|
55
|
+
case x:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case C:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case se:
|
|
60
60
|
return "Suspense";
|
|
61
|
-
case
|
|
61
|
+
case ne:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case G:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof e == "object")
|
|
67
67
|
switch (typeof e.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
69
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
70
|
+
case o:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case z:
|
|
73
73
|
return (e.displayName || "Context") + ".Provider";
|
|
74
|
-
case M:
|
|
75
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
74
|
case J:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return
|
|
81
|
-
case
|
|
82
|
-
|
|
75
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case te:
|
|
77
|
+
var a = e.render;
|
|
78
|
+
return e = e.displayName, e || (e = a.displayName || a.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
+
case oe:
|
|
80
|
+
return a = e.displayName || null, a !== null ? a : t(e.type) || "Memo";
|
|
81
|
+
case P:
|
|
82
|
+
a = e._payload, e = e._init;
|
|
83
83
|
try {
|
|
84
|
-
return t(e(
|
|
84
|
+
return t(e(a));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function n(e) {
|
|
91
91
|
return "" + e;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function i(e) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
96
|
-
var
|
|
95
|
+
n(e);
|
|
96
|
+
var a = !1;
|
|
97
97
|
} catch {
|
|
98
|
-
|
|
98
|
+
a = !0;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
return
|
|
104
|
-
|
|
100
|
+
if (a) {
|
|
101
|
+
a = console;
|
|
102
|
+
var R = a.error, T = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return R.call(
|
|
104
|
+
a,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
|
|
107
|
-
),
|
|
106
|
+
T
|
|
107
|
+
), n(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
function l(e) {
|
|
111
|
-
if (e ===
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
111
|
+
if (e === y) return "<>";
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === P)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
var a = t(e);
|
|
116
|
+
return a ? "<" + a + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
@@ -126,40 +126,40 @@ function _e() {
|
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
128
|
function g(e) {
|
|
129
|
-
if (
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
129
|
+
if (M.call(e, "key")) {
|
|
130
|
+
var a = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
+
if (a && a.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
function
|
|
135
|
+
function m(e, a) {
|
|
136
|
+
function R() {
|
|
137
137
|
H || (H = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
|
|
139
|
+
a
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
get:
|
|
142
|
+
R.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: R,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function v() {
|
|
148
148
|
var e = t(this.type);
|
|
149
149
|
return X[e] || (X[e] = !0, console.error(
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
151
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
153
|
+
function p(e, a, R, T, j, A, I, L) {
|
|
154
|
+
return R = A.ref, e = {
|
|
155
155
|
$$typeof: c,
|
|
156
156
|
type: e,
|
|
157
|
-
key:
|
|
157
|
+
key: a,
|
|
158
158
|
props: A,
|
|
159
|
-
_owner:
|
|
160
|
-
}, (
|
|
159
|
+
_owner: j
|
|
160
|
+
}, (R !== void 0 ? R : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
|
-
get:
|
|
162
|
+
get: v
|
|
163
163
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
@@ -182,105 +182,105 @@ function _e() {
|
|
|
182
182
|
value: L
|
|
183
183
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
for (
|
|
191
|
-
|
|
192
|
-
Object.freeze && Object.freeze(
|
|
185
|
+
function f(e, a, R, T, j, A, I, L) {
|
|
186
|
+
var _ = a.children;
|
|
187
|
+
if (_ !== void 0)
|
|
188
|
+
if (T)
|
|
189
|
+
if (Y(_)) {
|
|
190
|
+
for (T = 0; T < _.length; T++)
|
|
191
|
+
b(_[T]);
|
|
192
|
+
Object.freeze && Object.freeze(_);
|
|
193
193
|
} else
|
|
194
194
|
console.error(
|
|
195
195
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
196
|
);
|
|
197
|
-
else
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
return
|
|
197
|
+
else b(_);
|
|
198
|
+
if (M.call(a, "key")) {
|
|
199
|
+
_ = t(e);
|
|
200
|
+
var D = Object.keys(a).filter(function(ue) {
|
|
201
|
+
return ue !== "key";
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
T = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", Q[_ + T] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
204
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
205
|
let props = %s;
|
|
206
206
|
<%s {...props} />
|
|
207
207
|
React keys must be passed directly to JSX without using spread:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
), Q[
|
|
210
|
+
T,
|
|
211
|
+
_,
|
|
212
|
+
D,
|
|
213
|
+
_
|
|
214
|
+
), Q[_ + T] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
for (var
|
|
219
|
-
|
|
220
|
-
} else
|
|
221
|
-
return
|
|
222
|
-
|
|
216
|
+
if (_ = null, R !== void 0 && (i(R), _ = "" + R), g(a) && (i(a.key), _ = "" + a.key), "key" in a) {
|
|
217
|
+
R = {};
|
|
218
|
+
for (var N in a)
|
|
219
|
+
N !== "key" && (R[N] = a[N]);
|
|
220
|
+
} else R = a;
|
|
221
|
+
return _ && m(
|
|
222
|
+
R,
|
|
223
223
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
224
|
+
), p(
|
|
225
225
|
e,
|
|
226
|
-
|
|
226
|
+
_,
|
|
227
227
|
A,
|
|
228
|
-
|
|
228
|
+
j,
|
|
229
229
|
h(),
|
|
230
|
-
|
|
230
|
+
R,
|
|
231
231
|
I,
|
|
232
232
|
L
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function b(e) {
|
|
236
236
|
typeof e == "object" && e !== null && e.$$typeof === c && e._store && (e._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var u = we, c = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), z = Symbol.for("react.context"), te = Symbol.for("react.forward_ref"), se = Symbol.for("react.suspense"), ne = Symbol.for("react.suspense_list"), oe = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), G = Symbol.for("react.activity"), $ = Symbol.for("react.client.reference"), W = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, Y = Array.isArray, B = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
241
|
+
u = {
|
|
242
242
|
"react-stack-bottom-frame": function(e) {
|
|
243
243
|
return e();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var H, X = {}, Z =
|
|
247
|
-
|
|
246
|
+
var H, X = {}, Z = u["react-stack-bottom-frame"].bind(
|
|
247
|
+
u,
|
|
248
248
|
E
|
|
249
|
-
)(),
|
|
250
|
-
ee.Fragment =
|
|
249
|
+
)(), w = B(l(E)), Q = {};
|
|
250
|
+
ee.Fragment = y, ee.jsx = function(e, a, R, T, j) {
|
|
251
251
|
var A = 1e4 > W.recentlyCreatedOwnerStacks++;
|
|
252
|
-
return
|
|
252
|
+
return f(
|
|
253
253
|
e,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
a,
|
|
255
|
+
R,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
T,
|
|
258
|
+
j,
|
|
259
259
|
A ? Error("react-stack-top-frame") : Z,
|
|
260
|
-
A ?
|
|
260
|
+
A ? B(l(e)) : w
|
|
261
261
|
);
|
|
262
|
-
}, ee.jsxs = function(e,
|
|
262
|
+
}, ee.jsxs = function(e, a, R, T, j) {
|
|
263
263
|
var A = 1e4 > W.recentlyCreatedOwnerStacks++;
|
|
264
|
-
return
|
|
264
|
+
return f(
|
|
265
265
|
e,
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
a,
|
|
267
|
+
R,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
T,
|
|
270
|
+
j,
|
|
271
271
|
A ? Error("react-stack-top-frame") : Z,
|
|
272
|
-
A ?
|
|
272
|
+
A ? B(l(e)) : w
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
275
|
}()), ee;
|
|
276
276
|
}
|
|
277
277
|
var ge;
|
|
278
|
-
function
|
|
279
|
-
return ge || (ge = 1, process.env.NODE_ENV === "production" ?
|
|
278
|
+
function Oe() {
|
|
279
|
+
return ge || (ge = 1, process.env.NODE_ENV === "production" ? ae.exports = ke() : ae.exports = Ae()), ae.exports;
|
|
280
280
|
}
|
|
281
|
-
var me =
|
|
281
|
+
var me = Oe();
|
|
282
282
|
const S = () => {
|
|
283
|
-
},
|
|
283
|
+
}, pe = Te({
|
|
284
284
|
ref: null,
|
|
285
285
|
watch: S,
|
|
286
286
|
actions: {
|
|
@@ -308,98 +308,94 @@ const S = () => {
|
|
|
308
308
|
loadFormValues: S,
|
|
309
309
|
getWatchValue: S,
|
|
310
310
|
channels: {}
|
|
311
|
-
}),
|
|
311
|
+
}), ye = () => _e(pe), Le = ({
|
|
312
312
|
id: t,
|
|
313
|
-
control:
|
|
314
|
-
method:
|
|
313
|
+
control: n,
|
|
314
|
+
method: i,
|
|
315
315
|
action: l,
|
|
316
316
|
children: h,
|
|
317
317
|
onSubmit: E = () => {
|
|
318
318
|
},
|
|
319
319
|
onInput: g = () => {
|
|
320
320
|
},
|
|
321
|
-
onChange:
|
|
321
|
+
onChange: m = () => {
|
|
322
322
|
},
|
|
323
|
-
onBlur:
|
|
323
|
+
onBlur: v = () => {
|
|
324
324
|
},
|
|
325
|
-
onReset:
|
|
325
|
+
onReset: p = () => {
|
|
326
326
|
},
|
|
327
|
-
numberFields:
|
|
328
|
-
className:
|
|
329
|
-
...
|
|
327
|
+
numberFields: f = [],
|
|
328
|
+
className: b,
|
|
329
|
+
...u
|
|
330
330
|
}) => (de(() => {
|
|
331
|
-
const c =
|
|
331
|
+
const c = n.channels.subscribe("onChange", m), o = n.channels.subscribe("onBlur", v);
|
|
332
332
|
return () => {
|
|
333
|
-
c(),
|
|
333
|
+
c(), o();
|
|
334
334
|
};
|
|
335
|
-
}, []), /* @__PURE__ */ me.jsx(
|
|
335
|
+
}, [n.lastReloadedAt]), /* @__PURE__ */ me.jsx(pe.Provider, { value: n, children: /* @__PURE__ */ me.jsx(
|
|
336
336
|
"form",
|
|
337
337
|
{
|
|
338
338
|
id: t,
|
|
339
|
-
ref:
|
|
339
|
+
ref: n.ref,
|
|
340
340
|
action: l,
|
|
341
|
-
method:
|
|
342
|
-
className:
|
|
341
|
+
method: i,
|
|
342
|
+
className: b,
|
|
343
343
|
onInput: g,
|
|
344
344
|
onSubmit: (c) => {
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
E(
|
|
345
|
+
i || c.preventDefault();
|
|
346
|
+
const o = n.loadFormValues();
|
|
347
|
+
E(o);
|
|
348
348
|
},
|
|
349
349
|
onChange: (c) => {
|
|
350
|
-
const
|
|
351
|
-
!
|
|
350
|
+
const o = c.target.name;
|
|
351
|
+
!o || n.actions.getControlledFields().has(o) || n.actions.setValue(o, c.target.value);
|
|
352
352
|
},
|
|
353
353
|
onBlur: (c) => {
|
|
354
|
-
const
|
|
355
|
-
if (!
|
|
356
|
-
const
|
|
357
|
-
|
|
354
|
+
const o = c.target.name;
|
|
355
|
+
if (!o || n.actions.getControlledFields().has(o)) return;
|
|
356
|
+
const y = c.target.value;
|
|
357
|
+
n.channels.publish("onBlur", o, y, n.actions.getValues());
|
|
358
358
|
},
|
|
359
359
|
onReset: (c) => {
|
|
360
|
-
|
|
360
|
+
n.actions.reset(), p(c);
|
|
361
361
|
},
|
|
362
|
-
...
|
|
362
|
+
...u,
|
|
363
363
|
children: h
|
|
364
364
|
},
|
|
365
|
-
|
|
366
|
-
) })),
|
|
367
|
-
const { getWatchValue: l, registerHookWatcher: h } = t ||
|
|
365
|
+
n.lastReloadedAt
|
|
366
|
+
) })), Ce = ({ control: t, name: n, compute: i }) => {
|
|
367
|
+
const { getWatchValue: l, registerHookWatcher: h } = t || ye(), E = l({ name: n, compute: i }), [g, m] = ie(E);
|
|
368
368
|
return de(() => {
|
|
369
|
-
const
|
|
370
|
-
return () =>
|
|
369
|
+
const v = h({ name: n, compute: i, value: g, setValue: m });
|
|
370
|
+
return () => v.forEach((p) => p());
|
|
371
371
|
}, []), g;
|
|
372
|
-
},
|
|
373
|
-
const { actions:
|
|
374
|
-
(
|
|
375
|
-
var
|
|
376
|
-
let
|
|
377
|
-
(
|
|
372
|
+
}, Pe = ({ name: t, defaultValue: n }) => {
|
|
373
|
+
const { actions: i, registerController: l, channels: h } = ye(), E = V(), g = i.getDefaultValues()[t] || n || "", [m, v] = ie(g), p = Ce({ name: `fieldStates.${t}` }), f = d(
|
|
374
|
+
(u, { shouldDirty: c = !0, shouldOnChange: o = !0 } = {}) => {
|
|
375
|
+
var C, x;
|
|
376
|
+
let y = u;
|
|
377
|
+
(C = u == null ? void 0 : u.target) != null && C.value && (y = u.target.value), (x = u == null ? void 0 : u.target) != null && x.checked && (y = u.target.checked + ""), v(y), i.setValue(t, y, { shouldDirty: c, shouldOnChange: o });
|
|
378
378
|
},
|
|
379
|
-
[
|
|
380
|
-
),
|
|
381
|
-
const c =
|
|
382
|
-
h.publish("onBlur", t,
|
|
379
|
+
[i.setValue]
|
|
380
|
+
), b = d((u) => {
|
|
381
|
+
const c = i.getValues(), o = u ?? c[t];
|
|
382
|
+
h.publish("onBlur", t, o, c);
|
|
383
383
|
}, []);
|
|
384
|
-
return de(() => l(t,
|
|
385
|
-
},
|
|
384
|
+
return de(() => l(t, v), []), { ref: E, name: t, defaultValue: g, value: m, onChange: f, onBlur: b, fieldState: p };
|
|
385
|
+
}, Ue = ({
|
|
386
386
|
name: t,
|
|
387
|
-
defaultValue:
|
|
388
|
-
render:
|
|
387
|
+
defaultValue: n,
|
|
388
|
+
render: i = ({ ref: l, name: h, defaultValue: E, value: g, onChange: m, onBlur: v, fieldState: p }) => null
|
|
389
389
|
}) => {
|
|
390
|
-
const l =
|
|
391
|
-
return
|
|
392
|
-
},
|
|
390
|
+
const l = Pe({ name: t, defaultValue: n });
|
|
391
|
+
return i(l);
|
|
392
|
+
}, je = ["errors", "fieldStates", "formState"], re = (t = {}, n = "") => n.split(".").reduce((i, l) => i && i[l] !== void 0 ? i[l] : void 0, t), ve = (t = {}, n = "", i) => {
|
|
393
393
|
let l = t;
|
|
394
|
-
const h =
|
|
394
|
+
const h = n.split(".");
|
|
395
395
|
return h.forEach((E, g) => {
|
|
396
|
-
|
|
397
|
-
l[E] || (l[E] = {}), l = l[E];
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
l[E] = a;
|
|
396
|
+
g < h.length - 1 && (l[E] || (l[E] = {}), g === h.length - 2 && (l[E] = { ...l[E] }), l = l[E]), l[E] = i;
|
|
401
397
|
}), t;
|
|
402
|
-
}, q = (t) =>
|
|
398
|
+
}, q = (t) => je.some((n) => t.startsWith(n)) ? t : "values." + t, xe = [
|
|
403
399
|
"badInput",
|
|
404
400
|
"customError",
|
|
405
401
|
"patternMismatch",
|
|
@@ -410,12 +406,12 @@ const S = () => {
|
|
|
410
406
|
"tooShort",
|
|
411
407
|
"typeMismatch",
|
|
412
408
|
"valueMissing"
|
|
413
|
-
],
|
|
409
|
+
], Re = (t) => {
|
|
414
410
|
typeof t.setCustomValidity == "function" && t.setCustomValidity("");
|
|
415
|
-
let
|
|
416
|
-
if (
|
|
411
|
+
let n = t.validity, i = xe.find((l) => n[l]);
|
|
412
|
+
if (i) return { type: i, message: t.validationMessage };
|
|
417
413
|
};
|
|
418
|
-
class
|
|
414
|
+
class Ne {
|
|
419
415
|
constructor() {
|
|
420
416
|
this.events = /* @__PURE__ */ new Map(), this.watchEvents = /* @__PURE__ */ new Map();
|
|
421
417
|
}
|
|
@@ -425,309 +421,318 @@ class xe {
|
|
|
425
421
|
getEvents() {
|
|
426
422
|
return this.events;
|
|
427
423
|
}
|
|
428
|
-
subscribe(
|
|
429
|
-
return this.events.has(
|
|
424
|
+
subscribe(n, i) {
|
|
425
|
+
return this.events.has(n) || this.events.set(n, /* @__PURE__ */ new Set()), this.events.get(n).add(i), () => {
|
|
430
426
|
var l;
|
|
431
|
-
return (l = this.events.get(
|
|
427
|
+
return (l = this.events.get(n)) == null ? void 0 : l.delete(i);
|
|
432
428
|
};
|
|
433
429
|
}
|
|
434
|
-
subscribeWatch(
|
|
435
|
-
this.watchEvents.has(
|
|
430
|
+
subscribeWatch(n, i) {
|
|
431
|
+
this.watchEvents.has(n) || (this.watchEvents.set(n, /* @__PURE__ */ new Set()), this.watchEvents.get(n).add(i));
|
|
436
432
|
}
|
|
437
|
-
publish(
|
|
433
|
+
publish(n, ...i) {
|
|
438
434
|
this.events.forEach((l, h) => {
|
|
439
|
-
|
|
435
|
+
n.includes(h) && l.forEach((E) => E(...i));
|
|
440
436
|
}), this.watchEvents.forEach((l, h) => {
|
|
441
|
-
|
|
437
|
+
n.includes(h) && l.forEach((E) => E(...i));
|
|
442
438
|
});
|
|
443
439
|
}
|
|
444
440
|
reset() {
|
|
445
441
|
this.events.clear(), this.watchEvents.clear();
|
|
446
442
|
}
|
|
447
443
|
}
|
|
448
|
-
const
|
|
449
|
-
const t =
|
|
450
|
-
t.current.publish(
|
|
451
|
-
}, []),
|
|
452
|
-
t.current.subscribeWatch(
|
|
444
|
+
const Ve = () => {
|
|
445
|
+
const t = V(new Ne()), n = d((m, ...v) => {
|
|
446
|
+
t.current.publish(m, ...v);
|
|
447
|
+
}, []), i = d((m, v) => t.current.subscribe(m, v), []), l = d((m, v) => {
|
|
448
|
+
t.current.subscribeWatch(m, v);
|
|
453
449
|
}, []), h = d(() => t.current.getEvents(), []), E = d(() => t.current.getWatchEvents(), []), g = d(() => {
|
|
454
450
|
t.current.reset();
|
|
455
451
|
}, []);
|
|
456
|
-
return { publish:
|
|
457
|
-
},
|
|
458
|
-
const [t,
|
|
459
|
-
return [t,
|
|
452
|
+
return { publish: n, subscribe: i, reset: g, getEvents: h, subscribeWatch: l, getWatchEvents: E };
|
|
453
|
+
}, De = () => {
|
|
454
|
+
const [t, n] = ie(), i = d(() => n((/* @__PURE__ */ new Date()).toString()), []);
|
|
455
|
+
return [t, i];
|
|
460
456
|
}, We = () => {
|
|
461
|
-
const [, t] =
|
|
457
|
+
const [, t] = ie({});
|
|
462
458
|
return d(() => t({}), []);
|
|
463
|
-
},
|
|
464
|
-
const E = We(), g = d(({ name:
|
|
465
|
-
if (typeof
|
|
466
|
-
if (Array.isArray(
|
|
467
|
-
const
|
|
468
|
-
return
|
|
469
|
-
|
|
470
|
-
}),
|
|
459
|
+
}, $e = ({ channels: t, getValues: n, getErrors: i, getFieldStates: l, getFormState: h }) => {
|
|
460
|
+
const E = We(), g = d(({ name: f, compute: b }) => {
|
|
461
|
+
if (typeof b == "function") return b(n());
|
|
462
|
+
if (Array.isArray(f)) {
|
|
463
|
+
const u = {};
|
|
464
|
+
return f.forEach((c) => {
|
|
465
|
+
u[c] = g({ name: c });
|
|
466
|
+
}), u;
|
|
471
467
|
}
|
|
472
|
-
return
|
|
468
|
+
return re(
|
|
473
469
|
{
|
|
474
|
-
...
|
|
475
|
-
errors: { ...
|
|
470
|
+
...n(),
|
|
471
|
+
errors: { ...i() },
|
|
476
472
|
formState: { ...h() },
|
|
477
473
|
fieldStates: { ...l() }
|
|
478
474
|
},
|
|
479
|
-
|
|
475
|
+
f
|
|
480
476
|
);
|
|
481
|
-
}, []),
|
|
482
|
-
if (!
|
|
483
|
-
return t.subscribeWatch("values", () => E()),
|
|
484
|
-
if (typeof
|
|
485
|
-
const
|
|
486
|
-
return t.subscribeWatch(
|
|
477
|
+
}, []), m = d((f) => {
|
|
478
|
+
if (!f)
|
|
479
|
+
return t.subscribeWatch("values", () => E()), n();
|
|
480
|
+
if (typeof f == "string") {
|
|
481
|
+
const b = q(f);
|
|
482
|
+
return t.subscribeWatch(b, () => E()), g({ name: f });
|
|
487
483
|
}
|
|
488
|
-
if (Array.isArray(
|
|
489
|
-
const
|
|
490
|
-
return
|
|
491
|
-
const c = q(
|
|
492
|
-
t.subscribeWatch(c, () => E()),
|
|
493
|
-
}), { ...
|
|
484
|
+
if (Array.isArray(f)) {
|
|
485
|
+
const b = {};
|
|
486
|
+
return f.forEach((u) => {
|
|
487
|
+
const c = q(u);
|
|
488
|
+
t.subscribeWatch(c, () => E()), b[u] = g({ name: u });
|
|
489
|
+
}), { ...b };
|
|
494
490
|
}
|
|
495
491
|
throw new Error("Parameters of watch must be string or array of string");
|
|
496
|
-
}, []),
|
|
497
|
-
if (typeof
|
|
492
|
+
}, []), v = d(({ name: f, compute: b, setValue: u }) => {
|
|
493
|
+
if (typeof b == "function")
|
|
498
494
|
return [t.subscribe("values", () => {
|
|
499
|
-
const
|
|
500
|
-
o
|
|
495
|
+
const o = g({ compute: b });
|
|
496
|
+
u(o);
|
|
501
497
|
})];
|
|
502
|
-
if (!
|
|
498
|
+
if (!f)
|
|
503
499
|
return [t.subscribe("values", () => {
|
|
504
|
-
|
|
500
|
+
u(n());
|
|
505
501
|
})];
|
|
506
|
-
if (typeof
|
|
507
|
-
const c = q(
|
|
502
|
+
if (typeof f == "string") {
|
|
503
|
+
const c = q(f);
|
|
508
504
|
return [t.subscribe(c, () => {
|
|
509
|
-
const
|
|
510
|
-
|
|
505
|
+
const y = g({ name: f });
|
|
506
|
+
u(y);
|
|
511
507
|
})];
|
|
512
508
|
}
|
|
513
|
-
if (Array.isArray(
|
|
514
|
-
const c = g({ name:
|
|
515
|
-
return
|
|
516
|
-
const
|
|
517
|
-
const
|
|
518
|
-
c[
|
|
509
|
+
if (Array.isArray(f)) {
|
|
510
|
+
const c = g({ name: f }), o = [];
|
|
511
|
+
return f.forEach((y) => {
|
|
512
|
+
const C = q(y), x = t.subscribe(C, () => {
|
|
513
|
+
const J = g({ name: y });
|
|
514
|
+
c[y] = J, u({ ...c });
|
|
519
515
|
});
|
|
520
|
-
|
|
521
|
-
}),
|
|
516
|
+
o.push(x);
|
|
517
|
+
}), o;
|
|
522
518
|
}
|
|
523
519
|
throw new Error("Parameters of name must be string or array of string or compute must be a function");
|
|
524
|
-
}, []),
|
|
525
|
-
(
|
|
526
|
-
if (!
|
|
527
|
-
return t.subscribe("values",
|
|
528
|
-
if (typeof
|
|
529
|
-
const
|
|
530
|
-
return t.subscribe(
|
|
520
|
+
}, []), p = d(
|
|
521
|
+
(f, b) => {
|
|
522
|
+
if (!f)
|
|
523
|
+
return t.subscribe("values", b);
|
|
524
|
+
if (typeof f == "string") {
|
|
525
|
+
const u = q(f);
|
|
526
|
+
return t.subscribe(u, b);
|
|
531
527
|
}
|
|
532
|
-
if (Array.isArray(
|
|
533
|
-
const
|
|
534
|
-
return
|
|
535
|
-
const
|
|
536
|
-
o
|
|
528
|
+
if (Array.isArray(f)) {
|
|
529
|
+
const u = {}, c = [];
|
|
530
|
+
return f.forEach((o) => {
|
|
531
|
+
const y = q(o), C = t.subscribe(y, () => {
|
|
532
|
+
u[o] = g({ name: o }), b({ ...u });
|
|
537
533
|
});
|
|
538
|
-
c.push(
|
|
534
|
+
c.push(C);
|
|
539
535
|
}), c;
|
|
540
536
|
}
|
|
541
537
|
throw new Error("Parameters of name must be string or array of string");
|
|
542
538
|
},
|
|
543
539
|
[t]
|
|
544
540
|
);
|
|
545
|
-
return { watch:
|
|
546
|
-
},
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
541
|
+
return { watch: m, registerHookWatcher: v, getWatchValue: g, subscribe: p };
|
|
542
|
+
}, Se = {
|
|
543
|
+
lastReset: null,
|
|
544
|
+
isDirty: !1,
|
|
545
|
+
isError: !1,
|
|
546
|
+
errorFields: [],
|
|
547
|
+
dirtyFields: [],
|
|
548
|
+
touchedFields: []
|
|
549
|
+
}, fe = { isDirty: !1, isTouched: !1, error: null }, Me = [], Ye = {}, qe = ({
|
|
550
|
+
numberFields: t = Me,
|
|
551
|
+
defaultValues: n = Ye,
|
|
552
|
+
shouldUnRegister: i = !1,
|
|
550
553
|
shouldConvertNumber: l = !1
|
|
551
554
|
} = {}) => {
|
|
552
|
-
const [h, E] =
|
|
553
|
-
|
|
554
|
-
}, []),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}),
|
|
558
|
-
}, []),
|
|
555
|
+
const [h, E] = De(), g = V(), m = V(t), v = V(/* @__PURE__ */ new Map()), p = V({}), f = V({}), b = V({ ...Se }), u = V({ ...n }), c = V({ ...n }), o = Ve(), y = d(() => {
|
|
556
|
+
f.current = Object.keys(c.current).reduce((r, s) => ({ ...r, [s]: { ...fe } }), {});
|
|
557
|
+
}, []), C = d((r = {}) => {
|
|
558
|
+
c.current = { ...c.current, ...r }, u.current = { ...c.current }, v.current.forEach((s, F) => {
|
|
559
|
+
s(c.current[F]);
|
|
560
|
+
}), p.current = {}, b.current = { ...Se }, m.current = t, v.current = /* @__PURE__ */ new Map(), o.reset(), y(), t.length > 0 && (l = !0), E();
|
|
561
|
+
}, []), x = d(() => {
|
|
559
562
|
const r = Object.fromEntries(new FormData(g.current));
|
|
560
|
-
return
|
|
561
|
-
r[k] =
|
|
562
|
-
}), l &&
|
|
563
|
-
(
|
|
564
|
-
), { ...
|
|
565
|
-
}, []),
|
|
566
|
-
(r) =>
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
errorFields: Object.keys(m.current).filter((n) => !!m.current[n]),
|
|
571
|
-
dirtyFields: Object.keys(o.current).filter((n) => o.current[n].isDirty),
|
|
572
|
-
touchedFields: Object.keys(o.current).filter((n) => o.current[n].isTouched)
|
|
573
|
-
},
|
|
574
|
-
r
|
|
575
|
-
),
|
|
576
|
-
[j]
|
|
577
|
-
), { watch: $, registerHookWatcher: H, getWatchValue: X, subscribe: Z } = De({
|
|
578
|
-
channels: f,
|
|
563
|
+
return v.current.forEach((F, k) => {
|
|
564
|
+
r[k] = u.current[k];
|
|
565
|
+
}), l && m.current.forEach(
|
|
566
|
+
(F) => r.hasOwnProperty(F) && (r[F] = Number(r[F]) || 0)
|
|
567
|
+
), { ...u.current, ...r };
|
|
568
|
+
}, []), J = d(() => !!Object.values(W()).find((r) => r.isDirty), []), z = d(() => !!Object.values($()).find((r) => !!r), []), te = d((r) => Re(r.target), []), se = d(() => c.current, []), ne = d(() => m.current, []), oe = d(() => v.current, []), P = d((r, s) => s ? Array.isArray(s) ? s.reduce((F, k) => ({ ...F, [k]: re(r, k) }), {}) : re(r, s) : { ...r }, []), G = d((r) => P(u.current, r), [P]), $ = d((r) => P(p.current, r), [P]), W = d((r) => P(f.current, r), [P]), M = d(
|
|
569
|
+
(r) => P({ ...b.current, lastReset: h }, r),
|
|
570
|
+
[P, h]
|
|
571
|
+
), { watch: Y, registerHookWatcher: B, getWatchValue: H, subscribe: X } = $e({
|
|
572
|
+
channels: o,
|
|
579
573
|
getValues: G,
|
|
580
|
-
getErrors:
|
|
581
|
-
getFieldStates:
|
|
582
|
-
getFormState:
|
|
583
|
-
}),
|
|
584
|
-
const
|
|
585
|
-
|
|
574
|
+
getErrors: $,
|
|
575
|
+
getFieldStates: W,
|
|
576
|
+
getFormState: M
|
|
577
|
+
}), Z = d((r, s) => {
|
|
578
|
+
const F = b.current;
|
|
579
|
+
re(F, r) !== s && (ve(b.current, r, s), o.publish(`formState.${r}`, s));
|
|
580
|
+
}, []), w = d((r, s, F) => {
|
|
581
|
+
const k = f.current[r] || { ...fe };
|
|
582
|
+
re(k, s) !== F && (ve(f.current, `${r}.${s}`, F), o.publish(`fieldStates.${r}.${s}`, F), s === "error" && (b.current.errorFields = Object.keys(p.current).filter(
|
|
583
|
+
(O) => !!p.current[O]
|
|
584
|
+
), o.publish("formState.errorFields", b.current.errorFields)), s === "isDirty" && (b.current.dirtyFields = Object.keys(f.current).filter(
|
|
585
|
+
(O) => f.current[O].isDirty
|
|
586
|
+
), o.publish("formState.dirtyFields", b.current.dirtyFields)), s === "isTouched" && (b.current.touchedFields = Object.keys(f.current).filter(
|
|
587
|
+
(O) => f.current[O].isTouched
|
|
588
|
+
), o.publish("formState.touchedFields", b.current.touchedFields)));
|
|
586
589
|
}, []), Q = d(
|
|
587
590
|
(r) => {
|
|
588
|
-
|
|
591
|
+
w(r, "isDirty", !1), w(r, "isTouched", !1), w(r, "error", null);
|
|
589
592
|
},
|
|
590
|
-
[
|
|
593
|
+
[w]
|
|
591
594
|
), e = d(
|
|
592
|
-
(r,
|
|
593
|
-
if (
|
|
594
|
-
|
|
595
|
-
const k =
|
|
596
|
-
|
|
595
|
+
(r, s) => {
|
|
596
|
+
if (p.current[r] === s) return;
|
|
597
|
+
p.current[r] = s, w(r, "error", s), o.publish(`errors.${r}`, s);
|
|
598
|
+
const k = z();
|
|
599
|
+
b.current.isError !== k && (b.current.isError = k, o.publish("formState.isError", k));
|
|
597
600
|
},
|
|
598
|
-
[
|
|
599
|
-
),
|
|
601
|
+
[w]
|
|
602
|
+
), a = d(
|
|
600
603
|
(r) => {
|
|
601
|
-
if (!
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
|
|
604
|
+
if (!p.current[r]) return;
|
|
605
|
+
p.current[r] = null, w(r, "error", null), o.publish(`errors.${r}`, null);
|
|
606
|
+
const s = z();
|
|
607
|
+
b.current.isError !== s && (b.current.isError = s, o.publish("formState.isError", s));
|
|
605
608
|
},
|
|
606
|
-
[
|
|
607
|
-
),
|
|
608
|
-
if (Object.keys(
|
|
609
|
-
Object.keys(
|
|
610
|
-
const r =
|
|
611
|
-
|
|
612
|
-
}, []),
|
|
609
|
+
[w]
|
|
610
|
+
), R = d(() => {
|
|
611
|
+
if (Object.keys(p.current) === 0) return;
|
|
612
|
+
Object.keys(p.current).forEach((s) => a(s)), p.current = {};
|
|
613
|
+
const r = z();
|
|
614
|
+
b.current.isError !== r && (b.current.isError = r, o.publish("formState.isError", r));
|
|
615
|
+
}, []), T = d(
|
|
613
616
|
(r) => {
|
|
614
|
-
const
|
|
615
|
-
|
|
617
|
+
const s = Re(r.target);
|
|
618
|
+
s ? e(r.target.name, s) : a(r.target.name);
|
|
616
619
|
},
|
|
617
|
-
[e,
|
|
618
|
-
),
|
|
619
|
-
(r,
|
|
620
|
-
if (
|
|
621
|
-
l &&
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
const U =
|
|
627
|
-
U && U(
|
|
620
|
+
[e, a]
|
|
621
|
+
), j = d(
|
|
622
|
+
(r, s, { shouldDirty: F = !0, shouldOnChange: k = !0 } = {}) => {
|
|
623
|
+
if (s === u.current[r]) return;
|
|
624
|
+
l && m.current.includes(r) && (s = Number(s) || void 0), w(r, "isTouched", !0);
|
|
625
|
+
const ce = s !== c.current[r];
|
|
626
|
+
F && f.current[r].isDirty !== ce && w(r, "isDirty", ce);
|
|
627
|
+
const O = J();
|
|
628
|
+
b.current.isDirty !== O && (b.current.isDirty = O, o.publish("formState.isDirty", O)), u.current[r] = s;
|
|
629
|
+
const U = v.current.get(r);
|
|
630
|
+
U && U(s), o.publish(`values.${r}`, s, { shouldDirty: F, shouldOnChange: k }), k && o.publish("onChange", r, s, u.current);
|
|
628
631
|
},
|
|
629
|
-
[
|
|
630
|
-
), A = d((r,
|
|
631
|
-
|
|
632
|
+
[w]
|
|
633
|
+
), A = d((r, s) => (v.current.set(r, s), f.current[r] = { ...fe }, () => {
|
|
634
|
+
i && v.current.delete(r);
|
|
632
635
|
}), []), I = d(
|
|
633
|
-
(r, { keepError:
|
|
634
|
-
const U =
|
|
636
|
+
(r, { keepError: s, keepDirty: F, keepTouched: k, keepCustomState: ce, defaultValue: O }) => {
|
|
637
|
+
const U = v.current.get(r);
|
|
635
638
|
if (!U)
|
|
636
639
|
throw new Error(`Cannot reset "${r}" because it's uncontrolled field`);
|
|
637
|
-
|
|
640
|
+
c.current[r] = O, u.current[r] = O, U && U(O), s || a(r), F || w(r, "isDirty", !1), k || w(r, "isTouched", !1);
|
|
638
641
|
},
|
|
639
|
-
[
|
|
640
|
-
), L = d((r,
|
|
641
|
-
|
|
642
|
-
}, []),
|
|
642
|
+
[a, w]
|
|
643
|
+
), L = d((r, s = N.getValues(r)) => {
|
|
644
|
+
o.publish("onBlur", r, s, N.getValues());
|
|
645
|
+
}, []), _ = d((r) => o.subscribe("onChange", r), []), D = d((r) => o.subscribe("onBlur", r), []), N = le(
|
|
643
646
|
() => ({
|
|
644
|
-
subscribe:
|
|
645
|
-
reset:
|
|
647
|
+
subscribe: X,
|
|
648
|
+
reset: C,
|
|
646
649
|
resetField: I,
|
|
647
|
-
setValue:
|
|
650
|
+
setValue: j,
|
|
648
651
|
getValues: G,
|
|
649
|
-
getErrors:
|
|
650
|
-
getFieldStates:
|
|
651
|
-
getFormState:
|
|
652
|
+
getErrors: $,
|
|
653
|
+
getFieldStates: W,
|
|
654
|
+
getFormState: M,
|
|
652
655
|
setError: e,
|
|
653
|
-
clearError:
|
|
654
|
-
clearErrors:
|
|
655
|
-
checkValidity:
|
|
656
|
+
clearError: a,
|
|
657
|
+
clearErrors: R,
|
|
658
|
+
checkValidity: T,
|
|
656
659
|
getNumberFields: ne,
|
|
657
|
-
getFieldValidity:
|
|
658
|
-
getDefaultValues:
|
|
659
|
-
setFieldState:
|
|
660
|
+
getFieldValidity: te,
|
|
661
|
+
getDefaultValues: se,
|
|
662
|
+
setFieldState: w,
|
|
660
663
|
triggerFieldBlur: L,
|
|
661
664
|
resetFieldState: Q,
|
|
662
|
-
getControlledFields:
|
|
663
|
-
subscribeChange:
|
|
664
|
-
subscribeBlur:
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
getControlledFields: oe,
|
|
666
|
+
subscribeChange: _,
|
|
667
|
+
subscribeBlur: D,
|
|
668
|
+
setFormState: Z,
|
|
669
|
+
getEvents: o.getEvents,
|
|
670
|
+
getWatchEvents: o.getWatchEvents
|
|
667
671
|
}),
|
|
668
672
|
[
|
|
669
|
-
|
|
670
|
-
N,
|
|
671
|
-
I,
|
|
673
|
+
X,
|
|
672
674
|
C,
|
|
675
|
+
I,
|
|
676
|
+
j,
|
|
673
677
|
G,
|
|
678
|
+
$,
|
|
674
679
|
W,
|
|
675
|
-
|
|
676
|
-
D,
|
|
680
|
+
M,
|
|
677
681
|
e,
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
682
|
+
a,
|
|
683
|
+
R,
|
|
684
|
+
T,
|
|
681
685
|
ne,
|
|
682
|
-
re,
|
|
683
686
|
te,
|
|
684
|
-
|
|
687
|
+
se,
|
|
688
|
+
w,
|
|
685
689
|
Q,
|
|
686
690
|
L,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
691
|
+
oe,
|
|
692
|
+
_,
|
|
693
|
+
D,
|
|
694
|
+
Z
|
|
690
695
|
]
|
|
691
|
-
),
|
|
696
|
+
), ue = le(
|
|
692
697
|
() => ({
|
|
693
698
|
ref: g,
|
|
694
|
-
watch:
|
|
695
|
-
actions:
|
|
699
|
+
watch: Y,
|
|
700
|
+
actions: N,
|
|
696
701
|
registerController: A,
|
|
697
|
-
registerHookWatcher:
|
|
702
|
+
registerHookWatcher: B,
|
|
698
703
|
lastReloadedAt: h,
|
|
699
|
-
loadFormValues:
|
|
700
|
-
getWatchValue:
|
|
701
|
-
channels:
|
|
704
|
+
loadFormValues: x,
|
|
705
|
+
getWatchValue: H,
|
|
706
|
+
channels: o
|
|
702
707
|
}),
|
|
703
708
|
[
|
|
704
709
|
g,
|
|
705
|
-
|
|
706
|
-
|
|
710
|
+
Y,
|
|
711
|
+
N,
|
|
707
712
|
A,
|
|
708
|
-
|
|
713
|
+
B,
|
|
709
714
|
h,
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
715
|
+
x,
|
|
716
|
+
H,
|
|
717
|
+
o
|
|
713
718
|
]
|
|
714
|
-
),
|
|
719
|
+
), Fe = le(() => ({ control: ue, actions: N, watch: Y }), [h, ue, N, Y]);
|
|
715
720
|
return be(() => {
|
|
716
|
-
if ([...g.current.querySelectorAll("[name]")].forEach((
|
|
717
|
-
!
|
|
721
|
+
if ([...g.current.querySelectorAll("[name]")].forEach((s) => {
|
|
722
|
+
!s.defaultValue && !v.current.has(s.name) && c.current[s.name] && (s.defaultValue = c.current[s.name]), s.type === "number" && !m.current.includes(s.name) && m.current.push(s.name);
|
|
718
723
|
}), g.current) {
|
|
719
|
-
const
|
|
720
|
-
|
|
724
|
+
const s = x();
|
|
725
|
+
u.current = { ...s }, c.current = { ...s };
|
|
721
726
|
}
|
|
722
727
|
}, [h]), be(() => {
|
|
723
|
-
|
|
724
|
-
}, []),
|
|
728
|
+
y();
|
|
729
|
+
}, []), Fe;
|
|
725
730
|
};
|
|
726
731
|
export {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
732
|
+
Ue as Controller,
|
|
733
|
+
Le as Form,
|
|
734
|
+
Pe as useController,
|
|
735
|
+
qe as useForm,
|
|
736
|
+
ye as useFormContext,
|
|
737
|
+
Ce as useWatch
|
|
733
738
|
};
|