ngx-bootstrap-alert
Version:
For Angular5+ Provides alert messaging for your application. Message styling is driven by [Bootstrap](https://getbootstrap.com/).
3 lines (2 loc) • 4.02 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs/add/operator/toPromise"),require("rxjs/Rx"),require("@angular/animations"),require("@angular/common"),require("@angular/platform-browser/animations"),require("uuid")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/add/operator/toPromise","rxjs/Rx","@angular/animations","@angular/common","@angular/platform-browser/animations","uuid"],e):e(t["ngx-bootstrap-alert"]={},t.ng.core,t.Rx.Observable.prototype,t.Rx,t.ng.animations,t.ng.common,t.ng.platformBrowser.animations,t.uuid)}(this,function(t,e,o,r,i,n,s,a){"use strict";var u=function(){function t(){this._bootstrapAlert=new r.BehaviorSubject(null)}return t.prototype.alert=function(t){this._bootstrapAlert.next(t)},t}();u.decorators=[{type:e.Injectable}],u.ctorParameters=function(){return[]};var l=function(){function t(t){var e=this;this.bootstrapAlertService=t,this.DEFAULT_TIMEOUT=3e3,this.FADE_TIMEOUT=600,this.bootstrapAlerts=[],this.bootstrapAlertService._bootstrapAlert.subscribe(function(t){e.show(t)})}return t.prototype.show=function(t){var e=this;t&&(this.bootstrapAlerts.unshift(t),setTimeout(function(){e.destroy(t.uuid)},t.timeoutInMiliSeconds?t.timeoutInMiliSeconds:this.DEFAULT_TIMEOUT))},t.prototype.fade=function(t){t.state="destroyed"},t.prototype.destroy=function(t){var e=this,o=this.findIndex(this.bootstrapAlerts,"uuid",t);-1!==o&&(this.bootstrapAlerts[o].state="destroyed",setTimeout(function(){e.bootstrapAlerts.splice(o,1)},this.FADE_TIMEOUT))},t.prototype.findIndex=function(t,e,o){for(var r=0;r<t.length;r+=1)if(t[r][e]===o)return r;return-1},t}();l.decorators=[{type:e.Component,args:[{selector:"bootstrap-alert",template:'<div [ngClass]="alertPosition" class="bootstrap-alert col-lg-4">\n\t<div *ngFor="let bootstrapAlert of bootstrapAlerts" id="{{bootstrapAlert.uuid}}" class="alert alert-dismissable mb-2" [ngClass]="bootstrapAlert.type" [@alertVisible]="bootstrapAlert.state">\n\t\t<button type="button" class="close" (click)="destroy(bootstrapAlert.uuid)" >x</button>\n\t\t{{bootstrapAlert.message}}\n\t</div>\n</div>\n',styles:[".bootstrap-alert{z-index:2000;position:fixed}.top-left{left:1rem;top:1rem}.top-center{margin:auto;left:0;right:0;top:1rem}.top-right{right:1rem;top:1rem}.bottom-left{left:1rem;bottom:1rem}.bottom-center{margin:auto;left:0;right:0;bottom:1rem}.bottom-right{right:1rem;bottom:1rem}"],animations:[i.trigger("alertVisible",[i.state("visible",i.style({opacity:1})),i.state("destroyed",i.style({opacity:0})),i.transition("visible => destroyed",i.animate("600ms")),i.transition("destroyed => visible",i.animate("600ms"))])]}]}],l.ctorParameters=function(){return[{type:u}]},l.propDecorators={alertPosition:[{type:e.Input}]};var p=function(){};p.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,s.BrowserAnimationsModule],declarations:[l],exports:[l],providers:[u]}]}],p.ctorParameters=function(){return[]};var c=function(){function t(t,e){this._uuid=a.v4(),this._type=e,this._message=t,this._state="visible"}return Object.defineProperty(t.prototype,"message",{get:function(){return this._message},set:function(t){this._message=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"timeoutInMiliSeconds",{get:function(){return this._timeoutInMiliSeconds},set:function(t){this._timeoutInMiliSeconds=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},set:function(t){this._type=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uuid",{get:function(){return this._uuid},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},set:function(t){this._state=t},enumerable:!0,configurable:!0}),t}();t.BootstrapAlertService=u,t.BootstrapAlert=c,t.BootstrapAlertComponent=l,t.BootstrapAlertModule=p,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-bootstrap-alert.umd.min.js.map