models.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import type { Component } from "vue"
  2. import type { FormItemRule } from "element-plus/es/components/form/src/types"
  3. export type VbFormItem = {
  4. id?: string | (() => string)
  5. field: string
  6. label?: string
  7. show?: boolean | ((v?: any) => boolean)
  8. required?: boolean
  9. itemClass?: string
  10. class?: string
  11. itemStyle?: string
  12. style?: string
  13. type?: string
  14. component?:
  15. | "slot"
  16. | "Slot"
  17. | "innerText"
  18. | "text" //innerText
  19. | "VbSelect"
  20. | "VS" //VbSelect
  21. | "VbSelect"
  22. | "Dict" //DictSelect
  23. | "DictSelect"
  24. | "VS" //VbSelect
  25. | "VbSelectTree"
  26. | "VST" //VbSelectTree
  27. | "I" //ElInput
  28. | "S" //ElSelect
  29. | "C" //ElCheckboxGroup
  30. | "R" //ElRadioGroup
  31. | "D" //ElDatePicker
  32. | Component
  33. innerText?: string //component 为 innerText 时,优先显示的文本,否则会显示当前的字段值
  34. span?: number
  35. labelWidth?: number
  36. size?: "large" | "default" | "small"
  37. placeholder?: string
  38. rules?: Array<string | Array<FormItemRule> | FormItemRule> //全局规则的KEY 或 自定义的规则
  39. ruleFormat?: Array<Array<string | number> | undefined> //数组索引对应rules顺序,对应的rule是自定义的(或者没有format数据)要填undefined eg: [[0,1],undfiend,["名称"]]
  40. data?:
  41. | Array<{
  42. label: string
  43. value: string | number
  44. class?: string
  45. style?: string
  46. disabled?: boolean | ((v: any) => boolean)
  47. }>
  48. | (() => Array<{
  49. label: string
  50. value: string | number
  51. class?: string
  52. style?: string
  53. disabled?: string | ((v: any) => boolean)
  54. }>)
  55. itemProps?: any // 注入到 el-form-item 的属性
  56. props?: any // 当 component 为渲染组件时,注入到渲染组件当中的属性
  57. listeners?: any // 当 component 为渲染组件时,注入到渲染组件当中的事件
  58. }
  59. export type VbFormRowItem = {
  60. children: VbFormItem[]
  61. gutter?: number
  62. className?: string
  63. }