Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/DOMWrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import assign from 'object-assign';
const DOMWrap = React.createClass({
propTypes: {
tag: PropTypes.string,
hiddenClassName: PropTypes.string,
visible: PropTypes.bool,
},

getDefaultProps() {
Expand All @@ -19,6 +21,9 @@ const DOMWrap = React.createClass({
props.className += ` ${props.hiddenClassName}`;
}
const Tag = props.tag;
delete props.tag;
delete props.hiddenClassName;
delete props.visible;
return <Tag {...props} />;
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/Divider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Divider = React.createClass({
let className = props.className || '';
const rootPrefixCls = props.rootPrefixCls;
className += ' ' + `${rootPrefixCls}-item-divider`;
return <li {...props} className={className}/>;
return <li className={className} />;
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/MenuItem.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { PropTypes } from 'react';
import { KeyCode } from 'rc-util';
import KeyCode from 'rc-util/lib/KeyCode';
import classnames from 'classnames';
import { noop } from './util';

Expand Down
15 changes: 9 additions & 6 deletions src/MenuMixin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { createChainedFunction, KeyCode } from 'rc-util';
import KeyCode from 'rc-util/lib/KeyCode';
import createChainedFunction from 'rc-util/lib/createChainedFunction';
import classnames from 'classnames';
import scrollIntoView from 'dom-scroll-into-view';
import assign from 'object-assign';
Expand Down Expand Up @@ -255,11 +256,13 @@ const MenuMixin = {
return (
// ESLint is not smart enough to know that the type of `children` was checked.
/* eslint-disable */
<DOMWrap style={props.style}
tag="ul"
hiddenClassName={`${props.prefixCls}-hidden`}
visible={props.visible}
{...domProps}>
<DOMWrap
style={props.style}
tag="ul"
hiddenClassName={`${props.prefixCls}-hidden`}
visible={props.visible}
{...domProps}
>
{React.Children.map(props.children, this.renderMenuItem)}
</DOMWrap>
/*eslint-enable */
Expand Down
3 changes: 2 additions & 1 deletion src/SubMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SubPopupMenu from './SubPopupMenu';
import React, { PropTypes } from 'react';
import { KeyCode, guid } from 'rc-util';
import KeyCode from 'rc-util/lib/KeyCode';
import guid from 'rc-util/lib/guid';
import classnames from 'classnames';
import { noop } from './util';

Expand Down
10 changes: 6 additions & 4 deletions src/SubMenuStateMixin.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import rcUtil, { KeyCode } from 'rc-util';
import KeyCode from 'rc-util/lib/KeyCode';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
import contains from 'rc-util/lib/Dom/contains';
import ReactDOM from 'react-dom';

export default {
Expand Down Expand Up @@ -29,7 +31,7 @@ export default {
handleDocumentClick(e) {
// If the click originated from within this component
// don't do anything.
if (rcUtil.Dom.contains(ReactDOM.findDOMNode(this), e.target)) {
if (contains(ReactDOM.findDOMNode(this), e.target)) {
return;
}
const props = this.props;
Expand All @@ -43,9 +45,9 @@ export default {

bindRootCloseHandlers() {
if (!this._onDocumentClickListener) {
this._onDocumentClickListener = rcUtil.Dom.addEventListener(document,
this._onDocumentClickListener = addEventListener(document,
'click', this.handleDocumentClick);
this._onDocumentKeyupListener = rcUtil.Dom.addEventListener(document,
this._onDocumentKeyupListener = addEventListener(document,
'keyup', this.handleDocumentKeyUp);
}
},
Expand Down