adb-shared 7.0.12 → 7.0.14

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
- import * as i1$3 from '@angular/common';
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, forwardRef, createComponent, signal, InjectionToken, model, contentChild, TemplateRef, ContentChild } 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';
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';
@@ -9,9 +9,9 @@ import { NavigationEnd, RouterModule, NavigationStart } from '@angular/router';
9
9
  import * as i1$1 from '@ngx-translate/core';
10
10
  import { TranslatePipe } from '@ngx-translate/core';
11
11
  import { Subscription, Subject, of, BehaviorSubject, catchError, throwError, map as map$1, tap } from 'rxjs';
12
+ import * as i1$3 from '@angular/forms';
13
+ import { NG_VALUE_ACCESSOR, FormsModule, NG_VALIDATORS } from '@angular/forms';
12
14
  import { endOfDay, addYears, startOfDay, subYears, getMonth, subMonths, addMonths, isSameYear, endOfMonth, startOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isSameDay, isWithinInterval, isSameMonth, isValid, parseISO, addSeconds, format } from 'date-fns';
13
- import * as i1$4 from '@angular/forms';
14
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
15
15
  import { delay, debounceTime, switchMap, map, catchError as catchError$1 } from 'rxjs/operators';
16
16
 
17
17
  class EnvironmentService {
@@ -451,7 +451,7 @@ class ArtportalenNavComponent {
451
451
  this.subscription.unsubscribe();
452
452
  }
453
453
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: ArtportalenNavComponent, deps: [{ token: i1$2.HttpClient }, { token: i1.Router }, { token: i1$1.TranslateService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Component });
454
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: ArtportalenNavComponent, isStandalone: false, selector: "adb-artportalen-nav", inputs: { showPattern: "showPattern", userName: "userName" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0, template: "<div class=\"bg-primary adb-main-header position-static\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n @if (translationFinished) {\r\n <header class=\"container-lg px-0\">\r\n <div [attr.id]=\"showPattern?'banner':''\" class=\"px-1 d-flex flex-wrap align-items-center gap-2\">\r\n <nav class=\"d-flex flex-grow-1 align-items-center pe-2 py-2 gap-2\">\r\n <a class=\"d-flex text-white text-decoration-none d-flex gap-2\" href=\"https://www.artdatabanken.se/\" target=\"new\">\r\n <img style=\"height: 2rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <div class=\"border-end d-none d-sm-block\"></div>\r\n <img class=\"d-none d-sm-block align-self-center pe-5\" style=\"height: 0.7rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n </a>\r\n <a [href]=\"$safeNavigationMigration(navigation?.home)\" class=\"text-white text-decoration-none fs-1 fw-bold\">{{'HEADER.TITLE'|translate}}</a>\r\n </nav>\r\n <div class=\"ms-auto d-flex align-items-center gap-2\">\r\n <div><ng-content></ng-content></div>\r\n <div>\r\n <button class=\"d-none d-md-block btn btn-primary-dark btn-lg\" type=\"button\"\r\n title=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\"\r\n attr.aria-label=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\"\r\n (click)=\"onUserClick()\">\r\n <small>{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}</small>\r\n </button>\r\n </div>\r\n <div>\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\" title=\"{{'HEADER.MENY'|translate}}\" attr.aria-label=\"{{'HEADER.MENY'|translate}}\" (click)=\"showMenuDropdown(!showNavMenu)\">\r\n <i class=\"bi bi-list\"></i>\r\n <small class=\"ms-2 d-none d-md-inline-block\">{{'HEADER.MENY'|translate}}</small>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"d-flex justify-content-center d-md-none p-2 border-dark border-top\">\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\"\r\n title=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\"\r\n attr.aria-label=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\" (click)=\"onUserClick()\">\r\n <small>{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}</small>\r\n </button>\r\n </div>\r\n </header>\r\n }\r\n @if (navigation) {\r\n <div role=\"dialog\" class=\"offcanvas offcanvas-end bg-primary text-white\" [class.show]=\"showNavMenu\" tabindex=\"-1\" aria-labelledby=\"offcanvasNav\">\r\n <div class=\"offcanvas-header\">\r\n <h1 class=\"offcanvas-title h-section mb-0\" id=\"offcanvasNav\"><a [href]=\"navigation.home\" class=\"text-white text-decoration-none\">{{'HEADER.TITLE'|translate}}</a></h1>\r\n <button type=\"button\" class=\"btn-close btn-close-white\" attr.aria-label=\"{{'CLOSE'|translate}}\" (click)=\"showMenuDropdown(false)\"></button>\r\n </div>\r\n <div class=\"offcanvas-body d-flex flex-column p-0\">\r\n <div class=\"px-3\">\r\n <div class=\"d-flex flex-wrap justify-content-between align-items-center mb-2 gap-1 px-2\">\r\n @if (fullName) {\r\n <div>\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-primary-dark\">\r\n {{'HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div>{{fullName}}</div>\r\n }\r\n @if (!fullName) {\r\n <div class=\"text-center\">\r\n <button type=\"button\" class=\"btn btn-primary-dark\" (click)=\"login()\" id=\"start-login\">{{'HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n @if (navigation) {\r\n <a class=\"text-white\" href=\"{{navigation.createAccountLink}}?lang={{trans.getCurrentLang}}&returnUrl={{url}}\">\r\n {{'HEADER.CREATE_USER'|translate}}\r\n </a>\r\n }\r\n }\r\n </div>\r\n <ul class=\"list-group list-group-flush border-top\">\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showReport?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"py-1 text-white flex-grow-1\" href=\"{{navigation.report.url}}\">\r\n {{navigation.report.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showReport = !showReport\" attr.aria-controls=\"report-links\" attr.aria-expanded=\"{{showReport}}\">\r\n <span class=\"bi\" [ngClass]=\"showReport?'bi-chevron-up':'bi-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n @if (showReport) {\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" id=\"report-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <div class=\"d-flex\">\r\n <a href=\"{{navigation.checklist.url}}\" class=\"text-white flex-grow-1\">\r\n {{navigation.checklist.transId|translate}}\r\n </a>\r\n </div>\r\n </li>\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.report.url}}\">\r\n {{'HEADER.REPORT'|translate}}\r\n </a>\r\n <li class=\"d-block py-1\">\r\n <div class=\"d-flex \">\r\n <a href=\"{{navigation.wanted.url}}\" class=\"text-white flex-grow-1\">\r\n {{navigation.wanted.transId|translate}}\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n </li>\r\n }\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showObservations?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"py-1 text-white flex-grow-1\" href=\"{{navigation.observations.url}}\">\r\n {{navigation.observations.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showObservations = !showObservations\" attr.aria-controls=\"observations-links\" attr.aria-expanded=\"{{showObservations}}\">\r\n <span class=\"bi\" [ngClass]=\"showObservations?'bi-chevron-up':'bi-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n @if (showObservations) {\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" id=\"observations-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.observations.url}}\">\r\n {{'HEADER.TODAYS_OBSERVATIONS'|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-0\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.fieldDiary.url}}\">\r\n {{'HEADER.FIELD_DIARY'|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n }\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showSubs?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <button class=\"btn btn-link p-0 text-white w-100 text-start\" (click)=\"showSubs = !showSubs\">\r\n {{navigation.subcriptions.transId|translate}}\r\n </button>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showSubs = !showSubs\" attr.aria-controls=\"subs-links\" attr.aria-expanded=\"{{showSubs}}\">\r\n <span class=\"bi\" [ngClass]=\"showSubs?'bi-chevron-up':'bi-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n @if (showSubs) {\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" id=\"subs-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.subcriptions.url}}\">\r\n {{'HEADER.MY_SUBSCRIPTIONS'|translate}}\r\n </a>\r\n </li>\r\n <li class=\"py-1\">\r\n <div class=\"d-flex\">\r\n <a href=\"{{navigation.events.url}}\" class=\"text-white flex-grow-1\">\r\n {{navigation.events.transId|translate}}\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n </li>\r\n }\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.fyndregler.url}}\">\r\n {{navigation.fyndregler.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block fw-bold py-1 text-white\" [href]=\"navigation.artportalenUrl\">\r\n Artportalen.se\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block fw-bold py-1 text-white\" [href]=\"navigation.artfaktaUrl\">\r\n {{'HEADER.ARTFAKTA'|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <small class=\"d-block text-white pt-1\">\r\n {{'HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\">\r\n {{'HEADER.ARTDATABANKEN'|translate}}\r\n </a>\r\n </small>\r\n </li>\r\n </ul>\r\n </div>\r\n <div id=\"pattern\" class=\"flex-grow-1\"> </div>\r\n </div>\r\n </div>\r\n }\r\n</div>", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
454
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: ArtportalenNavComponent, isStandalone: false, selector: "adb-artportalen-nav", inputs: { showPattern: "showPattern", userName: "userName" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0, template: "<div class=\"bg-primary adb-main-header position-static\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n @if (translationFinished) {\r\n <header class=\"container-lg px-0\">\r\n <div [attr.id]=\"showPattern?'banner':''\" class=\"px-1 d-flex flex-wrap align-items-center gap-2\">\r\n <nav class=\"d-flex flex-grow-1 align-items-center pe-2 py-2 gap-2\">\r\n <a class=\"d-flex text-white text-decoration-none d-flex gap-2\" href=\"https://www.artdatabanken.se/\" target=\"new\">\r\n <img style=\"height: 2rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <div class=\"border-end d-none d-sm-block\"></div>\r\n <img class=\"d-none d-sm-block align-self-center pe-5\" style=\"height: 0.7rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n </a>\r\n <a [href]=\"$safeNavigationMigration(navigation?.home)\" class=\"text-white text-decoration-none fs-1 fw-bold\">{{'HEADER.TITLE'|translate}}</a>\r\n </nav>\r\n <div class=\"ms-auto d-flex align-items-center gap-2\">\r\n <div><ng-content></ng-content></div>\r\n <div>\r\n <button class=\"d-none d-md-block btn btn-primary-dark btn-lg\" type=\"button\"\r\n title=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\"\r\n attr.aria-label=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\"\r\n (click)=\"onUserClick()\">\r\n <small>{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}</small>\r\n </button>\r\n </div>\r\n <div>\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\" title=\"{{'HEADER.MENY'|translate}}\" attr.aria-label=\"{{'HEADER.MENY'|translate}}\" (click)=\"showMenuDropdown(!showNavMenu)\">\r\n <i class=\"bi bi-list\"></i>\r\n <small class=\"ms-2 d-none d-md-inline-block\">{{'HEADER.MENY'|translate}}</small>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"d-flex justify-content-center d-md-none p-2 border-dark border-top\">\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\"\r\n title=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\"\r\n attr.aria-label=\"{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}\" (click)=\"onUserClick()\">\r\n <small>{{(!fullName ? 'HEADER.LOGIN' : 'HEADER.LOGOUT')|translate}}</small>\r\n </button>\r\n </div>\r\n </header>\r\n }\r\n @if (navigation) {\r\n <div role=\"dialog\" class=\"offcanvas offcanvas-end bg-primary text-white\" [class.show]=\"showNavMenu\" tabindex=\"-1\" aria-labelledby=\"offcanvasNav\">\r\n <div class=\"offcanvas-header\">\r\n <h1 class=\"offcanvas-title h-section mb-0\" id=\"offcanvasNav\"><a [href]=\"navigation.home\" class=\"text-white text-decoration-none\">{{'HEADER.TITLE'|translate}}</a></h1>\r\n <button type=\"button\" class=\"btn-close btn-close-white\" attr.aria-label=\"{{'CLOSE'|translate}}\" (click)=\"showMenuDropdown(false)\"></button>\r\n </div>\r\n <div class=\"offcanvas-body d-flex flex-column p-0\">\r\n <div class=\"px-3\">\r\n <div class=\"d-flex flex-wrap justify-content-between align-items-center mb-2 gap-1 px-2\">\r\n @if (fullName) {\r\n <div>\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-primary-dark\">\r\n {{'HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div>{{fullName}}</div>\r\n }\r\n @if (!fullName) {\r\n <div class=\"text-center\">\r\n <button type=\"button\" class=\"btn btn-primary-dark\" (click)=\"login()\" id=\"start-login\">{{'HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n @if (navigation) {\r\n <a class=\"text-white\" href=\"{{navigation.createAccountLink}}?lang={{trans.getCurrentLang}}&returnUrl={{url}}\">\r\n {{'HEADER.CREATE_USER'|translate}}\r\n </a>\r\n }\r\n }\r\n </div>\r\n <ul class=\"list-group list-group-flush border-top\">\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showReport?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"py-1 text-white flex-grow-1\" href=\"{{navigation.report.url}}\">\r\n {{navigation.report.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showReport = !showReport\" attr.aria-controls=\"report-links\" attr.aria-expanded=\"{{showReport}}\">\r\n <span class=\"bi\" [ngClass]=\"showReport?'bi-chevron-up':'bi-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n @if (showReport) {\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" id=\"report-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <div class=\"d-flex\">\r\n <a href=\"{{navigation.checklist.url}}\" class=\"text-white flex-grow-1\">\r\n {{navigation.checklist.transId|translate}}\r\n </a>\r\n </div>\r\n </li>\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.report.url}}\">\r\n {{'HEADER.REPORT'|translate}}\r\n </a>\r\n <li class=\"d-block py-1\">\r\n <div class=\"d-flex \">\r\n <a href=\"{{navigation.wanted.url}}\" class=\"text-white flex-grow-1\">\r\n {{navigation.wanted.transId|translate}}\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n </li>\r\n }\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showObservations?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"py-1 text-white flex-grow-1\" href=\"{{navigation.observations.url}}\">\r\n {{navigation.observations.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showObservations = !showObservations\" attr.aria-controls=\"observations-links\" attr.aria-expanded=\"{{showObservations}}\">\r\n <span class=\"bi\" [ngClass]=\"showObservations?'bi-chevron-up':'bi-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n @if (showObservations) {\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" id=\"observations-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.observations.url}}\">\r\n {{'HEADER.TODAYS_OBSERVATIONS'|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-0\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.fieldDiary.url}}\">\r\n {{'HEADER.FIELD_DIARY'|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n }\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showSubs?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <button class=\"btn btn-link p-0 text-white w-100 text-start\" (click)=\"showSubs = !showSubs\">\r\n {{navigation.subcriptions.transId|translate}}\r\n </button>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showSubs = !showSubs\" attr.aria-controls=\"subs-links\" attr.aria-expanded=\"{{showSubs}}\">\r\n <span class=\"bi\" [ngClass]=\"showSubs?'bi-chevron-up':'bi-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n @if (showSubs) {\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" id=\"subs-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.subcriptions.url}}\">\r\n {{'HEADER.MY_SUBSCRIPTIONS'|translate}}\r\n </a>\r\n </li>\r\n <li class=\"py-1\">\r\n <div class=\"d-flex\">\r\n <a href=\"{{navigation.events.url}}\" class=\"text-white flex-grow-1\">\r\n {{navigation.events.transId|translate}}\r\n </a>\r\n </div>\r\n </li>\r\n </ul>\r\n </li>\r\n }\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.fyndregler.url}}\">\r\n {{navigation.fyndregler.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block fw-bold py-1 text-white\" [href]=\"navigation.artportalenUrl\">\r\n Artportalen.se\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block fw-bold py-1 text-white\" [href]=\"navigation.artfaktaUrl\">\r\n {{'HEADER.ARTFAKTA'|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <small class=\"d-block text-white pt-1\">\r\n {{'HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\">\r\n {{'HEADER.ARTDATABANKEN'|translate}}\r\n </a>\r\n </small>\r\n </li>\r\n </ul>\r\n </div>\r\n <div id=\"pattern\" class=\"flex-grow-1\"> </div>\r\n </div>\r\n </div>\r\n }\r\n</div>", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
455
455
  }
456
456
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: ArtportalenNavComponent, decorators: [{
457
457
  type: Component,
@@ -766,7 +766,7 @@ class PagerComponent extends PagerBaseDirective {
766
766
  this.subscription.unsubscribe();
767
767
  }
768
768
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: PagerComponent, deps: [{ token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
769
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: PagerComponent, isStandalone: false, selector: "adb-pager-nav", inputs: { offsetName: "offsetName", infiniteLimit: "infiniteLimit" }, usesInheritance: true, ngImport: i0, template: "@if (pages&&pages.length>1&&currentPage<=amountOfPages) { <nav class=\"d-flex justify-content-end my-1\">\r\n <ul class=\"pagination flex-wrap mb-0\">\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.first\" queryParamsHandling=\"merge\" [ngClass]=\"{'pe-none opacity-25':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\" [attr.tabindex]=\"currentPage === 1 ? -1 : null\"\r\n aria-label=\"F\u00F6rsta sidan\">\r\n <span class=\"bi bi-chevron-double-left\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.prev\" queryParamsHandling=\"merge\" [ngClass]=\"{'pe-none opacity-25':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\" [attr.tabindex]=\"currentPage === 1 ? -1 : null\"\r\n aria-label=\"F\u00F6reg\u00E5ende\">\r\n <span class=\"bi bi-chevron-left\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n @for (page of params.pages; track page) {\r\n <li class=\"page-item\" [class.active]=\"currentPage===page.name\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"page.params\" [attr.aria-current]=\"currentPage == page.name ? 'page' : null\" queryParamsHandling=\"merge\" [attr.aria-label]=\"'Sida ' + page.name\">{{page.name}}</a>\r\n </li>\r\n }\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.next\" queryParamsHandling=\"merge\" [ngClass]=\"{'pe-none opacity-25':currentPage>=amountOfPages}\" [attr.aria-disabled]=\"currentPage>=amountOfPages\"\r\n [attr.tabindex]=\"currentPage>=amountOfPages ? -1 : null\" aria-label=\"N\u00E4sta sida\">\r\n <span class=\"bi bi-chevron-right\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n @if (!infiniteLimit) {\r\n @if ((amountOfPages-1)*limit<10000) { <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\" [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-25':currentPage>=amountOfPages}\"\r\n [attr.tabindex]=\"currentPage>=amountOfPages ? -1 : null\" aria-label=\"Sista sida\">\r\n <span class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n }\r\n }\r\n @if (infiniteLimit) {\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\" [attr.aria-disabled]=\"currentPage >= amountOfPages\" [ngClass]=\"{'pe-none opacity-50': currentPage >= amountOfPages}\"\r\n [attr.tabindex]=\"currentPage >= amountOfPages ? -1 : null\" aria-label=\"Sista sidan\">\r\n <span class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n }\r\n </ul>\r\n </nav>\r\n }", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
769
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: PagerComponent, isStandalone: false, selector: "adb-pager-nav", inputs: { offsetName: "offsetName", infiniteLimit: "infiniteLimit" }, usesInheritance: true, ngImport: i0, template: "@if (pages&&pages.length>1&&currentPage<=amountOfPages) { <nav class=\"d-flex justify-content-end my-1\">\r\n <ul class=\"pagination flex-wrap mb-0\">\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.first\" queryParamsHandling=\"merge\" [ngClass]=\"{'pe-none opacity-25':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\" [attr.tabindex]=\"currentPage === 1 ? -1 : null\"\r\n aria-label=\"F\u00F6rsta sidan\">\r\n <span class=\"bi bi-chevron-double-left\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.prev\" queryParamsHandling=\"merge\" [ngClass]=\"{'pe-none opacity-25':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\" [attr.tabindex]=\"currentPage === 1 ? -1 : null\"\r\n aria-label=\"F\u00F6reg\u00E5ende\">\r\n <span class=\"bi bi-chevron-left\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n @for (page of params.pages; track page) {\r\n <li class=\"page-item\" [class.active]=\"currentPage===page.name\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"page.params\" [attr.aria-current]=\"currentPage == page.name ? 'page' : null\" queryParamsHandling=\"merge\" [attr.aria-label]=\"'Sida ' + page.name\">{{page.name}}</a>\r\n </li>\r\n }\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.next\" queryParamsHandling=\"merge\" [ngClass]=\"{'pe-none opacity-25':currentPage>=amountOfPages}\" [attr.aria-disabled]=\"currentPage>=amountOfPages\"\r\n [attr.tabindex]=\"currentPage>=amountOfPages ? -1 : null\" aria-label=\"N\u00E4sta sida\">\r\n <span class=\"bi bi-chevron-right\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n @if (!infiniteLimit) {\r\n @if ((amountOfPages-1)*limit<10000) { <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\" [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-25':currentPage>=amountOfPages}\"\r\n [attr.tabindex]=\"currentPage>=amountOfPages ? -1 : null\" aria-label=\"Sista sida\">\r\n <span class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n }\r\n }\r\n @if (infiniteLimit) {\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\" [attr.aria-disabled]=\"currentPage >= amountOfPages\" [ngClass]=\"{'pe-none opacity-50': currentPage >= amountOfPages}\"\r\n [attr.tabindex]=\"currentPage >= amountOfPages ? -1 : null\" aria-label=\"Sista sidan\">\r\n <span class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></span>\r\n </a>\r\n </li>\r\n }\r\n </ul>\r\n </nav>\r\n }", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
770
770
  }
771
771
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: PagerComponent, decorators: [{
772
772
  type: Component,
@@ -811,7 +811,7 @@ class PagerInlineComponent extends PagerBaseDirective {
811
811
  this.calculatePages();
812
812
  }
813
813
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: PagerInlineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
814
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: PagerInlineComponent, isStandalone: false, selector: "adb-pager", inputs: { infiniteLimit: "infiniteLimit" }, outputs: { pageChanged: "pageChanged" }, usesInheritance: true, ngImport: i0, template: "@if (pages&&pages.length>1&&currentPage<=amountOfPages) { <nav class=\"d-flex justify-content-end pr-2 my-1\">\r\n <ul class=\"pagination flex-wrap\">\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onFirstClick()\" [ngClass]=\"currentPage==1?'opacity-25 pe-none':''\" [disabled]=\"currentPage==1\" aria-label=\"F\u00F6rsta sidan\">\r\n <i class=\"bi bi-chevron-double-left\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onPrevClick()\" [ngClass]=\"currentPage==1?'opacity-25 pe-none':''\" [disabled]=\"currentPage==1\" aria-label=\"F\u00F6reg\u00E5ende sida\">\r\n <i class=\"bi bi-chevron-left\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n @for (page of pages; track page) {\r\n <li class=\"page-item\" [class.active]=\"currentPage==page\">\r\n <button class=\"page-link\" (click)=\"onPageClick(page)\">\r\n {{page}}\r\n </button>\r\n </li>\r\n }\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onNextClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-25 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\" aria-label=\"N\u00E4sta sida\">\r\n <i class=\"bi bi-chevron-right\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n @if (!infiniteLimit) {\r\n @if ((amountOfPages-1)*limit<10000) { <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-25 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\" aria-label=\"Sista sidan\">\r\n <i class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n }\r\n }\r\n @if (infiniteLimit) {\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-25 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\" aria-label=\"Sista sidan\">\r\n <i class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n }\r\n </ul>\r\n </nav>\r\n }", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
814
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: PagerInlineComponent, isStandalone: false, selector: "adb-pager", inputs: { infiniteLimit: "infiniteLimit" }, outputs: { pageChanged: "pageChanged" }, usesInheritance: true, ngImport: i0, template: "@if (pages&&pages.length>1&&currentPage<=amountOfPages) { <nav class=\"d-flex justify-content-end pr-2 my-1\">\r\n <ul class=\"pagination flex-wrap\">\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onFirstClick()\" [ngClass]=\"currentPage==1?'opacity-25 pe-none':''\" [disabled]=\"currentPage==1\" aria-label=\"F\u00F6rsta sidan\">\r\n <i class=\"bi bi-chevron-double-left\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onPrevClick()\" [ngClass]=\"currentPage==1?'opacity-25 pe-none':''\" [disabled]=\"currentPage==1\" aria-label=\"F\u00F6reg\u00E5ende sida\">\r\n <i class=\"bi bi-chevron-left\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n @for (page of pages; track page) {\r\n <li class=\"page-item\" [class.active]=\"currentPage==page\">\r\n <button class=\"page-link\" (click)=\"onPageClick(page)\">\r\n {{page}}\r\n </button>\r\n </li>\r\n }\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onNextClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-25 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\" aria-label=\"N\u00E4sta sida\">\r\n <i class=\"bi bi-chevron-right\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n @if (!infiniteLimit) {\r\n @if ((amountOfPages-1)*limit<10000) { <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-25 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\" aria-label=\"Sista sidan\">\r\n <i class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n }\r\n }\r\n @if (infiniteLimit) {\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-25 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\" aria-label=\"Sista sidan\">\r\n <i class=\"bi bi-chevron-double-right\" aria-hidden=\"true\"></i>\r\n </button>\r\n </li>\r\n }\r\n </ul>\r\n </nav>\r\n }", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
815
815
  }
816
816
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: PagerInlineComponent, decorators: [{
817
817
  type: Component,
@@ -1091,948 +1091,1019 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
1091
1091
  }]
1092
1092
  }] });
1093
1093
 
1094
- class AdbDatePickerComponent {
1095
- elementRef;
1096
- translate;
1097
- subscriptions = new Subscription();
1098
- static MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1099
- static WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7'];
1100
- static YEAR_INTERVALL = 8;
1101
- currentdDate = new Date();
1102
- currentMonth;
1103
- selectedDate = new Date();
1104
- years;
1105
- months;
1106
- weekDays = AdbDatePickerComponent.WEEK_DAYS;
1107
- weeks;
1108
- range;
1109
- noYearMode = false;
1110
- ;
1111
- initialDate;
1112
- settings;
1113
- toLeft;
1114
- id;
1115
- selectDate = new EventEmitter();
1116
- constructor(elementRef, translate) {
1117
- this.elementRef = elementRef;
1118
- this.translate = translate;
1094
+ const ADB_ALERT_CONFIG = new InjectionToken('ADB_ALERT_CONFIG');
1095
+
1096
+ const RICH_MODULE_CONFIG = new InjectionToken('richModule.config');
1097
+
1098
+ class RichTextComponent {
1099
+ text = '';
1100
+ parts = [];
1101
+ taxonUrl;
1102
+ constructor(config) {
1103
+ this.taxonUrl = config.taxonUrl;
1119
1104
  }
1120
- ngOnInit() {
1121
- if (this.settings) {
1122
- if (this.settings?.minDate || this.settings?.maxDate) {
1123
- const minDate = AdbDatePickerComponent.parseDate(this.settings.minDate);
1124
- const maxDate = AdbDatePickerComponent.parseDate(this.settings.maxDate);
1125
- this.range = {
1126
- start: minDate ? startOfDay(minDate) : subYears(new Date(), 1000),
1127
- end: maxDate ? endOfDay(maxDate) : addYears(new Date(), 1000)
1128
- };
1105
+ ngOnChanges() {
1106
+ this.parts = this.text
1107
+ ? this.parseCustomMarkdown(this.text)
1108
+ : [];
1109
+ }
1110
+ parseCustomMarkdown(input) {
1111
+ const parts = [];
1112
+ let i = 0;
1113
+ const pushText = (text) => {
1114
+ if (text) {
1115
+ parts.push({ type: 'text', content: text });
1129
1116
  }
1130
- if (this.settings.noYear) {
1131
- this.noYearMode = this.settings.noYear;
1117
+ };
1118
+ while (i < input.length) {
1119
+ if (input.startsWith('**', i) || input.startsWith('__', i)) {
1120
+ const marker = input.slice(i, i + 2);
1121
+ const end = input.indexOf(marker, i + 2);
1122
+ if (end !== -1) {
1123
+ parts.push({
1124
+ type: 'bold',
1125
+ content: input.slice(i + 2, end)
1126
+ });
1127
+ i = end + 2;
1128
+ continue;
1129
+ }
1130
+ }
1131
+ if (input[i] === '*' || input[i] === '_') {
1132
+ const marker = input[i];
1133
+ const end = input.indexOf(marker, i + 1);
1134
+ if (end !== -1) {
1135
+ parts.push({
1136
+ type: 'italic',
1137
+ content: input.slice(i + 1, end)
1138
+ });
1139
+ i = end + 1;
1140
+ continue;
1141
+ }
1142
+ }
1143
+ if (input[i] === '[') {
1144
+ const textEnd = input.indexOf(']', i);
1145
+ const linkStart = input.indexOf('(', textEnd);
1146
+ const linkEnd = input.indexOf(')', linkStart);
1147
+ if (textEnd !== -1 && linkStart === textEnd + 1 && linkEnd !== -1) {
1148
+ const label = input.slice(i + 1, textEnd);
1149
+ const link = input.slice(linkStart + 1, linkEnd);
1150
+ const [type, id] = link.split(':');
1151
+ if (type === 'taxon' || type === 'reference') {
1152
+ parts.push({
1153
+ type: type,
1154
+ content: label,
1155
+ id
1156
+ });
1157
+ i = linkEnd + 1;
1158
+ continue;
1159
+ }
1160
+ parts.push({ type: 'link', content: label, url: link });
1161
+ i = linkEnd + 1;
1162
+ continue;
1163
+ }
1164
+ }
1165
+ let next = input.length;
1166
+ for (const c of ['*', '_', '[']) {
1167
+ const idx = input.indexOf(c, i + 1);
1168
+ if (idx !== -1 && idx < next) {
1169
+ next = idx;
1170
+ }
1171
+ }
1172
+ if (next === input.length) {
1173
+ pushText(input.slice(i));
1174
+ break;
1132
1175
  }
1176
+ pushText(input.slice(i, next));
1177
+ i = next;
1133
1178
  }
1134
- this.selectedDate = this.currentdDate = this.initialDate ?? new Date();
1135
- this.currentMonth = getMonth(this.selectedDate);
1136
- this.createCalendar();
1137
- }
1138
- onShowYear() {
1139
- this.months = null;
1140
- this.loadYearsInterval();
1179
+ return parts;
1141
1180
  }
1142
- onShowMonth() {
1143
- this.years = null;
1144
- this.loadMonths();
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 });
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 });
1183
+ }
1184
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: RichTextComponent, decorators: [{
1185
+ type: Component,
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" }]
1187
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1188
+ type: Inject,
1189
+ args: [RICH_MODULE_CONFIG]
1190
+ }] }], propDecorators: { text: [{
1191
+ type: Input
1192
+ }] } });
1193
+
1194
+ class AdbAlertComponent {
1195
+ http;
1196
+ config;
1197
+ alerts = [];
1198
+ constructor(http, config) {
1199
+ this.http = http;
1200
+ this.config = config;
1145
1201
  }
1146
- onSelectYear(inYear) {
1147
- this.selectedDate.setFullYear(inYear.getFullYear());
1148
- this.loadMonths();
1149
- this.years = null;
1202
+ ngOnInit() {
1203
+ this.loadAlerts();
1150
1204
  }
1151
- onSelectMonth(inMonth) {
1152
- this.selectedDate.setMonth(inMonth);
1153
- this.currentMonth = getMonth(this.selectedDate);
1154
- this.createCalendar();
1155
- this.years = null;
1156
- this.months = null;
1205
+ loadAlerts() {
1206
+ this.http.get(this.config.apiUrl).subscribe(alerts => {
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)));
1210
+ });
1157
1211
  }
1158
- onPrev() {
1159
- if (this.years) {
1160
- this.selectedDate = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1161
- this.loadYearsInterval();
1162
- }
1163
- else if (this.months) {
1164
- this.selectedDate = subYears(this.selectedDate, 1);
1165
- this.loadMonths();
1166
- }
1167
- else {
1168
- this.selectedDate = subMonths(this.selectedDate, 1);
1169
- this.createCalendar();
1212
+ dismiss(alert) {
1213
+ this.alerts = this.alerts.filter(item => item.id !== alert.id);
1214
+ const storageKey = `${this.config.clientId}-alert-dismissed`;
1215
+ const dismissedIds = this.getItem(storageKey) ?? [];
1216
+ if (!dismissedIds.includes(alert.id)) {
1217
+ dismissedIds.push(alert.id);
1170
1218
  }
1171
- this.currentMonth = getMonth(this.selectedDate);
1219
+ this.setItem(storageKey, dismissedIds);
1172
1220
  }
1173
- onNext() {
1174
- if (this.years) {
1175
- this.selectedDate = addYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1176
- this.loadYearsInterval();
1177
- }
1178
- else if (this.months) {
1179
- this.selectedDate = addYears(this.selectedDate, 1);
1180
- this.loadMonths();
1181
- }
1182
- else {
1183
- this.selectedDate = addMonths(this.selectedDate, 1);
1184
- this.createCalendar();
1185
- }
1186
- this.currentMonth = getMonth(this.selectedDate);
1221
+ setItem(key, value) {
1222
+ localStorage.setItem(key, JSON.stringify(value));
1187
1223
  }
1188
- ngOnDestroy() {
1189
- this.subscriptions.unsubscribe();
1224
+ getItem(key) {
1225
+ return localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : null;
1190
1226
  }
1191
- loadMonths() {
1192
- this.months = AdbDatePickerComponent.MONTHS.map(x => {
1193
- return {
1194
- value: x,
1195
- isThisMonth: getMonth(this.selectedDate) === x && isSameYear(this.currentdDate, this.selectedDate)
1196
- };
1197
- });
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" }] });
1229
+ }
1230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertComponent, decorators: [{
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}" }]
1233
+ }], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
1234
+ type: Inject,
1235
+ args: [ADB_ALERT_CONFIG]
1236
+ }] }] });
1237
+
1238
+ const FORMAT_MARKERS = {
1239
+ italic: ['*', '_'],
1240
+ bold: ['**', '__']
1241
+ };
1242
+ const DEFAULT_MARKER = {
1243
+ italic: '*',
1244
+ bold: '**'
1245
+ };
1246
+ class AdbRichEditorComponent {
1247
+ el;
1248
+ text = '';
1249
+ hasTaxon = false;
1250
+ hasReference = false;
1251
+ rows = 3;
1252
+ label = 'Set label';
1253
+ id;
1254
+ constructor(el) {
1255
+ this.el = el;
1256
+ this.id = this.getId();
1198
1257
  }
1199
- loadYearsInterval() {
1200
- let year = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1201
- const years = [];
1202
- for (let i = 0; i < 16; i++) {
1203
- years.push({
1204
- value: year,
1205
- title: year.getFullYear(),
1206
- isThisYear: isSameYear(year, this.currentdDate)
1207
- });
1208
- year = addYears(year, 1);
1258
+ getTextarea() {
1259
+ return this.el.nativeElement.querySelector('textarea');
1260
+ }
1261
+ onDoubleClick() {
1262
+ const textarea = this.getTextarea();
1263
+ if (!textarea)
1264
+ return;
1265
+ const start = textarea.selectionStart;
1266
+ let end = textarea.selectionEnd;
1267
+ while (end > start && textarea.value[end - 1] === ' ') {
1268
+ end--;
1209
1269
  }
1210
- this.years = years;
1270
+ textarea.setSelectionRange(start, end);
1211
1271
  }
1212
- onSelectDate(day) {
1213
- this.selectDate.emit(day.value);
1272
+ onItalicClick() {
1273
+ this.applyFormatting('italic');
1214
1274
  }
1215
- createCalendar() {
1216
- const weeks = [];
1217
- const monthInterval = { start: startOfMonth(this.selectedDate), end: endOfMonth(this.selectedDate) };
1218
- var fnsWweeks = eachWeekOfInterval(monthInterval, { weekStartsOn: this.translate.currentLang() === 'sv' || this.translate.currentLang() === 'sv-SE' ? 1 : 0 });
1219
- for (const fnsWeek of fnsWweeks) {
1220
- const week = { weekNumber: 0, days: [] };
1221
- week.weekNumber = getISOWeek(new Date(fnsWeek));
1222
- const weekInterval = { start: new Date(fnsWeek), end: addDays(new Date(fnsWeek), 6) };
1223
- week.days = eachDayOfInterval(weekInterval).map(day => {
1224
- day.setHours(getHours(new Date()));
1225
- day.setMinutes(getMinutes(new Date()));
1226
- return {
1227
- value: day,
1228
- isSelected: isSameYear(day, this.initialDate) && isSameDay(day, this.initialDate) && isSameMonth(day, this.initialDate),
1229
- isInRange: this.range ? isWithinInterval(day, this.range) : true,
1230
- isToday: isSameDay(day, new Date()),
1231
- inMonth: monthInterval.start.getMonth() === day.getMonth()
1232
- };
1233
- });
1234
- weeks.push(week);
1235
- }
1236
- this.weeks = weeks;
1237
- }
1238
- static parseDate(value) {
1239
- if (typeof value === 'string') {
1240
- if (isValid(parseISO(value))) {
1241
- return parseISO(value);
1242
- }
1243
- else {
1244
- return null;
1245
- }
1246
- }
1247
- else if (value instanceof Date) {
1248
- return value;
1249
- }
1250
- else {
1251
- return null;
1252
- }
1253
- }
1254
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
1255
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbDatePickerComponent, isStandalone: false, selector: "adb-date-picker", inputs: { initialDate: "initialDate", settings: "settings", toLeft: "toLeft", id: "id" }, outputs: { selectDate: "selectDate" }, host: { properties: { "id": "this.id" } }, ngImport: i0, template: "<div class=\"position-relative\" [class.to-left]=\"toLeft\">\r\n <nav class=\"bg-body shadow rounded position-absolute\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"bi bi-chevron-left\"></span></button>\r\n @if(!years&&!months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n @if(years){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n }\r\n @if(months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><span class=\"bi bi-chevron-right\"></span></button>\r\n </header>\r\n <div class=\"p-0 border calendar\">\r\n <ul class=\"list-unstyled row\" *ngIf=\"years\">\r\n <li class=\"col-3 text-center px-2 py-3\" *ngFor=\"let year of years\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\"\r\n [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n @if(months){\r\n <ul class=\"list-unstyled row\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n }\r\n <div class=\"days\" *ngIf=\"!years&&!months\">\r\n <div class=\"text-center border-bottom py-2 text-muted\" *ngFor=\"let weekDay of weekDays\">{{'WEEK_DAYS.'+weekDay|translate}}</div>\r\n <ng-container *ngFor=\"let week of weeks\">\r\n <button tabIndex=\"-1\" class=\"btn rounded-circle p-0\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" [class.border]=\"day.isToday\" [class.btn-primary]=\"day.isSelected\"\r\n [ngClass]=\"{'border-0 opacity-50':!day.inMonth||!day.isInRange}\" [disabled]=\"!day.inMonth || !day.isInRange\">\r\n <small>{{day.value|date:'d'}}</small>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </nav>\r\n</div>", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$3.DatePipe, name: "date" }, { kind: "pipe", type: LocaleDatePipe, name: "adbLocaleDate" }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1256
- }
1257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
1258
- type: Component,
1259
- args: [{ selector: 'adb-date-picker', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div class=\"position-relative\" [class.to-left]=\"toLeft\">\r\n <nav class=\"bg-body shadow rounded position-absolute\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"bi bi-chevron-left\"></span></button>\r\n @if(!years&&!months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n @if(years){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n }\r\n @if(months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><span class=\"bi bi-chevron-right\"></span></button>\r\n </header>\r\n <div class=\"p-0 border calendar\">\r\n <ul class=\"list-unstyled row\" *ngIf=\"years\">\r\n <li class=\"col-3 text-center px-2 py-3\" *ngFor=\"let year of years\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\"\r\n [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n @if(months){\r\n <ul class=\"list-unstyled row\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n }\r\n <div class=\"days\" *ngIf=\"!years&&!months\">\r\n <div class=\"text-center border-bottom py-2 text-muted\" *ngFor=\"let weekDay of weekDays\">{{'WEEK_DAYS.'+weekDay|translate}}</div>\r\n <ng-container *ngFor=\"let week of weeks\">\r\n <button tabIndex=\"-1\" class=\"btn rounded-circle p-0\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" [class.border]=\"day.isToday\" [class.btn-primary]=\"day.isSelected\"\r\n [ngClass]=\"{'border-0 opacity-50':!day.inMonth||!day.isInRange}\" [disabled]=\"!day.inMonth || !day.isInRange\">\r\n <small>{{day.value|date:'d'}}</small>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </nav>\r\n</div>" }]
1260
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.TranslateService }], propDecorators: { initialDate: [{
1261
- type: Input
1262
- }], settings: [{
1263
- type: Input
1264
- }], toLeft: [{
1265
- type: Input
1266
- }], id: [{
1267
- type: HostBinding,
1268
- args: ['id']
1269
- }, {
1270
- type: Input
1271
- }], selectDate: [{
1272
- type: Output
1273
- }] } });
1274
-
1275
- class AdbDatePickerService {
1276
- viewRef;
1277
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1278
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerService });
1279
- }
1280
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerService, decorators: [{
1281
- type: Injectable
1282
- }] });
1283
-
1284
- class AdbDatePickerDirective {
1285
- viewContainerRef;
1286
- renderer;
1287
- elementRef;
1288
- adbDatePickerService;
1289
- translate;
1290
- subscriptions = new Subscription();
1291
- autocomplete = 'off';
1292
- adbBlur = new EventEmitter();
1293
- format = 'yyyy-MM-dd';
1294
- toLeft;
1295
- settings = null;
1296
- id;
1297
- currentDate;
1298
- isValid;
1299
- constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
1300
- this.viewContainerRef = viewContainerRef;
1301
- this.renderer = renderer;
1302
- this.elementRef = elementRef;
1303
- this.adbDatePickerService = adbDatePickerService;
1304
- this.translate = translate;
1305
- }
1306
- ngOnInit() {
1307
- this.elementRef.nativeElement.setAttribute("placeholder", this.format);
1275
+ onBoldClick() {
1276
+ this.applyFormatting('bold');
1308
1277
  }
1309
- onClick() {
1310
- if (this.adbDatePickerService.viewRef) {
1311
- this.adbDatePickerService.viewRef.destroy();
1278
+ applyFormatting(type) {
1279
+ const textarea = this.getTextarea();
1280
+ if (!textarea)
1281
+ return;
1282
+ const start = textarea.selectionStart;
1283
+ const end = textarea.selectionEnd;
1284
+ const value = textarea.value;
1285
+ if (start === end) {
1286
+ const marker = DEFAULT_MARKER[type];
1287
+ const newValue = value.slice(0, start) +
1288
+ marker +
1289
+ marker +
1290
+ value.slice(start);
1291
+ this.updateValue(newValue);
1292
+ const cursor = start + marker.length;
1293
+ requestAnimationFrame(() => {
1294
+ textarea.focus();
1295
+ textarea.setSelectionRange(cursorStart, cursorEnd);
1296
+ });
1297
+ return;
1312
1298
  }
1313
- const viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
1314
- viewRef.instance.settings = this.settings;
1315
- viewRef.instance.toLeft = this.toLeft;
1316
- viewRef.instance.initialDate = this.currentDate;
1317
- this.id = this.getId();
1318
- viewRef.instance.id = this.id;
1319
- viewRef.instance.selectDate.subscribe((date) => {
1320
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang()));
1321
- this.onChange(date);
1322
- this.currentDate = date;
1323
- this.onHide();
1324
- this.adbBlur.emit(date);
1299
+ const existingMarker = this.findWrappingMarker(value, start, end, FORMAT_MARKERS[type]);
1300
+ const marker = existingMarker ?? DEFAULT_MARKER[type];
1301
+ const newValue = existingMarker
1302
+ ? value.slice(0, start - marker.length) +
1303
+ value.slice(start, end) +
1304
+ value.slice(end + marker.length)
1305
+ : value.slice(0, start) +
1306
+ marker +
1307
+ value.slice(start, end) +
1308
+ marker +
1309
+ value.slice(end);
1310
+ this.updateValue(newValue);
1311
+ const cursorStart = existingMarker
1312
+ ? start - marker.length
1313
+ : start + marker.length;
1314
+ const cursorEnd = existingMarker
1315
+ ? end - marker.length
1316
+ : end + marker.length;
1317
+ requestAnimationFrame(() => {
1318
+ textarea.focus();
1319
+ textarea.setSelectionRange(cursorStart, cursorEnd);
1325
1320
  });
1326
- this.adbDatePickerService.viewRef = viewRef;
1327
1321
  }
1328
- onKeyup(event) {
1329
- const date = AdbDatePickerDirective.tryParse(event.target.value);
1330
- if (date) {
1331
- const now = new Date();
1332
- date.setHours(now.getHours());
1333
- date.setMinutes(now.getMinutes());
1334
- date.setSeconds(now.getSeconds());
1335
- this.onChange(date);
1336
- }
1337
- else {
1338
- this.onChange(event.target.value); //send inccorect values to form
1339
- }
1340
- }
1341
- onTabDown() {
1342
- this.updateValueOnLeave();
1343
- this.onHide();
1344
- this.adbBlur.emit(this.currentDate);
1345
- }
1346
- onEscdOWN() {
1347
- this.updateValueOnLeave();
1348
- this.onHide();
1349
- }
1350
- onHide() {
1351
- this.adbDatePickerService.viewRef = null;
1352
- this.viewContainerRef.detach();
1353
- this.viewContainerRef.clear();
1354
- }
1355
- onCheckOutSideClick(target) {
1356
- const nativeElement = this.adbDatePickerService.viewRef?.instance.elementRef.nativeElement ?? null;
1357
- if (nativeElement) {
1358
- if (nativeElement.id === this.id) {
1359
- if (!target.hasAttribute('adbdatepicker')) {
1360
- const clickedInside = nativeElement.contains(target);
1361
- if (!clickedInside) {
1362
- this.updateValueOnLeave();
1363
- this.onHide();
1364
- this.adbBlur.emit(this.currentDate);
1365
- }
1366
- }
1367
- }
1368
- }
1322
+ findWrappingMarker(value, start, end, markers) {
1323
+ return (markers.find(marker => value.substring(start - marker.length, start) === marker &&
1324
+ value.substring(end, end + marker.length) === marker) ?? null);
1369
1325
  }
1370
- updateValueOnLeave() {
1371
- if (this.isValid) {
1372
- if (this.currentDate) {
1373
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang()));
1374
- }
1375
- else {
1376
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1377
- }
1378
- }
1326
+ onTaxonClick() {
1327
+ this.replaceMarked('[Name](taxon:0)');
1379
1328
  }
1380
- ngOnDestroy() {
1381
- this.subscriptions.unsubscribe();
1329
+ onReferenceClick() {
1330
+ this.replaceMarked('[Name](reference:0)');
1382
1331
  }
1383
- //Validator
1384
- validate(control) {
1385
- const value = control.value;
1386
- if (!value) {
1387
- this.currentDate = null;
1388
- this.isValid = true;
1389
- return null;
1390
- }
1391
- if (value instanceof Date) {
1392
- this.currentDate = value;
1393
- this.isValid = true;
1394
- return null;
1395
- }
1396
- if (typeof value === 'string' || value instanceof String) {
1397
- const date = AdbDatePickerDirective.tryParse(value);
1398
- if (!date) {
1399
- this.isValid = false;
1400
- return { date: true };
1401
- }
1402
- }
1403
- this.isValid = true;
1404
- return null;
1332
+ replaceMarked(replaceTag) {
1333
+ const textarea = this.getTextarea();
1334
+ if (!textarea)
1335
+ return;
1336
+ const start = textarea.selectionStart;
1337
+ const end = textarea.selectionEnd;
1338
+ const value = textarea.value;
1339
+ const before = start > 0 ? value[start - 1] : '';
1340
+ const after = end < value.length ? value[end] : '';
1341
+ const spaceBefore = before && !/\s/.test(before) ? ' ' : '';
1342
+ const spaceAfter = after && !/\s/.test(after) ? ' ' : '';
1343
+ const newValue = value.slice(0, start) +
1344
+ spaceBefore +
1345
+ replaceTag +
1346
+ spaceAfter +
1347
+ value.slice(end);
1348
+ this.updateValue(newValue);
1349
+ const nameStart = newValue.indexOf('Name', start);
1350
+ if (nameStart === -1)
1351
+ return;
1352
+ const nameEnd = nameStart + 'Name'.length;
1353
+ requestAnimationFrame(() => {
1354
+ textarea.focus();
1355
+ textarea.setSelectionRange(nameStart, nameEnd);
1356
+ });
1405
1357
  }
1406
- //ControlValueAccessor
1358
+ // ---------------------------------------
1359
+ // ControlValueAccessor
1360
+ // ---------------------------------------
1407
1361
  onChange = () => { };
1408
1362
  onTouched = () => { };
1409
- onValidationChange = () => { };
1410
- registerOnValidatorChange(fn) {
1411
- this.onValidationChange = fn;
1412
- }
1413
1363
  writeValue(value) {
1414
- if (!value) {
1415
- this.currentDate = null;
1416
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1417
- return;
1418
- }
1419
- if (typeof value === 'string' || value instanceof String) {
1420
- const date = AdbDatePickerDirective.tryParse(value);
1421
- if (!date) {
1422
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
1423
- return;
1424
- }
1425
- value = date;
1426
- }
1427
- if (value instanceof Date) {
1428
- this.currentDate = value;
1429
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang()));
1430
- }
1364
+ this.text = value ?? '';
1431
1365
  }
1432
1366
  registerOnChange(fn) {
1433
1367
  this.onChange = fn;
1434
1368
  }
1435
- registerOnTouched(fn) {
1436
- this.onTouched = fn;
1437
- }
1438
- setDisabledState(isDisabled) {
1439
- this.viewContainerRef.clear();
1440
- }
1441
- static tryParse(dateString) {
1442
- const parsed = parseISO(dateString);
1443
- return isValid(parsed) ? parsed : null;
1444
- }
1445
- getId() {
1446
- return '' + Math.floor(Math.random() * Date.now());
1447
- }
1448
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Directive });
1449
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: AdbDatePickerDirective, isStandalone: false, selector: "input[adbDatepicker]", inputs: { format: "format", toLeft: "toLeft", settings: "settings" }, outputs: { adbBlur: "adbBlur" }, host: { listeners: { "click": "onClick()", "keyup": "onKeyup($event)", "keydown.shift.tab": "onTabDown()", "keydown.tab": "onTabDown()", "keydown.esc": "onEscdOWN()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "autocomplete": "this.autocomplete" } }, providers: [{
1450
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => AdbDatePickerDirective),
1451
- multi: true
1452
- },
1453
- {
1454
- provide: NG_VALIDATORS,
1455
- useExisting: AdbDatePickerDirective,
1456
- multi: true,
1457
- },], ngImport: i0 });
1458
- }
1459
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
1460
- type: Directive,
1461
- args: [{
1462
- selector: `input[adbDatepicker]`,
1463
- providers: [{
1464
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => AdbDatePickerDirective),
1465
- multi: true
1466
- },
1467
- {
1468
- provide: NG_VALIDATORS,
1469
- useExisting: AdbDatePickerDirective,
1470
- multi: true,
1471
- },],
1472
- standalone: false
1473
- }]
1474
- }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i1$1.TranslateService }], propDecorators: { autocomplete: [{
1475
- type: HostBinding,
1476
- args: ['autocomplete']
1477
- }], adbBlur: [{
1478
- type: Output
1479
- }], format: [{
1480
- type: Input
1481
- }], toLeft: [{
1482
- type: Input
1483
- }], settings: [{
1484
- type: Input
1485
- }], onClick: [{
1486
- type: HostListener,
1487
- args: ['click']
1488
- }], onKeyup: [{
1489
- type: HostListener,
1490
- args: ['keyup', ['$event']]
1491
- }], onTabDown: [{
1492
- type: HostListener,
1493
- args: ['keydown.shift.tab']
1494
- }, {
1495
- type: HostListener,
1496
- args: ['keydown.tab']
1497
- }], onEscdOWN: [{
1498
- type: HostListener,
1499
- args: ['keydown.esc']
1500
- }], onCheckOutSideClick: [{
1501
- type: HostListener,
1502
- args: ['document:click', ['$event.target']]
1503
- }] } });
1504
-
1505
- class AdbDatePickerModule {
1506
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1507
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, declarations: [AdbDatePickerComponent, AdbDatePickerDirective], imports: [CommonModule, AdbPipesModule, AdbDirectivesModule, TranslatePipe], exports: [AdbDatePickerComponent, AdbDatePickerDirective] });
1508
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, providers: [AdbDatePickerService], imports: [CommonModule, AdbPipesModule, AdbDirectivesModule] });
1509
- }
1510
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, decorators: [{
1511
- type: NgModule,
1512
- args: [{
1513
- imports: [CommonModule, AdbPipesModule, AdbDirectivesModule, TranslatePipe],
1514
- declarations: [AdbDatePickerComponent, AdbDatePickerDirective],
1515
- exports: [AdbDatePickerComponent, AdbDatePickerDirective],
1516
- providers: [AdbDatePickerService]
1517
- }]
1518
- }] });
1519
-
1520
- class AdbModalService {
1521
- environmentInjector;
1522
- appRef;
1523
- closeSubject = new Subject();
1524
- close$ = this.closeSubject.asObservable();
1525
- renderer;
1526
- domElem;
1527
- backdrop;
1528
- constructor(environmentInjector, rendererFactory, appRef) {
1529
- this.environmentInjector = environmentInjector;
1530
- this.appRef = appRef;
1531
- this.renderer = rendererFactory.createRenderer(null, null);
1532
- }
1533
- hide(confirm) {
1534
- this.closeSubject.next(confirm);
1535
- document.body.removeChild(this.domElem);
1536
- document.body.removeChild(this.backdrop);
1537
- var main = this.renderer.selectRootElement('main', true);
1538
- this.renderer.removeAttribute(main, 'inert');
1539
- this.closeSubject.unsubscribe();
1540
- this.closeSubject = new Subject();
1541
- this.close$ = this.closeSubject.asObservable();
1542
- }
1543
- showConfirm(model) {
1544
- const main = this.renderer.selectRootElement('main', true);
1545
- main.setAttribute('inert', '');
1546
- this.backdrop = this.renderer.createElement('div');
1547
- this.backdrop.classList.add('modal-backdrop', 'fade', 'show');
1548
- this.renderer.appendChild(document.body, this.backdrop);
1549
- const componentRef = createComponent(AdbConfirmModal, {
1550
- environmentInjector: this.environmentInjector
1551
- });
1552
- model.header = model.header ?? 'NOT_SET';
1553
- model.text = model.text ?? 'NOT_SET';
1554
- model.confirm = model.confirm ?? 'OK';
1555
- model.decline = model.decline ?? 'CANCEL';
1556
- model.showDecline = model.showDecline ?? true;
1557
- componentRef.instance.model = model;
1558
- this.appRef.attachView(componentRef.hostView);
1559
- this.domElem = componentRef.location.nativeElement;
1560
- document.body.appendChild(this.domElem);
1561
- }
1562
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalService, deps: [{ token: i0.EnvironmentInjector }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
1563
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalService });
1564
- }
1565
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalService, decorators: [{
1566
- type: Injectable
1567
- }], ctorParameters: () => [{ type: i0.EnvironmentInjector }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }] });
1568
-
1569
- class AdbConfirmModal {
1570
- modalRef;
1571
- elementRef;
1572
- model;
1573
- constructor(modalRef, elementRef) {
1574
- this.modalRef = modalRef;
1575
- this.elementRef = elementRef;
1369
+ registerOnTouched(fn) {
1370
+ this.onTouched = fn;
1576
1371
  }
1577
- ngAfterViewInit() {
1578
- const element = this.elementRef.nativeElement.querySelector('#modal-close');
1579
- if (element) {
1580
- element.focus();
1581
- }
1372
+ setDisabledState(isDisabled) {
1373
+ // Intentionally left minimal
1374
+ // Disabled state should be handled via template binding
1582
1375
  }
1583
- onClose(confirm) {
1584
- this.modalRef.hide(confirm);
1376
+ onTextChange() {
1377
+ this.onChange(this.text);
1585
1378
  }
1586
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbConfirmModal, deps: [{ token: AdbModalService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1587
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbConfirmModal, isStandalone: false, selector: "ng-component", inputs: { model: "model" }, ngImport: i0, template: "@if (model) {\r\n <div class=\"modal fade show\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"h-subsection mb-0 modal-title\" id=\"mod_header\">{{model.header|translate}}</h1>\r\n <button type=\"button\" class=\"btn-close\" id=\"modal-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"onClose(false)\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div id=\"mod_desc\">{{model.text|translate}}</div>\r\n @if (model.value) {\r\n <div>\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n @if (model.showDecline) {\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\r\n }\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"onClose(true)\">{{model.confirm|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n}", dependencies: [{ kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1379
+ updateValue(value) {
1380
+ this.text = value;
1381
+ this.onChange(this.text);
1382
+ }
1383
+ getId() {
1384
+ return '' + Math.floor(Math.random() * Date.now());
1385
+ }
1386
+ ngOnDestroy() { }
1387
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1388
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbRichEditorComponent, isStandalone: false, selector: "adb-rich-editor", inputs: { hasTaxon: "hasTaxon", hasReference: "hasReference", rows: "rows", label: "label" }, providers: [
1389
+ {
1390
+ provide: NG_VALUE_ACCESSOR,
1391
+ useExisting: forwardRef(() => AdbRichEditorComponent),
1392
+ multi: true
1393
+ }
1394
+ ], ngImport: i0, template: "<div>\r\n <div class=\"d-flex justify-content-end align-items-end gap-3 mb-1\">\r\n <label class=\"me-auto\" [for]=\"id\">{{label|translate}}</label>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onItalicClick()\" title=\"Italic\" aria-label=\"Italic\" type=\"button\"><span class=\"bi bi-type-italic\"></span></button>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onBoldClick()\" title=\"Italic\" aria-label=\"strong\" type=\"button\"><span class=\"bi bi-type-bold\"></span></button>\r\n @if (hasTaxon) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onTaxonClick()\" title=\"Taxon\" aria-label=\"Taxon\" type=\"button\"><span class=\"bi bi-bug\"></span></button>\r\n }\r\n @if (hasReference) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onReferenceClick()\" title=\"Reference\" aria-label=\"Reference\" type=\"button\"><span class=\"bi bi-asterisk\"></span></button>\r\n }\r\n </div>\r\n <textarea [id]=\"id\" class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" [rows]=\"rows\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1588
1395
  }
1589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbConfirmModal, decorators: [{
1396
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorComponent, decorators: [{
1590
1397
  type: Component,
1591
- args: [{ changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "@if (model) {\r\n <div class=\"modal fade show\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"h-subsection mb-0 modal-title\" id=\"mod_header\">{{model.header|translate}}</h1>\r\n <button type=\"button\" class=\"btn-close\" id=\"modal-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"onClose(false)\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div id=\"mod_desc\">{{model.text|translate}}</div>\r\n @if (model.value) {\r\n <div>\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n @if (model.showDecline) {\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\r\n }\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"onClose(true)\">{{model.confirm|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n}" }]
1592
- }], ctorParameters: () => [{ type: AdbModalService }, { type: i0.ElementRef }], propDecorators: { model: [{
1398
+ args: [{ selector: 'adb-rich-editor', providers: [
1399
+ {
1400
+ provide: NG_VALUE_ACCESSOR,
1401
+ useExisting: forwardRef(() => AdbRichEditorComponent),
1402
+ multi: true
1403
+ }
1404
+ ], changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div>\r\n <div class=\"d-flex justify-content-end align-items-end gap-3 mb-1\">\r\n <label class=\"me-auto\" [for]=\"id\">{{label|translate}}</label>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onItalicClick()\" title=\"Italic\" aria-label=\"Italic\" type=\"button\"><span class=\"bi bi-type-italic\"></span></button>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onBoldClick()\" title=\"Italic\" aria-label=\"strong\" type=\"button\"><span class=\"bi bi-type-bold\"></span></button>\r\n @if (hasTaxon) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onTaxonClick()\" title=\"Taxon\" aria-label=\"Taxon\" type=\"button\"><span class=\"bi bi-bug\"></span></button>\r\n }\r\n @if (hasReference) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onReferenceClick()\" title=\"Reference\" aria-label=\"Reference\" type=\"button\"><span class=\"bi bi-asterisk\"></span></button>\r\n }\r\n </div>\r\n <textarea [id]=\"id\" class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" [rows]=\"rows\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n" }]
1405
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { hasTaxon: [{
1406
+ type: Input
1407
+ }], hasReference: [{
1408
+ type: Input
1409
+ }], rows: [{
1410
+ type: Input
1411
+ }], label: [{
1593
1412
  type: Input
1594
1413
  }] } });
1595
1414
 
1596
- class AdbModalModule {
1597
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1598
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, declarations: [AdbConfirmModal], imports: [CommonModule, AdbDirectivesModule, TranslatePipe], exports: [AdbConfirmModal] });
1599
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, providers: [AdbModalService], imports: [CommonModule, AdbDirectivesModule] });
1415
+ class AdbRichEditorModule {
1416
+ static forRoot(config) {
1417
+ return {
1418
+ ngModule: AdbRichEditorModule,
1419
+ providers: [
1420
+ { provide: RICH_MODULE_CONFIG, useValue: config }
1421
+ ]
1422
+ };
1423
+ }
1424
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1425
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, declarations: [AdbRichEditorComponent, RichTextComponent], imports: [CommonModule, FormsModule, TranslatePipe], exports: [AdbRichEditorComponent, RichTextComponent] });
1426
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, imports: [CommonModule, FormsModule] });
1600
1427
  }
1601
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, decorators: [{
1428
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, decorators: [{
1602
1429
  type: NgModule,
1603
1430
  args: [{
1604
- imports: [CommonModule, AdbDirectivesModule, TranslatePipe],
1605
- declarations: [AdbConfirmModal],
1606
- exports: [AdbConfirmModal],
1607
- providers: [AdbModalService]
1431
+ imports: [CommonModule, FormsModule, TranslatePipe],
1432
+ declarations: [AdbRichEditorComponent, RichTextComponent],
1433
+ exports: [AdbRichEditorComponent, RichTextComponent]
1608
1434
  }]
1609
1435
  }] });
1610
1436
 
1611
- class AdbToastService {
1612
- environmentInjector;
1613
- appRef;
1614
- toastsSignal = signal([], ...(ngDevMode ? [{ debugName: "toastsSignal" }] : /* istanbul ignore next */ []));
1615
- container;
1616
- constructor(environmentInjector, appRef) {
1617
- this.environmentInjector = environmentInjector;
1618
- this.appRef = appRef;
1437
+ class AdbAlertModule {
1438
+ static forRoot(config) {
1439
+ return {
1440
+ ngModule: AdbAlertModule,
1441
+ providers: [
1442
+ { provide: ADB_ALERT_CONFIG, useValue: config }
1443
+ ]
1444
+ };
1619
1445
  }
1620
- add(toastMessage, time = 4000) {
1621
- this.addContainer();
1622
- toastMessage.type ??= ToastType.Primary;
1623
- toastMessage.id = Date.now();
1624
- toastMessage.delay = of(toastMessage)
1625
- .pipe(delay(time))
1626
- .subscribe(toast => this.remove(toast));
1627
- this.toastsSignal.update(toasts => [...toasts, toastMessage]);
1446
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1447
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertModule, declarations: [AdbAlertComponent], imports: [CommonModule, TranslatePipe, AdbRichEditorModule], exports: [AdbAlertComponent] });
1448
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertModule, imports: [CommonModule, AdbRichEditorModule] });
1449
+ }
1450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbAlertModule, decorators: [{
1451
+ type: NgModule,
1452
+ args: [{
1453
+ imports: [CommonModule, TranslatePipe, AdbRichEditorModule],
1454
+ declarations: [AdbAlertComponent],
1455
+ exports: [AdbAlertComponent]
1456
+ }]
1457
+ }] });
1458
+
1459
+ class AdbDatePickerComponent {
1460
+ elementRef;
1461
+ translate;
1462
+ subscriptions = new Subscription();
1463
+ static MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1464
+ static WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7'];
1465
+ static YEAR_INTERVALL = 8;
1466
+ currentdDate = new Date();
1467
+ currentMonth;
1468
+ selectedDate = new Date();
1469
+ years;
1470
+ months;
1471
+ weekDays = AdbDatePickerComponent.WEEK_DAYS;
1472
+ weeks;
1473
+ range;
1474
+ noYearMode = false;
1475
+ ;
1476
+ initialDate;
1477
+ settings;
1478
+ toLeft;
1479
+ id;
1480
+ selectDate = new EventEmitter();
1481
+ constructor(elementRef, translate) {
1482
+ this.elementRef = elementRef;
1483
+ this.translate = translate;
1628
1484
  }
1629
- remove(toast) {
1630
- this.toastsSignal.update(toasts => toasts.filter(x => x.id !== toast.id));
1485
+ ngOnInit() {
1486
+ if (this.settings) {
1487
+ if (this.settings?.minDate || this.settings?.maxDate) {
1488
+ const minDate = AdbDatePickerComponent.parseDate(this.settings.minDate);
1489
+ const maxDate = AdbDatePickerComponent.parseDate(this.settings.maxDate);
1490
+ this.range = {
1491
+ start: minDate ? startOfDay(minDate) : subYears(new Date(), 1000),
1492
+ end: maxDate ? endOfDay(maxDate) : addYears(new Date(), 1000)
1493
+ };
1494
+ }
1495
+ if (this.settings.noYear) {
1496
+ this.noYearMode = this.settings.noYear;
1497
+ }
1498
+ }
1499
+ this.selectedDate = this.currentdDate = this.initialDate ?? new Date();
1500
+ this.currentMonth = getMonth(this.selectedDate);
1501
+ this.createCalendar();
1631
1502
  }
1632
- addContainer() {
1633
- if (!this.container) {
1634
- const componentRef = createComponent(AdbToast, {
1635
- environmentInjector: this.environmentInjector
1503
+ onShowYear() {
1504
+ this.months = null;
1505
+ this.loadYearsInterval();
1506
+ }
1507
+ onShowMonth() {
1508
+ this.years = null;
1509
+ this.loadMonths();
1510
+ }
1511
+ onSelectYear(inYear) {
1512
+ this.selectedDate.setFullYear(inYear.getFullYear());
1513
+ this.loadMonths();
1514
+ this.years = null;
1515
+ }
1516
+ onSelectMonth(inMonth) {
1517
+ this.selectedDate.setMonth(inMonth);
1518
+ this.currentMonth = getMonth(this.selectedDate);
1519
+ this.createCalendar();
1520
+ this.years = null;
1521
+ this.months = null;
1522
+ }
1523
+ onPrev() {
1524
+ if (this.years) {
1525
+ this.selectedDate = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1526
+ this.loadYearsInterval();
1527
+ }
1528
+ else if (this.months) {
1529
+ this.selectedDate = subYears(this.selectedDate, 1);
1530
+ this.loadMonths();
1531
+ }
1532
+ else {
1533
+ this.selectedDate = subMonths(this.selectedDate, 1);
1534
+ this.createCalendar();
1535
+ }
1536
+ this.currentMonth = getMonth(this.selectedDate);
1537
+ }
1538
+ onNext() {
1539
+ if (this.years) {
1540
+ this.selectedDate = addYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1541
+ this.loadYearsInterval();
1542
+ }
1543
+ else if (this.months) {
1544
+ this.selectedDate = addYears(this.selectedDate, 1);
1545
+ this.loadMonths();
1546
+ }
1547
+ else {
1548
+ this.selectedDate = addMonths(this.selectedDate, 1);
1549
+ this.createCalendar();
1550
+ }
1551
+ this.currentMonth = getMonth(this.selectedDate);
1552
+ }
1553
+ ngOnDestroy() {
1554
+ this.subscriptions.unsubscribe();
1555
+ }
1556
+ loadMonths() {
1557
+ this.months = AdbDatePickerComponent.MONTHS.map(x => {
1558
+ return {
1559
+ value: x,
1560
+ isThisMonth: getMonth(this.selectedDate) === x && isSameYear(this.currentdDate, this.selectedDate)
1561
+ };
1562
+ });
1563
+ }
1564
+ loadYearsInterval() {
1565
+ let year = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1566
+ const years = [];
1567
+ for (let i = 0; i < 16; i++) {
1568
+ years.push({
1569
+ value: year,
1570
+ title: year.getFullYear(),
1571
+ isThisYear: isSameYear(year, this.currentdDate)
1636
1572
  });
1637
- this.appRef.attachView(componentRef.hostView);
1638
- this.container = componentRef.location.nativeElement;
1639
- document.body.appendChild(this.container);
1573
+ year = addYears(year, 1);
1640
1574
  }
1575
+ this.years = years;
1641
1576
  }
1642
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastService, deps: [{ token: i0.EnvironmentInjector }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
1643
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastService });
1644
- }
1645
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastService, decorators: [{
1646
- type: Injectable
1647
- }], ctorParameters: () => [{ type: i0.EnvironmentInjector }, { type: i0.ApplicationRef }] });
1648
- var ToastType;
1649
- (function (ToastType) {
1650
- ToastType[ToastType["Primary"] = 1] = "Primary";
1651
- ToastType[ToastType["Success"] = 2] = "Success";
1652
- ToastType[ToastType["Warn"] = 3] = "Warn";
1653
- ToastType[ToastType["Danger"] = 4] = "Danger";
1654
- })(ToastType || (ToastType = {}));
1655
-
1656
- class AdbToast {
1657
- toastService;
1658
- toastType = ToastType;
1659
- constructor(toastService) {
1660
- this.toastService = toastService;
1577
+ onSelectDate(day) {
1578
+ this.selectDate.emit(day.value);
1579
+ }
1580
+ createCalendar() {
1581
+ const weeks = [];
1582
+ const monthInterval = { start: startOfMonth(this.selectedDate), end: endOfMonth(this.selectedDate) };
1583
+ var fnsWweeks = eachWeekOfInterval(monthInterval, { weekStartsOn: this.translate.currentLang() === 'sv' || this.translate.currentLang() === 'sv-SE' ? 1 : 0 });
1584
+ for (const fnsWeek of fnsWweeks) {
1585
+ const week = { weekNumber: 0, days: [] };
1586
+ week.weekNumber = getISOWeek(new Date(fnsWeek));
1587
+ const weekInterval = { start: new Date(fnsWeek), end: addDays(new Date(fnsWeek), 6) };
1588
+ week.days = eachDayOfInterval(weekInterval).map(day => {
1589
+ day.setHours(getHours(new Date()));
1590
+ day.setMinutes(getMinutes(new Date()));
1591
+ return {
1592
+ value: day,
1593
+ isSelected: isSameYear(day, this.initialDate) && isSameDay(day, this.initialDate) && isSameMonth(day, this.initialDate),
1594
+ isInRange: this.range ? isWithinInterval(day, this.range) : true,
1595
+ isToday: isSameDay(day, new Date()),
1596
+ inMonth: monthInterval.start.getMonth() === day.getMonth()
1597
+ };
1598
+ });
1599
+ weeks.push(week);
1600
+ }
1601
+ this.weeks = weeks;
1661
1602
  }
1662
- onRemoveToast(toast) {
1663
- this.toastService.remove(toast);
1603
+ static parseDate(value) {
1604
+ if (typeof value === 'string') {
1605
+ if (isValid(parseISO(value))) {
1606
+ return parseISO(value);
1607
+ }
1608
+ else {
1609
+ return null;
1610
+ }
1611
+ }
1612
+ else if (value instanceof Date) {
1613
+ return value;
1614
+ }
1615
+ else {
1616
+ return null;
1617
+ }
1664
1618
  }
1665
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToast, deps: [{ token: AdbToastService }], target: i0.ɵɵFactoryTarget.Component });
1666
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbToast, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\" aria-live=\"polite\" aria-atomic=\"true\">\r\n @for (toast of toastService.toastsSignal(); track toast.id) {\r\n <div class=\"alert alert-dismissible position-relative\" role=\"status\"\r\n [class.alert-primary]=\"toast.type===toastType.Primary\"\r\n [class.alert-success]=\"toast.type===toastType.Success\"\r\n [class.alert-warning]=\"toast.type===toastType.Warn\"\r\n [class.alert-danger]=\"toast.type===toastType.Danger\">\r\n\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n \r\n @if (toast.header) {\r\n <div class=\"d-flex align-items-center justify-content-between pb-1\">\r\n @if (!toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{toast.header|translate}}</div>\r\n }\r\n @if (toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n }\r\n </div>\r\n }\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n @if (!toast.messageValue) {\r\n <div>{{toast.message|translate}}</div>\r\n }\r\n @if (toast.messageValue) {\r\n <div>{{(toast.message|translate:toast.messageValue )}}</div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n</div>", dependencies: [{ kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
1619
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
1620
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbDatePickerComponent, isStandalone: false, selector: "adb-date-picker", inputs: { initialDate: "initialDate", settings: "settings", toLeft: "toLeft", id: "id" }, outputs: { selectDate: "selectDate" }, host: { properties: { "id": "this.id" } }, ngImport: i0, template: "<div class=\"position-relative\" [class.to-left]=\"toLeft\">\r\n <nav class=\"bg-body shadow rounded position-absolute\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"bi bi-chevron-left\"></span></button>\r\n @if(!years&&!months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n @if(years){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n }\r\n @if(months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><span class=\"bi bi-chevron-right\"></span></button>\r\n </header>\r\n <div class=\"p-0 border calendar\">\r\n <ul class=\"list-unstyled row\" *ngIf=\"years\">\r\n <li class=\"col-3 text-center px-2 py-3\" *ngFor=\"let year of years\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\"\r\n [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n @if(months){\r\n <ul class=\"list-unstyled row\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n }\r\n <div class=\"days\" *ngIf=\"!years&&!months\">\r\n <div class=\"text-center border-bottom py-2 text-muted\" *ngFor=\"let weekDay of weekDays\">{{'WEEK_DAYS.'+weekDay|translate}}</div>\r\n <ng-container *ngFor=\"let week of weeks\">\r\n <button tabIndex=\"-1\" class=\"btn rounded-circle p-0\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" [class.border]=\"day.isToday\" [class.btn-primary]=\"day.isSelected\"\r\n [ngClass]=\"{'border-0 opacity-50':!day.inMonth||!day.isInRange}\" [disabled]=\"!day.inMonth || !day.isInRange\">\r\n <small>{{day.value|date:'d'}}</small>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </nav>\r\n</div>", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "pipe", type: LocaleDatePipe, name: "adbLocaleDate" }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1667
1621
  }
1668
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToast, decorators: [{
1622
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
1669
1623
  type: Component,
1670
- args: [{ standalone: false, template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\" aria-live=\"polite\" aria-atomic=\"true\">\r\n @for (toast of toastService.toastsSignal(); track toast.id) {\r\n <div class=\"alert alert-dismissible position-relative\" role=\"status\"\r\n [class.alert-primary]=\"toast.type===toastType.Primary\"\r\n [class.alert-success]=\"toast.type===toastType.Success\"\r\n [class.alert-warning]=\"toast.type===toastType.Warn\"\r\n [class.alert-danger]=\"toast.type===toastType.Danger\">\r\n\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n \r\n @if (toast.header) {\r\n <div class=\"d-flex align-items-center justify-content-between pb-1\">\r\n @if (!toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{toast.header|translate}}</div>\r\n }\r\n @if (toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n }\r\n </div>\r\n }\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n @if (!toast.messageValue) {\r\n <div>{{toast.message|translate}}</div>\r\n }\r\n @if (toast.messageValue) {\r\n <div>{{(toast.message|translate:toast.messageValue )}}</div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n</div>" }]
1671
- }], ctorParameters: () => [{ type: AdbToastService }] });
1624
+ args: [{ selector: 'adb-date-picker', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div class=\"position-relative\" [class.to-left]=\"toLeft\">\r\n <nav class=\"bg-body shadow rounded position-absolute\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"bi bi-chevron-left\"></span></button>\r\n @if(!years&&!months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n @if(years){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n }\r\n @if(months){\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n }\r\n <button tabIndex=\"-1\" class=\"btn btn-primary-dark rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><span class=\"bi bi-chevron-right\"></span></button>\r\n </header>\r\n <div class=\"p-0 border calendar\">\r\n <ul class=\"list-unstyled row\" *ngIf=\"years\">\r\n <li class=\"col-3 text-center px-2 py-3\" *ngFor=\"let year of years\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\"\r\n [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n @if(months){\r\n <ul class=\"list-unstyled row\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n }\r\n <div class=\"days\" *ngIf=\"!years&&!months\">\r\n <div class=\"text-center border-bottom py-2 text-muted\" *ngFor=\"let weekDay of weekDays\">{{'WEEK_DAYS.'+weekDay|translate}}</div>\r\n <ng-container *ngFor=\"let week of weeks\">\r\n <button tabIndex=\"-1\" class=\"btn rounded-circle p-0\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" [class.border]=\"day.isToday\" [class.btn-primary]=\"day.isSelected\"\r\n [ngClass]=\"{'border-0 opacity-50':!day.inMonth||!day.isInRange}\" [disabled]=\"!day.inMonth || !day.isInRange\">\r\n <small>{{day.value|date:'d'}}</small>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </nav>\r\n</div>" }]
1625
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.TranslateService }], propDecorators: { initialDate: [{
1626
+ type: Input
1627
+ }], settings: [{
1628
+ type: Input
1629
+ }], toLeft: [{
1630
+ type: Input
1631
+ }], id: [{
1632
+ type: HostBinding,
1633
+ args: ['id']
1634
+ }, {
1635
+ type: Input
1636
+ }], selectDate: [{
1637
+ type: Output
1638
+ }] } });
1672
1639
 
1673
- class AdbToastModule {
1674
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1675
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, declarations: [AdbToast], imports: [CommonModule, AdbDirectivesModule, TranslatePipe], exports: [AdbToast] });
1676
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, providers: [AdbToastService], imports: [CommonModule, AdbDirectivesModule] });
1640
+ class AdbDatePickerService {
1641
+ viewRef;
1642
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1643
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerService });
1677
1644
  }
1678
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, decorators: [{
1679
- type: NgModule,
1680
- args: [{
1681
- imports: [CommonModule, AdbDirectivesModule, TranslatePipe],
1682
- declarations: [AdbToast],
1683
- exports: [AdbToast],
1684
- providers: [AdbToastService]
1685
- }]
1645
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerService, decorators: [{
1646
+ type: Injectable
1686
1647
  }] });
1687
1648
 
1688
- class AdbHelpButtonComponent {
1649
+ class AdbDatePickerDirective {
1650
+ viewContainerRef;
1651
+ renderer;
1689
1652
  elementRef;
1690
- showHelp = false;
1691
- buttonClassSignal = input('btn btn-invisible p-0', { ...(ngDevMode ? { debugName: "buttonClassSignal" } : /* istanbul ignore next */ {}), alias: 'buttonClass' });
1692
- labelSignal = input('', { ...(ngDevMode ? { debugName: "labelSignal" } : /* istanbul ignore next */ {}), alias: 'label' });
1653
+ adbDatePickerService;
1654
+ translate;
1655
+ subscriptions = new Subscription();
1656
+ autocomplete = 'off';
1657
+ adbBlur = new EventEmitter();
1658
+ format = 'yyyy-MM-dd';
1659
+ toLeft;
1660
+ settings = null;
1693
1661
  id;
1694
- onClickDoc(event) {
1695
- const target = event.target;
1696
- const parent = target.parentElement;
1697
- const clickedInside = this.elementRef.nativeElement.contains(parent);
1698
- if (!clickedInside) {
1699
- this.showHelp = false;
1700
- }
1701
- }
1702
- constructor(elementRef) {
1662
+ currentDate;
1663
+ isValid;
1664
+ constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
1665
+ this.viewContainerRef = viewContainerRef;
1666
+ this.renderer = renderer;
1703
1667
  this.elementRef = elementRef;
1668
+ this.adbDatePickerService = adbDatePickerService;
1669
+ this.translate = translate;
1704
1670
  }
1705
1671
  ngOnInit() {
1706
- this.id = +Math.floor(Math.random() * Date.now());
1672
+ this.elementRef.nativeElement.setAttribute("placeholder", this.format);
1707
1673
  }
1708
- onClose() {
1709
- const node = this.elementRef.nativeElement.parentNode;
1710
- if (node) {
1711
- if (this.showHelp) {
1712
- node.classList.remove('position-relative');
1674
+ onClick() {
1675
+ if (this.adbDatePickerService.viewRef) {
1676
+ this.adbDatePickerService.viewRef.destroy();
1677
+ }
1678
+ const viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
1679
+ viewRef.instance.settings = this.settings;
1680
+ viewRef.instance.toLeft = this.toLeft;
1681
+ viewRef.instance.initialDate = this.currentDate;
1682
+ this.id = this.getId();
1683
+ viewRef.instance.id = this.id;
1684
+ viewRef.instance.selectDate.subscribe((date) => {
1685
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang()));
1686
+ this.onChange(date);
1687
+ this.currentDate = date;
1688
+ this.onHide();
1689
+ this.adbBlur.emit(date);
1690
+ });
1691
+ this.adbDatePickerService.viewRef = viewRef;
1692
+ }
1693
+ onKeyup(event) {
1694
+ const date = AdbDatePickerDirective.tryParse(event.target.value);
1695
+ if (date) {
1696
+ const now = new Date();
1697
+ date.setHours(now.getHours());
1698
+ date.setMinutes(now.getMinutes());
1699
+ date.setSeconds(now.getSeconds());
1700
+ this.onChange(date);
1701
+ }
1702
+ else {
1703
+ this.onChange(event.target.value); //send inccorect values to form
1704
+ }
1705
+ }
1706
+ onTabDown() {
1707
+ this.updateValueOnLeave();
1708
+ this.onHide();
1709
+ this.adbBlur.emit(this.currentDate);
1710
+ }
1711
+ onEscdOWN() {
1712
+ this.updateValueOnLeave();
1713
+ this.onHide();
1714
+ }
1715
+ onHide() {
1716
+ this.adbDatePickerService.viewRef = null;
1717
+ this.viewContainerRef.detach();
1718
+ this.viewContainerRef.clear();
1719
+ }
1720
+ onCheckOutSideClick(target) {
1721
+ const nativeElement = this.adbDatePickerService.viewRef?.instance.elementRef.nativeElement ?? null;
1722
+ if (nativeElement) {
1723
+ if (nativeElement.id === this.id) {
1724
+ if (!target.hasAttribute('adbdatepicker')) {
1725
+ const clickedInside = nativeElement.contains(target);
1726
+ if (!clickedInside) {
1727
+ this.updateValueOnLeave();
1728
+ this.onHide();
1729
+ this.adbBlur.emit(this.currentDate);
1730
+ }
1731
+ }
1732
+ }
1733
+ }
1734
+ }
1735
+ updateValueOnLeave() {
1736
+ if (this.isValid) {
1737
+ if (this.currentDate) {
1738
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang()));
1713
1739
  }
1714
1740
  else {
1715
- node.classList.add('position-relative');
1741
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1716
1742
  }
1717
1743
  }
1718
- this.showHelp = !this.showHelp;
1719
1744
  }
1720
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbHelpButtonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1721
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbHelpButtonComponent, isStandalone: false, selector: "adb-help-button", inputs: { buttonClassSignal: { classPropertyName: "buttonClassSignal", publicName: "buttonClass", isSignal: true, isRequired: false, transformFunction: null }, labelSignal: { classPropertyName: "labelSignal", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "onClickDoc($event)" } }, ngImport: i0, template: "<button type=\"button\"\r\n class=\"w-auto d-flex gap-1 align-items-baseline help-button\"\r\n [ngClass]=\"buttonClassSignal()\"\r\n [attr.aria-controls]=\"id\" aria-label=\"Help\"\r\n [attr.aria-expanded]=\"showHelp\" (click)=\"onClose()\">\r\n <span class=\"bi bi-question-circle-fill text-primary\"></span>\r\n {{labelSignal()}}\r\n</button>\r\n<div>\r\n @if (showHelp) {\r\n <div [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow fw-normal\" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div class=\"flex-grow-1\"><ng-content></ng-content></div>\r\n <div class=\"ms-auto align-self-start d-flex align-items-start\">\r\n <button type=\"button\" class=\"btn-close p-1\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"showHelp=false\"></button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n</div>", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1722
- }
1723
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbHelpButtonComponent, decorators: [{
1724
- type: Component,
1725
- args: [{ selector: 'adb-help-button', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<button type=\"button\"\r\n class=\"w-auto d-flex gap-1 align-items-baseline help-button\"\r\n [ngClass]=\"buttonClassSignal()\"\r\n [attr.aria-controls]=\"id\" aria-label=\"Help\"\r\n [attr.aria-expanded]=\"showHelp\" (click)=\"onClose()\">\r\n <span class=\"bi bi-question-circle-fill text-primary\"></span>\r\n {{labelSignal()}}\r\n</button>\r\n<div>\r\n @if (showHelp) {\r\n <div [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow fw-normal\" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div class=\"flex-grow-1\"><ng-content></ng-content></div>\r\n <div class=\"ms-auto align-self-start d-flex align-items-start\">\r\n <button type=\"button\" class=\"btn-close p-1\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"showHelp=false\"></button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n</div>" }]
1726
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { buttonClassSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonClass", required: false }] }], labelSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], onClickDoc: [{
1745
+ ngOnDestroy() {
1746
+ this.subscriptions.unsubscribe();
1747
+ }
1748
+ //Validator
1749
+ validate(control) {
1750
+ const value = control.value;
1751
+ if (!value) {
1752
+ this.currentDate = null;
1753
+ this.isValid = true;
1754
+ return null;
1755
+ }
1756
+ if (value instanceof Date) {
1757
+ this.currentDate = value;
1758
+ this.isValid = true;
1759
+ return null;
1760
+ }
1761
+ if (typeof value === 'string' || value instanceof String) {
1762
+ const date = AdbDatePickerDirective.tryParse(value);
1763
+ if (!date) {
1764
+ this.isValid = false;
1765
+ return { date: true };
1766
+ }
1767
+ }
1768
+ this.isValid = true;
1769
+ return null;
1770
+ }
1771
+ //ControlValueAccessor
1772
+ onChange = () => { };
1773
+ onTouched = () => { };
1774
+ onValidationChange = () => { };
1775
+ registerOnValidatorChange(fn) {
1776
+ this.onValidationChange = fn;
1777
+ }
1778
+ writeValue(value) {
1779
+ if (!value) {
1780
+ this.currentDate = null;
1781
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1782
+ return;
1783
+ }
1784
+ if (typeof value === 'string' || value instanceof String) {
1785
+ const date = AdbDatePickerDirective.tryParse(value);
1786
+ if (!date) {
1787
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
1788
+ return;
1789
+ }
1790
+ value = date;
1791
+ }
1792
+ if (value instanceof Date) {
1793
+ this.currentDate = value;
1794
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang()));
1795
+ }
1796
+ }
1797
+ registerOnChange(fn) {
1798
+ this.onChange = fn;
1799
+ }
1800
+ registerOnTouched(fn) {
1801
+ this.onTouched = fn;
1802
+ }
1803
+ setDisabledState(isDisabled) {
1804
+ this.viewContainerRef.clear();
1805
+ }
1806
+ static tryParse(dateString) {
1807
+ const parsed = parseISO(dateString);
1808
+ return isValid(parsed) ? parsed : null;
1809
+ }
1810
+ getId() {
1811
+ return '' + Math.floor(Math.random() * Date.now());
1812
+ }
1813
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Directive });
1814
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: AdbDatePickerDirective, isStandalone: false, selector: "input[adbDatepicker]", inputs: { format: "format", toLeft: "toLeft", settings: "settings" }, outputs: { adbBlur: "adbBlur" }, host: { listeners: { "click": "onClick()", "keyup": "onKeyup($event)", "keydown.shift.tab": "onTabDown()", "keydown.tab": "onTabDown()", "keydown.esc": "onEscdOWN()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "autocomplete": "this.autocomplete" } }, providers: [{
1815
+ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => AdbDatePickerDirective),
1816
+ multi: true
1817
+ },
1818
+ {
1819
+ provide: NG_VALIDATORS,
1820
+ useExisting: AdbDatePickerDirective,
1821
+ multi: true,
1822
+ },], ngImport: i0 });
1823
+ }
1824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
1825
+ type: Directive,
1826
+ args: [{
1827
+ selector: `input[adbDatepicker]`,
1828
+ providers: [{
1829
+ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => AdbDatePickerDirective),
1830
+ multi: true
1831
+ },
1832
+ {
1833
+ provide: NG_VALIDATORS,
1834
+ useExisting: AdbDatePickerDirective,
1835
+ multi: true,
1836
+ },],
1837
+ standalone: false
1838
+ }]
1839
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i1$1.TranslateService }], propDecorators: { autocomplete: [{
1840
+ type: HostBinding,
1841
+ args: ['autocomplete']
1842
+ }], adbBlur: [{
1843
+ type: Output
1844
+ }], format: [{
1845
+ type: Input
1846
+ }], toLeft: [{
1847
+ type: Input
1848
+ }], settings: [{
1849
+ type: Input
1850
+ }], onClick: [{
1727
1851
  type: HostListener,
1728
- args: ['document:click', ['$event']]
1852
+ args: ['click']
1853
+ }], onKeyup: [{
1854
+ type: HostListener,
1855
+ args: ['keyup', ['$event']]
1856
+ }], onTabDown: [{
1857
+ type: HostListener,
1858
+ args: ['keydown.shift.tab']
1859
+ }, {
1860
+ type: HostListener,
1861
+ args: ['keydown.tab']
1862
+ }], onEscdOWN: [{
1863
+ type: HostListener,
1864
+ args: ['keydown.esc']
1865
+ }], onCheckOutSideClick: [{
1866
+ type: HostListener,
1867
+ args: ['document:click', ['$event.target']]
1729
1868
  }] } });
1730
1869
 
1731
- class AdbButtonsModule {
1732
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1733
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, declarations: [AdbHelpButtonComponent], imports: [CommonModule, AdbDirectivesModule], exports: [AdbHelpButtonComponent] });
1734
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, imports: [CommonModule, AdbDirectivesModule] });
1870
+ class AdbDatePickerModule {
1871
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1872
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, declarations: [AdbDatePickerComponent, AdbDatePickerDirective], imports: [CommonModule, AdbPipesModule, AdbDirectivesModule, TranslatePipe], exports: [AdbDatePickerComponent, AdbDatePickerDirective] });
1873
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, providers: [AdbDatePickerService], imports: [CommonModule, AdbPipesModule, AdbDirectivesModule] });
1735
1874
  }
1736
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, decorators: [{
1875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbDatePickerModule, decorators: [{
1737
1876
  type: NgModule,
1738
1877
  args: [{
1739
- imports: [CommonModule, AdbDirectivesModule],
1740
- declarations: [AdbHelpButtonComponent],
1741
- exports: [AdbHelpButtonComponent]
1878
+ imports: [CommonModule, AdbPipesModule, AdbDirectivesModule, TranslatePipe],
1879
+ declarations: [AdbDatePickerComponent, AdbDatePickerDirective],
1880
+ exports: [AdbDatePickerComponent, AdbDatePickerDirective],
1881
+ providers: [AdbDatePickerService]
1742
1882
  }]
1743
1883
  }] });
1744
1884
 
1745
- const FORMAT_MARKERS = {
1746
- italic: ['*', '_'],
1747
- bold: ['**', '__']
1748
- };
1749
- const DEFAULT_MARKER = {
1750
- italic: '*',
1751
- bold: '**'
1752
- };
1753
- class AdbRichEditorComponent {
1754
- el;
1755
- text = '';
1756
- hasTaxon = false;
1757
- hasReference = false;
1758
- rows = 3;
1759
- label = 'Set label';
1760
- id;
1761
- constructor(el) {
1762
- this.el = el;
1763
- this.id = this.getId();
1764
- }
1765
- getTextarea() {
1766
- return this.el.nativeElement.querySelector('textarea');
1767
- }
1768
- onDoubleClick() {
1769
- const textarea = this.getTextarea();
1770
- if (!textarea)
1771
- return;
1772
- const start = textarea.selectionStart;
1773
- let end = textarea.selectionEnd;
1774
- while (end > start && textarea.value[end - 1] === ' ') {
1775
- end--;
1776
- }
1777
- textarea.setSelectionRange(start, end);
1778
- }
1779
- onItalicClick() {
1780
- this.applyFormatting('italic');
1885
+ class AdbModalService {
1886
+ environmentInjector;
1887
+ appRef;
1888
+ closeSubject = new Subject();
1889
+ close$ = this.closeSubject.asObservable();
1890
+ renderer;
1891
+ domElem;
1892
+ backdrop;
1893
+ constructor(environmentInjector, rendererFactory, appRef) {
1894
+ this.environmentInjector = environmentInjector;
1895
+ this.appRef = appRef;
1896
+ this.renderer = rendererFactory.createRenderer(null, null);
1781
1897
  }
1782
- onBoldClick() {
1783
- this.applyFormatting('bold');
1898
+ hide(confirm) {
1899
+ this.closeSubject.next(confirm);
1900
+ document.body.removeChild(this.domElem);
1901
+ document.body.removeChild(this.backdrop);
1902
+ var main = this.renderer.selectRootElement('main', true);
1903
+ this.renderer.removeAttribute(main, 'inert');
1904
+ this.closeSubject.unsubscribe();
1905
+ this.closeSubject = new Subject();
1906
+ this.close$ = this.closeSubject.asObservable();
1784
1907
  }
1785
- applyFormatting(type) {
1786
- const textarea = this.getTextarea();
1787
- if (!textarea)
1788
- return;
1789
- const start = textarea.selectionStart;
1790
- const end = textarea.selectionEnd;
1791
- const value = textarea.value;
1792
- if (start === end) {
1793
- const marker = DEFAULT_MARKER[type];
1794
- const newValue = value.slice(0, start) +
1795
- marker +
1796
- marker +
1797
- value.slice(start);
1798
- this.updateValue(newValue);
1799
- const cursor = start + marker.length;
1800
- requestAnimationFrame(() => {
1801
- textarea.focus();
1802
- textarea.setSelectionRange(cursorStart, cursorEnd);
1803
- });
1804
- return;
1805
- }
1806
- const existingMarker = this.findWrappingMarker(value, start, end, FORMAT_MARKERS[type]);
1807
- const marker = existingMarker ?? DEFAULT_MARKER[type];
1808
- const newValue = existingMarker
1809
- ? value.slice(0, start - marker.length) +
1810
- value.slice(start, end) +
1811
- value.slice(end + marker.length)
1812
- : value.slice(0, start) +
1813
- marker +
1814
- value.slice(start, end) +
1815
- marker +
1816
- value.slice(end);
1817
- this.updateValue(newValue);
1818
- const cursorStart = existingMarker
1819
- ? start - marker.length
1820
- : start + marker.length;
1821
- const cursorEnd = existingMarker
1822
- ? end - marker.length
1823
- : end + marker.length;
1824
- requestAnimationFrame(() => {
1825
- textarea.focus();
1826
- textarea.setSelectionRange(cursorStart, cursorEnd);
1908
+ showConfirm(model) {
1909
+ const main = this.renderer.selectRootElement('main', true);
1910
+ main.setAttribute('inert', '');
1911
+ this.backdrop = this.renderer.createElement('div');
1912
+ this.backdrop.classList.add('modal-backdrop', 'fade', 'show');
1913
+ this.renderer.appendChild(document.body, this.backdrop);
1914
+ const componentRef = createComponent(AdbConfirmModal, {
1915
+ environmentInjector: this.environmentInjector
1827
1916
  });
1917
+ model.header = model.header ?? 'NOT_SET';
1918
+ model.text = model.text ?? 'NOT_SET';
1919
+ model.confirm = model.confirm ?? 'OK';
1920
+ model.decline = model.decline ?? 'CANCEL';
1921
+ model.showDecline = model.showDecline ?? true;
1922
+ componentRef.instance.model = model;
1923
+ this.appRef.attachView(componentRef.hostView);
1924
+ this.domElem = componentRef.location.nativeElement;
1925
+ document.body.appendChild(this.domElem);
1828
1926
  }
1829
- findWrappingMarker(value, start, end, markers) {
1830
- return (markers.find(marker => value.substring(start - marker.length, start) === marker &&
1831
- value.substring(end, end + marker.length) === marker) ?? null);
1832
- }
1833
- onTaxonClick() {
1834
- this.replaceMarked('[Name](taxon:0)');
1835
- }
1836
- onReferenceClick() {
1837
- this.replaceMarked('[Name](reference:0)');
1927
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalService, deps: [{ token: i0.EnvironmentInjector }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
1928
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalService });
1929
+ }
1930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalService, decorators: [{
1931
+ type: Injectable
1932
+ }], ctorParameters: () => [{ type: i0.EnvironmentInjector }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }] });
1933
+
1934
+ class AdbConfirmModal {
1935
+ modalRef;
1936
+ elementRef;
1937
+ model;
1938
+ constructor(modalRef, elementRef) {
1939
+ this.modalRef = modalRef;
1940
+ this.elementRef = elementRef;
1838
1941
  }
1839
- replaceMarked(replaceTag) {
1840
- const textarea = this.getTextarea();
1841
- if (!textarea)
1842
- return;
1843
- const start = textarea.selectionStart;
1844
- const end = textarea.selectionEnd;
1845
- const value = textarea.value;
1846
- const before = start > 0 ? value[start - 1] : '';
1847
- const after = end < value.length ? value[end] : '';
1848
- const spaceBefore = before && !/\s/.test(before) ? ' ' : '';
1849
- const spaceAfter = after && !/\s/.test(after) ? ' ' : '';
1850
- const newValue = value.slice(0, start) +
1851
- spaceBefore +
1852
- replaceTag +
1853
- spaceAfter +
1854
- value.slice(end);
1855
- this.updateValue(newValue);
1856
- const nameStart = newValue.indexOf('Name', start);
1857
- if (nameStart === -1)
1858
- return;
1859
- const nameEnd = nameStart + 'Name'.length;
1860
- requestAnimationFrame(() => {
1861
- textarea.focus();
1862
- textarea.setSelectionRange(nameStart, nameEnd);
1863
- });
1942
+ ngAfterViewInit() {
1943
+ const element = this.elementRef.nativeElement.querySelector('#modal-close');
1944
+ if (element) {
1945
+ element.focus();
1946
+ }
1864
1947
  }
1865
- // ---------------------------------------
1866
- // ControlValueAccessor
1867
- // ---------------------------------------
1868
- onChange = () => { };
1869
- onTouched = () => { };
1870
- writeValue(value) {
1871
- this.text = value ?? '';
1948
+ onClose(confirm) {
1949
+ this.modalRef.hide(confirm);
1872
1950
  }
1873
- registerOnChange(fn) {
1874
- this.onChange = fn;
1951
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbConfirmModal, deps: [{ token: AdbModalService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1952
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbConfirmModal, isStandalone: false, selector: "ng-component", inputs: { model: "model" }, ngImport: i0, template: "@if (model) {\r\n <div class=\"modal fade show\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"h-subsection mb-0 modal-title\" id=\"mod_header\">{{model.header|translate}}</h1>\r\n <button type=\"button\" class=\"btn-close\" id=\"modal-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"onClose(false)\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div id=\"mod_desc\">{{model.text|translate}}</div>\r\n @if (model.value) {\r\n <div>\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n @if (model.showDecline) {\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\r\n }\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"onClose(true)\">{{model.confirm|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n}", dependencies: [{ kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
1953
+ }
1954
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbConfirmModal, decorators: [{
1955
+ type: Component,
1956
+ args: [{ changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "@if (model) {\r\n <div class=\"modal fade show\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"h-subsection mb-0 modal-title\" id=\"mod_header\">{{model.header|translate}}</h1>\r\n <button type=\"button\" class=\"btn-close\" id=\"modal-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"onClose(false)\"></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div id=\"mod_desc\">{{model.text|translate}}</div>\r\n @if (model.value) {\r\n <div>\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n @if (model.showDecline) {\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\r\n }\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"onClose(true)\">{{model.confirm|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n}" }]
1957
+ }], ctorParameters: () => [{ type: AdbModalService }, { type: i0.ElementRef }], propDecorators: { model: [{
1958
+ type: Input
1959
+ }] } });
1960
+
1961
+ class AdbModalModule {
1962
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1963
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, declarations: [AdbConfirmModal], imports: [CommonModule, AdbDirectivesModule, TranslatePipe], exports: [AdbConfirmModal] });
1964
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, providers: [AdbModalService], imports: [CommonModule, AdbDirectivesModule] });
1965
+ }
1966
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbModalModule, decorators: [{
1967
+ type: NgModule,
1968
+ args: [{
1969
+ imports: [CommonModule, AdbDirectivesModule, TranslatePipe],
1970
+ declarations: [AdbConfirmModal],
1971
+ exports: [AdbConfirmModal],
1972
+ providers: [AdbModalService]
1973
+ }]
1974
+ }] });
1975
+
1976
+ class AdbToastService {
1977
+ environmentInjector;
1978
+ appRef;
1979
+ toastsSignal = signal([], ...(ngDevMode ? [{ debugName: "toastsSignal" }] : /* istanbul ignore next */ []));
1980
+ container;
1981
+ constructor(environmentInjector, appRef) {
1982
+ this.environmentInjector = environmentInjector;
1983
+ this.appRef = appRef;
1875
1984
  }
1876
- registerOnTouched(fn) {
1877
- this.onTouched = fn;
1985
+ add(toastMessage, time = 4000) {
1986
+ this.addContainer();
1987
+ toastMessage.type ??= ToastType.Primary;
1988
+ toastMessage.id = Date.now();
1989
+ toastMessage.delay = of(toastMessage)
1990
+ .pipe(delay(time))
1991
+ .subscribe(toast => this.remove(toast));
1992
+ this.toastsSignal.update(toasts => [...toasts, toastMessage]);
1878
1993
  }
1879
- setDisabledState(isDisabled) {
1880
- // Intentionally left minimal
1881
- // Disabled state should be handled via template binding
1994
+ remove(toast) {
1995
+ this.toastsSignal.update(toasts => toasts.filter(x => x.id !== toast.id));
1882
1996
  }
1883
- onTextChange() {
1884
- this.onChange(this.text);
1997
+ addContainer() {
1998
+ if (!this.container) {
1999
+ const componentRef = createComponent(AdbToast, {
2000
+ environmentInjector: this.environmentInjector
2001
+ });
2002
+ this.appRef.attachView(componentRef.hostView);
2003
+ this.container = componentRef.location.nativeElement;
2004
+ document.body.appendChild(this.container);
2005
+ }
1885
2006
  }
1886
- updateValue(value) {
1887
- this.text = value;
1888
- this.onChange(this.text);
2007
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastService, deps: [{ token: i0.EnvironmentInjector }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
2008
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastService });
2009
+ }
2010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastService, decorators: [{
2011
+ type: Injectable
2012
+ }], ctorParameters: () => [{ type: i0.EnvironmentInjector }, { type: i0.ApplicationRef }] });
2013
+ var ToastType;
2014
+ (function (ToastType) {
2015
+ ToastType[ToastType["Primary"] = 1] = "Primary";
2016
+ ToastType[ToastType["Success"] = 2] = "Success";
2017
+ ToastType[ToastType["Warn"] = 3] = "Warn";
2018
+ ToastType[ToastType["Danger"] = 4] = "Danger";
2019
+ })(ToastType || (ToastType = {}));
2020
+
2021
+ class AdbToast {
2022
+ toastService;
2023
+ toastType = ToastType;
2024
+ constructor(toastService) {
2025
+ this.toastService = toastService;
1889
2026
  }
1890
- getId() {
1891
- return '' + Math.floor(Math.random() * Date.now());
2027
+ onRemoveToast(toast) {
2028
+ this.toastService.remove(toast);
1892
2029
  }
1893
- ngOnDestroy() { }
1894
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1895
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbRichEditorComponent, isStandalone: false, selector: "adb-rich-editor", inputs: { hasTaxon: "hasTaxon", hasReference: "hasReference", rows: "rows", label: "label" }, providers: [
1896
- {
1897
- provide: NG_VALUE_ACCESSOR,
1898
- useExisting: forwardRef(() => AdbRichEditorComponent),
1899
- multi: true
1900
- }
1901
- ], ngImport: i0, template: "<div>\r\n <div class=\"d-flex justify-content-end align-items-end gap-3 mb-1\">\r\n <label class=\"me-auto\" [for]=\"id\">{{label|translate}}</label>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onItalicClick()\" title=\"Italic\" aria-label=\"Italic\" type=\"button\"><span class=\"bi bi-type-italic\"></span></button>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onBoldClick()\" title=\"Italic\" aria-label=\"strong\" type=\"button\"><span class=\"bi bi-type-bold\"></span></button>\r\n @if (hasTaxon) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onTaxonClick()\" title=\"Taxon\" aria-label=\"Taxon\" type=\"button\"><span class=\"bi bi-bug\"></span></button>\r\n }\r\n @if (hasReference) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onReferenceClick()\" title=\"Reference\" aria-label=\"Reference\" type=\"button\"><span class=\"bi bi-asterisk\"></span></button>\r\n }\r\n </div>\r\n <textarea [id]=\"id\" class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" [rows]=\"rows\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i1$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2030
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToast, deps: [{ token: AdbToastService }], target: i0.ɵɵFactoryTarget.Component });
2031
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbToast, isStandalone: false, selector: "ng-component", ngImport: i0, template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\" aria-live=\"polite\" aria-atomic=\"true\">\r\n @for (toast of toastService.toastsSignal(); track toast.id) {\r\n <div class=\"alert alert-dismissible position-relative\" role=\"status\"\r\n [class.alert-primary]=\"toast.type===toastType.Primary\"\r\n [class.alert-success]=\"toast.type===toastType.Success\"\r\n [class.alert-warning]=\"toast.type===toastType.Warn\"\r\n [class.alert-danger]=\"toast.type===toastType.Danger\">\r\n\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n \r\n @if (toast.header) {\r\n <div class=\"d-flex align-items-center justify-content-between pb-1\">\r\n @if (!toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{toast.header|translate}}</div>\r\n }\r\n @if (toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n }\r\n </div>\r\n }\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n @if (!toast.messageValue) {\r\n <div>{{toast.message|translate}}</div>\r\n }\r\n @if (toast.messageValue) {\r\n <div>{{(toast.message|translate:toast.messageValue )}}</div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n</div>", dependencies: [{ kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] });
1902
2032
  }
1903
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorComponent, decorators: [{
2033
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToast, decorators: [{
1904
2034
  type: Component,
1905
- args: [{ selector: 'adb-rich-editor', providers: [
1906
- {
1907
- provide: NG_VALUE_ACCESSOR,
1908
- useExisting: forwardRef(() => AdbRichEditorComponent),
1909
- multi: true
1910
- }
1911
- ], changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div>\r\n <div class=\"d-flex justify-content-end align-items-end gap-3 mb-1\">\r\n <label class=\"me-auto\" [for]=\"id\">{{label|translate}}</label>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onItalicClick()\" title=\"Italic\" aria-label=\"Italic\" type=\"button\"><span class=\"bi bi-type-italic\"></span></button>\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onBoldClick()\" title=\"Italic\" aria-label=\"strong\" type=\"button\"><span class=\"bi bi-type-bold\"></span></button>\r\n @if (hasTaxon) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onTaxonClick()\" title=\"Taxon\" aria-label=\"Taxon\" type=\"button\"><span class=\"bi bi-bug\"></span></button>\r\n }\r\n @if (hasReference) {\r\n <button class=\"btn btn-sm btn-secondary\" (click)=\"onReferenceClick()\" title=\"Reference\" aria-label=\"Reference\" type=\"button\"><span class=\"bi bi-asterisk\"></span></button>\r\n }\r\n </div>\r\n <textarea [id]=\"id\" class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" [rows]=\"rows\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n" }]
1912
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { hasTaxon: [{
1913
- type: Input
1914
- }], hasReference: [{
1915
- type: Input
1916
- }], rows: [{
1917
- type: Input
1918
- }], label: [{
1919
- type: Input
1920
- }] } });
2035
+ args: [{ standalone: false, template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\" aria-live=\"polite\" aria-atomic=\"true\">\r\n @for (toast of toastService.toastsSignal(); track toast.id) {\r\n <div class=\"alert alert-dismissible position-relative\" role=\"status\"\r\n [class.alert-primary]=\"toast.type===toastType.Primary\"\r\n [class.alert-success]=\"toast.type===toastType.Success\"\r\n [class.alert-warning]=\"toast.type===toastType.Warn\"\r\n [class.alert-danger]=\"toast.type===toastType.Danger\">\r\n\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n \r\n @if (toast.header) {\r\n <div class=\"d-flex align-items-center justify-content-between pb-1\">\r\n @if (!toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{toast.header|translate}}</div>\r\n }\r\n @if (toast.headerValue) {\r\n <div class=\"fw-bold pb-1\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n }\r\n </div>\r\n }\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n @if (!toast.messageValue) {\r\n <div>{{toast.message|translate}}</div>\r\n }\r\n @if (toast.messageValue) {\r\n <div>{{(toast.message|translate:toast.messageValue )}}</div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n</div>" }]
2036
+ }], ctorParameters: () => [{ type: AdbToastService }] });
1921
2037
 
1922
- const RICH_MODULE_CONFIG = new InjectionToken('richModule.config');
2038
+ class AdbToastModule {
2039
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2040
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, declarations: [AdbToast], imports: [CommonModule, AdbDirectivesModule, TranslatePipe], exports: [AdbToast] });
2041
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, providers: [AdbToastService], imports: [CommonModule, AdbDirectivesModule] });
2042
+ }
2043
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbToastModule, decorators: [{
2044
+ type: NgModule,
2045
+ args: [{
2046
+ imports: [CommonModule, AdbDirectivesModule, TranslatePipe],
2047
+ declarations: [AdbToast],
2048
+ exports: [AdbToast],
2049
+ providers: [AdbToastService]
2050
+ }]
2051
+ }] });
1923
2052
 
1924
- class RichTextComponent {
1925
- text = '';
1926
- parts = [];
1927
- taxonUrl;
1928
- constructor(config) {
1929
- this.taxonUrl = config.taxonUrl;
2053
+ class AdbHelpButtonComponent {
2054
+ elementRef;
2055
+ showHelp = false;
2056
+ buttonClassSignal = input('btn btn-invisible p-0', { ...(ngDevMode ? { debugName: "buttonClassSignal" } : /* istanbul ignore next */ {}), alias: 'buttonClass' });
2057
+ labelSignal = input('', { ...(ngDevMode ? { debugName: "labelSignal" } : /* istanbul ignore next */ {}), alias: 'label' });
2058
+ id;
2059
+ onClickDoc(event) {
2060
+ const target = event.target;
2061
+ const parent = target.parentElement;
2062
+ const clickedInside = this.elementRef.nativeElement.contains(parent);
2063
+ if (!clickedInside) {
2064
+ this.showHelp = false;
2065
+ }
1930
2066
  }
1931
- ngOnChanges() {
1932
- this.parts = this.text
1933
- ? this.parseCustomMarkdown(this.text)
1934
- : [];
2067
+ constructor(elementRef) {
2068
+ this.elementRef = elementRef;
1935
2069
  }
1936
- parseCustomMarkdown(input) {
1937
- const parts = [];
1938
- let i = 0;
1939
- const pushText = (text) => {
1940
- if (text) {
1941
- parts.push({ type: 'text', content: text });
1942
- }
1943
- };
1944
- while (i < input.length) {
1945
- if (input.startsWith('**', i) || input.startsWith('__', i)) {
1946
- const marker = input.slice(i, i + 2);
1947
- const end = input.indexOf(marker, i + 2);
1948
- if (end !== -1) {
1949
- parts.push({
1950
- type: 'bold',
1951
- content: input.slice(i + 2, end)
1952
- });
1953
- i = end + 2;
1954
- continue;
1955
- }
1956
- }
1957
- if (input[i] === '*' || input[i] === '_') {
1958
- const marker = input[i];
1959
- const end = input.indexOf(marker, i + 1);
1960
- if (end !== -1) {
1961
- parts.push({
1962
- type: 'italic',
1963
- content: input.slice(i + 1, end)
1964
- });
1965
- i = end + 1;
1966
- continue;
1967
- }
1968
- }
1969
- if (input[i] === '[') {
1970
- const textEnd = input.indexOf(']', i);
1971
- const linkStart = input.indexOf('(', textEnd);
1972
- const linkEnd = input.indexOf(')', linkStart);
1973
- if (textEnd !== -1 && linkStart !== -1 && linkEnd !== -1) {
1974
- const label = input.slice(i + 1, textEnd);
1975
- const link = input.slice(linkStart + 1, linkEnd);
1976
- const [type, id] = link.split(':');
1977
- if (type === 'taxon' || type === 'reference') {
1978
- parts.push({
1979
- type: type,
1980
- content: label,
1981
- id
1982
- });
1983
- i = linkEnd + 1;
1984
- continue;
1985
- }
1986
- }
1987
- }
1988
- let next = input.length;
1989
- for (const c of ['*', '_', '[']) {
1990
- const idx = input.indexOf(c, i + 1);
1991
- if (idx !== -1 && idx < next) {
1992
- next = idx;
1993
- }
2070
+ ngOnInit() {
2071
+ this.id = +Math.floor(Math.random() * Date.now());
2072
+ }
2073
+ onClose() {
2074
+ const node = this.elementRef.nativeElement.parentNode;
2075
+ if (node) {
2076
+ if (this.showHelp) {
2077
+ node.classList.remove('position-relative');
1994
2078
  }
1995
- if (next === input.length) {
1996
- pushText(input.slice(i));
1997
- break;
2079
+ else {
2080
+ node.classList.add('position-relative');
1998
2081
  }
1999
- pushText(input.slice(i, next));
2000
- i = next;
2001
2082
  }
2002
- return parts;
2083
+ this.showHelp = !this.showHelp;
2003
2084
  }
2004
- 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 });
2005
- 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>", changeDetection: i0.ChangeDetectionStrategy.Eager });
2085
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbHelpButtonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
2086
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: AdbHelpButtonComponent, isStandalone: false, selector: "adb-help-button", inputs: { buttonClassSignal: { classPropertyName: "buttonClassSignal", publicName: "buttonClass", isSignal: true, isRequired: false, transformFunction: null }, labelSignal: { classPropertyName: "labelSignal", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "onClickDoc($event)" } }, ngImport: i0, template: "<button type=\"button\"\r\n class=\"w-auto d-flex gap-1 align-items-baseline help-button\"\r\n [ngClass]=\"buttonClassSignal()\"\r\n [attr.aria-controls]=\"id\" aria-label=\"Help\"\r\n [attr.aria-expanded]=\"showHelp\" (click)=\"onClose()\">\r\n <span class=\"bi bi-question-circle-fill text-primary\"></span>\r\n {{labelSignal()}}\r\n</button>\r\n<div>\r\n @if (showHelp) {\r\n <div [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow fw-normal\" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div class=\"flex-grow-1\"><ng-content></ng-content></div>\r\n <div class=\"ms-auto align-self-start d-flex align-items-start\">\r\n <button type=\"button\" class=\"btn-close p-1\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"showHelp=false\"></button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n</div>", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2006
2087
  }
2007
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: RichTextComponent, decorators: [{
2088
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbHelpButtonComponent, decorators: [{
2008
2089
  type: Component,
2009
- 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>" }]
2010
- }], ctorParameters: () => [{ type: undefined, decorators: [{
2011
- type: Inject,
2012
- args: [RICH_MODULE_CONFIG]
2013
- }] }], propDecorators: { text: [{
2014
- type: Input
2090
+ args: [{ selector: 'adb-help-button', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<button type=\"button\"\r\n class=\"w-auto d-flex gap-1 align-items-baseline help-button\"\r\n [ngClass]=\"buttonClassSignal()\"\r\n [attr.aria-controls]=\"id\" aria-label=\"Help\"\r\n [attr.aria-expanded]=\"showHelp\" (click)=\"onClose()\">\r\n <span class=\"bi bi-question-circle-fill text-primary\"></span>\r\n {{labelSignal()}}\r\n</button>\r\n<div>\r\n @if (showHelp) {\r\n <div [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow fw-normal\" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div class=\"flex-grow-1\"><ng-content></ng-content></div>\r\n <div class=\"ms-auto align-self-start d-flex align-items-start\">\r\n <button type=\"button\" class=\"btn-close p-1\" data-bs-dismiss=\"modal\" aria-label=\"Close\" (click)=\"showHelp=false\"></button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n</div>" }]
2091
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { buttonClassSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonClass", required: false }] }], labelSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], onClickDoc: [{
2092
+ type: HostListener,
2093
+ args: ['document:click', ['$event']]
2015
2094
  }] } });
2016
2095
 
2017
- class AdbRichEditorModule {
2018
- static forRoot(config) {
2019
- return {
2020
- ngModule: AdbRichEditorModule,
2021
- providers: [
2022
- { provide: RICH_MODULE_CONFIG, useValue: config }
2023
- ]
2024
- };
2025
- }
2026
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2027
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, declarations: [AdbRichEditorComponent, RichTextComponent], imports: [CommonModule, FormsModule, TranslatePipe], exports: [AdbRichEditorComponent, RichTextComponent] });
2028
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, imports: [CommonModule, FormsModule] });
2096
+ class AdbButtonsModule {
2097
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2098
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, declarations: [AdbHelpButtonComponent], imports: [CommonModule, AdbDirectivesModule], exports: [AdbHelpButtonComponent] });
2099
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, imports: [CommonModule, AdbDirectivesModule] });
2029
2100
  }
2030
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbRichEditorModule, decorators: [{
2101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdbButtonsModule, decorators: [{
2031
2102
  type: NgModule,
2032
2103
  args: [{
2033
- imports: [CommonModule, FormsModule, TranslatePipe],
2034
- declarations: [AdbRichEditorComponent, RichTextComponent],
2035
- exports: [AdbRichEditorComponent, RichTextComponent]
2104
+ imports: [CommonModule, AdbDirectivesModule],
2105
+ declarations: [AdbHelpButtonComponent],
2106
+ exports: [AdbHelpButtonComponent]
2036
2107
  }]
2037
2108
  }] });
2038
2109
 
@@ -2045,7 +2116,7 @@ class FilterSectionComponent {
2045
2116
  templateSignal = contentChild(TemplateRef, ...(ngDevMode ? [{ debugName: "templateSignal" }] : /* istanbul ignore next */ []));
2046
2117
  id = `filter-section-${Math.floor(Math.random() * Date.now())}`;
2047
2118
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FilterSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2048
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FilterSectionComponent, isStandalone: false, selector: "adb-filter-section", inputs: { countSignal: { classPropertyName: "countSignal", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, titleResourceSignal: { classPropertyName: "titleResourceSignal", publicName: "titleResource", isSignal: true, isRequired: false, transformFunction: null }, helpResourceSignal: { classPropertyName: "helpResourceSignal", publicName: "helpResource", isSignal: true, isRequired: false, transformFunction: null }, lazySignal: { classPropertyName: "lazySignal", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, expandedSignal: { classPropertyName: "expandedSignal", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedSignal: "expandedChange" }, queries: [{ propertyName: "templateSignal", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<button [attr.aria-expanded]=\"expandedSignal()\" [attr.aria-controls]=\"id\" class=\"btn btn-invisible px-1\" type=\"button\" (click)=\"expandedSignal.update(value => !value)\">\r\n <div class=\"d-flex align-items-center gap-1 flex-wrap\">\r\n <div class=\"d-flex align-items-center gap-1\">\r\n <span [ngClass]=\"expandedSignal()? 'bi bi-chevron-down': 'bi bi-chevron-right'\"></span>\r\n @if (countSignal() > 0) {\r\n <div class=\"badge bg-primary\">{{ countSignal() }}</div>\r\n }\r\n {{ titleResourceSignal() | translate }}\r\n </div>\r\n @if (helpResourceSignal()) {\r\n <adb-help-button (click)=\"$event.stopPropagation()\">\r\n <adb-rich-text [text]=\"helpResourceSignal() | translate\"></adb-rich-text>\r\n </adb-help-button>\r\n }\r\n </div>\r\n</button>\r\n@if (expandedSignal()) {\r\n<div class=\"px-3 pb-3 border-bottom\" [id]=\"id\">\r\n @if (lazySignal() && templateSignal()) {\r\n <ng-container *ngTemplateOutlet=\"templateSignal()\"></ng-container>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</div>\r\n}", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AdbHelpButtonComponent, selector: "adb-help-button", inputs: ["buttonClass", "label"] }, { kind: "component", type: RichTextComponent, selector: "adb-rich-text", inputs: ["text"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2119
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FilterSectionComponent, isStandalone: false, selector: "adb-filter-section", inputs: { countSignal: { classPropertyName: "countSignal", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, titleResourceSignal: { classPropertyName: "titleResourceSignal", publicName: "titleResource", isSignal: true, isRequired: false, transformFunction: null }, helpResourceSignal: { classPropertyName: "helpResourceSignal", publicName: "helpResource", isSignal: true, isRequired: false, transformFunction: null }, lazySignal: { classPropertyName: "lazySignal", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, expandedSignal: { classPropertyName: "expandedSignal", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedSignal: "expandedChange" }, queries: [{ propertyName: "templateSignal", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<button [attr.aria-expanded]=\"expandedSignal()\" [attr.aria-controls]=\"id\" class=\"btn btn-invisible px-1\" type=\"button\" (click)=\"expandedSignal.update(value => !value)\">\r\n <div class=\"d-flex align-items-center gap-1 flex-wrap\">\r\n <div class=\"d-flex align-items-center gap-1\">\r\n <span [ngClass]=\"expandedSignal()? 'bi bi-chevron-down': 'bi bi-chevron-right'\"></span>\r\n @if (countSignal() > 0) {\r\n <div class=\"badge bg-primary\">{{ countSignal() }}</div>\r\n }\r\n {{ titleResourceSignal() | translate }}\r\n </div>\r\n @if (helpResourceSignal()) {\r\n <adb-help-button (click)=\"$event.stopPropagation()\">\r\n <adb-rich-text [text]=\"helpResourceSignal() | translate\"></adb-rich-text>\r\n </adb-help-button>\r\n }\r\n </div>\r\n</button>\r\n@if (expandedSignal()) {\r\n<div class=\"px-3 pb-3 border-bottom\" [id]=\"id\">\r\n @if (lazySignal() && templateSignal()) {\r\n <ng-container *ngTemplateOutlet=\"templateSignal()\"></ng-container>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</div>\r\n}", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AdbHelpButtonComponent, selector: "adb-help-button", inputs: ["buttonClass", "label"] }, { kind: "component", type: RichTextComponent, selector: "adb-rich-text", inputs: ["text"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2049
2120
  }
2050
2121
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FilterSectionComponent, decorators: [{
2051
2122
  type: Component,
@@ -2529,7 +2600,7 @@ class GenericPickerComponent {
2529
2600
  this.subs.unsubscribe();
2530
2601
  }
2531
2602
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: GenericPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2532
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: GenericPickerComponent, isStandalone: false, selector: "adb-generic-picker", inputs: { search: "search", displayFn: "displayFn", loadById: "loadById", disabled: "disabled", placeholder: "placeholder", initialValue: "initialValue" }, outputs: { selectItemChange: "selectItemChange", focus: "focus" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true }], ngImport: i0, template: "<div (adbClickOutside)=\"resetPopup()\">\r\n <div class=\"input-group\">\r\n <input [(ngModel)]=\"searchQuery\" class=\"form-control\" role=\"combobox\" aria-autocomplete=\"list\" [attr.aria-expanded]=\"showPop\" aria-controls=\"picker-listbox\" [disabled]=\"disabled\" autocomplete=\"off\" (keyup.arrowdown)=\"onArrowDown()\"\r\n (keyup.arrowup)=\"onArrowUp()\" (keydown.enter)=\"onEnter($event)\" (keydown.escape)=\"resetPopup()\" (keydown.tab)=\"resetPopup()\" (ngModelChange)=\"onModelChange()\" (focus)=\"focus.emit($event)\" [placeholder]=\"placeholder\" />\r\n @if (searchQuery && !showPop) {\r\n <div>\r\n <button type=\"button\" (click)=\"resetModel()\" class=\"btn btn-secondary border border-start-0\">\r\n <span class=\"bi bi-x\"></span>\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n</div>\r\n@let items = items$ | async;\r\n@if (showPop) {\r\n<div class=\"pop\">\r\n <div class=\"pop-body\">\r\n <div [class.loading]=\"loading\">\r\n @if (error) {\r\n <div class=\"alert alert-danger mb-0\">\r\n Serverfel\r\n </div>\r\n }\r\n @else {\r\n <ul class=\"list-group list-group-flush\" role=\"listbox\" id=\"picker-listbox\">\r\n @for (item of items; track item; let i = $index) {\r\n <li role=\"option\" class=\"list-group-item list-group-item-action pointer\" [class.active]=\"i === rowIndex\" (click)=\"$event.preventDefault(); $event.stopPropagation(); selectItem(item)\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item, searchQuery: searchQuery }\"></ng-container>\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n}", dependencies: [{ kind: "directive", type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { kind: "pipe", type: i1$3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2603
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: GenericPickerComponent, isStandalone: false, selector: "adb-generic-picker", inputs: { search: "search", displayFn: "displayFn", loadById: "loadById", disabled: "disabled", placeholder: "placeholder", initialValue: "initialValue" }, outputs: { selectItemChange: "selectItemChange", focus: "focus" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true }], ngImport: i0, template: "<div (adbClickOutside)=\"resetPopup()\">\r\n <div class=\"input-group\">\r\n <input [(ngModel)]=\"searchQuery\" class=\"form-control\" role=\"combobox\" aria-autocomplete=\"list\" [attr.aria-expanded]=\"showPop\" aria-controls=\"picker-listbox\" [disabled]=\"disabled\" autocomplete=\"off\" (keyup.arrowdown)=\"onArrowDown()\"\r\n (keyup.arrowup)=\"onArrowUp()\" (keydown.enter)=\"onEnter($event)\" (keydown.escape)=\"resetPopup()\" (keydown.tab)=\"resetPopup()\" (ngModelChange)=\"onModelChange()\" (focus)=\"focus.emit($event)\" [placeholder]=\"placeholder\" />\r\n @if (searchQuery && !showPop) {\r\n <div>\r\n <button type=\"button\" (click)=\"resetModel()\" class=\"btn btn-secondary border border-start-0\">\r\n <span class=\"bi bi-x\"></span>\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n</div>\r\n@let items = items$ | async;\r\n@if (showPop) {\r\n<div class=\"pop\">\r\n <div class=\"pop-body\">\r\n <div [class.loading]=\"loading\">\r\n @if (error) {\r\n <div class=\"alert alert-danger mb-0\">\r\n Serverfel\r\n </div>\r\n }\r\n @else {\r\n <ul class=\"list-group list-group-flush\" role=\"listbox\" id=\"picker-listbox\">\r\n @for (item of items; track item; let i = $index) {\r\n <li role=\"option\" class=\"list-group-item list-group-item-action pointer\" [class.active]=\"i === rowIndex\" (click)=\"$event.preventDefault(); $event.stopPropagation(); selectItem(item)\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item, searchQuery: searchQuery }\"></ng-container>\r\n </li>\r\n }\r\n </ul>\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n}", dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2533
2604
  }
2534
2605
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: GenericPickerComponent, decorators: [{
2535
2606
  type: Component,
@@ -2828,5 +2899,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
2828
2899
  * Generated bundle index. Do not edit.
2829
2900
  */
2830
2901
 
2831
- export { ADB_PICKER_CONFIG, ADB_USER_SERVICE_CONFIG, AdbAreaPickerComponent, AdbButtonsModule, AdbConfirmModal, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, AdbDirectivesModule, AdbDropdownDirective, AdbDropdownModule, AdbFilterSectionModule, AdbHelpButtonComponent, AdbModalModule, AdbModalService, AdbPagersModule, AdbPickerConfigService, AdbPickerModule, AdbPipesModule, AdbRichEditorComponent, AdbRichEditorModule, AdbTaxonPickerComponent, AdbToast, AdbToastModule, AdbToastService, AdbUserInterceptor, AdbUserModule, AdbUserService, ArtportalenFooterComponent, ArtportalenNavComponent, ArtportalenNavModule, AuthCallbackComponent, ClickOutsideDirective, DEFAULT_ADB_USER_SERVICE_CONFIG, EmptyValuePipe, EnvironmentService, FileUploadDirective, FilterSectionComponent, FocusDirective, GenericPickerComponent, HighlightHtmlPipe, HighlightPipe, ImageLoaderDirective, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent, PagerInlineComponent, RedListBadgeClassDirective, RichTextComponent, RiskClassDirective, RouterLinkActiveFragmentDirective, ToastType, UserModuleConstants };
2902
+ export { ADB_ALERT_CONFIG, ADB_PICKER_CONFIG, ADB_USER_SERVICE_CONFIG, AdbAlertComponent, AdbAlertModule, AdbAreaPickerComponent, AdbButtonsModule, AdbConfirmModal, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, AdbDirectivesModule, AdbDropdownDirective, AdbDropdownModule, AdbFilterSectionModule, AdbHelpButtonComponent, AdbModalModule, AdbModalService, AdbPagersModule, AdbPickerConfigService, AdbPickerModule, AdbPipesModule, AdbRichEditorComponent, AdbRichEditorModule, AdbTaxonPickerComponent, AdbToast, AdbToastModule, AdbToastService, AdbUserInterceptor, AdbUserModule, AdbUserService, ArtportalenFooterComponent, ArtportalenNavComponent, ArtportalenNavModule, AuthCallbackComponent, ClickOutsideDirective, DEFAULT_ADB_USER_SERVICE_CONFIG, EmptyValuePipe, EnvironmentService, FileUploadDirective, FilterSectionComponent, FocusDirective, GenericPickerComponent, HighlightHtmlPipe, HighlightPipe, ImageLoaderDirective, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent, PagerInlineComponent, RedListBadgeClassDirective, RichTextComponent, RiskClassDirective, RouterLinkActiveFragmentDirective, ToastType, UserModuleConstants };
2832
2903
  //# sourceMappingURL=adb-shared.mjs.map