rc-tree-select
Advanced tools
Comparing version 0.3.6 to 0.4.0
@@ -245,3 +245,3 @@ 'use strict'; | ||
var check = info.event === 'check'; | ||
if (!check && !info.selected) { | ||
if (!check && typeof info.selected === 'boolean' && !info.selected) { | ||
this.onDeselect(info); | ||
@@ -275,4 +275,6 @@ // return; | ||
} | ||
value = [selectedValue]; | ||
label = [selectedLabel]; | ||
value = !check ? [selectedValue] : [].concat(_toConsumableArray(info.checkedKeys)); | ||
label = !check ? [selectedLabel] : info.allCheckedNodesKeys.map(function (i) { | ||
return _this.getLabelFromOption(i.node); | ||
}); | ||
this.setOpenState(false); | ||
@@ -475,2 +477,14 @@ } | ||
isValueChange: function isValueChange(value) { | ||
var sv = this.state.value; | ||
if (typeof sv === 'string') { | ||
sv = [sv]; | ||
} | ||
if (value.length !== sv.length || !value.every(function (val, index) { | ||
return sv[index] === val; | ||
})) { | ||
return true; | ||
} | ||
}, | ||
fireChange: function fireChange(value, label) { | ||
@@ -483,3 +497,5 @@ var props = this.props; | ||
} | ||
props.onChange(this.getVLForOnChange(value), this.getVLForOnChange(label)); | ||
if (this.isValueChange(value)) { | ||
props.onChange(this.getVLForOnChange(value), this.getVLForOnChange(label), [].concat(_toConsumableArray(this.state.value))); | ||
} | ||
}, | ||
@@ -486,0 +502,0 @@ renderTopControlNode: function renderTopControlNode() { |
@@ -94,4 +94,4 @@ 'use strict'; | ||
if (item.pos === nodePos || nArr.length > iArr.length && isInclude(iArr, nArr) || nArr.length < iArr.length && isInclude(nArr, iArr)) { | ||
// 过滤掉 非父级节点 和 所有子节点。 | ||
// 因为 node节点 不选时,其 非父级节点 和 所有子节点 都不选。 | ||
// 过滤掉 父级节点 和 所有子节点。 | ||
// 因为 node节点 不选时,其 父级节点 和 所有子节点 都不选。 | ||
return; | ||
@@ -98,0 +98,0 @@ } |
{ | ||
"name": "rc-tree-select", | ||
"version": "0.3.6", | ||
"version": "0.4.0", | ||
"description": "tree-select 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
85099
2484