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