Comparing version
@@ -14,8 +14,10 @@ /** @jsx React.DOM */ | ||
var handleDeselect = function (selectedKey) { | ||
console.log(this.x + ' deselect ' + selectedKey); | ||
}.bind({ | ||
x: 1 | ||
}); | ||
function handleClick(selectedKey) { | ||
console.log('click ' + selectedKey); | ||
} | ||
function handleDeselect(selectedKey) { | ||
console.log(' deselect ' + selectedKey); | ||
} | ||
var titleRight = <span>sub menu | ||
@@ -39,3 +41,5 @@ <i className="fa fa-caret-right pull-right"></i> | ||
var leftMenu = ( | ||
<Menu onSelect={handleSelect} onDeselect={handleDeselect}> | ||
<Menu onSelect={handleSelect} | ||
onClick={handleClick} | ||
onDeselect={handleDeselect}> | ||
<SubMenu title={titleRight} key="1"> | ||
@@ -42,0 +46,0 @@ <MenuItem key="1-1">0-1</MenuItem> |
@@ -231,2 +231,3 @@ /** @jsx React.DOM */ | ||
selected: state.selectedKeys.indexOf(key) !== -1, | ||
onClick: this.props.onClick, | ||
onDeselect: createChainedFunction(childProps.onDeselect, this.handleDeselect), | ||
@@ -279,2 +280,3 @@ onDestroy: this.handleDestroy, | ||
onSelect: noop, | ||
onClick: noop, | ||
onDeselect: noop | ||
@@ -281,0 +283,0 @@ }; |
@@ -52,11 +52,13 @@ /** @jsx React.DOM */ | ||
var props = this.props; | ||
var eventKey = props.eventKey; | ||
props.onClick(eventKey, this, e); | ||
if (props.multiple) { | ||
if (props.selected) { | ||
props.onDeselect(props.eventKey, this, e); | ||
props.onDeselect(eventKey, this, e); | ||
} else { | ||
props.onSelect(props.eventKey, this, e); | ||
props.onSelect(eventKey, this, e); | ||
} | ||
} else { | ||
if (!props.selected) { | ||
props.onSelect(props.eventKey, this, e); | ||
props.onSelect(eventKey, this, e); | ||
} | ||
@@ -111,2 +113,3 @@ } | ||
onSelect: React.PropTypes.func, | ||
onClick: React.PropTypes.func, | ||
onDeselect: React.PropTypes.func, | ||
@@ -113,0 +116,0 @@ onHover: React.PropTypes.func, |
@@ -124,2 +124,6 @@ /** @jsx React.DOM */ | ||
handleSubMenuClick(key, menuItem, e) { | ||
this.props.onClick(key, menuItem, e); | ||
}, | ||
handleSelect(childKey, child, e) { | ||
@@ -183,2 +187,3 @@ // propagate | ||
focusable: false, | ||
onClick: this.handleSubMenuClick, | ||
onSelect: this.handleSelect, | ||
@@ -194,2 +199,3 @@ onDeselect: this.handleDeselect, | ||
baseProps.ref = createChainedFunction(menu.ref, this.saveMenuInstance); | ||
baseProps.onClick = createChainedFunction(menu.props.onClick, this.handleSubMenuClick); | ||
this._cacheMenu = React.cloneElement(menu, baseProps); | ||
@@ -196,0 +202,0 @@ } else { |
{ | ||
"name": "rc-menu", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "menu ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
41608
1.06%1050
1.25%