@overmap-ai/core 1.0.28-integrate-forms.2 → 1.0.28-integrate-forms.4
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.
|
@@ -11,8 +11,5 @@ interface PatchFieldProps {
|
|
|
11
11
|
name: string;
|
|
12
12
|
render: (args: RenderArgs) => ReactNode;
|
|
13
13
|
}
|
|
14
|
-
export declare const PatchField:
|
|
15
|
-
(props: PatchFieldProps): null;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
14
|
+
export declare const PatchField: import("react").MemoExoticComponent<(props: PatchFieldProps) => null>;
|
|
18
15
|
export {};
|
package/dist/overmap-core.js
CHANGED
|
@@ -9645,10 +9645,25 @@ const FormSubmissionBrowser = memo(function FormSubmissionBrowser2(props) {
|
|
|
9645
9645
|
}
|
|
9646
9646
|
);
|
|
9647
9647
|
});
|
|
9648
|
-
const PatchField = (props) => {
|
|
9648
|
+
const PatchField = memo((props) => {
|
|
9649
9649
|
console.log("PatchField props:", props);
|
|
9650
|
+
const { name, render } = props;
|
|
9651
|
+
const { submitForm } = useFormikContext();
|
|
9652
|
+
const [fieldProps, _meta, helpers] = useField(name);
|
|
9653
|
+
useMemo(() => {
|
|
9654
|
+
const setValue = (value) => {
|
|
9655
|
+
void helpers.setValue(value, false);
|
|
9656
|
+
};
|
|
9657
|
+
return render({
|
|
9658
|
+
value: fieldProps.value,
|
|
9659
|
+
setValue,
|
|
9660
|
+
patchValue: () => {
|
|
9661
|
+
void submitForm();
|
|
9662
|
+
}
|
|
9663
|
+
});
|
|
9664
|
+
}, [submitForm, helpers, fieldProps.value, render]);
|
|
9650
9665
|
return null;
|
|
9651
|
-
};
|
|
9666
|
+
});
|
|
9652
9667
|
PatchField.displayName = "PatchField";
|
|
9653
9668
|
const PatchFormProvider = memo(
|
|
9654
9669
|
forwardRef((props, ref) => {
|