UNPKG

@angular-mdc/web

Version:
8 lines 4.35 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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular-mdc/web/icon"),require("@angular/cdk/coercion"),require("@angular-mdc/web/ripple")):"function"==typeof define&&define.amd?define("@angular-mdc/web/fab",["exports","@angular/core","@angular/common","@angular-mdc/web/icon","@angular/cdk/coercion","@angular-mdc/web/ripple"],t):t(((e=e||self).ng=e.ng||{},e.ng.web=e.ng.web||{},e.ng.web.fab={}),e.ng.core,e.ng.common,e.ng.web.icon,e.ng.cdk.coercion,e.ng.web.ripple)}(this,(function(e,t,n,o,i,c){"use strict";var r=function(){function e(){}return e.decorators=[{type:t.Directive,args:[{selector:"mdc-fab-label, [mdcFabLabel]",host:{class:"mdc-fab__label"}}]}],e}(),a=function(){function e(e,t,n){this._changeDetectionRef=e,this.elementRef=t,this._ripple=n,this._mini=!1,this._touch=!1,this._exited=!1,this._extended=!1,this._fluid=!1,this._position=null}return Object.defineProperty(e.prototype,"mini",{get:function(){return this._mini},set:function(e){this._mini=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touch",{get:function(){return this._touch},set:function(e){this._touch=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exited",{get:function(){return this._exited},set:function(e){this._exited=i.coerceBooleanProperty(e),this._changeDetectionRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extended",{get:function(){return this._extended},set:function(e){this._extended=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fluid",{get:function(){return this._fluid},set:function(e){this._fluid=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position&&this._getHostElement().classList.remove("ngx-mdc-fab--"+this._convertPosition(this._position)),e&&this._getHostElement().classList.add("ngx-mdc-fab--"+this._convertPosition(e)),this._position=e},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){this.fabIcon&&this.fabIcon.elementRef.nativeElement.classList.add("mdc-fab__icon"),this._ripple=new c.MdcRipple(this.elementRef),this._ripple.init()},e.prototype._convertPosition=function(e){switch(e){case"bottomLeft":return"bottom-left";case"bottomRight":return"bottom-right";default:return null}},e.prototype.ngOnDestroy=function(){this._ripple.destroy()},e.prototype.toggleExited=function(e){this._exited=e||!this._exited},e.prototype.focus=function(){this._getHostElement().focus()},e.prototype._getHostElement=function(){return this.elementRef.nativeElement},e.decorators=[{type:t.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:[c.MdcRipple],encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}]}],e.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:t.ElementRef},{type:c.MdcRipple}]},e.propDecorators={mini:[{type:t.Input}],touch:[{type:t.Input}],exited:[{type:t.Input}],extended:[{type:t.Input}],fluid:[{type:t.Input}],position:[{type:t.Input}],label:[{type:t.Input}],icon:[{type:t.Input}],fabIcon:[{type:t.ContentChild,args:[o.MdcIcon,{static:!1}]}]},e}(),s=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,o.MdcIconModule],exports:[a,r],declarations:[a,r]}]}],e}();e.MdcFab=a,e.MdcFabLabel=r,e.MdcFabModule=s,Object.defineProperty(e,"__esModule",{value:!0})}));