@@ -17,6 +17,7 @@ import PopupTrigger from './PopupTrigger';
1717import Icon from '../Icon' ;
1818import useActive from '../hooks/useActive' ;
1919import { warnItemProp } from '../utils/warnUtil' ;
20+ import { genMultiMode } from '../utils/multiModeUtil' ;
2021import useDirectionStyle from '../hooks/useDirectionStyle' ;
2122import InlineSubMenuList from './InlineSubMenuList' ;
2223import {
@@ -104,6 +105,7 @@ const InternalSubMenu = (props: SubMenuProps) => {
104105 const {
105106 prefixCls,
106107 mode,
108+ inlineMaxLevel,
107109 openKeys,
108110
109111 // Disabled
@@ -129,6 +131,7 @@ const InternalSubMenu = (props: SubMenuProps) => {
129131
130132 const { isSubPathKey } = React . useContext ( PathUserContext ) ;
131133 const connectedPath = useFullPath ( ) ;
134+ const isMultiMode = genMultiMode ( connectedPath , mode , inlineMaxLevel ) ;
132135
133136 const subMenuPrefixCls = `${ prefixCls } -submenu` ;
134137 const mergedDisabled = contextDisabled || disabled ;
@@ -168,25 +171,23 @@ const InternalSubMenu = (props: SubMenuProps) => {
168171 }
169172 } ;
170173
171- const onInternalMouseEnter : React . MouseEventHandler < HTMLLIElement > =
172- domEvent => {
173- triggerChildrenActive ( true ) ;
174+ const onInternalMouseEnter : React . MouseEventHandler < HTMLLIElement > = domEvent => {
175+ triggerChildrenActive ( true ) ;
174176
175- onMouseEnter ?.( {
176- key : eventKey ,
177- domEvent,
178- } ) ;
179- } ;
177+ onMouseEnter ?.( {
178+ key : eventKey ,
179+ domEvent,
180+ } ) ;
181+ } ;
180182
181- const onInternalMouseLeave : React . MouseEventHandler < HTMLLIElement > =
182- domEvent => {
183- triggerChildrenActive ( false ) ;
183+ const onInternalMouseLeave : React . MouseEventHandler < HTMLLIElement > = domEvent => {
184+ triggerChildrenActive ( false ) ;
184185
185- onMouseLeave ?.( {
186- key : eventKey ,
187- domEvent,
188- } ) ;
189- } ;
186+ onMouseLeave ?.( {
187+ key : eventKey ,
188+ domEvent,
189+ } ) ;
190+ } ;
190191
191192 const mergedActive = React . useMemo ( ( ) => {
192193 if ( active ) {
@@ -233,6 +234,9 @@ const InternalSubMenu = (props: SubMenuProps) => {
233234 if ( mode !== 'inline' ) {
234235 onOpenChange ( eventKey , newVisible ) ;
235236 }
237+ if ( isMultiMode . isMultiPopup ) {
238+ onOpenChange ( eventKey , newVisible ) ;
239+ }
236240 } ;
237241
238242 /**
@@ -287,6 +291,10 @@ const InternalSubMenu = (props: SubMenuProps) => {
287291 triggerModeRef . current = connectedPath . length > 1 ? 'vertical' : mode ;
288292 }
289293
294+ if ( isMultiMode . isMultiPopup ) {
295+ triggerModeRef . current = 'vertical' ;
296+ }
297+
290298 if ( ! overflowDisabled ) {
291299 const triggerMode = triggerModeRef . current ;
292300
@@ -296,17 +304,23 @@ const InternalSubMenu = (props: SubMenuProps) => {
296304 < PopupTrigger
297305 mode = { triggerMode }
298306 prefixCls = { subMenuPrefixCls }
299- visible = { ! internalPopupClose && open && mode !== 'inline' }
307+ visible = {
308+ ! internalPopupClose &&
309+ open &&
310+ ( mode !== 'inline' || isMultiMode . isMultiPopup )
311+ }
300312 popupClassName = { popupClassName }
301313 popupOffset = { popupOffset }
302314 popup = {
303315 < MenuContextProvider
304316 // Special handle of horizontal mode
305317 mode = { triggerMode === 'horizontal' ? 'vertical' : triggerMode }
306318 >
307- < SubMenuList id = { popupId } ref = { popupRef } >
308- { children }
309- </ SubMenuList >
319+ { ! isMultiMode . isMulti || isMultiMode . isPopup ? (
320+ < SubMenuList id = { popupId } ref = { popupRef } >
321+ { children }
322+ </ SubMenuList >
323+ ) : null }
310324 </ MenuContextProvider >
311325 }
312326 disabled = { mergedDisabled }
@@ -339,6 +353,7 @@ const InternalSubMenu = (props: SubMenuProps) => {
339353 [ `${ subMenuPrefixCls } -active` ] : mergedActive ,
340354 [ `${ subMenuPrefixCls } -selected` ] : childrenSelected ,
341355 [ `${ subMenuPrefixCls } -disabled` ] : mergedDisabled ,
356+ [ `${ subMenuPrefixCls } -multi` ] : isMultiMode . isMultiPopup ,
342357 } ,
343358 ) }
344359 onMouseEnter = { onInternalMouseEnter }
@@ -347,7 +362,7 @@ const InternalSubMenu = (props: SubMenuProps) => {
347362 { titleNode }
348363
349364 { /* Inline mode */ }
350- { ! overflowDisabled && (
365+ { ! overflowDisabled && ( ! isMultiMode . isMulti || ! isMultiMode . isPopup ) && (
351366 < InlineSubMenuList id = { popupId } open = { open } keyPath = { connectedPath } >
352367 { children }
353368 </ InlineSubMenuList >
0 commit comments