@middag-io/react 0.17.0 → 0.18.0
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/dist-lib/{ChartPanelBlock-OZix9y7T.js → ChartPanelBlock-CSQd3YU7.js} +1 -1
- package/dist-lib/{DocumentField-y8OETxf6.js → DocumentField-Mc-FrWZt.js} +1 -1
- package/dist-lib/{FlowEditorBlock-CGCowCIL.js → FlowEditorBlock-NrPOi3mS.js} +1 -1
- package/dist-lib/{FormBuilderBlock-CRAV0oSH.js → FormBuilderBlock-Yzy7KaAI.js} +1 -1
- package/dist-lib/{FormPanelBlock-BTcXUBcZ.js → FormPanelBlock-C9facP0m.js} +316 -316
- package/dist-lib/FormPanelBlock-ulvxaRzJ.js +2 -0
- package/dist-lib/{KanbanBoardBlock-CiQWT6Us.js → KanbanBoardBlock-DhiQZzqL.js} +1 -1
- package/dist-lib/{MarkdownContent-B8cmBIKa.js → MarkdownContent-Bt6q-Y_1.js} +1287 -1288
- package/dist-lib/base/partials/index.d.ts +17 -0
- package/dist-lib/base/partials/index.d.ts.map +1 -0
- package/dist-lib/contracts/page-contract-data.d.ts +63 -0
- package/dist-lib/contracts/page-contract-data.d.ts.map +1 -0
- package/dist-lib/index.d.ts +2 -1
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/middag-react.js +2999 -2337
- package/package.json +1 -1
- package/dist-lib/FormPanelBlock-D6ashc8j.js +0 -2
- /package/dist-lib/{ConditionTreeBlock-DqxfYryz.js → ConditionTreeBlock-BX_2p3Yz.js} +0 -0
- /package/dist-lib/{DateField-DjYSg_p7.js → DateField-BxYJUlk4.js} +0 -0
- /package/dist-lib/{DateRangeField-iAVBZVzE.js → DateRangeField-DK02BwDy.js} +0 -0
- /package/dist-lib/{PhoneField-Wu-d01cw.js → PhoneField-B1EDgorM.js} +0 -0
- /package/dist-lib/{SentenceBuilderBlock-DJ2yPhKB.js → SentenceBuilderBlock--JBOCkXI.js} +0 -0
- /package/dist-lib/{dist-Dg5ozU8m.js → dist-DEukRl4M.js} +0 -0
- /package/dist-lib/{document-validation-DOLZeicu.js → document-validation-DfjoJeek.js} +0 -0
- /package/dist-lib/{sortable.esm-BjkovHTt.js → sortable.esm-DsdSKGdv.js} +0 -0
- /package/dist-lib/{value-Cs0MHQBZ.js → value-PnGnjGbr.js} +0 -0
|
@@ -13,7 +13,7 @@ import { p as lt } from "./floating-ui.react-dom-62M1nRNP.js";
|
|
|
13
13
|
import { t as ut } from "./badge-AMZPvmLD.js";
|
|
14
14
|
import { t as dt } from "./skeleton-DzfTvSIA.js";
|
|
15
15
|
import { t as ft } from "./input-DzdJK5AV.js";
|
|
16
|
-
import { t as pt } from "./document-validation-
|
|
16
|
+
import { t as pt } from "./document-validation-DfjoJeek.js";
|
|
17
17
|
import * as P from "react";
|
|
18
18
|
import F, { Suspense as mt, createContext as ht, lazy as gt, useCallback as I, useContext as _t, useEffect as vt, useId as yt, useMemo as bt, useRef as xt, useState as St } from "react";
|
|
19
19
|
import { router as Ct } from "@inertiajs/core";
|
|
@@ -4950,7 +4950,7 @@ function Of(e) {
|
|
|
4950
4950
|
}
|
|
4951
4951
|
//#endregion
|
|
4952
4952
|
//#region src/base/partials/EmptyPlaceholder/index.tsx
|
|
4953
|
-
var kf = gt(() => import("./dist-
|
|
4953
|
+
var kf = gt(() => import("./dist-DEukRl4M.js").then((e) => ({ default: e.DotLottieReact }))), Af = {
|
|
4954
4954
|
"first-use": {
|
|
4955
4955
|
iconSize: 56,
|
|
4956
4956
|
padding: "py-20",
|
|
@@ -7076,27 +7076,81 @@ function Ym({ id: e, value: t, onChange: n, type: r = "text", placeholder: i, di
|
|
|
7076
7076
|
});
|
|
7077
7077
|
}
|
|
7078
7078
|
//#endregion
|
|
7079
|
+
//#region src/base/partials/FormSection/index.tsx
|
|
7080
|
+
function Xm({ id: e, title: t, description: n, children: r, defaultCollapsed: i = !1, hasErrors: a = !1, errorCount: o }) {
|
|
7081
|
+
let { t: c } = De(), [l, u] = St(i && !a), d = `${e}-content`, f = !!t, p = !l || a;
|
|
7082
|
+
return /* @__PURE__ */ R("fieldset", {
|
|
7083
|
+
className: "border-border space-y-5 rounded-lg border p-6",
|
|
7084
|
+
children: [
|
|
7085
|
+
t && /* @__PURE__ */ L("legend", {
|
|
7086
|
+
className: "sr-only",
|
|
7087
|
+
children: t
|
|
7088
|
+
}),
|
|
7089
|
+
t && /* @__PURE__ */ R("div", {
|
|
7090
|
+
className: "-mt-2 flex items-center justify-between",
|
|
7091
|
+
children: [f ? /* @__PURE__ */ R(s, {
|
|
7092
|
+
variant: "ghost",
|
|
7093
|
+
size: "sm",
|
|
7094
|
+
onClick: () => !a && u(!l),
|
|
7095
|
+
"aria-expanded": p,
|
|
7096
|
+
"aria-controls": d,
|
|
7097
|
+
className: "-ml-2 flex items-center gap-2 px-2",
|
|
7098
|
+
disabled: a,
|
|
7099
|
+
children: [/* @__PURE__ */ L(Le, {
|
|
7100
|
+
icon: p ? Oe : Be,
|
|
7101
|
+
size: 14
|
|
7102
|
+
}), /* @__PURE__ */ L("span", {
|
|
7103
|
+
className: "text-foreground text-lg font-semibold",
|
|
7104
|
+
children: t
|
|
7105
|
+
})]
|
|
7106
|
+
}) : /* @__PURE__ */ L("h3", {
|
|
7107
|
+
className: "text-foreground text-lg font-semibold",
|
|
7108
|
+
children: t
|
|
7109
|
+
}), a && o !== void 0 && o > 0 && /* @__PURE__ */ R("span", {
|
|
7110
|
+
className: "text-destructive text-xs",
|
|
7111
|
+
children: [
|
|
7112
|
+
"(",
|
|
7113
|
+
o,
|
|
7114
|
+
" ",
|
|
7115
|
+
c(o === 1 ? "middag.ui.form.error_one" : "middag.ui.form.error_other"),
|
|
7116
|
+
")"
|
|
7117
|
+
]
|
|
7118
|
+
})]
|
|
7119
|
+
}),
|
|
7120
|
+
n && p && /* @__PURE__ */ L("p", {
|
|
7121
|
+
className: "text-muted-foreground text-xs",
|
|
7122
|
+
children: n
|
|
7123
|
+
}),
|
|
7124
|
+
/* @__PURE__ */ L("div", {
|
|
7125
|
+
id: d,
|
|
7126
|
+
className: j("transition-[opacity,height] duration-200 ease-[var(--ease-default)]", p ? "opacity-100" : "hidden opacity-0"),
|
|
7127
|
+
children: r
|
|
7128
|
+
})
|
|
7129
|
+
]
|
|
7130
|
+
});
|
|
7131
|
+
}
|
|
7132
|
+
//#endregion
|
|
7079
7133
|
//#region node_modules/react-hook-form/dist/index.esm.mjs
|
|
7080
|
-
var
|
|
7134
|
+
var Zm = (e) => e.type === "checkbox", Qm = (e) => e instanceof Date, $m = (e) => e == null, eh = (e) => typeof e == "object", q = (e) => !$m(e) && !Array.isArray(e) && eh(e) && !Qm(e), th = (e) => q(e) && e.target ? Zm(e.target) ? e.target.checked : e.target.value : e, nh = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), rh = (e) => {
|
|
7081
7135
|
let t = e.constructor && e.constructor.prototype;
|
|
7082
7136
|
return q(t) && t.hasOwnProperty("isPrototypeOf");
|
|
7083
|
-
},
|
|
7137
|
+
}, ih = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
|
|
7084
7138
|
function J(e) {
|
|
7085
7139
|
if (e instanceof Date) return new Date(e);
|
|
7086
7140
|
let t = typeof FileList < "u" && e instanceof FileList;
|
|
7087
|
-
if (
|
|
7141
|
+
if (ih && (e instanceof Blob || t)) return e;
|
|
7088
7142
|
let n = Array.isArray(e);
|
|
7089
|
-
if (!n && !(q(e) &&
|
|
7143
|
+
if (!n && !(q(e) && rh(e))) return e;
|
|
7090
7144
|
let r = n ? [] : Object.create(Object.getPrototypeOf(e));
|
|
7091
7145
|
for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = J(e[t]));
|
|
7092
7146
|
return r;
|
|
7093
7147
|
}
|
|
7094
|
-
var
|
|
7148
|
+
var ah = (e) => /^\w*$/.test(e), Y = (e) => e === void 0, oh = (e) => Array.isArray(e) ? e.filter(Boolean) : [], sh = (e) => oh(e.replace(/["|']|\]/g, "").split(/\.|\[/)), X = (e, t, n) => {
|
|
7095
7149
|
if (!t || !q(e)) return n;
|
|
7096
|
-
let r = (
|
|
7150
|
+
let r = (ah(t) ? [t] : sh(t)).reduce((e, t) => $m(e) ? void 0 : e[t], e);
|
|
7097
7151
|
return Y(r) || r === e ? Y(e[t]) ? n : e[t] : r;
|
|
7098
|
-
},
|
|
7099
|
-
let r = -1, i =
|
|
7152
|
+
}, ch = (e) => typeof e == "boolean", lh = (e) => typeof e == "function", Z = (e, t, n) => {
|
|
7153
|
+
let r = -1, i = ah(t) ? [t] : sh(t), a = i.length, o = a - 1;
|
|
7100
7154
|
for (; ++r < a;) {
|
|
7101
7155
|
let t = i[r], a = n;
|
|
7102
7156
|
if (r !== o) {
|
|
@@ -7106,20 +7160,20 @@ var ih = (e) => /^\w*$/.test(e), Y = (e) => e === void 0, ah = (e) => Array.isAr
|
|
|
7106
7160
|
if (t === "__proto__" || t === "constructor" || t === "prototype") return;
|
|
7107
7161
|
e[t] = a, e = e[t];
|
|
7108
7162
|
}
|
|
7109
|
-
},
|
|
7163
|
+
}, uh = {
|
|
7110
7164
|
BLUR: "blur",
|
|
7111
7165
|
FOCUS_OUT: "focusout",
|
|
7112
7166
|
CHANGE: "change",
|
|
7113
7167
|
SUBMIT: "submit",
|
|
7114
7168
|
TRIGGER: "trigger",
|
|
7115
7169
|
VALID: "valid"
|
|
7116
|
-
},
|
|
7170
|
+
}, dh = {
|
|
7117
7171
|
onBlur: "onBlur",
|
|
7118
7172
|
onChange: "onChange",
|
|
7119
7173
|
onSubmit: "onSubmit",
|
|
7120
7174
|
onTouched: "onTouched",
|
|
7121
7175
|
all: "all"
|
|
7122
|
-
},
|
|
7176
|
+
}, fh = {
|
|
7123
7177
|
max: "max",
|
|
7124
7178
|
min: "min",
|
|
7125
7179
|
maxLength: "maxLength",
|
|
@@ -7127,20 +7181,20 @@ var ih = (e) => /^\w*$/.test(e), Y = (e) => e === void 0, ah = (e) => Array.isAr
|
|
|
7127
7181
|
pattern: "pattern",
|
|
7128
7182
|
required: "required",
|
|
7129
7183
|
validate: "validate"
|
|
7130
|
-
},
|
|
7131
|
-
|
|
7132
|
-
var
|
|
7184
|
+
}, ph = "form", mh = "root", hh = F.createContext(null);
|
|
7185
|
+
hh.displayName = "HookFormControlContext";
|
|
7186
|
+
var gh = () => F.useContext(hh), _h = (e, t, n, r = !0) => {
|
|
7133
7187
|
let i = {};
|
|
7134
7188
|
for (let a in e) Object.defineProperty(i, a, { get: () => {
|
|
7135
7189
|
let i = a;
|
|
7136
|
-
return t._proxyFormState[i] !==
|
|
7190
|
+
return t._proxyFormState[i] !== dh.all && (t._proxyFormState[i] = !r || dh.all), n && (n[i] = !0), e[i];
|
|
7137
7191
|
} });
|
|
7138
7192
|
return i;
|
|
7139
|
-
},
|
|
7140
|
-
function
|
|
7193
|
+
}, vh = typeof window < "u" ? F.useLayoutEffect : F.useEffect, Q = (e) => typeof e == "string", yh = (e, t, n, r, i) => Q(e) ? (r && t.watch.add(e), X(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), X(n, e))) : (r && (t.watchAll = !0), n), bh = (e) => $m(e) || !eh(e);
|
|
7194
|
+
function xh(e, t, n = /* @__PURE__ */ new WeakSet()) {
|
|
7141
7195
|
if (e === t) return !0;
|
|
7142
|
-
if (
|
|
7143
|
-
if (
|
|
7196
|
+
if (bh(e) || bh(t)) return Object.is(e, t);
|
|
7197
|
+
if (Qm(e) && Qm(t)) return Object.is(e.getTime(), t.getTime());
|
|
7144
7198
|
let r = Object.keys(e), i = Object.keys(t);
|
|
7145
7199
|
if (r.length !== i.length) return !1;
|
|
7146
7200
|
if (n.has(e) || n.has(t)) return !0;
|
|
@@ -7150,19 +7204,19 @@ function bh(e, t, n = /* @__PURE__ */ new WeakSet()) {
|
|
|
7150
7204
|
if (!(i in t)) return !1;
|
|
7151
7205
|
if (i !== "ref") {
|
|
7152
7206
|
let e = t[i];
|
|
7153
|
-
if (
|
|
7207
|
+
if (Qm(r) && Qm(e) || (q(r) || Array.isArray(r)) && (q(e) || Array.isArray(e)) ? !xh(r, e, n) : !Object.is(r, e)) return !1;
|
|
7154
7208
|
}
|
|
7155
7209
|
}
|
|
7156
7210
|
return !0;
|
|
7157
7211
|
}
|
|
7158
|
-
function
|
|
7159
|
-
let t =
|
|
7212
|
+
function Sh(e) {
|
|
7213
|
+
let t = gh(), { control: n = t, name: r, defaultValue: i, disabled: a, exact: o, compute: s } = e || {}, c = F.useRef(i), l = F.useRef(s), u = F.useRef(void 0), d = F.useRef(n), f = F.useRef(r);
|
|
7160
7214
|
l.current = s;
|
|
7161
7215
|
let [p, m] = F.useState(() => {
|
|
7162
7216
|
let e = n._getWatch(r, c.current);
|
|
7163
7217
|
return l.current ? l.current(e) : e;
|
|
7164
7218
|
}), h = F.useCallback((e) => {
|
|
7165
|
-
let t =
|
|
7219
|
+
let t = yh(r, n._names, e || n._formValues, !1, c.current);
|
|
7166
7220
|
return l.current ? l.current(t) : t;
|
|
7167
7221
|
}, [
|
|
7168
7222
|
n._formValues,
|
|
@@ -7170,10 +7224,10 @@ function xh(e) {
|
|
|
7170
7224
|
r
|
|
7171
7225
|
]), g = F.useCallback((e) => {
|
|
7172
7226
|
if (!a) {
|
|
7173
|
-
let t =
|
|
7227
|
+
let t = yh(r, n._names, e || n._formValues, !1, c.current);
|
|
7174
7228
|
if (l.current) {
|
|
7175
7229
|
let e = l.current(t);
|
|
7176
|
-
|
|
7230
|
+
xh(e, u.current) || (m(e), u.current = e);
|
|
7177
7231
|
} else m(t);
|
|
7178
7232
|
}
|
|
7179
7233
|
}, [
|
|
@@ -7182,7 +7236,7 @@ function xh(e) {
|
|
|
7182
7236
|
a,
|
|
7183
7237
|
r
|
|
7184
7238
|
]);
|
|
7185
|
-
|
|
7239
|
+
vh(() => ((d.current !== n || !xh(f.current, r)) && (d.current = n, f.current = r, g()), n._subscribe({
|
|
7186
7240
|
name: r,
|
|
7187
7241
|
formState: { values: !0 },
|
|
7188
7242
|
exact: o,
|
|
@@ -7197,7 +7251,7 @@ function xh(e) {
|
|
|
7197
7251
|
]), F.useEffect(() => n._removeUnmounted());
|
|
7198
7252
|
let _ = d.current !== n, v = f.current, y = F.useMemo(() => {
|
|
7199
7253
|
if (a) return null;
|
|
7200
|
-
let e = !_ && !
|
|
7254
|
+
let e = !_ && !xh(v, r);
|
|
7201
7255
|
return _ || e ? h() : null;
|
|
7202
7256
|
}, [
|
|
7203
7257
|
a,
|
|
@@ -7208,15 +7262,15 @@ function xh(e) {
|
|
|
7208
7262
|
]);
|
|
7209
7263
|
return y === null ? p : y;
|
|
7210
7264
|
}
|
|
7211
|
-
var
|
|
7212
|
-
|
|
7213
|
-
var
|
|
7265
|
+
var Ch = F.createContext(null);
|
|
7266
|
+
Ch.displayName = "HookFormContext";
|
|
7267
|
+
var wh = (e, t, n, r, i) => t ? {
|
|
7214
7268
|
...n[e],
|
|
7215
7269
|
types: {
|
|
7216
7270
|
...n[e] && n[e].types ? n[e].types : {},
|
|
7217
7271
|
[r]: i || !0
|
|
7218
7272
|
}
|
|
7219
|
-
} : {},
|
|
7273
|
+
} : {}, Th = (e) => Array.isArray(e) ? e : [e], Eh = () => {
|
|
7220
7274
|
let e = [];
|
|
7221
7275
|
return {
|
|
7222
7276
|
get observers() {
|
|
@@ -7233,26 +7287,26 @@ var Ch = (e, t, n, r, i) => t ? {
|
|
|
7233
7287
|
}
|
|
7234
7288
|
};
|
|
7235
7289
|
};
|
|
7236
|
-
function
|
|
7290
|
+
function Dh(e, t) {
|
|
7237
7291
|
let n = {};
|
|
7238
7292
|
for (let r in e) if (e.hasOwnProperty(r)) {
|
|
7239
7293
|
let i = e[r], a = t[r];
|
|
7240
7294
|
if (i && q(i) && a) {
|
|
7241
|
-
let e =
|
|
7295
|
+
let e = Dh(i, a);
|
|
7242
7296
|
q(e) && (n[r] = e);
|
|
7243
7297
|
} else e[r] && (n[r] = a);
|
|
7244
7298
|
}
|
|
7245
7299
|
return n;
|
|
7246
7300
|
}
|
|
7247
|
-
var
|
|
7248
|
-
if (!
|
|
7301
|
+
var Oh = (e) => q(e) && !Object.keys(e).length, kh = (e) => e.type === "file", Ah = (e) => {
|
|
7302
|
+
if (!ih) return !1;
|
|
7249
7303
|
let t = e ? e.ownerDocument : 0;
|
|
7250
7304
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
7251
|
-
},
|
|
7252
|
-
function
|
|
7305
|
+
}, jh = (e) => e.type === "select-multiple", Mh = (e) => e.type === "radio", Nh = (e) => Mh(e) || Zm(e), Ph = (e) => Ah(e) && e.isConnected;
|
|
7306
|
+
function Fh(e, t) {
|
|
7253
7307
|
let n = t.slice(0, -1).length, r = 0;
|
|
7254
7308
|
for (; r < n;) {
|
|
7255
|
-
if (
|
|
7309
|
+
if ($m(e)) {
|
|
7256
7310
|
e = void 0;
|
|
7257
7311
|
break;
|
|
7258
7312
|
}
|
|
@@ -7260,65 +7314,65 @@ function Ph(e, t) {
|
|
|
7260
7314
|
}
|
|
7261
7315
|
return e;
|
|
7262
7316
|
}
|
|
7263
|
-
function
|
|
7317
|
+
function Ih(e) {
|
|
7264
7318
|
for (let t in e) if (e.hasOwnProperty(t) && !Y(e[t])) return !1;
|
|
7265
7319
|
return !0;
|
|
7266
7320
|
}
|
|
7267
7321
|
function $(e, t) {
|
|
7268
7322
|
if (Q(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
|
|
7269
|
-
let n = Array.isArray(t) ? t :
|
|
7270
|
-
return r && delete r[a], i !== 0 && (q(r) &&
|
|
7323
|
+
let n = Array.isArray(t) ? t : ah(t) ? [t] : sh(t), r = n.length === 1 ? e : Fh(e, n), i = n.length - 1, a = n[i];
|
|
7324
|
+
return r && delete r[a], i !== 0 && (q(r) && Oh(r) || Array.isArray(r) && Ih(r)) && $(e, n.slice(0, -1)), e;
|
|
7271
7325
|
}
|
|
7272
|
-
var
|
|
7273
|
-
for (let t in e) if (
|
|
7326
|
+
var Lh = (e) => {
|
|
7327
|
+
for (let t in e) if (lh(e[t])) return !0;
|
|
7274
7328
|
return !1;
|
|
7275
7329
|
};
|
|
7276
|
-
function
|
|
7277
|
-
return Array.isArray(e) || q(e) && !
|
|
7330
|
+
function Rh(e) {
|
|
7331
|
+
return Array.isArray(e) || q(e) && !Lh(e);
|
|
7278
7332
|
}
|
|
7279
|
-
function
|
|
7333
|
+
function zh(e, t = {}) {
|
|
7280
7334
|
for (let n in e) {
|
|
7281
7335
|
let r = e[n];
|
|
7282
|
-
|
|
7336
|
+
Rh(r) ? (t[n] = Array.isArray(r) ? [] : {}, zh(r, t[n])) : Y(r) || (t[n] = !0);
|
|
7283
7337
|
}
|
|
7284
7338
|
return t;
|
|
7285
7339
|
}
|
|
7286
|
-
function
|
|
7340
|
+
function Bh(e) {
|
|
7287
7341
|
if (e !== !1) {
|
|
7288
7342
|
if (e === !0) return !0;
|
|
7289
7343
|
if (Array.isArray(e)) {
|
|
7290
|
-
let t = e.map((e) =>
|
|
7344
|
+
let t = e.map((e) => Bh(e));
|
|
7291
7345
|
return t.some((e) => e !== void 0) ? t : void 0;
|
|
7292
7346
|
}
|
|
7293
7347
|
if (q(e)) {
|
|
7294
7348
|
let t = {};
|
|
7295
7349
|
for (let n in e) {
|
|
7296
|
-
let r =
|
|
7350
|
+
let r = Bh(e[n]);
|
|
7297
7351
|
Y(r) || (t[n] = r);
|
|
7298
7352
|
}
|
|
7299
7353
|
return Object.keys(t).length ? t : void 0;
|
|
7300
7354
|
}
|
|
7301
7355
|
}
|
|
7302
7356
|
}
|
|
7303
|
-
function
|
|
7304
|
-
n ||=
|
|
7357
|
+
function Vh(e, t, n) {
|
|
7358
|
+
n ||= zh(t);
|
|
7305
7359
|
for (let r in e) {
|
|
7306
7360
|
let i = e[r];
|
|
7307
|
-
if (
|
|
7361
|
+
if (Rh(i)) Y(t) || bh(n[r]) ? n[r] = zh(i, Array.isArray(i) ? [] : {}) : Vh(i, $m(t) ? {} : t[r], n[r]);
|
|
7308
7362
|
else {
|
|
7309
7363
|
let e = t[r];
|
|
7310
|
-
n[r] = !
|
|
7364
|
+
n[r] = !xh(i, e);
|
|
7311
7365
|
}
|
|
7312
7366
|
}
|
|
7313
|
-
return
|
|
7367
|
+
return Bh(n) || {};
|
|
7314
7368
|
}
|
|
7315
|
-
var
|
|
7369
|
+
var Hh = {
|
|
7316
7370
|
value: !1,
|
|
7317
7371
|
isValid: !1
|
|
7318
|
-
},
|
|
7372
|
+
}, Uh = {
|
|
7319
7373
|
value: !0,
|
|
7320
7374
|
isValid: !0
|
|
7321
|
-
},
|
|
7375
|
+
}, Wh = (e) => {
|
|
7322
7376
|
if (Array.isArray(e)) {
|
|
7323
7377
|
if (e.length > 1) {
|
|
7324
7378
|
let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
|
|
@@ -7327,24 +7381,24 @@ var Vh = {
|
|
|
7327
7381
|
isValid: !!t.length
|
|
7328
7382
|
};
|
|
7329
7383
|
}
|
|
7330
|
-
return e[0].checked && !e[0].disabled ? e[0].attributes && !Y(e[0].attributes.value) ? Y(e[0].value) || e[0].value === "" ?
|
|
7384
|
+
return e[0].checked && !e[0].disabled ? e[0].attributes && !Y(e[0].attributes.value) ? Y(e[0].value) || e[0].value === "" ? Uh : {
|
|
7331
7385
|
value: e[0].value,
|
|
7332
7386
|
isValid: !0
|
|
7333
|
-
} :
|
|
7387
|
+
} : Uh : Hh;
|
|
7334
7388
|
}
|
|
7335
|
-
return
|
|
7336
|
-
},
|
|
7389
|
+
return Hh;
|
|
7390
|
+
}, Gh = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => Y(e) ? e : t ? e === "" ? NaN : e && +e : n && Q(e) ? new Date(e) : r ? r(e) : e, Kh = {
|
|
7337
7391
|
isValid: !1,
|
|
7338
7392
|
value: null
|
|
7339
|
-
},
|
|
7393
|
+
}, qh = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
|
|
7340
7394
|
isValid: !0,
|
|
7341
7395
|
value: t.value
|
|
7342
|
-
} : e,
|
|
7343
|
-
function
|
|
7396
|
+
} : e, Kh) : Kh;
|
|
7397
|
+
function Jh(e) {
|
|
7344
7398
|
let t = e.ref;
|
|
7345
|
-
return
|
|
7399
|
+
return kh(t) ? t.files : Mh(t) ? qh(e.refs).value : jh(t) ? [...t.selectedOptions].map(({ value: e }) => e) : Zm(t) ? Wh(e.refs).value : Gh(Y(t.value) ? e.ref.value : t.value, e);
|
|
7346
7400
|
}
|
|
7347
|
-
var
|
|
7401
|
+
var Yh = (e, t, n, r) => {
|
|
7348
7402
|
let i = {};
|
|
7349
7403
|
for (let n of e) {
|
|
7350
7404
|
let e = X(t, n);
|
|
@@ -7356,27 +7410,27 @@ var Jh = (e, t, n, r) => {
|
|
|
7356
7410
|
fields: i,
|
|
7357
7411
|
shouldUseNativeValidation: r
|
|
7358
7412
|
};
|
|
7359
|
-
},
|
|
7360
|
-
isOnSubmit: !e || e ===
|
|
7361
|
-
isOnBlur: e ===
|
|
7362
|
-
isOnChange: e ===
|
|
7363
|
-
isOnAll: e ===
|
|
7364
|
-
isOnTouch: e ===
|
|
7365
|
-
}),
|
|
7413
|
+
}, Xh = (e) => e instanceof RegExp, Zh = (e) => Y(e) ? e : Xh(e) ? e.source : q(e) ? Xh(e.value) ? e.value.source : e.value : e, Qh = (e) => ({
|
|
7414
|
+
isOnSubmit: !e || e === dh.onSubmit,
|
|
7415
|
+
isOnBlur: e === dh.onBlur,
|
|
7416
|
+
isOnChange: e === dh.onChange,
|
|
7417
|
+
isOnAll: e === dh.all,
|
|
7418
|
+
isOnTouch: e === dh.onTouched
|
|
7419
|
+
}), $h = "AsyncFunction", eg = (e) => !!e && !!e.validate && !!(lh(e.validate) && e.validate.constructor.name === $h || q(e.validate) && Object.values(e.validate).find((e) => e.constructor.name === $h)), tg = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), ng = (e, t, n) => !n && (t.watchAll || t.watch.has(e) || [...t.watch].some((t) => e.startsWith(t) && /^\.\w+/.test(e.slice(t.length)))), rg = (e, t, n, r) => {
|
|
7366
7420
|
for (let i of n || Object.keys(e)) {
|
|
7367
7421
|
let n = X(e, i);
|
|
7368
7422
|
if (n) {
|
|
7369
7423
|
let { _f: e, ...a } = n;
|
|
7370
7424
|
if (e) {
|
|
7371
7425
|
if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
|
|
7372
|
-
if (
|
|
7373
|
-
} else if (q(a) &&
|
|
7426
|
+
if (rg(a, t)) break;
|
|
7427
|
+
} else if (q(a) && rg(a, t)) break;
|
|
7374
7428
|
}
|
|
7375
7429
|
}
|
|
7376
7430
|
};
|
|
7377
|
-
function
|
|
7431
|
+
function ig(e, t, n) {
|
|
7378
7432
|
let r = X(e, n);
|
|
7379
|
-
if (r ||
|
|
7433
|
+
if (r || ah(n)) return {
|
|
7380
7434
|
error: r,
|
|
7381
7435
|
name: n
|
|
7382
7436
|
};
|
|
@@ -7396,30 +7450,30 @@ function rg(e, t, n) {
|
|
|
7396
7450
|
}
|
|
7397
7451
|
return { name: n };
|
|
7398
7452
|
}
|
|
7399
|
-
var
|
|
7453
|
+
var ag = (e, t, n, r) => {
|
|
7400
7454
|
n(e);
|
|
7401
7455
|
let { name: i, ...a } = e;
|
|
7402
|
-
return
|
|
7403
|
-
},
|
|
7404
|
-
let r =
|
|
7405
|
-
return Z(r,
|
|
7456
|
+
return Oh(a) || r && Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((e) => t[e] === (!r || dh.all));
|
|
7457
|
+
}, og = (e, t, n) => !e || !t || e === t || Th(e).some((e) => e && (n ? e === t : e.startsWith(t) || t.startsWith(e))), sg = (e, t, n, r, i) => i.isOnAll ? !1 : !n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : (n ? r.isOnChange : i.isOnChange) ? e : !0, cg = (e, t) => !oh(X(e, t)).length && $(e, t), lg = (e, t, n) => {
|
|
7458
|
+
let r = Th(X(e, n));
|
|
7459
|
+
return Z(r, mh, t[n]), Z(e, n, r), e;
|
|
7406
7460
|
};
|
|
7407
|
-
function
|
|
7408
|
-
if (Q(e) || Array.isArray(e) && e.every(Q) ||
|
|
7461
|
+
function ug(e, t, n = "validate") {
|
|
7462
|
+
if (Q(e) || Array.isArray(e) && e.every(Q) || ch(e) && !e) return {
|
|
7409
7463
|
type: n,
|
|
7410
7464
|
message: Q(e) ? e : "",
|
|
7411
7465
|
ref: t
|
|
7412
7466
|
};
|
|
7413
7467
|
}
|
|
7414
|
-
var
|
|
7468
|
+
var dg = (e) => q(e) && !Xh(e) ? e : {
|
|
7415
7469
|
value: e,
|
|
7416
7470
|
message: ""
|
|
7417
|
-
},
|
|
7471
|
+
}, fg = async (e, t, n, r, i, a) => {
|
|
7418
7472
|
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 = X(n, h);
|
|
7419
7473
|
if (!_ || t.has(h)) return {};
|
|
7420
7474
|
let y = s ? s[0] : o, b = (e) => {
|
|
7421
|
-
i && y.reportValidity && (y.setCustomValidity(
|
|
7422
|
-
}, x = {}, S =
|
|
7475
|
+
i && y.reportValidity && (y.setCustomValidity(ch(e) ? "" : e || ""), y.reportValidity());
|
|
7476
|
+
}, x = {}, S = Mh(o), C = Zm(o), ee = S || C, w = (g || kh(o)) && Y(o.value) && Y(v) || Ah(o) && o.value === "" || v === "" || Array.isArray(v) && !v.length || g && typeof v == "number" && isNaN(v), T = wh.bind(null, h, r, x), E = (e, t, n, r = fh.maxLength, i = fh.minLength) => {
|
|
7423
7477
|
let a = e ? t : n;
|
|
7424
7478
|
x[h] = {
|
|
7425
7479
|
type: e ? r : i,
|
|
@@ -7428,71 +7482,71 @@ var ug = (e) => q(e) && !Yh(e) ? e : {
|
|
|
7428
7482
|
...T(e ? r : i, a)
|
|
7429
7483
|
};
|
|
7430
7484
|
};
|
|
7431
|
-
if (a ? !Array.isArray(v) || !v.length : c && (!ee && (w ||
|
|
7485
|
+
if (a ? !Array.isArray(v) || !v.length : c && (!ee && (w || $m(v)) || ch(v) && !v || C && !Wh(s).isValid || S && !qh(s).isValid)) {
|
|
7432
7486
|
let { value: e, message: t } = Q(c) ? {
|
|
7433
7487
|
value: !!c,
|
|
7434
7488
|
message: c
|
|
7435
|
-
} :
|
|
7489
|
+
} : dg(c);
|
|
7436
7490
|
if (e && (x[h] = {
|
|
7437
|
-
type:
|
|
7491
|
+
type: fh.required,
|
|
7438
7492
|
message: t,
|
|
7439
7493
|
ref: y,
|
|
7440
|
-
...T(
|
|
7494
|
+
...T(fh.required, t)
|
|
7441
7495
|
}, !r)) return b(t), x;
|
|
7442
7496
|
}
|
|
7443
|
-
if (!w && (
|
|
7444
|
-
let e, t, n =
|
|
7445
|
-
if (
|
|
7497
|
+
if (!w && (!$m(d) || !$m(f))) {
|
|
7498
|
+
let e, t, n = dg(f), i = dg(d);
|
|
7499
|
+
if (!$m(v) && !isNaN(v)) {
|
|
7446
7500
|
let r = o.valueAsNumber || v && +v;
|
|
7447
|
-
|
|
7501
|
+
$m(n.value) || (e = r > n.value), $m(i.value) || (t = r < i.value);
|
|
7448
7502
|
} else {
|
|
7449
7503
|
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";
|
|
7450
7504
|
Q(n.value) && v && (e = s ? a(v) > a(n.value) : c ? v > n.value : r > new Date(n.value)), Q(i.value) && v && (t = s ? a(v) < a(i.value) : c ? v < i.value : r < new Date(i.value));
|
|
7451
7505
|
}
|
|
7452
|
-
if ((e || t) && (E(!!e, n.message, i.message,
|
|
7506
|
+
if ((e || t) && (E(!!e, n.message, i.message, fh.max, fh.min), !r)) return b(x[h].message), x;
|
|
7453
7507
|
}
|
|
7454
7508
|
if ((l || u) && !w && (Q(v) || a && Array.isArray(v))) {
|
|
7455
|
-
let e =
|
|
7509
|
+
let e = dg(l), t = dg(u), n = !$m(e.value) && v.length > +e.value, i = !$m(t.value) && v.length < +t.value;
|
|
7456
7510
|
if ((n || i) && (E(n, e.message, t.message), !r)) return b(x[h].message), x;
|
|
7457
7511
|
}
|
|
7458
7512
|
if (p && !w && Q(v)) {
|
|
7459
|
-
let { value: e, message: t } =
|
|
7460
|
-
if (
|
|
7461
|
-
type:
|
|
7513
|
+
let { value: e, message: t } = dg(p);
|
|
7514
|
+
if (Xh(e) && !v.match(e) && (x[h] = {
|
|
7515
|
+
type: fh.pattern,
|
|
7462
7516
|
message: t,
|
|
7463
7517
|
ref: o,
|
|
7464
|
-
...T(
|
|
7518
|
+
...T(fh.pattern, t)
|
|
7465
7519
|
}, !r)) return b(t), x;
|
|
7466
7520
|
}
|
|
7467
7521
|
if (m) {
|
|
7468
|
-
if (
|
|
7469
|
-
let e =
|
|
7522
|
+
if (lh(m)) {
|
|
7523
|
+
let e = ug(await m(v, n), y);
|
|
7470
7524
|
if (e && (x[h] = {
|
|
7471
7525
|
...e,
|
|
7472
|
-
...T(
|
|
7526
|
+
...T(fh.validate, e.message)
|
|
7473
7527
|
}, !r)) return b(e.message), x;
|
|
7474
7528
|
} else if (q(m)) {
|
|
7475
7529
|
let e = {};
|
|
7476
7530
|
for (let t in m) {
|
|
7477
|
-
if (!
|
|
7478
|
-
let i =
|
|
7531
|
+
if (!Oh(e) && !r) break;
|
|
7532
|
+
let i = ug(await m[t](v, n), y, t);
|
|
7479
7533
|
i && (e = {
|
|
7480
7534
|
...i,
|
|
7481
7535
|
...T(t, i.message)
|
|
7482
7536
|
}, b(i.message), r && (x[h] = e));
|
|
7483
7537
|
}
|
|
7484
|
-
if (!
|
|
7538
|
+
if (!Oh(e) && (x[h] = {
|
|
7485
7539
|
ref: y,
|
|
7486
7540
|
...e
|
|
7487
7541
|
}, !r)) return x;
|
|
7488
7542
|
}
|
|
7489
7543
|
}
|
|
7490
7544
|
return b(!0), x;
|
|
7491
|
-
}, fg = {
|
|
7492
|
-
mode: uh.onSubmit,
|
|
7493
|
-
reValidateMode: uh.onChange,
|
|
7494
|
-
shouldFocusError: !0
|
|
7495
7545
|
}, pg = {
|
|
7546
|
+
mode: dh.onSubmit,
|
|
7547
|
+
reValidateMode: dh.onChange,
|
|
7548
|
+
shouldFocusError: !0
|
|
7549
|
+
}, mg = {
|
|
7496
7550
|
submitCount: 0,
|
|
7497
7551
|
isDirty: !1,
|
|
7498
7552
|
isReady: !1,
|
|
@@ -7505,13 +7559,13 @@ var ug = (e) => q(e) && !Yh(e) ? e : {
|
|
|
7505
7559
|
dirtyFields: {},
|
|
7506
7560
|
validatingFields: {}
|
|
7507
7561
|
};
|
|
7508
|
-
function
|
|
7562
|
+
function hg(e = {}) {
|
|
7509
7563
|
let t = {
|
|
7510
|
-
...
|
|
7564
|
+
...pg,
|
|
7511
7565
|
...e
|
|
7512
7566
|
}, n = {
|
|
7513
|
-
...J(
|
|
7514
|
-
isLoading:
|
|
7567
|
+
...J(mg),
|
|
7568
|
+
isLoading: lh(t.defaultValues),
|
|
7515
7569
|
errors: t.errors || {},
|
|
7516
7570
|
disabled: t.disabled || !1
|
|
7517
7571
|
}, r = {}, i = (q(t.defaultValues) || q(t.values)) && J(t.defaultValues || t.values) || {}, a = t.shouldUnregister ? {} : J(i), o = {
|
|
@@ -7535,17 +7589,17 @@ function mg(e = {}) {
|
|
|
7535
7589
|
isValid: !1,
|
|
7536
7590
|
errors: !1
|
|
7537
7591
|
}, d = { ...u }, f = { ...d }, p = {
|
|
7538
|
-
array:
|
|
7539
|
-
state:
|
|
7540
|
-
}, m = t.criteriaMode ===
|
|
7592
|
+
array: Eh(),
|
|
7593
|
+
state: Eh()
|
|
7594
|
+
}, m = t.criteriaMode === dh.all, h = (e) => (t) => {
|
|
7541
7595
|
clearTimeout(l), l = setTimeout(e, t);
|
|
7542
7596
|
}, g = async (e) => {
|
|
7543
7597
|
if (!o.keepIsValid && !t.disabled && (d.isValid || f.isValid || e)) {
|
|
7544
7598
|
let e;
|
|
7545
|
-
t.resolver ? (e =
|
|
7599
|
+
t.resolver ? (e = Oh((await w()).errors), _()) : e = await D({
|
|
7546
7600
|
fields: r,
|
|
7547
7601
|
onlyCheckValid: !0,
|
|
7548
|
-
eventType:
|
|
7602
|
+
eventType: uh.VALID
|
|
7549
7603
|
}), e !== n.isValid && p.state.next({ isValid: e });
|
|
7550
7604
|
}
|
|
7551
7605
|
}, _ = (e, r) => {
|
|
@@ -7553,10 +7607,10 @@ function mg(e = {}) {
|
|
|
7553
7607
|
e && (r ? Z(n.validatingFields, e, r) : $(n.validatingFields, e));
|
|
7554
7608
|
}), p.state.next({
|
|
7555
7609
|
validatingFields: n.validatingFields,
|
|
7556
|
-
isValidating: !
|
|
7610
|
+
isValidating: !Oh(n.validatingFields)
|
|
7557
7611
|
}));
|
|
7558
7612
|
}, v = () => {
|
|
7559
|
-
n.dirtyFields =
|
|
7613
|
+
n.dirtyFields = Vh(i, a);
|
|
7560
7614
|
}, y = (e, i = [], s, c, l = !0, u = !0) => {
|
|
7561
7615
|
if (c && s && !t.disabled) {
|
|
7562
7616
|
if (o.action = !0, u && Array.isArray(X(r, e))) {
|
|
@@ -7565,7 +7619,7 @@ function mg(e = {}) {
|
|
|
7565
7619
|
}
|
|
7566
7620
|
if (u && Array.isArray(X(n.errors, e))) {
|
|
7567
7621
|
let t = s(X(n.errors, e), c.argA, c.argB);
|
|
7568
|
-
l && Z(n.errors, e, t),
|
|
7622
|
+
l && Z(n.errors, e, t), cg(n.errors, e);
|
|
7569
7623
|
}
|
|
7570
7624
|
if ((d.touchedFields || f.touchedFields) && u && Array.isArray(X(n.touchedFields, e))) {
|
|
7571
7625
|
let t = s(X(n.touchedFields, e), c.argA, c.argB);
|
|
@@ -7590,14 +7644,14 @@ function mg(e = {}) {
|
|
|
7590
7644
|
let l = X(r, e);
|
|
7591
7645
|
if (l) {
|
|
7592
7646
|
let r = Y(X(a, e)), u = X(a, e, Y(s) ? X(i, e) : s);
|
|
7593
|
-
Y(u) || c && c.defaultChecked || t ? Z(a, e, t ? u :
|
|
7647
|
+
Y(u) || c && c.defaultChecked || t ? Z(a, e, t ? u : Jh(l._f)) : ne(e, u), o.mount && !o.action && (g(), r && n.isDirty && (d.isDirty || f.isDirty) && (k() || (n.isDirty = !1, p.state.next({ ...n }))));
|
|
7594
7648
|
}
|
|
7595
7649
|
}, C = (e, r, a, o, s) => {
|
|
7596
7650
|
let c = !1, l = !1, u = { name: e };
|
|
7597
7651
|
if (!t.disabled) {
|
|
7598
7652
|
if (!a || o) {
|
|
7599
7653
|
(d.isDirty || f.isDirty) && (l = n.isDirty, n.isDirty = u.isDirty = k(), c = l !== u.isDirty);
|
|
7600
|
-
let t =
|
|
7654
|
+
let t = xh(X(i, e), r);
|
|
7601
7655
|
l = !!X(n.dirtyFields, e), t ? $(n.dirtyFields, e) : Z(n.dirtyFields, e, !0), u.dirtyFields = n.dirtyFields, c ||= (d.dirtyFields || f.dirtyFields) && l !== !t;
|
|
7602
7656
|
}
|
|
7603
7657
|
if (a) {
|
|
@@ -7608,11 +7662,11 @@ function mg(e = {}) {
|
|
|
7608
7662
|
}
|
|
7609
7663
|
return c ? u : {};
|
|
7610
7664
|
}, ee = (e, r, i, a) => {
|
|
7611
|
-
let o = X(n.errors, e), s = (d.isValid || f.isValid) &&
|
|
7612
|
-
if (t.delayError && i ? (c = h(() => b(e, i)), c(t.delayError)) : (clearTimeout(l), c = null, i ? Z(n.errors, e, i) : $(n.errors, e)), (i ? !
|
|
7665
|
+
let o = X(n.errors, e), s = (d.isValid || f.isValid) && ch(r) && n.isValid !== r;
|
|
7666
|
+
if (t.delayError && i ? (c = h(() => b(e, i)), c(t.delayError)) : (clearTimeout(l), c = null, i ? Z(n.errors, e, i) : $(n.errors, e)), (i ? !xh(o, i) : o) || !Oh(a) || s) {
|
|
7613
7667
|
let t = {
|
|
7614
7668
|
...a,
|
|
7615
|
-
...s &&
|
|
7669
|
+
...s && ch(r) ? { isValid: r } : {},
|
|
7616
7670
|
errors: n.errors,
|
|
7617
7671
|
name: e
|
|
7618
7672
|
};
|
|
@@ -7621,7 +7675,7 @@ function mg(e = {}) {
|
|
|
7621
7675
|
...t
|
|
7622
7676
|
}, p.state.next(t);
|
|
7623
7677
|
}
|
|
7624
|
-
}, w = async (e) => (_(e, !0), await t.resolver(a, t.context,
|
|
7678
|
+
}, w = async (e) => (_(e, !0), await t.resolver(a, t.context, Yh(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))), T = async (e) => {
|
|
7625
7679
|
let { errors: t } = await w(e);
|
|
7626
7680
|
if (_(e), e) for (let r of e) {
|
|
7627
7681
|
let e = X(t, r);
|
|
@@ -7637,14 +7691,14 @@ function mg(e = {}) {
|
|
|
7637
7691
|
name: t,
|
|
7638
7692
|
eventType: r
|
|
7639
7693
|
});
|
|
7640
|
-
if (q(i)) for (let e in i) i[e] && fe(`${
|
|
7694
|
+
if (q(i)) for (let e in i) i[e] && fe(`${ph}.${e}`, {
|
|
7641
7695
|
message: Q(i.message) ? i.message : "",
|
|
7642
|
-
type:
|
|
7696
|
+
type: fh.validate
|
|
7643
7697
|
});
|
|
7644
|
-
else Q(i) || !i ? fe(
|
|
7698
|
+
else Q(i) || !i ? fe(ph, {
|
|
7645
7699
|
message: i || "",
|
|
7646
|
-
type:
|
|
7647
|
-
}) : de(
|
|
7700
|
+
type: fh.validate
|
|
7701
|
+
}) : de(ph);
|
|
7648
7702
|
return i;
|
|
7649
7703
|
}
|
|
7650
7704
|
return !0;
|
|
@@ -7661,12 +7715,12 @@ function mg(e = {}) {
|
|
|
7661
7715
|
if (u) {
|
|
7662
7716
|
let { _f: r, ...f } = u;
|
|
7663
7717
|
if (r) {
|
|
7664
|
-
let o = s.array.has(r.name), c = u._f &&
|
|
7718
|
+
let o = s.array.has(r.name), c = u._f && eg(u._f);
|
|
7665
7719
|
c && d.validatingFields && _([r.name], !0);
|
|
7666
|
-
let f = await
|
|
7667
|
-
if (c && d.validatingFields && _([r.name]), f[r.name] && (l.valid = !1, i) || (!i && (X(f, r.name) ? o ?
|
|
7720
|
+
let f = await fg(u, s.disabled, a, m, t.shouldUseNativeValidation && !i, o);
|
|
7721
|
+
if (c && d.validatingFields && _([r.name]), f[r.name] && (l.valid = !1, i) || (!i && (X(f, r.name) ? o ? lg(n.errors, f, r.name) : Z(n.errors, r.name, f[r.name]) : $(n.errors, r.name)), e.shouldUseNativeValidation && f[r.name])) break;
|
|
7668
7722
|
}
|
|
7669
|
-
!
|
|
7723
|
+
!Oh(f) && await D({
|
|
7670
7724
|
context: l,
|
|
7671
7725
|
onlyCheckValid: i,
|
|
7672
7726
|
fields: f,
|
|
@@ -7679,16 +7733,16 @@ function mg(e = {}) {
|
|
|
7679
7733
|
}, O = () => {
|
|
7680
7734
|
for (let e of s.unMount) {
|
|
7681
7735
|
let t = X(r, e);
|
|
7682
|
-
t && (t._f.refs ? t._f.refs.every((e) => !
|
|
7736
|
+
t && (t._f.refs ? t._f.refs.every((e) => !Ph(e)) : !Ph(t._f.ref)) && ge(e);
|
|
7683
7737
|
}
|
|
7684
7738
|
s.unMount = /* @__PURE__ */ new Set();
|
|
7685
|
-
}, k = (e, n) => !t.disabled && (e && n && Z(a, e, n), !
|
|
7739
|
+
}, k = (e, n) => !t.disabled && (e && n && Z(a, e, n), !xh(le(), i)), A = (e, t, n) => yh(e, s, { ...o.mount ? a : Y(t) ? i : Q(e) ? { [e]: t } : t }, n, t), te = (e) => oh(X(o.mount ? a : i, e, t.shouldUnregister ? X(i, e, []) : [])), ne = (e, t, n = {}) => {
|
|
7686
7740
|
let i = X(r, e), o = t;
|
|
7687
7741
|
if (i) {
|
|
7688
7742
|
let n = i._f;
|
|
7689
|
-
n && (!n.disabled && Z(a, e,
|
|
7743
|
+
n && (!n.disabled && Z(a, e, Gh(t, n)), o = Ah(n.ref) && $m(t) ? "" : t, jh(n.ref) ? [...n.ref.options].forEach((e) => e.selected = o.includes(e.value)) : n.refs ? Zm(n.ref) ? n.refs.forEach((e) => {
|
|
7690
7744
|
(!e.defaultChecked || !e.disabled) && (Array.isArray(o) ? e.checked = !!o.find((t) => t === e.value) : e.checked = o === e.value || !!o);
|
|
7691
|
-
}) : n.refs.forEach((e) => e.checked = e.value === o) :
|
|
7745
|
+
}) : n.refs.forEach((e) => e.checked = e.value === o) : kh(n.ref) ? n.ref.value = "" : (n.ref.value = o, n.ref.type || p.state.next({
|
|
7692
7746
|
name: e,
|
|
7693
7747
|
values: J(a)
|
|
7694
7748
|
})));
|
|
@@ -7698,10 +7752,10 @@ function mg(e = {}) {
|
|
|
7698
7752
|
for (let i in t) {
|
|
7699
7753
|
if (!t.hasOwnProperty(i)) return;
|
|
7700
7754
|
let a = t[i], o = e + "." + i, c = X(r, o);
|
|
7701
|
-
(s.array.has(e) || q(a) || c && !c._f) && !
|
|
7755
|
+
(s.array.has(e) || q(a) || c && !c._f) && !Qm(a) ? re(o, a, n) : ne(o, a, n);
|
|
7702
7756
|
}
|
|
7703
7757
|
}, ie = (e, t, i = {}) => {
|
|
7704
|
-
let c = X(r, e), l = s.array.has(e), u = J(t), m =
|
|
7758
|
+
let c = X(r, e), l = s.array.has(e), u = J(t), m = xh(X(a, e), u);
|
|
7705
7759
|
if (Z(a, e, u), l) p.array.next({
|
|
7706
7760
|
name: e,
|
|
7707
7761
|
values: J(a)
|
|
@@ -7711,11 +7765,11 @@ function mg(e = {}) {
|
|
|
7711
7765
|
isDirty: k(e, u)
|
|
7712
7766
|
}));
|
|
7713
7767
|
else {
|
|
7714
|
-
let t = Array.isArray(u) && !u.length ||
|
|
7715
|
-
!c || c._f ||
|
|
7768
|
+
let t = Array.isArray(u) && !u.length || Oh(u);
|
|
7769
|
+
!c || c._f || $m(u) || t ? ne(e, u, i) : re(e, u, i);
|
|
7716
7770
|
}
|
|
7717
7771
|
if (!m) {
|
|
7718
|
-
let t =
|
|
7772
|
+
let t = ng(e, s);
|
|
7719
7773
|
p.state.next({
|
|
7720
7774
|
...t && n,
|
|
7721
7775
|
name: o.mount || t ? e : void 0,
|
|
@@ -7723,8 +7777,8 @@ function mg(e = {}) {
|
|
|
7723
7777
|
});
|
|
7724
7778
|
}
|
|
7725
7779
|
}, ae = (e) => {
|
|
7726
|
-
let t =
|
|
7727
|
-
|
|
7780
|
+
let t = lh(e) ? e(a) : e;
|
|
7781
|
+
xh(a, t) || (a = {
|
|
7728
7782
|
...a,
|
|
7729
7783
|
...t
|
|
7730
7784
|
}, p.state.next({
|
|
@@ -7734,12 +7788,12 @@ function mg(e = {}) {
|
|
|
7734
7788
|
}, oe = async (i) => {
|
|
7735
7789
|
o.mount = !0;
|
|
7736
7790
|
let l = i.target, u = l.name, h = !0, v = X(r, u), y = (e) => {
|
|
7737
|
-
h = Number.isNaN(e) ||
|
|
7738
|
-
}, b =
|
|
7791
|
+
h = Number.isNaN(e) || Qm(e) && isNaN(e.getTime()) || xh(e, X(a, u, e));
|
|
7792
|
+
}, b = Qh(t.mode), x = Qh(t.reValidateMode);
|
|
7739
7793
|
if (v) {
|
|
7740
|
-
let o, S, T = l.type ?
|
|
7794
|
+
let o, S, T = l.type ? Jh(v._f) : th(i), O = i.type === uh.BLUR || i.type === uh.FOCUS_OUT, k = !tg(v._f) && !e.validate && !t.resolver && !X(n.errors, u) && !v._f.deps || sg(O, X(n.touchedFields, u), n.isSubmitted, x, b), A = ng(u, s, O);
|
|
7741
7795
|
Z(a, u, T), O ? (!l || !l.readOnly) && (v._f.onBlur && v._f.onBlur(i), c && c(0)) : v._f.onChange && v._f.onChange(i);
|
|
7742
|
-
let te = C(u, T, O), ne = !
|
|
7796
|
+
let te = C(u, T, O), ne = !Oh(te) || A;
|
|
7743
7797
|
if (!O && p.state.next({
|
|
7744
7798
|
name: u,
|
|
7745
7799
|
type: i.type,
|
|
@@ -7754,10 +7808,10 @@ function mg(e = {}) {
|
|
|
7754
7808
|
}), !O && A && p.state.next({ ...n }), t.resolver) {
|
|
7755
7809
|
let { errors: e } = await w([u]);
|
|
7756
7810
|
if (_([u]), y(T), h) {
|
|
7757
|
-
let t =
|
|
7758
|
-
o = i.error, u = i.name, S =
|
|
7811
|
+
let t = ig(n.errors, r, u), i = ig(e, r, t.name || u);
|
|
7812
|
+
o = i.error, u = i.name, S = Oh(e);
|
|
7759
7813
|
}
|
|
7760
|
-
} else _([u], !0), o = (await
|
|
7814
|
+
} else _([u], !0), o = (await fg(v, s.disabled, a, m, t.shouldUseNativeValidation))[u], _([u]), y(T), h && (o ? S = !1 : (d.isValid || f.isValid) && (S = await D({
|
|
7761
7815
|
fields: r,
|
|
7762
7816
|
onlyCheckValid: !0,
|
|
7763
7817
|
name: u,
|
|
@@ -7768,29 +7822,29 @@ function mg(e = {}) {
|
|
|
7768
7822
|
}, se = (e, t) => {
|
|
7769
7823
|
if (X(n.errors, t) && e.focus) return e.focus(), 1;
|
|
7770
7824
|
}, ce = async (e, i = {}) => {
|
|
7771
|
-
let a, o, c =
|
|
7825
|
+
let a, o, c = Th(e);
|
|
7772
7826
|
if (t.resolver) {
|
|
7773
7827
|
let t = await T(Y(e) ? e : c);
|
|
7774
|
-
a =
|
|
7828
|
+
a = Oh(t), o = e ? !c.some((e) => X(t, e)) : a;
|
|
7775
7829
|
} else e ? (o = (await Promise.all(c.map(async (e) => {
|
|
7776
7830
|
let t = X(r, e);
|
|
7777
7831
|
return await D({
|
|
7778
7832
|
fields: t && t._f ? { [e]: t } : t,
|
|
7779
|
-
eventType:
|
|
7833
|
+
eventType: uh.TRIGGER
|
|
7780
7834
|
});
|
|
7781
7835
|
}))).every(Boolean), !(!o && !n.isValid) && g()) : o = a = await D({
|
|
7782
7836
|
fields: r,
|
|
7783
7837
|
name: e,
|
|
7784
|
-
eventType:
|
|
7838
|
+
eventType: uh.TRIGGER
|
|
7785
7839
|
});
|
|
7786
7840
|
return p.state.next({
|
|
7787
7841
|
...!Q(e) || (d.isValid || f.isValid) && a !== n.isValid ? {} : { name: e },
|
|
7788
7842
|
...t.resolver || !e ? { isValid: a } : {},
|
|
7789
7843
|
errors: n.errors
|
|
7790
|
-
}), i.shouldFocus && !o &&
|
|
7844
|
+
}), i.shouldFocus && !o && rg(r, se, e ? c : s.mount), o;
|
|
7791
7845
|
}, le = (e, t) => {
|
|
7792
7846
|
let r = { ...o.mount ? a : i };
|
|
7793
|
-
return t && (r =
|
|
7847
|
+
return t && (r = Dh(t.dirtyFields ? n.dirtyFields : n.touchedFields, r)), Y(e) ? r : Q(e) ? X(r, e) : e.map((e) => X(r, e));
|
|
7794
7848
|
}, ue = (e, t) => ({
|
|
7795
7849
|
invalid: !!X((t || n).errors, e),
|
|
7796
7850
|
isDirty: !!X((t || n).dirtyFields, e),
|
|
@@ -7798,7 +7852,7 @@ function mg(e = {}) {
|
|
|
7798
7852
|
isValidating: !!X(n.validatingFields, e),
|
|
7799
7853
|
isTouched: !!X((t || n).touchedFields, e)
|
|
7800
7854
|
}), de = (e) => {
|
|
7801
|
-
let t = e ?
|
|
7855
|
+
let t = e ? Th(e) : void 0;
|
|
7802
7856
|
t?.forEach((e) => $(n.errors, e)), t ? t.forEach((e) => {
|
|
7803
7857
|
p.state.next({
|
|
7804
7858
|
name: e,
|
|
@@ -7816,8 +7870,8 @@ function mg(e = {}) {
|
|
|
7816
7870
|
errors: n.errors,
|
|
7817
7871
|
isValid: !1
|
|
7818
7872
|
}), i && i.shouldFocus && a && a.focus && a.focus();
|
|
7819
|
-
}, pe = (e, t) =>
|
|
7820
|
-
if (
|
|
7873
|
+
}, pe = (e, t) => lh(e) ? p.state.subscribe({ next: (n) => "values" in n && e(n.values || A(void 0, t), n) }) : A(e, t, !0), me = (e) => p.state.subscribe({ next: (t) => {
|
|
7874
|
+
if (og(e.name, t.name, e.exact) && ag(t, e.formState || d, Ee, e.reRenderRoot)) {
|
|
7821
7875
|
let r = { ...a };
|
|
7822
7876
|
e.callback({
|
|
7823
7877
|
values: r,
|
|
@@ -7836,18 +7890,18 @@ function mg(e = {}) {
|
|
|
7836
7890
|
...e.formState
|
|
7837
7891
|
}
|
|
7838
7892
|
})), ge = (e, o = {}) => {
|
|
7839
|
-
for (let c of e ?
|
|
7893
|
+
for (let c of e ? Th(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);
|
|
7840
7894
|
p.state.next({ values: J(a) }), p.state.next({
|
|
7841
7895
|
...n,
|
|
7842
7896
|
...o.keepDirty ? { isDirty: k() } : {}
|
|
7843
7897
|
}), !o.keepIsValid && g();
|
|
7844
7898
|
}, _e = ({ disabled: e, name: t }) => {
|
|
7845
|
-
if (
|
|
7899
|
+
if (ch(e) && o.mount || e || s.disabled.has(t)) {
|
|
7846
7900
|
let n = s.disabled.has(t) !== !!e;
|
|
7847
7901
|
e ? s.disabled.add(t) : s.disabled.delete(t), n && o.mount && !o.action && g();
|
|
7848
7902
|
}
|
|
7849
7903
|
}, ve = (e, n = {}) => {
|
|
7850
|
-
let a = X(r, e), c =
|
|
7904
|
+
let a = X(r, e), c = ch(n.disabled) || ch(t.disabled), l = !s.registerName.has(e) && a && a._f && !a._f.mount;
|
|
7851
7905
|
return Z(r, e, {
|
|
7852
7906
|
...a || {},
|
|
7853
7907
|
_f: {
|
|
@@ -7857,17 +7911,17 @@ function mg(e = {}) {
|
|
|
7857
7911
|
...n
|
|
7858
7912
|
}
|
|
7859
7913
|
}), s.mount.add(e), a && !l ? _e({
|
|
7860
|
-
disabled:
|
|
7914
|
+
disabled: ch(n.disabled) ? n.disabled : t.disabled,
|
|
7861
7915
|
name: e
|
|
7862
7916
|
}) : S(e, !0, n.value), {
|
|
7863
7917
|
...c ? { disabled: n.disabled || t.disabled } : {},
|
|
7864
7918
|
...t.progressive ? {
|
|
7865
7919
|
required: !!n.required,
|
|
7866
|
-
min:
|
|
7867
|
-
max:
|
|
7868
|
-
minLength:
|
|
7869
|
-
maxLength:
|
|
7870
|
-
pattern:
|
|
7920
|
+
min: Zh(n.min),
|
|
7921
|
+
max: Zh(n.max),
|
|
7922
|
+
minLength: Zh(n.minLength),
|
|
7923
|
+
maxLength: Zh(n.maxLength),
|
|
7924
|
+
pattern: Zh(n.pattern)
|
|
7871
7925
|
} : {},
|
|
7872
7926
|
name: e,
|
|
7873
7927
|
onChange: oe,
|
|
@@ -7875,13 +7929,13 @@ function mg(e = {}) {
|
|
|
7875
7929
|
ref: (c) => {
|
|
7876
7930
|
if (c) {
|
|
7877
7931
|
s.registerName.add(e), ve(e, n), s.registerName.delete(e), a = X(r, e);
|
|
7878
|
-
let t = Y(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o =
|
|
7932
|
+
let t = Y(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = Nh(t), l = a._f.refs || [];
|
|
7879
7933
|
if (o ? l.find((e) => e === t) : t === a._f.ref) return;
|
|
7880
7934
|
Z(r, e, { _f: {
|
|
7881
7935
|
...a._f,
|
|
7882
7936
|
...o ? {
|
|
7883
7937
|
refs: [
|
|
7884
|
-
...l.filter(
|
|
7938
|
+
...l.filter(Ph),
|
|
7885
7939
|
t,
|
|
7886
7940
|
...Array.isArray(X(i, e)) ? [{}] : []
|
|
7887
7941
|
],
|
|
@@ -7891,11 +7945,11 @@ function mg(e = {}) {
|
|
|
7891
7945
|
}
|
|
7892
7946
|
} : { ref: t }
|
|
7893
7947
|
} }), S(e, !1, void 0, t);
|
|
7894
|
-
} else a = X(r, e, {}), a._f && (a._f.mount = !1), (t.shouldUnregister || n.shouldUnregister) && !(
|
|
7948
|
+
} else a = X(r, e, {}), a._f && (a._f.mount = !1), (t.shouldUnregister || n.shouldUnregister) && !(nh(s.array, e) && o.action) && s.unMount.add(e);
|
|
7895
7949
|
}
|
|
7896
7950
|
};
|
|
7897
|
-
}, ye = () => t.shouldFocusError &&
|
|
7898
|
-
|
|
7951
|
+
}, ye = () => t.shouldFocusError && rg(r, se, s.mount), be = (e) => {
|
|
7952
|
+
ch(e) && (p.state.next({ disabled: e }), rg(r, (t, n) => {
|
|
7899
7953
|
let i = X(r, n);
|
|
7900
7954
|
i && (t.disabled = i._f.disabled || e, Array.isArray(i._f.refs) && i._f.refs.forEach((t) => {
|
|
7901
7955
|
t.disabled = i._f.disabled || e;
|
|
@@ -7910,10 +7964,10 @@ function mg(e = {}) {
|
|
|
7910
7964
|
_(), n.errors = e, l = J(t);
|
|
7911
7965
|
} else await D({
|
|
7912
7966
|
fields: r,
|
|
7913
|
-
eventType:
|
|
7967
|
+
eventType: uh.SUBMIT
|
|
7914
7968
|
});
|
|
7915
7969
|
if (s.disabled.size) for (let e of s.disabled) $(l, e);
|
|
7916
|
-
if ($(n.errors,
|
|
7970
|
+
if ($(n.errors, mh), Oh(n.errors)) {
|
|
7917
7971
|
p.state.next({ errors: {} });
|
|
7918
7972
|
try {
|
|
7919
7973
|
await e(l, o);
|
|
@@ -7924,27 +7978,27 @@ function mg(e = {}) {
|
|
|
7924
7978
|
if (p.state.next({
|
|
7925
7979
|
isSubmitted: !0,
|
|
7926
7980
|
isSubmitting: !1,
|
|
7927
|
-
isSubmitSuccessful:
|
|
7981
|
+
isSubmitSuccessful: Oh(n.errors) && !c,
|
|
7928
7982
|
submitCount: n.submitCount + 1,
|
|
7929
7983
|
errors: n.errors
|
|
7930
7984
|
}), c) throw c;
|
|
7931
7985
|
}, Se = (e, t = {}) => {
|
|
7932
7986
|
X(r, e) && (Y(t.defaultValue) ? ie(e, J(X(i, e))) : (ie(e, t.defaultValue), Z(i, e, J(t.defaultValue))), t.keepTouched || $(n.touchedFields, e), t.keepDirty || ($(n.dirtyFields, e), n.isDirty = t.defaultValue ? k(e, J(X(i, e))) : k()), t.keepError || ($(n.errors, e), d.isValid && g()), p.state.next({ ...n }));
|
|
7933
7987
|
}, Ce = (e, c = {}) => {
|
|
7934
|
-
let l = e ? J(e) : i, u = J(l), f =
|
|
7988
|
+
let l = e ? J(e) : i, u = J(l), f = Oh(e), m = f ? i : u;
|
|
7935
7989
|
if (c.keepDefaultValues || (i = l), !c.keepValues) {
|
|
7936
7990
|
if (c.keepDirtyValues) {
|
|
7937
|
-
let e = new Set([...s.mount, ...Object.keys(
|
|
7991
|
+
let e = new Set([...s.mount, ...Object.keys(Vh(i, a))]);
|
|
7938
7992
|
for (let t of Array.from(e)) {
|
|
7939
7993
|
let e = X(n.dirtyFields, t), r = X(a, t), i = X(m, t);
|
|
7940
7994
|
e && !Y(r) ? Z(m, t, r) : !e && !Y(i) && ie(t, i);
|
|
7941
7995
|
}
|
|
7942
7996
|
} else {
|
|
7943
|
-
if (
|
|
7997
|
+
if (ih && Y(e)) for (let e of s.mount) {
|
|
7944
7998
|
let t = X(r, e);
|
|
7945
7999
|
if (t && t._f) {
|
|
7946
8000
|
let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
|
|
7947
|
-
if (
|
|
8001
|
+
if (Ah(e)) {
|
|
7948
8002
|
let t = e.closest("form");
|
|
7949
8003
|
if (t) {
|
|
7950
8004
|
t.reset();
|
|
@@ -7967,18 +8021,18 @@ function mg(e = {}) {
|
|
|
7967
8021
|
watch: /* @__PURE__ */ new Set(),
|
|
7968
8022
|
watchAll: !1,
|
|
7969
8023
|
focus: ""
|
|
7970
|
-
}, o.mount = !d.isValid || !!c.keepIsValid || !!c.keepDirtyValues || !t.shouldUnregister && !
|
|
8024
|
+
}, o.mount = !d.isValid || !!c.keepIsValid || !!c.keepDirtyValues || !t.shouldUnregister && !Oh(m), o.watch = !!t.shouldUnregister, o.keepIsValid = !!c.keepIsValid, o.action = !1, c.keepErrors || (n.errors = {}), p.state.next({
|
|
7971
8025
|
submitCount: c.keepSubmitCount ? n.submitCount : 0,
|
|
7972
|
-
isDirty: f ? !1 : c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !
|
|
8026
|
+
isDirty: f ? !1 : c.keepDirty ? n.isDirty : !!(c.keepDefaultValues && !xh(e, i)),
|
|
7973
8027
|
isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
|
|
7974
|
-
dirtyFields: f ? {} : c.keepDirtyValues ? c.keepDefaultValues && a ?
|
|
8028
|
+
dirtyFields: f ? {} : c.keepDirtyValues ? c.keepDefaultValues && a ? Vh(i, a) : n.dirtyFields : c.keepDefaultValues && e ? Vh(i, e) : c.keepDirty ? n.dirtyFields : {},
|
|
7975
8029
|
touchedFields: c.keepTouched ? n.touchedFields : {},
|
|
7976
8030
|
errors: c.keepErrors ? n.errors : {},
|
|
7977
8031
|
isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
|
|
7978
8032
|
isSubmitting: !1,
|
|
7979
8033
|
defaultValues: i
|
|
7980
8034
|
});
|
|
7981
|
-
}, we = (e, n) => Ce(
|
|
8035
|
+
}, we = (e, n) => Ce(lh(e) ? e(a) : e, {
|
|
7982
8036
|
...t.resetOptions,
|
|
7983
8037
|
...n
|
|
7984
8038
|
}), Te = (e, t = {}) => {
|
|
@@ -7986,7 +8040,7 @@ function mg(e = {}) {
|
|
|
7986
8040
|
if (i) {
|
|
7987
8041
|
let e = i.refs ? i.refs[0] : i.ref;
|
|
7988
8042
|
e.focus && setTimeout(() => {
|
|
7989
|
-
e.focus(), t.shouldSelect &&
|
|
8043
|
+
e.focus(), t.shouldSelect && lh(e.select) && e.select();
|
|
7990
8044
|
});
|
|
7991
8045
|
}
|
|
7992
8046
|
}, Ee = (e) => {
|
|
@@ -8013,7 +8067,7 @@ function mg(e = {}) {
|
|
|
8013
8067
|
_setErrors: x,
|
|
8014
8068
|
_getFieldArray: te,
|
|
8015
8069
|
_reset: Ce,
|
|
8016
|
-
_resetDefaultValues: () =>
|
|
8070
|
+
_resetDefaultValues: () => lh(t.defaultValues) && t.defaultValues().then((e) => {
|
|
8017
8071
|
we(e, t.resetOptions), p.state.next({ isLoading: !1 });
|
|
8018
8072
|
}),
|
|
8019
8073
|
_removeUnmounted: O,
|
|
@@ -8075,27 +8129,27 @@ function mg(e = {}) {
|
|
|
8075
8129
|
formControl: De
|
|
8076
8130
|
};
|
|
8077
8131
|
}
|
|
8078
|
-
function
|
|
8132
|
+
function gg(e = {}) {
|
|
8079
8133
|
let t = F.useRef(void 0), n = F.useRef(void 0), [r, i] = F.useState(() => ({
|
|
8080
|
-
...J(
|
|
8081
|
-
isLoading:
|
|
8134
|
+
...J(mg),
|
|
8135
|
+
isLoading: lh(e.defaultValues),
|
|
8082
8136
|
errors: e.errors || {},
|
|
8083
8137
|
disabled: e.disabled || !1,
|
|
8084
|
-
defaultValues:
|
|
8138
|
+
defaultValues: lh(e.defaultValues) ? void 0 : e.defaultValues
|
|
8085
8139
|
}));
|
|
8086
8140
|
if (!t.current) if (e.formControl) t.current = {
|
|
8087
8141
|
...e.formControl,
|
|
8088
8142
|
formState: r
|
|
8089
|
-
}, e.defaultValues && !
|
|
8143
|
+
}, e.defaultValues && !lh(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
8090
8144
|
else {
|
|
8091
|
-
let { formControl: n, ...i } =
|
|
8145
|
+
let { formControl: n, ...i } = hg(e);
|
|
8092
8146
|
t.current = {
|
|
8093
8147
|
...i,
|
|
8094
8148
|
formState: r
|
|
8095
8149
|
};
|
|
8096
8150
|
}
|
|
8097
8151
|
let a = t.current.control;
|
|
8098
|
-
return a._options = e,
|
|
8152
|
+
return a._options = e, vh(() => {
|
|
8099
8153
|
let e = a._subscribe({
|
|
8100
8154
|
formState: a._proxyFormState,
|
|
8101
8155
|
callback: () => i({ ...a._formState }),
|
|
@@ -8121,47 +8175,47 @@ function hg(e = {}) {
|
|
|
8121
8175
|
e !== r.isDirty && a._subjects.state.next({ isDirty: e });
|
|
8122
8176
|
}
|
|
8123
8177
|
}, [a, r.isDirty]), F.useEffect(() => {
|
|
8124
|
-
e.values && !
|
|
8178
|
+
e.values && !xh(e.values, n.current) ? (a._reset(e.values, {
|
|
8125
8179
|
keepFieldsRef: !0,
|
|
8126
8180
|
...a._options.resetOptions
|
|
8127
8181
|
}), a._options.resetOptions?.keepIsValid || a._setValid(), n.current = e.values, i((e) => ({ ...e }))) : a._resetDefaultValues();
|
|
8128
8182
|
}, [a, e.values]), F.useEffect(() => {
|
|
8129
8183
|
a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
8130
|
-
}), t.current.formState = F.useMemo(() =>
|
|
8184
|
+
}), t.current.formState = F.useMemo(() => _h(r, a), [a, r]), t.current;
|
|
8131
8185
|
}
|
|
8132
8186
|
//#endregion
|
|
8133
8187
|
//#region node_modules/@hookform/resolvers/dist/resolvers.mjs
|
|
8134
|
-
var
|
|
8188
|
+
var _g = (e, t, n) => {
|
|
8135
8189
|
if (e && "reportValidity" in e) {
|
|
8136
8190
|
let r = X(n, t);
|
|
8137
8191
|
e.setCustomValidity(r && r.message || ""), e.reportValidity();
|
|
8138
8192
|
}
|
|
8139
|
-
},
|
|
8193
|
+
}, vg = (e, t) => {
|
|
8140
8194
|
for (let n in t.fields) {
|
|
8141
8195
|
let r = t.fields[n];
|
|
8142
|
-
r && r.ref && "reportValidity" in r.ref ?
|
|
8196
|
+
r && r.ref && "reportValidity" in r.ref ? _g(r.ref, n, e) : r && r.refs && r.refs.forEach((t) => _g(t, n, e));
|
|
8143
8197
|
}
|
|
8144
|
-
},
|
|
8145
|
-
t.shouldUseNativeValidation &&
|
|
8198
|
+
}, yg = (e, t) => {
|
|
8199
|
+
t.shouldUseNativeValidation && vg(e, t);
|
|
8146
8200
|
let n = {};
|
|
8147
8201
|
for (let r in e) {
|
|
8148
8202
|
let i = X(t.fields, r), a = Object.assign(e[r] || {}, { ref: i && i.ref });
|
|
8149
|
-
if (
|
|
8203
|
+
if (bg(t.names || Object.keys(e), r)) {
|
|
8150
8204
|
let e = Object.assign({}, X(n, r));
|
|
8151
8205
|
Z(e, "root", a), Z(n, r, e);
|
|
8152
8206
|
} else Z(n, r, a);
|
|
8153
8207
|
}
|
|
8154
8208
|
return n;
|
|
8155
|
-
},
|
|
8156
|
-
let n =
|
|
8157
|
-
return e.some((e) =>
|
|
8209
|
+
}, bg = (e, t) => {
|
|
8210
|
+
let n = xg(t);
|
|
8211
|
+
return e.some((e) => xg(e).match(`^${n}\\.\\d+`));
|
|
8158
8212
|
};
|
|
8159
|
-
function
|
|
8213
|
+
function xg(e) {
|
|
8160
8214
|
return e.replace(/\]|\[/g, "");
|
|
8161
8215
|
}
|
|
8162
8216
|
//#endregion
|
|
8163
8217
|
//#region node_modules/@hookform/resolvers/zod/dist/zod.mjs
|
|
8164
|
-
function
|
|
8218
|
+
function Sg(e, t) {
|
|
8165
8219
|
try {
|
|
8166
8220
|
var n = e();
|
|
8167
8221
|
} catch (e) {
|
|
@@ -8169,7 +8223,7 @@ function xg(e, t) {
|
|
|
8169
8223
|
}
|
|
8170
8224
|
return n && n.then ? n.then(void 0, t) : n;
|
|
8171
8225
|
}
|
|
8172
|
-
function
|
|
8226
|
+
function Cg(e, t) {
|
|
8173
8227
|
for (var n = {}; e.length;) {
|
|
8174
8228
|
var r = e[0], i = r.code, a = r.message, o = r.path.join(".");
|
|
8175
8229
|
if (!n[o]) if ("unionErrors" in r) {
|
|
@@ -8188,13 +8242,13 @@ function Sg(e, t) {
|
|
|
8188
8242
|
});
|
|
8189
8243
|
}), t) {
|
|
8190
8244
|
var c = n[o].types, l = c && c[r.code];
|
|
8191
|
-
n[o] =
|
|
8245
|
+
n[o] = wh(o, t, n, i, l ? [].concat(l, r.message) : r.message);
|
|
8192
8246
|
}
|
|
8193
8247
|
e.shift();
|
|
8194
8248
|
}
|
|
8195
8249
|
return n;
|
|
8196
8250
|
}
|
|
8197
|
-
function
|
|
8251
|
+
function wg(e, t) {
|
|
8198
8252
|
for (var n = {}; e.length;) {
|
|
8199
8253
|
var r = e[0], i = r.code, a = r.message, o = r.path.join(".");
|
|
8200
8254
|
if (!n[o]) if (r.code === "invalid_union" && r.errors.length > 0) {
|
|
@@ -8213,20 +8267,20 @@ function Cg(e, t) {
|
|
|
8213
8267
|
});
|
|
8214
8268
|
}), t) {
|
|
8215
8269
|
var c = n[o].types, l = c && c[r.code];
|
|
8216
|
-
n[o] =
|
|
8270
|
+
n[o] = wh(o, t, n, i, l ? [].concat(l, r.message) : r.message);
|
|
8217
8271
|
}
|
|
8218
8272
|
e.shift();
|
|
8219
8273
|
}
|
|
8220
8274
|
return n;
|
|
8221
8275
|
}
|
|
8222
|
-
function
|
|
8276
|
+
function Tg(e, t, n) {
|
|
8223
8277
|
if (n === void 0 && (n = {}), function(e) {
|
|
8224
8278
|
return "_def" in e && typeof e._def == "object" && "typeName" in e._def;
|
|
8225
8279
|
}(e)) return function(r, i, a) {
|
|
8226
8280
|
try {
|
|
8227
|
-
return Promise.resolve(
|
|
8281
|
+
return Promise.resolve(Sg(function() {
|
|
8228
8282
|
return Promise.resolve(e[n.mode === "sync" ? "parse" : "parseAsync"](r, t)).then(function(e) {
|
|
8229
|
-
return a.shouldUseNativeValidation &&
|
|
8283
|
+
return a.shouldUseNativeValidation && vg({}, a), {
|
|
8230
8284
|
errors: {},
|
|
8231
8285
|
values: n.raw ? Object.assign({}, r) : e
|
|
8232
8286
|
};
|
|
@@ -8236,7 +8290,7 @@ function wg(e, t, n) {
|
|
|
8236
8290
|
return Array.isArray(e?.issues);
|
|
8237
8291
|
}(e)) return {
|
|
8238
8292
|
values: {},
|
|
8239
|
-
errors:
|
|
8293
|
+
errors: yg(Cg(e.errors, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a)
|
|
8240
8294
|
};
|
|
8241
8295
|
throw e;
|
|
8242
8296
|
}));
|
|
@@ -8248,9 +8302,9 @@ function wg(e, t, n) {
|
|
|
8248
8302
|
return "_zod" in e && typeof e._zod == "object";
|
|
8249
8303
|
}(e)) return function(r, i, a) {
|
|
8250
8304
|
try {
|
|
8251
|
-
return Promise.resolve(
|
|
8305
|
+
return Promise.resolve(Sg(function() {
|
|
8252
8306
|
return Promise.resolve((n.mode === "sync" ? bn : Sn)(e, r, t)).then(function(e) {
|
|
8253
|
-
return a.shouldUseNativeValidation &&
|
|
8307
|
+
return a.shouldUseNativeValidation && vg({}, a), {
|
|
8254
8308
|
errors: {},
|
|
8255
8309
|
values: n.raw ? Object.assign({}, r) : e
|
|
8256
8310
|
};
|
|
@@ -8260,7 +8314,7 @@ function wg(e, t, n) {
|
|
|
8260
8314
|
return e instanceof hn;
|
|
8261
8315
|
}(e)) return {
|
|
8262
8316
|
values: {},
|
|
8263
|
-
errors:
|
|
8317
|
+
errors: yg(wg(e.issues, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a)
|
|
8264
8318
|
};
|
|
8265
8319
|
throw e;
|
|
8266
8320
|
}));
|
|
@@ -8272,19 +8326,19 @@ function wg(e, t, n) {
|
|
|
8272
8326
|
}
|
|
8273
8327
|
//#endregion
|
|
8274
8328
|
//#region src/base/form/form-utils.ts
|
|
8275
|
-
function
|
|
8329
|
+
function Eg(e) {
|
|
8276
8330
|
let t = [];
|
|
8277
|
-
for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...
|
|
8331
|
+
for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...Eg(n.children));
|
|
8278
8332
|
return t;
|
|
8279
8333
|
}
|
|
8280
|
-
function
|
|
8334
|
+
function Dg(e, t) {
|
|
8281
8335
|
if (e.component === "header") return !0;
|
|
8282
8336
|
let { props: n } = e;
|
|
8283
8337
|
return !(n.hidden_when && Uf(n.hidden_when, t) || n.visible_when && !Uf(n.visible_when, t));
|
|
8284
8338
|
}
|
|
8285
8339
|
//#endregion
|
|
8286
8340
|
//#region src/base/form/form-schema-builder.ts
|
|
8287
|
-
function
|
|
8341
|
+
function Og(e, t) {
|
|
8288
8342
|
let { component: n, props: r } = e, i = r.validation, a = r.required;
|
|
8289
8343
|
switch (n) {
|
|
8290
8344
|
case "text":
|
|
@@ -8348,18 +8402,18 @@ function Dg(e, t) {
|
|
|
8348
8402
|
default: return Ss();
|
|
8349
8403
|
}
|
|
8350
8404
|
}
|
|
8351
|
-
function
|
|
8352
|
-
let r =
|
|
8353
|
-
for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" ||
|
|
8405
|
+
function kg(e, t, n) {
|
|
8406
|
+
let r = Eg(e), i = {};
|
|
8407
|
+
for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" || Dg(e, t) && (i[e.key] = Og(e, n));
|
|
8354
8408
|
return As(i);
|
|
8355
8409
|
}
|
|
8356
8410
|
//#endregion
|
|
8357
8411
|
//#region src/base/form/FormField.tsx
|
|
8358
|
-
var
|
|
8359
|
-
function
|
|
8412
|
+
var Ag = gt(() => import("./PhoneField-B1EDgorM.js").then((e) => ({ default: e.PhoneField }))), jg = gt(() => import("./DateField-BxYJUlk4.js").then((e) => ({ default: e.DateField }))), Mg = gt(() => import("./DocumentField-Mc-FrWZt.js").then((e) => ({ default: e.DocumentField }))), Ng = gt(() => import("./DateRangeField-DK02BwDy.js").then((e) => ({ default: e.DateRangeField })));
|
|
8413
|
+
function Pg() {
|
|
8360
8414
|
return /* @__PURE__ */ L(dt, { className: "h-9 w-full rounded-md" });
|
|
8361
8415
|
}
|
|
8362
|
-
function
|
|
8416
|
+
function Fg({ label: e }) {
|
|
8363
8417
|
return /* @__PURE__ */ L("div", {
|
|
8364
8418
|
className: "pt-4 pb-1",
|
|
8365
8419
|
children: /* @__PURE__ */ L("h4", {
|
|
@@ -8368,21 +8422,21 @@ function Pg({ label: e }) {
|
|
|
8368
8422
|
})
|
|
8369
8423
|
});
|
|
8370
8424
|
}
|
|
8371
|
-
function
|
|
8425
|
+
function Ig({ id: e, value: t }) {
|
|
8372
8426
|
return /* @__PURE__ */ L("input", {
|
|
8373
8427
|
type: "hidden",
|
|
8374
8428
|
id: e,
|
|
8375
8429
|
value: String(t ?? "")
|
|
8376
8430
|
});
|
|
8377
8431
|
}
|
|
8378
|
-
function
|
|
8432
|
+
function Lg({ field: e, value: t, onChange: n, error: r }) {
|
|
8379
8433
|
let { t: i } = De(), a = yt(), o = `field-${e.key}-${a}`, s = `${o}-help`, c = `${o}-error`, { component: l, props: u } = e;
|
|
8380
|
-
if (l === "header") return /* @__PURE__ */ L(
|
|
8381
|
-
if (l === "hidden") return /* @__PURE__ */ L(
|
|
8434
|
+
if (l === "header") return /* @__PURE__ */ L(Fg, { label: u.label });
|
|
8435
|
+
if (l === "hidden") return /* @__PURE__ */ L(Ig, {
|
|
8382
8436
|
id: o,
|
|
8383
8437
|
value: t
|
|
8384
8438
|
});
|
|
8385
|
-
let d = l === "checkbox" || l === "switch", f =
|
|
8439
|
+
let d = l === "checkbox" || l === "switch", f = Rg(l, o, t, n, u, r, s, c, i);
|
|
8386
8440
|
return /* @__PURE__ */ R("div", {
|
|
8387
8441
|
className: "space-y-1.5",
|
|
8388
8442
|
children: [
|
|
@@ -8408,7 +8462,7 @@ function Ig({ field: e, value: t, onChange: n, error: r }) {
|
|
|
8408
8462
|
]
|
|
8409
8463
|
});
|
|
8410
8464
|
}
|
|
8411
|
-
function
|
|
8465
|
+
function Rg(e, t, n, r, i, a, o, s, c) {
|
|
8412
8466
|
let l = {
|
|
8413
8467
|
id: t,
|
|
8414
8468
|
error: a,
|
|
@@ -8505,8 +8559,8 @@ function Lg(e, t, n, r, i, a, o, s, c) {
|
|
|
8505
8559
|
label: i.label
|
|
8506
8560
|
});
|
|
8507
8561
|
case "date": return /* @__PURE__ */ L(mt, {
|
|
8508
|
-
fallback: /* @__PURE__ */ L(
|
|
8509
|
-
children: /* @__PURE__ */ L(
|
|
8562
|
+
fallback: /* @__PURE__ */ L(Pg, {}),
|
|
8563
|
+
children: /* @__PURE__ */ L(jg, {
|
|
8510
8564
|
...l,
|
|
8511
8565
|
mode: "date",
|
|
8512
8566
|
value: n,
|
|
@@ -8515,8 +8569,8 @@ function Lg(e, t, n, r, i, a, o, s, c) {
|
|
|
8515
8569
|
})
|
|
8516
8570
|
});
|
|
8517
8571
|
case "datetime": return /* @__PURE__ */ L(mt, {
|
|
8518
|
-
fallback: /* @__PURE__ */ L(
|
|
8519
|
-
children: /* @__PURE__ */ L(
|
|
8572
|
+
fallback: /* @__PURE__ */ L(Pg, {}),
|
|
8573
|
+
children: /* @__PURE__ */ L(jg, {
|
|
8520
8574
|
...l,
|
|
8521
8575
|
mode: "datetime",
|
|
8522
8576
|
value: n,
|
|
@@ -8549,8 +8603,8 @@ function Lg(e, t, n, r, i, a, o, s, c) {
|
|
|
8549
8603
|
value: n
|
|
8550
8604
|
});
|
|
8551
8605
|
case "phone": return /* @__PURE__ */ L(mt, {
|
|
8552
|
-
fallback: /* @__PURE__ */ L(
|
|
8553
|
-
children: /* @__PURE__ */ L(
|
|
8606
|
+
fallback: /* @__PURE__ */ L(Pg, {}),
|
|
8607
|
+
children: /* @__PURE__ */ L(Ag, {
|
|
8554
8608
|
...l,
|
|
8555
8609
|
value: n,
|
|
8556
8610
|
onChange: r,
|
|
@@ -8560,8 +8614,8 @@ function Lg(e, t, n, r, i, a, o, s, c) {
|
|
|
8560
8614
|
})
|
|
8561
8615
|
});
|
|
8562
8616
|
case "document": return /* @__PURE__ */ L(mt, {
|
|
8563
|
-
fallback: /* @__PURE__ */ L(
|
|
8564
|
-
children: /* @__PURE__ */ L(
|
|
8617
|
+
fallback: /* @__PURE__ */ L(Pg, {}),
|
|
8618
|
+
children: /* @__PURE__ */ L(Mg, {
|
|
8565
8619
|
...l,
|
|
8566
8620
|
value: n,
|
|
8567
8621
|
onChange: r,
|
|
@@ -8602,8 +8656,8 @@ function Lg(e, t, n, r, i, a, o, s, c) {
|
|
|
8602
8656
|
maxTags: i.maxTags
|
|
8603
8657
|
});
|
|
8604
8658
|
case "date_range": return /* @__PURE__ */ L(mt, {
|
|
8605
|
-
fallback: /* @__PURE__ */ L(
|
|
8606
|
-
children: /* @__PURE__ */ L(
|
|
8659
|
+
fallback: /* @__PURE__ */ L(Pg, {}),
|
|
8660
|
+
children: /* @__PURE__ */ L(Ng, {
|
|
8607
8661
|
...l,
|
|
8608
8662
|
value: n,
|
|
8609
8663
|
onChange: r,
|
|
@@ -8623,71 +8677,17 @@ function Lg(e, t, n, r, i, a, o, s, c) {
|
|
|
8623
8677
|
}
|
|
8624
8678
|
}
|
|
8625
8679
|
//#endregion
|
|
8626
|
-
//#region src/base/partials/FormSection/index.tsx
|
|
8627
|
-
function Rg({ id: e, title: t, description: n, children: r, defaultCollapsed: i = !1, hasErrors: a = !1, errorCount: o }) {
|
|
8628
|
-
let { t: c } = De(), [l, u] = St(i && !a), d = `${e}-content`, f = !!t, p = !l || a;
|
|
8629
|
-
return /* @__PURE__ */ R("fieldset", {
|
|
8630
|
-
className: "border-border space-y-5 rounded-lg border p-6",
|
|
8631
|
-
children: [
|
|
8632
|
-
t && /* @__PURE__ */ L("legend", {
|
|
8633
|
-
className: "sr-only",
|
|
8634
|
-
children: t
|
|
8635
|
-
}),
|
|
8636
|
-
t && /* @__PURE__ */ R("div", {
|
|
8637
|
-
className: "-mt-2 flex items-center justify-between",
|
|
8638
|
-
children: [f ? /* @__PURE__ */ R(s, {
|
|
8639
|
-
variant: "ghost",
|
|
8640
|
-
size: "sm",
|
|
8641
|
-
onClick: () => !a && u(!l),
|
|
8642
|
-
"aria-expanded": p,
|
|
8643
|
-
"aria-controls": d,
|
|
8644
|
-
className: "-ml-2 flex items-center gap-2 px-2",
|
|
8645
|
-
disabled: a,
|
|
8646
|
-
children: [/* @__PURE__ */ L(Le, {
|
|
8647
|
-
icon: p ? Oe : Be,
|
|
8648
|
-
size: 14
|
|
8649
|
-
}), /* @__PURE__ */ L("span", {
|
|
8650
|
-
className: "text-foreground text-lg font-semibold",
|
|
8651
|
-
children: t
|
|
8652
|
-
})]
|
|
8653
|
-
}) : /* @__PURE__ */ L("h3", {
|
|
8654
|
-
className: "text-foreground text-lg font-semibold",
|
|
8655
|
-
children: t
|
|
8656
|
-
}), a && o !== void 0 && o > 0 && /* @__PURE__ */ R("span", {
|
|
8657
|
-
className: "text-destructive text-xs",
|
|
8658
|
-
children: [
|
|
8659
|
-
"(",
|
|
8660
|
-
o,
|
|
8661
|
-
" ",
|
|
8662
|
-
c(o === 1 ? "middag.ui.form.error_one" : "middag.ui.form.error_other"),
|
|
8663
|
-
")"
|
|
8664
|
-
]
|
|
8665
|
-
})]
|
|
8666
|
-
}),
|
|
8667
|
-
n && p && /* @__PURE__ */ L("p", {
|
|
8668
|
-
className: "text-muted-foreground text-xs",
|
|
8669
|
-
children: n
|
|
8670
|
-
}),
|
|
8671
|
-
/* @__PURE__ */ L("div", {
|
|
8672
|
-
id: d,
|
|
8673
|
-
className: j("transition-[opacity,height] duration-200 ease-[var(--ease-default)]", p ? "opacity-100" : "hidden opacity-0"),
|
|
8674
|
-
children: r
|
|
8675
|
-
})
|
|
8676
|
-
]
|
|
8677
|
-
});
|
|
8678
|
-
}
|
|
8679
|
-
//#endregion
|
|
8680
8680
|
//#region src/base/blocks/FormPanelBlock.tsx
|
|
8681
8681
|
function zg({ nodes: e, values: t, errors: n, onChange: r }) {
|
|
8682
8682
|
return /* @__PURE__ */ L(wt, { children: e.map((e, i) => {
|
|
8683
8683
|
switch (e.kind) {
|
|
8684
|
-
case "field": return
|
|
8684
|
+
case "field": return Dg(e, t) ? /* @__PURE__ */ L(Lg, {
|
|
8685
8685
|
field: e,
|
|
8686
8686
|
value: t[e.key] ?? "",
|
|
8687
8687
|
onChange: (t) => r(e.key, t),
|
|
8688
8688
|
error: n[e.key]
|
|
8689
8689
|
}, e.key) : null;
|
|
8690
|
-
case "section": return /* @__PURE__ */ L(
|
|
8690
|
+
case "section": return /* @__PURE__ */ L(Xm, {
|
|
8691
8691
|
id: e.id,
|
|
8692
8692
|
title: e.label,
|
|
8693
8693
|
defaultCollapsed: e.defaultCollapsed,
|
|
@@ -8721,18 +8721,18 @@ function zg({ nodes: e, values: t, errors: n, onChange: r }) {
|
|
|
8721
8721
|
}) });
|
|
8722
8722
|
}
|
|
8723
8723
|
function Bg({ block: e }) {
|
|
8724
|
-
let { t } = De(), { data: n } = e, r = bt(() =>
|
|
8724
|
+
let { t } = De(), { data: n } = e, r = bt(() => Eg(n.schema), [n.schema]), i = (n.meta.validation ?? "both") !== "server", a = bt(() => Object.fromEntries(r.map((e) => [e.key, n.values[e.key] ?? ""])), [r, n.values]), o = xt(i ? kg(n.schema, a, t) : null), c = gg({
|
|
8725
8725
|
defaultValues: a,
|
|
8726
8726
|
mode: "onTouched",
|
|
8727
8727
|
resolver: bt(() => {
|
|
8728
|
-
if (i) return async (e, t, n) => o.current ?
|
|
8728
|
+
if (i) return async (e, t, n) => o.current ? Tg(o.current)(e, t, n) : {
|
|
8729
8729
|
values: e,
|
|
8730
8730
|
errors: {}
|
|
8731
8731
|
};
|
|
8732
8732
|
}, [i])
|
|
8733
|
-
}), l =
|
|
8733
|
+
}), l = Sh({ control: c.control }) ?? a, u = r.map((e) => Dg(e, l) ? "1" : "0").join("");
|
|
8734
8734
|
vt(() => {
|
|
8735
|
-
i && (o.current =
|
|
8735
|
+
i && (o.current = kg(n.schema, l, t));
|
|
8736
8736
|
}, [
|
|
8737
8737
|
i,
|
|
8738
8738
|
n.schema,
|
|
@@ -8760,7 +8760,7 @@ function Bg({ block: e }) {
|
|
|
8760
8760
|
shouldValidate: c.formState.isSubmitted
|
|
8761
8761
|
}), c.clearErrors(e);
|
|
8762
8762
|
}, [c]), g = I((e) => {
|
|
8763
|
-
let t = r.filter((t) =>
|
|
8763
|
+
let t = r.filter((t) => Dg(t, e)), i = Object.fromEntries(t.map((t) => [t.key, e[t.key]]));
|
|
8764
8764
|
Ct[n.method === "put" ? "put" : n.method === "patch" ? "patch" : "post"](n.action, i, { onError: (e) => {
|
|
8765
8765
|
for (let [t, n] of Object.entries(e)) c.setError(t, {
|
|
8766
8766
|
type: "server",
|
|
@@ -8778,7 +8778,7 @@ function Bg({ block: e }) {
|
|
|
8778
8778
|
for (let [t, n] of Object.entries(c.formState.errors)) n?.message && (e[t] = n.message);
|
|
8779
8779
|
return e;
|
|
8780
8780
|
}, [c.formState.errors]);
|
|
8781
|
-
return r.filter((e) =>
|
|
8781
|
+
return r.filter((e) => Dg(e, l)).length === 0 && n.schema.length === 0 ? /* @__PURE__ */ L(Nf, {
|
|
8782
8782
|
variant: "inline",
|
|
8783
8783
|
title: t("middag.ui.form.no_fields")
|
|
8784
8784
|
}) : /* @__PURE__ */ R(wt, { children: [/* @__PURE__ */ R("form", {
|
|
@@ -8824,4 +8824,4 @@ function Bg({ block: e }) {
|
|
|
8824
8824
|
})] });
|
|
8825
8825
|
}
|
|
8826
8826
|
//#endregion
|
|
8827
|
-
export {
|
|
8827
|
+
export { As as $, bf as A, al as B, Pf as C, Ff as D, If as E, Ef as F, mc as G, cl as H, ul as I, dc as J, _c as K, sl as L, Df as M, Tf as N, Nf as O, wf as P, Bs as Q, ll as R, Vf as S, Rf as T, Sc as U, il as V, hc as W, Os as X, Rs as Y, bs as Z, Jf as _, qm as a, Uf as b, Um as c, Fm as d, Is as et, Mm as f, mm as g, _m as h, Jm as i, Cf as j, Of as k, Vm as l, ym as m, Xm as n, ws as nt, Km as o, jm as p, gc as q, Ym as r, Wm as s, Bg as t, Yo as tt, Bm as u, Kf as v, Lf as w, Hf as x, Gf as y, ol as z };
|