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