adb-shared 6.0.2 → 6.0.4

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 -24
  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 -119
  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 -65
  21. package/esm2022/lib/components/adb-rich-editor/adb-rich-editor.module.mjs +19 -19
  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 -22
  46. package/esm2022/lib/pipes/rich.pipe.mjs +36 -36
  47. package/esm2022/public-api.mjs +41 -41
  48. package/fesm2022/adb-shared.mjs +1817 -1815
  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 -11
  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 -23
  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 -22
  70. package/lib/components/adb-rich-editor/adb-rich-editor.module.d.ts +9 -9
  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 -12
  95. package/lib/pipes/rich.pipe.d.ts +11 -11
  96. package/package.json +4 -4
  97. package/public-api.d.ts +38 -38
@@ -5,1908 +5,1910 @@ 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
12
  import * as i1$2 from '@angular/platform-browser';
13
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';
14
- import * as i1$3 from '@angular/forms';
14
+ import * as i2$2 from '@angular/forms';
15
15
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
16
16
  import { delay } from 'rxjs/operators';
17
17
 
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: "16.2.12", ngImport: i0, type: EnvironmentService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); }
23
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService }); }
24
- };
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService$1, decorators: [{
26
- type: Injectable
27
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
28
- type: Inject,
29
- args: ['env']
30
- }] }]; } });
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
+ }] }] });
31
31
 
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: "16.2.12", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
44
- /** @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 }); }
45
- }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClickOutsideDirective, decorators: [{
47
- type: Directive,
48
- args: [{
49
- selector: '[adbClickOutside]',
50
- }]
51
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { adbClickOutside: [{
52
- type: Output
53
- }], onClick: [{
54
- type: HostListener,
55
- 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']]
56
56
  }] } });
57
57
 
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: "16.2.12", ngImport: i0, type: FileUploadDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
78
- /** @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 }); }
79
- }
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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: 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 }] });
91
91
 
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: "16.2.12", ngImport: i0, type: FocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
113
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FocusDirective, selector: "[adbFocus]", inputs: { adbFocus: "adbFocus" }, ngImport: i0 }); }
114
- }
115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FocusDirective, decorators: [{
116
- type: Directive,
117
- args: [{
118
- selector: '[adbFocus]',
119
- }]
120
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { adbFocus: [{
121
- 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
122
122
  }] } });
123
123
 
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: "16.2.12", ngImport: i0, type: RedListBadgeClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
151
- /** @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 }); }
152
- }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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']
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']
164
164
  }] } });
165
165
 
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: "16.2.12", ngImport: i0, type: RiskClassDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
186
- /** @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 }); }
187
- }
188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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']
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']
199
199
  }] } });
200
200
 
201
- class AdbDirectivesModule {
202
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
203
- /** @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] }); }
204
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDirectivesModule }); }
205
- }
206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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
- }]
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
+ }]
213
213
  }] });
214
214
 
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: "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 }); }
301
- /** @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" }] }); }
302
- }
303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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: function () { return [{ 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
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
318
318
  }] } });
319
319
 
320
- class AdbDropdownService {
321
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
322
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownService }); }
323
- }
324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownService, decorators: [{
325
- 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
326
326
  }] });
327
327
 
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: "16.2.12", 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: "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 }); }
391
- }
392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownDirective, decorators: [{
393
- type: Directive,
394
- args: [{
395
- selector: '[adbDropdown]',
396
- exportAs: 'adbDropdown'
397
- }]
398
- }], ctorParameters: function () { return [{ 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']]
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']]
423
423
  }] } });
424
424
 
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: "16.2.12", 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: "16.2.12", 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: "16.2.12", ngImport: i0, type: AdbDropdown2Directive, decorators: [{
506
- type: Directive,
507
- args: [{
508
- selector: '[adbDropdown2]',
509
- exportAs: 'adbDropdown'
510
- }]
511
- }], ctorParameters: function () { return [{ 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']
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
539
  }] } });
540
540
 
541
- class AdbDropdownModule {
542
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
543
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", 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: "16.2.12", ngImport: i0, type: AdbDropdownModule, providers: [AdbDropdownService], imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule] }); }
545
- }
546
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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
- }]
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
+ }]
554
554
  }] });
555
555
 
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: "16.2.12", ngImport: i0, type: InfiniteScrollComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
587
- /** @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 }); }
588
- }
589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InfiniteScrollComponent, decorators: [{
590
- type: Directive,
591
- args: [{ selector: "[onVisible]" }]
592
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onVisible: [{
593
- type: Output
594
- }], onHidden: [{
595
- type: Output
596
- }], height: [{
597
- type: HostBinding,
598
- 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']
599
599
  }] } });
600
600
 
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: "16.2.12", ngImport: i0, type: PagerBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
643
- /** @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 }); }
644
- }
645
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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']
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']
653
653
  }] } });
654
654
 
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: "16.2.12", ngImport: i0, type: PagerComponent, deps: [{ token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
691
- /** @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"] }] }); }
692
- }
693
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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: function () { return [{ type: i2.ActivatedRoute }]; }, propDecorators: { offsetName: [{
697
- type: Input
698
- }], infiniteLimit: [{
699
- 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
700
700
  }] } });
701
701
 
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: "16.2.12", ngImport: i0, type: PagerInlineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
736
- /** @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"] }] }); }
737
- }
738
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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: function () { return []; }, propDecorators: { pageChanged: [{
742
- type: Output
743
- }], infiniteLimit: [{
744
- 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
745
745
  }] } });
746
746
 
747
- class AdbPagersModule {
748
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPagersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
749
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", 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: "16.2.12", ngImport: i0, type: AdbPagersModule, imports: [CommonModule,
752
- RouterModule] }); }
753
- }
754
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", 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
- }]
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
+ }]
764
764
  }] });
765
765
 
766
- class ADBHeaderModule {
767
- static forRoot(environment) {
768
- return {
769
- ngModule: ADBHeaderModule,
770
- providers: [
771
- EnvironmentService$1,
772
- {
773
- provide: 'env',
774
- useValue: environment
775
- }
776
- ]
777
- };
778
- }
779
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
780
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, declarations: [ADBNavComponent], imports: [CommonModule,
781
- HttpClientModule,
782
- RouterModule,
783
- TranslateModule,
784
- AdbDirectivesModule,
785
- AdbDropdownModule,
786
- AdbPagersModule], exports: [ADBNavComponent] }); }
787
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, imports: [CommonModule,
788
- HttpClientModule,
789
- RouterModule,
790
- TranslateModule,
791
- AdbDirectivesModule,
792
- AdbDropdownModule,
793
- AdbPagersModule] }); }
794
- }
795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ADBHeaderModule, decorators: [{
796
- type: NgModule,
797
- args: [{
798
- declarations: [ADBNavComponent],
799
- imports: [
800
- CommonModule,
801
- HttpClientModule,
802
- RouterModule,
803
- TranslateModule,
804
- AdbDirectivesModule,
805
- AdbDropdownModule,
806
- AdbPagersModule
807
- ],
808
- exports: [ADBNavComponent]
809
- }]
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())] }]
810
802
  }] });
811
803
 
812
- class EnvironmentService {
813
- constructor(environment) {
814
- this.environment = environment;
815
- }
816
- /** @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 }); }
817
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService }); }
818
- }
819
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnvironmentService, decorators: [{
820
- type: Injectable
821
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
822
- type: Inject,
823
- args: ['env']
824
- }] }]; } });
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
+ }] }] });
825
817
 
826
- class ArtportalenNavComponent {
827
- set userName(fullName) {
828
- this.fullName = fullName;
829
- }
830
- ;
831
- constructor(httpClient, router, trans, envService) {
832
- this.httpClient = httpClient;
833
- this.router = router;
834
- this.trans = trans;
835
- this.envService = envService;
836
- this.subscription = new Subscription();
837
- this.loginClicked = new EventEmitter();
838
- this.logoutClicked = new EventEmitter();
839
- this.dropMenuChange = new EventEmitter();
840
- this.showPattern = false;
841
- this.translationFinished = false;
842
- this.lastPosition = 0;
843
- this.showNavMenu = false;
844
- this.showUserMenu = false;
845
- this.showReport = true;
846
- this.showObservations = true;
847
- this.showSubs = false;
848
- }
849
- ngOnInit() {
850
- this.url = window.location.href;
851
- const baseUrl = this.envService.environment.resourceUrl;
852
- const url = '/assets/artportalen/links-ap3.json';
853
- this.subscription.add(this.httpClient.get(baseUrl + url).subscribe(result => {
854
- this.navigation = result;
855
- }));
856
- this.initTranslations(baseUrl);
857
- this.router.events.subscribe((event) => {
858
- if (event instanceof NavigationEnd) {
859
- this.showNavMenu = false;
860
- this.dropMenuChange.emit(this.showNavMenu);
861
- }
862
- });
863
- }
864
- showMenuDropdown(show) {
865
- this.showUserMenu = false;
866
- if (this.showNavMenu !== show) {
867
- this.showNavMenu = show;
868
- this.dropMenuChange.emit(show);
869
- }
870
- }
871
- setLanguage(lang) {
872
- this.trans.use(lang);
873
- this.showNavMenu = false;
874
- this.dropMenuChange.emit(false);
875
- }
876
- onUserClick() {
877
- if (this.fullName) {
878
- this.logout();
879
- }
880
- else {
881
- this.login();
882
- }
883
- }
884
- login() {
885
- this.loginClicked.emit();
886
- }
887
- logout() {
888
- this.logoutClicked.emit();
889
- }
890
- initTranslations(baseUrl) {
891
- if (this.trans.store.translations[this.trans.currentLang]) {
892
- this.loadTranslation(baseUrl, this.trans.currentLang);
893
- }
894
- this.subscription.add(this.trans.onLangChange.subscribe((event) => {
895
- this.translationFinished = false;
896
- this.loadTranslation(baseUrl, event.lang);
897
- }));
898
- }
899
- loadTranslation(baseUrl, lang) {
900
- //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
901
- const url = baseUrl + `/assets/artportalen/i18n/${lang}.json`;
902
- this.subscription.add(this.httpClient.get(url).subscribe(translations => {
903
- this.trans.setTranslation(lang, translations, true);
904
- this.translationFinished = true;
905
- }));
906
- }
907
- ngOnDestroy() {
908
- this.subscription.unsubscribe();
909
- }
910
- /** @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 }); }
911
- /** @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" }] }); }
912
- }
913
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavComponent, decorators: [{
914
- type: Component,
915
- 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>" }]
916
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.Router }, { type: i1$1.TranslateService }, { type: EnvironmentService }]; }, propDecorators: { loginClicked: [{
917
- type: Output
918
- }], logoutClicked: [{
919
- type: Output
920
- }], dropMenuChange: [{
921
- type: Output
922
- }], showPattern: [{
923
- type: Input
924
- }], userName: [{
925
- 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
926
918
  }] } });
927
919
 
928
- class ArtportalenFooterComponent {
929
- constructor(httpClient, envService, trans) {
930
- this.httpClient = httpClient;
931
- this.envService = envService;
932
- this.trans = trans;
933
- this.subscription = new Subscription();
934
- this.translationFinished = false;
935
- }
936
- ngOnInit() {
937
- this.url = window.location.href;
938
- this.baseUrl = this.envService.environment.resourceUrl;
939
- this.initTranslations(this.baseUrl);
940
- }
941
- initTranslations(baseUrl) {
942
- if (this.trans.store.translations[this.trans.currentLang]) {
943
- this.loadTranslation(baseUrl, this.trans.currentLang);
944
- }
945
- this.subscription.add(this.trans.onLangChange.subscribe((event) => {
946
- this.translationFinished = false;
947
- this.loadTranslation(baseUrl, event.lang);
948
- }));
949
- }
950
- loadTranslation(baseUrl, lang) {
951
- //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)
952
- const url = baseUrl + `/assets/artportalen/i18n/${lang}.json`;
953
- this.subscription.add(this.httpClient.get(url).subscribe(translations => {
954
- this.trans.setTranslation(lang, translations, true);
955
- this.translationFinished = true;
956
- }));
957
- }
958
- ngOnDestroy() {
959
- this.subscription.unsubscribe();
960
- }
961
- /** @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 }); }
962
- /** @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" }] }); }
963
- }
964
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenFooterComponent, decorators: [{
965
- type: Component,
966
- 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>" }]
967
- }], 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 }] });
968
960
 
969
- class ArtportalenNavModule {
970
- static forRoot(environment) {
971
- return {
972
- ngModule: ArtportalenNavModule,
973
- providers: [
974
- EnvironmentService,
975
- {
976
- provide: 'env',
977
- useValue: environment
978
- }
979
- ]
980
- };
981
- }
982
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
983
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, declarations: [ArtportalenNavComponent,
984
- ArtportalenFooterComponent], imports: [CommonModule,
985
- HttpClientModule,
986
- RouterModule,
987
- TranslateModule,
988
- AdbDirectivesModule,
989
- AdbDropdownModule,
990
- AdbPagersModule], exports: [ArtportalenNavComponent,
991
- ArtportalenFooterComponent] }); }
992
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, imports: [CommonModule,
993
- HttpClientModule,
994
- RouterModule,
995
- TranslateModule,
996
- AdbDirectivesModule,
997
- AdbDropdownModule,
998
- AdbPagersModule] }); }
999
- }
1000
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArtportalenNavModule, decorators: [{
1001
- type: NgModule,
1002
- args: [{
1003
- declarations: [
1004
- ArtportalenNavComponent,
1005
- ArtportalenFooterComponent
1006
- ],
1007
- imports: [
1008
- CommonModule,
1009
- HttpClientModule,
1010
- RouterModule,
1011
- TranslateModule,
1012
- AdbDirectivesModule,
1013
- AdbDropdownModule,
1014
- AdbPagersModule
1015
- ],
1016
- exports: [
1017
- ArtportalenNavComponent,
1018
- ArtportalenFooterComponent
1019
- ]
1020
- }]
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())] }]
1021
1005
  }] });
1022
1006
 
1023
- class LocaleDatePipe {
1024
- constructor(translate) {
1025
- this.translate = translate;
1026
- }
1027
- transform(value, format) {
1028
- return new DatePipe(this.translate.currentLang).transform(value, format, null, this.translate.currentLang);
1029
- }
1030
- /** @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 }); }
1031
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocaleDatePipe, name: "adbLocaleDate", pure: false }); }
1032
- }
1033
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocaleDatePipe, decorators: [{
1034
- type: Pipe,
1035
- args: [{
1036
- name: 'adbLocaleDate',
1037
- pure: false
1038
- }]
1039
- }], 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 }] });
1040
1024
 
1041
- class EmptyValuePipe {
1042
- transform(value) {
1043
- if (!value) {
1044
- return '-';
1045
- }
1046
- if (value.trim() === '') {
1047
- return '-';
1048
- }
1049
- return value;
1050
- }
1051
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmptyValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1052
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: EmptyValuePipe, name: "adbEmptyValue" }); }
1053
- }
1054
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmptyValuePipe, decorators: [{
1055
- type: Pipe,
1056
- args: [{
1057
- name: 'adbEmptyValue'
1058
- }]
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
+ }]
1059
1043
  }] });
1060
1044
 
1061
- class HighlightPipe {
1062
- constructor() {
1063
- this.forbiddenSymbols = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
1064
- }
1065
- transform(value, searchs) {
1066
- if (!value) {
1067
- return value;
1068
- }
1069
- value = value + '';
1070
- if (searchs) {
1071
- if (!Array.isArray(searchs)) {
1072
- searchs = searchs.split(' ').filter(s => s);
1073
- }
1074
- for (let search of searchs) {
1075
- if (this.forbiddenSymbols.test(search)) {
1076
- search = search.replace(this.forbiddenSymbols, '');
1077
- }
1078
- const normalizedSearch = this.normalizeText(search);
1079
- const normalizedValue = this.normalizeText(value);
1080
- const start = normalizedValue ? normalizedValue.indexOf(normalizedSearch) : -1;
1081
- if (start !== -1) {
1082
- const regex = new RegExp(`(${search})(?![^<]*>)`, 'gi');
1083
- const match = value.match(regex);
1084
- if (match) {
1085
- value = value.replace(regex, '<mark>$1</mark>');
1086
- }
1087
- }
1088
- }
1089
- }
1090
- return value;
1091
- }
1092
- normalizeText(text) {
1093
- return text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
1094
- }
1095
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1096
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: HighlightPipe, name: "adbHighlight" }); }
1097
- }
1098
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightPipe, decorators: [{
1099
- type: Pipe,
1100
- args: [{
1101
- name: 'adbHighlight'
1102
- }]
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
+ }]
1103
1087
  }] });
1104
1088
 
1105
- class NumberSpacingPipe {
1106
- transform(value) {
1107
- // If value is empty, 0 is falsy so perform an extra check to not make '0' to an empty string
1108
- if (!value && value !== 0) {
1109
- return '';
1110
- }
1111
- return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
1112
- }
1113
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberSpacingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1114
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: NumberSpacingPipe, name: "adbSpacing", pure: false }); }
1115
- }
1116
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberSpacingPipe, decorators: [{
1117
- type: Pipe,
1118
- args: [{
1119
- name: 'adbSpacing',
1120
- pure: false
1121
- }]
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
+ }]
1122
1106
  }] });
1123
1107
 
1124
- class HighlightHtmlPipe {
1125
- constructor() {
1126
- this.forbiddenSymbols = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
1127
- }
1128
- transform(value, searchs) {
1129
- if (!value) {
1130
- return value;
1131
- }
1132
- value = value + '';
1133
- if (searchs) {
1134
- if (!Array.isArray(searchs)) {
1135
- searchs = searchs.split(' ').filter(s => s);
1136
- }
1137
- for (let search of searchs) {
1138
- if (this.forbiddenSymbols.test(search)) {
1139
- search = search.replace(this.forbiddenSymbols, '');
1140
- }
1141
- const normalizedSearch = this.normalizeText(search);
1142
- const normalizedValue = this.normalizeText(value);
1143
- const start = normalizedValue ? normalizedValue.indexOf(normalizedSearch) : -1;
1144
- if (start !== -1) {
1145
- const regex = new RegExp(`([^<\\w]|^)(${this.escapeRegExp(search)})(?![^<]*>)`, 'gi');
1146
- value = value.replace(regex, '$1<mark>$2</mark>');
1147
- }
1148
- }
1149
- }
1150
- return value;
1151
- }
1152
- normalizeText(text) {
1153
- return text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
1154
- }
1155
- escapeRegExp(text) {
1156
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
1157
- }
1158
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1159
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: HighlightHtmlPipe, name: "adbHighlightHtml" }); }
1160
- }
1161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HighlightHtmlPipe, decorators: [{
1162
- type: Pipe,
1163
- args: [{
1164
- name: 'adbHighlightHtml'
1165
- }]
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
+ }]
1166
1150
  }] });
1167
1151
 
1168
- class RichPipe {
1169
- constructor(sanitizer) {
1170
- this.sanitizer = sanitizer;
1171
- }
1172
- transform(value) {
1173
- if (!value) {
1174
- return '';
1175
- }
1176
- const htmlContent = this.parseCustomMarkdown(value);
1177
- return this.sanitizer.bypassSecurityTrustHtml(htmlContent);
1178
- }
1179
- parseCustomMarkdown(input) {
1180
- const italicRegex = /_([^_]+)_/g;
1181
- const taxonRegex = /\[([^\]]+)\]\(taxon:([^)]+)\)/g;
1182
- const termRegex = /\[([^\]]+)\]\(term:([^)]+)\)/g;
1183
- const referenceRegex = /\[([^\]]+)\]\(reference:([^)]+)\)/g;
1184
- // Replace patterns with HTML tags
1185
- input = input.replace(italicRegex, '<em>$1</em>');
1186
- input = input.replace(taxonRegex, '<span class="taxon" data-id="$2">$1</span>');
1187
- input = input.replace(termRegex, '<span class="term" data-id="$2">$1</span>');
1188
- input = input.replace(referenceRegex, '<span class="reference" data-id="$2">$1</span>');
1189
- return input;
1190
- }
1191
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RichPipe, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
1192
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: RichPipe, name: "rich" }); }
1193
- }
1194
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RichPipe, decorators: [{
1195
- type: Pipe,
1196
- args: [{
1197
- name: 'rich'
1198
- }]
1199
- }], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }]; } });
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 }] });
1200
1184
 
1201
- class AdbPipesModule {
1202
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1203
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule, declarations: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe], exports: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe] }); }
1204
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule }); }
1205
- }
1206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbPipesModule, decorators: [{
1207
- type: NgModule,
1208
- args: [{
1209
- imports: [],
1210
- declarations: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe],
1211
- exports: [RichPipe, HighlightPipe, HighlightHtmlPipe, NumberSpacingPipe, LocaleDatePipe, EmptyValuePipe]
1212
- }]
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
+ }]
1213
1197
  }] });
1214
1198
 
1215
- class AdbDatePickerComponent {
1216
- static { this.MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; }
1217
- static { this.WEEK_DAYS = ['1', '2', '3', '4', '5', '6', '7']; }
1218
- static { this.YEAR_INTERVALL = 8; }
1219
- ;
1220
- constructor(elementRef, translate) {
1221
- this.elementRef = elementRef;
1222
- this.translate = translate;
1223
- this.subscriptions = new Subscription();
1224
- this.currentdDate = new Date();
1225
- this.selectedDate = new Date();
1226
- this.weekDays = AdbDatePickerComponent.WEEK_DAYS;
1227
- this.noYearMode = false;
1228
- this.selectDate = new EventEmitter();
1229
- }
1230
- ngOnInit() {
1231
- if (this.settings) {
1232
- if (this.settings?.minDate || this.settings?.maxDate) {
1233
- const minDate = AdbDatePickerComponent.parseDate(this.settings.minDate);
1234
- const maxDate = AdbDatePickerComponent.parseDate(this.settings.maxDate);
1235
- this.range = {
1236
- start: minDate ? startOfDay(minDate) : subYears(new Date(), 1000),
1237
- end: maxDate ? endOfDay(maxDate) : addYears(new Date(), 1000)
1238
- };
1239
- }
1240
- if (this.settings.noYear) {
1241
- this.noYearMode = this.settings.noYear;
1242
- }
1243
- }
1244
- this.selectedDate = this.currentdDate = this.initialDate ?? new Date();
1245
- this.currentMonth = getMonth(this.selectedDate);
1246
- this.createCalendar();
1247
- }
1248
- onShowYear() {
1249
- this.months = null;
1250
- this.loadYearsInterval();
1251
- }
1252
- onShowMonth() {
1253
- this.years = null;
1254
- this.loadMonths();
1255
- }
1256
- onSelectYear(inYear) {
1257
- this.selectedDate.setFullYear(inYear.getFullYear());
1258
- this.loadMonths();
1259
- this.years = null;
1260
- }
1261
- onSelectMonth(inMonth) {
1262
- this.selectedDate.setMonth(inMonth);
1263
- this.currentMonth = getMonth(this.selectedDate);
1264
- this.createCalendar();
1265
- this.years = null;
1266
- this.months = null;
1267
- }
1268
- onPrev() {
1269
- if (this.years) {
1270
- this.selectedDate = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1271
- this.loadYearsInterval();
1272
- }
1273
- else if (this.months) {
1274
- this.selectedDate = subYears(this.selectedDate, 1);
1275
- this.loadMonths();
1276
- }
1277
- else {
1278
- this.selectedDate = subMonths(this.selectedDate, 1);
1279
- this.createCalendar();
1280
- }
1281
- this.currentMonth = getMonth(this.selectedDate);
1282
- }
1283
- onNext() {
1284
- if (this.years) {
1285
- this.selectedDate = addYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1286
- this.loadYearsInterval();
1287
- }
1288
- else if (this.months) {
1289
- this.selectedDate = addYears(this.selectedDate, 1);
1290
- this.loadMonths();
1291
- }
1292
- else {
1293
- this.selectedDate = addMonths(this.selectedDate, 1);
1294
- this.createCalendar();
1295
- }
1296
- this.currentMonth = getMonth(this.selectedDate);
1297
- }
1298
- ngOnDestroy() {
1299
- this.subscriptions.unsubscribe();
1300
- }
1301
- loadMonths() {
1302
- this.months = AdbDatePickerComponent.MONTHS.map(x => {
1303
- return {
1304
- value: x,
1305
- isThisMonth: getMonth(this.selectedDate) === x && isSameYear(this.currentdDate, this.selectedDate)
1306
- };
1307
- });
1308
- }
1309
- loadYearsInterval() {
1310
- let year = subYears(this.selectedDate, AdbDatePickerComponent.YEAR_INTERVALL);
1311
- const years = [];
1312
- for (let i = 0; i < 16; i++) {
1313
- years.push({
1314
- value: year,
1315
- title: year.getFullYear(),
1316
- isThisYear: isSameYear(year, this.currentdDate)
1317
- });
1318
- year = addYears(year, 1);
1319
- }
1320
- this.years = years;
1321
- }
1322
- onSelectDate(day) {
1323
- this.selectDate.emit(day.value);
1324
- }
1325
- createCalendar() {
1326
- const weeks = [];
1327
- const monthInterval = { start: startOfMonth(this.selectedDate), end: endOfMonth(this.selectedDate) };
1328
- var fnsWweeks = eachWeekOfInterval(monthInterval, { weekStartsOn: this.translate.currentLang === 'sv' || this.translate.currentLang === 'sv-SE' ? 1 : 0 });
1329
- for (const fnsWeek of fnsWweeks) {
1330
- const week = { weekNumber: 0, days: [] };
1331
- week.weekNumber = getISOWeek(new Date(fnsWeek));
1332
- const weekInterval = { start: new Date(fnsWeek), end: addDays(new Date(fnsWeek), 6) };
1333
- week.days = eachDayOfInterval(weekInterval).map(day => {
1334
- day.setHours(getHours(new Date()));
1335
- day.setMinutes(getMinutes(new Date()));
1336
- return {
1337
- value: day,
1338
- isSelected: isSameYear(day, this.initialDate) && isSameDay(day, this.initialDate) && isSameMonth(day, this.initialDate),
1339
- isInRange: this.range ? isWithinInterval(day, this.range) : true,
1340
- isToday: isSameDay(day, new Date()),
1341
- inMonth: monthInterval.start.getMonth() === day.getMonth()
1342
- };
1343
- });
1344
- weeks.push(week);
1345
- }
1346
- this.weeks = weeks;
1347
- }
1348
- static parseDate(value) {
1349
- if (typeof value === 'string') {
1350
- if (isValid(parseISO(value))) {
1351
- return parseISO(value);
1352
- }
1353
- else {
1354
- return null;
1355
- }
1356
- }
1357
- else if (value instanceof Date) {
1358
- return value;
1359
- }
1360
- else {
1361
- return null;
1362
- }
1363
- }
1364
- /** @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 }); }
1365
- /** @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" }] }); }
1366
- }
1367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerComponent, decorators: [{
1368
- type: Component,
1369
- 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" }]
1370
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.TranslateService }]; }, propDecorators: { initialDate: [{
1371
- type: Input
1372
- }], settings: [{
1373
- type: Input
1374
- }], toLeft: [{
1375
- type: Input
1376
- }], id: [{
1377
- type: HostBinding,
1378
- args: ['id']
1379
- }, {
1380
- type: Input
1381
- }], selectDate: [{
1382
- 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
1383
1367
  }] } });
1384
1368
 
1385
- class AdbDatePickerService {
1386
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1387
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerService }); }
1388
- }
1389
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerService, decorators: [{
1390
- 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
1391
1375
  }] });
1392
1376
 
1393
- class AdbDatePickerDirective {
1394
- constructor(viewContainerRef, renderer, elementRef, adbDatePickerService, translate) {
1395
- this.viewContainerRef = viewContainerRef;
1396
- this.renderer = renderer;
1397
- this.elementRef = elementRef;
1398
- this.adbDatePickerService = adbDatePickerService;
1399
- this.translate = translate;
1400
- this.subscriptions = new Subscription();
1401
- this.autocomplete = 'off';
1402
- this.adbBlur = new EventEmitter();
1403
- this.format = 'yyyy-MM-dd';
1404
- this.settings = null;
1405
- //ControlValueAccessor
1406
- this.onChange = () => { };
1407
- this.onTouched = () => { };
1408
- this.onValidationChange = () => { };
1409
- }
1410
- ngOnInit() {
1411
- this.elementRef.nativeElement.setAttribute("placeholder", this.format);
1412
- }
1413
- onClick() {
1414
- if (this.adbDatePickerService.viewRef) {
1415
- this.adbDatePickerService.viewRef.destroy();
1416
- }
1417
- const viewRef = this.viewContainerRef.createComponent(AdbDatePickerComponent);
1418
- viewRef.instance.settings = this.settings;
1419
- viewRef.instance.toLeft = this.toLeft;
1420
- viewRef.instance.initialDate = this.currentDate;
1421
- this.id = this.getId();
1422
- viewRef.instance.id = this.id;
1423
- viewRef.instance.selectDate.subscribe((date) => {
1424
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(date, this.format, this.translate.currentLang));
1425
- this.onChange(date);
1426
- this.currentDate = date;
1427
- this.onHide();
1428
- this.adbBlur.emit(date);
1429
- });
1430
- this.adbDatePickerService.viewRef = viewRef;
1431
- }
1432
- onKeyup(event) {
1433
- const date = AdbDatePickerDirective.tryParse(event.target.value);
1434
- if (date) {
1435
- const now = new Date();
1436
- date.setHours(now.getHours());
1437
- date.setMinutes(now.getMinutes());
1438
- date.setSeconds(now.getSeconds());
1439
- this.onChange(date);
1440
- }
1441
- else {
1442
- this.onChange(event.target.value); //send inccorect values to form
1443
- }
1444
- }
1445
- onTabDown() {
1446
- this.updateValueOnLeave();
1447
- this.onHide();
1448
- this.adbBlur.emit(this.currentDate);
1449
- }
1450
- onEscdOWN() {
1451
- this.updateValueOnLeave();
1452
- this.onHide();
1453
- }
1454
- onHide() {
1455
- this.adbDatePickerService.viewRef = null;
1456
- this.viewContainerRef.detach();
1457
- this.viewContainerRef.clear();
1458
- }
1459
- onCheckOutSideClick(target) {
1460
- const nativeElement = this.adbDatePickerService.viewRef?.instance.elementRef.nativeElement ?? null;
1461
- if (nativeElement) {
1462
- if (nativeElement.id === this.id) {
1463
- if (!target.hasAttribute('adbdatepicker')) {
1464
- const clickedInside = nativeElement.contains(target);
1465
- if (!clickedInside) {
1466
- this.updateValueOnLeave();
1467
- this.onHide();
1468
- this.adbBlur.emit(this.currentDate);
1469
- }
1470
- }
1471
- }
1472
- }
1473
- }
1474
- updateValueOnLeave() {
1475
- if (this.isValid) {
1476
- if (this.currentDate) {
1477
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang));
1478
- }
1479
- else {
1480
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1481
- }
1482
- }
1483
- }
1484
- ngOnDestroy() {
1485
- this.subscriptions.unsubscribe();
1486
- }
1487
- //Validator
1488
- validate(control) {
1489
- const value = control.value;
1490
- if (!value) {
1491
- this.currentDate = null;
1492
- this.isValid = true;
1493
- return null;
1494
- }
1495
- if (value instanceof Date) {
1496
- this.currentDate = value;
1497
- this.isValid = true;
1498
- return null;
1499
- }
1500
- if (typeof value === 'string' || value instanceof String) {
1501
- const date = AdbDatePickerDirective.tryParse(value);
1502
- if (!date) {
1503
- this.isValid = false;
1504
- return { date: true };
1505
- }
1506
- }
1507
- this.isValid = true;
1508
- return null;
1509
- }
1510
- registerOnValidatorChange(fn) {
1511
- this.onValidationChange = fn;
1512
- }
1513
- writeValue(value) {
1514
- if (!value) {
1515
- this.currentDate = null;
1516
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', '');
1517
- return;
1518
- }
1519
- if (typeof value === 'string' || value instanceof String) {
1520
- const date = AdbDatePickerDirective.tryParse(value);
1521
- if (!date) {
1522
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
1523
- return;
1524
- }
1525
- value = date;
1526
- }
1527
- if (value instanceof Date) {
1528
- this.currentDate = value;
1529
- this.renderer.setProperty(this.elementRef.nativeElement, 'value', formatDate(this.currentDate, this.format, this.translate.currentLang));
1530
- }
1531
- }
1532
- registerOnChange(fn) {
1533
- this.onChange = fn;
1534
- }
1535
- registerOnTouched(fn) {
1536
- this.onTouched = fn;
1537
- }
1538
- setDisabledState(isDisabled) {
1539
- this.viewContainerRef.clear();
1540
- }
1541
- static tryParse(dateString) {
1542
- const parsed = parseISO(dateString);
1543
- return isValid(parsed) ? parsed : null;
1544
- }
1545
- getId() {
1546
- return '' + Math.floor(Math.random() * Date.now());
1547
- }
1548
- /** @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 }); }
1549
- /** @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: [{
1550
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
1551
- multi: true
1552
- },
1553
- {
1554
- provide: NG_VALIDATORS,
1555
- useExisting: AdbDatePickerDirective,
1556
- multi: true,
1557
- },], ngImport: i0 }); }
1558
- }
1559
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerDirective, decorators: [{
1560
- type: Directive,
1561
- args: [{
1562
- selector: `input[adbDatepicker]`,
1563
- providers: [{
1564
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbDatePickerDirective)),
1565
- multi: true
1566
- },
1567
- {
1568
- provide: NG_VALIDATORS,
1569
- useExisting: AdbDatePickerDirective,
1570
- multi: true,
1571
- },]
1572
- }]
1573
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: AdbDatePickerService }, { type: i1$1.TranslateService }]; }, propDecorators: { autocomplete: [{
1574
- type: HostBinding,
1575
- args: ['autocomplete']
1576
- }], adbBlur: [{
1577
- type: Output
1578
- }], format: [{
1579
- type: Input
1580
- }], toLeft: [{
1581
- type: Input
1582
- }], settings: [{
1583
- type: Input
1584
- }], onClick: [{
1585
- type: HostListener,
1586
- args: ['click']
1587
- }], onKeyup: [{
1588
- type: HostListener,
1589
- args: ['keyup', ['$event']]
1590
- }], onTabDown: [{
1591
- type: HostListener,
1592
- args: ['keydown.shift.tab']
1593
- }, {
1594
- type: HostListener,
1595
- args: ['keydown.tab']
1596
- }], onEscdOWN: [{
1597
- type: HostListener,
1598
- args: ['keydown.esc']
1599
- }], onCheckOutSideClick: [{
1600
- type: HostListener,
1601
- 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']]
1602
1586
  }] } });
1603
1587
 
1604
- class AdbDatePickerModule {
1605
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1606
- /** @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] }); }
1607
- /** @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] }); }
1608
- }
1609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbDatePickerModule, decorators: [{
1610
- type: NgModule,
1611
- args: [{
1612
- imports: [CommonModule, TranslateModule.forChild(), AdbPipesModule, AdbDirectivesModule],
1613
- declarations: [AdbDatePickerComponent, AdbDatePickerDirective],
1614
- exports: [AdbDatePickerComponent, AdbDatePickerDirective],
1615
- providers: [AdbDatePickerService]
1616
- }]
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
+ }]
1617
1601
  }] });
1618
1602
 
1619
- class AdbModalService {
1620
- constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
1621
- this.componentFactoryResolver = componentFactoryResolver;
1622
- this.appRef = appRef;
1623
- this.injector = injector;
1624
- this.closeSubject = new Subject();
1625
- this.close$ = this.closeSubject.asObservable();
1626
- this.renderer = rendererFactory.createRenderer(null, null);
1627
- }
1628
- hide(confirm) {
1629
- this.closeSubject.next(confirm);
1630
- document.body.removeChild(this.domElem);
1631
- document.body.removeChild(this.backdrop);
1632
- var main = this.renderer.selectRootElement('main', true);
1633
- this.renderer.removeAttribute(main, 'inert');
1634
- this.closeSubject.unsubscribe();
1635
- this.closeSubject = new Subject();
1636
- this.close$ = this.closeSubject.asObservable();
1637
- }
1638
- showConfirm(model) {
1639
- var main = this.renderer.selectRootElement('main', true);
1640
- main.setAttribute('inert', '');
1641
- this.backdrop = this.renderer.createElement('div');
1642
- this.backdrop.classList.add('modal-backdrop', 'fade', 'show');
1643
- this.renderer.appendChild(document.body, this.backdrop);
1644
- let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbConfirmModal).create(this.injector);
1645
- model.header = model.header ?? 'NOT_SET';
1646
- model.text = model.text ?? 'NOT_SET';
1647
- model.confirm = model.confirm ?? 'OK';
1648
- model.decline = model.decline ?? 'CANCEL';
1649
- componentRef.instance.model = model;
1650
- this.appRef.attachView(componentRef.hostView);
1651
- this.domElem = componentRef.hostView.rootNodes[0];
1652
- document.body.appendChild(this.domElem);
1653
- }
1654
- /** @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 }); }
1655
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalService }); }
1656
- }
1657
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalService, decorators: [{
1658
- type: Injectable
1659
- }], 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 }] });
1660
1644
 
1661
- class AdbConfirmModal {
1662
- constructor(modalRef, elementRef) {
1663
- this.modalRef = modalRef;
1664
- this.elementRef = elementRef;
1665
- }
1666
- ngAfterViewInit() {
1667
- const element = this.elementRef.nativeElement.querySelector('#modal-close');
1668
- if (element) {
1669
- element.focus();
1670
- }
1671
- }
1672
- onClose(confirm) {
1673
- this.modalRef.hide(confirm);
1674
- }
1675
- /** @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 }); }
1676
- /** @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" }] }); }
1677
- }
1678
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbConfirmModal, decorators: [{
1679
- type: Component,
1680
- 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>" }]
1681
- }], ctorParameters: function () { return [{ type: AdbModalService }, { type: i0.ElementRef }]; }, propDecorators: { model: [{
1682
- 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
1683
1667
  }] } });
1684
1668
 
1685
- class AdbModalModule {
1686
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1687
- /** @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] }); }
1688
- /** @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] }); }
1689
- }
1690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbModalModule, decorators: [{
1691
- type: NgModule,
1692
- args: [{
1693
- imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
1694
- declarations: [AdbConfirmModal],
1695
- exports: [AdbConfirmModal],
1696
- providers: [AdbModalService]
1697
- }]
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
+ }]
1698
1682
  }] });
1699
1683
 
1700
- class AdbToastService {
1701
- constructor(componentFactoryResolver, rendererFactory, appRef, injector) {
1702
- this.componentFactoryResolver = componentFactoryResolver;
1703
- this.rendererFactory = rendererFactory;
1704
- this.appRef = appRef;
1705
- this.injector = injector;
1706
- this.toasts = new Array();
1707
- this.toastsSubject = new Subject();
1708
- this.$toasts = this.toastsSubject.asObservable();
1709
- }
1710
- add(toastMessage, time = 4000) {
1711
- this.addContainer();
1712
- toastMessage.type = toastMessage.type ? toastMessage.type : ToastType.Primary;
1713
- toastMessage.index = this.toasts.length;
1714
- toastMessage.delay = of(toastMessage).pipe(delay(time)).subscribe(toast => {
1715
- this.remove(toast);
1716
- });
1717
- this.toasts.push(toastMessage);
1718
- this.toastsSubject.next(this.toasts);
1719
- }
1720
- remove(toast) {
1721
- this.toasts = this.toasts?.filter(x => x.index !== toast.index);
1722
- this.toastsSubject.next(this.toasts);
1723
- }
1724
- addContainer() {
1725
- if (!this.container) {
1726
- this.renderer = this.rendererFactory.createRenderer(null, null);
1727
- //create container i top
1728
- this.container = this.renderer.createElement('div');
1729
- this.renderer.appendChild(document.body, this.container);
1730
- let componentRef = this.componentFactoryResolver.resolveComponentFactory(AdbToast).create(this.injector);
1731
- this.appRef.attachView(componentRef.hostView);
1732
- const element = componentRef.hostView.rootNodes[0];
1733
- this.container.prepend(element);
1734
- }
1735
- }
1736
- /** @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 }); }
1737
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastService }); }
1738
- }
1739
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastService, decorators: [{
1740
- type: Injectable
1741
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.RendererFactory2 }, { type: i0.ApplicationRef }, { type: i0.Injector }]; } });
1742
- var ToastType;
1743
- (function (ToastType) {
1744
- ToastType[ToastType["Primary"] = 1] = "Primary";
1745
- ToastType[ToastType["Success"] = 2] = "Success";
1746
- ToastType[ToastType["Warn"] = 3] = "Warn";
1747
- 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";
1748
1732
  })(ToastType || (ToastType = {}));
1749
1733
 
1750
- class AdbToast {
1751
- constructor(toastService) {
1752
- this.toastService = toastService;
1753
- this.toastType = ToastType;
1754
- this.toastService.$toasts.subscribe(toasts => {
1755
- this.toasts = toasts;
1756
- });
1757
- }
1758
- onRemoveToast(toast) {
1759
- this.toastService.remove(toast);
1760
- }
1761
- /** @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 }); }
1762
- /** @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" }] }); }
1763
- }
1764
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToast, decorators: [{
1765
- type: Component,
1766
- 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>" }]
1767
- }], 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 }] });
1768
1752
 
1769
- class AdbToastModule {
1770
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1771
- /** @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] }); }
1772
- /** @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] }); }
1773
- }
1774
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbToastModule, decorators: [{
1775
- type: NgModule,
1776
- args: [{
1777
- imports: [CommonModule, TranslateModule.forChild(), AdbDirectivesModule],
1778
- declarations: [AdbToast],
1779
- exports: [AdbToast],
1780
- providers: [AdbToastService]
1781
- }]
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
+ }]
1782
1766
  }] });
1783
1767
 
1784
- class AdbHelpButtonComponent {
1785
- constructor(elementRef) {
1786
- this.elementRef = elementRef;
1787
- this.showHelp = false;
1788
- this.label = '';
1789
- }
1790
- ngOnInit() {
1791
- this.id = +Math.floor(Math.random() * Date.now());
1792
- }
1793
- onClick() {
1794
- const node = this.elementRef.nativeElement.parentNode;
1795
- if (node) {
1796
- if (this.showHelp) {
1797
- node.classList.remove('position-relative');
1798
- }
1799
- else {
1800
- node.classList.add('position-relative');
1801
- }
1802
- }
1803
- this.showHelp = !this.showHelp;
1804
- }
1805
- /** @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 }); }
1806
- /** @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"] }] }); }
1807
- }
1808
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbHelpButtonComponent, decorators: [{
1809
- type: Component,
1810
- 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>" }]
1811
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { label: [{
1812
- type: Input
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
1813
1797
  }] } });
1814
1798
 
1815
- class AdbButtonsModule {
1816
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1817
- /** @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] }); }
1818
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, imports: [CommonModule, AdbDirectivesModule] }); }
1819
- }
1820
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbButtonsModule, decorators: [{
1821
- type: NgModule,
1822
- args: [{
1823
- imports: [CommonModule, AdbDirectivesModule],
1824
- declarations: [AdbHelpButtonComponent],
1825
- exports: [AdbHelpButtonComponent]
1826
- }]
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
+ }]
1827
1811
  }] });
1828
1812
 
1829
- class AdbRichEditorComponent {
1830
- constructor(renderer, el) {
1831
- this.renderer = renderer;
1832
- this.el = el;
1833
- //ControlValueAccessor
1834
- this.onChange = () => { };
1835
- this.onTouched = () => { };
1836
- }
1837
- ngAfterViewInit() {
1838
- }
1839
- onDoubleClick() {
1840
- console.log('what');
1841
- const textarea = this.el.nativeElement.querySelector('textarea');
1842
- const selectionStart = textarea.selectionStart;
1843
- let selectionEnd = textarea.selectionEnd;
1844
- while (selectionEnd > selectionStart && textarea.value[selectionEnd - 1] === ' ') {
1845
- selectionEnd--;
1846
- }
1847
- textarea.setSelectionRange(selectionStart, selectionEnd);
1848
- }
1849
- onItalicClick() {
1850
- const textarea = this.el.nativeElement.querySelector('textarea');
1851
- if (textarea) {
1852
- const selectionStart = textarea.selectionStart;
1853
- const selectionEnd = textarea.selectionEnd;
1854
- let currentValue = textarea.value;
1855
- let modifiedText = `${currentValue.substring(0, selectionStart)}_${currentValue.substring(selectionStart, selectionEnd)}_${currentValue.substring(selectionEnd)}`;
1856
- this.text = modifiedText;
1857
- this.onChange(this.text);
1858
- }
1859
- }
1860
- onTextChange() {
1861
- this.onChange(this.text);
1862
- }
1863
- writeValue(value) {
1864
- this.text = value;
1865
- }
1866
- registerOnChange(fn) {
1867
- this.onChange = fn;
1868
- }
1869
- registerOnTouched(fn) {
1870
- this.onTouched = fn;
1871
- }
1872
- setDisabledState(isDisabled) {
1873
- }
1874
- ngOnDestroy() {
1875
- }
1876
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbRichEditorComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
1877
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AdbRichEditorComponent, selector: "adb-rich-editor", providers: [{
1878
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbRichEditorComponent)),
1879
- multi: true
1880
- }], 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 </div>\r\n <textarea class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1881
- }
1882
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbRichEditorComponent, decorators: [{
1883
- type: Component,
1884
- args: [{ selector: 'adb-rich-editor', providers: [{
1885
- provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((() => AdbRichEditorComponent)),
1886
- multi: true
1887
- }], 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 </div>\r\n <textarea class=\"form-control\" [(ngModel)]=\"text\" (ngModelChange)=\"onTextChange()\" (dblclick)=\"onDoubleClick()\"></textarea>\r\n</div>\r\n" }]
1888
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; } });
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
1890
+ }] } });
1889
1891
 
1890
- class AdbRichEditorModule {
1891
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbRichEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1892
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: AdbRichEditorModule, declarations: [AdbRichEditorComponent], imports: [CommonModule, FormsModule], exports: [AdbRichEditorComponent] }); }
1893
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbRichEditorModule, imports: [CommonModule, FormsModule] }); }
1894
- }
1895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdbRichEditorModule, decorators: [{
1896
- type: NgModule,
1897
- args: [{
1898
- imports: [CommonModule, FormsModule],
1899
- declarations: [AdbRichEditorComponent],
1900
- exports: [AdbRichEditorComponent]
1901
- }]
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
+ }]
1902
1904
  }] });
1903
1905
 
1904
- /*
1905
- * Public API Surface of artdata-shared
1906
+ /*
1907
+ * Public API Surface of artdata-shared
1906
1908
  */
1907
1909
 
1908
- /**
1909
- * Generated bundle index. Do not edit.
1910
+ /**
1911
+ * Generated bundle index. Do not edit.
1910
1912
  */
1911
1913
 
1912
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 };