@@ -39,11 +39,11 @@ export default class DropdownTreeService {
39
39
return undefined ;
40
40
}
41
41
42
- selectAllChildOptions ( option , settings , currentSelection ) {
43
- const optionsToAdd = this . getOptionsToAdd ( option , settings , currentSelection ) ;
42
+ selectAllChildOptions ( option , settings , currentSelection , searchText ) {
43
+ const optionsToAdd = this . getOptionsToAdd ( option , settings , currentSelection , searchText ) ;
44
44
45
45
if ( optionsToAdd . length === 0 ) {
46
- this . removeAllChildOptions ( option , settings , currentSelection ) ;
46
+ this . removeAllChildOptions ( option , settings , currentSelection , searchText ) ;
47
47
return true ;
48
48
}
49
49
if ( settings . selectionLimit === 0 ) {
@@ -62,28 +62,30 @@ export default class DropdownTreeService {
62
62
return false ;
63
63
}
64
64
65
- getOptionsToAdd ( option , settings , currentSelection ) {
65
+ getOptionsToAdd ( option , settings , currentSelection , searchText ) {
66
66
let optionsToAdd = [ ] ;
67
67
if ( this . isFolder ( option , settings ) ) {
68
68
this . getChildOptions ( option , settings )
69
69
. forEach ( ( childOption ) => {
70
70
optionsToAdd = optionsToAdd . concat (
71
- this . getOptionsToAdd ( childOption , settings , currentSelection , false ) ,
71
+ this . getOptionsToAdd ( childOption , settings , currentSelection , searchText ) ,
72
72
) ;
73
73
} ) ;
74
- } else if ( currentSelection . indexOf ( option ) < 0 ) {
74
+ } else if ( currentSelection . indexOf ( option ) < 0 &&
75
+ this . isVisible ( option , settings , searchText ) ) {
75
76
optionsToAdd . push ( option ) ;
76
77
}
77
78
78
79
return optionsToAdd ;
79
80
}
80
81
81
- removeAllChildOptions ( option , settings , currentSelection ) {
82
+ removeAllChildOptions ( option , settings , currentSelection , searchText ) {
82
83
if ( this . isFolder ( option , settings ) ) {
83
84
this . getChildOptions ( option , settings ) . forEach ( ( childOption ) => {
84
- this . removeAllChildOptions ( childOption , settings , currentSelection ) ;
85
+ this . removeAllChildOptions ( childOption , settings , currentSelection , searchText ) ;
85
86
} ) ;
86
- } else if ( currentSelection . indexOf ( option ) >= 0 ) {
87
+ } else if ( currentSelection . indexOf ( option ) >= 0 &&
88
+ this . isVisible ( option , settings , searchText ) ) {
87
89
currentSelection . splice ( currentSelection . indexOf ( option ) , 1 ) ;
88
90
}
89
91
}
0 commit comments