UNPKG

@angular-mdc/web

Version:
299 lines (293 loc) 10.4 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 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular-mdc/web/icon'), require('@angular/cdk/coercion'), require('@angular-mdc/web/ripple')) : typeof define === 'function' && define.amd ? define('@angular-mdc/web/fab', ['exports', '@angular/core', '@angular/common', '@angular-mdc/web/icon', '@angular/cdk/coercion', '@angular-mdc/web/ripple'], factory) : (global = global || self, factory((global.ng = global.ng || {}, global.ng.web = global.ng.web || {}, global.ng.web.fab = {}), global.ng.core, global.ng.common, global.ng.web.icon, global.ng.cdk.coercion, global.ng.web.ripple)); }(this, (function (exports, core, common, icon, coercion, ripple) { 'use strict'; /** * @fileoverview added by tsickle * Generated from: fab/fab.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFabLabel = /** @class */ (function () { function MdcFabLabel() { } MdcFabLabel.decorators = [ { type: core.Directive, args: [{ selector: 'mdc-fab-label, [mdcFabLabel]', host: { 'class': 'mdc-fab__label' } },] }, ]; return MdcFabLabel; }()); var MdcFab = /** @class */ (function () { function MdcFab(_changeDetectionRef, elementRef, _ripple) { this._changeDetectionRef = _changeDetectionRef; this.elementRef = elementRef; this._ripple = _ripple; this._mini = false; this._touch = false; this._exited = false; this._extended = false; this._fluid = false; this._position = null; } Object.defineProperty(MdcFab.prototype, "mini", { get: /** * @return {?} */ function () { return this._mini; }, set: /** * @param {?} value * @return {?} */ function (value) { this._mini = coercion.coerceBooleanProperty(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "touch", { get: /** * @return {?} */ function () { return this._touch; }, set: /** * @param {?} value * @return {?} */ function (value) { this._touch = coercion.coerceBooleanProperty(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "exited", { get: /** * @return {?} */ function () { return this._exited; }, set: /** * @param {?} value * @return {?} */ function (value) { this._exited = coercion.coerceBooleanProperty(value); this._changeDetectionRef.markForCheck(); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "extended", { get: /** * @return {?} */ function () { return this._extended; }, set: /** * @param {?} value * @return {?} */ function (value) { this._extended = coercion.coerceBooleanProperty(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "fluid", { get: /** * @return {?} */ function () { return this._fluid; }, set: /** * @param {?} value * @return {?} */ function (value) { this._fluid = coercion.coerceBooleanProperty(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdcFab.prototype, "position", { get: /** * @return {?} */ function () { return this._position; }, set: /** * @param {?} value * @return {?} */ function (value) { if (this._position) { this._getHostElement().classList.remove("ngx-mdc-fab--" + this._convertPosition(this._position)); } if (value) { this._getHostElement().classList.add("ngx-mdc-fab--" + this._convertPosition(value)); } this._position = value; }, enumerable: true, configurable: true }); /** * @return {?} */ MdcFab.prototype.ngAfterContentInit = /** * @return {?} */ function () { if (this.fabIcon) { this.fabIcon.elementRef.nativeElement.classList.add('mdc-fab__icon'); } this._ripple = new ripple.MdcRipple(this.elementRef); this._ripple.init(); }; /** * @private * @param {?} position * @return {?} */ MdcFab.prototype._convertPosition = /** * @private * @param {?} position * @return {?} */ function (position) { switch (position) { case 'bottomLeft': { return 'bottom-left'; } case 'bottomRight': { return 'bottom-right'; } default: { return null; } } }; /** * @return {?} */ MdcFab.prototype.ngOnDestroy = /** * @return {?} */ function () { this._ripple.destroy(); }; /** * @param {?=} exited * @return {?} */ MdcFab.prototype.toggleExited = /** * @param {?=} exited * @return {?} */ function (exited) { this._exited = exited ? exited : !this._exited; }; /** Focuses the button. */ /** * Focuses the button. * @return {?} */ MdcFab.prototype.focus = /** * Focuses the button. * @return {?} */ function () { this._getHostElement().focus(); }; /** * @private * @return {?} */ MdcFab.prototype._getHostElement = /** * @private * @return {?} */ function () { return this.elementRef.nativeElement; }; MdcFab.decorators = [ { type: core.Component, args: [{selector: 'button[mdc-fab], a[mdc-fab]', host: { '[attr.tabindex]': 'exited ? -1 : 0', 'class': 'mdc-fab', '[class.mdc-fab--mini]': 'mini', '[class.mdc-fab--exited]': 'exited', '[class.mdc-fab--extended]': 'extended', '[class.ngx-mdc-fab-extended--fluid]': 'fluid', '[class.mdc-fab--touch]': 'touch && mini', }, template: "\n <div class=\"mdc-fab__ripple\"></div>\n <ng-content></ng-content>\n <mdc-icon class=\"mdc-fab__icon\" *ngIf=\"icon\">{{icon}}</mdc-icon>\n <span class=\"mdc-fab__label\" *ngIf=\"label\">{{label}}</span>\n <div class=\"mdc-fab__touch\" *ngIf=\"touch && mini\"></div>", providers: [ripple.MdcRipple], encapsulation: core.ViewEncapsulation.None, changeDetection: core.ChangeDetectionStrategy.OnPush },] }, ]; /** @nocollapse */ MdcFab.ctorParameters = function () { return [ { type: core.ChangeDetectorRef }, { type: core.ElementRef }, { type: ripple.MdcRipple } ]; }; MdcFab.propDecorators = { mini: [{ type: core.Input }], touch: [{ type: core.Input }], exited: [{ type: core.Input }], extended: [{ type: core.Input }], fluid: [{ type: core.Input }], position: [{ type: core.Input }], label: [{ type: core.Input }], icon: [{ type: core.Input }], fabIcon: [{ type: core.ContentChild, args: [icon.MdcIcon, { static: false },] }] }; return MdcFab; }()); /** * @fileoverview added by tsickle * Generated from: fab/module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MdcFabModule = /** @class */ (function () { function MdcFabModule() { } MdcFabModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule, icon.MdcIconModule ], exports: [ MdcFab, MdcFabLabel ], declarations: [MdcFab, MdcFabLabel] },] }, ]; return MdcFabModule; }()); exports.MdcFab = MdcFab; exports.MdcFabLabel = MdcFabLabel; exports.MdcFabModule = MdcFabModule; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=web-fab.umd.js.map