select.mjs 3.5 KB

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