@@ -3,8 +3,6 @@ import { TreeModel } from './tree.model';
33import { KEYS } from '../constants/keys' ;
44import { ITreeOptions } from '../defs/api' ;
55
6- import { defaultsDeep , get , omit , isNumber } from 'lodash-es' ;
7-
86export interface IActionHandler {
97 ( tree : TreeModel , node : TreeNode , $event : any , ...rest ) ;
108}
@@ -98,10 +96,17 @@ export class TreeOptions {
9896 actionMapping : IActionMapping ;
9997
10098 constructor ( private options : ITreeOptions = { } ) {
101- this . actionMapping = defaultsDeep ( { } , this . options . actionMapping , defaultActionMapping ) ;
99+ console . log ( 'actionMapping' , this . options . actionMapping ) ;
100+ console . log ( 'defaultActionMapping' , defaultActionMapping ) ;
101+
102+ this . actionMapping = {
103+ ...defaultActionMapping ,
104+ ...this . options . actionMapping ,
105+ } ;
106+
102107 if ( options . rtl ) {
103- this . actionMapping . keys [ KEYS . RIGHT ] = < IActionHandler > get ( options , [ ' actionMapping' , ' keys' , KEYS . RIGHT ] ) || TREE_ACTIONS . DRILL_UP ;
104- this . actionMapping . keys [ KEYS . LEFT ] = < IActionHandler > get ( options , [ ' actionMapping' , ' keys' , KEYS . LEFT ] ) || TREE_ACTIONS . DRILL_DOWN ;
108+ this . actionMapping . keys [ KEYS . RIGHT ] = < IActionHandler > options . actionMapping ?. keys [ KEYS . RIGHT ] || TREE_ACTIONS . DRILL_UP ;
109+ this . actionMapping . keys [ KEYS . LEFT ] = < IActionHandler > options . actionMapping ?. keys [ KEYS . LEFT ] || TREE_ACTIONS . DRILL_DOWN ;
105110 }
106111 }
107112
@@ -110,7 +115,13 @@ export class TreeOptions {
110115 return this . options . getNodeClone ( node ) ;
111116 }
112117
113- return omit ( Object . assign ( { } , node . data ) , [ 'id' ] ) ;
118+ // remove id from clone
119+ // keeping ie11 compatibility
120+ const nodeClone = Object . assign ( { } , node . data ) ;
121+ if ( nodeClone . id ) {
122+ delete nodeClone . id ;
123+ }
124+ return nodeClone ;
114125 }
115126
116127 allowDrop ( element , to , $event ?) : boolean {
@@ -150,6 +161,6 @@ export class TreeOptions {
150161 }
151162
152163 get dropSlotHeight ( ) : number {
153- return isNumber ( this . options . dropSlotHeight ) ? this . options . dropSlotHeight : 2 ;
164+ return typeof this . options . dropSlotHeight === 'number' ? this . options . dropSlotHeight : 2 ;
154165 }
155166}
0 commit comments