adb-shared 0.0.55 → 1.0.3

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.
@@ -1,33 +0,0 @@
1
- /**
2
- * @fileoverview added by tsickle
3
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4
- */
5
- /**
6
- * @record
7
- */
8
- export function Navigation() { }
9
- if (false) {
10
- /** @type {?} */
11
- Navigation.prototype.about;
12
- /** @type {?} */
13
- Navigation.prototype.links;
14
- /** @type {?} */
15
- Navigation.prototype.createAccountLink;
16
- }
17
- /**
18
- * @record
19
- */
20
- export function Link() { }
21
- if (false) {
22
- /** @type {?} */
23
- Link.prototype.transId;
24
- /** @type {?} */
25
- Link.prototype.url;
26
- /** @type {?|undefined} */
27
- Link.prototype.topLink;
28
- /** @type {?|undefined} */
29
- Link.prototype.icon;
30
- /** @type {?|undefined} */
31
- Link.prototype.children;
32
- }
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF2aWdhdGlvbi5tb2RlbC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2FkYi1zaGFyZWQvIiwic291cmNlcyI6WyJsaWIvbmF2aWdhdGlvbi5tb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUEsZ0NBSUM7OztJQUhHLDJCQUFZOztJQUNaLDJCQUFjOztJQUNkLHVDQUEwQjs7Ozs7QUFHOUIsMEJBTUM7OztJQUxHLHVCQUFnQjs7SUFDaEIsbUJBQVk7O0lBQ1osdUJBQWtCOztJQUNsQixvQkFBYzs7SUFDZCx3QkFBa0IiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIE5hdmlnYXRpb24ge1xyXG4gICAgYWJvdXQ6IExpbms7XHJcbiAgICBsaW5rczogTGlua1tdO1xyXG4gICAgY3JlYXRlQWNjb3VudExpbms6IHN0cmluZztcclxufVxyXG5cclxuZXhwb3J0IGludGVyZmFjZSBMaW5rIHtcclxuICAgIHRyYW5zSWQ6IHN0cmluZztcclxuICAgIHVybDogc3RyaW5nO1xyXG4gICAgdG9wTGluaz86IGJvb2xlYW47XHJcbiAgICBpY29uPzogc3RyaW5nO1xyXG4gICAgY2hpbGRyZW4/OiBMaW5rW107XHJcbn0iXX0=
@@ -1,10 +0,0 @@
1
- /**
2
- * @fileoverview added by tsickle
3
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4
- */
5
- /*
6
- * Public API Surface of artdata-shared
7
- */
8
- export { ADBHeaderComponent } from './lib/adb-header.component';
9
- export { ADBHeaderModule } from './lib/adb-header.module';
10
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2FkYi1zaGFyZWQvIiwic291cmNlcyI6WyJwdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxtQ0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxnQ0FBYyx5QkFBeUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBhcnRkYXRhLXNoYXJlZFxyXG4gKi9cclxuXHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL2FkYi1oZWFkZXIuY29tcG9uZW50JztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvYWRiLWhlYWRlci5tb2R1bGUnO1xyXG4iXX0=
@@ -1,340 +0,0 @@
1
- import { HttpClient, HttpClientModule } from '@angular/common/http';
2
- import { Injectable, Inject, EventEmitter, Component, Output, Input, Directive, ElementRef, HostListener, NgModule } from '@angular/core';
3
- import { TranslateService, TranslateModule } from '@ngx-translate/core';
4
- import { Subscription, forkJoin } from 'rxjs';
5
- import { CommonModule } from '@angular/common';
6
- import { RouterModule } from '@angular/router';
7
-
8
- /**
9
- * @fileoverview added by tsickle
10
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
11
- */
12
- var EnvironmentService = /** @class */ (function () {
13
- function EnvironmentService(environment) {
14
- this.environment = environment;
15
- }
16
- EnvironmentService.decorators = [
17
- { type: Injectable }
18
- ];
19
- /** @nocollapse */
20
- EnvironmentService.ctorParameters = function () { return [
21
- { type: undefined, decorators: [{ type: Inject, args: ['env',] }] }
22
- ]; };
23
- return EnvironmentService;
24
- }());
25
- if (false) {
26
- /** @type {?} */
27
- EnvironmentService.prototype.environment;
28
- }
29
-
30
- /**
31
- * @fileoverview added by tsickle
32
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
33
- */
34
- var ADBHeaderComponent = /** @class */ (function () {
35
- function ADBHeaderComponent(httpClient, envService, trans) {
36
- this.httpClient = httpClient;
37
- this.envService = envService;
38
- this.trans = trans;
39
- this.subscription = new Subscription();
40
- this.loginClicked = new EventEmitter();
41
- this.logoutClicked = new EventEmitter();
42
- this.dropMenuChange = new EventEmitter();
43
- this.showMenu = false;
44
- this.showUserMenu = false;
45
- }
46
- Object.defineProperty(ADBHeaderComponent.prototype, "userName", {
47
- set: /**
48
- * @param {?} fullName
49
- * @return {?}
50
- */
51
- function (fullName) {
52
- this.fullName = fullName;
53
- /** @type {?} */
54
- var splitted = fullName.split(' ');
55
- if (splitted && splitted.length > 1) {
56
- /** @type {?} */
57
- var initials = splitted.shift().charAt(0) + splitted.pop().charAt(0);
58
- this.initials = initials.toUpperCase();
59
- }
60
- },
61
- enumerable: true,
62
- configurable: true
63
- });
64
- ;
65
- /**
66
- * @return {?}
67
- */
68
- ADBHeaderComponent.prototype.ngOnInit = /**
69
- * @return {?}
70
- */
71
- function () {
72
- var _this = this;
73
- this.url = window.location.href;
74
- /** @type {?} */
75
- var baseUrl = this.envService.environment.resourceUrl;
76
- this.subscription.add(this.httpClient.get(baseUrl + '/assets/links.json').subscribe((/**
77
- * @param {?} result
78
- * @return {?}
79
- */
80
- function (result) {
81
- _this.navigation = result;
82
- })));
83
- this.initAllTranslations(baseUrl);
84
- };
85
- /**
86
- * @private
87
- * @param {?} baseUrl
88
- * @return {?}
89
- */
90
- ADBHeaderComponent.prototype.initAllTranslations = /**
91
- * @private
92
- * @param {?} baseUrl
93
- * @return {?}
94
- */
95
- function (baseUrl) {
96
- var _this = this;
97
- /** @type {?} */
98
- var trans$ = forkJoin([this.httpClient.get(baseUrl + '/assets/i18n/en.json'), this.httpClient.get(baseUrl + '/assets/i18n/sv.json')]);
99
- this.subscription.add(trans$.subscribe((/**
100
- * @param {?} result
101
- * @return {?}
102
- */
103
- function (result) {
104
- _this.trans.setTranslation('en', result[0], true);
105
- _this.trans.setTranslation('sv', result[1], true);
106
- })));
107
- };
108
- /**
109
- * @param {?} show
110
- * @return {?}
111
- */
112
- ADBHeaderComponent.prototype.showMenuDropdown = /**
113
- * @param {?} show
114
- * @return {?}
115
- */
116
- function (show) {
117
- if (this.showMenu !== show) {
118
- this.showMenu = show;
119
- this.dropMenuChange.emit(show);
120
- }
121
- };
122
- /**
123
- * @param {?} lang
124
- * @return {?}
125
- */
126
- ADBHeaderComponent.prototype.setLanguage = /**
127
- * @param {?} lang
128
- * @return {?}
129
- */
130
- function (lang) {
131
- this.trans.use(lang);
132
- //TODO: set localstorage/cookies or probaly event to main app
133
- };
134
- /**
135
- * @param {?} transId
136
- * @return {?}
137
- */
138
- ADBHeaderComponent.prototype.onExpandLink = /**
139
- * @param {?} transId
140
- * @return {?}
141
- */
142
- function (transId) {
143
- if (this.expandedLink === transId) {
144
- this.expandedLink = null;
145
- return;
146
- }
147
- this.expandedLink = transId;
148
- };
149
- /**
150
- * @return {?}
151
- */
152
- ADBHeaderComponent.prototype.login = /**
153
- * @return {?}
154
- */
155
- function () {
156
- this.loginClicked.emit();
157
- };
158
- /**
159
- * @return {?}
160
- */
161
- ADBHeaderComponent.prototype.logout = /**
162
- * @return {?}
163
- */
164
- function () {
165
- this.logoutClicked.emit();
166
- };
167
- /**
168
- * @return {?}
169
- */
170
- ADBHeaderComponent.prototype.ngOnDestroy = /**
171
- * @return {?}
172
- */
173
- function () {
174
- this.subscription.unsubscribe();
175
- };
176
- ADBHeaderComponent.decorators = [
177
- { type: Component, args: [{
178
- selector: 'adb-header2',
179
- template: "<header id=\"top-header\" (clickOutside)=\"showUserMenu=false;showMenuDropdown(false);\">\r\n <nav class=\"d-flex flex-wrap px-3\">\r\n <div class=\"flex-grow-1 d-flex align-items-center justify-content-between justify-content-md-start\">\r\n <div class=\"logo d-none d-md-block\">\r\n <img src=\"/assets/images/logo.svg\" style=\"height: 3.2rem;\">\r\n </div>\r\n <div class=\"logo pl-2 d-sm-block d-md-none d-flex align-items-center\">\r\n <img src=\"/assets/images/logo_sm_white.png\" style=\"height: 2rem;\">\r\n </div>\r\n <strong class=\"bigger\">Artfakta</strong>\r\n </div>\r\n <div class=\"flex-grow-1 d-flex justify-content-lg-between justify-content-end align-items-center\">\r\n <div class=\"d-flex align-items-center\">\r\n <nav class=\"d-none align-items-center d-lg-flex pr-4\" style=\"gap:2rem;\" *ngIf=\"navigation\">\r\n <ng-container *ngFor=\"let link of navigation.links\">\r\n <a [href]=\"link.url\" *ngIf=\"link.topLink\" [ngClass]=\"{'d-none d-xl-block':link.transId==='ADB_HEADER.OBSERVATION'}\">\r\n {{link.transId|translate}}\r\n </a>\r\n </ng-container>\r\n </nav>\r\n <div>\r\n <button type=\"button\" class=\"btn btn-sm py-1 px-2 btn-primary\" (click)=\"showUserMenu = false;showMenuDropdown(!showMenu)\">\r\n {{'ADB_HEADER.MENY'|translate}}\r\n <i class=\"ml-1 fas\" [ngClass]=\"showMenu?'fa-chevron-up':'fa-chevron-down'\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"d-none d-md-block pl-4\">\r\n <button *ngIf=\"initials\" type=\"button\" class=\"btn initials px-2 py-1\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\">{{initials}}</button>\r\n <button *ngIf=\"!initials\" type=\"button\" (click)=\"showUserMenu = !showUserMenu;showMenuDropdown(false)\" class=\"btn btn-link\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n </nav>\r\n <div class=\"menu\" *ngIf=\"showUserMenu\">\r\n <div class=\"menu-body bg-white p-3\" style=\"width:15rem\">\r\n <ng-container *ngIf=\"initials\">\r\n <div class=\"text-dark\">\r\n <span class=\"initials py-2 px-2 mr-2\">{{initials}}</span>\r\n <strong>{{fullName}}</strong>\r\n </div>\r\n <hr class=\"mx-n3\">\r\n <button (click)=\"logout()\" type=\"button\" class=\"btn btn-link p-0\">\r\n <i class=\"fas fa-sign-out-alt mr-1\"></i>{{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </ng-container>\r\n <ng-container *ngIf=\"!initials\">\r\n <div class=\"d-flex justify-content-center\">\r\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"login()\" id=\"start-login\">{{'ADB_HEADER.LOGIN'|translate}}</button>\r\n </div>\r\n <a class=\"d-block mt-3\" href=\"{{navigation.createAccountLink}}?returnUrl={{url}}\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <div class=\"menu\" *ngIf=\"showMenu\">\r\n <div class=\"menu-body\" *ngIf=\"navigation\">\r\n <div class=\"px-3 pt-3 mb-1\">\r\n <div class=\"d-flex justify-content-between flex-wrap gap-2 mb-2\">\r\n <div>\r\n <div class=\"d-flex d-md-none align-items-center gap-2\" *ngIf=\"initials\">\r\n <span class=\"initials mr-2\">{{initials}}</span>\r\n <button type=\"button\" (click)=\"logout()\" class=\"btn btn-primary\">\r\n {{'ADB_HEADER.LOGOUT'|translate}}\r\n </button>\r\n </div>\r\n <div class=\"d-flex gap-2 d-md-none\" *ngIf=\"!initials\">\r\n <button type=\"button\" (click)=\"login()\" class=\"btn btn-primary\" id=\"login\">\r\n {{'ADB_HEADER.LOGIN'|translate}}\r\n </button>\r\n <a href=\"{{navigation.createAccountLink}}?returnUrl={{url}}\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.CREATE_USER'|translate}}\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='en'\" (click)=\"setLanguage('sv')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_SWEDISH'|translate}}\r\n </button>\r\n <button type=\"button\" *ngIf=\"trans.currentLang==='sv'\" (click)=\"setLanguage('en')\"\r\n class=\"btn btn-primary\">\r\n {{'ADB_HEADER.IN_ENGLISH'|translate}}\r\n </button>\r\n </div>\r\n </div>\r\n {{'ADB_HEADER.SERVICES'|translate}}\r\n </div>\r\n <div id=\"splash\">\r\n <div class=\"px-3 d-flex flex-column\">\r\n <ul class=\"list-group ml-0 mb-0 pl-0\">\r\n <li class=\"mb-1 list-group-item rounded-0\"\r\n [ngClass]=\"{'pointer list-group-item-action':link.children&&link.children.length>0}\"\r\n *ngFor=\"let link of navigation.links\"\r\n [attr.aria-expanded]=\"link.transId===expandedLink?true:false\" role=\"button\"\r\n (click)=\"onExpandLink(link.transId)\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <div class=\"d-flex\">\r\n <small class=\"fa-stack mr-1\" *ngIf=\"link.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"link.icon\"></span>\r\n </small>\r\n <a [href]=\"link.url\" (click)=\"$event.stopPropagation();\">\r\n {{link.transId|translate}}\r\n </a>\r\n </div>\r\n <div *ngIf=\"link.children&&link.children.length>0\">\r\n <i class=\"d-none fas fa-chevron-up\" [class.d-block]=\"link.transId===expandedLink\"></i>\r\n <i class=\"d-none fas fa-chevron-down\" [class.d-block]=\"link.transId!==expandedLink\"></i>\r\n </div>\r\n </div>\r\n <ul class=\"list-unstyled d-none\" [class.d-block]=\"link.transId===expandedLink\">\r\n <li class=\"py-1 m-0\" *ngFor=\"let subLink of link.children\" style=\"padding-left:2.2rem;\">\r\n <a [href]=\"subLink.url\">\r\n {{subLink.transId|translate}}\r\n </a>\r\n </li>\r\n </ul>\r\n </li>\r\n </ul>\r\n <div *ngIf=\"navigation.about\" class=\"mt-2 mb-auto\">\r\n <div class=\"mb-1\">{{'ADB_HEADER.CONTACT'|translate}}</div>\r\n <div class=\"mb-1 row\">\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse\" [ngClass]=\"navigation.about.icon\"></span>\r\n </small>\r\n <a [href]=\"navigation.about.url\">\r\n {{navigation.about.transId|translate}}\r\n </a>\r\n </div>\r\n </div>\r\n <div class=\"col-sm-6 mb-2\">\r\n <div class=\"bg-white p-2\">\r\n <small class=\"fa-stack\" *ngIf=\"navigation.about.icon\">\r\n <span class=\"fas fa-circle fa-stack-2x text-primary\"></span>\r\n <span class=\"fas fa-stack-1x fa-inverse fa-envelope\"></span>\r\n </small>\r\n <a class=\"bg-white p-2\" href=\"mailto:artfakta@artdatabanken.se\">artfakta@artdatabanken.se</a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div style=\"height:10rem\"></div>\r\n <div>\r\n <img style=\"height: 3.2rem;\" src=\"/assets/images/logo.svg\">\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</header>\r\n"
180
- }] }
181
- ];
182
- /** @nocollapse */
183
- ADBHeaderComponent.ctorParameters = function () { return [
184
- { type: HttpClient },
185
- { type: EnvironmentService },
186
- { type: TranslateService }
187
- ]; };
188
- ADBHeaderComponent.propDecorators = {
189
- loginClicked: [{ type: Output }],
190
- logoutClicked: [{ type: Output }],
191
- dropMenuChange: [{ type: Output }],
192
- userName: [{ type: Input }]
193
- };
194
- return ADBHeaderComponent;
195
- }());
196
- if (false) {
197
- /**
198
- * @type {?}
199
- * @private
200
- */
201
- ADBHeaderComponent.prototype.subscription;
202
- /** @type {?} */
203
- ADBHeaderComponent.prototype.loginClicked;
204
- /** @type {?} */
205
- ADBHeaderComponent.prototype.logoutClicked;
206
- /** @type {?} */
207
- ADBHeaderComponent.prototype.dropMenuChange;
208
- /** @type {?} */
209
- ADBHeaderComponent.prototype.fullName;
210
- /** @type {?} */
211
- ADBHeaderComponent.prototype.initials;
212
- /** @type {?} */
213
- ADBHeaderComponent.prototype.showMenu;
214
- /** @type {?} */
215
- ADBHeaderComponent.prototype.showUserMenu;
216
- /** @type {?} */
217
- ADBHeaderComponent.prototype.navigation;
218
- /** @type {?} */
219
- ADBHeaderComponent.prototype.url;
220
- /** @type {?} */
221
- ADBHeaderComponent.prototype.expandedLink;
222
- /**
223
- * @type {?}
224
- * @private
225
- */
226
- ADBHeaderComponent.prototype.httpClient;
227
- /**
228
- * @type {?}
229
- * @private
230
- */
231
- ADBHeaderComponent.prototype.envService;
232
- /** @type {?} */
233
- ADBHeaderComponent.prototype.trans;
234
- /* Skipping unhandled member: ;*/
235
- }
236
-
237
- /**
238
- * @fileoverview added by tsickle
239
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
240
- */
241
- var ClickOutsideDirective = /** @class */ (function () {
242
- function ClickOutsideDirective(elementRef) {
243
- this.elementRef = elementRef;
244
- this.clickOutside = new EventEmitter();
245
- }
246
- /**
247
- * @param {?} target
248
- * @return {?}
249
- */
250
- ClickOutsideDirective.prototype.onClick = /**
251
- * @param {?} target
252
- * @return {?}
253
- */
254
- function (target) {
255
- /** @type {?} */
256
- var clickedInside = this.elementRef.nativeElement.contains(target);
257
- if (!clickedInside) {
258
- this.clickOutside.emit();
259
- }
260
- };
261
- ClickOutsideDirective.decorators = [
262
- { type: Directive, args: [{
263
- selector: '[clickOutside]',
264
- },] }
265
- ];
266
- /** @nocollapse */
267
- ClickOutsideDirective.ctorParameters = function () { return [
268
- { type: ElementRef }
269
- ]; };
270
- ClickOutsideDirective.propDecorators = {
271
- clickOutside: [{ type: Output }],
272
- onClick: [{ type: HostListener, args: ['document:click', ['$event.target'],] }]
273
- };
274
- return ClickOutsideDirective;
275
- }());
276
- if (false) {
277
- /** @type {?} */
278
- ClickOutsideDirective.prototype.clickOutside;
279
- /**
280
- * @type {?}
281
- * @private
282
- */
283
- ClickOutsideDirective.prototype.elementRef;
284
- }
285
-
286
- /**
287
- * @fileoverview added by tsickle
288
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
289
- */
290
- var ADBHeaderModule = /** @class */ (function () {
291
- function ADBHeaderModule() {
292
- }
293
- /**
294
- * @param {?} environment
295
- * @return {?}
296
- */
297
- ADBHeaderModule.forRoot = /**
298
- * @param {?} environment
299
- * @return {?}
300
- */
301
- function (environment) {
302
- return {
303
- ngModule: ADBHeaderModule,
304
- providers: [
305
- EnvironmentService,
306
- {
307
- provide: 'env',
308
- // you can also use InjectionToken
309
- useValue: environment
310
- }
311
- ]
312
- };
313
- };
314
- ADBHeaderModule.decorators = [
315
- { type: NgModule, args: [{
316
- declarations: [ADBHeaderComponent, ClickOutsideDirective],
317
- imports: [
318
- CommonModule,
319
- HttpClientModule,
320
- RouterModule,
321
- TranslateModule
322
- ],
323
- exports: [ADBHeaderComponent]
324
- },] }
325
- ];
326
- return ADBHeaderModule;
327
- }());
328
-
329
- /**
330
- * @fileoverview added by tsickle
331
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
332
- */
333
-
334
- /**
335
- * @fileoverview added by tsickle
336
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
337
- */
338
-
339
- export { ADBHeaderComponent, ADBHeaderModule, EnvironmentService as ɵa, ClickOutsideDirective as ɵb };
340
- //# sourceMappingURL=adb-shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adb-shared.js","sources":["ng://adb-shared/lib/environment.service.ts","ng://adb-shared/lib/adb-header.component.ts","ng://adb-shared/lib/click-outside.directive.ts","ng://adb-shared/lib/adb-header.module.ts"],"sourcesContent":["import { Inject, Injectable } from \"@angular/core\";\r\n\r\n@Injectable()\r\nexport class EnvironmentService {\r\n constructor(@Inject('env') public environment) {\r\n }\r\n}","import { HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { forkJoin, Subscription } from 'rxjs';\r\nimport { EnvironmentService } from './environment.service';\r\nimport { Navigation } from './navigation.model';\r\nimport { take } from 'rxjs/operators';\r\n@Component({\r\n selector: 'adb-header2',\r\n templateUrl: './adb-header.component.html'\r\n})\r\nexport class ADBHeaderComponent implements OnInit, OnDestroy {\r\n private subscription = new Subscription();\r\n @Output() loginClicked = new EventEmitter();\r\n @Output() logoutClicked = new EventEmitter();\r\n @Output() dropMenuChange = new EventEmitter<boolean>();\r\n fullName: string;\r\n @Input() set userName(fullName: string) {\r\n this.fullName = fullName;\r\n const splitted = fullName.split(' ');\r\n if (splitted && splitted.length > 1) {\r\n const initials = splitted.shift().charAt(0) + splitted.pop().charAt(0);\r\n this.initials = initials.toUpperCase();\r\n }\r\n };\r\n initials: string;\r\n showMenu = false;\r\n showUserMenu = false;\r\n navigation: Navigation;\r\n url: string;\r\n expandedLink: string;\r\n constructor(\r\n private httpClient: HttpClient,\r\n private envService: EnvironmentService,\r\n public trans: TranslateService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.url = window.location.href;\r\n const baseUrl = this.envService.environment.resourceUrl;\r\n this.subscription.add(this.httpClient.get<Navigation>(baseUrl + '/assets/links.json').subscribe(result => {\r\n this.navigation = result;\r\n }));\r\n this.initAllTranslations(baseUrl);\r\n }\r\n\r\n private initAllTranslations(baseUrl: string): void {\r\n const trans$ = forkJoin([this.httpClient.get(baseUrl + '/assets/i18n/en.json'), this.httpClient.get(baseUrl + '/assets/i18n/sv.json')])\r\n this.subscription.add(trans$.subscribe(result => {\r\n this.trans.setTranslation('en', result[0], true);\r\n this.trans.setTranslation('sv', result[1], true);\r\n }));\r\n }\r\n\r\n showMenuDropdown(show: boolean): void {\r\n if (this.showMenu !== show) {\r\n this.showMenu = show;\r\n this.dropMenuChange.emit(show);\r\n }\r\n }\r\n\r\n setLanguage(lang): void {\r\n this.trans.use(lang);\r\n //TODO: set localstorage/cookies or probaly event to main app\r\n }\r\n\r\n onExpandLink(transId: string): void {\r\n if (this.expandedLink === transId) {\r\n this.expandedLink = null;\r\n return;\r\n }\r\n this.expandedLink = transId;\r\n }\r\n\r\n login(): void {\r\n this.loginClicked.emit();\r\n }\r\n\r\n logout(): void {\r\n this.logoutClicked.emit();\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.subscription.unsubscribe();\r\n }\r\n\r\n}\r\n\r\n\r\n // if (this.trans.store.translations[this.trans.currentLang]) {\r\n // console.log('this.trans.currentLang', this.trans.currentLang);\r\n // this.initTranslations(baseUrl, this.trans.currentLang);\r\n // } else {\r\n // this.subscription.add(this.trans.onLangChange.subscribe((event) => {\r\n // console.log('event', event);\r\n // this.initTranslations(baseUrl, event.lang);\r\n // }));\r\n // }\r\n // private initTranslations(baseUrl: string, lang: string): void {\r\n // //TODO: Prepare for diffents lang then en sv (en-GB) or add more files in devcomponentserver :)\r\n // this.subscription.add(this.httpClient.get(baseUrl + `/assets/i18n/${lang}.json`, { headers: new HttpHeaders() }).subscribe(translations => {\r\n // this.trans.setTranslation(lang, translations, true);\r\n // }));\r\n // }","import { Directive, Input, Output, EventEmitter, ElementRef, HostListener } from '@angular/core';\r\n@Directive({\r\n selector: '[clickOutside]',\r\n})\r\nexport class ClickOutsideDirective {\r\n @Output() clickOutside = new EventEmitter<void>();\r\n constructor(private elementRef: ElementRef) { }\r\n\r\n @HostListener('document:click', ['$event.target'])\r\n public onClick(target: any) {\r\n const clickedInside = this.elementRef.nativeElement.contains(target);\r\n if (!clickedInside) {\r\n this.clickOutside.emit();\r\n }\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule } from '@angular/core';\r\nimport { TranslateLoader, TranslateModule } from '@ngx-translate/core';\r\nimport { ADBHeaderComponent } from './adb-header.component';\r\nimport { HttpClient, HttpClientModule } from '@angular/common/http';\r\nimport { TranslateHttpLoader } from '@ngx-translate/http-loader';\r\nimport { EnvironmentService } from './environment.service';\r\nimport { RouterModule } from '@angular/router';\r\nimport { ClickOutsideDirective } from './click-outside.directive';\r\n\r\n\r\n@NgModule({\r\n declarations: [ADBHeaderComponent, ClickOutsideDirective],\r\n imports: [\r\n CommonModule,\r\n HttpClientModule,\r\n RouterModule,\r\n TranslateModule\r\n ],\r\n exports: [ADBHeaderComponent]\r\n})\r\nexport class ADBHeaderModule {\r\n public static forRoot(environment: any): ModuleWithProviders<ADBHeaderModule> {\r\n return {\r\n ngModule: ADBHeaderModule,\r\n providers: [\r\n EnvironmentService,\r\n {\r\n provide: 'env', // you can also use InjectionToken\r\n useValue: environment\r\n }\r\n ]\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;IAII,4BAAkC,WAAW;QAAX,gBAAW,GAAX,WAAW,CAAA;KAC5C;;gBAHJ,UAAU;;;;gDAEM,MAAM,SAAC,KAAK;;IAE7B,yBAAC;CAJD,IAIC;;;IAFe,yCAAiC;;;;;;;ACJjD;IA+BE,4BACU,UAAsB,EACtB,UAA8B,EAC/B,KAAuB;QAFtB,eAAU,GAAV,UAAU,CAAY;QACtB,eAAU,GAAV,UAAU,CAAoB;QAC/B,UAAK,GAAL,KAAK,C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