Comparing version 1.2.0-beta to 1.2.0-beta.1
@@ -227,36 +227,38 @@ 'use strict'; | ||
var checkedKeys = [].concat(_toConsumableArray(this.state.checkedKeys)); | ||
if (checked && checkedKeys.indexOf(key) === -1) { | ||
var index = checkedKeys.indexOf(key); | ||
if (checked && index === -1) { | ||
checkedKeys.push(key); | ||
} | ||
// checkStrictly | ||
var _checkedKeys = [].concat(_toConsumableArray(checkedKeys)); | ||
if (this.props.checkStrictly) { | ||
var index = _checkedKeys.indexOf(key); | ||
if (!checked && index > -1) { | ||
_checkedKeys.splice(index, 1); | ||
} | ||
} | ||
var checkKeys = (0, _util.getTreeNodesStates)(this.props.children, checkedKeys, checked, key); | ||
var newSt = { | ||
event: 'check', | ||
node: treeNode, | ||
checked: checked, | ||
checkedNodes: checkKeys.checkedNodes, | ||
checkedNodesPositions: checkKeys.checkedNodesPositions | ||
checked: checked | ||
}; | ||
checkedKeys = checkKeys.checkedKeys; | ||
if (!('checkedKeys' in this.props)) { | ||
this.setState({ | ||
checkedKeys: checkedKeys | ||
// checkStrictly | ||
if (this.props.checkStrictly && 'checkedKeys' in this.props) { | ||
if (!checked && index > -1) { | ||
checkedKeys.splice(index, 1); | ||
} | ||
newSt.checkedNodes = []; | ||
(0, _util.loopAllChildren)(this.props.children, function (item, ind, pos, keyOrPos) { | ||
if (checkedKeys.indexOf(keyOrPos) !== -1) { | ||
checked = true; | ||
newSt.checkedNodes.push(item); | ||
} | ||
}); | ||
} | ||
} else { | ||
var checkKeys = (0, _util.getTreeNodesStates)(this.props.children, checkedKeys, checked, key); | ||
newSt.checkedNodes = checkKeys.checkedNodes; | ||
newSt.checkedNodesPositions = checkKeys.checkedNodesPositions; | ||
if (this.props.checkStrictly) { | ||
delete newSt.checkedNodes; | ||
delete newSt.checkedNodesPositions; | ||
checkedKeys = checkKeys.checkedKeys; | ||
if (!('checkedKeys' in this.props)) { | ||
this.setState({ | ||
checkedKeys: checkedKeys | ||
}); | ||
} | ||
} | ||
this.props.onCheck(this.props.checkStrictly ? _checkedKeys : checkedKeys, newSt); | ||
this.props.onCheck(checkedKeys, newSt); | ||
} | ||
@@ -263,0 +265,0 @@ }, { |
{ | ||
"name": "rc-tree", | ||
"version": "1.2.0-beta", | ||
"version": "1.2.0-beta.1", | ||
"description": "tree ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -72,3 +72,3 @@ # rc-tree | ||
|checkedKeys | Controlled checked treeNodes(After setting, defaultCheckedKeys will not work). Note: parent and children nodes are associated, if the parent node's key exists, it all children node will be checked, and vice versa. | String[] | [] | | ||
|checkStrictly| check the key of node precisely, parent and children nodes are not associated| bool | false | | ||
|checkStrictly| check node precisely, parent and children nodes are not associated| bool | false | | ||
|defaultCheckedKeys | default checked treeNodes | String[] | [] | | ||
@@ -75,0 +75,0 @@ |selectedKeys | Controlled selected treeNodes(After setting, defaultSelectedKeys will not work) | String[] | [] | |
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
57225
1356