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