Skip to content

Commit

Permalink
release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
warmhug committed Apr 6, 2016
1 parent f3d3d43 commit 81ebf39
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# History
---

## 1.2.0 / 2016-04-03
## 1.2.0 / 2016-04-06
- improve performance.
- add `checkStrictly` api.
- add `checkStrictly`/`halfCheckedKeys` api.

## 1.1.0 / 2016-01-25
- change `onDrop` params (from `originExpandedKeys` to `rawExpandedKeys`)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ see examples
|defaultExpandedKeys | expand specific treeNodes | String[] | - |
|expandedKeys | Controlled expand specific treeNodes | String[] | - |
|autoExpandParent | whether auto expand parent treeNodes | bool | true |
|defaultCheckedKeys | default checked treeNodes | String[] | [] |
|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[] | [] |
|halfCheckedKeys | when set checkStrictly, it works | String[] | [] |
|checkStrictly| check node precisely, parent and children nodes are not associated| bool | false |
|defaultCheckedKeys | default checked treeNodes | String[] | [] |
|selectedKeys | Controlled selected treeNodes(After setting, defaultSelectedKeys will not work) | String[] | [] |
|defaultSelectedKeys | default selected treeNodes | String[] | [] |
|selectedKeys | Controlled selected treeNodes(After setting, defaultSelectedKeys will not work) | String[] | [] |
|onExpand | fire on treeNode expand or not | function(node, expanded, expandedKeys) | - |
|onCheck | click the treeNode/checkbox to fire | function(checkedKeys, e:{checked: bool, checkedNodes, node, event}) | - |
|onSelect | click the treeNode to fire | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | - |
Expand Down
4 changes: 3 additions & 1 deletion examples/basic-controlled.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const Demo = React.createClass({
// console.log(checkedNodesPositions.filter(i => pps.indexOf(i.pos) > -1).map(i => i.node.key));
this.setState({
checkedKeys,
halfCheckedKeys: ['0-0-key'],
});
},
onSelect(selectedKeys, info) {
Expand Down Expand Up @@ -90,7 +91,8 @@ const Demo = React.createClass({
<h2>checkStrictly</h2>
<Tree checkable multiple={this.props.multiple} defaultExpandAll
onExpand={this.onExpand} expandedKeys={this.state.expandedKeys}
onCheck={this.onCheckStrictly} checkedKeys={this.state.checkedKeys}
onCheck={this.onCheckStrictly}
checkedKeys={this.state.checkedKeys} halfCheckedKeys={this.state.halfCheckedKeys}
checkStrictly>
{loop(gData)}
</Tree>
Expand Down
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",
"version": "1.2.0-beta.3",
"version": "1.2.0",
"description": "tree ui component for react",
"keywords": [
"react",
Expand Down
19 changes: 14 additions & 5 deletions src/Tree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,16 @@ class Tree extends React.Component {
cloneProps.checkable = props.checkable;
cloneProps.checked = (props.checkStrictly ? state.checkedKeys : this.checkedKeys).
indexOf(key) !== -1;
cloneProps.checkPart = props.checkStrictly ? false : this.checkPartKeys.
indexOf(key) !== -1;
if (props.checkStrictly) {
if (props.halfCheckedKeys) {
cloneProps.checkPart = props.halfCheckedKeys.indexOf(key) !== -1 || false;
} else {
cloneProps.checkPart = false;
}
} else {
cloneProps.checkPart = this.checkPartKeys.indexOf(key) !== -1;
}

if (this.treeNodesStates[pos]) {
assign(cloneProps, this.treeNodesStates[pos].siblingPosition);
}
Expand Down Expand Up @@ -543,12 +551,13 @@ Tree.propTypes = {
draggable: PropTypes.bool,
autoExpandParent: PropTypes.bool,
defaultExpandAll: PropTypes.bool,
expandedKeys: PropTypes.arrayOf(PropTypes.string),
defaultExpandedKeys: PropTypes.arrayOf(PropTypes.string),
checkedKeys: PropTypes.arrayOf(PropTypes.string),
expandedKeys: PropTypes.arrayOf(PropTypes.string),
defaultCheckedKeys: PropTypes.arrayOf(PropTypes.string),
selectedKeys: PropTypes.arrayOf(PropTypes.string),
checkedKeys: PropTypes.arrayOf(PropTypes.string),
halfCheckedKeys: PropTypes.arrayOf(PropTypes.string),
defaultSelectedKeys: PropTypes.arrayOf(PropTypes.string),
selectedKeys: PropTypes.arrayOf(PropTypes.string),
onExpand: PropTypes.func,
onCheck: PropTypes.func,
onSelect: PropTypes.func,
Expand Down

0 comments on commit 81ebf39

Please sign in to comment.