import { type FormItemRule } from 'element-plus' export = Form export as namespace Form export type FieldNamesProps = { label: string value: string children?: string } export interface EnumProps { label?: string // 选项框显示的文字 value?: string | number | boolean | any[] // 选项框值 disabled?: boolean // 是否禁用此选项 tagType?: string // 当 tag 为 true 时,此选择会指定 tag 显示类型 children?: EnumProps[] // 为树形选择时,可以通过 children 属性指定子选项 [key: string]: any } declare namespace Form { type ItemType = | 'password' | 'text' | 'textarea' | 'radio' | 'checkbox' | 'select' | 'select-v2' | 'select-tree' | 'date-picker' | 'input-number' | 'select-icon' // 当FiledItem的type === 'radio' | 'checkbox'时的需要的参数类型 interface IFieldOptions { labelKey?: string valueKey?: string children?: string placeholder?: string data?: Record[] multiple?: boolean type?: IDatePickerType max?: number min?: number filterable?: boolean allowCreate?: boolean clearable?: boolean valueFormat?: string } interface Options { labelWidth?: string | number labelPosition?: 'left' | 'right' | 'top' disabled?: boolean size?: 'large' | 'small' | 'default' showResetButton?: boolean // 是否展示重置按钮 showCancelButton?: boolean // 是否展示取消按钮 submitButtonText?: string resetButtonText?: string cancelButtonText?: string blockSubmitButton?: boolean // 提交按钮是否以块级按钮呈现 hasFooter?: boolean // 表单是否有footer } interface FieldItem { label?: string labelWidth?: string | number // 标签宽度,例如 '50px'。 可以使用 auto。 field: string type?: ItemType tooltip?: string // 问号,tooltip提示 value?: any placeholder?: string disabled?: boolean readonly?: boolean options?: IFieldOptions rules?: FormItemRule[] clearable?: boolean // 是否可清空 showPassword?: boolean // 是否显示切换密码图标 enterable?: boolean // 当为输入框时,是否启用回车触发提交功能 span?: number // 表单col宽度 enum?: EnumProps[] | Ref | ((params?: any) => Promise) // 枚举字典 } }