rsuite-check-tree
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -99,19 +99,9 @@ 'use strict'; | ||
_this.getSelectedValues = function (activeNode) { | ||
_this.getSelectedValues = function (nextData) { | ||
var _this$props2 = _this.props, | ||
relation = _this$props2.relation, | ||
valueKey = _this$props2.valueKey, | ||
childrenKey = _this$props2.childrenKey; | ||
var checkState = activeNode.checkState; | ||
var selectedValues = _this.state.selectedValues; | ||
var selectedValues = []; | ||
if (activeNode.checkState === 'checked') { | ||
selectedValues.push(activeNode[valueKey]); | ||
} else if (checkState === 'unchecked') { | ||
_lodash2.default.remove(selectedValues, function (value) { | ||
return value === activeNode[valueKey]; | ||
}); | ||
} | ||
var loop = function loop(nodes) { | ||
@@ -121,6 +111,2 @@ nodes.forEach(function (node) { | ||
selectedValues.push(node[valueKey]); | ||
} else if (checkState === 'unchecked') { | ||
_lodash2.default.remove(selectedValues, function (value) { | ||
return value === node[valueKey]; | ||
}); | ||
} | ||
@@ -132,7 +118,4 @@ if (node[childrenKey]) { | ||
}; | ||
loop(nextData); | ||
if (relation && activeNode[childrenKey]) { | ||
loop(activeNode[childrenKey]); | ||
} | ||
return selectedValues; | ||
@@ -202,3 +185,2 @@ }; | ||
_this.handleSelect = function (activeNodeData, layer) { | ||
var selectedValues = _this.state.selectedValues; | ||
var _this$props5 = _this.props, | ||
@@ -216,10 +198,10 @@ valueKey = _this$props5.valueKey, | ||
relation && _this.checkChildren(activeNode[childrenKey], activeNode.checkState); | ||
_this.getSelectedValues(activeNode); | ||
var selectedValues = _this.getSelectedValues(nextData); | ||
_this.setState({ | ||
data: nextData | ||
data: nextData, | ||
selectedValues: selectedValues | ||
}, function () { | ||
onChange && onChange(selectedValues); | ||
onSelect && onSelect(activeNode, nextData, layer); | ||
}); | ||
onChange && onChange(selectedValues); | ||
onSelect && onSelect(activeNode, nextData, layer); | ||
} | ||
@@ -226,0 +208,0 @@ }; |
{ | ||
"name": "rsuite-check-tree", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "A react check tree component", | ||
@@ -13,3 +13,5 @@ "scripts": { | ||
"test": "npm run lint", | ||
"publish-docs": "node docs/gh-pages.js" | ||
"publish-docs": "node docs/gh-pages.js", | ||
"predeploy": "npm run build", | ||
"deploy": "npm publish" | ||
}, | ||
@@ -94,2 +96,2 @@ "main": "lib/index.js", | ||
} | ||
} | ||
} |
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
44274
885