cascader2.mjs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import { placements } from '@popperjs/core';
  2. import { CircleClose } from '@element-plus/icons-vue';
  3. import { CommonProps } from '../../cascader-panel/src/config.mjs';
  4. import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
  5. import { useSizeProp } from '../../../hooks/use-size/index.mjs';
  6. import { iconPropType } from '../../../utils/vue/icon.mjs';
  7. import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
  8. import { tagProps } from '../../tag/src/tag2.mjs';
  9. import { useEmptyValuesProps } from '../../../hooks/use-empty-values/index.mjs';
  10. import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
  11. import { isBoolean } from '../../../utils/types.mjs';
  12. const cascaderProps = buildProps({
  13. ...CommonProps,
  14. size: useSizeProp,
  15. placeholder: String,
  16. disabled: {
  17. type: Boolean,
  18. default: void 0
  19. },
  20. clearable: Boolean,
  21. clearIcon: {
  22. type: iconPropType,
  23. default: CircleClose
  24. },
  25. filterable: Boolean,
  26. filterMethod: {
  27. type: definePropType(
  28. Function
  29. ),
  30. default: (node, keyword) => node.text.includes(keyword)
  31. },
  32. separator: {
  33. type: String,
  34. default: " / "
  35. },
  36. showAllLevels: {
  37. type: Boolean,
  38. default: true
  39. },
  40. collapseTags: Boolean,
  41. maxCollapseTags: {
  42. type: Number,
  43. default: 1
  44. },
  45. collapseTagsTooltip: Boolean,
  46. maxCollapseTagsTooltipHeight: {
  47. type: [String, Number]
  48. },
  49. debounce: {
  50. type: Number,
  51. default: 300
  52. },
  53. beforeFilter: {
  54. type: definePropType(Function),
  55. default: () => true
  56. },
  57. placement: {
  58. type: definePropType(String),
  59. values: placements,
  60. default: "bottom-start"
  61. },
  62. fallbackPlacements: {
  63. type: definePropType(Array),
  64. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  65. },
  66. popperClass: useTooltipContentProps.popperClass,
  67. popperStyle: useTooltipContentProps.popperStyle,
  68. teleported: useTooltipContentProps.teleported,
  69. effect: {
  70. type: definePropType(String),
  71. default: "light"
  72. },
  73. tagType: { ...tagProps.type, default: "info" },
  74. tagEffect: { ...tagProps.effect, default: "light" },
  75. validateEvent: {
  76. type: Boolean,
  77. default: true
  78. },
  79. persistent: {
  80. type: Boolean,
  81. default: true
  82. },
  83. showCheckedStrategy: {
  84. type: String,
  85. values: ["parent", "child"],
  86. default: "child"
  87. },
  88. checkOnClickNode: Boolean,
  89. showPrefix: {
  90. type: Boolean,
  91. default: true
  92. },
  93. ...useEmptyValuesProps
  94. });
  95. const emitChangeFn = (value) => true;
  96. const cascaderEmits = {
  97. [UPDATE_MODEL_EVENT]: emitChangeFn,
  98. [CHANGE_EVENT]: emitChangeFn,
  99. focus: (evt) => evt instanceof FocusEvent,
  100. blur: (evt) => evt instanceof FocusEvent,
  101. clear: () => true,
  102. visibleChange: (val) => isBoolean(val),
  103. expandChange: (val) => !!val,
  104. removeTag: (val) => !!val
  105. };
  106. export { cascaderEmits, cascaderProps };
  107. //# sourceMappingURL=cascader2.mjs.map