/** * @license * Copyright Google LLC All Rights Reserved. * * 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 { Platform } from '@angular/cdk/platform'; import { Directive, ElementRef, Inject, InjectionToken, Input, NgZone, Optional, } from '@angular/core'; import { RippleRenderer } from './ripple-renderer'; import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations'; import * as i0 from "@angular/core"; import * as i1 from "@angular/cdk/platform"; /** Injection token that can be used to specify the global ripple options. */ export const MAT_RIPPLE_GLOBAL_OPTIONS = new InjectionToken('mat-ripple-global-options'); export class MatRipple { /** * Whether click events will not trigger the ripple. Ripples can be still launched manually * by using the `launch()` method. */ get disabled() { return this._disabled; } set disabled(value) { if (value) { this.fadeOutAllNonPersistent(); } this._disabled = value; this._setupTriggerEventsIfEnabled(); } /** * The element that triggers the ripple when click events are received. * Defaults to the directive's host element. */ get trigger() { return this._trigger || this._elementRef.nativeElement; } set trigger(trigger) { this._trigger = trigger; this._setupTriggerEventsIfEnabled(); } constructor(_elementRef, ngZone, platform, globalOptions, _animationMode) { this._elementRef = _elementRef; this._animationMode = _animationMode; /** * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius * will be the distance from the center of the ripple to the furthest corner of the host element's * bounding rectangle. */ this.radius = 0; this._disabled = false; /** @docs-private Whether ripple directive is initialized and the input bindings are set. */ this._isInitialized = false; this._globalOptions = globalOptions || {}; this._rippleRenderer = new RippleRenderer(this, ngZone, _elementRef, platform); } ngOnInit() { this._isInitialized = true; this._setupTriggerEventsIfEnabled(); } ngOnDestroy() { this._rippleRenderer._removeTriggerEvents(); } /** Fades out all currently showing ripple elements. */ fadeOutAll() { this._rippleRenderer.fadeOutAll(); } /** Fades out all currently showing non-persistent ripple elements. */ fadeOutAllNonPersistent() { this._rippleRenderer.fadeOutAllNonPersistent(); } /** * Ripple configuration from the directive's input values. * @docs-private Implemented as part of RippleTarget */ get rippleConfig() { return { centered: this.centered, radius: this.radius, color: this.color, animation: { ...this._globalOptions.animation, ...(this._animationMode === 'NoopAnimations' ? { enterDuration: 0, exitDuration: 0 } : {}), ...this.animation, }, terminateOnPointerUp: this._globalOptions.terminateOnPointerUp, }; } /** * Whether ripples on pointer-down are disabled or not. * @docs-private Implemented as part of RippleTarget */ get rippleDisabled() { return this.disabled || !!this._globalOptions.disabled; } /** Sets up the trigger event listeners if ripples are enabled. */ _setupTriggerEventsIfEnabled() { if (!this.disabled && this._isInitialized) { this._rippleRenderer.setupTriggerEvents(this.trigger); } } /** Launches a manual ripple at the specified coordinated or just by the ripple config. */ launch(configOrX, y = 0, config) { if (typeof configOrX === 'number') { return this._rippleRenderer.fadeInRipple(configOrX, y, { ...this.rippleConfig, ...config }); } else { return this._rippleRenderer.fadeInRipple(0, 0, { ...this.rippleConfig, ...configOrX }); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatRipple, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.Platform }, { token: MAT_RIPPLE_GLOBAL_OPTIONS, optional: true }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: { color: ["matRippleColor", "color"], unbounded: ["matRippleUnbounded", "unbounded"], centered: ["matRippleCentered", "centered"], radius: ["matRippleRadius", "radius"], animation: ["matRippleAnimation", "animation"], disabled: ["matRippleDisabled", "disabled"], trigger: ["matRippleTrigger", "trigger"] }, host: { properties: { "class.mat-ripple-unbounded": "unbounded" }, classAttribute: "mat-ripple" }, exportAs: ["matRipple"], ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatRipple, decorators: [{ type: Directive, args: [{ selector: '[mat-ripple], [matRipple]', exportAs: 'matRipple', host: { 'class': 'mat-ripple', '[class.mat-ripple-unbounded]': 'unbounded', }, }] }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.Platform }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS] }] }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE] }] }]; }, propDecorators: { color: [{ type: Input, args: ['matRippleColor'] }], unbounded: [{ type: Input, args: ['matRippleUnbounded'] }], centered: [{ type: Input, args: ['matRippleCentered'] }], radius: [{ type: Input, args: ['matRippleRadius'] }], animation: [{ type: Input, args: ['matRippleAnimation'] }], disabled: [{ type: Input, args: ['matRippleDisabled'] }], trigger: [{ type: Input, args: ['matRippleTrigger'] }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmlwcGxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2NvcmUvcmlwcGxlL3JpcHBsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDL0MsT0FBTyxFQUNMLFNBQVMsRUFDVCxVQUFVLEVBQ1YsTUFBTSxFQUNOLGNBQWMsRUFDZCxLQUFLLEVBQ0wsTUFBTSxFQUdOLFFBQVEsR0FDVCxNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUMsY0FBYyxFQUFlLE1BQU0sbUJBQW1CLENBQUM7QUFDL0QsT0FBTyxFQUFDLHFCQUFxQixFQUFDLE1BQU0sc0NBQXNDLENBQUM7OztBQXdCM0UsNkVBQTZFO0FBQzdFLE1BQU0sQ0FBQyxNQUFNLHlCQUF5QixHQUFHLElBQUksY0FBYyxDQUN6RCwyQkFBMkIsQ0FDNUIsQ0FBQztBQVVGLE1BQ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