diff --git a/src/material-experimental/mdc-core/option/option.ts b/src/material-experimental/mdc-core/option/option.ts index 3785cad24c8a..0bb41033b108 100644 --- a/src/material-experimental/mdc-core/option/option.ts +++ b/src/material-experimental/mdc-core/option/option.ts @@ -48,7 +48,7 @@ import {MatOptgroup} from './optgroup'; encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, }) -export class MatOption extends _MatOptionBase { +export class MatOption extends _MatOptionBase { constructor( element: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/src/material/core/option/option.ts b/src/material/core/option/option.ts index 66cf009eef95..cdc25148310a 100644 --- a/src/material/core/option/option.ts +++ b/src/material/core/option/option.ts @@ -36,10 +36,10 @@ import {MatOptgroup, _MatOptgroupBase, MAT_OPTGROUP} from './optgroup'; let _uniqueIdCounter = 0; /** Event object emitted by MatOption when selected or deselected. */ -export class MatOptionSelectionChange { +export class MatOptionSelectionChange { constructor( /** Reference to the option that emitted the event. */ - public source: _MatOptionBase, + public source: _MatOptionBase, /** Whether the change in the option's value was a result of a user action. */ public isUserInput = false) { } } @@ -62,7 +62,7 @@ export const MAT_OPTION_PARENT_COMPONENT = @Directive() -export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { +export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { private _selected = false; private _active = false; private _disabled = false; @@ -75,7 +75,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest get selected(): boolean { return this._selected; } /** The form value of the option. */ - @Input() value: any; + @Input() value: T; /** The unique ID of the option. */ @Input() id: string = `mat-option-${_uniqueIdCounter++}`; @@ -90,7 +90,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest /** Event emitted when the option is selected or deselected. */ // tslint:disable-next-line:no-output-on-prefix - @Output() readonly onSelectionChange = new EventEmitter(); + @Output() readonly onSelectionChange = new EventEmitter>(); /** Emits when the state of the option changes and any parents have to be notified. */ readonly _stateChanges = new Subject(); @@ -242,7 +242,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest /** Emits the selection change event. */ private _emitSelectionChangeEvent(isUserInput = false): void { - this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput)); + this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput)); } static ngAcceptInputType_disabled: BooleanInput; @@ -273,7 +273,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, }) -export class MatOption extends _MatOptionBase { +export class MatOption extends _MatOptionBase { constructor( element: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/tools/public_api_guard/material/core.d.ts b/tools/public_api_guard/material/core.d.ts index 8c5eec048f84..33671fce34c8 100644 --- a/tools/public_api_guard/material/core.d.ts +++ b/tools/public_api_guard/material/core.d.ts @@ -10,7 +10,7 @@ export declare class _MatOptgroupBase extends _MatOptgroupMixinBase implements C static ɵfac: i0.ɵɵFactoryDef<_MatOptgroupBase, never>; } -export declare class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { +export declare class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { readonly _stateChanges: Subject; get active(): boolean; get disableRipple(): boolean | undefined; @@ -19,9 +19,9 @@ export declare class _MatOptionBase implements FocusableOption, AfterViewChecked readonly group: _MatOptgroupBase; id: string; get multiple(): boolean | undefined; - readonly onSelectionChange: EventEmitter; + readonly onSelectionChange: EventEmitter>; get selected(): boolean; - value: any; + value: T; get viewValue(): string; constructor(_element: ElementRef, _changeDetectorRef: ChangeDetectorRef, _parent: MatOptionParentComponent, group: _MatOptgroupBase); _getAriaSelected(): boolean | null; @@ -38,8 +38,8 @@ export declare class _MatOptionBase implements FocusableOption, AfterViewChecked setActiveStyles(): void; setInactiveStyles(): void; static ngAcceptInputType_disabled: BooleanInput; - static ɵdir: i0.ɵɵDirectiveDefWithMeta<_MatOptionBase, never, never, { "value": "value"; "id": "id"; "disabled": "disabled"; }, { "onSelectionChange": "onSelectionChange"; }, never>; - static ɵfac: i0.ɵɵFactoryDef<_MatOptionBase, never>; + static ɵdir: i0.ɵɵDirectiveDefWithMeta<_MatOptionBase, never, never, { "value": "value"; "id": "id"; "disabled": "disabled"; }, { "onSelectionChange": "onSelectionChange"; }, never>; + static ɵfac: i0.ɵɵFactoryDef<_MatOptionBase, never>; } export declare class AnimationCurves { @@ -222,10 +222,10 @@ export declare class MatOptgroup extends _MatOptgroupBase { static ɵfac: i0.ɵɵFactoryDef; } -export declare class MatOption extends _MatOptionBase { +export declare class MatOption extends _MatOptionBase { constructor(element: ElementRef, changeDetectorRef: ChangeDetectorRef, parent: MatOptionParentComponent, group: MatOptgroup); - static ɵcmp: i0.ɵɵComponentDefWithMeta; - static ɵfac: i0.ɵɵFactoryDef; + static ɵcmp: i0.ɵɵComponentDefWithMeta, "mat-option", ["matOption"], {}, {}, never, ["*"]>; + static ɵfac: i0.ɵɵFactoryDef, [null, null, { optional: true; }, { optional: true; }]>; } export declare class MatOptionModule { @@ -238,11 +238,11 @@ export interface MatOptionParentComponent { multiple?: boolean; } -export declare class MatOptionSelectionChange { +export declare class MatOptionSelectionChange { isUserInput: boolean; - source: _MatOptionBase; + source: _MatOptionBase; constructor( - source: _MatOptionBase, + source: _MatOptionBase, isUserInput?: boolean); }