license import { Directive } from '@angular/core' ; import { CdkMenuItemSelectable } from './menu-item-selectable' ; import { CdkMenuItem } from './menu-item' ; /**
 * A directive providing behavior for the "menuitemcheckbox" ARIA role, which behaves similarly to a
 * conventional checkbox.
 */ @ Directive ( { selector : '[cdkMenuItemCheckbox]' , exportAs : 'cdkMenuItemCheckbox' , host : { '[tabindex]' : '_tabindex' , 'type' : 'button' , 'role' : 'menuitemcheckbox' , '[attr.aria-checked]' : 'checked || null' , '[attr.aria-disabled]' : 'disabled || null' , } , providers : [ { provide : CdkMenuItemSelectable , useExisting : CdkMenuItemCheckbox } , { provide : CdkMenuItem , useExisting : CdkMenuItemSelectable } , ] , } ) export class CdkMenuItemCheckbox extends CdkMenuItemSelectable { /** Toggle the checked state of the checkbox. */ override trigger ( ) { super . trigger ( ) ; if ( ! this . disabled ) { this . checked = ! this . checked ; } } }