@@ -35,11 +35,8 @@ export class FileTreeNodeComponent implements OnChanges, OnInit {
35
35
@Input ( )
36
36
public depth = 0 ;
37
37
38
- @Input ( )
39
- public hide = false ;
40
-
41
38
@Output ( )
42
- public fileSelected : EventEmitter < ProjectFile > = new EventEmitter ( ) ;
39
+ public fileSelected = new EventEmitter < ProjectFile > ( ) ;
43
40
44
41
public get marginLeftStyleValue ( ) : string {
45
42
return `${ this . baseMarginLeft * this . depth } px` ;
@@ -49,14 +46,6 @@ export class FileTreeNodeComponent implements OnChanges, OnInit {
49
46
return ! ! this . node . children ;
50
47
}
51
48
52
- public get isFile ( ) : boolean {
53
- return ! ! this . node . content ;
54
- }
55
-
56
- public get isHidden ( ) : boolean {
57
- return ! this . isOpened || this . hide ;
58
- }
59
-
60
49
public get incrementedDepth ( ) : number {
61
50
return this . depth + 1 ;
62
51
}
@@ -65,35 +54,9 @@ export class FileTreeNodeComponent implements OnChanges, OnInit {
65
54
return `/assets/icons/file-explorer/${ this . icon } .svg` ;
66
55
}
67
56
68
- public get arrowCssClassesAsString ( ) : string {
69
- const CLASSES = 'monaco-tree-arrow codicon codicon-chevron-down' ;
70
-
71
- if ( this . isOpened ) {
72
- return `${ CLASSES } open` ;
73
- }
74
-
75
- return CLASSES ;
76
- }
77
-
78
- public get rowCssClassesAsString ( ) : string {
79
- const CLASSES = `monaco-tree-row` ;
80
-
81
- if ( this . hide ) {
82
- return `${ CLASSES } hide` ;
83
- }
84
-
85
- return CLASSES ;
86
- }
87
-
88
- public get isAllowedToRender ( ) : boolean {
89
- return ! this . isHidden || this . hasBeenOpened ;
90
- }
91
-
92
57
public isOpened = false ;
93
58
public isSelected = false ;
94
59
95
- private hasBeenOpened = false ;
96
-
97
60
private readonly baseMarginLeft = 10 ;
98
61
99
62
private icon ! : string ;
@@ -115,34 +78,25 @@ export class FileTreeNodeComponent implements OnChanges, OnInit {
115
78
}
116
79
}
117
80
118
- public onButtonToggle ( ) : void {
81
+ public onRowClick ( ) : void {
119
82
this . isOpened = ! this . isOpened ;
120
- this . hasBeenOpened = true ;
121
83
122
- if ( this . doChildrenExist ) {
123
- return ;
84
+ if ( ! this . doChildrenExist ) {
85
+ this . fileSelectionState . set ( this . node ) ;
124
86
}
125
-
126
- this . fileSelectionState . set ( this . node as ProjectFile ) ;
127
- }
128
-
129
- public onFileSelected ( node : ProjectFile ) : void {
130
- this . fileSelected . emit ( node ) ;
131
87
}
132
88
133
89
@AutoUnsubscribe ( )
134
90
private initFileSelection ( ) : Subscription {
135
- return this . fileSelectionState . data$
136
- . pipe ( filter < ProjectFile | null > ( Boolean ) )
137
- . subscribe ( ( node : ProjectFile ) => {
138
- this . isSelected = node . fullPath === this . node . fullPath ;
91
+ return this . fileSelectionState . data$ . pipe ( filter ( Boolean ) ) . subscribe ( ( node ) => {
92
+ this . isSelected = node . fullPath === this . node . fullPath ;
139
93
140
- if ( this . isSelected ) {
141
- this . fileSelected . emit ( this . node as ProjectFile ) ;
142
- }
94
+ if ( this . isSelected ) {
95
+ this . fileSelected . emit ( this . node ) ;
96
+ }
143
97
144
- this . changeDetectorRef . markForCheck ( ) ;
145
- } ) ;
98
+ this . changeDetectorRef . markForCheck ( ) ;
99
+ } ) ;
146
100
}
147
101
148
102
private getIcon ( ) : string {
0 commit comments