adb-shared 7.0.13 → 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.
- package/fesm2022/adb-shared.mjs +13 -10
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/types/adb-shared.d.ts +3 -2
package/fesm2022/adb-shared.mjs
CHANGED
|
@@ -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,
|
|
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';
|
|
@@ -1144,7 +1144,7 @@ class RichTextComponent {
|
|
|
1144
1144
|
const textEnd = input.indexOf(']', i);
|
|
1145
1145
|
const linkStart = input.indexOf('(', textEnd);
|
|
1146
1146
|
const linkEnd = input.indexOf(')', linkStart);
|
|
1147
|
-
if (textEnd !== -1 && linkStart
|
|
1147
|
+
if (textEnd !== -1 && linkStart === textEnd + 1 && linkEnd !== -1) {
|
|
1148
1148
|
const label = input.slice(i + 1, textEnd);
|
|
1149
1149
|
const link = input.slice(linkStart + 1, linkEnd);
|
|
1150
1150
|
const [type, id] = link.split(':');
|
|
@@ -1157,6 +1157,9 @@ class RichTextComponent {
|
|
|
1157
1157
|
i = linkEnd + 1;
|
|
1158
1158
|
continue;
|
|
1159
1159
|
}
|
|
1160
|
+
parts.push({ type: 'link', content: label, url: link });
|
|
1161
|
+
i = linkEnd + 1;
|
|
1162
|
+
continue;
|
|
1160
1163
|
}
|
|
1161
1164
|
}
|
|
1162
1165
|
let next = input.length;
|
|
@@ -1176,11 +1179,11 @@ class RichTextComponent {
|
|
|
1176
1179
|
return parts;
|
|
1177
1180
|
}
|
|
1178
1181
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: RichTextComponent, deps: [{ token: RICH_MODULE_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
1179
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: RichTextComponent, isStandalone: false, selector: "adb-rich-text", inputs: { text: "text" }, usesOnChanges: true, ngImport: i0, template: "<div style=\"white-space: pre-wrap;\">\r\n @for (part of parts; track $index) {\r\n @switch (part.type) {\r\n @case ('text') { <span>{{ part.content }}</span> }\r\n @case ('italic') { <em>{{ part.content }}</em> }\r\n @case ('bold') { <b>{{ part.content }}</b> }\r\n @case ('taxon') { <a [href]=\"taxonUrl + part.id\">{{ part.content }}</a> }\r\n @default { <span>{{ part.content }}</span> }\r\n }\r\n}\r\n</div
|
|
1182
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: RichTextComponent, isStandalone: false, selector: "adb-rich-text", inputs: { text: "text" }, usesOnChanges: true, ngImport: i0, template: "<div style=\"white-space: pre-wrap;\">\r\n @for (part of parts; track $index) {\r\n @switch (part.type) {\r\n @case ('text') { <span>{{ part.content }}</span> }\r\n @case ('italic') { <em>{{ part.content }}</em> }\r\n @case ('bold') { <b>{{ part.content }}</b> }\r\n @case ('taxon') { <a [href]=\"taxonUrl + part.id\">{{ part.content }}</a> }\r\n @case ('link') { <a [href]=\"part.url\">{{ part.content }}</a> }\r\n @default { <span>{{ part.content }}</span> }\r\n }\r\n}\r\n</div>\r\n", changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1180
1183
|
}
|
|
1181
1184
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: RichTextComponent, decorators: [{
|
|
1182
1185
|
type: Component,
|
|
1183
|
-
args: [{ selector: 'adb-rich-text', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div style=\"white-space: pre-wrap;\">\r\n @for (part of parts; track $index) {\r\n @switch (part.type) {\r\n @case ('text') { <span>{{ part.content }}</span> }\r\n @case ('italic') { <em>{{ part.content }}</em> }\r\n @case ('bold') { <b>{{ part.content }}</b> }\r\n @case ('taxon') { <a [href]=\"taxonUrl + part.id\">{{ part.content }}</a> }\r\n @default { <span>{{ part.content }}</span> }\r\n }\r\n}\r\n</div
|
|
1186
|
+
args: [{ selector: 'adb-rich-text', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div style=\"white-space: pre-wrap;\">\r\n @for (part of parts; track $index) {\r\n @switch (part.type) {\r\n @case ('text') { <span>{{ part.content }}</span> }\r\n @case ('italic') { <em>{{ part.content }}</em> }\r\n @case ('bold') { <b>{{ part.content }}</b> }\r\n @case ('taxon') { <a [href]=\"taxonUrl + part.id\">{{ part.content }}</a> }\r\n @case ('link') { <a [href]=\"part.url\">{{ part.content }}</a> }\r\n @default { <span>{{ part.content }}</span> }\r\n }\r\n}\r\n</div>\r\n" }]
|
|
1184
1187
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1185
1188
|
type: Inject,
|
|
1186
1189
|
args: [RICH_MODULE_CONFIG]
|
|
@@ -1191,7 +1194,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
|
|
|
1191
1194
|
class AdbAlertComponent {
|
|
1192
1195
|
http;
|
|
1193
1196
|
config;
|
|
1194
|
-
alerts = [];
|
|
1197
|
+
alerts = signal([], ...(ngDevMode ? [{ debugName: "alerts" }] : /* istanbul ignore next */ []));
|
|
1195
1198
|
constructor(http, config) {
|
|
1196
1199
|
this.http = http;
|
|
1197
1200
|
this.config = config;
|
|
@@ -1202,12 +1205,12 @@ class AdbAlertComponent {
|
|
|
1202
1205
|
loadAlerts() {
|
|
1203
1206
|
this.http.get(this.config.apiUrl).subscribe(alerts => {
|
|
1204
1207
|
const dismissedIds = this.getItem(`${this.config.clientId}-alert-dismissed`) ?? [];
|
|
1205
|
-
this.alerts
|
|
1206
|
-
(!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))));
|
|
1207
1210
|
});
|
|
1208
1211
|
}
|
|
1209
1212
|
dismiss(alert) {
|
|
1210
|
-
this.alerts
|
|
1213
|
+
this.alerts.set(this.alerts().filter(item => item.id !== alert.id));
|
|
1211
1214
|
const storageKey = `${this.config.clientId}-alert-dismissed`;
|
|
1212
1215
|
const dismissedIds = this.getItem(storageKey) ?? [];
|
|
1213
1216
|
if (!dismissedIds.includes(alert.id)) {
|
|
@@ -1222,11 +1225,11 @@ class AdbAlertComponent {
|
|
|
1222
1225
|
return localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : null;
|
|
1223
1226
|
}
|
|
1224
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 });
|
|
1225
|
-
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" }] });
|
|
1226
1229
|
}
|
|
1227
1230
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertComponent, decorators: [{
|
|
1228
1231
|
type: Component,
|
|
1229
|
-
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" }]
|
|
1230
1233
|
}], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
1231
1234
|
type: Inject,
|
|
1232
1235
|
args: [ADB_ALERT_CONFIG]
|