parent
54efd71c7e
commit
ca8ddfcfb2
|
@ -340,6 +340,16 @@ var Tree = function (_React$Component) {
|
|||
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) {
|
||||
this.props.onMouseEnter({
|
||||
event: e,
|
||||
|
@ -528,6 +538,7 @@ var Tree = function (_React$Component) {
|
|||
onMouseEnter: props.onMouseEnter,
|
||||
onMouseLeave: props.onMouseLeave,
|
||||
onRightClick: props.onRightClick,
|
||||
onDoubleClick: props.onDoubleClick,
|
||||
prefixCls: props.prefixCls,
|
||||
showLine: props.showLine,
|
||||
showIcon: props.showIcon,
|
||||
|
|
|
@ -53,7 +53,7 @@ var TreeNode = function (_React$Component) {
|
|||
|
||||
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.state = {
|
||||
|
@ -77,11 +77,23 @@ var TreeNode = function (_React$Component) {
|
|||
// }
|
||||
|
||||
TreeNode.prototype.onCheck = function onCheck() {
|
||||
|
||||
this.props.root.onCheck(this);
|
||||
};
|
||||
|
||||
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) {
|
||||
|
@ -360,6 +372,10 @@ var TreeNode = function (_React$Component) {
|
|||
// }
|
||||
};
|
||||
|
||||
if (props.onDoubleClick) {
|
||||
domProps.onDoubleClick = _this4.onDoubleClick;
|
||||
}
|
||||
|
||||
if (props.onRightClick) {
|
||||
domProps.onContextMenu = _this4.onContextMenu;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-tree",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "Tree ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
Loading…
Reference in New Issue