@mosa-ng/core 17.0.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.
Files changed (60) hide show
  1. package/.eslintrc.json +31 -0
  2. package/README.md +24 -0
  3. package/ng-package.json +10 -0
  4. package/package.json +12 -0
  5. package/src/assets/i18n/mosa-de-DE.json +60 -0
  6. package/src/assets/i18n/mosa-en-US.json +60 -0
  7. package/src/lib/constants/local-storage.constant.ts +4 -0
  8. package/src/lib/enums/browser.enum.ts +9 -0
  9. package/src/lib/enums/content-position.enum.ts +11 -0
  10. package/src/lib/enums/i18n-supported.enum.ts +10 -0
  11. package/src/lib/enums/theme.enum.ts +4 -0
  12. package/src/lib/models/api-options.model.ts +21 -0
  13. package/src/lib/models/dictionary-item.model.ts +8 -0
  14. package/src/lib/models/key-map.model.ts +3 -0
  15. package/src/lib/models/logger/log-event.model.ts +8 -0
  16. package/src/lib/models/logger/log-message-data.model.ts +5 -0
  17. package/src/lib/models/logger/log-type.model.ts +1 -0
  18. package/src/lib/models/logger/log.model.ts +10 -0
  19. package/src/lib/models/logger/logger-base-config.model.ts +8 -0
  20. package/src/lib/models/logger/logger-config.model.ts +9 -0
  21. package/src/lib/models/logger/logger-default-config.model.ts +5 -0
  22. package/src/lib/models/mosa-duration.model.ts +1 -0
  23. package/src/lib/models/sieve/sieve-filter.model.ts +10 -0
  24. package/src/lib/models/sieve/sieve-operator.model.ts +69 -0
  25. package/src/lib/models/sieve/sieve-options.model.ts +13 -0
  26. package/src/lib/models/sieve/sieve-response.model.ts +4 -0
  27. package/src/lib/models/sieve/sieve-sort.model.ts +7 -0
  28. package/src/lib/models/token-settings.model.ts +5 -0
  29. package/src/lib/models/transform-matrix.model.ts +5 -0
  30. package/src/lib/mosa-core.module.ts +117 -0
  31. package/src/lib/pipes/dictionary-item-pipe/dictionary-item-pipe.module.ts +15 -0
  32. package/src/lib/pipes/dictionary-item-pipe/dictionary-item.pipe.ts +14 -0
  33. package/src/lib/pipes/find-in-array/find-in-array-pipe.module.ts +17 -0
  34. package/src/lib/pipes/find-in-array/find-in-array.pipe.spec.ts +8 -0
  35. package/src/lib/pipes/find-in-array/find-in-array.pipe.ts +34 -0
  36. package/src/lib/pipes/join/join-pipe.module.ts +17 -0
  37. package/src/lib/pipes/join/join.pipe.spec.ts +8 -0
  38. package/src/lib/pipes/join/join.pipe.ts +20 -0
  39. package/src/lib/pipes/mosa-date-pipe/mosa-date-pipe.module.ts +14 -0
  40. package/src/lib/pipes/mosa-date-pipe/mosa-date.pipe.ts +102 -0
  41. package/src/lib/pipes/mosa-duration-pipe/mosa-duration-pipe.module.ts +13 -0
  42. package/src/lib/pipes/mosa-duration-pipe/mosa-duration.pipe.ts +106 -0
  43. package/src/lib/services/api.service.ts +270 -0
  44. package/src/lib/services/core-logger.service.ts +219 -0
  45. package/src/lib/services/guards/can-deactivate.guard.ts +18 -0
  46. package/src/lib/services/mosa-socket.service.ts +46 -0
  47. package/src/lib/services/translation/assets-i18n-loader.service.ts +67 -0
  48. package/src/lib/services/translation/custom-translate-loader.service.ts +27 -0
  49. package/src/lib/services/translation/translate-collector.service.ts +60 -0
  50. package/src/lib/utils/commons.util.ts +100 -0
  51. package/src/lib/utils/dictionary.util.ts +140 -0
  52. package/src/lib/utils/item.util.ts +4 -0
  53. package/src/lib/utils/promise.util.ts +3 -0
  54. package/src/lib/utils/prototypes.util.ts +167 -0
  55. package/src/lib/utils/sieve.util.ts +169 -0
  56. package/src/lib/utils/size.util.ts +4 -0
  57. package/src/public-api.ts +1 -0
  58. package/tsconfig.lib.json +16 -0
  59. package/tsconfig.lib.prod.json +10 -0
  60. package/tsconfig.spec.json +14 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "extends": "../../.eslintrc.json",
3
+ "parserOptions": {
4
+ "project": "**/tsconfig.json"
5
+ },
6
+ "overrides": [
7
+ {
8
+ "files": [
9
+ "*.ts"
10
+ ],
11
+ "rules": {
12
+ "@angular-eslint/component-selector": [
13
+ "error",
14
+ {
15
+ "type": "element",
16
+ "prefix": "mosa",
17
+ "style": "kebab-case"
18
+ }
19
+ ],
20
+ "@angular-eslint/directive-selector": [
21
+ "error",
22
+ {
23
+ "type": "attribute",
24
+ "prefix": "mosa",
25
+ "style": "camelCase"
26
+ }
27
+ ]
28
+ }
29
+ }
30
+ ]
31
+ }
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # core
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project core`.
8
+ > Note: Don't forget to add `--project core` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build core` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build core`, go to the dist folder `cd dist/core` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test core` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/@mosa-ng/core",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "assets": [
8
+ "src/assets"
9
+ ]
10
+ }
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@mosa-ng/core",
3
+ "version": "17.0.0",
4
+ "peerDependencies": {
5
+ "@angular/common": ">=17.0.0 < 18.0.0",
6
+ "@angular/core": ">=17.0.0 < 18.0.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false
12
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "mosa.confirmDialog.label": "Aktion bestätigen",
3
+ "mosa.confirmDialog.message": "Wollen Sie diese Aktion wirklich ausführen?",
4
+ "mosa.updateDialog.label": "Update verfügbar",
5
+ "mosa.updateDialog.message": "Ein neues Update dieser Seite ist verfügbar. Welche Aktion wollen Sie ausführen?",
6
+
7
+ "mosa.cellEditor.discardChanges.label": "Änderungen verwerfen?",
8
+ "mosa.cellEditor.discardChanges.message": "Wollen Sie Ihre Änderungen wirklich verwerfen?",
9
+
10
+ "mosa.components.cellEditorBase.discardChanges.label": "Änderungen verwerfen?",
11
+ "mosa.components.cellEditorBase.discardChanges.message": "Sie haben noch nicht gespeicherte Änderungen. Wollen Sie diese Seite wirklich schließen?",
12
+
13
+ "mosa.pipes.timeSince.prefix": "vor ",
14
+ "mosa.pipes.timeSince.suffix": "",
15
+ "mosa.pipes.timeSince.seconds": "%d Sekunden",
16
+ "mosa.pipes.timeSince.minute": "einer Minute",
17
+ "mosa.pipes.timeSince.minutes": "%d Minuten",
18
+ "mosa.pipes.timeSince.hour": "einer Stunde",
19
+ "mosa.pipes.timeSince.hours": "%d Stunden",
20
+ "mosa.pipes.timeSince.day": "einem Tag",
21
+ "mosa.pipes.timeSince.days": "%d Tagen",
22
+ "mosa.pipes.timeSince.month": "einem Monat",
23
+ "mosa.pipes.timeSince.months": "%d Monaten",
24
+ "mosa.pipes.timeSince.year": "einem Jahr",
25
+ "mosa.pipes.timeSince.years": "%d Jahren",
26
+
27
+ "mosa.commons.logs.success.label": "Erfolgreich",
28
+ "mosa.commons.logs.success.message": "Aktion wurde erfolgreich ausgeführt",
29
+ "mosa.commons.logs.warning.label": "Warnung",
30
+ "mosa.commons.logs.warning.message": "Aktion wurde mit Warnungen ausgeführt",
31
+ "mosa.commons.logs.info.label": "Info",
32
+ "mosa.commons.logs.info.message": "Aktion wurde ausgeführt",
33
+ "mosa.commons.logs.error.label": "Fehler",
34
+ "mosa.commons.logs.error.message": "Ein Fehler ist aufgetreten",
35
+
36
+ "mosa.commons.errors.status[400].message": "Die Anfrage konnte nicht verarbeitet werden",
37
+ "mosa.commons.errors.status[403].message": "Sie haben keine Berechtigung für diese Aktion",
38
+ "mosa.commons.errors.status[401].message": "Sie sind nicht angemeldet",
39
+ "mosa.commons.errors.status[404].message": "Die angeforderte Ressource wurde nicht gefunden",
40
+ "mosa.commons.errors.status[500].message": "Ein interner Fehler ist aufgetreten",
41
+
42
+ "mosa.commons.dateTime.seconds.label": "Sekunde",
43
+ "mosa.commons.dateTime.seconds.plural.label": "Sekunden",
44
+ "mosa.commons.dateTime.minutes.label": "Minute",
45
+ "mosa.commons.dateTime.minutes.plural.label": "Minuten",
46
+ "mosa.commons.dateTime.hours.label": "Stunde",
47
+ "mosa.commons.dateTime.hours.plural.label": "Stunden",
48
+ "mosa.commons.dateTime.days.label": "Tag",
49
+ "mosa.commons.dateTime.days.plural.label": "Tage",
50
+
51
+ "mosa.commons.buttons.save": "Speichern",
52
+ "mosa.commons.buttons.deny": "Ablehnen",
53
+ "mosa.commons.buttons.dismiss": "Schließen",
54
+ "mosa.commons.buttons.confirm": "Bestätigen",
55
+ "mosa.commons.buttons.cancel": "Abbrechen",
56
+ "mosa.commons.buttons.delete": "Löschen",
57
+ "mosa.commons.buttons.accept": "Akzeptieren",
58
+ "mosa.commons.buttons.reloadNow": "Jetzt neu laden",
59
+ "mosa.commons.buttons.ignoreFor": "Für {{ duration }} ignorieren"
60
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "mosa.confirmDialog.label": "Confirm Action",
3
+ "mosa.confirmDialog.message": "Do you really want to execute this action?",
4
+ "mosa.updateDialog.label": "Update available",
5
+ "mosa.updateDialog.message": "A new update was found. Which action do you want to take?",
6
+
7
+ "mosa.cellEditor.discardChanges.label": "Discard changes?",
8
+ "mosa.cellEditor.discardChanges.message": "Do you really want to discard your changes?",
9
+
10
+ "mosa.components.cellEditorBase.discardChanges.label": "Discard changes?",
11
+ "mosa.components.cellEditorBase.discardChanges.message": "You have still unsaved changes. Are you sure you want to close the page?",
12
+
13
+ "mosa.pipes.timeSince.prefix": "",
14
+ "mosa.pipes.timeSince.suffix": " ago",
15
+ "mosa.pipes.timeSince.seconds": "%d seconds",
16
+ "mosa.pipes.timeSince.minute": "a minute",
17
+ "mosa.pipes.timeSince.minutes": "%d minutes",
18
+ "mosa.pipes.timeSince.hour": "an hour",
19
+ "mosa.pipes.timeSince.hours": "%d hours",
20
+ "mosa.pipes.timeSince.day": "a day",
21
+ "mosa.pipes.timeSince.days": "%d days",
22
+ "mosa.pipes.timeSince.month": "a month",
23
+ "mosa.pipes.timeSince.months": "%d months",
24
+ "mosa.pipes.timeSince.year": "a year",
25
+ "mosa.pipes.timeSince.years": "%d years",
26
+
27
+ "mosa.commons.logs.success.label": "Success",
28
+ "mosa.commons.logs.success.message": "Action processed successfully",
29
+ "mosa.commons.logs.warning.label": "Warning",
30
+ "mosa.commons.logs.warning.message": "Action processed with warnings",
31
+ "mosa.commons.logs.info.label": "Info",
32
+ "mosa.commons.logs.info.message": "Action was processed",
33
+ "mosa.commons.logs.error.label": "Error",
34
+ "mosa.commons.logs.error.message": "An error happened",
35
+
36
+ "mosa.commons.errors.status[400].message": "An unexpected error happened",
37
+ "mosa.commons.errors.status[403].message": "Forbidden request",
38
+ "mosa.commons.errors.status[401].message": "Unauthorized request",
39
+ "mosa.commons.errors.status[404].message": "Not found",
40
+ "mosa.commons.errors.status[500].message": "Internal Server Error",
41
+
42
+ "mosa.commons.dateTime.seconds.label": "second",
43
+ "mosa.commons.dateTime.seconds.plural.label": "seconds",
44
+ "mosa.commons.dateTime.minutes.label": "minute",
45
+ "mosa.commons.dateTime.minutes.plural.label": "minutes",
46
+ "mosa.commons.dateTime.hours.label": "hour",
47
+ "mosa.commons.dateTime.hours.plural.label": "hours",
48
+ "mosa.commons.dateTime.days.label": "day",
49
+ "mosa.commons.dateTime.days.plural.label": "days",
50
+
51
+ "mosa.commons.buttons.save": "Save",
52
+ "mosa.commons.buttons.deny": "Deny",
53
+ "mosa.commons.buttons.dismiss": "Dismiss",
54
+ "mosa.commons.buttons.confirm": "Confirm",
55
+ "mosa.commons.buttons.cancel": "Cancel",
56
+ "mosa.commons.buttons.delete": "Delete",
57
+ "mosa.commons.buttons.accept": "Accept",
58
+ "mosa.commons.buttons.reloadNow": "Reload now",
59
+ "mosa.commons.buttons.ignoreFor": "Ignore for {{ duration }}"
60
+ }
@@ -0,0 +1,4 @@
1
+ import { I18nSupported } from '../enums/i18n-supported.enum';
2
+
3
+ export const MOSA_MERGED_TRANSLATION = (lang: string): string => `mosa_${ lang }_merged_${ location.host }`;
4
+ export const MOSA_FALLBACK_TRANSLATION = `mosa_${ I18nSupported.enUS }_merged_${ location.host }`;
@@ -0,0 +1,9 @@
1
+ export enum Browser {
2
+ chrome,
3
+ firefox,
4
+ internetExplorer,
5
+ opera,
6
+ edge,
7
+ safari,
8
+ other,
9
+ }
@@ -0,0 +1,11 @@
1
+ export enum ContentPosition {
2
+ top = 'top',
3
+ topLeft = 'top-left',
4
+ topRight = 'top-right',
5
+ bottom = 'bottom',
6
+ bottomLeft = 'bottom-left',
7
+ bottomRight = 'bottom-right',
8
+ center = 'center',
9
+ centerLeft = 'center-left',
10
+ centerRight = 'center-right',
11
+ }
@@ -0,0 +1,10 @@
1
+ export enum I18nSupported {
2
+ enUS = 'en-US',
3
+ deDE = 'de-DE',
4
+ deCH = 'de-CH',
5
+ deAT = 'de-AT',
6
+ enGB = 'en-GB',
7
+ frFR = 'fr-FR',
8
+ esES = 'es-ES',
9
+ ptPT = 'pt-PT',
10
+ }
@@ -0,0 +1,4 @@
1
+ export enum Theme {
2
+ light,
3
+ dark,
4
+ }
@@ -0,0 +1,21 @@
1
+ import { HttpParams } from '@angular/common/http';
2
+
3
+ export type ApiResponseTypes = 'json' | 'blob' | 'text' | 'arraybuffer';
4
+
5
+ export type ApiObserveTypes = 'body' | 'response' | 'events';
6
+
7
+ export interface IHttpOptions {
8
+ observe?: ApiObserveTypes;
9
+ responseType?: ApiResponseTypes;
10
+ params?: HttpParams | {
11
+ [ param: string ]: string | string[];
12
+ };
13
+ reportProgress?: boolean;
14
+ }
15
+
16
+ export interface IApiOptions {
17
+ skipAuth?: boolean;
18
+ skipContentType?: boolean;
19
+ skipErrorHandling?: boolean;
20
+ httpOptions?: IHttpOptions;
21
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Interface for dictionary class. Has a key and a value
3
+ */
4
+ export interface IDictionaryItem<Key, Value> {
5
+ key: Key;
6
+ value: Value;
7
+ }
8
+
@@ -0,0 +1,3 @@
1
+ export interface IKeyMap<T> {
2
+ [ key: string | number ]: T;
3
+ }
@@ -0,0 +1,8 @@
1
+ import { ILogMessageData } from './log-message-data.model';
2
+ import { LogType } from './log-type.model';
3
+ import { ILoggerConfig } from './logger-config.model';
4
+
5
+ export interface ILogEvent extends ILogMessageData {
6
+ type: LogType;
7
+ config: ILoggerConfig;
8
+ }
@@ -0,0 +1,5 @@
1
+ export interface ILogMessageData {
2
+ title?: string;
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ msg?: any;
5
+ }
@@ -0,0 +1 @@
1
+ export type LogType = 'success' | 'error' | 'warning' | 'info' | 'default';
@@ -0,0 +1,10 @@
1
+ import { ILoggerConfig } from './logger-config.model';
2
+
3
+ export interface ILog {
4
+ id: number;
5
+ title: string;
6
+ message: string;
7
+ config: ILoggerConfig;
8
+ icon: string;
9
+ state?: 'enter' | 'leave';
10
+ }
@@ -0,0 +1,8 @@
1
+ export interface ILoggerBaseConfig {
2
+ showUser?: boolean;
3
+ duration?: number;
4
+ className?: string;
5
+ hideIcon?: boolean;
6
+ showDismiss?: boolean;
7
+ closeOnClick?: boolean;
8
+ }
@@ -0,0 +1,9 @@
1
+ import { ILogMessageData } from './log-message-data.model';
2
+ import { ILoggerBaseConfig } from './logger-base-config.model';
3
+
4
+ export interface ILoggerConfig extends ILoggerBaseConfig, ILogMessageData {
5
+ action?: {
6
+ label: string;
7
+ callback?: () => void;
8
+ };
9
+ }
@@ -0,0 +1,5 @@
1
+ import { ILoggerBaseConfig } from './logger-base-config.model';
2
+
3
+ export interface ILoggerDefaultConfig extends ILoggerBaseConfig {
4
+ debug: boolean;
5
+ }
@@ -0,0 +1 @@
1
+ export type MosaDurationFormat = 'auto' | 'days' | 'hours' | 'minutes' | 'seconds';
@@ -0,0 +1,10 @@
1
+ import { SieveOperator } from './sieve-operator.model';
2
+
3
+ /**
4
+ * Sieve filter interface
5
+ */
6
+ export interface ISieveFilter {
7
+ key: string;
8
+ operator: SieveOperator;
9
+ value: string;
10
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Sieve operator for filtering
3
+ * @see https://github.com/Biarity/Sieve#operators
4
+ */
5
+ export type SieveOperator =
6
+ /**
7
+ * Equals
8
+ */
9
+ '==' |
10
+ /**
11
+ * Not equals
12
+ */
13
+ '!=' |
14
+ /**
15
+ * Greater than
16
+ */
17
+ '>' |
18
+ /**
19
+ * Less than
20
+ */
21
+ '<' |
22
+ /**
23
+ * Greater than or equal to
24
+ */
25
+ '>=' |
26
+ /**
27
+ * Less than or equal to
28
+ */
29
+ '<=' |
30
+ /**
31
+ * Contains
32
+ */
33
+ '@=' |
34
+ /**
35
+ * Starts with
36
+ */
37
+ '_=' |
38
+ /**
39
+ * Does not Contains
40
+ */
41
+ '!@=' |
42
+ /**
43
+ * Does not Starts with
44
+ */
45
+ '!_=' |
46
+ /**
47
+ * Case-insensitive string Contains
48
+ */
49
+ '@=*' |
50
+ /**
51
+ * Case-insensitive string Starts with
52
+ */
53
+ '_=*' |
54
+ /**
55
+ * Case-insensitive string Equals
56
+ */
57
+ '==*' |
58
+ /**
59
+ * Case-insensitive string Not equals
60
+ */
61
+ '!=*' |
62
+ /**
63
+ * Case-insensitive string does not Contains
64
+ */
65
+ '!@=*' |
66
+ /**
67
+ * Case-insensitive string does not Starts with
68
+ */
69
+ '!_=*';
@@ -0,0 +1,13 @@
1
+ import { ISieveFilter } from './sieve-filter.model';
2
+ import { ISieveSort } from './sieve-sort.model';
3
+
4
+ /**
5
+ * Sieve options interface
6
+ */
7
+ export interface ISieveOptions {
8
+ baseUrl?: string;
9
+ sorts?: ISieveSort[];
10
+ filters?: ISieveFilter[];
11
+ page?: number;
12
+ pageSize?: number;
13
+ }
@@ -0,0 +1,4 @@
1
+ export interface ISieveResponse<T = unknown> {
2
+ totalCount?: number;
3
+ data: T[];
4
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sieve sort interface
3
+ */
4
+ export interface ISieveSort {
5
+ desc?: boolean;
6
+ name: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface ITokenSettings {
2
+ tokenType: string;
3
+ token: string;
4
+ expiration?: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ export interface ITransformMatrix {
2
+ x: number;
3
+ y: number;
4
+ z?: number;
5
+ }
@@ -0,0 +1,117 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
3
+ import { AssetsI18nLoaderService } from './services/translation/assets-i18n-loader.service';
4
+
5
+ /*
6
+ * Public API Surface of core
7
+ */
8
+
9
+ /**
10
+ * Services
11
+ */
12
+ export * from './services/api.service';
13
+ export * from './services/mosa-socket.service';
14
+ export * from './services/core-logger.service';
15
+ export * from './services/translation/translate-collector.service';
16
+ export * from './services/translation/custom-translate-loader.service';
17
+
18
+ /**
19
+ * Guards
20
+ */
21
+ export * from './services/guards/can-deactivate.guard';
22
+
23
+ /**
24
+ * Models
25
+ */
26
+ export * from './models/dictionary-item.model';
27
+ export * from './models/api-options.model';
28
+ export * from './models/mosa-duration.model';
29
+ export * from './models/token-settings.model';
30
+ export * from './models/transform-matrix.model';
31
+ export * from './models/key-map.model';
32
+
33
+ export * from './models/sieve/sieve-response.model';
34
+ export * from './models/sieve/sieve-sort.model';
35
+ export * from './models/sieve/sieve-filter.model';
36
+ export * from './models/sieve/sieve-operator.model';
37
+ export * from './models/sieve/sieve-options.model';
38
+
39
+ export * from './models/logger/logger-config.model';
40
+ export * from './models/logger/log.model';
41
+ export * from './models/logger/log-event.model';
42
+ export * from './models/logger/log-message-data.model';
43
+ export * from './models/logger/logger-base-config.model';
44
+ export * from './models/logger/logger-default-config.model';
45
+ export * from './models/logger/log-type.model';
46
+
47
+ /**
48
+ * Utils
49
+ */
50
+ export * from './utils/dictionary.util';
51
+ export * from './utils/prototypes.util';
52
+ export * from './utils/sieve.util';
53
+ export * from './utils/size.util';
54
+ export * from './utils/promise.util';
55
+ export * from './utils/item.util';
56
+ export * from './utils/commons.util';
57
+ export * from './services/translation/assets-i18n-loader.service';
58
+
59
+ /**
60
+ * Enums
61
+ */
62
+ export * from './enums/theme.enum';
63
+ export * from './enums/content-position.enum';
64
+ export * from './enums/browser.enum';
65
+ export * from './enums/i18n-supported.enum';
66
+
67
+ /**
68
+ * Constants
69
+ */
70
+ export * from './constants/local-storage.constant';
71
+
72
+ /**
73
+ * Pipes
74
+ */
75
+ export * from './pipes/mosa-date-pipe/mosa-date-pipe.module';
76
+ export * from './pipes/mosa-date-pipe/mosa-date.pipe';
77
+
78
+ export * from './pipes/dictionary-item-pipe/dictionary-item-pipe.module';
79
+ export * from './pipes/dictionary-item-pipe/dictionary-item.pipe';
80
+
81
+ export * from './pipes/mosa-duration-pipe/mosa-duration-pipe.module';
82
+ export * from './pipes/mosa-duration-pipe/mosa-duration.pipe';
83
+
84
+ export * from './pipes/find-in-array/find-in-array-pipe.module';
85
+ export * from './pipes/find-in-array/find-in-array.pipe';
86
+
87
+ export * from './pipes/join/join-pipe.module';
88
+ export * from './pipes/join/join.pipe';
89
+
90
+
91
+ export function initI18n(i18n: AssetsI18nLoaderService): () => Promise<void> {
92
+ return () => i18n.init(null, null, 1);
93
+ }
94
+
95
+ export function initI18nCore(i18n: AssetsI18nLoaderService): () => Promise<void> {
96
+ return () => i18n.init(null, 'mosa');
97
+ }
98
+
99
+ @NgModule({
100
+ declarations: [],
101
+ imports: [
102
+ CommonModule,
103
+ ],
104
+ })
105
+ export class MosaCoreModule {
106
+
107
+ public static forRoot(): ModuleWithProviders<MosaCoreModule> {
108
+ return {
109
+ ngModule: MosaCoreModule,
110
+ providers: [
111
+ { provide: APP_INITIALIZER, useFactory: initI18n, deps: [ AssetsI18nLoaderService ], multi: true },
112
+ { provide: APP_INITIALIZER, useFactory: initI18nCore, deps: [ AssetsI18nLoaderService ], multi: true },
113
+ ],
114
+ };
115
+ }
116
+
117
+ }
@@ -0,0 +1,15 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
+ import { DictionaryItemPipe } from './dictionary-item.pipe';
4
+
5
+ @NgModule({
6
+ declarations: [ DictionaryItemPipe ],
7
+ imports: [
8
+ CommonModule,
9
+ ],
10
+ exports: [
11
+ DictionaryItemPipe,
12
+ ],
13
+ })
14
+ export class DictionaryItemPipeModule {
15
+ }
@@ -0,0 +1,14 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { Dictionary } from '../../utils/dictionary.util';
3
+
4
+ @Pipe({
5
+ name: 'dictionaryItem',
6
+ })
7
+ export class DictionaryItemPipe implements PipeTransform {
8
+
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ public transform(key: any, dictionary: Dictionary<any, any>): string {
11
+ return dictionary.get(key)?.value;
12
+ }
13
+
14
+ }
@@ -0,0 +1,17 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
+ import { FindInArrayPipe } from './find-in-array.pipe';
4
+
5
+ @NgModule({
6
+ declarations: [
7
+ FindInArrayPipe,
8
+ ],
9
+ imports: [
10
+ CommonModule,
11
+ ],
12
+ exports: [
13
+ FindInArrayPipe,
14
+ ],
15
+ })
16
+ export class FindInArrayPipeModule {
17
+ }
@@ -0,0 +1,8 @@
1
+ import { FindInArrayPipe } from './find-in-array.pipe';
2
+
3
+ describe('FindInArrayPipe', (): void => {
4
+ it('create an instance', (): void => {
5
+ const pipe: FindInArrayPipe = new FindInArrayPipe();
6
+ void expect(pipe).toBeTruthy();
7
+ });
8
+ });