Skip to content

Commit 3011236

Browse files
crisbetommalerba
authored andcommitted
refactor(select): use mixin for disableRipple behavior (#8847)
Switches `mat-select` to the common `disableRipple` mixin rather than re-implementing it.
1 parent e96a847 commit 3011236

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/lib/select/select.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
98
import {ActiveDescendantKeyManager} from '@angular/cdk/a11y';
109
import {Directionality} from '@angular/cdk/bidi';
1110
import {coerceBooleanProperty} from '@angular/cdk/coercion';
@@ -69,6 +68,8 @@ import {
6968
mixinDisabled,
7069
mixinTabIndex,
7170
MAT_OPTION_PARENT_COMPONENT,
71+
mixinDisableRipple,
72+
CanDisableRipple,
7273
} from '@angular/material/core';
7374
import {MatFormField, MatFormFieldControl} from '@angular/material/form-field';
7475
import {Observable} from 'rxjs/Observable';
@@ -153,7 +154,8 @@ export class MatSelectBase {
153154
public _parentFormGroup: FormGroupDirective,
154155
public ngControl: NgControl) {}
155156
}
156-
export const _MatSelectMixinBase = mixinTabIndex(mixinDisabled(mixinErrorState(MatSelectBase)));
157+
export const _MatSelectMixinBase = mixinDisableRipple(
158+
mixinTabIndex(mixinDisabled(mixinErrorState(MatSelectBase))));
157159

158160

159161
/**
@@ -171,7 +173,7 @@ export class MatSelectTrigger {}
171173
exportAs: 'matSelect',
172174
templateUrl: 'select.html',
173175
styleUrls: ['select.css'],
174-
inputs: ['disabled', 'tabIndex'],
176+
inputs: ['disabled', 'disableRipple', 'tabIndex'],
175177
encapsulation: ViewEncapsulation.None,
176178
preserveWhitespaces: false,
177179
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -207,7 +209,7 @@ export class MatSelectTrigger {}
207209
})
208210
export class MatSelect extends _MatSelectMixinBase implements AfterContentInit, OnChanges,
209211
OnDestroy, OnInit, DoCheck, ControlValueAccessor, CanDisable, HasTabIndex,
210-
MatFormFieldControl<any>, CanUpdateErrorState {
212+
MatFormFieldControl<any>, CanUpdateErrorState, CanDisableRipple {
211213
/** Whether or not the overlay panel is open. */
212214
private _panelOpen = false;
213215

@@ -376,14 +378,6 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
376378
}
377379
private _value: any;
378380

379-
/** Whether ripples for all options in the select are disabled. */
380-
@Input()
381-
get disableRipple(): boolean { return this._disableRipple; }
382-
set disableRipple(value: boolean) {
383-
this._disableRipple = coerceBooleanProperty(value);
384-
}
385-
private _disableRipple: boolean = false;
386-
387381
/** Aria label of the select. If not specified, the placeholder will be used as label. */
388382
@Input('aria-label') ariaLabel: string = '';
389383

0 commit comments

Comments
 (0)