@muraai/mnl-commons 0.1.0-alpha-a04cfbd → 0.1.0-alpha-0abf887

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 (72) hide show
  1. package/esm2020/lib/commons.module.mjs +140 -0
  2. package/esm2020/lib/components/header/header.component.mjs +32 -0
  3. package/esm2020/lib/components/highlighter/highlighter.component.mjs +24 -0
  4. package/esm2020/lib/components/language-menu/language-menu.component.mjs +36 -0
  5. package/esm2020/lib/components/login/login.component.mjs +56 -0
  6. package/esm2020/lib/components/menu/menu.component.mjs +69 -0
  7. package/esm2020/lib/components/profile/profile.component.mjs +44 -0
  8. package/esm2020/lib/material.module.mjs +60 -0
  9. package/{esm2015/lib/model/log-levels.model.js → esm2020/lib/model/log-levels.model.mjs} +0 -0
  10. package/{esm2015/lib/model/menu-data.model.js → esm2020/lib/model/menu-data.model.mjs} +0 -0
  11. package/{esm2015/lib/model/translation-resource.js → esm2020/lib/model/translation-resource.mjs} +0 -0
  12. package/{esm2015/lib/model/user-model.js → esm2020/lib/model/user-model.mjs} +0 -0
  13. package/esm2020/lib/pipes/app-config-pipe.mjs +20 -0
  14. package/esm2020/lib/pipes/time-ago-pipe.mjs +43 -0
  15. package/esm2020/lib/pipes/user-fullname-pipe.mjs +34 -0
  16. package/esm2020/lib/pipes/user-initials-pipe.mjs +48 -0
  17. package/esm2020/lib/services/app.config.service.mjs +41 -0
  18. package/esm2020/lib/services/local-storage.service.mjs +48 -0
  19. package/esm2020/lib/services/locale.service.mjs +89 -0
  20. package/esm2020/lib/services/log.service.mjs +89 -0
  21. package/esm2020/lib/services/user-profile.service.mjs +36 -0
  22. package/{esm2015/lib/utils/object-utils.js → esm2020/lib/utils/object-utils.mjs} +0 -0
  23. package/{esm2015/muraai-mnl-commons.js → esm2020/muraai-mnl-commons.mjs} +0 -0
  24. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  25. package/fesm2015/muraai-mnl-commons.mjs +914 -0
  26. package/fesm2015/muraai-mnl-commons.mjs.map +1 -0
  27. package/fesm2020/muraai-mnl-commons.mjs +911 -0
  28. package/fesm2020/muraai-mnl-commons.mjs.map +1 -0
  29. package/{muraai-mnl-commons.d.ts → index.d.ts} +1 -0
  30. package/lib/commons.module.d.ts +19 -0
  31. package/lib/components/header/header.component.d.ts +3 -0
  32. package/lib/components/highlighter/highlighter.component.d.ts +3 -0
  33. package/lib/components/language-menu/language-menu.component.d.ts +3 -0
  34. package/lib/components/login/login.component.d.ts +5 -2
  35. package/lib/components/menu/menu.component.d.ts +3 -0
  36. package/lib/components/profile/profile.component.d.ts +3 -0
  37. package/lib/material.module.d.ts +14 -2
  38. package/lib/pipes/app-config-pipe.d.ts +3 -0
  39. package/lib/pipes/time-ago-pipe.d.ts +3 -0
  40. package/lib/pipes/user-fullname-pipe.d.ts +3 -0
  41. package/lib/pipes/user-initials-pipe.d.ts +3 -0
  42. package/lib/services/app.config.service.d.ts +3 -0
  43. package/lib/services/local-storage.service.d.ts +7 -0
  44. package/lib/services/locale.service.d.ts +3 -0
  45. package/lib/services/log.service.d.ts +4 -1
  46. package/lib/services/user-profile.service.d.ts +3 -0
  47. package/package.json +22 -10
  48. package/theming.scss +6 -6
  49. package/bundles/muraai-mnl-commons.umd.js +0 -1270
  50. package/bundles/muraai-mnl-commons.umd.js.map +0 -1
  51. package/bundles/muraai-mnl-commons.umd.min.js +0 -17
  52. package/bundles/muraai-mnl-commons.umd.min.js.map +0 -1
  53. package/esm2015/lib/commons.module.js +0 -104
  54. package/esm2015/lib/components/header/header.component.js +0 -27
  55. package/esm2015/lib/components/highlighter/highlighter.component.js +0 -21
  56. package/esm2015/lib/components/language-menu/language-menu.component.js +0 -35
  57. package/esm2015/lib/components/login/login.component.js +0 -48
  58. package/esm2015/lib/components/menu/menu.component.js +0 -62
  59. package/esm2015/lib/components/profile/profile.component.js +0 -35
  60. package/esm2015/lib/material.module.js +0 -31
  61. package/esm2015/lib/pipes/app-config-pipe.js +0 -19
  62. package/esm2015/lib/pipes/time-ago-pipe.js +0 -43
  63. package/esm2015/lib/pipes/user-fullname-pipe.js +0 -30
  64. package/esm2015/lib/pipes/user-initials-pipe.js +0 -44
  65. package/esm2015/lib/services/app.config.service.js +0 -44
  66. package/esm2015/lib/services/local-storage.service.js +0 -17
  67. package/esm2015/lib/services/locale.service.js +0 -94
  68. package/esm2015/lib/services/log.service.js +0 -91
  69. package/esm2015/lib/services/user-profile.service.js +0 -40
  70. package/fesm2015/muraai-mnl-commons.js +0 -813
  71. package/fesm2015/muraai-mnl-commons.js.map +0 -1
  72. package/muraai-mnl-commons.metadata.json +0 -1
@@ -0,0 +1,911 @@
1
+ import * as i0 from '@angular/core';
2
+ import { NgModule, EventEmitter, Component, ViewEncapsulation, Input, Output, Injectable, Inject, Pipe, InjectionToken, APP_INITIALIZER } from '@angular/core';
3
+ import * as i4 from '@angular/material/button';
4
+ import { MatButtonModule } from '@angular/material/button';
5
+ import * as i5$2 from '@angular/material/list';
6
+ import { MatListModule } from '@angular/material/list';
7
+ import * as i5 from '@angular/material/icon';
8
+ import { MatIconModule } from '@angular/material/icon';
9
+ import * as i7 from '@angular/material/input';
10
+ import { MatInputModule } from '@angular/material/input';
11
+ import * as i6 from '@angular/material/form-field';
12
+ import { MatFormFieldModule } from '@angular/material/form-field';
13
+ import * as i5$1 from '@angular/material/card';
14
+ import { MatCardModule } from '@angular/material/card';
15
+ import * as i8 from '@angular/forms';
16
+ import { FormsModule, ReactiveFormsModule, UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
17
+ import * as i4$1 from '@angular/material/menu';
18
+ import { MatMenuModule } from '@angular/material/menu';
19
+ import * as i1 from '@angular/common';
20
+ import { DOCUMENT, DatePipe, registerLocaleData, CommonModule } from '@angular/common';
21
+ import * as i1$1 from '@angular/common/http';
22
+ import { HttpClient } from '@angular/common/http';
23
+ import localeAR from '@angular/common/locales/ar';
24
+ import localeDE from '@angular/common/locales/de';
25
+ import localeFR from '@angular/common/locales/fr';
26
+ import { FlexLayoutModule } from '@angular/flex-layout';
27
+ import * as i2 from '@angular/material/toolbar';
28
+ import { MatToolbarModule } from '@angular/material/toolbar';
29
+ import * as i2$2 from '@ngx-translate/core';
30
+ import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
31
+ import * as i3 from '@angular/flex-layout/flex';
32
+ import * as i2$1 from '@angular/flex-layout/extended';
33
+ import * as i1$2 from '@angular/platform-browser';
34
+ import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
35
+ import { formatDistance } from 'date-fns';
36
+ import differenceInDays from 'date-fns/differenceInDays';
37
+ import { Subject } from 'rxjs';
38
+
39
+ function modules() {
40
+ return [
41
+ MatButtonModule,
42
+ MatCardModule,
43
+ MatFormFieldModule,
44
+ MatIconModule,
45
+ MatInputModule,
46
+ MatListModule,
47
+ FormsModule,
48
+ ReactiveFormsModule,
49
+ MatMenuModule,
50
+ ];
51
+ }
52
+ class MaterialModule {
53
+ }
54
+ MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
55
+ MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, imports: [MatButtonModule,
56
+ MatCardModule,
57
+ MatFormFieldModule,
58
+ MatIconModule,
59
+ MatInputModule,
60
+ MatListModule,
61
+ FormsModule,
62
+ ReactiveFormsModule,
63
+ MatMenuModule], exports: [MatButtonModule,
64
+ MatCardModule,
65
+ MatFormFieldModule,
66
+ MatIconModule,
67
+ MatInputModule,
68
+ MatListModule,
69
+ FormsModule,
70
+ ReactiveFormsModule,
71
+ MatMenuModule] });
72
+ MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, imports: [modules(), MatButtonModule,
73
+ MatCardModule,
74
+ MatFormFieldModule,
75
+ MatIconModule,
76
+ MatInputModule,
77
+ MatListModule,
78
+ FormsModule,
79
+ ReactiveFormsModule,
80
+ MatMenuModule] });
81
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MaterialModule, decorators: [{
82
+ type: NgModule,
83
+ args: [{
84
+ imports: modules(),
85
+ exports: modules()
86
+ }]
87
+ }] });
88
+
89
+ class HeaderComponent {
90
+ constructor() {
91
+ this.menuButonClickEvent = new EventEmitter();
92
+ this.logoClick = new EventEmitter();
93
+ }
94
+ menuClick(event) {
95
+ this.menuButonClickEvent.emit(event);
96
+ }
97
+ onLogoClick(event) {
98
+ this.logoClick.emit(event);
99
+ }
100
+ }
101
+ HeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
102
+ HeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: HeaderComponent, selector: "mnl-header", inputs: { header: "header" }, outputs: { menuButonClickEvent: "menuButonClickEvent", logoClick: "logoClick" }, ngImport: i0, template: "<mat-toolbar *ngIf=\"header\" color=\"{{ header.toolbarColor }}\">\n <mat-toolbar-row>\n <div fxLayout fxLayoutAlign=\"start center\">\n <button mat-icon-button *ngIf=\"header.showMenuIcon\">\n <mat-icon (click)=\"menuClick($event)\">menu</mat-icon>\n </button>\n <img\n class=\"mnl-logo\"\n (click)=\"onLogoClick($event)\"\n src=\"{{ header.logo }}\"\n />\n <span>{{ header.name }}</span>\n </div>\n <div fxLayoutAlign=\"end center\" fxFlex>\n <ng-content select=\"`[mnl-header-content]`\"></ng-content>\n </div>\n </mat-toolbar-row>\n</mat-toolbar>\n", styles: [".mnl-logo{margin-right:15px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i2.MatToolbarRow, selector: "mat-toolbar-row", exportAs: ["matToolbarRow"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], encapsulation: i0.ViewEncapsulation.None });
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HeaderComponent, decorators: [{
104
+ type: Component,
105
+ args: [{ selector: 'mnl-header', encapsulation: ViewEncapsulation.None, template: "<mat-toolbar *ngIf=\"header\" color=\"{{ header.toolbarColor }}\">\n <mat-toolbar-row>\n <div fxLayout fxLayoutAlign=\"start center\">\n <button mat-icon-button *ngIf=\"header.showMenuIcon\">\n <mat-icon (click)=\"menuClick($event)\">menu</mat-icon>\n </button>\n <img\n class=\"mnl-logo\"\n (click)=\"onLogoClick($event)\"\n src=\"{{ header.logo }}\"\n />\n <span>{{ header.name }}</span>\n </div>\n <div fxLayoutAlign=\"end center\" fxFlex>\n <ng-content select=\"`[mnl-header-content]`\"></ng-content>\n </div>\n </mat-toolbar-row>\n</mat-toolbar>\n", styles: [".mnl-logo{margin-right:15px}\n"] }]
106
+ }], propDecorators: { header: [{
107
+ type: Input
108
+ }], menuButonClickEvent: [{
109
+ type: Output
110
+ }], logoClick: [{
111
+ type: Output
112
+ }] } });
113
+
114
+ class HighlighterComponent {
115
+ constructor() {
116
+ this.height = '40px';
117
+ this.width = '4px';
118
+ this.enabled = true;
119
+ }
120
+ }
121
+ HighlighterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HighlighterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
122
+ HighlighterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: HighlighterComponent, selector: "mnl-highlighter", inputs: { height: "height", width: "width", enabled: "enabled" }, ngImport: i0, template: "<div [ngClass]=\"{'mnl-bg-primary' : enabled}\" [ngStyle]=\" {'height': height, 'width' : width}\"></div>", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i2$1.DefaultStyleDirective, selector: " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }] });
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: HighlighterComponent, decorators: [{
124
+ type: Component,
125
+ args: [{ selector: 'mnl-highlighter', template: "<div [ngClass]=\"{'mnl-bg-primary' : enabled}\" [ngStyle]=\" {'height': height, 'width' : width}\"></div>" }]
126
+ }], propDecorators: { height: [{
127
+ type: Input
128
+ }], width: [{
129
+ type: Input
130
+ }], enabled: [{
131
+ type: Input
132
+ }] } });
133
+
134
+ class ObjectUtils {
135
+ /**
136
+ * Gets a value from an object by composed key
137
+ * ObjectUtils.getValue({ item: { nodeType: 'cm:folder' }}, 'item.nodeType') ==> 'cm:folder'
138
+ */
139
+ static getValue(target, key) {
140
+ if (!target) {
141
+ return undefined;
142
+ }
143
+ const keys = key.split('.');
144
+ key = '';
145
+ do {
146
+ key += keys.shift();
147
+ const value = target[key];
148
+ if (value !== undefined && (typeof value === 'object' || !keys.length)) {
149
+ target = value;
150
+ key = '';
151
+ }
152
+ else if (!keys.length) {
153
+ target = undefined;
154
+ }
155
+ else {
156
+ key += '.';
157
+ }
158
+ } while (keys.length);
159
+ return target;
160
+ }
161
+ static merge(...objects) {
162
+ const result = {};
163
+ objects.forEach((source) => {
164
+ Object.keys(source).forEach((prop) => {
165
+ if (prop in result && Array.isArray(result[prop])) {
166
+ result[prop] = result[prop].concat(source[prop]);
167
+ }
168
+ else if (prop in result && typeof result[prop] === 'object') {
169
+ result[prop] = ObjectUtils.merge(result[prop], source[prop]);
170
+ }
171
+ else {
172
+ result[prop] = source[prop];
173
+ }
174
+ });
175
+ });
176
+ return result;
177
+ }
178
+ }
179
+
180
+ class AppConfigService {
181
+ constructor(http) {
182
+ this.http = http;
183
+ this.config = null;
184
+ }
185
+ /**
186
+ * Use to get the data found in the file (config file)
187
+ */
188
+ get(key, defaultValue) {
189
+ const result = ObjectUtils.getValue(this.config, key);
190
+ return (result === undefined ? defaultValue : result);
191
+ }
192
+ /**
193
+ * This method:
194
+ * Loads "config.json" to get all variables (e.g.: 'app.config.json')
195
+ */
196
+ load() {
197
+ return new Promise(async (resolve) => {
198
+ const configUrl = `assets/app.config.json`;
199
+ await this.http.get(configUrl).subscribe((data) => {
200
+ this.config = Object.assign({}, this.config, data || {});
201
+ resolve(this.config);
202
+ }, () => {
203
+ resolve(this.config);
204
+ });
205
+ });
206
+ }
207
+ }
208
+ AppConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AppConfigService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
209
+ AppConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AppConfigService, providedIn: 'root' });
210
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AppConfigService, decorators: [{
211
+ type: Injectable,
212
+ args: [{
213
+ providedIn: 'root',
214
+ }]
215
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
216
+
217
+ class LocalStorageService {
218
+ constructor() {
219
+ this.memoryStore = {};
220
+ this.useLocalStorage = false;
221
+ this.useLocalStorage = this.isStorageAvailable('localStorage');
222
+ }
223
+ set(key, value) {
224
+ if (this.useLocalStorage) {
225
+ localStorage.setItem(key, value);
226
+ }
227
+ else {
228
+ this.memoryStore[key] = value;
229
+ }
230
+ }
231
+ get(key) {
232
+ if (this.useLocalStorage) {
233
+ return localStorage.getItem(key);
234
+ }
235
+ else {
236
+ return this.memoryStore.hasOwnProperty(key)
237
+ ? this.memoryStore[key]
238
+ : null;
239
+ }
240
+ }
241
+ isStorageAvailable(type) {
242
+ try {
243
+ const storage = window[type];
244
+ const key = '__storage_test__';
245
+ storage.setItem(key, key);
246
+ storage.removeItem(key, key);
247
+ return true;
248
+ }
249
+ catch (e) {
250
+ return false;
251
+ }
252
+ }
253
+ }
254
+ LocalStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
255
+ LocalStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LocalStorageService, providedIn: 'root' });
256
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LocalStorageService, decorators: [{
257
+ type: Injectable,
258
+ args: [{
259
+ providedIn: 'root',
260
+ }]
261
+ }], ctorParameters: function () { return []; } });
262
+
263
+ class UserProfileService {
264
+ constructor(appConfigService, localStorageService) {
265
+ this.appConfigService = appConfigService;
266
+ this.localStorageService = localStorageService;
267
+ this.userPrefix = '';
268
+ }
269
+ getApplicationId() {
270
+ return this.appConfigService.get('applicationId') ? this.appConfigService.get('applicationId') : '';
271
+ }
272
+ setUserPrefix(userPrefix) {
273
+ this.userPrefix = userPrefix;
274
+ }
275
+ getUserPrefix() {
276
+ return this.userPrefix ? this.userPrefix : '';
277
+ }
278
+ setLocale(locale) {
279
+ this.localStorageService.set(this.getApplicationId() + this.userPrefix + UserProfileService.LOCALE_PREFIX, locale);
280
+ }
281
+ getLocale() {
282
+ return this.localStorageService.get(this.getApplicationId() + this.userPrefix + UserProfileService.LOCALE_PREFIX);
283
+ }
284
+ }
285
+ UserProfileService.LOCALE_PREFIX = '____locale';
286
+ UserProfileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserProfileService, deps: [{ token: AppConfigService }, { token: LocalStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
287
+ UserProfileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserProfileService, providedIn: 'root' });
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserProfileService, decorators: [{
289
+ type: Injectable,
290
+ args: [{
291
+ providedIn: 'root'
292
+ }]
293
+ }], ctorParameters: function () { return [{ type: AppConfigService }, { type: LocalStorageService }]; } });
294
+
295
+ /** @dynamic */
296
+ class LocaleService {
297
+ constructor(config, translate, userProfileService, document) {
298
+ this.config = config;
299
+ this.translate = translate;
300
+ this.userProfileService = userProfileService;
301
+ this.document = document;
302
+ this.languages = [];
303
+ this.initUserLanguage();
304
+ }
305
+ initUserLanguage() {
306
+ this.setActiveLocale(this.getActiveLocale() || this.getDefaultLocale());
307
+ }
308
+ setTextOrientation(direction) {
309
+ document.body.setAttribute('dir', direction);
310
+ }
311
+ getTextOrientation() {
312
+ return document.body.getAttribute('dir');
313
+ }
314
+ getLanguages() {
315
+ this.languages = this.config.get('languages');
316
+ if (!this.languages) {
317
+ this.languages = [
318
+ {
319
+ key: 'fr',
320
+ label: 'French',
321
+ direction: 'ltr',
322
+ },
323
+ {
324
+ key: 'de',
325
+ label: 'German',
326
+ direction: 'ltr',
327
+ },
328
+ {
329
+ key: 'en',
330
+ label: 'English',
331
+ direction: 'ltr',
332
+ },
333
+ {
334
+ key: 'ar',
335
+ label: 'Arabic',
336
+ direction: 'rtl',
337
+ },
338
+ ];
339
+ }
340
+ return this.languages;
341
+ }
342
+ getDefaultLocale() {
343
+ this.locale = this.userProfileService.getLocale();
344
+ if (!this.locale) {
345
+ this.locale = this.config.get('locale')
346
+ ? this.config.get('locale')
347
+ : this.translate.getBrowserLang()
348
+ ? this.translate.getBrowserLang()
349
+ : 'en';
350
+ }
351
+ return this.getLanguages().find((e) => e.key === this.locale);
352
+ }
353
+ getActiveLocale() {
354
+ if (this.userProfileService.getLocale()) {
355
+ return this.getLanguages().find((e) => e.key === this.userProfileService.getLocale());
356
+ }
357
+ }
358
+ setActiveLocale(locale) {
359
+ if (locale) {
360
+ this.translate.use(locale.key);
361
+ this.setTextOrientation(locale.direction);
362
+ this.userProfileService.setLocale(locale.key);
363
+ }
364
+ }
365
+ }
366
+ LocaleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LocaleService, deps: [{ token: AppConfigService }, { token: i2$2.TranslateService }, { token: UserProfileService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
367
+ LocaleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LocaleService, providedIn: 'root' });
368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LocaleService, decorators: [{
369
+ type: Injectable,
370
+ args: [{
371
+ providedIn: 'root',
372
+ }]
373
+ }], ctorParameters: function () { return [{ type: AppConfigService }, { type: i2$2.TranslateService }, { type: UserProfileService }, { type: Document, decorators: [{
374
+ type: Inject,
375
+ args: [DOCUMENT]
376
+ }] }]; } });
377
+
378
+ class LanguageMenuComponent {
379
+ constructor(localeService) {
380
+ this.localeService = localeService;
381
+ this.showLocaleKeyAsLabel = false;
382
+ this.showLocaleAsLabel = false;
383
+ this.languages = [];
384
+ }
385
+ ngOnInit() {
386
+ this.languages = this.localeService.getLanguages();
387
+ this.localeService.setActiveLocale(this.locale);
388
+ }
389
+ onChangeLanguage(language) {
390
+ this.localeService.setActiveLocale(language);
391
+ }
392
+ get locale() {
393
+ return this.localeService.getActiveLocale() || this.localeService.getDefaultLocale();
394
+ }
395
+ }
396
+ LanguageMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LanguageMenuComponent, deps: [{ token: LocaleService }], target: i0.ɵɵFactoryTarget.Component });
397
+ LanguageMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: LanguageMenuComponent, selector: "mnl-language-menu", inputs: { showLocaleKeyAsLabel: "showLocaleKeyAsLabel", showLocaleAsLabel: "showLocaleAsLabel" }, ngImport: i0, template: "<button id=\"mnl-locale-button\" mat-menu-item [matMenuTriggerFor]=\"languageMenu\">\n <ng-container *ngIf=\"showLocaleKeyAsLabel || showLocaleAsLabel; else defaultLabel\">\n <div *ngIf=\"showLocaleKeyAsLabel\">{{ locale.key | uppercase }}</div>\n <div *ngIf=\"showLocaleAsLabel\">{{ locale.label }}</div>\n </ng-container>\n <ng-template #defaultLabel>\n <mat-icon>language</mat-icon>\n {{ \"MNL.LANGUAGE-SELECTOR.LANGUAGES\" | translate }}\n </ng-template>\n</button>\n<mat-menu #languageMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngFor=\"let language of languages\"\n (click)=\"onChangeLanguage(language)\"\n id=\"langMenu\"\n >\n {{ language.label }}\n </button>\n</mat-menu>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i4$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i2$2.TranslatePipe, name: "translate" }] });
398
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LanguageMenuComponent, decorators: [{
399
+ type: Component,
400
+ args: [{ selector: 'mnl-language-menu', template: "<button id=\"mnl-locale-button\" mat-menu-item [matMenuTriggerFor]=\"languageMenu\">\n <ng-container *ngIf=\"showLocaleKeyAsLabel || showLocaleAsLabel; else defaultLabel\">\n <div *ngIf=\"showLocaleKeyAsLabel\">{{ locale.key | uppercase }}</div>\n <div *ngIf=\"showLocaleAsLabel\">{{ locale.label }}</div>\n </ng-container>\n <ng-template #defaultLabel>\n <mat-icon>language</mat-icon>\n {{ \"MNL.LANGUAGE-SELECTOR.LANGUAGES\" | translate }}\n </ng-template>\n</button>\n<mat-menu #languageMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngFor=\"let language of languages\"\n (click)=\"onChangeLanguage(language)\"\n id=\"langMenu\"\n >\n {{ language.label }}\n </button>\n</mat-menu>\n" }]
401
+ }], ctorParameters: function () { return [{ type: LocaleService }]; }, propDecorators: { showLocaleKeyAsLabel: [{
402
+ type: Input
403
+ }], showLocaleAsLabel: [{
404
+ type: Input
405
+ }] } });
406
+
407
+ class LoginComponent {
408
+ constructor(sanitizer) {
409
+ this.sanitizer = sanitizer;
410
+ this.title = '';
411
+ this.logoImageUrl = './assets/images/logo.png';
412
+ this.backgroundImageUrl = './assets/images/background.jpg';
413
+ this.disabled = false;
414
+ this.login = new EventEmitter();
415
+ }
416
+ ngOnInit() {
417
+ this.initForm();
418
+ }
419
+ initForm() {
420
+ this.formGroup = new UntypedFormGroup({
421
+ username: new UntypedFormControl('', [Validators.required]),
422
+ password: new UntypedFormControl('', [Validators.required])
423
+ });
424
+ }
425
+ onSubmit() {
426
+ if (this.formGroup.valid) {
427
+ this.login.emit(this.formGroup.value);
428
+ }
429
+ }
430
+ getBackgroundImageUrl() {
431
+ return this.sanitizer.bypassSecurityTrustStyle(`url(${this.backgroundImageUrl})`);
432
+ }
433
+ }
434
+ LoginComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LoginComponent, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
435
+ LoginComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: LoginComponent, selector: "mnl-login", inputs: { title: "title", logoImageUrl: "logoImageUrl", backgroundImageUrl: "backgroundImageUrl", disabled: "disabled" }, outputs: { login: "login" }, ngImport: i0, template: "<div fxLayoutAlign=\"center center\" class=\"mnl-login-container\" fxFlexFill [style.background-image]=\"getBackgroundImageUrl()\">\n <mat-card class=\"mnl-login-card\">\n <form fxLayoutAlign=\"stretch\" fxLayout=\"column\" [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\n <mat-card-header fxLayoutAlign=\"center center\">\n <mat-card-title>\n <img *ngIf=\"logoImageUrl\" src=\"{{logoImageUrl}}\">\n </mat-card-title>\n </mat-card-header>\n <h3 fxLayoutAlign=\"center center\" class=\"mnl-login-title\" *ngIf=\"title\">{{title | translate}}</h3>\n <mat-form-field fxFlex=\"100\">\n <input id=\"username\" matInput placeholder=\"{{'MNL.LOGIN.USERNAME' | translate}}\"\n formControlName=\"username\">\n </mat-form-field>\n\n <mat-form-field fxFlex=\"100\">\n <input id=\"password\" matInput type=\"password\" placeholder=\"{{'MNL.LOGIN.PASSWORD' | translate}}\"\n formControlName=\"password\">\n </mat-form-field>\n <mat-card-actions fxLayoutAlign=\"center center\">\n <button id=\"loginButton\" mat-raised-button color=\"accent\" [disabled]=\"disabled || !formGroup.valid\"\n type=\"submit\"> {{'MNL.LOGIN.LOGIN_BUTTON' | translate}}</button>\n </mat-card-actions>\n\n </form>\n </mat-card>\n</div>", styles: [".mnl-login-card{min-width:260px}.mnl-login-container{background-size:cover}.mnl-login-title{opacity:.6}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i3.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "directive", type: i3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5$1.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "component", type: i5$1.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i5$1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i5$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i8.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i2$2.TranslatePipe, name: "translate" }] });
436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LoginComponent, decorators: [{
437
+ type: Component,
438
+ args: [{ selector: 'mnl-login', template: "<div fxLayoutAlign=\"center center\" class=\"mnl-login-container\" fxFlexFill [style.background-image]=\"getBackgroundImageUrl()\">\n <mat-card class=\"mnl-login-card\">\n <form fxLayoutAlign=\"stretch\" fxLayout=\"column\" [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\n <mat-card-header fxLayoutAlign=\"center center\">\n <mat-card-title>\n <img *ngIf=\"logoImageUrl\" src=\"{{logoImageUrl}}\">\n </mat-card-title>\n </mat-card-header>\n <h3 fxLayoutAlign=\"center center\" class=\"mnl-login-title\" *ngIf=\"title\">{{title | translate}}</h3>\n <mat-form-field fxFlex=\"100\">\n <input id=\"username\" matInput placeholder=\"{{'MNL.LOGIN.USERNAME' | translate}}\"\n formControlName=\"username\">\n </mat-form-field>\n\n <mat-form-field fxFlex=\"100\">\n <input id=\"password\" matInput type=\"password\" placeholder=\"{{'MNL.LOGIN.PASSWORD' | translate}}\"\n formControlName=\"password\">\n </mat-form-field>\n <mat-card-actions fxLayoutAlign=\"center center\">\n <button id=\"loginButton\" mat-raised-button color=\"accent\" [disabled]=\"disabled || !formGroup.valid\"\n type=\"submit\"> {{'MNL.LOGIN.LOGIN_BUTTON' | translate}}</button>\n </mat-card-actions>\n\n </form>\n </mat-card>\n</div>", styles: [".mnl-login-card{min-width:260px}.mnl-login-container{background-size:cover}.mnl-login-title{opacity:.6}\n"] }]
439
+ }], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }]; }, propDecorators: { title: [{
440
+ type: Input
441
+ }], logoImageUrl: [{
442
+ type: Input
443
+ }], backgroundImageUrl: [{
444
+ type: Input
445
+ }], disabled: [{
446
+ type: Input
447
+ }], login: [{
448
+ type: Output
449
+ }] } });
450
+
451
+ class MenuComponent {
452
+ constructor() {
453
+ this.menuClick = new EventEmitter();
454
+ }
455
+ onMenuClick(menu) {
456
+ if (this.hasSubMenu(menu)) {
457
+ this.openMenu(menu);
458
+ this.onSubMenuClick(menu.subMenus[0], menu);
459
+ }
460
+ else {
461
+ this.deSelectMenus(this.menuData);
462
+ this.selectMenu(menu);
463
+ this.menuClick.emit(menu);
464
+ }
465
+ }
466
+ onSubMenuClick(subMenu, menu) {
467
+ this.deSelectMenus(this.menuData);
468
+ this.selectMenu(menu);
469
+ this.selectMenu(subMenu);
470
+ this.menuClick.emit(subMenu);
471
+ }
472
+ deSelectMenus(menus) {
473
+ if (menus) {
474
+ for (const menu of menus) {
475
+ if (menu.selected) {
476
+ menu.selected = false;
477
+ }
478
+ this.deSelectMenus(menu.subMenus);
479
+ }
480
+ }
481
+ }
482
+ selectMenu(menu) {
483
+ if (menu) {
484
+ menu.selected = true;
485
+ }
486
+ }
487
+ hasSubMenu(menu) {
488
+ return menu.subMenus && menu.subMenus.length > 0;
489
+ }
490
+ toggleMenu(menu, event) {
491
+ menu.expanded = !menu.expanded;
492
+ if (event) {
493
+ event.stopPropagation();
494
+ }
495
+ }
496
+ openMenu(menu) {
497
+ menu.expanded = true;
498
+ }
499
+ }
500
+ MenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
501
+ MenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: MenuComponent, selector: "mnl-menu", inputs: { menuData: "menuData" }, outputs: { menuClick: "menuClick" }, ngImport: i0, template: "<mat-nav-list *ngFor=\"let menu of menuData\">\n <a mat-list-item fxLayout=\"row\" (click)=\"onMenuClick(menu)\" id=\"mnl-menu-anchor\">\n <mnl-highlighter [enabled]=\"menu.selected\"></mnl-highlighter>\n <mat-icon *ngIf=\"menu.icon; else svgTemplate \">{{menu.icon}}</mat-icon>\n <ng-template #svgTemplate>\n <mat-icon svgIcon=\"{{menu.svgIcon}}\"> </mat-icon>\n </ng-template>\n <span class=\"mnl-menu\" id=\"mnl-menu\">{{menu.name | translate }}</span>\n <mat-icon class=\"mnl-menu-button\" *ngIf=\"menu.subMenus\" (click)=\"toggleMenu(menu, $event)\"\n [ngClass]=\"{'mnl-rotated' : menu.expanded}\">expand_more</mat-icon>\n </a>\n <ng-container *ngFor=\"let sub of menu.subMenus\">\n <a mat-list-item fxLayout=\"row\" class=\"mnl-submenu\" [class.mnl-expanded]=\"menu.expanded\" *ngIf=\"menu.expanded\"\n (click)=\"onSubMenuClick(sub, menu)\" fxLayout=\"row\" id=\"mnl-submenu-anchor\">\n <mnl-highlighter [enabled]=\"sub.selected\"></mnl-highlighter>\n <mat-icon>{{sub.icon}}</mat-icon>\n <span class=\"mnl-menu\" id=\"mnl-submenu\">{{sub.name | translate }}</span>\n </a>\n </ng-container>\n</mat-nav-list>", styles: [".mnl-submenu{overflow-y:hidden;transition:transform .3s ease;transform:scaleY(0);transform-origin:top;padding-left:15px!important}.mnl-submenu.mnl-expanded{transform:scaleY(1)}.mnl-menu{margin-top:5px;margin-left:10px;margin-right:10px}.mnl-menu-button{transition:.3s ease-in-out;transform:rotate(0);margin-top:3px;margin-left:25px}.mnl-menu-button.mnl-rotated{transform:rotate(180deg)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i2$1.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$2.MatNavList, selector: "mat-nav-list", inputs: ["disableRipple", "disabled"], exportAs: ["matNavList"] }, { kind: "component", type: i5$2.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["disableRipple", "disabled"], exportAs: ["matListItem"] }, { kind: "component", type: HighlighterComponent, selector: "mnl-highlighter", inputs: ["height", "width", "enabled"] }, { kind: "pipe", type: i2$2.TranslatePipe, name: "translate" }] });
502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MenuComponent, decorators: [{
503
+ type: Component,
504
+ args: [{ selector: 'mnl-menu', template: "<mat-nav-list *ngFor=\"let menu of menuData\">\n <a mat-list-item fxLayout=\"row\" (click)=\"onMenuClick(menu)\" id=\"mnl-menu-anchor\">\n <mnl-highlighter [enabled]=\"menu.selected\"></mnl-highlighter>\n <mat-icon *ngIf=\"menu.icon; else svgTemplate \">{{menu.icon}}</mat-icon>\n <ng-template #svgTemplate>\n <mat-icon svgIcon=\"{{menu.svgIcon}}\"> </mat-icon>\n </ng-template>\n <span class=\"mnl-menu\" id=\"mnl-menu\">{{menu.name | translate }}</span>\n <mat-icon class=\"mnl-menu-button\" *ngIf=\"menu.subMenus\" (click)=\"toggleMenu(menu, $event)\"\n [ngClass]=\"{'mnl-rotated' : menu.expanded}\">expand_more</mat-icon>\n </a>\n <ng-container *ngFor=\"let sub of menu.subMenus\">\n <a mat-list-item fxLayout=\"row\" class=\"mnl-submenu\" [class.mnl-expanded]=\"menu.expanded\" *ngIf=\"menu.expanded\"\n (click)=\"onSubMenuClick(sub, menu)\" fxLayout=\"row\" id=\"mnl-submenu-anchor\">\n <mnl-highlighter [enabled]=\"sub.selected\"></mnl-highlighter>\n <mat-icon>{{sub.icon}}</mat-icon>\n <span class=\"mnl-menu\" id=\"mnl-submenu\">{{sub.name | translate }}</span>\n </a>\n </ng-container>\n</mat-nav-list>", styles: [".mnl-submenu{overflow-y:hidden;transition:transform .3s ease;transform:scaleY(0);transform-origin:top;padding-left:15px!important}.mnl-submenu.mnl-expanded{transform:scaleY(1)}.mnl-menu{margin-top:5px;margin-left:10px;margin-right:10px}.mnl-menu-button{transition:.3s ease-in-out;transform:rotate(0);margin-top:3px;margin-left:25px}.mnl-menu-button.mnl-rotated{transform:rotate(180deg)}\n"] }]
505
+ }], propDecorators: { menuData: [{
506
+ type: Input
507
+ }], menuClick: [{
508
+ type: Output
509
+ }] } });
510
+
511
+ class UserInitialPipe {
512
+ transform(value) {
513
+ let userInitials = '';
514
+ if (!this.isEmptyObject(value)) {
515
+ if (value.firstName && value.lastName) {
516
+ userInitials = value.firstName.substring(0, 1).toUpperCase() + value.lastName.substring(0, 1).toUpperCase();
517
+ }
518
+ else if (!value.firstName && value.lastName) {
519
+ userInitials = this.getUserInitials(value.lastName);
520
+ }
521
+ else if (value.firstName && !value.lastName) {
522
+ userInitials = this.getUserInitials(value.firstName);
523
+ }
524
+ else if (!value.firstName && !value.lastName) {
525
+ userInitials = value.email.substring(0, 1).toUpperCase();
526
+ }
527
+ }
528
+ return userInitials;
529
+ }
530
+ isEmptyObject(data) {
531
+ return (data && (Object.keys(data).length === 0));
532
+ }
533
+ getUserInitials(name) {
534
+ let userInitial = '';
535
+ if (this.hasWhiteSpace(name.trim())) {
536
+ const data = name.split(/\s+/);
537
+ userInitial = data[0].substring(0, 1).toUpperCase() + data[1].substring(0, 1).toUpperCase();
538
+ }
539
+ else {
540
+ userInitial = name.trim().substring(0, 1).toUpperCase();
541
+ }
542
+ return userInitial;
543
+ }
544
+ hasWhiteSpace(data) {
545
+ return /\s/g.test(data);
546
+ }
547
+ }
548
+ UserInitialPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserInitialPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
549
+ UserInitialPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: UserInitialPipe, name: "mnlUserInitialPipe" });
550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserInitialPipe, decorators: [{
551
+ type: Pipe,
552
+ args: [{
553
+ name: 'mnlUserInitialPipe'
554
+ }]
555
+ }] });
556
+
557
+ class UserFullnamePipe {
558
+ transform(value) {
559
+ let fullName = '';
560
+ if (!this.isEmptyObject(value)) {
561
+ if (value.firstName && value.lastName) {
562
+ fullName = value.firstName + ' ' + value.lastName;
563
+ }
564
+ else if (!value.firstName && value.lastName) {
565
+ fullName = value.lastName;
566
+ }
567
+ else if (value.firstName && !value.lastName) {
568
+ fullName = value.firstName;
569
+ }
570
+ else if (!value.firstName && !value.lastName) {
571
+ fullName = value.email;
572
+ }
573
+ }
574
+ return fullName;
575
+ }
576
+ isEmptyObject(data) {
577
+ return (data && (Object.keys(data).length === 0));
578
+ }
579
+ }
580
+ UserFullnamePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserFullnamePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
581
+ UserFullnamePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: UserFullnamePipe, name: "mnlUserFullName" });
582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: UserFullnamePipe, decorators: [{
583
+ type: Pipe,
584
+ args: [{
585
+ name: 'mnlUserFullName'
586
+ }]
587
+ }] });
588
+
589
+ class ProfileComponent {
590
+ constructor() {
591
+ this.showDisplayName = true;
592
+ this.userInitialClick = new EventEmitter();
593
+ this.profileMenuClick = new EventEmitter();
594
+ }
595
+ onUserInitialClick(event) {
596
+ this.userInitialClick.emit(event);
597
+ }
598
+ ngOnChanges(changes) {
599
+ if (changes && changes.userProfileDetails && changes.userProfileDetails.currentValue
600
+ && changes.userProfileDetails.currentValue.firstName && changes.userProfileDetails.currentValue.lastName
601
+ && changes.userProfileDetails.currentValue.email) {
602
+ this.hasUserDetails = true;
603
+ }
604
+ else {
605
+ this.hasUserDetails = false;
606
+ }
607
+ }
608
+ }
609
+ ProfileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ProfileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
610
+ ProfileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ProfileComponent, selector: "mnl-user-profile", inputs: { userProfileDetails: "userProfileDetails", showDisplayName: "showDisplayName" }, outputs: { userInitialClick: "userInitialClick", profileMenuClick: "profileMenuClick" }, usesOnChanges: true, ngImport: i0, template: "<div id=\"mnl-profile-container\" fxLayoutGap=\"10px\">\n <span\n *ngIf=\"showDisplayName && hasUserDetails\"\n id=\"mnl-userinfo-name\"\n fxHide.xs\n >{{ userProfileDetails | mnlUserFullName }}</span\n >\n <button\n *ngIf=\"hasUserDetails\"\n id=\"mnl-initials-button\"\n mat-raised-button\n (click)=\"onUserInitialClick($event)\"\n mat-icon-button\n >\n {{ userProfileDetails | mnlUserInitialPipe }}\n </button>\n\n <button\n *ngIf=\"!hasUserDetails\"\n id=\"mnl-user-icon-button\"\n mat-raised-button\n (click)=\"onUserInitialClick($event)\"\n mat-icon-button\n >\n <mat-icon>person</mat-icon>\n </button>\n</div>\n", styles: ["#mnl-initials-button{border-radius:20px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i2$1.DefaultShowHideDirective, selector: " [fxShow], [fxShow.print], [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl], [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl], [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg], [fxHide], [fxHide.print], [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl], [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl], [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]", inputs: ["fxShow", "fxShow.print", "fxShow.xs", "fxShow.sm", "fxShow.md", "fxShow.lg", "fxShow.xl", "fxShow.lt-sm", "fxShow.lt-md", "fxShow.lt-lg", "fxShow.lt-xl", "fxShow.gt-xs", "fxShow.gt-sm", "fxShow.gt-md", "fxShow.gt-lg", "fxHide", "fxHide.print", "fxHide.xs", "fxHide.sm", "fxHide.md", "fxHide.lg", "fxHide.xl", "fxHide.lt-sm", "fxHide.lt-md", "fxHide.lt-lg", "fxHide.lt-xl", "fxHide.gt-xs", "fxHide.gt-sm", "fxHide.gt-md", "fxHide.gt-lg"] }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: UserInitialPipe, name: "mnlUserInitialPipe" }, { kind: "pipe", type: UserFullnamePipe, name: "mnlUserFullName" }] });
611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ProfileComponent, decorators: [{
612
+ type: Component,
613
+ args: [{ selector: 'mnl-user-profile', template: "<div id=\"mnl-profile-container\" fxLayoutGap=\"10px\">\n <span\n *ngIf=\"showDisplayName && hasUserDetails\"\n id=\"mnl-userinfo-name\"\n fxHide.xs\n >{{ userProfileDetails | mnlUserFullName }}</span\n >\n <button\n *ngIf=\"hasUserDetails\"\n id=\"mnl-initials-button\"\n mat-raised-button\n (click)=\"onUserInitialClick($event)\"\n mat-icon-button\n >\n {{ userProfileDetails | mnlUserInitialPipe }}\n </button>\n\n <button\n *ngIf=\"!hasUserDetails\"\n id=\"mnl-user-icon-button\"\n mat-raised-button\n (click)=\"onUserInitialClick($event)\"\n mat-icon-button\n >\n <mat-icon>person</mat-icon>\n </button>\n</div>\n", styles: ["#mnl-initials-button{border-radius:20px}\n"] }]
614
+ }], propDecorators: { userProfileDetails: [{
615
+ type: Input
616
+ }], showDisplayName: [{
617
+ type: Input
618
+ }], userInitialClick: [{
619
+ type: Output
620
+ }], profileMenuClick: [{
621
+ type: Output
622
+ }] } });
623
+
624
+ const MNL_TRANSLATION_RESOURCE = new InjectionToken('Translation Resource');
625
+ function translationLoaderFactory(http, resources) {
626
+ if (!resources) {
627
+ resources = [];
628
+ }
629
+ else if (!resources.length) {
630
+ resources = [resources];
631
+ }
632
+ resources.push({ prefix: './assets/mnl-commons/i18n/', suffix: '.json' });
633
+ return new MultiTranslateHttpLoader(http, resources);
634
+ }
635
+
636
+ class AppConfigPipe {
637
+ constructor(config) {
638
+ this.config = config;
639
+ }
640
+ transform(value, defaultValue) {
641
+ return this.config.get(value) || defaultValue || '';
642
+ }
643
+ }
644
+ AppConfigPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AppConfigPipe, deps: [{ token: AppConfigService }], target: i0.ɵɵFactoryTarget.Pipe });
645
+ AppConfigPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: AppConfigPipe, name: "mnlAppConfig" });
646
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AppConfigPipe, decorators: [{
647
+ type: Pipe,
648
+ args: [{
649
+ name: 'mnlAppConfig'
650
+ }]
651
+ }], ctorParameters: function () { return [{ type: AppConfigService }]; } });
652
+
653
+ class TimeAgoPipe {
654
+ constructor(appConfigService, userProfileService) {
655
+ this.appConfigService = appConfigService;
656
+ this.userProfileService = userProfileService;
657
+ this.defaultLocale = TimeAgoPipe.DEFAULT_LOCALE;
658
+ this.defaultDateTimeFormat = TimeAgoPipe.DEFAULT_DATE_TIME_FORMAT;
659
+ }
660
+ transform(value, dateTimeFormat, locale) {
661
+ if (value) {
662
+ const currentLocale = this.userProfileService.getLocale();
663
+ const currentDateTimeFormat = this.appConfigService.get('dateTimeFormat');
664
+ const requiredLocale = locale || currentLocale || this.defaultLocale;
665
+ const requiredDateTimeFormat = dateTimeFormat || currentDateTimeFormat || this.defaultDateTimeFormat;
666
+ if (differenceInDays(new Date(), new Date(value)) > 7) {
667
+ const datePipe = new DatePipe(requiredLocale);
668
+ return datePipe.transform(value, requiredDateTimeFormat);
669
+ }
670
+ return formatDistance(new Date(value), new Date(), {
671
+ includeSeconds: true,
672
+ addSuffix: true,
673
+ });
674
+ }
675
+ return '';
676
+ }
677
+ }
678
+ TimeAgoPipe.DEFAULT_LOCALE = 'en-US';
679
+ TimeAgoPipe.DEFAULT_DATE_TIME_FORMAT = 'dd/MM/yyyy HH:mm';
680
+ TimeAgoPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TimeAgoPipe, deps: [{ token: AppConfigService }, { token: UserProfileService }], target: i0.ɵɵFactoryTarget.Pipe });
681
+ TimeAgoPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: TimeAgoPipe, name: "mnlTimeAgo" });
682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: TimeAgoPipe, decorators: [{
683
+ type: Pipe,
684
+ args: [{
685
+ name: 'mnlTimeAgo',
686
+ }]
687
+ }], ctorParameters: function () { return [{ type: AppConfigService }, { type: UserProfileService }]; } });
688
+
689
+ class LogLevelsEnum extends Number {
690
+ }
691
+ LogLevelsEnum.TRACE = 5;
692
+ LogLevelsEnum.DEBUG = 1;
693
+ LogLevelsEnum.INFO = 2;
694
+ LogLevelsEnum.WARN = 3;
695
+ LogLevelsEnum.ERROR = 4;
696
+ LogLevelsEnum.SILENT = 0;
697
+ let logLevels = [
698
+ { level: LogLevelsEnum.TRACE, name: 'TRACE' },
699
+ { level: LogLevelsEnum.DEBUG, name: 'DEBUG' },
700
+ { level: LogLevelsEnum.INFO, name: 'INFO' },
701
+ { level: LogLevelsEnum.WARN, name: 'WARN' },
702
+ { level: LogLevelsEnum.ERROR, name: 'ERROR' },
703
+ { level: LogLevelsEnum.SILENT, name: 'SILENT' }
704
+ ];
705
+
706
+ /* eslint-disable no-console */
707
+ class LogService {
708
+ constructor(appConfigService) {
709
+ this.appConfigService = appConfigService;
710
+ this.onMessage = new Subject();
711
+ }
712
+ get currentLogLevel() {
713
+ const configLevel = this.appConfigService.get('logLevel');
714
+ if (configLevel) {
715
+ return this.getLogLevel(configLevel);
716
+ }
717
+ return LogLevelsEnum.ERROR;
718
+ }
719
+ error(message, ...optionalParams) {
720
+ if (this.currentLogLevel >= LogLevelsEnum.ERROR) {
721
+ this.messageBus(message, 'ERROR');
722
+ console.error(message, ...optionalParams);
723
+ }
724
+ }
725
+ debug(message, ...optionalParams) {
726
+ if (this.currentLogLevel >= LogLevelsEnum.DEBUG) {
727
+ this.messageBus(message, 'DEBUG');
728
+ console.debug(message, ...optionalParams);
729
+ }
730
+ }
731
+ info(message, ...optionalParams) {
732
+ if (this.currentLogLevel >= LogLevelsEnum.INFO) {
733
+ this.messageBus(message, 'INFO');
734
+ console.info(message, ...optionalParams);
735
+ }
736
+ }
737
+ log(message, ...optionalParams) {
738
+ if (this.currentLogLevel >= LogLevelsEnum.TRACE) {
739
+ this.messageBus(message, 'LOG');
740
+ console.log(message, ...optionalParams);
741
+ }
742
+ }
743
+ trace(message, ...optionalParams) {
744
+ if (this.currentLogLevel >= LogLevelsEnum.TRACE) {
745
+ this.messageBus(message, 'TRACE');
746
+ console.trace(message, ...optionalParams);
747
+ }
748
+ }
749
+ warn(message, ...optionalParams) {
750
+ if (this.currentLogLevel >= LogLevelsEnum.WARN) {
751
+ this.messageBus(message, 'WARN');
752
+ console.warn(message, ...optionalParams);
753
+ }
754
+ }
755
+ assert(test, message, ...optionalParams) {
756
+ if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
757
+ this.messageBus(message, 'ASSERT');
758
+ console.assert(test, message, ...optionalParams);
759
+ }
760
+ }
761
+ group(groupTitle, ...optionalParams) {
762
+ if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
763
+ console.group(groupTitle, ...optionalParams);
764
+ }
765
+ }
766
+ groupEnd() {
767
+ if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
768
+ console.groupEnd();
769
+ }
770
+ }
771
+ getLogLevel(level) {
772
+ const referencedLevel = logLevels.find((currentLevel) => {
773
+ return currentLevel.name.toLocaleLowerCase() === level.toLocaleLowerCase();
774
+ });
775
+ return referencedLevel ? referencedLevel.level : 4;
776
+ }
777
+ messageBus(message, logLevel) {
778
+ this.onMessage.next({ text: message, type: logLevel });
779
+ }
780
+ }
781
+ LogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LogService, deps: [{ token: AppConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
782
+ LogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LogService, providedIn: 'root' });
783
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: LogService, decorators: [{
784
+ type: Injectable,
785
+ args: [{
786
+ providedIn: 'root'
787
+ }]
788
+ }], ctorParameters: function () { return [{ type: AppConfigService }]; } });
789
+
790
+ registerLocaleData(localeFR);
791
+ registerLocaleData(localeDE);
792
+ registerLocaleData(localeAR);
793
+ class CommonsModule {
794
+ static forRoot() {
795
+ return {
796
+ ngModule: CommonsModule,
797
+ providers: [
798
+ {
799
+ provide: APP_INITIALIZER,
800
+ useFactory: loadConfig,
801
+ deps: [
802
+ AppConfigService,
803
+ UserProfileService,
804
+ LocalStorageService,
805
+ LogService,
806
+ LocaleService,
807
+ ],
808
+ multi: true,
809
+ },
810
+ ],
811
+ };
812
+ }
813
+ static forChild() {
814
+ return {
815
+ ngModule: CommonsModule,
816
+ };
817
+ }
818
+ }
819
+ CommonsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CommonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
820
+ CommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CommonsModule, declarations: [HeaderComponent,
821
+ MenuComponent,
822
+ HighlighterComponent,
823
+ AppConfigPipe,
824
+ LoginComponent,
825
+ LanguageMenuComponent,
826
+ ProfileComponent,
827
+ UserInitialPipe,
828
+ TimeAgoPipe,
829
+ UserFullnamePipe], imports: [CommonModule,
830
+ MatToolbarModule,
831
+ FlexLayoutModule,
832
+ MaterialModule, i2$2.TranslateModule], exports: [HeaderComponent,
833
+ MenuComponent,
834
+ HighlighterComponent,
835
+ AppConfigPipe,
836
+ LanguageMenuComponent,
837
+ LoginComponent,
838
+ ProfileComponent,
839
+ UserInitialPipe,
840
+ TimeAgoPipe,
841
+ UserFullnamePipe,
842
+ TranslateModule] });
843
+ CommonsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CommonsModule, imports: [CommonModule,
844
+ MatToolbarModule,
845
+ FlexLayoutModule,
846
+ MaterialModule,
847
+ TranslateModule.forRoot({
848
+ loader: {
849
+ provide: TranslateLoader,
850
+ useFactory: translationLoaderFactory,
851
+ deps: [HttpClient, MNL_TRANSLATION_RESOURCE],
852
+ },
853
+ }), TranslateModule] });
854
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CommonsModule, decorators: [{
855
+ type: NgModule,
856
+ args: [{
857
+ declarations: [
858
+ HeaderComponent,
859
+ MenuComponent,
860
+ HighlighterComponent,
861
+ AppConfigPipe,
862
+ LoginComponent,
863
+ LanguageMenuComponent,
864
+ ProfileComponent,
865
+ UserInitialPipe,
866
+ TimeAgoPipe,
867
+ UserFullnamePipe,
868
+ ],
869
+ imports: [
870
+ CommonModule,
871
+ MatToolbarModule,
872
+ FlexLayoutModule,
873
+ MaterialModule,
874
+ TranslateModule.forRoot({
875
+ loader: {
876
+ provide: TranslateLoader,
877
+ useFactory: translationLoaderFactory,
878
+ deps: [HttpClient, MNL_TRANSLATION_RESOURCE],
879
+ },
880
+ }),
881
+ ],
882
+ exports: [
883
+ HeaderComponent,
884
+ MenuComponent,
885
+ HighlighterComponent,
886
+ AppConfigPipe,
887
+ LanguageMenuComponent,
888
+ LoginComponent,
889
+ ProfileComponent,
890
+ UserInitialPipe,
891
+ TimeAgoPipe,
892
+ UserFullnamePipe,
893
+ TranslateModule,
894
+ ],
895
+ }]
896
+ }] });
897
+ function loadConfig(config) {
898
+ const conf = () => config.load();
899
+ return conf;
900
+ }
901
+
902
+ /*
903
+ * Public API Surface of mnl-commons
904
+ */
905
+
906
+ /**
907
+ * Generated bundle index. Do not edit.
908
+ */
909
+
910
+ export { AppConfigPipe, AppConfigService, CommonsModule, HeaderComponent, HighlighterComponent, LanguageMenuComponent, LocalStorageService, LocaleService, LogLevelsEnum, LogService, LoginComponent, MNL_TRANSLATION_RESOURCE, MaterialModule, MenuComponent, ProfileComponent, TimeAgoPipe, UserFullnamePipe, UserInitialPipe, UserProfileService, loadConfig, logLevels, modules, translationLoaderFactory };
911
+ //# sourceMappingURL=muraai-mnl-commons.mjs.map