adb-shared 6.0.1 → 6.0.3

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.
Files changed (97) hide show
  1. package/esm2022/adb-shared.mjs +4 -4
  2. package/esm2022/lib/components/adb-artportalen-nav/adb-artportalen-footer.component.mjs +48 -48
  3. package/esm2022/lib/components/adb-artportalen-nav/adb-artportalen-nav.component.mjs +112 -112
  4. package/esm2022/lib/components/adb-artportalen-nav/adb-artportalen-nav.module.mjs +58 -66
  5. package/esm2022/lib/components/adb-artportalen-nav/environment.service.mjs +16 -16
  6. package/esm2022/lib/components/adb-artportalen-nav/navigation.model.mjs +1 -1
  7. package/esm2022/lib/components/adb-buttons/adb-buttons.module.mjs +19 -19
  8. package/esm2022/lib/components/adb-buttons/help-button.component.mjs +35 -35
  9. package/esm2022/lib/components/adb-confirm-modal/adb-confirm-modal.mjs +29 -29
  10. package/esm2022/lib/components/adb-confirm-modal/adb-modal.module.mjs +23 -23
  11. package/esm2022/lib/components/adb-confirm-modal/adb-modal.service.mjs +46 -46
  12. package/esm2022/lib/components/adb-dropdown/adb-dropdown.directive.mjs +100 -100
  13. package/esm2022/lib/components/adb-dropdown/adb-dropdown.module.mjs +24 -23
  14. package/esm2022/lib/components/adb-dropdown/adb-dropdown.service.mjs +10 -10
  15. package/esm2022/lib/components/adb-dropdown/adb-dropdown2.directive.mjs +119 -0
  16. package/esm2022/lib/components/adb-header/adb-header.module.mjs +49 -57
  17. package/esm2022/lib/components/adb-header/adb-nav.component.mjs +115 -115
  18. package/esm2022/lib/components/adb-header/environment.service.mjs +16 -16
  19. package/esm2022/lib/components/adb-header/navigation.model.mjs +1 -1
  20. package/esm2022/lib/components/adb-rich-editor/adb-rich-editor.component.mjs +84 -0
  21. package/esm2022/lib/components/adb-rich-editor/adb-rich-editor.module.mjs +19 -0
  22. package/esm2022/lib/components/adb-toast/adb-toast.mjs +25 -25
  23. package/esm2022/lib/components/adb-toast/adb-toast.module.mjs +23 -23
  24. package/esm2022/lib/components/adb-toast/adb-toast.service.mjs +55 -55
  25. package/esm2022/lib/components/date-picker/adb-date-picker.component.mjs +177 -177
  26. package/esm2022/lib/components/date-picker/adb-date-picker.directive.mjs +220 -220
  27. package/esm2022/lib/components/date-picker/adb-date-picker.module.mjs +25 -25
  28. package/esm2022/lib/components/date-picker/adb-date-picker.service.mjs +10 -10
  29. package/esm2022/lib/components/pagers/infinite-scroll.component.mjs +47 -47
  30. package/esm2022/lib/components/pagers/pager-base.directive.mjs +57 -57
  31. package/esm2022/lib/components/pagers/pager-inline.mjs +49 -49
  32. package/esm2022/lib/components/pagers/pager.mjs +53 -53
  33. package/esm2022/lib/components/pagers/pagers.module.mjs +26 -26
  34. package/esm2022/lib/directives/click-outside.directive.mjs +28 -28
  35. package/esm2022/lib/directives/directives.module.mjs +21 -21
  36. package/esm2022/lib/directives/file-upload.directive.mjs +36 -36
  37. package/esm2022/lib/directives/focus.directive.mjs +34 -34
  38. package/esm2022/lib/directives/redlist-badge-class.directive.mjs +44 -44
  39. package/esm2022/lib/directives/risk-class.directive.mjs +37 -37
  40. package/esm2022/lib/pipes/date.pipe.mjs +22 -22
  41. package/esm2022/lib/pipes/emptyValue.pipe.mjs +22 -22
  42. package/esm2022/lib/pipes/highlight-html.pipe.mjs +46 -46
  43. package/esm2022/lib/pipes/highlight.pipe.mjs +46 -46
  44. package/esm2022/lib/pipes/number-spacing.pipe.mjs +21 -21
  45. package/esm2022/lib/pipes/pipes.module.mjs +22 -21
  46. package/esm2022/lib/pipes/rich.pipe.mjs +36 -0
  47. package/esm2022/public-api.mjs +42 -38
  48. package/fesm2022/adb-shared.mjs +1826 -1598
  49. package/fesm2022/adb-shared.mjs.map +1 -1
  50. package/index.d.ts +5 -5
  51. package/lib/components/adb-artportalen-nav/adb-artportalen-footer.component.d.ts +23 -23
  52. package/lib/components/adb-artportalen-nav/adb-artportalen-nav.component.d.ts +41 -41
  53. package/lib/components/adb-artportalen-nav/adb-artportalen-nav.module.d.ts +16 -17
  54. package/lib/components/adb-artportalen-nav/environment.service.d.ts +7 -7
  55. package/lib/components/adb-artportalen-nav/navigation.model.d.ts +18 -18
  56. package/lib/components/adb-buttons/adb-buttons.module.d.ts +9 -9
  57. package/lib/components/adb-buttons/help-button.component.d.ts +13 -13
  58. package/lib/components/adb-confirm-modal/adb-confirm-modal.d.ts +20 -20
  59. package/lib/components/adb-confirm-modal/adb-modal.module.d.ts +10 -10
  60. package/lib/components/adb-confirm-modal/adb-modal.service.d.ts +18 -18
  61. package/lib/components/adb-dropdown/adb-dropdown.directive.d.ts +21 -21
  62. package/lib/components/adb-dropdown/adb-dropdown.module.d.ts +11 -10
  63. package/lib/components/adb-dropdown/adb-dropdown.service.d.ts +7 -7
  64. package/lib/components/adb-dropdown/adb-dropdown2.directive.d.ts +23 -0
  65. package/lib/components/adb-header/adb-header.module.d.ts +15 -16
  66. package/lib/components/adb-header/adb-nav.component.d.ts +41 -41
  67. package/lib/components/adb-header/environment.service.d.ts +7 -7
  68. package/lib/components/adb-header/navigation.model.d.ts +29 -29
  69. package/lib/components/adb-rich-editor/adb-rich-editor.component.d.ts +24 -0
  70. package/lib/components/adb-rich-editor/adb-rich-editor.module.d.ts +9 -0
  71. package/lib/components/adb-toast/adb-toast.d.ts +11 -11
  72. package/lib/components/adb-toast/adb-toast.module.d.ts +10 -10
  73. package/lib/components/adb-toast/adb-toast.service.d.ts +36 -36
  74. package/lib/components/date-picker/adb-date-picker.component.d.ts +64 -64
  75. package/lib/components/date-picker/adb-date-picker.directive.d.ts +47 -47
  76. package/lib/components/date-picker/adb-date-picker.module.d.ts +12 -12
  77. package/lib/components/date-picker/adb-date-picker.service.d.ts +8 -8
  78. package/lib/components/pagers/infinite-scroll.component.d.ts +15 -15
  79. package/lib/components/pagers/pager-base.directive.d.ts +16 -16
  80. package/lib/components/pagers/pager-inline.d.ts +16 -16
  81. package/lib/components/pagers/pager.d.ts +22 -22
  82. package/lib/components/pagers/pagers.module.d.ts +11 -11
  83. package/lib/directives/click-outside.directive.d.ts +10 -10
  84. package/lib/directives/directives.module.d.ts +11 -11
  85. package/lib/directives/file-upload.directive.d.ts +12 -12
  86. package/lib/directives/focus.directive.d.ts +11 -11
  87. package/lib/directives/redlist-badge-class.directive.d.ts +7 -7
  88. package/lib/directives/risk-class.directive.d.ts +7 -7
  89. package/lib/pipes/date.pipe.d.ts +10 -10
  90. package/lib/pipes/emptyValue.pipe.d.ts +7 -7
  91. package/lib/pipes/highlight-html.pipe.d.ts +10 -10
  92. package/lib/pipes/highlight.pipe.d.ts +9 -9
  93. package/lib/pipes/number-spacing.pipe.d.ts +7 -7
  94. package/lib/pipes/pipes.module.d.ts +12 -11
  95. package/lib/pipes/rich.pipe.d.ts +11 -0
  96. package/package.json +5 -5
  97. package/public-api.d.ts +38 -34
@@ -5,1683 +5,1911 @@ import { Injectable, Inject, EventEmitter, Directive, Output, HostListener, Inpu
5
5
  import * as i1$1 from '@ngx-translate/core';
6
6
  import { TranslateModule } from '@ngx-translate/core';
7
7
  import * as i1 from '@angular/common/http';
8
- import { HttpClientModule } from '@angular/common/http';
8
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
9
9
  import * as i2 from '@angular/router';
10
10
  import { NavigationEnd, RouterModule } from '@angular/router';
11
11
  import { Subscription, Subject, of } from 'rxjs';
12
+ import * as i1$2 from '@angular/platform-browser';
12
13
  import { startOfDay, subYears, endOfDay, addYears, getMonth, subMonths, addMonths, isSameYear, startOfMonth, endOfMonth, eachWeekOfInterval, getISOWeek, addDays, eachDayOfInterval, getHours, getMinutes, isSameDay, isSameMonth, isWithinInterval, isValid, parseISO } from 'date-fns';
13
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
14
+ import * as i2$2 from '@angular/forms';
15
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
14
16
  import { delay } from 'rxjs/operators';
15
17
 
16
- let EnvironmentService$1 = class EnvironmentService {
17
- constructor(environment) {
18
- this.environment = environment;
19
- }
20
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); }
21
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService }); }
22
- };
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService$1, decorators: [{
24
- type: Injectable
25
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
26
- type: Inject,
27
- args: ['env']
28
- }] }]; } });
18
+ let EnvironmentService$1 = class EnvironmentService {
19
+ constructor(environment) {
20
+ this.environment = environment;
21
+ }
22
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EnvironmentService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); }
23
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EnvironmentService }); }
24
+ };
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EnvironmentService$1, decorators: [{
26
+ type: Injectable
27
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
28
+ type: Inject,
29
+ args: ['env']
30
+ }] }] });
29
31
 
30
- class ClickOutsideDirective {
31
- constructor(elementRef) {
32
- this.elementRef = elementRef;
33
- this.adbClickOutside = new EventEmitter();
34
- }
35
- onClick(target) {
36
- const clickedInside = this.elementRef.nativeElement.contains(target);
37
- if (!clickedInside) {
38
- this.adbClickOutside.emit(target);
39
- }
40
- }
41
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
42
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: { adbClickOutside: "adbClickOutside" }, host: { listeners: { "document:click": "onClick($event.target)" } }, ngImport: i0 }); }
43
- }
44
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClickOutsideDirective, decorators: [{
45
- type: Directive,
46
- args: [{
47
- selector: '[adbClickOutside]',
48
- }]
49
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { adbClickOutside: [{
50
- type: Output
51
- }], onClick: [{
52
- type: HostListener,
53
- args: ['document:click', ['$event.target']]
32
+ class ClickOutsideDirective {
33
+ constructor(elementRef) {
34
+ this.elementRef = elementRef;
35
+ this.adbClickOutside = new EventEmitter();
36
+ }
37
+ onClick(target) {
38
+ const clickedInside = this.elementRef.nativeElement.contains(target);
39
+ if (!clickedInside) {
40
+ this.adbClickOutside.emit(target);
41
+ }
42
+ }
43
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
44
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: { adbClickOutside: "adbClickOutside" }, host: { listeners: { "document:click": "onClick($event.target)" } }, ngImport: i0 }); }
45
+ }
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ClickOutsideDirective, decorators: [{
47
+ type: Directive,
48
+ args: [{
49
+ selector: '[adbClickOutside]',
50
+ }]
51
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { adbClickOutside: [{
52
+ type: Output
53
+ }], onClick: [{
54
+ type: HostListener,
55
+ args: ['document:click', ['$event.target']]
54
56
  }] } });
55
57
 
56
- class FileUploadDirective {
57
- constructor(el) {
58
- this.el = el;
59
- this.upload = new EventEmitter();
60
- this.click = new EventEmitter();
61
- }
62
- onBeginUpload(target) {
63
- if (target) {
64
- if (target.files && target.files[0]) {
65
- this.upload.emit(target.files[0]);
66
- }
67
- }
68
- }
69
- onClick(target) {
70
- this.el.nativeElement.value = '';
71
- if (target) {
72
- this.click.emit(target);
73
- }
74
- }
75
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileUploadDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
76
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FileUploadDirective, selector: "input[adbFileUpload]", outputs: { upload: "upload" }, host: { listeners: { "change": "onBeginUpload($event.target)", "click": "onClick($event.target)" } }, ngImport: i0 }); }
77
- }
78
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileUploadDirective, decorators: [{
79
- type: Directive,
80
- args: [{
81
- selector: 'input[adbFileUpload]',
82
- host: {
83
- '(change)': 'onBeginUpload($event.target)',
84
- '(click)': 'onClick($event.target)'
85
- },
86
- outputs: ['upload']
87
- }]
88
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
58
+ class FileUploadDirective {
59
+ constructor(el) {
60
+ this.el = el;
61
+ this.upload = new EventEmitter();
62
+ this.click = new EventEmitter();
63
+ }
64
+ onBeginUpload(target) {
65
+ if (target) {
66
+ if (target.files && target.files[0]) {
67
+ this.upload.emit(target.files[0]);
68
+ }
69
+ }
70
+ }
71
+ onClick(target) {
72
+ this.el.nativeElement.value = '';
73
+ if (target) {
74
+ this.click.emit(target);
75
+ }
76
+ }
77
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: FileUploadDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
78
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: FileUploadDirective, selector: "input[adbFileUpload]", outputs: { upload: "upload" }, host: { listeners: { "change": "onBeginUpload($event.target)", "click": "onClick($event.target)" } }, ngImport: i0 }); }
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: FileUploadDirective, decorators: [{
81
+ type: Directive,
82
+ args: [{
83
+ selector: 'input[adbFileUpload]',
84
+ host: {
85
+ '(change)': 'onBeginUpload($event.target)',
86
+ '(click)': 'onClick($event.target)'
87
+ },
88
+ outputs: ['upload']
89
+ }]
90
+ }], ctorParameters: () => [{ type: i0.ElementRef }] });
89
91
 
90
- /* eslint-disable @angular-eslint/directive-selector */
91
- class FocusDirective {
92
- set adbFocus(value) {
93
- this.focused = value;
94
- if (this.focused) {
95
- this.element.nativeElement.focus();
96
- }
97
- else {
98
- this.element.nativeElement.blur();
99
- }
100
- }
101
- constructor(element) {
102
- this.element = element;
103
- }
104
- ngAfterViewInit() {
105
- // ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
106
- if (this.focused) {
107
- setTimeout(() => this.element.nativeElement.focus(), 0);
108
- }
109
- }
110
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
111
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FocusDirective, selector: "[adbFocus]", inputs: { adbFocus: "adbFocus" }, ngImport: i0 }); }
112
- }
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FocusDirective, decorators: [{
114
- type: Directive,
115
- args: [{
116
- selector: '[adbFocus]',
117
- }]
118
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { adbFocus: [{
119
- type: Input
92
+ /* eslint-disable @angular-eslint/directive-selector */
93
+ class FocusDirective {
94
+ set adbFocus(value) {
95
+ this.focused = value;
96
+ if (this.focused) {
97
+ this.element.nativeElement.focus();
98
+ }
99
+ else {
100
+ this.element.nativeElement.blur();
101
+ }
102
+ }
103
+ constructor(element) {
104
+ this.element = element;
105
+ }
106
+ ngAfterViewInit() {
107
+ // ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
108
+ if (this.focused) {
109
+ setTimeout(() => this.element.nativeElement.focus(), 0);
110
+ }
111
+ }
112
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: FocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
113
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: FocusDirective, selector: "[adbFocus]", inputs: { adbFocus: "adbFocus" }, ngImport: i0 }); }
114
+ }
115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: FocusDirective, decorators: [{
116
+ type: Directive,
117
+ args: [{
118
+ selector: '[adbFocus]',
119
+ }]
120
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { adbFocus: [{
121
+ type: Input
120
122
  }] } });
121
123
 
122
- class RedListBadgeClassDirective {
123
- get hostClasses() {
124
- this.redlistId = this.redlistId ? this.redlistId.replace('°', '') : '';
125
- if (this.redlistId === 'EX' || this.redlistId === 'RE') {
126
- return 'bg-redlist-re';
127
- }
128
- else if (this.redlistId === 'DD' || this.redlistId === 'NE' || this.redlistId === 'NA') {
129
- return 'bg-redlist-dd';
130
- }
131
- else if (this.redlistId === 'CR') {
132
- return 'bg-redlist-cr';
133
- }
134
- else if (this.redlistId === 'EN') {
135
- return 'bg-redlist-en';
136
- }
137
- else if (this.redlistId === 'VU') {
138
- return 'bg-redlist-vu';
139
- }
140
- else if (this.redlistId === 'NT') {
141
- return 'bg-redlist-nt';
142
- }
143
- else if (this.redlistId === 'NONE') {
144
- return '';
145
- }
146
- return 'bg-redlist-lc';
147
- }
148
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RedListBadgeClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
149
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: RedListBadgeClassDirective, selector: "[adbRedListBadgeClass]", inputs: { redlistId: ["adbRedListBadgeClass", "redlistId"] }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0 }); }
150
- }
151
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RedListBadgeClassDirective, decorators: [{
152
- type: Directive,
153
- args: [{
154
- selector: '[adbRedListBadgeClass]'
155
- }]
156
- }], propDecorators: { redlistId: [{
157
- type: Input,
158
- args: ['adbRedListBadgeClass']
159
- }], hostClasses: [{
160
- type: HostBinding,
161
- args: ['class']
124
+ class RedListBadgeClassDirective {
125
+ get hostClasses() {
126
+ this.redlistId = this.redlistId ? this.redlistId.replace('°', '') : '';
127
+ if (this.redlistId === 'EX' || this.redlistId === 'RE') {
128
+ return 'bg-redlist-re';
129
+ }
130
+ else if (this.redlistId === 'DD' || this.redlistId === 'NE' || this.redlistId === 'NA') {
131
+ return 'bg-redlist-dd';
132
+ }
133
+ else if (this.redlistId === 'CR') {
134
+ return 'bg-redlist-cr';
135
+ }
136
+ else if (this.redlistId === 'EN') {
137
+ return 'bg-redlist-en';
138
+ }
139
+ else if (this.redlistId === 'VU') {
140
+ return 'bg-redlist-vu';
141
+ }
142
+ else if (this.redlistId === 'NT') {
143
+ return 'bg-redlist-nt';
144
+ }
145
+ else if (this.redlistId === 'NONE') {
146
+ return '';
147
+ }
148
+ return 'bg-redlist-lc';
149
+ }
150
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RedListBadgeClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
151
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: RedListBadgeClassDirective, selector: "[adbRedListBadgeClass]", inputs: { redlistId: ["adbRedListBadgeClass", "redlistId"] }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0 }); }
152
+ }
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RedListBadgeClassDirective, decorators: [{
154
+ type: Directive,
155
+ args: [{
156
+ selector: '[adbRedListBadgeClass]'
157
+ }]
158
+ }], propDecorators: { redlistId: [{
159
+ type: Input,
160
+ args: ['adbRedListBadgeClass']
161
+ }], hostClasses: [{
162
+ type: HostBinding,
163
+ args: ['class']
162
164
  }] } });
163
165
 
164
- class RiskClassDirective {
165
- get hostClasses() {
166
- if (this.category === 'NK') {
167
- return 'bg-risk-class-nk text-dark border';
168
- }
169
- else if (this.category === 'LO') {
170
- return 'bg-risk-class-lo border';
171
- }
172
- else if (this.category === 'PH') {
173
- return 'bg-risk-class-ph border';
174
- }
175
- else if (this.category === 'HI') {
176
- return 'bg-risk-class-hi border';
177
- }
178
- else if (this.category === 'SE') {
179
- return 'bg-risk-class-se border';
180
- }
181
- return 'text-dark';
182
- }
183
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RiskClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
184
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: RiskClassDirective, selector: "[adbRiskClass]", inputs: { category: ["adbRiskClass", "category"] }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0 }); }
185
- }
186
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RiskClassDirective, decorators: [{
187
- type: Directive,
188
- args: [{
189
- selector: '[adbRiskClass]'
190
- }]
191
- }], propDecorators: { category: [{
192
- type: Input,
193
- args: ['adbRiskClass']
194
- }], hostClasses: [{
195
- type: HostBinding,
196
- args: ['class']
166
+ class RiskClassDirective {
167
+ get hostClasses() {
168
+ if (this.category === 'NK') {
169
+ return 'bg-risk-class-nk text-dark border';
170
+ }
171
+ else if (this.category === 'LO') {
172
+ return 'bg-risk-class-lo border';
173
+ }
174
+ else if (this.category === 'PH') {
175
+ return 'bg-risk-class-ph border';
176
+ }
177
+ else if (this.category === 'HI') {
178
+ return 'bg-risk-class-hi border';
179
+ }
180
+ else if (this.category === 'SE') {
181
+ return 'bg-risk-class-se border';
182
+ }
183
+ return 'text-dark';
184
+ }
185
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RiskClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
186
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: RiskClassDirective, selector: "[adbRiskClass]", inputs: { category: ["adbRiskClass", "category"] }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0 }); }
187
+ }
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RiskClassDirective, decorators: [{
189
+ type: Directive,
190
+ args: [{
191
+ selector: '[adbRiskClass]'
192
+ }]
193
+ }], propDecorators: { category: [{
194
+ type: Input,
195
+ args: ['adbRiskClass']
196
+ }], hostClasses: [{
197
+ type: HostBinding,
198
+ args: ['class']
197
199
  }] } });
198
200
 
199
- class AdbDirectivesModule {
200
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
201
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbDirectivesModule, declarations: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective], exports: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective] }); }
202
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDirectivesModule }); }
203
- }
204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDirectivesModule, decorators: [{
205
- type: NgModule,
206
- args: [{
207
- imports: [],
208
- declarations: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective],
209
- exports: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective]
210
- }]
201
+ class AdbDirectivesModule {
202
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
203
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbDirectivesModule, declarations: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective], exports: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective] }); }
204
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDirectivesModule }); }
205
+ }
206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDirectivesModule, decorators: [{
207
+ type: NgModule,
208
+ args: [{
209
+ imports: [],
210
+ declarations: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective],
211
+ exports: [ClickOutsideDirective, FocusDirective, FileUploadDirective, RedListBadgeClassDirective, RiskClassDirective]
212
+ }]
211
213
  }] });
212
214
 
213
- class ADBNavComponent {
214
- set userName(fullName) {
215
- this.fullName = fullName;
216
- const splitted = fullName?.split(' ');
217
- if (splitted?.length > 1) {
218
- const initials = splitted.shift().charAt(0) + splitted.pop().charAt(0);
219
- this.initials = initials.toUpperCase();
220
- }
221
- else {
222
- this.initials = this.fullName ? this.fullName.charAt(0).toUpperCase() : this.fullName;
223
- }
224
- }
225
- ;
226
- constructor(httpClient, router, envService, trans) {
227
- this.httpClient = httpClient;
228
- this.router = router;
229
- this.envService = envService;
230
- this.trans = trans;
231
- this.subscription = new Subscription();
232
- this.loginClicked = new EventEmitter();
233
- this.logoutClicked = new EventEmitter();
234
- this.dropMenuChange = new EventEmitter();
235
- this.showPattern = false;
236
- this.translationFinished = false;
237
- this.lastPosition = 0;
238
- this.artfakta = true;
239
- this.showNavMenu = false;
240
- this.showUserMenu = false;
241
- this.showArtfakta = true;
242
- this.showNOS = true;
243
- }
244
- ngOnInit() {
245
- this.url = window.location.href;
246
- const baseUrl = this.envService.environment.resourceUrl;
247
- const url = this.artfakta ? '/assets/links-ap3.json' : '/assets/artportalen/links-ap3.json';
248
- this.subscription.add(this.httpClient.get(baseUrl + url).subscribe(result => {
249
- this.navigation = result;
250
- }));
251
- this.initTranslations(baseUrl);
252
- this.router.events.subscribe((event) => {
253
- if (event instanceof NavigationEnd) {
254
- this.showNavMenu = false;
255
- this.dropMenuChange.emit(this.showNavMenu);
256
- }
257
- });
258
- }
259
- initTranslations(baseUrl) {
260
- if (this.trans.store.translations[this.trans.currentLang]) {
261
- this.loadTranslation(baseUrl, this.trans.currentLang);
262
- }
263
- this.subscription.add(this.trans.onLangChange.subscribe((event) => {
264
- this.translationFinished = false;
265
- this.loadTranslation(baseUrl, event.lang);
266
- }));
267
- }
268
- loadTranslation(baseUrl, lang) {
269
- //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
270
- const url = this.artfakta ? baseUrl + `/assets/i18n/${lang}.json` : baseUrl + `/assets/artportalen/i18n/${lang}.json`;
271
- this.subscription.add(this.httpClient.get(url).subscribe(translations => {
272
- this.trans.setTranslation(lang, translations, true);
273
- this.translationFinished = true;
274
- }));
275
- }
276
- showMenuDropdown(show) {
277
- this.showUserMenu = false;
278
- if (this.showNavMenu !== show) {
279
- this.showNavMenu = show;
280
- this.dropMenuChange.emit(show);
281
- }
282
- }
283
- setLanguage(lang) {
284
- this.trans.use(lang);
285
- this.showNavMenu = false;
286
- this.dropMenuChange.emit(false);
287
- //TODO: set localstorage/cookies or probaly event to main app
288
- }
289
- login() {
290
- this.loginClicked.emit();
291
- }
292
- logout() {
293
- this.logoutClicked.emit();
294
- }
295
- ngOnDestroy() {
296
- this.subscription.unsubscribe();
297
- }
298
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBNavComponent, deps: [{ token: i1.HttpClient }, { token: i2.Router }, { token: EnvironmentService$1 }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
299
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ADBNavComponent, selector: "adb-nav", inputs: { showPattern: "showPattern", userName: "userName", artfakta: "artfakta" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0, template: "<div class=\"bg-primary adb-main-header\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n <header class=\"container-lg\" *ngIf=\"translationFinished\">\r\n <div [attr.id]=\"showPattern?'banner':''\" class=\"d-flex align-items-center gap-2\">\r\n <nav class=\"d-flex flex-grow-1 align-items-center pe-2 py-2 gap-1\">\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 routerLink=\"/\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artfakta</a>\r\n </nav>\r\n <div class=\"d-flex align-items-center gap-2\">\r\n <div><ng-content></ng-content></div>\r\n <div>\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\"\r\n attr.aria-label=\"{{'ADB_HEADER.MENY'|translate}}\"\r\n (click)=\"showMenuDropdown(!showNavMenu)\">\r\n <i class=\"fas fa-bars\"></i>\r\n <small class=\"d-none ms-2 d-md-inline-block\">{{'ADB_HEADER.MENY'|translate}}</small>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </header>\r\n <div *ngIf=\"navigation\" role=\"dialog\" class=\"offcanvas offcanvas-end bg-primary text-white\"\r\n [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\">Artfakta</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 tabindex=\"-1\" 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 <ng-container *ngIf=\"initials\">\r\n <div>\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-primary-dark\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div>{{fullName}}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"text-center\">\r\n <button type=\"button\" class=\"btn btn-primary-dark\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"text-white\" 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 <ul class=\"list-group list-group-flush border-top\">\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showArtfakta?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.artinfo.url}}\">\r\n {{navigation.artinfo.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showArtfakta = !showArtfakta\"\r\n attr.aria-controls=\"artfakta-links\" attr.aria-expanded=\"{{showArtfakta}}\">\r\n <span class=\"fas\" [ngClass]=\"showArtfakta?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showArtfakta\" id=\"artfakta-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.keys.url}}\" class=\"text-white\">\r\n {{navigation.keys.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.mySpecies.url}}\" class=\"text-white\">\r\n {{navigation.mySpecies.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.lists.url}}\" class=\"text-white\">\r\n {{navigation.lists.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.imageRec.url}}\" class=\"text-white\">\r\n {{navigation.imageRec.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.filter.url}}\" class=\"text-white\">\r\n {{navigation.filter.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.observations.url}}?lang={{trans.currentLang}}\">\r\n {{navigation.observations.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showNOS?'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)=\"showNOS = !showNOS\">\r\n {{navigation.nameAndRelationship.transId|translate}}\r\n </button>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showNOS = !showNOS\" attr.aria-controls=\"nos-links\" attr.aria-expanded=\"{{showNOS}}\">\r\n <span class=\"fas\" [ngClass]=\"showNOS?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showNOS\" id=\"nos-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.nameSearch.url}}\" class=\"text-white\">\r\n {{navigation.nameSearch.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.match.url}}\" class=\"text-white\">\r\n {{navigation.match.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</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 {{'ADB_HEADER.ARTPORTALEN_TITLE'|translate}}\r\n <i class=\"fas fa-external-link\"></i>\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 {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u class=\"me-1\">{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u> <span class=\"fas fa-external-link\"></span></a>\r\n </small>\r\n </li>\r\n </ul>\r\n </div>\r\n <div id=\"pattern\" class=\"flex-grow-1\">\r\n\r\n </div>\r\n </div>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
300
- }
301
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBNavComponent, decorators: [{
302
- type: Component,
303
- args: [{ selector: 'adb-nav', template: "<div class=\"bg-primary adb-main-header\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n <header class=\"container-lg\" *ngIf=\"translationFinished\">\r\n <div [attr.id]=\"showPattern?'banner':''\" class=\"d-flex align-items-center gap-2\">\r\n <nav class=\"d-flex flex-grow-1 align-items-center pe-2 py-2 gap-1\">\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 routerLink=\"/\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artfakta</a>\r\n </nav>\r\n <div class=\"d-flex align-items-center gap-2\">\r\n <div><ng-content></ng-content></div>\r\n <div>\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\"\r\n attr.aria-label=\"{{'ADB_HEADER.MENY'|translate}}\"\r\n (click)=\"showMenuDropdown(!showNavMenu)\">\r\n <i class=\"fas fa-bars\"></i>\r\n <small class=\"d-none ms-2 d-md-inline-block\">{{'ADB_HEADER.MENY'|translate}}</small>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </header>\r\n <div *ngIf=\"navigation\" role=\"dialog\" class=\"offcanvas offcanvas-end bg-primary text-white\"\r\n [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\">Artfakta</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 tabindex=\"-1\" 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 <ng-container *ngIf=\"initials\">\r\n <div>\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-primary-dark\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div>{{fullName}}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"text-center\">\r\n <button type=\"button\" class=\"btn btn-primary-dark\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"text-white\" 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 <ul class=\"list-group list-group-flush border-top\">\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showArtfakta?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.artinfo.url}}\">\r\n {{navigation.artinfo.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showArtfakta = !showArtfakta\"\r\n attr.aria-controls=\"artfakta-links\" attr.aria-expanded=\"{{showArtfakta}}\">\r\n <span class=\"fas\" [ngClass]=\"showArtfakta?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showArtfakta\" id=\"artfakta-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.keys.url}}\" class=\"text-white\">\r\n {{navigation.keys.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.mySpecies.url}}\" class=\"text-white\">\r\n {{navigation.mySpecies.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.lists.url}}\" class=\"text-white\">\r\n {{navigation.lists.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.imageRec.url}}\" class=\"text-white\">\r\n {{navigation.imageRec.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.filter.url}}\" class=\"text-white\">\r\n {{navigation.filter.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.observations.url}}?lang={{trans.currentLang}}\">\r\n {{navigation.observations.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showNOS?'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)=\"showNOS = !showNOS\">\r\n {{navigation.nameAndRelationship.transId|translate}}\r\n </button>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showNOS = !showNOS\" attr.aria-controls=\"nos-links\" attr.aria-expanded=\"{{showNOS}}\">\r\n <span class=\"fas\" [ngClass]=\"showNOS?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showNOS\" id=\"nos-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.nameSearch.url}}\" class=\"text-white\">\r\n {{navigation.nameSearch.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.match.url}}\" class=\"text-white\">\r\n {{navigation.match.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</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 {{'ADB_HEADER.ARTPORTALEN_TITLE'|translate}}\r\n <i class=\"fas fa-external-link\"></i>\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 {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u class=\"me-1\">{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u> <span class=\"fas fa-external-link\"></span></a>\r\n </small>\r\n </li>\r\n </ul>\r\n </div>\r\n <div id=\"pattern\" class=\"flex-grow-1\">\r\n\r\n </div>\r\n </div>\r\n </div>\r\n</div>" }]
304
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.Router }, { type: EnvironmentService$1 }, { type: i1$1.TranslateService }]; }, propDecorators: { loginClicked: [{
305
- type: Output
306
- }], logoutClicked: [{
307
- type: Output
308
- }], dropMenuChange: [{
309
- type: Output
310
- }], showPattern: [{
311
- type: Input
312
- }], userName: [{
313
- type: Input
314
- }], artfakta: [{
315
- type: Input
215
+ class ADBNavComponent {
216
+ set userName(fullName) {
217
+ this.fullName = fullName;
218
+ const splitted = fullName?.split(' ');
219
+ if (splitted?.length > 1) {
220
+ const initials = splitted.shift().charAt(0) + splitted.pop().charAt(0);
221
+ this.initials = initials.toUpperCase();
222
+ }
223
+ else {
224
+ this.initials = this.fullName ? this.fullName.charAt(0).toUpperCase() : this.fullName;
225
+ }
226
+ }
227
+ ;
228
+ constructor(httpClient, router, envService, trans) {
229
+ this.httpClient = httpClient;
230
+ this.router = router;
231
+ this.envService = envService;
232
+ this.trans = trans;
233
+ this.subscription = new Subscription();
234
+ this.loginClicked = new EventEmitter();
235
+ this.logoutClicked = new EventEmitter();
236
+ this.dropMenuChange = new EventEmitter();
237
+ this.showPattern = false;
238
+ this.translationFinished = false;
239
+ this.lastPosition = 0;
240
+ this.artfakta = true;
241
+ this.showNavMenu = false;
242
+ this.showUserMenu = false;
243
+ this.showArtfakta = true;
244
+ this.showNOS = true;
245
+ }
246
+ ngOnInit() {
247
+ this.url = window.location.href;
248
+ const baseUrl = this.envService.environment.resourceUrl;
249
+ const url = this.artfakta ? '/assets/links-ap3.json' : '/assets/artportalen/links-ap3.json';
250
+ this.subscription.add(this.httpClient.get(baseUrl + url).subscribe(result => {
251
+ this.navigation = result;
252
+ }));
253
+ this.initTranslations(baseUrl);
254
+ this.router.events.subscribe((event) => {
255
+ if (event instanceof NavigationEnd) {
256
+ this.showNavMenu = false;
257
+ this.dropMenuChange.emit(this.showNavMenu);
258
+ }
259
+ });
260
+ }
261
+ initTranslations(baseUrl) {
262
+ if (this.trans.store.translations[this.trans.currentLang]) {
263
+ this.loadTranslation(baseUrl, this.trans.currentLang);
264
+ }
265
+ this.subscription.add(this.trans.onLangChange.subscribe((event) => {
266
+ this.translationFinished = false;
267
+ this.loadTranslation(baseUrl, event.lang);
268
+ }));
269
+ }
270
+ loadTranslation(baseUrl, lang) {
271
+ //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
272
+ const url = this.artfakta ? baseUrl + `/assets/i18n/${lang}.json` : baseUrl + `/assets/artportalen/i18n/${lang}.json`;
273
+ this.subscription.add(this.httpClient.get(url).subscribe(translations => {
274
+ this.trans.setTranslation(lang, translations, true);
275
+ this.translationFinished = true;
276
+ }));
277
+ }
278
+ showMenuDropdown(show) {
279
+ this.showUserMenu = false;
280
+ if (this.showNavMenu !== show) {
281
+ this.showNavMenu = show;
282
+ this.dropMenuChange.emit(show);
283
+ }
284
+ }
285
+ setLanguage(lang) {
286
+ this.trans.use(lang);
287
+ this.showNavMenu = false;
288
+ this.dropMenuChange.emit(false);
289
+ //TODO: set localstorage/cookies or probaly event to main app
290
+ }
291
+ login() {
292
+ this.loginClicked.emit();
293
+ }
294
+ logout() {
295
+ this.logoutClicked.emit();
296
+ }
297
+ ngOnDestroy() {
298
+ this.subscription.unsubscribe();
299
+ }
300
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ADBNavComponent, deps: [{ token: i1.HttpClient }, { token: i2.Router }, { token: EnvironmentService$1 }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
301
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: ADBNavComponent, selector: "adb-nav", inputs: { showPattern: "showPattern", userName: "userName", artfakta: "artfakta" }, outputs: { loginClicked: "loginClicked", logoutClicked: "logoutClicked", dropMenuChange: "dropMenuChange" }, ngImport: i0, template: "<div class=\"bg-primary adb-main-header\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n <header class=\"container-lg\" *ngIf=\"translationFinished\">\r\n <div [attr.id]=\"showPattern?'banner':''\" class=\"d-flex align-items-center gap-2\">\r\n <nav class=\"d-flex flex-grow-1 align-items-center pe-2 py-2 gap-1\">\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 routerLink=\"/\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artfakta</a>\r\n </nav>\r\n <div class=\"d-flex align-items-center gap-2\">\r\n <div><ng-content></ng-content></div>\r\n <div>\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\"\r\n attr.aria-label=\"{{'ADB_HEADER.MENY'|translate}}\"\r\n (click)=\"showMenuDropdown(!showNavMenu)\">\r\n <i class=\"fas fa-bars\"></i>\r\n <small class=\"d-none ms-2 d-md-inline-block\">{{'ADB_HEADER.MENY'|translate}}</small>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </header>\r\n <div *ngIf=\"navigation\" role=\"dialog\" class=\"offcanvas offcanvas-end bg-primary text-white\"\r\n [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\">Artfakta</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 tabindex=\"-1\" 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 <ng-container *ngIf=\"initials\">\r\n <div>\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-primary-dark\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div>{{fullName}}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"text-center\">\r\n <button type=\"button\" class=\"btn btn-primary-dark\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"text-white\" 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 <ul class=\"list-group list-group-flush border-top\">\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showArtfakta?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.artinfo.url}}\">\r\n {{navigation.artinfo.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showArtfakta = !showArtfakta\"\r\n attr.aria-controls=\"artfakta-links\" attr.aria-expanded=\"{{showArtfakta}}\">\r\n <span class=\"fas\" [ngClass]=\"showArtfakta?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showArtfakta\" id=\"artfakta-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.keys.url}}\" class=\"text-white\">\r\n {{navigation.keys.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.mySpecies.url}}\" class=\"text-white\">\r\n {{navigation.mySpecies.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.lists.url}}\" class=\"text-white\">\r\n {{navigation.lists.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.imageRec.url}}\" class=\"text-white\">\r\n {{navigation.imageRec.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.filter.url}}\" class=\"text-white\">\r\n {{navigation.filter.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.observations.url}}?lang={{trans.currentLang}}\">\r\n {{navigation.observations.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showNOS?'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)=\"showNOS = !showNOS\">\r\n {{navigation.nameAndRelationship.transId|translate}}\r\n </button>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showNOS = !showNOS\" attr.aria-controls=\"nos-links\" attr.aria-expanded=\"{{showNOS}}\">\r\n <span class=\"fas\" [ngClass]=\"showNOS?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showNOS\" id=\"nos-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.nameSearch.url}}\" class=\"text-white\">\r\n {{navigation.nameSearch.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.match.url}}\" class=\"text-white\">\r\n {{navigation.match.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</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 {{'ADB_HEADER.ARTPORTALEN_TITLE'|translate}}\r\n <i class=\"fas fa-external-link\"></i>\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 {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u class=\"me-1\">{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u> <span class=\"fas fa-external-link\"></span></a>\r\n </small>\r\n </li>\r\n </ul>\r\n </div>\r\n <div id=\"pattern\" class=\"flex-grow-1\">\r\n\r\n </div>\r\n </div>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
302
+ }
303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ADBNavComponent, decorators: [{
304
+ type: Component,
305
+ args: [{ selector: 'adb-nav', template: "<div class=\"bg-primary adb-main-header\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n <header class=\"container-lg\" *ngIf=\"translationFinished\">\r\n <div [attr.id]=\"showPattern?'banner':''\" class=\"d-flex align-items-center gap-2\">\r\n <nav class=\"d-flex flex-grow-1 align-items-center pe-2 py-2 gap-1\">\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 routerLink=\"/\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artfakta</a>\r\n </nav>\r\n <div class=\"d-flex align-items-center gap-2\">\r\n <div><ng-content></ng-content></div>\r\n <div>\r\n <button class=\"btn btn-primary-dark btn-lg\" type=\"button\"\r\n attr.aria-label=\"{{'ADB_HEADER.MENY'|translate}}\"\r\n (click)=\"showMenuDropdown(!showNavMenu)\">\r\n <i class=\"fas fa-bars\"></i>\r\n <small class=\"d-none ms-2 d-md-inline-block\">{{'ADB_HEADER.MENY'|translate}}</small>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </header>\r\n <div *ngIf=\"navigation\" role=\"dialog\" class=\"offcanvas offcanvas-end bg-primary text-white\"\r\n [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\">Artfakta</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 tabindex=\"-1\" 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 <ng-container *ngIf=\"initials\">\r\n <div>\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-primary-dark\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div>{{fullName}}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"text-center\">\r\n <button type=\"button\" class=\"btn btn-primary-dark\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a *ngIf=\"navigation\" class=\"text-white\" 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 <ul class=\"list-group list-group-flush border-top\">\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showArtfakta?'border-bottom-0 pb-0':''\">\r\n <div class=\"d-flex justify-content-between gap-2\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.artinfo.url}}\">\r\n {{navigation.artinfo.transId|translate}}\r\n </a>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showArtfakta = !showArtfakta\"\r\n attr.aria-controls=\"artfakta-links\" attr.aria-expanded=\"{{showArtfakta}}\">\r\n <span class=\"fas\" [ngClass]=\"showArtfakta?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showArtfakta\" id=\"artfakta-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.keys.url}}\" class=\"text-white\">\r\n {{navigation.keys.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.mySpecies.url}}\" class=\"text-white\">\r\n {{navigation.mySpecies.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.lists.url}}\" class=\"text-white\">\r\n {{navigation.lists.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.imageRec.url}}\" class=\"text-white\">\r\n {{navigation.imageRec.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1\">\r\n <a href=\"{{navigation.filter.url}}\" class=\"text-white\">\r\n {{navigation.filter.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" href=\"{{navigation.observations.url}}?lang={{trans.currentLang}}\">\r\n {{navigation.observations.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"list-group-item bg-primary\" [ngClass]=\"showNOS?'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)=\"showNOS = !showNOS\">\r\n {{navigation.nameAndRelationship.transId|translate}}\r\n </button>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"showNOS = !showNOS\" attr.aria-controls=\"nos-links\" attr.aria-expanded=\"{{showNOS}}\">\r\n <span class=\"fas\" [ngClass]=\"showNOS?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showNOS\" id=\"nos-links\">\r\n <ul class=\"list-unstyled\">\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.nameSearch.url}}\" class=\"text-white\">\r\n {{navigation.nameSearch.transId|translate}}\r\n </a>\r\n </li>\r\n <li class=\"d-block py-1 text-white\">\r\n <a href=\"{{navigation.match.url}}\" class=\"text-white\">\r\n {{navigation.match.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n <li class=\"list-group-item bg-primary\">\r\n <a class=\"d-block py-1 text-white\" [href]=\"navigation.about.url\">{{navigation.about.transId|translate}}</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 {{'ADB_HEADER.ARTPORTALEN_TITLE'|translate}}\r\n <i class=\"fas fa-external-link\"></i>\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 {{'ADB_HEADER.DEVELOPED_BY'|translate}}\r\n <a href=\"https://www.artdatabanken.se/\" class=\"text-white\"><u class=\"me-1\">{{'ADB_HEADER.ARTDATABANKEN'|translate}}</u> <span class=\"fas fa-external-link\"></span></a>\r\n </small>\r\n </li>\r\n </ul>\r\n </div>\r\n <div id=\"pattern\" class=\"flex-grow-1\">\r\n\r\n </div>\r\n </div>\r\n </div>\r\n</div>" }]
306
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.Router }, { type: EnvironmentService$1 }, { type: i1$1.TranslateService }], propDecorators: { loginClicked: [{
307
+ type: Output
308
+ }], logoutClicked: [{
309
+ type: Output
310
+ }], dropMenuChange: [{
311
+ type: Output
312
+ }], showPattern: [{
313
+ type: Input
314
+ }], userName: [{
315
+ type: Input
316
+ }], artfakta: [{
317
+ type: Input
316
318
  }] } });
317
319
 
318
- class AdbDropdownService {
319
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
320
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownService }); }
321
- }
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownService, decorators: [{
323
- type: Injectable
320
+ class AdbDropdownService {
321
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
322
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownService }); }
323
+ }
324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownService, decorators: [{
325
+ type: Injectable
324
326
  }] });
325
327
 
326
- class AdbDropdownDirective {
327
- constructor(elementRef, adbDropdownService) {
328
- this.elementRef = elementRef;
329
- this.adbDropdownService = adbDropdownService;
330
- this.adbDropdown = new EventEmitter();
331
- this.insideClick = false;
332
- this.dataToggle = "dropdown";
333
- this.haspPopup = true;
334
- this.expanded = false;
335
- this.id = this.getId();
336
- this.dropId = this.getId();
337
- }
338
- onClick() {
339
- this.adbDropdownService.currentMenuId = this.id;
340
- const node = this.elementRef.nativeElement.parentNode;
341
- const toggleButton = node.querySelector('.dropdown-toggle');
342
- let style = `transform:translate3d(0px, ${toggleButton?.clientHeight + 1}px, 0px);`;
343
- const menu = node.querySelector('.dropdown-menu');
344
- if (menu) {
345
- this.adbDropdownService.currentMenu = this.elementRef.nativeElement;
346
- if (menu.classList?.contains('dropdown-menu-end')) {
347
- style = style + 'inset: 0px 0px auto auto;';
348
- }
349
- menu.setAttribute('style', style);
350
- menu.setAttribute('id', this.dropId);
351
- if (menu.classList.contains('show')) {
352
- menu.classList.remove('show');
353
- this.expanded = false;
354
- }
355
- else {
356
- this.adbDropdown.emit();
357
- menu.classList.add('show');
358
- this.expanded = true;
359
- }
360
- }
361
- }
362
- onCheckOutSideClick(target) {
363
- if (this.adbDropdownService.currentMenuId === this.id) {
364
- const parent = this.insideClick ? this.elementRef.nativeElement.parentNode : this.elementRef.nativeElement;
365
- const clickedInside = parent.contains(target);
366
- if (!clickedInside) {
367
- const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
368
- parent?.classList.remove('show');
369
- this.expanded = false;
370
- }
371
- }
372
- else {
373
- const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
374
- parent?.classList.remove('show');
375
- this.expanded = false;
376
- }
377
- }
378
- close() {
379
- const node = this.elementRef.nativeElement.parentNode;
380
- const menu = node.querySelector('.dropdown-menu');
381
- menu.classList.remove('show');
382
- this.expanded = false;
383
- }
384
- getId() {
385
- return '' + Math.floor(Math.random() * Date.now());
386
- }
387
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownDirective, deps: [{ token: i0.ElementRef }, { token: AdbDropdownService }], target: i0.ɵɵFactoryTarget.Directive }); }
388
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AdbDropdownDirective, selector: "[adbDropdown]", inputs: { insideClick: "insideClick" }, outputs: { adbDropdown: "adbDropdown" }, host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded", "attr.aria-controls": "this.dropId" } }, exportAs: ["adbDropdown"], ngImport: i0 }); }
389
- }
390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownDirective, decorators: [{
391
- type: Directive,
392
- args: [{
393
- selector: '[adbDropdown]',
394
- exportAs: 'adbDropdown'
395
- }]
396
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: AdbDropdownService }]; }, propDecorators: { adbDropdown: [{
397
- type: Output
398
- }], insideClick: [{
399
- type: Input
400
- }], id: [{
401
- type: HostBinding,
402
- args: ['id']
403
- }], dataToggle: [{
404
- type: HostBinding,
405
- args: ['attr.data-toggle']
406
- }], haspPopup: [{
407
- type: HostBinding,
408
- args: ['attr.aria-haspopup']
409
- }], expanded: [{
410
- type: HostBinding,
411
- args: ['attr.aria-expanded']
412
- }], dropId: [{
413
- type: HostBinding,
414
- args: ['attr.aria-controls']
415
- }], onClick: [{
416
- type: HostListener,
417
- args: ['click']
418
- }], onCheckOutSideClick: [{
419
- type: HostListener,
420
- args: ['document:click', ['$event.target']]
328
+ class AdbDropdownDirective {
329
+ constructor(elementRef, adbDropdownService) {
330
+ this.elementRef = elementRef;
331
+ this.adbDropdownService = adbDropdownService;
332
+ this.adbDropdown = new EventEmitter();
333
+ this.insideClick = false;
334
+ this.dataToggle = "dropdown";
335
+ this.haspPopup = true;
336
+ this.expanded = false;
337
+ this.id = this.getId();
338
+ this.dropId = this.getId();
339
+ }
340
+ onClick() {
341
+ this.adbDropdownService.currentMenuId = this.id;
342
+ const node = this.elementRef.nativeElement.parentNode;
343
+ const toggleButton = node.querySelector('.dropdown-toggle');
344
+ let style = `transform:translate3d(0px, ${toggleButton?.clientHeight + 1}px, 0px);`;
345
+ const menu = node.querySelector('.dropdown-menu');
346
+ if (menu) {
347
+ this.adbDropdownService.currentMenu = this.elementRef.nativeElement;
348
+ if (menu.classList?.contains('dropdown-menu-end')) {
349
+ style = style + 'inset: 0px 0px auto auto;';
350
+ }
351
+ menu.setAttribute('style', style);
352
+ menu.setAttribute('id', this.dropId);
353
+ if (menu.classList.contains('show')) {
354
+ menu.classList.remove('show');
355
+ this.expanded = false;
356
+ }
357
+ else {
358
+ this.adbDropdown.emit();
359
+ menu.classList.add('show');
360
+ this.expanded = true;
361
+ }
362
+ }
363
+ }
364
+ onCheckOutSideClick(target) {
365
+ if (this.adbDropdownService.currentMenuId === this.id) {
366
+ const parent = this.insideClick ? this.elementRef.nativeElement.parentNode : this.elementRef.nativeElement;
367
+ const clickedInside = parent.contains(target);
368
+ if (!clickedInside) {
369
+ const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
370
+ parent?.classList.remove('show');
371
+ this.expanded = false;
372
+ }
373
+ }
374
+ else {
375
+ const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
376
+ parent?.classList.remove('show');
377
+ this.expanded = false;
378
+ }
379
+ }
380
+ close() {
381
+ const node = this.elementRef.nativeElement.parentNode;
382
+ const menu = node.querySelector('.dropdown-menu');
383
+ menu.classList.remove('show');
384
+ this.expanded = false;
385
+ }
386
+ getId() {
387
+ return '' + Math.floor(Math.random() * Date.now());
388
+ }
389
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownDirective, deps: [{ token: i0.ElementRef }, { token: AdbDropdownService }], target: i0.ɵɵFactoryTarget.Directive }); }
390
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: AdbDropdownDirective, selector: "[adbDropdown]", inputs: { insideClick: "insideClick" }, outputs: { adbDropdown: "adbDropdown" }, host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded", "attr.aria-controls": "this.dropId" } }, exportAs: ["adbDropdown"], ngImport: i0 }); }
391
+ }
392
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownDirective, decorators: [{
393
+ type: Directive,
394
+ args: [{
395
+ selector: '[adbDropdown]',
396
+ exportAs: 'adbDropdown'
397
+ }]
398
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: AdbDropdownService }], propDecorators: { adbDropdown: [{
399
+ type: Output
400
+ }], insideClick: [{
401
+ type: Input
402
+ }], id: [{
403
+ type: HostBinding,
404
+ args: ['id']
405
+ }], dataToggle: [{
406
+ type: HostBinding,
407
+ args: ['attr.data-toggle']
408
+ }], haspPopup: [{
409
+ type: HostBinding,
410
+ args: ['attr.aria-haspopup']
411
+ }], expanded: [{
412
+ type: HostBinding,
413
+ args: ['attr.aria-expanded']
414
+ }], dropId: [{
415
+ type: HostBinding,
416
+ args: ['attr.aria-controls']
417
+ }], onClick: [{
418
+ type: HostListener,
419
+ args: ['click']
420
+ }], onCheckOutSideClick: [{
421
+ type: HostListener,
422
+ args: ['document:click', ['$event.target']]
421
423
  }] } });
422
424
 
423
- class AdbDropdownModule {
424
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
425
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownModule, declarations: [AdbDropdownDirective], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbDropdownDirective] }); }
426
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownModule, providers: [AdbDropdownService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
427
- }
428
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownModule, decorators: [{
429
- type: NgModule,
430
- args: [{
431
- imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
432
- declarations: [AdbDropdownDirective],
433
- exports: [AdbDropdownDirective],
434
- providers: [AdbDropdownService]
435
- }]
425
+ class AdbDropdown2Directive {
426
+ constructor(elementRef, adbDropdownService) {
427
+ this.elementRef = elementRef;
428
+ this.adbDropdownService = adbDropdownService;
429
+ this.adbDropdown = new EventEmitter();
430
+ this.insideClick = false;
431
+ this.dataToggle = "dropdown";
432
+ this.haspPopup = true;
433
+ this.expanded = false;
434
+ this.id = this.getId();
435
+ this.dropId = this.getId();
436
+ }
437
+ onClick() {
438
+ this.adbDropdownService.currentMenuId = this.id;
439
+ const node = this.elementRef.nativeElement.parentNode;
440
+ const menu = node.querySelector('.dropdown-menu');
441
+ if (menu) {
442
+ this.adbDropdownService.currentMenu = this.elementRef.nativeElement;
443
+ this.setMenuPosition(node, menu);
444
+ menu.setAttribute('id', this.dropId);
445
+ if (menu.classList.contains('show')) {
446
+ menu.classList.remove('show');
447
+ this.expanded = false;
448
+ }
449
+ else {
450
+ this.adbDropdown.emit();
451
+ menu.classList.add('show');
452
+ this.expanded = true;
453
+ }
454
+ }
455
+ }
456
+ onCheckOutSideClick(target) {
457
+ if (this.adbDropdownService.currentMenuId === this.id) {
458
+ const parent = this.insideClick ? this.elementRef.nativeElement.parentNode : this.elementRef.nativeElement;
459
+ const clickedInside = parent.contains(target);
460
+ if (!clickedInside) {
461
+ const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
462
+ parent?.classList.remove('show');
463
+ this.expanded = false;
464
+ }
465
+ }
466
+ else {
467
+ const parent = this.elementRef.nativeElement.parentNode.querySelector('.dropdown-menu');
468
+ parent?.classList.remove('show');
469
+ this.expanded = false;
470
+ }
471
+ }
472
+ onWindowScroll() {
473
+ const node = this.elementRef.nativeElement.parentNode;
474
+ const menu = node.querySelector('.dropdown-menu');
475
+ if (menu.classList?.contains('show')) {
476
+ this.setMenuPosition(node, menu);
477
+ }
478
+ }
479
+ setMenuPosition(dropdownNode, menu) {
480
+ const toggleButton = dropdownNode.querySelector('.dropdown-toggle');
481
+ menu.setAttribute('style', 'visibility:hidden');
482
+ menu.setAttribute('style', 'display:block');
483
+ const menuWidth = menu.offsetWidth;
484
+ menu.setAttribute('style', 'visibility:visible');
485
+ menu.setAttribute('style', 'display:none');
486
+ const buttonRect = toggleButton.getBoundingClientRect();
487
+ let menuPosition = `top:${buttonRect.bottom}px;left:${buttonRect.left}px;position:fixed;`;
488
+ if (menu.classList?.contains('dropdown-menu-end')) {
489
+ menuPosition = `top:${buttonRect.bottom}px;left:${buttonRect.right - menuWidth}px;position:fixed;`;
490
+ }
491
+ menu.setAttribute('style', menuPosition);
492
+ }
493
+ close() {
494
+ const node = this.elementRef.nativeElement.parentNode;
495
+ const menu = node.querySelector('.dropdown-menu');
496
+ menu.classList.remove('show');
497
+ this.expanded = false;
498
+ }
499
+ getId() {
500
+ return '' + Math.floor(Math.random() * Date.now());
501
+ }
502
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdown2Directive, deps: [{ token: i0.ElementRef }, { token: AdbDropdownService }], target: i0.ɵɵFactoryTarget.Directive }); }
503
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: AdbDropdown2Directive, selector: "[adbDropdown2]", inputs: { insideClick: "insideClick" }, outputs: { adbDropdown: "adbDropdown" }, host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)", "window:scroll": "onWindowScroll()" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded", "attr.aria-controls": "this.dropId" } }, exportAs: ["adbDropdown"], ngImport: i0 }); }
504
+ }
505
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdown2Directive, decorators: [{
506
+ type: Directive,
507
+ args: [{
508
+ selector: '[adbDropdown2]',
509
+ exportAs: 'adbDropdown'
510
+ }]
511
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: AdbDropdownService }], propDecorators: { adbDropdown: [{
512
+ type: Output
513
+ }], insideClick: [{
514
+ type: Input
515
+ }], id: [{
516
+ type: HostBinding,
517
+ args: ['id']
518
+ }], dataToggle: [{
519
+ type: HostBinding,
520
+ args: ['attr.data-toggle']
521
+ }], haspPopup: [{
522
+ type: HostBinding,
523
+ args: ['attr.aria-haspopup']
524
+ }], expanded: [{
525
+ type: HostBinding,
526
+ args: ['attr.aria-expanded']
527
+ }], dropId: [{
528
+ type: HostBinding,
529
+ args: ['attr.aria-controls']
530
+ }], onClick: [{
531
+ type: HostListener,
532
+ args: ['click']
533
+ }], onCheckOutSideClick: [{
534
+ type: HostListener,
535
+ args: ['document:click', ['$event.target']]
536
+ }], onWindowScroll: [{
537
+ type: HostListener,
538
+ args: ['window:scroll']
539
+ }] } });
540
+
541
+ class AdbDropdownModule {
542
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
543
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownModule, declarations: [AdbDropdownDirective, AdbDropdown2Directive], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbDropdownDirective, AdbDropdown2Directive] }); }
544
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownModule, providers: [AdbDropdownService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
545
+ }
546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDropdownModule, decorators: [{
547
+ type: NgModule,
548
+ args: [{
549
+ imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
550
+ declarations: [AdbDropdownDirective, AdbDropdown2Directive],
551
+ exports: [AdbDropdownDirective, AdbDropdown2Directive],
552
+ providers: [AdbDropdownService]
553
+ }]
436
554
  }] });
437
555
 
438
- class InfiniteScrollComponent {
439
- constructor(_element) {
440
- this._element = _element;
441
- this.onVisible = new EventEmitter();
442
- this.onHidden = new EventEmitter();
443
- this.height = '1px';
444
- this.checkForIntersection = (entries) => {
445
- entries.forEach((entry) => {
446
- const isIntersecting = entry.isIntersecting &&
447
- entry.target === this._element.nativeElement;
448
- if (isIntersecting) {
449
- this.onVisible.emit();
450
- }
451
- else {
452
- this.onHidden.emit();
453
- }
454
- });
455
- };
456
- }
457
- ngAfterViewInit() {
458
- this._intersectionObserver = new IntersectionObserver(entries => {
459
- this.checkForIntersection(entries);
460
- }, {});
461
- this._intersectionObserver.observe(this._element.nativeElement);
462
- }
463
- ngOnDestroy() {
464
- if (this._intersectionObserver) {
465
- this._intersectionObserver.disconnect();
466
- }
467
- }
468
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InfiniteScrollComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
469
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: InfiniteScrollComponent, selector: "[onVisible]", outputs: { onVisible: "onVisible", onHidden: "onHidden" }, host: { properties: { "style.height": "this.height" } }, ngImport: i0 }); }
470
- }
471
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InfiniteScrollComponent, decorators: [{
472
- type: Directive,
473
- args: [{ selector: "[onVisible]" }]
474
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onVisible: [{
475
- type: Output
476
- }], onHidden: [{
477
- type: Output
478
- }], height: [{
479
- type: HostBinding,
480
- args: ['style.height']
556
+ class InfiniteScrollComponent {
557
+ constructor(_element) {
558
+ this._element = _element;
559
+ this.onVisible = new EventEmitter();
560
+ this.onHidden = new EventEmitter();
561
+ this.height = '1px';
562
+ this.checkForIntersection = (entries) => {
563
+ entries.forEach((entry) => {
564
+ const isIntersecting = entry.isIntersecting &&
565
+ entry.target === this._element.nativeElement;
566
+ if (isIntersecting) {
567
+ this.onVisible.emit();
568
+ }
569
+ else {
570
+ this.onHidden.emit();
571
+ }
572
+ });
573
+ };
574
+ }
575
+ ngAfterViewInit() {
576
+ this._intersectionObserver = new IntersectionObserver(entries => {
577
+ this.checkForIntersection(entries);
578
+ }, {});
579
+ this._intersectionObserver.observe(this._element.nativeElement);
580
+ }
581
+ ngOnDestroy() {
582
+ if (this._intersectionObserver) {
583
+ this._intersectionObserver.disconnect();
584
+ }
585
+ }
586
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: InfiniteScrollComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
587
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: InfiniteScrollComponent, selector: "[onVisible]", outputs: { onVisible: "onVisible", onHidden: "onHidden" }, host: { properties: { "style.height": "this.height" } }, ngImport: i0 }); }
588
+ }
589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: InfiniteScrollComponent, decorators: [{
590
+ type: Directive,
591
+ args: [{ selector: "[onVisible]" }]
592
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { onVisible: [{
593
+ type: Output
594
+ }], onHidden: [{
595
+ type: Output
596
+ }], height: [{
597
+ type: HostBinding,
598
+ args: ['style.height']
481
599
  }] } });
482
600
 
483
- class PagerBaseDirective {
484
- constructor() {
485
- this.limit = PagerBaseDirective.DEFAULT_LIMIT;
486
- this.currentPage = 1;
487
- }
488
- static { this.DEFAULT_LIMIT = 10; }
489
- static { this.VISIBLE_PAGES = 5; }
490
- static { this.SKIP_RESOURCE = 'offset'; }
491
- set setTotalCount(value) {
492
- this.totalCount = value;
493
- this.calculatePages();
494
- }
495
- set setLimit(value) {
496
- this.limit = value ?? PagerBaseDirective.DEFAULT_LIMIT;
497
- this.calculatePages();
498
- }
499
- calculatePages() {
500
- if (this.totalCount >= 0 && this.limit > 0) {
501
- this.amountOfPages = Math.ceil(this.totalCount / this.limit);
502
- if ((this.currentPage + 1) > PagerBaseDirective.VISIBLE_PAGES) {
503
- this.pages = [
504
- this.currentPage - 2,
505
- this.currentPage - 1, this.currentPage
506
- ];
507
- const above = this.amountOfPages - this.currentPage;
508
- if (above >= 1) {
509
- this.pages.push(this.currentPage + 1);
510
- }
511
- if (above >= 2) {
512
- this.pages.push(this.currentPage + 2);
513
- }
514
- }
515
- else if (this.totalCount) {
516
- const max = this.amountOfPages > PagerBaseDirective.VISIBLE_PAGES ? 5 : this.amountOfPages;
517
- this.pages = Array(Math.ceil(max)).fill(1).map((x, i) => i + 1);
518
- }
519
- }
520
- else {
521
- this.amountOfPages = 0;
522
- }
523
- }
524
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PagerBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
525
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: PagerBaseDirective, inputs: { setTotalCount: ["totalCount", "setTotalCount"], setLimit: ["limit", "setLimit"] }, ngImport: i0 }); }
526
- }
527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PagerBaseDirective, decorators: [{
528
- type: Directive
529
- }], propDecorators: { setTotalCount: [{
530
- type: Input,
531
- args: ['totalCount']
532
- }], setLimit: [{
533
- type: Input,
534
- args: ['limit']
601
+ class PagerBaseDirective {
602
+ constructor() {
603
+ this.limit = PagerBaseDirective.DEFAULT_LIMIT;
604
+ this.currentPage = 1;
605
+ }
606
+ static { this.DEFAULT_LIMIT = 10; }
607
+ static { this.VISIBLE_PAGES = 5; }
608
+ static { this.SKIP_RESOURCE = 'offset'; }
609
+ set setTotalCount(value) {
610
+ this.totalCount = value;
611
+ this.calculatePages();
612
+ }
613
+ set setLimit(value) {
614
+ this.limit = value ?? PagerBaseDirective.DEFAULT_LIMIT;
615
+ this.calculatePages();
616
+ }
617
+ calculatePages() {
618
+ if (this.totalCount >= 0 && this.limit > 0) {
619
+ this.amountOfPages = Math.ceil(this.totalCount / this.limit);
620
+ if ((this.currentPage + 1) > PagerBaseDirective.VISIBLE_PAGES) {
621
+ this.pages = [
622
+ this.currentPage - 2,
623
+ this.currentPage - 1, this.currentPage
624
+ ];
625
+ const above = this.amountOfPages - this.currentPage;
626
+ if (above >= 1) {
627
+ this.pages.push(this.currentPage + 1);
628
+ }
629
+ if (above >= 2) {
630
+ this.pages.push(this.currentPage + 2);
631
+ }
632
+ }
633
+ else if (this.totalCount) {
634
+ const max = this.amountOfPages > PagerBaseDirective.VISIBLE_PAGES ? 5 : this.amountOfPages;
635
+ this.pages = Array(Math.ceil(max)).fill(1).map((x, i) => i + 1);
636
+ }
637
+ }
638
+ else {
639
+ this.amountOfPages = 0;
640
+ }
641
+ }
642
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: PagerBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
643
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: PagerBaseDirective, inputs: { setTotalCount: ["totalCount", "setTotalCount"], setLimit: ["limit", "setLimit"] }, ngImport: i0 }); }
644
+ }
645
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: PagerBaseDirective, decorators: [{
646
+ type: Directive
647
+ }], propDecorators: { setTotalCount: [{
648
+ type: Input,
649
+ args: ['totalCount']
650
+ }], setLimit: [{
651
+ type: Input,
652
+ args: ['limit']
535
653
  }] } });
536
654
 
537
- class PagerComponent extends PagerBaseDirective {
538
- constructor(activatedRoute) {
539
- super();
540
- this.activatedRoute = activatedRoute;
541
- this.subscription = new Subscription();
542
- this.offsetName = "offset";
543
- this.infiniteLimit = false;
544
- }
545
- ngOnInit() {
546
- this.subscription.add(this.activatedRoute.queryParams.subscribe(params => {
547
- if (params[this.offsetName]) {
548
- this.currentPage = (+params[this.offsetName] / this.limit) + 1;
549
- }
550
- else {
551
- this.currentPage = 1;
552
- }
553
- this.calculatePages();
554
- //create model
555
- this.params = {
556
- first: { [this.offsetName]: 0 },
557
- prev: { [this.offsetName]: (this.currentPage - 2) * this.limit },
558
- pages: [],
559
- next: { [this.offsetName]: this.currentPage * this.limit },
560
- last: { [this.offsetName]: (this.amountOfPages - 1) * this.limit },
561
- };
562
- if (this.pages) {
563
- for (const page of this.pages) {
564
- this.params.pages.push({ name: page, params: { [this.offsetName]: (page - 1) * this.limit } });
565
- }
566
- }
567
- }));
568
- }
569
- ngOnDestroy() {
570
- this.subscription.unsubscribe();
571
- }
572
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PagerComponent, deps: [{ token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
573
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PagerComponent, selector: "adb-pager-nav", inputs: { offsetName: "offsetName", infiniteLimit: "infiniteLimit" }, usesInheritance: true, ngImport: i0, template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.first\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.prev\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\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.name\" *ngFor=\"let page of params.pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"page.params\"\r\n queryParamsHandling=\"merge\">{{page.name}}</a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.next\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\" [attr.aria-disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] }); }
574
- }
575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PagerComponent, decorators: [{
576
- type: Component,
577
- args: [{ selector: 'adb-pager-nav', template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.first\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.prev\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\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.name\" *ngFor=\"let page of params.pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"page.params\"\r\n queryParamsHandling=\"merge\">{{page.name}}</a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.next\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\" [attr.aria-disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>" }]
578
- }], ctorParameters: function () { return [{ type: i2.ActivatedRoute }]; }, propDecorators: { offsetName: [{
579
- type: Input
580
- }], infiniteLimit: [{
581
- type: Input
655
+ class PagerComponent extends PagerBaseDirective {
656
+ constructor(activatedRoute) {
657
+ super();
658
+ this.activatedRoute = activatedRoute;
659
+ this.subscription = new Subscription();
660
+ this.offsetName = "offset";
661
+ this.infiniteLimit = false;
662
+ }
663
+ ngOnInit() {
664
+ this.subscription.add(this.activatedRoute.queryParams.subscribe(params => {
665
+ if (params[this.offsetName]) {
666
+ this.currentPage = (+params[this.offsetName] / this.limit) + 1;
667
+ }
668
+ else {
669
+ this.currentPage = 1;
670
+ }
671
+ this.calculatePages();
672
+ //create model
673
+ this.params = {
674
+ first: { [this.offsetName]: 0 },
675
+ prev: { [this.offsetName]: (this.currentPage - 2) * this.limit },
676
+ pages: [],
677
+ next: { [this.offsetName]: this.currentPage * this.limit },
678
+ last: { [this.offsetName]: (this.amountOfPages - 1) * this.limit },
679
+ };
680
+ if (this.pages) {
681
+ for (const page of this.pages) {
682
+ this.params.pages.push({ name: page, params: { [this.offsetName]: (page - 1) * this.limit } });
683
+ }
684
+ }
685
+ }));
686
+ }
687
+ ngOnDestroy() {
688
+ this.subscription.unsubscribe();
689
+ }
690
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: PagerComponent, deps: [{ token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
691
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: PagerComponent, selector: "adb-pager-nav", inputs: { offsetName: "offsetName", infiniteLimit: "infiniteLimit" }, usesInheritance: true, ngImport: i0, template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.first\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.prev\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\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.name\" *ngFor=\"let page of params.pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"page.params\"\r\n queryParamsHandling=\"merge\">{{page.name}}</a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.next\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\" [attr.aria-disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] }); }
692
+ }
693
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: PagerComponent, decorators: [{
694
+ type: Component,
695
+ args: [{ selector: 'adb-pager-nav', template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end my-1\">\r\n <ul class=\"pagination mb-0\">\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.first\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\r\n <i class=\"fas fa-chevron-double-left\"></i>\r\n </a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.prev\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage===1}\" [attr.aria-disabled]=\"currentPage===1\">\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.name\" *ngFor=\"let page of params.pages\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"page.params\"\r\n queryParamsHandling=\"merge\">{{page.name}}</a>\r\n </li>\r\n <li class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.next\" queryParamsHandling=\"merge\"\r\n [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\" [attr.aria-disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </a>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <a class=\"page-link\" [routerLink]=\"[]\" [queryParams]=\"params.last\" queryParamsHandling=\"merge\"\r\n [attr.aria-disabled]=\"currentPage>=amountOfPages\" [ngClass]=\"{'pe-none opacity-50':currentPage>=amountOfPages}\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </a>\r\n </li>\r\n </ul>\r\n</nav>" }]
696
+ }], ctorParameters: () => [{ type: i2.ActivatedRoute }], propDecorators: { offsetName: [{
697
+ type: Input
698
+ }], infiniteLimit: [{
699
+ type: Input
582
700
  }] } });
583
701
 
584
- class PagerInlineComponent extends PagerBaseDirective {
585
- constructor() {
586
- super();
587
- this.pageChanged = new EventEmitter();
588
- this.infiniteLimit = false;
589
- }
590
- ngOnInit() {
591
- this.calculatePages();
592
- }
593
- onFirstClick() {
594
- this.currentPage = 1;
595
- this.pageChanged.emit(this.currentPage - 1);
596
- this.calculatePages();
597
- }
598
- onPrevClick() {
599
- this.currentPage = this.currentPage - 1;
600
- this.pageChanged.emit(this.currentPage - 1);
601
- this.calculatePages();
602
- }
603
- onPageClick(page) {
604
- this.currentPage = page;
605
- this.pageChanged.emit(this.currentPage - 1);
606
- }
607
- onNextClick() {
608
- this.currentPage = this.currentPage + 1;
609
- this.pageChanged.emit(this.currentPage - 1);
610
- this.calculatePages();
611
- }
612
- onLastClick() {
613
- this.currentPage = this.amountOfPages;
614
- this.pageChanged.emit(this.currentPage - 1);
615
- this.calculatePages();
616
- }
617
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PagerInlineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
618
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PagerInlineComponent, selector: "adb-pager", inputs: { infiniteLimit: "infiniteLimit" }, outputs: { pageChanged: "pageChanged" }, usesInheritance: true, ngImport: i0, template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end pr-2 my-1\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onFirstClick()\" [ngClass]=\"currentPage==1?'opacity-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-double-left\"></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-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </button>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage==page\" *ngFor=\"let page of pages\">\r\n <button class=\"page-link\" (click)=\"onPageClick(page)\">\r\n {{page}}\r\n </button>\r\n </li>\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onNextClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </button>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ul>\r\n</nav>\r\n", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
619
- }
620
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PagerInlineComponent, decorators: [{
621
- type: Component,
622
- args: [{ selector: 'adb-pager', template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end pr-2 my-1\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onFirstClick()\" [ngClass]=\"currentPage==1?'opacity-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-double-left\"></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-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </button>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage==page\" *ngFor=\"let page of pages\">\r\n <button class=\"page-link\" (click)=\"onPageClick(page)\">\r\n {{page}}\r\n </button>\r\n </li>\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onNextClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </button>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ul>\r\n</nav>\r\n" }]
623
- }], ctorParameters: function () { return []; }, propDecorators: { pageChanged: [{
624
- type: Output
625
- }], infiniteLimit: [{
626
- type: Input
702
+ class PagerInlineComponent extends PagerBaseDirective {
703
+ constructor() {
704
+ super();
705
+ this.pageChanged = new EventEmitter();
706
+ this.infiniteLimit = false;
707
+ }
708
+ ngOnInit() {
709
+ this.calculatePages();
710
+ }
711
+ onFirstClick() {
712
+ this.currentPage = 1;
713
+ this.pageChanged.emit(this.currentPage - 1);
714
+ this.calculatePages();
715
+ }
716
+ onPrevClick() {
717
+ this.currentPage = this.currentPage - 1;
718
+ this.pageChanged.emit(this.currentPage - 1);
719
+ this.calculatePages();
720
+ }
721
+ onPageClick(page) {
722
+ this.currentPage = page;
723
+ this.pageChanged.emit(this.currentPage - 1);
724
+ }
725
+ onNextClick() {
726
+ this.currentPage = this.currentPage + 1;
727
+ this.pageChanged.emit(this.currentPage - 1);
728
+ this.calculatePages();
729
+ }
730
+ onLastClick() {
731
+ this.currentPage = this.amountOfPages;
732
+ this.pageChanged.emit(this.currentPage - 1);
733
+ this.calculatePages();
734
+ }
735
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: PagerInlineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
736
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: PagerInlineComponent, selector: "adb-pager", inputs: { infiniteLimit: "infiniteLimit" }, outputs: { pageChanged: "pageChanged" }, usesInheritance: true, ngImport: i0, template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end pr-2 my-1\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onFirstClick()\" [ngClass]=\"currentPage==1?'opacity-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-double-left\"></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-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </button>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage==page\" *ngFor=\"let page of pages\">\r\n <button class=\"page-link\" (click)=\"onPageClick(page)\">\r\n {{page}}\r\n </button>\r\n </li>\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onNextClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </button>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ul>\r\n</nav>\r\n", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
737
+ }
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: PagerInlineComponent, decorators: [{
739
+ type: Component,
740
+ args: [{ selector: 'adb-pager', template: "<nav *ngIf=\"pages&&pages.length>1&&currentPage<=amountOfPages\" class=\"d-flex justify-content-end pr-2 my-1\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onFirstClick()\" [ngClass]=\"currentPage==1?'opacity-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-double-left\"></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-50 pe-none':''\" [disabled]=\"currentPage==1\">\r\n <i class=\"fas fa-chevron-left\"></i>\r\n </button>\r\n </li>\r\n <li class=\"page-item\" [class.active]=\"currentPage==page\" *ngFor=\"let page of pages\">\r\n <button class=\"page-link\" (click)=\"onPageClick(page)\">\r\n {{page}}\r\n </button>\r\n </li>\r\n <li class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onNextClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-right\"></i>\r\n </button>\r\n </li>\r\n <ng-container *ngIf=\"!infiniteLimit\">\r\n <li *ngIf=\"(amountOfPages-1)*limit<10000\" class=\"page-item\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ng-container>\r\n <li class=\"page-item\" *ngIf=\"infiniteLimit\">\r\n <button class=\"page-link\" (click)=\"onLastClick()\" [ngClass]=\"currentPage>=amountOfPages?'opacity-50 pe-none':''\" [disabled]=\"currentPage>=amountOfPages\">\r\n <i class=\"fas fa-chevron-double-right\"></i>\r\n </button>\r\n </li>\r\n </ul>\r\n</nav>\r\n" }]
741
+ }], ctorParameters: () => [], propDecorators: { pageChanged: [{
742
+ type: Output
743
+ }], infiniteLimit: [{
744
+ type: Input
627
745
  }] } });
628
746
 
629
- class AdbPagersModule {
630
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPagersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
631
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbPagersModule, declarations: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent], imports: [CommonModule,
632
- RouterModule], exports: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent] }); }
633
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPagersModule, imports: [CommonModule,
634
- RouterModule] }); }
635
- }
636
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPagersModule, decorators: [{
637
- type: NgModule,
638
- args: [{
639
- imports: [
640
- CommonModule,
641
- RouterModule
642
- ],
643
- declarations: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent],
644
- exports: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent]
645
- }]
747
+ class AdbPagersModule {
748
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbPagersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
749
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbPagersModule, declarations: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent], imports: [CommonModule,
750
+ RouterModule], exports: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent] }); }
751
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbPagersModule, imports: [CommonModule,
752
+ RouterModule] }); }
753
+ }
754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbPagersModule, decorators: [{
755
+ type: NgModule,
756
+ args: [{
757
+ imports: [
758
+ CommonModule,
759
+ RouterModule
760
+ ],
761
+ declarations: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent],
762
+ exports: [InfiniteScrollComponent, PagerComponent, PagerInlineComponent]
763
+ }]
646
764
  }] });
647
765
 
648
- class ADBHeaderModule {
649
- static forRoot(environment) {
650
- return {
651
- ngModule: ADBHeaderModule,
652
- providers: [
653
- EnvironmentService$1,
654
- {
655
- provide: 'env',
656
- useValue: environment
657
- }
658
- ]
659
- };
660
- }
661
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
662
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, declarations: [ADBNavComponent], imports: [CommonModule,
663
- HttpClientModule,
664
- RouterModule,
665
- TranslateModule,
666
- AdbDirectivesModule,
667
- AdbDropdownModule,
668
- AdbPagersModule], exports: [ADBNavComponent] }); }
669
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, imports: [CommonModule,
670
- HttpClientModule,
671
- RouterModule,
672
- TranslateModule,
673
- AdbDirectivesModule,
674
- AdbDropdownModule,
675
- AdbPagersModule] }); }
676
- }
677
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, decorators: [{
678
- type: NgModule,
679
- args: [{
680
- declarations: [ADBNavComponent],
681
- imports: [
682
- CommonModule,
683
- HttpClientModule,
684
- RouterModule,
685
- TranslateModule,
686
- AdbDirectivesModule,
687
- AdbDropdownModule,
688
- AdbPagersModule
689
- ],
690
- exports: [ADBNavComponent]
691
- }]
766
+ class ADBHeaderModule {
767
+ static forRoot(environment) {
768
+ return {
769
+ ngModule: ADBHeaderModule,
770
+ providers: [
771
+ EnvironmentService$1,
772
+ {
773
+ provide: 'env', // you can also use InjectionToken
774
+ useValue: environment
775
+ }
776
+ ]
777
+ };
778
+ }
779
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ADBHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
780
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: ADBHeaderModule, declarations: [ADBNavComponent], imports: [CommonModule,
781
+ RouterModule,
782
+ TranslateModule,
783
+ AdbDirectivesModule,
784
+ AdbDropdownModule,
785
+ AdbPagersModule], exports: [ADBNavComponent] }); }
786
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ADBHeaderModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
787
+ RouterModule,
788
+ TranslateModule,
789
+ AdbDirectivesModule,
790
+ AdbDropdownModule,
791
+ AdbPagersModule] }); }
792
+ }
793
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ADBHeaderModule, decorators: [{
794
+ type: NgModule,
795
+ args: [{ declarations: [ADBNavComponent],
796
+ exports: [ADBNavComponent], imports: [CommonModule,
797
+ RouterModule,
798
+ TranslateModule,
799
+ AdbDirectivesModule,
800
+ AdbDropdownModule,
801
+ AdbPagersModule], providers: [provideHttpClient(withInterceptorsFromDi())] }]
692
802
  }] });
693
803
 
694
- class EnvironmentService {
695
- constructor(environment) {
696
- this.environment = environment;
697
- }
698
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); }
699
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService }); }
700
- }
701
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService, decorators: [{
702
- type: Injectable
703
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
704
- type: Inject,
705
- args: ['env']
706
- }] }]; } });
804
+ class EnvironmentService {
805
+ constructor(environment) {
806
+ this.environment = environment;
807
+ }
808
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EnvironmentService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); }
809
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EnvironmentService }); }
810
+ }
811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EnvironmentService, decorators: [{
812
+ type: Injectable
813
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
814
+ type: Inject,
815
+ args: ['env']
816
+ }] }] });
707
817
 
708
- class ArtportalenNavComponent {
709
- set userName(fullName) {
710
- this.fullName = fullName;
711
- }
712
- ;
713
- constructor(httpClient, router, trans, envService) {
714
- this.httpClient = httpClient;
715
- this.router = router;
716
- this.trans = trans;
717
- this.envService = envService;
718
- this.subscription = new Subscription();
719
- this.loginClicked = new EventEmitter();
720
- this.logoutClicked = new EventEmitter();
721
- this.dropMenuChange = new EventEmitter();
722
- this.showPattern = false;
723
- this.translationFinished = false;
724
- this.lastPosition = 0;
725
- this.showNavMenu = false;
726
- this.showUserMenu = false;
727
- this.showReport = true;
728
- this.showObservations = true;
729
- this.showSubs = false;
730
- }
731
- ngOnInit() {
732
- this.url = window.location.href;
733
- const baseUrl = this.envService.environment.resourceUrl;
734
- const url = '/assets/artportalen/links-ap3.json';
735
- this.subscription.add(this.httpClient.get(baseUrl + url).subscribe(result => {
736
- this.navigation = result;
737
- }));
738
- this.initTranslations(baseUrl);
739
- this.router.events.subscribe((event) => {
740
- if (event instanceof NavigationEnd) {
741
- this.showNavMenu = false;
742
- this.dropMenuChange.emit(this.showNavMenu);
743
- }
744
- });
745
- }
746
- showMenuDropdown(show) {
747
- this.showUserMenu = false;
748
- if (this.showNavMenu !== show) {
749
- this.showNavMenu = show;
750
- this.dropMenuChange.emit(show);
751
- }
752
- }
753
- setLanguage(lang) {
754
- this.trans.use(lang);
755
- this.showNavMenu = false;
756
- this.dropMenuChange.emit(false);
757
- }
758
- onUserClick() {
759
- if (this.fullName) {
760
- this.logout();
761
- }
762
- else {
763
- this.login();
764
- }
765
- }
766
- login() {
767
- this.loginClicked.emit();
768
- }
769
- logout() {
770
- this.logoutClicked.emit();
771
- }
772
- initTranslations(baseUrl) {
773
- if (this.trans.store.translations[this.trans.currentLang]) {
774
- this.loadTranslation(baseUrl, this.trans.currentLang);
775
- }
776
- this.subscription.add(this.trans.onLangChange.subscribe((event) => {
777
- this.translationFinished = false;
778
- this.loadTranslation(baseUrl, event.lang);
779
- }));
780
- }
781
- loadTranslation(baseUrl, lang) {
782
- //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
783
- const url = baseUrl + `/assets/artportalen/i18n/${lang}.json`;
784
- this.subscription.add(this.httpClient.get(url).subscribe(translations => {
785
- this.trans.setTranslation(lang, translations, true);
786
- this.translationFinished = true;
787
- }));
788
- }
789
- ngOnDestroy() {
790
- this.subscription.unsubscribe();
791
- }
792
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavComponent, deps: [{ token: i1.HttpClient }, { token: i2.Router }, { token: i1$1.TranslateService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
793
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ArtportalenNavComponent, 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 <header class=\"container-lg px-0\" *ngIf=\"translationFinished\">\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]=\"navigation?.home\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artportalen beta</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=\"fas fa-bars\"></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 <div *ngIf=\"navigation\" 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\">Artportalen beta</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 <ng-container *ngIf=\"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 </ng-container>\r\n <ng-container *ngIf=\"!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 <a *ngIf=\"navigation\" class=\"text-white\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\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=\"fas\" [ngClass]=\"showReport?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showReport\" 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 <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=\"fas\" [ngClass]=\"showObservations?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showObservations\" 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 <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=\"fas\" [ngClass]=\"showSubs?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showSubs\" 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 <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 <i class=\"fas fa-external-link\"></i>\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 <i class=\"fas fa-external-link\"></i>\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 <span class=\"fas fa-external-link\"></span>\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</div>", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
794
- }
795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavComponent, decorators: [{
796
- type: Component,
797
- args: [{ selector: 'adb-artportalen-nav', template: "<div class=\"bg-primary adb-main-header position-static\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n <header class=\"container-lg px-0\" *ngIf=\"translationFinished\">\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]=\"navigation?.home\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artportalen beta</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=\"fas fa-bars\"></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 <div *ngIf=\"navigation\" 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\">Artportalen beta</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 <ng-container *ngIf=\"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 </ng-container>\r\n <ng-container *ngIf=\"!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 <a *ngIf=\"navigation\" class=\"text-white\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\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=\"fas\" [ngClass]=\"showReport?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showReport\" 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 <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=\"fas\" [ngClass]=\"showObservations?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showObservations\" 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 <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=\"fas\" [ngClass]=\"showSubs?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showSubs\" 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 <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 <i class=\"fas fa-external-link\"></i>\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 <i class=\"fas fa-external-link\"></i>\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 <span class=\"fas fa-external-link\"></span>\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</div>" }]
798
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.Router }, { type: i1$1.TranslateService }, { type: EnvironmentService }]; }, propDecorators: { loginClicked: [{
799
- type: Output
800
- }], logoutClicked: [{
801
- type: Output
802
- }], dropMenuChange: [{
803
- type: Output
804
- }], showPattern: [{
805
- type: Input
806
- }], userName: [{
807
- type: Input
818
+ class ArtportalenNavComponent {
819
+ set userName(fullName) {
820
+ this.fullName = fullName;
821
+ }
822
+ ;
823
+ constructor(httpClient, router, trans, envService) {
824
+ this.httpClient = httpClient;
825
+ this.router = router;
826
+ this.trans = trans;
827
+ this.envService = envService;
828
+ this.subscription = new Subscription();
829
+ this.loginClicked = new EventEmitter();
830
+ this.logoutClicked = new EventEmitter();
831
+ this.dropMenuChange = new EventEmitter();
832
+ this.showPattern = false;
833
+ this.translationFinished = false;
834
+ this.lastPosition = 0;
835
+ this.showNavMenu = false;
836
+ this.showUserMenu = false;
837
+ this.showReport = true;
838
+ this.showObservations = true;
839
+ this.showSubs = false;
840
+ }
841
+ ngOnInit() {
842
+ this.url = window.location.href;
843
+ const baseUrl = this.envService.environment.resourceUrl;
844
+ const url = '/assets/artportalen/links-ap3.json';
845
+ this.subscription.add(this.httpClient.get(baseUrl + url).subscribe(result => {
846
+ this.navigation = result;
847
+ }));
848
+ this.initTranslations(baseUrl);
849
+ this.router.events.subscribe((event) => {
850
+ if (event instanceof NavigationEnd) {
851
+ this.showNavMenu = false;
852
+ this.dropMenuChange.emit(this.showNavMenu);
853
+ }
854
+ });
855
+ }
856
+ showMenuDropdown(show) {
857
+ this.showUserMenu = false;
858
+ if (this.showNavMenu !== show) {
859
+ this.showNavMenu = show;
860
+ this.dropMenuChange.emit(show);
861
+ }
862
+ }
863
+ setLanguage(lang) {
864
+ this.trans.use(lang);
865
+ this.showNavMenu = false;
866
+ this.dropMenuChange.emit(false);
867
+ }
868
+ onUserClick() {
869
+ if (this.fullName) {
870
+ this.logout();
871
+ }
872
+ else {
873
+ this.login();
874
+ }
875
+ }
876
+ login() {
877
+ this.loginClicked.emit();
878
+ }
879
+ logout() {
880
+ this.logoutClicked.emit();
881
+ }
882
+ initTranslations(baseUrl) {
883
+ if (this.trans.store.translations[this.trans.currentLang]) {
884
+ this.loadTranslation(baseUrl, this.trans.currentLang);
885
+ }
886
+ this.subscription.add(this.trans.onLangChange.subscribe((event) => {
887
+ this.translationFinished = false;
888
+ this.loadTranslation(baseUrl, event.lang);
889
+ }));
890
+ }
891
+ loadTranslation(baseUrl, lang) {
892
+ //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
893
+ const url = baseUrl + `/assets/artportalen/i18n/${lang}.json`;
894
+ this.subscription.add(this.httpClient.get(url).subscribe(translations => {
895
+ this.trans.setTranslation(lang, translations, true);
896
+ this.translationFinished = true;
897
+ }));
898
+ }
899
+ ngOnDestroy() {
900
+ this.subscription.unsubscribe();
901
+ }
902
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenNavComponent, deps: [{ token: i1.HttpClient }, { token: i2.Router }, { token: i1$1.TranslateService }, { token: EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
903
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: ArtportalenNavComponent, 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 <header class=\"container-lg px-0\" *ngIf=\"translationFinished\">\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]=\"navigation?.home\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artportalen beta</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=\"fas fa-bars\"></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 <div *ngIf=\"navigation\" 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\">Artportalen beta</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 <ng-container *ngIf=\"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 </ng-container>\r\n <ng-container *ngIf=\"!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 <a *ngIf=\"navigation\" class=\"text-white\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\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=\"fas\" [ngClass]=\"showReport?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showReport\" 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 <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=\"fas\" [ngClass]=\"showObservations?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showObservations\" 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 <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=\"fas\" [ngClass]=\"showSubs?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showSubs\" 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 <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 <i class=\"fas fa-external-link\"></i>\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 <i class=\"fas fa-external-link\"></i>\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 <span class=\"fas fa-external-link\"></span>\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</div>", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
904
+ }
905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenNavComponent, decorators: [{
906
+ type: Component,
907
+ args: [{ selector: 'adb-artportalen-nav', template: "<div class=\"bg-primary adb-main-header position-static\" (adbClickOutside)=\"showMenuDropdown(false);\">\r\n <header class=\"container-lg px-0\" *ngIf=\"translationFinished\">\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]=\"navigation?.home\" class=\"text-white text-decoration-none fs-1 fw-bold\">Artportalen beta</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=\"fas fa-bars\"></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 <div *ngIf=\"navigation\" 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\">Artportalen beta</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 <ng-container *ngIf=\"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 </ng-container>\r\n <ng-container *ngIf=\"!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 <a *ngIf=\"navigation\" class=\"text-white\" href=\"{{navigation.createAccountLink}}?lang={{trans.currentLang}}&returnUrl={{url}}\">\r\n {{'HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\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=\"fas\" [ngClass]=\"showReport?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showReport\" 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 <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=\"fas\" [ngClass]=\"showObservations?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showObservations\" 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 <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=\"fas\" [ngClass]=\"showSubs?'fa-chevron-up':'fa-chevron-down'\"></span>\r\n </button>\r\n </div>\r\n </li>\r\n <li class=\"list-group-item bg-primary pt-0 px-3\" *ngIf=\"showSubs\" 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 <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 <i class=\"fas fa-external-link\"></i>\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 <i class=\"fas fa-external-link\"></i>\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 <span class=\"fas fa-external-link\"></span>\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</div>" }]
908
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.Router }, { type: i1$1.TranslateService }, { type: EnvironmentService }], propDecorators: { loginClicked: [{
909
+ type: Output
910
+ }], logoutClicked: [{
911
+ type: Output
912
+ }], dropMenuChange: [{
913
+ type: Output
914
+ }], showPattern: [{
915
+ type: Input
916
+ }], userName: [{
917
+ type: Input
808
918
  }] } });
809
919
 
810
- class ArtportalenFooterComponent {
811
- constructor(httpClient, envService, trans) {
812
- this.httpClient = httpClient;
813
- this.envService = envService;
814
- this.trans = trans;
815
- this.subscription = new Subscription();
816
- this.translationFinished = false;
817
- }
818
- ngOnInit() {
819
- this.url = window.location.href;
820
- this.baseUrl = this.envService.environment.resourceUrl;
821
- this.initTranslations(this.baseUrl);
822
- }
823
- initTranslations(baseUrl) {
824
- if (this.trans.store.translations[this.trans.currentLang]) {
825
- this.loadTranslation(baseUrl, this.trans.currentLang);
826
- }
827
- this.subscription.add(this.trans.onLangChange.subscribe((event) => {
828
- this.translationFinished = false;
829
- this.loadTranslation(baseUrl, event.lang);
830
- }));
831
- }
832
- loadTranslation(baseUrl, lang) {
833
- //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
834
- const url = baseUrl + `/assets/artportalen/i18n/${lang}.json`;
835
- this.subscription.add(this.httpClient.get(url).subscribe(translations => {
836
- this.trans.setTranslation(lang, translations, true);
837
- this.translationFinished = true;
838
- }));
839
- }
840
- ngOnDestroy() {
841
- this.subscription.unsubscribe();
842
- }
843
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenFooterComponent, deps: [{ token: i1.HttpClient }, { token: EnvironmentService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
844
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ArtportalenFooterComponent, selector: "adb-artportalen-footer", ngImport: i0, template: "<footer class=\"bg-primary-dark py-2 mt-auto container-fluid\" *ngIf=\"translationFinished\">\r\n <div class=\"d-flex justify-content-center\">\r\n <div class=\"container py-3 px-5 justify-content-center text-white\">\r\n <div class=\"row mb-4\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4 mb-3\">\r\n <a href=\"https://www.artdatabanken.se/artportalen/\" class=\"d-block text-white mb-2\">{{'FOOTER.ABOUT'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/artportalen-tillganglighetsredogorelse\" class=\"d-block text-white mb-2\">{{'FOOTER.WCAG'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/kontakt/support\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.SUPPORT'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/tjanster-och-miljodata/villkor-kontohavare\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.TERMS_OF_USE'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/behandling-av-personuppgifter\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.PERSONAL_DATA'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-2\" style=\"font-variant: small-caps;\"><sub><strong>{{'FOOTER.PARTNERS'|translate}}</strong></sub></div>\r\n <a href=\"https://birdlife.se\" class=\"d-block text-white mb-2\"><span class=\"me-1\">Birdlife Sverige</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://svenskbotanik.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Svenska Botaniska F\u00F6reningen</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.sef.nu\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Entomologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.svampar.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Mykologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-3 text-white\">\r\n <div>{{'FOOTER.INFO'|translate}}</div>\r\n <div>{{'FOOTER.INFO2'|translate}}</div>\r\n <div>{{'FOOTER.INFO3'|translate}}\r\n <a href=\"https://www.naturvardsverket.se\" class=\"text-white mb-2\"><u class=\"me-1\">Naturv\u00E5rdsverket.</u><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n </div>\r\n <div class=\"mb-3\">{{'FOOTER.INFO4'|translate}}.</div>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <a class=\"text-white text-decoration-none d-flex gap-2 mb-3\" href=\"https://www.artdatabanken.se/\" target=\"new\">\r\n <img class=\"d-block d-md-none\" style=\"height: 2.6rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <img class=\"d-none d-md-block\" style=\"height: 2rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <div class=\"border-end d-none d-sm-block\"></div>\r\n <div class=\"border-end d-block d-sm-none\"></div>\r\n <img class=\"d-none d-md-block align-self-center pe-5\" style=\"height: 0.7rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n <img class=\"d-block d-md-none align-self-center pe-5\" style=\"height: 0.8rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n </a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n</footer>", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
845
- }
846
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenFooterComponent, decorators: [{
847
- type: Component,
848
- args: [{ selector: 'adb-artportalen-footer', template: "<footer class=\"bg-primary-dark py-2 mt-auto container-fluid\" *ngIf=\"translationFinished\">\r\n <div class=\"d-flex justify-content-center\">\r\n <div class=\"container py-3 px-5 justify-content-center text-white\">\r\n <div class=\"row mb-4\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4 mb-3\">\r\n <a href=\"https://www.artdatabanken.se/artportalen/\" class=\"d-block text-white mb-2\">{{'FOOTER.ABOUT'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/artportalen-tillganglighetsredogorelse\" class=\"d-block text-white mb-2\">{{'FOOTER.WCAG'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/kontakt/support\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.SUPPORT'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/tjanster-och-miljodata/villkor-kontohavare\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.TERMS_OF_USE'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/behandling-av-personuppgifter\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.PERSONAL_DATA'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-2\" style=\"font-variant: small-caps;\"><sub><strong>{{'FOOTER.PARTNERS'|translate}}</strong></sub></div>\r\n <a href=\"https://birdlife.se\" class=\"d-block text-white mb-2\"><span class=\"me-1\">Birdlife Sverige</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://svenskbotanik.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Svenska Botaniska F\u00F6reningen</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.sef.nu\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Entomologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.svampar.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Mykologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-3 text-white\">\r\n <div>{{'FOOTER.INFO'|translate}}</div>\r\n <div>{{'FOOTER.INFO2'|translate}}</div>\r\n <div>{{'FOOTER.INFO3'|translate}}\r\n <a href=\"https://www.naturvardsverket.se\" class=\"text-white mb-2\"><u class=\"me-1\">Naturv\u00E5rdsverket.</u><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n </div>\r\n <div class=\"mb-3\">{{'FOOTER.INFO4'|translate}}.</div>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <a class=\"text-white text-decoration-none d-flex gap-2 mb-3\" href=\"https://www.artdatabanken.se/\" target=\"new\">\r\n <img class=\"d-block d-md-none\" style=\"height: 2.6rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <img class=\"d-none d-md-block\" style=\"height: 2rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <div class=\"border-end d-none d-sm-block\"></div>\r\n <div class=\"border-end d-block d-sm-none\"></div>\r\n <img class=\"d-none d-md-block align-self-center pe-5\" style=\"height: 0.7rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n <img class=\"d-block d-md-none align-self-center pe-5\" style=\"height: 0.8rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n </a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n</footer>" }]
849
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EnvironmentService }, { type: i1$1.TranslateService }]; } });
920
+ class ArtportalenFooterComponent {
921
+ constructor(httpClient, envService, trans) {
922
+ this.httpClient = httpClient;
923
+ this.envService = envService;
924
+ this.trans = trans;
925
+ this.subscription = new Subscription();
926
+ this.translationFinished = false;
927
+ }
928
+ ngOnInit() {
929
+ this.url = window.location.href;
930
+ this.baseUrl = this.envService.environment.resourceUrl;
931
+ this.initTranslations(this.baseUrl);
932
+ }
933
+ initTranslations(baseUrl) {
934
+ if (this.trans.store.translations[this.trans.currentLang]) {
935
+ this.loadTranslation(baseUrl, this.trans.currentLang);
936
+ }
937
+ this.subscription.add(this.trans.onLangChange.subscribe((event) => {
938
+ this.translationFinished = false;
939
+ this.loadTranslation(baseUrl, event.lang);
940
+ }));
941
+ }
942
+ loadTranslation(baseUrl, lang) {
943
+ //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
944
+ const url = baseUrl + `/assets/artportalen/i18n/${lang}.json`;
945
+ this.subscription.add(this.httpClient.get(url).subscribe(translations => {
946
+ this.trans.setTranslation(lang, translations, true);
947
+ this.translationFinished = true;
948
+ }));
949
+ }
950
+ ngOnDestroy() {
951
+ this.subscription.unsubscribe();
952
+ }
953
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenFooterComponent, deps: [{ token: i1.HttpClient }, { token: EnvironmentService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
954
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: ArtportalenFooterComponent, selector: "adb-artportalen-footer", ngImport: i0, template: "<footer class=\"bg-primary-dark py-2 mt-auto container-fluid\" *ngIf=\"translationFinished\">\r\n <div class=\"d-flex justify-content-center\">\r\n <div class=\"container py-3 px-5 justify-content-center text-white\">\r\n <div class=\"row mb-4\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4 mb-3\">\r\n <a href=\"https://www.artdatabanken.se/artportalen/\" class=\"d-block text-white mb-2\">{{'FOOTER.ABOUT'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/artportalen-tillganglighetsredogorelse\" class=\"d-block text-white mb-2\">{{'FOOTER.WCAG'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/kontakt/support\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.SUPPORT'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/tjanster-och-miljodata/villkor-kontohavare\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.TERMS_OF_USE'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/behandling-av-personuppgifter\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.PERSONAL_DATA'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-2\" style=\"font-variant: small-caps;\"><sub><strong>{{'FOOTER.PARTNERS'|translate}}</strong></sub></div>\r\n <a href=\"https://birdlife.se\" class=\"d-block text-white mb-2\"><span class=\"me-1\">Birdlife Sverige</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://svenskbotanik.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Svenska Botaniska F\u00F6reningen</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.sef.nu\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Entomologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.svampar.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Mykologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-3 text-white\">\r\n <div>{{'FOOTER.INFO'|translate}}</div>\r\n <div>{{'FOOTER.INFO2'|translate}}</div>\r\n <div>{{'FOOTER.INFO3'|translate}}\r\n <a href=\"https://www.naturvardsverket.se\" class=\"text-white mb-2\"><u class=\"me-1\">Naturv\u00E5rdsverket.</u><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n </div>\r\n <div class=\"mb-3\">{{'FOOTER.INFO4'|translate}}.</div>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <a class=\"text-white text-decoration-none d-flex gap-2 mb-3\" href=\"https://www.artdatabanken.se/\" target=\"new\">\r\n <img class=\"d-block d-md-none\" style=\"height: 2.6rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <img class=\"d-none d-md-block\" style=\"height: 2rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <div class=\"border-end d-none d-sm-block\"></div>\r\n <div class=\"border-end d-block d-sm-none\"></div>\r\n <img class=\"d-none d-md-block align-self-center pe-5\" style=\"height: 0.7rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n <img class=\"d-block d-md-none align-self-center pe-5\" style=\"height: 0.8rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n </a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n</footer>", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
955
+ }
956
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenFooterComponent, decorators: [{
957
+ type: Component,
958
+ args: [{ selector: 'adb-artportalen-footer', template: "<footer class=\"bg-primary-dark py-2 mt-auto container-fluid\" *ngIf=\"translationFinished\">\r\n <div class=\"d-flex justify-content-center\">\r\n <div class=\"container py-3 px-5 justify-content-center text-white\">\r\n <div class=\"row mb-4\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4 mb-3\">\r\n <a href=\"https://www.artdatabanken.se/artportalen/\" class=\"d-block text-white mb-2\">{{'FOOTER.ABOUT'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/artportalen-tillganglighetsredogorelse\" class=\"d-block text-white mb-2\">{{'FOOTER.WCAG'|translate}}</a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/kontakt/support\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.SUPPORT'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/tjanster-och-miljodata/villkor-kontohavare\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.TERMS_OF_USE'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.artdatabanken.se/om-oss/behandling-av-personuppgifter\" class=\"d-block text-white mb-2\"><span class=\"me-1\">{{'FOOTER.PERSONAL_DATA'|translate}}</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-2\" style=\"font-variant: small-caps;\"><sub><strong>{{'FOOTER.PARTNERS'|translate}}</strong></sub></div>\r\n <a href=\"https://birdlife.se\" class=\"d-block text-white mb-2\"><span class=\"me-1\">Birdlife Sverige</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://svenskbotanik.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Svenska Botaniska F\u00F6reningen</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.sef.nu\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Entomologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n <a href=\"https://www.svampar.se\" class=\"d-block text-nowrap text-white mb-2\"><span class=\"me-1\">Sveriges Mykologiska F\u00F6rening</span><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-md-2\"></div>\r\n <div class=\"col-md-4\">\r\n <div class=\"mb-3 text-white\">\r\n <div>{{'FOOTER.INFO'|translate}}</div>\r\n <div>{{'FOOTER.INFO2'|translate}}</div>\r\n <div>{{'FOOTER.INFO3'|translate}}\r\n <a href=\"https://www.naturvardsverket.se\" class=\"text-white mb-2\"><u class=\"me-1\">Naturv\u00E5rdsverket.</u><span class=\"fas fa-external-link\"></span></a>\r\n </div>\r\n </div>\r\n <div class=\"mb-3\">{{'FOOTER.INFO4'|translate}}.</div>\r\n </div>\r\n <div class=\"col-md-4\">\r\n <a class=\"text-white text-decoration-none d-flex gap-2 mb-3\" href=\"https://www.artdatabanken.se/\" target=\"new\">\r\n <img class=\"d-block d-md-none\" style=\"height: 2.6rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <img class=\"d-none d-md-block\" style=\"height: 2rem;\" src=\"/assets/images/slu.svg\" alt=\"logo\">\r\n <div class=\"border-end d-none d-sm-block\"></div>\r\n <div class=\"border-end d-block d-sm-none\"></div>\r\n <img class=\"d-none d-md-block align-self-center pe-5\" style=\"height: 0.7rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n <img class=\"d-block d-md-none align-self-center pe-5\" style=\"height: 0.8rem;\" src=\"/assets/images/artdatabanken.svg\" alt=\"logo\">\r\n </a>\r\n </div>\r\n <div class=\"col-md-2\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n</footer>" }]
959
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: EnvironmentService }, { type: i1$1.TranslateService }] });
850
960
 
851
- class ArtportalenNavModule {
852
- static forRoot(environment) {
853
- return {
854
- ngModule: ArtportalenNavModule,
855
- providers: [
856
- EnvironmentService,
857
- {
858
- provide: 'env',
859
- useValue: environment
860
- }
861
- ]
862
- };
863
- }
864
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
865
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, declarations: [ArtportalenNavComponent,
866
- ArtportalenFooterComponent], imports: [CommonModule,
867
- HttpClientModule,
868
- RouterModule,
869
- TranslateModule,
870
- AdbDirectivesModule,
871
- AdbDropdownModule,
872
- AdbPagersModule], exports: [ArtportalenNavComponent,
873
- ArtportalenFooterComponent] }); }
874
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, imports: [CommonModule,
875
- HttpClientModule,
876
- RouterModule,
877
- TranslateModule,
878
- AdbDirectivesModule,
879
- AdbDropdownModule,
880
- AdbPagersModule] }); }
881
- }
882
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, decorators: [{
883
- type: NgModule,
884
- args: [{
885
- declarations: [
886
- ArtportalenNavComponent,
887
- ArtportalenFooterComponent
888
- ],
889
- imports: [
890
- CommonModule,
891
- HttpClientModule,
892
- RouterModule,
893
- TranslateModule,
894
- AdbDirectivesModule,
895
- AdbDropdownModule,
896
- AdbPagersModule
897
- ],
898
- exports: [
899
- ArtportalenNavComponent,
900
- ArtportalenFooterComponent
901
- ]
902
- }]
961
+ class ArtportalenNavModule {
962
+ static forRoot(environment) {
963
+ return {
964
+ ngModule: ArtportalenNavModule,
965
+ providers: [
966
+ EnvironmentService,
967
+ {
968
+ provide: 'env', // you can also use InjectionToken
969
+ useValue: environment
970
+ }
971
+ ]
972
+ };
973
+ }
974
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenNavModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
975
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenNavModule, declarations: [ArtportalenNavComponent,
976
+ ArtportalenFooterComponent], imports: [CommonModule,
977
+ RouterModule,
978
+ TranslateModule,
979
+ AdbDirectivesModule,
980
+ AdbDropdownModule,
981
+ AdbPagersModule], exports: [ArtportalenNavComponent,
982
+ ArtportalenFooterComponent] }); }
983
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenNavModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
984
+ RouterModule,
985
+ TranslateModule,
986
+ AdbDirectivesModule,
987
+ AdbDropdownModule,
988
+ AdbPagersModule] }); }
989
+ }
990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: ArtportalenNavModule, decorators: [{
991
+ type: NgModule,
992
+ args: [{ declarations: [
993
+ ArtportalenNavComponent,
994
+ ArtportalenFooterComponent
995
+ ],
996
+ exports: [
997
+ ArtportalenNavComponent,
998
+ ArtportalenFooterComponent
999
+ ], imports: [CommonModule,
1000
+ RouterModule,
1001
+ TranslateModule,
1002
+ AdbDirectivesModule,
1003
+ AdbDropdownModule,
1004
+ AdbPagersModule], providers: [provideHttpClient(withInterceptorsFromDi())] }]
903
1005
  }] });
904
1006
 
905
- class LocaleDatePipe {
906
- constructor(translate) {
907
- this.translate = translate;
908
- }
909
- transform(value, format) {
910
- return new DatePipe(this.translate.currentLang).transform(value, format, null, this.translate.currentLang);
911
- }
912
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocaleDatePipe, deps: [{ token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
913
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocaleDatePipe, name: "adbLocaleDate", pure: false }); }
914
- }
915
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocaleDatePipe, decorators: [{
916
- type: Pipe,
917
- args: [{
918
- name: 'adbLocaleDate',
919
- pure: false
920
- }]
921
- }], ctorParameters: function () { return [{ type: i1$1.TranslateService }]; } });
1007
+ class LocaleDatePipe {
1008
+ constructor(translate) {
1009
+ this.translate = translate;
1010
+ }
1011
+ transform(value, format) {
1012
+ return new DatePipe(this.translate.currentLang).transform(value, format, null, this.translate.currentLang);
1013
+ }
1014
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LocaleDatePipe, deps: [{ token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
1015
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: LocaleDatePipe, name: "adbLocaleDate", pure: false }); }
1016
+ }
1017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: LocaleDatePipe, decorators: [{
1018
+ type: Pipe,
1019
+ args: [{
1020
+ name: 'adbLocaleDate',
1021
+ pure: false
1022
+ }]
1023
+ }], ctorParameters: () => [{ type: i1$1.TranslateService }] });
922
1024
 
923
- class EmptyValuePipe {
924
- transform(value) {
925
- if (!value) {
926
- return '-';
927
- }
928
- if (value.trim() === '') {
929
- return '-';
930
- }
931
- return value;
932
- }
933
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmptyValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
934
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: EmptyValuePipe, name: "adbEmptyValue" }); }
935
- }
936
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmptyValuePipe, decorators: [{
937
- type: Pipe,
938
- args: [{
939
- name: 'adbEmptyValue'
940
- }]
1025
+ class EmptyValuePipe {
1026
+ transform(value) {
1027
+ if (!value) {
1028
+ return '-';
1029
+ }
1030
+ if (value.trim() === '') {
1031
+ return '-';
1032
+ }
1033
+ return value;
1034
+ }
1035
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EmptyValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1036
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: EmptyValuePipe, name: "adbEmptyValue" }); }
1037
+ }
1038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: EmptyValuePipe, decorators: [{
1039
+ type: Pipe,
1040
+ args: [{
1041
+ name: 'adbEmptyValue'
1042
+ }]
941
1043
  }] });
942
1044
 
943
- class HighlightPipe {
944
- constructor() {
945
- this.forbiddenSymbols = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
946
- }
947
- transform(value, searchs) {
948
- if (!value) {
949
- return value;
950
- }
951
- value = value + '';
952
- if (searchs) {
953
- if (!Array.isArray(searchs)) {
954
- searchs = searchs.split(' ').filter(s => s);
955
- }
956
- for (let search of searchs) {
957
- if (this.forbiddenSymbols.test(search)) {
958
- search = search.replace(this.forbiddenSymbols, '');
959
- }
960
- const normalizedSearch = this.normalizeText(search);
961
- const normalizedValue = this.normalizeText(value);
962
- const start = normalizedValue ? normalizedValue.indexOf(normalizedSearch) : -1;
963
- if (start !== -1) {
964
- const regex = new RegExp(`(${search})(?![^<]*>)`, 'gi');
965
- const match = value.match(regex);
966
- if (match) {
967
- value = value.replace(regex, '<mark>$1</mark>');
968
- }
969
- }
970
- }
971
- }
972
- return value;
973
- }
974
- normalizeText(text) {
975
- return text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
976
- }
977
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
978
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: HighlightPipe, name: "adbHighlight" }); }
979
- }
980
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightPipe, decorators: [{
981
- type: Pipe,
982
- args: [{
983
- name: 'adbHighlight'
984
- }]
1045
+ class HighlightPipe {
1046
+ constructor() {
1047
+ this.forbiddenSymbols = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
1048
+ }
1049
+ transform(value, searchs) {
1050
+ if (!value) {
1051
+ return value;
1052
+ }
1053
+ value = value + '';
1054
+ if (searchs) {
1055
+ if (!Array.isArray(searchs)) {
1056
+ searchs = searchs.split(' ').filter(s => s);
1057
+ }
1058
+ for (let search of searchs) {
1059
+ if (this.forbiddenSymbols.test(search)) {
1060
+ search = search.replace(this.forbiddenSymbols, '');
1061
+ }
1062
+ const normalizedSearch = this.normalizeText(search);
1063
+ const normalizedValue = this.normalizeText(value);
1064
+ const start = normalizedValue ? normalizedValue.indexOf(normalizedSearch) : -1;
1065
+ if (start !== -1) {
1066
+ const regex = new RegExp(`(${search})(?![^<]*>)`, 'gi');
1067
+ const match = value.match(regex);
1068
+ if (match) {
1069
+ value = value.replace(regex, '<mark>$1</mark>');
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+ return value;
1075
+ }
1076
+ normalizeText(text) {
1077
+ return text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
1078
+ }
1079
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: HighlightPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1080
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: HighlightPipe, name: "adbHighlight" }); }
1081
+ }
1082
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: HighlightPipe, decorators: [{
1083
+ type: Pipe,
1084
+ args: [{
1085
+ name: 'adbHighlight'
1086
+ }]
985
1087
  }] });
986
1088
 
987
- class NumberSpacingPipe {
988
- transform(value) {
989
- // If value is empty, 0 is falsy so perform an extra check to not make '0' to an empty string
990
- if (!value && value !== 0) {
991
- return '';
992
- }
993
- return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
994
- }
995
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberSpacingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
996
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: NumberSpacingPipe, name: "adbSpacing", pure: false }); }
997
- }
998
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberSpacingPipe, decorators: [{
999
- type: Pipe,
1000
- args: [{
1001
- name: 'adbSpacing',
1002
- pure: false
1003
- }]
1089
+ class NumberSpacingPipe {
1090
+ transform(value) {
1091
+ // If value is empty, 0 is falsy so perform an extra check to not make '0' to an empty string
1092
+ if (!value && value !== 0) {
1093
+ return '';
1094
+ }
1095
+ return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
1096
+ }
1097
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NumberSpacingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1098
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: NumberSpacingPipe, name: "adbSpacing", pure: false }); }
1099
+ }
1100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: NumberSpacingPipe, decorators: [{
1101
+ type: Pipe,
1102
+ args: [{
1103
+ name: 'adbSpacing',
1104
+ pure: false
1105
+ }]
1004
1106
  }] });
1005
1107
 
1006
- class HighlightHtmlPipe {
1007
- constructor() {
1008
- this.forbiddenSymbols = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
1009
- }
1010
- transform(value, searchs) {
1011
- if (!value) {
1012
- return value;
1013
- }
1014
- value = value + '';
1015
- if (searchs) {
1016
- if (!Array.isArray(searchs)) {
1017
- searchs = searchs.split(' ').filter(s => s);
1018
- }
1019
- for (let search of searchs) {
1020
- if (this.forbiddenSymbols.test(search)) {
1021
- search = search.replace(this.forbiddenSymbols, '');
1022
- }
1023
- const normalizedSearch = this.normalizeText(search);
1024
- const normalizedValue = this.normalizeText(value);
1025
- const start = normalizedValue ? normalizedValue.indexOf(normalizedSearch) : -1;
1026
- if (start !== -1) {
1027
- const regex = new RegExp(`([^<\\w]|^)(${this.escapeRegExp(search)})(?![^<]*>)`, 'gi');
1028
- value = value.replace(regex, '$1<mark>$2</mark>');
1029
- }
1030
- }
1031
- }
1032
- return value;
1033
- }
1034
- normalizeText(text) {
1035
- return text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
1036
- }
1037
- escapeRegExp(text) {
1038
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
1039
- }
1040
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1041
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: HighlightHtmlPipe, name: "adbHighlightHtml" }); }
1042
- }
1043
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightHtmlPipe, decorators: [{
1044
- type: Pipe,
1045
- args: [{
1046
- name: 'adbHighlightHtml'
1047
- }]
1108
+ class HighlightHtmlPipe {
1109
+ constructor() {
1110
+ this.forbiddenSymbols = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
1111
+ }
1112
+ transform(value, searchs) {
1113
+ if (!value) {
1114
+ return value;
1115
+ }
1116
+ value = value + '';
1117
+ if (searchs) {
1118
+ if (!Array.isArray(searchs)) {
1119
+ searchs = searchs.split(' ').filter(s => s);
1120
+ }
1121
+ for (let search of searchs) {
1122
+ if (this.forbiddenSymbols.test(search)) {
1123
+ search = search.replace(this.forbiddenSymbols, '');
1124
+ }
1125
+ const normalizedSearch = this.normalizeText(search);
1126
+ const normalizedValue = this.normalizeText(value);
1127
+ const start = normalizedValue ? normalizedValue.indexOf(normalizedSearch) : -1;
1128
+ if (start !== -1) {
1129
+ const regex = new RegExp(`([^<\\w]|^)(${this.escapeRegExp(search)})(?![^<]*>)`, 'gi');
1130
+ value = value.replace(regex, '$1<mark>$2</mark>');
1131
+ }
1132
+ }
1133
+ }
1134
+ return value;
1135
+ }
1136
+ normalizeText(text) {
1137
+ return text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
1138
+ }
1139
+ escapeRegExp(text) {
1140
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
1141
+ }
1142
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: HighlightHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1143
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: HighlightHtmlPipe, name: "adbHighlightHtml" }); }
1144
+ }
1145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: HighlightHtmlPipe, decorators: [{
1146
+ type: Pipe,
1147
+ args: [{
1148
+ name: 'adbHighlightHtml'
1149
+ }]
1048
1150
  }] });
1049
1151
 
1050
- class AdbPipesModule {
1051
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1052
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule, declarations: [HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe], exports: [HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe] }); }
1053
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule }); }
1054
- }
1055
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule, decorators: [{
1056
- type: NgModule,
1057
- args: [{
1058
- imports: [],
1059
- declarations: [HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe],
1060
- exports: [HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe]
1061
- }]
1152
+ class RichPipe {
1153
+ constructor(sanitizer) {
1154
+ this.sanitizer = sanitizer;
1155
+ }
1156
+ transform(value, baseUrl) {
1157
+ if (!value) {
1158
+ return '';
1159
+ }
1160
+ const htmlContent = this.parseCustomMarkdown(value, baseUrl);
1161
+ return this.sanitizer.bypassSecurityTrustHtml(htmlContent);
1162
+ }
1163
+ parseCustomMarkdown(input, baseUrl) {
1164
+ const italicRegex = /_([^_]+)_/g;
1165
+ const taxonRegex = /\[([^\]]+)\]\(taxon:([^)]+)\)/g;
1166
+ const termRegex = /\[([^\]]+)\]\(term:([^)]+)\)/g;
1167
+ const referenceRegex = /\[([^\]]+)\]\(reference:([^)]+)\)/g;
1168
+ // Replace patterns with HTML tags and use baseUrl if needed
1169
+ input = input.replace(italicRegex, '<em>$1</em>');
1170
+ input = input.replace(taxonRegex, `<a href="${baseUrl}/taxa/$2" class="taxon">$1</a>`);
1171
+ input = input.replace(termRegex, `<span> class="term">$1</span>`);
1172
+ input = input.replace(referenceRegex, `<span> class="term">$1</span>`);
1173
+ return input;
1174
+ }
1175
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RichPipe, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
1176
+ /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: RichPipe, name: "rich" }); }
1177
+ }
1178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: RichPipe, decorators: [{
1179
+ type: Pipe,
1180
+ args: [{
1181
+ name: 'rich'
1182
+ }]
1183
+ }], ctorParameters: () => [{ type: i1$2.DomSanitizer }] });
1184
+
1185
+ class AdbPipesModule {
1186
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1187
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbPipesModule, declarations: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe], exports: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe] }); }
1188
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbPipesModule }); }
1189
+ }
1190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbPipesModule, decorators: [{
1191
+ type: NgModule,
1192
+ args: [{
1193
+ imports: [],
1194
+ declarations: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe],
1195
+ exports: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe]
1196
+ }]
1062
1197
  }] });
1063
1198
 
1064
- class AdbDatePickerComponent {
1065
- static { this.MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; }
1066
- static { this.WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7']; }
1067
- static { this.YEAR_INTERVALL = 8; }
1068
- ;
1069
- constructor(elementRef, translate) {
1070
- this.elementRef = elementRef;
1071
- this.translate = translate;
1072
- this.subscriptions = new Subscription();
1073
- this.currentdDate = new Date();
1074
- this.selectedDate = new Date();
1075
- this.weekDays = AdbDatePickerComponent.WEEK_DAYS;
1076
- this.noYearMode = false;
1077
- this.selectDate = new EventEmitter();
1078
- }
1079
- ngOnInit() {
1080
- if (this.settings) {
1081
- if (this.settings?.minDate || this.settings?.maxDate) {
1082
- const minDate = AdbDatePickerComponent.parseDate(this.settings.minDate);
1083
- const maxDate = AdbDatePickerComponent.parseDate(this.settings.maxDate);
1084
- this.range = {
1085
- start: minDate ? startOfDay(minDate) : subYears(new Date(), 1000),
1086
- end: maxDate ? endOfDay(maxDate) : addYears(new Date(), 1000)
1087
- };
1088
- }
1089
- if (this.settings.noYear) {
1090
- this.noYearMode = this.settings.noYear;
1091
- }
1092
- }
1093
- this.selectedDate = this.currentdDate = this.initialDate ?? new Date();
1094
- this.currentMonth = getMonth(this.selectedDate);
1095
- this.createCalendar();
1096
- }
1097
- onShowYear() {
1098
- this.months = null;
1099
- this.loadYearsInterval();
1100
- }
1101
- onShowMonth() {
1102
- this.years = null;
1103
- this.loadMonths();
1104
- }
1105
- onSelectYear(inYear) {
1106
- this.selectedDate.setFullYear(inYear.getFullYear());
1107
- this.loadMonths();
1108
- this.years = null;
1109
- }
1110
- onSelectMonth(inMonth) {
1111
- this.selectedDate.setMonth(inMonth);
1112
- this.currentMonth = getMonth(this.selectedDate);
1113
- this.createCalendar();
1114
- this.years = null;
1115
- this.months = null;
1116
- }
1117
- onPrev() {
1118
- if (this.years) {
1119
- this.selectedDate = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1120
- this.loadYearsInterval();
1121
- }
1122
- else if (this.months) {
1123
- this.selectedDate = subYears(this.selectedDate, 1);
1124
- this.loadMonths();
1125
- }
1126
- else {
1127
- this.selectedDate = subMonths(this.selectedDate, 1);
1128
- this.createCalendar();
1129
- }
1130
- this.currentMonth = getMonth(this.selectedDate);
1131
- }
1132
- onNext() {
1133
- if (this.years) {
1134
- this.selectedDate = addYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1135
- this.loadYearsInterval();
1136
- }
1137
- else if (this.months) {
1138
- this.selectedDate = addYears(this.selectedDate, 1);
1139
- this.loadMonths();
1140
- }
1141
- else {
1142
- this.selectedDate = addMonths(this.selectedDate, 1);
1143
- this.createCalendar();
1144
- }
1145
- this.currentMonth = getMonth(this.selectedDate);
1146
- }
1147
- ngOnDestroy() {
1148
- this.subscriptions.unsubscribe();
1149
- }
1150
- loadMonths() {
1151
- this.months = AdbDatePickerComponent.MONTHS.map(x => {
1152
- return {
1153
- value: x,
1154
- isThisMonth: getMonth(this.selectedDate) === x && isSameYear(this.currentdDate, this.selectedDate)
1155
- };
1156
- });
1157
- }
1158
- loadYearsInterval() {
1159
- let year = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1160
- const years = [];
1161
- for (let i = 0; i < 16; i++) {
1162
- years.push({
1163
- value: year,
1164
- title: year.getFullYear(),
1165
- isThisYear: isSameYear(year, this.currentdDate)
1166
- });
1167
- year = addYears(year, 1);
1168
- }
1169
- this.years = years;
1170
- }
1171
- onSelectDate(day) {
1172
- this.selectDate.emit(day.value);
1173
- }
1174
- createCalendar() {
1175
- const weeks = [];
1176
- const monthInterval = { start: startOfMonth(this.selectedDate), end: endOfMonth(this.selectedDate) };
1177
- var fnsWweeks = eachWeekOfInterval(monthInterval, { weekStartsOn: this.translate.currentLang === 'sv' || this.translate.currentLang === 'sv-SE' ? 1 : 0 });
1178
- for (const fnsWeek of fnsWweeks) {
1179
- const week = { weekNumber: 0, days: [] };
1180
- week.weekNumber = getISOWeek(new Date(fnsWeek));
1181
- const weekInterval = { start: new Date(fnsWeek), end: addDays(new Date(fnsWeek), 6) };
1182
- week.days = eachDayOfInterval(weekInterval).map(day => {
1183
- day.setHours(getHours(new Date()));
1184
- day.setMinutes(getMinutes(new Date()));
1185
- return {
1186
- value: day,
1187
- isSelected: isSameYear(day, this.initialDate) && isSameDay(day, this.initialDate) && isSameMonth(day, this.initialDate),
1188
- isInRange: this.range ? isWithinInterval(day, this.range) : true,
1189
- isToday: isSameDay(day, new Date()),
1190
- inMonth: monthInterval.start.getMonth() === day.getMonth()
1191
- };
1192
- });
1193
- weeks.push(week);
1194
- }
1195
- this.weeks = weeks;
1196
- }
1197
- static parseDate(value) {
1198
- if (typeof value === 'string') {
1199
- if (isValid(parseISO(value))) {
1200
- return parseISO(value);
1201
- }
1202
- else {
1203
- return null;
1204
- }
1205
- }
1206
- else if (value instanceof Date) {
1207
- return value;
1208
- }
1209
- else {
1210
- return null;
1211
- }
1212
- }
1213
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
1214
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AdbDatePickerComponent, 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-white shadow rounded position-absolute\" style=\"width:350px\">\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 text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button tabIndex=\"-1\" *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button tabIndex=\"-1\" *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\" [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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [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\" *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 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" \r\n [class.border]=\"day.isToday\" [class.bg-primary]=\"day.isSelected\" [class.text-white]=\"day.isSelected\" [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>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2$1.DatePipe, name: "date" }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "pipe", type: LocaleDatePipe, name: "adbLocaleDate" }] }); }
1215
- }
1216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
1217
- type: Component,
1218
- args: [{ selector: 'adb-date-picker', template: "<div class=\"position-relative\" [class.to-left]=\"toLeft\">\r\n <nav class=\"bg-white shadow rounded position-absolute\" style=\"width:350px\">\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 text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button tabIndex=\"-1\" *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button tabIndex=\"-1\" *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\" [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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [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\" *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 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" \r\n [class.border]=\"day.isToday\" [class.bg-primary]=\"day.isSelected\" [class.text-white]=\"day.isSelected\" [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>\r\n</div>\r\n" }]
1219
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.TranslateService }]; }, propDecorators: { initialDate: [{
1220
- type: Input
1221
- }], settings: [{
1222
- type: Input
1223
- }], toLeft: [{
1224
- type: Input
1225
- }], id: [{
1226
- type: HostBinding,
1227
- args: ['id']
1228
- }, {
1229
- type: Input
1230
- }], selectDate: [{
1231
- type: Output
1199
+ class AdbDatePickerComponent {
1200
+ static { this.MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; }
1201
+ static { this.WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7']; }
1202
+ static { this.YEAR_INTERVALL = 8; }
1203
+ ;
1204
+ constructor(elementRef, translate) {
1205
+ this.elementRef = elementRef;
1206
+ this.translate = translate;
1207
+ this.subscriptions = new Subscription();
1208
+ this.currentdDate = new Date();
1209
+ this.selectedDate = new Date();
1210
+ this.weekDays = AdbDatePickerComponent.WEEK_DAYS;
1211
+ this.noYearMode = false;
1212
+ this.selectDate = new EventEmitter();
1213
+ }
1214
+ ngOnInit() {
1215
+ if (this.settings) {
1216
+ if (this.settings?.minDate || this.settings?.maxDate) {
1217
+ const minDate = AdbDatePickerComponent.parseDate(this.settings.minDate);
1218
+ const maxDate = AdbDatePickerComponent.parseDate(this.settings.maxDate);
1219
+ this.range = {
1220
+ start: minDate ? startOfDay(minDate) : subYears(new Date(), 1000),
1221
+ end: maxDate ? endOfDay(maxDate) : addYears(new Date(), 1000)
1222
+ };
1223
+ }
1224
+ if (this.settings.noYear) {
1225
+ this.noYearMode = this.settings.noYear;
1226
+ }
1227
+ }
1228
+ this.selectedDate = this.currentdDate = this.initialDate ?? new Date();
1229
+ this.currentMonth = getMonth(this.selectedDate);
1230
+ this.createCalendar();
1231
+ }
1232
+ onShowYear() {
1233
+ this.months = null;
1234
+ this.loadYearsInterval();
1235
+ }
1236
+ onShowMonth() {
1237
+ this.years = null;
1238
+ this.loadMonths();
1239
+ }
1240
+ onSelectYear(inYear) {
1241
+ this.selectedDate.setFullYear(inYear.getFullYear());
1242
+ this.loadMonths();
1243
+ this.years = null;
1244
+ }
1245
+ onSelectMonth(inMonth) {
1246
+ this.selectedDate.setMonth(inMonth);
1247
+ this.currentMonth = getMonth(this.selectedDate);
1248
+ this.createCalendar();
1249
+ this.years = null;
1250
+ this.months = null;
1251
+ }
1252
+ onPrev() {
1253
+ if (this.years) {
1254
+ this.selectedDate = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1255
+ this.loadYearsInterval();
1256
+ }
1257
+ else if (this.months) {
1258
+ this.selectedDate = subYears(this.selectedDate, 1);
1259
+ this.loadMonths();
1260
+ }
1261
+ else {
1262
+ this.selectedDate = subMonths(this.selectedDate, 1);
1263
+ this.createCalendar();
1264
+ }
1265
+ this.currentMonth = getMonth(this.selectedDate);
1266
+ }
1267
+ onNext() {
1268
+ if (this.years) {
1269
+ this.selectedDate = addYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1270
+ this.loadYearsInterval();
1271
+ }
1272
+ else if (this.months) {
1273
+ this.selectedDate = addYears(this.selectedDate, 1);
1274
+ this.loadMonths();
1275
+ }
1276
+ else {
1277
+ this.selectedDate = addMonths(this.selectedDate, 1);
1278
+ this.createCalendar();
1279
+ }
1280
+ this.currentMonth = getMonth(this.selectedDate);
1281
+ }
1282
+ ngOnDestroy() {
1283
+ this.subscriptions.unsubscribe();
1284
+ }
1285
+ loadMonths() {
1286
+ this.months = AdbDatePickerComponent.MONTHS.map(x => {
1287
+ return {
1288
+ value: x,
1289
+ isThisMonth: getMonth(this.selectedDate) === x && isSameYear(this.currentdDate, this.selectedDate)
1290
+ };
1291
+ });
1292
+ }
1293
+ loadYearsInterval() {
1294
+ let year = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1295
+ const years = [];
1296
+ for (let i = 0; i < 16; i++) {
1297
+ years.push({
1298
+ value: year,
1299
+ title: year.getFullYear(),
1300
+ isThisYear: isSameYear(year, this.currentdDate)
1301
+ });
1302
+ year = addYears(year, 1);
1303
+ }
1304
+ this.years = years;
1305
+ }
1306
+ onSelectDate(day) {
1307
+ this.selectDate.emit(day.value);
1308
+ }
1309
+ createCalendar() {
1310
+ const weeks = [];
1311
+ const monthInterval = { start: startOfMonth(this.selectedDate), end: endOfMonth(this.selectedDate) };
1312
+ var fnsWweeks = eachWeekOfInterval(monthInterval, { weekStartsOn: this.translate.currentLang === 'sv' || this.translate.currentLang === 'sv-SE' ? 1 : 0 });
1313
+ for (const fnsWeek of fnsWweeks) {
1314
+ const week = { weekNumber: 0, days: [] };
1315
+ week.weekNumber = getISOWeek(new Date(fnsWeek));
1316
+ const weekInterval = { start: new Date(fnsWeek), end: addDays(new Date(fnsWeek), 6) };
1317
+ week.days = eachDayOfInterval(weekInterval).map(day => {
1318
+ day.setHours(getHours(new Date()));
1319
+ day.setMinutes(getMinutes(new Date()));
1320
+ return {
1321
+ value: day,
1322
+ isSelected: isSameYear(day, this.initialDate) && isSameDay(day, this.initialDate) && isSameMonth(day, this.initialDate),
1323
+ isInRange: this.range ? isWithinInterval(day, this.range) : true,
1324
+ isToday: isSameDay(day, new Date()),
1325
+ inMonth: monthInterval.start.getMonth() === day.getMonth()
1326
+ };
1327
+ });
1328
+ weeks.push(week);
1329
+ }
1330
+ this.weeks = weeks;
1331
+ }
1332
+ static parseDate(value) {
1333
+ if (typeof value === 'string') {
1334
+ if (isValid(parseISO(value))) {
1335
+ return parseISO(value);
1336
+ }
1337
+ else {
1338
+ return null;
1339
+ }
1340
+ }
1341
+ else if (value instanceof Date) {
1342
+ return value;
1343
+ }
1344
+ else {
1345
+ return null;
1346
+ }
1347
+ }
1348
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
1349
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AdbDatePickerComponent, 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-white shadow rounded position-absolute\" style=\"width:350px\">\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 text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button tabIndex=\"-1\" *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button tabIndex=\"-1\" *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\" [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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [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\" *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 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" \r\n [class.border]=\"day.isToday\" [class.bg-primary]=\"day.isSelected\" [class.text-white]=\"day.isSelected\" [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>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2$1.DatePipe, name: "date" }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "pipe", type: LocaleDatePipe, name: "adbLocaleDate" }] }); }
1350
+ }
1351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
1352
+ type: Component,
1353
+ args: [{ selector: 'adb-date-picker', template: "<div class=\"position-relative\" [class.to-left]=\"toLeft\">\r\n <nav class=\"bg-white shadow rounded position-absolute\" style=\"width:350px\">\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 text-white rounded-pill\" type=\"button\" (click)=\"onPrev()\" [disabled]=\"noYearMode&&currentMonth===0\"><span class=\"fa fa-chevron-left\"></span></button>\r\n <ng-container *ngIf=\"!years&&!months\">\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowMonth();$event.stopPropagation()\">{{selectedDate|adbLocaleDate:'MMM'}}</button>\r\n <button *ngIf=\"!noYearMode\" tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n </ng-container>\r\n <button tabIndex=\"-1\" *ngIf=\"years\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"years=null;$event.stopPropagation()\">{{years[0].title}} - {{years[years.length-1].title}}</button>\r\n <button tabIndex=\"-1\" *ngIf=\"months\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onShowYear();$event.stopPropagation()\">{{selectedDate|date:'yyyy'}}</button>\r\n <button tabIndex=\"-1\" class=\"btn btn-primary text-white rounded-pill\" type=\"button\" (click)=\"onNext()\" [disabled]=\"noYearMode&&currentMonth===11\"><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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectYear(year.value);$event.stopPropagation()\" [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 type=\"button\" tabIndex=\"-1\" class=\"btn btn-sm btn-outline-secondary rounded-pill\" (click)=\"onSelectMonth(month.value);$event.stopPropagation()\" [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\" *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 m-2\" *ngFor=\"let day of week.days\" (click)=\"onSelectDate(day)\" type=\"button\" \r\n [class.border]=\"day.isToday\" [class.bg-primary]=\"day.isSelected\" [class.text-white]=\"day.isSelected\" [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>\r\n</div>\r\n" }]
1354
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.TranslateService }], propDecorators: { initialDate: [{
1355
+ type: Input
1356
+ }], settings: [{
1357
+ type: Input
1358
+ }], toLeft: [{
1359
+ type: Input
1360
+ }], id: [{
1361
+ type: HostBinding,
1362
+ args: ['id']
1363
+ }, {
1364
+ type: Input
1365
+ }], selectDate: [{
1366
+ type: Output
1232
1367
  }] } });
1233
1368
 
1234
- class AdbDatePickerService {
1235
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1236
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerService }); }
1237
- }
1238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerService, decorators: [{
1239
- type: Injectable
1369
+ class AdbDatePickerService {
1370
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1371
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerService }); }
1372
+ }
1373
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerService, decorators: [{
1374
+ type: Injectable
1240
1375
  }] });
1241
1376
 
1242
- class AdbDatePickerDirective {
1243
- constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
1244
- this.viewContainerRef = viewContainerRef;
1245
- this.renderer = renderer;
1246
- this.elementRef = elementRef;
1247
- this.adbDatePickerService = adbDatePickerService;
1248
- this.translate = translate;
1249
- this.subscriptions = new Subscription();
1250
- this.autocomplete = 'off';
1251
- this.adbBlur = new EventEmitter();
1252
- this.format = 'yyyy-MM-dd';
1253
- this.settings = null;
1254
- this.onValidationChange = () => { };
1255
- //ControlValueAccessor
1256
- this.onChange = () => { };
1257
- this.onTouched = () => { };
1258
- }
1259
- ngOnInit() {
1260
- this.elementRef.nativeElement.setAttribute("placeholder", this.format);
1261
- }
1262
- onClick() {
1263
- if (this.adbDatePickerService.viewRef) {
1264
- this.adbDatePickerService.viewRef.destroy();
1265
- }
1266
- const viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
1267
- viewRef.instance.settings = this.settings;
1268
- viewRef.instance.toLeft = this.toLeft;
1269
- viewRef.instance.initialDate = this.currentDate;
1270
- this.id = this.getId();
1271
- viewRef.instance.id = this.id;
1272
- viewRef.instance.selectDate.subscribe((date) => {
1273
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang));
1274
- this.onChange(date);
1275
- this.currentDate = date;
1276
- this.onHide();
1277
- this.adbBlur.emit(date);
1278
- });
1279
- this.adbDatePickerService.viewRef = viewRef;
1280
- }
1281
- onKeyup(event) {
1282
- const date = AdbDatePickerDirective.tryParse(event.target.value);
1283
- if (date) {
1284
- const now = new Date();
1285
- date.setHours(now.getHours());
1286
- date.setMinutes(now.getMinutes());
1287
- date.setSeconds(now.getSeconds());
1288
- this.onChange(date);
1289
- }
1290
- else {
1291
- this.onChange(event.target.value); //send inccorect values to form
1292
- }
1293
- }
1294
- onTabDown() {
1295
- this.updateValueOnLeave();
1296
- this.onHide();
1297
- this.adbBlur.emit(this.currentDate);
1298
- }
1299
- onEscdOWN() {
1300
- this.updateValueOnLeave();
1301
- this.onHide();
1302
- }
1303
- onHide() {
1304
- this.adbDatePickerService.viewRef = null;
1305
- this.viewContainerRef.detach();
1306
- this.viewContainerRef.clear();
1307
- }
1308
- onCheckOutSideClick(target) {
1309
- const nativeElement = this.adbDatePickerService.viewRef?.instance.elementRef.nativeElement ?? null;
1310
- if (nativeElement) {
1311
- if (nativeElement.id === this.id) {
1312
- if (!target.hasAttribute('adbdatepicker')) {
1313
- const clickedInside = nativeElement.contains(target);
1314
- if (!clickedInside) {
1315
- this.updateValueOnLeave();
1316
- this.onHide();
1317
- this.adbBlur.emit(this.currentDate);
1318
- }
1319
- }
1320
- }
1321
- }
1322
- }
1323
- updateValueOnLeave() {
1324
- if (this.isValid) {
1325
- if (this.currentDate) {
1326
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang));
1327
- }
1328
- else {
1329
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1330
- }
1331
- }
1332
- }
1333
- ngOnDestroy() {
1334
- this.subscriptions.unsubscribe();
1335
- }
1336
- //Validator
1337
- validate(control) {
1338
- const value = control.value;
1339
- if (!value) {
1340
- this.currentDate = null;
1341
- this.isValid = true;
1342
- return null;
1343
- }
1344
- if (value instanceof Date) {
1345
- this.currentDate = value;
1346
- this.isValid = true;
1347
- return null;
1348
- }
1349
- if (typeof value === 'string' || value instanceof String) {
1350
- const date = AdbDatePickerDirective.tryParse(value);
1351
- if (!date) {
1352
- this.isValid = false;
1353
- return { date: true };
1354
- }
1355
- }
1356
- this.isValid = true;
1357
- return null;
1358
- }
1359
- registerOnValidatorChange(fn) {
1360
- this.onValidationChange = fn;
1361
- }
1362
- writeValue(value) {
1363
- if (!value) {
1364
- this.currentDate = null;
1365
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1366
- return;
1367
- }
1368
- if (typeof value === 'string' || value instanceof String) {
1369
- const date = AdbDatePickerDirective.tryParse(value);
1370
- if (!date) {
1371
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
1372
- return;
1373
- }
1374
- value = date;
1375
- }
1376
- if (value instanceof Date) {
1377
- this.currentDate = value;
1378
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang));
1379
- }
1380
- }
1381
- registerOnChange(fn) {
1382
- this.onChange = fn;
1383
- }
1384
- registerOnTouched(fn) {
1385
- this.onTouched = fn;
1386
- }
1387
- setDisabledState(isDisabled) {
1388
- this.viewContainerRef.clear();
1389
- }
1390
- static tryParse(dateString) {
1391
- const parsed = parseISO(dateString);
1392
- return isValid(parsed) ? parsed : null;
1393
- }
1394
- getId() {
1395
- return '' + Math.floor(Math.random() * Date.now());
1396
- }
1397
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Directive }); }
1398
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AdbDatePickerDirective, 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: [{
1399
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
1400
- multi: true
1401
- },
1402
- {
1403
- provide: NG_VALIDATORS,
1404
- useExisting: AdbDatePickerDirective,
1405
- multi: true,
1406
- },], ngImport: i0 }); }
1407
- }
1408
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
1409
- type: Directive,
1410
- args: [{
1411
- selector: `input[adbDatepicker]`,
1412
- providers: [{
1413
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
1414
- multi: true
1415
- },
1416
- {
1417
- provide: NG_VALIDATORS,
1418
- useExisting: AdbDatePickerDirective,
1419
- multi: true,
1420
- },]
1421
- }]
1422
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i1$1.TranslateService }]; }, propDecorators: { autocomplete: [{
1423
- type: HostBinding,
1424
- args: ['autocomplete']
1425
- }], adbBlur: [{
1426
- type: Output
1427
- }], format: [{
1428
- type: Input
1429
- }], toLeft: [{
1430
- type: Input
1431
- }], settings: [{
1432
- type: Input
1433
- }], onClick: [{
1434
- type: HostListener,
1435
- args: ['click']
1436
- }], onKeyup: [{
1437
- type: HostListener,
1438
- args: ['keyup', ['$event']]
1439
- }], onTabDown: [{
1440
- type: HostListener,
1441
- args: ['keydown.shift.tab']
1442
- }, {
1443
- type: HostListener,
1444
- args: ['keydown.tab']
1445
- }], onEscdOWN: [{
1446
- type: HostListener,
1447
- args: ['keydown.esc']
1448
- }], onCheckOutSideClick: [{
1449
- type: HostListener,
1450
- args: ['document:click', ['$event.target']]
1377
+ class AdbDatePickerDirective {
1378
+ constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
1379
+ this.viewContainerRef = viewContainerRef;
1380
+ this.renderer = renderer;
1381
+ this.elementRef = elementRef;
1382
+ this.adbDatePickerService = adbDatePickerService;
1383
+ this.translate = translate;
1384
+ this.subscriptions = new Subscription();
1385
+ this.autocomplete = 'off';
1386
+ this.adbBlur = new EventEmitter();
1387
+ this.format = 'yyyy-MM-dd';
1388
+ this.settings = null;
1389
+ //ControlValueAccessor
1390
+ this.onChange = () => { };
1391
+ this.onTouched = () => { };
1392
+ this.onValidationChange = () => { };
1393
+ }
1394
+ ngOnInit() {
1395
+ this.elementRef.nativeElement.setAttribute("placeholder", this.format);
1396
+ }
1397
+ onClick() {
1398
+ if (this.adbDatePickerService.viewRef) {
1399
+ this.adbDatePickerService.viewRef.destroy();
1400
+ }
1401
+ const viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
1402
+ viewRef.instance.settings = this.settings;
1403
+ viewRef.instance.toLeft = this.toLeft;
1404
+ viewRef.instance.initialDate = this.currentDate;
1405
+ this.id = this.getId();
1406
+ viewRef.instance.id = this.id;
1407
+ viewRef.instance.selectDate.subscribe((date) => {
1408
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang));
1409
+ this.onChange(date);
1410
+ this.currentDate = date;
1411
+ this.onHide();
1412
+ this.adbBlur.emit(date);
1413
+ });
1414
+ this.adbDatePickerService.viewRef = viewRef;
1415
+ }
1416
+ onKeyup(event) {
1417
+ const date = AdbDatePickerDirective.tryParse(event.target.value);
1418
+ if (date) {
1419
+ const now = new Date();
1420
+ date.setHours(now.getHours());
1421
+ date.setMinutes(now.getMinutes());
1422
+ date.setSeconds(now.getSeconds());
1423
+ this.onChange(date);
1424
+ }
1425
+ else {
1426
+ this.onChange(event.target.value); //send inccorect values to form
1427
+ }
1428
+ }
1429
+ onTabDown() {
1430
+ this.updateValueOnLeave();
1431
+ this.onHide();
1432
+ this.adbBlur.emit(this.currentDate);
1433
+ }
1434
+ onEscdOWN() {
1435
+ this.updateValueOnLeave();
1436
+ this.onHide();
1437
+ }
1438
+ onHide() {
1439
+ this.adbDatePickerService.viewRef = null;
1440
+ this.viewContainerRef.detach();
1441
+ this.viewContainerRef.clear();
1442
+ }
1443
+ onCheckOutSideClick(target) {
1444
+ const nativeElement = this.adbDatePickerService.viewRef?.instance.elementRef.nativeElement ?? null;
1445
+ if (nativeElement) {
1446
+ if (nativeElement.id === this.id) {
1447
+ if (!target.hasAttribute('adbdatepicker')) {
1448
+ const clickedInside = nativeElement.contains(target);
1449
+ if (!clickedInside) {
1450
+ this.updateValueOnLeave();
1451
+ this.onHide();
1452
+ this.adbBlur.emit(this.currentDate);
1453
+ }
1454
+ }
1455
+ }
1456
+ }
1457
+ }
1458
+ updateValueOnLeave() {
1459
+ if (this.isValid) {
1460
+ if (this.currentDate) {
1461
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang));
1462
+ }
1463
+ else {
1464
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1465
+ }
1466
+ }
1467
+ }
1468
+ ngOnDestroy() {
1469
+ this.subscriptions.unsubscribe();
1470
+ }
1471
+ //Validator
1472
+ validate(control) {
1473
+ const value = control.value;
1474
+ if (!value) {
1475
+ this.currentDate = null;
1476
+ this.isValid = true;
1477
+ return null;
1478
+ }
1479
+ if (value instanceof Date) {
1480
+ this.currentDate = value;
1481
+ this.isValid = true;
1482
+ return null;
1483
+ }
1484
+ if (typeof value === 'string' || value instanceof String) {
1485
+ const date = AdbDatePickerDirective.tryParse(value);
1486
+ if (!date) {
1487
+ this.isValid = false;
1488
+ return { date: true };
1489
+ }
1490
+ }
1491
+ this.isValid = true;
1492
+ return null;
1493
+ }
1494
+ registerOnValidatorChange(fn) {
1495
+ this.onValidationChange = fn;
1496
+ }
1497
+ writeValue(value) {
1498
+ if (!value) {
1499
+ this.currentDate = null;
1500
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1501
+ return;
1502
+ }
1503
+ if (typeof value === 'string' || value instanceof String) {
1504
+ const date = AdbDatePickerDirective.tryParse(value);
1505
+ if (!date) {
1506
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
1507
+ return;
1508
+ }
1509
+ value = date;
1510
+ }
1511
+ if (value instanceof Date) {
1512
+ this.currentDate = value;
1513
+ this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang));
1514
+ }
1515
+ }
1516
+ registerOnChange(fn) {
1517
+ this.onChange = fn;
1518
+ }
1519
+ registerOnTouched(fn) {
1520
+ this.onTouched = fn;
1521
+ }
1522
+ setDisabledState(isDisabled) {
1523
+ this.viewContainerRef.clear();
1524
+ }
1525
+ static tryParse(dateString) {
1526
+ const parsed = parseISO(dateString);
1527
+ return isValid(parsed) ? parsed : null;
1528
+ }
1529
+ getId() {
1530
+ return '' + Math.floor(Math.random() * Date.now());
1531
+ }
1532
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: AdbDatePickerService }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Directive }); }
1533
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: AdbDatePickerDirective, 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: [{
1534
+ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
1535
+ multi: true
1536
+ },
1537
+ {
1538
+ provide: NG_VALIDATORS,
1539
+ useExisting: AdbDatePickerDirective,
1540
+ multi: true,
1541
+ },], ngImport: i0 }); }
1542
+ }
1543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
1544
+ type: Directive,
1545
+ args: [{
1546
+ selector: `input[adbDatepicker]`,
1547
+ providers: [{
1548
+ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
1549
+ multi: true
1550
+ },
1551
+ {
1552
+ provide: NG_VALIDATORS,
1553
+ useExisting: AdbDatePickerDirective,
1554
+ multi: true,
1555
+ },]
1556
+ }]
1557
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i1$1.TranslateService }], propDecorators: { autocomplete: [{
1558
+ type: HostBinding,
1559
+ args: ['autocomplete']
1560
+ }], adbBlur: [{
1561
+ type: Output
1562
+ }], format: [{
1563
+ type: Input
1564
+ }], toLeft: [{
1565
+ type: Input
1566
+ }], settings: [{
1567
+ type: Input
1568
+ }], onClick: [{
1569
+ type: HostListener,
1570
+ args: ['click']
1571
+ }], onKeyup: [{
1572
+ type: HostListener,
1573
+ args: ['keyup', ['$event']]
1574
+ }], onTabDown: [{
1575
+ type: HostListener,
1576
+ args: ['keydown.shift.tab']
1577
+ }, {
1578
+ type: HostListener,
1579
+ args: ['keydown.tab']
1580
+ }], onEscdOWN: [{
1581
+ type: HostListener,
1582
+ args: ['keydown.esc']
1583
+ }], onCheckOutSideClick: [{
1584
+ type: HostListener,
1585
+ args: ['document:click', ['$event.target']]
1451
1586
  }] } });
1452
1587
 
1453
- class AdbDatePickerModule {
1454
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1455
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerModule, declarations: [AdbDatePickerComponent, AdbDatePickerDirective], imports: [CommonModule, i1$1.TranslateModule, AdbPipesModule, AdbDirectivesModule], exports: [AdbDatePickerComponent, AdbDatePickerDirective] }); }
1456
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerModule, providers: [AdbDatePickerService], imports: [CommonModule, TranslateModule.forChild(), AdbPipesModule, AdbDirectivesModule] }); }
1457
- }
1458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerModule, decorators: [{
1459
- type: NgModule,
1460
- args: [{
1461
- imports: [CommonModule, TranslateModule.forChild(), AdbPipesModule, AdbDirectivesModule],
1462
- declarations: [AdbDatePickerComponent, AdbDatePickerDirective],
1463
- exports: [AdbDatePickerComponent, AdbDatePickerDirective],
1464
- providers: [AdbDatePickerService]
1465
- }]
1588
+ class AdbDatePickerModule {
1589
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1590
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerModule, declarations: [AdbDatePickerComponent, AdbDatePickerDirective], imports: [CommonModule, i1$1.TranslateModule, AdbPipesModule, AdbDirectivesModule], exports: [AdbDatePickerComponent, AdbDatePickerDirective] }); }
1591
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerModule, providers: [AdbDatePickerService], imports: [CommonModule, TranslateModule.forChild(), AdbPipesModule, AdbDirectivesModule] }); }
1592
+ }
1593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbDatePickerModule, decorators: [{
1594
+ type: NgModule,
1595
+ args: [{
1596
+ imports: [CommonModule, TranslateModule.forChild(), AdbPipesModule, AdbDirectivesModule],
1597
+ declarations: [AdbDatePickerComponent, AdbDatePickerDirective],
1598
+ exports: [AdbDatePickerComponent, AdbDatePickerDirective],
1599
+ providers: [AdbDatePickerService]
1600
+ }]
1466
1601
  }] });
1467
1602
 
1468
- class AdbModalService {
1469
- constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
1470
- this.componentFactoryResolver = componentFactoryResolver;
1471
- this.appRef = appRef;
1472
- this.injector = injector;
1473
- this.closeSubject = new Subject();
1474
- this.close$ = this.closeSubject.asObservable();
1475
- this.renderer = rendererFactory.createRenderer(null, null);
1476
- }
1477
- hide(confirm) {
1478
- this.closeSubject.next(confirm);
1479
- document.body.removeChild(this.domElem);
1480
- document.body.removeChild(this.backdrop);
1481
- var main = this.renderer.selectRootElement('main', true);
1482
- this.renderer.removeAttribute(main, 'inert');
1483
- this.closeSubject.unsubscribe();
1484
- this.closeSubject = new Subject();
1485
- this.close$ = this.closeSubject.asObservable();
1486
- }
1487
- showConfirm(model) {
1488
- var main = this.renderer.selectRootElement('main', true);
1489
- main.setAttribute('inert', '');
1490
- this.backdrop = this.renderer.createElement('div');
1491
- this.backdrop.classList.add('modal-backdrop', 'fade', 'show');
1492
- this.renderer.appendChild(document.body, this.backdrop);
1493
- let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbConfirmModal).create(this.injector);
1494
- model.header = model.header ?? 'NOT_SET';
1495
- model.text = model.text ?? 'NOT_SET';
1496
- model.confirm = model.confirm ?? 'OK';
1497
- model.decline = model.decline ?? 'CANCEL';
1498
- componentRef.instance.model = model;
1499
- this.appRef.attachView(componentRef.hostView);
1500
- this.domElem = componentRef.hostView.rootNodes[0];
1501
- document.body.appendChild(this.domElem);
1502
- }
1503
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1504
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalService }); }
1505
- }
1506
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalService, decorators: [{
1507
- type: Injectable
1508
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }, { type: i0.Injector }]; } });
1603
+ class AdbModalService {
1604
+ constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
1605
+ this.componentFactoryResolver = componentFactoryResolver;
1606
+ this.appRef = appRef;
1607
+ this.injector = injector;
1608
+ this.closeSubject = new Subject();
1609
+ this.close$ = this.closeSubject.asObservable();
1610
+ this.renderer = rendererFactory.createRenderer(null, null);
1611
+ }
1612
+ hide(confirm) {
1613
+ this.closeSubject.next(confirm);
1614
+ document.body.removeChild(this.domElem);
1615
+ document.body.removeChild(this.backdrop);
1616
+ var main = this.renderer.selectRootElement('main', true);
1617
+ this.renderer.removeAttribute(main, 'inert');
1618
+ this.closeSubject.unsubscribe();
1619
+ this.closeSubject = new Subject();
1620
+ this.close$ = this.closeSubject.asObservable();
1621
+ }
1622
+ showConfirm(model) {
1623
+ var main = this.renderer.selectRootElement('main', true);
1624
+ main.setAttribute('inert', '');
1625
+ this.backdrop = this.renderer.createElement('div');
1626
+ this.backdrop.classList.add('modal-backdrop', 'fade', 'show');
1627
+ this.renderer.appendChild(document.body, this.backdrop);
1628
+ let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbConfirmModal).create(this.injector);
1629
+ model.header = model.header ?? 'NOT_SET';
1630
+ model.text = model.text ?? 'NOT_SET';
1631
+ model.confirm = model.confirm ?? 'OK';
1632
+ model.decline = model.decline ?? 'CANCEL';
1633
+ componentRef.instance.model = model;
1634
+ this.appRef.attachView(componentRef.hostView);
1635
+ this.domElem = componentRef.hostView.rootNodes[0];
1636
+ document.body.appendChild(this.domElem);
1637
+ }
1638
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbModalService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1639
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbModalService }); }
1640
+ }
1641
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbModalService, decorators: [{
1642
+ type: Injectable
1643
+ }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }, { type: i0.Injector }] });
1509
1644
 
1510
- class AdbConfirmModal {
1511
- constructor(modalRef, elementRef) {
1512
- this.modalRef = modalRef;
1513
- this.elementRef = elementRef;
1514
- }
1515
- ngAfterViewInit() {
1516
- const element = this.elementRef.nativeElement.querySelector('#modal-close');
1517
- if (element) {
1518
- element.focus();
1519
- }
1520
- }
1521
- onClose(confirm) {
1522
- this.modalRef.hide(confirm);
1523
- }
1524
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbConfirmModal, deps: [{ token: AdbModalService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1525
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AdbConfirmModal, selector: "ng-component", inputs: { model: "model" }, ngImport: i0, template: "<div class=\"modal fade show\" *ngIf=\"model\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\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 <div *ngIf=\"model.value\">\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\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>", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
1526
- }
1527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbConfirmModal, decorators: [{
1528
- type: Component,
1529
- args: [{ template: "<div class=\"modal fade show\" *ngIf=\"model\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\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 <div *ngIf=\"model.value\">\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\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>" }]
1530
- }], ctorParameters: function () { return [{ type: AdbModalService }, { type: i0.ElementRef }]; }, propDecorators: { model: [{
1531
- type: Input
1645
+ class AdbConfirmModal {
1646
+ constructor(modalRef, elementRef) {
1647
+ this.modalRef = modalRef;
1648
+ this.elementRef = elementRef;
1649
+ }
1650
+ ngAfterViewInit() {
1651
+ const element = this.elementRef.nativeElement.querySelector('#modal-close');
1652
+ if (element) {
1653
+ element.focus();
1654
+ }
1655
+ }
1656
+ onClose(confirm) {
1657
+ this.modalRef.hide(confirm);
1658
+ }
1659
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbConfirmModal, deps: [{ token: AdbModalService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1660
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AdbConfirmModal, selector: "ng-component", inputs: { model: "model" }, ngImport: i0, template: "<div class=\"modal fade show\" *ngIf=\"model\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\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 <div *ngIf=\"model.value\">\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\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>", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
1661
+ }
1662
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbConfirmModal, decorators: [{
1663
+ type: Component,
1664
+ args: [{ template: "<div class=\"modal fade show\" *ngIf=\"model\" role=\"dialog\"\r\n attr.aria-labelledby=\"mod_header\"\r\n attr.aria-describedby=\"mod_desc\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\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 <div *ngIf=\"model.value\">\r\n <strong>{{model.value}}</strong>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"d-flex gap-2 justify-content-end\">\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"onClose(false)\">{{model.decline|translate}}</button>\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>" }]
1665
+ }], ctorParameters: () => [{ type: AdbModalService }, { type: i0.ElementRef }], propDecorators: { model: [{
1666
+ type: Input
1532
1667
  }] } });
1533
1668
 
1534
- class AdbModalModule {
1535
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1536
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbModalModule, declarations: [AdbConfirmModal], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbConfirmModal] }); }
1537
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalModule, providers: [AdbModalService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
1538
- }
1539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalModule, decorators: [{
1540
- type: NgModule,
1541
- args: [{
1542
- imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
1543
- declarations: [AdbConfirmModal],
1544
- exports: [AdbConfirmModal],
1545
- providers: [AdbModalService]
1546
- }]
1669
+ class AdbModalModule {
1670
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1671
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbModalModule, declarations: [AdbConfirmModal], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbConfirmModal] }); }
1672
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbModalModule, providers: [AdbModalService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
1673
+ }
1674
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbModalModule, decorators: [{
1675
+ type: NgModule,
1676
+ args: [{
1677
+ imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
1678
+ declarations: [AdbConfirmModal],
1679
+ exports: [AdbConfirmModal],
1680
+ providers: [AdbModalService]
1681
+ }]
1547
1682
  }] });
1548
1683
 
1549
- class AdbToastService {
1550
- constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
1551
- this.componentFactoryResolver = componentFactoryResolver;
1552
- this.rendererFactory = rendererFactory;
1553
- this.appRef = appRef;
1554
- this.injector = injector;
1555
- this.toasts = new Array();
1556
- this.toastsSubject = new Subject();
1557
- this.$toasts = this.toastsSubject.asObservable();
1558
- }
1559
- add(toastMessage, time = 4000) {
1560
- this.addContainer();
1561
- toastMessage.type = toastMessage.type ? toastMessage.type : ToastType.Primary;
1562
- toastMessage.index = this.toasts.length;
1563
- toastMessage.delay = of(toastMessage).pipe(delay(time)).subscribe(toast => {
1564
- this.remove(toast);
1565
- });
1566
- this.toasts.push(toastMessage);
1567
- this.toastsSubject.next(this.toasts);
1568
- }
1569
- remove(toast) {
1570
- this.toasts = this.toasts?.filter(x => x.index !== toast.index);
1571
- this.toastsSubject.next(this.toasts);
1572
- }
1573
- addContainer() {
1574
- if (!this.container) {
1575
- this.renderer = this.rendererFactory.createRenderer(null, null);
1576
- //create container i top
1577
- this.container = this.renderer.createElement('div');
1578
- this.renderer.appendChild(document.body, this.container);
1579
- let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbToast).create(this.injector);
1580
- this.appRef.attachView(componentRef.hostView);
1581
- const element = componentRef.hostView.rootNodes[0];
1582
- this.container.prepend(element);
1583
- }
1584
- }
1585
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1586
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastService }); }
1587
- }
1588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastService, decorators: [{
1589
- type: Injectable
1590
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }, { type: i0.Injector }]; } });
1591
- var ToastType;
1592
- (function (ToastType) {
1593
- ToastType[ToastType["Primary"] = 1] = "Primary";
1594
- ToastType[ToastType["Success"] = 2] = "Success";
1595
- ToastType[ToastType["Warn"] = 3] = "Warn";
1596
- ToastType[ToastType["Danger"] = 4] = "Danger";
1684
+ class AdbToastService {
1685
+ constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
1686
+ this.componentFactoryResolver = componentFactoryResolver;
1687
+ this.rendererFactory = rendererFactory;
1688
+ this.appRef = appRef;
1689
+ this.injector = injector;
1690
+ this.toasts = new Array();
1691
+ this.toastsSubject = new Subject();
1692
+ this.$toasts = this.toastsSubject.asObservable();
1693
+ }
1694
+ add(toastMessage, time = 4000) {
1695
+ this.addContainer();
1696
+ toastMessage.type = toastMessage.type ? toastMessage.type : ToastType.Primary;
1697
+ toastMessage.index = this.toasts.length;
1698
+ toastMessage.delay = of(toastMessage).pipe(delay(time)).subscribe(toast => {
1699
+ this.remove(toast);
1700
+ });
1701
+ this.toasts.push(toastMessage);
1702
+ this.toastsSubject.next(this.toasts);
1703
+ }
1704
+ remove(toast) {
1705
+ this.toasts = this.toasts?.filter(x => x.index !== toast.index);
1706
+ this.toastsSubject.next(this.toasts);
1707
+ }
1708
+ addContainer() {
1709
+ if (!this.container) {
1710
+ this.renderer = this.rendererFactory.createRenderer(null, null);
1711
+ //create container i top
1712
+ this.container = this.renderer.createElement('div');
1713
+ this.renderer.appendChild(document.body, this.container);
1714
+ let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbToast).create(this.injector);
1715
+ this.appRef.attachView(componentRef.hostView);
1716
+ const element = componentRef.hostView.rootNodes[0];
1717
+ this.container.prepend(element);
1718
+ }
1719
+ }
1720
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToastService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.RendererFactory2 }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1721
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToastService }); }
1722
+ }
1723
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToastService, decorators: [{
1724
+ type: Injectable
1725
+ }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }, { type: i0.Injector }] });
1726
+ var ToastType;
1727
+ (function (ToastType) {
1728
+ ToastType[ToastType["Primary"] = 1] = "Primary";
1729
+ ToastType[ToastType["Success"] = 2] = "Success";
1730
+ ToastType[ToastType["Warn"] = 3] = "Warn";
1731
+ ToastType[ToastType["Danger"] = 4] = "Danger";
1597
1732
  })(ToastType || (ToastType = {}));
1598
1733
 
1599
- class AdbToast {
1600
- constructor(toastService) {
1601
- this.toastService = toastService;
1602
- this.toastType = ToastType;
1603
- this.toastService.$toasts.subscribe(toasts => {
1604
- this.toasts = toasts;
1605
- });
1606
- }
1607
- onRemoveToast(toast) {
1608
- this.toastService.remove(toast);
1609
- }
1610
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToast, deps: [{ token: AdbToastService }], target: i0.ɵɵFactoryTarget.Component }); }
1611
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AdbToast, selector: "ng-component", ngImport: i0, template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\">\r\n <div class=\"alert alert-dismissible\" role=\"alert\" *ngFor=\"let toast of toasts\"\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 <div class=\"d-flex align-items-center justify-content-between pb-1\" *ngIf=\"toast.header\">\r\n <div class=\"fw-bold pb-1\" *ngIf=\"!toast.headerValue\">{{toast.header|translate}}</div>\r\n <div class=\"fw-bold pb-1\" *ngIf=\"toast.headerValue\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n <div *ngIf=\"!toast.messageValue\">{{toast.message|translate}}</div>\r\n <div *ngIf=\"toast.messageValue\">{{(toast.message|translate:toast.messageValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
1612
- }
1613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToast, decorators: [{
1614
- type: Component,
1615
- args: [{ template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\">\r\n <div class=\"alert alert-dismissible\" role=\"alert\" *ngFor=\"let toast of toasts\"\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 <div class=\"d-flex align-items-center justify-content-between pb-1\" *ngIf=\"toast.header\">\r\n <div class=\"fw-bold pb-1\" *ngIf=\"!toast.headerValue\">{{toast.header|translate}}</div>\r\n <div class=\"fw-bold pb-1\" *ngIf=\"toast.headerValue\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n <div *ngIf=\"!toast.messageValue\">{{toast.message|translate}}</div>\r\n <div *ngIf=\"toast.messageValue\">{{(toast.message|translate:toast.messageValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n </div>\r\n</div>" }]
1616
- }], ctorParameters: function () { return [{ type: AdbToastService }]; } });
1734
+ class AdbToast {
1735
+ constructor(toastService) {
1736
+ this.toastService = toastService;
1737
+ this.toastType = ToastType;
1738
+ this.toastService.$toasts.subscribe(toasts => {
1739
+ this.toasts = toasts;
1740
+ });
1741
+ }
1742
+ onRemoveToast(toast) {
1743
+ this.toastService.remove(toast);
1744
+ }
1745
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToast, deps: [{ token: AdbToastService }], target: i0.ɵɵFactoryTarget.Component }); }
1746
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AdbToast, selector: "ng-component", ngImport: i0, template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\">\r\n <div class=\"alert alert-dismissible\" role=\"alert\" *ngFor=\"let toast of toasts\"\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 <div class=\"d-flex align-items-center justify-content-between pb-1\" *ngIf=\"toast.header\">\r\n <div class=\"fw-bold pb-1\" *ngIf=\"!toast.headerValue\">{{toast.header|translate}}</div>\r\n <div class=\"fw-bold pb-1\" *ngIf=\"toast.headerValue\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n <div *ngIf=\"!toast.messageValue\">{{toast.message|translate}}</div>\r\n <div *ngIf=\"toast.messageValue\">{{(toast.message|translate:toast.messageValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
1747
+ }
1748
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToast, decorators: [{
1749
+ type: Component,
1750
+ args: [{ template: "<div class=\"position-fixed bottom-0 end-0\" style=\"z-index: 50000;min-width: 15rem;\">\r\n <div class=\"alert alert-dismissible\" role=\"alert\" *ngFor=\"let toast of toasts\"\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 <div class=\"d-flex align-items-center justify-content-between pb-1\" *ngIf=\"toast.header\">\r\n <div class=\"fw-bold pb-1\" *ngIf=\"!toast.headerValue\">{{toast.header|translate}}</div>\r\n <div class=\"fw-bold pb-1\" *ngIf=\"toast.headerValue\">{{(toast.header|translate:toast.headerValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n <div class=\"d-flex align-items-center justify-content-between mt-1\">\r\n <div *ngIf=\"!toast.messageValue\">{{toast.message|translate}}</div>\r\n <div *ngIf=\"toast.messageValue\">{{(toast.message|translate:toast.messageValue )}}</div>\r\n <button type=\"button\" class=\"btn-close\" (click)=\"onRemoveToast(toast)\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\r\n </div>\r\n </div>\r\n</div>" }]
1751
+ }], ctorParameters: () => [{ type: AdbToastService }] });
1752
+
1753
+ class AdbToastModule {
1754
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToastModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1755
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbToastModule, declarations: [AdbToast], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbToast] }); }
1756
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToastModule, providers: [AdbToastService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
1757
+ }
1758
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbToastModule, decorators: [{
1759
+ type: NgModule,
1760
+ args: [{
1761
+ imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
1762
+ declarations: [AdbToast],
1763
+ exports: [AdbToast],
1764
+ providers: [AdbToastService]
1765
+ }]
1766
+ }] });
1767
+
1768
+ class AdbHelpButtonComponent {
1769
+ constructor(elementRef) {
1770
+ this.elementRef = elementRef;
1771
+ this.showHelp = false;
1772
+ this.label = '';
1773
+ }
1774
+ ngOnInit() {
1775
+ this.id = +Math.floor(Math.random() * Date.now());
1776
+ }
1777
+ onClick() {
1778
+ const node = this.elementRef.nativeElement.parentNode;
1779
+ if (node) {
1780
+ if (this.showHelp) {
1781
+ node.classList.remove('position-relative');
1782
+ }
1783
+ else {
1784
+ node.classList.add('position-relative');
1785
+ }
1786
+ }
1787
+ this.showHelp = !this.showHelp;
1788
+ }
1789
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbHelpButtonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1790
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AdbHelpButtonComponent, selector: "adb-help-button", inputs: { label: "label" }, ngImport: i0, template: "<div>\r\n <button type=\"button\" id=\"help-button\" tabindex=\"-1\" (adbClickOutside)=\"showHelp=false\"\r\n class=\"w-auto btn btn-invisible p-0 w-auto d-flex gap-1 align-items-baseline\"\r\n [attr.aria-controls]=\"id\" attr.aria-label=\"Help\" [attr.aria-expanded]=\"showHelp\" (click)=\"onClick()\">\r\n <span class=\"fas fa-question-circle text-primary\"></span>\r\n {{label}}\r\n </button>\r\n</div>\r\n<div>\r\n <div *ngIf=\"showHelp\" [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow \" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div><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</div>", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }] }); }
1791
+ }
1792
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbHelpButtonComponent, decorators: [{
1793
+ type: Component,
1794
+ args: [{ selector: 'adb-help-button', template: "<div>\r\n <button type=\"button\" id=\"help-button\" tabindex=\"-1\" (adbClickOutside)=\"showHelp=false\"\r\n class=\"w-auto btn btn-invisible p-0 w-auto d-flex gap-1 align-items-baseline\"\r\n [attr.aria-controls]=\"id\" attr.aria-label=\"Help\" [attr.aria-expanded]=\"showHelp\" (click)=\"onClick()\">\r\n <span class=\"fas fa-question-circle text-primary\"></span>\r\n {{label}}\r\n </button>\r\n</div>\r\n<div>\r\n <div *ngIf=\"showHelp\" [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow \" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div><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</div>" }]
1795
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { label: [{
1796
+ type: Input
1797
+ }] } });
1617
1798
 
1618
- class AdbToastModule {
1619
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1620
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbToastModule, declarations: [AdbToast], imports: [CommonModule, i1$1.TranslateModule, AdbDirectivesModule], exports: [AdbToast] }); }
1621
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastModule, providers: [AdbToastService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
1622
- }
1623
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastModule, decorators: [{
1624
- type: NgModule,
1625
- args: [{
1626
- imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
1627
- declarations: [AdbToast],
1628
- exports: [AdbToast],
1629
- providers: [AdbToastService]
1630
- }]
1799
+ class AdbButtonsModule {
1800
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1801
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbButtonsModule, declarations: [AdbHelpButtonComponent], imports: [CommonModule, AdbDirectivesModule], exports: [AdbHelpButtonComponent] }); }
1802
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbButtonsModule, imports: [CommonModule, AdbDirectivesModule] }); }
1803
+ }
1804
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbButtonsModule, decorators: [{
1805
+ type: NgModule,
1806
+ args: [{
1807
+ imports: [CommonModule, AdbDirectivesModule],
1808
+ declarations: [AdbHelpButtonComponent],
1809
+ exports: [AdbHelpButtonComponent]
1810
+ }]
1631
1811
  }] });
1632
1812
 
1633
- class AdbHelpButtonComponent {
1634
- constructor(elementRef) {
1635
- this.elementRef = elementRef;
1636
- this.showHelp = false;
1637
- this.label = '';
1638
- }
1639
- ngOnInit() {
1640
- this.id = +Math.floor(Math.random() * Date.now());
1641
- }
1642
- onClick() {
1643
- const node = this.elementRef.nativeElement.parentNode;
1644
- if (node) {
1645
- if (this.showHelp) {
1646
- node.classList.remove('position-relative');
1647
- }
1648
- else {
1649
- node.classList.add('position-relative');
1650
- }
1651
- }
1652
- this.showHelp = !this.showHelp;
1653
- }
1654
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbHelpButtonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1655
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AdbHelpButtonComponent, selector: "adb-help-button", inputs: { label: "label" }, ngImport: i0, template: "<div>\r\n <button type=\"button\" id=\"help-button\" tabindex=\"-1\" (adbClickOutside)=\"showHelp=false\"\r\n class=\"w-auto btn btn-invisible p-0 w-auto d-flex gap-1 align-items-baseline\"\r\n [attr.aria-controls]=\"id\" attr.aria-label=\"Help\" [attr.aria-expanded]=\"showHelp\" (click)=\"onClick()\">\r\n <span class=\"fas fa-question-circle text-primary\"></span>\r\n {{label}}\r\n </button>\r\n</div>\r\n<div>\r\n <div *ngIf=\"showHelp\" [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow \" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div><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</div>", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[adbClickOutside]", outputs: ["adbClickOutside"] }] }); }
1656
- }
1657
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbHelpButtonComponent, decorators: [{
1658
- type: Component,
1659
- args: [{ selector: 'adb-help-button', template: "<div>\r\n <button type=\"button\" id=\"help-button\" tabindex=\"-1\" (adbClickOutside)=\"showHelp=false\"\r\n class=\"w-auto btn btn-invisible p-0 w-auto d-flex gap-1 align-items-baseline\"\r\n [attr.aria-controls]=\"id\" attr.aria-label=\"Help\" [attr.aria-expanded]=\"showHelp\" (click)=\"onClick()\">\r\n <span class=\"fas fa-question-circle text-primary\"></span>\r\n {{label}}\r\n </button>\r\n</div>\r\n<div>\r\n <div *ngIf=\"showHelp\" [id]=\"id\" class=\"position-absolute start-0 w-100 adb-plate-primary text-start shadow \" style=\"z-index:4\">\r\n <div class=\"d-flex align-items-center\">\r\n <div><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</div>" }]
1660
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { label: [{
1661
- type: Input
1813
+ class AdbRichEditorComponent {
1814
+ constructor(renderer, el) {
1815
+ this.renderer = renderer;
1816
+ this.el = el;
1817
+ this.hasTaxon = true;
1818
+ this.hasRefernce = true;
1819
+ //ControlValueAccessor
1820
+ this.onChange = () => { };
1821
+ this.onTouched = () => { };
1822
+ }
1823
+ onDoubleClick() {
1824
+ const textarea = this.el.nativeElement.querySelector('textarea');
1825
+ const selectionStart = textarea.selectionStart;
1826
+ let selectionEnd = textarea.selectionEnd;
1827
+ while (selectionEnd > selectionStart && textarea.value[selectionEnd - 1] === ' ') {
1828
+ selectionEnd--;
1829
+ }
1830
+ textarea.setSelectionRange(selectionStart, selectionEnd);
1831
+ }
1832
+ onItalicClick() {
1833
+ const textarea = this.el.nativeElement.querySelector('textarea');
1834
+ if (textarea) {
1835
+ const selectionStart = textarea.selectionStart;
1836
+ const selectionEnd = textarea.selectionEnd;
1837
+ let currentValue = textarea.value;
1838
+ let modifiedText = `${currentValue.substring(0, selectionStart)}_${currentValue.substring(selectionStart, selectionEnd)}_${currentValue.substring(selectionEnd)}`;
1839
+ this.text = modifiedText;
1840
+ this.onChange(this.text);
1841
+ }
1842
+ }
1843
+ onTaxonClick() {
1844
+ const textarea = this.el.nativeElement.querySelector('textarea');
1845
+ if (textarea) {
1846
+ const start = textarea.selectionStart;
1847
+ const end = textarea.selectionEnd;
1848
+ const originalText = textarea.value;
1849
+ const charBefore = start > 0 ? originalText[start - 1] : '';
1850
+ const charAfter = end < originalText.length ? originalText[end] : '';
1851
+ const spaceBefore = charBefore && !/\s/.test(charBefore) ? ' ' : '';
1852
+ const spaceAfter = charAfter && !/\s/.test(charAfter) ? ' ' : '';
1853
+ const newText = originalText.slice(0, start) + spaceBefore + '[Name](taxon:0)' + spaceAfter + originalText.slice(end);
1854
+ this.text = newText;
1855
+ this.onChange(this.text);
1856
+ }
1857
+ }
1858
+ onTextChange() {
1859
+ this.onChange(this.text);
1860
+ }
1861
+ writeValue(value) {
1862
+ this.text = value;
1863
+ }
1864
+ registerOnChange(fn) {
1865
+ this.onChange = fn;
1866
+ }
1867
+ registerOnTouched(fn) {
1868
+ this.onTouched = fn;
1869
+ }
1870
+ setDisabledState(isDisabled) {
1871
+ }
1872
+ ngOnDestroy() {
1873
+ }
1874
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbRichEditorComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1875
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AdbRichEditorComponent, selector: "adb-rich-editor", inputs: { hasTaxon: "hasTaxon", hasRefernce: "hasRefernce" }, providers: [{
1876
+ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbRichEditorComponent)),
1877
+ multi: true
1878
+ }], ngImport: i0, template: "<div>\r\n <div class=\"d-flex justify-content-end gap-3 mb-1\">\r\n <button class=\"btn btn-secondary\" (click)=\"onItalicClick()\"><span class=\"fas fa-italic\"></span></button>\r\n <button *ngIf=\"hasTaxon\" class=\"btn btn-secondary\" (click)=\"onTaxonClick()\"><span class=\"far fa-paw\"></span></button>\r\n </div>\r\n <textarea class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.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: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1879
+ }
1880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbRichEditorComponent, decorators: [{
1881
+ type: Component,
1882
+ args: [{ selector: 'adb-rich-editor', providers: [{
1883
+ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbRichEditorComponent)),
1884
+ multi: true
1885
+ }], template: "<div>\r\n <div class=\"d-flex justify-content-end gap-3 mb-1\">\r\n <button class=\"btn btn-secondary\" (click)=\"onItalicClick()\"><span class=\"fas fa-italic\"></span></button>\r\n <button *ngIf=\"hasTaxon\" class=\"btn btn-secondary\" (click)=\"onTaxonClick()\"><span class=\"far fa-paw\"></span></button>\r\n </div>\r\n <textarea class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n" }]
1886
+ }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { hasTaxon: [{
1887
+ type: Input
1888
+ }], hasRefernce: [{
1889
+ type: Input
1662
1890
  }] } });
1663
1891
 
1664
- class AdbButtonsModule {
1665
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1666
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, declarations: [AdbHelpButtonComponent], imports: [CommonModule, AdbDirectivesModule], exports: [AdbHelpButtonComponent] }); }
1667
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, imports: [CommonModule, AdbDirectivesModule] }); }
1668
- }
1669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, decorators: [{
1670
- type: NgModule,
1671
- args: [{
1672
- imports: [CommonModule, AdbDirectivesModule],
1673
- declarations: [AdbHelpButtonComponent],
1674
- exports: [AdbHelpButtonComponent]
1675
- }]
1892
+ class AdbRichEditorModule {
1893
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbRichEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1894
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AdbRichEditorModule, declarations: [AdbRichEditorComponent], imports: [CommonModule, FormsModule], exports: [AdbRichEditorComponent] }); }
1895
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbRichEditorModule, imports: [CommonModule, FormsModule] }); }
1896
+ }
1897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AdbRichEditorModule, decorators: [{
1898
+ type: NgModule,
1899
+ args: [{
1900
+ imports: [CommonModule, FormsModule],
1901
+ declarations: [AdbRichEditorComponent],
1902
+ exports: [AdbRichEditorComponent]
1903
+ }]
1676
1904
  }] });
1677
1905
 
1678
- /*
1679
- * Public API Surface of artdata-shared
1906
+ /*
1907
+ * Public API Surface of artdata-shared
1680
1908
  */
1681
1909
 
1682
- /**
1683
- * Generated bundle index. Do not edit.
1910
+ /**
1911
+ * Generated bundle index. Do not edit.
1684
1912
  */
1685
1913
 
1686
- export { ADBHeaderModule, ADBNavComponent, AdbButtonsModule, AdbConfirmModal, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, AdbDirectivesModule, AdbDropdownDirective, AdbDropdownModule, AdbHelpButtonComponent, AdbModalModule, AdbModalService, AdbPagersModule, AdbPipesModule, AdbToast, AdbToastModule, AdbToastService, ArtportalenFooterComponent, ArtportalenNavComponent, ArtportalenNavModule, ClickOutsideDirective, EmptyValuePipe, FileUploadDirective, FocusDirective, HighlightHtmlPipe, HighlightPipe, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent, PagerInlineComponent, RedListBadgeClassDirective, RiskClassDirective, ToastType };
1914
+ export { ADBHeaderModule, ADBNavComponent, AdbButtonsModule, AdbConfirmModal, AdbDatePickerComponent, AdbDatePickerDirective, AdbDatePickerModule, AdbDirectivesModule, AdbDropdown2Directive, AdbDropdownDirective, AdbDropdownModule, AdbHelpButtonComponent, AdbModalModule, AdbModalService, AdbPagersModule, AdbPipesModule, AdbRichEditorComponent, AdbRichEditorModule, AdbToast, AdbToastModule, AdbToastService, ArtportalenFooterComponent, ArtportalenNavComponent, ArtportalenNavModule, ClickOutsideDirective, EmptyValuePipe, FileUploadDirective, FocusDirective, HighlightHtmlPipe, HighlightPipe, InfiniteScrollComponent, LocaleDatePipe, NumberSpacingPipe, PagerComponent, PagerInlineComponent, RedListBadgeClassDirective, RichPipe, RiskClassDirective, ToastType };
1687
1915
  //# sourceMappingURL=adb-shared.mjs.map