/// import { IState, ValueOf } from 'formstate-x'; import { FormProps as BaseFormProps, ModalFormProps as BaseModalFormProps, DrawerFormProps as BaseDrawerFormProps } from 'react-icecream'; export declare type SubmitHandler = (value: V) => (void | Promise); export declare type WithState; }, S extends IState, V = ValueOf> = (Omit & { /** 表单状态,`FormState` 实例 */ state: S; /** 提交行为的回调函数,表单校验通过才会触发回调 */ onSubmit?: SubmitHandler; }); export declare type Props, V = ValueOf> = WithState; export default function Form, V = ValueOf>({ state, onSubmit, ...formProps }: Props): JSX.Element; export declare type ModalFormProps, V = ValueOf> = WithState; export declare function ModalForm, V = ValueOf>({ state, onSubmit, ...modalFormProps }: ModalFormProps): JSX.Element; export declare type DrawerFormProps, V = ValueOf> = WithState; export declare function DrawerForm, V = ValueOf>({ state, onSubmit, ...drawerFormProps }: DrawerFormProps): JSX.Element; /** * 在 React 组件中构造 `FormState` / `FieldState` 实例的 hooks * * 使用姿势: * function createState(foo: Foo, bar?: Bar) { * return new FormState({ * foo: new FieldState(foo) * bar: new FieldState(bar) * }) * } * * function Comp({ foo, bar }) { * const state = useFormstateX(createState, [foo, bar]) * } * */ export declare function useFormstateX R>(createState: Fn, parameters: [...D]): ReturnType;