import React, { useRef } from 'react'; import { DrawerForm, ProFormInstance, ProFormText } from '@ant-design/pro-components'; export type FormValueType = { target?: string; template?: string; type?: string; time?: string; frequency?: string; } & Partial; export type UpdateFormProps = { onCancel: (flag?: boolean, formVals?: FormValueType) => void; onSubmit: (values: FormValueType) => Promise; updateModalVisible: boolean; }; const UpdateItemForm: React.FC = (props) => { const formRef = useRef(); return ( { return props.onSubmit({ ...value }) }} drawerProps={{ destroyOnClose: true, }} onOpenChange={(visible) => { formRef.current?.resetFields(); if (!visible) { props.onCancel(); } }} > ); }; export default UpdateItemForm;