UNPKG

4.47 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { coerceBooleanProperty } from '@angular/cdk/coercion';
9import { Directive, Input } from '@angular/core';
10import { CdkMenuItem } from './menu-item';
11import * as i0 from "@angular/core";
12/** Base class providing checked state for selectable MenuItems. */
13class CdkMenuItemSelectable extends CdkMenuItem {
14 constructor() {
15 super(...arguments);
16 this._checked = false;
17 /** Whether the item should close the menu if triggered by the spacebar. */
18 this.closeOnSpacebarTrigger = false;
19 }
20 /** Whether the element is checked */
21 get checked() {
22 return this._checked;
23 }
24 set checked(value) {
25 this._checked = coerceBooleanProperty(value);
26 }
27 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkMenuItemSelectable, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
28 static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkMenuItemSelectable, inputs: { checked: ["cdkMenuItemChecked", "checked"] }, host: { properties: { "attr.aria-checked": "!!checked", "attr.aria-disabled": "disabled || null" } }, usesInheritance: true, ngImport: i0 }); }
29}
30export { CdkMenuItemSelectable };
31i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkMenuItemSelectable, decorators: [{
32 type: Directive,
33 args: [{
34 host: {
35 '[attr.aria-checked]': '!!checked',
36 '[attr.aria-disabled]': 'disabled || null',
37 },
38 }]
39 }], propDecorators: { checked: [{
40 type: Input,
41 args: ['cdkMenuItemChecked']
42 }] } });
43//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVudS1pdGVtLXNlbGVjdGFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL21l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