ProFormOld.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { type FormItemRule } from 'element-plus'
  2. export = Form
  3. export as namespace Form
  4. export type FieldNamesProps = {
  5. label: string
  6. value: string
  7. children?: string
  8. }
  9. export interface EnumProps {
  10. label?: string // 选项框显示的文字
  11. value?: string | number | boolean | any[] // 选项框值
  12. disabled?: boolean // 是否禁用此选项
  13. tagType?: string // 当 tag 为 true 时,此选择会指定 tag 显示类型
  14. children?: EnumProps[] // 为树形选择时,可以通过 children 属性指定子选项
  15. [key: string]: any
  16. }
  17. declare namespace Form {
  18. type ItemType =
  19. | 'password'
  20. | 'text'
  21. | 'textarea'
  22. | 'radio'
  23. | 'checkbox'
  24. | 'select'
  25. | 'select-v2'
  26. | 'select-tree'
  27. | 'date-picker'
  28. | 'input-number'
  29. | 'select-icon'
  30. // 当FiledItem的type === 'radio' | 'checkbox'时的需要的参数类型
  31. interface IFieldOptions {
  32. labelKey?: string
  33. valueKey?: string
  34. children?: string
  35. placeholder?: string
  36. data?: Record<string, any>[]
  37. multiple?: boolean
  38. type?: IDatePickerType
  39. max?: number
  40. min?: number
  41. filterable?: boolean
  42. allowCreate?: boolean
  43. clearable?: boolean
  44. valueFormat?: string
  45. }
  46. interface Options {
  47. labelWidth?: string | number
  48. labelPosition?: 'left' | 'right' | 'top'
  49. disabled?: boolean
  50. size?: 'large' | 'small' | 'default'
  51. showResetButton?: boolean // 是否展示重置按钮
  52. showCancelButton?: boolean // 是否展示取消按钮
  53. submitButtonText?: string
  54. resetButtonText?: string
  55. cancelButtonText?: string
  56. blockSubmitButton?: boolean // 提交按钮是否以块级按钮呈现
  57. hasFooter?: boolean // 表单是否有footer
  58. }
  59. interface FieldItem {
  60. label?: string
  61. labelWidth?: string | number // 标签宽度,例如 '50px'。 可以使用 auto。
  62. field: string
  63. type?: ItemType
  64. tooltip?: string // 问号,tooltip提示
  65. value?: any
  66. placeholder?: string
  67. disabled?: boolean
  68. readonly?: boolean
  69. options?: IFieldOptions
  70. rules?: FormItemRule[]
  71. clearable?: boolean // 是否可清空
  72. showPassword?: boolean // 是否显示切换密码图标
  73. enterable?: boolean // 当为输入框时,是否启用回车触发提交功能
  74. span?: number // 表单col宽度
  75. enum?: EnumProps[] | Ref<EnumProps[]> | ((params?: any) => Promise<any>) // 枚举字典
  76. }
  77. }