props.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* eslint-disable @typescript-eslint/no-unused-vars */
  2. import type { InputProps, PopoverProps } from 'element-plus'
  3. import type { PropType } from 'vue'
  4. import type { TableConfig } from './types'
  5. export const tableSelectProps = {
  6. // 绑定值
  7. modelValue: {
  8. type: [String, Number, Array],
  9. default: ''
  10. },
  11. // 是否多选
  12. multiple: Boolean,
  13. // 是否禁用
  14. disabled: Boolean,
  15. // 尺寸
  16. size: {
  17. type: String as PropType<InputProps['size']>,
  18. default: 'default'
  19. },
  20. // 是否支持清除
  21. clearable: {
  22. type: Boolean,
  23. default: true
  24. },
  25. // input 的 autocomplete 属性
  26. autocomplete: String,
  27. // value 的属性名
  28. valueKey: {
  29. type: String,
  30. default: 'id'
  31. },
  32. // label 的属性名
  33. labelKey: {
  34. type: String,
  35. default: 'label'
  36. },
  37. // 回显数据,用于后段分页显示
  38. initValue: [Object, Array],
  39. // 气泡位置
  40. placement: {
  41. type: String,
  42. default: 'bottom-start'
  43. },
  44. // 是否在输入框获得焦点后自动弹出选项菜单
  45. automaticDropdown: Boolean,
  46. // 占位符
  47. placeholder: {
  48. type: String,
  49. default: '请选择'
  50. },
  51. // popover 宽度
  52. popperWidth: {
  53. type: [String, Number],
  54. default: 560
  55. },
  56. // popover 样式
  57. popperClass: String,
  58. // popover 配置项
  59. popperOptions: Object as PropType<PopoverProps['popperOptions']>,
  60. // 表格配置
  61. tableConfig: {
  62. type: Object as PropType<TableConfig>,
  63. default: {
  64. columns: [],
  65. loading: false,
  66. data: [],
  67. total: 0
  68. }
  69. }
  70. }
  71. export type TableSelectProps = ExtractPropTypes<typeof tableSelectProps>
  72. /**
  73. * 事件
  74. */
  75. export const tableSelectEmits = {
  76. // 更新绑定值
  77. 'update:modelValue': (_value: any) => true,
  78. // 清除按钮点击事件
  79. clear: () => true,
  80. // 多选单个清除事件
  81. 'item-clear': (_value: object) => true,
  82. // 获取焦点事件
  83. focus: (_e: FocusEvent) => true,
  84. // 失去焦点事件
  85. blur: (_e: FocusEvent) => true,
  86. // 输入框值改变事件
  87. change: (_value: string | Array<any>) => true
  88. }