Skip to content

Commit b580d1f

Browse files
MatChip implements RippleTarget
1 parent 422f1fd commit b580d1f

File tree

1 file changed

+18
-12
lines changed
  • src/material-experimental/mdc-chips

1 file changed

+18
-12
lines changed

src/material-experimental/mdc-chips/chip.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
mixinColor,
3333
mixinDisabled,
3434
mixinDisableRipple,
35+
RippleConfig,
3536
RippleRenderer,
3637
RippleTarget,
3738
} from '@angular/material/core';
@@ -132,7 +133,7 @@ const _MatChipMixinBase: CanColorCtor & CanDisableRippleCtor & CanDisableCtor &
132133
'[class.mat-chip-selected]': 'selected',
133134
},
134135
})
135-
export class MatChip extends _MatChipMixinBase implements AfterContentInit, AfterViewInit, CanColor, CanDisable, CanDisableRipple, OnDestroy {
136+
export class MatChip extends _MatChipMixinBase implements AfterContentInit, AfterViewInit, CanColor, CanDisable, CanDisableRipple, RippleTarget, OnDestroy {
136137
/** Whether the chip has focus. */
137138
_hasFocus: boolean = false;
138139

@@ -194,6 +195,21 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
194195
/** The ripple renderer for this chip. */
195196
private _rippleRenderer: RippleRenderer;
196197

198+
rippleConfig: RippleConfig = {
199+
animation: {
200+
enterDuration: 225 /* MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS */,
201+
exitDuration: 150 /* MDCRippleFoundation.numbers.FG_DEACTIVATION_MS */,
202+
}
203+
};
204+
205+
/**
206+
* Whether ripples are disabled on interaction
207+
* INTERNAL USE ONLY.
208+
*/
209+
get rippleDisabled(): boolean {
210+
return this.disabled || this.disableRipple || this._isBasicChip();
211+
}
212+
197213
/** Whether the chip list is selectable */
198214
chipListSelectable: boolean = true;
199215

@@ -311,18 +327,8 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
311327

312328
/** Initializes the ripple renderer. */
313329
private _initRipple() {
314-
const rippleTarget: RippleTarget = {
315-
rippleConfig: {
316-
animation: {
317-
enterDuration: 225 /* MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS */,
318-
exitDuration: 150 /* MDCRippleFoundation.numbers.FG_DEACTIVATION_MS */,
319-
},
320-
},
321-
rippleDisabled: this.disabled || this._isBasicChip(),
322-
};
323-
324330
this._rippleRenderer =
325-
new RippleRenderer(rippleTarget, this._ngZone, this._mdcChip, this._platform);
331+
new RippleRenderer(this, this._ngZone, this._mdcChip, this._platform);
326332
this._rippleRenderer.setupTriggerEvents(this._mdcChip.nativeElement);
327333
}
328334

0 commit comments

Comments
 (0)