diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 8838592c9..7adc7e8ed 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -63,7 +63,7 @@ const Dropdown = defineComponent({ // menu should be focusable in dropdown defaultly const overlayProps = overlayNode && getPropsData(overlayNode); const { selectable = false, focusable = true } = (overlayProps || {}) as any; - const expandIcon = ( + const expandIcon = () => ( diff --git a/components/dropdown/style/index.less b/components/dropdown/style/index.less index 835adb321..f61c38aba 100644 --- a/components/dropdown/style/index.less +++ b/components/dropdown/style/index.less @@ -68,6 +68,9 @@ &-submenu-popup { position: absolute; z-index: @zindex-dropdown; + background: transparent; + box-shadow: none; + transform-origin: 0 0; > .@{dropdown-prefix-cls}-menu { transform-origin: 0 0; @@ -81,7 +84,6 @@ ul { margin-right: 0.3em; margin-left: 0.3em; - padding: 0; } } diff --git a/components/menu/src/Menu.tsx b/components/menu/src/Menu.tsx index 45cd20b19..1f94f1453 100644 --- a/components/menu/src/Menu.tsx +++ b/components/menu/src/Menu.tsx @@ -49,6 +49,8 @@ export const menuProps = { triggerSubMenuAction: { type: String as PropType, default: 'hover' }, getPopupContainer: Function as PropType<(node: HTMLElement) => HTMLElement>, + + expandIcon: Function as PropType<(p?: { isOpen: boolean; [key: string]: any }) => any>, }; export type MenuProps = Partial>; @@ -66,6 +68,7 @@ export default defineComponent({ 'click', 'update:activeKey', ], + slots: ['expandIcon'], setup(props, { slots, emit }) { const { prefixCls, direction } = useConfigInject('menu', props); const store = ref>({}); @@ -371,6 +374,7 @@ export default defineComponent({ unRegisterMenuInfo, selectedSubMenuEventKeys, isRootMenu: true, + expandIcon: props.expandIcon || slots.expandIcon, }); return () => { const childList = flattenChildren(slots.default?.()); diff --git a/components/menu/src/SubMenu.tsx b/components/menu/src/SubMenu.tsx index 762da791b..0aadbd0c7 100644 --- a/components/menu/src/SubMenu.tsx +++ b/components/menu/src/SubMenu.tsx @@ -24,6 +24,7 @@ const subMenuProps = { popupOffset: Array as PropType, internalPopupClose: Boolean, eventKey: String, + expandIcon: Function as PropType<(p?: { isOpen: boolean; [key: string]: any }) => any>, }; export type SubMenuProps = Partial>; @@ -32,7 +33,7 @@ export default defineComponent({ name: 'ASubMenu', inheritAttrs: false, props: subMenuProps, - slots: ['icon', 'title'], + slots: ['icon', 'title', 'expandIcon'], emits: ['titleClick', 'mouseenter', 'mouseleave'], setup(props, { slots, attrs, emit }) { useProvideFirstLevel(false); @@ -84,6 +85,7 @@ export default defineComponent({ selectedSubMenuEventKeys, motion, defaultMotions, + expandIcon: menuExpandIcon, } = useInjectMenu(); registerMenuInfo(eventKey, menuInfo); @@ -226,6 +228,7 @@ export default defineComponent({ const icon = getPropsSlot(slots, props, 'icon'); const title = renderTitle(getPropsSlot(slots, props, 'title'), icon); const subMenuPrefixClsValue = subMenuPrefixCls.value; + const expandIcon = props.expandIcon || slots.expandIcon || menuExpandIcon; let titleNode = (
)} diff --git a/components/menu/src/hooks/useMenuContext.ts b/components/menu/src/hooks/useMenuContext.ts index c200c613e..c7815f2b3 100644 --- a/components/menu/src/hooks/useMenuContext.ts +++ b/components/menu/src/hooks/useMenuContext.ts @@ -77,7 +77,7 @@ export interface MenuContextProps { // // Icon // itemIcon?: RenderIconType; - // expandIcon?: RenderIconType; + expandIcon?: (p?: { isOpen: boolean; [key: string]: any }) => any; // // Function onItemClick: MenuClickEventHandler;