UNPKG

@angular-mdc/web

Version:
225 lines (221 loc) 6.73 kB
/** * @license * Copyright (c) Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ import { Directive, NgZone, ElementRef, NgModule } from '@angular/core'; import { __extends } from 'tslib'; import { Subject, fromEvent } from 'rxjs'; import { takeUntil, filter } from 'rxjs/operators'; import { MDCComponent } from '@angular-mdc/web/base'; import { MDCLineRippleFoundation } from '@material/line-ripple'; /** * @fileoverview added by tsickle * Generated from: line-ripple/line-ripple.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcLineRipple = /** @class */ (function (_super) { __extends(MdcLineRipple, _super); function MdcLineRipple(_ngZone, elementRef) { var _this = _super.call(this, elementRef) || this; _this._ngZone = _ngZone; _this.elementRef = elementRef; /** * Emits whenever the component is destroyed. */ _this._destroy = new Subject(); return _this; } /** * @return {?} */ MdcLineRipple.prototype.getDefaultFoundation = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var adapter = { addClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.add(className); }), removeClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.remove(className); }), hasClass: (/** * @param {?} className * @return {?} */ function (className) { return _this._getHostElement().classList.contains(className); }), setStyle: (/** * @param {?} propertyName * @param {?} value * @return {?} */ function (propertyName, value) { return _this._getHostElement().style.setProperty(propertyName, value); }), registerEventHandler: (/** * @return {?} */ function () { }), deregisterEventHandler: (/** * @return {?} */ function () { }) }; return new MDCLineRippleFoundation(adapter); }; /** * @return {?} */ MdcLineRipple.prototype.ngOnInit = /** * @return {?} */ function () { this._loadListeners(); }; /** * @return {?} */ MdcLineRipple.prototype.destroy = /** * @return {?} */ function () { this._destroy.next(); this._destroy.complete(); }; /** * @return {?} */ MdcLineRipple.prototype.ngOnDestroy = /** * @return {?} */ function () { this.destroy(); }; /** Activates the line ripple */ /** * Activates the line ripple * @return {?} */ MdcLineRipple.prototype.activate = /** * Activates the line ripple * @return {?} */ function () { this._foundation.activate(); }; /** Deactivates the line ripple */ /** * Deactivates the line ripple * @return {?} */ MdcLineRipple.prototype.deactivate = /** * Deactivates the line ripple * @return {?} */ function () { this._foundation.deactivate(); }; /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. */ /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. * @param {?} xCoordinate * @return {?} */ MdcLineRipple.prototype.setRippleCenter = /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. * @param {?} xCoordinate * @return {?} */ function (xCoordinate) { this._foundation.setRippleCenter(xCoordinate); }; /** * @private * @return {?} */ MdcLineRipple.prototype._loadListeners = /** * @private * @return {?} */ function () { var _this = this; this._ngZone.runOutsideAngular((/** * @return {?} */ function () { return fromEvent(_this._getHostElement(), 'transitionend') .pipe(takeUntil(_this._destroy), filter((/** * @param {?} e * @return {?} */ function (e) { return e.target === _this._getHostElement(); }))) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._ngZone.run((/** * @return {?} */ function () { return _this._foundation.handleTransitionEnd(evt); })); })); })); }; /** Retrieves the DOM element of the component host. */ /** * Retrieves the DOM element of the component host. * @private * @return {?} */ MdcLineRipple.prototype._getHostElement = /** * Retrieves the DOM element of the component host. * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcLineRipple.decorators = [ { type: Directive, args: [{ selector: '[mdcLineRipple], mdc-line-ripple', exportAs: 'mdcLineRipple', host: { 'class': 'mdc-line-ripple' } },] }, ]; /** @nocollapse */ MdcLineRipple.ctorParameters = function () { return [ { type: NgZone }, { type: ElementRef } ]; }; return MdcLineRipple; }(MDCComponent)); /** * @fileoverview added by tsickle * Generated from: line-ripple/module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcLineRippleModule = /** @class */ (function () { function MdcLineRippleModule() { } MdcLineRippleModule.decorators = [ { type: NgModule, args: [{ exports: [MdcLineRipple], declarations: [MdcLineRipple] },] }, ]; return MdcLineRippleModule; }()); export { MdcLineRipple, MdcLineRippleModule }; //# sourceMappingURL=line-ripple.es5.js.map