triafly-ui-kit 1.0.55 → 1.0.56
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.
@@ -1,27 +1,27 @@
|
|
1
|
-
import { jsx as
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
2
2
|
import '../../../../assets/src/components/Ui/Form/FormRoot/Form.css';/* empty css */
|
3
|
-
import { useMemo as
|
4
|
-
import { FormContext as
|
5
|
-
import { FormItem as
|
6
|
-
import { useForm as
|
7
|
-
const
|
8
|
-
const a =
|
9
|
-
const
|
10
|
-
return
|
11
|
-
}, [m, a, t]),
|
12
|
-
|
3
|
+
import { useMemo as u } from "react";
|
4
|
+
import { FormContext as p } from "../FormContext/FormContext.js";
|
5
|
+
import { FormItem as n } from "../FormItem/FormItem.js";
|
6
|
+
import { useForm as d, FormValidationError as v } from "../useForm/useForm.js";
|
7
|
+
const M = ({ form: m, children: s, onFinish: o, disabled: t = !1 }) => {
|
8
|
+
const a = d()[0], c = u(() => {
|
9
|
+
const e = m || a;
|
10
|
+
return e.disabled = t, e;
|
11
|
+
}, [m, a, t]), f = async (e) => {
|
12
|
+
e.preventDefault();
|
13
13
|
try {
|
14
14
|
if (t) return;
|
15
|
-
const r = await
|
16
|
-
await (
|
15
|
+
const r = await c.validateFields();
|
16
|
+
await (o == null ? void 0 : o(r));
|
17
17
|
} catch (r) {
|
18
|
-
if (r instanceof
|
19
|
-
throw console.error(r.errors), console.error(r.errorMap), console.error(r.message), console.error(r.name), r.errorMap;
|
18
|
+
if (r instanceof v)
|
19
|
+
throw console.error(r.errors), console.error(r.errorMap), console.error(r.message), console.error(r.name), o == null || o(r.errorMap), r.errorMap;
|
20
20
|
}
|
21
21
|
};
|
22
|
-
return /* @__PURE__ */
|
22
|
+
return /* @__PURE__ */ l(p.Provider, { value: c || null, children: /* @__PURE__ */ l("form", { onSubmit: f, children: s }) });
|
23
23
|
};
|
24
|
-
|
24
|
+
M.Item = n;
|
25
25
|
export {
|
26
|
-
|
26
|
+
M as Form
|
27
27
|
};
|