UNPKG

@angular-mdc/web

Version:
22 lines (20 loc) 5.53 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(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@angular/cdk/coercion"),require("@angular/cdk/platform"),require("@angular-mdc/web/base"),require("@material/tab-indicator")):"function"==typeof define&&define.amd?define("@angular-mdc/web/tab-indicator",["exports","@angular/core","@angular/common","@angular/cdk/coercion","@angular/cdk/platform","@angular-mdc/web/base","@material/tab-indicator"],e):e(((t=t||self).ng=t.ng||{},t.ng.web=t.ng.web||{},t.ng.web.tabIndicator={}),t.ng.core,t.ng.common,t.ng.cdk.coercion,t.ng.cdk.platform,t.ng.web.base,t.mdc.tabIndicator)}(this,(function(t,e,n,o,i,a,c){"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. ***************************************************************************** */var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var s=function(t){function n(e,n,o){var i=t.call(this,o)||this;return i._platform=e,i._changeDetectorRef=n,i.elementRef=o,i._isFoundationInit=!1,i._active=!1,i._fade=!1,i._icon=null,i}return function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,t),Object.defineProperty(n.prototype,"active",{get:function(){return this._active},set:function(t){var e=o.coerceBooleanProperty(t);this._active!==e&&(this._active=o.coerceBooleanProperty(e),this._active?this.activate(this.computeContentClientRect()):this.deactivate())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"fade",{get:function(){return this._fade},set:function(t){var e=o.coerceBooleanProperty(t);e!==this._fade&&(this._fade=e,this._initFoundation())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this._updateContentClasses()},enumerable:!0,configurable:!0}),n.prototype.getDefaultFoundation=function(){var t=this,e={addClass:function(e){return t._getHostElement().classList.add(e)},removeClass:function(e){return t._getHostElement().classList.remove(e)},computeContentClientRect:function(){return t._platform.isBrowser?t.content.nativeElement.getBoundingClientRect():{height:0,width:0,bottom:0,top:0,left:0,right:0}},setContentStyleProperty:function(e,n){return t.content.nativeElement.style.setProperty(e,n)}};return this._fade?new c.MDCFadingTabIndicatorFoundation(e):new c.MDCSlidingTabIndicatorFoundation(e)},n.prototype.ngAfterViewInit=function(){this._isFoundationInit||(this._initFoundation(),this._updateContentClasses())},n.prototype.activate=function(t){this._foundation&&this._foundation.activate(t)},n.prototype.deactivate=function(){this._foundation&&this._foundation.deactivate()},n.prototype.computeContentClientRect=function(){return this._foundation.computeContentClientRect()},n.prototype._initFoundation=function(){this._foundation.init(),this._isFoundationInit=!0,this._changeDetectorRef.markForCheck()},n.prototype._updateContentClasses=function(){this.content.nativeElement.classList.remove("mdc-tab-indicator__content--underline"),this.content.nativeElement.classList.remove("mdc-tab-indicator__content--icon"),this.icon?(this.content.nativeElement.classList.add("mdc-tab-indicator__content--icon"),this.content.nativeElement.classList.add("material-icons")):this.content.nativeElement.classList.add("mdc-tab-indicator__content--underline"),this._changeDetectorRef.markForCheck()},n.prototype._getHostElement=function(){return this.elementRef.nativeElement},n.decorators=[{type:e.Component,args:[{selector:"[mdcTabIndicator], mdc-tab-indicator",exportAs:"mdcTabIndicator",host:{class:"mdc-tab-indicator","[class.mdc-tab-indicator--active]":"active","[class.mdc-tab-indicator--fade]":"fade"},template:'\n <span #content class="mdc-tab-indicator__content">\n <ng-container *ngIf="icon">{{icon}}</ng-container>\n </span>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None}]}],n.ctorParameters=function(){return[{type:i.Platform},{type:e.ChangeDetectorRef},{type:e.ElementRef}]},n.propDecorators={active:[{type:e.Input}],fade:[{type:e.Input}],icon:[{type:e.Input}],content:[{type:e.ViewChild,args:["content",{static:!0}]}]},n}(a.MDCComponent),u=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule],exports:[s],declarations:[s]}]}],t}();t.MdcTabIndicator=s,t.MdcTabIndicatorModule=u,Object.defineProperty(t,"__esModule",{value:!0})}));