fix(SubMenu): popupStyle not working (#50922)

This commit is contained in:
𝑾𝒖𝒙𝒉 2024-09-19 20:01:03 +08:00 committed by GitHub
parent fac392de60
commit c48fc0fb95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,28 +5,18 @@ import omit from 'rc-util/lib/omit';
import { useZIndex } from '../_util/hooks/useZIndex';
import { cloneElement } from '../_util/reactNode';
import type { MenuContextProps, MenuTheme } from './MenuContext';
import type { MenuContextProps } from './MenuContext';
import MenuContext from './MenuContext';
import type { SubMenuType } from './interface';
interface TitleEventEntity {
key: string;
domEvent: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
}
export interface SubMenuProps {
className?: string;
disabled?: boolean;
level?: number;
export interface SubMenuProps extends Omit<SubMenuType, 'ref' | 'key' | 'children' | 'label'> {
title?: React.ReactNode;
icon?: React.ReactNode;
style?: React.CSSProperties;
onTitleClick?: (e: TitleEventEntity) => void;
onTitleMouseEnter?: (e: TitleEventEntity) => void;
onTitleMouseLeave?: (e: TitleEventEntity) => void;
popupOffset?: [number, number];
popupClassName?: string;
children?: React.ReactNode;
theme?: MenuTheme;
/**
* @deprecated No longer needed, it can now be safely deleted.
* @see: https://github.com/ant-design/ant-design/pull/30638
*/
level?: number;
}
const SubMenu: React.FC<SubMenuProps> = (props) => {
@ -82,6 +72,8 @@ const SubMenu: React.FC<SubMenuProps> = (props) => {
)}
popupStyle={{
zIndex,
// fix: https://github.com/ant-design/ant-design/issues/47826#issuecomment-2360737237
...props.popupStyle,
}}
/>
</MenuContext.Provider>