parent
54efd71c7e
commit
ca8ddfcfb2
|
@ -340,6 +340,16 @@ var Tree = function (_React$Component) {
|
||||||
props.onSelect(selectedKeys, newSt);
|
props.onSelect(selectedKeys, newSt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Tree.prototype.onDoubleClick = function onDoubleClick(treeNode) {
|
||||||
|
var props = this.props;
|
||||||
|
var eventKey = treeNode.props.eventKey;
|
||||||
|
var newSt = {
|
||||||
|
event: 'dblclick',
|
||||||
|
node: treeNode
|
||||||
|
};
|
||||||
|
props.onDoubleClick(eventKey, newSt);
|
||||||
|
};
|
||||||
|
|
||||||
Tree.prototype.onMouseEnter = function onMouseEnter(e, treeNode) {
|
Tree.prototype.onMouseEnter = function onMouseEnter(e, treeNode) {
|
||||||
this.props.onMouseEnter({
|
this.props.onMouseEnter({
|
||||||
event: e,
|
event: e,
|
||||||
|
@ -528,6 +538,7 @@ var Tree = function (_React$Component) {
|
||||||
onMouseEnter: props.onMouseEnter,
|
onMouseEnter: props.onMouseEnter,
|
||||||
onMouseLeave: props.onMouseLeave,
|
onMouseLeave: props.onMouseLeave,
|
||||||
onRightClick: props.onRightClick,
|
onRightClick: props.onRightClick,
|
||||||
|
onDoubleClick: props.onDoubleClick,
|
||||||
prefixCls: props.prefixCls,
|
prefixCls: props.prefixCls,
|
||||||
showLine: props.showLine,
|
showLine: props.showLine,
|
||||||
showIcon: props.showIcon,
|
showIcon: props.showIcon,
|
||||||
|
|
|
@ -53,7 +53,7 @@ var TreeNode = function (_React$Component) {
|
||||||
|
|
||||||
var _this2 = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
var _this2 = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
||||||
|
|
||||||
['onExpand', 'onCheck', 'onContextMenu', 'onMouseEnter', 'onMouseLeave', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDragLeave', 'onDrop', 'onDragEnd'].forEach(function (m) {
|
['onExpand', 'onCheck', 'onContextMenu', 'onMouseEnter', 'onMouseLeave', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDragLeave', 'onDrop', 'onDragEnd', 'onDoubleClick'].forEach(function (m) {
|
||||||
_this2[m] = _this2[m].bind(_this2);
|
_this2[m] = _this2[m].bind(_this2);
|
||||||
});
|
});
|
||||||
_this2.state = {
|
_this2.state = {
|
||||||
|
@ -77,11 +77,23 @@ var TreeNode = function (_React$Component) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
TreeNode.prototype.onCheck = function onCheck() {
|
TreeNode.prototype.onCheck = function onCheck() {
|
||||||
|
|
||||||
this.props.root.onCheck(this);
|
this.props.root.onCheck(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
TreeNode.prototype.onSelect = function onSelect() {
|
TreeNode.prototype.onSelect = function onSelect() {
|
||||||
this.props.root.onSelect(this);
|
clearTimeout(this.doubleClickFlag);
|
||||||
|
var _this = this;
|
||||||
|
//执行延时
|
||||||
|
this.doubleClickFlag = setTimeout(function () {
|
||||||
|
//do function在此处写单击事件要执行的代码
|
||||||
|
_this.props.root.onSelect(_this);
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
TreeNode.prototype.onDoubleClick = function onDoubleClick() {
|
||||||
|
clearTimeout(this.doubleClickFlag);
|
||||||
|
this.props.root.onDoubleClick(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
TreeNode.prototype.onMouseEnter = function onMouseEnter(e) {
|
TreeNode.prototype.onMouseEnter = function onMouseEnter(e) {
|
||||||
|
@ -360,6 +372,10 @@ var TreeNode = function (_React$Component) {
|
||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (props.onDoubleClick) {
|
||||||
|
domProps.onDoubleClick = _this4.onDoubleClick;
|
||||||
|
}
|
||||||
|
|
||||||
if (props.onRightClick) {
|
if (props.onRightClick) {
|
||||||
domProps.onContextMenu = _this4.onContextMenu;
|
domProps.onContextMenu = _this4.onContextMenu;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-tree",
|
"name": "bee-tree",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "Tree ui component for react",
|
"description": "Tree ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
Loading…
Reference in New Issue