@@ -276,7 +276,7 @@ class Dropdown {
276276 */
277277 private getSelectedOptions ( names : boolean ) {
278278 let selected = [ ] ;
279- if ( this . multipleAllowed && this . optionsSelected [ 0 ] ) {
279+ if ( ( this . multipleAllowed || this . selectMultipleWithCtrl ) && this . optionsSelected [ 0 ] ) {
280280 // Note: Show All is always the first option (0 index) when multiple selected items are allowed
281281 return [ names ? this . options [ 0 ] . name : this . options [ 0 ] . value ] ;
282282 }
@@ -298,7 +298,7 @@ class Dropdown {
298298
299299 if ( doubleClick ) {
300300 // Double click
301- if ( this . multipleAllowed && option === 0 ) {
301+ if ( ( this . multipleAllowed || this . selectMultipleWithCtrl ) && option === 0 ) {
302302 for ( let i = 1 ; i < this . optionsSelected . length ; i ++ ) {
303303 this . optionsSelected [ i ] = ! this . optionsSelected [ i ] ;
304304 }
@@ -334,15 +334,27 @@ class Dropdown {
334334 } else {
335335 // Only a single dropdown option can be selected
336336 this . close ( ) ;
337- if ( this . lastSelected !== option ) {
337+ if ( option === 0 ) {
338+ // Show All was selected
339+ if ( ! this . optionsSelected [ 0 ] ) {
340+ this . optionsSelected [ 0 ] = true ;
341+ for ( let i = 1 ; i < this . optionsSelected . length ; i ++ ) {
342+ this . optionsSelected [ i ] = false ;
343+ }
344+ change = true ;
345+ }
346+ } else if ( this . lastSelected !== option ) {
347+ for ( let i = 0 ; i < this . optionsSelected . length ; i ++ ) {
348+ this . optionsSelected [ i ] = false ;
349+ }
338350 this . optionsSelected [ this . lastSelected ] = false ;
339351 this . optionsSelected [ option ] = true ;
340- this . lastSelected = option ;
341352 change = true ;
342353 }
343354 }
344355
345356 if ( change ) {
357+ this . lastSelected = option ;
346358 // If a change has occurred, trigger the callback
347359 this . changeCallback ( this . getSelectedOptions ( false ) ) ;
348360 }
0 commit comments