You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { SubMenu as RcSubMenu } from 'rc-menu';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
class SubMenu extends React.Component<any, any> {
|
|
|
|
static contextTypes = {
|
|
|
|
antdMenuTheme: PropTypes.string,
|
|
|
|
};
|
|
|
|
private subMenu: any;
|
|
|
|
onKeyDown = (e) => {
|
|
|
|
this.subMenu.onKeyDown(e);
|
|
|
|
}
|
|
|
|
saveSubMenu = (subMenu) => {
|
|
|
|
this.subMenu = subMenu;
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
const { rootPrefixCls, className } = this.props;
|
|
|
|
const theme = this.context.antdMenuTheme;
|
|
|
|
return (
|
|
|
|
<RcSubMenu
|
|
|
|
{...this.props}
|
|
|
|
ref={this.saveSubMenu}
|
|
|
|
popupClassName={classNames(`${rootPrefixCls}-${theme}`, className)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SubMenu;
|