|
|
@ -89,6 +89,7 @@ class Menu extends React.Component<MenuProps, MenuState> { |
|
|
|
context: any; |
|
|
|
switchingModeFromInline: boolean; |
|
|
|
inlineOpenKeys: string[] = []; |
|
|
|
contextSiderCollapsed: boolean = true; |
|
|
|
|
|
|
|
constructor(props: MenuProps) { |
|
|
|
super(props); |
|
|
@ -129,12 +130,20 @@ class Menu extends React.Component<MenuProps, MenuState> { |
|
|
|
if (prevProps.mode === 'inline' && this.props.mode !== 'inline') { |
|
|
|
this.switchingModeFromInline = true; |
|
|
|
} |
|
|
|
if (this.props.inlineCollapsed && !prevProps.inlineCollapsed) { |
|
|
|
if ( |
|
|
|
(this.props.inlineCollapsed && !prevProps.inlineCollapsed) || |
|
|
|
(this.getInlineCollapsed() && this.contextSiderCollapsed) |
|
|
|
) { |
|
|
|
this.contextSiderCollapsed = false; |
|
|
|
this.switchingModeFromInline = true; |
|
|
|
this.inlineOpenKeys = this.state.openKeys; |
|
|
|
this.setState({ openKeys: [] }); |
|
|
|
} |
|
|
|
if (!this.props.inlineCollapsed && prevProps.inlineCollapsed) { |
|
|
|
if ( |
|
|
|
(!this.props.inlineCollapsed && prevProps.inlineCollapsed) || |
|
|
|
(!this.getInlineCollapsed() && !this.contextSiderCollapsed) |
|
|
|
) { |
|
|
|
this.contextSiderCollapsed = true; |
|
|
|
this.setState({ openKeys: this.inlineOpenKeys }); |
|
|
|
this.inlineOpenKeys = []; |
|
|
|
} |
|
|
|