@sheetxl/utils-mui 0.8.0-beta.1 → 0.8.0-beta.2
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/browser/cjs/BUKGN088i3WnPm2X.cjs +3 -0
- package/browser/cjs/{CMDyOaq_TZmhbR3R.cjs → BoIvdNHQ8K9GSQnQ.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{DBwwZFuNSwPGoi8L.mjs → BTjqmdqRredVe5QC.mjs} +563 -543
- package/browser/esm/{DL0kfA1tkA8abU1N.mjs → Dypk9nOG6XqTqq_J.mjs} +4 -4
- package/browser/esm/index.mjs +773 -676
- package/node/esm/{Dil2ramfxzB8VR3D.mjs → CwSLcaHUI7AukMBS.mjs} +1 -1
- package/node/esm/index.mjs +820 -705
- package/package.json +3 -3
- package/resources/locales/en/ui.msg.json +1 -0
- package/types/src/button/ExhibitMenuItem.d.ts +12 -0
- package/types/src/components/AnimatedLoadingPanel.d.ts +42 -0
- package/types/src/components/LazyLoadErrorPanel.d.ts +16 -0
- package/types/src/components/index.d.ts +1 -0
- package/types/src/dialog/index.d.ts +1 -0
- package/types/src/dialog/lazyModal.d.ts +25 -0
- package/types/src/theme/ExhibitTheme.d.ts +0 -28
- package/browser/cjs/GeHQP4M_1ydWv9v4.cjs +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
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.2
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -7,45 +7,45 @@
|
|
|
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, { Fragment as S, cloneElement as ee, forwardRef as C, memo as w, useEffect as T, useId as
|
|
11
|
-
import { alpha as
|
|
12
|
-
import { CommonUtils as
|
|
13
|
-
import { Command 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, { Fragment as S, cloneElement as ee, 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 j } from "react";
|
|
11
|
+
import { alpha as M, darken as N, lighten as P } from "@mui/system";
|
|
12
|
+
import { CommonUtils as F } from "@sheetxl/utils";
|
|
13
|
+
import { Command as te, DynamicIcon as ne, KeyCodes as re, KeyModifiers as I, NotifierType as ie, ReactUtils as ae, floatThemeScopeProps as oe, getScrollbarCssVariables as L, useCallbackRef as se, useFloatSurface as ce, useFullscreenPortal as le, useImperativeElement as ue, useTranslator as de } from "@sheetxl/utils-react";
|
|
14
|
+
import { deepmerge as fe } from "@mui/utils";
|
|
15
|
+
import pe, { createPortal as me } from "react-dom";
|
|
16
|
+
var he = Object.create, ge = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, ve = Object.getOwnPropertyNames, ye = Object.getPrototypeOf, be = Object.prototype.hasOwnProperty, xe = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), Se = (e, t, n) => (n = e == null ? {} : he(ye(e)), ((e, t, n, r) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i, a = ve(t), o = 0, s = a.length; o < s; o++) i = a[o], be.call(e, i) || i === n || ge(e, i, {
|
|
18
18
|
get: ((e) => t[e]).bind(null, i),
|
|
19
|
-
enumerable: !(r =
|
|
19
|
+
enumerable: !(r = _e(t, i)) || r.enumerable
|
|
20
20
|
});
|
|
21
21
|
return e;
|
|
22
|
-
})(!t && e && e.__esModule ? n :
|
|
22
|
+
})(!t && e && e.__esModule ? n : ge(n, "default", {
|
|
23
23
|
value: e,
|
|
24
24
|
enumerable: !0
|
|
25
25
|
}), e));
|
|
26
|
-
function
|
|
26
|
+
function Ce(e) {
|
|
27
27
|
var t, n, r = "";
|
|
28
28
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
29
29
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
30
30
|
var i = e.length;
|
|
31
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
31
|
+
for (t = 0; t < i; t++) e[t] && (n = Ce(e[t])) && (r && (r += " "), r += n);
|
|
32
32
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
33
33
|
return r;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
35
|
+
function we() {
|
|
36
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Ce(e)) && (r && (r += " "), r += t);
|
|
37
37
|
return r;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Te(e, t) {
|
|
40
40
|
if (typeof e == "function") return e(t);
|
|
41
41
|
e && (e.current = t);
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var Ee = parseInt(j.split(".")[0], 10) >= 19 ? function(e) {
|
|
44
44
|
return (t) => {
|
|
45
45
|
let n = [];
|
|
46
46
|
for (let r of e) {
|
|
47
|
-
let e =
|
|
48
|
-
n.push(i ? e : () =>
|
|
47
|
+
let e = Te(r, t), i = typeof e == "function";
|
|
48
|
+
n.push(i ? e : () => Te(r, null));
|
|
49
49
|
}
|
|
50
50
|
return () => {
|
|
51
51
|
for (let e of n) e();
|
|
@@ -53,9 +53,9 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
53
53
|
};
|
|
54
54
|
} : function(e) {
|
|
55
55
|
return (t) => {
|
|
56
|
-
for (let n of e)
|
|
56
|
+
for (let n of e) Te(n, t);
|
|
57
57
|
};
|
|
58
|
-
},
|
|
58
|
+
}, De = function() {}, Oe = typeof window < "u", ke = Oe ? D : T, Ae = {
|
|
59
59
|
x: 0,
|
|
60
60
|
y: 0,
|
|
61
61
|
width: 0,
|
|
@@ -64,8 +64,8 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
64
64
|
left: 0,
|
|
65
65
|
bottom: 0,
|
|
66
66
|
right: 0
|
|
67
|
-
},
|
|
68
|
-
var e =
|
|
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
69
|
return new window.ResizeObserver(function(e) {
|
|
70
70
|
if (e[0]) {
|
|
71
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;
|
|
@@ -82,15 +82,15 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
}, []);
|
|
85
|
-
return
|
|
85
|
+
return ke(function() {
|
|
86
86
|
if (t) return o.observe(t), function() {
|
|
87
87
|
o.disconnect();
|
|
88
88
|
};
|
|
89
89
|
}, [t]), [n, i];
|
|
90
90
|
} : function() {
|
|
91
|
-
return [
|
|
92
|
-
},
|
|
93
|
-
let { chips: i, sx: a, ...o } = e, s =
|
|
91
|
+
return [De, Ae];
|
|
92
|
+
}, Me = w(C((e, n) => {
|
|
93
|
+
let { chips: i, sx: a, ...o } = e, s = O(() => {
|
|
94
94
|
if (!i) return null;
|
|
95
95
|
let e = Array.isArray(i) ? i : [i], t = [], n = e.length;
|
|
96
96
|
for (let i = 0; i < n; i++) {
|
|
@@ -116,40 +116,33 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
116
116
|
...o,
|
|
117
117
|
children: s
|
|
118
118
|
});
|
|
119
|
-
})),
|
|
119
|
+
})), Ne = (e) => {
|
|
120
120
|
if (e.palette.mode === "dark") return `drop-shadow(0px 0px 1px ${e.palette.mode === "dark" ? e.palette.text.primary : e.palette.divider})`;
|
|
121
|
-
},
|
|
121
|
+
}, Pe = (e = 1) => (t) => {
|
|
122
122
|
if (t.palette.mode === "dark") return `drop-shadow(0px 0px ${e}px ${t.palette.mode === "dark" ? t.palette.text.primary : t.palette.divider})`;
|
|
123
|
-
},
|
|
123
|
+
}, Fe = (e) => v(ne, {
|
|
124
124
|
...e,
|
|
125
125
|
iconKey: "ArrowDownOutline"
|
|
126
|
-
}),
|
|
126
|
+
}), Ie = (e) => v(ne, {
|
|
127
127
|
...e,
|
|
128
128
|
iconKey: "ArrowRightOutline"
|
|
129
|
-
}),
|
|
129
|
+
}), Le = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, Re = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, R = function(e, t = null) {
|
|
130
130
|
if (!e) return e;
|
|
131
|
-
e = e.replace(
|
|
131
|
+
e = e.replace(Le, function(e, t, n, r) {
|
|
132
132
|
return t + t + n + n + r + r;
|
|
133
133
|
});
|
|
134
|
-
let n =
|
|
134
|
+
let n = Re.exec(e);
|
|
135
135
|
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
|
-
},
|
|
136
|
+
}, ze = function(e, t = .2, n = "light") {
|
|
137
137
|
if (!e) return e;
|
|
138
138
|
let r = n !== "dark";
|
|
139
|
-
t < 0 && (r = !r, t *= -1), e =
|
|
139
|
+
t < 0 && (r = !r, t *= -1), e = R(e);
|
|
140
140
|
try {
|
|
141
|
-
return r ?
|
|
141
|
+
return r ? N(e, Math.max(0, Math.min(1, 1 * t))) : P(e, Math.max(0, Math.min(1, 1.5 * t)));
|
|
142
142
|
} catch {
|
|
143
143
|
return e;
|
|
144
144
|
}
|
|
145
|
-
},
|
|
146
|
-
let t = 0;
|
|
147
|
-
return t = e < 1 ? 5.11916 * e ** 2 : 4.5 * Math.log(e + 1) + 2, Number((t / 100).toFixed(2));
|
|
148
|
-
}, Be = (e) => (t) => {
|
|
149
|
-
if (t.palette.mode !== "dark") return "var(--sxl-surface-raised, none)";
|
|
150
|
-
let n = j("#fff", ze(e));
|
|
151
|
-
return `var(--sxl-surface-raised, linear-gradient(${n}, ${n}))`;
|
|
152
|
-
}, Ve = Be(2), He = Be(8), Ue = (e, t) => {
|
|
145
|
+
}, Be = (e, t) => {
|
|
153
146
|
let n = m({ palette: { mode: e ? "dark" : "light" } }), r = {
|
|
154
147
|
"--icon-shadow": e ? n.palette.text.primary : n.palette.divider,
|
|
155
148
|
"--icon-size": "1.25rem",
|
|
@@ -159,15 +152,15 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
159
152
|
palette: {
|
|
160
153
|
mode: e ? "dark" : "light",
|
|
161
154
|
text: {
|
|
162
|
-
secondary: e ? n.palette.text.secondary :
|
|
163
|
-
icon: e ?
|
|
155
|
+
secondary: e ? n.palette.text.secondary : M(n.palette.text.secondary, .75),
|
|
156
|
+
icon: e ? M(n.palette.text.secondary, .7) : M(n.palette.text.primary, .75)
|
|
164
157
|
}
|
|
165
158
|
},
|
|
166
159
|
components: {
|
|
167
160
|
MuiDialogTitle: { styleOverrides: { root: { fontWeight: "normal" } } },
|
|
168
161
|
MuiSelect: {
|
|
169
162
|
defaultProps: {
|
|
170
|
-
IconComponent:
|
|
163
|
+
IconComponent: Fe,
|
|
171
164
|
MenuProps: { container: () => document.fullscreenElement }
|
|
172
165
|
},
|
|
173
166
|
styleOverrides: { icon: { top: "unset" } }
|
|
@@ -225,7 +218,7 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
225
218
|
MuiInputBase: { styleOverrides: { root: {} } },
|
|
226
219
|
MuiPaper: { styleOverrides: { root: {
|
|
227
220
|
...r,
|
|
228
|
-
backgroundImage: "
|
|
221
|
+
backgroundImage: "none"
|
|
229
222
|
} } },
|
|
230
223
|
MuiPopover: { styleOverrides: { paper: {
|
|
231
224
|
backgroundColor: `var(--sxl-color-elevated, var(--sxl-color-base-100, ${n.palette.background.paper}))`,
|
|
@@ -252,17 +245,17 @@ var Te = parseInt(A.split(".")[0], 10) >= 19 ? function(e) {
|
|
|
252
245
|
} }
|
|
253
246
|
}
|
|
254
247
|
}, a = i;
|
|
255
|
-
return t && (a =
|
|
248
|
+
return t && (a = fe(i, t)), m(a);
|
|
256
249
|
};
|
|
257
|
-
function
|
|
258
|
-
return t =
|
|
259
|
-
track:
|
|
260
|
-
thumb:
|
|
250
|
+
function Ve(e, t) {
|
|
251
|
+
return t = fe({
|
|
252
|
+
track: ze(e.palette.background.paper, .05, e?.palette.mode),
|
|
253
|
+
thumb: ze(e.palette.background.paper, .3, e?.palette.mode),
|
|
261
254
|
active: e.palette.primary.main,
|
|
262
255
|
corner: e.palette.background.paper,
|
|
263
256
|
outline: !1
|
|
264
|
-
}, t || {}),
|
|
265
|
-
track:
|
|
257
|
+
}, t || {}), L({
|
|
258
|
+
track: M(t.track, .2),
|
|
266
259
|
thumb: t.thumb,
|
|
267
260
|
button: t.button,
|
|
268
261
|
active: t.active,
|
|
@@ -270,8 +263,8 @@ function We(e, t) {
|
|
|
270
263
|
border: t.track
|
|
271
264
|
});
|
|
272
265
|
}
|
|
273
|
-
function
|
|
274
|
-
let n =
|
|
266
|
+
function He(e, t) {
|
|
267
|
+
let n = Ve(e, t), r = {
|
|
275
268
|
...n,
|
|
276
269
|
"& .scrollbar, & .vsb-track, & .vsb-thumb": { ...n },
|
|
277
270
|
"&::-webkit-scrollbar, & *::-webkit-scrollbar": {
|
|
@@ -312,9 +305,9 @@ function Ge(e, t) {
|
|
|
312
305
|
},
|
|
313
306
|
"&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": { backgroundColor: "var(--scrollbar-corner-color)" }
|
|
314
307
|
};
|
|
315
|
-
return
|
|
308
|
+
return F.getPlatform() === F.OSType.Firefox && (r["* .pseudo-scrollbar"] = { scrollbarColor: "var(--scrollbar-thumb-color) transparent" }, r["* .pseudo-scrollbar:hover:not([disabled])"] = { scrollbarColor: "var(--scrollbar-active-color) transparent" }), r;
|
|
316
309
|
}
|
|
317
|
-
var
|
|
310
|
+
var Ue = C((e, t) => {
|
|
318
311
|
let { slotProps: n, ...r } = e, { getPortalContainer: i, isFullscreen: a } = le();
|
|
319
312
|
return v(d, {
|
|
320
313
|
ref: t,
|
|
@@ -328,8 +321,8 @@ var Ke = C((e, t) => {
|
|
|
328
321
|
...r
|
|
329
322
|
});
|
|
330
323
|
});
|
|
331
|
-
|
|
332
|
-
var
|
|
324
|
+
Ue.displayName = "SimpleTooltip";
|
|
325
|
+
var We = w((e) => {
|
|
333
326
|
let { modifier: n, sx: r, ...i } = e;
|
|
334
327
|
return v(t, {
|
|
335
328
|
sx: {
|
|
@@ -341,11 +334,11 @@ var qe = w((e) => {
|
|
|
341
334
|
borderLeftWidth: "1px",
|
|
342
335
|
borderRightWidth: "1px",
|
|
343
336
|
borderBottomWidth: "2px",
|
|
344
|
-
borderTopColor: (e) =>
|
|
345
|
-
borderLeftColor: (e) =>
|
|
346
|
-
borderRightColor: (e) =>
|
|
347
|
-
borderBottomColor: (e) =>
|
|
348
|
-
backgroundColor: (e) =>
|
|
337
|
+
borderTopColor: (e) => M(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
338
|
+
borderLeftColor: (e) => M(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
339
|
+
borderRightColor: (e) => M(e.palette.background.paper, e.palette.action.disabledOpacity),
|
|
340
|
+
borderBottomColor: (e) => M(e.palette.background.paper, 1 - e.palette.action.disabledOpacity),
|
|
341
|
+
backgroundColor: (e) => M(e.palette.action.hover, e.palette.action.disabledOpacity),
|
|
349
342
|
paddingLeft: "4px",
|
|
350
343
|
paddingRight: "4px",
|
|
351
344
|
minHeight: "1.6em",
|
|
@@ -368,10 +361,10 @@ var qe = w((e) => {
|
|
|
368
361
|
children: n
|
|
369
362
|
})
|
|
370
363
|
});
|
|
371
|
-
}),
|
|
364
|
+
}), Ge = (e, n, r = !1, i = null) => {
|
|
372
365
|
if (Array.isArray(e)) {
|
|
373
366
|
let a = [], o = e;
|
|
374
|
-
for (let e = 0; e < o.length; e++) a.push(
|
|
367
|
+
for (let e = 0; e < o.length; e++) a.push(Ge(o[e], n, r, i ?? "" + e));
|
|
375
368
|
return v(t, {
|
|
376
369
|
sx: {
|
|
377
370
|
display: "flex",
|
|
@@ -384,32 +377,32 @@ var qe = w((e) => {
|
|
|
384
377
|
if (!e?.key) return null;
|
|
385
378
|
let a = {};
|
|
386
379
|
for (let t = 0; e.modifiers && t < e.modifiers.length; t++) a[e.modifiers[t]] = !0;
|
|
387
|
-
let o = [], s =
|
|
388
|
-
return a?.[
|
|
380
|
+
let o = [], s = F.getPlatform() === F.OSType.MacOS || F.getPlatform() === F.OSType.IOS ? n("shortcut.modifier.cmd") : n("shortcut.modifier.ctrl");
|
|
381
|
+
return a?.[I.Ctrl] && (o.push(v(We, { modifier: r ? "^" : v("div", {
|
|
389
382
|
style: { paddingRight: "1px" },
|
|
390
383
|
children: s
|
|
391
|
-
}) }, "ctrl")), o.push("+")), a?.[
|
|
384
|
+
}) }, "ctrl")), o.push("+")), a?.[I.Alt] && (o.push(v(We, { modifier: r ? "⌥" : n("shortcut.modifier.alt") }, "alt")), o.push("+")), a?.[I.Shift] && (o.push(v(We, { modifier: r ? "⇧" : v("div", {
|
|
392
385
|
style: { paddingRight: "1px" },
|
|
393
386
|
children: n("shortcut.modifier.shift")
|
|
394
|
-
}) }, "shift")), o.push("+")), a?.[
|
|
387
|
+
}) }, "shift")), o.push("+")), a?.[I.Meta] && (o.push(v(We, { modifier: r ? v("div", {
|
|
395
388
|
style: { paddingTop: "1px" },
|
|
396
389
|
children: "⌘"
|
|
397
|
-
}) : n("shortcut.modifier.meta") }, "meta")), o.push("+")), o.push(v(
|
|
390
|
+
}) : n("shortcut.modifier.meta") }, "meta")), o.push("+")), o.push(v(We, { modifier: ae.toPrettyKeyCode(e.key) }, "character")), v(t, {
|
|
398
391
|
sx: {
|
|
399
392
|
display: "flex",
|
|
400
393
|
alignItems: "center"
|
|
401
394
|
},
|
|
402
395
|
children: o
|
|
403
396
|
}, i);
|
|
404
|
-
},
|
|
397
|
+
}, Ke = w(C((e, n) => {
|
|
405
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 = de(), b = null;
|
|
406
|
-
a && (b =
|
|
407
|
-
let [x, S] =
|
|
399
|
+
a && (b = Ge(a, g, l));
|
|
400
|
+
let [x, S] = A(null);
|
|
408
401
|
return T(() => {
|
|
409
402
|
Promise.resolve(i).then((e) => {
|
|
410
403
|
S(e);
|
|
411
404
|
});
|
|
412
|
-
}, [i]), v(
|
|
405
|
+
}, [i]), v(Ue, {
|
|
413
406
|
slotProps: { popper: {
|
|
414
407
|
sx: {
|
|
415
408
|
"& .MuiTooltip-tooltip": { marginTop: "0px !important" },
|
|
@@ -438,7 +431,7 @@ var qe = w((e) => {
|
|
|
438
431
|
sx: { flex: "1 1 100%" },
|
|
439
432
|
children: x
|
|
440
433
|
}),
|
|
441
|
-
o ? v(
|
|
434
|
+
o ? v(Me, { chips: o }) : null,
|
|
442
435
|
b ? v(t, { sx: { marginLeft: "8px" } }, "leadingSpace") : v(_, {}),
|
|
443
436
|
b
|
|
444
437
|
]
|
|
@@ -465,9 +458,10 @@ var qe = w((e) => {
|
|
|
465
458
|
children: u
|
|
466
459
|
})
|
|
467
460
|
});
|
|
468
|
-
})),
|
|
461
|
+
})), qe = {
|
|
469
462
|
"dialog.cancel": "Cancel",
|
|
470
463
|
"dialog.ok": "Ok",
|
|
464
|
+
"lazyLoad.retry": "Retry",
|
|
471
465
|
"overflow.more": "More",
|
|
472
466
|
"overflow.moreDescription": "More toolbar options…",
|
|
473
467
|
"scroll.edgeBottom": " Bottom: ''Ctrl+Click'' to scroll to the end",
|
|
@@ -486,14 +480,14 @@ var qe = w((e) => {
|
|
|
486
480
|
"stackTrace.log": "Log error to console",
|
|
487
481
|
"stackTrace.moreFrames": "... and {count} more frames",
|
|
488
482
|
"window.close": "Close"
|
|
489
|
-
}, { DefaultCommandCatalogService:
|
|
490
|
-
function
|
|
491
|
-
|
|
483
|
+
}, { DefaultCommandCatalogService: Je } = te, Ye = !1;
|
|
484
|
+
function Xe() {
|
|
485
|
+
Ye || (Ye = !0, Je.registerFromManifest("@sheetxl/utils-mui", import.meta.url, { messages: qe }));
|
|
492
486
|
}
|
|
493
|
-
var
|
|
487
|
+
var Ze = xe((e, t) => {
|
|
494
488
|
t.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
495
|
-
}),
|
|
496
|
-
var n =
|
|
489
|
+
}), Qe = xe((e, t) => {
|
|
490
|
+
var n = Ze();
|
|
497
491
|
function r() {}
|
|
498
492
|
function i() {}
|
|
499
493
|
i.resetWarningCache = r, t.exports = function() {
|
|
@@ -532,71 +526,71 @@ var et = be((e, t) => {
|
|
|
532
526
|
};
|
|
533
527
|
return a.PropTypes = a, a;
|
|
534
528
|
};
|
|
535
|
-
}), z = xe(
|
|
536
|
-
t.exports =
|
|
529
|
+
}), z = Se(xe((e, t) => {
|
|
530
|
+
t.exports = Qe()();
|
|
537
531
|
})(), 1);
|
|
538
|
-
function
|
|
532
|
+
function $e(e, t) {
|
|
539
533
|
for (let n = 0, r = e.length; n < r; n++) if (t.apply(t, [
|
|
540
534
|
e[n],
|
|
541
535
|
n,
|
|
542
536
|
e
|
|
543
537
|
])) return e[n];
|
|
544
538
|
}
|
|
545
|
-
function
|
|
539
|
+
function et(e) {
|
|
546
540
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Function]";
|
|
547
541
|
}
|
|
548
|
-
function
|
|
542
|
+
function tt(e) {
|
|
549
543
|
return typeof e == "number" && !isNaN(e);
|
|
550
544
|
}
|
|
551
545
|
function B(e) {
|
|
552
546
|
return parseInt(e, 10);
|
|
553
547
|
}
|
|
554
|
-
function
|
|
548
|
+
function nt(e, t, n) {
|
|
555
549
|
if (e[t]) return /* @__PURE__ */ Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`);
|
|
556
550
|
}
|
|
557
|
-
var
|
|
551
|
+
var rt = [
|
|
558
552
|
"Moz",
|
|
559
553
|
"Webkit",
|
|
560
554
|
"O",
|
|
561
555
|
"ms"
|
|
562
556
|
];
|
|
563
|
-
function
|
|
557
|
+
function it(e, t) {
|
|
564
558
|
return t ? `${t}${function(e) {
|
|
565
559
|
let t = "", n = !0;
|
|
566
560
|
for (let r = 0; r < e.length; r++) n ? (t += e[r].toUpperCase(), n = !1) : e[r] === "-" ? n = !0 : t += e[r];
|
|
567
561
|
return t;
|
|
568
562
|
}(e)}` : e;
|
|
569
563
|
}
|
|
570
|
-
var
|
|
564
|
+
var at = function(e = "transform") {
|
|
571
565
|
if (typeof window > "u") return "";
|
|
572
566
|
let t = window.document?.documentElement?.style;
|
|
573
567
|
if (!t || e in t) return "";
|
|
574
|
-
for (let n = 0; n <
|
|
568
|
+
for (let n = 0; n < rt.length; n++) if (it(e, rt[n]) in t) return rt[n];
|
|
575
569
|
return "";
|
|
576
|
-
}(),
|
|
577
|
-
function
|
|
578
|
-
|
|
570
|
+
}(), ot = "";
|
|
571
|
+
function st(e, t) {
|
|
572
|
+
ot ||= $e([
|
|
579
573
|
"matches",
|
|
580
574
|
"webkitMatchesSelector",
|
|
581
575
|
"mozMatchesSelector",
|
|
582
576
|
"msMatchesSelector",
|
|
583
577
|
"oMatchesSelector"
|
|
584
578
|
], function(t) {
|
|
585
|
-
return
|
|
579
|
+
return et(e[t]);
|
|
586
580
|
}) ?? "";
|
|
587
|
-
let n = e[
|
|
588
|
-
return !!
|
|
581
|
+
let n = e[ot];
|
|
582
|
+
return !!et(n) && !!n.call(e, t);
|
|
589
583
|
}
|
|
590
|
-
function
|
|
584
|
+
function ct(e, t, n) {
|
|
591
585
|
let r = e;
|
|
592
586
|
do {
|
|
593
|
-
if (
|
|
587
|
+
if (st(r, t)) return !0;
|
|
594
588
|
if (r === n) return !1;
|
|
595
589
|
r = r.parentNode;
|
|
596
590
|
} while (r);
|
|
597
591
|
return !1;
|
|
598
592
|
}
|
|
599
|
-
function
|
|
593
|
+
function lt(e, t, n, r) {
|
|
600
594
|
if (!e) return;
|
|
601
595
|
let i = {
|
|
602
596
|
capture: !0,
|
|
@@ -604,7 +598,7 @@ function ft(e, t, n, r) {
|
|
|
604
598
|
}, a = n;
|
|
605
599
|
e.addEventListener ? e.addEventListener(t, a, i) : e.attachEvent ? e.attachEvent("on" + t, a) : e["on" + t] = a;
|
|
606
600
|
}
|
|
607
|
-
function
|
|
601
|
+
function ut(e, t, n, r) {
|
|
608
602
|
if (!e) return;
|
|
609
603
|
let i = {
|
|
610
604
|
capture: !0,
|
|
@@ -612,27 +606,27 @@ function pt(e, t, n, r) {
|
|
|
612
606
|
}, a = n;
|
|
613
607
|
e.removeEventListener ? e.removeEventListener(t, a, i) : e.detachEvent ? e.detachEvent("on" + t, a) : e["on" + t] = null;
|
|
614
608
|
}
|
|
615
|
-
function
|
|
609
|
+
function dt(e) {
|
|
616
610
|
let t = e.clientHeight, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
617
611
|
return t += B(n.borderTopWidth), t += B(n.borderBottomWidth), t;
|
|
618
612
|
}
|
|
619
|
-
function
|
|
613
|
+
function ft(e) {
|
|
620
614
|
let t = e.clientWidth, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
621
615
|
return t += B(n.borderLeftWidth), t += B(n.borderRightWidth), t;
|
|
622
616
|
}
|
|
623
|
-
function
|
|
617
|
+
function pt(e) {
|
|
624
618
|
let t = e.clientHeight, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
625
619
|
return t -= B(n.paddingTop), t -= B(n.paddingBottom), t;
|
|
626
620
|
}
|
|
627
|
-
function
|
|
621
|
+
function mt(e) {
|
|
628
622
|
let t = e.clientWidth, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
629
623
|
return t -= B(n.paddingLeft), t -= B(n.paddingRight), t;
|
|
630
624
|
}
|
|
631
|
-
function
|
|
625
|
+
function ht({ x: e, y: t }, n, r) {
|
|
632
626
|
let i = `translate(${e}${r},${t}${r})`;
|
|
633
627
|
return n && (i = `translate(${typeof n.x == "string" ? n.x : n.x + r}, ${typeof n.y == "string" ? n.y : n.y + r})` + i), i;
|
|
634
628
|
}
|
|
635
|
-
function
|
|
629
|
+
function gt(e, t) {
|
|
636
630
|
if (!e) return;
|
|
637
631
|
let n = e.getElementById("react-draggable-style-el");
|
|
638
632
|
if (!n) {
|
|
@@ -643,12 +637,12 @@ function yt(e, t) {
|
|
|
643
637
|
var r, i;
|
|
644
638
|
e.body && (r = e.body, i = "react-draggable-transparent-selection", r.classList ? r.classList.add(i) : r.className.match(RegExp(`(?:^|\\s)${i}(?!\\S)`)) || (r.className += ` ${i}`));
|
|
645
639
|
}
|
|
646
|
-
function
|
|
640
|
+
function _t(e) {
|
|
647
641
|
window.requestAnimationFrame ? window.requestAnimationFrame(() => {
|
|
648
|
-
|
|
649
|
-
}) :
|
|
642
|
+
vt(e);
|
|
643
|
+
}) : vt(e);
|
|
650
644
|
}
|
|
651
|
-
function
|
|
645
|
+
function vt(e) {
|
|
652
646
|
var t, n;
|
|
653
647
|
if (e) try {
|
|
654
648
|
e.body && (t = e.body, n = "react-draggable-transparent-selection", t.classList ? t.classList.remove(n) : t.className = t.className.replace(RegExp(`(?:^|\\s)${n}(?!\\S)`, "g"), ""));
|
|
@@ -660,21 +654,21 @@ function xt(e) {
|
|
|
660
654
|
}
|
|
661
655
|
} catch {}
|
|
662
656
|
}
|
|
663
|
-
function
|
|
657
|
+
function yt(e, t, n) {
|
|
664
658
|
return [Math.round(t / e[0]) * e[0], Math.round(n / e[1]) * e[1]];
|
|
665
659
|
}
|
|
666
|
-
function
|
|
660
|
+
function bt(e) {
|
|
667
661
|
return e.props.axis === "both" || e.props.axis === "x";
|
|
668
662
|
}
|
|
669
|
-
function
|
|
663
|
+
function xt(e) {
|
|
670
664
|
return e.props.axis === "both" || e.props.axis === "y";
|
|
671
665
|
}
|
|
672
|
-
function
|
|
666
|
+
function St(e, t, n) {
|
|
673
667
|
let r = typeof t == "number" ? function(e, t) {
|
|
674
|
-
return e.targetTouches &&
|
|
668
|
+
return e.targetTouches && $e(e.targetTouches, (e) => t === e.identifier) || e.changedTouches && $e(e.changedTouches, (e) => t === e.identifier);
|
|
675
669
|
}(e, t) : null;
|
|
676
670
|
if (typeof t == "number" && !r) return null;
|
|
677
|
-
let i =
|
|
671
|
+
let i = Tt(n);
|
|
678
672
|
return function(e, t, n) {
|
|
679
673
|
let r = t === t.ownerDocument.body ? {
|
|
680
674
|
left: 0,
|
|
@@ -686,8 +680,8 @@ function Tt(e, t, n) {
|
|
|
686
680
|
};
|
|
687
681
|
}(r || e, n.props.offsetParent || i.offsetParent || i.ownerDocument.body, n.props.scale);
|
|
688
682
|
}
|
|
689
|
-
function
|
|
690
|
-
let r = !
|
|
683
|
+
function Ct(e, t, n) {
|
|
684
|
+
let r = !tt(e.lastX), i = Tt(e);
|
|
691
685
|
return r ? {
|
|
692
686
|
node: i,
|
|
693
687
|
deltaX: 0,
|
|
@@ -706,7 +700,7 @@ function Et(e, t, n) {
|
|
|
706
700
|
y: n
|
|
707
701
|
};
|
|
708
702
|
}
|
|
709
|
-
function
|
|
703
|
+
function wt(e, t) {
|
|
710
704
|
let n = e.props.scale;
|
|
711
705
|
return {
|
|
712
706
|
node: t.node,
|
|
@@ -718,46 +712,46 @@ function Dt(e, t) {
|
|
|
718
712
|
lastY: e.state.y
|
|
719
713
|
};
|
|
720
714
|
}
|
|
721
|
-
function
|
|
715
|
+
function Tt(e) {
|
|
722
716
|
let t = e.findDOMNode();
|
|
723
717
|
if (!t) throw Error("<DraggableCore>: Unmounted during event!");
|
|
724
718
|
return t;
|
|
725
719
|
}
|
|
726
|
-
var
|
|
720
|
+
var Et = {
|
|
727
721
|
start: "touchstart",
|
|
728
722
|
move: "touchmove",
|
|
729
723
|
stop: "touchend"
|
|
730
|
-
},
|
|
724
|
+
}, Dt = {
|
|
731
725
|
start: "mousedown",
|
|
732
726
|
move: "mousemove",
|
|
733
727
|
stop: "mouseup"
|
|
734
|
-
},
|
|
728
|
+
}, Ot = Dt, kt = class extends b.Component {
|
|
735
729
|
constructor() {
|
|
736
730
|
super(...arguments), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, this.touchIdentifier = null, this.mounted = !1, this.handleDragStart = (e) => {
|
|
737
731
|
if (this.props.onMouseDown(e), !this.props.allowAnyClick && (typeof e.button == "number" && e.button !== 0 || e.ctrlKey)) return !1;
|
|
738
732
|
let t = this.findDOMNode();
|
|
739
733
|
if (!t || !t.ownerDocument || !t.ownerDocument.body) throw Error("<DraggableCore> not mounted on DragStart!");
|
|
740
734
|
let { ownerDocument: n } = t;
|
|
741
|
-
if (this.props.disabled || !(e.target instanceof n.defaultView.Node) || this.props.handle && !
|
|
735
|
+
if (this.props.disabled || !(e.target instanceof n.defaultView.Node) || this.props.handle && !ct(e.target, this.props.handle, t) || this.props.cancel && ct(e.target, this.props.cancel, t)) return;
|
|
742
736
|
e.type !== "touchstart" || this.props.allowMobileScroll || e.preventDefault();
|
|
743
737
|
let r = function(e) {
|
|
744
738
|
return e.targetTouches && e.targetTouches[0] ? e.targetTouches[0].identifier : e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].identifier : void 0;
|
|
745
739
|
}(e);
|
|
746
740
|
this.touchIdentifier = r;
|
|
747
|
-
let i =
|
|
741
|
+
let i = St(e, r, this);
|
|
748
742
|
if (i == null) return;
|
|
749
|
-
let { x: a, y: o } = i, s =
|
|
750
|
-
this.props.onStart, !1 !== this.props.onStart(e, s) && !1 !== this.mounted && (this.props.enableUserSelectHack &&
|
|
743
|
+
let { x: a, y: o } = i, s = Ct(this, a, o);
|
|
744
|
+
this.props.onStart, !1 !== this.props.onStart(e, s) && !1 !== this.mounted && (this.props.enableUserSelectHack && gt(n, this.props.nonce), this.dragging = !0, this.lastX = a, this.lastY = o, lt(n, Ot.move, this.handleDrag), lt(n, Ot.stop, this.handleDragStop));
|
|
751
745
|
}, this.handleDrag = (e) => {
|
|
752
|
-
let t =
|
|
746
|
+
let t = St(e, this.touchIdentifier, this);
|
|
753
747
|
if (t == null) return;
|
|
754
748
|
let { x: n, y: r } = t;
|
|
755
749
|
if (Array.isArray(this.props.grid)) {
|
|
756
750
|
let e = n - this.lastX, t = r - this.lastY;
|
|
757
|
-
if ([e, t] =
|
|
751
|
+
if ([e, t] = yt(this.props.grid, e, t), !e && !t) return;
|
|
758
752
|
n = this.lastX + e, r = this.lastY + t;
|
|
759
753
|
}
|
|
760
|
-
let i =
|
|
754
|
+
let i = Ct(this, n, r);
|
|
761
755
|
if (!1 !== this.props.onDrag(e, i) && !1 !== this.mounted) this.lastX = n, this.lastY = r;
|
|
762
756
|
else try {
|
|
763
757
|
this.handleDragStop(new MouseEvent("mouseup"));
|
|
@@ -767,35 +761,35 @@ var kt = {
|
|
|
767
761
|
}
|
|
768
762
|
}, this.handleDragStop = (e) => {
|
|
769
763
|
if (!this.dragging) return;
|
|
770
|
-
let t =
|
|
764
|
+
let t = St(e, this.touchIdentifier, this);
|
|
771
765
|
if (t == null) return;
|
|
772
766
|
let { x: n, y: r } = t;
|
|
773
767
|
if (Array.isArray(this.props.grid)) {
|
|
774
768
|
let e = n - this.lastX || 0, t = r - this.lastY || 0;
|
|
775
|
-
[e, t] =
|
|
769
|
+
[e, t] = yt(this.props.grid, e, t), n = this.lastX + e, r = this.lastY + t;
|
|
776
770
|
}
|
|
777
|
-
let i =
|
|
771
|
+
let i = Ct(this, n, r);
|
|
778
772
|
if (!1 === this.props.onStop(e, i) || !1 === this.mounted) return !1;
|
|
779
773
|
let a = this.findDOMNode();
|
|
780
|
-
a && this.props.enableUserSelectHack &&
|
|
781
|
-
}, this.onMouseDown = (e) => (
|
|
774
|
+
a && this.props.enableUserSelectHack && _t(a.ownerDocument), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, a && (ut(a.ownerDocument, Ot.move, this.handleDrag), ut(a.ownerDocument, Ot.stop, this.handleDragStop));
|
|
775
|
+
}, this.onMouseDown = (e) => (Ot = Dt, this.handleDragStart(e)), this.onMouseUp = (e) => (Ot = Dt, this.handleDragStop(e)), this.onTouchStart = (e) => (Ot = Et, this.handleDragStart(e)), this.onTouchEnd = (e) => (Ot = Et, this.handleDragStop(e));
|
|
782
776
|
}
|
|
783
777
|
componentDidMount() {
|
|
784
778
|
this.mounted = !0;
|
|
785
779
|
let e = this.findDOMNode();
|
|
786
|
-
e &&
|
|
780
|
+
e && lt(e, Et.start, this.onTouchStart, { passive: !1 });
|
|
787
781
|
}
|
|
788
782
|
componentWillUnmount() {
|
|
789
783
|
this.mounted = !1;
|
|
790
784
|
let e = this.findDOMNode();
|
|
791
785
|
if (e) {
|
|
792
786
|
let { ownerDocument: t } = e;
|
|
793
|
-
|
|
787
|
+
ut(t, Dt.move, this.handleDrag), ut(t, Et.move, this.handleDrag), ut(t, Dt.stop, this.handleDragStop), ut(t, Et.stop, this.handleDragStop), ut(e, Et.start, this.onTouchStart, { passive: !1 }), this.props.enableUserSelectHack && _t(t);
|
|
794
788
|
}
|
|
795
789
|
}
|
|
796
790
|
findDOMNode() {
|
|
797
791
|
if (this.props?.nodeRef) return this.props.nodeRef.current;
|
|
798
|
-
let e =
|
|
792
|
+
let e = pe;
|
|
799
793
|
return typeof e.findDOMNode == "function" ? e.findDOMNode(this) : null;
|
|
800
794
|
}
|
|
801
795
|
render() {
|
|
@@ -806,7 +800,7 @@ var kt = {
|
|
|
806
800
|
});
|
|
807
801
|
}
|
|
808
802
|
};
|
|
809
|
-
|
|
803
|
+
kt.displayName = "DraggableCore", kt.propTypes = {
|
|
810
804
|
allowAnyClick: z.default.bool,
|
|
811
805
|
allowMobileScroll: z.default.bool,
|
|
812
806
|
children: z.default.node.isRequired,
|
|
@@ -825,10 +819,10 @@ Mt.displayName = "DraggableCore", Mt.propTypes = {
|
|
|
825
819
|
onStop: z.default.func,
|
|
826
820
|
onMouseDown: z.default.func,
|
|
827
821
|
scale: z.default.number,
|
|
828
|
-
className:
|
|
829
|
-
style:
|
|
830
|
-
transform:
|
|
831
|
-
},
|
|
822
|
+
className: nt,
|
|
823
|
+
style: nt,
|
|
824
|
+
transform: nt
|
|
825
|
+
}, kt.defaultProps = {
|
|
832
826
|
allowAnyClick: !1,
|
|
833
827
|
allowMobileScroll: !1,
|
|
834
828
|
disabled: !1,
|
|
@@ -839,17 +833,17 @@ Mt.displayName = "DraggableCore", Mt.propTypes = {
|
|
|
839
833
|
onMouseDown: function() {},
|
|
840
834
|
scale: 1
|
|
841
835
|
};
|
|
842
|
-
var
|
|
836
|
+
var At = class extends b.Component {
|
|
843
837
|
constructor(e) {
|
|
844
838
|
super(e), this.onDragStart = (e, t) => {
|
|
845
|
-
if (!1 === this.props.onStart(e,
|
|
839
|
+
if (!1 === this.props.onStart(e, wt(this, t))) return !1;
|
|
846
840
|
this.setState({
|
|
847
841
|
dragging: !0,
|
|
848
842
|
dragged: !0
|
|
849
843
|
});
|
|
850
844
|
}, this.onDrag = (e, t) => {
|
|
851
845
|
if (!this.state.dragging) return !1;
|
|
852
|
-
let n =
|
|
846
|
+
let n = wt(this, t), r = {
|
|
853
847
|
x: n.x,
|
|
854
848
|
y: n.y,
|
|
855
849
|
slackX: 0,
|
|
@@ -869,7 +863,7 @@ var Nt = class extends b.Component {
|
|
|
869
863
|
bottom: e.bottom
|
|
870
864
|
};
|
|
871
865
|
}(r);
|
|
872
|
-
let i =
|
|
866
|
+
let i = Tt(e);
|
|
873
867
|
if (typeof r == "string") {
|
|
874
868
|
let { ownerDocument: e } = i, t = e.defaultView;
|
|
875
869
|
if (!t) throw Error("Cannot resolve the owner window of the draggable node.");
|
|
@@ -879,18 +873,18 @@ var Nt = class extends b.Component {
|
|
|
879
873
|
r = {
|
|
880
874
|
left: -i.offsetLeft + B(s.paddingLeft) + B(o.marginLeft),
|
|
881
875
|
top: -i.offsetTop + B(s.paddingTop) + B(o.marginTop),
|
|
882
|
-
right:
|
|
883
|
-
bottom:
|
|
876
|
+
right: mt(a) - ft(i) - i.offsetLeft + B(s.paddingRight) - B(o.marginRight),
|
|
877
|
+
bottom: pt(a) - dt(i) - i.offsetTop + B(s.paddingBottom) - B(o.marginBottom)
|
|
884
878
|
};
|
|
885
879
|
}
|
|
886
|
-
return
|
|
880
|
+
return tt(r.right) && (t = Math.min(t, r.right)), tt(r.bottom) && (n = Math.min(n, r.bottom)), tt(r.left) && (t = Math.max(t, r.left)), tt(r.top) && (n = Math.max(n, r.top)), [t, n];
|
|
887
881
|
}(this, r.x, r.y);
|
|
888
882
|
r.x = i, r.y = a, r.slackX = this.state.slackX + (e - r.x), r.slackY = this.state.slackY + (t - r.y), n.x = r.x, n.y = r.y, n.deltaX = r.x - this.state.x, n.deltaY = r.y - this.state.y;
|
|
889
883
|
}
|
|
890
884
|
if (!1 === this.props.onDrag(e, n)) return !1;
|
|
891
885
|
this.setState(r);
|
|
892
886
|
}, this.onDragStop = (e, t) => {
|
|
893
|
-
if (!this.state.dragging || !1 === this.props.onStop(e,
|
|
887
|
+
if (!this.state.dragging || !1 === this.props.onStop(e, wt(this, t))) return !1;
|
|
894
888
|
let n = {
|
|
895
889
|
dragging: !1,
|
|
896
890
|
slackX: 0,
|
|
@@ -927,25 +921,25 @@ var Nt = class extends b.Component {
|
|
|
927
921
|
}
|
|
928
922
|
findDOMNode() {
|
|
929
923
|
if (this.props?.nodeRef) return this.props.nodeRef.current;
|
|
930
|
-
let e =
|
|
924
|
+
let e = pe;
|
|
931
925
|
return typeof e.findDOMNode == "function" ? e.findDOMNode(this) : null;
|
|
932
926
|
}
|
|
933
927
|
render() {
|
|
934
928
|
let { axis: e, bounds: t, children: n, defaultPosition: r, defaultClassName: i, defaultClassNameDragging: a, defaultClassNameDragged: o, position: s, positionOffset: c, scale: l, ...u } = this.props, d = {}, f = null, p = !s || this.state.dragging, m = s || r, h = {
|
|
935
|
-
x:
|
|
936
|
-
y:
|
|
929
|
+
x: bt(this) && p ? this.state.x : m.x,
|
|
930
|
+
y: xt(this) && p ? this.state.y : m.y
|
|
937
931
|
};
|
|
938
932
|
this.state.isElementSVG ? f = function(e, t) {
|
|
939
|
-
return
|
|
933
|
+
return ht(e, t, "");
|
|
940
934
|
}(h, c) : d = function(e, t) {
|
|
941
|
-
let n =
|
|
942
|
-
return { [
|
|
935
|
+
let n = ht(e, t, "px");
|
|
936
|
+
return { [it("transform", at)]: n };
|
|
943
937
|
}(h, c);
|
|
944
|
-
let g = b.Children.only(n), _ =
|
|
938
|
+
let g = b.Children.only(n), _ = we(g.props.className || "", i, {
|
|
945
939
|
[a]: this.state.dragging,
|
|
946
940
|
[o]: this.state.dragged
|
|
947
941
|
});
|
|
948
|
-
return b.createElement(
|
|
942
|
+
return b.createElement(kt, {
|
|
949
943
|
...u,
|
|
950
944
|
onStart: this.onDragStart,
|
|
951
945
|
onDrag: this.onDrag,
|
|
@@ -960,8 +954,8 @@ var Nt = class extends b.Component {
|
|
|
960
954
|
}));
|
|
961
955
|
}
|
|
962
956
|
};
|
|
963
|
-
|
|
964
|
-
...
|
|
957
|
+
At.displayName = "Draggable", At.propTypes = {
|
|
958
|
+
...kt.propTypes,
|
|
965
959
|
axis: z.default.oneOf([
|
|
966
960
|
"both",
|
|
967
961
|
"x",
|
|
@@ -993,11 +987,11 @@ Nt.displayName = "Draggable", Nt.propTypes = {
|
|
|
993
987
|
x: z.default.number,
|
|
994
988
|
y: z.default.number
|
|
995
989
|
}),
|
|
996
|
-
className:
|
|
997
|
-
style:
|
|
998
|
-
transform:
|
|
999
|
-
},
|
|
1000
|
-
...
|
|
990
|
+
className: nt,
|
|
991
|
+
style: nt,
|
|
992
|
+
transform: nt
|
|
993
|
+
}, At.defaultProps = {
|
|
994
|
+
...kt.defaultProps,
|
|
1001
995
|
axis: "both",
|
|
1002
996
|
bounds: !1,
|
|
1003
997
|
defaultClassName: "react-draggable",
|
|
@@ -1009,23 +1003,23 @@ Nt.displayName = "Draggable", Nt.propTypes = {
|
|
|
1009
1003
|
},
|
|
1010
1004
|
scale: 1
|
|
1011
1005
|
};
|
|
1012
|
-
var
|
|
1013
|
-
|
|
1014
|
-
var
|
|
1006
|
+
var jt = At;
|
|
1007
|
+
Xe();
|
|
1008
|
+
var Mt = {
|
|
1015
1009
|
x: 0,
|
|
1016
1010
|
y: 0
|
|
1017
|
-
},
|
|
1018
|
-
let { defaultPosition: n =
|
|
1011
|
+
}, Nt = w(C((e, t) => {
|
|
1012
|
+
let { defaultPosition: n = Mt, PaperComponent: r = u, onDragStop: i, rootSel: a = ".MuiModal-root", handleSel: o = ".draggable-title", titleSize: s, rootSize: c, ...l } = e, d = k(null), f = O(() => s?.width && s?.height && c?.width && c?.height ? {
|
|
1019
1013
|
left: 0,
|
|
1020
1014
|
top: 0,
|
|
1021
1015
|
right: c.width - s.width,
|
|
1022
1016
|
bottom: c.height - s.height
|
|
1023
|
-
} : null, [s, c]), [p, m] =
|
|
1024
|
-
return v(
|
|
1017
|
+
} : null, [s, c]), [p, m] = A(null), [h, g] = A(null), _ = p ?? n ?? null;
|
|
1018
|
+
return v(jt, {
|
|
1025
1019
|
nodeRef: d,
|
|
1026
1020
|
handle: o,
|
|
1027
1021
|
cancel: "[class*=\"MuiDialogContent-root\"]",
|
|
1028
|
-
position:
|
|
1022
|
+
position: O(() => _ && f ? {
|
|
1029
1023
|
x: Math.max(0, Math.min(_.x, f.right)),
|
|
1030
1024
|
y: Math.max(0, Math.min(_.y, f.bottom))
|
|
1031
1025
|
} : _, [_, f]) ?? void 0,
|
|
@@ -1049,37 +1043,39 @@ var Ft = {
|
|
|
1049
1043
|
});
|
|
1050
1044
|
},
|
|
1051
1045
|
children: v(r, {
|
|
1052
|
-
ref:
|
|
1046
|
+
ref: Ee([d, t]),
|
|
1053
1047
|
...l
|
|
1054
1048
|
})
|
|
1055
1049
|
});
|
|
1056
|
-
})),
|
|
1050
|
+
})), Pt = {
|
|
1057
1051
|
x: "50",
|
|
1058
1052
|
y: "50"
|
|
1059
|
-
},
|
|
1053
|
+
}, Ft = w(C((n, r) => {
|
|
1060
1054
|
let i = g({
|
|
1061
1055
|
props: n,
|
|
1062
1056
|
name: "MuiDialog"
|
|
1063
1057
|
}), a = h(), o = de(), d = {
|
|
1064
1058
|
enter: .66 * a.transitions.duration.enteringScreen,
|
|
1065
1059
|
exit: .66 * a.transitions.duration.leavingScreen
|
|
1066
|
-
}, { title: f = "SheetXL", onCancel: m, onDone: _, onShow: b, onShown: x, onHide: S, onClose: ee, open: C, autoFocusSel: w, children:
|
|
1067
|
-
|
|
1068
|
-
...
|
|
1069
|
-
...
|
|
1060
|
+
}, { title: f = "SheetXL", onCancel: m, onDone: _, onShow: b, onShown: x, onHide: S, onClose: ee, open: C, autoFocusSel: w, children: O, transitionDuration: j = d, TransitionProps: N, slots: P = F.EmptyArray, slotProps: te = F.EmptyArray, sx: I, className: ie, onMouseDown: ae, initialPosition: L = Pt, isModal: fe = !1, suspendModal: pe = !1, restoreFocus: he = !0, disableAutoDestroy: ge = !1, revealToken: _e, startHidden: ve = !1, ...ye } = i, be = P.transition ?? c, xe = P.backdrop ?? e, Se = P.paper ?? u, Ce = te.transition;
|
|
1061
|
+
N && (Ce = {
|
|
1062
|
+
...N,
|
|
1063
|
+
...Ce
|
|
1070
1064
|
});
|
|
1071
|
-
let
|
|
1072
|
-
|
|
1073
|
-
Oe
|
|
1065
|
+
let Te = te.backdrop, De = te.paper, [Oe, ke] = A(null), [Ae, Me] = A(!1), [Ne, Pe] = A(!1), Fe = k(null), [Ie, Le] = je(), Re = k(null), R = k(null), [ze, Be] = je(), Ve = k(null), Ue = E(), We = k(null);
|
|
1066
|
+
D(() => {
|
|
1067
|
+
if (!Oe || ve) return;
|
|
1068
|
+
let e = !!C;
|
|
1069
|
+
We.current !== e && (We.current = e, Me(e));
|
|
1074
1070
|
}, [
|
|
1075
1071
|
C,
|
|
1076
1072
|
Oe,
|
|
1077
1073
|
ve
|
|
1078
1074
|
]);
|
|
1079
|
-
let
|
|
1075
|
+
let Ge = se(() => {
|
|
1080
1076
|
m?.(), Me(!1);
|
|
1081
1077
|
}, [m]);
|
|
1082
|
-
|
|
1078
|
+
D(() => {
|
|
1083
1079
|
if (Oe) return;
|
|
1084
1080
|
let e = Re.current, t = Ve.current;
|
|
1085
1081
|
if (!e || !t) return;
|
|
@@ -1091,48 +1087,48 @@ var Ft = {
|
|
|
1091
1087
|
y: s
|
|
1092
1088
|
});
|
|
1093
1089
|
});
|
|
1094
|
-
let [
|
|
1095
|
-
if (
|
|
1090
|
+
let [qe, Je] = A(!1), [Ye, Xe] = A(null), [Ze, Qe] = A(null), z = se((e) => {
|
|
1091
|
+
if (Ye) return Ye.focus(e), !0;
|
|
1096
1092
|
if (w) {
|
|
1097
1093
|
let t = R.current?.querySelectorAll?.(w);
|
|
1098
1094
|
if (t && t.length > 0) return t[0]?.focus?.(e), !0;
|
|
1099
1095
|
}
|
|
1100
1096
|
return R.current?.focus?.(e), !1;
|
|
1101
|
-
}, [
|
|
1102
|
-
|
|
1103
|
-
} }), []), et =
|
|
1097
|
+
}, [Ye, w]), $e = ue(r, () => ({ focus: (e) => {
|
|
1098
|
+
z(e);
|
|
1099
|
+
} }), []), et = k(_e);
|
|
1104
1100
|
T(() => {
|
|
1105
1101
|
_e !== et.current && (et.current = _e, Me(!0));
|
|
1106
1102
|
}, [_e]);
|
|
1107
1103
|
let tt = {
|
|
1108
|
-
...
|
|
1104
|
+
...Ce,
|
|
1109
1105
|
onExited: (e) => {
|
|
1110
|
-
_?.(null), ge ||
|
|
1106
|
+
_?.(null), ge || Ce?.onExited?.(e);
|
|
1111
1107
|
},
|
|
1112
1108
|
onExit: (e) => {
|
|
1113
|
-
let t =
|
|
1109
|
+
let t = Ze, n = typeof he == "function" ? he() : he;
|
|
1114
1110
|
t && !1 !== n && requestAnimationFrame(() => {
|
|
1115
1111
|
$e.current?.contains(document.activeElement) && t.focus();
|
|
1116
|
-
}), S?.(), Pe(!1),
|
|
1112
|
+
}), S?.(), Pe(!1), Ce?.onExit?.(e);
|
|
1117
1113
|
},
|
|
1118
1114
|
onEntered: (e, t) => {
|
|
1119
|
-
b?.(),
|
|
1115
|
+
b?.(), Ce?.onEntered?.(e, t);
|
|
1120
1116
|
},
|
|
1121
1117
|
onEntering: (e, t) => {
|
|
1122
1118
|
Pe(!0), x?.($e.current);
|
|
1123
1119
|
}
|
|
1124
1120
|
};
|
|
1125
1121
|
T(() => {
|
|
1126
|
-
Ne &&
|
|
1122
|
+
Ne && z();
|
|
1127
1123
|
}, [Ne]);
|
|
1128
|
-
let
|
|
1124
|
+
let B = v(p, {
|
|
1129
1125
|
open: Ne,
|
|
1130
1126
|
disableAutoFocus: !0,
|
|
1131
|
-
disableEnforceFocus: !
|
|
1127
|
+
disableEnforceFocus: !qe,
|
|
1132
1128
|
disableRestoreFocus: !0 !== he,
|
|
1133
1129
|
children: v(be, {
|
|
1134
|
-
in:
|
|
1135
|
-
timeout:
|
|
1130
|
+
in: Ae,
|
|
1131
|
+
timeout: j,
|
|
1136
1132
|
role: "presentation",
|
|
1137
1133
|
...tt,
|
|
1138
1134
|
children: v(t, {
|
|
@@ -1144,22 +1140,22 @@ var Ft = {
|
|
|
1144
1140
|
position: "relative"
|
|
1145
1141
|
},
|
|
1146
1142
|
onKeyDown: (e) => {
|
|
1147
|
-
e.which ===
|
|
1143
|
+
e.which === re.Escape && (Ge(), Fe.current?.start(e, { center: !1 }), setTimeout(() => Fe.current?.stop(e), 180)), e.stopPropagation();
|
|
1148
1144
|
},
|
|
1149
|
-
children: y(
|
|
1150
|
-
ref:
|
|
1151
|
-
className:
|
|
1145
|
+
children: y(Nt, {
|
|
1146
|
+
ref: Ee([Ve, r]),
|
|
1147
|
+
className: we({ "Mui-focusVisible": qe }, ie, "draggable"),
|
|
1152
1148
|
sx: {
|
|
1153
|
-
"& *": (e) =>
|
|
1149
|
+
"& *": (e) => He(e),
|
|
1154
1150
|
pointerEvents: "auto",
|
|
1155
1151
|
userSelect: "none",
|
|
1156
1152
|
backgroundColor: "var(--sxl-color-elevated, var(--sxl-color-base-100))",
|
|
1157
1153
|
border: "1px solid var(--sxl-color-elevated-border, transparent)",
|
|
1158
|
-
"&:hover:not([disabled]):not(.Mui-focusVisible)": { outline: (e) => `solid ${
|
|
1159
|
-
"&.Mui-focusVisible": { outline: (e) => `solid ${
|
|
1154
|
+
"&:hover:not([disabled]):not(.Mui-focusVisible)": { outline: (e) => `solid ${M(e.palette.text?.primary, .2)} 1px` },
|
|
1155
|
+
"&.Mui-focusVisible": { outline: (e) => `solid ${M(e.palette.text?.primary, .2)} 1px` },
|
|
1160
1156
|
position: "absolute",
|
|
1161
1157
|
maxWidth: "100%",
|
|
1162
|
-
...
|
|
1158
|
+
...I
|
|
1163
1159
|
},
|
|
1164
1160
|
defaultPosition: Oe,
|
|
1165
1161
|
titleSize: Be,
|
|
@@ -1168,7 +1164,7 @@ var Ft = {
|
|
|
1168
1164
|
...ye,
|
|
1169
1165
|
...De,
|
|
1170
1166
|
children: [f ? v(s, {
|
|
1171
|
-
className:
|
|
1167
|
+
className: we({ "Mui-selected": qe }, "draggable-title"),
|
|
1172
1168
|
sx: {
|
|
1173
1169
|
cursor: "move",
|
|
1174
1170
|
display: "flex",
|
|
@@ -1182,7 +1178,7 @@ var Ft = {
|
|
|
1182
1178
|
opacity: 1,
|
|
1183
1179
|
transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
|
|
1184
1180
|
},
|
|
1185
|
-
backgroundColor: (e) =>
|
|
1181
|
+
backgroundColor: (e) => M(e.palette.action.hover, .03)
|
|
1186
1182
|
},
|
|
1187
1183
|
ref: ze,
|
|
1188
1184
|
children: y(t, {
|
|
@@ -1191,7 +1187,8 @@ var Ft = {
|
|
|
1191
1187
|
flex: "1 1 10%",
|
|
1192
1188
|
flexDirection: "row",
|
|
1193
1189
|
alignItems: "center",
|
|
1194
|
-
marginTop: (e) => e.spacing(
|
|
1190
|
+
marginTop: (e) => e.spacing(.25),
|
|
1191
|
+
marginBottom: (e) => e.spacing(.25),
|
|
1195
1192
|
marginLeft: (e) => e.spacing(1),
|
|
1196
1193
|
marginRight: (e) => e.spacing(1)
|
|
1197
1194
|
},
|
|
@@ -1201,7 +1198,7 @@ var Ft = {
|
|
|
1201
1198
|
paddingLeft: (e) => e.spacing(1)
|
|
1202
1199
|
},
|
|
1203
1200
|
children: f
|
|
1204
|
-
}), v(
|
|
1201
|
+
}), v(Ke, {
|
|
1205
1202
|
label: o("window.close"),
|
|
1206
1203
|
children: v(l, {
|
|
1207
1204
|
"aria-label": "close",
|
|
@@ -1210,34 +1207,34 @@ var Ft = {
|
|
|
1210
1207
|
onPointerDown: (e) => {
|
|
1211
1208
|
Fe.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
|
|
1212
1209
|
},
|
|
1213
|
-
onPointerUp:
|
|
1214
|
-
children: v(
|
|
1210
|
+
onPointerUp: Ge,
|
|
1211
|
+
children: v(ne, { iconKey: "Close" })
|
|
1215
1212
|
})
|
|
1216
1213
|
})]
|
|
1217
1214
|
})
|
|
1218
|
-
}) : null,
|
|
1215
|
+
}) : null, O]
|
|
1219
1216
|
})
|
|
1220
1217
|
})
|
|
1221
1218
|
})
|
|
1222
1219
|
}), nt = null;
|
|
1223
|
-
fe && !
|
|
1224
|
-
...
|
|
1225
|
-
open:
|
|
1220
|
+
fe && !pe && (nt = v(xe, {
|
|
1221
|
+
...Te,
|
|
1222
|
+
open: Ae,
|
|
1226
1223
|
onMouseDown: (e) => {
|
|
1227
|
-
|
|
1224
|
+
Ge(), Te?.onMouseDown?.(e);
|
|
1228
1225
|
},
|
|
1229
1226
|
onClick: (e) => {
|
|
1230
|
-
ee?.(e, "backdropClick"),
|
|
1227
|
+
ee?.(e, "backdropClick"), Te?.onClick?.(e);
|
|
1231
1228
|
},
|
|
1232
1229
|
sx: {
|
|
1233
1230
|
pointerEvents: "auto",
|
|
1234
|
-
...
|
|
1231
|
+
...Te?.sx
|
|
1235
1232
|
}
|
|
1236
1233
|
}));
|
|
1237
|
-
let { getPortalContainer: rt } = le(), { className: it, attrs:
|
|
1238
|
-
return
|
|
1239
|
-
className:
|
|
1240
|
-
...
|
|
1234
|
+
let { getPortalContainer: rt } = le(), { className: it, attrs: at } = oe(ce()?.themeScope);
|
|
1235
|
+
return me(y(t, {
|
|
1236
|
+
className: we("MuiModal-root", it),
|
|
1237
|
+
...at,
|
|
1241
1238
|
sx: {
|
|
1242
1239
|
position: "fixed",
|
|
1243
1240
|
zIndex: "1300",
|
|
@@ -1249,81 +1246,81 @@ var Ft = {
|
|
|
1249
1246
|
display: "block",
|
|
1250
1247
|
pointerEvents: "none"
|
|
1251
1248
|
},
|
|
1252
|
-
ref:
|
|
1249
|
+
ref: Ee([
|
|
1253
1250
|
$e,
|
|
1254
1251
|
Ie,
|
|
1255
1252
|
Re
|
|
1256
1253
|
]),
|
|
1257
1254
|
onPointerDown: (e) => {
|
|
1258
|
-
|
|
1255
|
+
qe && (e.target === R.current || e.target.tabIndex < 0) && R.current?.contains(document.activeElement);
|
|
1259
1256
|
},
|
|
1260
1257
|
onContextMenu: (e) => {
|
|
1261
1258
|
e.isPropagationStopped() || e.preventDefault();
|
|
1262
1259
|
},
|
|
1263
1260
|
onFocus: (e) => {
|
|
1264
|
-
!
|
|
1265
|
-
|
|
1266
|
-
}, 100),
|
|
1261
|
+
!qe && (e.target === R.current || e.target.tabIndex < 0) && setTimeout(() => {
|
|
1262
|
+
z();
|
|
1263
|
+
}, 100), Je(!0), R.current?.contains(e.target) && e.target !== R.current && Xe(e.target), e.relatedTarget && !Ze && Qe(e.relatedTarget);
|
|
1267
1264
|
},
|
|
1268
1265
|
onBlur: (e) => {
|
|
1269
|
-
$e?.current?.contains(e.relatedTarget) || (
|
|
1266
|
+
$e?.current?.contains(e.relatedTarget) || (Qe(null), Je(!1));
|
|
1270
1267
|
},
|
|
1271
|
-
children: [nt,
|
|
1272
|
-
}), rt(),
|
|
1268
|
+
children: [nt, B]
|
|
1269
|
+
}), rt(), Ue);
|
|
1273
1270
|
})), V = typeof window < "u" ? window : {
|
|
1274
1271
|
screen: {},
|
|
1275
1272
|
navigator: {}
|
|
1276
|
-
},
|
|
1273
|
+
}, It = (V.matchMedia || function() {
|
|
1277
1274
|
return { matches: !1 };
|
|
1278
|
-
}).bind(V),
|
|
1275
|
+
}).bind(V), Lt = { get passive() {
|
|
1279
1276
|
return !0;
|
|
1280
|
-
} },
|
|
1281
|
-
V.addEventListener && V.addEventListener("p",
|
|
1282
|
-
var
|
|
1277
|
+
} }, Rt = function() {};
|
|
1278
|
+
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) => {
|
|
1283
1280
|
let t = e.constructor && e.constructor.prototype;
|
|
1284
1281
|
return U(t) && t.hasOwnProperty("isPrototypeOf");
|
|
1285
|
-
},
|
|
1282
|
+
}, $t = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
1286
1283
|
function W(e) {
|
|
1287
1284
|
if (e instanceof Date) return new Date(e);
|
|
1288
1285
|
let t = typeof FileList < "u" && e instanceof FileList;
|
|
1289
|
-
if (
|
|
1286
|
+
if ($t && (e instanceof Blob || t)) return e;
|
|
1290
1287
|
let n = Array.isArray(e);
|
|
1291
|
-
if (!(n || U(e) &&
|
|
1288
|
+
if (!(n || U(e) && Qt(e))) return e;
|
|
1292
1289
|
let r = n ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1293
1290
|
for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = W(e[t]));
|
|
1294
1291
|
return r;
|
|
1295
1292
|
}
|
|
1296
|
-
var
|
|
1293
|
+
var en = "blur", tn = "focusout", nn = "submit", rn = "trigger", an = "valid", on = "onBlur", sn = "onChange", cn = "onSubmit", ln = "onTouched", un = "all", dn = "max", fn = "min", pn = "maxLength", mn = "minLength", hn = "pattern", gn = "required", _n = "validate", vn = "root", yn = [
|
|
1297
1294
|
"__proto__",
|
|
1298
1295
|
"constructor",
|
|
1299
1296
|
"prototype"
|
|
1300
|
-
],
|
|
1297
|
+
], bn = /^\w*$/, xn = (e) => bn.test(e), G = (e) => e === void 0, Sn = /[.[\]'"]/, Cn = (e) => e.split(Sn).filter(Boolean), K = (e, t, n) => {
|
|
1301
1298
|
if (!t || !U(e)) return n;
|
|
1302
|
-
let r =
|
|
1303
|
-
if (r.some((e) =>
|
|
1299
|
+
let r = xn(t) ? [t] : Cn(t);
|
|
1300
|
+
if (r.some((e) => yn.includes(e))) return n;
|
|
1304
1301
|
let i = r.reduce((e, t) => H(e) ? void 0 : e[t], e);
|
|
1305
1302
|
return G(i) || i === e ? G(e[t]) ? n : e[t] : i;
|
|
1306
1303
|
}, q = (e) => typeof e == "boolean", J = (e) => typeof e == "function", Y = (e, t, n) => {
|
|
1307
|
-
let r = -1, i =
|
|
1304
|
+
let r = -1, i = xn(t) ? [t] : Cn(t), a = i.length, o = a - 1;
|
|
1308
1305
|
for (; ++r < a;) {
|
|
1309
1306
|
let t = i[r], a = n;
|
|
1310
1307
|
if (r !== o) {
|
|
1311
1308
|
let n = e[t];
|
|
1312
1309
|
a = U(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
|
|
1313
1310
|
}
|
|
1314
|
-
if (
|
|
1311
|
+
if (yn.includes(t)) return;
|
|
1315
1312
|
e[t] = a, e = e[t];
|
|
1316
1313
|
}
|
|
1317
|
-
},
|
|
1318
|
-
|
|
1319
|
-
var
|
|
1314
|
+
}, wn = x.createContext(null);
|
|
1315
|
+
wn.displayName = "HookFormControlContext";
|
|
1316
|
+
var Tn = $t ? x.useLayoutEffect : x.useEffect, X = (e) => typeof e == "string", En = (e) => H(e) || !Zt(e), Dn = (e, t) => t.length === 0 && !Array.isArray(e) && !Qt(e);
|
|
1320
1317
|
function Z(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
1321
1318
|
if (e === t) return !0;
|
|
1322
|
-
if (
|
|
1323
|
-
if (
|
|
1319
|
+
if (En(e) || En(t)) return Object.is(e, t);
|
|
1320
|
+
if (Xt(e) && Xt(t)) return Object.is(e.getTime(), t.getTime());
|
|
1324
1321
|
let r = Object.keys(e), i = Object.keys(t);
|
|
1325
1322
|
if (r.length !== i.length) return !1;
|
|
1326
|
-
if (
|
|
1323
|
+
if (Dn(e, r) || Dn(t, i)) return Object.is(e, t);
|
|
1327
1324
|
if (!r.length && Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
1328
1325
|
let a = n.get(e);
|
|
1329
1326
|
if (a && a.has(t)) return !0;
|
|
@@ -1337,53 +1334,53 @@ function Z(e, t, n = /* @__PURE__ */ new WeakMap()) {
|
|
|
1337
1334
|
if (!(i in t)) return !1;
|
|
1338
1335
|
if (i !== "ref") {
|
|
1339
1336
|
let e = t[i];
|
|
1340
|
-
if (
|
|
1337
|
+
if (Xt(r) && Xt(e) || (U(r) || Array.isArray(r)) && (U(e) || Array.isArray(e)) ? !Z(r, e, n) : !Object.is(r, e)) return !1;
|
|
1341
1338
|
}
|
|
1342
1339
|
}
|
|
1343
1340
|
return !0;
|
|
1344
1341
|
}
|
|
1345
|
-
var
|
|
1346
|
-
isOnSubmit: !e || e ===
|
|
1347
|
-
isOnBlur: e ===
|
|
1348
|
-
isOnChange: e ===
|
|
1349
|
-
isOnAll: e ===
|
|
1350
|
-
isOnTouch: e ===
|
|
1351
|
-
}),
|
|
1342
|
+
var On = (e) => ({
|
|
1343
|
+
isOnSubmit: !e || e === cn,
|
|
1344
|
+
isOnBlur: e === on,
|
|
1345
|
+
isOnChange: e === sn,
|
|
1346
|
+
isOnAll: e === un,
|
|
1347
|
+
isOnTouch: e === ln
|
|
1348
|
+
}), kn = (e, t, n) => {
|
|
1352
1349
|
if (n) return !1;
|
|
1353
1350
|
if (t.watchAll || t.watch.has(e)) return !0;
|
|
1354
1351
|
for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
|
|
1355
1352
|
return !1;
|
|
1356
|
-
},
|
|
1353
|
+
}, An = (e, t, n, r) => {
|
|
1357
1354
|
for (let i of n || Object.keys(e)) {
|
|
1358
1355
|
let n = K(e, i);
|
|
1359
1356
|
if (n) {
|
|
1360
1357
|
let { _f: e, ...a } = n;
|
|
1361
1358
|
if (e) {
|
|
1362
1359
|
if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
|
|
1363
|
-
if (
|
|
1364
|
-
} else if (U(a) &&
|
|
1360
|
+
if (An(a, t)) break;
|
|
1361
|
+
} else if (U(a) && An(a, t)) break;
|
|
1365
1362
|
}
|
|
1366
1363
|
}
|
|
1367
|
-
},
|
|
1364
|
+
}, jn = (e, t, n) => {
|
|
1368
1365
|
let r = K(e, n), i = Array.isArray(r) ? r : [];
|
|
1369
|
-
return Y(i,
|
|
1370
|
-
}, Q = (e) => U(e) && !Object.keys(e).length,
|
|
1371
|
-
if (
|
|
1366
|
+
return Y(i, vn, t[n]), Y(e, n, i), e;
|
|
1367
|
+
}, Q = (e) => U(e) && !Object.keys(e).length, Mn = (e) => {
|
|
1368
|
+
if (!$t) return !1;
|
|
1372
1369
|
let t = e ? e.ownerDocument : 0;
|
|
1373
1370
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
1374
|
-
},
|
|
1371
|
+
}, Nn = (e) => e.type === "radio", Pn = (e) => e instanceof RegExp, Fn = (e, t, n, r, i) => t ? {
|
|
1375
1372
|
...n[e],
|
|
1376
1373
|
types: {
|
|
1377
1374
|
...n[e] && n[e].types ? n[e].types : {},
|
|
1378
1375
|
[r]: i || !0
|
|
1379
1376
|
}
|
|
1380
|
-
} : {},
|
|
1377
|
+
} : {}, In = {
|
|
1381
1378
|
value: !1,
|
|
1382
1379
|
isValid: !1
|
|
1383
|
-
},
|
|
1380
|
+
}, Ln = {
|
|
1384
1381
|
value: !0,
|
|
1385
1382
|
isValid: !0
|
|
1386
|
-
},
|
|
1383
|
+
}, Rn = (e) => {
|
|
1387
1384
|
if (Array.isArray(e)) {
|
|
1388
1385
|
if (e.length > 1) {
|
|
1389
1386
|
let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
|
|
@@ -1392,30 +1389,30 @@ var jn = (e) => ({
|
|
|
1392
1389
|
isValid: !!t.length
|
|
1393
1390
|
};
|
|
1394
1391
|
}
|
|
1395
|
-
return e[0].checked && !e[0].disabled ? e[0].attributes && !G(e[0].attributes.value) ? G(e[0].value) || e[0].value === "" ?
|
|
1392
|
+
return e[0].checked && !e[0].disabled ? e[0].attributes && !G(e[0].attributes.value) ? G(e[0].value) || e[0].value === "" ? Ln : {
|
|
1396
1393
|
value: e[0].value,
|
|
1397
1394
|
isValid: !0
|
|
1398
|
-
} :
|
|
1395
|
+
} : Ln : In;
|
|
1399
1396
|
}
|
|
1400
|
-
return
|
|
1401
|
-
},
|
|
1397
|
+
return In;
|
|
1398
|
+
}, zn = {
|
|
1402
1399
|
isValid: !1,
|
|
1403
1400
|
value: null
|
|
1404
|
-
},
|
|
1401
|
+
}, Bn = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
|
|
1405
1402
|
isValid: !0,
|
|
1406
1403
|
value: t.value
|
|
1407
|
-
} : e,
|
|
1408
|
-
function
|
|
1404
|
+
} : e, zn) : zn;
|
|
1405
|
+
function Vn(e, t, n = "validate") {
|
|
1409
1406
|
if (X(e) || Array.isArray(e) && e.every(X) || q(e) && !e) return {
|
|
1410
1407
|
type: n,
|
|
1411
1408
|
message: X(e) ? e : "",
|
|
1412
1409
|
ref: t
|
|
1413
1410
|
};
|
|
1414
1411
|
}
|
|
1415
|
-
var
|
|
1412
|
+
var Hn = (e) => U(e) && !Pn(e) ? e : {
|
|
1416
1413
|
value: e,
|
|
1417
1414
|
message: ""
|
|
1418
|
-
},
|
|
1415
|
+
}, Un = async (e, t, n, r, i, a) => {
|
|
1419
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, v = K(n, h);
|
|
1420
1417
|
if (!_ || t.has(h)) return {};
|
|
1421
1418
|
let y = s ? s[0] : o, b = (e) => {
|
|
@@ -1423,7 +1420,7 @@ var Gn = (e) => U(e) && !Ln(e) ? e : {
|
|
|
1423
1420
|
let t = q(e) ? "" : e || "";
|
|
1424
1421
|
s ? s.forEach((e) => e.setCustomValidity(t)) : y.setCustomValidity(t), y.reportValidity();
|
|
1425
1422
|
}
|
|
1426
|
-
}, x = {}, S =
|
|
1423
|
+
}, x = {}, S = Nn(o), ee = Jt(o), C = S || ee, w = (g || Yt(o)) && G(o.value) && G(v) || Mn(o) && o.value === "" || v === "" || Array.isArray(v) && !v.length, T = Fn.bind(null, h, r, x), E = (e, t, n, r = pn, i = mn) => {
|
|
1427
1424
|
let a = e ? t : n;
|
|
1428
1425
|
x[h] = {
|
|
1429
1426
|
type: e ? r : i,
|
|
@@ -1432,20 +1429,20 @@ var Gn = (e) => U(e) && !Ln(e) ? e : {
|
|
|
1432
1429
|
...T(e ? r : i, a)
|
|
1433
1430
|
};
|
|
1434
1431
|
};
|
|
1435
|
-
if (a ? !Array.isArray(v) || !v.length : c && (!C && (w || H(v)) || q(v) && !v || ee && !
|
|
1432
|
+
if (a ? !Array.isArray(v) || !v.length : c && (!C && (w || H(v)) || q(v) && !v || ee && !Rn(s).isValid || S && !Bn(s).isValid)) {
|
|
1436
1433
|
let { value: e, message: t } = X(c) ? {
|
|
1437
1434
|
value: !!c,
|
|
1438
1435
|
message: c
|
|
1439
|
-
} :
|
|
1436
|
+
} : Hn(c);
|
|
1440
1437
|
if (e && (x[h] = {
|
|
1441
|
-
type:
|
|
1438
|
+
type: gn,
|
|
1442
1439
|
message: t,
|
|
1443
1440
|
ref: y,
|
|
1444
|
-
...T(
|
|
1441
|
+
...T(gn, t)
|
|
1445
1442
|
}, !r)) return b(t), x;
|
|
1446
1443
|
}
|
|
1447
1444
|
if (!(w || H(d) && H(f))) {
|
|
1448
|
-
let e, t, n =
|
|
1445
|
+
let e, t, n = Hn(f), i = Hn(d);
|
|
1449
1446
|
if (H(v) || isNaN(v)) {
|
|
1450
1447
|
let r = o.valueAsDate || new Date(v), a = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), s = o.type == "time", c = o.type == "week";
|
|
1451
1448
|
X(n.value) && v && (e = s ? a(v) > a(n.value) : c ? v > n.value : r > new Date(n.value)), X(i.value) && v && (t = s ? a(v) < a(i.value) : c ? v < i.value : r < new Date(i.value));
|
|
@@ -1453,33 +1450,33 @@ var Gn = (e) => U(e) && !Ln(e) ? e : {
|
|
|
1453
1450
|
let r = o.valueAsNumber || v && +v;
|
|
1454
1451
|
H(n.value) || (e = r > n.value), H(i.value) || (t = r < i.value);
|
|
1455
1452
|
}
|
|
1456
|
-
if ((e || t) && (
|
|
1453
|
+
if ((e || t) && (E(!!e, n.message, i.message, dn, fn), !r)) return b(x[h].message), x;
|
|
1457
1454
|
}
|
|
1458
1455
|
if ((l || u) && !w && (X(v) || a && Array.isArray(v))) {
|
|
1459
|
-
let e =
|
|
1460
|
-
if ((n || i) && (
|
|
1456
|
+
let e = Hn(l), t = Hn(u), n = !H(e.value) && v.length > +e.value, i = !H(t.value) && v.length < +t.value;
|
|
1457
|
+
if ((n || i) && (E(n, e.message, t.message), !r)) return b(x[h].message), x;
|
|
1461
1458
|
}
|
|
1462
1459
|
if (p && !w && X(v)) {
|
|
1463
|
-
let { value: e, message: t } =
|
|
1464
|
-
if (
|
|
1465
|
-
type:
|
|
1460
|
+
let { value: e, message: t } = Hn(p);
|
|
1461
|
+
if (Pn(e) && !v.match(e) && (x[h] = {
|
|
1462
|
+
type: hn,
|
|
1466
1463
|
message: t,
|
|
1467
1464
|
ref: o,
|
|
1468
|
-
...T(
|
|
1465
|
+
...T(hn, t)
|
|
1469
1466
|
}, !r)) return b(t), x;
|
|
1470
1467
|
}
|
|
1471
1468
|
if (m) {
|
|
1472
1469
|
if (J(m)) {
|
|
1473
|
-
let e =
|
|
1470
|
+
let e = Vn(await m(v, n), y);
|
|
1474
1471
|
if (e && (x[h] = {
|
|
1475
1472
|
...e,
|
|
1476
|
-
...T(
|
|
1473
|
+
...T(_n, e.message)
|
|
1477
1474
|
}, !r)) return b(e.message), x;
|
|
1478
1475
|
} else if (U(m)) {
|
|
1479
1476
|
let e = {};
|
|
1480
1477
|
for (let t in m) {
|
|
1481
1478
|
if (!Q(e) && !r) break;
|
|
1482
|
-
let i =
|
|
1479
|
+
let i = Vn(await m[t](v, n), y, t);
|
|
1483
1480
|
i && (e = {
|
|
1484
1481
|
...i,
|
|
1485
1482
|
...T(t, i.message)
|
|
@@ -1492,11 +1489,11 @@ var Gn = (e) => U(e) && !Ln(e) ? e : {
|
|
|
1492
1489
|
}
|
|
1493
1490
|
}
|
|
1494
1491
|
return b(!0), x;
|
|
1495
|
-
},
|
|
1492
|
+
}, Wn = (e) => Array.isArray(e) ? e : [e], Gn = (e) => Array.isArray(e) ? e.filter(Boolean) : [];
|
|
1496
1493
|
function $(e, t) {
|
|
1497
1494
|
if (X(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
|
|
1498
|
-
let n = Array.isArray(t) ? t :
|
|
1499
|
-
if (n.some((e) =>
|
|
1495
|
+
let n = Array.isArray(t) ? t : xn(t) ? [t] : Cn(t);
|
|
1496
|
+
if (n.some((e) => yn.includes(String(e)))) return e;
|
|
1500
1497
|
let r = n.length === 1 ? e : function(e, t) {
|
|
1501
1498
|
let n = t.slice(0, -1).length, r = 0;
|
|
1502
1499
|
for (; r < n;) {
|
|
@@ -1513,16 +1510,16 @@ function $(e, t) {
|
|
|
1513
1510
|
return !0;
|
|
1514
1511
|
}(r)) && $(e, n.slice(0, -1)), e;
|
|
1515
1512
|
}
|
|
1516
|
-
var
|
|
1513
|
+
var Kn = (e) => {
|
|
1517
1514
|
let t = {};
|
|
1518
|
-
for (let n of Object.keys(e)) if (
|
|
1519
|
-
let r =
|
|
1515
|
+
for (let n of Object.keys(e)) if (Zt(e[n]) && e[n] !== null && !Xt(e[n])) {
|
|
1516
|
+
let r = Kn(e[n]);
|
|
1520
1517
|
for (let e of Object.keys(r)) t[`${n}.${e}`] = r[e];
|
|
1521
1518
|
} else t[n] = e[n];
|
|
1522
1519
|
return t;
|
|
1523
|
-
},
|
|
1524
|
-
|
|
1525
|
-
var
|
|
1520
|
+
}, qn = x.createContext(null);
|
|
1521
|
+
qn.displayName = "HookFormContext";
|
|
1522
|
+
var Jn = ({ children: e, watch: t, getValues: n, getFieldState: r, setError: i, clearErrors: a, setValue: o, setValues: s, trigger: c, formState: l, resetField: u, reset: d, resetDefaultValues: f, handleSubmit: p, unregister: m, control: h, register: g, setFocus: _, subscribe: v }) => {
|
|
1526
1523
|
let y = x.useMemo(() => ({
|
|
1527
1524
|
watch: t,
|
|
1528
1525
|
getValues: n,
|
|
@@ -1562,8 +1559,8 @@ var Zn = ({ children: e, watch: t, getValues: n, getFieldState: r, setError: i,
|
|
|
1562
1559
|
m,
|
|
1563
1560
|
t
|
|
1564
1561
|
]);
|
|
1565
|
-
return x.createElement(
|
|
1566
|
-
},
|
|
1562
|
+
return x.createElement(qn.Provider, { value: y }, x.createElement(wn.Provider, { value: y.control }, e));
|
|
1563
|
+
}, Yn = () => {
|
|
1567
1564
|
let e = [];
|
|
1568
1565
|
return {
|
|
1569
1566
|
get observers() {
|
|
@@ -1580,64 +1577,64 @@ var Zn = ({ children: e, watch: t, getValues: n, getFieldState: r, setError: i,
|
|
|
1580
1577
|
}
|
|
1581
1578
|
};
|
|
1582
1579
|
};
|
|
1583
|
-
function
|
|
1580
|
+
function Xn(e, t) {
|
|
1584
1581
|
let n = {};
|
|
1585
1582
|
for (let r in e) if (e.hasOwnProperty(r)) {
|
|
1586
1583
|
let i = e[r], a = t[r];
|
|
1587
1584
|
if (i && U(i) && a) {
|
|
1588
|
-
let e =
|
|
1585
|
+
let e = Xn(i, a);
|
|
1589
1586
|
U(e) && (n[r] = e);
|
|
1590
1587
|
} else e[r] && (n[r] = a);
|
|
1591
1588
|
}
|
|
1592
1589
|
return n;
|
|
1593
1590
|
}
|
|
1594
|
-
var
|
|
1595
|
-
function
|
|
1591
|
+
var Zn = (e) => e.type === "select-multiple", Qn = (e) => Mn(e) && e.isConnected;
|
|
1592
|
+
function $n(e) {
|
|
1596
1593
|
return Array.isArray(e) || U(e) && !((e) => {
|
|
1597
1594
|
for (let t in e) if (J(e[t])) return !0;
|
|
1598
1595
|
return !1;
|
|
1599
1596
|
})(e);
|
|
1600
1597
|
}
|
|
1601
|
-
function
|
|
1598
|
+
function er(e) {
|
|
1602
1599
|
return !(!e || !("_f" in e));
|
|
1603
1600
|
}
|
|
1604
|
-
function
|
|
1601
|
+
function tr(e) {
|
|
1605
1602
|
return Array.isArray(e) ? !e.some((e) => !G(e)) : !Object.keys(e).length;
|
|
1606
1603
|
}
|
|
1607
|
-
function
|
|
1604
|
+
function nr(e, t) {
|
|
1608
1605
|
Array.isArray(e) ? e[t] = void 0 : delete e[t];
|
|
1609
1606
|
}
|
|
1610
|
-
function
|
|
1607
|
+
function rr(e, t = {}, n) {
|
|
1611
1608
|
for (let r in e) {
|
|
1612
1609
|
let i = e[r], a = n && n[r];
|
|
1613
|
-
|
|
1610
|
+
!$n(i) || Array.isArray(i) && er(a) ? G(i) || (t[r] = !0) : (t[r] = Array.isArray(i) ? [] : {}, rr(i, t[r], a), tr(t[r]) && nr(t, r));
|
|
1614
1611
|
}
|
|
1615
1612
|
return t;
|
|
1616
1613
|
}
|
|
1617
|
-
function
|
|
1618
|
-
n ||=
|
|
1614
|
+
function ir(e, t, n, r) {
|
|
1615
|
+
n ||= rr(t, {}, r);
|
|
1619
1616
|
for (let i in e) {
|
|
1620
1617
|
let a = e[i], o = r && r[i];
|
|
1621
|
-
|
|
1618
|
+
!$n(a) || Array.isArray(a) && er(o) ? Z(a, t[i]) ? nr(n, i) : n[i] = !0 : (G(t) || En(n[i]) ? n[i] = rr(a, Array.isArray(a) ? [] : {}, o) : ir(a, H(t) ? {} : t[i], n[i], o), tr(n[i]) && nr(n, i));
|
|
1622
1619
|
}
|
|
1623
1620
|
return n;
|
|
1624
1621
|
}
|
|
1625
|
-
var
|
|
1626
|
-
function
|
|
1622
|
+
var ar = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => G(e) ? e : t ? e === "" ? NaN : e && +e : n && X(e) ? new Date(e) : r ? r(e) : e;
|
|
1623
|
+
function or(e) {
|
|
1627
1624
|
let t = e.ref;
|
|
1628
|
-
return
|
|
1625
|
+
return Yt(t) ? t.files : Nn(t) ? Bn(e.refs).value : Zn(t) ? [...t.selectedOptions].map(({ value: e }) => e) : Jt(t) ? Rn(e.refs).value : ar(G(t.value) ? e.ref.value : t.value, e);
|
|
1629
1626
|
}
|
|
1630
|
-
var
|
|
1627
|
+
var sr = (e) => G(e) ? e : Pn(e) ? e.source : U(e) ? Pn(e.value) ? e.value.source : e.value : e, cr = "AsyncFunction", lr = (e) => {
|
|
1631
1628
|
if (!e || !e.validate) return !1;
|
|
1632
|
-
if (J(e.validate)) return e.validate.constructor.name ===
|
|
1629
|
+
if (J(e.validate)) return e.validate.constructor.name === cr;
|
|
1633
1630
|
if (U(e.validate)) {
|
|
1634
|
-
for (let t in e.validate) if (e.validate[t].constructor.name ===
|
|
1631
|
+
for (let t in e.validate) if (e.validate[t].constructor.name === cr) return !0;
|
|
1635
1632
|
}
|
|
1636
1633
|
return !1;
|
|
1637
1634
|
};
|
|
1638
|
-
function
|
|
1635
|
+
function ur(e, t, n) {
|
|
1639
1636
|
let r = K(e, n);
|
|
1640
|
-
if (r ||
|
|
1637
|
+
if (r || xn(n)) return {
|
|
1641
1638
|
error: r,
|
|
1642
1639
|
name: n
|
|
1643
1640
|
};
|
|
@@ -1657,11 +1654,11 @@ function pr(e, t, n) {
|
|
|
1657
1654
|
}
|
|
1658
1655
|
return { name: n };
|
|
1659
1656
|
}
|
|
1660
|
-
var
|
|
1661
|
-
mode:
|
|
1662
|
-
reValidateMode:
|
|
1657
|
+
var dr = {
|
|
1658
|
+
mode: cn,
|
|
1659
|
+
reValidateMode: sn,
|
|
1663
1660
|
shouldFocusError: !0
|
|
1664
|
-
},
|
|
1661
|
+
}, fr = "form", pr = {
|
|
1665
1662
|
submitCount: 0,
|
|
1666
1663
|
isDirty: !1,
|
|
1667
1664
|
isReady: !1,
|
|
@@ -1674,12 +1671,12 @@ var mr = {
|
|
|
1674
1671
|
dirtyFields: {},
|
|
1675
1672
|
validatingFields: {}
|
|
1676
1673
|
};
|
|
1677
|
-
function
|
|
1674
|
+
function mr(e = {}) {
|
|
1678
1675
|
let t = {
|
|
1679
|
-
...
|
|
1676
|
+
...dr,
|
|
1680
1677
|
...e
|
|
1681
1678
|
}, n = {
|
|
1682
|
-
...W(
|
|
1679
|
+
...W(pr),
|
|
1683
1680
|
isLoading: J(t.defaultValues),
|
|
1684
1681
|
errors: t.errors || {},
|
|
1685
1682
|
disabled: t.disabled || !1
|
|
@@ -1695,7 +1692,7 @@ function _r(e = {}) {
|
|
|
1695
1692
|
array: /* @__PURE__ */ new Set(),
|
|
1696
1693
|
watch: /* @__PURE__ */ new Set(),
|
|
1697
1694
|
registerName: /* @__PURE__ */ new Set()
|
|
1698
|
-
}, c = {}, l = {}, u = 0, d =
|
|
1695
|
+
}, c = {}, l = {}, u = 0, d = On(t.mode), f = On(t.reValidateMode), p = {
|
|
1699
1696
|
isDirty: !1,
|
|
1700
1697
|
dirtyFields: !1,
|
|
1701
1698
|
validatingFields: !1,
|
|
@@ -1704,17 +1701,17 @@ function _r(e = {}) {
|
|
|
1704
1701
|
isValid: !1,
|
|
1705
1702
|
errors: !1
|
|
1706
1703
|
}, m = { ...p }, h = { ...m }, g = {
|
|
1707
|
-
array:
|
|
1708
|
-
state:
|
|
1709
|
-
}, _ = 0, v = t.criteriaMode ===
|
|
1704
|
+
array: Yn(),
|
|
1705
|
+
state: Yn()
|
|
1706
|
+
}, _ = 0, v = t.criteriaMode === un, y = (e, t) => (n) => {
|
|
1710
1707
|
clearTimeout(l[e]), l[e] = setTimeout(t, n);
|
|
1711
1708
|
}, b = async (e) => {
|
|
1712
1709
|
if (!o.keepIsValid && !t.disabled && (m.isValid || h.isValid || e)) {
|
|
1713
1710
|
let e = ++_, i;
|
|
1714
|
-
t.resolver ? (i = Q((await T()).errors), e === _ && x()) : i = await
|
|
1711
|
+
t.resolver ? (i = Q((await T()).errors), e === _ && x()) : i = await D({
|
|
1715
1712
|
fields: r,
|
|
1716
1713
|
onlyCheckValid: !0,
|
|
1717
|
-
eventType:
|
|
1714
|
+
eventType: an
|
|
1718
1715
|
}), e === _ && i !== n.isValid && g.state.next({ isValid: i });
|
|
1719
1716
|
}
|
|
1720
1717
|
}, x = (e, r) => {
|
|
@@ -1725,14 +1722,14 @@ function _r(e = {}) {
|
|
|
1725
1722
|
isValidating: !Q(n.validatingFields)
|
|
1726
1723
|
}));
|
|
1727
1724
|
}, S = () => {
|
|
1728
|
-
n.dirtyFields =
|
|
1725
|
+
n.dirtyFields = ir(i, a, void 0, r);
|
|
1729
1726
|
}, ee = (e, t) => {
|
|
1730
1727
|
Y(n.errors, e, t), n.errors = { ...n.errors }, g.state.next({ errors: n.errors });
|
|
1731
1728
|
}, C = (t, c, l, u) => {
|
|
1732
1729
|
let d = K(r, t);
|
|
1733
1730
|
if (d) {
|
|
1734
1731
|
if (((e) => {
|
|
1735
|
-
let t =
|
|
1732
|
+
let t = xn(e) ? [e] : Cn(e), n = a, r = i;
|
|
1736
1733
|
for (let e = 0; e < t.length - 1; e++) {
|
|
1737
1734
|
let i = t[e];
|
|
1738
1735
|
if (n = H(n) ? n : n[i], r = H(r) ? r : r[i], n === null && r !== null) return !0;
|
|
@@ -1740,17 +1737,17 @@ function _r(e = {}) {
|
|
|
1740
1737
|
return !1;
|
|
1741
1738
|
})(t)) return;
|
|
1742
1739
|
let r = G(K(a, t)), f = K(a, t, G(l) ? K(i, t) : l);
|
|
1743
|
-
G(f) || u && u.defaultChecked || c ? Y(a, t, c ? f :
|
|
1740
|
+
G(f) || u && u.defaultChecked || c ? Y(a, t, c ? f : or(d._f)) : A(t, f), o.mount && !o.action && (b(), r && n.isDirty && (m.isDirty || h.isDirty) && (O() || (n.isDirty = !1, g.state.next({ ...n }))), e.shouldUnregister && r && !G(K(a, t)) && kn(t, s) && (o.watch = !0));
|
|
1744
1741
|
}
|
|
1745
1742
|
}, w = (e, o, s, c, l) => {
|
|
1746
1743
|
let u = !1, d = !1, f = { name: e };
|
|
1747
1744
|
if (!t.disabled || !0 === c) {
|
|
1748
1745
|
if (!s || c) {
|
|
1749
1746
|
let t = Z(K(i, e), o);
|
|
1750
|
-
(m.isDirty || h.isDirty) && (d = n.isDirty, n.isDirty = f.isDirty = !t ||
|
|
1747
|
+
(m.isDirty || h.isDirty) && (d = n.isDirty, n.isDirty = f.isDirty = !t || O(), u = d !== f.isDirty), d = !!K(n.dirtyFields, e), t === n.isDirty ? t ? $(n.dirtyFields, e) : Y(n.dirtyFields, e, !0) : ((e, t) => {
|
|
1751
1748
|
for (let n in e) n in t || delete e[n];
|
|
1752
1749
|
Object.assign(e, t);
|
|
1753
|
-
})(n.dirtyFields,
|
|
1750
|
+
})(n.dirtyFields, ir(i, a, void 0, r)), f.dirtyFields = n.dirtyFields, u ||= (m.dirtyFields || h.dirtyFields) && d !== !t;
|
|
1754
1751
|
}
|
|
1755
1752
|
if (s) {
|
|
1756
1753
|
let t = K(n.touchedFields, e);
|
|
@@ -1771,7 +1768,7 @@ function _r(e = {}) {
|
|
|
1771
1768
|
fields: i,
|
|
1772
1769
|
shouldUseNativeValidation: r
|
|
1773
1770
|
};
|
|
1774
|
-
})(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))),
|
|
1771
|
+
})(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))), E = async ({ name: t, eventType: r }) => {
|
|
1775
1772
|
if (e.validate) {
|
|
1776
1773
|
let i = await e.validate({
|
|
1777
1774
|
formValues: a,
|
|
@@ -1781,23 +1778,23 @@ function _r(e = {}) {
|
|
|
1781
1778
|
});
|
|
1782
1779
|
if (U(i)) for (let e in i) {
|
|
1783
1780
|
let t = i[e];
|
|
1784
|
-
t &&
|
|
1781
|
+
t && I(`${fr}.${e}`, {
|
|
1785
1782
|
message: X(t.message) ? t.message : "",
|
|
1786
|
-
type: t.type ||
|
|
1783
|
+
type: t.type || _n
|
|
1787
1784
|
});
|
|
1788
1785
|
}
|
|
1789
|
-
else X(i) || !i ?
|
|
1786
|
+
else X(i) || !i ? I(fr, {
|
|
1790
1787
|
message: i || "",
|
|
1791
|
-
type:
|
|
1792
|
-
}) :
|
|
1788
|
+
type: _n
|
|
1789
|
+
}) : re(fr);
|
|
1793
1790
|
return i;
|
|
1794
1791
|
}
|
|
1795
1792
|
return !0;
|
|
1796
|
-
},
|
|
1793
|
+
}, D = async ({ fields: r, onlyCheckValid: i, name: o, eventType: c, context: l = {
|
|
1797
1794
|
valid: !0,
|
|
1798
1795
|
runRootValidation: !1
|
|
1799
1796
|
} }) => {
|
|
1800
|
-
if (e.validate && (l.runRootValidation = !0, !await
|
|
1797
|
+
if (e.validate && (l.runRootValidation = !0, !await E({
|
|
1801
1798
|
name: o,
|
|
1802
1799
|
eventType: c
|
|
1803
1800
|
}) && (l.valid = !1, i))) return l.valid;
|
|
@@ -1806,12 +1803,12 @@ function _r(e = {}) {
|
|
|
1806
1803
|
if (u) {
|
|
1807
1804
|
let { _f: r, ...d } = u;
|
|
1808
1805
|
if (r) {
|
|
1809
|
-
let o = s.array.has(r.name), c = u._f &&
|
|
1806
|
+
let o = s.array.has(r.name), c = u._f && lr(u._f), d = m.validatingFields || m.isValidating || h.validatingFields || h.isValidating;
|
|
1810
1807
|
c && d && x([r.name], !0);
|
|
1811
|
-
let f = await
|
|
1812
|
-
if (c && d && x([r.name]), f[r.name] && (l.valid = !1, i) || (!i && (K(f, r.name) ? o ?
|
|
1808
|
+
let f = await Un(u, s.disabled, a, v, t.shouldUseNativeValidation && !i, o);
|
|
1809
|
+
if (c && d && x([r.name]), f[r.name] && (l.valid = !1, i) || (!i && (K(f, r.name) ? o ? jn(n.errors, f, r.name) : Y(n.errors, r.name, f[r.name]) : $(n.errors, r.name)), e.shouldUseNativeValidation && f[r.name])) break;
|
|
1813
1810
|
}
|
|
1814
|
-
!Q(d) && await
|
|
1811
|
+
!Q(d) && await D({
|
|
1815
1812
|
context: l,
|
|
1816
1813
|
onlyCheckValid: i,
|
|
1817
1814
|
fields: d,
|
|
@@ -1821,25 +1818,25 @@ function _r(e = {}) {
|
|
|
1821
1818
|
}
|
|
1822
1819
|
}
|
|
1823
1820
|
return l.valid;
|
|
1824
|
-
},
|
|
1821
|
+
}, O = (e, t) => (e && t && Y(a, e, t), !Z(o.mount ? a : i, i)), k = (e, t, n) => ((e, t, n, r, i) => X(e) ? (r && t.watch.add(e), K(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), K(n, e))) : (r && (t.watchAll = !0), n))(e, s, { ...o.mount ? a : G(t) ? i : X(e) ? { [e]: t } : t }, n, t), A = (e, t, n = {}, i = !1, o = !1) => {
|
|
1825
1822
|
let s = K(r, e), c = t;
|
|
1826
1823
|
if (s) {
|
|
1827
1824
|
let n = s._f;
|
|
1828
|
-
n && (!n.disabled && Y(a, e,
|
|
1825
|
+
n && (!n.disabled && Y(a, e, ar(t, n)), c = Mn(n.ref) && H(t) ? "" : t, Zn(n.ref) ? [...n.ref.options].forEach((e) => e.selected = c.includes(e.value)) : n.refs ? Jt(n.ref) ? n.refs.forEach((e) => {
|
|
1829
1826
|
e.defaultChecked && e.disabled || (Array.isArray(c) ? e.checked = !!c.find((t) => t === e.value) : e.checked = c === e.value || !!c);
|
|
1830
|
-
}) : n.refs.forEach((e) => e.checked = e.value === c) :
|
|
1827
|
+
}) : n.refs.forEach((e) => e.checked = e.value === c) : Yt(n.ref) ? n.ref.value = "" : (n.ref.value = c, n.ref.type || o || g.state.next({
|
|
1831
1828
|
name: e,
|
|
1832
1829
|
values: i ? a : W(a)
|
|
1833
1830
|
})));
|
|
1834
1831
|
}
|
|
1835
|
-
(n.shouldDirty || n.shouldTouch) && w(e, c, n.shouldTouch, n.shouldDirty, !o), n.shouldValidate &&
|
|
1836
|
-
},
|
|
1832
|
+
(n.shouldDirty || n.shouldTouch) && w(e, c, n.shouldTouch, n.shouldDirty, !o), n.shouldValidate && te(e, { delayError: n.delayError });
|
|
1833
|
+
}, j = (e, t, n, i = !1, a = !1) => {
|
|
1837
1834
|
for (let o in t) {
|
|
1838
1835
|
if (!t.hasOwnProperty(o)) return;
|
|
1839
1836
|
let c = t[o], l = e + "." + o, u = K(r, l);
|
|
1840
|
-
(s.array.has(e) || U(c) || u && !u._f) &&
|
|
1837
|
+
(s.array.has(e) || U(c) || u && !u._f) && !Xt(c) ? j(l, c, n, i, a) : A(l, c, n, i, a);
|
|
1841
1838
|
}
|
|
1842
|
-
},
|
|
1839
|
+
}, M = (e, t, i, c, l = !1) => {
|
|
1843
1840
|
let u = K(r, e), d = s.array.has(e), f = c ? t : W(t), p = Z(K(a, e), f);
|
|
1844
1841
|
if (p || Y(a, e, f), d) g.array.next({
|
|
1845
1842
|
name: e,
|
|
@@ -1847,58 +1844,58 @@ function _r(e = {}) {
|
|
|
1847
1844
|
}), (m.isDirty || m.dirtyFields || h.isDirty || h.dirtyFields) && i.shouldDirty && (S(), l || g.state.next({
|
|
1848
1845
|
name: e,
|
|
1849
1846
|
dirtyFields: n.dirtyFields,
|
|
1850
|
-
isDirty:
|
|
1847
|
+
isDirty: O(e, f)
|
|
1851
1848
|
}));
|
|
1852
1849
|
else {
|
|
1853
1850
|
let t = Array.isArray(f) && !f.length || Q(f);
|
|
1854
|
-
!u || u._f || H(f) || t ?
|
|
1851
|
+
!u || u._f || H(f) || t ? A(e, f, i, c, l) : j(e, f, i, c, l);
|
|
1855
1852
|
}
|
|
1856
1853
|
if (!p && !l) {
|
|
1857
|
-
let t =
|
|
1854
|
+
let t = kn(e, s), r = c ? a : W(a);
|
|
1858
1855
|
g.state.next({
|
|
1859
1856
|
...t && n,
|
|
1860
1857
|
name: o.mount || t ? e : void 0,
|
|
1861
1858
|
values: r
|
|
1862
1859
|
});
|
|
1863
1860
|
}
|
|
1864
|
-
},
|
|
1861
|
+
}, N = (e, t, n = {}) => M(e, t, n, !1), P = async (i) => {
|
|
1865
1862
|
o.mount = !0;
|
|
1866
|
-
let p = i.target, _ = p.name, S = !0, C = K(r, _),
|
|
1867
|
-
S = Number.isNaN(e) ||
|
|
1863
|
+
let p = i.target, _ = p.name, S = !0, C = K(r, _), O = (e) => {
|
|
1864
|
+
S = Number.isNaN(e) || Xt(e) && isNaN(e.getTime()) || Z(e, K(a, _, e));
|
|
1868
1865
|
};
|
|
1869
1866
|
if (C) {
|
|
1870
|
-
let o,
|
|
1871
|
-
if (Y(a, _,
|
|
1867
|
+
let o, k, A = p.type ? or(C._f) : ((e) => U(e) && e.target ? Jt(e.target) ? e.target.checked : Yt(e.target) ? e.target.files : e.target.value : e)(i), j = i.type === en || i.type === tn, M = !(((e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate))(C._f) || e.validate || t.resolver || K(n.errors, _) || C._f.deps), N = M || ((e, t, n, r, i) => !i.isOnAll && (!n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : !(n ? r.isOnChange : i.isOnChange) || e))(j, K(n.touchedFields, _), n.isSubmitted, f, d), P = kn(_, s, j);
|
|
1868
|
+
if (Y(a, _, A), j) {
|
|
1872
1869
|
if (!p || !p.readOnly) {
|
|
1873
1870
|
C._f.onBlur && C._f.onBlur(i);
|
|
1874
1871
|
let e = c[_];
|
|
1875
1872
|
e && e(0);
|
|
1876
1873
|
}
|
|
1877
1874
|
} else C._f.onChange && C._f.onChange(i);
|
|
1878
|
-
let
|
|
1879
|
-
if (!
|
|
1875
|
+
let F = w(_, A, j), ne = !Q(F) || P;
|
|
1876
|
+
if (!j && g.state.next({
|
|
1880
1877
|
name: _,
|
|
1881
1878
|
type: i.type,
|
|
1882
1879
|
...u ? { values: W(a) } : {}
|
|
1883
|
-
}),
|
|
1880
|
+
}), N) return M && n.isValid || !m.isValid && !h.isValid || (t.mode === "onBlur" ? j && b() : j || b()), ne && g.state.next({
|
|
1884
1881
|
name: _,
|
|
1885
|
-
...
|
|
1882
|
+
...P ? {} : F
|
|
1886
1883
|
});
|
|
1887
|
-
if (!t.resolver && e.validate && await
|
|
1884
|
+
if (!t.resolver && e.validate && await E({
|
|
1888
1885
|
name: _,
|
|
1889
1886
|
eventType: i.type
|
|
1890
|
-
}), !
|
|
1887
|
+
}), !j && P && g.state.next({ ...n }), t.resolver) {
|
|
1891
1888
|
let { errors: e } = await T([_]);
|
|
1892
|
-
if (x([_]),
|
|
1893
|
-
let t =
|
|
1894
|
-
o = i.error, _ = i.name,
|
|
1895
|
-
} else x([_], !0), o = (await
|
|
1889
|
+
if (x([_]), O(A), !S) return void (!Q(F) && g.state.next(F));
|
|
1890
|
+
let t = ur(n.errors, r, _), i = ur(e, r, t.name || _);
|
|
1891
|
+
o = i.error, _ = i.name, k = Q(e);
|
|
1892
|
+
} else x([_], !0), o = (await Un(C, s.disabled, a, v, t.shouldUseNativeValidation))[_], x([_]), O(A), S && (o ? k = !1 : (m.isValid || h.isValid) && (k = await D({
|
|
1896
1893
|
fields: r,
|
|
1897
1894
|
onlyCheckValid: !0,
|
|
1898
1895
|
name: _,
|
|
1899
1896
|
eventType: i.type
|
|
1900
1897
|
})));
|
|
1901
|
-
S && (C._f.deps && (!Array.isArray(C._f.deps) || C._f.deps.length > 0) &&
|
|
1898
|
+
S && (C._f.deps && (!Array.isArray(C._f.deps) || C._f.deps.length > 0) && te(C._f.deps), ((e, r, i, a) => {
|
|
1902
1899
|
let o = K(n.errors, e), s = (m.isValid || h.isValid) && q(r) && n.isValid !== r;
|
|
1903
1900
|
if (t.delayError && i ? (c[e] = y(e, () => ee(e, i)), c[e](t.delayError)) : (clearTimeout(l[e]), delete c[e], i ? Y(n.errors, e, i) : $(n.errors, e), n.errors = { ...n.errors }), (i ? !Z(o, i) : o) || !Q(a) || s) {
|
|
1904
1901
|
let t = {
|
|
@@ -1912,19 +1909,19 @@ function _r(e = {}) {
|
|
|
1912
1909
|
...t
|
|
1913
1910
|
}, g.state.next(t);
|
|
1914
1911
|
}
|
|
1915
|
-
})(_,
|
|
1912
|
+
})(_, k, o, F));
|
|
1916
1913
|
}
|
|
1917
|
-
},
|
|
1914
|
+
}, F = (e, t) => {
|
|
1918
1915
|
if (K(n.errors, t) && e.focus) return e.focus(), 1;
|
|
1919
|
-
},
|
|
1920
|
-
let a, o, u =
|
|
1916
|
+
}, te = async (e, i = {}) => {
|
|
1917
|
+
let a, o, u = Wn(e);
|
|
1921
1918
|
if (t.resolver) {
|
|
1922
1919
|
let t = await (async (e) => {
|
|
1923
1920
|
let { errors: t } = await T(e);
|
|
1924
1921
|
if (x(e), e) {
|
|
1925
1922
|
for (let r of e) {
|
|
1926
1923
|
let e = K(t, r);
|
|
1927
|
-
e ? s.array.has(r) && U(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ?
|
|
1924
|
+
e ? s.array.has(r) && U(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ? jn(n.errors, { [r]: e }, r) : Y(n.errors, r, e) : $(n.errors, r);
|
|
1928
1925
|
}
|
|
1929
1926
|
n.errors = { ...n.errors };
|
|
1930
1927
|
} else n.errors = t;
|
|
@@ -1933,14 +1930,14 @@ function _r(e = {}) {
|
|
|
1933
1930
|
a = Q(t), o = e ? !u.some((e) => K(t, e)) : a;
|
|
1934
1931
|
} else e ? (o = (await Promise.all(u.map(async (e) => {
|
|
1935
1932
|
let t = K(r, e);
|
|
1936
|
-
return await
|
|
1933
|
+
return await D({
|
|
1937
1934
|
fields: t && t._f ? { [e]: t } : t,
|
|
1938
|
-
eventType:
|
|
1935
|
+
eventType: rn
|
|
1939
1936
|
});
|
|
1940
|
-
}))).every(Boolean), (o || n.isValid) && b()) : o = a = await
|
|
1937
|
+
}))).every(Boolean), (o || n.isValid) && b()) : o = a = await D({
|
|
1941
1938
|
fields: r,
|
|
1942
1939
|
name: e,
|
|
1943
|
-
eventType:
|
|
1940
|
+
eventType: rn
|
|
1944
1941
|
});
|
|
1945
1942
|
if (i.delayError && t.delayError && X(e)) {
|
|
1946
1943
|
let r = K(n.errors, e);
|
|
@@ -1950,22 +1947,22 @@ function _r(e = {}) {
|
|
|
1950
1947
|
...!X(e) || (m.isValid || h.isValid) && a !== n.isValid ? {} : { name: e },
|
|
1951
1948
|
...t.resolver || !e ? { isValid: a } : {},
|
|
1952
1949
|
errors: n.errors
|
|
1953
|
-
}), i.shouldFocus && !o &&
|
|
1954
|
-
},
|
|
1950
|
+
}), i.shouldFocus && !o && An(r, F, e ? u : s.mount), o;
|
|
1951
|
+
}, ne = (e, t) => ({
|
|
1955
1952
|
invalid: !!K((t || n).errors, e),
|
|
1956
1953
|
isDirty: !!K((t || n).dirtyFields, e),
|
|
1957
1954
|
error: K((t || n).errors, e),
|
|
1958
1955
|
isValidating: !!K(n.validatingFields, e),
|
|
1959
1956
|
isTouched: !!K((t || n).touchedFields, e)
|
|
1960
|
-
}),
|
|
1961
|
-
let t = e ?
|
|
1957
|
+
}), re = (e) => {
|
|
1958
|
+
let t = e ? Wn(e) : void 0;
|
|
1962
1959
|
t?.forEach((e) => $(n.errors, e)), t ? t.forEach((e) => {
|
|
1963
1960
|
g.state.next({
|
|
1964
1961
|
name: e,
|
|
1965
1962
|
errors: n.errors
|
|
1966
1963
|
});
|
|
1967
1964
|
}) : (n.errors = {}, g.state.next({ errors: n.errors }));
|
|
1968
|
-
},
|
|
1965
|
+
}, I = (e, t, i) => {
|
|
1969
1966
|
let a = (K(r, e, { _f: {} })._f || {}).ref, { ref: o, message: s, type: c, ...l } = K(n.errors, e) || {};
|
|
1970
1967
|
Y(n.errors, e, {
|
|
1971
1968
|
...l,
|
|
@@ -1976,15 +1973,15 @@ function _r(e = {}) {
|
|
|
1976
1973
|
errors: n.errors,
|
|
1977
1974
|
isValid: !1
|
|
1978
1975
|
}), i && i.shouldFocus && a && a.focus && a.focus();
|
|
1979
|
-
},
|
|
1976
|
+
}, ie = (e) => {
|
|
1980
1977
|
let t = !!e.formState?.values;
|
|
1981
1978
|
t && u++;
|
|
1982
1979
|
let { unsubscribe: r } = g.state.subscribe({ next: (t) => {
|
|
1983
|
-
if (r = e.name, o = t.name, s = e.exact, (!r || !o || r === o ||
|
|
1980
|
+
if (r = e.name, o = t.name, s = e.exact, (!r || !o || r === o || Wn(r).some((e) => e && (s ? e === o || e.startsWith(o + ".") : e.startsWith(o) || o.startsWith(e)))) && ((e, t, n, r) => {
|
|
1984
1981
|
n(e);
|
|
1985
1982
|
let { name: i, ...a } = e, o = Object.keys(a);
|
|
1986
|
-
return !o.length || r && o.length >= Object.keys(t).length || o.find((e) => t[e] === (!r ||
|
|
1987
|
-
})(t, e.formState || m,
|
|
1983
|
+
return !o.length || r && o.length >= Object.keys(t).length || o.find((e) => t[e] === (!r || un));
|
|
1984
|
+
})(t, e.formState || m, de, e.reRenderRoot)) {
|
|
1988
1985
|
let r = { ...a };
|
|
1989
1986
|
e.callback({
|
|
1990
1987
|
values: r,
|
|
@@ -2000,18 +1997,18 @@ function _r(e = {}) {
|
|
|
2000
1997
|
return () => {
|
|
2001
1998
|
o || (o = !0, u--, r());
|
|
2002
1999
|
};
|
|
2003
|
-
},
|
|
2004
|
-
for (let c of e ?
|
|
2000
|
+
}, ae = (e, o = {}) => {
|
|
2001
|
+
for (let c of e ? Wn(e) : s.mount) s.mount.delete(c), s.array.delete(c), o.keepValue || ($(r, c), $(a, c)), !o.keepError && $(n.errors, c), !o.keepDirty && $(n.dirtyFields, c), !o.keepTouched && $(n.touchedFields, c), !o.keepIsValidating && $(n.validatingFields, c), !t.shouldUnregister && !o.keepDefaultValue && $(i, c);
|
|
2005
2002
|
g.state.next({ values: W(a) }), g.state.next({
|
|
2006
2003
|
...n,
|
|
2007
|
-
...o.keepDirty ? { isDirty:
|
|
2004
|
+
...o.keepDirty ? { isDirty: O() } : {}
|
|
2008
2005
|
}), !o.keepIsValid && b();
|
|
2009
|
-
},
|
|
2006
|
+
}, oe = ({ disabled: e, name: t }) => {
|
|
2010
2007
|
if (q(e) && o.mount || e || s.disabled.has(t)) {
|
|
2011
2008
|
let n = s.disabled.has(t) !== !!e;
|
|
2012
2009
|
e ? s.disabled.add(t) : s.disabled.delete(t), n && o.mount && !o.action && b();
|
|
2013
2010
|
}
|
|
2014
|
-
},
|
|
2011
|
+
}, L = (e, n = {}) => {
|
|
2015
2012
|
let a = K(r, e), c = q(n.disabled) || q(t.disabled), l = !s.registerName.has(e) && a && a._f && !a._f.mount;
|
|
2016
2013
|
return Y(r, e, {
|
|
2017
2014
|
...a || {},
|
|
@@ -2021,30 +2018,30 @@ function _r(e = {}) {
|
|
|
2021
2018
|
mount: !0,
|
|
2022
2019
|
...n
|
|
2023
2020
|
}
|
|
2024
|
-
}), s.mount.add(e), a && !l ?
|
|
2021
|
+
}), s.mount.add(e), a && !l ? oe({
|
|
2025
2022
|
disabled: q(n.disabled) ? n.disabled : t.disabled,
|
|
2026
2023
|
name: e
|
|
2027
2024
|
}) : C(e, !0, n.value), {
|
|
2028
2025
|
...c ? { disabled: n.disabled || t.disabled } : {},
|
|
2029
2026
|
...t.progressive ? {
|
|
2030
2027
|
required: !!n.required,
|
|
2031
|
-
min:
|
|
2032
|
-
max:
|
|
2033
|
-
minLength:
|
|
2034
|
-
maxLength:
|
|
2035
|
-
pattern:
|
|
2028
|
+
min: sr(n.min),
|
|
2029
|
+
max: sr(n.max),
|
|
2030
|
+
minLength: sr(n.minLength),
|
|
2031
|
+
maxLength: sr(n.maxLength),
|
|
2032
|
+
pattern: sr(n.pattern)
|
|
2036
2033
|
} : {},
|
|
2037
2034
|
name: e,
|
|
2038
|
-
onChange:
|
|
2039
|
-
onBlur:
|
|
2035
|
+
onChange: P,
|
|
2036
|
+
onBlur: P,
|
|
2040
2037
|
ref: (c) => {
|
|
2041
2038
|
if (c) {
|
|
2042
|
-
s.registerName.add(e),
|
|
2043
|
-
let t = G(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = ((e) =>
|
|
2039
|
+
s.registerName.add(e), L(e, n), s.registerName.delete(e), a = K(r, e);
|
|
2040
|
+
let t = G(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = ((e) => Nn(e) || Jt(e))(t), l = a._f.refs || [];
|
|
2044
2041
|
if (o ? l.find((e) => e === t) : t === a._f.ref) return;
|
|
2045
2042
|
let u = { ...a._f };
|
|
2046
2043
|
o ? (u.refs = [
|
|
2047
|
-
...l.filter(
|
|
2044
|
+
...l.filter(Qn),
|
|
2048
2045
|
t,
|
|
2049
2046
|
...Array.isArray(K(i, e)) ? [{}] : []
|
|
2050
2047
|
], u.ref = {
|
|
@@ -2054,26 +2051,26 @@ function _r(e = {}) {
|
|
|
2054
2051
|
} 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);
|
|
2055
2052
|
}
|
|
2056
2053
|
};
|
|
2057
|
-
},
|
|
2054
|
+
}, se = () => t.shouldFocusError && !t.shouldUseNativeValidation && An(r, F, s.mount), ce = (e, i) => async (o) => {
|
|
2058
2055
|
let c;
|
|
2059
2056
|
o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
|
|
2060
2057
|
let l = W(a);
|
|
2061
2058
|
if (g.state.next({ isSubmitting: !0 }), t.resolver) {
|
|
2062
2059
|
let { errors: e, values: t } = await T();
|
|
2063
2060
|
x(), n.errors = e, l = W(t);
|
|
2064
|
-
} else await
|
|
2061
|
+
} else await D({
|
|
2065
2062
|
fields: r,
|
|
2066
|
-
eventType:
|
|
2063
|
+
eventType: nn
|
|
2067
2064
|
});
|
|
2068
2065
|
if (s.disabled.size) for (let e of s.disabled) $(l, e);
|
|
2069
|
-
if ($(n.errors,
|
|
2066
|
+
if ($(n.errors, vn), Q(n.errors)) {
|
|
2070
2067
|
g.state.next({ errors: {} });
|
|
2071
2068
|
try {
|
|
2072
2069
|
await e(l, o);
|
|
2073
2070
|
} catch (e) {
|
|
2074
2071
|
c = e;
|
|
2075
2072
|
}
|
|
2076
|
-
} else i && await i({ ...n.errors }, o),
|
|
2073
|
+
} else i && await i({ ...n.errors }, o), se(), setTimeout(se);
|
|
2077
2074
|
if (g.state.next({
|
|
2078
2075
|
isSubmitted: !0,
|
|
2079
2076
|
isSubmitting: !1,
|
|
@@ -2081,21 +2078,21 @@ function _r(e = {}) {
|
|
|
2081
2078
|
submitCount: n.submitCount + 1,
|
|
2082
2079
|
errors: n.errors
|
|
2083
2080
|
}), c) throw c;
|
|
2084
|
-
},
|
|
2081
|
+
}, le = (e, c = {}) => {
|
|
2085
2082
|
let l = e ? W(e) : i, u = W(l), d = Q(e), f = u, p = r;
|
|
2086
2083
|
if (c.keepDefaultValues || (i = l), !c.keepValues) {
|
|
2087
2084
|
if (c.keepDirtyValues) {
|
|
2088
|
-
let e = /* @__PURE__ */ new Set([...s.mount, ...Object.keys(
|
|
2085
|
+
let e = /* @__PURE__ */ new Set([...s.mount, ...Object.keys(ir(i, a, void 0, p))]);
|
|
2089
2086
|
for (let t of Array.from(e)) {
|
|
2090
2087
|
let e = K(n.dirtyFields, t), r = K(a, t), i = K(f, t);
|
|
2091
|
-
e && !G(r) ? Y(f, t, r) : e || G(i) ||
|
|
2088
|
+
e && !G(r) ? Y(f, t, r) : e || G(i) || N(t, i);
|
|
2092
2089
|
}
|
|
2093
2090
|
} else {
|
|
2094
|
-
if (
|
|
2091
|
+
if ($t && G(e)) for (let e of s.mount) {
|
|
2095
2092
|
let t = K(r, e);
|
|
2096
2093
|
if (t && t._f) {
|
|
2097
2094
|
let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
|
|
2098
|
-
if (
|
|
2095
|
+
if (Mn(e)) {
|
|
2099
2096
|
let t = e.closest("form");
|
|
2100
2097
|
if (t) {
|
|
2101
2098
|
t.reset();
|
|
@@ -2104,7 +2101,7 @@ function _r(e = {}) {
|
|
|
2104
2101
|
}
|
|
2105
2102
|
}
|
|
2106
2103
|
}
|
|
2107
|
-
if (c.keepFieldsRef) for (let e of s.mount)
|
|
2104
|
+
if (c.keepFieldsRef) for (let e of s.mount) N(e, K(f, e));
|
|
2108
2105
|
else r = {};
|
|
2109
2106
|
}
|
|
2110
2107
|
if (t.shouldUnregister) {
|
|
@@ -2127,19 +2124,19 @@ function _r(e = {}) {
|
|
|
2127
2124
|
focus: ""
|
|
2128
2125
|
}, o.mount = !m.isValid || !!c.keepIsValid || !!c.keepDirtyValues || !t.shouldUnregister && !Q(f), o.watch = !!t.shouldUnregister, o.keepIsValid = !!c.keepIsValid, o.action = !1, c.keepErrors || (n.errors = {}), g.state.next({
|
|
2129
2126
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
2130
|
-
isDirty: !d && (c.keepDirty ? n.isDirty : c.keepValues ?
|
|
2127
|
+
isDirty: !d && (c.keepDirty ? n.isDirty : c.keepValues ? O() : !(!c.keepDefaultValues || Z(e, i))),
|
|
2131
2128
|
isSubmitted: !!c.keepIsSubmitted && n.isSubmitted,
|
|
2132
|
-
dirtyFields: d ? {} : c.keepDirtyValues ? c.keepDefaultValues && a ?
|
|
2129
|
+
dirtyFields: d ? {} : c.keepDirtyValues ? c.keepDefaultValues && a ? ir(i, a, void 0, p) : n.dirtyFields : c.keepDefaultValues && e ? ir(i, e, void 0, p) : c.keepDirty ? n.dirtyFields : {},
|
|
2133
2130
|
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
2134
2131
|
errors: c.keepErrors ? n.errors : {},
|
|
2135
2132
|
isSubmitSuccessful: !!c.keepIsSubmitSuccessful && n.isSubmitSuccessful,
|
|
2136
2133
|
isSubmitting: !1,
|
|
2137
2134
|
defaultValues: i
|
|
2138
2135
|
});
|
|
2139
|
-
},
|
|
2136
|
+
}, ue = (e, n) => le(J(e) ? e(a) : e, {
|
|
2140
2137
|
...t.resetOptions,
|
|
2141
2138
|
...n
|
|
2142
|
-
}),
|
|
2139
|
+
}), de = (e) => {
|
|
2143
2140
|
let { name: t, type: r, values: i, ...a } = e;
|
|
2144
2141
|
n = {
|
|
2145
2142
|
...n,
|
|
@@ -2147,17 +2144,17 @@ function _r(e = {}) {
|
|
|
2147
2144
|
};
|
|
2148
2145
|
}, fe = {
|
|
2149
2146
|
control: {
|
|
2150
|
-
register:
|
|
2151
|
-
unregister:
|
|
2152
|
-
getFieldState:
|
|
2153
|
-
handleSubmit:
|
|
2154
|
-
setError:
|
|
2155
|
-
_subscribe:
|
|
2147
|
+
register: L,
|
|
2148
|
+
unregister: ae,
|
|
2149
|
+
getFieldState: ne,
|
|
2150
|
+
handleSubmit: ce,
|
|
2151
|
+
setError: I,
|
|
2152
|
+
_subscribe: ie,
|
|
2156
2153
|
_runSchema: T,
|
|
2157
2154
|
_updateIsValidating: x,
|
|
2158
|
-
_focusError:
|
|
2159
|
-
_getWatch:
|
|
2160
|
-
_getDirty:
|
|
2155
|
+
_focusError: se,
|
|
2156
|
+
_getWatch: k,
|
|
2157
|
+
_getDirty: O,
|
|
2161
2158
|
_setValid: b,
|
|
2162
2159
|
_setFieldArray: (e, i = [], s, c, l = !0, u = !0) => {
|
|
2163
2160
|
if (c && s && !t.disabled) {
|
|
@@ -2168,7 +2165,7 @@ function _r(e = {}) {
|
|
|
2168
2165
|
if (u && Array.isArray(K(n.errors, e))) {
|
|
2169
2166
|
let t = s(K(n.errors, e), c.argA, c.argB);
|
|
2170
2167
|
l && Y(n.errors, e, t), ((e, t) => {
|
|
2171
|
-
!
|
|
2168
|
+
!Gn(K(e, t)).length && $(e, t);
|
|
2172
2169
|
})(n.errors, e);
|
|
2173
2170
|
}
|
|
2174
2171
|
if ((m.touchedFields || h.touchedFields) && u && Array.isArray(K(n.touchedFields, e))) {
|
|
@@ -2177,34 +2174,34 @@ function _r(e = {}) {
|
|
|
2177
2174
|
}
|
|
2178
2175
|
(m.dirtyFields || h.dirtyFields) && S(), g.state.next({
|
|
2179
2176
|
name: e,
|
|
2180
|
-
isDirty:
|
|
2177
|
+
isDirty: O(e, i),
|
|
2181
2178
|
dirtyFields: n.dirtyFields,
|
|
2182
2179
|
errors: n.errors,
|
|
2183
2180
|
isValid: n.isValid
|
|
2184
2181
|
});
|
|
2185
2182
|
} else Y(a, e, i);
|
|
2186
2183
|
},
|
|
2187
|
-
_setDisabledField:
|
|
2184
|
+
_setDisabledField: oe,
|
|
2188
2185
|
_setErrors: (e) => {
|
|
2189
2186
|
n.errors = e, g.state.next({
|
|
2190
2187
|
errors: n.errors,
|
|
2191
2188
|
isValid: !1
|
|
2192
2189
|
});
|
|
2193
2190
|
},
|
|
2194
|
-
_getFieldArray: (e) =>
|
|
2195
|
-
_reset:
|
|
2191
|
+
_getFieldArray: (e) => Gn(K(o.mount ? a : i, e, t.shouldUnregister ? K(i, e, []) : [])),
|
|
2192
|
+
_reset: le,
|
|
2196
2193
|
_resetDefaultValues: () => J(t.defaultValues) && t.defaultValues().then((e) => {
|
|
2197
|
-
|
|
2194
|
+
ue(e, t.resetOptions), g.state.next({ isLoading: !1 });
|
|
2198
2195
|
}),
|
|
2199
2196
|
_removeUnmounted: () => {
|
|
2200
2197
|
for (let e of s.unMount) {
|
|
2201
2198
|
let t = K(r, e);
|
|
2202
|
-
t && (t._f.refs ? t._f.refs.every((e) => !
|
|
2199
|
+
t && (t._f.refs ? t._f.refs.every((e) => !Qn(e)) : !Qn(t._f.ref)) && ae(e);
|
|
2203
2200
|
}
|
|
2204
2201
|
s.unMount = /* @__PURE__ */ new Set();
|
|
2205
2202
|
},
|
|
2206
2203
|
_disableForm: (e) => {
|
|
2207
|
-
q(e) && (g.state.next({ disabled: e }),
|
|
2204
|
+
q(e) && (g.state.next({ disabled: e }), An(r, (t, n) => {
|
|
2208
2205
|
let i = K(r, n);
|
|
2209
2206
|
i && (t.disabled = i._f.disabled || e, Array.isArray(i._f.refs) && i._f.refs.forEach((t) => {
|
|
2210
2207
|
t.disabled = i._f.disabled || e;
|
|
@@ -2244,33 +2241,33 @@ function _r(e = {}) {
|
|
|
2244
2241
|
t = {
|
|
2245
2242
|
...t,
|
|
2246
2243
|
...e
|
|
2247
|
-
}, d =
|
|
2244
|
+
}, d = On(t.mode), f = On(t.reValidateMode);
|
|
2248
2245
|
}
|
|
2249
2246
|
},
|
|
2250
2247
|
subscribe: (e) => (o.mount = !0, h = {
|
|
2251
2248
|
...h,
|
|
2252
2249
|
...e.formState
|
|
2253
|
-
},
|
|
2250
|
+
}, ie({
|
|
2254
2251
|
...e,
|
|
2255
2252
|
formState: {
|
|
2256
2253
|
...p,
|
|
2257
2254
|
...e.formState
|
|
2258
2255
|
}
|
|
2259
2256
|
})),
|
|
2260
|
-
trigger:
|
|
2261
|
-
register:
|
|
2262
|
-
handleSubmit:
|
|
2257
|
+
trigger: te,
|
|
2258
|
+
register: L,
|
|
2259
|
+
handleSubmit: ce,
|
|
2263
2260
|
watch: (e, t) => {
|
|
2264
2261
|
if (J(e)) {
|
|
2265
2262
|
u++;
|
|
2266
|
-
let { unsubscribe: n } = g.state.subscribe({ next: (n) => "values" in n && e(n.values ||
|
|
2263
|
+
let { unsubscribe: n } = g.state.subscribe({ next: (n) => "values" in n && e(n.values || k(void 0, t), n) }), r = !1;
|
|
2267
2264
|
return { unsubscribe: () => {
|
|
2268
2265
|
r || (r = !0, u--, n());
|
|
2269
2266
|
} };
|
|
2270
2267
|
}
|
|
2271
|
-
return
|
|
2268
|
+
return k(e, t, !0);
|
|
2272
2269
|
},
|
|
2273
|
-
setValue:
|
|
2270
|
+
setValue: N,
|
|
2274
2271
|
setValues: (e, t = {}) => {
|
|
2275
2272
|
let r = J(e) ? e(a) : e;
|
|
2276
2273
|
if (!Z(a, r)) {
|
|
@@ -2278,8 +2275,8 @@ function _r(e = {}) {
|
|
|
2278
2275
|
...a,
|
|
2279
2276
|
...r
|
|
2280
2277
|
};
|
|
2281
|
-
let e =
|
|
2282
|
-
for (let n of s.mount) n in e &&
|
|
2278
|
+
let e = Kn(r);
|
|
2279
|
+
for (let n of s.mount) n in e && M(n, e[n], t, !0, !0);
|
|
2283
2280
|
g.state.next({
|
|
2284
2281
|
...n,
|
|
2285
2282
|
name: void 0,
|
|
@@ -2290,15 +2287,15 @@ function _r(e = {}) {
|
|
|
2290
2287
|
},
|
|
2291
2288
|
getValues: (e, t) => {
|
|
2292
2289
|
let r = { ...o.mount ? a : i };
|
|
2293
|
-
return t && (r =
|
|
2290
|
+
return t && (r = Xn(t.dirtyFields ? n.dirtyFields : n.touchedFields, r)), G(e) ? r : X(e) ? K(r, e) : e.map((e) => K(r, e));
|
|
2294
2291
|
},
|
|
2295
|
-
reset:
|
|
2292
|
+
reset: ue,
|
|
2296
2293
|
resetField: (e, t = {}) => {
|
|
2297
|
-
K(r, e) && (G(t.defaultValue) ?
|
|
2294
|
+
K(r, e) && (G(t.defaultValue) ? N(e, W(K(i, e))) : (N(e, t.defaultValue), Y(i, e, W(t.defaultValue))), t.keepTouched || $(n.touchedFields, e), t.keepDirty || ($(n.dirtyFields, e), n.isDirty = t.defaultValue ? O(e, W(K(i, e))) : O()), t.keepError || ($(n.errors, e), m.isValid && b()), g.state.next({ ...n }));
|
|
2298
2295
|
},
|
|
2299
2296
|
resetDefaultValues: (e, t = {}) => {
|
|
2300
2297
|
if (i = W(e), !t.keepDirty) {
|
|
2301
|
-
let e =
|
|
2298
|
+
let e = ir(i, a, void 0, r);
|
|
2302
2299
|
n.dirtyFields = e, n.isDirty = !Q(e);
|
|
2303
2300
|
}
|
|
2304
2301
|
t.keepIsValid || b(), g.state.next({
|
|
@@ -2306,9 +2303,9 @@ function _r(e = {}) {
|
|
|
2306
2303
|
defaultValues: i
|
|
2307
2304
|
});
|
|
2308
2305
|
},
|
|
2309
|
-
clearErrors:
|
|
2310
|
-
unregister:
|
|
2311
|
-
setError:
|
|
2306
|
+
clearErrors: re,
|
|
2307
|
+
unregister: ae,
|
|
2308
|
+
setError: I,
|
|
2312
2309
|
setFocus: (e, t = {}) => {
|
|
2313
2310
|
let n = K(r, e), i = n && n._f;
|
|
2314
2311
|
if (i) {
|
|
@@ -2318,16 +2315,16 @@ function _r(e = {}) {
|
|
|
2318
2315
|
});
|
|
2319
2316
|
}
|
|
2320
2317
|
},
|
|
2321
|
-
getFieldState:
|
|
2318
|
+
getFieldState: ne
|
|
2322
2319
|
};
|
|
2323
2320
|
return {
|
|
2324
2321
|
...fe,
|
|
2325
2322
|
formControl: fe
|
|
2326
2323
|
};
|
|
2327
2324
|
}
|
|
2328
|
-
function
|
|
2325
|
+
function hr(e = {}) {
|
|
2329
2326
|
let t = x.useRef(void 0), n = x.useRef(void 0), r = x.useRef(e.formControl), [i, a] = x.useState(() => ({
|
|
2330
|
-
...W(
|
|
2327
|
+
...W(pr),
|
|
2331
2328
|
isLoading: J(e.defaultValues),
|
|
2332
2329
|
errors: e.errors || {},
|
|
2333
2330
|
disabled: e.disabled || !1,
|
|
@@ -2338,14 +2335,14 @@ function vr(e = {}) {
|
|
|
2338
2335
|
formState: i
|
|
2339
2336
|
}, e.defaultValues && !J(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
2340
2337
|
else {
|
|
2341
|
-
let { formControl: n, ...r } =
|
|
2338
|
+
let { formControl: n, ...r } = mr(e);
|
|
2342
2339
|
t.current = {
|
|
2343
2340
|
...r,
|
|
2344
2341
|
formState: i
|
|
2345
2342
|
};
|
|
2346
2343
|
}
|
|
2347
2344
|
let o = t.current.control;
|
|
2348
|
-
return o._options = e,
|
|
2345
|
+
return o._options = e, Tn(() => {
|
|
2349
2346
|
let e = o._subscribe({
|
|
2350
2347
|
formState: o._proxyFormState,
|
|
2351
2348
|
callback: () => a({
|
|
@@ -2384,60 +2381,72 @@ function vr(e = {}) {
|
|
|
2384
2381
|
let i = {};
|
|
2385
2382
|
for (let a in e) Object.defineProperty(i, a, { get: () => {
|
|
2386
2383
|
let i = a;
|
|
2387
|
-
return t._proxyFormState[i] !==
|
|
2384
|
+
return t._proxyFormState[i] !== un && (t._proxyFormState[i] = !r || un), n && (n[i] = !0), e[i];
|
|
2388
2385
|
} });
|
|
2389
2386
|
return i;
|
|
2390
2387
|
})(i, o), [o, i]), t.current;
|
|
2391
2388
|
}
|
|
2392
|
-
var
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2389
|
+
var gr = ["Ok", "Cancel"], _r = {
|
|
2390
|
+
[ie.Info]: "ValidationInformation",
|
|
2391
|
+
[ie.Warning]: "ValidationWarning",
|
|
2392
|
+
[ie.Error]: "ValidationStop",
|
|
2393
|
+
[ie.Success]: "Check"
|
|
2394
|
+
}, vr = (e) => typeof e == "string" ? e : e.id ?? e, yr = (e, t) => t !== void 0 && vr(e) === vr(t), br = (e) => typeof e != "string" && (typeof e.disabled == "function" ? e.disabled() : !0 === e.disabled), xr = w(C((e, r) => {
|
|
2395
|
+
let { description: s, type: c, icon: l, onCancel: u, onOption: d, onDone: p, onValidateOption: m, options: h = gr, autoFocusSel: g = ".defaultOption", defaultOption: _ = h[0], cancelOption: b = "Cancel", autoFocus: x, children: ee, ...C } = e, w = hr({ shouldUseNativeValidation: !1 }), { handleSubmit: T, formState: E } = w, D = k(null), j = k(null), N = de(), P = O(() => {
|
|
2396
|
+
let e = typeof l == "string" ? l : l ? void 0 : _r[c];
|
|
2397
|
+
return e ? v(ne, {
|
|
2398
|
+
iconKey: e,
|
|
2399
|
+
size: 32,
|
|
2400
|
+
ariaHidden: !0
|
|
2401
|
+
}) : l ?? null;
|
|
2402
|
+
}, [l, c]), F = se((e) => typeof e == "string" ? e === "Ok" ? N("dialog.ok") : e === "Cancel" ? N("dialog.cancel") : e : typeof e.label == "function" ? e.label() : e.label, [N]), te = k(null), [I, ie] = A(null), ae = se(async (e) => {
|
|
2403
|
+
let t = vr(e);
|
|
2404
|
+
if (I !== null || br(e)) return;
|
|
2405
|
+
let n = yr(e, b), r;
|
|
2397
2406
|
try {
|
|
2398
|
-
if (
|
|
2399
|
-
await Promise.resolve(
|
|
2407
|
+
if (ie(t), r = !!n || (await Promise.resolve(m?.(t)) ?? !0), !0 !== r) return;
|
|
2408
|
+
await Promise.resolve(d?.(t, n, yr(e, _))), p?.(t);
|
|
2400
2409
|
} catch {} finally {
|
|
2401
|
-
|
|
2410
|
+
ie(null);
|
|
2402
2411
|
}
|
|
2403
2412
|
}, [
|
|
2404
|
-
u,
|
|
2405
2413
|
d,
|
|
2406
2414
|
p,
|
|
2415
|
+
m,
|
|
2416
|
+
b,
|
|
2407
2417
|
_,
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
]), F = I((e, t) => {
|
|
2418
|
+
I
|
|
2419
|
+
]), oe = se((e, t) => {
|
|
2411
2420
|
setTimeout(() => {
|
|
2412
|
-
|
|
2421
|
+
ae(_);
|
|
2413
2422
|
}, 180);
|
|
2414
|
-
}, [
|
|
2415
|
-
|
|
2423
|
+
}, [ae, _]), L = se(() => {
|
|
2424
|
+
d?.(vr(b), !0, !1), u?.(), p?.(null);
|
|
2416
2425
|
}, [
|
|
2426
|
+
d,
|
|
2427
|
+
b,
|
|
2417
2428
|
u,
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
]), oe = T && (Object.keys(T.errors).length > 0 || T.disabled || T.isSubmitting), se = I((e, t, r) => {
|
|
2422
|
-
let a = xr(e, _), o = {
|
|
2429
|
+
p
|
|
2430
|
+
]), ce = E && (Object.keys(E.errors).length > 0 || E.disabled || E.isSubmitting), le = se((e, t, r) => {
|
|
2431
|
+
let a = yr(e, b), o = {
|
|
2423
2432
|
className: t ? "defaultOption" : "action",
|
|
2424
2433
|
type: t ? "submit" : "button",
|
|
2425
2434
|
style: { minWidth: "75px" },
|
|
2426
2435
|
onClick: () => {
|
|
2427
|
-
a ?
|
|
2436
|
+
a ? L() : t || ae(e);
|
|
2428
2437
|
}
|
|
2429
2438
|
}, s = typeof e == "string" ? void 0 : e.renderButton;
|
|
2430
2439
|
if (s) return v(S, { children: s(o, t) }, `action:${r}`);
|
|
2431
|
-
let c =
|
|
2440
|
+
let c = I !== null && yr(e, I), l = {
|
|
2432
2441
|
className: t ? "defaultOption" : "action",
|
|
2433
2442
|
variant: t ? "contained" : "outlined",
|
|
2434
2443
|
size: "small",
|
|
2435
|
-
disabled: !a && (
|
|
2444
|
+
disabled: !a && (ce || br(e)) || I !== null && !c,
|
|
2436
2445
|
color: "primary",
|
|
2437
2446
|
...o
|
|
2438
2447
|
};
|
|
2439
2448
|
if (t || a) {
|
|
2440
|
-
let e = t ?
|
|
2449
|
+
let e = t ? D : j;
|
|
2441
2450
|
l.touchRippleRef = e, l.onPointerDown = (t) => {
|
|
2442
2451
|
e.current?.start(t, { center: !1 }), t.stopPropagation(), t.preventDefault();
|
|
2443
2452
|
};
|
|
@@ -2446,8 +2455,8 @@ var yr = ["Ok", "Cancel"], br = (e) => typeof e == "string" ? e : e.id ?? e, xr
|
|
|
2446
2455
|
...l,
|
|
2447
2456
|
children: [v("div", {
|
|
2448
2457
|
style: { visibility: c ? "hidden" : void 0 },
|
|
2449
|
-
children:
|
|
2450
|
-
}),
|
|
2458
|
+
children: F(e)
|
|
2459
|
+
}), m && !a ? v(i, {
|
|
2451
2460
|
size: 16,
|
|
2452
2461
|
color: "inherit",
|
|
2453
2462
|
style: { opacity: +!!c },
|
|
@@ -2462,54 +2471,54 @@ var yr = ["Ok", "Cancel"], br = (e) => typeof e == "string" ? e : e.id ?? e, xr
|
|
|
2462
2471
|
}) : null]
|
|
2463
2472
|
}, `action:${r}`);
|
|
2464
2473
|
}, [
|
|
2465
|
-
|
|
2466
|
-
g,
|
|
2474
|
+
h,
|
|
2467
2475
|
_,
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2476
|
+
b,
|
|
2477
|
+
E,
|
|
2478
|
+
F,
|
|
2479
|
+
I
|
|
2480
|
+
]), ue = O(() => {
|
|
2472
2481
|
let e = [];
|
|
2473
|
-
for (let t = 0; t <
|
|
2474
|
-
let n =
|
|
2475
|
-
e.push(
|
|
2482
|
+
for (let t = 0; t < h.length; t++) {
|
|
2483
|
+
let n = h[t], r = _ === void 0 ? t === 0 : yr(n, _);
|
|
2484
|
+
e.push(le(n, r, t));
|
|
2476
2485
|
}
|
|
2477
2486
|
return e;
|
|
2478
2487
|
}, [
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2488
|
+
h,
|
|
2489
|
+
_,
|
|
2490
|
+
E,
|
|
2491
|
+
N,
|
|
2492
|
+
I
|
|
2484
2493
|
]);
|
|
2485
|
-
return v(
|
|
2486
|
-
onCancel:
|
|
2487
|
-
initialPosition: { y:
|
|
2488
|
-
onDone:
|
|
2489
|
-
autoFocusSel:
|
|
2494
|
+
return v(Ft, {
|
|
2495
|
+
onCancel: L,
|
|
2496
|
+
initialPosition: { y: qt === "touch" ? "15" : "35" },
|
|
2497
|
+
onDone: p,
|
|
2498
|
+
autoFocusSel: g,
|
|
2490
2499
|
isModal: !0,
|
|
2491
2500
|
ref: r,
|
|
2492
|
-
...
|
|
2493
|
-
children: v(
|
|
2494
|
-
...
|
|
2501
|
+
...C,
|
|
2502
|
+
children: v(Jn, {
|
|
2503
|
+
...w,
|
|
2495
2504
|
children: y("form", {
|
|
2496
|
-
ref:
|
|
2497
|
-
onSubmit:
|
|
2505
|
+
ref: te,
|
|
2506
|
+
onSubmit: T(oe),
|
|
2498
2507
|
children: [v(o, {
|
|
2499
2508
|
dividers: !0,
|
|
2500
2509
|
onKeyDown: (e) => {
|
|
2501
2510
|
if (e.isDefaultPrevented()) return;
|
|
2502
2511
|
e.stopPropagation();
|
|
2503
|
-
let t = null, n = null, r = e.which ===
|
|
2512
|
+
let t = null, n = null, r = e.which === re.Escape && b;
|
|
2504
2513
|
if (r) {
|
|
2505
|
-
if (
|
|
2506
|
-
t =
|
|
2514
|
+
if (I !== null) return;
|
|
2515
|
+
t = b, n = j;
|
|
2507
2516
|
} else {
|
|
2508
|
-
if (
|
|
2509
|
-
e.which ===
|
|
2517
|
+
if (ce || I !== null) return;
|
|
2518
|
+
e.which === re.Enter && (t = _ ?? h[0], n = D);
|
|
2510
2519
|
}
|
|
2511
2520
|
t && (n?.current?.start(e, { center: !1 }), setTimeout(() => {
|
|
2512
|
-
n?.current?.stop(e), r &&
|
|
2521
|
+
n?.current?.stop(e), r && L();
|
|
2513
2522
|
}, 180));
|
|
2514
2523
|
},
|
|
2515
2524
|
children: y(t, {
|
|
@@ -2517,15 +2526,26 @@ var yr = ["Ok", "Cancel"], br = (e) => typeof e == "string" ? e : e.id ?? e, xr
|
|
|
2517
2526
|
display: "flex",
|
|
2518
2527
|
flexDirection: "column",
|
|
2519
2528
|
whiteSpace: "pre-wrap",
|
|
2520
|
-
rowGap: (e) => e.spacing(
|
|
2529
|
+
rowGap: (e) => e.spacing(P || s ? 1.5 : 0)
|
|
2521
2530
|
},
|
|
2522
2531
|
children: [y(t, {
|
|
2523
2532
|
sx: {
|
|
2524
2533
|
display: "flex",
|
|
2525
|
-
flexDirection: "
|
|
2534
|
+
flexDirection: "row",
|
|
2535
|
+
alignItems: "flex-start",
|
|
2536
|
+
columnGap: (e) => e.spacing(2)
|
|
2526
2537
|
},
|
|
2527
|
-
children: [
|
|
2528
|
-
|
|
2538
|
+
children: [P ? v(t, {
|
|
2539
|
+
sx: {
|
|
2540
|
+
display: "flex",
|
|
2541
|
+
flex: "none"
|
|
2542
|
+
},
|
|
2543
|
+
children: P
|
|
2544
|
+
}) : null, v(f, {
|
|
2545
|
+
sx: { alignSelf: "center" },
|
|
2546
|
+
children: s
|
|
2547
|
+
})]
|
|
2548
|
+
}), ee]
|
|
2529
2549
|
})
|
|
2530
2550
|
}), v(a, {
|
|
2531
2551
|
sx: {
|
|
@@ -2533,12 +2553,12 @@ var yr = ["Ok", "Cancel"], br = (e) => typeof e == "string" ? e : e.id ?? e, xr
|
|
|
2533
2553
|
paddingBottom: (e) => e.spacing(1),
|
|
2534
2554
|
paddingLeft: (e) => e.spacing(1),
|
|
2535
2555
|
paddingRight: (e) => e.spacing(1),
|
|
2536
|
-
backgroundColor: (e) =>
|
|
2556
|
+
backgroundColor: (e) => M(e.palette.action.hover, .03)
|
|
2537
2557
|
},
|
|
2538
|
-
children:
|
|
2558
|
+
children: ue
|
|
2539
2559
|
})]
|
|
2540
2560
|
})
|
|
2541
2561
|
})
|
|
2542
2562
|
});
|
|
2543
2563
|
}));
|
|
2544
|
-
export {
|
|
2564
|
+
export { Me as _, Ke as a, Ee as b, Ve as c, ze as d, R as f, Ne as g, Pe as h, Xe as i, He as l, Ie as m, vr as n, Ge as o, Fe as p, Ft as r, Ue as s, xr as t, Be as u, je as v, we as x, ke as y };
|