import { DOWN_ARROW , ENTER , SPACE , UP_ARROW } from '@angular/cdk/keycodes' ; import { SelectionStrategy } from '../../../directives/selection/index' ; export class SingleSelectListStrategy < T > extends SelectionStrategy < T > { click ( _event , data ) { this . selectionService . activate ( data ) ; if ( ! this . selectionService . isSelected ( data ) ) { this . selectOnly ( data ) ; } else { this . deselect ( data ) ; } } keydown ( event , data ) { switch ( event . which ) { case UP_ARROW : { event . preventDefault ( ) ; this . selectionService . activateSibling ( true ) ; break ; } case DOWN_ARROW : { event . preventDefault ( ) ; this . selectionService . activateSibling ( false ) ; break ; } case SPACE : case ENTER : event . preventDefault ( ) ; this . click ( null , data ) ; break ; } } }