ngx-notification
Version:
Angular Library to display all types of notifications in a Toast Notification format. Tested on Angular 6
2 lines • 3.84 kB
JavaScript
!function(n,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core"),require("rxjs"),require("@angular/common"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("ngx-notification",["exports","@angular/core","rxjs","@angular/common","@angular/platform-browser"],o):o(n["ngx-notification"]={},n.ng.core,null,n.ng.common,n.ng.platformBrowser)}(this,function(n,o,t,e,i){"use strict";var r=function(){function n(){this.subject=new t.Subject}return n.prototype.sendMessage=function(n,o,t){this.subject.next({text:n,theme:o,position:t})},n.prototype.clearMessage=function(){this.subject.next()},n.prototype.getMessage=function(){return this.subject.asObservable()},n.decorators=[{type:o.Injectable,args:[{providedIn:"root"}]}],n.ctorParameters=function(){return[]},n.ngInjectableDef=o.defineInjectable({factory:function(){return new n},token:n,providedIn:"root"}),n}(),c=function(){function n(n){var o=this;this.ngxNotificationService=n,this.message={},this.subscription=this.ngxNotificationService.getMessage().subscribe(function(n){o.show=!0,o.message=n,console.log(o.message),o.autoHideMessage()})}return n.prototype.ngOnInit=function(){},n.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},n.prototype.autoHideMessage=function(){var n=this;setTimeout(function(){n.show=!1},5e3)},n.decorators=[{type:o.Component,args:[{selector:"lib-ngx-notification",template:"<div *ngIf='show' class='ngx-notification {{ message.position }} {{ message.theme }} show'>{{message?.text }}</div>",styles:["\n .ngx-notification.dark {\n background-color: #2d2d30;\n border-color: #272729;\n color: #c9c9c9;\n }\n .ngx-notification.light {\n background-color: #ffffff;\n border-color: #cccccc;\n color: #2d2d30;\n }\n .ngx-notification.success {\n background-color: #dff0d8;\n border-color: #d0e9c6;\n color: #3c763d;\n }\n .ngx-notification.info {\n background-color: #d9edf7;\n border-color: #bcdff1;\n color: #31708f;\n }\n .ngx-notification.warning {\n background-color: #fcf8e3;\n border-color: #faf2cc;\n color: #8a6d3b;\n }\n .ngx-notification.danger {\n background-color: #f2dede;\n border-color: #ebcccc;\n color: #a94442;\n }\n .ngx-notification.top-left {\n position: fixed;\n left: 10px;\n top: 10px;\n }\n .ngx-notification.top-right {\n position: fixed;\n right: 10px;\n top: 10px;\n }\n .ngx-notification.bottom-right {\n position: fixed;\n right: 10px;\n bottom: 10px;\n }\n .ngx-notification.bottom-left {\n position: fixed;\n left: 10px;\n bottom: 10px;\n }\n .ngx-notification.center {\n position:absolute;\n top: 50%;\n left: 50%;\n margin-top: -9em;\n margin-left: -15em;\n }\n .ngx-notification {\n padding: .75rem 1.25rem;\n margin-bottom: 1rem;\n border: 1px solid transparent;\n border-radius: .25rem;\n -webkit-animation: fadein 1.5s, fadeout 1.5s 3.5s;\n animation: fadein 1.5s, fadeout 1.5s 3.5s;\n z-index : 1;\n }\n\n /* Animations to fade the snackbar in and out */\n @-webkit-keyframes fadein {\n from {opacity: 0;}\n to {opacity: 1;}\n }\n\n @keyframes fadein {\n from {opacity: 0;}\n to {opacity: 1;}\n }\n\n @-webkit-keyframes fadeout {\n from {opacity: 1;}\n to {opacity: 0;}\n }\n\n @keyframes fadeout {\n from {opacity: 1;}\n to {opacity: 0;}\n }\n "]}]}],n.ctorParameters=function(){return[{type:r}]},n}(),a=function(){function n(){}return n.decorators=[{type:o.NgModule,args:[{imports:[e.CommonModule,i.BrowserModule],declarations:[c],exports:[c]}]}],n}();n.NgxNotificationService=r,n.NgxNotificationComponent=c,n.NgxNotificationModule=a,Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-notification.umd.min.js.map