@muraai/mnl-commons 0.1.0 → 0.2.0-alpha-3a3a286

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