42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
import type { FormInstance, FormProps } from "antd/es/form";
 | 
						||
import type { FC, ReactNode } from "react";
 | 
						||
import type { FormOption } from "../FormBuilder/FormItemsRenderer";
 | 
						||
 | 
						||
type FormValues = Record<string, any>;
 | 
						||
 | 
						||
/**
 | 
						||
 * Search 组件属性
 | 
						||
 */
 | 
						||
export interface SearchProps extends Omit<FormProps, "form" | "onFinish"> {
 | 
						||
  /** 表单配置项数组 */
 | 
						||
  options: FormOption[];
 | 
						||
  /** 表单值 */
 | 
						||
  values?: FormValues;
 | 
						||
  /** 搜索和重置都会触发的回调 */
 | 
						||
  onFinish?: (values: FormValues, type: "submit" | "reset") => void;
 | 
						||
  /** 搜索回调 */
 | 
						||
  onSubmit?: (values: FormValues) => void;
 | 
						||
  /** 重置回调 */
 | 
						||
  onReset?: (values: FormValues) => void;
 | 
						||
  /** 搜索按钮文本,默认"搜索" */
 | 
						||
  searchText?: string;
 | 
						||
  /** 重置按钮文本,默认"重置" */
 | 
						||
  resetText?: string;
 | 
						||
  /** 是否显示搜索按钮,默认 true */
 | 
						||
  showSearchButton?: boolean;
 | 
						||
  /** 是否显示重置按钮,默认 true */
 | 
						||
  showResetButton?: boolean;
 | 
						||
  /** 额外的底部按钮组 */
 | 
						||
  extraButtons?: ReactNode;
 | 
						||
  /** 表单实例(通过 Form.useForm() 创建) */
 | 
						||
  form: FormInstance;
 | 
						||
}
 | 
						||
 | 
						||
/**
 | 
						||
 * 搜索表单组件
 | 
						||
 * 支持自动展开/收起功能,当表单项超过4个时显示展开/收起按钮
 | 
						||
 */
 | 
						||
declare const Search: FC<SearchProps>;
 | 
						||
 | 
						||
export default Search;
 |