ngh-spinner
Version:
Library for Loading Spinner - Angular 4/5/6
2 lines • 6.13 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common/http"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngh-spinner",["exports","@angular/core","rxjs","rxjs/operators","@angular/common/http","@angular/common"],t):t(e["ngh-spinner"]={},e.ng.core,e.rxjs,e.rxjs.operators,e.ng.common.http,e.ng.common)}(this,function(e,t,n,o,r,i){"use strict";var a=function(){function e(){this.spinnerChange=new n.Subject}return e.prototype.show=function(){console.log("ddd"),this.spinnerChange.next(!0)},e.prototype.hide=function(){this.spinnerChange.next(!1)},e.prototype.getState=function(){return this.spinnerChange.asObservable()},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),s=function(){function e(e){var t=this;this.spinnerService=e,this.bgColor="rgba(0,0,0,0.5)",this.color="#2598db",this.type="circle-clip",this.showHide=!1,this.subscription=this.spinnerService.getState().subscribe(function(e){t.showHide=e})}return e.prototype.ngOnInit=function(){},e.decorators=[{type:t.Component,args:[{selector:"ngh-spinner",template:'<div class="overlay" [ngStyle]="{\'background-color\':bgColor,\'color\': color}" *ngIf="showHide" >\n <div class="loader" [ngClass]="type">\n <div></div>\n </div>\n</div>',styles:['.overlay{position:fixed;width:100%;height:100%;top:0;left:0;right:0;bottom:0;z-index:2}.loader{position:absolute;top:50%;left:50%}.circle-clip{border:5px solid transparent;border-radius:50%;border-top:5px solid;width:25px;height:25px;-webkit-animation:2s linear infinite spin;animation:2s linear infinite spin}.square-spin{border:5px solid;width:25px;height:25px;-webkit-animation:2s linear infinite spin;animation:2s linear infinite spin}.bar-load{height:4px;position:relative;overflow:hidden;background-color:#c3c3c3;width:25%;left:37.5%}.bar-load div{display:block;position:absolute;content:"";left:-200px;width:200px;height:4px;background-color:currentColor;-webkit-animation:2s linear infinite loading;animation:2s linear infinite loading}@-webkit-keyframes loading{from{left:-200px;width:30%}50%{width:30%}70%{width:70%}80%{left:50%}95%{left:120%}to{left:100%}}@keyframes loading{from{left:-200px;width:30%}50%{width:30%}70%{width:70%}80%{left:50%}95%{left:120%}to{left:100%}}.bar-center{height:4px;position:relative;overflow:hidden;background-color:#c3c3c3;width:25%;left:37.5%}.bar-center div{content:"";display:inline;position:absolute;width:0;height:100%;left:50%;text-align:center;background-color:currentColor;-webkit-animation:3s linear infinite center-loading;animation:3s linear infinite center-loading}@-webkit-keyframes center-loading{from{left:50%;width:0;z-index:100}33.3333%{left:0;width:100%;z-index:10}to{left:0;width:100%}}@keyframes center-loading{from{left:50%;width:0;z-index:100}33.3333%{left:0;width:100%;z-index:10}to{left:0;width:100%}}.spinner{width:40px;height:40px;margin:40px;-webkit-animation:1.4s ease-in-out infinite rotate,1.4s ease-in-out infinite alternate background;animation:1.4s ease-in-out infinite rotate,1.4s ease-in-out infinite alternate background}@-webkit-keyframes rotate{0%{-webkit-transform:perspective(120px) rotateX(0) rotateY(0);transform:perspective(120px) rotateX(0) rotateY(0)}50%{-webkit-transform:perspective(120px) rotateX(-180deg) rotateY(0);transform:perspective(120px) rotateX(-180deg) rotateY(0)}100%{-webkit-transform:perspective(120px) rotateX(-180deg) rotateY(-180deg);transform:perspective(120px) rotateX(-180deg) rotateY(-180deg)}}@keyframes rotate{0%{-webkit-transform:perspective(120px) rotateX(0) rotateY(0);transform:perspective(120px) rotateX(0) rotateY(0)}50%{-webkit-transform:perspective(120px) rotateX(-180deg) rotateY(0);transform:perspective(120px) rotateX(-180deg) rotateY(0)}100%{-webkit-transform:perspective(120px) rotateX(-180deg) rotateY(-180deg);transform:perspective(120px) rotateX(-180deg) rotateY(-180deg)}}@-webkit-keyframes background{0%,100%,50%{background-color:currentColor}}@keyframes background{0%,100%,50%{background-color:currentColor}}.signal{border:5px solid currentColor;border-radius:30px;height:30px;left:50%;margin:-15px 0 0 -15px;opacity:0;position:absolute;top:50%;width:30px;-webkit-animation:1s ease-out infinite pulsate;animation:1s ease-out infinite pulsate}@-webkit-keyframes pulsate{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:0}50%{opacity:1}100%{-webkit-transform:scale(1.2);transform:scale(1.2);opacity:0}}@keyframes pulsate{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:0}50%{opacity:1}100%{-webkit-transform:scale(1.2);transform:scale(1.2);opacity:0}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}']}]}],e.ctorParameters=function(){return[{type:a}]},e.propDecorators={bgColor:[{type:t.Input}],color:[{type:t.Input}],type:[{type:t.Input}]},e}(),p=function(){function e(e){this.nghSpinnerService=e}return e.prototype.intercept=function(e,t){var r=this;e.clone({headers:e.headers.set("headerName","headerValue")});return t.handle(e).pipe(o.map(function(e){return r.nghSpinnerService.show(),e}),o.catchError(function(e){return n.throwError(e)}),o.finalize(function(){r.nghSpinnerService.hide()}))},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:a}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(a))},token:e,providedIn:"root"}),e}(),c=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[i.CommonModule],providers:[{provide:r.HTTP_INTERCEPTORS,useClass:p,multi:!0}],declarations:[s],exports:[s]}]}],e}();e.NghSpinnerService=a,e.NghSpinnerComponent=s,e.NghSpinnerModule=c,e.ɵa=p,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ngh-spinner.umd.min.js.map