form.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import { Component, CSSProperties } from 'vue'
  2. import type { FormItemRule } from 'element-plus'
  3. declare global {
  4. /**
  5. * input可用attr,用于代码提示,渲染不同输入组件时,需要的attr是不一样的
  6. * https://element-plus.org/zh-CN/component/input.html#input-属性
  7. */
  8. interface InputAttr {
  9. id?: string
  10. name?: string
  11. type?: string
  12. placeholder?: string
  13. maxlength?: string | number
  14. minlength?: string | number
  15. 'show-word-limit'?: boolean
  16. clearable?: boolean
  17. 'show-password'?: boolean
  18. disabled?: boolean
  19. size?: 'large' | 'default' | 'small'
  20. 'prefix-icon'?: string | Component
  21. 'suffix-icon'?: string | Component
  22. rows?: number
  23. border?: boolean
  24. autosize?: boolean | anyObj
  25. autocomplete?: string
  26. readonly?: boolean
  27. max?: string | number
  28. min?: string | number
  29. step?: string | number
  30. resize?: 'none' | 'both' | 'horizontal' | 'vertical'
  31. autofocus?: boolean
  32. form?: string
  33. label?: string
  34. tabindex?: string | number
  35. 'validate-event'?: boolean
  36. 'input-style'?: anyObj
  37. // DateTimePicker属性
  38. editable?: boolean
  39. 'start-placeholder'?: string
  40. 'end-placeholder'?: string
  41. 'time-arrow-control'?: boolean
  42. format?: string
  43. 'popper-class'?: string
  44. 'range-separator'?: string
  45. 'default-value'?: Date
  46. 'default-time'?: Date | Date[]
  47. 'value-format'?: string
  48. 'unlink-panels'?: boolean
  49. 'clear-icon'?: string | Component
  50. shortcuts?: { text: string; value: Date | Function }[]
  51. disabledDate?: Function
  52. cellClassName?: Function
  53. teleported?: boolean
  54. // select属性
  55. multiple?: boolean
  56. 'value-key'?: string
  57. 'collapse-tags'?: string
  58. 'collapse-tags-tooltip'?: boolean
  59. 'multiple-limit'?: number
  60. effect?: 'dark' | 'light'
  61. filterable?: boolean
  62. 'allow-create'?: boolean
  63. 'filter-method'?: Function
  64. remote?: false // 禁止使用远程搜索,如需使用请使用单独封装好的 remoteSelect 组件
  65. 'remote-method'?: false
  66. 'no-match-text'?: string
  67. 'no-data-text'?: string
  68. 'reserve-keyword'?: boolean
  69. 'default-first-option'?: boolean
  70. 'popper-append-to-body'?: boolean
  71. persistent?: boolean
  72. 'automatic-dropdown'?: boolean
  73. 'fit-input-width'?: boolean
  74. 'tag-type'?: 'success' | 'info' | 'warning' | 'danger'
  75. params?: anyObj
  76. // 远程select属性
  77. pk?: string
  78. field?: string
  79. 'remote-url'?: string
  80. showRefresh?:boolean
  81. // 图标选择器属性
  82. 'show-icon-name'?: boolean
  83. placement?: string
  84. title?: string
  85. // 图片文件上传属性
  86. action?: string
  87. headers?: anyObj
  88. method?: string
  89. data?: anyObj
  90. 'with-credentials'?: boolean
  91. 'show-file-list'?: boolean
  92. drag?: boolean
  93. accept?: boolean
  94. 'list-type'?: string
  95. 'auto-upload'?: boolean
  96. limit?: number
  97. // editor属性
  98. height?: string
  99. mode?: string
  100. editorStyle?: CSSProperties
  101. style?: CSSProperties
  102. toolbarConfig?: anyObj
  103. editorConfig?: anyObj
  104. // 返回数据类型
  105. 'data-type'?: string
  106. // 事件
  107. onPreview?: Function
  108. onRemove?: Function
  109. onSuccess?: Function
  110. onError?: Function
  111. onProgress?: Function
  112. onExceed?: Function
  113. onBeforeUpload?: Function
  114. onBeforeRemove?: Function
  115. onChange?: Function
  116. onInput?: Function
  117. onVisibleChange?: Function
  118. onRemoveTag?: Function
  119. onClear?: Function
  120. onBlur?: Function
  121. onFocus?: Function
  122. onCalendarChange?: Function
  123. onPanelChange?: Function
  124. }
  125. interface FormItemAttr {
  126. id?: string
  127. class?: string
  128. prop?: string | string[]
  129. 'label-width'?: string | number
  130. required?: boolean
  131. rules?: FormItemRule | FormItemRule[]
  132. error?: string
  133. 'show-message'?: boolean
  134. 'inline-message'?: boolean
  135. size?: 'large' | 'default' | 'small'
  136. style?: CSSProperties
  137. 'block-help'?: string
  138. }
  139. }