@sheetxl/utils-mui 0.8.0-beta.2 → 0.8.0-beta.21
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/LICENSE.md +17 -7
- package/browser/esm/{Dypk9nOG6XqTqq_J.mjs → CZTs_B098Z3VLwtH.mjs} +5 -5
- package/browser/esm/{BTjqmdqRredVe5QC.mjs → CxrWP6EfUrThqSuY.mjs} +865 -738
- package/browser/esm/index.mjs +751 -696
- package/licenses/dependencies.txt +2 -74
- package/node/esm/{CwSLcaHUI7AukMBS.mjs → DTa5twriT7hpPLUG.mjs} +4 -4
- package/node/esm/index.mjs +709 -635
- package/package.json +11 -14
- package/types/src/command/CommandGroup.d.ts +1 -1
- package/types/src/command/CommandPopupButton.d.ts +3 -3
- package/types/src/components/ContextMenu.d.ts +2 -2
- package/types/src/components/ScrollButtons.d.ts +3 -3
- package/types/src/components/index.d.ts +1 -0
- package/types/src/components/lazyPanel.d.ts +23 -0
- package/types/src/float/ExhibitFloatPanel.d.ts +4 -4
- package/types/src/float/ExhibitFloatProvider.d.ts +1 -1
- package/types/src/float/ExhibitPopup.d.ts +15 -7
- package/types/src/theme/ExhibitTheme.d.ts +0 -8
- package/browser/cjs/BUKGN088i3WnPm2X.cjs +0 -3
- package/browser/cjs/BoIvdNHQ8K9GSQnQ.cjs +0 -1
- package/browser/cjs/index.cjs +0 -4
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/utils-mui - Utilities MUI - Utilities for MUI Components needed for all SheetXL components. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/utils-mui - Utilities MUI - Utilities for MUI Components needed for all SheetXL components. - v0.8.0-beta.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License:
|
|
5
|
+
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
import { Backdrop as e, Box as t, Button as n, Chip as r, CircularProgress as i, DialogActions as a, DialogContent as o, DialogTitle as s, Fade as c, IconButton as l, Paper as u, Tooltip as d, Typography as f, Unstable_TrapFocus as p, createTheme as m, useTheme as h, useThemeProps as g } from "@mui/material";
|
|
8
8
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
9
|
import * as b from "react";
|
|
10
|
-
import x, {
|
|
11
|
-
import { alpha as
|
|
12
|
-
import { CommonUtils as
|
|
13
|
-
import { Command as te, DynamicIcon as ne, KeyCodes as re, KeyModifiers as
|
|
14
|
-
import { deepmerge as
|
|
15
|
-
import
|
|
16
|
-
var
|
|
17
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i, a =
|
|
10
|
+
import x, { cloneElement as S, forwardRef as C, memo as w, useEffect as T, useId as E, useLayoutEffect as D, useMemo as O, useRef as k, useState as A, version as ee } from "react";
|
|
11
|
+
import { alpha as j, darken as M, lighten as N } from "@mui/system";
|
|
12
|
+
import { CommonUtils as P } from "@sheetxl/utils";
|
|
13
|
+
import { Command as te, DynamicIcon as ne, KeyCodes as re, KeyModifiers as F, NotifierType as ie, ReactUtils as I, RenderSlot as ae, floatThemeScopeProps as oe, getScrollbarCssVariables as L, useCallbackRef as se, useFloatSurface as ce, useFullscreenPortal as le, useImperativeElement as ue, useMeasure as de, useTranslator as fe, zIndexVar as pe } from "@sheetxl/utils-react";
|
|
14
|
+
import { deepmerge as me } from "@mui/utils";
|
|
15
|
+
import he, { createPortal as ge } from "react-dom";
|
|
16
|
+
var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, be = Object.getOwnPropertyNames, xe = Object.getPrototypeOf, Se = Object.prototype.hasOwnProperty, Ce = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), we = (e, t, n) => (n = e == null ? {} : _e(xe(e)), ((e, t, n, r) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i, a = be(t), o = 0, s = a.length; o < s; o++) i = a[o], Se.call(e, i) || i === n || ve(e, i, {
|
|
18
18
|
get: ((e) => t[e]).bind(null, i),
|
|
19
|
-
enumerable: !(r =
|
|
19
|
+
enumerable: !(r = ye(t, i)) || r.enumerable
|
|
20
20
|
});
|
|
21
21
|
return e;
|
|
22
|
-
})(!t && e && e.__esModule ? n :
|
|
22
|
+
})(!t && e && e.__esModule && Se.call(e, "default") ? n : ve(n, "default", {
|
|
23
23
|
value: e,
|
|
24
24
|
enumerable: !0
|
|
25
25
|
}), e));
|
|
26
|
-
function
|
|
26
|
+
function Te(e) {
|
|
27
27
|
var t, n, r = "";
|
|
28
28
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
29
|
-
else if (typeof e == "object")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
else if (typeof e == "object") {
|
|
30
|
+
if (Array.isArray(e)) {
|
|
31
|
+
var i = e.length;
|
|
32
|
+
for (t = 0; t < i; t++) e[t] && (n = Te(e[t])) && (r && (r += " "), r += n);
|
|
33
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
34
|
+
}
|
|
33
35
|
return r;
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
37
|
+
function Ee() {
|
|
38
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Te(e)) && (r && (r += " "), r += t);
|
|
37
39
|
return r;
|
|
38
40
|
}
|
|
39
|
-
function
|
|
41
|
+
function De(e, t) {
|
|
40
42
|
if (typeof e == "function") return e(t);
|
|
41
43
|
e && (e.current = t);
|
|
42
44
|
}
|
|
43
|
-
var
|
|
45
|
+
var Oe = parseInt(ee.split(".")[0], 10) >= 19 ? function(e) {
|
|
44
46
|
return (t) => {
|
|
45
47
|
let n = [];
|
|
46
48
|
for (let r of e) {
|
|
47
|
-
let e =
|
|
48
|
-
n.push(i ? e : () =>
|
|
49
|
+
let e = De(r, t), i = typeof e == "function";
|
|
50
|
+
n.push(i ? e : () => De(r, null));
|
|
49
51
|
}
|
|
50
52
|
return () => {
|
|
51
53
|
for (let e of n) e();
|
|
@@ -53,43 +55,13 @@ var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
53
55
|
};
|
|
54
56
|
} : function(e) {
|
|
55
57
|
return (t) => {
|
|
56
|
-
for (let n of e)
|
|
58
|
+
for (let n of e) De(n, t);
|
|
57
59
|
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
top: 0,
|
|
64
|
-
left: 0,
|
|
65
|
-
bottom: 0,
|
|
66
|
-
right: 0
|
|
67
|
-
}, je = Oe && window.ResizeObserver !== void 0 ? function() {
|
|
68
|
-
var e = A(null), t = e[0], n = e[1], r = A(Ae), i = r[0], a = r[1], o = O(function() {
|
|
69
|
-
return new window.ResizeObserver(function(e) {
|
|
70
|
-
if (e[0]) {
|
|
71
|
-
var t = e[0].contentRect, n = t.x, r = t.y, i = t.width, o = t.height, s = t.top, c = t.left, l = t.bottom, u = t.right;
|
|
72
|
-
a({
|
|
73
|
-
x: n,
|
|
74
|
-
y: r,
|
|
75
|
-
width: i,
|
|
76
|
-
height: o,
|
|
77
|
-
top: s,
|
|
78
|
-
left: c,
|
|
79
|
-
bottom: l,
|
|
80
|
-
right: u
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}, []);
|
|
85
|
-
return ke(function() {
|
|
86
|
-
if (t) return o.observe(t), function() {
|
|
87
|
-
o.disconnect();
|
|
88
|
-
};
|
|
89
|
-
}, [t]), [n, i];
|
|
90
|
-
} : function() {
|
|
91
|
-
return [De, Ae];
|
|
92
|
-
}, Me = w(C((e, n) => {
|
|
60
|
+
};
|
|
61
|
+
function ke(e) {
|
|
62
|
+
return O(() => Oe(e), e);
|
|
63
|
+
}
|
|
64
|
+
var Ae = w(C((e, n) => {
|
|
93
65
|
let { chips: i, sx: a, ...o } = e, s = O(() => {
|
|
94
66
|
if (!i) return null;
|
|
95
67
|
let e = Array.isArray(i) ? i : [i], t = [], n = e.length;
|
|
@@ -100,7 +72,7 @@ var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
100
72
|
color: "primary",
|
|
101
73
|
size: "small",
|
|
102
74
|
sx: { scale: "0.8" }
|
|
103
|
-
}, "chip-" + i) :
|
|
75
|
+
}, "chip-" + i) : S(n, { key: "chip-" + i }), t.push(a);
|
|
104
76
|
}
|
|
105
77
|
return t;
|
|
106
78
|
}, [i]);
|
|
@@ -116,32 +88,37 @@ var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
116
88
|
...o,
|
|
117
89
|
children: s
|
|
118
90
|
});
|
|
119
|
-
})),
|
|
91
|
+
})), je = (e) => {
|
|
120
92
|
if (e.palette.mode === "dark") return `drop-shadow(0px 0px 1px ${e.palette.mode === "dark" ? e.palette.text.primary : e.palette.divider})`;
|
|
121
|
-
},
|
|
93
|
+
}, Me = (e = 1) => (t) => {
|
|
122
94
|
if (t.palette.mode === "dark") return `drop-shadow(0px 0px ${e}px ${t.palette.mode === "dark" ? t.palette.text.primary : t.palette.divider})`;
|
|
123
|
-
},
|
|
95
|
+
}, Ne = (e) => v(ne, {
|
|
124
96
|
...e,
|
|
125
97
|
iconKey: "ArrowDownOutline"
|
|
126
|
-
}),
|
|
98
|
+
}), Pe = (e) => v(ne, {
|
|
127
99
|
...e,
|
|
128
100
|
iconKey: "ArrowRightOutline"
|
|
129
|
-
}),
|
|
101
|
+
}), Fe = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, Ie = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, Le = function(e, t = null) {
|
|
130
102
|
if (!e) return e;
|
|
131
|
-
e = e.replace(
|
|
103
|
+
e = e.replace(Fe, function(e, t, n, r) {
|
|
132
104
|
return t + t + n + n + r + r;
|
|
133
105
|
});
|
|
134
|
-
let n =
|
|
106
|
+
let n = Ie.exec(e);
|
|
135
107
|
return n ? t === null ? `rgb(${parseInt(n[1], 16)}, ${parseInt(n[2], 16)}, ${parseInt(n[3], 16)})` : `rgb(${parseInt(n[1], 16)} ${parseInt(n[2], 16)} ${parseInt(n[3], 16)} / ${100 * t}%)` : e;
|
|
136
|
-
},
|
|
108
|
+
}, Re = function(e, t = .2, n = "light") {
|
|
137
109
|
if (!e) return e;
|
|
138
110
|
let r = n !== "dark";
|
|
139
|
-
t < 0 && (r = !r, t *= -1), e =
|
|
111
|
+
t < 0 && (r = !r, t *= -1), e = Le(e);
|
|
140
112
|
try {
|
|
141
|
-
return r ?
|
|
113
|
+
return r ? M(e, Math.max(0, Math.min(1, 1 * t))) : N(e, Math.max(0, Math.min(1, 1.5 * t)));
|
|
142
114
|
} catch {
|
|
143
115
|
return e;
|
|
144
116
|
}
|
|
117
|
+
}, ze = (e) => {
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
}, R = {
|
|
120
|
+
onMouseDown: ze,
|
|
121
|
+
onTouchStart: ze
|
|
145
122
|
}, Be = (e, t) => {
|
|
146
123
|
let n = m({ palette: { mode: e ? "dark" : "light" } }), r = {
|
|
147
124
|
"--icon-shadow": e ? n.palette.text.primary : n.palette.divider,
|
|
@@ -152,16 +129,19 @@ var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
152
129
|
palette: {
|
|
153
130
|
mode: e ? "dark" : "light",
|
|
154
131
|
text: {
|
|
155
|
-
secondary: e ? n.palette.text.secondary :
|
|
156
|
-
icon: e ?
|
|
132
|
+
secondary: e ? n.palette.text.secondary : j(n.palette.text.secondary, .75),
|
|
133
|
+
icon: e ? j(n.palette.text.secondary, .7) : j(n.palette.text.primary, .75)
|
|
157
134
|
}
|
|
158
135
|
},
|
|
159
136
|
components: {
|
|
160
137
|
MuiDialogTitle: { styleOverrides: { root: { fontWeight: "normal" } } },
|
|
161
138
|
MuiSelect: {
|
|
162
139
|
defaultProps: {
|
|
163
|
-
IconComponent:
|
|
164
|
-
MenuProps: {
|
|
140
|
+
IconComponent: Ne,
|
|
141
|
+
MenuProps: {
|
|
142
|
+
container: () => document.fullscreenElement,
|
|
143
|
+
...R
|
|
144
|
+
}
|
|
165
145
|
},
|
|
166
146
|
styleOverrides: { icon: { top: "unset" } }
|
|
167
147
|
},
|
|
@@ -187,7 +167,10 @@ var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
187
167
|
"&.Mui-selected": {}
|
|
188
168
|
} } },
|
|
189
169
|
MuiMenu: {
|
|
190
|
-
defaultProps: {
|
|
170
|
+
defaultProps: {
|
|
171
|
+
container: () => document.fullscreenElement,
|
|
172
|
+
...R
|
|
173
|
+
},
|
|
191
174
|
styleOverrides: { root: {
|
|
192
175
|
paddingTop: "2px",
|
|
193
176
|
paddingBottom: "2px",
|
|
@@ -245,17 +228,17 @@ var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
245
228
|
} }
|
|
246
229
|
}
|
|
247
230
|
}, a = i;
|
|
248
|
-
return t && (a =
|
|
231
|
+
return t && (a = me(i, t)), m(a);
|
|
249
232
|
};
|
|
250
233
|
function Ve(e, t) {
|
|
251
|
-
return t =
|
|
252
|
-
track:
|
|
253
|
-
thumb:
|
|
234
|
+
return t = me({
|
|
235
|
+
track: Re(e.palette.background.paper, .05, e?.palette.mode),
|
|
236
|
+
thumb: Re(e.palette.background.paper, .3, e?.palette.mode),
|
|
254
237
|
active: e.palette.primary.main,
|
|
255
238
|
corner: e.palette.background.paper,
|
|
256
239
|
outline: !1
|
|
257
240
|
}, t || {}), L({
|
|
258
|
-
track:
|
|
241
|
+
track: j(t.track, .2),
|
|
259
242
|
thumb: t.thumb,
|
|
260
243
|
button: t.button,
|
|
261
244
|
active: t.active,
|
|
@@ -305,7 +288,7 @@ function He(e, t) {
|
|
|
305
288
|
},
|
|
306
289
|
"&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": { backgroundColor: "var(--scrollbar-corner-color)" }
|
|
307
290
|
};
|
|
308
|
-
return
|
|
291
|
+
return P.getPlatform() === P.OSType.Firefox && (r["* .pseudo-scrollbar"] = { scrollbarColor: "var(--scrollbar-thumb-color) transparent" }, r["* .pseudo-scrollbar:hover:not([disabled])"] = { scrollbarColor: "var(--scrollbar-active-color) transparent" }), r;
|
|
309
292
|
}
|
|
310
293
|
var Ue = C((e, t) => {
|
|
311
294
|
let { slotProps: n, ...r } = e, { getPortalContainer: i, isFullscreen: a } = le();
|
|
@@ -334,11 +317,11 @@ var We = w((e) => {
|
|
|
334
317
|
borderLeftWidth: "1px",
|
|
335
318
|
borderRightWidth: "1px",
|
|
336
319
|
borderBottomWidth: "2px",
|
|
337
|
-
borderTopColor: (e) =>
|
|
338
|
-
borderLeftColor: (e) =>
|
|
339
|
-
borderRightColor: (e) =>
|
|
340
|
-
borderBottomColor: (e) =>
|
|
341
|
-
backgroundColor: (e) =>
|
|
320
|
+
borderTopColor: (e) => j(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
321
|
+
borderLeftColor: (e) => j(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
322
|
+
borderRightColor: (e) => j(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
323
|
+
borderBottomColor: (e) => j(e.palette.background.paper, 1 - e.palette.action.disabledOpacity),
|
|
324
|
+
backgroundColor: (e) => j(e.palette.action.hover, e.palette.action.disabledOpacity),
|
|
342
325
|
paddingLeft: "4px",
|
|
343
326
|
paddingRight: "4px",
|
|
344
327
|
minHeight: "1.6em",
|
|
@@ -377,25 +360,27 @@ var We = w((e) => {
|
|
|
377
360
|
if (!e?.key) return null;
|
|
378
361
|
let a = {};
|
|
379
362
|
for (let t = 0; e.modifiers && t < e.modifiers.length; t++) a[e.modifiers[t]] = !0;
|
|
380
|
-
let o = [], s =
|
|
381
|
-
return a?.[
|
|
363
|
+
let o = [], s = P.getPlatform() === P.OSType.MacOS || P.getPlatform() === P.OSType.IOS ? n("shortcut.modifier.cmd") : n("shortcut.modifier.ctrl");
|
|
364
|
+
return a?.[F.Ctrl] && (o.push(v(We, { modifier: r ? "^" : v("div", {
|
|
382
365
|
style: { paddingRight: "1px" },
|
|
383
366
|
children: s
|
|
384
|
-
}) }, "ctrl")), o.push("+")), a?.[
|
|
367
|
+
}) }, "ctrl")), o.push("+")), a?.[F.Alt] && (o.push(v(We, { modifier: r ? "⌥" : n("shortcut.modifier.alt") }, "alt")), o.push("+")), a?.[F.Shift] && (o.push(v(We, { modifier: r ? "⇧" : v("div", {
|
|
385
368
|
style: { paddingRight: "1px" },
|
|
386
369
|
children: n("shortcut.modifier.shift")
|
|
387
|
-
}) }, "shift")), o.push("+")), a?.[
|
|
370
|
+
}) }, "shift")), o.push("+")), a?.[F.Meta] && (o.push(v(We, { modifier: r ? v("div", {
|
|
388
371
|
style: { paddingTop: "1px" },
|
|
389
372
|
children: "⌘"
|
|
390
|
-
}) : n("shortcut.modifier.meta") }, "meta")), o.push("+")), o.push(v(We, { modifier:
|
|
373
|
+
}) : n("shortcut.modifier.meta") }, "meta")), o.push("+")), o.push(v(We, { modifier: I.toPrettyKeyCode(e.key) }, "character")), v(t, {
|
|
391
374
|
sx: {
|
|
392
375
|
display: "flex",
|
|
393
|
-
alignItems: "center"
|
|
376
|
+
alignItems: "center",
|
|
377
|
+
flexShrink: 0,
|
|
378
|
+
whiteSpace: "nowrap"
|
|
394
379
|
},
|
|
395
380
|
children: o
|
|
396
381
|
}, i);
|
|
397
382
|
}, Ke = w(C((e, n) => {
|
|
398
|
-
let { disabled: r = !1, label: i, shortcut: a, chips: o, description: s, maxWidth: c = 280, useModifierSymbols: l = !1, children: u, simple: d, componentDisabled: p = !1, sx: m, ...h } = e, g =
|
|
383
|
+
let { disabled: r = !1, label: i, shortcut: a, chips: o, description: s, maxWidth: c = 280, useModifierSymbols: l = !1, children: u, simple: d, componentDisabled: p = !1, sx: m, ...h } = e, g = fe(), b = null;
|
|
399
384
|
a && (b = Ge(a, g, l));
|
|
400
385
|
let [x, S] = A(null);
|
|
401
386
|
return T(() => {
|
|
@@ -431,7 +416,7 @@ var We = w((e) => {
|
|
|
431
416
|
sx: { flex: "1 1 100%" },
|
|
432
417
|
children: x
|
|
433
418
|
}),
|
|
434
|
-
o ? v(
|
|
419
|
+
o ? v(Ae, { chips: o }) : null,
|
|
435
420
|
b ? v(t, { sx: { marginLeft: "8px" } }, "leadingSpace") : v(_, {}),
|
|
436
421
|
b
|
|
437
422
|
]
|
|
@@ -484,9 +469,9 @@ var We = w((e) => {
|
|
|
484
469
|
function Xe() {
|
|
485
470
|
Ye || (Ye = !0, Je.registerFromManifest("@sheetxl/utils-mui", import.meta.url, { messages: qe }));
|
|
486
471
|
}
|
|
487
|
-
var Ze =
|
|
472
|
+
var Ze = Ce((e, t) => {
|
|
488
473
|
t.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
489
|
-
}), Qe =
|
|
474
|
+
}), Qe = Ce((e, t) => {
|
|
490
475
|
var n = Ze();
|
|
491
476
|
function r() {}
|
|
492
477
|
function i() {}
|
|
@@ -526,7 +511,7 @@ var Ze = xe((e, t) => {
|
|
|
526
511
|
};
|
|
527
512
|
return a.PropTypes = a, a;
|
|
528
513
|
};
|
|
529
|
-
}), z =
|
|
514
|
+
}), z = we(Ce((e, t) => {
|
|
530
515
|
t.exports = Qe()();
|
|
531
516
|
})(), 1);
|
|
532
517
|
function $e(e, t) {
|
|
@@ -789,7 +774,7 @@ var Et = {
|
|
|
789
774
|
}
|
|
790
775
|
findDOMNode() {
|
|
791
776
|
if (this.props?.nodeRef) return this.props.nodeRef.current;
|
|
792
|
-
let e =
|
|
777
|
+
let e = he;
|
|
793
778
|
return typeof e.findDOMNode == "function" ? e.findDOMNode(this) : null;
|
|
794
779
|
}
|
|
795
780
|
render() {
|
|
@@ -921,7 +906,7 @@ var At = class extends b.Component {
|
|
|
921
906
|
}
|
|
922
907
|
findDOMNode() {
|
|
923
908
|
if (this.props?.nodeRef) return this.props.nodeRef.current;
|
|
924
|
-
let e =
|
|
909
|
+
let e = he;
|
|
925
910
|
return typeof e.findDOMNode == "function" ? e.findDOMNode(this) : null;
|
|
926
911
|
}
|
|
927
912
|
render() {
|
|
@@ -935,7 +920,7 @@ var At = class extends b.Component {
|
|
|
935
920
|
let n = ht(e, t, "px");
|
|
936
921
|
return { [it("transform", at)]: n };
|
|
937
922
|
}(h, c);
|
|
938
|
-
let g = b.Children.only(n), _ =
|
|
923
|
+
let g = b.Children.only(n), _ = Ee(g.props.className || "", i, {
|
|
939
924
|
[a]: this.state.dragging,
|
|
940
925
|
[o]: this.state.dragged
|
|
941
926
|
});
|
|
@@ -1014,15 +999,15 @@ var Mt = {
|
|
|
1014
999
|
top: 0,
|
|
1015
1000
|
right: c.width - s.width,
|
|
1016
1001
|
bottom: c.height - s.height
|
|
1017
|
-
} : null, [s, c]), [p, m] = A(null), [h, g] = A(null), _ = p ?? n ?? null
|
|
1002
|
+
} : null, [s, c]), [p, m] = A(null), [h, g] = A(null), _ = p ?? n ?? null, y = O(() => _ && f ? {
|
|
1003
|
+
x: Math.max(0, Math.min(_.x, f.right)),
|
|
1004
|
+
y: Math.max(0, Math.min(_.y, f.bottom))
|
|
1005
|
+
} : _, [_, f]), b = ke([d, t]);
|
|
1018
1006
|
return v(jt, {
|
|
1019
1007
|
nodeRef: d,
|
|
1020
1008
|
handle: o,
|
|
1021
1009
|
cancel: "[class*=\"MuiDialogContent-root\"]",
|
|
1022
|
-
position:
|
|
1023
|
-
x: Math.max(0, Math.min(_.x, f.right)),
|
|
1024
|
-
y: Math.max(0, Math.min(_.y, f.bottom))
|
|
1025
|
-
} : _, [_, f]) ?? void 0,
|
|
1010
|
+
position: y ?? void 0,
|
|
1026
1011
|
bounds: f ?? ".MuiModal-root",
|
|
1027
1012
|
enableUserSelectHack: !1,
|
|
1028
1013
|
onStop: i,
|
|
@@ -1043,7 +1028,7 @@ var Mt = {
|
|
|
1043
1028
|
});
|
|
1044
1029
|
},
|
|
1045
1030
|
children: v(r, {
|
|
1046
|
-
ref:
|
|
1031
|
+
ref: b,
|
|
1047
1032
|
...l
|
|
1048
1033
|
})
|
|
1049
1034
|
});
|
|
@@ -1054,83 +1039,83 @@ var Mt = {
|
|
|
1054
1039
|
let i = g({
|
|
1055
1040
|
props: n,
|
|
1056
1041
|
name: "MuiDialog"
|
|
1057
|
-
}), a = h(), o =
|
|
1042
|
+
}), a = h(), o = fe(), d = {
|
|
1058
1043
|
enter: .66 * a.transitions.duration.enteringScreen,
|
|
1059
1044
|
exit: .66 * a.transitions.duration.leavingScreen
|
|
1060
|
-
}, { title: f = "SheetXL", onCancel: m, onDone: _, onShow: b, onShown: x, onHide: S, onClose:
|
|
1061
|
-
N && (
|
|
1045
|
+
}, { title: f = "SheetXL", onCancel: m, onDone: _, onShow: b, onShown: x, onHide: S, onClose: C, open: w, autoFocusSel: O, children: ee, transitionDuration: M = d, TransitionProps: N, slots: te = P.EmptyArray, slotProps: F = P.EmptyArray, sx: ie, className: I, onMouseDown: ae, initialPosition: L = Pt, isModal: me = !1, suspendModal: he = !1, restoreFocus: _e = !0, disableAutoDestroy: ve = !1, revealToken: ye, startHidden: be = !1, ...xe } = i, Se = te.transition ?? c, Ce = te.backdrop ?? e, we = te.paper ?? u, Te = F.transition;
|
|
1046
|
+
N && (Te = {
|
|
1062
1047
|
...N,
|
|
1063
|
-
...
|
|
1048
|
+
...Te
|
|
1064
1049
|
});
|
|
1065
|
-
let
|
|
1050
|
+
let De = F.backdrop, Oe = F.paper, [Ae, je] = A(null), [Me, Ne] = A(!1), [Pe, Fe] = A(!1), Ie = k(null), [Le, Re] = de(), ze = k(null), R = k(null), [Be, Ve] = de(), Ue = k(null), We = E(), Ge = k(null);
|
|
1066
1051
|
D(() => {
|
|
1067
|
-
if (!
|
|
1068
|
-
let e = !!
|
|
1069
|
-
|
|
1052
|
+
if (!Ae || be) return;
|
|
1053
|
+
let e = !!w;
|
|
1054
|
+
Ge.current !== e && (Ge.current = e, Ne(e));
|
|
1070
1055
|
}, [
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1056
|
+
w,
|
|
1057
|
+
Ae,
|
|
1058
|
+
be
|
|
1074
1059
|
]);
|
|
1075
|
-
let
|
|
1076
|
-
m?.(),
|
|
1060
|
+
let qe = se(() => {
|
|
1061
|
+
m?.(), Ne(!1);
|
|
1077
1062
|
}, [m]);
|
|
1078
1063
|
D(() => {
|
|
1079
|
-
if (
|
|
1080
|
-
let e =
|
|
1064
|
+
if (Ae) return;
|
|
1065
|
+
let e = ze.current, t = Ue.current;
|
|
1081
1066
|
if (!e || !t) return;
|
|
1082
1067
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
1083
1068
|
if (n.width === 0 && n.height === 0 || r.width === 0 && r.height === 0) return;
|
|
1084
1069
|
let i = n.height - r.height, a = n.width - r.width, o = .5 * a, s = .5 * i;
|
|
1085
|
-
typeof L?.x == "number" ? o = L.x : typeof L?.x == "string" && (o = a * (parseFloat(L.x) / 100)), typeof L?.y == "number" ? s = L.y : typeof L?.y == "string" && (s = i * (parseFloat(L.y) / 100)),
|
|
1070
|
+
typeof L?.x == "number" ? o = L.x : typeof L?.x == "string" && (o = a * (parseFloat(L.x) / 100)), typeof L?.y == "number" ? s = L.y : typeof L?.y == "string" && (s = i * (parseFloat(L.y) / 100)), je({
|
|
1086
1071
|
x: o,
|
|
1087
1072
|
y: s
|
|
1088
1073
|
});
|
|
1089
1074
|
});
|
|
1090
|
-
let [
|
|
1091
|
-
if (
|
|
1092
|
-
if (
|
|
1093
|
-
let t = R.current?.querySelectorAll?.(
|
|
1075
|
+
let [Je, Ye] = A(!1), [Xe, Ze] = A(null), [Qe, z] = A(null), $e = se((e) => {
|
|
1076
|
+
if (Xe) return Xe.focus(e), !0;
|
|
1077
|
+
if (O) {
|
|
1078
|
+
let t = R.current?.querySelectorAll?.(O);
|
|
1094
1079
|
if (t && t.length > 0) return t[0]?.focus?.(e), !0;
|
|
1095
1080
|
}
|
|
1096
1081
|
return R.current?.focus?.(e), !1;
|
|
1097
|
-
}, [
|
|
1098
|
-
|
|
1099
|
-
} }), []),
|
|
1082
|
+
}, [Xe, O]), et = ue(r, () => ({ focus: (e) => {
|
|
1083
|
+
$e(e);
|
|
1084
|
+
} }), []), tt = k(ye);
|
|
1100
1085
|
T(() => {
|
|
1101
|
-
|
|
1102
|
-
}, [
|
|
1103
|
-
let
|
|
1104
|
-
...
|
|
1086
|
+
ye !== tt.current && (tt.current = ye, Ne(!0));
|
|
1087
|
+
}, [ye]);
|
|
1088
|
+
let B = {
|
|
1089
|
+
...Te,
|
|
1105
1090
|
onExited: (e) => {
|
|
1106
|
-
_?.(null),
|
|
1091
|
+
_?.(null), ve || Te?.onExited?.(e);
|
|
1107
1092
|
},
|
|
1108
1093
|
onExit: (e) => {
|
|
1109
|
-
let t =
|
|
1094
|
+
let t = Qe, n = typeof _e == "function" ? _e() : _e;
|
|
1110
1095
|
t && !1 !== n && requestAnimationFrame(() => {
|
|
1111
|
-
|
|
1112
|
-
}), S?.(),
|
|
1096
|
+
et.current?.contains(document.activeElement) && t.focus();
|
|
1097
|
+
}), S?.(), Fe(!1), Te?.onExit?.(e);
|
|
1113
1098
|
},
|
|
1114
1099
|
onEntered: (e, t) => {
|
|
1115
|
-
b?.(),
|
|
1100
|
+
b?.(), Te?.onEntered?.(e, t);
|
|
1116
1101
|
},
|
|
1117
1102
|
onEntering: (e, t) => {
|
|
1118
|
-
|
|
1103
|
+
Fe(!0), x?.(et.current);
|
|
1119
1104
|
}
|
|
1120
1105
|
};
|
|
1121
1106
|
T(() => {
|
|
1122
|
-
|
|
1123
|
-
}, [
|
|
1124
|
-
let
|
|
1125
|
-
open:
|
|
1107
|
+
Pe && $e();
|
|
1108
|
+
}, [Pe]);
|
|
1109
|
+
let nt = ke([Ue, r]), rt = v(p, {
|
|
1110
|
+
open: Pe,
|
|
1126
1111
|
disableAutoFocus: !0,
|
|
1127
|
-
disableEnforceFocus: !
|
|
1128
|
-
disableRestoreFocus: !0 !==
|
|
1129
|
-
children: v(
|
|
1130
|
-
in:
|
|
1131
|
-
timeout:
|
|
1112
|
+
disableEnforceFocus: !Je,
|
|
1113
|
+
disableRestoreFocus: !0 !== _e,
|
|
1114
|
+
children: v(Se, {
|
|
1115
|
+
in: Me,
|
|
1116
|
+
timeout: M,
|
|
1132
1117
|
role: "presentation",
|
|
1133
|
-
...
|
|
1118
|
+
...B,
|
|
1134
1119
|
children: v(t, {
|
|
1135
1120
|
className: "MuiDialog-container",
|
|
1136
1121
|
ref: R,
|
|
@@ -1140,31 +1125,31 @@ var Mt = {
|
|
|
1140
1125
|
position: "relative"
|
|
1141
1126
|
},
|
|
1142
1127
|
onKeyDown: (e) => {
|
|
1143
|
-
e.which === re.Escape && (
|
|
1128
|
+
e.which === re.Escape && (qe(), Ie.current?.start(e, { center: !1 }), setTimeout(() => Ie.current?.stop(e), 180)), e.stopPropagation();
|
|
1144
1129
|
},
|
|
1145
1130
|
children: y(Nt, {
|
|
1146
|
-
ref:
|
|
1147
|
-
className:
|
|
1131
|
+
ref: nt,
|
|
1132
|
+
className: Ee({ "Mui-focusVisible": Je }, I, "draggable"),
|
|
1148
1133
|
sx: {
|
|
1149
1134
|
"& *": (e) => He(e),
|
|
1150
1135
|
pointerEvents: "auto",
|
|
1151
1136
|
userSelect: "none",
|
|
1152
1137
|
backgroundColor: "var(--sxl-color-elevated, var(--sxl-color-base-100))",
|
|
1153
1138
|
border: "1px solid var(--sxl-color-elevated-border, transparent)",
|
|
1154
|
-
"&:hover:not([disabled]):not(.Mui-focusVisible)": { outline: (e) => `solid ${
|
|
1155
|
-
"&.Mui-focusVisible": { outline: (e) => `solid ${
|
|
1139
|
+
"&:hover:not([disabled]):not(.Mui-focusVisible)": { outline: (e) => `solid ${j(e.palette.text?.primary, .2)} 1px` },
|
|
1140
|
+
"&.Mui-focusVisible": { outline: (e) => `solid ${j(e.palette.text?.primary, .2)} 1px` },
|
|
1156
1141
|
position: "absolute",
|
|
1157
1142
|
maxWidth: "100%",
|
|
1158
|
-
...
|
|
1143
|
+
...ie
|
|
1159
1144
|
},
|
|
1160
|
-
defaultPosition:
|
|
1161
|
-
titleSize:
|
|
1162
|
-
rootSize:
|
|
1163
|
-
PaperComponent:
|
|
1164
|
-
...
|
|
1165
|
-
...
|
|
1145
|
+
defaultPosition: Ae,
|
|
1146
|
+
titleSize: Ve,
|
|
1147
|
+
rootSize: Re,
|
|
1148
|
+
PaperComponent: we,
|
|
1149
|
+
...xe,
|
|
1150
|
+
...Oe,
|
|
1166
1151
|
children: [f ? v(s, {
|
|
1167
|
-
className:
|
|
1152
|
+
className: Ee({ "Mui-selected": Je }, "draggable-title"),
|
|
1168
1153
|
sx: {
|
|
1169
1154
|
cursor: "move",
|
|
1170
1155
|
display: "flex",
|
|
@@ -1178,9 +1163,9 @@ var Mt = {
|
|
|
1178
1163
|
opacity: 1,
|
|
1179
1164
|
transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
|
|
1180
1165
|
},
|
|
1181
|
-
backgroundColor: (e) =>
|
|
1166
|
+
backgroundColor: (e) => j(e.palette.action.hover, .03)
|
|
1182
1167
|
},
|
|
1183
|
-
ref:
|
|
1168
|
+
ref: Be,
|
|
1184
1169
|
children: y(t, {
|
|
1185
1170
|
sx: {
|
|
1186
1171
|
display: "flex",
|
|
@@ -1203,41 +1188,45 @@ var Mt = {
|
|
|
1203
1188
|
children: v(l, {
|
|
1204
1189
|
"aria-label": "close",
|
|
1205
1190
|
sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
|
|
1206
|
-
touchRippleRef:
|
|
1191
|
+
touchRippleRef: Ie,
|
|
1207
1192
|
onPointerDown: (e) => {
|
|
1208
|
-
|
|
1193
|
+
Ie.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
|
|
1209
1194
|
},
|
|
1210
|
-
onPointerUp:
|
|
1195
|
+
onPointerUp: qe,
|
|
1211
1196
|
children: v(ne, { iconKey: "Close" })
|
|
1212
1197
|
})
|
|
1213
1198
|
})]
|
|
1214
1199
|
})
|
|
1215
|
-
}) : null,
|
|
1200
|
+
}) : null, ee]
|
|
1216
1201
|
})
|
|
1217
1202
|
})
|
|
1218
1203
|
})
|
|
1219
|
-
}),
|
|
1220
|
-
|
|
1221
|
-
...
|
|
1222
|
-
open:
|
|
1204
|
+
}), it = null;
|
|
1205
|
+
me && !he && (it = v(Ce, {
|
|
1206
|
+
...De,
|
|
1207
|
+
open: Me,
|
|
1223
1208
|
onMouseDown: (e) => {
|
|
1224
|
-
|
|
1209
|
+
qe(), De?.onMouseDown?.(e);
|
|
1225
1210
|
},
|
|
1226
1211
|
onClick: (e) => {
|
|
1227
|
-
|
|
1212
|
+
C?.(e, "backdropClick"), De?.onClick?.(e);
|
|
1228
1213
|
},
|
|
1229
1214
|
sx: {
|
|
1230
1215
|
pointerEvents: "auto",
|
|
1231
|
-
...
|
|
1216
|
+
...De?.sx
|
|
1232
1217
|
}
|
|
1233
1218
|
}));
|
|
1234
|
-
let { getPortalContainer:
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1219
|
+
let { getPortalContainer: at } = le(), { className: ot, attrs: st } = oe(ce()?.themeScope), ct = ke([
|
|
1220
|
+
et,
|
|
1221
|
+
Le,
|
|
1222
|
+
ze
|
|
1223
|
+
]);
|
|
1224
|
+
return ge(y(t, {
|
|
1225
|
+
className: Ee("MuiModal-root", ot),
|
|
1226
|
+
...st,
|
|
1238
1227
|
sx: {
|
|
1239
1228
|
position: "fixed",
|
|
1240
|
-
zIndex: "
|
|
1229
|
+
zIndex: pe("popup"),
|
|
1241
1230
|
right: "0",
|
|
1242
1231
|
bottom: "0",
|
|
1243
1232
|
top: "0",
|
|
@@ -1246,27 +1235,23 @@ var Mt = {
|
|
|
1246
1235
|
display: "block",
|
|
1247
1236
|
pointerEvents: "none"
|
|
1248
1237
|
},
|
|
1249
|
-
ref:
|
|
1250
|
-
$e,
|
|
1251
|
-
Ie,
|
|
1252
|
-
Re
|
|
1253
|
-
]),
|
|
1238
|
+
ref: ct,
|
|
1254
1239
|
onPointerDown: (e) => {
|
|
1255
|
-
|
|
1240
|
+
Je && (e.target === R.current || e.target.tabIndex < 0) && R.current?.contains(document.activeElement);
|
|
1256
1241
|
},
|
|
1257
1242
|
onContextMenu: (e) => {
|
|
1258
1243
|
e.isPropagationStopped() || e.preventDefault();
|
|
1259
1244
|
},
|
|
1260
1245
|
onFocus: (e) => {
|
|
1261
|
-
!
|
|
1262
|
-
|
|
1263
|
-
}, 100),
|
|
1246
|
+
!Je && (e.target === R.current || e.target.tabIndex < 0) && setTimeout(() => {
|
|
1247
|
+
$e();
|
|
1248
|
+
}, 100), Ye(!0), R.current?.contains(e.target) && e.target !== R.current && Ze(e.target), e.relatedTarget && !Qe && z(e.relatedTarget);
|
|
1264
1249
|
},
|
|
1265
1250
|
onBlur: (e) => {
|
|
1266
|
-
|
|
1251
|
+
et?.current?.contains(e.relatedTarget) || (z(null), Ye(!1));
|
|
1267
1252
|
},
|
|
1268
|
-
children: [
|
|
1269
|
-
}),
|
|
1253
|
+
children: [it, rt]
|
|
1254
|
+
}), at(), We);
|
|
1270
1255
|
})), V = typeof window < "u" ? window : {
|
|
1271
1256
|
screen: {},
|
|
1272
1257
|
navigator: {}
|
|
@@ -1276,51 +1261,60 @@ var Mt = {
|
|
|
1276
1261
|
return !0;
|
|
1277
1262
|
} }, Rt = function() {};
|
|
1278
1263
|
V.addEventListener && V.addEventListener("p", Rt, Lt), V.removeEventListener && V.removeEventListener("p", Rt, !1);
|
|
1279
|
-
var zt = "ontouchstart" in V, Bt = zt || "TouchEvent" in V && It("(any-pointer: coarse)").matches, Vt = (V.navigator.maxTouchPoints || 0) > 0 || Bt, Ht = V.navigator.userAgent || "", Ut = It("(pointer: coarse)").matches && /iPad|Macintosh/.test(Ht) && Math.min(V.screen.width || 0, V.screen.height || 0) >= 768, Wt = (It("(pointer: coarse)").matches || !It("(pointer: fine)").matches && zt) && !/Windows.*Firefox/.test(Ht), Gt = It("(any-pointer: fine)").matches || It("(any-hover: hover)").matches || Ut || !zt, Kt = !Vt || !Gt && Wt ? Vt ? "touchOnly" : "mouseOnly" : "hybrid", qt = Kt === "mouseOnly" ? "mouse" : Kt === "touchOnly" || Wt ? "touch" : "mouse", Jt = (e) => e.type === "checkbox", Yt = (e) => e.type === "file", Xt = (e) => e instanceof Date, H = (e) => e == null, Zt = (e) => typeof e == "object", U = (e) => !H(e) && !Array.isArray(e) && Zt(e) && !Xt(e), Qt = (e) =>
|
|
1280
|
-
let t = e.constructor && e.constructor.prototype;
|
|
1281
|
-
return U(t) && t.hasOwnProperty("isPrototypeOf");
|
|
1282
|
-
}, $t = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
1264
|
+
var zt = "ontouchstart" in V, Bt = zt || "TouchEvent" in V && It("(any-pointer: coarse)").matches, Vt = (V.navigator.maxTouchPoints || 0) > 0 || Bt, Ht = V.navigator.userAgent || "", Ut = It("(pointer: coarse)").matches && /iPad|Macintosh/.test(Ht) && Math.min(V.screen.width || 0, V.screen.height || 0) >= 768, Wt = (It("(pointer: coarse)").matches || !It("(pointer: fine)").matches && zt) && !/Windows.*Firefox/.test(Ht), Gt = It("(any-pointer: fine)").matches || It("(any-hover: hover)").matches || Ut || !zt, Kt = !Vt || !Gt && Wt ? Vt ? "touchOnly" : "mouseOnly" : "hybrid", qt = Kt === "mouseOnly" ? "mouse" : Kt === "touchOnly" || Wt ? "touch" : "mouse", Jt = (e) => e.type === "checkbox", Yt = (e) => e.type === "file", Xt = (e) => e instanceof Date, H = (e) => e == null, Zt = (e) => typeof e == "object", U = (e) => !H(e) && !Array.isArray(e) && Zt(e) && !Xt(e), Qt = /[.[\]'"]/, $t = (e) => e.split(Qt).filter(Boolean), en = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
1283
1265
|
function W(e) {
|
|
1266
|
+
if (typeof e != "object" || !e) return e;
|
|
1284
1267
|
if (e instanceof Date) return new Date(e);
|
|
1285
|
-
let t = typeof FileList < "u" && e instanceof FileList;
|
|
1286
|
-
if (
|
|
1287
|
-
let
|
|
1288
|
-
if (!
|
|
1289
|
-
let
|
|
1290
|
-
for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (
|
|
1291
|
-
return
|
|
1268
|
+
let t = typeof Blob < "u" && e instanceof Blob, n = typeof FileList < "u" && e instanceof FileList;
|
|
1269
|
+
if (en && (t || n)) return e;
|
|
1270
|
+
let r = Array.isArray(e);
|
|
1271
|
+
if (!r && e.constructor !== Object) return e;
|
|
1272
|
+
let i = r ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1273
|
+
for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (i[t] = W(e[t]));
|
|
1274
|
+
return i;
|
|
1292
1275
|
}
|
|
1293
|
-
var
|
|
1276
|
+
var tn = "blur", nn = "focusout", rn = "submit", an = "trigger", on = "valid", sn = "onBlur", cn = "onChange", ln = "onSubmit", un = "onTouched", dn = "all", fn = "max", pn = "min", mn = "maxLength", hn = "minLength", gn = "pattern", _n = "required", vn = "validate", yn = [
|
|
1277
|
+
_n,
|
|
1278
|
+
pn,
|
|
1279
|
+
fn,
|
|
1280
|
+
hn,
|
|
1281
|
+
mn,
|
|
1282
|
+
gn,
|
|
1283
|
+
vn
|
|
1284
|
+
], bn = "form", xn = "root", Sn = [
|
|
1294
1285
|
"__proto__",
|
|
1295
1286
|
"constructor",
|
|
1296
1287
|
"prototype"
|
|
1297
|
-
],
|
|
1288
|
+
], Cn = /^\w*$/, wn = (e) => Cn.test(e), G = (e) => e === void 0, K = (e, t, n) => {
|
|
1298
1289
|
if (!t || !U(e)) return n;
|
|
1299
|
-
let r =
|
|
1300
|
-
if (r.some((e) =>
|
|
1290
|
+
let r = wn(t) ? [t] : $t(t);
|
|
1291
|
+
if (r.some((e) => Sn.includes(e))) return n;
|
|
1301
1292
|
let i = r.reduce((e, t) => H(e) ? void 0 : e[t], e);
|
|
1302
1293
|
return G(i) || i === e ? G(e[t]) ? n : e[t] : i;
|
|
1303
1294
|
}, q = (e) => typeof e == "boolean", J = (e) => typeof e == "function", Y = (e, t, n) => {
|
|
1304
|
-
let r = -1, i =
|
|
1295
|
+
let r = -1, i = wn(t) ? [t] : $t(t), a = i.length, o = a - 1;
|
|
1305
1296
|
for (; ++r < a;) {
|
|
1306
1297
|
let t = i[r], a = n;
|
|
1307
1298
|
if (r !== o) {
|
|
1308
1299
|
let n = e[t];
|
|
1309
1300
|
a = U(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
|
|
1310
1301
|
}
|
|
1311
|
-
if (
|
|
1302
|
+
if (Sn.includes(t)) return;
|
|
1312
1303
|
e[t] = a, e = e[t];
|
|
1313
1304
|
}
|
|
1314
|
-
},
|
|
1315
|
-
|
|
1316
|
-
var
|
|
1317
|
-
|
|
1305
|
+
}, Tn = x.createContext(null);
|
|
1306
|
+
Tn.displayName = "HookFormControlContext";
|
|
1307
|
+
var En = en ? x.useLayoutEffect : x.useEffect, Dn = (e) => H(e) || !Zt(e), On = (e, t) => t.length === 0 && !Array.isArray(e) && !((e) => {
|
|
1308
|
+
let t = e.constructor && e.constructor.prototype;
|
|
1309
|
+
return U(t) && t.hasOwnProperty("isPrototypeOf");
|
|
1310
|
+
})(e);
|
|
1311
|
+
function X(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
1318
1312
|
if (e === t) return !0;
|
|
1319
|
-
if (
|
|
1313
|
+
if (Dn(e) || Dn(t)) return Object.is(e, t);
|
|
1320
1314
|
if (Xt(e) && Xt(t)) return Object.is(e.getTime(), t.getTime());
|
|
1321
1315
|
let r = Object.keys(e), i = Object.keys(t);
|
|
1322
1316
|
if (r.length !== i.length) return !1;
|
|
1323
|
-
if (
|
|
1317
|
+
if (On(e, r) || On(t, i)) return Object.is(e, t);
|
|
1324
1318
|
if (!r.length && Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
1325
1319
|
let a = n.get(e);
|
|
1326
1320
|
if (a && a.has(t)) return !0;
|
|
@@ -1334,168 +1328,168 @@ function Z(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
|
1334
1328
|
if (!(i in t)) return !1;
|
|
1335
1329
|
if (i !== "ref") {
|
|
1336
1330
|
let e = t[i];
|
|
1337
|
-
if (Xt(r) && Xt(e) || (U(r) || Array.isArray(r)) && (U(e) || Array.isArray(e)) ? !
|
|
1331
|
+
if (Xt(r) && Xt(e) || (U(r) || Array.isArray(r)) && (U(e) || Array.isArray(e)) ? !X(r, e, n) : !Object.is(r, e)) return !1;
|
|
1338
1332
|
}
|
|
1339
1333
|
}
|
|
1340
1334
|
return !0;
|
|
1341
1335
|
}
|
|
1342
|
-
var
|
|
1343
|
-
isOnSubmit: !e || e ===
|
|
1344
|
-
isOnBlur: e ===
|
|
1345
|
-
isOnChange: e ===
|
|
1346
|
-
isOnAll: e ===
|
|
1347
|
-
isOnTouch: e ===
|
|
1348
|
-
}),
|
|
1336
|
+
var Z = (e) => typeof e == "string", kn = (e) => ({
|
|
1337
|
+
isOnSubmit: !e || e === ln,
|
|
1338
|
+
isOnBlur: e === sn,
|
|
1339
|
+
isOnChange: e === cn,
|
|
1340
|
+
isOnAll: e === dn,
|
|
1341
|
+
isOnTouch: e === un
|
|
1342
|
+
}), An = (e, t, n) => {
|
|
1349
1343
|
if (n) return !1;
|
|
1350
1344
|
if (t.watchAll || t.watch.has(e)) return !0;
|
|
1351
1345
|
for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
|
|
1352
1346
|
return !1;
|
|
1353
|
-
},
|
|
1354
|
-
for (let
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1347
|
+
}, jn = (e, t, n) => {
|
|
1348
|
+
for (let r of n || Object.keys(e)) {
|
|
1349
|
+
if (r === "_f") continue;
|
|
1350
|
+
let i = n ? K(e, r) : e[r];
|
|
1351
|
+
if (i) {
|
|
1352
|
+
let { _f: e } = i;
|
|
1358
1353
|
if (e) {
|
|
1359
|
-
if (e.refs && e.refs[0] && t(e.refs[0],
|
|
1360
|
-
|
|
1361
|
-
} else if (U(a) && An(a, t)) break;
|
|
1354
|
+
if (e.refs && e.refs[0] && t(e.refs[0], e.name) || e.ref && t(e.ref, e.name) || jn(i, t)) return !0;
|
|
1355
|
+
} else if ((U(i) || Array.isArray(i)) && jn(i, t)) return !0;
|
|
1362
1356
|
}
|
|
1363
1357
|
}
|
|
1364
|
-
},
|
|
1358
|
+
}, Mn = (e, t, n) => {
|
|
1365
1359
|
let r = K(e, n), i = Array.isArray(r) ? r : [];
|
|
1366
|
-
return Y(i,
|
|
1367
|
-
}, Q = (e) => U(e) && !Object.keys(e).length,
|
|
1368
|
-
if (
|
|
1360
|
+
return Y(i, xn, t[n]), Y(e, n, i), e;
|
|
1361
|
+
}, Q = (e) => U(e) && !Object.keys(e).length, Nn = (e) => {
|
|
1362
|
+
if (!en) return !1;
|
|
1369
1363
|
let t = e ? e.ownerDocument : 0;
|
|
1370
1364
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
1371
|
-
},
|
|
1365
|
+
}, Pn = (e) => e.type === "radio", Fn = (e) => e instanceof RegExp, In = (e, t, n, r, i) => t ? {
|
|
1372
1366
|
...n[e],
|
|
1373
1367
|
types: {
|
|
1374
1368
|
...n[e] && n[e].types ? n[e].types : {},
|
|
1375
1369
|
[r]: i || !0
|
|
1376
1370
|
}
|
|
1377
|
-
} : {},
|
|
1371
|
+
} : {}, Ln = {
|
|
1378
1372
|
value: !1,
|
|
1379
1373
|
isValid: !1
|
|
1380
|
-
},
|
|
1374
|
+
}, Rn = {
|
|
1381
1375
|
value: !0,
|
|
1382
1376
|
isValid: !0
|
|
1383
|
-
},
|
|
1384
|
-
if (Array.isArray(e))
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
}
|
|
1392
|
-
return e[0].checked && !e[0].disabled ? e[0].attributes && !G(e[0].attributes.value) ? G(e[0].value) || e[0].value === "" ? Ln : {
|
|
1393
|
-
value: e[0].value,
|
|
1394
|
-
isValid: !0
|
|
1395
|
-
} : Ln : In;
|
|
1377
|
+
}, zn = (e) => {
|
|
1378
|
+
if (!Array.isArray(e)) return Ln;
|
|
1379
|
+
if (e.length > 1) {
|
|
1380
|
+
let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
|
|
1381
|
+
return {
|
|
1382
|
+
value: t,
|
|
1383
|
+
isValid: !!t.length
|
|
1384
|
+
};
|
|
1396
1385
|
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1386
|
+
let t = e[0];
|
|
1387
|
+
return t && t.checked && !t.disabled ? t.attributes && "value" in t.attributes ? G(t.value) || t.value === "" ? Rn : {
|
|
1388
|
+
value: t.value,
|
|
1389
|
+
isValid: !0
|
|
1390
|
+
} : Rn : Ln;
|
|
1391
|
+
}, Bn = {
|
|
1399
1392
|
isValid: !1,
|
|
1400
1393
|
value: null
|
|
1401
|
-
},
|
|
1394
|
+
}, Vn = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
|
|
1402
1395
|
isValid: !0,
|
|
1403
1396
|
value: t.value
|
|
1404
|
-
} : e,
|
|
1405
|
-
function
|
|
1406
|
-
if (
|
|
1397
|
+
} : e, Bn) : Bn;
|
|
1398
|
+
function Hn(e, t, n = "validate") {
|
|
1399
|
+
if (Z(e) || Array.isArray(e) && e.every(Z) || q(e) && !e) return {
|
|
1407
1400
|
type: n,
|
|
1408
|
-
message:
|
|
1401
|
+
message: Z(e) ? e : "",
|
|
1409
1402
|
ref: t
|
|
1410
1403
|
};
|
|
1411
1404
|
}
|
|
1412
|
-
var
|
|
1405
|
+
var Un = (e) => U(e) && !Fn(e) ? e : {
|
|
1413
1406
|
value: e,
|
|
1414
1407
|
message: ""
|
|
1415
|
-
},
|
|
1416
|
-
let { ref: o, refs: s, required: c, maxLength: l, minLength: u, min: d, max: f, pattern: p, validate: m, name: h, valueAsNumber: g, mount: _ } = e._f,
|
|
1408
|
+
}, Wn = async (e, t, n, r, i, a) => {
|
|
1409
|
+
let { ref: o, refs: s, required: c, maxLength: l, minLength: u, min: d, max: f, pattern: p, validate: m, name: h, valueAsNumber: g, mount: _, _c: v } = e._f, y = K(n, h);
|
|
1417
1410
|
if (!_ || t.has(h)) return {};
|
|
1418
|
-
let
|
|
1419
|
-
if (i &&
|
|
1411
|
+
let b = s ? s[0] : o, x = (e) => {
|
|
1412
|
+
if (i && b.reportValidity) {
|
|
1420
1413
|
let t = q(e) ? "" : e || "";
|
|
1421
|
-
s ? s.forEach((e) => e.setCustomValidity(t)) :
|
|
1414
|
+
s ? s.forEach((e) => J(e.setCustomValidity) && e.setCustomValidity(t)) : b.setCustomValidity(t), b.reportValidity();
|
|
1422
1415
|
}
|
|
1423
|
-
},
|
|
1416
|
+
}, S = {}, C = Pn(o), w = Jt(o), T = C || w, E = (g || Yt(o)) && G(o.value) && G(y) || Nn(o) && o.value === "" && !v || y === "" || Array.isArray(y) && !y.length, D = In.bind(null, h, r, S), O = (e, t, n, r = mn, i = hn) => {
|
|
1424
1417
|
let a = e ? t : n;
|
|
1425
|
-
|
|
1418
|
+
S[h] = {
|
|
1426
1419
|
type: e ? r : i,
|
|
1427
1420
|
message: a,
|
|
1428
1421
|
ref: o,
|
|
1429
|
-
...
|
|
1422
|
+
...D(e ? r : i, a)
|
|
1430
1423
|
};
|
|
1431
1424
|
};
|
|
1432
|
-
if (a ? !Array.isArray(
|
|
1433
|
-
let { value: e, message: t } =
|
|
1425
|
+
if (a ? !Array.isArray(y) || !y.length : c && (!T && (E || H(y)) || q(y) && !y || w && !zn(s).isValid || C && !Vn(s).isValid)) {
|
|
1426
|
+
let { value: e, message: t } = Z(c) ? {
|
|
1434
1427
|
value: !!c,
|
|
1435
1428
|
message: c
|
|
1436
|
-
} :
|
|
1437
|
-
if (e && (
|
|
1438
|
-
type:
|
|
1429
|
+
} : Un(c);
|
|
1430
|
+
if (e && (S[h] = {
|
|
1431
|
+
type: _n,
|
|
1439
1432
|
message: t,
|
|
1440
|
-
ref:
|
|
1441
|
-
...
|
|
1442
|
-
}, !r)) return
|
|
1433
|
+
ref: b,
|
|
1434
|
+
...D(_n, t)
|
|
1435
|
+
}, !r)) return x(t), S;
|
|
1443
1436
|
}
|
|
1444
|
-
if (!(
|
|
1445
|
-
let e, t, n =
|
|
1446
|
-
if (H(
|
|
1447
|
-
let r = o.valueAsDate || new Date(
|
|
1448
|
-
|
|
1437
|
+
if (!(E || H(d) && H(f))) {
|
|
1438
|
+
let e, t, n = Un(f), i = Un(d);
|
|
1439
|
+
if (H(y) || Xt(y) || isNaN(y)) {
|
|
1440
|
+
let r = o.valueAsDate || new Date(y), a = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), s = o.type == "time", c = o.type == "week";
|
|
1441
|
+
Z(n.value) && y && (e = s ? a(y) > a(n.value) : c ? y > n.value : r > new Date(n.value)), Z(i.value) && y && (t = s ? a(y) < a(i.value) : c ? y < i.value : r < new Date(i.value));
|
|
1449
1442
|
} else {
|
|
1450
|
-
let r = o.valueAsNumber ||
|
|
1443
|
+
let r = o.valueAsNumber || y && +y;
|
|
1451
1444
|
H(n.value) || (e = r > n.value), H(i.value) || (t = r < i.value);
|
|
1452
1445
|
}
|
|
1453
|
-
if ((e || t) && (
|
|
1446
|
+
if ((e || t) && (O(!!e, n.message, i.message, fn, pn), !r)) return x(S[h].message), S;
|
|
1454
1447
|
}
|
|
1455
|
-
if ((l || u) && !
|
|
1456
|
-
let e =
|
|
1457
|
-
if ((n || i) && (
|
|
1448
|
+
if ((l || u) && !E && (Z(y) || a && Array.isArray(y))) {
|
|
1449
|
+
let e = Un(l), t = Un(u), n = !H(e.value) && y.length > +e.value, i = !H(t.value) && y.length < +t.value;
|
|
1450
|
+
if ((n || i) && (O(n, e.message, t.message), !r)) return x(S[h].message), S;
|
|
1458
1451
|
}
|
|
1459
|
-
if (p && !
|
|
1460
|
-
let { value: e, message: t } =
|
|
1461
|
-
if (
|
|
1462
|
-
type:
|
|
1452
|
+
if (p && !E && Z(y)) {
|
|
1453
|
+
let { value: e, message: t } = Un(p);
|
|
1454
|
+
if (Fn(e) && !y.match(e) && (S[h] = {
|
|
1455
|
+
type: gn,
|
|
1463
1456
|
message: t,
|
|
1464
1457
|
ref: o,
|
|
1465
|
-
...
|
|
1466
|
-
}, !r)) return
|
|
1458
|
+
...D(gn, t)
|
|
1459
|
+
}, !r)) return x(t), S;
|
|
1467
1460
|
}
|
|
1468
1461
|
if (m) {
|
|
1469
1462
|
if (J(m)) {
|
|
1470
|
-
let e =
|
|
1471
|
-
if (e && (
|
|
1463
|
+
let e = Hn(await m(y, n), b);
|
|
1464
|
+
if (e && (S[h] = {
|
|
1472
1465
|
...e,
|
|
1473
|
-
...
|
|
1474
|
-
}, !r)) return
|
|
1466
|
+
...D(vn, e.message)
|
|
1467
|
+
}, !r)) return x(e.message), S;
|
|
1475
1468
|
} else if (U(m)) {
|
|
1476
1469
|
let e = {};
|
|
1477
1470
|
for (let t in m) {
|
|
1478
1471
|
if (!Q(e) && !r) break;
|
|
1479
|
-
let i =
|
|
1472
|
+
let i = Hn(await m[t](y, n), b, t);
|
|
1480
1473
|
i && (e = {
|
|
1481
1474
|
...i,
|
|
1482
|
-
...
|
|
1483
|
-
},
|
|
1475
|
+
...D(t, i.message)
|
|
1476
|
+
}, r || x(i.message), r && (S[h] = e));
|
|
1484
1477
|
}
|
|
1485
|
-
if (!Q(e) && (
|
|
1486
|
-
ref:
|
|
1478
|
+
if (!Q(e) && (S[h] = {
|
|
1479
|
+
ref: b,
|
|
1487
1480
|
...e
|
|
1488
|
-
}, !r)) return
|
|
1481
|
+
}, !r)) return S;
|
|
1489
1482
|
}
|
|
1490
1483
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1484
|
+
let k = S[h];
|
|
1485
|
+
return x(!k || k.message), S;
|
|
1486
|
+
}, Gn = (e) => Array.isArray(e) ? e : [e], Kn = (e) => Array.isArray(e) ? e.filter(Boolean) : [];
|
|
1493
1487
|
function $(e, t) {
|
|
1494
|
-
if (
|
|
1495
|
-
let n = Array.isArray(t) ? t :
|
|
1496
|
-
if (n.some((e) =>
|
|
1488
|
+
if (Z(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
|
|
1489
|
+
let n = Array.isArray(t) ? t : wn(t) ? [t] : $t(t);
|
|
1490
|
+
if (n.some((e) => Sn.includes(String(e)))) return e;
|
|
1497
1491
|
let r = n.length === 1 ? e : function(e, t) {
|
|
1498
|
-
let n = t.
|
|
1492
|
+
let n = t.length - 1, r = 0;
|
|
1499
1493
|
for (; r < n;) {
|
|
1500
1494
|
if (H(e)) {
|
|
1501
1495
|
e = void 0;
|
|
@@ -1510,56 +1504,51 @@ function $(e, t) {
|
|
|
1510
1504
|
return !0;
|
|
1511
1505
|
}(r)) && $(e, n.slice(0, -1)), e;
|
|
1512
1506
|
}
|
|
1513
|
-
var
|
|
1514
|
-
let t = {};
|
|
1515
|
-
for (let n of Object.keys(e)) if (Zt(e[n]) && e[n] !== null && !Xt(e[n])) {
|
|
1516
|
-
let r = Kn(e[n]);
|
|
1517
|
-
for (let e of Object.keys(r)) t[`${n}.${e}`] = r[e];
|
|
1518
|
-
} else t[n] = e[n];
|
|
1519
|
-
return t;
|
|
1520
|
-
}, qn = x.createContext(null);
|
|
1507
|
+
var qn = x.createContext(null);
|
|
1521
1508
|
qn.displayName = "HookFormContext";
|
|
1522
|
-
var Jn = ({ children: e, watch: t, getValues: n,
|
|
1523
|
-
let
|
|
1509
|
+
var Jn = ({ children: e, watch: t, getValues: n, getErrors: r, getFieldState: i, setError: a, clearErrors: o, setValue: s, setValues: c, trigger: l, formState: u, resetField: d, reset: f, resetDefaultValues: p, handleSubmit: m, unregister: h, control: g, register: _, setFocus: v, subscribe: y }) => {
|
|
1510
|
+
let b = x.useMemo(() => ({
|
|
1524
1511
|
watch: t,
|
|
1525
1512
|
getValues: n,
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1513
|
+
getErrors: r,
|
|
1514
|
+
getFieldState: i,
|
|
1515
|
+
setError: a,
|
|
1516
|
+
clearErrors: o,
|
|
1517
|
+
setValue: s,
|
|
1518
|
+
setValues: c,
|
|
1519
|
+
trigger: l,
|
|
1520
|
+
formState: u,
|
|
1521
|
+
resetField: d,
|
|
1522
|
+
reset: f,
|
|
1523
|
+
resetDefaultValues: p,
|
|
1524
|
+
handleSubmit: m,
|
|
1525
|
+
unregister: h,
|
|
1526
|
+
control: g,
|
|
1527
|
+
register: _,
|
|
1528
|
+
setFocus: v,
|
|
1529
|
+
subscribe: y
|
|
1542
1530
|
}), [
|
|
1543
|
-
|
|
1544
|
-
h,
|
|
1545
|
-
l,
|
|
1546
|
-
r,
|
|
1547
|
-
n,
|
|
1548
|
-
p,
|
|
1531
|
+
o,
|
|
1549
1532
|
g,
|
|
1550
|
-
d,
|
|
1551
|
-
f,
|
|
1552
1533
|
u,
|
|
1534
|
+
r,
|
|
1553
1535
|
i,
|
|
1536
|
+
n,
|
|
1537
|
+
m,
|
|
1554
1538
|
_,
|
|
1555
|
-
|
|
1556
|
-
|
|
1539
|
+
f,
|
|
1540
|
+
p,
|
|
1541
|
+
d,
|
|
1542
|
+
a,
|
|
1557
1543
|
v,
|
|
1544
|
+
s,
|
|
1558
1545
|
c,
|
|
1559
|
-
|
|
1546
|
+
y,
|
|
1547
|
+
l,
|
|
1548
|
+
h,
|
|
1560
1549
|
t
|
|
1561
1550
|
]);
|
|
1562
|
-
return x.createElement(qn.Provider, { value:
|
|
1551
|
+
return x.createElement(qn.Provider, { value: b }, x.createElement(Tn.Provider, { value: b.control }, e));
|
|
1563
1552
|
}, Yn = () => {
|
|
1564
1553
|
let e = [];
|
|
1565
1554
|
return {
|
|
@@ -1578,63 +1567,78 @@ var Jn = ({ children: e, watch: t, getValues: n, getFieldState: r, setError: i,
|
|
|
1578
1567
|
};
|
|
1579
1568
|
};
|
|
1580
1569
|
function Xn(e, t) {
|
|
1581
|
-
let n = {};
|
|
1570
|
+
let n = Array.isArray(e) ? [] : {};
|
|
1582
1571
|
for (let r in e) if (e.hasOwnProperty(r)) {
|
|
1583
1572
|
let i = e[r], a = t[r];
|
|
1584
|
-
|
|
1585
|
-
let e = Xn(i, a);
|
|
1586
|
-
U(e) && (n[r] = e);
|
|
1587
|
-
} else e[r] && (n[r] = a);
|
|
1573
|
+
i && (U(i) || Array.isArray(i)) && a ? n[r] = Xn(i, a) : e[r] && (n[r] = a);
|
|
1588
1574
|
}
|
|
1589
1575
|
return n;
|
|
1590
1576
|
}
|
|
1591
|
-
var Zn = (e) => e
|
|
1592
|
-
|
|
1577
|
+
var Zn = (e, t) => e !== null && Zt(e) && Object.prototype.hasOwnProperty.call(e, t), Qn = (e, t) => {
|
|
1578
|
+
if (!t) return !1;
|
|
1579
|
+
let n = e;
|
|
1580
|
+
for (let r of wn(t) ? [t] : $t(t)) {
|
|
1581
|
+
if (!Zn(n, r)) return Zn(e, t);
|
|
1582
|
+
n = n[r];
|
|
1583
|
+
}
|
|
1584
|
+
return !0;
|
|
1585
|
+
}, $n = (e) => e.type === "select-multiple", er = (e) => Nn(e) && e.isConnected;
|
|
1586
|
+
function tr(e) {
|
|
1587
|
+
return Array.isArray(e) || U(e);
|
|
1588
|
+
}
|
|
1589
|
+
function nr(e, t, n = "", r = []) {
|
|
1590
|
+
for (let i in e) {
|
|
1591
|
+
let a = n ? `${n}.${i}` : i, o = e[i];
|
|
1592
|
+
tr(o) && tr(K(t, a)) ? nr(o, t, a, r) : r.push(a);
|
|
1593
|
+
}
|
|
1594
|
+
return r;
|
|
1595
|
+
}
|
|
1596
|
+
function rr(e) {
|
|
1593
1597
|
return Array.isArray(e) || U(e) && !((e) => {
|
|
1594
1598
|
for (let t in e) if (J(e[t])) return !0;
|
|
1595
1599
|
return !1;
|
|
1596
1600
|
})(e);
|
|
1597
1601
|
}
|
|
1598
|
-
function
|
|
1602
|
+
function ir(e) {
|
|
1599
1603
|
return !(!e || !("_f" in e));
|
|
1600
1604
|
}
|
|
1601
|
-
function
|
|
1605
|
+
function ar(e) {
|
|
1602
1606
|
return Array.isArray(e) ? !e.some((e) => !G(e)) : !Object.keys(e).length;
|
|
1603
1607
|
}
|
|
1604
|
-
function
|
|
1608
|
+
function or(e, t) {
|
|
1605
1609
|
Array.isArray(e) ? e[t] = void 0 : delete e[t];
|
|
1606
1610
|
}
|
|
1607
|
-
function
|
|
1611
|
+
function sr(e, t = {}, n) {
|
|
1608
1612
|
for (let r in e) {
|
|
1609
1613
|
let i = e[r], a = n && n[r];
|
|
1610
|
-
|
|
1614
|
+
!rr(i) || Array.isArray(i) && ir(a) ? G(i) || (t[r] = !0) : (t[r] = Array.isArray(i) ? [] : {}, sr(i, t[r], a), ar(t[r]) && or(t, r));
|
|
1611
1615
|
}
|
|
1612
1616
|
return t;
|
|
1613
1617
|
}
|
|
1614
|
-
function
|
|
1615
|
-
n ||=
|
|
1618
|
+
function cr(e, t, n, r) {
|
|
1619
|
+
n ||= sr(t, {}, r);
|
|
1616
1620
|
for (let i in e) {
|
|
1617
1621
|
let a = e[i], o = r && r[i];
|
|
1618
|
-
|
|
1622
|
+
!rr(a) || Array.isArray(a) && ir(o) ? X(a, t[i]) ? or(n, i) : n[i] = !0 : (G(t) || Dn(n[i]) ? n[i] = sr(a, Array.isArray(a) ? [] : {}, o) : cr(a, H(t) ? {} : t[i], n[i], o), ar(n[i]) && or(n, i));
|
|
1619
1623
|
}
|
|
1620
1624
|
return n;
|
|
1621
1625
|
}
|
|
1622
|
-
var
|
|
1623
|
-
function
|
|
1626
|
+
var lr = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => G(e) ? e : t ? e === "" ? NaN : e && +e : n && Z(e) ? new Date(e) : r ? r(e) : e;
|
|
1627
|
+
function ur(e) {
|
|
1624
1628
|
let t = e.ref;
|
|
1625
|
-
return Yt(t) ? t.files :
|
|
1629
|
+
return Yt(t) ? t.files : Pn(t) ? Vn(e.refs).value : $n(t) ? [...t.selectedOptions].map(({ value: e }) => e) : Jt(t) ? zn(e.refs).value : lr(t.value, e);
|
|
1626
1630
|
}
|
|
1627
|
-
var
|
|
1631
|
+
var dr = (e) => G(e) ? e : Fn(e) ? e.source : U(e) ? Fn(e.value) ? e.value.source : e.value : e, fr = "AsyncFunction", pr = (e) => {
|
|
1628
1632
|
if (!e || !e.validate) return !1;
|
|
1629
|
-
if (J(e.validate)) return e.validate.constructor.name ===
|
|
1633
|
+
if (J(e.validate)) return e.validate.constructor.name === fr;
|
|
1630
1634
|
if (U(e.validate)) {
|
|
1631
|
-
for (let t in e.validate) if (e.validate[t].constructor.name ===
|
|
1635
|
+
for (let t in e.validate) if (e.validate[t].constructor.name === fr) return !0;
|
|
1632
1636
|
}
|
|
1633
1637
|
return !1;
|
|
1634
1638
|
};
|
|
1635
|
-
function
|
|
1639
|
+
function mr(e, t, n) {
|
|
1636
1640
|
let r = K(e, n);
|
|
1637
|
-
if (r ||
|
|
1641
|
+
if (r?.type || r?.message || Array.isArray(r)) return {
|
|
1638
1642
|
error: r,
|
|
1639
1643
|
name: n
|
|
1640
1644
|
};
|
|
@@ -1654,11 +1658,11 @@ function ur(e, t, n) {
|
|
|
1654
1658
|
}
|
|
1655
1659
|
return { name: n };
|
|
1656
1660
|
}
|
|
1657
|
-
var
|
|
1658
|
-
mode:
|
|
1659
|
-
reValidateMode:
|
|
1661
|
+
var hr = {
|
|
1662
|
+
mode: ln,
|
|
1663
|
+
reValidateMode: cn,
|
|
1660
1664
|
shouldFocusError: !0
|
|
1661
|
-
},
|
|
1665
|
+
}, gr = {
|
|
1662
1666
|
submitCount: 0,
|
|
1663
1667
|
isDirty: !1,
|
|
1664
1668
|
isReady: !1,
|
|
@@ -1671,17 +1675,18 @@ var dr = {
|
|
|
1671
1675
|
dirtyFields: {},
|
|
1672
1676
|
validatingFields: {}
|
|
1673
1677
|
};
|
|
1674
|
-
function
|
|
1678
|
+
function _r(e = {}) {
|
|
1675
1679
|
let t = {
|
|
1676
|
-
...
|
|
1680
|
+
...hr,
|
|
1677
1681
|
...e
|
|
1678
1682
|
}, n = {
|
|
1679
|
-
...W(
|
|
1683
|
+
...W(gr),
|
|
1680
1684
|
isLoading: J(t.defaultValues),
|
|
1681
1685
|
errors: t.errors || {},
|
|
1682
1686
|
disabled: t.disabled || !1
|
|
1683
1687
|
}, r = {}, i = (U(t.defaultValues) || U(t.values)) && W(t.defaultValues || t.values) || {}, a = t.shouldUnregister ? {} : W(i), o = {
|
|
1684
1688
|
action: !1,
|
|
1689
|
+
actionArrayLengths: /* @__PURE__ */ new Map(),
|
|
1685
1690
|
mount: !1,
|
|
1686
1691
|
watch: !1,
|
|
1687
1692
|
keepIsValid: !1
|
|
@@ -1692,7 +1697,7 @@ function mr(e = {}) {
|
|
|
1692
1697
|
array: /* @__PURE__ */ new Set(),
|
|
1693
1698
|
watch: /* @__PURE__ */ new Set(),
|
|
1694
1699
|
registerName: /* @__PURE__ */ new Set()
|
|
1695
|
-
}, c = {}, l = {}, u = 0, d =
|
|
1700
|
+
}, c = {}, l = {}, u = 0, d = kn(t.mode), f = kn(t.reValidateMode), p = {
|
|
1696
1701
|
isDirty: !1,
|
|
1697
1702
|
dirtyFields: !1,
|
|
1698
1703
|
validatingFields: !1,
|
|
@@ -1700,63 +1705,79 @@ function mr(e = {}) {
|
|
|
1700
1705
|
isValidating: !1,
|
|
1701
1706
|
isValid: !1,
|
|
1702
1707
|
errors: !1
|
|
1703
|
-
}, m = { ...p }, h = { ...m }, g = {
|
|
1708
|
+
}, m = { ...p }, h = { ...m }, g = (...e) => e.some((e) => m[e] || h[e]), _ = {
|
|
1704
1709
|
array: Yn(),
|
|
1705
1710
|
state: Yn()
|
|
1706
|
-
},
|
|
1711
|
+
}, v = 0, y = 0, b = t.criteriaMode === dn, x = (e, t) => (n) => {
|
|
1707
1712
|
clearTimeout(l[e]), l[e] = setTimeout(t, n);
|
|
1708
|
-
},
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1713
|
+
}, S = (e) => {
|
|
1714
|
+
clearTimeout(l[e]), delete l[e], delete c[e];
|
|
1715
|
+
}, C = (e) => {
|
|
1716
|
+
S(e);
|
|
1717
|
+
let t = `${e}.`;
|
|
1718
|
+
for (let e of Object.keys(c)) e.startsWith(t) && S(e);
|
|
1719
|
+
}, w = async (e) => {
|
|
1720
|
+
if (!o.keepIsValid && !t.disabled && (g("isValid") || e)) {
|
|
1721
|
+
let e = ++v, i;
|
|
1722
|
+
t.resolver ? (i = Q((await A()).errors), e === v && T()) : i = await j({
|
|
1712
1723
|
fields: r,
|
|
1713
1724
|
onlyCheckValid: !0,
|
|
1714
|
-
eventType:
|
|
1715
|
-
}), e ===
|
|
1725
|
+
eventType: on
|
|
1726
|
+
}), e === v && i !== n.isValid && _.state.next({ isValid: i });
|
|
1716
1727
|
}
|
|
1717
|
-
},
|
|
1718
|
-
!t.disabled && (
|
|
1728
|
+
}, T = (e, r) => {
|
|
1729
|
+
!t.disabled && g("isValidating", "validatingFields") && ((e || s.mount).forEach((e) => {
|
|
1719
1730
|
e && (r ? Y(n.validatingFields, e, r) : $(n.validatingFields, e));
|
|
1720
|
-
}),
|
|
1731
|
+
}), _.state.next({
|
|
1721
1732
|
validatingFields: n.validatingFields,
|
|
1722
1733
|
isValidating: !Q(n.validatingFields)
|
|
1723
1734
|
}));
|
|
1724
|
-
},
|
|
1725
|
-
n.dirtyFields =
|
|
1726
|
-
},
|
|
1727
|
-
Y(n.errors, e, t), n.errors = { ...n.errors },
|
|
1728
|
-
},
|
|
1729
|
-
let
|
|
1730
|
-
if (
|
|
1735
|
+
}, E = () => {
|
|
1736
|
+
n.dirtyFields = cr(i, a, void 0, r);
|
|
1737
|
+
}, D = (e, t) => {
|
|
1738
|
+
Y(n.errors, e, t), n.errors = { ...n.errors }, _.state.next({ errors: n.errors });
|
|
1739
|
+
}, O = (c, l, u, d) => {
|
|
1740
|
+
let f = K(r, c);
|
|
1741
|
+
if (f) {
|
|
1731
1742
|
if (((e) => {
|
|
1732
|
-
let t =
|
|
1743
|
+
let t = wn(e) ? [e] : $t(e), n = a, r = i;
|
|
1733
1744
|
for (let e = 0; e < t.length - 1; e++) {
|
|
1734
1745
|
let i = t[e];
|
|
1735
1746
|
if (n = H(n) ? n : n[i], r = H(r) ? r : r[i], n === null && r !== null) return !0;
|
|
1736
1747
|
}
|
|
1737
1748
|
return !1;
|
|
1738
|
-
})(
|
|
1739
|
-
|
|
1740
|
-
|
|
1749
|
+
})(c) || ((e) => {
|
|
1750
|
+
if (!o.actionArrayLengths.size) return !1;
|
|
1751
|
+
let t = wn(e) ? [e] : $t(e), n = a, r = "", i = -1, s = 0;
|
|
1752
|
+
for (let e = 0; e < t.length; e++) {
|
|
1753
|
+
if (H(n)) return !1;
|
|
1754
|
+
let a = t[e];
|
|
1755
|
+
if (r = r ? `${r}.${a}` : a, Array.isArray(n) && +a >= n.length) return i !== -1 && (e !== i || +a < s);
|
|
1756
|
+
if (o.actionArrayLengths.has(r) && (i = e + 1, s = o.actionArrayLengths.get(r)), n = n[a], G(n) && i !== -1 && e > i && +t[i] < s) return !0;
|
|
1757
|
+
}
|
|
1758
|
+
return !1;
|
|
1759
|
+
})(c)) return;
|
|
1760
|
+
let r = G(K(a, c)), p = K(a, c, G(u) ? K(i, c) : u);
|
|
1761
|
+
G(p) || d && d.defaultChecked || l ? Y(a, c, l ? p : ur(f._f)) : P(c, p), o.mount && !o.action && (t.resolver && g("isValidating", "validatingFields") ? Promise.resolve().then(() => w()) : w(), r && n.isDirty && g("isDirty") && (M() || (n.isDirty = !1, _.state.next({ ...n }))), e.shouldUnregister && r && !G(K(a, c)) && An(c, s) && (o.watch = !0));
|
|
1741
1762
|
}
|
|
1742
|
-
},
|
|
1763
|
+
}, k = (e, o, s, c, l) => {
|
|
1743
1764
|
let u = !1, d = !1, f = { name: e };
|
|
1744
1765
|
if (!t.disabled || !0 === c) {
|
|
1745
1766
|
if (!s || c) {
|
|
1746
|
-
let t =
|
|
1747
|
-
(
|
|
1767
|
+
let t = X(K(i, e), o);
|
|
1768
|
+
g("isDirty") && (d = n.isDirty, n.isDirty = f.isDirty = !t || M(), u = d !== f.isDirty), d = !!K(n.dirtyFields, e), t === n.isDirty ? t ? $(n.dirtyFields, e) : Y(n.dirtyFields, e, !0) : ((e, t) => {
|
|
1748
1769
|
for (let n in e) n in t || delete e[n];
|
|
1749
1770
|
Object.assign(e, t);
|
|
1750
|
-
})(n.dirtyFields,
|
|
1771
|
+
})(n.dirtyFields, cr(i, a, void 0, r)), f.dirtyFields = n.dirtyFields, u ||= g("dirtyFields") && d !== !t;
|
|
1751
1772
|
}
|
|
1752
1773
|
if (s) {
|
|
1753
1774
|
let t = K(n.touchedFields, e);
|
|
1754
|
-
t || (Y(n.touchedFields, e, s), f.touchedFields = n.touchedFields, u ||= (
|
|
1775
|
+
t || (Y(n.touchedFields, e, s), f.touchedFields = n.touchedFields, u ||= g("touchedFields") && t !== s);
|
|
1755
1776
|
}
|
|
1756
|
-
u && l &&
|
|
1777
|
+
u && l && _.state.next(f);
|
|
1757
1778
|
}
|
|
1758
1779
|
return u ? f : {};
|
|
1759
|
-
},
|
|
1780
|
+
}, A = async (e) => (T(e, !0), await t.resolver(a, t.context, ((e, t, n, r) => {
|
|
1760
1781
|
let i = {};
|
|
1761
1782
|
for (let n of e) {
|
|
1762
1783
|
let e = K(t, n);
|
|
@@ -1768,220 +1789,252 @@ function mr(e = {}) {
|
|
|
1768
1789
|
fields: i,
|
|
1769
1790
|
shouldUseNativeValidation: r
|
|
1770
1791
|
};
|
|
1771
|
-
})(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))),
|
|
1772
|
-
if (
|
|
1773
|
-
let i = await
|
|
1792
|
+
})(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))), ee = async ({ name: e, eventType: r }) => {
|
|
1793
|
+
if (t.validate) {
|
|
1794
|
+
let i = y, o = await t.validate({
|
|
1774
1795
|
formValues: a,
|
|
1775
1796
|
formState: n,
|
|
1776
|
-
name:
|
|
1797
|
+
name: e,
|
|
1777
1798
|
eventType: r
|
|
1778
1799
|
});
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1800
|
+
if (i !== y) return !0;
|
|
1801
|
+
if (U(o)) {
|
|
1802
|
+
let e = !0;
|
|
1803
|
+
oe(bn);
|
|
1804
|
+
for (let t in o) {
|
|
1805
|
+
let n = o[t];
|
|
1806
|
+
n && (e = !1, L(`${bn}.${t}`, {
|
|
1807
|
+
message: Z(n.message) ? n.message : "",
|
|
1808
|
+
type: n.type || vn
|
|
1809
|
+
}));
|
|
1810
|
+
}
|
|
1811
|
+
return e;
|
|
1785
1812
|
}
|
|
1786
|
-
|
|
1787
|
-
message:
|
|
1788
|
-
type:
|
|
1789
|
-
}) :
|
|
1790
|
-
return i;
|
|
1813
|
+
return Z(o) || !o ? (L(bn, {
|
|
1814
|
+
message: o || "",
|
|
1815
|
+
type: vn
|
|
1816
|
+
}), !1) : (oe(bn), !0);
|
|
1791
1817
|
}
|
|
1792
1818
|
return !0;
|
|
1793
|
-
},
|
|
1819
|
+
}, j = async ({ fields: r, onlyCheckValid: i, name: o, eventType: c, context: l = {
|
|
1794
1820
|
valid: !0,
|
|
1795
1821
|
runRootValidation: !1
|
|
1796
1822
|
} }) => {
|
|
1797
|
-
|
|
1823
|
+
let u = y;
|
|
1824
|
+
if (t.validate && !l.runRootValidation && (l.runRootValidation = !0, !await ee({
|
|
1798
1825
|
name: o,
|
|
1799
1826
|
eventType: c
|
|
1800
1827
|
}) && (l.valid = !1, i))) return l.valid;
|
|
1801
1828
|
for (let o in r) {
|
|
1802
|
-
let
|
|
1803
|
-
if (
|
|
1804
|
-
let { _f: r, ...
|
|
1829
|
+
let d = r[o];
|
|
1830
|
+
if (d) {
|
|
1831
|
+
let { _f: r, ...f } = d;
|
|
1805
1832
|
if (r) {
|
|
1806
|
-
let o = s.array.has(r.name), c =
|
|
1807
|
-
c &&
|
|
1808
|
-
let
|
|
1809
|
-
if (
|
|
1833
|
+
let o = s.array.has(r.name), c = d._f && pr(d._f), f = g("isValidating", "validatingFields");
|
|
1834
|
+
c && f && T([r.name], !0);
|
|
1835
|
+
let p = await Wn(d, s.disabled, a, b, t.shouldUseNativeValidation && !i, o);
|
|
1836
|
+
if (u !== y) return l.valid;
|
|
1837
|
+
if (c && f && T([r.name]), p[r.name] && (l.valid = !1, i) || (i || (S(r.name), K(p, r.name) ? o ? Mn(n.errors, p, r.name) : Y(n.errors, r.name, p[r.name]) : $(n.errors, r.name)), e.shouldUseNativeValidation && p[r.name])) break;
|
|
1810
1838
|
}
|
|
1811
|
-
!Q(
|
|
1839
|
+
!Q(f) && await j({
|
|
1812
1840
|
context: l,
|
|
1813
1841
|
onlyCheckValid: i,
|
|
1814
|
-
fields:
|
|
1842
|
+
fields: f,
|
|
1815
1843
|
name: o,
|
|
1816
1844
|
eventType: c
|
|
1817
1845
|
});
|
|
1818
1846
|
}
|
|
1819
1847
|
}
|
|
1820
1848
|
return l.valid;
|
|
1821
|
-
},
|
|
1822
|
-
let
|
|
1823
|
-
if (
|
|
1824
|
-
let n =
|
|
1825
|
-
n && (!n.disabled && Y(a, e,
|
|
1826
|
-
e.defaultChecked && e.disabled || (Array.isArray(
|
|
1827
|
-
}) : n.refs.forEach((e) => e.checked = e.value ===
|
|
1849
|
+
}, M = (e, t) => (e && t && Y(a, e, t), !X(o.mount ? a : i, i)), N = (e, t, n) => ((e, t, n, r, i) => Z(e) ? (r && t.watch.add(e), K(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), K(n, e, K(i, e)))) : (r && (t.watchAll = !0), n))(e, s, { ...o.mount ? a : G(t) || Z(e) ? i : t }, n, t), P = (e, t, n = {}, i = !1, o = !1, s = !1) => {
|
|
1850
|
+
let c = K(r, e), l = t;
|
|
1851
|
+
if (c) {
|
|
1852
|
+
let n = c._f;
|
|
1853
|
+
n && (!n.disabled && Y(a, e, lr(t, n)), l = Nn(n.ref) && H(t) ? "" : t, $n(n.ref) ? [...n.ref.options].forEach((e) => e.selected = l.includes(e.value)) : n.refs ? Jt(n.ref) ? n.refs.forEach((e) => {
|
|
1854
|
+
e.defaultChecked && e.disabled || (e.checked = Array.isArray(l) ? !!l.find((t) => t === e.value) : l === e.value || !!l);
|
|
1855
|
+
}) : n.refs.forEach((e) => e.checked = e.value === l) : Yt(n.ref) ? n.ref.value = "" : (n.ref.value = l, n.ref.type || o || s || _.state.next({
|
|
1828
1856
|
name: e,
|
|
1829
1857
|
values: i ? a : W(a)
|
|
1830
1858
|
})));
|
|
1831
1859
|
}
|
|
1832
|
-
(n.shouldDirty || n.shouldTouch) &&
|
|
1833
|
-
},
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1860
|
+
(n.shouldDirty || n.shouldTouch) && k(e, c && c._f && !c._f.disabled && (c._f.valueAsNumber || c._f.valueAsDate || c._f.setValueAs) ? lr(t, c._f) : l, n.shouldTouch, n.shouldDirty, !o), n.shouldValidate && I(e, { delayError: n.delayError }), n.shouldValidate && c && c._f && c._f.deps && (!Array.isArray(c._f.deps) || c._f.deps.length > 0) && I(c._f.deps);
|
|
1861
|
+
}, te = (e, t, n, i = !1, o = !1, c = !1) => {
|
|
1862
|
+
s.array.has(e) && _.array.next({
|
|
1863
|
+
name: e,
|
|
1864
|
+
values: i ? a : W(a)
|
|
1865
|
+
});
|
|
1866
|
+
for (let a in t) {
|
|
1867
|
+
if (!t.hasOwnProperty(a)) continue;
|
|
1868
|
+
let l = t[a], u = e + "." + a, d = K(r, u);
|
|
1869
|
+
(s.array.has(e) || U(l) || d && !d._f) && !Xt(l) ? te(u, l, n, i, o, c) : P(u, l, n, i, o, c);
|
|
1838
1870
|
}
|
|
1839
|
-
},
|
|
1840
|
-
let u = K(r, e), d = s.array.has(e), f = c ? t : W(t), p =
|
|
1841
|
-
if (p || Y(a, e, f), d)
|
|
1871
|
+
}, ne = (e, t, i, c, l = !1) => {
|
|
1872
|
+
let u = K(r, e), d = s.array.has(e), f = c ? t : W(t), p = X(K(a, e), f);
|
|
1873
|
+
if (p || Y(a, e, f), d) _.array.next({
|
|
1842
1874
|
name: e,
|
|
1843
1875
|
values: c ? a : W(a)
|
|
1844
|
-
}), (
|
|
1876
|
+
}), g("isDirty", "dirtyFields") && i.shouldDirty && (E(), l || _.state.next({
|
|
1845
1877
|
name: e,
|
|
1846
1878
|
dirtyFields: n.dirtyFields,
|
|
1847
|
-
isDirty:
|
|
1848
|
-
}));
|
|
1879
|
+
isDirty: M(e, f)
|
|
1880
|
+
})), i.shouldValidate && I(e, { delayError: i.delayError });
|
|
1849
1881
|
else {
|
|
1850
|
-
let t = Array.isArray(f) && !f.length || Q(f);
|
|
1851
|
-
!u || u._f || H(f) || t ?
|
|
1882
|
+
let t = Array.isArray(f) && !f.length || Q(f), n = !p && !l;
|
|
1883
|
+
!u || u._f || H(f) || t ? P(e, f, i, c, l, n) : te(e, f, i, c, l, n);
|
|
1852
1884
|
}
|
|
1853
1885
|
if (!p && !l) {
|
|
1854
|
-
let t =
|
|
1855
|
-
|
|
1886
|
+
let t = An(e, s), r = c ? a : W(a);
|
|
1887
|
+
if (_.state.next({
|
|
1856
1888
|
...t && n,
|
|
1857
1889
|
name: o.mount || t ? e : void 0,
|
|
1858
1890
|
values: r
|
|
1891
|
+
}), !d) for (let t of ((e, t) => {
|
|
1892
|
+
let n = t.split("."), r = [], i = n[0];
|
|
1893
|
+
for (let t = 1; t < n.length; i += "." + n[t++]) !isNaN(+n[t]) && e.has(i) && r.push(`${i}.${n[t]}`);
|
|
1894
|
+
return r;
|
|
1895
|
+
})(s.array, e)) _.state.next({
|
|
1896
|
+
name: t,
|
|
1897
|
+
values: r
|
|
1859
1898
|
});
|
|
1860
1899
|
}
|
|
1861
|
-
},
|
|
1900
|
+
}, re = (e, t, n = {}) => ne(e, t, n, !1), F = async (e) => {
|
|
1862
1901
|
o.mount = !0;
|
|
1863
|
-
let
|
|
1864
|
-
|
|
1902
|
+
let i = e.target, l = i.name, p = !0, m = K(r, l), h = (e) => {
|
|
1903
|
+
p = Number.isNaN(e) || Xt(e) && isNaN(e.getTime()) || X(e, K(a, l, e));
|
|
1865
1904
|
};
|
|
1866
|
-
if (
|
|
1867
|
-
let o,
|
|
1868
|
-
if (Y(a,
|
|
1869
|
-
if (!
|
|
1870
|
-
|
|
1871
|
-
let
|
|
1872
|
-
|
|
1905
|
+
if (m) {
|
|
1906
|
+
let o, v, C = i.type ? ur(m._f) : ((e) => U(e) && e.target ? Jt(e.target) ? e.target.checked : Yt(e.target) ? e.target.files : e.target.value : e)(e), E = e.type === tn || e.type === nn, O = !(((e) => e.mount && (e.required || !G(e.required) && !1 !== e.required || !G(e.min) || !G(e.max) || !G(e.maxLength) || !G(e.minLength) || e.pattern || e.validate))(m._f) || t.validate || t.resolver || K(n.errors, l) || m._f.deps), M = O || ((e, t, n, r, i) => !i.isOnAll && (!n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : !(n ? r.isOnChange : i.isOnChange) || e))(E, K(n.touchedFields, l), n.isSubmitted, f, d), N = An(l, s, E);
|
|
1907
|
+
if (Y(a, l, W(C)), E) {
|
|
1908
|
+
if (!i || !i.readOnly) {
|
|
1909
|
+
m._f.onBlur && m._f.onBlur(e);
|
|
1910
|
+
let t = c[l];
|
|
1911
|
+
t && t(0);
|
|
1873
1912
|
}
|
|
1874
|
-
} else
|
|
1875
|
-
let
|
|
1876
|
-
if (!
|
|
1877
|
-
name:
|
|
1878
|
-
type:
|
|
1913
|
+
} else m._f.onChange && m._f.onChange(e);
|
|
1914
|
+
let P = k(l, C, E), te = !Q(P) || N;
|
|
1915
|
+
if (!E && _.state.next({
|
|
1916
|
+
name: l,
|
|
1917
|
+
type: e.type,
|
|
1879
1918
|
...u ? { values: W(a) } : {}
|
|
1880
|
-
}),
|
|
1881
|
-
name:
|
|
1882
|
-
...
|
|
1919
|
+
}), M) return O && n.isValid || !g("isValid") || (t.mode === "onBlur" ? E && w() : E || w()), te && _.state.next({
|
|
1920
|
+
name: l,
|
|
1921
|
+
...N ? {} : P
|
|
1883
1922
|
});
|
|
1884
|
-
if (!t.resolver &&
|
|
1885
|
-
name:
|
|
1886
|
-
eventType:
|
|
1887
|
-
}), !
|
|
1888
|
-
let { errors:
|
|
1889
|
-
if (
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1923
|
+
if (!t.resolver && t.validate && await ee({
|
|
1924
|
+
name: l,
|
|
1925
|
+
eventType: e.type
|
|
1926
|
+
}), !E && N && _.state.next({ ...n }), t.resolver) {
|
|
1927
|
+
let e = y, { errors: t } = await A([l]);
|
|
1928
|
+
if (e !== y) return;
|
|
1929
|
+
if (T([l]), h(C), !p) return void (!Q(P) && _.state.next(P));
|
|
1930
|
+
let i = mr(n.errors, r, l), a = mr(t, r, i.name || l);
|
|
1931
|
+
o = a.error, l = a.name, v = Q(t);
|
|
1932
|
+
} else {
|
|
1933
|
+
let n = y;
|
|
1934
|
+
if (T([l], !0), o = (await Wn(m, s.disabled, a, b, t.shouldUseNativeValidation))[l], n !== y) return;
|
|
1935
|
+
if (T([l]), h(C), p) {
|
|
1936
|
+
if (o) v = !1;
|
|
1937
|
+
else if (g("isValid") && (v = await j({
|
|
1938
|
+
fields: r,
|
|
1939
|
+
onlyCheckValid: !0,
|
|
1940
|
+
name: l,
|
|
1941
|
+
eventType: e.type
|
|
1942
|
+
}), n !== y)) return;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
p && (m._f.deps && (!Array.isArray(m._f.deps) || m._f.deps.length > 0) && I(m._f.deps), ((e, r, i, a) => {
|
|
1946
|
+
let o = K(n.errors, e), s = g("isValid") && q(r) && n.isValid !== r;
|
|
1947
|
+
if (t.delayError && i ? (c[e] = x(e, () => D(e, i)), c[e](t.delayError)) : (S(e), i ? Y(n.errors, e, i) : $(n.errors, e), n.errors = { ...n.errors }), (i ? !X(o, i) : o) || !Q(a) || s) {
|
|
1901
1948
|
let t = {
|
|
1902
1949
|
...a,
|
|
1903
1950
|
...s && q(r) ? { isValid: r } : {},
|
|
1904
1951
|
errors: n.errors,
|
|
1905
1952
|
name: e
|
|
1906
1953
|
};
|
|
1907
|
-
|
|
1908
|
-
...n,
|
|
1909
|
-
...t
|
|
1910
|
-
}, g.state.next(t);
|
|
1954
|
+
_.state.next(t);
|
|
1911
1955
|
}
|
|
1912
|
-
})(
|
|
1956
|
+
})(l, v, o, P));
|
|
1913
1957
|
}
|
|
1914
|
-
},
|
|
1958
|
+
}, ie = (e, t) => {
|
|
1915
1959
|
if (K(n.errors, t) && e.focus) return e.focus(), 1;
|
|
1916
|
-
},
|
|
1917
|
-
let a, o,
|
|
1960
|
+
}, I = async (e, i = {}) => {
|
|
1961
|
+
let a, o, l = Gn(e);
|
|
1918
1962
|
if (t.resolver) {
|
|
1919
|
-
let t = await (async (e) => {
|
|
1920
|
-
let { errors:
|
|
1921
|
-
if (
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1963
|
+
let t = y, i = await (async (e) => {
|
|
1964
|
+
let t = y, { errors: i } = await A(e);
|
|
1965
|
+
if (t !== y) return i;
|
|
1966
|
+
if (T(e), e) {
|
|
1967
|
+
for (let t of e) {
|
|
1968
|
+
let e = K(i, t);
|
|
1969
|
+
C(t);
|
|
1970
|
+
let a = s.array.has(t) && U(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))), o = K(r, t), c = U(o) && Object.keys(o).some((e) => e !== "_f");
|
|
1971
|
+
a ? Mn(n.errors, { [t]: e }, t) : e?.type || e?.message || Array.isArray(e) || U(e) && c ? Y(n.errors, t, e) : $(n.errors, t);
|
|
1925
1972
|
}
|
|
1926
1973
|
n.errors = { ...n.errors };
|
|
1927
|
-
} else n.errors =
|
|
1928
|
-
return
|
|
1929
|
-
})(G(e) ? e :
|
|
1930
|
-
a = Q(
|
|
1931
|
-
} else e ? (o = (await Promise.all(
|
|
1974
|
+
} else Object.keys(c).forEach(S), n.errors = i;
|
|
1975
|
+
return i;
|
|
1976
|
+
})(G(e) ? e : l);
|
|
1977
|
+
if (a = Q(i), o = e ? !l.some((e) => K(i, e)) : a, t !== y) return o;
|
|
1978
|
+
} else e ? (o = (await Promise.all(l.map(async (e) => {
|
|
1932
1979
|
let t = K(r, e);
|
|
1933
|
-
return await
|
|
1980
|
+
return await j({
|
|
1934
1981
|
fields: t && t._f ? { [e]: t } : t,
|
|
1935
|
-
eventType:
|
|
1982
|
+
eventType: an
|
|
1936
1983
|
});
|
|
1937
|
-
}))).every(Boolean), (o || n.isValid) &&
|
|
1984
|
+
}))).every(Boolean), (o || n.isValid) && w()) : o = a = await j({
|
|
1938
1985
|
fields: r,
|
|
1939
1986
|
name: e,
|
|
1940
|
-
eventType:
|
|
1987
|
+
eventType: an
|
|
1941
1988
|
});
|
|
1942
|
-
if (i.delayError && t.delayError &&
|
|
1989
|
+
if (i.delayError && t.delayError && Z(e)) {
|
|
1943
1990
|
let r = K(n.errors, e);
|
|
1944
|
-
r ? ($(n.errors, e), c[e] =
|
|
1991
|
+
r ? ($(n.errors, e), c[e] = x(e, () => D(e, r)), c[e](t.delayError)) : S(e);
|
|
1945
1992
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1993
|
+
if (i.shouldTouch) for (let t of e ? l : s.mount) !s.array.has(t) && Y(n.touchedFields, t, !0);
|
|
1994
|
+
return _.state.next({
|
|
1995
|
+
...!Z(e) || g("isValid") && a !== n.isValid ? {} : { name: e },
|
|
1948
1996
|
...t.resolver || !e ? { isValid: a } : {},
|
|
1997
|
+
...i.shouldTouch && g("touchedFields") ? { touchedFields: n.touchedFields } : {},
|
|
1949
1998
|
errors: n.errors
|
|
1950
|
-
}), i.shouldFocus && !o &&
|
|
1951
|
-
},
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1999
|
+
}), i.shouldFocus && !o && jn(r, ie, e ? l : s.mount), o;
|
|
2000
|
+
}, ae = (e, t) => {
|
|
2001
|
+
let r = t || n, i = K(r.errors, e);
|
|
2002
|
+
return {
|
|
2003
|
+
invalid: !!i,
|
|
2004
|
+
isDirty: !!K(r.dirtyFields, e),
|
|
2005
|
+
error: i,
|
|
2006
|
+
isValidating: !!K(r.validatingFields, e),
|
|
2007
|
+
isTouched: !!K(r.touchedFields, e)
|
|
2008
|
+
};
|
|
2009
|
+
}, oe = (e) => {
|
|
2010
|
+
let t = e ? Gn(e) : void 0;
|
|
2011
|
+
t ? t.forEach((e) => {
|
|
2012
|
+
C(e), $(n.errors, e), _.state.next({
|
|
1961
2013
|
name: e,
|
|
1962
2014
|
errors: n.errors
|
|
1963
2015
|
});
|
|
1964
|
-
}) : (n.errors = {},
|
|
1965
|
-
},
|
|
1966
|
-
|
|
2016
|
+
}) : (Object.keys(c).forEach(S), n.errors = {}, _.state.next({ errors: n.errors }));
|
|
2017
|
+
}, L = (e, t, i) => {
|
|
2018
|
+
C(e);
|
|
2019
|
+
let a = (K(r, e, { _f: {} })._f || {}).ref, { ref: o, message: s, type: c, types: l, ...u } = K(n.errors, e) || {};
|
|
1967
2020
|
Y(n.errors, e, {
|
|
1968
|
-
...
|
|
2021
|
+
...u,
|
|
1969
2022
|
...t,
|
|
1970
2023
|
ref: a
|
|
1971
|
-
}),
|
|
2024
|
+
}), _.state.next({
|
|
1972
2025
|
name: e,
|
|
1973
2026
|
errors: n.errors,
|
|
1974
2027
|
isValid: !1
|
|
1975
2028
|
}), i && i.shouldFocus && a && a.focus && a.focus();
|
|
1976
|
-
},
|
|
2029
|
+
}, se = (e) => {
|
|
1977
2030
|
let t = !!e.formState?.values;
|
|
1978
2031
|
t && u++;
|
|
1979
|
-
let { unsubscribe: r } =
|
|
1980
|
-
if (r = e.name, o = t.name, s = e.exact, (!r || !o || r === o ||
|
|
2032
|
+
let { unsubscribe: r } = _.state.subscribe({ next: (t) => {
|
|
2033
|
+
if (r = e.name, o = t.name, s = e.exact, (!r || !o || r === o || Gn(r).some((e) => e && (s ? e === o || e.startsWith(o + ".") : e.startsWith(o) || o.startsWith(e)))) && ((e, t, n, r) => {
|
|
1981
2034
|
n(e);
|
|
1982
|
-
let
|
|
1983
|
-
return !
|
|
1984
|
-
})(t, e.formState || m,
|
|
2035
|
+
let i = Object.keys(e).filter((e) => e !== "name");
|
|
2036
|
+
return !i.length || r && i.length >= Object.keys(t).length || i.find((e) => t[e] === (!r || dn));
|
|
2037
|
+
})(t, e.formState || m, he, e.reRenderRoot)) {
|
|
1985
2038
|
let r = { ...a };
|
|
1986
2039
|
e.callback({
|
|
1987
2040
|
values: r,
|
|
@@ -1997,20 +2050,21 @@ function mr(e = {}) {
|
|
|
1997
2050
|
return () => {
|
|
1998
2051
|
o || (o = !0, u--, r());
|
|
1999
2052
|
};
|
|
2000
|
-
},
|
|
2001
|
-
for (let c of e ?
|
|
2002
|
-
|
|
2053
|
+
}, ce = (e, o = {}) => {
|
|
2054
|
+
for (let c of e ? Gn(e) : s.mount) s.mount.delete(c), s.array.delete(c), s.disabled.delete(c), o.keepValue || ($(r, c), $(a, c)), o.keepError || (C(c), $(n.errors, c)), !o.keepDirty && $(n.dirtyFields, c), !o.keepTouched && $(n.touchedFields, c), !o.keepIsValidating && $(n.validatingFields, c), !t.shouldUnregister && !o.keepDefaultValue && $(i, c);
|
|
2055
|
+
u && _.state.next({ values: W(a) }), _.state.next({
|
|
2003
2056
|
...n,
|
|
2004
|
-
...o.keepDirty ? { isDirty:
|
|
2005
|
-
|
|
2006
|
-
|
|
2057
|
+
...o.keepDirty ? {} : { isDirty: M() },
|
|
2058
|
+
...o.keepIsValidating ? {} : { isValidating: !Q(n.validatingFields) }
|
|
2059
|
+
}), !o.keepIsValid && w();
|
|
2060
|
+
}, le = ({ disabled: e, name: t }) => {
|
|
2007
2061
|
if (q(e) && o.mount || e || s.disabled.has(t)) {
|
|
2008
2062
|
let n = s.disabled.has(t) !== !!e;
|
|
2009
|
-
e ? s.disabled.add(t) : s.disabled.delete(t), n && o.mount && !o.action &&
|
|
2063
|
+
e ? s.disabled.add(t) : s.disabled.delete(t), n && o.mount && !o.action && w();
|
|
2010
2064
|
}
|
|
2011
|
-
},
|
|
2065
|
+
}, ue = (e, n = {}) => {
|
|
2012
2066
|
let a = K(r, e), c = q(n.disabled) || q(t.disabled), l = !s.registerName.has(e) && a && a._f && !a._f.mount;
|
|
2013
|
-
|
|
2067
|
+
if (Y(r, e, {
|
|
2014
2068
|
...a || {},
|
|
2015
2069
|
_f: {
|
|
2016
2070
|
...a && a._f ? a._f : { ref: { name: e } },
|
|
@@ -2018,81 +2072,92 @@ function mr(e = {}) {
|
|
|
2018
2072
|
mount: !0,
|
|
2019
2073
|
...n
|
|
2020
2074
|
}
|
|
2021
|
-
}), s.mount.add(e), a &&
|
|
2075
|
+
}), s.mount.add(e), a && a._f) {
|
|
2076
|
+
let t = K(r, e);
|
|
2077
|
+
for (let e of yn) e in n || delete t._f[e];
|
|
2078
|
+
}
|
|
2079
|
+
return a && !l ? le({
|
|
2022
2080
|
disabled: q(n.disabled) ? n.disabled : t.disabled,
|
|
2023
2081
|
name: e
|
|
2024
|
-
}) :
|
|
2082
|
+
}) : O(e, !0, n.value), {
|
|
2025
2083
|
...c ? { disabled: n.disabled || t.disabled } : {},
|
|
2026
2084
|
...t.progressive ? {
|
|
2027
2085
|
required: !!n.required,
|
|
2028
|
-
min:
|
|
2029
|
-
max:
|
|
2030
|
-
minLength:
|
|
2031
|
-
maxLength:
|
|
2032
|
-
pattern:
|
|
2086
|
+
min: dr(n.min),
|
|
2087
|
+
max: dr(n.max),
|
|
2088
|
+
minLength: dr(n.minLength),
|
|
2089
|
+
maxLength: dr(n.maxLength),
|
|
2090
|
+
pattern: dr(n.pattern)
|
|
2033
2091
|
} : {},
|
|
2034
2092
|
name: e,
|
|
2035
|
-
onChange:
|
|
2036
|
-
onBlur:
|
|
2093
|
+
onChange: F,
|
|
2094
|
+
onBlur: F,
|
|
2037
2095
|
ref: (c) => {
|
|
2038
2096
|
if (c) {
|
|
2039
|
-
s.registerName.add(e),
|
|
2040
|
-
let t = G(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = ((e) =>
|
|
2097
|
+
s.registerName.add(e), ue(e, n), s.registerName.delete(e), a = K(r, e);
|
|
2098
|
+
let t = G(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = ((e) => Pn(e) || Jt(e))(t), l = a._f.refs || [];
|
|
2041
2099
|
if (o ? l.find((e) => e === t) : t === a._f.ref) return;
|
|
2042
2100
|
let u = { ...a._f };
|
|
2043
2101
|
o ? (u.refs = [
|
|
2044
|
-
...l.filter(
|
|
2102
|
+
...l.filter(er),
|
|
2045
2103
|
t,
|
|
2046
2104
|
...Array.isArray(K(i, e)) ? [{}] : []
|
|
2047
2105
|
], u.ref = {
|
|
2048
2106
|
type: t.type,
|
|
2049
2107
|
name: e
|
|
2050
|
-
}) : (u.ref = t, delete u.refs), Y(r, e, { _f: u }),
|
|
2108
|
+
}) : (u.ref = t, delete u.refs), Y(r, e, { _f: u }), O(e, !1, void 0, t);
|
|
2051
2109
|
} else a = K(r, e, {}), a._f && (a._f.mount = !1), (t.shouldUnregister || n.shouldUnregister) && (!((e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))))(s.array, e) || !o.action) && s.unMount.add(e);
|
|
2052
2110
|
}
|
|
2053
2111
|
};
|
|
2054
|
-
},
|
|
2055
|
-
let
|
|
2112
|
+
}, de = () => t.shouldFocusError && !t.shouldUseNativeValidation && jn(r, ie, s.mount), fe = (e, i) => async (o) => {
|
|
2113
|
+
let l, u;
|
|
2056
2114
|
o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
|
|
2057
|
-
let
|
|
2058
|
-
if (
|
|
2059
|
-
let { errors:
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2115
|
+
let d = W(a);
|
|
2116
|
+
if (_.state.next({ isSubmitting: !0 }), t.resolver) {
|
|
2117
|
+
let e = y, { errors: t, values: r } = await A();
|
|
2118
|
+
if (e !== y) return;
|
|
2119
|
+
T(), Object.keys(c).forEach(S), n.errors = t, d = W(r);
|
|
2120
|
+
} else {
|
|
2121
|
+
let e = y;
|
|
2122
|
+
if (await j({
|
|
2123
|
+
fields: r,
|
|
2124
|
+
eventType: rn
|
|
2125
|
+
}), e !== y) return;
|
|
2126
|
+
$(n.errors, xn);
|
|
2127
|
+
}
|
|
2128
|
+
if (s.disabled.size) for (let e of s.disabled) $(d, e);
|
|
2129
|
+
if (Q(n.errors)) {
|
|
2130
|
+
_.state.next({ errors: {} });
|
|
2068
2131
|
try {
|
|
2069
|
-
await e(
|
|
2132
|
+
l = await e(d, o);
|
|
2070
2133
|
} catch (e) {
|
|
2071
|
-
|
|
2134
|
+
u = e;
|
|
2072
2135
|
}
|
|
2073
|
-
} else i && await i({ ...n.errors }, o),
|
|
2074
|
-
if (
|
|
2136
|
+
} else i && await i({ ...n.errors }, o), de(), setTimeout(de);
|
|
2137
|
+
if (_.state.next({
|
|
2075
2138
|
isSubmitted: !0,
|
|
2076
2139
|
isSubmitting: !1,
|
|
2077
|
-
isSubmitSuccessful: Q(n.errors) && !
|
|
2140
|
+
isSubmitSuccessful: Q(n.errors) && !u,
|
|
2078
2141
|
submitCount: n.submitCount + 1,
|
|
2079
2142
|
errors: n.errors
|
|
2080
|
-
}),
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2143
|
+
}), u) throw u;
|
|
2144
|
+
return l;
|
|
2145
|
+
}, pe = (e, l = {}) => {
|
|
2146
|
+
y++;
|
|
2147
|
+
let u = e ? W(e) : i, d = W(u), f = Q(e), p = d, h = r;
|
|
2148
|
+
if (Object.keys(c).forEach(S), l.keepDefaultValues || (i = u), !l.keepValues) {
|
|
2149
|
+
if (l.keepDirtyValues) {
|
|
2150
|
+
let e = /* @__PURE__ */ new Set([...s.mount, ...nr(cr(i, a, void 0, h), n.dirtyFields)]);
|
|
2151
|
+
for (let t of e) {
|
|
2152
|
+
let e = K(n.dirtyFields, t), r = K(a, t), i = K(p, t);
|
|
2153
|
+
e && !G(r) ? Y(p, t, r) : e || G(i) || re(t, i);
|
|
2089
2154
|
}
|
|
2090
2155
|
} else {
|
|
2091
|
-
if (
|
|
2156
|
+
if (en && G(e)) for (let e of s.mount) {
|
|
2092
2157
|
let t = K(r, e);
|
|
2093
2158
|
if (t && t._f) {
|
|
2094
2159
|
let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
|
|
2095
|
-
if (
|
|
2160
|
+
if (Nn(e)) {
|
|
2096
2161
|
let t = e.closest("form");
|
|
2097
2162
|
if (t) {
|
|
2098
2163
|
t.reset();
|
|
@@ -2101,20 +2166,20 @@ function mr(e = {}) {
|
|
|
2101
2166
|
}
|
|
2102
2167
|
}
|
|
2103
2168
|
}
|
|
2104
|
-
if (
|
|
2169
|
+
if (l.keepFieldsRef) for (let e of s.mount) re(e, K(p, e));
|
|
2105
2170
|
else r = {};
|
|
2106
2171
|
}
|
|
2107
2172
|
if (t.shouldUnregister) {
|
|
2108
|
-
if (a =
|
|
2109
|
-
} else a = W(
|
|
2110
|
-
|
|
2173
|
+
if (a = l.keepDefaultValues ? W(i) : {}, l.keepFieldsRef) for (let e of s.mount) Y(a, e, K(p, e));
|
|
2174
|
+
} else a = W(p);
|
|
2175
|
+
_.array.next({ values: { ...p } }), _.state.next({
|
|
2111
2176
|
name: void 0,
|
|
2112
2177
|
type: void 0,
|
|
2113
|
-
values: { ...
|
|
2178
|
+
values: { ...p }
|
|
2114
2179
|
});
|
|
2115
2180
|
}
|
|
2116
2181
|
s = {
|
|
2117
|
-
mount:
|
|
2182
|
+
mount: l.keepDirtyValues ? s.mount : /* @__PURE__ */ new Set(),
|
|
2118
2183
|
unMount: /* @__PURE__ */ new Set(),
|
|
2119
2184
|
array: /* @__PURE__ */ new Set(),
|
|
2120
2185
|
registerName: /* @__PURE__ */ new Set(),
|
|
@@ -2122,93 +2187,112 @@ function mr(e = {}) {
|
|
|
2122
2187
|
watch: /* @__PURE__ */ new Set(),
|
|
2123
2188
|
watchAll: !1,
|
|
2124
2189
|
focus: ""
|
|
2125
|
-
}, o.mount = !m.isValid || !!
|
|
2126
|
-
submitCount:
|
|
2127
|
-
isDirty: !
|
|
2128
|
-
isSubmitted: !!
|
|
2129
|
-
dirtyFields:
|
|
2130
|
-
touchedFields:
|
|
2131
|
-
|
|
2132
|
-
|
|
2190
|
+
}, o.mount = !m.isValid || !!l.keepIsValid || !!l.keepDirtyValues || !t.shouldUnregister && !Q(p), o.watch = !!t.shouldUnregister, o.keepIsValid = !!l.keepIsValid, o.action = !1, o.actionArrayLengths.clear(), l.keepErrors || (n.errors = {}), _.state.next({
|
|
2191
|
+
submitCount: l.keepSubmitCount ? n.submitCount : 0,
|
|
2192
|
+
isDirty: !f && (l.keepDirty ? n.isDirty : l.keepValues ? M() : !(!l.keepDefaultValues || X(e, i))),
|
|
2193
|
+
isSubmitted: !!l.keepIsSubmitted && n.isSubmitted,
|
|
2194
|
+
dirtyFields: f ? {} : l.keepDirtyValues ? l.keepDefaultValues && a ? cr(i, a, void 0, h) : n.dirtyFields : l.keepDefaultValues && e ? cr(i, e, void 0, h) : l.keepDirty ? n.dirtyFields : l.keepValues ? cr(i, a, void 0, h) : {},
|
|
2195
|
+
touchedFields: l.keepTouched ? n.touchedFields : {},
|
|
2196
|
+
...l.keepIsValidating || !n.isValidating && Q(n.validatingFields) ? null : {
|
|
2197
|
+
validatingFields: {},
|
|
2198
|
+
isValidating: !1
|
|
2199
|
+
},
|
|
2200
|
+
errors: l.keepErrors ? n.errors : {},
|
|
2201
|
+
isSubmitSuccessful: !!l.keepIsSubmitSuccessful && n.isSubmitSuccessful,
|
|
2133
2202
|
isSubmitting: !1,
|
|
2134
2203
|
defaultValues: i
|
|
2135
2204
|
});
|
|
2136
|
-
},
|
|
2205
|
+
}, me = (e, n) => pe(J(e) ? e(a) : e, {
|
|
2137
2206
|
...t.resetOptions,
|
|
2138
2207
|
...n
|
|
2139
|
-
}),
|
|
2208
|
+
}), he = (e) => {
|
|
2140
2209
|
let { name: t, type: r, values: i, ...a } = e;
|
|
2141
2210
|
n = {
|
|
2142
2211
|
...n,
|
|
2143
2212
|
...a
|
|
2144
2213
|
};
|
|
2145
|
-
}
|
|
2214
|
+
};
|
|
2215
|
+
_.state.subscribe({ next: he });
|
|
2216
|
+
let ge = {
|
|
2146
2217
|
control: {
|
|
2147
|
-
register:
|
|
2148
|
-
unregister:
|
|
2149
|
-
getFieldState:
|
|
2150
|
-
handleSubmit:
|
|
2151
|
-
setError:
|
|
2152
|
-
_subscribe:
|
|
2153
|
-
_runSchema:
|
|
2154
|
-
_updateIsValidating:
|
|
2155
|
-
_focusError:
|
|
2156
|
-
_getWatch:
|
|
2157
|
-
_getDirty:
|
|
2158
|
-
_setValid:
|
|
2218
|
+
register: ue,
|
|
2219
|
+
unregister: ce,
|
|
2220
|
+
getFieldState: ae,
|
|
2221
|
+
handleSubmit: fe,
|
|
2222
|
+
setError: L,
|
|
2223
|
+
_subscribe: se,
|
|
2224
|
+
_runSchema: A,
|
|
2225
|
+
_updateIsValidating: T,
|
|
2226
|
+
_focusError: de,
|
|
2227
|
+
_getWatch: N,
|
|
2228
|
+
_getDirty: M,
|
|
2229
|
+
_setValid: w,
|
|
2159
2230
|
_setFieldArray: (e, i = [], s, c, l = !0, u = !0) => {
|
|
2160
2231
|
if (c && s && !t.disabled) {
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2232
|
+
o.action = !0;
|
|
2233
|
+
let t = K(r, e);
|
|
2234
|
+
if (o.actionArrayLengths.has(e) || o.actionArrayLengths.set(e, Array.isArray(t) ? t.length : 0), u && Array.isArray(t)) {
|
|
2235
|
+
let n = s(t, c.argA, c.argB);
|
|
2236
|
+
l && Y(r, e, n);
|
|
2164
2237
|
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2238
|
+
let a = K(n.errors, e);
|
|
2239
|
+
if (u && Array.isArray(a)) {
|
|
2240
|
+
let t = a.root, r = s(a, c.argA, c.argB) || a;
|
|
2241
|
+
t && (r.root = t), l && Y(n.errors, e, r), ((e, t) => {
|
|
2242
|
+
let n = K(e, t);
|
|
2243
|
+
!Kn(n).length && (n == null || !n.root) && $(e, t);
|
|
2169
2244
|
})(n.errors, e);
|
|
2170
2245
|
}
|
|
2171
|
-
|
|
2172
|
-
|
|
2246
|
+
let d = K(n.touchedFields, e), f = u && Array.isArray(d);
|
|
2247
|
+
if (f) {
|
|
2248
|
+
let t = s(d, c.argA, c.argB);
|
|
2173
2249
|
l && Y(n.touchedFields, e, t);
|
|
2174
2250
|
}
|
|
2175
|
-
|
|
2251
|
+
let p = K(n.dirtyFields, e);
|
|
2252
|
+
if (u && Array.isArray(p)) {
|
|
2253
|
+
let t = s(p, c.argA, c.argB) || p;
|
|
2254
|
+
l && Y(n.dirtyFields, e, t);
|
|
2255
|
+
}
|
|
2256
|
+
g("dirtyFields") && E(), _.state.next({
|
|
2176
2257
|
name: e,
|
|
2177
|
-
isDirty:
|
|
2258
|
+
isDirty: M(e, i),
|
|
2178
2259
|
dirtyFields: n.dirtyFields,
|
|
2260
|
+
...f && { touchedFields: n.touchedFields },
|
|
2179
2261
|
errors: n.errors,
|
|
2180
2262
|
isValid: n.isValid
|
|
2181
2263
|
});
|
|
2182
2264
|
} else Y(a, e, i);
|
|
2183
2265
|
},
|
|
2184
|
-
_setDisabledField:
|
|
2266
|
+
_setDisabledField: le,
|
|
2185
2267
|
_setErrors: (e) => {
|
|
2186
|
-
|
|
2268
|
+
Object.keys(c).forEach(S);
|
|
2269
|
+
let t = !Q(e);
|
|
2270
|
+
n.errors = e, _.state.next({
|
|
2187
2271
|
errors: n.errors,
|
|
2188
|
-
isValid: !1
|
|
2189
|
-
});
|
|
2272
|
+
...t ? { isValid: !1 } : {}
|
|
2273
|
+
}), !t && o.mount && w();
|
|
2190
2274
|
},
|
|
2191
|
-
_getFieldArray: (e) =>
|
|
2192
|
-
_reset:
|
|
2275
|
+
_getFieldArray: (e) => Kn(K(o.mount ? a : i, e, t.shouldUnregister ? K(i, e, []) : [])),
|
|
2276
|
+
_reset: pe,
|
|
2193
2277
|
_resetDefaultValues: () => J(t.defaultValues) && t.defaultValues().then((e) => {
|
|
2194
|
-
|
|
2278
|
+
me(e, t.resetOptions), _.state.next({ isLoading: !1 });
|
|
2195
2279
|
}),
|
|
2196
2280
|
_removeUnmounted: () => {
|
|
2197
2281
|
for (let e of s.unMount) {
|
|
2198
2282
|
let t = K(r, e);
|
|
2199
|
-
t && (t._f.refs ? t._f.refs.every((e) => !
|
|
2283
|
+
t && (t._f.refs ? t._f.refs.every((e) => !er(e)) : !er(t._f.ref)) && ce(e);
|
|
2200
2284
|
}
|
|
2201
2285
|
s.unMount = /* @__PURE__ */ new Set();
|
|
2202
2286
|
},
|
|
2203
2287
|
_disableForm: (e) => {
|
|
2204
|
-
q(e) && (
|
|
2288
|
+
q(e) && (_.state.next({ disabled: e }), jn(r, (t, n) => {
|
|
2205
2289
|
let i = K(r, n);
|
|
2206
2290
|
i && (t.disabled = i._f.disabled || e, Array.isArray(i._f.refs) && i._f.refs.forEach((t) => {
|
|
2207
2291
|
t.disabled = i._f.disabled || e;
|
|
2208
2292
|
}));
|
|
2209
|
-
}, 0
|
|
2293
|
+
}, 0));
|
|
2210
2294
|
},
|
|
2211
|
-
_subjects:
|
|
2295
|
+
_subjects: _,
|
|
2212
2296
|
_proxyFormState: m,
|
|
2213
2297
|
get _fields() {
|
|
2214
2298
|
return r;
|
|
@@ -2241,71 +2325,74 @@ function mr(e = {}) {
|
|
|
2241
2325
|
t = {
|
|
2242
2326
|
...t,
|
|
2243
2327
|
...e
|
|
2244
|
-
}, d =
|
|
2328
|
+
}, d = kn(t.mode), f = kn(t.reValidateMode), b = t.criteriaMode === dn;
|
|
2245
2329
|
}
|
|
2246
2330
|
},
|
|
2247
2331
|
subscribe: (e) => (o.mount = !0, h = {
|
|
2248
2332
|
...h,
|
|
2249
2333
|
...e.formState
|
|
2250
|
-
},
|
|
2334
|
+
}, se({
|
|
2251
2335
|
...e,
|
|
2252
2336
|
formState: {
|
|
2253
2337
|
...p,
|
|
2254
2338
|
...e.formState
|
|
2255
2339
|
}
|
|
2256
2340
|
})),
|
|
2257
|
-
trigger:
|
|
2258
|
-
register:
|
|
2259
|
-
handleSubmit:
|
|
2341
|
+
trigger: I,
|
|
2342
|
+
register: ue,
|
|
2343
|
+
handleSubmit: fe,
|
|
2260
2344
|
watch: (e, t) => {
|
|
2261
2345
|
if (J(e)) {
|
|
2262
2346
|
u++;
|
|
2263
|
-
let { unsubscribe: n } =
|
|
2347
|
+
let { unsubscribe: n } = _.state.subscribe({ next: (n) => "values" in n && e(n.values || N(void 0, t), n) }), r = !1;
|
|
2264
2348
|
return { unsubscribe: () => {
|
|
2265
2349
|
r || (r = !0, u--, n());
|
|
2266
2350
|
} };
|
|
2267
2351
|
}
|
|
2268
|
-
return
|
|
2352
|
+
return N(e, t, !0);
|
|
2269
2353
|
},
|
|
2270
|
-
setValue:
|
|
2354
|
+
setValue: re,
|
|
2271
2355
|
setValues: (e, t = {}) => {
|
|
2272
2356
|
let r = J(e) ? e(a) : e;
|
|
2273
|
-
if (!
|
|
2357
|
+
if (!X(a, r)) {
|
|
2274
2358
|
a = {
|
|
2275
2359
|
...a,
|
|
2276
2360
|
...r
|
|
2277
2361
|
};
|
|
2278
|
-
let e
|
|
2279
|
-
|
|
2280
|
-
g.state.next({
|
|
2362
|
+
for (let e of s.mount) Qn(r, e) && ne(e, K(r, e), t, !0, !0);
|
|
2363
|
+
_.state.next({
|
|
2281
2364
|
...n,
|
|
2282
2365
|
name: void 0,
|
|
2283
2366
|
type: void 0,
|
|
2284
2367
|
...u ? { values: a } : {}
|
|
2285
|
-
}), t.shouldValidate &&
|
|
2368
|
+
}), t.shouldValidate && w();
|
|
2286
2369
|
}
|
|
2287
2370
|
},
|
|
2288
2371
|
getValues: (e, t) => {
|
|
2289
2372
|
let r = { ...o.mount ? a : i };
|
|
2290
|
-
return t && (r = Xn(t.dirtyFields ? n.dirtyFields : n.touchedFields, r)), G(e) ? r :
|
|
2373
|
+
return t && (r = Xn(t.dirtyFields ? n.dirtyFields : n.touchedFields, r)), G(e) ? r : Z(e) ? K(r, e) : e.map((e) => K(r, e));
|
|
2291
2374
|
},
|
|
2292
|
-
|
|
2375
|
+
getErrors: (e) => G(e) ? { ...n.errors } : Z(e) ? K(n.errors, e) : e.map((e) => K(n.errors, e)),
|
|
2376
|
+
reset: me,
|
|
2293
2377
|
resetField: (e, t = {}) => {
|
|
2294
|
-
K(r, e) && (G(t.defaultValue) ?
|
|
2378
|
+
K(r, e) && ($(n.validatingFields, e), G(t.defaultValue) ? re(e, W(K(i, e))) : (re(e, t.defaultValue), Y(i, e, W(t.defaultValue))), t.keepTouched || $(n.touchedFields, e), t.keepDirty || ($(n.dirtyFields, e), n.isDirty = t.defaultValue ? M(e, W(K(i, e))) : M()), t.keepError || (C(e), $(n.errors, e), w()), _.state.next({
|
|
2379
|
+
...n,
|
|
2380
|
+
isValidating: !Q(n.validatingFields)
|
|
2381
|
+
}));
|
|
2295
2382
|
},
|
|
2296
2383
|
resetDefaultValues: (e, t = {}) => {
|
|
2297
2384
|
if (i = W(e), !t.keepDirty) {
|
|
2298
|
-
let e =
|
|
2385
|
+
let e = cr(i, a, void 0, r);
|
|
2299
2386
|
n.dirtyFields = e, n.isDirty = !Q(e);
|
|
2300
2387
|
}
|
|
2301
|
-
t.keepIsValid ||
|
|
2388
|
+
t.keepIsValid || w(), _.state.next({
|
|
2302
2389
|
...n,
|
|
2303
2390
|
defaultValues: i
|
|
2304
2391
|
});
|
|
2305
2392
|
},
|
|
2306
|
-
clearErrors:
|
|
2307
|
-
unregister:
|
|
2308
|
-
setError:
|
|
2393
|
+
clearErrors: oe,
|
|
2394
|
+
unregister: ce,
|
|
2395
|
+
setError: L,
|
|
2309
2396
|
setFocus: (e, t = {}) => {
|
|
2310
2397
|
let n = K(r, e), i = n && n._f;
|
|
2311
2398
|
if (i) {
|
|
@@ -2315,97 +2402,131 @@ function mr(e = {}) {
|
|
|
2315
2402
|
});
|
|
2316
2403
|
}
|
|
2317
2404
|
},
|
|
2318
|
-
getFieldState:
|
|
2405
|
+
getFieldState: ae
|
|
2319
2406
|
};
|
|
2320
2407
|
return {
|
|
2321
|
-
...
|
|
2322
|
-
formControl:
|
|
2408
|
+
...ge,
|
|
2409
|
+
formControl: ge
|
|
2323
2410
|
};
|
|
2324
2411
|
}
|
|
2325
|
-
function
|
|
2326
|
-
let t = x.useRef(void 0), n = x.useRef(void 0), r = x.useRef(e.formControl),
|
|
2327
|
-
...W(
|
|
2412
|
+
function vr(e = {}) {
|
|
2413
|
+
let t = x.useRef(void 0), n = x.useRef(void 0), r = x.useRef(e.formControl), i = x.useRef(!!e.validate), [a, o] = x.useState(() => ({
|
|
2414
|
+
...W(gr),
|
|
2328
2415
|
isLoading: J(e.defaultValues),
|
|
2329
2416
|
errors: e.errors || {},
|
|
2330
2417
|
disabled: e.disabled || !1,
|
|
2331
2418
|
defaultValues: J(e.defaultValues) ? void 0 : e.defaultValues
|
|
2332
2419
|
}));
|
|
2333
|
-
if (!t.current || e.formControl && r.current !== e.formControl)
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2420
|
+
if (!t.current || e.formControl && r.current !== e.formControl) {
|
|
2421
|
+
if (r.current = e.formControl, e.formControl) t.current = {
|
|
2422
|
+
...e.formControl,
|
|
2423
|
+
formState: a
|
|
2424
|
+
}, e.defaultValues && !J(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
2425
|
+
else {
|
|
2426
|
+
let { formControl: n, ...r } = _r(e);
|
|
2427
|
+
t.current = {
|
|
2428
|
+
...r,
|
|
2429
|
+
formState: a
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2343
2432
|
}
|
|
2344
|
-
let
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2433
|
+
let s = t.current.control;
|
|
2434
|
+
s._options = {
|
|
2435
|
+
...e,
|
|
2436
|
+
validate: e.validate
|
|
2437
|
+
};
|
|
2438
|
+
let c = () => ({
|
|
2439
|
+
...s._formState,
|
|
2440
|
+
defaultValues: s._defaultValues
|
|
2441
|
+
}), { resyncIfNeeded: l, snapshot: u } = function(e) {
|
|
2442
|
+
let t = x.useRef(!1), n = x.useRef(!1), r = x.useRef(void 0), i = x.useRef(0);
|
|
2443
|
+
return i.current++, !n.current && e && (n.current = !0, r.current = W(e())), {
|
|
2444
|
+
resyncIfNeeded: x.useCallback((e, a, o) => {
|
|
2445
|
+
if (e && (t.current || n.current && i.current > 1)) {
|
|
2446
|
+
let e = a();
|
|
2447
|
+
X(r.current, e) || o(e);
|
|
2448
|
+
}
|
|
2449
|
+
t.current = !0;
|
|
2450
|
+
}, []),
|
|
2451
|
+
snapshot: x.useCallback((e, t) => {
|
|
2452
|
+
e && (r.current = W(t()));
|
|
2453
|
+
}, [])
|
|
2454
|
+
};
|
|
2455
|
+
}(c);
|
|
2456
|
+
return En(() => {
|
|
2457
|
+
l(!0, c, o);
|
|
2458
|
+
let e = s._subscribe({
|
|
2459
|
+
formState: s._proxyFormState,
|
|
2460
|
+
callback: () => o({
|
|
2461
|
+
...s._formState,
|
|
2462
|
+
defaultValues: s._defaultValues
|
|
2351
2463
|
}),
|
|
2352
2464
|
reRenderRoot: !0
|
|
2353
2465
|
});
|
|
2354
|
-
return
|
|
2466
|
+
return o((e) => ({
|
|
2355
2467
|
...e,
|
|
2356
2468
|
isReady: !0
|
|
2357
|
-
})),
|
|
2358
|
-
|
|
2359
|
-
|
|
2469
|
+
})), s._formState.isReady = !0, () => {
|
|
2470
|
+
e(), u(!0, c);
|
|
2471
|
+
};
|
|
2360
2472
|
}, [
|
|
2361
|
-
|
|
2473
|
+
s,
|
|
2474
|
+
l,
|
|
2475
|
+
u
|
|
2476
|
+
]), x.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), x.useEffect(() => {
|
|
2477
|
+
e.mode && (s._options.mode = e.mode), e.reValidateMode && (s._options.reValidateMode = e.reValidateMode);
|
|
2478
|
+
}, [
|
|
2479
|
+
s,
|
|
2362
2480
|
e.mode,
|
|
2363
2481
|
e.reValidateMode
|
|
2364
2482
|
]), x.useEffect(() => {
|
|
2365
|
-
e.errors && (
|
|
2366
|
-
}, [
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2483
|
+
e.errors && (s._setErrors(e.errors), s._focusError());
|
|
2484
|
+
}, [s, e.errors]), x.useEffect(() => {
|
|
2485
|
+
var n;
|
|
2486
|
+
i.current && !e.validate && ((n = t.current) == null || n.clearErrors(bn)), i.current = !!e.validate;
|
|
2487
|
+
}, [e.validate]), x.useEffect(() => {
|
|
2488
|
+
e.shouldUnregister && s._subjects.state.next({ values: s._getWatch() });
|
|
2489
|
+
}, [s, e.shouldUnregister]), x.useEffect(() => {
|
|
2490
|
+
if (s._proxyFormState.isDirty) {
|
|
2491
|
+
let e = s._getDirty();
|
|
2492
|
+
e !== a.isDirty && s._subjects.state.next({ isDirty: e });
|
|
2372
2493
|
}
|
|
2373
|
-
}, [
|
|
2374
|
-
e.values && !
|
|
2494
|
+
}, [s, a.isDirty]), x.useEffect(() => {
|
|
2495
|
+
e.values && !X(e.values, n.current) ? (s._reset(e.values, {
|
|
2375
2496
|
keepFieldsRef: !0,
|
|
2376
|
-
...
|
|
2377
|
-
}),
|
|
2378
|
-
}, [
|
|
2379
|
-
|
|
2497
|
+
...s._options.resetOptions
|
|
2498
|
+
}), s._options.resetOptions?.keepIsValid || s._setValid(), n.current = e.values, o((e) => ({ ...e }))) : s._resetDefaultValues();
|
|
2499
|
+
}, [s, e.values]), x.useEffect(() => {
|
|
2500
|
+
s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
|
|
2380
2501
|
}), t.current.formState = x.useMemo(() => ((e, t, n, r = !0) => {
|
|
2381
2502
|
let i = {};
|
|
2382
2503
|
for (let a in e) Object.defineProperty(i, a, { get: () => {
|
|
2383
2504
|
let i = a;
|
|
2384
|
-
return t._proxyFormState[i] !==
|
|
2505
|
+
return t._proxyFormState[i] !== dn && (t._proxyFormState[i] = !r || dn), n && (n[i] = !0), e[i];
|
|
2385
2506
|
} });
|
|
2386
2507
|
return i;
|
|
2387
|
-
})(
|
|
2508
|
+
})(a, s), [s, a]), t.current;
|
|
2388
2509
|
}
|
|
2389
|
-
var
|
|
2510
|
+
var yr = ["Ok", "Cancel"], br = {
|
|
2390
2511
|
[ie.Info]: "ValidationInformation",
|
|
2391
2512
|
[ie.Warning]: "ValidationWarning",
|
|
2392
2513
|
[ie.Error]: "ValidationStop",
|
|
2393
2514
|
[ie.Success]: "Check"
|
|
2394
|
-
},
|
|
2395
|
-
let { description: s, type: c, icon: l, onCancel: u, onOption: d, onDone: p, onValidateOption: m, options: h =
|
|
2396
|
-
let e = typeof l == "string" ? l : l ? void 0 :
|
|
2515
|
+
}, xr = (e) => typeof e == "string" ? e : e.id ?? e, Sr = (e, t) => t !== void 0 && xr(e) === xr(t), Cr = (e) => typeof e != "string" && (typeof e.disabled == "function" ? e.disabled() : !0 === e.disabled), wr = w(C((e, r) => {
|
|
2516
|
+
let { description: s, type: c, icon: l, onCancel: u, onOption: d, onDone: p, onValidateOption: m, options: h = yr, autoFocusSel: g = ".defaultOption", defaultOption: _ = h[0], cancelOption: b = "Cancel", autoFocus: x, children: S, ...C } = e, w = vr({ shouldUseNativeValidation: !1 }), { handleSubmit: T, formState: E } = w, D = k(null), ee = k(null), M = fe(), N = O(() => {
|
|
2517
|
+
let e = typeof l == "string" ? l : l ? void 0 : br[c];
|
|
2397
2518
|
return e ? v(ne, {
|
|
2398
2519
|
iconKey: e,
|
|
2399
2520
|
size: 32,
|
|
2400
2521
|
ariaHidden: !0
|
|
2401
2522
|
}) : l ?? null;
|
|
2402
|
-
}, [l, c]),
|
|
2403
|
-
let t =
|
|
2404
|
-
if (
|
|
2405
|
-
let n =
|
|
2523
|
+
}, [l, c]), P = se((e) => typeof e == "string" ? e === "Ok" ? M("dialog.ok") : e === "Cancel" ? M("dialog.cancel") : e : typeof e.label == "function" ? e.label() : e.label, [M]), te = k(null), [F, ie] = A(null), I = se(async (e) => {
|
|
2524
|
+
let t = xr(e);
|
|
2525
|
+
if (F !== null || Cr(e)) return;
|
|
2526
|
+
let n = Sr(e, b), r;
|
|
2406
2527
|
try {
|
|
2407
2528
|
if (ie(t), r = !!n || (await Promise.resolve(m?.(t)) ?? !0), !0 !== r) return;
|
|
2408
|
-
await Promise.resolve(d?.(t, n,
|
|
2529
|
+
await Promise.resolve(d?.(t, n, Sr(e, _))), p?.(t);
|
|
2409
2530
|
} catch {} finally {
|
|
2410
2531
|
ie(null);
|
|
2411
2532
|
}
|
|
@@ -2415,38 +2536,44 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2415
2536
|
m,
|
|
2416
2537
|
b,
|
|
2417
2538
|
_,
|
|
2418
|
-
|
|
2539
|
+
F
|
|
2419
2540
|
]), oe = se((e, t) => {
|
|
2420
2541
|
setTimeout(() => {
|
|
2421
|
-
|
|
2542
|
+
I(_);
|
|
2422
2543
|
}, 180);
|
|
2423
|
-
}, [
|
|
2424
|
-
d?.(
|
|
2544
|
+
}, [I, _]), L = se(() => {
|
|
2545
|
+
d?.(xr(b), !0, !1), u?.(), p?.(null);
|
|
2425
2546
|
}, [
|
|
2426
2547
|
d,
|
|
2427
2548
|
b,
|
|
2428
2549
|
u,
|
|
2429
2550
|
p
|
|
2430
2551
|
]), ce = E && (Object.keys(E.errors).length > 0 || E.disabled || E.isSubmitting), le = se((e, t, r) => {
|
|
2431
|
-
let a =
|
|
2552
|
+
let a = Sr(e, b), o = {
|
|
2432
2553
|
className: t ? "defaultOption" : "action",
|
|
2433
2554
|
type: t ? "submit" : "button",
|
|
2434
2555
|
style: { minWidth: "75px" },
|
|
2435
2556
|
onClick: () => {
|
|
2436
|
-
a ? L() : t ||
|
|
2557
|
+
a ? L() : t || I(e);
|
|
2437
2558
|
}
|
|
2438
2559
|
}, s = typeof e == "string" ? void 0 : e.renderButton;
|
|
2439
|
-
if (s) return v(
|
|
2440
|
-
|
|
2560
|
+
if (s) return v(ae, {
|
|
2561
|
+
render: s,
|
|
2562
|
+
props: {
|
|
2563
|
+
buttonProps: o,
|
|
2564
|
+
isDefaultOption: t
|
|
2565
|
+
}
|
|
2566
|
+
}, `action:${r}`);
|
|
2567
|
+
let c = F !== null && Sr(e, F), l = {
|
|
2441
2568
|
className: t ? "defaultOption" : "action",
|
|
2442
2569
|
variant: t ? "contained" : "outlined",
|
|
2443
2570
|
size: "small",
|
|
2444
|
-
disabled: !a && (ce ||
|
|
2571
|
+
disabled: !a && (ce || Cr(e)) || F !== null && !c,
|
|
2445
2572
|
color: "primary",
|
|
2446
2573
|
...o
|
|
2447
2574
|
};
|
|
2448
2575
|
if (t || a) {
|
|
2449
|
-
let e = t ? D :
|
|
2576
|
+
let e = t ? D : ee;
|
|
2450
2577
|
l.touchRippleRef = e, l.onPointerDown = (t) => {
|
|
2451
2578
|
e.current?.start(t, { center: !1 }), t.stopPropagation(), t.preventDefault();
|
|
2452
2579
|
};
|
|
@@ -2455,7 +2582,7 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2455
2582
|
...l,
|
|
2456
2583
|
children: [v("div", {
|
|
2457
2584
|
style: { visibility: c ? "hidden" : void 0 },
|
|
2458
|
-
children:
|
|
2585
|
+
children: P(e)
|
|
2459
2586
|
}), m && !a ? v(i, {
|
|
2460
2587
|
size: 16,
|
|
2461
2588
|
color: "inherit",
|
|
@@ -2475,12 +2602,12 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2475
2602
|
_,
|
|
2476
2603
|
b,
|
|
2477
2604
|
E,
|
|
2478
|
-
|
|
2479
|
-
|
|
2605
|
+
P,
|
|
2606
|
+
F
|
|
2480
2607
|
]), ue = O(() => {
|
|
2481
2608
|
let e = [];
|
|
2482
2609
|
for (let t = 0; t < h.length; t++) {
|
|
2483
|
-
let n = h[t], r = _ === void 0 ? t === 0 :
|
|
2610
|
+
let n = h[t], r = _ === void 0 ? t === 0 : Sr(n, _);
|
|
2484
2611
|
e.push(le(n, r, t));
|
|
2485
2612
|
}
|
|
2486
2613
|
return e;
|
|
@@ -2488,8 +2615,8 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2488
2615
|
h,
|
|
2489
2616
|
_,
|
|
2490
2617
|
E,
|
|
2491
|
-
|
|
2492
|
-
|
|
2618
|
+
M,
|
|
2619
|
+
F
|
|
2493
2620
|
]);
|
|
2494
2621
|
return v(Ft, {
|
|
2495
2622
|
onCancel: L,
|
|
@@ -2511,10 +2638,10 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2511
2638
|
e.stopPropagation();
|
|
2512
2639
|
let t = null, n = null, r = e.which === re.Escape && b;
|
|
2513
2640
|
if (r) {
|
|
2514
|
-
if (
|
|
2515
|
-
t = b, n =
|
|
2641
|
+
if (F !== null) return;
|
|
2642
|
+
t = b, n = ee;
|
|
2516
2643
|
} else {
|
|
2517
|
-
if (ce ||
|
|
2644
|
+
if (ce || F !== null) return;
|
|
2518
2645
|
e.which === re.Enter && (t = _ ?? h[0], n = D);
|
|
2519
2646
|
}
|
|
2520
2647
|
t && (n?.current?.start(e, { center: !1 }), setTimeout(() => {
|
|
@@ -2526,7 +2653,7 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2526
2653
|
display: "flex",
|
|
2527
2654
|
flexDirection: "column",
|
|
2528
2655
|
whiteSpace: "pre-wrap",
|
|
2529
|
-
rowGap: (e) => e.spacing(
|
|
2656
|
+
rowGap: (e) => e.spacing(N || s ? 1.5 : 0)
|
|
2530
2657
|
},
|
|
2531
2658
|
children: [y(t, {
|
|
2532
2659
|
sx: {
|
|
@@ -2535,17 +2662,17 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2535
2662
|
alignItems: "flex-start",
|
|
2536
2663
|
columnGap: (e) => e.spacing(2)
|
|
2537
2664
|
},
|
|
2538
|
-
children: [
|
|
2665
|
+
children: [N ? v(t, {
|
|
2539
2666
|
sx: {
|
|
2540
2667
|
display: "flex",
|
|
2541
2668
|
flex: "none"
|
|
2542
2669
|
},
|
|
2543
|
-
children:
|
|
2670
|
+
children: N
|
|
2544
2671
|
}) : null, v(f, {
|
|
2545
2672
|
sx: { alignSelf: "center" },
|
|
2546
2673
|
children: s
|
|
2547
2674
|
})]
|
|
2548
|
-
}),
|
|
2675
|
+
}), S]
|
|
2549
2676
|
})
|
|
2550
2677
|
}), v(a, {
|
|
2551
2678
|
sx: {
|
|
@@ -2553,7 +2680,7 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2553
2680
|
paddingBottom: (e) => e.spacing(1),
|
|
2554
2681
|
paddingLeft: (e) => e.spacing(1),
|
|
2555
2682
|
paddingRight: (e) => e.spacing(1),
|
|
2556
|
-
backgroundColor: (e) =>
|
|
2683
|
+
backgroundColor: (e) => j(e.palette.action.hover, .03)
|
|
2557
2684
|
},
|
|
2558
2685
|
children: ue
|
|
2559
2686
|
})]
|
|
@@ -2561,4 +2688,4 @@ var gr = ["Ok", "Cancel"], _r = {
|
|
|
2561
2688
|
})
|
|
2562
2689
|
});
|
|
2563
2690
|
}));
|
|
2564
|
-
export {
|
|
2691
|
+
export { Ae as _, Ke as a, Ve as c, Re as d, Le as f, je as g, Me as h, Xe as i, He as l, Pe as m, xr as n, Ge as o, Ne as p, Ft as r, Ue as s, wr as t, Be as u, ke as v, Ee as y };
|