Skip to content

Commit

Permalink
fix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
warmhug committed May 30, 2016
1 parent 08b36e3 commit 7ea95e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-tree-select",
"version": "1.7.2",
"version": "1.7.3",
"description": "tree-select ui component for react",
"keywords": [
"react",
Expand Down
10 changes: 10 additions & 0 deletions src/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ const Select = React.createClass({
});
const nArr = unCheckPos.split('-');
const newVals = [];
const newCkTns = [];
checkedTreeNodes.forEach(itemObj => {
const iArr = itemObj.pos.split('-');
if (itemObj.pos === unCheckPos ||
Expand All @@ -606,8 +607,10 @@ const Select = React.createClass({
// 因为 node节点 不选时,其 父级节点 和 所有子节点 都不选。
return;
}
newCkTns.push(itemObj);
newVals.push(itemObj.node.props.value);
});
this.checkedTreeNodes = this._checkedNodes = newCkTns;
const nv = this.state.value.filter(val => newVals.indexOf(val.value) !== -1);
this.fireChange(nv, {triggerValue: selectedValue, clear: true});
},
Expand Down Expand Up @@ -701,6 +704,13 @@ const Select = React.createClass({
}
props.onDeselect(event);
}
if (props.treeCheckable) {
if (this.checkedTreeNodes && this.checkedTreeNodes.length) {
this.checkedTreeNodes = this._checkedNodes = this.checkedTreeNodes.filter(item => {
return value.some(i => i.value === item.node.props.value);
});
}
}
this.fireChange(value, {triggerValue: selectedVal, clear: true});
},

Expand Down

0 comments on commit 7ea95e1

Please sign in to comment.