11import omit from 'omit.js' ;
22import debounce from 'lodash/debounce' ;
33import PropTypes from '../_util/vue-types' ;
4+ import warning from '../_util/warning' ;
45import { conductExpandParent , convertTreeToEntities } from '../vc-tree/src/util' ;
56import Tree , { TreeProps } from './Tree' ;
67import { calcRangeKeys , getFullKeyList } from './util' ;
@@ -9,7 +10,7 @@ import BaseMixin from '../_util/BaseMixin';
910import { initDefaultProps , getOptionProps } from '../_util/props-util' ;
1011import { ConfigConsumerProps } from '../config-provider' ;
1112
12- // export type ExpandAction = false | 'click' | 'doubleClick '; export interface
13+ // export type ExpandAction = false | 'click' | 'dbclick '; export interface
1314// DirectoryTreeProps extends TreeProps { expandAction?: ExpandAction; }
1415// export interface DirectoryTreeState { expandedKeys?: string[];
1516// selectedKeys?: string[]; }
@@ -32,7 +33,7 @@ export default {
3233 props : initDefaultProps (
3334 {
3435 ...TreeProps ( ) ,
35- expandAction : PropTypes . oneOf ( [ false , 'click' , 'doubleclick' ] ) ,
36+ expandAction : PropTypes . oneOf ( [ false , 'click' , 'doubleclick' , 'dbclick' ] ) ,
3637 } ,
3738 {
3839 showIcon : true ,
@@ -103,11 +104,12 @@ export default {
103104 const { expandAction } = this . $props ;
104105
105106 // Expand the tree
106- if ( expandAction === 'doubleclick' ) {
107+ if ( expandAction === 'dbclick' || expandAction === ' doubleclick') {
107108 this . onDebounceExpand ( event , node ) ;
108109 }
109110
110111 this . $emit ( 'doubleclick' , event , node ) ;
112+ this . $emit ( 'dbclick' , event , node ) ;
111113 } ,
112114
113115 onSelect ( keys , event ) {
@@ -181,6 +183,10 @@ export default {
181183 const getPrefixCls = this . configProvider . getPrefixCls ;
182184 const prefixCls = getPrefixCls ( 'tree' , customizePrefixCls ) ;
183185 const { _expandedKeys : expandedKeys , _selectedKeys : selectedKeys } = this . $data ;
186+ warning (
187+ ! this . $listeners . doubleclick ,
188+ '`doubleclick` is deprecated. please use `dbclick` instead.' ,
189+ ) ;
184190 const treeProps = {
185191 props : {
186192 icon : getIcon ,
@@ -195,7 +201,7 @@ export default {
195201 ...omit ( this . $listeners , [ 'update:selectedKeys' ] ) ,
196202 select : this . onSelect ,
197203 click : this . onClick ,
198- doubleclick : this . onDoubleClick ,
204+ dbclick : this . onDoubleClick ,
199205 expand : this . onExpand ,
200206 } ,
201207 } ;
0 commit comments