select.mjs 3.2 KB

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