@overmap-ai/forms 1.0.8 → 1.0.9-handle-patchform-errors.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/forms.js +9 -3
- package/dist/forms.js.map +1 -1
- package/dist/forms.umd.cjs +8 -2
- package/dist/forms.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/forms.umd.cjs
CHANGED
|
@@ -1828,6 +1828,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1828
1828
|
const PatchFormProvider = React.memo(
|
|
1829
1829
|
React.forwardRef((props, ref) => {
|
|
1830
1830
|
const { children, schema, values, onPatch, onError, ...rest } = props;
|
|
1831
|
+
const { showError } = blocks.useToast();
|
|
1831
1832
|
const initialValues2 = React.useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
|
|
1832
1833
|
const handlePatch = React.useCallback(
|
|
1833
1834
|
(values2) => {
|
|
@@ -1840,6 +1841,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1840
1841
|
}
|
|
1841
1842
|
if (!hasKeys(diff))
|
|
1842
1843
|
return;
|
|
1844
|
+
console.log("onpatch runs", diff);
|
|
1843
1845
|
onPatch(diff);
|
|
1844
1846
|
},
|
|
1845
1847
|
[initialValues2, onPatch]
|
|
@@ -1865,9 +1867,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1865
1867
|
const { errors, resetForm } = formik$1;
|
|
1866
1868
|
React.useEffect(() => {
|
|
1867
1869
|
if (hasKeys(errors)) {
|
|
1868
|
-
|
|
1870
|
+
console.log(errors);
|
|
1871
|
+
showError({
|
|
1872
|
+
title: "test title",
|
|
1873
|
+
description: "Sections with conditions must be below the fields they reference."
|
|
1874
|
+
});
|
|
1869
1875
|
}
|
|
1870
|
-
}, [errors, initialValues2, resetForm]);
|
|
1876
|
+
}, [showError, errors, initialValues2, resetForm]);
|
|
1871
1877
|
return /* @__PURE__ */ jsxRuntime.jsx(formik.FormikProvider, { value: formik$1, children: /* @__PURE__ */ jsxRuntime.jsx("form", { ...rest, ref, onSubmit: formik$1.handleSubmit, children }) });
|
|
1872
1878
|
})
|
|
1873
1879
|
);
|