File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 11import Component from '@ember/component' ;
2+ import { computed } from '@ember/object' ;
23import layout from '../templates/components/x-tree-node' ;
34
45export default Component . extend ( {
56 layout,
6- classNameBindings : [ 'model.isSelected:tree-highlight' ] ,
7+ classNameBindings : [ 'model.isSelected:tree-highlight' , 'isChosen:tree-chosen' ] ,
8+
9+ isChosen : computed ( 'model.id' , 'chosenId' , function ( ) {
10+ let chosenId = this . get ( 'chosenId' ) ;
11+ return chosenId ? this . get ( 'model.id' ) === chosenId : false ;
12+ } ) ,
713
814 click ( ) {
915 this . attrs . select ( this . get ( 'model' ) ) ;
1016 } ,
11-
1217 mouseEnter ( ) {
18+ this . set ( 'model.isSelected' , true ) ;
1319 let hover = this . get ( 'hover' ) ;
1420 if ( hover ) {
1521 hover ( this . get ( 'model' ) ) ;
1622 }
1723 } ,
24+ mouseLeave ( ) {
25+ this . set ( 'model.isSelected' , false ) ;
26+ } ,
1827
1928 actions : {
2029 toggleCheck ( ) {
Original file line number Diff line number Diff line change 1- {{ x-tree-node model =model select =select hover =hover }}
1+ {{ x-tree-node model =model select =select hover =hover chosenId = chosenId }}
22
33{{ #if model.isExpanded }}
4- {{ x-tree model =model.children select =select hover =hover }}
4+ {{ x-tree model =model.children select =select hover =hover chosenId = chosenId }}
55{{ /if }}
Original file line number Diff line number Diff line change 33 {{ #if hasBlock }}
44 {{ yield child }}
55 {{ else }}
6- {{ x-tree-children model =child select =select hover =hover }}
6+ {{ x-tree-children model =child select =select hover =hover chosenId = chosenId }}
77 {{ /if }}
88 {{ /if }}
99{{ /each }}
You can’t perform that action at this time.
0 commit comments