adb-shared 7.0.14 → 7.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i2 from '@angular/common';
2
2
  import { CommonModule, DatePipe, formatDate } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Inject, Injectable, EventEmitter, HostListener, Output, Directive, Input, HostBinding, NgModule, ChangeDetectionStrategy, Component, output, input, Pipe, InjectionToken, forwardRef, createComponent, signal, model, contentChild, TemplateRef, ContentChild } from '@angular/core';
4
+ import { Inject, Injectable, EventEmitter, HostListener, Output, Directive, Input, HostBinding, NgModule, ChangeDetectionStrategy, Component, output, input, Pipe, InjectionToken, signal, forwardRef, createComponent, model, contentChild, TemplateRef, ContentChild } from '@angular/core';
5
5
  import * as i1$2 from '@angular/common/http';
6
6
  import { provideHttpClient, withInterceptorsFromDi, HttpHeaders, HTTP_INTERCEPTORS } from '@angular/common/http';
7
7
  import * as i1 from '@angular/router';
@@ -1194,7 +1194,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
1194
1194
  class AdbAlertComponent {
1195
1195
  http;
1196
1196
  config;
1197
- alerts = [];
1197
+ alerts = signal([], ...(ngDevMode ? [{ debugName: "alerts" }] : /* istanbul ignore next */ []));
1198
1198
  constructor(http, config) {
1199
1199
  this.http = http;
1200
1200
  this.config = config;
@@ -1205,12 +1205,12 @@ class AdbAlertComponent {
1205
1205
  loadAlerts() {
1206
1206
  this.http.get(this.config.apiUrl).subscribe(alerts => {
1207
1207
  const dismissedIds = this.getItem(`${this.config.clientId}-alert-dismissed`) ?? [];
1208
- this.alerts = alerts.filter(alert => !dismissedIds.includes(alert.id) &&
1209
- (!alert.affectedSystems?.length || alert.affectedSystems.includes(this.config.clientId)));
1208
+ this.alerts.set(alerts.filter(alert => !dismissedIds.includes(alert.id) &&
1209
+ (!alert.affectedSystems?.length || alert.affectedSystems.includes(this.config.clientId))));
1210
1210
  });
1211
1211
  }
1212
1212
  dismiss(alert) {
1213
- this.alerts = this.alerts.filter(item => item.id !== alert.id);
1213
+ this.alerts.set(this.alerts().filter(item => item.id !== alert.id));
1214
1214
  const storageKey = `${this.config.clientId}-alert-dismissed`;
1215
1215
  const dismissedIds = this.getItem(storageKey) ?? [];
1216
1216
  if (!dismissedIds.includes(alert.id)) {
@@ -1225,11 +1225,11 @@ class AdbAlertComponent {
1225
1225
  return localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : null;
1226
1226
  }
1227
1227
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertComponent, deps: [{ token: i1$2.HttpClient }, { token: ADB_ALERT_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
1228
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbAlertComponent, isStandalone: false, selector: "adb-alert", ngImport: i0, template: "@for (alert of alerts; track alert.id) {\r\n <div class=\"alert alert-dismissible\" [ngClass]=\"alert.severity === 2 ? 'alert-warning' : 'alert-info'\">\r\n <div role=\"status\" aria-atomic=\"true\" [id]=\"'adb-alert-message-' + alert.id\">\r\n <adb-rich-text [text]=\"alert.message\"></adb-rich-text>\r\n </div>\r\n @if(!alert.sticky){\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'CLOSE' | translate\" [attr.aria-describedby]=\"'adb-alert-message-' + alert.id\" (click)=\"dismiss(alert)\">\r\n </button>\r\n }\r\n </div>\r\n}", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: RichTextComponent, selector: "adb-rich-text", inputs: ["text"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
1228
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbAlertComponent, isStandalone: false, selector: "adb-alert", ngImport: i0, template: "@for (alert of alerts(); track alert.id) {\r\n <div class=\"alert alert-dismissible\" [ngClass]=\"alert.severity === 2 ? 'alert-warning' : 'alert-info'\">\r\n <div role=\"status\" aria-atomic=\"true\" [id]=\"'adb-alert-message-' + alert.id\">\r\n <adb-rich-text [text]=\"alert.message\"></adb-rich-text>\r\n </div>\r\n @if(!alert.sticky){\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'CLOSE' | translate\" [attr.aria-describedby]=\"'adb-alert-message-' + alert.id\" (click)=\"dismiss(alert)\">\r\n </button>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: RichTextComponent, selector: "adb-rich-text", inputs: ["text"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
1229
1229
  }
1230
1230
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertComponent, decorators: [{
1231
1231
  type: Component,
1232
- args: [{ selector: 'adb-alert', standalone: false, template: "@for (alert of alerts; track alert.id) {\r\n <div class=\"alert alert-dismissible\" [ngClass]=\"alert.severity === 2 ? 'alert-warning' : 'alert-info'\">\r\n <div role=\"status\" aria-atomic=\"true\" [id]=\"'adb-alert-message-' + alert.id\">\r\n <adb-rich-text [text]=\"alert.message\"></adb-rich-text>\r\n </div>\r\n @if(!alert.sticky){\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'CLOSE' | translate\" [attr.aria-describedby]=\"'adb-alert-message-' + alert.id\" (click)=\"dismiss(alert)\">\r\n </button>\r\n }\r\n </div>\r\n}" }]
1232
+ args: [{ selector: 'adb-alert', standalone: false, template: "@for (alert of alerts(); track alert.id) {\r\n <div class=\"alert alert-dismissible\" [ngClass]=\"alert.severity === 2 ? 'alert-warning' : 'alert-info'\">\r\n <div role=\"status\" aria-atomic=\"true\" [id]=\"'adb-alert-message-' + alert.id\">\r\n <adb-rich-text [text]=\"alert.message\"></adb-rich-text>\r\n </div>\r\n @if(!alert.sticky){\r\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'CLOSE' | translate\" [attr.aria-describedby]=\"'adb-alert-message-' + alert.id\" (click)=\"dismiss(alert)\">\r\n </button>\r\n }\r\n </div>\r\n}\r\n" }]
1233
1233
  }], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
1234
1234
  type: Inject,
1235
1235
  args: [ADB_ALERT_CONFIG]