select.mjs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import { placements } from '@popperjs/core';
  2. import { CircleClose, ArrowDown } from '@element-plus/icons-vue';
  3. import { defaultProps } from '../../select-v2/src/useProps.mjs';
  4. import { tagProps } from '../../tag/src/tag2.mjs';
  5. import { scrollbarEmits } from '../../scrollbar/src/scrollbar.mjs';
  6. import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
  7. import { useSizeProp } from '../../../hooks/use-size/index.mjs';
  8. import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
  9. import { iconPropType } from '../../../utils/vue/icon.mjs';
  10. import { useEmptyValuesProps } from '../../../hooks/use-empty-values/index.mjs';
  11. import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
  12. import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
  13. const selectProps = buildProps({
  14. name: String,
  15. id: String,
  16. modelValue: {
  17. type: definePropType([
  18. Array,
  19. String,
  20. Number,
  21. Boolean,
  22. Object
  23. ]),
  24. default: void 0
  25. },
  26. autocomplete: {
  27. type: String,
  28. default: "off"
  29. },
  30. automaticDropdown: Boolean,
  31. size: useSizeProp,
  32. effect: {
  33. type: definePropType(String),
  34. default: "light"
  35. },
  36. disabled: {
  37. type: Boolean,
  38. default: void 0
  39. },
  40. clearable: Boolean,
  41. filterable: Boolean,
  42. allowCreate: Boolean,
  43. loading: Boolean,
  44. popperClass: {
  45. type: String,
  46. default: ""
  47. },
  48. popperStyle: {
  49. type: definePropType([String, Object])
  50. },
  51. popperOptions: {
  52. type: definePropType(Object),
  53. default: () => ({})
  54. },
  55. remote: Boolean,
  56. debounce: {
  57. type: Number,
  58. default: 300
  59. },
  60. loadingText: String,
  61. noMatchText: String,
  62. noDataText: String,
  63. remoteMethod: {
  64. type: definePropType(Function)
  65. },
  66. filterMethod: {
  67. type: definePropType(Function)
  68. },
  69. multiple: Boolean,
  70. multipleLimit: {
  71. type: Number,
  72. default: 0
  73. },
  74. placeholder: {
  75. type: String
  76. },
  77. defaultFirstOption: Boolean,
  78. reserveKeyword: {
  79. type: Boolean,
  80. default: true
  81. },
  82. valueKey: {
  83. type: String,
  84. default: "value"
  85. },
  86. collapseTags: Boolean,
  87. collapseTagsTooltip: Boolean,
  88. maxCollapseTags: {
  89. type: Number,
  90. default: 1
  91. },
  92. teleported: useTooltipContentProps.teleported,
  93. persistent: {
  94. type: Boolean,
  95. default: true
  96. },
  97. clearIcon: {
  98. type: iconPropType,
  99. default: CircleClose
  100. },
  101. fitInputWidth: Boolean,
  102. suffixIcon: {
  103. type: iconPropType,
  104. default: ArrowDown
  105. },
  106. tagType: { ...tagProps.type, default: "info" },
  107. tagEffect: { ...tagProps.effect, default: "light" },
  108. validateEvent: {
  109. type: Boolean,
  110. default: true
  111. },
  112. remoteShowSuffix: Boolean,
  113. showArrow: {
  114. type: Boolean,
  115. default: true
  116. },
  117. offset: {
  118. type: Number,
  119. default: 12
  120. },
  121. placement: {
  122. type: definePropType(String),
  123. values: placements,
  124. default: "bottom-start"
  125. },
  126. fallbackPlacements: {
  127. type: definePropType(Array),
  128. default: ["bottom-start", "top-start", "right", "left"]
  129. },
  130. tabindex: {
  131. type: [String, Number],
  132. default: 0
  133. },
  134. appendTo: useTooltipContentProps.appendTo,
  135. options: {
  136. type: definePropType(Array)
  137. },
  138. props: {
  139. type: definePropType(Object),
  140. default: () => defaultProps
  141. },
  142. ...useEmptyValuesProps,
  143. ...useAriaProps(["ariaLabel"])
  144. });
  145. const selectEmits = {
  146. [UPDATE_MODEL_EVENT]: (val) => true,
  147. [CHANGE_EVENT]: (val) => true,
  148. "popup-scroll": scrollbarEmits.scroll,
  149. "remove-tag": (val) => true,
  150. "visible-change": (visible) => true,
  151. focus: (evt) => evt instanceof FocusEvent,
  152. blur: (evt) => evt instanceof FocusEvent,
  153. clear: () => true
  154. };
  155. export { selectEmits, selectProps };
  156. //# sourceMappingURL=select.mjs.map