newportsite 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/newportsite-1.1.3.tgz +0 -0
  2. package/ng-package.json +7 -0
  3. package/obfuscate.js +70 -0
  4. package/package.json +15 -0
  5. package/src/lib/app.component.ts +47 -0
  6. package/src/lib/app.routing.ts +38 -0
  7. package/src/lib/auth/alert.component.html +5 -0
  8. package/src/lib/auth/alert.component.ts +24 -0
  9. package/src/lib/auth/auth.component.html +1 -0
  10. package/src/lib/auth/auth.component.ts +10 -0
  11. package/src/lib/auth/auth.routes.ts +16 -0
  12. package/src/lib/auth/index.ts +4 -0
  13. package/src/lib/auth/login.component.html +87 -0
  14. package/src/lib/auth/login.component.ts +158 -0
  15. package/src/lib/auth/models/index.ts +1 -0
  16. package/src/lib/auth/models/user.ts +25 -0
  17. package/src/lib/auth/register.component.html +157 -0
  18. package/src/lib/auth/register.component.ts +219 -0
  19. package/src/lib/auth/services/alert.service.ts +47 -0
  20. package/src/lib/auth/services/auth.service.ts +28 -0
  21. package/src/lib/auth/services/index.ts +3 -0
  22. package/src/lib/auth/services/user.service.spec.ts +112 -0
  23. package/src/lib/auth/services/user.service.ts +47 -0
  24. package/src/lib/common/card.component.html +72 -0
  25. package/src/lib/common/card.component.ts +102 -0
  26. package/src/lib/common/commands.component.html +8 -0
  27. package/src/lib/common/commands.component.ts +42 -0
  28. package/src/lib/common/context.component.html +9 -0
  29. package/src/lib/common/context.component.ts +38 -0
  30. package/src/lib/common/grid.component.html +20 -0
  31. package/src/lib/common/grid.component.ts +747 -0
  32. package/src/lib/common/index.ts +9 -0
  33. package/src/lib/common/loader.component.html +5 -0
  34. package/src/lib/common/loader.component.ts +27 -0
  35. package/src/lib/common/lookup.component.html +29 -0
  36. package/src/lib/common/lookup.component.ts +115 -0
  37. package/src/lib/common/messagebox.component.html +39 -0
  38. package/src/lib/common/messagebox.component.ts +74 -0
  39. package/src/lib/common/theme-toggle.component.ts +139 -0
  40. package/src/lib/config.ts +62 -0
  41. package/src/lib/containers/default-layout/default-layout.component.html +191 -0
  42. package/src/lib/containers/default-layout/default-layout.component.ts +158 -0
  43. package/src/lib/containers/default-layout/index.ts +1 -0
  44. package/src/lib/containers/index.ts +1 -0
  45. package/src/lib/directives/component.draggable.ts +80 -0
  46. package/src/lib/directives/index.ts +2 -0
  47. package/src/lib/directives/input.directive.spec.ts +158 -0
  48. package/src/lib/directives/input.directive.ts +210 -0
  49. package/src/lib/home/dashboard/dashboard.component.html +38 -0
  50. package/src/lib/home/dashboard/dashboard.component.ts +50 -0
  51. package/src/lib/home/dashboard/index.ts +1 -0
  52. package/src/lib/home/index.component.html +1 -0
  53. package/src/lib/home/index.component.ts +10 -0
  54. package/src/lib/home/index.routes.ts +29 -0
  55. package/src/lib/home/index.ts +1 -0
  56. package/src/lib/home/info/index.ts +1 -0
  57. package/src/lib/home/info/info.component.css +476 -0
  58. package/src/lib/home/info/info.component.html +174 -0
  59. package/src/lib/home/info/info.component.ts +287 -0
  60. package/src/lib/home/model/article.component.html +10 -0
  61. package/src/lib/home/model/article.component.ts +50 -0
  62. package/src/lib/home/model/barchart.component.html +8 -0
  63. package/src/lib/home/model/barchart.component.ts +59 -0
  64. package/src/lib/home/model/index.ts +7 -0
  65. package/src/lib/home/model/itemdetail.component.html +25 -0
  66. package/src/lib/home/model/itemdetail.component.ts +93 -0
  67. package/src/lib/home/model/itemtab.component.html +25 -0
  68. package/src/lib/home/model/itemtab.component.ts +105 -0
  69. package/src/lib/home/model/model.component.html +121 -0
  70. package/src/lib/home/model/model.component.ts +510 -0
  71. package/src/lib/home/model/modeltoolbar.component.html +111 -0
  72. package/src/lib/home/model/modeltoolbar.component.ts +157 -0
  73. package/src/lib/home/model/navigation.component.html +86 -0
  74. package/src/lib/home/model/navigation.component.ts +247 -0
  75. package/src/lib/home/model/services/index.ts +1 -0
  76. package/src/lib/home/model/services/model.service.spec.ts +423 -0
  77. package/src/lib/home/model/services/model.service.ts +319 -0
  78. package/src/lib/home/modelsearch/index.ts +1 -0
  79. package/src/lib/home/modelsearch/modelsearch.component.html +124 -0
  80. package/src/lib/home/modelsearch/modelsearch.component.ts +453 -0
  81. package/src/lib/interfaces/data.interface.ts +131 -0
  82. package/src/lib/interfaces/index.ts +2 -0
  83. package/src/lib/interfaces/item.interface.ts +438 -0
  84. package/src/lib/players/lookup/lookup.directive.ts +6 -0
  85. package/src/lib/players/lookup/lookup.item.component.ts +37 -0
  86. package/src/lib/players/lookup/lookup.item.ts +9 -0
  87. package/src/lib/players/lookup/lookup.player.component.ts +59 -0
  88. package/src/lib/players/lookup/lookup.selector.component.ts +41 -0
  89. package/src/lib/players/model/model.directive.ts +6 -0
  90. package/src/lib/players/model/model.item.component.spec.ts +311 -0
  91. package/src/lib/players/model/model.item.component.ts +3457 -0
  92. package/src/lib/players/model/model.item.ts +9 -0
  93. package/src/lib/players/model/model.player.component.ts +109 -0
  94. package/src/lib/players/model/model.selector.component.ts +59 -0
  95. package/src/lib/scheduler/scheduler.component.html +13 -0
  96. package/src/lib/scheduler/scheduler.component.scss +6 -0
  97. package/src/lib/scheduler/scheduler.component.ts +296 -0
  98. package/src/lib/scheduler/scheduler.routes.ts +15 -0
  99. package/src/lib/scheduler/schedulerdialog.component.html +72 -0
  100. package/src/lib/scheduler/schedulerdialog.component.ts +208 -0
  101. package/src/lib/scheduler/services/scheduler.service.ts +133 -0
  102. package/src/lib/services/auth-state.service.ts +129 -0
  103. package/src/lib/services/auth.interceptor.spec.ts +144 -0
  104. package/src/lib/services/auth.interceptor.ts +44 -0
  105. package/src/lib/services/cache.service.spec.ts +143 -0
  106. package/src/lib/services/cache.service.ts +71 -0
  107. package/src/lib/services/global-error-handler.spec.ts +39 -0
  108. package/src/lib/services/global-error-handler.ts +28 -0
  109. package/src/lib/services/global.service.spec.ts +801 -0
  110. package/src/lib/services/global.service.ts +724 -0
  111. package/src/lib/services/message.service.ts +556 -0
  112. package/src/lib/services/theme.service.ts +96 -0
  113. package/src/lib/template/authtemplate.component.html +6 -0
  114. package/src/lib/template/authtemplate.component.ts +13 -0
  115. package/src/lib/template/basetemplate.component.html +7 -0
  116. package/src/lib/template/basetemplate.component.ts +13 -0
  117. package/src/lib/template/index.ts +3 -0
  118. package/src/lib/template/modeltemplate.component.html +7 -0
  119. package/src/lib/template/modeltemplate.component.ts +21 -0
  120. package/src/lib/utils/piva.spec.ts +56 -0
  121. package/src/lib/utils/piva.ts +29 -0
  122. package/src/lib/validators/email.validator.spec.ts +57 -0
  123. package/src/lib/validators/email.validator.ts +17 -0
  124. package/src/lib/validators/equalPasswords.validator.spec.ts +54 -0
  125. package/src/lib/validators/equalPasswords.validator.ts +17 -0
  126. package/src/lib/validators/index.ts +2 -0
  127. package/src/lib/version.ts +1 -0
  128. package/src/public-api.ts +64 -0
  129. package/src/typings.d.ts +2 -0
  130. package/tsconfig.lib.json +18 -0
  131. package/tsconfig.lib.prod.json +9 -0
@@ -0,0 +1,9 @@
1
+ export * from './loader.component';
2
+ export * from './lookup.component';
3
+ export * from './messagebox.component';
4
+ export * from './context.component';
5
+ export * from './grid.component';
6
+ export * from './commands.component';
7
+ export * from './card.component';
8
+ export * from './theme-toggle.component';
9
+ export * from '../home/model/barchart.component';
@@ -0,0 +1,5 @@
1
+ @if (loading()) {
2
+ <div class="cssload-container">
3
+ <div class="cssload-speeding-wheel"></div>
4
+ </div>
5
+ }
@@ -0,0 +1,27 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ effect,
5
+ inject,
6
+ } from '@angular/core';
7
+ import { GlobalService } from '../services/global.service';
8
+ import { toSignal } from '@angular/core/rxjs-interop';
9
+
10
+ @Component({
11
+ selector: 'loader',
12
+ templateUrl: 'loader.component.html',
13
+ changeDetection: ChangeDetectionStrategy.OnPush,
14
+ imports: [],
15
+ })
16
+ export class LoaderComponent {
17
+ private gsv = inject(GlobalService);
18
+
19
+ loading = toSignal(this.gsv.getLoaderState(), { initialValue: false });
20
+
21
+ /** Mirrors the loader signal into GlobalService so non-signal code can read loading state. */
22
+ constructor() {
23
+ effect(() => {
24
+ this.gsv.setLoading(this.loading());
25
+ });
26
+ }
27
+ }
@@ -0,0 +1,29 @@
1
+ <div class="modal-glass-overlay"></div>
2
+ <div
3
+ ngxModalDraggable
4
+ class="modal fade"
5
+ bsModal
6
+ #modal="bs-modal"
7
+ [config]="{ backdrop: false, keyboard: false }"
8
+ [ngStyle]="contextStyle()">
9
+ <div class="lk-shell">
10
+ <div class="lk-header">
11
+ <span class="lk-grip"><i class="bi bi-grip-horizontal"></i></span>
12
+ <span class="lk-icon"><i class="bi bi-search"></i></span>
13
+ <h6 class="lk-title">{{ title() }}</h6>
14
+ <button
15
+ type="button"
16
+ class="lk-close"
17
+ aria-label="Close"
18
+ (click)="closeDetail(null)">
19
+ <i class="bi bi-x-lg"></i>
20
+ </button>
21
+ </div>
22
+
23
+ <div class="lk-body">
24
+ <lookupselector
25
+ [lookupData]="lookupData()"
26
+ (lookupChanged)="lookupChanged($event)"></lookupselector>
27
+ </div>
28
+ </div>
29
+ </div>
@@ -0,0 +1,115 @@
1
+ import {
2
+ Component,
3
+ HostListener,
4
+ AfterViewInit,
5
+ inject,
6
+ input,
7
+ output,
8
+ viewChild,
9
+ computed,
10
+ ChangeDetectionStrategy,
11
+ } from '@angular/core';
12
+
13
+ import { AppMessageService } from '../services/message.service';
14
+
15
+ import { ModalDirective } from 'ngx-bootstrap/modal';
16
+ import { LookupInterface, ViewListInterface } from '../interfaces/index';
17
+ import { NgxModalDraggableDirective } from '../directives/component.draggable';
18
+ import { NgStyle } from '@angular/common';
19
+ import { LookupSelectorComponent } from '../players/lookup/lookup.selector.component';
20
+
21
+ @Component({
22
+ selector: 'lookup',
23
+ templateUrl: 'lookup.component.html',
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ imports: [
26
+ NgxModalDraggableDirective,
27
+ ModalDirective,
28
+ NgStyle,
29
+ LookupSelectorComponent,
30
+ ],
31
+ styles: [
32
+ `
33
+ :host ::ng-deep .lk-body {
34
+ display: flex;
35
+ flex-direction: column;
36
+ overflow: hidden;
37
+ }
38
+ :host ::ng-deep .lk-body lookupselector,
39
+ :host ::ng-deep .lk-body lookupplayer,
40
+ :host ::ng-deep .lk-body lookupplayer > *,
41
+ :host ::ng-deep .lk-body grid {
42
+ flex: 1;
43
+ display: flex;
44
+ flex-direction: column;
45
+ min-height: 0;
46
+ }
47
+ :host ::ng-deep .grid-wrapper {
48
+ flex: 1;
49
+ min-height: 0;
50
+ height: 100% !important;
51
+ }
52
+ `,
53
+ ],
54
+ })
55
+ export class LookupComponent implements AfterViewInit {
56
+ msg = inject(AppMessageService);
57
+
58
+ readonly modal = viewChild.required<ModalDirective>('modal');
59
+
60
+ show = input<boolean>(false);
61
+ title = input<string>('');
62
+ text = input<string>('');
63
+ width = input<number>(0);
64
+ height = input<number>(0);
65
+ top = input<number>(0);
66
+ left = input<number>(0);
67
+ lookup = input<string>('');
68
+ filter = input<string>('');
69
+
70
+ lookupResult = output<any>();
71
+
72
+ readonly lookupData = computed<LookupInterface>(() => ({
73
+ lookup: this.lookup(),
74
+ filter: this.filter(),
75
+ }));
76
+
77
+ readonly contextStyle = computed(() => ({
78
+ position: 'fixed',
79
+ top: this.top() + 'px',
80
+ left: this.left() + 'px',
81
+ width: this.width() + 'px',
82
+ height: this.height() + 'px',
83
+ pointerEvents: 'auto',
84
+ zIndex: '2001',
85
+ }));
86
+
87
+ /** Lifecycle: shows the modal on first render. */
88
+ ngAfterViewInit() {
89
+ this.modal().show();
90
+ }
91
+
92
+ /** Forwards the lookup selection to closeDetail. */
93
+ public lookupChanged(changed: ViewListInterface) {
94
+ this.closeDetail(changed.rows);
95
+ }
96
+
97
+ @HostListener('document:keydown.escape', ['$event']) onKeydownHandler(
98
+ event: KeyboardEvent
99
+ ) {
100
+ if (this.show()) {
101
+ event.stopImmediatePropagation();
102
+ this.closeDetail(null);
103
+ }
104
+ }
105
+
106
+ /** Hides the modal and emits the lookup result (null when dismissed). */
107
+ public closeDetail(rsp: any) {
108
+ if (this.modal().isShown !== undefined) {
109
+ this.modal().hide();
110
+ this.lookupResult.emit({
111
+ value: rsp,
112
+ });
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,39 @@
1
+ <div class="modal-glass-overlay"></div>
2
+ <div
3
+ class="modal fade"
4
+ bsModal
5
+ #modal="bs-modal"
6
+ [config]="{ backdrop: false, keyboard: false }"
7
+ [ngStyle]="contextStyle()"
8
+ ngxModalDraggable>
9
+ <div class="mb-shell">
10
+ <div class="mb-header">
11
+ <span class="mb-grip"><i class="bi bi-grip-horizontal"></i></span>
12
+ <span class="mb-icon"><i class="bi bi-info-circle"></i></span>
13
+ <h6 class="mb-title">{{ title() }}</h6>
14
+ <button
15
+ type="button"
16
+ class="mb-close"
17
+ aria-label="Close"
18
+ (click)="closeDetail(false)">
19
+ <i class="bi bi-x-lg"></i>
20
+ </button>
21
+ </div>
22
+
23
+ <div class="mb-body">
24
+ <div class="mb-message">{{ text() }}</div>
25
+ </div>
26
+
27
+ <div class="mb-footer">
28
+ <button
29
+ class="btn btn-primary btn-sm"
30
+ (click)="closeDetail(true)"
31
+ [hidden]="!showconfirm()">
32
+ {{ msg?.get('app.confirm') }}
33
+ </button>
34
+ <button class="btn btn-sm" (click)="closeDetail(false)">
35
+ {{ msg?.get('app.close') }}
36
+ </button>
37
+ </div>
38
+ </div>
39
+ </div>
@@ -0,0 +1,74 @@
1
+ import {
2
+ Component,
3
+ HostListener,
4
+ inject,
5
+ input,
6
+ output,
7
+ viewChild,
8
+ computed,
9
+ AfterViewInit,
10
+ ChangeDetectionStrategy,
11
+ } from '@angular/core';
12
+
13
+ import { AppMessageService } from '../services/message.service';
14
+
15
+ import { ModalDirective } from 'ngx-bootstrap/modal';
16
+ import { NgxModalDraggableDirective } from '../directives/component.draggable';
17
+ import { NgStyle } from '@angular/common';
18
+
19
+ @Component({
20
+ selector: 'messagebox',
21
+ templateUrl: 'messagebox.component.html',
22
+ changeDetection: ChangeDetectionStrategy.OnPush,
23
+ imports: [ModalDirective, NgxModalDraggableDirective, NgStyle],
24
+ })
25
+ export class MessageBoxComponent implements AfterViewInit {
26
+ msg = inject(AppMessageService);
27
+
28
+ readonly modal = viewChild.required<ModalDirective>('modal');
29
+
30
+ show = input<boolean>(false);
31
+ title = input<string>('');
32
+ text = input<string>('');
33
+ showconfirm = input<boolean>(false);
34
+ width = input<number>(0);
35
+ height = input<number>(0);
36
+ top = input<number>(0);
37
+ left = input<number>(0);
38
+
39
+ messageResult = output<any>();
40
+
41
+ /** Lifecycle: shows the modal on first render. */
42
+ ngAfterViewInit() {
43
+ this.modal().show();
44
+ }
45
+
46
+ readonly contextStyle = computed(() => ({
47
+ position: 'fixed',
48
+ top: this.top() + 'px',
49
+ left: this.left() + 'px',
50
+ width: this.width() + 'px',
51
+ height: this.height() + 'px',
52
+ pointerEvents: 'auto',
53
+ zIndex: '2001',
54
+ }));
55
+
56
+ @HostListener('document:keydown.escape', ['$event']) onKeydownHandler(
57
+ event: KeyboardEvent
58
+ ) {
59
+ if (this.show()) {
60
+ event.stopImmediatePropagation();
61
+ this.closeDetail(false);
62
+ }
63
+ }
64
+
65
+ /** Hides the modal and emits the confirmation result (true = confirmed). */
66
+ public closeDetail(status: boolean) {
67
+ if (this.modal().isShown !== undefined) {
68
+ this.modal().hide();
69
+ this.messageResult.emit({
70
+ value: status,
71
+ });
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,139 @@
1
+ import { Component, inject, ChangeDetectionStrategy } from '@angular/core';
2
+ import { NgClass } from '@angular/common';
3
+ import { ThemeService } from '../services/theme.service';
4
+
5
+ @Component({
6
+ selector: 'app-theme-toggle',
7
+ standalone: true,
8
+ imports: [NgClass],
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ template: `
11
+ <div class="theme-toggle-wrapper">
12
+ <button
13
+ class="theme-toggle-switch"
14
+ (click)="toggleTheme()"
15
+ [class.dark]="currentTheme() === 'dark'"
16
+ [attr.aria-label]="
17
+ 'Cambia tema a ' + (currentTheme() === 'light' ? 'scuro' : 'chiaro')
18
+ "
19
+ [title]="'Tema: ' + (currentTheme() === 'light' ? 'Chiaro' : 'Scuro')">
20
+ <span class="toggle-track">
21
+ <span class="toggle-switch-dot">
22
+ <i
23
+ [ngClass]="
24
+ currentTheme() === 'light'
25
+ ? 'bi bi-sun-fill'
26
+ : 'bi bi-moon-fill'
27
+ "></i>
28
+ </span>
29
+ </span>
30
+ </button>
31
+ </div>
32
+ `,
33
+ styles: [
34
+ `
35
+ .theme-toggle-wrapper {
36
+ display: inline-flex;
37
+ align-items: center;
38
+ margin-left: 8px;
39
+ }
40
+
41
+ .theme-toggle-switch {
42
+ position: relative;
43
+ width: 54px;
44
+ height: 28px;
45
+ background: transparent;
46
+ border: none;
47
+ cursor: pointer;
48
+ padding: 0;
49
+ border-radius: 20px;
50
+ outline: none;
51
+ transition: transform 0.2s ease;
52
+ }
53
+
54
+ .theme-toggle-switch:hover {
55
+ transform: scale(1.08);
56
+ }
57
+
58
+ .theme-toggle-switch:active {
59
+ transform: scale(0.92);
60
+ }
61
+
62
+ .toggle-track {
63
+ position: absolute;
64
+ width: 100%;
65
+ height: 100%;
66
+ left: 0;
67
+ top: 0;
68
+ background-color: #d0d0d0;
69
+ border-radius: 20px;
70
+ transition: background-color 0.35s cubic-bezier(0.4, 0, 0.2, 1);
71
+ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
72
+ }
73
+
74
+ .theme-toggle-switch:hover .toggle-track {
75
+ background-color: #b0b0b0;
76
+ }
77
+
78
+ .theme-toggle-switch.dark .toggle-track {
79
+ background-color: #0d6fa3;
80
+ }
81
+
82
+ .theme-toggle-switch.dark:hover .toggle-track {
83
+ background-color: #0d8ac8;
84
+ }
85
+
86
+ .toggle-switch-dot {
87
+ position: absolute;
88
+ left: 2px;
89
+ top: 50%;
90
+ transform: translateY(-50%);
91
+ width: 24px;
92
+ height: 24px;
93
+ background: white;
94
+ border-radius: 50%;
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ z-index: 2;
99
+ transition:
100
+ left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
101
+ box-shadow 0.3s ease;
102
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
103
+ }
104
+
105
+ .theme-toggle-switch:hover .toggle-switch-dot {
106
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
107
+ }
108
+
109
+ .theme-toggle-switch.dark .toggle-switch-dot {
110
+ left: 28px;
111
+ background: #ffd700;
112
+ }
113
+
114
+ .toggle-switch-dot i {
115
+ font-size: 13px;
116
+ color: #1a1a1a;
117
+ transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
118
+ }
119
+
120
+ .theme-toggle-switch:hover .toggle-switch-dot i {
121
+ transform: scale(1.15) rotate(10deg);
122
+ }
123
+
124
+ .theme-toggle-switch.dark .toggle-switch-dot i {
125
+ color: #003049;
126
+ }
127
+ `,
128
+ ],
129
+ })
130
+ export class ThemeToggleComponent {
131
+ private themeService = inject(ThemeService);
132
+
133
+ readonly currentTheme = this.themeService.currentTheme;
134
+
135
+ /** Toggles between light and dark theme. */
136
+ toggleTheme(): void {
137
+ this.themeService.toggleTheme();
138
+ }
139
+ }
@@ -0,0 +1,62 @@
1
+ import { InjectionToken, isDevMode, importProvidersFrom, LOCALE_ID } from '@angular/core';
2
+ import { LocationStrategy, PathLocationStrategy } from '@angular/common';
3
+ import { provideRouter, withRouterConfig } from '@angular/router';
4
+ import { provideHttpClient, withInterceptors } from '@angular/common/http';
5
+ import { provideAnimations } from '@angular/platform-browser/animations';
6
+ import { ErrorHandler } from '@angular/core';
7
+ import { ModalModule } from 'ngx-bootstrap/modal';
8
+ import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
9
+ import { TooltipModule } from 'ngx-bootstrap/tooltip';
10
+ import { ButtonsModule } from 'ngx-bootstrap/buttons';
11
+ import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
12
+ import { provideZoneChangeDetection } from '@angular/core';
13
+ import { APP_ROUTES } from './app.routing';
14
+ import { authInterceptor } from './services/auth.interceptor';
15
+ import { GlobalErrorHandler } from './services/global-error-handler';
16
+ import { ManagmentService } from './home/model/services';
17
+ import { SchedulerService } from './scheduler/services/scheduler.service';
18
+ import { AppMessageService } from './services/message.service';
19
+ import { EntitiesData, Entities } from './interfaces';
20
+
21
+ /** Contract returned by projectsInfoLoader — provides runtime data and schema for a project. */
22
+ export interface ProjectInfo {
23
+ getData(): EntitiesData;
24
+ getSchema(): Entities;
25
+ }
26
+
27
+ export interface NewportConfig {
28
+ /** Base URL of the backend REST API */
29
+ apiUrl: string;
30
+ /** Factory for the project-specific logic layer. May return a Promise (for lazy loading). */
31
+ logicFactory: (...args: any[]) => any | Promise<any>;
32
+ /** Loader for project_info schema/data modules */
33
+ projectsInfoLoader: (year: number, appId: string) => Promise<ProjectInfo>;
34
+ /** Loader for static lookup tables used in login (optional). May return a Promise. */
35
+ staticTableLoader?: (id: string) => string | Promise<string>;
36
+ }
37
+
38
+ export const NEWPORT_CONFIG = new InjectionToken<NewportConfig>('NEWPORT_CONFIG');
39
+
40
+ /** Register all library providers. Call this inside bootstrapApplication providers. */
41
+ export function provideNewport(config: NewportConfig) {
42
+ return [
43
+ provideZoneChangeDetection(),
44
+ provideRouter(APP_ROUTES, withRouterConfig({ onSameUrlNavigation: 'reload' })),
45
+ importProvidersFrom(
46
+ ModalModule,
47
+ BsDropdownModule,
48
+ TooltipModule,
49
+ ButtonsModule,
50
+ BsDatepickerModule,
51
+ ),
52
+ ManagmentService,
53
+ SchedulerService,
54
+ AppMessageService,
55
+ { provide: ErrorHandler, useExisting: GlobalErrorHandler },
56
+ { provide: LocationStrategy, useClass: PathLocationStrategy },
57
+ { provide: LOCALE_ID, useValue: 'en-US' },
58
+ { provide: NEWPORT_CONFIG, useValue: config },
59
+ provideAnimations(),
60
+ provideHttpClient(withInterceptors([authInterceptor])),
61
+ ];
62
+ }