Socket
Socket
Sign inDemoInstall

rc-menu

Package Overview
Dependencies
Maintainers
2
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 3.1.1

examples/top.html

2

examples/multiple.js

@@ -46,3 +46,3 @@ /** @jsx React.DOM */

</SubMenu>
<MenuItem key="2" disabled>1</MenuItem>
<MenuItem key="2" disabled>can not deselect me,i'm disabled</MenuItem>
<MenuItem key="3">outer</MenuItem>

@@ -49,0 +49,0 @@ <SubMenu title={titleRight1} key="4">

@@ -14,10 +14,20 @@ /** @jsx React.DOM */

function handleDeselect(selectedKey) {
console.log('deselect ' + selectedKey);
}
var handleDeselect = function (selectedKey) {
console.log(this.x + ' deselect ' + selectedKey);
}.bind({
x: 1
});
var titleRight = <span>sub menu <i className="fa fa-caret-right pull-right"></i></span>;
var titleRight1 = <span>sub menu 1 <i className="fa fa-caret-right pull-right"></i></span>;
var titleRight2 = <span>sub menu 2 <i className="fa fa-caret-right pull-right"></i></span>;
var titleRight3 = <span>sub menu 3 <i className="fa fa-caret-right pull-right"></i></span>;
var titleRight = <span>sub menu
<i className="fa fa-caret-right pull-right"></i>
</span>;
var titleRight1 = <span>sub menu 1
<i className="fa fa-caret-right pull-right"></i>
</span>;
var titleRight2 = <span>sub menu 2
<i className="fa fa-caret-right pull-right"></i>
</span>;
var titleRight3 = <span>sub menu 3
<i className="fa fa-caret-right pull-right"></i>
</span>;
var container = document.getElementById('__react-content');

@@ -27,3 +37,3 @@

function render(container){
function render(container) {
var leftMenu = (

@@ -58,3 +68,6 @@ <Menu onSelect={handleSelect} onDeselect={handleDeselect}>

);
React.render(<div><h1>single selectable menu</h1><div style={{width:400}}>{leftMenu}</div></div>, container);
React.render(<div>
<h1>single selectable menu</h1>
<div style={{width: 400}}>{leftMenu}</div>
</div>, container);
}

@@ -11,2 +11,5 @@ /** @jsx React.DOM */

function noop() {
}
function getActiveKey(props) {

@@ -58,6 +61,9 @@ var activeKey = props.activeKey;

componentWillReceiveProps(nextProps) {
this.setState({
activeKey: getActiveKey.call(this, nextProps),
selectedKeys: nextProps.selectedKeys || []
});
var props = {
activeKey: getActiveKey.call(this, nextProps)
};
if ('selectedKeys' in nextProps) {
props.selectedKeys = nextProps.selectedKeys || [];
}
this.setState(props);
}

@@ -151,2 +157,3 @@

// top menu
// TODO: remove sub judge
if (!props.sub) {

@@ -158,3 +165,3 @@ if (!props.multiple) {

var selectedDescendantProps = selectedDescendant.props;
selectedDescendantProps.onDeselect(selectedDescendantProps.eventKey, selectedDescendant, e);
selectedDescendantProps.onDeselect(selectedDescendantProps.eventKey, selectedDescendant, e, child);
}

@@ -178,2 +185,3 @@ }

}
if (props.onSelect) {

@@ -184,6 +192,7 @@ props.onSelect(key, child, e);

handleDeselect(key, child, e) {
handleDeselect(key, child, e, __childToBeSelected/*internal*/) {
var state = this.state;
var children = this.getChildrenComponents();
// my children
if (this.getChildrenComponents().indexOf(child) !== -1) {
if (children.indexOf(child) !== -1 && children.indexOf(__childToBeSelected) === -1) {
var selectedKeys = state.selectedKeys;

@@ -199,5 +208,3 @@ var index = selectedKeys.indexOf(key);

}
if (this.props.onDeselect) {
this.props.onDeselect(key, child, e);
}
this.props.onDeselect.apply(null, arguments);
}

@@ -276,5 +283,7 @@

prefixCls: 'rc-menu',
focusable: true
focusable: true,
onSelect: noop,
onDeselect: noop
};
module.exports = Menu;

@@ -36,7 +36,7 @@ /** @jsx React.DOM */

_getActiveClassName() {
return this._getPrefixCls()+'-active';
return this._getPrefixCls() + '-active';
},
_getDisabledClassName() {
return this._getPrefixCls()+'-disabled';
return this._getPrefixCls() + '-disabled';
},

@@ -130,5 +130,4 @@

handleDeselect(childKey, child, e) {
// propagate
this.props.onDeselect(childKey, child, e);
handleDeselect() {
this.props.onDeselect.apply(null, arguments);
},

@@ -192,5 +191,2 @@

};
if (this.menuInstance) {
baseProps.selectedKeys = this.menuInstance.state.selectedKeys;
}
if (childrenCount === 1 && children.type === Menu) {

@@ -197,0 +193,0 @@ var menu = children;

{
"name": "rc-menu",
"version": "3.1.0",
"version": "3.1.1",
"description": "menu ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc