biplab-notifier
Version:
This is a notification npm package, it can be use as simple notification or modal dialog, a lot of customization option are available as well, checkout the github repo and examples
149 lines • 19.5 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { Component, Input, Output, EventEmitter, ElementRef, ViewChild } from '@angular/core';
import { Message } from '../message/notifer';
var NotificationsComponent = /** @class */ (function () {
function NotificationsComponent() {
this.close = new EventEmitter();
}
/**
* @return {?}
*/
NotificationsComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
};
/**
* @param {?} event
* @return {?}
*/
NotificationsComponent.prototype.closeDailog = /**
* @param {?} event
* @return {?}
*/
function (event) {
/** @type {?} */
var layout = (/** @type {?} */ (this.layoutHint.layout));
if (layout.displayAs === 'dialog' && !layout.disableOutsideClick) {
if (event && event.target === this.myDiv.nativeElement) {
this.close.emit(false);
}
}
};
/**
* @param {?} button
* @return {?}
*/
NotificationsComponent.prototype.click = /**
* @param {?} button
* @return {?}
*/
function (button) {
var e_1, _a;
if (!!button.callBackFunctions && button.callBackFunctions.length > 0) {
try {
for (var _b = tslib_1.__values(button.callBackFunctions), _c = _b.next(); !_c.done; _c = _b.next()) {
var custom = _c.value;
if (custom.param) {
custom.func(custom.param);
}
else {
custom.func();
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
}
else {
if (button.type === 'button') {
this.notificationClose(button.emitValue);
}
}
};
/**
* @param {?} status
* @return {?}
*/
NotificationsComponent.prototype.notificationClose = /**
* @param {?} status
* @return {?}
*/
function (status) {
this.close.emit(status);
};
Object.defineProperty(NotificationsComponent.prototype, "shadow", {
get: /**
* @return {?}
*/
function () {
return !!this.layoutHint.css.shadow ? this.layoutHint.layout.displayAs + "-shadow" : '';
},
enumerable: true,
configurable: true
});
/**
* @param {?} button
* @return {?}
*/
NotificationsComponent.prototype.buttonStatus = /**
* @param {?} button
* @return {?}
*/
function (button) {
return typeof (button.emitValue) === 'boolean' && button.emitValue;
};
Object.defineProperty(NotificationsComponent.prototype, "messages", {
get: /**
* @return {?}
*/
function () {
if (this.layoutHint && this.layoutHint.data) {
/** @type {?} */
var rows = (/** @type {?} */ (this.layoutHint.data)) || [new Message('')];
return rows.map((/**
* @param {?} row
* @return {?}
*/
function (row) { return row.message; }));
}
return [];
},
enumerable: true,
configurable: true
});
NotificationsComponent.decorators = [
{ type: Component, args: [{
selector: 'biplab-notifications',
template: "<ng-template #empty></ng-template>\n<ng-template [ngIf]=\"layoutHint\">\n<div #parentDailog (click)=\"closeDailog($event)\" [ngClass]=\"[ layoutHint.layout.displayAs ]\">\n <div>\n <!-- Modal content -->\n <div\n [ngClass]=\"[\n layoutHint.layout.displayAs+'-content', \n layoutHint.css.position,\n layoutHint.layout.displayAs+'-'+layoutHint.css.position+'-animation',\n shadow\n ]\"\n [ngStyle]=\"{\n 'max-width': layoutHint.layout.displayAs === 'notification' ? ( layoutHint.css?.width ? '97vw' : '100vw' ) : '80vw',\n 'max-height': '100vh',\n 'width': layoutHint.css?.width,\n 'height': layoutHint.css?.height}\">\n <!-- Modal Title -->\n <ng-template [ngIf]=\"layoutHint.layout.title.status === 'show'\">\n <ng-template #mainTitle >\n <div class=\"notification-multi-title\" [ngStyle]=\"{'background': layoutHint.css.background, 'color': layoutHint.css.color}\">\n <ng-content select=\"[notificationIcon]\"></ng-content>\n <ng-container *ngIf=\"layoutHint.template?.typeIcon then layoutHint.template?.typeIcon else empty\"></ng-container>\n <ng-template [ngIf]=\"layoutHint.layout.closeButton.status === 'show'\">\n <span (click)=\"notificationClose(false)\" class=\"notification-multi-close\">×</span>\n </ng-template>\n <ng-content select=\"[notificationTitle]\"></ng-content>\n <strong>{{ layoutHint.layout['titleText'] ? layoutHint.layout['titleText'] : layoutHint.type | titlecase }} </strong>\n </div>\n </ng-template>\n <ng-container *ngTemplateOutlet=\"layoutHint.template?.titleTemplate ? \n layoutHint.template?.titleTemplate : mainTitle; context:{ 'data': messages, event: close, 'notificationClose': notificationClose.bind(this)}\">\n </ng-container>\n </ng-template>\n <div [ngStyle]=\"{'padding': !!layoutHint.layout['head'] ? '0px 16px' : '16px'}\" \n [ngClass]=\"[ 'notification-multi-body-'+ layoutHint.layout.displayAs ]\">\n <!-- Modal header -->\n <ng-template #headTeample>\n <ng-template [ngIf]=\"layoutHint.layout['head']\">\n <h1> {{layoutHint.layout['head']}}</h1>\n </ng-template>\n </ng-template>\n <ng-container *ngTemplateOutlet=\"layoutHint.template?.head ? layoutHint.template?.head : headTeample\"></ng-container>\n\n <!-- Modal Body -->\n <ng-template #bodyTemplate>\n <ng-template [ngIf]=\"!!messages && messages.length > 0\">\n <div class=\"notification-multi-message-row\" *ngFor=\"let message of messages\">{{ message }}</div>\n </ng-template>\n </ng-template>\n <ng-content select=\"[notificationMessages]\"></ng-content>\n <ng-container *ngTemplateOutlet=\"layoutHint.template?.body ? layoutHint.template?.body : bodyTemplate; context:{ data: messages, 'notificationClose': notificationClose.bind(this) }\"></ng-container>\n <!-- footer -->\n <div class=\"notification-multi-body-footer\">\n <ng-container *ngIf=\"layoutHint.template?.footer then layoutHint.template?.footer else empty\"></ng-container>\n <ng-content select=\"[notificationFooter]\"></ng-content>\n </div>\n </div>\n <!-- Modal action -->\n <ng-template [ngIf]=\"layoutHint.layout['actionRow']['status'] === 'show'\">\n <div id=\"action\" [ngClass]=\"[ 'notification-multi-action-'+layoutHint.layout.displayAs ]\" >\n <ng-template #bottonTemplate>\n <button\n class=\"button\"\n *ngFor=\"let button of layoutHint.buttons\"\n [disabled]=\"button?.disabled\"\n [type]=\"button?.type\"\n (click)=\"click(button)\"\n [ngClass]=\"{ 'button-shadow': button.css?.shadow}\"\n [ngStyle]=\"{\n 'color': button.css?.color,\n 'background': button.css?.background\n }\"\n >\n <ng-template [ngIf]=\"buttonStatus(button)\">\n <ng-content select=\"[notificationTrueButton]\"></ng-content>\n </ng-template>\n <ng-template [ngIf]=\"!buttonStatus(button)\">\n <ng-content select=\"[notificationFalseButton]\"></ng-content>\n </ng-template>\n {{ button.text }}\n </button>\n </ng-template>\n <ng-container *ngTemplateOutlet=\"layoutHint.template?.button ? layoutHint.template?.button : bottonTemplate; context:{ 'data': messages, 'event': close, 'notificationClose': notificationClose.bind(this) }\"></ng-container>\n </div>\n </ng-template>\n </div>\n </div>\n</div>\n</ng-template>\n",
styles: ["body{font-family:Roboto,\"Helvetica Neue Light\",\"Helvetica Neue\",Helvetica,Arial,\"Lucida Grande\",sans-serif;margin:0}h1{margin:10px 0}.notification{opacity:1;transition:opacity .6s}.notification-shadow,.snack-bar-shadow{box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)}.dialog-shadow{box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12)}.snack-bar{display:block;position:fixed;z-index:1;overflow:auto}.snack-bar-content{position:fixed;background:#f5f3f3;color:#000}.dialog{display:block;position:fixed;z-index:1;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgba(0,0,0,.4)}.dialog-content{margin:auto;display:block;position:fixed;z-index:999;overflow:auto;-webkit-animation-name:fadeIn;-webkit-animation-duration:.4s;animation-name:fadeIn;animation-duration:.4s;color:#000;border-radius:5px;max-height:inherit;background-color:#f5f3f3}.default{margin:0;top:0;left:0;right:0}.top{top:0;left:50%;-webkit-transform:translate(-50%,0);transform:translate(-50%,0)}.left{left:0;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.bottom{bottom:0;left:50%;-webkit-transform:translate(-50%,0);transform:translate(-50%,0)}.right{right:0;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.center{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.snack-bar-bottom-animation{-webkit-animation-name:slideInBottom;-webkit-animation-duration:.4s;animation-name:slideInBottom;animation-duration:.4s}.snack-bar-top-animation{-webkit-animation-name:slideInTop;-webkit-animation-duration:.4s;animation-name:slideInTop;animation-duration:.4s}.snack-bar-left-animation{-webkit-animation-name:slideInLeft;-webkit-animation-duration:.4s;animation-name:slideInLeft;animation-duration:.4s}.snack-bar-right-animation{-webkit-animation-name:slideInRight;-webkit-animation-duration:.4s;animation-name:slideInRight;animation-duration:.4s}.snack-bar-center-animation{-webkit-animation-name:fadeIn;-webkit-animation-duration:.4s;animation-name:fadeIn;animation-duration:.4s}@-webkit-keyframes slideInBottom{from{bottom:-300px;opacity:0}to{bottom:0;opacity:1}}@keyframes slideInBottom{from{bottom:-300px;opacity:0}to{bottom:0;opacity:1}}@-webkit-keyframes slideInRight{from{right:-300px;opacity:0}to{right:0;opacity:1}}@keyframes slideInRight{from{right:-300px;opacity:0}to{right:0;opacity:1}}@-webkit-keyframes slideInLeft{from{left:-300px;opacity:0}to{left:0;opacity:1}}@keyframes slideInLeft{from{left:-300px;opacity:0}to{left:0;opacity:1}}@-webkit-keyframes slideInTop{from{top:-300px;opacity:0}to{top:0;opacity:1}}@keyframes slideInTop{from{top:-300px;opacity:0}to{top:0;opacity:1}}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}.notification-multi{opacity:1}.notification-multi-container{display:block}.notification-multi-content{background-color:#f1ecec;margin:auto;padding:0}.notification-multi-message-row{padding:3px;width:100%;font-size:20px}.notification-multi-close{float:right;font-size:26px}.notification-multi-close:focus,.notification-multi-close:hover{text-decoration:none;cursor:pointer;color:#570303}.notification-multi-title{padding:15px;border:1px snow;font-size:22px}.notification-multi-header{padding:0 15px}.notification-multi-footer{padding:12px 16px}.button{font-family:Roboto,\"Helvetica Neue\",sans-serif;font-size:14px;font-weight:500;-webkit-appearance:button;background:0 0;align-items:flex-start;box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;transition-duration:.4s;overflow:hidden}.button:hover{transition:.8s;opacity:.8}.button-shadow{box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}.notification-multi-primary-btn:hover{background:#3f51b52a}.notification-multi-warning-btn{color:#f44336}.notification-multi-warning-btn:hover{background:#f4433638}.notification-multi-action-notification{padding:10px}.notification-multi-action-dialog,.notification-multi-action-snack-bar{padding:10px;background:#f5f3f3}.notification-multi-action button{margin-right:10px}.notification-multi-body-dialog,.notification-multi-body-snack-bar{display:block;max-height:65vh;overflow:auto;background:#f5f3f3;word-wrap:break-word}.notification-multi-body-footer{overflow:auto;max-height:70px;word-wrap:break-word}#action button{margin-right:10px}"]
}] }
];
/** @nocollapse */
NotificationsComponent.ctorParameters = function () { return []; };
NotificationsComponent.propDecorators = {
myDiv: [{ type: ViewChild, args: ['parentDailog',] }],
layoutHint: [{ type: Input }],
close: [{ type: Output }]
};
return NotificationsComponent;
}());
export { NotificationsComponent };
if (false) {
/** @type {?} */
NotificationsComponent.prototype.myDiv;
/** @type {?} */
NotificationsComponent.prototype.layoutHint;
/** @type {?} */
NotificationsComponent.prototype.close;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90aWZpY2F0aW9ucy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9iaXBsYWItbm90aWZpZXIvIiwic291cmNlcyI6WyJsaWIvbm90aWZpY2F0aW9ucy9ub3RpZmljYXRpb25zLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQVU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