adb-shared 1.0.21 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{esm2015/adb-shared.js → esm2020/adb-shared.mjs} +0 -0
- package/esm2020/lib/components/adb-header/adb-header.component.mjs +102 -0
- package/{esm2015/lib/components/adb-header/adb-header.module.js → esm2020/lib/components/adb-header/adb-header.module.mjs} +5 -5
- package/{esm2015/lib/components/adb-header/environment.service.js → esm2020/lib/components/adb-header/environment.service.mjs} +4 -4
- package/{esm2015/lib/components/adb-header/navigation.model.js → esm2020/lib/components/adb-header/navigation.model.mjs} +0 -0
- package/esm2020/lib/components/date-picker/adb-date-picker.component.mjs +137 -0
- package/esm2020/lib/components/date-picker/adb-date-picker.directive.mjs +117 -0
- package/esm2020/lib/components/date-picker/adb-date-picker.module.mjs +24 -0
- package/esm2020/lib/components/date-picker/adb-date-picker.service.mjs +28 -0
- package/{esm2015/lib/components/pagers/infinite-scroll.component.js → esm2020/lib/components/pagers/infinite-scroll.component.mjs} +4 -4
- package/{esm2015/lib/components/pagers/pager-base.directive.js → esm2020/lib/components/pagers/pager-base.directive.mjs} +4 -4
- package/esm2020/lib/components/pagers/pager.mjs +31 -0
- package/{esm2015/lib/components/pagers/pagers.module.js → esm2020/lib/components/pagers/pagers.module.mjs} +5 -5
- package/esm2020/lib/directives/click-outside.directive.mjs +28 -0
- package/{esm2015/lib/directives/directives.module.js → esm2020/lib/directives/directives.module.mjs} +5 -5
- package/{esm2015/lib/directives/focus.directive.js → esm2020/lib/directives/focus.directive.mjs} +4 -4
- package/esm2020/lib/pipes/date.pipe.mjs +22 -0
- package/{esm2015/lib/pipes/highlight.pipe.js → esm2020/lib/pipes/highlight.pipe.mjs} +4 -4
- package/{esm2015/lib/pipes/number-spacing.pipe.js → esm2020/lib/pipes/number-spacing.pipe.mjs} +4 -4
- package/esm2020/lib/pipes/pipes.module.mjs +19 -0
- package/esm2020/public-api.mjs +19 -0
- package/fesm2015/adb-shared.mjs +727 -0
- package/fesm2015/adb-shared.mjs.map +1 -0
- package/fesm2020/adb-shared.mjs +724 -0
- package/fesm2020/adb-shared.mjs.map +1 -0
- package/lib/components/date-picker/adb-date-picker.component.d.ts +54 -0
- package/lib/components/date-picker/adb-date-picker.directive.d.ts +33 -0
- package/lib/components/date-picker/adb-date-picker.module.d.ts +12 -0
- package/lib/components/date-picker/adb-date-picker.service.d.ts +20 -0
- package/lib/directives/click-outside.directive.d.ts +1 -1
- package/lib/pipes/date.pipe.d.ts +10 -0
- package/lib/pipes/pipes.module.d.ts +2 -1
- package/package.json +25 -11
- package/public-api.d.ts +4 -0
- package/bundles/adb-shared.umd.js +0 -831
- package/bundles/adb-shared.umd.js.map +0 -1
- package/esm2015/lib/components/adb-header/adb-header.component.js +0 -104
- package/esm2015/lib/components/pagers/pager.js +0 -34
- package/esm2015/lib/directives/click-outside.directive.js +0 -28
- package/esm2015/lib/pipes/pipes.module.js +0 -18
- package/esm2015/public-api.js +0 -15
- package/fesm2015/adb-shared.js +0 -432
- package/fesm2015/adb-shared.js.map +0 -1
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
import * as i3$1 from '@angular/common';
|
|
2
|
+
import { CommonModule, DatePipe, formatDate } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, Inject, EventEmitter, Component, Output, Input, Directive, HostListener, NgModule, HostBinding, Pipe, forwardRef } from '@angular/core';
|
|
5
|
+
import * as i3 from '@ngx-translate/core';
|
|
6
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
7
|
+
import { Subscription, Subject, BehaviorSubject } from 'rxjs';
|
|
8
|
+
import * as i1 from '@angular/common/http';
|
|
9
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
10
|
+
import * as i1$1 from '@angular/router';
|
|
11
|
+
import { RouterModule } from '@angular/router';
|
|
12
|
+
import { startOfDay, endOfDay, subYears, subMonths, addYears, addMonths, getMonth, isSameYear, startOfMonth, endOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isWithinInterval, isSameDay, isValid, parseISO } from 'date-fns';
|
|
13
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
14
|
+
|
|
15
|
+
class EnvironmentService {
|
|
16
|
+
constructor(environment) {
|
|
17
|
+
this.environment = environment;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** @nocollapse */ EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: EnvironmentService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
21
|
+
/** @nocollapse */ EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: EnvironmentService });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: EnvironmentService, decorators: [{
|
|
23
|
+
type: Injectable
|
|
24
|
+
}], ctorParameters: function () {
|
|
25
|
+
return [{ type: undefined, decorators: [{
|
|
26
|
+
type: Inject,
|
|
27
|
+
args: ['env']
|
|
28
|
+
}] }];
|
|
29
|
+
} });
|
|
30
|
+
|
|
31
|
+
class ADBHeaderComponent {
|
|
32
|
+
constructor(httpClient, envService, trans) {
|
|
33
|
+
this.httpClient = httpClient;
|
|
34
|
+
this.envService = envService;
|
|
35
|
+
this.trans = trans;
|
|
36
|
+
this.subscription = new Subscription();
|
|
37
|
+
this.loginClicked = new EventEmitter();
|
|
38
|
+
this.logoutClicked = new EventEmitter();
|
|
39
|
+
this.dropMenuChange = new EventEmitter();
|
|
40
|
+
this.translationFinished = false;
|
|
41
|
+
this.showMenu = false;
|
|
42
|
+
this.showUserMenu = false;
|
|
43
|
+
}
|
|
44
|
+
set userName(fullName) {
|
|
45
|
+
this.fullName = fullName;
|
|
46
|
+
const splitted = fullName.split(' ');
|
|
47
|
+
if ((splitted === null || splitted === void 0 ? void 0 : splitted.length) > 1) {
|
|
48
|
+
const initials = splitted.shift().charAt(0) + splitted.pop().charAt(0);
|
|
49
|
+
this.initials = initials.toUpperCase();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.initials = this.fullName ? this.fullName.charAt(0).toUpperCase() : this.fullName;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
ngOnInit() {
|
|
57
|
+
this.url = window.location.href;
|
|
58
|
+
const baseUrl = this.envService.environment.resourceUrl;
|
|
59
|
+
this.subscription.add(this.httpClient.get(baseUrl + '/assets/links.json').subscribe(result => {
|
|
60
|
+
this.navigation = result;
|
|
61
|
+
}));
|
|
62
|
+
this.initTranslations(baseUrl);
|
|
63
|
+
}
|
|
64
|
+
initTranslations(baseUrl) {
|
|
65
|
+
if (this.trans.store.translations[this.trans.currentLang]) {
|
|
66
|
+
this.loadTranslation(baseUrl, this.trans.currentLang);
|
|
67
|
+
}
|
|
68
|
+
this.subscription.add(this.trans.onLangChange.subscribe((event) => {
|
|
69
|
+
this.translationFinished = false;
|
|
70
|
+
this.loadTranslation(baseUrl, event.lang);
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
loadTranslation(baseUrl, lang) {
|
|
74
|
+
//TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
|
|
75
|
+
this.subscription.add(this.httpClient.get(baseUrl + `/assets/i18n/${lang}.json`).subscribe(translations => {
|
|
76
|
+
this.trans.setTranslation(lang, translations, true);
|
|
77
|
+
this.translationFinished = true;
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
showMenuDropdown(show) {
|
|
81
|
+
if (this.showMenu !== show) {
|
|
82
|
+
this.showMenu = show;
|
|
83
|
+
this.dropMenuChange.emit(show);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
setLanguage(lang) {
|
|
87
|
+
this.trans.use(lang);
|
|
88
|
+
this.showMenu = false;
|
|
89
|
+
this.dropMenuChange.emit(false);
|
|
90
|
+
//TODO: set localstorage/cookies or probaly event to main app
|
|
91
|
+
}
|
|
92
|
+
onExpandLink(event, transId) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
if (this.expandedLink === transId) {
|
|
96
|
+
this.expandedLink = null;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.expandedLink = transId;
|
|
100
|
+
}
|
|
101
|
+
login() {
|
|
102
|
+
this.loginClicked.emit();
|
|
103
|
+
}
|
|
104
|
+
logout() {
|
|
105
|
+
this.logoutClicked.emit();
|
|
106
|
+
}
|
|
107
|
+
ngOnDestroy() {
|
|
108
|
+
this.subscription.unsubscribe();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** @nocollapse */ ADBHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ADBHeaderComponent, deps: [{ token: i1.HttpClient }, { token: EnvironmentService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
112
|
+
/** @nocollapse */ ADBHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: ADBHeaderComponent, selector: "adb-header2", inputs: { userName: "userName" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0, template: "<header id=\"top-header\" (clickOutside)=\"showUserMenu=false;showMenuDropdown(false);\">\r\n <nav class=\"d-flex flex-wrap px-3\">\r\n <div class=\"flex-grow-1 d-flex align-items-center justify-content-between justify-content-md-start\">\r\n <div class=\"logo d-none d-md-block\">\r\n <img src=\"/assets/images/logo.svg\" style=\"height: 3.2rem;\">\r\n </div>\r\n <div class=\"logo ps-2 d-sm-block d-md-none d-flex align-items-center\">\r\n <img src=\"/assets/images/logo_sm_white.png\" style=\"height: 2rem;\">\r\n </div>\r\n <strong class=\"bigger\">{{'ADB_HEADER.TITLE'|translate}}</strong>\r\n </div>\r\n <div *ngIf=\"translationFinished\" class=\"flex-grow-1 d-flex justify-content-lg-between justify-content-end align-items-center\">\r\n <div *ngIf=\"navigation\" class=\"d-flex align-items-center\">\r\n <nav class=\"d-none align-items-center d-lg-flex pe-4 gap-4\" *ngIf=\"navigation\">\r\n <ng-container *ngFor=\"let link of navigation.links\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" *ngIf=\"link.topLink\" [ngClass]=\"{'d-none d-xl-block':link.transId==='ADB_HEADER.OBSERVATION'}\">\r\n {{link.transId|translate}}\r\n </a>\r\n </ng-container>\r\n </nav>\r\n <div>\r\n <button type=\"button\" class=\"btn btn-sm py-1 px-2 btn-primary\" (click)=\"showUserMenu = false;showMenuDropdown(!showMenu)\">\r\n {{'ADB_HEADER.MENY'|translate}}\r\n <i class=\"ms-1 fas\" [ngClass]=\"showMenu?'fa-chevron-up':'fa-chevron-down'\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"d-none d-md-block ps-4\">\r\n <button *ngIf=\"initials\" type=\"button\" class=\"btn initials\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\">{{initials}}</button>\r\n <button *ngIf=\"!initials\" type=\"button\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\" class=\"btn btn-link\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n </nav>\r\n <div class=\"menu\" *ngIf=\"showUserMenu\">\r\n <div class=\"menu-body bg-white p-3\" style=\"width:15rem\">\r\n <ng-container *ngIf=\"initials\">\r\n <div class=\"d-flex align-items-center gap-2 text-dark\">\r\n <span class=\"initials\">{{initials}}</span>\r\n <strong>{{fullName}}</strong>\r\n </div>\r\n <hr class=\"mx-n3 text-muted\">\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-link p-0\">\r\n <i class=\"fas fa-sign-out-alt me-1\"></i>{{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"d-flex justify-content-center\">\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"d-block mt-3\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"menu\" *ngIf=\"showMenu\">\r\n <div class=\"menu-body\" *ngIf=\"navigation\">\r\n <div class=\"px-3 pt-3 mb-1\">\r\n <div class=\"d-flex justify-content-between flex-wrap gap-2 mb-2\">\r\n <div>\r\n <div class=\"d-flex d-md-none align-items-center gap-2\" *ngIf=\"initials\">\r\n <span class=\"initials me-2\">{{initials}}</span>\r\n <button type=\"button\" (click)=\"logout()\" class=\"btn btn-primary\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div class=\"d-flex gap-2 d-md-none\" *ngIf=\"!initials\">\r\n <button type=\"button\" (click)=\"login()\" class=\"btn btn-primary\" id=\"login\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n <a href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\"\r\n class=\"btn btn-primary text-white\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='en'\" (click)=\"setLanguage('sv')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_SWEDISH'|translate}}\r\n </button>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='sv'\" (click)=\"setLanguage('en')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_ENGLISH'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n {{'ADB_HEADER.SERVICES'|translate}}\r\n </div>\r\n <div id=\"splash\">\r\n <div class=\"px-3 d-flex flex-column\">\r\n <ul class=\"list-group ms-0 mb-0 ps-0\">\r\n <li class=\"mb-1 list-group-item p-0 rounded\" *ngFor=\"let link of navigation.links\"\r\n [attr.aria-expanded]=\"link.transId===expandedLink?true:false\" role=\"button\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" class=\"d-flex align-items-center flex-grow-1 p-2\">\r\n <small class=\"fa-stack me-1\" *ngIf=\"link.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"link.icon\"></span>\r\n </small>\r\n {{link.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-expand me-2\" *ngIf=\"link.children?.length>0\" (click)=\"onExpandLink($event,link.transId)\">\r\n <i class=\"fas fa-chevron-up\" [ngClass]=\"link.transId===expandedLink?'d-block ':'d-none'\"></i>\r\n <i class=\"fas fa-chevron-down\" [ngClass]=\"link.transId!==expandedLink?'d-block ':'d-none'\"></i>\r\n </button>\r\n </div>\r\n <ul class=\"list-unstyled\" [ngClass]=\"link.transId===expandedLink?'d-block':'d-none'\">\r\n <li class=\"py-1 m-0\" [class.pt-0]=\"first\" *ngFor=\"let subLink of link.children;let first = first\" style=\"padding-left:3rem;\">\r\n <a class=\"w-100 d-block\" href=\"{{subLink.url}}?lang={{trans.currentLang}}\">\r\n {{subLink.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n <div *ngIf=\"navigation.about\" class=\"mt-2 mb-auto\">\r\n <div class=\"mb-1\">{{'ADB_HEADER.CONTACT'|translate}}</div>\r\n <div class=\"mb-1 row\">\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse fa-envelope\"></span>\r\n </small>\r\n <a class=\"bg-white p-2\" href=\"mailto:artfakta@artdatabanken.se\">artfakta@artdatabanken.se</a>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"navigation.about.icon\"></span>\r\n </small>\r\n <a [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div style=\"height:10rem\"></div>\r\n <div class=\"mb-3\">\r\n {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u>{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u></a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</header>\r\n", directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "translate": i3.TranslatePipe } });
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ADBHeaderComponent, decorators: [{
|
|
114
|
+
type: Component,
|
|
115
|
+
args: [{ selector: 'adb-header2', template: "<header id=\"top-header\" (clickOutside)=\"showUserMenu=false;showMenuDropdown(false);\">\r\n <nav class=\"d-flex flex-wrap px-3\">\r\n <div class=\"flex-grow-1 d-flex align-items-center justify-content-between justify-content-md-start\">\r\n <div class=\"logo d-none d-md-block\">\r\n <img src=\"/assets/images/logo.svg\" style=\"height: 3.2rem;\">\r\n </div>\r\n <div class=\"logo ps-2 d-sm-block d-md-none d-flex align-items-center\">\r\n <img src=\"/assets/images/logo_sm_white.png\" style=\"height: 2rem;\">\r\n </div>\r\n <strong class=\"bigger\">{{'ADB_HEADER.TITLE'|translate}}</strong>\r\n </div>\r\n <div *ngIf=\"translationFinished\" class=\"flex-grow-1 d-flex justify-content-lg-between justify-content-end align-items-center\">\r\n <div *ngIf=\"navigation\" class=\"d-flex align-items-center\">\r\n <nav class=\"d-none align-items-center d-lg-flex pe-4 gap-4\" *ngIf=\"navigation\">\r\n <ng-container *ngFor=\"let link of navigation.links\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" *ngIf=\"link.topLink\" [ngClass]=\"{'d-none d-xl-block':link.transId==='ADB_HEADER.OBSERVATION'}\">\r\n {{link.transId|translate}}\r\n </a>\r\n </ng-container>\r\n </nav>\r\n <div>\r\n <button type=\"button\" class=\"btn btn-sm py-1 px-2 btn-primary\" (click)=\"showUserMenu = false;showMenuDropdown(!showMenu)\">\r\n {{'ADB_HEADER.MENY'|translate}}\r\n <i class=\"ms-1 fas\" [ngClass]=\"showMenu?'fa-chevron-up':'fa-chevron-down'\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"d-none d-md-block ps-4\">\r\n <button *ngIf=\"initials\" type=\"button\" class=\"btn initials\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\">{{initials}}</button>\r\n <button *ngIf=\"!initials\" type=\"button\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\" class=\"btn btn-link\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n </nav>\r\n <div class=\"menu\" *ngIf=\"showUserMenu\">\r\n <div class=\"menu-body bg-white p-3\" style=\"width:15rem\">\r\n <ng-container *ngIf=\"initials\">\r\n <div class=\"d-flex align-items-center gap-2 text-dark\">\r\n <span class=\"initials\">{{initials}}</span>\r\n <strong>{{fullName}}</strong>\r\n </div>\r\n <hr class=\"mx-n3 text-muted\">\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-link p-0\">\r\n <i class=\"fas fa-sign-out-alt me-1\"></i>{{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"d-flex justify-content-center\">\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"d-block mt-3\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"menu\" *ngIf=\"showMenu\">\r\n <div class=\"menu-body\" *ngIf=\"navigation\">\r\n <div class=\"px-3 pt-3 mb-1\">\r\n <div class=\"d-flex justify-content-between flex-wrap gap-2 mb-2\">\r\n <div>\r\n <div class=\"d-flex d-md-none align-items-center gap-2\" *ngIf=\"initials\">\r\n <span class=\"initials me-2\">{{initials}}</span>\r\n <button type=\"button\" (click)=\"logout()\" class=\"btn btn-primary\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div class=\"d-flex gap-2 d-md-none\" *ngIf=\"!initials\">\r\n <button type=\"button\" (click)=\"login()\" class=\"btn btn-primary\" id=\"login\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n <a href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\"\r\n class=\"btn btn-primary text-white\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='en'\" (click)=\"setLanguage('sv')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_SWEDISH'|translate}}\r\n </button>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='sv'\" (click)=\"setLanguage('en')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_ENGLISH'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n {{'ADB_HEADER.SERVICES'|translate}}\r\n </div>\r\n <div id=\"splash\">\r\n <div class=\"px-3 d-flex flex-column\">\r\n <ul class=\"list-group ms-0 mb-0 ps-0\">\r\n <li class=\"mb-1 list-group-item p-0 rounded\" *ngFor=\"let link of navigation.links\"\r\n [attr.aria-expanded]=\"link.transId===expandedLink?true:false\" role=\"button\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <a href=\"{{link.url}}?lang={{trans.currentLang}}\" class=\"d-flex align-items-center flex-grow-1 p-2\">\r\n <small class=\"fa-stack me-1\" *ngIf=\"link.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"link.icon\"></span>\r\n </small>\r\n {{link.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-expand me-2\" *ngIf=\"link.children?.length>0\" (click)=\"onExpandLink($event,link.transId)\">\r\n <i class=\"fas fa-chevron-up\" [ngClass]=\"link.transId===expandedLink?'d-block ':'d-none'\"></i>\r\n <i class=\"fas fa-chevron-down\" [ngClass]=\"link.transId!==expandedLink?'d-block ':'d-none'\"></i>\r\n </button>\r\n </div>\r\n <ul class=\"list-unstyled\" [ngClass]=\"link.transId===expandedLink?'d-block':'d-none'\">\r\n <li class=\"py-1 m-0\" [class.pt-0]=\"first\" *ngFor=\"let subLink of link.children;let first = first\" style=\"padding-left:3rem;\">\r\n <a class=\"w-100 d-block\" href=\"{{subLink.url}}?lang={{trans.currentLang}}\">\r\n {{subLink.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n <div *ngIf=\"navigation.about\" class=\"mt-2 mb-auto\">\r\n <div class=\"mb-1\">{{'ADB_HEADER.CONTACT'|translate}}</div>\r\n <div class=\"mb-1 row\">\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse fa-envelope\"></span>\r\n </small>\r\n <a class=\"bg-white p-2\" href=\"mailto:artfakta@artdatabanken.se\">artfakta@artdatabanken.se</a>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2 rounded\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"navigation.about.icon\"></span>\r\n </small>\r\n <a [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div style=\"height:10rem\"></div>\r\n <div class=\"mb-3\">\r\n {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u>{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u></a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</header>\r\n" }]
|
|
116
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EnvironmentService }, { type: i3.TranslateService }]; }, propDecorators: { loginClicked: [{
|
|
117
|
+
type: Output
|
|
118
|
+
}], logoutClicked: [{
|
|
119
|
+
type: Output
|
|
120
|
+
}], dropMenuChange: [{
|
|
121
|
+
type: Output
|
|
122
|
+
}], userName: [{
|
|
123
|
+
type: Input
|
|
124
|
+
}] } });
|
|
125
|
+
|
|
126
|
+
class ClickOutsideDirective {
|
|
127
|
+
constructor(elementRef) {
|
|
128
|
+
this.elementRef = elementRef;
|
|
129
|
+
this.adbClickOutside = new EventEmitter();
|
|
130
|
+
}
|
|
131
|
+
onClick(target) {
|
|
132
|
+
const clickedInside = this.elementRef.nativeElement.contains(target);
|
|
133
|
+
if (!clickedInside) {
|
|
134
|
+
this.adbClickOutside.emit(target);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** @nocollapse */ ClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
139
|
+
/** @nocollapse */ ClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: { adbClickOutside: "adbClickOutside" }, host: { listeners: { "document:click": "onClick($event.target)" } }, ngImport: i0 });
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ClickOutsideDirective, decorators: [{
|
|
141
|
+
type: Directive,
|
|
142
|
+
args: [{
|
|
143
|
+
selector: '[adbClickOutside]',
|
|
144
|
+
}]
|
|
145
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { adbClickOutside: [{
|
|
146
|
+
type: Output
|
|
147
|
+
}], onClick: [{
|
|
148
|
+
type: HostListener,
|
|
149
|
+
args: ['document:click', ['$event.target']]
|
|
150
|
+
}] } });
|
|
151
|
+
|
|
152
|
+
/* eslint-disable @angular-eslint/directive-selector */
|
|
153
|
+
class FocusDirective {
|
|
154
|
+
constructor(element) {
|
|
155
|
+
this.element = element;
|
|
156
|
+
this.focused = false;
|
|
157
|
+
}
|
|
158
|
+
ngAfterViewInit() {
|
|
159
|
+
// ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
|
|
160
|
+
if (this.focused) {
|
|
161
|
+
setTimeout(() => this.element.nativeElement.focus(), 0);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** @nocollapse */ FocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: FocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
166
|
+
/** @nocollapse */ FocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: FocusDirective, selector: "[adbFocus]", inputs: { focused: ["adbFocus", "focused"] }, ngImport: i0 });
|
|
167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: FocusDirective, decorators: [{
|
|
168
|
+
type: Directive,
|
|
169
|
+
args: [{
|
|
170
|
+
selector: '[adbFocus]',
|
|
171
|
+
}]
|
|
172
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { focused: [{
|
|
173
|
+
type: Input,
|
|
174
|
+
args: ['adbFocus']
|
|
175
|
+
}] } });
|
|
176
|
+
|
|
177
|
+
class DirectivesModule {
|
|
178
|
+
}
|
|
179
|
+
/** @nocollapse */ DirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
180
|
+
/** @nocollapse */ DirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DirectivesModule, declarations: [ClickOutsideDirective, FocusDirective], exports: [ClickOutsideDirective, FocusDirective] });
|
|
181
|
+
/** @nocollapse */ DirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DirectivesModule, imports: [[]] });
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: DirectivesModule, decorators: [{
|
|
183
|
+
type: NgModule,
|
|
184
|
+
args: [{
|
|
185
|
+
imports: [],
|
|
186
|
+
declarations: [ClickOutsideDirective, FocusDirective],
|
|
187
|
+
exports: [ClickOutsideDirective, FocusDirective]
|
|
188
|
+
}]
|
|
189
|
+
}] });
|
|
190
|
+
|
|
191
|
+
class ADBHeaderModule {
|
|
192
|
+
static forRoot(environment) {
|
|
193
|
+
return {
|
|
194
|
+
ngModule: ADBHeaderModule,
|
|
195
|
+
providers: [
|
|
196
|
+
EnvironmentService,
|
|
197
|
+
{
|
|
198
|
+
provide: 'env',
|
|
199
|
+
useValue: environment
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** @nocollapse */ ADBHeaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ADBHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
206
|
+
/** @nocollapse */ ADBHeaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ADBHeaderModule, declarations: [ADBHeaderComponent], imports: [CommonModule,
|
|
207
|
+
HttpClientModule,
|
|
208
|
+
RouterModule,
|
|
209
|
+
TranslateModule,
|
|
210
|
+
DirectivesModule], exports: [ADBHeaderComponent] });
|
|
211
|
+
/** @nocollapse */ ADBHeaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ADBHeaderModule, imports: [[
|
|
212
|
+
CommonModule,
|
|
213
|
+
HttpClientModule,
|
|
214
|
+
RouterModule,
|
|
215
|
+
TranslateModule,
|
|
216
|
+
DirectivesModule
|
|
217
|
+
]] });
|
|
218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ADBHeaderModule, decorators: [{
|
|
219
|
+
type: NgModule,
|
|
220
|
+
args: [{
|
|
221
|
+
declarations: [ADBHeaderComponent],
|
|
222
|
+
imports: [
|
|
223
|
+
CommonModule,
|
|
224
|
+
HttpClientModule,
|
|
225
|
+
RouterModule,
|
|
226
|
+
TranslateModule,
|
|
227
|
+
DirectivesModule
|
|
228
|
+
],
|
|
229
|
+
exports: [ADBHeaderComponent]
|
|
230
|
+
}]
|
|
231
|
+
}] });
|
|
232
|
+
|
|
233
|
+
class InfiniteScrollComponent {
|
|
234
|
+
constructor(_element) {
|
|
235
|
+
this._element = _element;
|
|
236
|
+
this.onVisible = new EventEmitter();
|
|
237
|
+
this.height = '1px';
|
|
238
|
+
this.checkForIntersection = (entries) => {
|
|
239
|
+
entries.forEach((entry) => {
|
|
240
|
+
const isIntersecting = entry.isIntersecting &&
|
|
241
|
+
entry.target === this._element.nativeElement;
|
|
242
|
+
if (isIntersecting) {
|
|
243
|
+
this.onVisible.emit();
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
ngAfterViewInit() {
|
|
249
|
+
this._intersectionObserver = new IntersectionObserver(entries => {
|
|
250
|
+
this.checkForIntersection(entries);
|
|
251
|
+
}, {});
|
|
252
|
+
this._intersectionObserver.observe(this._element.nativeElement);
|
|
253
|
+
}
|
|
254
|
+
ngOnDestroy() {
|
|
255
|
+
if (this._intersectionObserver) {
|
|
256
|
+
this._intersectionObserver.disconnect();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/** @nocollapse */ InfiniteScrollComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: InfiniteScrollComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
261
|
+
/** @nocollapse */ InfiniteScrollComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: InfiniteScrollComponent, selector: "[onVisible]", outputs: { onVisible: "onVisible" }, host: { properties: { "style.height": "this.height" } }, ngImport: i0 });
|
|
262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: InfiniteScrollComponent, decorators: [{
|
|
263
|
+
type: Directive,
|
|
264
|
+
args: [{ selector: "[onVisible]" }]
|
|
265
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onVisible: [{
|
|
266
|
+
type: Output
|
|
267
|
+
}], height: [{
|
|
268
|
+
type: HostBinding,
|
|
269
|
+
args: ['style.height']
|
|
270
|
+
}] } });
|
|
271
|
+
|
|
272
|
+
class PagerBaseDirective {
|
|
273
|
+
constructor() {
|
|
274
|
+
this.limit = PagerBaseDirective.DEFAULT_LIMIT;
|
|
275
|
+
this.currentPage = 1;
|
|
276
|
+
}
|
|
277
|
+
calculatePages() {
|
|
278
|
+
this.amountOfPages = Math.ceil(this.totalCount / this.limit);
|
|
279
|
+
if ((this.currentPage + 1) > PagerBaseDirective.VISIBLE_PAGES) {
|
|
280
|
+
this.pages = [
|
|
281
|
+
this.currentPage - 2,
|
|
282
|
+
this.currentPage - 1, this.currentPage
|
|
283
|
+
];
|
|
284
|
+
const above = this.amountOfPages - this.currentPage;
|
|
285
|
+
if (above >= 1) {
|
|
286
|
+
this.pages.push(this.currentPage + 1);
|
|
287
|
+
}
|
|
288
|
+
if (above >= 2) {
|
|
289
|
+
this.pages.push(this.currentPage + 2);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else if (this.totalCount) {
|
|
293
|
+
const max = this.amountOfPages > PagerBaseDirective.VISIBLE_PAGES ? 5 : this.amountOfPages;
|
|
294
|
+
this.pages = Array(Math.ceil(max)).fill(1).map((x, i) => i + 1);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
PagerBaseDirective.DEFAULT_LIMIT = 10;
|
|
299
|
+
PagerBaseDirective.VISIBLE_PAGES = 5;
|
|
300
|
+
PagerBaseDirective.SKIP_RESOURCE = 'offset';
|
|
301
|
+
/** @nocollapse */ PagerBaseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagerBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
302
|
+
/** @nocollapse */ PagerBaseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: PagerBaseDirective, inputs: { totalCount: "totalCount", limit: "limit" }, ngImport: i0 });
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagerBaseDirective, decorators: [{
|
|
304
|
+
type: Directive
|
|
305
|
+
}], propDecorators: { totalCount: [{
|
|
306
|
+
type: Input
|
|
307
|
+
}], limit: [{
|
|
308
|
+
type: Input
|
|
309
|
+
}] } });
|
|
310
|
+
|
|
311
|
+
class PagerComponent extends PagerBaseDirective {
|
|
312
|
+
constructor(activatedRoute) {
|
|
313
|
+
super();
|
|
314
|
+
this.activatedRoute = activatedRoute;
|
|
315
|
+
this.subscription = new Subscription();
|
|
316
|
+
}
|
|
317
|
+
ngOnInit() {
|
|
318
|
+
this.subscription.add(this.activatedRoute.queryParams.subscribe(params => {
|
|
319
|
+
if (params.offset) {
|
|
320
|
+
this.currentPage = (+params.offset / this.limit) + 1;
|
|
321
|
+
}
|
|
322
|
+
this.calculatePages();
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
ngOnDestroy() {
|
|
326
|
+
this.subscription.unsubscribe();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/** @nocollapse */ PagerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagerComponent, deps: [{ token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
330
|
+
/** @nocollapse */ PagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: PagerComponent, selector: "adb-pager-nav", usesInheritance: true, ngImport: i0, template: "<nav *ngIf=\"pages&&pages.length>1&¤tPage<=amountOfPages\" class=\"d-flex justify-content-end pe-2 my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\" [class.disabled]=\"currentPage===1\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: 0}\" queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage===1\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (currentPage-2)*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage===page\" *ngFor=\"let page of pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (page-1)*limit}\"\r\n queryParamsHandling=\"merge\">{{page}}</a>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage>=amountOfPages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: currentPage*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\" [class.disabled]=\"currentPage>=amountOfPages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (amountOfPages-1)*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>", directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagerComponent, decorators: [{
|
|
332
|
+
type: Component,
|
|
333
|
+
args: [{ selector: 'adb-pager-nav', template: "<nav *ngIf=\"pages&&pages.length>1&¤tPage<=amountOfPages\" class=\"d-flex justify-content-end pe-2 my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\" [class.disabled]=\"currentPage===1\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: 0}\" queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage===1\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (currentPage-2)*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage===page\" *ngFor=\"let page of pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (page-1)*limit}\"\r\n queryParamsHandling=\"merge\">{{page}}</a>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage>=amountOfPages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: currentPage*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\" [class.disabled]=\"currentPage>=amountOfPages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"{ offset: (amountOfPages-1)*limit}\"\r\n queryParamsHandling=\"merge\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>" }]
|
|
334
|
+
}], ctorParameters: function () { return [{ type: i1$1.ActivatedRoute }]; } });
|
|
335
|
+
|
|
336
|
+
class PagersModule {
|
|
337
|
+
}
|
|
338
|
+
/** @nocollapse */ PagersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
339
|
+
/** @nocollapse */ PagersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagersModule, declarations: [InfiniteScrollComponent, PagerComponent], imports: [CommonModule,
|
|
340
|
+
RouterModule], exports: [InfiniteScrollComponent, PagerComponent] });
|
|
341
|
+
/** @nocollapse */ PagersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagersModule, imports: [[
|
|
342
|
+
CommonModule,
|
|
343
|
+
RouterModule
|
|
344
|
+
]] });
|
|
345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PagersModule, decorators: [{
|
|
346
|
+
type: NgModule,
|
|
347
|
+
args: [{
|
|
348
|
+
imports: [
|
|
349
|
+
CommonModule,
|
|
350
|
+
RouterModule
|
|
351
|
+
],
|
|
352
|
+
declarations: [InfiniteScrollComponent, PagerComponent],
|
|
353
|
+
exports: [InfiniteScrollComponent, PagerComponent]
|
|
354
|
+
}]
|
|
355
|
+
}] });
|
|
356
|
+
|
|
357
|
+
class LocaleDatePipe {
|
|
358
|
+
constructor(translate) {
|
|
359
|
+
this.translate = translate;
|
|
360
|
+
}
|
|
361
|
+
transform(value, format) {
|
|
362
|
+
return new DatePipe(this.translate.currentLang).transform(value, format, null, this.translate.currentLang);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/** @nocollapse */ LocaleDatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: LocaleDatePipe, deps: [{ token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
366
|
+
/** @nocollapse */ LocaleDatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: LocaleDatePipe, name: "adbLocaleDate", pure: false });
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: LocaleDatePipe, decorators: [{
|
|
368
|
+
type: Pipe,
|
|
369
|
+
args: [{
|
|
370
|
+
name: 'adbLocaleDate',
|
|
371
|
+
pure: false
|
|
372
|
+
}]
|
|
373
|
+
}], ctorParameters: function () { return [{ type: i3.TranslateService }]; } });
|
|
374
|
+
|
|
375
|
+
class HighlightPipe {
|
|
376
|
+
constructor() {
|
|
377
|
+
this.format = /[`!@#$%*\\()_+\-=\[\]{};':"\\|,<>\/?~]/g;
|
|
378
|
+
}
|
|
379
|
+
transform(value, searchs) {
|
|
380
|
+
if (!value) {
|
|
381
|
+
return value;
|
|
382
|
+
}
|
|
383
|
+
if (searchs) {
|
|
384
|
+
if (!Array.isArray(searchs)) {
|
|
385
|
+
searchs = searchs.split(' ').filter((s) => s);
|
|
386
|
+
}
|
|
387
|
+
for (let search of searchs) {
|
|
388
|
+
if (this.format.test(search)) {
|
|
389
|
+
search = search.replace(this.format, '');
|
|
390
|
+
}
|
|
391
|
+
const reText = new RegExp(search, 'gi');
|
|
392
|
+
value = value.replace(reText, '<mark>$&</mark>');
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return value;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/** @nocollapse */ HighlightPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: HighlightPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
399
|
+
/** @nocollapse */ HighlightPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: HighlightPipe, name: "adbHighlight" });
|
|
400
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: HighlightPipe, decorators: [{
|
|
401
|
+
type: Pipe,
|
|
402
|
+
args: [{
|
|
403
|
+
name: 'adbHighlight'
|
|
404
|
+
}]
|
|
405
|
+
}] });
|
|
406
|
+
|
|
407
|
+
class NumberSpacingPipe {
|
|
408
|
+
transform(value) {
|
|
409
|
+
// If value is empty, 0 is falsy so perform an extra check to not make '0' to an empty string
|
|
410
|
+
if (!value && value !== 0) {
|
|
411
|
+
return '';
|
|
412
|
+
}
|
|
413
|
+
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/** @nocollapse */ NumberSpacingPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NumberSpacingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
417
|
+
/** @nocollapse */ NumberSpacingPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NumberSpacingPipe, name: "adbSpacing", pure: false });
|
|
418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NumberSpacingPipe, decorators: [{
|
|
419
|
+
type: Pipe,
|
|
420
|
+
args: [{
|
|
421
|
+
name: 'adbSpacing',
|
|
422
|
+
pure: false
|
|
423
|
+
}]
|
|
424
|
+
}] });
|
|
425
|
+
|
|
426
|
+
class PipesModule {
|
|
427
|
+
}
|
|
428
|
+
/** @nocollapse */ PipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
429
|
+
/** @nocollapse */ PipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PipesModule, declarations: [HighlightPipe, NumberSpacingPipe, LocaleDatePipe], exports: [HighlightPipe, NumberSpacingPipe, LocaleDatePipe] });
|
|
430
|
+
/** @nocollapse */ PipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PipesModule, imports: [[]] });
|
|
431
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: PipesModule, decorators: [{
|
|
432
|
+
type: NgModule,
|
|
433
|
+
args: [{
|
|
434
|
+
imports: [],
|
|
435
|
+
declarations: [HighlightPipe, NumberSpacingPipe, LocaleDatePipe],
|
|
436
|
+
exports: [HighlightPipe, NumberSpacingPipe, LocaleDatePipe]
|
|
437
|
+
}]
|
|
438
|
+
}] });
|
|
439
|
+
|
|
440
|
+
class AdbDatePickerService {
|
|
441
|
+
constructor() {
|
|
442
|
+
this.dateSubject = new Subject();
|
|
443
|
+
this.date$ = this.dateSubject.asObservable();
|
|
444
|
+
this.hideSubject = new Subject();
|
|
445
|
+
this.hide$ = this.hideSubject.asObservable();
|
|
446
|
+
this.settingSubject = new BehaviorSubject(null);
|
|
447
|
+
this.settings$ = this.settingSubject.asObservable();
|
|
448
|
+
}
|
|
449
|
+
selectDate(date) {
|
|
450
|
+
this.dateSubject.next(date);
|
|
451
|
+
}
|
|
452
|
+
setSetting(settings) {
|
|
453
|
+
this.settingSubject.next(settings);
|
|
454
|
+
}
|
|
455
|
+
hide() {
|
|
456
|
+
this.hideSubject.next();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/** @nocollapse */ AdbDatePickerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
460
|
+
/** @nocollapse */ AdbDatePickerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerService });
|
|
461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerService, decorators: [{
|
|
462
|
+
type: Injectable
|
|
463
|
+
}] });
|
|
464
|
+
|
|
465
|
+
class AdbDatePickerComponent {
|
|
466
|
+
constructor(adbDatePickerService) {
|
|
467
|
+
this.adbDatePickerService = adbDatePickerService;
|
|
468
|
+
this.subscriptions = new Subscription();
|
|
469
|
+
this.currentdDate = new Date();
|
|
470
|
+
this.selectedDate = new Date();
|
|
471
|
+
this.weekDays = AdbDatePickerComponent.WEEK_DAYS;
|
|
472
|
+
}
|
|
473
|
+
ngOnInit() {
|
|
474
|
+
this.subscriptions.add(this.adbDatePickerService.settings$.subscribe(settings => {
|
|
475
|
+
this.range = {
|
|
476
|
+
start: (settings === null || settings === void 0 ? void 0 : settings.minDate) ? startOfDay(settings.minDate) : null,
|
|
477
|
+
end: (settings === null || settings === void 0 ? void 0 : settings.maxDate) ? endOfDay(settings.maxDate) : null
|
|
478
|
+
};
|
|
479
|
+
this.createCalendar();
|
|
480
|
+
}));
|
|
481
|
+
}
|
|
482
|
+
onShowYear() {
|
|
483
|
+
this.months = null;
|
|
484
|
+
this.loadYearsInterval();
|
|
485
|
+
}
|
|
486
|
+
onShowMonth() {
|
|
487
|
+
this.years = null;
|
|
488
|
+
this.loadMonths();
|
|
489
|
+
}
|
|
490
|
+
onSelectYear(inYear) {
|
|
491
|
+
this.selectedDate.setFullYear(inYear.getFullYear());
|
|
492
|
+
this.loadMonths();
|
|
493
|
+
this.years = null;
|
|
494
|
+
}
|
|
495
|
+
onSelectMonth(inMonth) {
|
|
496
|
+
this.selectedDate.setMonth(inMonth);
|
|
497
|
+
this.createCalendar();
|
|
498
|
+
this.years = null;
|
|
499
|
+
this.months = null;
|
|
500
|
+
}
|
|
501
|
+
onPrev() {
|
|
502
|
+
if (this.years) {
|
|
503
|
+
this.selectedDate = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
|
|
504
|
+
this.loadYearsInterval();
|
|
505
|
+
}
|
|
506
|
+
else if (this.months) {
|
|
507
|
+
this.selectedDate = subYears(this.selectedDate, 1);
|
|
508
|
+
this.loadMonths();
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.selectedDate = subMonths(this.selectedDate, 1);
|
|
512
|
+
this.createCalendar();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
onNext() {
|
|
516
|
+
if (this.years) {
|
|
517
|
+
this.selectedDate = addYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
|
|
518
|
+
this.loadYearsInterval();
|
|
519
|
+
}
|
|
520
|
+
else if (this.months) {
|
|
521
|
+
this.selectedDate = addYears(this.selectedDate, 1);
|
|
522
|
+
this.loadMonths();
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
this.selectedDate = addMonths(this.selectedDate, 1);
|
|
526
|
+
this.createCalendar();
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
onHide(target) {
|
|
530
|
+
if (!target.hasAttribute('adbdatepicker')) {
|
|
531
|
+
this.adbDatePickerService.hide();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
ngOnDestroy() {
|
|
535
|
+
this.subscriptions.unsubscribe();
|
|
536
|
+
}
|
|
537
|
+
loadMonths() {
|
|
538
|
+
this.months = AdbDatePickerComponent.MONTHS.map(x => {
|
|
539
|
+
return {
|
|
540
|
+
value: x,
|
|
541
|
+
isThisMonth: getMonth(this.selectedDate) === x && isSameYear(this.currentdDate, this.selectedDate)
|
|
542
|
+
};
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
loadYearsInterval() {
|
|
546
|
+
let year = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
|
|
547
|
+
const years = [];
|
|
548
|
+
for (let i = 0; i < 16; i++) {
|
|
549
|
+
years.push({
|
|
550
|
+
value: year,
|
|
551
|
+
title: year.getFullYear(),
|
|
552
|
+
isThisYear: isSameYear(year, this.currentdDate)
|
|
553
|
+
});
|
|
554
|
+
year = addYears(year, 1);
|
|
555
|
+
}
|
|
556
|
+
this.years = years;
|
|
557
|
+
}
|
|
558
|
+
onSelectDate(day) {
|
|
559
|
+
this.adbDatePickerService.selectDate(day.value);
|
|
560
|
+
}
|
|
561
|
+
createCalendar() {
|
|
562
|
+
const weeks = [];
|
|
563
|
+
const monthInterval = { start: startOfMonth(this.selectedDate), end: endOfMonth(this.selectedDate) };
|
|
564
|
+
var fnsWweeks = eachWeekOfInterval(monthInterval);
|
|
565
|
+
for (const fnsWeek of fnsWweeks) {
|
|
566
|
+
const week = { weekNumber: 0, days: [] };
|
|
567
|
+
week.weekNumber = getISOWeek(new Date(fnsWeek));
|
|
568
|
+
const weekInterval = { start: new Date(fnsWeek), end: addDays(new Date(fnsWeek), 6) };
|
|
569
|
+
week.days = eachDayOfInterval(weekInterval).map(day => {
|
|
570
|
+
day.setHours(getHours(new Date()));
|
|
571
|
+
day.setMinutes(getMinutes(new Date()));
|
|
572
|
+
return {
|
|
573
|
+
value: day,
|
|
574
|
+
isInRange: isWithinInterval(day, this.range),
|
|
575
|
+
isToday: isSameDay(day, this.currentdDate),
|
|
576
|
+
inMonth: monthInterval.start.getMonth() === day.getMonth()
|
|
577
|
+
};
|
|
578
|
+
});
|
|
579
|
+
weeks.push(week);
|
|
580
|
+
}
|
|
581
|
+
this.weeks = weeks;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
AdbDatePickerComponent.MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
585
|
+
AdbDatePickerComponent.WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7'];
|
|
586
|
+
AdbDatePickerComponent.YEAR_INTERVALL = 8;
|
|
587
|
+
/** @nocollapse */ AdbDatePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerComponent, deps: [{ token: AdbDatePickerService }], target: i0.ɵɵFactoryTarget.Component });
|
|
588
|
+
/** @nocollapse */ AdbDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: AdbDatePickerComponent, selector: "adb-date-picker", ngImport: i0, template: "<nav class=\"bg-white shadow rounded\" style=\"width:350px\" (adbClickOutside)=\"onHide($event)\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth()\">{{selectedDate|date:'MMM'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\"><span class=\"fa fa-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 class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value)\" [class.active]=\"year.hasObservation\" [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n <ul class=\"list-unstyled row\" *ngIf=\"months\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value)\" [class.active]=\"month.observation\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n <div class=\"days\">\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 class=\"btn rounded-circle p-0 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\"\r\n [class.border]=\"day.isToday\" [ngClass]=\"{'pe-none text-muted opacity-50':!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>", directives: [{ type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "date": i3$1.DatePipe, "translate": i3.TranslatePipe } });
|
|
589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
|
|
590
|
+
type: Component,
|
|
591
|
+
args: [{ selector: 'adb-date-picker', template: "<nav class=\"bg-white shadow rounded\" style=\"width:350px\" (adbClickOutside)=\"onHide($event)\">\r\n <header class=\"bg-primary p-2 rounded-top d-flex justify-content-between align-items-center gap-1\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth()\">{{selectedDate|date:'MMM'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\"><span class=\"fa fa-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 class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value)\" [class.active]=\"year.hasObservation\" [ngClass]=\"{'border border-secondary':year.isThisYear}\">{{year.title}}</button>\r\n </li>\r\n </ul>\r\n <ul class=\"list-unstyled row\" *ngIf=\"months\">\r\n <li class=\"col-4 text-center px-2 py-3\" *ngFor=\"let month of months\">\r\n <button class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value)\" [class.active]=\"month.observation\" [ngClass]=\"{'border border-secondary':month.isThisMonth}\">\r\n {{'MONTHS.'+(month.value+1)|translate}}\r\n </button>\r\n </li>\r\n </ul>\r\n <div class=\"days\">\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 class=\"btn rounded-circle p-0 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\"\r\n [class.border]=\"day.isToday\" [ngClass]=\"{'pe-none text-muted opacity-50':!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>" }]
|
|
592
|
+
}], ctorParameters: function () { return [{ type: AdbDatePickerService }]; } });
|
|
593
|
+
|
|
594
|
+
class AdbDatePickerDirective {
|
|
595
|
+
constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
|
|
596
|
+
this.viewContainerRef = viewContainerRef;
|
|
597
|
+
this.renderer = renderer;
|
|
598
|
+
this.elementRef = elementRef;
|
|
599
|
+
this.adbDatePickerService = adbDatePickerService;
|
|
600
|
+
this.translate = translate;
|
|
601
|
+
this.subscriptions = new Subscription();
|
|
602
|
+
this.format = 'yyyy-MM-dd';
|
|
603
|
+
//TODO: convert to getter if this would become dynamic from server
|
|
604
|
+
this.settings = null;
|
|
605
|
+
//ControlValueAccessor
|
|
606
|
+
this.onChange = () => { };
|
|
607
|
+
this.onTouched = () => { };
|
|
608
|
+
}
|
|
609
|
+
ngOnInit() {
|
|
610
|
+
var _a, _b;
|
|
611
|
+
this.subscriptions.add(this.adbDatePickerService.date$.subscribe({
|
|
612
|
+
next: date => {
|
|
613
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang));
|
|
614
|
+
this.onChange(date);
|
|
615
|
+
this.onHide();
|
|
616
|
+
}
|
|
617
|
+
}));
|
|
618
|
+
this.subscriptions.add(this.adbDatePickerService.hide$.subscribe({
|
|
619
|
+
next: () => {
|
|
620
|
+
this.onHide();
|
|
621
|
+
}
|
|
622
|
+
}));
|
|
623
|
+
if (((_a = this.settings) === null || _a === void 0 ? void 0 : _a.maxDate) || ((_b = this.settings) === null || _b === void 0 ? void 0 : _b.minDate)) {
|
|
624
|
+
this.adbDatePickerService.setSetting({
|
|
625
|
+
minDate: AdbDatePickerDirective.parseDate(this.settings.minDate),
|
|
626
|
+
maxDate: AdbDatePickerDirective.parseDate(this.settings.maxDate)
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
onClick() {
|
|
631
|
+
if (!this.viewRef) {
|
|
632
|
+
this.viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
onHide() {
|
|
636
|
+
this.viewRef = null;
|
|
637
|
+
this.viewContainerRef.detach();
|
|
638
|
+
this.viewContainerRef.clear();
|
|
639
|
+
}
|
|
640
|
+
ngOnDestroy() {
|
|
641
|
+
this.subscriptions.unsubscribe();
|
|
642
|
+
}
|
|
643
|
+
writeValue(value) {
|
|
644
|
+
if (value) {
|
|
645
|
+
let initialDate = AdbDatePickerDirective.parseDate(value);
|
|
646
|
+
if (initialDate) {
|
|
647
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(initialDate, this.format, this.translate.currentLang));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
registerOnChange(fn) {
|
|
652
|
+
this.onChange = fn;
|
|
653
|
+
}
|
|
654
|
+
registerOnTouched(fn) {
|
|
655
|
+
this.onTouched = fn;
|
|
656
|
+
}
|
|
657
|
+
setDisabledState(isDisabled) {
|
|
658
|
+
this.viewContainerRef.clear();
|
|
659
|
+
}
|
|
660
|
+
static parseDate(value) {
|
|
661
|
+
if (typeof value === 'string') {
|
|
662
|
+
if (isValid(parseISO(value))) {
|
|
663
|
+
return parseISO(value);
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
else if (value instanceof Date) {
|
|
670
|
+
return value;
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** @nocollapse */ AdbDatePickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
678
|
+
/** @nocollapse */ AdbDatePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: AdbDatePickerDirective, selector: "input[adbDatepicker]", inputs: { format: "format", settings: "settings" }, host: { listeners: { "click": "onClick()", "keyup.esc": "onHide()" } }, providers: [{
|
|
679
|
+
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
|
|
680
|
+
multi: true
|
|
681
|
+
}], ngImport: i0 });
|
|
682
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
|
|
683
|
+
type: Directive,
|
|
684
|
+
args: [{
|
|
685
|
+
selector: `input[adbDatepicker]`,
|
|
686
|
+
providers: [{
|
|
687
|
+
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
|
|
688
|
+
multi: true
|
|
689
|
+
}]
|
|
690
|
+
}]
|
|
691
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i3.TranslateService }]; }, propDecorators: { format: [{
|
|
692
|
+
type: Input
|
|
693
|
+
}], settings: [{
|
|
694
|
+
type: Input
|
|
695
|
+
}], onClick: [{
|
|
696
|
+
type: HostListener,
|
|
697
|
+
args: ['click']
|
|
698
|
+
}], onHide: [{
|
|
699
|
+
type: HostListener,
|
|
700
|
+
args: ['keyup.esc']
|
|
701
|
+
}] } });
|
|
702
|
+
|
|
703
|
+
class AdbDatePickerModule {
|
|
704
|
+
}
|
|
705
|
+
/** @nocollapse */ AdbDatePickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
706
|
+
/** @nocollapse */ AdbDatePickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerModule, declarations: [AdbDatePickerComponent, AdbDatePickerDirective], imports: [CommonModule, TranslateModule, PipesModule, DirectivesModule], exports: [AdbDatePickerComponent, AdbDatePickerDirective] });
|
|
707
|
+
/** @nocollapse */ AdbDatePickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerModule, providers: [AdbDatePickerService], imports: [[CommonModule, TranslateModule, PipesModule, DirectivesModule]] });
|
|
708
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: AdbDatePickerModule, decorators: [{
|
|
709
|
+
type: NgModule,
|
|
710
|
+
args: [{
|
|
711
|
+
imports: [CommonModule, TranslateModule, PipesModule, DirectivesModule],
|
|
712
|
+
declarations: [AdbDatePickerComponent, AdbDatePickerDirective],
|
|
713
|
+
exports: [AdbDatePickerComponent, AdbDatePickerDirective],
|
|
714
|
+
providers: [AdbDatePickerService]
|
|
715
|
+
}]
|
|
716
|
+
}] });
|
|
717
|
+
|
|
718
|
+
/*
|
|
719
|
+
* Public API Surface of artdata-shared
|
|
720
|
+
*/
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Generated bundle index. Do not edit.
|
|
724
|
+
*/
|
|
725
|
+
|
|
726
|
+
export { ADBHeaderComponent, ADBHeaderModule, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, ClickOutsideDirective, DirectivesModule, FocusDirective, HighlightPipe, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent, PagersModule, PipesModule };
|
|
727
|
+
//# sourceMappingURL=adb-shared.mjs.map
|