@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
@@ -1,1270 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/button'), require('@angular/material/list'), require('@angular/material/icon'), require('@angular/material/input'), require('@angular/material/form-field'), require('@angular/material/card'), require('@angular/forms'), require('@angular/material/menu'), require('@angular/common'), require('@angular/common/http'), require('@angular/common/locales/ar'), require('@angular/common/locales/de'), require('@angular/common/locales/fr'), require('@angular/flex-layout'), require('@angular/material/toolbar'), require('@ngx-translate/core'), require('@angular/platform-browser'), require('ngx-translate-multi-http-loader'), require('date-fns'), require('date-fns/differenceInDays'), require('rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@muraai/mnl-commons', ['exports', '@angular/core', '@angular/material/button', '@angular/material/list', '@angular/material/icon', '@angular/material/input', '@angular/material/form-field', '@angular/material/card', '@angular/forms', '@angular/material/menu', '@angular/common', '@angular/common/http', '@angular/common/locales/ar', '@angular/common/locales/de', '@angular/common/locales/fr', '@angular/flex-layout', '@angular/material/toolbar', '@ngx-translate/core', '@angular/platform-browser', 'ngx-translate-multi-http-loader', 'date-fns', 'date-fns/differenceInDays', 'rxjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.muraai = global.muraai || {}, global.muraai['mnl-commons'] = {}), global.ng.core, global.ng.material.button, global.ng.material.list, global.ng.material.icon, global.ng.material.input, global.ng.material.formField, global.ng.material.card, global.ng.forms, global.ng.material.menu, global.ng.common, global.ng.common.http, global.ng.common.locales.ar, global.ng.common.locales.de, global.ng.common.locales.fr, global.ng.flexLayout, global.ng.material.toolbar, global.i2, global.ng.platformBrowser, global.ngxTranslateMultiHttpLoader, global.dateFns, global.differenceInDays, global.rxjs));
5
- }(this, (function (exports, i0, button, list, icon, input, formField, card, forms, menu, i4, i1, localeAR, localeDE, localeFR, flexLayout, toolbar, i2, platformBrowser, ngxTranslateMultiHttpLoader, dateFns, differenceInDays, rxjs) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () {
19
- return e[k];
20
- }
21
- });
22
- }
23
- });
24
- }
25
- n['default'] = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
31
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
32
- var localeAR__default = /*#__PURE__*/_interopDefaultLegacy(localeAR);
33
- var localeDE__default = /*#__PURE__*/_interopDefaultLegacy(localeDE);
34
- var localeFR__default = /*#__PURE__*/_interopDefaultLegacy(localeFR);
35
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
36
- var differenceInDays__default = /*#__PURE__*/_interopDefaultLegacy(differenceInDays);
37
-
38
- function modules() {
39
- return [
40
- button.MatButtonModule,
41
- card.MatCardModule,
42
- formField.MatFormFieldModule,
43
- icon.MatIconModule,
44
- input.MatInputModule,
45
- list.MatListModule,
46
- forms.FormsModule,
47
- forms.ReactiveFormsModule,
48
- menu.MatMenuModule,
49
- ];
50
- }
51
- var MaterialModule = /** @class */ (function () {
52
- function MaterialModule() {
53
- }
54
- return MaterialModule;
55
- }());
56
- MaterialModule.decorators = [
57
- { type: i0.NgModule, args: [{
58
- imports: modules(),
59
- exports: modules()
60
- },] }
61
- ];
62
-
63
- var HeaderComponent = /** @class */ (function () {
64
- function HeaderComponent() {
65
- this.menuButonClickEvent = new i0.EventEmitter();
66
- this.logoClick = new i0.EventEmitter();
67
- }
68
- HeaderComponent.prototype.menuClick = function (event) {
69
- this.menuButonClickEvent.emit(event);
70
- };
71
- HeaderComponent.prototype.onLogoClick = function (event) {
72
- this.logoClick.emit(event);
73
- };
74
- return HeaderComponent;
75
- }());
76
- HeaderComponent.decorators = [
77
- { type: i0.Component, args: [{
78
- selector: 'mnl-header',
79
- 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 class=\"mnl-logo\" (click)=\"onLogoClick($event)\" src=\"{{header.logo}}\">\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>",
80
- encapsulation: i0.ViewEncapsulation.None,
81
- styles: [".mnl-logo{margin-right:15px}"]
82
- },] }
83
- ];
84
- HeaderComponent.propDecorators = {
85
- header: [{ type: i0.Input }],
86
- menuButonClickEvent: [{ type: i0.Output }],
87
- logoClick: [{ type: i0.Output }]
88
- };
89
-
90
- var HighlighterComponent = /** @class */ (function () {
91
- function HighlighterComponent() {
92
- this.height = '40px';
93
- this.width = '4px';
94
- this.enabled = true;
95
- }
96
- return HighlighterComponent;
97
- }());
98
- HighlighterComponent.decorators = [
99
- { type: i0.Component, args: [{
100
- selector: 'mnl-highlighter',
101
- template: "<div [ngClass]=\"{'mnl-bg-primary' : enabled}\" [ngStyle]=\" {'height': height, 'width' : width}\"></div>",
102
- styles: [""]
103
- },] }
104
- ];
105
- HighlighterComponent.propDecorators = {
106
- height: [{ type: i0.Input }],
107
- width: [{ type: i0.Input }],
108
- enabled: [{ type: i0.Input }]
109
- };
110
-
111
- /*! *****************************************************************************
112
- Copyright (c) Microsoft Corporation.
113
-
114
- Permission to use, copy, modify, and/or distribute this software for any
115
- purpose with or without fee is hereby granted.
116
-
117
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
118
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
119
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
120
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
121
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
122
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
123
- PERFORMANCE OF THIS SOFTWARE.
124
- ***************************************************************************** */
125
- /* global Reflect, Promise */
126
- var extendStatics = function (d, b) {
127
- extendStatics = Object.setPrototypeOf ||
128
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
129
- function (d, b) { for (var p in b)
130
- if (Object.prototype.hasOwnProperty.call(b, p))
131
- d[p] = b[p]; };
132
- return extendStatics(d, b);
133
- };
134
- function __extends(d, b) {
135
- if (typeof b !== "function" && b !== null)
136
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
137
- extendStatics(d, b);
138
- function __() { this.constructor = d; }
139
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
140
- }
141
- var __assign = function () {
142
- __assign = Object.assign || function __assign(t) {
143
- for (var s, i = 1, n = arguments.length; i < n; i++) {
144
- s = arguments[i];
145
- for (var p in s)
146
- if (Object.prototype.hasOwnProperty.call(s, p))
147
- t[p] = s[p];
148
- }
149
- return t;
150
- };
151
- return __assign.apply(this, arguments);
152
- };
153
- function __rest(s, e) {
154
- var t = {};
155
- for (var p in s)
156
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
157
- t[p] = s[p];
158
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
159
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
160
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
161
- t[p[i]] = s[p[i]];
162
- }
163
- return t;
164
- }
165
- function __decorate(decorators, target, key, desc) {
166
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
167
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
168
- r = Reflect.decorate(decorators, target, key, desc);
169
- else
170
- for (var i = decorators.length - 1; i >= 0; i--)
171
- if (d = decorators[i])
172
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
173
- return c > 3 && r && Object.defineProperty(target, key, r), r;
174
- }
175
- function __param(paramIndex, decorator) {
176
- return function (target, key) { decorator(target, key, paramIndex); };
177
- }
178
- function __metadata(metadataKey, metadataValue) {
179
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
180
- return Reflect.metadata(metadataKey, metadataValue);
181
- }
182
- function __awaiter(thisArg, _arguments, P, generator) {
183
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
184
- return new (P || (P = Promise))(function (resolve, reject) {
185
- function fulfilled(value) { try {
186
- step(generator.next(value));
187
- }
188
- catch (e) {
189
- reject(e);
190
- } }
191
- function rejected(value) { try {
192
- step(generator["throw"](value));
193
- }
194
- catch (e) {
195
- reject(e);
196
- } }
197
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
198
- step((generator = generator.apply(thisArg, _arguments || [])).next());
199
- });
200
- }
201
- function __generator(thisArg, body) {
202
- var _ = { label: 0, sent: function () { if (t[0] & 1)
203
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
204
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
205
- function verb(n) { return function (v) { return step([n, v]); }; }
206
- function step(op) {
207
- if (f)
208
- throw new TypeError("Generator is already executing.");
209
- while (_)
210
- try {
211
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
212
- return t;
213
- if (y = 0, t)
214
- op = [op[0] & 2, t.value];
215
- switch (op[0]) {
216
- case 0:
217
- case 1:
218
- t = op;
219
- break;
220
- case 4:
221
- _.label++;
222
- return { value: op[1], done: false };
223
- case 5:
224
- _.label++;
225
- y = op[1];
226
- op = [0];
227
- continue;
228
- case 7:
229
- op = _.ops.pop();
230
- _.trys.pop();
231
- continue;
232
- default:
233
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
234
- _ = 0;
235
- continue;
236
- }
237
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
238
- _.label = op[1];
239
- break;
240
- }
241
- if (op[0] === 6 && _.label < t[1]) {
242
- _.label = t[1];
243
- t = op;
244
- break;
245
- }
246
- if (t && _.label < t[2]) {
247
- _.label = t[2];
248
- _.ops.push(op);
249
- break;
250
- }
251
- if (t[2])
252
- _.ops.pop();
253
- _.trys.pop();
254
- continue;
255
- }
256
- op = body.call(thisArg, _);
257
- }
258
- catch (e) {
259
- op = [6, e];
260
- y = 0;
261
- }
262
- finally {
263
- f = t = 0;
264
- }
265
- if (op[0] & 5)
266
- throw op[1];
267
- return { value: op[0] ? op[1] : void 0, done: true };
268
- }
269
- }
270
- var __createBinding = Object.create ? (function (o, m, k, k2) {
271
- if (k2 === undefined)
272
- k2 = k;
273
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
274
- }) : (function (o, m, k, k2) {
275
- if (k2 === undefined)
276
- k2 = k;
277
- o[k2] = m[k];
278
- });
279
- function __exportStar(m, o) {
280
- for (var p in m)
281
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
282
- __createBinding(o, m, p);
283
- }
284
- function __values(o) {
285
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
286
- if (m)
287
- return m.call(o);
288
- if (o && typeof o.length === "number")
289
- return {
290
- next: function () {
291
- if (o && i >= o.length)
292
- o = void 0;
293
- return { value: o && o[i++], done: !o };
294
- }
295
- };
296
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
297
- }
298
- function __read(o, n) {
299
- var m = typeof Symbol === "function" && o[Symbol.iterator];
300
- if (!m)
301
- return o;
302
- var i = m.call(o), r, ar = [], e;
303
- try {
304
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
305
- ar.push(r.value);
306
- }
307
- catch (error) {
308
- e = { error: error };
309
- }
310
- finally {
311
- try {
312
- if (r && !r.done && (m = i["return"]))
313
- m.call(i);
314
- }
315
- finally {
316
- if (e)
317
- throw e.error;
318
- }
319
- }
320
- return ar;
321
- }
322
- /** @deprecated */
323
- function __spread() {
324
- for (var ar = [], i = 0; i < arguments.length; i++)
325
- ar = ar.concat(__read(arguments[i]));
326
- return ar;
327
- }
328
- /** @deprecated */
329
- function __spreadArrays() {
330
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
331
- s += arguments[i].length;
332
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
333
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
334
- r[k] = a[j];
335
- return r;
336
- }
337
- function __spreadArray(to, from, pack) {
338
- if (pack || arguments.length === 2)
339
- for (var i = 0, l = from.length, ar; i < l; i++) {
340
- if (ar || !(i in from)) {
341
- if (!ar)
342
- ar = Array.prototype.slice.call(from, 0, i);
343
- ar[i] = from[i];
344
- }
345
- }
346
- return to.concat(ar || from);
347
- }
348
- function __await(v) {
349
- return this instanceof __await ? (this.v = v, this) : new __await(v);
350
- }
351
- function __asyncGenerator(thisArg, _arguments, generator) {
352
- if (!Symbol.asyncIterator)
353
- throw new TypeError("Symbol.asyncIterator is not defined.");
354
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
355
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
356
- function verb(n) { if (g[n])
357
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
358
- function resume(n, v) { try {
359
- step(g[n](v));
360
- }
361
- catch (e) {
362
- settle(q[0][3], e);
363
- } }
364
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
365
- function fulfill(value) { resume("next", value); }
366
- function reject(value) { resume("throw", value); }
367
- function settle(f, v) { if (f(v), q.shift(), q.length)
368
- resume(q[0][0], q[0][1]); }
369
- }
370
- function __asyncDelegator(o) {
371
- var i, p;
372
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
373
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
374
- }
375
- function __asyncValues(o) {
376
- if (!Symbol.asyncIterator)
377
- throw new TypeError("Symbol.asyncIterator is not defined.");
378
- var m = o[Symbol.asyncIterator], i;
379
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
380
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
381
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
382
- }
383
- function __makeTemplateObject(cooked, raw) {
384
- if (Object.defineProperty) {
385
- Object.defineProperty(cooked, "raw", { value: raw });
386
- }
387
- else {
388
- cooked.raw = raw;
389
- }
390
- return cooked;
391
- }
392
- ;
393
- var __setModuleDefault = Object.create ? (function (o, v) {
394
- Object.defineProperty(o, "default", { enumerable: true, value: v });
395
- }) : function (o, v) {
396
- o["default"] = v;
397
- };
398
- function __importStar(mod) {
399
- if (mod && mod.__esModule)
400
- return mod;
401
- var result = {};
402
- if (mod != null)
403
- for (var k in mod)
404
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
405
- __createBinding(result, mod, k);
406
- __setModuleDefault(result, mod);
407
- return result;
408
- }
409
- function __importDefault(mod) {
410
- return (mod && mod.__esModule) ? mod : { default: mod };
411
- }
412
- function __classPrivateFieldGet(receiver, state, kind, f) {
413
- if (kind === "a" && !f)
414
- throw new TypeError("Private accessor was defined without a getter");
415
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
416
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
417
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
418
- }
419
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
420
- if (kind === "m")
421
- throw new TypeError("Private method is not writable");
422
- if (kind === "a" && !f)
423
- throw new TypeError("Private accessor was defined without a setter");
424
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
425
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
426
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
427
- }
428
-
429
- var ObjectUtils = /** @class */ (function () {
430
- function ObjectUtils() {
431
- }
432
- /**
433
- * Gets a value from an object by composed key
434
- * ObjectUtils.getValue({ item: { nodeType: 'cm:folder' }}, 'item.nodeType') ==> 'cm:folder'
435
- */
436
- ObjectUtils.getValue = function (target, key) {
437
- if (!target) {
438
- return undefined;
439
- }
440
- var keys = key.split('.');
441
- key = '';
442
- do {
443
- key += keys.shift();
444
- var value = target[key];
445
- if (value !== undefined && (typeof value === 'object' || !keys.length)) {
446
- target = value;
447
- key = '';
448
- }
449
- else if (!keys.length) {
450
- target = undefined;
451
- }
452
- else {
453
- key += '.';
454
- }
455
- } while (keys.length);
456
- return target;
457
- };
458
- ObjectUtils.merge = function () {
459
- var objects = [];
460
- for (var _i = 0; _i < arguments.length; _i++) {
461
- objects[_i] = arguments[_i];
462
- }
463
- var result = {};
464
- objects.forEach(function (source) {
465
- Object.keys(source).forEach(function (prop) {
466
- if (prop in result && Array.isArray(result[prop])) {
467
- result[prop] = result[prop].concat(source[prop]);
468
- }
469
- else if (prop in result && typeof result[prop] === 'object') {
470
- result[prop] = ObjectUtils.merge(result[prop], source[prop]);
471
- }
472
- else {
473
- result[prop] = source[prop];
474
- }
475
- });
476
- });
477
- return result;
478
- };
479
- return ObjectUtils;
480
- }());
481
-
482
- var AppConfigService = /** @class */ (function () {
483
- function AppConfigService(http) {
484
- this.http = http;
485
- this.config = null;
486
- }
487
- /**
488
- * Use to get the data found in the file (config file)
489
- */
490
- AppConfigService.prototype.get = function (key, defaultValue) {
491
- var result = ObjectUtils.getValue(this.config, key);
492
- return (result === undefined ? defaultValue : result);
493
- };
494
- /**
495
- * This method:
496
- * Loads "config.json" to get all variables (e.g.: 'app.config.json')
497
- */
498
- AppConfigService.prototype.load = function () {
499
- var _this = this;
500
- return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
501
- var configUrl;
502
- var _this = this;
503
- return __generator(this, function (_a) {
504
- switch (_a.label) {
505
- case 0:
506
- configUrl = "assets/app.config.json";
507
- return [4 /*yield*/, this.http.get(configUrl).subscribe(function (data) {
508
- _this.config = Object.assign({}, _this.config, data || {});
509
- resolve(_this.config);
510
- }, function () {
511
- resolve(_this.config);
512
- })];
513
- case 1:
514
- _a.sent();
515
- return [2 /*return*/];
516
- }
517
- });
518
- }); });
519
- };
520
- return AppConfigService;
521
- }());
522
- AppConfigService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AppConfigService_Factory() { return new AppConfigService(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); }, token: AppConfigService, providedIn: "root" });
523
- AppConfigService.decorators = [
524
- { type: i0.Injectable, args: [{
525
- providedIn: 'root',
526
- },] }
527
- ];
528
- AppConfigService.ctorParameters = function () { return [
529
- { type: i1.HttpClient }
530
- ]; };
531
-
532
- var LocalStorageService = /** @class */ (function () {
533
- function LocalStorageService() {
534
- }
535
- LocalStorageService.prototype.set = function (key, value) {
536
- localStorage.setItem(key, value);
537
- };
538
- LocalStorageService.prototype.get = function (key) {
539
- return localStorage.getItem(key);
540
- };
541
- return LocalStorageService;
542
- }());
543
- LocalStorageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocalStorageService_Factory() { return new LocalStorageService(); }, token: LocalStorageService, providedIn: "root" });
544
- LocalStorageService.decorators = [
545
- { type: i0.Injectable, args: [{
546
- providedIn: 'root'
547
- },] }
548
- ];
549
-
550
- var UserProfileService = /** @class */ (function () {
551
- function UserProfileService(appConfigService, localStorageService) {
552
- this.appConfigService = appConfigService;
553
- this.localStorageService = localStorageService;
554
- this.userPrefix = '';
555
- }
556
- UserProfileService.prototype.getApplicationId = function () {
557
- return this.appConfigService.get('applicationId') ? this.appConfigService.get('applicationId') : '';
558
- };
559
- UserProfileService.prototype.setUserPrefix = function (userPrefix) {
560
- this.userPrefix = userPrefix;
561
- };
562
- UserProfileService.prototype.getUserPrefix = function () {
563
- return this.userPrefix ? this.userPrefix : '';
564
- };
565
- UserProfileService.prototype.setLocale = function (locale) {
566
- this.localStorageService.set(this.getApplicationId() + this.userPrefix + UserProfileService.LOCALE_PREFIX, locale);
567
- };
568
- UserProfileService.prototype.getLocale = function () {
569
- return this.localStorageService.get(this.getApplicationId() + this.userPrefix + UserProfileService.LOCALE_PREFIX);
570
- };
571
- return UserProfileService;
572
- }());
573
- UserProfileService.LOCALE_PREFIX = '____locale';
574
- UserProfileService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function UserProfileService_Factory() { return new UserProfileService(i0__namespace.ɵɵinject(AppConfigService), i0__namespace.ɵɵinject(LocalStorageService)); }, token: UserProfileService, providedIn: "root" });
575
- UserProfileService.decorators = [
576
- { type: i0.Injectable, args: [{
577
- providedIn: 'root'
578
- },] }
579
- ];
580
- UserProfileService.ctorParameters = function () { return [
581
- { type: AppConfigService },
582
- { type: LocalStorageService }
583
- ]; };
584
-
585
- /** @dynamic */
586
- var LocaleService = /** @class */ (function () {
587
- function LocaleService(config, translate, userProfileService, document) {
588
- this.config = config;
589
- this.translate = translate;
590
- this.userProfileService = userProfileService;
591
- this.document = document;
592
- this.languages = [];
593
- this.initUserLanguage();
594
- }
595
- LocaleService.prototype.initUserLanguage = function () {
596
- this.setActiveLocale(this.getActiveLocale() || this.getDefaultLocale());
597
- };
598
- LocaleService.prototype.setTextOrientation = function (direction) {
599
- document.body.setAttribute('dir', direction);
600
- };
601
- LocaleService.prototype.getTextOrientation = function () {
602
- return document.body.getAttribute('dir');
603
- };
604
- LocaleService.prototype.getLanguages = function () {
605
- this.languages = this.config.get('languages');
606
- if (!this.languages) {
607
- this.languages = [
608
- {
609
- key: 'fr',
610
- label: 'French',
611
- direction: 'ltr',
612
- },
613
- {
614
- key: 'de',
615
- label: 'German',
616
- direction: 'ltr',
617
- },
618
- {
619
- key: 'en',
620
- label: 'English',
621
- direction: 'ltr',
622
- },
623
- {
624
- key: 'ar',
625
- label: 'Arabic',
626
- direction: 'rtl',
627
- },
628
- ];
629
- }
630
- return this.languages;
631
- };
632
- LocaleService.prototype.getDefaultLocale = function () {
633
- var _this = this;
634
- this.locale = this.userProfileService.getLocale();
635
- if (!this.locale) {
636
- this.locale = this.config.get('locale')
637
- ? this.config.get('locale')
638
- : this.translate.getBrowserLang()
639
- ? this.translate.getBrowserLang()
640
- : 'en';
641
- }
642
- return this.getLanguages().find(function (e) { return e.key === _this.locale; });
643
- };
644
- LocaleService.prototype.getActiveLocale = function () {
645
- var _this = this;
646
- if (this.userProfileService.getLocale()) {
647
- return this.getLanguages().find(function (e) { return e.key === _this.userProfileService.getLocale(); });
648
- }
649
- };
650
- LocaleService.prototype.setActiveLocale = function (locale) {
651
- if (locale) {
652
- this.translate.use(locale.key);
653
- this.setTextOrientation(locale.direction);
654
- this.userProfileService.setLocale(locale.key);
655
- }
656
- };
657
- return LocaleService;
658
- }());
659
- LocaleService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LocaleService_Factory() { return new LocaleService(i0__namespace.ɵɵinject(AppConfigService), i0__namespace.ɵɵinject(i2__namespace.TranslateService), i0__namespace.ɵɵinject(UserProfileService), i0__namespace.ɵɵinject(i4__namespace.DOCUMENT)); }, token: LocaleService, providedIn: "root" });
660
- LocaleService.decorators = [
661
- { type: i0.Injectable, args: [{
662
- providedIn: 'root',
663
- },] }
664
- ];
665
- LocaleService.ctorParameters = function () { return [
666
- { type: AppConfigService },
667
- { type: i2.TranslateService },
668
- { type: UserProfileService },
669
- { type: Document, decorators: [{ type: i0.Inject, args: [i4.DOCUMENT,] }] }
670
- ]; };
671
-
672
- var LanguageMenuComponent = /** @class */ (function () {
673
- function LanguageMenuComponent(localeService) {
674
- this.localeService = localeService;
675
- this.showLocaleKeyAsLabel = false;
676
- this.showLocaleAsLabel = false;
677
- this.languages = [];
678
- }
679
- LanguageMenuComponent.prototype.ngOnInit = function () {
680
- this.languages = this.localeService.getLanguages();
681
- this.localeService.setActiveLocale(this.locale);
682
- };
683
- LanguageMenuComponent.prototype.onChangeLanguage = function (language) {
684
- this.localeService.setActiveLocale(language);
685
- };
686
- Object.defineProperty(LanguageMenuComponent.prototype, "locale", {
687
- get: function () {
688
- return this.localeService.getActiveLocale() || this.localeService.getDefaultLocale();
689
- },
690
- enumerable: false,
691
- configurable: true
692
- });
693
- return LanguageMenuComponent;
694
- }());
695
- LanguageMenuComponent.decorators = [
696
- { type: i0.Component, args: [{
697
- selector: 'mnl-language-menu',
698
- 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",
699
- styles: [""]
700
- },] }
701
- ];
702
- LanguageMenuComponent.ctorParameters = function () { return [
703
- { type: LocaleService }
704
- ]; };
705
- LanguageMenuComponent.propDecorators = {
706
- showLocaleKeyAsLabel: [{ type: i0.Input }],
707
- showLocaleAsLabel: [{ type: i0.Input }]
708
- };
709
-
710
- var LoginComponent = /** @class */ (function () {
711
- function LoginComponent(sanitizer) {
712
- this.sanitizer = sanitizer;
713
- this.title = '';
714
- this.logoImageUrl = './assets/images/logo.png';
715
- this.backgroundImageUrl = './assets/images/background.jpg';
716
- this.disabled = false;
717
- this.login = new i0.EventEmitter();
718
- }
719
- LoginComponent.prototype.ngOnInit = function () {
720
- this.initForm();
721
- };
722
- LoginComponent.prototype.initForm = function () {
723
- this.formGroup = new forms.FormGroup({
724
- username: new forms.FormControl('', [forms.Validators.required]),
725
- password: new forms.FormControl('', [forms.Validators.required])
726
- });
727
- };
728
- LoginComponent.prototype.onSubmit = function () {
729
- if (this.formGroup.valid) {
730
- this.login.emit(this.formGroup.value);
731
- }
732
- };
733
- LoginComponent.prototype.getBackgroundImageUrl = function () {
734
- return this.sanitizer.bypassSecurityTrustStyle("url(" + this.backgroundImageUrl + ")");
735
- };
736
- return LoginComponent;
737
- }());
738
- LoginComponent.decorators = [
739
- { type: i0.Component, args: [{
740
- selector: 'mnl-login',
741
- 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>",
742
- styles: [".mnl-login-card{min-width:260px}.mnl-login-container{background-size:cover}.mnl-login-title{opacity:.6}"]
743
- },] }
744
- ];
745
- LoginComponent.ctorParameters = function () { return [
746
- { type: platformBrowser.DomSanitizer }
747
- ]; };
748
- LoginComponent.propDecorators = {
749
- title: [{ type: i0.Input }],
750
- logoImageUrl: [{ type: i0.Input }],
751
- backgroundImageUrl: [{ type: i0.Input }],
752
- disabled: [{ type: i0.Input }],
753
- login: [{ type: i0.Output }]
754
- };
755
-
756
- var MenuComponent = /** @class */ (function () {
757
- function MenuComponent() {
758
- this.menuClick = new i0.EventEmitter();
759
- }
760
- MenuComponent.prototype.onMenuClick = function (menu) {
761
- if (this.hasSubMenu(menu)) {
762
- this.openMenu(menu);
763
- this.onSubMenuClick(menu.subMenus[0], menu);
764
- }
765
- else {
766
- this.deSelectMenus(this.menuData);
767
- this.selectMenu(menu);
768
- this.menuClick.emit(menu);
769
- }
770
- };
771
- MenuComponent.prototype.onSubMenuClick = function (subMenu, menu) {
772
- this.deSelectMenus(this.menuData);
773
- this.selectMenu(menu);
774
- this.selectMenu(subMenu);
775
- this.menuClick.emit(subMenu);
776
- };
777
- MenuComponent.prototype.deSelectMenus = function (menus) {
778
- var e_1, _a;
779
- if (menus) {
780
- try {
781
- for (var menus_1 = __values(menus), menus_1_1 = menus_1.next(); !menus_1_1.done; menus_1_1 = menus_1.next()) {
782
- var menu = menus_1_1.value;
783
- if (menu.selected) {
784
- menu.selected = false;
785
- }
786
- this.deSelectMenus(menu.subMenus);
787
- }
788
- }
789
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
790
- finally {
791
- try {
792
- if (menus_1_1 && !menus_1_1.done && (_a = menus_1.return)) _a.call(menus_1);
793
- }
794
- finally { if (e_1) throw e_1.error; }
795
- }
796
- }
797
- };
798
- MenuComponent.prototype.selectMenu = function (menu) {
799
- if (menu) {
800
- menu.selected = true;
801
- }
802
- };
803
- MenuComponent.prototype.hasSubMenu = function (menu) {
804
- return menu.subMenus && menu.subMenus.length > 0;
805
- };
806
- MenuComponent.prototype.toggleMenu = function (menu, event) {
807
- menu.expanded = !menu.expanded;
808
- if (event) {
809
- event.stopPropagation();
810
- }
811
- };
812
- MenuComponent.prototype.openMenu = function (menu) {
813
- menu.expanded = true;
814
- };
815
- return MenuComponent;
816
- }());
817
- MenuComponent.decorators = [
818
- { type: i0.Component, args: [{
819
- selector: 'mnl-menu',
820
- 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>",
821
- 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(0deg);margin-top:3px;margin-left:25px}.mnl-menu-button.mnl-rotated{transform:rotate(180deg)}"]
822
- },] }
823
- ];
824
- MenuComponent.propDecorators = {
825
- menuData: [{ type: i0.Input }],
826
- menuClick: [{ type: i0.Output }]
827
- };
828
-
829
- var ProfileComponent = /** @class */ (function () {
830
- function ProfileComponent() {
831
- this.showDisplayName = true;
832
- this.userInitialClick = new i0.EventEmitter();
833
- this.profileMenuClick = new i0.EventEmitter();
834
- }
835
- ProfileComponent.prototype.onUserInitialClick = function (event) {
836
- this.userInitialClick.emit(event);
837
- };
838
- ProfileComponent.prototype.ngOnChanges = function (changes) {
839
- if (changes && changes.userProfileDetails && changes.userProfileDetails.currentValue
840
- && changes.userProfileDetails.currentValue.firstName && changes.userProfileDetails.currentValue.lastName
841
- && changes.userProfileDetails.currentValue.email) {
842
- this.hasUserDetails = true;
843
- }
844
- else {
845
- this.hasUserDetails = false;
846
- }
847
- };
848
- return ProfileComponent;
849
- }());
850
- ProfileComponent.decorators = [
851
- { type: i0.Component, args: [{
852
- selector: 'mnl-user-profile',
853
- 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",
854
- styles: ["#mnl-initials-button{border-radius:20px}"]
855
- },] }
856
- ];
857
- ProfileComponent.propDecorators = {
858
- userProfileDetails: [{ type: i0.Input }],
859
- showDisplayName: [{ type: i0.Input }],
860
- userInitialClick: [{ type: i0.Output }],
861
- profileMenuClick: [{ type: i0.Output }]
862
- };
863
-
864
- var MNL_TRANSLATION_RESOURCE = new i0.InjectionToken('Translation Resource');
865
- function translationLoaderFactory(http, resources) {
866
- if (!resources) {
867
- resources = [];
868
- }
869
- else if (!resources.length) {
870
- resources = [resources];
871
- }
872
- resources.push({ prefix: './assets/mnl-commons/i18n/', suffix: '.json' });
873
- return new ngxTranslateMultiHttpLoader.MultiTranslateHttpLoader(http, resources);
874
- }
875
-
876
- var AppConfigPipe = /** @class */ (function () {
877
- function AppConfigPipe(config) {
878
- this.config = config;
879
- }
880
- AppConfigPipe.prototype.transform = function (value, defaultValue) {
881
- return this.config.get(value) || defaultValue || '';
882
- };
883
- return AppConfigPipe;
884
- }());
885
- AppConfigPipe.decorators = [
886
- { type: i0.Pipe, args: [{
887
- name: 'mnlAppConfig'
888
- },] }
889
- ];
890
- AppConfigPipe.ctorParameters = function () { return [
891
- { type: AppConfigService }
892
- ]; };
893
-
894
- var TimeAgoPipe = /** @class */ (function () {
895
- function TimeAgoPipe(appConfigService, userProfileService) {
896
- this.appConfigService = appConfigService;
897
- this.userProfileService = userProfileService;
898
- this.defaultLocale = TimeAgoPipe.DEFAULT_LOCALE;
899
- this.defaultDateTimeFormat = TimeAgoPipe.DEFAULT_DATE_TIME_FORMAT;
900
- }
901
- TimeAgoPipe.prototype.transform = function (value, dateTimeFormat, locale) {
902
- if (value) {
903
- var currentLocale = this.userProfileService.getLocale();
904
- var currentDateTimeFormat = this.appConfigService.get('dateTimeFormat');
905
- var requiredLocale = locale || currentLocale || this.defaultLocale;
906
- var requiredDateTimeFormat = dateTimeFormat || currentDateTimeFormat || this.defaultDateTimeFormat;
907
- if (differenceInDays__default['default'](new Date(), new Date(value)) > 7) {
908
- var datePipe = new i4.DatePipe(requiredLocale);
909
- return datePipe.transform(value, requiredDateTimeFormat);
910
- }
911
- return dateFns.formatDistance(new Date(value), new Date(), {
912
- includeSeconds: true,
913
- addSuffix: true,
914
- });
915
- }
916
- return '';
917
- };
918
- return TimeAgoPipe;
919
- }());
920
- TimeAgoPipe.DEFAULT_LOCALE = 'en-US';
921
- TimeAgoPipe.DEFAULT_DATE_TIME_FORMAT = 'dd/MM/yyyy HH:mm';
922
- TimeAgoPipe.decorators = [
923
- { type: i0.Pipe, args: [{
924
- name: 'mnlTimeAgo',
925
- },] }
926
- ];
927
- TimeAgoPipe.ctorParameters = function () { return [
928
- { type: AppConfigService },
929
- { type: UserProfileService }
930
- ]; };
931
-
932
- var UserFullnamePipe = /** @class */ (function () {
933
- function UserFullnamePipe() {
934
- }
935
- UserFullnamePipe.prototype.transform = function (value) {
936
- var fullName = '';
937
- if (!this.isEmptyObject(value)) {
938
- if (value.firstName && value.lastName) {
939
- fullName = value.firstName + ' ' + value.lastName;
940
- }
941
- else if (!value.firstName && value.lastName) {
942
- fullName = value.lastName;
943
- }
944
- else if (value.firstName && !value.lastName) {
945
- fullName = value.firstName;
946
- }
947
- else if (!value.firstName && !value.lastName) {
948
- fullName = value.email;
949
- }
950
- }
951
- return fullName;
952
- };
953
- UserFullnamePipe.prototype.isEmptyObject = function (data) {
954
- return (data && (Object.keys(data).length === 0));
955
- };
956
- return UserFullnamePipe;
957
- }());
958
- UserFullnamePipe.decorators = [
959
- { type: i0.Pipe, args: [{
960
- name: 'mnlUserFullName'
961
- },] }
962
- ];
963
-
964
- var UserInitialPipe = /** @class */ (function () {
965
- function UserInitialPipe() {
966
- }
967
- UserInitialPipe.prototype.transform = function (value) {
968
- var userInitials = '';
969
- if (!this.isEmptyObject(value)) {
970
- if (value.firstName && value.lastName) {
971
- userInitials = value.firstName.substring(0, 1).toUpperCase() + value.lastName.substring(0, 1).toUpperCase();
972
- }
973
- else if (!value.firstName && value.lastName) {
974
- userInitials = this.getUserInitials(value.lastName);
975
- }
976
- else if (value.firstName && !value.lastName) {
977
- userInitials = this.getUserInitials(value.firstName);
978
- }
979
- else if (!value.firstName && !value.lastName) {
980
- userInitials = value.email.substring(0, 1).toUpperCase();
981
- }
982
- }
983
- return userInitials;
984
- };
985
- UserInitialPipe.prototype.isEmptyObject = function (data) {
986
- return (data && (Object.keys(data).length === 0));
987
- };
988
- UserInitialPipe.prototype.getUserInitials = function (name) {
989
- var userInitial = '';
990
- if (this.hasWhiteSpace(name.trim())) {
991
- var data = name.split(/\s+/);
992
- userInitial = data[0].substring(0, 1).toUpperCase() + data[1].substring(0, 1).toUpperCase();
993
- }
994
- else {
995
- userInitial = name.trim().substring(0, 1).toUpperCase();
996
- }
997
- return userInitial;
998
- };
999
- UserInitialPipe.prototype.hasWhiteSpace = function (data) {
1000
- return /\s/g.test(data);
1001
- };
1002
- return UserInitialPipe;
1003
- }());
1004
- UserInitialPipe.decorators = [
1005
- { type: i0.Pipe, args: [{
1006
- name: 'mnlUserInitialPipe'
1007
- },] }
1008
- ];
1009
-
1010
- var LogLevelsEnum = /** @class */ (function (_super) {
1011
- __extends(LogLevelsEnum, _super);
1012
- function LogLevelsEnum() {
1013
- return _super !== null && _super.apply(this, arguments) || this;
1014
- }
1015
- return LogLevelsEnum;
1016
- }(Number));
1017
- LogLevelsEnum.TRACE = 5;
1018
- LogLevelsEnum.DEBUG = 1;
1019
- LogLevelsEnum.INFO = 2;
1020
- LogLevelsEnum.WARN = 3;
1021
- LogLevelsEnum.ERROR = 4;
1022
- LogLevelsEnum.SILENT = 0;
1023
- var logLevels = [
1024
- { level: LogLevelsEnum.TRACE, name: 'TRACE' },
1025
- { level: LogLevelsEnum.DEBUG, name: 'DEBUG' },
1026
- { level: LogLevelsEnum.INFO, name: 'INFO' },
1027
- { level: LogLevelsEnum.WARN, name: 'WARN' },
1028
- { level: LogLevelsEnum.ERROR, name: 'ERROR' },
1029
- { level: LogLevelsEnum.SILENT, name: 'SILENT' }
1030
- ];
1031
-
1032
- // tslint:disable: no-console
1033
- var LogService = /** @class */ (function () {
1034
- function LogService(appConfigService) {
1035
- this.appConfigService = appConfigService;
1036
- this.onMessage = new rxjs.Subject();
1037
- }
1038
- Object.defineProperty(LogService.prototype, "currentLogLevel", {
1039
- get: function () {
1040
- var configLevel = this.appConfigService.get('logLevel');
1041
- if (configLevel) {
1042
- return this.getLogLevel(configLevel);
1043
- }
1044
- return LogLevelsEnum.ERROR;
1045
- },
1046
- enumerable: false,
1047
- configurable: true
1048
- });
1049
- LogService.prototype.error = function (message) {
1050
- var optionalParams = [];
1051
- for (var _i = 1; _i < arguments.length; _i++) {
1052
- optionalParams[_i - 1] = arguments[_i];
1053
- }
1054
- if (this.currentLogLevel >= LogLevelsEnum.ERROR) {
1055
- this.messageBus(message, 'ERROR');
1056
- console.error.apply(console, __spread([message], optionalParams));
1057
- }
1058
- };
1059
- LogService.prototype.debug = function (message) {
1060
- var optionalParams = [];
1061
- for (var _i = 1; _i < arguments.length; _i++) {
1062
- optionalParams[_i - 1] = arguments[_i];
1063
- }
1064
- if (this.currentLogLevel >= LogLevelsEnum.DEBUG) {
1065
- this.messageBus(message, 'DEBUG');
1066
- console.debug.apply(console, __spread([message], optionalParams));
1067
- }
1068
- };
1069
- LogService.prototype.info = function (message) {
1070
- var optionalParams = [];
1071
- for (var _i = 1; _i < arguments.length; _i++) {
1072
- optionalParams[_i - 1] = arguments[_i];
1073
- }
1074
- if (this.currentLogLevel >= LogLevelsEnum.INFO) {
1075
- this.messageBus(message, 'INFO');
1076
- console.info.apply(console, __spread([message], optionalParams));
1077
- }
1078
- };
1079
- LogService.prototype.log = function (message) {
1080
- var optionalParams = [];
1081
- for (var _i = 1; _i < arguments.length; _i++) {
1082
- optionalParams[_i - 1] = arguments[_i];
1083
- }
1084
- if (this.currentLogLevel >= LogLevelsEnum.TRACE) {
1085
- this.messageBus(message, 'LOG');
1086
- console.log.apply(console, __spread([message], optionalParams));
1087
- }
1088
- };
1089
- LogService.prototype.trace = function (message) {
1090
- var optionalParams = [];
1091
- for (var _i = 1; _i < arguments.length; _i++) {
1092
- optionalParams[_i - 1] = arguments[_i];
1093
- }
1094
- if (this.currentLogLevel >= LogLevelsEnum.TRACE) {
1095
- this.messageBus(message, 'TRACE');
1096
- console.trace.apply(console, __spread([message], optionalParams));
1097
- }
1098
- };
1099
- LogService.prototype.warn = function (message) {
1100
- var optionalParams = [];
1101
- for (var _i = 1; _i < arguments.length; _i++) {
1102
- optionalParams[_i - 1] = arguments[_i];
1103
- }
1104
- if (this.currentLogLevel >= LogLevelsEnum.WARN) {
1105
- this.messageBus(message, 'WARN');
1106
- console.warn.apply(console, __spread([message], optionalParams));
1107
- }
1108
- };
1109
- LogService.prototype.assert = function (test, message) {
1110
- var optionalParams = [];
1111
- for (var _i = 2; _i < arguments.length; _i++) {
1112
- optionalParams[_i - 2] = arguments[_i];
1113
- }
1114
- if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
1115
- this.messageBus(message, 'ASSERT');
1116
- console.assert.apply(console, __spread([test, message], optionalParams));
1117
- }
1118
- };
1119
- LogService.prototype.group = function (groupTitle) {
1120
- var optionalParams = [];
1121
- for (var _i = 1; _i < arguments.length; _i++) {
1122
- optionalParams[_i - 1] = arguments[_i];
1123
- }
1124
- if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
1125
- console.group.apply(console, __spread([groupTitle], optionalParams));
1126
- }
1127
- };
1128
- LogService.prototype.groupEnd = function () {
1129
- if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
1130
- console.groupEnd();
1131
- }
1132
- };
1133
- LogService.prototype.getLogLevel = function (level) {
1134
- var referencedLevel = logLevels.find(function (currentLevel) {
1135
- return currentLevel.name.toLocaleLowerCase() === level.toLocaleLowerCase();
1136
- });
1137
- return referencedLevel ? referencedLevel.level : 4;
1138
- };
1139
- LogService.prototype.messageBus = function (message, logLevel) {
1140
- this.onMessage.next({ text: message, type: logLevel });
1141
- };
1142
- return LogService;
1143
- }());
1144
- LogService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LogService_Factory() { return new LogService(i0__namespace.ɵɵinject(AppConfigService)); }, token: LogService, providedIn: "root" });
1145
- LogService.decorators = [
1146
- { type: i0.Injectable, args: [{
1147
- providedIn: 'root'
1148
- },] }
1149
- ];
1150
- LogService.ctorParameters = function () { return [
1151
- { type: AppConfigService }
1152
- ]; };
1153
-
1154
- i4.registerLocaleData(localeFR__default['default']);
1155
- i4.registerLocaleData(localeDE__default['default']);
1156
- i4.registerLocaleData(localeAR__default['default']);
1157
- var ɵ0 = translationLoaderFactory;
1158
- var CommonsModule = /** @class */ (function () {
1159
- function CommonsModule() {
1160
- }
1161
- CommonsModule.forRoot = function () {
1162
- return {
1163
- ngModule: CommonsModule,
1164
- providers: [
1165
- {
1166
- provide: i0.APP_INITIALIZER,
1167
- useFactory: loadConfig,
1168
- deps: [
1169
- AppConfigService,
1170
- UserProfileService,
1171
- LocalStorageService,
1172
- LogService,
1173
- LocaleService,
1174
- ],
1175
- multi: true,
1176
- },
1177
- ],
1178
- };
1179
- };
1180
- CommonsModule.forChild = function () {
1181
- return {
1182
- ngModule: CommonsModule,
1183
- };
1184
- };
1185
- return CommonsModule;
1186
- }());
1187
- CommonsModule.decorators = [
1188
- { type: i0.NgModule, args: [{
1189
- declarations: [
1190
- HeaderComponent,
1191
- MenuComponent,
1192
- HighlighterComponent,
1193
- AppConfigPipe,
1194
- LoginComponent,
1195
- LanguageMenuComponent,
1196
- ProfileComponent,
1197
- UserInitialPipe,
1198
- TimeAgoPipe,
1199
- UserFullnamePipe,
1200
- ],
1201
- imports: [
1202
- i4.CommonModule,
1203
- toolbar.MatToolbarModule,
1204
- flexLayout.FlexLayoutModule,
1205
- MaterialModule,
1206
- i2.TranslateModule.forRoot({
1207
- loader: {
1208
- provide: i2.TranslateLoader,
1209
- useFactory: ɵ0,
1210
- deps: [i1.HttpClient, MNL_TRANSLATION_RESOURCE],
1211
- },
1212
- }),
1213
- ],
1214
- exports: [
1215
- HeaderComponent,
1216
- MenuComponent,
1217
- HighlighterComponent,
1218
- AppConfigPipe,
1219
- LanguageMenuComponent,
1220
- LoginComponent,
1221
- ProfileComponent,
1222
- UserInitialPipe,
1223
- TimeAgoPipe,
1224
- UserFullnamePipe,
1225
- i2.TranslateModule,
1226
- ],
1227
- },] }
1228
- ];
1229
- function loadConfig(config) {
1230
- var conf = function () { return config.load(); };
1231
- return conf;
1232
- }
1233
-
1234
- /*
1235
- * Public API Surface of mnl-commons
1236
- */
1237
-
1238
- /**
1239
- * Generated bundle index. Do not edit.
1240
- */
1241
-
1242
- exports.AppConfigPipe = AppConfigPipe;
1243
- exports.AppConfigService = AppConfigService;
1244
- exports.CommonsModule = CommonsModule;
1245
- exports.HeaderComponent = HeaderComponent;
1246
- exports.HighlighterComponent = HighlighterComponent;
1247
- exports.LanguageMenuComponent = LanguageMenuComponent;
1248
- exports.LocalStorageService = LocalStorageService;
1249
- exports.LocaleService = LocaleService;
1250
- exports.LogLevelsEnum = LogLevelsEnum;
1251
- exports.LogService = LogService;
1252
- exports.LoginComponent = LoginComponent;
1253
- exports.MNL_TRANSLATION_RESOURCE = MNL_TRANSLATION_RESOURCE;
1254
- exports.MaterialModule = MaterialModule;
1255
- exports.MenuComponent = MenuComponent;
1256
- exports.ProfileComponent = ProfileComponent;
1257
- exports.TimeAgoPipe = TimeAgoPipe;
1258
- exports.UserFullnamePipe = UserFullnamePipe;
1259
- exports.UserInitialPipe = UserInitialPipe;
1260
- exports.UserProfileService = UserProfileService;
1261
- exports.loadConfig = loadConfig;
1262
- exports.logLevels = logLevels;
1263
- exports.modules = modules;
1264
- exports.translationLoaderFactory = translationLoaderFactory;
1265
- exports.ɵ0 = ɵ0;
1266
-
1267
- Object.defineProperty(exports, '__esModule', { value: true });
1268
-
1269
- })));
1270
- //# sourceMappingURL=muraai-mnl-commons.umd.js.map