dropdown.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var trigger = require('../../tooltip/src/trigger.js');
  4. var popper = require('../../popper/src/popper.js');
  5. var runtime = require('../../../utils/vue/props/runtime.js');
  6. var aria = require('../../../constants/aria.js');
  7. var content = require('../../tooltip/src/content.js');
  8. var icon = require('../../../utils/vue/icon.js');
  9. var collection = require('../../collection/src/collection.js');
  10. const dropdownProps = runtime.buildProps({
  11. trigger: trigger.useTooltipTriggerProps.trigger,
  12. triggerKeys: {
  13. type: runtime.definePropType(Array),
  14. default: () => [
  15. aria.EVENT_CODE.enter,
  16. aria.EVENT_CODE.numpadEnter,
  17. aria.EVENT_CODE.space,
  18. aria.EVENT_CODE.down
  19. ]
  20. },
  21. effect: {
  22. ...content.useTooltipContentProps.effect,
  23. default: "light"
  24. },
  25. type: {
  26. type: runtime.definePropType(String)
  27. },
  28. placement: {
  29. type: runtime.definePropType(String),
  30. default: "bottom"
  31. },
  32. popperOptions: {
  33. type: runtime.definePropType(Object),
  34. default: () => ({})
  35. },
  36. id: String,
  37. size: {
  38. type: String,
  39. default: ""
  40. },
  41. splitButton: Boolean,
  42. hideOnClick: {
  43. type: Boolean,
  44. default: true
  45. },
  46. loop: {
  47. type: Boolean,
  48. default: true
  49. },
  50. showTimeout: {
  51. type: Number,
  52. default: 150
  53. },
  54. hideTimeout: {
  55. type: Number,
  56. default: 150
  57. },
  58. tabindex: {
  59. type: runtime.definePropType([Number, String]),
  60. default: 0
  61. },
  62. maxHeight: {
  63. type: runtime.definePropType([Number, String]),
  64. default: ""
  65. },
  66. popperClass: {
  67. type: String,
  68. default: ""
  69. },
  70. disabled: Boolean,
  71. role: {
  72. type: String,
  73. values: popper.roleTypes,
  74. default: "menu"
  75. },
  76. buttonProps: {
  77. type: runtime.definePropType(Object)
  78. },
  79. teleported: content.useTooltipContentProps.teleported,
  80. persistent: {
  81. type: Boolean,
  82. default: true
  83. }
  84. });
  85. const dropdownItemProps = runtime.buildProps({
  86. command: {
  87. type: [Object, String, Number],
  88. default: () => ({})
  89. },
  90. disabled: Boolean,
  91. divided: Boolean,
  92. textValue: String,
  93. icon: {
  94. type: icon.iconPropType
  95. }
  96. });
  97. const dropdownMenuProps = runtime.buildProps({
  98. onKeydown: { type: runtime.definePropType(Function) }
  99. });
  100. const FIRST_KEYS = [
  101. aria.EVENT_CODE.down,
  102. aria.EVENT_CODE.pageDown,
  103. aria.EVENT_CODE.home
  104. ];
  105. const LAST_KEYS = [aria.EVENT_CODE.up, aria.EVENT_CODE.pageUp, aria.EVENT_CODE.end];
  106. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  107. const {
  108. ElCollection,
  109. ElCollectionItem,
  110. COLLECTION_INJECTION_KEY,
  111. COLLECTION_ITEM_INJECTION_KEY
  112. } = collection.createCollectionWithScope("Dropdown");
  113. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  114. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  115. exports.ElCollection = ElCollection;
  116. exports.ElCollectionItem = ElCollectionItem;
  117. exports.FIRST_KEYS = FIRST_KEYS;
  118. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  119. exports.LAST_KEYS = LAST_KEYS;
  120. exports.dropdownItemProps = dropdownItemProps;
  121. exports.dropdownMenuProps = dropdownMenuProps;
  122. exports.dropdownProps = dropdownProps;
  123. //# sourceMappingURL=dropdown.js.map