@mosa-ng/core 19.0.1 → 20.1.0
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/fesm2022/mosa-ng-core.mjs +170 -311
- package/fesm2022/mosa-ng-core.mjs.map +1 -1
- package/index.d.ts +803 -3
- package/package.json +3 -3
- package/lib/constants/local-storage.constant.d.ts +0 -2
- package/lib/enums/browser.enum.d.ts +0 -9
- package/lib/enums/content-position.enum.d.ts +0 -11
- package/lib/enums/i18n-supported.enum.d.ts +0 -10
- package/lib/enums/theme.enum.d.ts +0 -4
- package/lib/models/api-options.model.d.ts +0 -17
- package/lib/models/dictionary-item.model.d.ts +0 -7
- package/lib/models/key-map.model.d.ts +0 -3
- package/lib/models/logger/log-event.model.d.ts +0 -7
- package/lib/models/logger/log-message-data.model.d.ts +0 -4
- package/lib/models/logger/log-type.model.d.ts +0 -1
- package/lib/models/logger/log.model.d.ts +0 -9
- package/lib/models/logger/logger-base-config.model.d.ts +0 -8
- package/lib/models/logger/logger-config.model.d.ts +0 -8
- package/lib/models/logger/logger-default-config.model.d.ts +0 -4
- package/lib/models/mosa-duration.model.d.ts +0 -1
- package/lib/models/sieve/sieve-filter.model.d.ts +0 -9
- package/lib/models/sieve/sieve-operator.model.d.ts +0 -69
- package/lib/models/sieve/sieve-options.model.d.ts +0 -12
- package/lib/models/sieve/sieve-response.model.d.ts +0 -4
- package/lib/models/sieve/sieve-sort.model.d.ts +0 -7
- package/lib/models/token-settings.model.d.ts +0 -5
- package/lib/models/transform-matrix.model.d.ts +0 -5
- package/lib/mosa-core.module.d.ts +0 -80
- package/lib/pipes/dictionary-item-pipe/dictionary-item-pipe.module.d.ts +0 -8
- package/lib/pipes/dictionary-item-pipe/dictionary-item.pipe.d.ts +0 -8
- package/lib/pipes/find-in-array/find-in-array-pipe.module.d.ts +0 -8
- package/lib/pipes/find-in-array/find-in-array.pipe.d.ts +0 -7
- package/lib/pipes/join/join-pipe.module.d.ts +0 -8
- package/lib/pipes/join/join.pipe.d.ts +0 -13
- package/lib/pipes/mosa-date-pipe/mosa-date-pipe.module.d.ts +0 -8
- package/lib/pipes/mosa-date-pipe/mosa-date.pipe.d.ts +0 -18
- package/lib/pipes/mosa-duration-pipe/mosa-duration-pipe.module.d.ts +0 -8
- package/lib/pipes/mosa-duration-pipe/mosa-duration.pipe.d.ts +0 -27
- package/lib/services/api.service.d.ts +0 -110
- package/lib/services/core-logger.service.d.ts +0 -80
- package/lib/services/guards/can-deactivate.guard.d.ts +0 -11
- package/lib/services/mosa-socket.service.d.ts +0 -11
- package/lib/services/translation/assets-i18n-loader.service.d.ts +0 -16
- package/lib/services/translation/custom-translate-loader.service.d.ts +0 -9
- package/lib/services/translation/translate-collector.service.d.ts +0 -15
- package/lib/utils/commons.util.d.ts +0 -47
- package/lib/utils/dictionary.util.d.ts +0 -70
- package/lib/utils/item.util.d.ts +0 -4
- package/lib/utils/promise.util.d.ts +0 -2
- package/lib/utils/prototypes.util.d.ts +0 -80
- package/lib/utils/sieve.util.d.ts +0 -71
- package/lib/utils/size.util.d.ts +0 -4
- package/public-api.d.ts +0 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as i2 from '@angular/common';
|
|
2
|
-
import { CommonModule, DatePipe } from '@angular/common';
|
|
3
1
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, Pipe,
|
|
2
|
+
import { Injectable, Pipe, makeEnvironmentProviders, provideAppInitializer, inject } from '@angular/core';
|
|
5
3
|
import { firstValueFrom, of, BehaviorSubject, throwError, Observable, Subject } from 'rxjs';
|
|
6
4
|
import { share, tap, catchError, map } from 'rxjs/operators';
|
|
7
5
|
import * as i1$1 from '@angular/common/http';
|
|
8
6
|
import { HttpErrorResponse, HttpResponse, HttpHeaders } from '@angular/common/http';
|
|
9
7
|
import * as i1 from '@ngx-translate/core';
|
|
8
|
+
import * as i2 from '@angular/common';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Checks if an object is null or undefined. Does not check for
|
|
@@ -67,6 +66,13 @@ function getTransformMatrix(element) {
|
|
|
67
66
|
z: transform[2],
|
|
68
67
|
};
|
|
69
68
|
}
|
|
69
|
+
function some(item, searchValue, searchKey) {
|
|
70
|
+
let searchValues = searchValue;
|
|
71
|
+
if (!Array.isArray(searchValue)) {
|
|
72
|
+
searchValues = [searchValue];
|
|
73
|
+
}
|
|
74
|
+
return searchValues.includes(searchKey ? item[searchKey] : item);
|
|
75
|
+
}
|
|
70
76
|
/**
|
|
71
77
|
* Generates a random string with numbers and letters
|
|
72
78
|
* @param length
|
|
@@ -88,7 +94,7 @@ function tryJsonParse(data, fallback) {
|
|
|
88
94
|
return JSON.parse(data);
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
|
-
catch
|
|
97
|
+
catch {
|
|
92
98
|
// Ignore - go on with fallback check
|
|
93
99
|
}
|
|
94
100
|
if (fallback) {
|
|
@@ -123,7 +129,7 @@ class TranslateCollectorService {
|
|
|
123
129
|
}
|
|
124
130
|
this.translationMap[lang].push({ priority, translation });
|
|
125
131
|
this.translationMap[lang].sort((a, b) => a.priority - b.priority);
|
|
126
|
-
const merged = JSON.parse(localStorage.getItem(MOSA_MERGED_TRANSLATION(lang))
|
|
132
|
+
const merged = JSON.parse(localStorage.getItem(MOSA_MERGED_TRANSLATION(lang)) || '{}');
|
|
127
133
|
for (const translationsData of this.translationMap[lang]) {
|
|
128
134
|
const translations = translationsData.translation;
|
|
129
135
|
if (translations != null) {
|
|
@@ -151,10 +157,10 @@ class TranslateCollectorService {
|
|
|
151
157
|
localStorage.setItem(MOSA_MERGED_TRANSLATION(lang), JSON.stringify(merged));
|
|
152
158
|
this.myTranslateService.reloadLang(lang);
|
|
153
159
|
}
|
|
154
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
155
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
160
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TranslateCollectorService, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
161
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TranslateCollectorService, providedIn: 'root' }); }
|
|
156
162
|
}
|
|
157
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TranslateCollectorService, decorators: [{
|
|
158
164
|
type: Injectable,
|
|
159
165
|
args: [{
|
|
160
166
|
providedIn: 'root',
|
|
@@ -166,6 +172,7 @@ class AssetsI18nLoaderService {
|
|
|
166
172
|
this.myHttpClient = myHttpClient;
|
|
167
173
|
this.myTranslateCollectorService = myTranslateCollectorService;
|
|
168
174
|
this.priority = 0;
|
|
175
|
+
this.supportedLanguages = [];
|
|
169
176
|
}
|
|
170
177
|
init(path, libName, priority) {
|
|
171
178
|
return new Promise(async (resolve) => {
|
|
@@ -180,32 +187,32 @@ class AssetsI18nLoaderService {
|
|
|
180
187
|
this.subLanguages = this.myHttpClient.get(`assets/i18n/supported-languages.json?v=${getRandomString()}`)
|
|
181
188
|
.pipe(share());
|
|
182
189
|
}
|
|
183
|
-
this.subLanguages.
|
|
184
|
-
|
|
185
|
-
this.
|
|
186
|
-
for (let i = 0; i < this.supportedLanguages.length; i++) {
|
|
187
|
-
await firstValueFrom(this.loadTranslations(this.supportedLanguages[i], path, libName, priority));
|
|
188
|
-
}
|
|
189
|
-
resolve();
|
|
190
|
-
}, () => {
|
|
191
|
-
this.subLanguages = null;
|
|
190
|
+
const res = await firstValueFrom(this.subLanguages).catch(() => null);
|
|
191
|
+
if (!res) {
|
|
192
|
+
this.subLanguages = undefined;
|
|
192
193
|
console.error('Missing file -> assets/i18n/supported-languages.json <-- FIX THIS!');
|
|
193
|
-
|
|
194
|
-
}
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.subLanguages = undefined;
|
|
197
|
+
this.supportedLanguages = res.languages;
|
|
198
|
+
for (let i = 0; i < this.supportedLanguages.length; i++) {
|
|
199
|
+
await firstValueFrom(this.loadTranslations(this.supportedLanguages[i], path, libName, priority));
|
|
200
|
+
}
|
|
201
|
+
resolve();
|
|
195
202
|
});
|
|
196
203
|
}
|
|
197
204
|
loadTranslations(lang, path, libName, priority) {
|
|
198
205
|
const filename = libName ? `${libName}-${lang}.json` : `${lang}.json`;
|
|
199
206
|
return this.myHttpClient.get(`${(path || './assets/i18n/') + filename}?v=${getRandomString()}`)
|
|
200
207
|
.pipe(tap((response) => this.myTranslateCollectorService.addTranslations(response, lang, priority || this.priority)), catchError(() => {
|
|
201
|
-
console.error(`Missing file -> ${filename}
|
|
208
|
+
console.error(`Missing file -> ${filename}`);
|
|
202
209
|
return of(null);
|
|
203
210
|
}));
|
|
204
211
|
}
|
|
205
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
206
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
212
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: AssetsI18nLoaderService, deps: [{ token: i1$1.HttpClient }, { token: TranslateCollectorService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
213
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: AssetsI18nLoaderService, providedIn: 'root' }); }
|
|
207
214
|
}
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: AssetsI18nLoaderService, decorators: [{
|
|
209
216
|
type: Injectable,
|
|
210
217
|
args: [{
|
|
211
218
|
providedIn: 'root',
|
|
@@ -249,7 +256,7 @@ class CoreLoggerService {
|
|
|
249
256
|
else if (err.error?.message) {
|
|
250
257
|
msg = err.error.message;
|
|
251
258
|
}
|
|
252
|
-
else if (err.error?.errors
|
|
259
|
+
else if (err.error?.errors?.[0]?.message) {
|
|
253
260
|
msg = err.error.errors[0].message;
|
|
254
261
|
}
|
|
255
262
|
else if (err.message) {
|
|
@@ -373,7 +380,7 @@ class CoreLoggerService {
|
|
|
373
380
|
}
|
|
374
381
|
// Serialize configuration
|
|
375
382
|
config.duration = CoreLoggerService.getValue(config.duration, this.defaultConfig.duration, 4);
|
|
376
|
-
config.className = CoreLoggerService.getValue(config.className, this.defaultConfig.className,
|
|
383
|
+
config.className = CoreLoggerService.getValue(config.className, this.defaultConfig.className, '');
|
|
377
384
|
config.showDismiss = CoreLoggerService.getValue(config.showDismiss, this.defaultConfig.showDismiss, false);
|
|
378
385
|
config.closeOnClick = CoreLoggerService.getValue(config.closeOnClick, this.defaultConfig.closeOnClick, true);
|
|
379
386
|
return config;
|
|
@@ -394,10 +401,10 @@ class CoreLoggerService {
|
|
|
394
401
|
}
|
|
395
402
|
return val;
|
|
396
403
|
}
|
|
397
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
398
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
404
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CoreLoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
405
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CoreLoggerService, providedIn: 'root' }); }
|
|
399
406
|
}
|
|
400
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CoreLoggerService, decorators: [{
|
|
401
408
|
type: Injectable,
|
|
402
409
|
args: [{
|
|
403
410
|
providedIn: 'root',
|
|
@@ -410,28 +417,6 @@ class ApiService {
|
|
|
410
417
|
this.myCoreLoggerService = myCoreLoggerService;
|
|
411
418
|
this.myHttpClient = myHttpClient;
|
|
412
419
|
}
|
|
413
|
-
/**
|
|
414
|
-
* Gets an access token
|
|
415
|
-
* @deprecated use getToken()
|
|
416
|
-
*/
|
|
417
|
-
getAccessToken() {
|
|
418
|
-
return window.localStorage.getItem('jwtAccessToken');
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Sets an access token
|
|
422
|
-
* @param token
|
|
423
|
-
* @deprecated use setToken()
|
|
424
|
-
*/
|
|
425
|
-
setAccessToken(token) {
|
|
426
|
-
window.localStorage.setItem('jwtAccessToken', token);
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Removes an access token from local storage
|
|
430
|
-
* @deprecated use deleteAccessToken()
|
|
431
|
-
*/
|
|
432
|
-
removeAccessToken() {
|
|
433
|
-
window.localStorage.removeItem('jwtAccessToken');
|
|
434
|
-
}
|
|
435
420
|
/**
|
|
436
421
|
* Sets the token
|
|
437
422
|
* @param tokenSettings
|
|
@@ -475,7 +460,7 @@ class ApiService {
|
|
|
475
460
|
* @param options
|
|
476
461
|
*/
|
|
477
462
|
async getWithHeadersAsync(url, headers, options) {
|
|
478
|
-
return this.getWithHeaders(url, headers, options)
|
|
463
|
+
return firstValueFrom(this.getWithHeaders(url, headers, options));
|
|
479
464
|
}
|
|
480
465
|
/**
|
|
481
466
|
* Makes an http get call, which also includes the response headers
|
|
@@ -542,7 +527,7 @@ class ApiService {
|
|
|
542
527
|
delete(url, headers, options) {
|
|
543
528
|
options = ApiService.serializeOptions(options);
|
|
544
529
|
headers = this.getHeaders(headers, options);
|
|
545
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
530
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
546
531
|
return this.myHttpClient.delete(url, { ...options.httpOptions, headers })
|
|
547
532
|
.pipe(catchError((err) => this.handleError(err, options)));
|
|
548
533
|
}
|
|
@@ -573,7 +558,7 @@ class ApiService {
|
|
|
573
558
|
if (!options?.skipErrorHandling) {
|
|
574
559
|
this.myCoreLoggerService.logError({ msg: err });
|
|
575
560
|
}
|
|
576
|
-
return throwError(err);
|
|
561
|
+
return throwError(() => err);
|
|
577
562
|
}
|
|
578
563
|
handleResponse(response) {
|
|
579
564
|
if (response instanceof HttpResponse) {
|
|
@@ -585,20 +570,14 @@ class ApiService {
|
|
|
585
570
|
if (!headers) {
|
|
586
571
|
headers = new HttpHeaders();
|
|
587
572
|
}
|
|
588
|
-
if (!options
|
|
573
|
+
if (!options?.skipContentType) {
|
|
589
574
|
if (!headers.get('Content-Type')) {
|
|
590
575
|
headers = headers.set('Content-Type', 'application/json');
|
|
591
576
|
}
|
|
592
577
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
headers = headers.set('Authorization', `${tokenSettings.tokenType} ${tokenSettings.token}`);
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
// Deprecated. Use ITokenSettings
|
|
600
|
-
headers = headers.set('Authorization', `Bearer ${this.getAccessToken()}`);
|
|
601
|
-
}
|
|
578
|
+
const tokenSettings = this.getToken();
|
|
579
|
+
if (!options?.skipAuth && tokenSettings) {
|
|
580
|
+
headers = headers.set('Authorization', `${tokenSettings.tokenType} ${tokenSettings.token}`);
|
|
602
581
|
}
|
|
603
582
|
return headers;
|
|
604
583
|
}
|
|
@@ -611,10 +590,10 @@ class ApiService {
|
|
|
611
590
|
}
|
|
612
591
|
return options;
|
|
613
592
|
}
|
|
614
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
615
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
593
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ApiService, deps: [{ token: CoreLoggerService }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
594
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ApiService, providedIn: 'root' }); }
|
|
616
595
|
}
|
|
617
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
596
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ApiService, decorators: [{
|
|
618
597
|
type: Injectable,
|
|
619
598
|
args: [{
|
|
620
599
|
providedIn: 'root',
|
|
@@ -631,7 +610,7 @@ class MosaSocketService {
|
|
|
631
610
|
return this.subject;
|
|
632
611
|
}
|
|
633
612
|
send(data) {
|
|
634
|
-
this.subject
|
|
613
|
+
this.subject?.next(data);
|
|
635
614
|
}
|
|
636
615
|
create(url) {
|
|
637
616
|
const ws = new WebSocket(url);
|
|
@@ -652,10 +631,10 @@ class MosaSocketService {
|
|
|
652
631
|
};
|
|
653
632
|
return Subject.create(observer, observable);
|
|
654
633
|
}
|
|
655
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
656
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
634
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaSocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
635
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaSocketService, providedIn: 'root' }); }
|
|
657
636
|
}
|
|
658
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaSocketService, decorators: [{
|
|
659
638
|
type: Injectable,
|
|
660
639
|
args: [{
|
|
661
640
|
providedIn: 'root',
|
|
@@ -675,10 +654,10 @@ class CustomTranslateLoaderService {
|
|
|
675
654
|
const defaultTranslation = localStorage.getItem(MOSA_FALLBACK_TRANSLATION);
|
|
676
655
|
return isNullOrEmpty(defaultTranslation) ? {} : JSON.parse(defaultTranslation);
|
|
677
656
|
}
|
|
678
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
679
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
657
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CustomTranslateLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
658
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CustomTranslateLoaderService, providedIn: 'root' }); }
|
|
680
659
|
}
|
|
681
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CustomTranslateLoaderService, decorators: [{
|
|
682
661
|
type: Injectable,
|
|
683
662
|
args: [{
|
|
684
663
|
providedIn: 'root',
|
|
@@ -689,10 +668,10 @@ class CanDeactivateGuard {
|
|
|
689
668
|
canDeactivate(component) {
|
|
690
669
|
return component.canDeactivate ? component.canDeactivate() : true;
|
|
691
670
|
}
|
|
692
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
693
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
671
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CanDeactivateGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
672
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CanDeactivateGuard, providedIn: 'root' }); }
|
|
694
673
|
}
|
|
695
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
674
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CanDeactivateGuard, decorators: [{
|
|
696
675
|
type: Injectable,
|
|
697
676
|
args: [{
|
|
698
677
|
providedIn: 'root',
|
|
@@ -818,7 +797,6 @@ class Dictionary {
|
|
|
818
797
|
}
|
|
819
798
|
}
|
|
820
799
|
|
|
821
|
-
/* eslint-disable @typescript-eslint/unbound-method */
|
|
822
800
|
/**
|
|
823
801
|
* Cast any type
|
|
824
802
|
* @param data to be casted
|
|
@@ -847,7 +825,7 @@ class StringExtensions {
|
|
|
847
825
|
try {
|
|
848
826
|
str = JSON.parse(str);
|
|
849
827
|
}
|
|
850
|
-
catch
|
|
828
|
+
catch {
|
|
851
829
|
return null;
|
|
852
830
|
}
|
|
853
831
|
if (typeof str === 'object') {
|
|
@@ -915,7 +893,7 @@ class Sieve {
|
|
|
915
893
|
* public getter to get page size
|
|
916
894
|
*/
|
|
917
895
|
get pageSize() {
|
|
918
|
-
return this.options.pageSize;
|
|
896
|
+
return this.options.pageSize || 10;
|
|
919
897
|
}
|
|
920
898
|
/**
|
|
921
899
|
* Setter to set page size
|
|
@@ -927,7 +905,7 @@ class Sieve {
|
|
|
927
905
|
* public getter to get page
|
|
928
906
|
*/
|
|
929
907
|
get page() {
|
|
930
|
-
return this.options.page;
|
|
908
|
+
return this.options.page || 0;
|
|
931
909
|
}
|
|
932
910
|
/**
|
|
933
911
|
* Setter to set page
|
|
@@ -965,7 +943,7 @@ class Sieve {
|
|
|
965
943
|
* @param desc sort descending
|
|
966
944
|
*/
|
|
967
945
|
addSort(name, desc) {
|
|
968
|
-
this.options.sorts
|
|
946
|
+
this.options.sorts?.push({
|
|
969
947
|
name,
|
|
970
948
|
desc,
|
|
971
949
|
});
|
|
@@ -977,7 +955,7 @@ class Sieve {
|
|
|
977
955
|
* @param value filtered value
|
|
978
956
|
*/
|
|
979
957
|
addFilter(key, operator, value) {
|
|
980
|
-
this.options.filters
|
|
958
|
+
this.options.filters?.push({
|
|
981
959
|
key,
|
|
982
960
|
operator,
|
|
983
961
|
value,
|
|
@@ -1071,24 +1049,103 @@ var Browser;
|
|
|
1071
1049
|
Browser[Browser["other"] = 6] = "other";
|
|
1072
1050
|
})(Browser || (Browser = {}));
|
|
1073
1051
|
|
|
1052
|
+
class DictionaryItemPipe {
|
|
1053
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1054
|
+
transform(key, dictionary) {
|
|
1055
|
+
return dictionary.get(key)?.value;
|
|
1056
|
+
}
|
|
1057
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: DictionaryItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1058
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: DictionaryItemPipe, isStandalone: true, name: "dictionaryItem" }); }
|
|
1059
|
+
}
|
|
1060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: DictionaryItemPipe, decorators: [{
|
|
1061
|
+
type: Pipe,
|
|
1062
|
+
args: [{ name: 'dictionaryItem' }]
|
|
1063
|
+
}] });
|
|
1064
|
+
|
|
1065
|
+
class FilterPipe {
|
|
1066
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1067
|
+
transform(array, searchValue, searchKey) {
|
|
1068
|
+
// Return if array is empty or null
|
|
1069
|
+
if (!array?.length) {
|
|
1070
|
+
return [];
|
|
1071
|
+
}
|
|
1072
|
+
const foundItems = array.filter((v) => some(v, searchValue, searchKey));
|
|
1073
|
+
if (!foundItems.length) {
|
|
1074
|
+
return [];
|
|
1075
|
+
}
|
|
1076
|
+
// Return whole item
|
|
1077
|
+
return foundItems;
|
|
1078
|
+
}
|
|
1079
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: FilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1080
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: FilterPipe, isStandalone: true, name: "filter" }); }
|
|
1081
|
+
}
|
|
1082
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: FilterPipe, decorators: [{
|
|
1083
|
+
type: Pipe,
|
|
1084
|
+
args: [{ name: 'filter' }]
|
|
1085
|
+
}] });
|
|
1086
|
+
|
|
1087
|
+
class FindPipe {
|
|
1088
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1089
|
+
transform(array, searchValue, searchKey) {
|
|
1090
|
+
// Return if array is empty or null
|
|
1091
|
+
if (!array?.length) {
|
|
1092
|
+
return null;
|
|
1093
|
+
}
|
|
1094
|
+
const foundItem = array.find((v) => some(v, searchValue, searchKey));
|
|
1095
|
+
if (!foundItem) {
|
|
1096
|
+
return null;
|
|
1097
|
+
}
|
|
1098
|
+
// Return whole item
|
|
1099
|
+
return foundItem;
|
|
1100
|
+
}
|
|
1101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: FindPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1102
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: FindPipe, isStandalone: true, name: "find" }); }
|
|
1103
|
+
}
|
|
1104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: FindPipe, decorators: [{
|
|
1105
|
+
type: Pipe,
|
|
1106
|
+
args: [{ name: 'find' }]
|
|
1107
|
+
}] });
|
|
1108
|
+
|
|
1109
|
+
class JoinPipe {
|
|
1110
|
+
/**
|
|
1111
|
+
* Join array by separator
|
|
1112
|
+
* @param array
|
|
1113
|
+
* @param returnField
|
|
1114
|
+
* @param separator
|
|
1115
|
+
*/
|
|
1116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1117
|
+
transform(array, returnField, separator = ', ') {
|
|
1118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1119
|
+
return array.map((val) => returnField ? val[returnField] : val).join(separator);
|
|
1120
|
+
}
|
|
1121
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: JoinPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1122
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: JoinPipe, isStandalone: true, name: "join" }); }
|
|
1123
|
+
}
|
|
1124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: JoinPipe, decorators: [{
|
|
1125
|
+
type: Pipe,
|
|
1126
|
+
args: [{ name: 'join' }]
|
|
1127
|
+
}] });
|
|
1128
|
+
|
|
1074
1129
|
class MosaDatePipe {
|
|
1075
1130
|
constructor(myTranslateService, myDatePipe) {
|
|
1076
1131
|
this.myTranslateService = myTranslateService;
|
|
1077
1132
|
this.myDatePipe = myDatePipe;
|
|
1078
|
-
this.store$ = new BehaviorSubject(
|
|
1133
|
+
this.store$ = new BehaviorSubject(new Date().getTime());
|
|
1134
|
+
this.templates = {};
|
|
1079
1135
|
this.updateTemplates();
|
|
1080
|
-
setInterval(() =>
|
|
1081
|
-
this.store$.next(new Date().getTime());
|
|
1082
|
-
}, 10);
|
|
1136
|
+
setInterval(() => this.store$.next(new Date().getTime()), 10);
|
|
1083
1137
|
this.myTranslateService.onLangChange.subscribe(() => {
|
|
1084
1138
|
this.updateTemplates();
|
|
1085
1139
|
this.store$.next(new Date().getTime());
|
|
1086
1140
|
});
|
|
1087
1141
|
}
|
|
1088
|
-
transform(date, mode = 'timeSince') {
|
|
1089
|
-
return this.store$.pipe(map((currentDate) => this.calcDate(currentDate, date, mode)));
|
|
1142
|
+
transform(date, mode = 'timeSince', options) {
|
|
1143
|
+
return this.store$.pipe(map((currentDate) => this.calcDate(currentDate, date, mode, options)));
|
|
1090
1144
|
}
|
|
1091
|
-
calcDate(currentDate, date, mode) {
|
|
1145
|
+
calcDate(currentDate, date, mode, options) {
|
|
1146
|
+
if (!date) {
|
|
1147
|
+
return '';
|
|
1148
|
+
}
|
|
1092
1149
|
let parsed;
|
|
1093
1150
|
if (date instanceof Date) {
|
|
1094
1151
|
parsed = new Date(date.toString()).getTime();
|
|
@@ -1106,7 +1163,7 @@ class MosaDatePipe {
|
|
|
1106
1163
|
const hours = minutes / 60;
|
|
1107
1164
|
const days = hours / 24;
|
|
1108
1165
|
const years = days / 365;
|
|
1109
|
-
const timeSince = this.templates['prefix'] + (seconds < 60 && this.template('seconds', seconds) ||
|
|
1166
|
+
const timeSince = (options?.withPrefix ? this.templates['prefix'] : '') + (seconds < 60 && this.template('seconds', seconds) ||
|
|
1110
1167
|
seconds < 120 && this.template('minute', 1) ||
|
|
1111
1168
|
minutes < 60 && this.template('minutes', minutes) ||
|
|
1112
1169
|
minutes < 120 && this.template('hour', 1) ||
|
|
@@ -1116,7 +1173,7 @@ class MosaDatePipe {
|
|
|
1116
1173
|
days < 45 && this.template('month', 1) ||
|
|
1117
1174
|
days < 365 && this.template('months', days / 30) ||
|
|
1118
1175
|
years < 1.5 && this.template('year', 1) ||
|
|
1119
|
-
this.template('years', years)) + this.templates['
|
|
1176
|
+
this.template('years', years)) + (options?.withSuffix ? this.templates['suffix'] : '');
|
|
1120
1177
|
if (mode === 'timeSince') {
|
|
1121
1178
|
return timeSince;
|
|
1122
1179
|
}
|
|
@@ -1124,10 +1181,10 @@ class MosaDatePipe {
|
|
|
1124
1181
|
return `${convertedDate} (${timeSince})`;
|
|
1125
1182
|
}
|
|
1126
1183
|
}
|
|
1127
|
-
return convertedDate;
|
|
1184
|
+
return convertedDate || '';
|
|
1128
1185
|
}
|
|
1129
1186
|
template(key, val) {
|
|
1130
|
-
return this.templates[key]
|
|
1187
|
+
return this.templates[key]?.replace(/%d/i, String(Math.abs(Math.round(val))));
|
|
1131
1188
|
}
|
|
1132
1189
|
updateTemplates() {
|
|
1133
1190
|
this.templates = {
|
|
@@ -1146,78 +1203,20 @@ class MosaDatePipe {
|
|
|
1146
1203
|
years: this.myTranslateService.instant('mosa.pipes.timeSince.years'),
|
|
1147
1204
|
};
|
|
1148
1205
|
}
|
|
1149
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1150
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
1206
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaDatePipe, deps: [{ token: i1.TranslateService }, { token: i2.DatePipe }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1207
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: MosaDatePipe, isStandalone: true, name: "mosaDate" }); }
|
|
1151
1208
|
}
|
|
1152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaDatePipe, decorators: [{
|
|
1153
1210
|
type: Pipe,
|
|
1154
|
-
args: [{
|
|
1155
|
-
name: 'mosaDate',
|
|
1156
|
-
standalone: false,
|
|
1157
|
-
}]
|
|
1211
|
+
args: [{ name: 'mosaDate' }]
|
|
1158
1212
|
}], ctorParameters: () => [{ type: i1.TranslateService }, { type: i2.DatePipe }] });
|
|
1159
1213
|
|
|
1160
|
-
class MosaDatePipeModule {
|
|
1161
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaDatePipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1162
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: MosaDatePipeModule, declarations: [MosaDatePipe], imports: [CommonModule], exports: [MosaDatePipe] }); }
|
|
1163
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaDatePipeModule, providers: [DatePipe], imports: [CommonModule] }); }
|
|
1164
|
-
}
|
|
1165
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaDatePipeModule, decorators: [{
|
|
1166
|
-
type: NgModule,
|
|
1167
|
-
args: [{
|
|
1168
|
-
declarations: [MosaDatePipe],
|
|
1169
|
-
imports: [
|
|
1170
|
-
CommonModule,
|
|
1171
|
-
],
|
|
1172
|
-
exports: [MosaDatePipe],
|
|
1173
|
-
providers: [DatePipe],
|
|
1174
|
-
}]
|
|
1175
|
-
}] });
|
|
1176
|
-
|
|
1177
|
-
class DictionaryItemPipe {
|
|
1178
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1179
|
-
transform(key, dictionary) {
|
|
1180
|
-
return dictionary.get(key)?.value;
|
|
1181
|
-
}
|
|
1182
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1183
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipe, isStandalone: false, name: "dictionaryItem" }); }
|
|
1184
|
-
}
|
|
1185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipe, decorators: [{
|
|
1186
|
-
type: Pipe,
|
|
1187
|
-
args: [{
|
|
1188
|
-
name: 'dictionaryItem',
|
|
1189
|
-
standalone: false,
|
|
1190
|
-
}]
|
|
1191
|
-
}] });
|
|
1192
|
-
|
|
1193
|
-
class DictionaryItemPipeModule {
|
|
1194
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1195
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipeModule, declarations: [DictionaryItemPipe], imports: [CommonModule], exports: [DictionaryItemPipe] }); }
|
|
1196
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipeModule, imports: [CommonModule] }); }
|
|
1197
|
-
}
|
|
1198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DictionaryItemPipeModule, decorators: [{
|
|
1199
|
-
type: NgModule,
|
|
1200
|
-
args: [{
|
|
1201
|
-
declarations: [DictionaryItemPipe],
|
|
1202
|
-
imports: [
|
|
1203
|
-
CommonModule,
|
|
1204
|
-
],
|
|
1205
|
-
exports: [
|
|
1206
|
-
DictionaryItemPipe,
|
|
1207
|
-
],
|
|
1208
|
-
}]
|
|
1209
|
-
}] });
|
|
1210
|
-
|
|
1211
1214
|
class MosaDurationPipe {
|
|
1212
1215
|
constructor(myTranslateService) {
|
|
1213
1216
|
this.myTranslateService = myTranslateService;
|
|
1214
1217
|
this.store$ = new BehaviorSubject(new Date().getTime());
|
|
1215
|
-
this.interval = setInterval(() =>
|
|
1216
|
-
|
|
1217
|
-
}, 1000);
|
|
1218
|
-
this.myTranslateService.onLangChange.subscribe(() => {
|
|
1219
|
-
this.store$.next(new Date().getTime());
|
|
1220
|
-
});
|
|
1218
|
+
this.interval = setInterval(() => this.store$.next(new Date().getTime()), 1000);
|
|
1219
|
+
this.myTranslateService.onLangChange.subscribe(() => this.store$.next(new Date().getTime()));
|
|
1221
1220
|
}
|
|
1222
1221
|
/**
|
|
1223
1222
|
* Converts a timestamp to a duration in the given format
|
|
@@ -1234,11 +1233,11 @@ class MosaDurationPipe {
|
|
|
1234
1233
|
return this.store$.pipe(map((currentDate) => {
|
|
1235
1234
|
if (!millis) {
|
|
1236
1235
|
clearInterval(this.interval);
|
|
1237
|
-
return
|
|
1236
|
+
return '';
|
|
1238
1237
|
}
|
|
1239
1238
|
if (millis - currentDate < 0) {
|
|
1240
1239
|
clearInterval(this.interval);
|
|
1241
|
-
return
|
|
1240
|
+
return '';
|
|
1242
1241
|
}
|
|
1243
1242
|
return this.calcDuration(currentDate, millis, format);
|
|
1244
1243
|
}));
|
|
@@ -1279,170 +1278,30 @@ class MosaDurationPipe {
|
|
|
1279
1278
|
}
|
|
1280
1279
|
return this.getTranslation(days, 'days');
|
|
1281
1280
|
}
|
|
1282
|
-
return
|
|
1281
|
+
return '';
|
|
1283
1282
|
}
|
|
1284
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1285
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
1283
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaDurationPipe, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1284
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: MosaDurationPipe, isStandalone: true, name: "mosaDuration" }); }
|
|
1286
1285
|
}
|
|
1287
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MosaDurationPipe, decorators: [{
|
|
1288
1287
|
type: Pipe,
|
|
1289
|
-
args: [{
|
|
1290
|
-
name: 'mosaDuration',
|
|
1291
|
-
standalone: false,
|
|
1292
|
-
}]
|
|
1288
|
+
args: [{ name: 'mosaDuration' }]
|
|
1293
1289
|
}], ctorParameters: () => [{ type: i1.TranslateService }] });
|
|
1294
1290
|
|
|
1295
|
-
class MosaDurationPipeModule {
|
|
1296
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaDurationPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1297
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: MosaDurationPipeModule, declarations: [MosaDurationPipe], imports: [CommonModule], exports: [MosaDurationPipe] }); }
|
|
1298
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaDurationPipeModule, imports: [CommonModule] }); }
|
|
1299
|
-
}
|
|
1300
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaDurationPipeModule, decorators: [{
|
|
1301
|
-
type: NgModule,
|
|
1302
|
-
args: [{
|
|
1303
|
-
declarations: [MosaDurationPipe],
|
|
1304
|
-
imports: [
|
|
1305
|
-
CommonModule,
|
|
1306
|
-
],
|
|
1307
|
-
exports: [MosaDurationPipe],
|
|
1308
|
-
}]
|
|
1309
|
-
}] });
|
|
1310
|
-
|
|
1311
|
-
class FindInArrayPipe {
|
|
1312
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1313
|
-
transform(searchValue, array, searchKey, returnElements) {
|
|
1314
|
-
// Return if array is empty or null
|
|
1315
|
-
if (!array || !array.length) {
|
|
1316
|
-
return null;
|
|
1317
|
-
}
|
|
1318
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1319
|
-
const foundItem = array.find((val) => (searchKey ? val[searchKey] : val) === searchValue);
|
|
1320
|
-
if (!foundItem) {
|
|
1321
|
-
return null;
|
|
1322
|
-
}
|
|
1323
|
-
// Return whole item
|
|
1324
|
-
if (!returnElements) {
|
|
1325
|
-
return foundItem;
|
|
1326
|
-
}
|
|
1327
|
-
if (returnElements.length === 1) {
|
|
1328
|
-
return foundItem[returnElements[0]];
|
|
1329
|
-
}
|
|
1330
|
-
// Return given values to the keys
|
|
1331
|
-
return returnElements.map((val) => foundItem[val]);
|
|
1332
|
-
}
|
|
1333
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1334
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipe, isStandalone: false, name: "findInArray" }); }
|
|
1335
|
-
}
|
|
1336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipe, decorators: [{
|
|
1337
|
-
type: Pipe,
|
|
1338
|
-
args: [{
|
|
1339
|
-
name: 'findInArray',
|
|
1340
|
-
standalone: false,
|
|
1341
|
-
}]
|
|
1342
|
-
}] });
|
|
1343
|
-
|
|
1344
|
-
class FindInArrayPipeModule {
|
|
1345
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1346
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipeModule, declarations: [FindInArrayPipe], imports: [CommonModule], exports: [FindInArrayPipe] }); }
|
|
1347
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipeModule, imports: [CommonModule] }); }
|
|
1348
|
-
}
|
|
1349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FindInArrayPipeModule, decorators: [{
|
|
1350
|
-
type: NgModule,
|
|
1351
|
-
args: [{
|
|
1352
|
-
declarations: [
|
|
1353
|
-
FindInArrayPipe,
|
|
1354
|
-
],
|
|
1355
|
-
imports: [
|
|
1356
|
-
CommonModule,
|
|
1357
|
-
],
|
|
1358
|
-
exports: [
|
|
1359
|
-
FindInArrayPipe,
|
|
1360
|
-
],
|
|
1361
|
-
}]
|
|
1362
|
-
}] });
|
|
1363
|
-
|
|
1364
|
-
class JoinPipe {
|
|
1365
|
-
/**
|
|
1366
|
-
* Join array by separator
|
|
1367
|
-
* @param array
|
|
1368
|
-
* @param returnField
|
|
1369
|
-
* @param separator
|
|
1370
|
-
*/
|
|
1371
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1372
|
-
transform(array, returnField, separator = ', ') {
|
|
1373
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1374
|
-
return array.map((val) => returnField ? val[returnField] : val).join(separator);
|
|
1375
|
-
}
|
|
1376
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: JoinPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1377
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: JoinPipe, isStandalone: false, name: "join" }); }
|
|
1378
|
-
}
|
|
1379
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: JoinPipe, decorators: [{
|
|
1380
|
-
type: Pipe,
|
|
1381
|
-
args: [{
|
|
1382
|
-
name: 'join',
|
|
1383
|
-
standalone: false,
|
|
1384
|
-
}]
|
|
1385
|
-
}] });
|
|
1386
|
-
|
|
1387
|
-
class JoinPipeModule {
|
|
1388
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: JoinPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1389
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: JoinPipeModule, declarations: [JoinPipe], imports: [CommonModule], exports: [JoinPipe] }); }
|
|
1390
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: JoinPipeModule, imports: [CommonModule] }); }
|
|
1391
|
-
}
|
|
1392
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: JoinPipeModule, decorators: [{
|
|
1393
|
-
type: NgModule,
|
|
1394
|
-
args: [{
|
|
1395
|
-
declarations: [
|
|
1396
|
-
JoinPipe,
|
|
1397
|
-
],
|
|
1398
|
-
exports: [
|
|
1399
|
-
JoinPipe,
|
|
1400
|
-
],
|
|
1401
|
-
imports: [
|
|
1402
|
-
CommonModule,
|
|
1403
|
-
],
|
|
1404
|
-
}]
|
|
1405
|
-
}] });
|
|
1406
|
-
|
|
1407
1291
|
function initI18n(i18n) {
|
|
1408
|
-
return
|
|
1292
|
+
return i18n.init(undefined, undefined, 1);
|
|
1409
1293
|
}
|
|
1410
1294
|
function initI18nCore(i18n) {
|
|
1411
|
-
return
|
|
1412
|
-
}
|
|
1413
|
-
class MosaCoreModule {
|
|
1414
|
-
static forRoot() {
|
|
1415
|
-
return {
|
|
1416
|
-
ngModule: MosaCoreModule,
|
|
1417
|
-
providers: [
|
|
1418
|
-
provideAppInitializer(() => {
|
|
1419
|
-
const initializerFn = (initI18n)(inject(AssetsI18nLoaderService));
|
|
1420
|
-
return initializerFn();
|
|
1421
|
-
}),
|
|
1422
|
-
provideAppInitializer(() => {
|
|
1423
|
-
const initializerFn = (initI18nCore)(inject(AssetsI18nLoaderService));
|
|
1424
|
-
return initializerFn();
|
|
1425
|
-
}),
|
|
1426
|
-
],
|
|
1427
|
-
};
|
|
1428
|
-
}
|
|
1429
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1430
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: MosaCoreModule, imports: [CommonModule] }); }
|
|
1431
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaCoreModule, imports: [CommonModule] }); }
|
|
1295
|
+
return i18n.init(undefined, 'mosa');
|
|
1432
1296
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
imports: [
|
|
1438
|
-
CommonModule,
|
|
1439
|
-
],
|
|
1440
|
-
}]
|
|
1441
|
-
}] });
|
|
1297
|
+
const provideMosaCore = () => makeEnvironmentProviders([
|
|
1298
|
+
provideAppInitializer(() => initI18n(inject(AssetsI18nLoaderService))),
|
|
1299
|
+
provideAppInitializer(() => initI18nCore(inject(AssetsI18nLoaderService))),
|
|
1300
|
+
]);
|
|
1442
1301
|
|
|
1443
1302
|
/**
|
|
1444
1303
|
* Generated bundle index. Do not edit.
|
|
1445
1304
|
*/
|
|
1446
1305
|
|
|
1447
|
-
export { ApiService, ArrayExtensions, AssetsI18nLoaderService, Browser, CanDeactivateGuard, ContentPosition, CoreLoggerService, CustomTranslateLoaderService, Dictionary, DictionaryItemPipe,
|
|
1306
|
+
export { ApiService, ArrayExtensions, AssetsI18nLoaderService, Browser, CanDeactivateGuard, ContentPosition, CoreLoggerService, CustomTranslateLoaderService, Dictionary, DictionaryItemPipe, FilterPipe, FindPipe, I18nSupported, JoinPipe, LOCAL_STORAGE_TOKEN_KEY, MOSA_FALLBACK_TRANSLATION, MOSA_MERGED_TRANSLATION, MosaDatePipe, MosaDurationPipe, MosaSocketService, NumberExtensions, Prototypes, Sieve, StringExtensions, Theme, TranslateCollectorService, cast, getRandomString, getTransformMatrix, isNullOrEmpty, isNullOrUndefined, isNumber, isZeroOrHigher, mergeArray, provideMosaCore, roundNearest, some, tryJsonParse };
|
|
1448
1307
|
//# sourceMappingURL=mosa-ng-core.mjs.map
|