Comparing version 0.25.0 to 0.25.1
@@ -17,4 +17,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
@@ -67,8 +65,16 @@ | ||
value: function componentWillReceiveProps(nextProps) { | ||
var _setState; | ||
var expandedKeys = this.getDefaultExpandedKeys(nextProps, true); | ||
var checkedKeys = this.getDefaultCheckedKeys(nextProps, true); | ||
var selectedKeys = this.getDefaultSelectedKeys(nextProps, true); | ||
this.setState((_setState = {}, _defineProperty(_setState, expandedKeys && 'expandedKeys', expandedKeys), _defineProperty(_setState, checkedKeys && 'checkedKeys', checkedKeys), _defineProperty(_setState, selectedKeys && 'selectedKeys', selectedKeys), _setState)); | ||
var st = {}; | ||
if (expandedKeys) { | ||
st.expandedKeys = expandedKeys; | ||
} | ||
if (checkedKeys) { | ||
st.checkedKeys = checkedKeys; | ||
} | ||
if (selectedKeys) { | ||
st.selectedKeys = selectedKeys; | ||
} | ||
this.setState(st); | ||
} | ||
@@ -145,3 +151,3 @@ }, { | ||
node: treeNode, | ||
expandedKeys: expandedKeys || this.state.expandedKeys | ||
expandedKeys: expandedKeys && [].concat(_toConsumableArray(expandedKeys)) || [].concat(_toConsumableArray(this.state.expandedKeys)) | ||
}); | ||
@@ -177,3 +183,3 @@ } | ||
dragNode: this.dragNode, | ||
dragNodesKeys: this.dragNodesKeys, | ||
dragNodesKeys: [].concat(_toConsumableArray(this.dragNodesKeys)), | ||
dropPos: this.dropPos + Number(posArr[posArr.length - 1]) | ||
@@ -185,3 +191,3 @@ }; | ||
if ('expandedKeys' in this.props) { | ||
res.originExpandedKeys = this._originExpandedKeys || [].concat(_toConsumableArray(this.state.expandedKeys)); | ||
res.originExpandedKeys = [].concat(_toConsumableArray(this._originExpandedKeys)) || [].concat(_toConsumableArray(this.state.expandedKeys)); | ||
} | ||
@@ -208,5 +214,7 @@ this.props.onTreeDrop(res); | ||
this.setState({ expandedKeys: expandedKeys }); | ||
this.props.onExpand(treeNode, expand, expandedKeys); | ||
// remember the return object, such as expandedKeys, must clone!! | ||
// so you can avoid outer code change it. | ||
this.props.onExpand(treeNode, expand, [].concat(_toConsumableArray(expandedKeys))); | ||
} else { | ||
this.props.onExpand(treeNode, !expand, expandedKeys); | ||
this.props.onExpand(treeNode, !expand, [].concat(_toConsumableArray(expandedKeys))); | ||
} | ||
@@ -261,3 +269,3 @@ | ||
} | ||
newSt.checkedKeys = checkedKeys; | ||
newSt.checkedKeys = [].concat(_toConsumableArray(checkedKeys)); | ||
this.props.onCheck(newSt); | ||
@@ -295,3 +303,3 @@ } | ||
} | ||
newSt.selectedKeys = selectedKeys; | ||
newSt.selectedKeys = [].concat(_toConsumableArray(selectedKeys)); | ||
props.onSelect(newSt); | ||
@@ -298,0 +306,0 @@ } |
{ | ||
"name": "rc-tree", | ||
"version": "0.25.0", | ||
"version": "0.25.1", | ||
"description": "tree ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60698
1518