@anglr/notifications
Version:
Angular module for displaying notifications
48 lines • 4.01 kB
JavaScript
import { Component, Optional, PLATFORM_ID, ChangeDetectorRef, Inject, ChangeDetectionStrategy } from '@angular/core';
import { NgClass } from '@angular/common';
import { extend } from '@jscrpt/common/extend';
import { NOTIFICATIONS_OPTIONS } from '../../common/notifications.interface';
import { GlobalNotificationsService } from '../../common/notifications.service';
import { NotificationsComponent } from '../notifications/notifications.component';
import { NotificationMessageComponent } from '../notificationMessage/notificationMessage.component';
import { MessageRendererDirective } from '../../directives';
import * as i0 from "@angular/core";
import * as i1 from "../../common/notifications.service";
/**
* Default options for notifications component
* @internal
*/
const defaultOptions = {
cssClasses: {
rootDiv: 'notifications global',
},
getNotificationMessageComponent: () => NotificationMessageComponent,
};
/**
* Notifications component for global messages
*/
export class GlobalNotificationsComponent extends NotificationsComponent {
//######################### constructor #########################
constructor(service, changeDetector, platformId, options) {
super(service, changeDetector, platformId, options);
this.ɵoptions = extend(true, {}, defaultOptions, options);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: GlobalNotificationsComponent, deps: [{ token: i1.GlobalNotificationsService }, { token: i0.ChangeDetectorRef }, { token: PLATFORM_ID }, { token: NOTIFICATIONS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0", type: GlobalNotificationsComponent, isStandalone: true, selector: "global-notifications", usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"options.cssClasses.rootDiv\">\r\n @for(itm of notifications; track itm)\r\n {\r\n <ng-template [messageRenderer]=\"itm\"\r\n [notificationsOptions]=\"options\"\r\n (closed)=\"removeItem($event)\"/>\r\n }\r\n</div>", styles: [".notifications.global\r\n{\r\n position: fixed;\r\n right: 15px;\r\n top: 20px;\r\n z-index: 21312;\r\n}"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: MessageRendererDirective, selector: "[messageRenderer]", inputs: ["messageRenderer", "notificationsOptions"], outputs: ["closed"], exportAs: ["messageRenderer"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: GlobalNotificationsComponent, decorators: [{
type: Component,
args: [{ selector: 'global-notifications', imports: [
NgClass,
MessageRendererDirective,
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"options.cssClasses.rootDiv\">\r\n @for(itm of notifications; track itm)\r\n {\r\n <ng-template [messageRenderer]=\"itm\"\r\n [notificationsOptions]=\"options\"\r\n (closed)=\"removeItem($event)\"/>\r\n }\r\n</div>", styles: [".notifications.global\r\n{\r\n position: fixed;\r\n right: 15px;\r\n top: 20px;\r\n z-index: 21312;\r\n}"] }]
}], ctorParameters: () => [{ type: i1.GlobalNotificationsService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
type: Inject,
args: [PLATFORM_ID]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [NOTIFICATIONS_OPTIONS]
}, {
type: Optional
}] }] });
//# sourceMappingURL=globalNotifications.component.js.map