增加autoSelectWhenFocus参数
This commit is contained in:
parent
101756fa84
commit
10903ed0e4
|
@ -575,7 +575,9 @@ var Tree = function (_React$Component) {
|
|||
this.setState({
|
||||
focusKey: eventKey
|
||||
});
|
||||
// this.onSelect(nextTreeNode);
|
||||
if (props.autoSelectWhenFocus) {
|
||||
this.onSelect(nextTreeNode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -628,7 +630,9 @@ var Tree = function (_React$Component) {
|
|||
this.setState({
|
||||
focusKey: eventKey
|
||||
});
|
||||
// this.onSelect(prevTreeNode);
|
||||
if (props.autoSelectWhenFocus) {
|
||||
this.onSelect(prevTreeNode);
|
||||
}
|
||||
};
|
||||
// all keyboard events callbacks run from here at first
|
||||
|
||||
|
@ -1217,7 +1221,8 @@ Tree.propTypes = {
|
|||
openAnimation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
||||
lazyLoad: _propTypes2["default"].bool,
|
||||
treeData: _propTypes2["default"].array,
|
||||
renderTreeNodes: _propTypes2["default"].func
|
||||
renderTreeNodes: _propTypes2["default"].func,
|
||||
autoSelectWhenFocus: _propTypes2["default"].bool
|
||||
};
|
||||
|
||||
Tree.defaultProps = {
|
||||
|
@ -1244,7 +1249,8 @@ Tree.defaultProps = {
|
|||
onDrop: noop,
|
||||
onDragEnd: noop,
|
||||
tabIndexValue: 0,
|
||||
lazyLoad: false
|
||||
lazyLoad: false,
|
||||
autoSelectWhenFocus: false
|
||||
};
|
||||
|
||||
exports["default"] = Tree;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -59,6 +59,7 @@ import 'bee-tree/build/Tree.css';
|
|||
|lazyLoad|是否使用懒加载(适用于大数据场景),[如何使用](http://bee.tinper.org/tinper-bee/bee-tree#%E6%BB%9A%E5%8A%A8%E5%8A%A0%E8%BD%BD%E6%A0%91%E8%8A%82%E7%82%B9)|bool|false
|
||||
|renderTitle|使用 treeData 渲染树时使用,可通过此函数自定义树节点内容|Function(item)|-
|
||||
|renderTreeNodes|使用 treeData 渲染树节点时,可使用该函数自定义节点显示内容(非必须)|Function(data)|-
|
||||
|autoSelectWhenFocus|使用“↑、↓”快捷键切换焦点时,是否自动选中树节点|bool|false
|
||||
|
||||
|
||||
### TreeNode
|
||||
|
|
14
src/Tree.js
14
src/Tree.js
|
@ -529,7 +529,9 @@ onExpand(treeNode,keyType) {
|
|||
this.setState({
|
||||
focusKey: eventKey
|
||||
})
|
||||
// this.onSelect(nextTreeNode);
|
||||
if(props.autoSelectWhenFocus){
|
||||
this.onSelect(nextTreeNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -583,7 +585,9 @@ onExpand(treeNode,keyType) {
|
|||
this.setState({
|
||||
focusKey: eventKey
|
||||
})
|
||||
// this.onSelect(prevTreeNode);
|
||||
if(props.autoSelectWhenFocus){
|
||||
this.onSelect(prevTreeNode);
|
||||
}
|
||||
}
|
||||
// all keyboard events callbacks run from here at first
|
||||
onKeyDown(e,treeNode) {
|
||||
|
@ -1128,7 +1132,8 @@ Tree.propTypes = {
|
|||
openAnimation: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
||||
lazyLoad: PropTypes.bool,
|
||||
treeData: PropTypes.array,
|
||||
renderTreeNodes: PropTypes.func
|
||||
renderTreeNodes: PropTypes.func,
|
||||
autoSelectWhenFocus: PropTypes.bool
|
||||
};
|
||||
|
||||
Tree.defaultProps = {
|
||||
|
@ -1155,7 +1160,8 @@ Tree.defaultProps = {
|
|||
onDrop: noop,
|
||||
onDragEnd: noop,
|
||||
tabIndexValue:0,
|
||||
lazyLoad: false
|
||||
lazyLoad: false,
|
||||
autoSelectWhenFocus: false
|
||||
};
|
||||
|
||||
export default Tree;
|
Loading…
Reference in New Issue