From d94aa4cdb5a13ebc9330aefa8aaa4f2b5dcd87c4 Mon Sep 17 00:00:00 2001 From: wzc520pyfm <1528857653@qq.com> Date: Sat, 3 Aug 2024 10:37:21 +0800 Subject: [PATCH] fix(components): [abort popper] fix effect type error (#17758) closed #17751 --- docs/en-US/component/menu.md | 42 +++++++++---------- docs/en-US/component/popover.md | 2 +- packages/components/menu/src/menu.ts | 4 +- packages/components/popper/src/content.ts | 2 +- packages/components/select-v2/src/defaults.ts | 2 +- packages/components/select/src/select.ts | 2 +- .../components/time-select/src/time-select.ts | 2 +- packages/components/tooltip-v2/src/content.ts | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/en-US/component/menu.md b/docs/en-US/component/menu.md index 67328f2919..f8d405d1f0 100644 --- a/docs/en-US/component/menu.md +++ b/docs/en-US/component/menu.md @@ -65,27 +65,27 @@ menu/popper-offset ### Menu Attributes -| Name | Description | Type | Default | -| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | -------- | -| mode | menu display mode | ^[enum]`'horizontal' \| 'vertical'` | vertical | -| collapse | whether the menu is collapsed (available only in vertical mode) | ^[boolean] | false | -| ellipsis | whether the menu is ellipsis (available only in horizontal mode) | ^[boolean] | true | -| ellipsis-icon ^(2.4.4) | custom ellipsis icon (available only in horizontal mode and ellipsis is true) | ^[string] / ^[Component] | — | -| popper-offset ^(2.4.4) | offset of the popper (effective for all submenus) | ^[number] | 6 | -| background-color ^(deprecated) | background color of Menu (hex format) (deprecated, use `--el-menu-bg-color` in a style class instead) | ^[string] | #ffffff | -| text-color ^(deprecated) | text color of Menu (hex format) (deprecated, use `--el-menu-text-color` in a style class instead) | ^[string] | #303133 | -| active-text-color ^(deprecated) | text color of currently active menu item (hex format) (deprecated, use `--el-menu-active-color` in a style class instead) | ^[string] | #409eff | -| default-active | index of active menu on page load | ^[string] | '' | -| default-openeds | array that contains indexes of currently active sub-menus | ^[object]`string[]` | [] | -| unique-opened | whether only one sub-menu can be active | ^[boolean] | false | -| menu-trigger | how sub-menus are triggered, only works when `mode` is 'horizontal' | ^[enum]`'hover' \| 'click'` | hover | -| router | whether `vue-router` mode is activated. If true, index will be used as 'path' to activate the route action. Use with `default-active` to set the active item on load. | ^[boolean] | false | -| collapse-transition | whether to enable the collapse transition | ^[boolean] | true | -| popper-effect ^(2.2.26) | Tooltip theme, built-in theme: `dark` / `light` when menu is collapsed | ^[enum]`'dark' \| 'light'` | dark | -| close-on-click-outside ^(2.4.4) | optional, whether menu is collapsed when clicking outside | ^[boolean] | false | -| popper-class ^(2.5.0) | custom class name for all popup menus | ^[string] | — | -| show-timeout ^(2.5.0) | control timeout for all menus before showing | ^[number] | 300 | -| hide-timeout ^(2.5.0) | control timeout for all menus before hiding | ^[number] | 300 | +| Name | Description | Type | Default | +| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | -------- | +| mode | menu display mode | ^[enum]`'horizontal' \| 'vertical'` | vertical | +| collapse | whether the menu is collapsed (available only in vertical mode) | ^[boolean] | false | +| ellipsis | whether the menu is ellipsis (available only in horizontal mode) | ^[boolean] | true | +| ellipsis-icon ^(2.4.4) | custom ellipsis icon (available only in horizontal mode and ellipsis is true) | ^[string] / ^[Component] | — | +| popper-offset ^(2.4.4) | offset of the popper (effective for all submenus) | ^[number] | 6 | +| background-color ^(deprecated) | background color of Menu (hex format) (deprecated, use `--el-menu-bg-color` in a style class instead) | ^[string] | #ffffff | +| text-color ^(deprecated) | text color of Menu (hex format) (deprecated, use `--el-menu-text-color` in a style class instead) | ^[string] | #303133 | +| active-text-color ^(deprecated) | text color of currently active menu item (hex format) (deprecated, use `--el-menu-active-color` in a style class instead) | ^[string] | #409eff | +| default-active | index of active menu on page load | ^[string] | '' | +| default-openeds | array that contains indexes of currently active sub-menus | ^[object]`string[]` | [] | +| unique-opened | whether only one sub-menu can be active | ^[boolean] | false | +| menu-trigger | how sub-menus are triggered, only works when `mode` is 'horizontal' | ^[enum]`'hover' \| 'click'` | hover | +| router | whether `vue-router` mode is activated. If true, index will be used as 'path' to activate the route action. Use with `default-active` to set the active item on load. | ^[boolean] | false | +| collapse-transition | whether to enable the collapse transition | ^[boolean] | true | +| popper-effect ^(2.2.26) | Tooltip theme, built-in theme: `dark` / `light` when menu is collapsed | ^[enum]`'dark' \| 'light'` / ^[string] | dark | +| close-on-click-outside ^(2.4.4) | optional, whether menu is collapsed when clicking outside | ^[boolean] | false | +| popper-class ^(2.5.0) | custom class name for all popup menus | ^[string] | — | +| show-timeout ^(2.5.0) | control timeout for all menus before showing | ^[number] | 300 | +| hide-timeout ^(2.5.0) | control timeout for all menus before hiding | ^[number] | 300 | ### Menu Events diff --git a/docs/en-US/component/popover.md b/docs/en-US/component/popover.md index cd3554f2ad..0da7844265 100644 --- a/docs/en-US/component/popover.md +++ b/docs/en-US/component/popover.md @@ -76,7 +76,7 @@ popover/directive-usage | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | trigger | how the popover is triggered | ^[enum]`'click' \| 'focus' \| 'hover' \| 'contextmenu'` | hover | | title | popover title | ^[string] | — | -| effect | Tooltip theme, built-in theme: `dark` / `light` | ^[enum]`'dark' \| 'light'` | light | +| effect | Tooltip theme, built-in theme: `dark` / `light` | ^[enum]`'dark' \| 'light'` / ^[string] | light | | content | popover content, can be replaced with a default `slot` | ^[string] | '' | | width | popover width | ^[string] / ^[number] | 150 | | placement | popover placement | ^[enum]`'top' \| 'top-start' \| 'top-end' \| 'bottom' \| 'bottom-start' \| 'bottom-end' \| 'left' \| 'left-start' \| 'left-end' \| 'right' \| 'right-start' \| 'right-end'` | bottom | diff --git a/packages/components/menu/src/menu.ts b/packages/components/menu/src/menu.ts index 9623f5e194..dee314dcd6 100644 --- a/packages/components/menu/src/menu.ts +++ b/packages/components/menu/src/menu.ts @@ -32,6 +32,7 @@ import Menubar from './utils/menu-bar' import ElMenuCollapseTransition from './menu-collapse-transition.vue' import ElSubMenu from './sub-menu' import { useMenuCssVar } from './use-menu-css-var' +import type { PopperEffect } from '@element-plus/components/popper' import type { MenuItemClicked, MenuProvider, SubMenuProvider } from './types' import type { NavigationFailure, Router } from 'vue-router' @@ -138,8 +139,7 @@ export const menuProps = buildProps({ * @description Tooltip theme, built-in theme: `dark` / `light` when menu is collapsed */ popperEffect: { - type: String, - values: ['dark', 'light'], + type: definePropType(String), default: 'dark', }, /** diff --git a/packages/components/popper/src/content.ts b/packages/components/popper/src/content.ts index b7642d4b7a..a9664e7348 100644 --- a/packages/components/popper/src/content.ts +++ b/packages/components/popper/src/content.ts @@ -74,7 +74,7 @@ export const popperContentProps = buildProps({ type: definePropType([String, Array, Object]), }, effect: { - type: definePropType(String), + type: definePropType(String), default: 'dark', }, visible: Boolean, diff --git a/packages/components/select-v2/src/defaults.ts b/packages/components/select-v2/src/defaults.ts index 001253e317..b5f6c3baa2 100644 --- a/packages/components/select-v2/src/defaults.ts +++ b/packages/components/select-v2/src/defaults.ts @@ -49,7 +49,7 @@ export const SelectProps = buildProps({ * @description tooltip theme, built-in theme: `dark` / `light` */ effect: { - type: definePropType(String), + type: definePropType(String), default: 'light', }, /** diff --git a/packages/components/select/src/select.ts b/packages/components/select/src/select.ts index ab7e0e6df6..d0352f6b5e 100644 --- a/packages/components/select/src/select.ts +++ b/packages/components/select/src/select.ts @@ -49,7 +49,7 @@ export const SelectProps = buildProps({ * @description tooltip theme, built-in theme: `dark` / `light` */ effect: { - type: definePropType(String), + type: definePropType(String), default: 'light', }, /** diff --git a/packages/components/time-select/src/time-select.ts b/packages/components/time-select/src/time-select.ts index ec6fb4b3c6..408d56f1b1 100644 --- a/packages/components/time-select/src/time-select.ts +++ b/packages/components/time-select/src/time-select.ts @@ -32,7 +32,7 @@ export const timeSelectProps = buildProps({ * @description Tooltip theme, built-in theme: `dark` / `light` */ effect: { - type: definePropType(String), + type: definePropType(String), default: 'light', }, /** diff --git a/packages/components/tooltip-v2/src/content.ts b/packages/components/tooltip-v2/src/content.ts index 3a92f74e7d..2b55647ffa 100644 --- a/packages/components/tooltip-v2/src/content.ts +++ b/packages/components/tooltip-v2/src/content.ts @@ -28,7 +28,7 @@ export const tooltipV2ContentProps = buildProps({ default: 5, }, effect: { - type: definePropType(String), + type: definePropType(String), default: 'light', }, contentClass: String,