import { ENTER , SPACE } from '@angular/cdk/keycodes' ; import { Component , Input } from '@angular/core' ; import { PageHeaderService } from '../../page-header.service' ; import type { PageHeaderNavigationDropdownItem } from '../navigation.component' ; @ Component ( { selector : 'ux-page-header-horizontal-navigation-dropdown-item' , exportAs : 'ux-page-header-horizontal-navigation-dropdown-item' , templateUrl : './navigation-dropdown-item.component.html' } ) export class PageHeaderNavigationDropdownItemComponent { /** Access the data for this item */ @ Input ( ) item : PageHeaderNavigationDropdownItem ; constructor ( private _pageHeaderService ) { } select ( item ) { if ( item . disabled || item . children ) { return ; } this . _pageHeaderService . select ( item ) ; } keydownHandler ( event , item ) { switch ( event . keyCode ) { case ENTER : case SPACE : this . select ( item ) ; event . preventDefault ( ) ; event . stopPropagation ( ) ; break ; } } }