feat:
This commit is contained in:
parent
35f13d00a0
commit
d2a99cd69d
|
@ -513,8 +513,7 @@ var Tree = function (_React$Component) {
|
|||
|
||||
|
||||
Tree.prototype.onKeyDown = function onKeyDown(e, treeNode) {
|
||||
// event.preventDefault()
|
||||
// console.log('-----'+e.keyCode);
|
||||
|
||||
var props = this.props;
|
||||
var currentPos = treeNode.props.pos;
|
||||
var currentIndex = currentPos.substr(currentPos.lastIndexOf('-') + 1);
|
||||
|
@ -523,13 +522,13 @@ var Tree = function (_React$Component) {
|
|||
this.goDown(currentPos, currentIndex, e, treeNode);
|
||||
} else if (e.keyCode == _tinperBeeCore.KeyCode.UP) {
|
||||
this.goUp(currentPos, currentIndex, e, treeNode);
|
||||
} else if (e.keyCode == _tinperBeeCore.KeyCode.LEFT) {
|
||||
} else if (e.keyCode == _tinperBeeCore.KeyCode.LEFT && !treeNode.props.isLeaf) {
|
||||
// 收起树节点
|
||||
this.onExpand(treeNode, 'left');
|
||||
} else if (e.keyCode == _tinperBeeCore.KeyCode.RIGHT && !treeNode.props.isLeaf) {
|
||||
// 展开树节点
|
||||
this.onExpand(treeNode, 'right');
|
||||
} else if (e.keyCode == _tinperBeeCore.KeyCode.SPACE && props.checkable && !treeNode.props.isLeaf) {
|
||||
} else if (e.keyCode == _tinperBeeCore.KeyCode.SPACE && props.checkable) {
|
||||
// 如果是多选tree则进行选中或者反选该节点
|
||||
this.onCheck(treeNode);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ var _propTypes = require('prop-types');
|
|||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _tinperBeeCore = require('tinper-bee-core');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
||||
|
@ -196,7 +198,9 @@ var TreeNode = function (_React$Component) {
|
|||
|
||||
TreeNode.prototype.onKeyDown = function onKeyDown(e) {
|
||||
this.props.root.onKeyDown(e, this);
|
||||
// e.preventDefault();
|
||||
if (e.keyCode !== _tinperBeeCore.KeyCode.TAB) {
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
TreeNode.prototype.renderSwitcher = function renderSwitcher(props, expandedState) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-tree",
|
||||
"version": "1.1.8",
|
||||
"version": "1.1.9",
|
||||
"description": "Tree ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
Loading…
Reference in New Issue