@angular-mdc/web
Version:
269 lines (255 loc) • 9.21 kB
JavaScript
/**
* @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
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular-mdc/web/base'), require('@material/line-ripple')) :
typeof define === 'function' && define.amd ? define('@angular-mdc/web/line-ripple', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular-mdc/web/base', '@material/line-ripple'], factory) :
(global = global || self, factory((global.ng = global.ng || {}, global.ng.web = global.ng.web || {}, global.ng.web.lineRipple = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.web.base, global.mdc.lineRipple));
}(this, (function (exports, core, rxjs, operators, base, lineRipple) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function (d, b) {
d.__proto__ = b;
} || function (d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) d[p] = b[p];
}
};
return _extendStatics(d, b);
};
function __extends(d, b) {
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
/**
* @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 rxjs.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 lineRipple.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 rxjs.fromEvent(_this._getHostElement(), 'transitionend')
.pipe(operators.takeUntil(_this._destroy), operators.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: core.Directive, args: [{
selector: '[mdcLineRipple], mdc-line-ripple',
exportAs: 'mdcLineRipple',
host: { 'class': 'mdc-line-ripple' }
},] },
];
/** @nocollapse */
MdcLineRipple.ctorParameters = function () { return [
{ type: core.NgZone },
{ type: core.ElementRef }
]; };
return MdcLineRipple;
}(base.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: core.NgModule, args: [{
exports: [MdcLineRipple],
declarations: [MdcLineRipple]
},] },
];
return MdcLineRippleModule;
}());
exports.MdcLineRipple = MdcLineRipple;
exports.MdcLineRippleModule = MdcLineRippleModule;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=web-line-ripple.umd.js.map