From 0c5331264d7dc8c5fbe8d35025e7c63619542e59 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 8 Dec 2017 18:54:50 +0100 Subject: [PATCH] refactor(select): use mixin for disableRipple behavior (#8847) Switches `mat-select` to the common `disableRipple` mixin rather than re-implementing it. --- src/lib/select/select.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 0cee44c7651..bb5252c3753 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -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, CanUpdateErrorState { + MatFormFieldControl, 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 = '';