@@ -36,26 +36,24 @@ export class FileDialogTreeFilters {
36
36
37
37
export class FileDialogTreeFiltersRenderer extends ReactRenderer {
38
38
39
+ readonly appliedFilters : FileDialogTreeFilters ;
40
+
39
41
constructor (
40
- readonly filters : FileDialogTreeFilters ,
42
+ readonly suppliedFilters : FileDialogTreeFilters ,
41
43
readonly fileDialogTree : FileDialogTree
42
44
) {
43
45
super ( ) ;
46
+ this . appliedFilters = { 'All Files' : [ ] , ...suppliedFilters , } ;
44
47
}
45
48
46
49
protected readonly handleFilterChanged = ( e : React . ChangeEvent < HTMLSelectElement > ) => this . onFilterChanged ( e ) ;
47
50
48
51
protected doRender ( ) : React . ReactNode {
49
- if ( ! this . filters ) {
52
+ if ( ! this . appliedFilters ) {
50
53
return undefined ;
51
54
}
52
55
53
- const fileTypes = [ 'All Files' ] ;
54
- Object . keys ( this . filters ) . forEach ( element => {
55
- fileTypes . push ( element ) ;
56
- } ) ;
57
-
58
- const options = fileTypes . map ( value => this . renderLocation ( value ) ) ;
56
+ const options = Object . keys ( this . appliedFilters ) . map ( value => this . renderLocation ( value ) ) ;
59
57
return < select className = { 'theia-select ' + FILE_TREE_FILTERS_LIST_CLASS } onChange = { this . handleFilterChanged } > { ...options } </ select > ;
60
58
}
61
59
@@ -67,7 +65,7 @@ export class FileDialogTreeFiltersRenderer extends ReactRenderer {
67
65
const locationList = this . locationList ;
68
66
if ( locationList ) {
69
67
const value = locationList . value ;
70
- const filters = this . filters [ value ] ;
68
+ const filters = this . appliedFilters [ value ] ;
71
69
this . fileDialogTree . setFilter ( filters ) ;
72
70
}
73
71
0 commit comments