Browse Source

Merge branch 'master' into antd-3.0

pull/8064/head
afc163 7 years ago
parent
commit
d96284c798
  1. 24
      components/menu/MenuItem.tsx
  2. 2
      components/menu/__tests__/__snapshots__/demo.test.js.snap
  3. 2
      components/menu/demo/switch-mode.md
  4. 4
      package.json

24
components/menu/MenuItem.tsx

@ -3,22 +3,22 @@ import { Item } from 'rc-menu';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Tooltip from '../tooltip'; import Tooltip from '../tooltip';
const MenuItem: any = (props, { inlineCollapsed }) => { class MenuItem extends React.Component<any, any> {
return ( static contextTypes = {
<Tooltip inlineCollapsed: PropTypes.bool,
};
static isMenuItem = 1;
render() {
const { inlineCollapsed } = this.context;
const props = this.props;
return <Tooltip
title={inlineCollapsed && props.level === 1 ? props.children : ''} title={inlineCollapsed && props.level === 1 ? props.children : ''}
placement="right" placement="right"
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`} overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
> >
<Item {...props} /> <Item {...props} />
</Tooltip> </Tooltip>;
); }
}; }
MenuItem.contextTypes = {
inlineCollapsed: PropTypes.bool,
};
MenuItem.isMenuItem = 1;
export default MenuItem; export default MenuItem;

2
components/menu/__tests__/__snapshots__/demo.test.js.snap

@ -582,7 +582,7 @@ exports[`renders ./components/menu/demo/switch-mode.md correctly 1`] = `
<div <div
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
aria-owns="sub2$Menu" aria-owns="sub1-2$Menu"
class="ant-menu-submenu-title" class="ant-menu-submenu-title"
style="padding-left:48px" style="padding-left:48px"
title="Submenu" title="Submenu"

2
components/menu/demo/switch-mode.md

@ -58,7 +58,7 @@ class Sider extends React.Component {
<SubMenu key="sub1" title={<span><Icon type="appstore" /><span>Navigation Three</span></span>}> <SubMenu key="sub1" title={<span><Icon type="appstore" /><span>Navigation Three</span></span>}>
<Menu.Item key="3">Option 3</Menu.Item> <Menu.Item key="3">Option 3</Menu.Item>
<Menu.Item key="4">Option 4</Menu.Item> <Menu.Item key="4">Option 4</Menu.Item>
<SubMenu key="sub2" title="Submenu"> <SubMenu key="sub1-2" title="Submenu">
<Menu.Item key="5">Option 5</Menu.Item> <Menu.Item key="5">Option 5</Menu.Item>
<Menu.Item key="6">Option 6</Menu.Item> <Menu.Item key="6">Option 6</Menu.Item>
</SubMenu> </SubMenu>

4
package.json

@ -76,8 +76,8 @@
"rc-tree-select": "~1.10.2", "rc-tree-select": "~1.10.2",
"rc-upload": "~2.4.0", "rc-upload": "~2.4.0",
"rc-util": "^4.0.4", "rc-util": "^4.0.4",
"react-lazy-load": "^3.0.10", "react-lazy-load": "^3.0.12",
"react-slick": "~0.15.0", "react-slick": "~0.15.4",
"shallowequal": "^1.0.1", "shallowequal": "^1.0.1",
"warning": "~3.0.0" "warning": "~3.0.0"
}, },

Loading…
Cancel
Save