@rxap/services 16.0.0-dev.2 → 16.0.0-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +327 -0
- package/LICENSE +621 -21
- package/LICENSE.md +621 -0
- package/README.md +8 -22
- package/esm2022/index.mjs +7 -7
- package/esm2022/lib/avatar-image.service.mjs +7 -8
- package/esm2022/lib/footer.service.mjs +14 -158
- package/esm2022/lib/header.service.mjs +18 -36
- package/esm2022/lib/image-loader.service.mjs +5 -6
- package/esm2022/lib/loading-indicator.service.mjs +9 -10
- package/esm2022/lib/reset.service.mjs +5 -6
- package/esm2022/lib/version.service.mjs +10 -7
- package/esm2022/lib/window-container-sidenav.service.mjs +7 -8
- package/esm2022/rxap-services.mjs +1 -1
- package/fesm2022/rxap-services.mjs +126 -372
- package/fesm2022/rxap-services.mjs.map +1 -1
- package/index.d.ts +4 -6
- package/lib/footer.service.d.ts +5 -89
- package/lib/header.service.d.ts +3 -12
- package/lib/loading-indicator.service.d.ts +1 -1
- package/lib/window-container-sidenav.service.d.ts +2 -2
- package/package.json +51 -45
- package/theme.css +1 -0
- package/collection.json +0 -10
- package/esm2022/lib/local-storage.service.mjs +0 -29
- package/esm2022/lib/theme.service.mjs +0 -75
- package/esm2022/testing/lib/local-storage.service.helper.spec.mjs +0 -39
- package/esm2022/testing/public_api.mjs +0 -2
- package/esm2022/testing/rxap-services-testing.mjs +0 -5
- package/fesm2022/rxap-services-testing.mjs +0 -45
- package/fesm2022/rxap-services-testing.mjs.map +0 -1
- package/lib/local-storage.service.d.ts +0 -9
- package/lib/theme.service.d.ts +0 -12
- package/migration.json +0 -4
- package/src/schematics/ng-add/index.d.ts +0 -2
- package/src/schematics/ng-add/index.js +0 -8
- package/src/schematics/ng-add/index.js.map +0 -1
- package/src/schematics/ng-add/schema.json +0 -7
- package/testing/index.d.ts +0 -5
- package/testing/lib/local-storage.service.helper.spec.d.ts +0 -13
- package/testing/public_api.d.ts +0 -1
|
@@ -1,83 +1,32 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { Subject, BehaviorSubject, Subscription } from 'rxjs';
|
|
4
|
-
import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
5
|
-
import { map, filter, delay } from 'rxjs/operators';
|
|
6
|
-
import * as i1 from '@angular/router';
|
|
7
|
-
import { NavigationStart, NavigationEnd, NavigationCancel, Router } from '@angular/router';
|
|
2
|
+
import { Injectable, signal, computed, isDevMode } from '@angular/core';
|
|
8
3
|
import { HttpRequest, HttpParams } from '@angular/common/http';
|
|
9
|
-
import {
|
|
4
|
+
import { Subscription, Subject } from 'rxjs';
|
|
5
|
+
import { map, delay } from 'rxjs/operators';
|
|
6
|
+
import { ToggleSubject } from '@rxap/rxjs';
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
class AvatarImageService {
|
|
9
|
+
get({ name }) {
|
|
10
|
+
return new HttpRequest('GET', 'https://eu.ui-avatars.com/api', {
|
|
11
|
+
params: new HttpParams({ fromObject: { name } }),
|
|
12
|
+
}).urlWithParams;
|
|
13
|
+
}
|
|
14
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
15
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, providedIn: 'root' }); }
|
|
17
16
|
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, decorators: [{
|
|
18
|
+
type: Injectable,
|
|
19
|
+
args: [{ providedIn: 'root' }]
|
|
20
|
+
}] });
|
|
21
|
+
|
|
18
22
|
class FooterService {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
get countComponent() {
|
|
23
|
-
return this.components.length;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated removed
|
|
27
|
-
*/
|
|
28
|
-
get countComponents() {
|
|
29
|
-
return this.components.length;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated removed
|
|
33
|
-
*/
|
|
34
|
-
get hasComponents() {
|
|
35
|
-
return this.countComponents !== 0;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated removed
|
|
39
|
-
*/
|
|
40
|
-
get hasComponentsOrTemplates() {
|
|
41
|
-
return this.hasComponents || this.hasTemplates;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated removed
|
|
45
|
-
*/
|
|
46
|
-
get countTemplates() {
|
|
47
|
-
return this.templates.length;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated removed
|
|
51
|
-
*/
|
|
52
|
-
get hasTemplates() {
|
|
53
|
-
return this.countTemplates !== 0;
|
|
54
|
-
}
|
|
55
|
-
constructor(footerComponents = null) {
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated removed
|
|
58
|
-
*/
|
|
59
|
-
this.update$ = new Subject();
|
|
60
|
-
this.components = [];
|
|
61
|
-
this.templates = [];
|
|
62
|
-
this.componentPortalMap = new WeakMap();
|
|
63
|
-
this.templatePortalMap = new WeakMap();
|
|
64
|
-
this.portals$ = new BehaviorSubject([]);
|
|
65
|
-
this.portalCount$ = this.portals$.pipe(map(portals => portals.length));
|
|
66
|
-
if (footerComponents) {
|
|
67
|
-
if (isDevMode()) {
|
|
68
|
-
console.warn('The RXAP_FOOTER_COMPONENT InjectionToken is deprecated and will be removed in the feature!');
|
|
69
|
-
}
|
|
70
|
-
if (Array.isArray(footerComponents)) {
|
|
71
|
-
footerComponents.forEach((comp, index) => this.addComponent(comp, { order: index }, true));
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this.addComponent(footerComponents, { order: 0 }, true);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
23
|
+
constructor() {
|
|
24
|
+
this.portals = signal([]);
|
|
25
|
+
this.portalCount = computed(() => this.portals().length);
|
|
77
26
|
}
|
|
78
27
|
pushPortal(portal) {
|
|
79
|
-
if (!this.portals
|
|
80
|
-
this.portals
|
|
28
|
+
if (!this.portals().includes(portal)) {
|
|
29
|
+
this.portals.update(portals => [...portals, portal]);
|
|
81
30
|
}
|
|
82
31
|
else {
|
|
83
32
|
if (isDevMode()) {
|
|
@@ -86,96 +35,103 @@ class FooterService {
|
|
|
86
35
|
}
|
|
87
36
|
}
|
|
88
37
|
removePortal(portal) {
|
|
89
|
-
const index = this.portals
|
|
38
|
+
const index = this.portals().indexOf(portal);
|
|
90
39
|
if (index !== -1) {
|
|
91
|
-
|
|
92
|
-
portals.splice(index, 1);
|
|
93
|
-
this.portals$.next(portals);
|
|
40
|
+
this.portals.mutate(portals => portals.splice(index, 1));
|
|
94
41
|
}
|
|
95
42
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FooterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
44
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FooterService, providedIn: 'root' }); }
|
|
45
|
+
}
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FooterService, decorators: [{
|
|
47
|
+
type: Injectable,
|
|
48
|
+
args: [{ providedIn: 'root' }]
|
|
49
|
+
}] });
|
|
50
|
+
|
|
51
|
+
class HeaderService {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.componentsWithMetadata = signal([]);
|
|
54
|
+
this.componentCount = computed(() => this.componentsWithMetadata().length + 1);
|
|
55
|
+
this.components = computed(() => this.componentsWithMetadata().map(item => item.component));
|
|
107
56
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.componentPortalMap.delete(component);
|
|
117
|
-
this.removePortal(portal);
|
|
118
|
-
}
|
|
57
|
+
addComponent(component, order = 0) {
|
|
58
|
+
this.componentsWithMetadata.mutate(components => {
|
|
59
|
+
components.push({
|
|
60
|
+
component,
|
|
61
|
+
order,
|
|
62
|
+
});
|
|
63
|
+
components.sort((a, b) => a.order - b.order);
|
|
64
|
+
});
|
|
119
65
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.
|
|
66
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
67
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, providedIn: 'root' }); }
|
|
68
|
+
}
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, decorators: [{
|
|
70
|
+
type: Injectable,
|
|
71
|
+
args: [{ providedIn: 'root' }]
|
|
72
|
+
}] });
|
|
73
|
+
|
|
74
|
+
class ImageLoaderService {
|
|
75
|
+
constructor() {
|
|
76
|
+
this.loading = new Map();
|
|
77
|
+
this.loaded = new Map();
|
|
131
78
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const portal = this.templatePortalMap.get(template);
|
|
139
|
-
if (portal) {
|
|
140
|
-
this.removePortal(portal);
|
|
141
|
-
this.templatePortalMap.delete(template);
|
|
79
|
+
load(imageSrc) {
|
|
80
|
+
if (this.loaded.has(imageSrc)) {
|
|
81
|
+
return Promise.resolve();
|
|
82
|
+
}
|
|
83
|
+
if (this.loading.has(imageSrc)) {
|
|
84
|
+
return this.loading.get(imageSrc);
|
|
142
85
|
}
|
|
86
|
+
const loading = new Promise((resolve, reject) => {
|
|
87
|
+
const image = new Image();
|
|
88
|
+
image.src = imageSrc;
|
|
89
|
+
image.onerror = reject;
|
|
90
|
+
image.onload = () => resolve();
|
|
91
|
+
}).then(() => {
|
|
92
|
+
this.loaded.set(imageSrc, true);
|
|
93
|
+
}).finally(() => {
|
|
94
|
+
this.loading.delete(imageSrc);
|
|
95
|
+
});
|
|
96
|
+
this.loading.set(imageSrc, loading);
|
|
97
|
+
return loading;
|
|
98
|
+
}
|
|
99
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
100
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, providedIn: 'root' }); }
|
|
101
|
+
}
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, decorators: [{
|
|
103
|
+
type: Injectable,
|
|
104
|
+
args: [{ providedIn: 'root' }]
|
|
105
|
+
}] });
|
|
106
|
+
|
|
107
|
+
class LoadingIndicatorService {
|
|
108
|
+
constructor() {
|
|
109
|
+
this.loading$ = new ToggleSubject(true);
|
|
110
|
+
this._attachedLoadingSubscription = new Subscription();
|
|
111
|
+
this.isLoading$ = this.loading$.asObservable();
|
|
143
112
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*/
|
|
147
|
-
getComponents() {
|
|
148
|
-
return this
|
|
149
|
-
.components
|
|
150
|
-
.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
113
|
+
attachLoading(loading$) {
|
|
114
|
+
this._attachedLoadingSubscription.add(loading$.pipe(map(Boolean), delay(0)).subscribe(this.loading$.next));
|
|
151
115
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
*/
|
|
155
|
-
getTemplates() {
|
|
156
|
-
return this
|
|
157
|
-
.templates
|
|
158
|
-
.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
116
|
+
ngOnDestroy() {
|
|
117
|
+
this._attachedLoadingSubscription.unsubscribe();
|
|
159
118
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
119
|
+
disable() {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
this.loading$.disable();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
enable() {
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
this.loading$.enable();
|
|
127
|
+
});
|
|
166
128
|
}
|
|
167
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
168
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
129
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
130
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService }); }
|
|
169
131
|
}
|
|
170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
171
|
-
type: Injectable
|
|
172
|
-
|
|
173
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
174
|
-
type: Optional
|
|
175
|
-
}, {
|
|
176
|
-
type: Inject,
|
|
177
|
-
args: [RXAP_FOOTER_COMPONENT]
|
|
178
|
-
}] }]; } });
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService, decorators: [{
|
|
133
|
+
type: Injectable
|
|
134
|
+
}], ctorParameters: function () { return []; } });
|
|
179
135
|
|
|
180
136
|
class ResetService {
|
|
181
137
|
constructor() {
|
|
@@ -193,121 +149,14 @@ class ResetService {
|
|
|
193
149
|
this.resetDataSource();
|
|
194
150
|
this.resetView();
|
|
195
151
|
}
|
|
196
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
197
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
152
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
153
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetService, providedIn: 'root' }); }
|
|
198
154
|
}
|
|
199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetService, decorators: [{
|
|
200
156
|
type: Injectable,
|
|
201
157
|
args: [{ providedIn: 'root' }]
|
|
202
158
|
}] });
|
|
203
159
|
|
|
204
|
-
class ThemeService {
|
|
205
|
-
get darkMode() {
|
|
206
|
-
return this.darkMode$.value;
|
|
207
|
-
}
|
|
208
|
-
constructor() {
|
|
209
|
-
this.baseFontSize = Number(localStorage.getItem('rxap-base-font-size') || 62.5);
|
|
210
|
-
// this.darkMode$ must be first bc the this.darkMode getter is used in this.toggleDarkTheme method
|
|
211
|
-
this.darkMode$ = new BehaviorSubject(localStorage.getItem('rxap-light-theme') === null);
|
|
212
|
-
this.setBaseFontSize(this.baseFontSize);
|
|
213
|
-
this.toggleDarkTheme(this.darkMode);
|
|
214
|
-
}
|
|
215
|
-
toggleDarkTheme(checked = !this.darkMode) {
|
|
216
|
-
if (checked) {
|
|
217
|
-
document.body.classList.add('dark-theme');
|
|
218
|
-
localStorage.removeItem('rxap-light-theme');
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
document.body.classList.remove('dark-theme');
|
|
222
|
-
localStorage.setItem('rxap-light-theme', 'true');
|
|
223
|
-
}
|
|
224
|
-
if (checked !== this.darkMode$.value) {
|
|
225
|
-
this.darkMode$.next(checked);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
setBaseFontSize(value) {
|
|
229
|
-
localStorage.setItem('rxap-base-font-size', value.toFixed(3));
|
|
230
|
-
document.documentElement.style.fontSize = `${value}%`;
|
|
231
|
-
this.baseFontSize = value;
|
|
232
|
-
switch (value) {
|
|
233
|
-
case 40:
|
|
234
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
235
|
-
document.body.classList.add('size-xxs');
|
|
236
|
-
break;
|
|
237
|
-
case 45:
|
|
238
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
239
|
-
document.body.classList.add('size-xs');
|
|
240
|
-
break;
|
|
241
|
-
case 55:
|
|
242
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
243
|
-
document.body.classList.add('size-s');
|
|
244
|
-
break;
|
|
245
|
-
case 62.5:
|
|
246
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
247
|
-
document.body.classList.add('size-m');
|
|
248
|
-
break;
|
|
249
|
-
case 70:
|
|
250
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
251
|
-
document.body.classList.add('size-l');
|
|
252
|
-
break;
|
|
253
|
-
case 80:
|
|
254
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
255
|
-
document.body.classList.add('size-xl');
|
|
256
|
-
break;
|
|
257
|
-
case 90:
|
|
258
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
259
|
-
document.body.classList.add('size-xxl');
|
|
260
|
-
break;
|
|
261
|
-
case 100:
|
|
262
|
-
document.body.classList.remove('size-xxs', 'size-xs', 'size-s', 'size-m', 'size-l', 'size-xl', 'size-xxl', 'size-xxxl');
|
|
263
|
-
document.body.classList.add('size-xxxl');
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
268
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
|
|
269
|
-
}
|
|
270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ThemeService, decorators: [{
|
|
271
|
-
type: Injectable,
|
|
272
|
-
args: [{ providedIn: 'root' }]
|
|
273
|
-
}], ctorParameters: function () { return []; } });
|
|
274
|
-
|
|
275
|
-
class HeaderService {
|
|
276
|
-
get countComponent() {
|
|
277
|
-
return this.components.length + 1;
|
|
278
|
-
}
|
|
279
|
-
constructor(router) {
|
|
280
|
-
this.router = router;
|
|
281
|
-
this.update$ = new Subject();
|
|
282
|
-
this.components = [];
|
|
283
|
-
this.navigating$ = this.router.events.pipe(filter(event => event instanceof NavigationStart ||
|
|
284
|
-
event instanceof NavigationEnd ||
|
|
285
|
-
event instanceof NavigationCancel), map(event => event instanceof NavigationStart));
|
|
286
|
-
}
|
|
287
|
-
addComponent(component, order = 0) {
|
|
288
|
-
this.components.push({ component, order });
|
|
289
|
-
this.update$.next();
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Returns all added components ordered based on the order property
|
|
293
|
-
*/
|
|
294
|
-
getComponents() {
|
|
295
|
-
return this
|
|
296
|
-
.components
|
|
297
|
-
.sort((a, b) => a.order - b.order)
|
|
298
|
-
.map(item => item.component);
|
|
299
|
-
}
|
|
300
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: HeaderService, deps: [{ token: Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
301
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: HeaderService, providedIn: 'root' }); }
|
|
302
|
-
}
|
|
303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: HeaderService, decorators: [{
|
|
304
|
-
type: Injectable,
|
|
305
|
-
args: [{ providedIn: 'root' }]
|
|
306
|
-
}], ctorParameters: function () { return [{ type: i1.Router, decorators: [{
|
|
307
|
-
type: Inject,
|
|
308
|
-
args: [Router]
|
|
309
|
-
}] }]; } });
|
|
310
|
-
|
|
311
160
|
class VersionService {
|
|
312
161
|
constructor() {
|
|
313
162
|
this.update$ = new Subject();
|
|
@@ -318,47 +167,25 @@ class VersionService {
|
|
|
318
167
|
this.update$.next();
|
|
319
168
|
}
|
|
320
169
|
get() {
|
|
321
|
-
return Array.from(this.modules.entries())
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}] });
|
|
330
|
-
|
|
331
|
-
class LocalStorageService {
|
|
332
|
-
has(key) {
|
|
333
|
-
return localStorage.getItem(key) !== null;
|
|
334
|
-
}
|
|
335
|
-
set(key, value) {
|
|
336
|
-
if (typeof value !== 'string') {
|
|
337
|
-
localStorage.setItem(key, JSON.stringify(value));
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
localStorage.setItem(key, value);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
get(key) {
|
|
344
|
-
return localStorage.getItem(key);
|
|
345
|
-
}
|
|
346
|
-
remove(key) {
|
|
347
|
-
localStorage.removeItem(key);
|
|
348
|
-
}
|
|
349
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
350
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LocalStorageService, providedIn: 'root' }); }
|
|
170
|
+
return Array.from(this.modules.entries())
|
|
171
|
+
.reduce((map, [moduleId, version]) => ({
|
|
172
|
+
...map,
|
|
173
|
+
[moduleId]: version,
|
|
174
|
+
}), {});
|
|
175
|
+
}
|
|
176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: VersionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
177
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: VersionService, providedIn: 'root' }); }
|
|
351
178
|
}
|
|
352
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: VersionService, decorators: [{
|
|
353
180
|
type: Injectable,
|
|
354
181
|
args: [{ providedIn: 'root' }]
|
|
355
182
|
}] });
|
|
356
183
|
|
|
357
184
|
class WindowContainerSidenavService {
|
|
358
185
|
constructor() {
|
|
359
|
-
this.components = new Map();
|
|
360
186
|
this.add$ = new Subject();
|
|
361
187
|
this.remove$ = new Subject();
|
|
188
|
+
this.components = new Map();
|
|
362
189
|
}
|
|
363
190
|
add(component) {
|
|
364
191
|
if (this.components.has(component.id)) {
|
|
@@ -377,93 +204,20 @@ class WindowContainerSidenavService {
|
|
|
377
204
|
getAll() {
|
|
378
205
|
return Array.from(this.components.values());
|
|
379
206
|
}
|
|
380
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
381
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
207
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: WindowContainerSidenavService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
208
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: WindowContainerSidenavService, providedIn: 'root' }); }
|
|
382
209
|
}
|
|
383
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: WindowContainerSidenavService, decorators: [{
|
|
384
211
|
type: Injectable,
|
|
385
212
|
args: [{ providedIn: 'root' }]
|
|
386
213
|
}] });
|
|
387
214
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
this.loading = new Map();
|
|
391
|
-
this.loaded = new Map();
|
|
392
|
-
}
|
|
393
|
-
load(imageSrc) {
|
|
394
|
-
if (this.loaded.has(imageSrc)) {
|
|
395
|
-
return Promise.resolve();
|
|
396
|
-
}
|
|
397
|
-
if (this.loading.has(imageSrc)) {
|
|
398
|
-
return this.loading.get(imageSrc);
|
|
399
|
-
}
|
|
400
|
-
const loading = new Promise((resolve, reject) => {
|
|
401
|
-
const image = new Image();
|
|
402
|
-
image.src = imageSrc;
|
|
403
|
-
image.onerror = reject;
|
|
404
|
-
image.onload = () => resolve();
|
|
405
|
-
}).then(() => {
|
|
406
|
-
this.loaded.set(imageSrc, true);
|
|
407
|
-
}).finally(() => {
|
|
408
|
-
this.loading.delete(imageSrc);
|
|
409
|
-
});
|
|
410
|
-
this.loading.set(imageSrc, loading);
|
|
411
|
-
return loading;
|
|
412
|
-
}
|
|
413
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ImageLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
414
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ImageLoaderService, providedIn: 'root' }); }
|
|
415
|
-
}
|
|
416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ImageLoaderService, decorators: [{
|
|
417
|
-
type: Injectable,
|
|
418
|
-
args: [{ providedIn: 'root' }]
|
|
419
|
-
}] });
|
|
420
|
-
|
|
421
|
-
class AvatarImageService {
|
|
422
|
-
get({ name }) {
|
|
423
|
-
return new HttpRequest('GET', 'https://eu.ui-avatars.com/api', {
|
|
424
|
-
params: new HttpParams({ fromObject: { name } })
|
|
425
|
-
}).urlWithParams;
|
|
426
|
-
}
|
|
427
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: AvatarImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
428
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: AvatarImageService, providedIn: 'root' }); }
|
|
429
|
-
}
|
|
430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: AvatarImageService, decorators: [{
|
|
431
|
-
type: Injectable,
|
|
432
|
-
args: [{ providedIn: 'root' }]
|
|
433
|
-
}] });
|
|
434
|
-
|
|
435
|
-
class LoadingIndicatorService {
|
|
436
|
-
constructor() {
|
|
437
|
-
this.loading$ = new ToggleSubject(true);
|
|
438
|
-
this._attachedLoadingSubscription = new Subscription();
|
|
439
|
-
this.isLoading$ = this.loading$.asObservable();
|
|
440
|
-
}
|
|
441
|
-
attachLoading(loading$) {
|
|
442
|
-
this._attachedLoadingSubscription.add(loading$.pipe(map(Boolean), delay(0)).subscribe(this.loading$.next));
|
|
443
|
-
}
|
|
444
|
-
ngOnDestroy() {
|
|
445
|
-
this._attachedLoadingSubscription.unsubscribe();
|
|
446
|
-
}
|
|
447
|
-
disable() {
|
|
448
|
-
setTimeout(() => {
|
|
449
|
-
this.loading$.disable();
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
enable() {
|
|
453
|
-
setTimeout(() => {
|
|
454
|
-
this.loading$.enable();
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LoadingIndicatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
458
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LoadingIndicatorService }); }
|
|
459
|
-
}
|
|
460
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LoadingIndicatorService, decorators: [{
|
|
461
|
-
type: Injectable
|
|
462
|
-
}], ctorParameters: function () { return []; } });
|
|
215
|
+
// region
|
|
216
|
+
// endregion
|
|
463
217
|
|
|
464
218
|
/**
|
|
465
219
|
* Generated bundle index. Do not edit.
|
|
466
220
|
*/
|
|
467
221
|
|
|
468
|
-
export { AvatarImageService, FooterService, HeaderService, ImageLoaderService,
|
|
222
|
+
export { AvatarImageService, FooterService, HeaderService, ImageLoaderService, LoadingIndicatorService, ResetService, VersionService, WindowContainerSidenavService };
|
|
469
223
|
//# sourceMappingURL=rxap-services.mjs.map
|