refactor(select): use mixin for disableRipple behavior (#8847)

Switches `mat-select` to the common `disableRipple` mixin rather than re-implementing it.
This commit is contained in:
Kristiyan Kostadinov
2017-12-08 18:54:50 +01:00
committed by mmalerba
parent d5a2fca336
commit 0c5331264d
+6 -12
View File
@@ -5,7 +5,6 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ActiveDescendantKeyManager} from '@angular/cdk/a11y';
import {Directionality} from '@angular/cdk/bidi';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
@@ -69,6 +68,8 @@ import {
mixinDisabled,
mixinTabIndex,
MAT_OPTION_PARENT_COMPONENT,
mixinDisableRipple,
CanDisableRipple,
} from '@angular/material/core';
import {MatFormField, MatFormFieldControl} from '@angular/material/form-field';
import {Observable} from 'rxjs/Observable';
@@ -153,7 +154,8 @@ export class MatSelectBase {
public _parentFormGroup: FormGroupDirective,
public ngControl: NgControl) {}
}
export const _MatSelectMixinBase = mixinTabIndex(mixinDisabled(mixinErrorState(MatSelectBase)));
export const _MatSelectMixinBase = mixinDisableRipple(
mixinTabIndex(mixinDisabled(mixinErrorState(MatSelectBase))));
/**
@@ -171,7 +173,7 @@ export class MatSelectTrigger {}
exportAs: 'matSelect',
templateUrl: 'select.html',
styleUrls: ['select.css'],
inputs: ['disabled', 'tabIndex'],
inputs: ['disabled', 'disableRipple', 'tabIndex'],
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -207,7 +209,7 @@ export class MatSelectTrigger {}
})
export class MatSelect extends _MatSelectMixinBase implements AfterContentInit, OnChanges,
OnDestroy, OnInit, DoCheck, ControlValueAccessor, CanDisable, HasTabIndex,
MatFormFieldControl<any>, CanUpdateErrorState {
MatFormFieldControl<any>, CanUpdateErrorState, CanDisableRipple {
/** Whether or not the overlay panel is open. */
private _panelOpen = false;
@@ -376,14 +378,6 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
}
private _value: any;
/** Whether ripples for all options in the select are disabled. */
@Input()
get disableRipple(): boolean { return this._disableRipple; }
set disableRipple(value: boolean) {
this._disableRipple = coerceBooleanProperty(value);
}
private _disableRipple: boolean = false;
/** Aria label of the select. If not specified, the placeholder will be used as label. */
@Input('aria-label') ariaLabel: string = '';