react-simple-formkit 2.0.3 → 2.1.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 +165 -40
- package/dist/react-simple-formkit.js +4 -4
- package/dist/react-simple-formkit.mjs +516 -400
- package/dist/react-simple-formkit.umd.js +4 -4
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import ge, { createContext as Re, useContext as Se, useEffect as ae, useState as ue, useRef as j, useCallback as f, useMemo as ce, useLayoutEffect as ie } from "react";
|
|
2
|
+
var oe = { exports: {} }, ee = {};
|
|
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 le;
|
|
13
|
+
function pe() {
|
|
14
|
+
if (le) return ee;
|
|
15
|
+
le = 1;
|
|
16
|
+
var s = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
17
|
+
function l(h, b, g) {
|
|
18
|
+
var E = null;
|
|
19
|
+
if (g !== void 0 && (E = "" + g), b.key !== void 0 && (E = "" + b.key), "key" in b) {
|
|
20
|
+
g = {};
|
|
21
|
+
for (var y in b)
|
|
22
|
+
y !== "key" && (g[y] = b[y]);
|
|
23
|
+
} else g = b;
|
|
24
|
+
return b = g.ref, {
|
|
25
25
|
$$typeof: s,
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
29
|
-
props:
|
|
26
|
+
type: h,
|
|
27
|
+
key: E,
|
|
28
|
+
ref: b !== void 0 ? b : null,
|
|
29
|
+
props: g
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return ee.Fragment = n, ee.jsx = l, ee.jsxs = l, ee;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var re = {};
|
|
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 fe;
|
|
45
|
+
function ye() {
|
|
46
|
+
return fe || (fe = 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
|
|
55
|
+
case I:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case A:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case re:
|
|
60
|
-
return "Suspense";
|
|
61
59
|
case te:
|
|
60
|
+
return "Suspense";
|
|
61
|
+
case se:
|
|
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 $:
|
|
73
|
-
return (e.displayName || "Context") + ".Provider";
|
|
74
72
|
case B:
|
|
73
|
+
return (e.displayName || "Context") + ".Provider";
|
|
74
|
+
case $:
|
|
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 ne:
|
|
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, F = 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
|
+
F
|
|
107
|
+
), n(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (e ===
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
110
|
+
function h(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 = x.A;
|
|
123
123
|
return e === null ? null : e.getOwner();
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function g() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
128
|
+
function E(e) {
|
|
129
|
+
if (M.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 y(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 T() {
|
|
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, F, O, w, L, V) {
|
|
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: T
|
|
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: L
|
|
178
178
|
}), Object.defineProperty(e, "_debugTask", {
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
|
-
value:
|
|
182
|
+
value: V
|
|
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, F, O, w, L, V) {
|
|
186
|
+
var _ = u.children;
|
|
187
|
+
if (_ !== void 0)
|
|
188
|
+
if (F)
|
|
189
|
+
if (N(_)) {
|
|
190
|
+
for (F = 0; F < _.length; F++)
|
|
191
|
+
m(_[F]);
|
|
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 m(_);
|
|
198
|
+
if (M.call(u, "key")) {
|
|
199
|
+
_ = s(e);
|
|
200
|
+
var W = Object.keys(u).filter(function(t) {
|
|
201
|
+
return t !== "key";
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
F = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", Q[_ + F] || (W = 0 < W.length ? "{" + W.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
|
+
F,
|
|
211
|
+
_,
|
|
212
|
+
W,
|
|
213
|
+
_
|
|
214
|
+
), Q[_ + F] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
for (var
|
|
219
|
-
|
|
220
|
-
} else
|
|
221
|
-
return
|
|
222
|
-
|
|
216
|
+
if (_ = null, R !== void 0 && (l(R), _ = "" + R), E(u) && (l(u.key), _ = "" + u.key), "key" in u) {
|
|
217
|
+
R = {};
|
|
218
|
+
for (var r in u)
|
|
219
|
+
r !== "key" && (R[r] = u[r]);
|
|
220
|
+
} else R = u;
|
|
221
|
+
return _ && y(
|
|
222
|
+
R,
|
|
223
223
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
224
|
+
), k(
|
|
225
225
|
e,
|
|
226
|
-
R,
|
|
227
|
-
T,
|
|
228
226
|
_,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
w,
|
|
228
|
+
O,
|
|
229
|
+
b(),
|
|
230
|
+
R,
|
|
231
|
+
L,
|
|
232
|
+
V
|
|
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 = ge, o = Symbol.for("react.transitional.element"), i = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), A = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), B = Symbol.for("react.context"), J = Symbol.for("react.forward_ref"), te = Symbol.for("react.suspense"), se = Symbol.for("react.suspense_list"), ne = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), P = Symbol.for("react.activity"), G = Symbol.for("react.client.reference"), x = a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, N = 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
|
+
g
|
|
249
|
+
)(), p = D(h(g)), Q = {};
|
|
250
|
+
re.Fragment = d, re.jsx = function(e, u, R, F, O) {
|
|
251
|
+
var w = 1e4 > x.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return c(
|
|
253
253
|
e,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
u,
|
|
255
|
+
R,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
F,
|
|
258
|
+
O,
|
|
259
|
+
w ? Error("react-stack-top-frame") : Z,
|
|
260
|
+
w ? D(h(e)) : p
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
262
|
+
}, re.jsxs = function(e, u, R, F, O) {
|
|
263
|
+
var w = 1e4 > x.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return c(
|
|
265
265
|
e,
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
u,
|
|
267
|
+
R,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
F,
|
|
270
|
+
O,
|
|
271
|
+
w ? Error("react-stack-top-frame") : Z,
|
|
272
|
+
w ? D(h(e)) : p
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
}()),
|
|
275
|
+
}()), re;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
278
|
-
function
|
|
279
|
-
return
|
|
277
|
+
var de;
|
|
278
|
+
function ve() {
|
|
279
|
+
return de || (de = 1, process.env.NODE_ENV === "production" ? oe.exports = pe() : oe.exports = ye()), oe.exports;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
282
|
-
const
|
|
283
|
-
},
|
|
281
|
+
var be = ve();
|
|
282
|
+
const S = () => {
|
|
283
|
+
}, Ee = Re({
|
|
284
284
|
ref: null,
|
|
285
|
-
watch:
|
|
285
|
+
watch: S,
|
|
286
286
|
actions: {
|
|
287
|
-
reset:
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
287
|
+
reset: S,
|
|
288
|
+
resetField: S,
|
|
289
|
+
setValue: S,
|
|
290
|
+
getValues: S,
|
|
291
|
+
getErrors: S,
|
|
292
|
+
getFieldStates: S,
|
|
293
|
+
getFormStates: S,
|
|
294
|
+
setError: S,
|
|
295
|
+
clearError: S,
|
|
296
|
+
clearErrors: S,
|
|
297
|
+
checkValidity: S,
|
|
298
|
+
getNumberFields: S,
|
|
299
|
+
getFieldValidity: S,
|
|
300
|
+
getDefaultValues: S,
|
|
301
|
+
setFieldState: S,
|
|
302
|
+
resetFieldState: S,
|
|
303
|
+
getControlledFields: S
|
|
299
304
|
},
|
|
300
|
-
registerController:
|
|
301
|
-
registerHookWatcher:
|
|
302
|
-
lastReloadedAt:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}),
|
|
305
|
+
registerController: S,
|
|
306
|
+
registerHookWatcher: S,
|
|
307
|
+
lastReloadedAt: S,
|
|
308
|
+
loadFormValues: S,
|
|
309
|
+
getWatchValue: S,
|
|
310
|
+
channels: {}
|
|
311
|
+
}), he = () => Se(Ee), Ve = ({
|
|
307
312
|
id: s,
|
|
308
|
-
control:
|
|
313
|
+
control: n,
|
|
309
314
|
method: l,
|
|
310
|
-
action:
|
|
311
|
-
children:
|
|
312
|
-
onSubmit:
|
|
315
|
+
action: h,
|
|
316
|
+
children: b,
|
|
317
|
+
onSubmit: g = () => {
|
|
318
|
+
},
|
|
319
|
+
onInput: E = () => {
|
|
313
320
|
},
|
|
314
|
-
|
|
321
|
+
onChange: y = () => {
|
|
315
322
|
},
|
|
316
|
-
|
|
323
|
+
onBlur: T = () => {
|
|
317
324
|
},
|
|
318
|
-
onReset:
|
|
325
|
+
onReset: k = () => {
|
|
319
326
|
},
|
|
320
|
-
numberFields:
|
|
321
|
-
className:
|
|
322
|
-
...
|
|
323
|
-
}) => (
|
|
327
|
+
numberFields: c = [],
|
|
328
|
+
className: m,
|
|
329
|
+
...a
|
|
330
|
+
}) => (ae(() => {
|
|
331
|
+
const o = n.channels.subscribe("onChange", y), i = n.channels.subscribe("onBlur", T);
|
|
332
|
+
return () => {
|
|
333
|
+
o(), i();
|
|
334
|
+
};
|
|
335
|
+
}, []), /* @__PURE__ */ be.jsx(Ee.Provider, { value: n, children: /* @__PURE__ */ be.jsx(
|
|
324
336
|
"form",
|
|
325
337
|
{
|
|
326
338
|
id: s,
|
|
327
|
-
ref:
|
|
328
|
-
action:
|
|
339
|
+
ref: n.ref,
|
|
340
|
+
action: h,
|
|
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
|
+
g(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
|
+
) })), Te = ({ control: s, name: n, compute: l }) => {
|
|
367
|
+
const { getWatchValue: h, registerHookWatcher: b } = s || he(), g = h({ name: n, compute: l }), [E, y] = ue(g);
|
|
368
|
+
return ae(() => {
|
|
369
|
+
const T = b({ name: n, compute: l, value: E, setValue: y });
|
|
370
|
+
return () => T.forEach((k) => k());
|
|
371
|
+
}, []), E;
|
|
372
|
+
}, Fe = ({ name: s, defaultValue: n }) => {
|
|
373
|
+
const { actions: l, registerController: h, channels: b } = he(), g = j(), E = l.getDefaultValues()[s] || n, [y, T] = ue(E), k = Te({ 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
|
+
T(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, y, l.getValues());
|
|
382
|
+
}, []);
|
|
383
|
+
return ae(() => h(s, T), []), { ref: g, name: s, defaultValue: E, value: y, onChange: m, onBlur: a, customState: k, setCustomState: c };
|
|
384
|
+
}, We = ({
|
|
362
385
|
name: s,
|
|
363
|
-
defaultValue:
|
|
364
|
-
render: l = ({ ref:
|
|
386
|
+
defaultValue: n,
|
|
387
|
+
render: l = ({ ref: h, name: b, defaultValue: g, value: E, onChange: y, onBlur: T, customState: k, setCustomState: c }) => null
|
|
365
388
|
}) => {
|
|
366
|
-
const
|
|
367
|
-
return l(
|
|
368
|
-
},
|
|
389
|
+
const h = Fe({ name: s, defaultValue: n });
|
|
390
|
+
return l(h);
|
|
391
|
+
}, _e = ["errors", "fieldStates", "formState"], q = (s) => _e.some((n) => s.startsWith(n)) ? s : "values." + s, ke = [
|
|
369
392
|
"badInput",
|
|
370
393
|
"customError",
|
|
371
394
|
"patternMismatch",
|
|
@@ -376,219 +399,312 @@ const h = () => {
|
|
|
376
399
|
"tooShort",
|
|
377
400
|
"typeMismatch",
|
|
378
401
|
"valueMissing"
|
|
379
|
-
],
|
|
402
|
+
], me = (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 = ke.find((h) => n[h]);
|
|
384
405
|
if (l) return { type: l, message: s.validationMessage };
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
406
|
+
};
|
|
407
|
+
class Ae {
|
|
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 h;
|
|
417
|
+
return (h = this.events.get(n)) == null ? void 0 : h.delete(l);
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
publish(n, ...l) {
|
|
421
|
+
const h = this.events.get(n);
|
|
422
|
+
h && h.forEach((b) => b(...l)), this.events.forEach((b, g) => {
|
|
423
|
+
n.includes(g) && b.forEach((E) => E(...l));
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
reset() {
|
|
427
|
+
this.events.clear();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const we = () => {
|
|
431
|
+
const s = j(new Ae()), n = f((b, ...g) => {
|
|
432
|
+
s.current.publish(b, ...g);
|
|
433
|
+
}, []), l = f((b, g) => s.current.subscribe(b, g), []), h = f(() => {
|
|
434
|
+
s.current.reset();
|
|
435
|
+
}, []);
|
|
436
|
+
return { publish: n, subscribe: l, reset: h };
|
|
437
|
+
}, Oe = () => {
|
|
438
|
+
const [s, n] = ue(), 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
|
+
}, Ce = () => {
|
|
441
|
+
const [, s] = ue({});
|
|
442
|
+
return f(() => s({}), []);
|
|
443
|
+
}, je = ({ channels: s, getValues: n, getErrors: l, getFieldStates: h, getFormState: b }) => {
|
|
444
|
+
const g = Ce(), 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: { ...h() }
|
|
428
459
|
}
|
|
460
|
+
);
|
|
461
|
+
}, []), y = f((c) => {
|
|
462
|
+
if (!c)
|
|
463
|
+
return s.subscribe("values", () => {
|
|
464
|
+
g();
|
|
465
|
+
}), n();
|
|
466
|
+
if (typeof c == "string") {
|
|
467
|
+
const m = q(c);
|
|
468
|
+
return s.subscribe(m, () => {
|
|
469
|
+
g();
|
|
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
|
+
g();
|
|
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
|
+
}, []), T = 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 I = q(A), $ = s.subscribe(I, () => {
|
|
499
|
+
const B = E({ name: A });
|
|
500
|
+
i[A] !== B && (i[A] = B, o({ ...i }));
|
|
501
|
+
});
|
|
502
|
+
d.push($);
|
|
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: y, registerHookWatcher: T, getWatchValue: E, subscribe: k };
|
|
530
|
+
}, Pe = [], xe = {}, $e = ({
|
|
531
|
+
numberFields: s = Pe,
|
|
532
|
+
defaultValues: n = xe,
|
|
533
|
+
shouldUnRegister: l = !1,
|
|
534
|
+
shouldConvertNumber: h = !1
|
|
535
|
+
} = {}) => {
|
|
536
|
+
const [b, g] = Oe(), E = j(), y = j(!1), T = j(!1), k = j(s), c = j(/* @__PURE__ */ new Map()), m = j({}), a = j({}), o = j(n), i = j(n), d = we(), 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
|
+
}, []), I = f((r = {}) => {
|
|
542
|
+
i.current = { ...i.current, ...r }, o.current = { ...i.current }, c.current.forEach((t, v) => {
|
|
543
|
+
t(i.current[v]);
|
|
544
|
+
}), y.current = !1, m.current = {}, k.current = s, c.current = /* @__PURE__ */ new Map(), d.reset(), A(), s.length > 0 && (h = !0), g();
|
|
545
|
+
}, []), $ = f(() => {
|
|
546
|
+
const r = Object.fromEntries(new FormData(E.current));
|
|
547
|
+
return c.current.forEach((v) => {
|
|
548
|
+
r[v] = o.current[v];
|
|
549
|
+
}), h && k.current.forEach(
|
|
550
|
+
(v) => r.hasOwnProperty(v) && (r[v] = Number(r[v]) || 0)
|
|
522
551
|
), r;
|
|
523
|
-
}, []),
|
|
552
|
+
}, []), B = f(() => !!Object.values(M()).find((r) => r.isDirty), []), J = f(() => !!Object.values(x()).find((r) => !!r), []), te = f((r) => me(r.target), []), se = f(() => i.current, []), ne = f(() => k.current, []), z = f(() => c.current, []), P = f((r, t) => t ? Array.isArray(t) ? t.map((v) => r[v]) : r[t] : { ...r }, []), G = f((r) => P(o.current, r), [P]), x = f((r) => P(m.current, r), [P]), M = f((r) => P(a.current, r), [P]), N = f(
|
|
553
|
+
(r) => P(
|
|
554
|
+
{
|
|
555
|
+
isDirty: y.current,
|
|
556
|
+
isError: T.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 } = je({
|
|
565
|
+
channels: d,
|
|
566
|
+
getValues: G,
|
|
567
|
+
getErrors: x,
|
|
568
|
+
getFieldStates: M,
|
|
569
|
+
getFormState: N
|
|
570
|
+
}), p = f((r, t, v) => {
|
|
571
|
+
const C = a.current[r];
|
|
572
|
+
C[t] !== v && (a.current[r] = { ...C, [t]: v }, d.publish(`fieldStates.${r}.${t}`, v), t === "isError" && d.publish("formState.errorFields", N("errorFields")), t === "isDirty" && d.publish("formState.dirtyFields", N("dirtyFields")), t === "isTouched" && d.publish("formState.touchedFields", N("touchedFields")));
|
|
573
|
+
}, []), Q = f(
|
|
574
|
+
(r) => {
|
|
575
|
+
p(r, "isError", !1), p(r, "isDirty", !1), p(r, "isTouched", !1), p(r, "customState", null);
|
|
576
|
+
},
|
|
577
|
+
[p]
|
|
578
|
+
), e = f(
|
|
579
|
+
(r, t) => {
|
|
580
|
+
if (m.current[r] === t) return;
|
|
581
|
+
m.current[r] = t, p(r, "isError", !!t), d.publish(`errors.${r}`, t);
|
|
582
|
+
const C = J();
|
|
583
|
+
T.current !== C && (T.current = C, d.publish("formState.isError", C));
|
|
584
|
+
},
|
|
585
|
+
[p]
|
|
586
|
+
), u = f(
|
|
587
|
+
(r) => {
|
|
588
|
+
if (!m.current[r]) return;
|
|
589
|
+
m.current[r] = null, p(r, "isError", !1), d.publish(`errors.${r}`, null);
|
|
590
|
+
const t = J();
|
|
591
|
+
T.current !== t && (T.current = t, d.publish("formState.isError", t));
|
|
592
|
+
},
|
|
593
|
+
[p]
|
|
594
|
+
), R = f(() => {
|
|
595
|
+
if (Object.keys(m.current) === 0) return;
|
|
596
|
+
m.current = {}, d.publish("errors", m.current);
|
|
597
|
+
const r = J();
|
|
598
|
+
T.current !== r && (T.current = r, d.publish("formState.isError", r));
|
|
599
|
+
}, []), F = f(
|
|
600
|
+
(r) => {
|
|
601
|
+
const t = me(r.target);
|
|
602
|
+
t ? e(r.target.name, t) : u(r.target.name);
|
|
603
|
+
},
|
|
604
|
+
[e, u]
|
|
605
|
+
), O = f(
|
|
606
|
+
(r, t, { shouldDirty: v = !0, shouldOnChange: C = !0 } = {}) => {
|
|
607
|
+
if (t === o.current[r]) return;
|
|
608
|
+
h && k.current.includes(r) && (t = Number(t) || void 0), p(r, "isTouched", !0);
|
|
609
|
+
const K = t !== i.current[r];
|
|
610
|
+
v && a.current[r].isDirty !== K && p(r, "isDirty", K);
|
|
611
|
+
const Y = B();
|
|
612
|
+
y.current !== Y && (y.current = Y, d.publish("formState.isDirty", Y)), o.current[r] = t;
|
|
613
|
+
const U = c.current.get(r);
|
|
614
|
+
U && U(t), d.publish(`values.${r}`, t, { shouldDirty: v, shouldOnChange: C }), C && d.publish("onChange", r, t, o.current);
|
|
615
|
+
},
|
|
616
|
+
[p]
|
|
617
|
+
), w = f((r, t) => (c.current.set(r, t), () => {
|
|
618
|
+
l && c.current.delete(r);
|
|
619
|
+
}), []), L = f(
|
|
620
|
+
(r, { keepError: t, keepDirty: v, keepTouched: C, keepCustomState: K, defaultValue: Y }) => {
|
|
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] = Y, o.current[r] = Y, U && U(Y), t || u(r), v || p(r, "isDirty", !1), C || p(r, "isTouched", !1), K || p(r, "customState", null);
|
|
625
|
+
},
|
|
626
|
+
[u, p]
|
|
627
|
+
), V = ce(
|
|
524
628
|
() => ({
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
629
|
+
subscribe: Z,
|
|
630
|
+
reset: I,
|
|
631
|
+
resetField: L,
|
|
632
|
+
setValue: O,
|
|
633
|
+
getValues: G,
|
|
634
|
+
getErrors: x,
|
|
635
|
+
getFieldStates: M,
|
|
636
|
+
getFormState: N,
|
|
637
|
+
setError: e,
|
|
638
|
+
clearError: u,
|
|
639
|
+
clearErrors: R,
|
|
640
|
+
checkValidity: F,
|
|
641
|
+
getNumberFields: ne,
|
|
642
|
+
getFieldValidity: te,
|
|
643
|
+
getDefaultValues: se,
|
|
644
|
+
setFieldState: p,
|
|
645
|
+
resetFieldState: Q,
|
|
646
|
+
getControlledFields: z
|
|
537
647
|
}),
|
|
538
648
|
[
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
N,
|
|
542
|
-
M,
|
|
649
|
+
Z,
|
|
650
|
+
I,
|
|
543
651
|
L,
|
|
652
|
+
O,
|
|
653
|
+
G,
|
|
654
|
+
x,
|
|
655
|
+
M,
|
|
656
|
+
N,
|
|
544
657
|
e,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
658
|
+
u,
|
|
659
|
+
R,
|
|
660
|
+
F,
|
|
548
661
|
ne,
|
|
549
|
-
|
|
550
|
-
|
|
662
|
+
te,
|
|
663
|
+
se,
|
|
664
|
+
p,
|
|
665
|
+
Q,
|
|
666
|
+
z
|
|
551
667
|
]
|
|
552
|
-
),
|
|
668
|
+
), _ = ce(
|
|
553
669
|
() => ({
|
|
554
670
|
ref: E,
|
|
555
|
-
watch:
|
|
556
|
-
actions:
|
|
557
|
-
registerController:
|
|
558
|
-
registerHookWatcher:
|
|
559
|
-
lastReloadedAt:
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
671
|
+
watch: D,
|
|
672
|
+
actions: V,
|
|
673
|
+
registerController: w,
|
|
674
|
+
registerHookWatcher: H,
|
|
675
|
+
lastReloadedAt: b,
|
|
676
|
+
loadFormValues: $,
|
|
677
|
+
getWatchValue: X,
|
|
678
|
+
channels: d
|
|
563
679
|
}),
|
|
564
680
|
[
|
|
565
681
|
E,
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
682
|
+
D,
|
|
683
|
+
V,
|
|
684
|
+
w,
|
|
685
|
+
H,
|
|
686
|
+
b,
|
|
687
|
+
$,
|
|
688
|
+
X,
|
|
689
|
+
d
|
|
574
690
|
]
|
|
575
|
-
),
|
|
576
|
-
return
|
|
691
|
+
), W = ce(() => ({ control: _, actions: V, watch: D }), [b, _, V, D]);
|
|
692
|
+
return ie(() => {
|
|
577
693
|
if ([...E.current.querySelectorAll("[name]")].forEach((t) => {
|
|
578
|
-
!t.defaultValue &&
|
|
694
|
+
!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
695
|
}), E.current) {
|
|
580
|
-
const t =
|
|
581
|
-
|
|
696
|
+
const t = $();
|
|
697
|
+
o.current = { ...t }, i.current = { ...t };
|
|
582
698
|
}
|
|
583
|
-
}, [
|
|
584
|
-
|
|
585
|
-
}, []),
|
|
699
|
+
}, [b]), ie(() => {
|
|
700
|
+
A();
|
|
701
|
+
}, []), W;
|
|
586
702
|
};
|
|
587
703
|
export {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
704
|
+
We as Controller,
|
|
705
|
+
Ve as Form,
|
|
706
|
+
Fe as useController,
|
|
707
|
+
$e as useForm,
|
|
708
|
+
he as useFormContext,
|
|
709
|
+
Te as useWatch
|
|
594
710
|
};
|