在 FormBuilder 和 Search 组件上暴露 useForm 和 useWatch 方法
parent
a5572b11dc
commit
13afaea2bf
|
|
@ -1,4 +1,5 @@
|
|||
import type { FormInstance, FormProps } from "antd/es/form";
|
||||
import type { useForm, useWatch } from "antd/es/form/Form";
|
||||
import type { Gutter } from "antd/es/grid/row";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import type { FormOption, FormValues } from "./FormItemsRenderer";
|
||||
|
|
@ -40,6 +41,9 @@ export interface FormBuilderProps extends Omit<FormProps, "form"> {
|
|||
/**
|
||||
* 表单构建器组件
|
||||
*/
|
||||
declare const FormBuilder: FC<FormBuilderProps>;
|
||||
declare const FormBuilder: FC<FormBuilderProps> & {
|
||||
useForm: typeof useForm;
|
||||
useWatch: typeof useWatch;
|
||||
};
|
||||
|
||||
export default FormBuilder;
|
||||
|
|
|
|||
|
|
@ -110,4 +110,7 @@ const FormBuilder = (props) => {
|
|||
|
||||
FormBuilder.displayName = "FormBuilder";
|
||||
|
||||
FormBuilder.useForm = Form.useForm;
|
||||
FormBuilder.useWatch = Form.useWatch;
|
||||
|
||||
export default FormBuilder;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { FormInstance, FormProps } from "antd/es/form";
|
||||
import type { useForm, useWatch } from "antd/es/form/Form";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import type { FormOption } from "../FormBuilder/FormItemsRenderer";
|
||||
|
||||
|
|
@ -36,6 +37,9 @@ export interface SearchProps extends Omit<FormProps, "form" | "onFinish"> {
|
|||
* 搜索表单组件
|
||||
* 支持自动展开/收起功能,当表单项超过4个时显示展开/收起按钮
|
||||
*/
|
||||
declare const Search: FC<SearchProps>;
|
||||
declare const Search: FC<SearchProps> & {
|
||||
useForm: typeof useForm;
|
||||
useWatch: typeof useWatch;
|
||||
};
|
||||
|
||||
export default Search;
|
||||
|
|
|
|||
|
|
@ -138,4 +138,7 @@ const Search = (props) => {
|
|||
|
||||
Search.displayName = "Search";
|
||||
|
||||
Search.useForm = Form.useForm;
|
||||
Search.useWatch = Form.useWatch;
|
||||
|
||||
export default Search;
|
||||
|
|
|
|||
Loading…
Reference in New Issue