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