@lenne.tech/ng-base 17.0.1 → 18.1.0

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 (128) hide show
  1. package/base-cms/pages/base-cms/base-cms.component.d.ts +1 -1
  2. package/base-cms/public-api.d.ts +0 -1
  3. package/base-components/components/breadcrumb/breadcrumb.component.d.ts +1 -1
  4. package/base-components/components/change-password/change-password.component.d.ts +1 -1
  5. package/base-components/components/checkbox/checkbox.component.d.ts +1 -1
  6. package/base-components/components/delete-account/delete-account.component.d.ts +1 -1
  7. package/base-components/components/fab-button/fab-button.component.d.ts +1 -1
  8. package/base-components/components/input/input.component.d.ts +1 -1
  9. package/base-components/components/model-form/model-form-base.component.d.ts +1 -1
  10. package/base-components/components/model-form/model-form.component.d.ts +1 -1
  11. package/base-components/components/model-form-sub/model-form-sub.component.d.ts +1 -1
  12. package/base-components/components/model-table/model-table.component.d.ts +1 -1
  13. package/base-components/components/refence-input/refence-input.component.d.ts +1 -1
  14. package/base-components/components/select/select.component.d.ts +1 -1
  15. package/base-components/components/skeleton-loader/skeleton-loader.component.d.ts +1 -1
  16. package/base-components/components/tags/tags.component.d.ts +1 -1
  17. package/base-components/components/textarea/textarea.component.d.ts +1 -1
  18. package/base-components/components/toast/toast.component.d.ts +1 -1
  19. package/base-components/components/upload-image/upload-image.component.d.ts +1 -1
  20. package/base-components/directives/back-button.directive.d.ts +1 -1
  21. package/base-components/directives/context-menu.directive.d.ts +1 -1
  22. package/base-components/directives/sort.directive.d.ts +1 -1
  23. package/base-components/directives/stop-propagation.directive.d.ts +1 -1
  24. package/base-components/pipes/ellipses.pipe.d.ts +1 -1
  25. package/base-components/public-api.d.ts +0 -1
  26. package/base-prototype/pages/email-verification/email-verification.component.d.ts +1 -1
  27. package/base-prototype/pages/forgot-password/forgot-password.component.d.ts +1 -1
  28. package/base-prototype/pages/login/login.component.d.ts +1 -1
  29. package/base-prototype/pages/profile/profile.component.d.ts +1 -1
  30. package/base-prototype/pages/register/register.component.d.ts +2 -2
  31. package/base-prototype/pages/set-password/set-password.component.d.ts +1 -1
  32. package/base-prototype/public-api.d.ts +0 -1
  33. package/esm2022/base-cms/pages/base-cms/base-cms.component.mjs +14 -8
  34. package/esm2022/base-cms/public-api.mjs +1 -3
  35. package/esm2022/base-components/components/breadcrumb/breadcrumb.component.mjs +10 -7
  36. package/esm2022/base-components/components/change-password/change-password.component.mjs +11 -9
  37. package/esm2022/base-components/components/checkbox/checkbox.component.mjs +10 -6
  38. package/esm2022/base-components/components/delete-account/delete-account.component.mjs +5 -6
  39. package/esm2022/base-components/components/fab-button/fab-button.component.mjs +11 -7
  40. package/esm2022/base-components/components/input/input.component.mjs +10 -6
  41. package/esm2022/base-components/components/loading-bar/loading-bar.component.mjs +5 -6
  42. package/esm2022/base-components/components/model-form/model-form-base.component.mjs +5 -4
  43. package/esm2022/base-components/components/model-form/model-form.component.mjs +17 -10
  44. package/esm2022/base-components/components/model-form-sub/model-form-sub.component.mjs +20 -13
  45. package/esm2022/base-components/components/model-table/model-table.component.mjs +23 -14
  46. package/esm2022/base-components/components/refence-input/refence-input.component.mjs +13 -7
  47. package/esm2022/base-components/components/select/select.component.mjs +10 -6
  48. package/esm2022/base-components/components/skeleton-loader/skeleton-loader.component.mjs +8 -6
  49. package/esm2022/base-components/components/tags/tags.component.mjs +11 -7
  50. package/esm2022/base-components/components/textarea/textarea.component.mjs +10 -6
  51. package/esm2022/base-components/components/toast/toast.component.mjs +8 -6
  52. package/esm2022/base-components/components/upload-image/upload-image.component.mjs +13 -9
  53. package/esm2022/base-components/directives/back-button.directive.mjs +5 -4
  54. package/esm2022/base-components/directives/context-menu.directive.mjs +5 -4
  55. package/esm2022/base-components/directives/sort.directive.mjs +5 -4
  56. package/esm2022/base-components/directives/stop-propagation.directive.mjs +5 -4
  57. package/esm2022/base-components/pipes/ellipses.pipe.mjs +5 -4
  58. package/esm2022/base-components/public-api.mjs +1 -3
  59. package/esm2022/base-prototype/pages/email-verification/email-verification.component.mjs +5 -6
  60. package/esm2022/base-prototype/pages/forgot-password/forgot-password.component.mjs +12 -8
  61. package/esm2022/base-prototype/pages/login/login.component.mjs +12 -8
  62. package/esm2022/base-prototype/pages/profile/profile.component.mjs +8 -6
  63. package/esm2022/base-prototype/pages/register/register.component.mjs +14 -9
  64. package/esm2022/base-prototype/pages/set-password/set-password.component.mjs +11 -9
  65. package/esm2022/base-prototype/public-api.mjs +1 -3
  66. package/esm2022/shared/classes/basic-user.class.mjs +1 -1
  67. package/esm2022/shared/classes/graphql-meta.class.mjs +1 -1
  68. package/esm2022/shared/classes/helper.class.mjs +1 -1
  69. package/esm2022/shared/classes/sort.class.mjs +1 -1
  70. package/esm2022/shared/classes/standard.class.mjs +1 -1
  71. package/esm2022/shared/functions/ws-client.function.mjs +1 -1
  72. package/esm2022/shared/services/auth.service.mjs +4 -4
  73. package/esm2022/shared/services/breadcrumb.service.mjs +4 -4
  74. package/esm2022/shared/services/cms.service.mjs +4 -4
  75. package/esm2022/shared/services/file.service.mjs +4 -4
  76. package/esm2022/shared/services/forms.service.mjs +4 -4
  77. package/esm2022/shared/services/graphql-meta.service.mjs +4 -4
  78. package/esm2022/shared/services/graphql-plus.service.mjs +4 -4
  79. package/esm2022/shared/services/graphql.service.mjs +7 -7
  80. package/esm2022/shared/services/image.service.mjs +4 -4
  81. package/esm2022/shared/services/loader.service.mjs +4 -4
  82. package/esm2022/shared/services/navigation.service.mjs +4 -4
  83. package/esm2022/shared/services/scroll.service.mjs +4 -4
  84. package/esm2022/shared/services/storage.service.mjs +4 -4
  85. package/esm2022/shared/services/toast.service.mjs +4 -4
  86. package/esm2022/shared/services/user.service.mjs +3 -3
  87. package/esm2022/shared/services/ws.service.mjs +3 -3
  88. package/esm2022/shared/validators/match.validator.mjs +1 -1
  89. package/esm2022/src/base.module.mjs +7 -40
  90. package/esm2022/src/decorators/auto-unsubscribe.decorator.mjs +1 -1
  91. package/esm2022/src/directives/lazy-load.directive.mjs +5 -4
  92. package/esm2022/src/directives/match-height.directive.mjs +5 -4
  93. package/esm2022/src/directives/resizable.directive.mjs +5 -4
  94. package/esm2022/src/factories/apollo-options.factory.mjs +1 -1
  95. package/esm2022/src/functions/extract-files.function.mjs +1 -1
  96. package/esm2022/src/guards/auth.guard.mjs +4 -4
  97. package/esm2022/src/guards/can-deactivate.guard.mjs +3 -3
  98. package/esm2022/src/guards/logout.guard.mjs +4 -4
  99. package/esm2022/src/pipes/date-ago.pipe.mjs +5 -4
  100. package/esm2022/src/pipes/safe-html.pipe.mjs +5 -5
  101. package/esm2022/src/services/fullscreen.service.mjs +4 -4
  102. package/esm2022/src/services/seo.service.mjs +4 -4
  103. package/esm2022/src/services/theme.service.mjs +4 -4
  104. package/fesm2022/lenne.tech-ng-base-base-cms.mjs +16 -93
  105. package/fesm2022/lenne.tech-ng-base-base-cms.mjs.map +1 -1
  106. package/fesm2022/lenne.tech-ng-base-base-components.mjs +669 -697
  107. package/fesm2022/lenne.tech-ng-base-base-components.mjs.map +1 -1
  108. package/fesm2022/lenne.tech-ng-base-base-prototype.mjs +48 -74
  109. package/fesm2022/lenne.tech-ng-base-base-prototype.mjs.map +1 -1
  110. package/fesm2022/lenne.tech-ng-base-shared.mjs +51 -51
  111. package/fesm2022/lenne.tech-ng-base-shared.mjs.map +1 -1
  112. package/fesm2022/lenne.tech-ng-base.mjs +199 -223
  113. package/fesm2022/lenne.tech-ng-base.mjs.map +1 -1
  114. package/package.json +12 -12
  115. package/src/base.module.d.ts +2 -8
  116. package/src/directives/lazy-load.directive.d.ts +1 -1
  117. package/src/directives/match-height.directive.d.ts +1 -1
  118. package/src/directives/resizable.directive.d.ts +1 -1
  119. package/src/pipes/date-ago.pipe.d.ts +1 -1
  120. package/src/pipes/safe-html.pipe.d.ts +1 -1
  121. package/base-cms/base-cms-routing.module.d.ts +0 -7
  122. package/base-cms/base-cms.module.d.ts +0 -26
  123. package/base-components/base-components.module.d.ts +0 -32
  124. package/base-prototype/base-prototype.module.d.ts +0 -17
  125. package/esm2022/base-cms/base-cms-routing.module.mjs +0 -32
  126. package/esm2022/base-cms/base-cms.module.mjs +0 -60
  127. package/esm2022/base-components/base-components.module.mjs +0 -122
  128. package/esm2022/base-prototype/base-prototype.module.mjs +0 -53
@@ -1,8 +1,8 @@
1
1
  import { APOLLO_OPTIONS, ApolloModule } from 'apollo-angular';
2
2
  import { HttpLink } from 'apollo-angular/http';
3
3
  import * as i0 from '@angular/core';
4
- import { Directive, HostBinding, Input, PLATFORM_ID, Inject, HostListener, Pipe, NgModule, Injectable } from '@angular/core';
5
- import { ApolloLink, fromPromise, concat, split } from '@apollo/client/core';
4
+ import { NgModule, Directive, HostBinding, Input, PLATFORM_ID, Inject, HostListener, Injectable, Pipe } from '@angular/core';
5
+ import { ApolloLink, fromPromise, split, concat } from '@apollo/client/core';
6
6
  import { InMemoryCache } from '@apollo/client/cache';
7
7
  import { getMainDefinition } from '@apollo/client/utilities';
8
8
  import * as i2 from '@lenne.tech/ng-base/shared';
@@ -10,10 +10,10 @@ import { createRestartableClient, BASE_MODULE_CONFIG, AuthService, WsService } f
10
10
  import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
11
11
  import { firstValueFrom, Observable, BehaviorSubject } from 'rxjs';
12
12
  import { onError } from '@apollo/client/link/error';
13
+ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
13
14
  import { isPlatformBrowser } from '@angular/common';
14
- import * as i1 from '@angular/platform-browser';
15
- import { HttpClientModule } from '@angular/common/http';
16
- import * as i1$1 from '@angular/router';
15
+ import * as i1 from '@angular/router';
16
+ import * as i1$1 from '@angular/platform-browser';
17
17
 
18
18
  /**
19
19
  * Inspired by Inpspired by https://github.com/jaydenseric/extract-files/releases/tag/v11.0.0
@@ -202,6 +202,86 @@ function apolloOptionsFactory(baseModuleConfig, httpLink, authService, wsService
202
202
  };
203
203
  }
204
204
 
205
+ /**
206
+ * Base module
207
+ */
208
+ class BaseModule {
209
+ /**
210
+ * Set configuration of base module in root module of the app
211
+ */
212
+ static forRoot(baseModuleConfig = {}, AppAuthService) {
213
+ // Default config
214
+ const config = {
215
+ apiUrl: '',
216
+ authGuardRedirectUrl: '/auth',
217
+ logging: false,
218
+ version: null,
219
+ prefix: null,
220
+ scrollDetectionOffset: 200,
221
+ scrollOffset: 100,
222
+ storageType: 'local',
223
+ securePasswordTransfer: true,
224
+ ...baseModuleConfig,
225
+ };
226
+ if (config.logging) {
227
+ console.log('Config:', config);
228
+ }
229
+ // Prepare providers
230
+ const providers = [
231
+ {
232
+ provide: BASE_MODULE_CONFIG,
233
+ useValue: config,
234
+ },
235
+ ];
236
+ // Add apollo features if API URL is set
237
+ if (baseModuleConfig.apiUrl) {
238
+ providers.push({
239
+ provide: APOLLO_OPTIONS,
240
+ useFactory: apolloOptionsFactory,
241
+ deps: [BASE_MODULE_CONFIG, HttpLink, AppAuthService ? AppAuthService : AuthService, WsService],
242
+ });
243
+ }
244
+ else if (config.logging) {
245
+ console.log('apiUrl is missing, ApolloLink is not initialized');
246
+ }
247
+ // Return root module
248
+ return {
249
+ ngModule: BaseModule,
250
+ providers,
251
+ };
252
+ }
253
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: BaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
254
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.2", ngImport: i0, type: BaseModule, imports: [ApolloModule], exports: [ApolloModule] });
255
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: BaseModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [ApolloModule, ApolloModule] });
256
+ }
257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: BaseModule, decorators: [{
258
+ type: NgModule,
259
+ args: [{ exports: [ApolloModule], imports: [ApolloModule], providers: [provideHttpClient(withInterceptorsFromDi())] }]
260
+ }] });
261
+
262
+ /**
263
+ * Decorator for automatically unsubscribe subscriptions
264
+ * Inspired by https://codereacter.medium.com/angular-advanced-features-and-tips-you-may-not-know-about-cae3b8527184#9bd6
265
+ */
266
+ function AutoUnsubscribe(blackList = []) {
267
+ return function (constructor) {
268
+ const original = constructor.prototype.ngOnDestroy;
269
+ constructor.prototype.ngOnDestroy = function () {
270
+ for (const prop of Object.keys(this)) {
271
+ if (!blackList.includes(prop)) {
272
+ const property = this[prop];
273
+ if (property && typeof property.unsubscribe === 'function') {
274
+ property.unsubscribe();
275
+ }
276
+ }
277
+ }
278
+ if (original && typeof original === 'function') {
279
+ original.apply(this, arguments);
280
+ }
281
+ };
282
+ };
283
+ }
284
+
205
285
  /**
206
286
  * Directive for lazy loading images
207
287
  */
@@ -232,13 +312,14 @@ class LazyLoadDirective {
232
312
  loadImage() {
233
313
  this.srcAttr = this.src;
234
314
  }
235
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LazyLoadDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
236
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.4", type: LazyLoadDirective, selector: "img[ltLazyLoad]", inputs: { src: "src" }, host: { properties: { "attr.src": "this.srcAttr" } }, ngImport: i0 });
315
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: LazyLoadDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
316
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: LazyLoadDirective, isStandalone: true, selector: "img[ltLazyLoad]", inputs: { src: "src" }, host: { properties: { "attr.src": "this.srcAttr" } }, ngImport: i0 });
237
317
  }
238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LazyLoadDirective, decorators: [{
318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: LazyLoadDirective, decorators: [{
239
319
  type: Directive,
240
320
  args: [{
241
321
  selector: 'img[ltLazyLoad]',
322
+ standalone: true
242
323
  }]
243
324
  }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { srcAttr: [{
244
325
  type: HostBinding,
@@ -314,13 +395,14 @@ class MatchHeightDirective {
314
395
  Array.from(children).forEach((element) => (element.style.height = `${maxHeight}px`));
315
396
  }
316
397
  }
317
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: MatchHeightDirective, deps: [{ token: i0.ElementRef }, { token: i2.ImageService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
318
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.4", type: MatchHeightDirective, selector: "[ltMatchHeight]", inputs: { ltMatchHeight: "ltMatchHeight", loadImages: "loadImages" }, host: { listeners: { "window:resize": "onResize()" } }, ngImport: i0 });
398
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: MatchHeightDirective, deps: [{ token: i0.ElementRef }, { token: i2.ImageService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
399
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: MatchHeightDirective, isStandalone: true, selector: "[ltMatchHeight]", inputs: { ltMatchHeight: "ltMatchHeight", loadImages: "loadImages" }, host: { listeners: { "window:resize": "onResize()" } }, ngImport: i0 });
319
400
  }
320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: MatchHeightDirective, decorators: [{
401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: MatchHeightDirective, decorators: [{
321
402
  type: Directive,
322
403
  args: [{
323
404
  selector: '[ltMatchHeight]',
405
+ standalone: true
324
406
  }]
325
407
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i2.ImageService }, { type: undefined, decorators: [{
326
408
  type: Inject,
@@ -409,13 +491,14 @@ class ResizableDirective {
409
491
  this.mouseMove(e);
410
492
  }, true);
411
493
  }
412
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ResizableDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
413
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.4", type: ResizableDirective, selector: "[ltResizable]", inputs: { resizableGrabWidth: "resizableGrabWidth", resizableMinWidth: "resizableMinWidth" }, ngImport: i0 });
494
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: ResizableDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
495
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: ResizableDirective, isStandalone: true, selector: "[ltResizable]", inputs: { resizableGrabWidth: "resizableGrabWidth", resizableMinWidth: "resizableMinWidth" }, ngImport: i0 });
414
496
  }
415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ResizableDirective, decorators: [{
497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: ResizableDirective, decorators: [{
416
498
  type: Directive,
417
499
  args: [{
418
500
  selector: '[ltResizable]',
501
+ standalone: true,
419
502
  }]
420
503
  }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { resizableGrabWidth: [{
421
504
  type: Input
@@ -423,194 +506,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImpor
423
506
  type: Input
424
507
  }] } });
425
508
 
426
- /**
427
- * Declarate html as safe
428
- */
429
- class SafeHtmlPipe {
430
- sanitized;
431
- constructor(sanitized) {
432
- this.sanitized = sanitized;
433
- }
434
- transform(value) {
435
- return this.sanitized.bypassSecurityTrustHtml(value);
436
- }
437
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
438
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: SafeHtmlPipe, name: "ltSafeHtml" });
439
- }
440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: SafeHtmlPipe, decorators: [{
441
- type: Pipe,
442
- args: [{ name: 'ltSafeHtml' }]
443
- }], ctorParameters: () => [{ type: i1.DomSanitizer }] });
444
-
445
- class DateAgoPipe {
446
- intervals = {
447
- year: 31536000,
448
- month: 2592000,
449
- week: 604800,
450
- day: 86400,
451
- hour: 3600,
452
- minute: 60,
453
- second: 1,
454
- };
455
- singular = {
456
- year: 'Jahr',
457
- month: 'Monat',
458
- week: 'Woche',
459
- day: 'Tag',
460
- hour: 'Stunde',
461
- minute: 'Minute',
462
- second: 'Sekunde',
463
- };
464
- plural = {
465
- year: 'Jahren',
466
- month: 'Monaten',
467
- week: 'Wochen',
468
- day: 'Tagen',
469
- hour: 'Stunden',
470
- minute: 'Minuten',
471
- second: 'Sekunden',
472
- };
473
- transform(value, currentDate) {
474
- const now = currentDate ?? new Date();
475
- if (value) {
476
- const seconds = Math.floor((+now - +new Date(value)) / 1000);
477
- if (seconds < 29) {
478
- return 'gerade eben'; // less than 30 seconds ago will show as 'Just now'
479
- }
480
- let counter;
481
- for (const i of Object.keys(this.intervals)) {
482
- counter = Math.floor(seconds / this.intervals[i]);
483
- if (counter > 0) {
484
- if (counter === 1) {
485
- return 'vor ' + counter + ' ' + this.singular[i]; // singular (1 day ago)
486
- }
487
- else {
488
- return 'vor ' + counter + ' ' + this.plural[i]; // plural (2 days ago)
489
- }
490
- }
491
- }
492
- }
493
- return value;
494
- }
495
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: DateAgoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
496
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: DateAgoPipe, name: "dateAgo" });
497
- }
498
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: DateAgoPipe, decorators: [{
499
- type: Pipe,
500
- args: [{
501
- name: 'dateAgo',
502
- pure: true,
503
- }]
504
- }] });
505
-
506
- // Imported and exported elements
507
- const elements = [
508
- // Directives
509
- LazyLoadDirective,
510
- MatchHeightDirective,
511
- ResizableDirective,
512
- // Pipes
513
- SafeHtmlPipe,
514
- DateAgoPipe,
515
- ];
516
- /**
517
- * Base module
518
- */
519
- class BaseModule {
520
- /**
521
- * Set configuration of base module in root module of the app
522
- */
523
- static forRoot(baseModuleConfig = {}, AppAuthService) {
524
- // Default config
525
- const config = {
526
- apiUrl: '',
527
- authGuardRedirectUrl: '/auth',
528
- logging: false,
529
- version: null,
530
- prefix: null,
531
- scrollDetectionOffset: 200,
532
- scrollOffset: 100,
533
- storageType: 'local',
534
- securePasswordTransfer: true,
535
- ...baseModuleConfig,
536
- };
537
- if (config.logging) {
538
- console.log('Config:', config);
539
- }
540
- // Prepare providers
541
- const providers = [
542
- {
543
- provide: BASE_MODULE_CONFIG,
544
- useValue: config,
545
- },
546
- ];
547
- // Add apollo features if API URL is set
548
- if (baseModuleConfig.apiUrl) {
549
- providers.push({
550
- provide: APOLLO_OPTIONS,
551
- useFactory: apolloOptionsFactory,
552
- deps: [BASE_MODULE_CONFIG, HttpLink, AppAuthService ? AppAuthService : AuthService, WsService],
553
- });
554
- }
555
- else if (config.logging) {
556
- console.log('apiUrl is missing, ApolloLink is not initialized');
557
- }
558
- // Return root module
559
- return {
560
- ngModule: BaseModule,
561
- providers,
562
- };
563
- }
564
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: BaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
565
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: BaseModule, declarations: [
566
- // Directives
567
- LazyLoadDirective,
568
- MatchHeightDirective,
569
- ResizableDirective,
570
- // Pipes
571
- SafeHtmlPipe,
572
- DateAgoPipe], imports: [ApolloModule, HttpClientModule], exports: [
573
- // Directives
574
- LazyLoadDirective,
575
- MatchHeightDirective,
576
- ResizableDirective,
577
- // Pipes
578
- SafeHtmlPipe,
579
- DateAgoPipe, ApolloModule, HttpClientModule] });
580
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: BaseModule, imports: [ApolloModule, HttpClientModule, ApolloModule, HttpClientModule] });
581
- }
582
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: BaseModule, decorators: [{
583
- type: NgModule,
584
- args: [{
585
- imports: [ApolloModule, HttpClientModule],
586
- declarations: elements,
587
- exports: [...elements, ApolloModule, HttpClientModule],
588
- }]
589
- }] });
590
-
591
- /**
592
- * Decorator for automatically unsubscribe subscriptions
593
- * Inspired by https://codereacter.medium.com/angular-advanced-features-and-tips-you-may-not-know-about-cae3b8527184#9bd6
594
- */
595
- function AutoUnsubscribe(blackList = []) {
596
- return function (constructor) {
597
- const original = constructor.prototype.ngOnDestroy;
598
- constructor.prototype.ngOnDestroy = function () {
599
- for (const prop of Object.keys(this)) {
600
- if (!blackList.includes(prop)) {
601
- const property = this[prop];
602
- if (property && typeof property.unsubscribe === 'function') {
603
- property.unsubscribe();
604
- }
605
- }
606
- }
607
- if (original && typeof original === 'function') {
608
- original.apply(this, arguments);
609
- }
610
- };
611
- };
612
- }
613
-
614
509
  /**
615
510
  * Authentication guard
616
511
  */
@@ -682,12 +577,12 @@ class AuthGuard {
682
577
  canActivateChild(route, state) {
683
578
  return this.canActivate(route, state);
684
579
  }
685
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: AuthGuard, deps: [{ token: i1$1.Router }, { token: i2.AuthService }, { token: BASE_MODULE_CONFIG }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
686
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: AuthGuard });
580
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AuthGuard, deps: [{ token: i1.Router }, { token: i2.AuthService }, { token: BASE_MODULE_CONFIG }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
581
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AuthGuard });
687
582
  }
688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: AuthGuard, decorators: [{
583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AuthGuard, decorators: [{
689
584
  type: Injectable
690
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i2.AuthService }, { type: undefined, decorators: [{
585
+ }], ctorParameters: () => [{ type: i1.Router }, { type: i2.AuthService }, { type: undefined, decorators: [{
691
586
  type: Inject,
692
587
  args: [BASE_MODULE_CONFIG]
693
588
  }] }, { type: undefined, decorators: [{
@@ -702,10 +597,10 @@ class CanDeactivateGuard {
702
597
  canDeactivate(component) {
703
598
  return component.canDeactivate ? component.canDeactivate() : true;
704
599
  }
705
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: CanDeactivateGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
706
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: CanDeactivateGuard });
600
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: CanDeactivateGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
601
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: CanDeactivateGuard });
707
602
  }
708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: CanDeactivateGuard, decorators: [{
603
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: CanDeactivateGuard, decorators: [{
709
604
  type: Injectable
710
605
  }] });
711
606
 
@@ -731,12 +626,93 @@ class LogoutGuard {
731
626
  canActivateChild(route, state) {
732
627
  return this.canActivate(route, state);
733
628
  }
734
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LogoutGuard, deps: [{ token: i1$1.Router }, { token: i2.AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
735
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LogoutGuard });
629
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: LogoutGuard, deps: [{ token: i1.Router }, { token: i2.AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
630
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: LogoutGuard });
736
631
  }
737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LogoutGuard, decorators: [{
632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: LogoutGuard, decorators: [{
738
633
  type: Injectable
739
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i2.AuthService }] });
634
+ }], ctorParameters: () => [{ type: i1.Router }, { type: i2.AuthService }] });
635
+
636
+ /**
637
+ * Declarate html as safe
638
+ */
639
+ class SafeHtmlPipe {
640
+ sanitized;
641
+ constructor(sanitized) {
642
+ this.sanitized = sanitized;
643
+ }
644
+ transform(value) {
645
+ return this.sanitized.bypassSecurityTrustHtml(value);
646
+ }
647
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
648
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.2", ngImport: i0, type: SafeHtmlPipe, isStandalone: true, name: "ltSafeHtml" });
649
+ }
650
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: SafeHtmlPipe, decorators: [{
651
+ type: Pipe,
652
+ args: [{ name: 'ltSafeHtml', standalone: true }]
653
+ }], ctorParameters: () => [{ type: i1$1.DomSanitizer }] });
654
+
655
+ class DateAgoPipe {
656
+ intervals = {
657
+ year: 31536000,
658
+ month: 2592000,
659
+ week: 604800,
660
+ day: 86400,
661
+ hour: 3600,
662
+ minute: 60,
663
+ second: 1,
664
+ };
665
+ singular = {
666
+ year: 'Jahr',
667
+ month: 'Monat',
668
+ week: 'Woche',
669
+ day: 'Tag',
670
+ hour: 'Stunde',
671
+ minute: 'Minute',
672
+ second: 'Sekunde',
673
+ };
674
+ plural = {
675
+ year: 'Jahren',
676
+ month: 'Monaten',
677
+ week: 'Wochen',
678
+ day: 'Tagen',
679
+ hour: 'Stunden',
680
+ minute: 'Minuten',
681
+ second: 'Sekunden',
682
+ };
683
+ transform(value, currentDate) {
684
+ const now = currentDate ?? new Date();
685
+ if (value) {
686
+ const seconds = Math.floor((+now - +new Date(value)) / 1000);
687
+ if (seconds < 29) {
688
+ return 'gerade eben'; // less than 30 seconds ago will show as 'Just now'
689
+ }
690
+ let counter;
691
+ for (const i of Object.keys(this.intervals)) {
692
+ counter = Math.floor(seconds / this.intervals[i]);
693
+ if (counter > 0) {
694
+ if (counter === 1) {
695
+ return 'vor ' + counter + ' ' + this.singular[i]; // singular (1 day ago)
696
+ }
697
+ else {
698
+ return 'vor ' + counter + ' ' + this.plural[i]; // plural (2 days ago)
699
+ }
700
+ }
701
+ }
702
+ }
703
+ return value;
704
+ }
705
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: DateAgoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
706
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.2", ngImport: i0, type: DateAgoPipe, isStandalone: true, name: "dateAgo" });
707
+ }
708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: DateAgoPipe, decorators: [{
709
+ type: Pipe,
710
+ args: [{
711
+ name: 'dateAgo',
712
+ pure: true,
713
+ standalone: true,
714
+ }]
715
+ }] });
740
716
 
741
717
  /**
742
718
  * Fullscreen service
@@ -776,10 +752,10 @@ class FullscreenService {
776
752
  }
777
753
  });
778
754
  }
779
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: FullscreenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
780
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: FullscreenService, providedIn: 'root' });
755
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: FullscreenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
756
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: FullscreenService, providedIn: 'root' });
781
757
  }
782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: FullscreenService, decorators: [{
758
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: FullscreenService, decorators: [{
783
759
  type: Injectable,
784
760
  args: [{
785
761
  providedIn: 'root',
@@ -878,15 +854,15 @@ class SEOService {
878
854
  setPageKeywords(keywords) {
879
855
  this.metaTagService.updateTag({ name: 'keywords', content: keywords });
880
856
  }
881
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: SEOService, deps: [{ token: i1.Title }, { token: i1.Meta }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
882
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: SEOService, providedIn: 'root' });
857
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: SEOService, deps: [{ token: i1$1.Title }, { token: i1$1.Meta }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
858
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: SEOService, providedIn: 'root' });
883
859
  }
884
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: SEOService, decorators: [{
860
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: SEOService, decorators: [{
885
861
  type: Injectable,
886
862
  args: [{
887
863
  providedIn: 'root',
888
864
  }]
889
- }], ctorParameters: () => [{ type: i1.Title }, { type: i1.Meta }, { type: undefined, decorators: [{
865
+ }], ctorParameters: () => [{ type: i1$1.Title }, { type: i1$1.Meta }, { type: undefined, decorators: [{
890
866
  type: Inject,
891
867
  args: [PLATFORM_ID]
892
868
  }] }] });
@@ -921,10 +897,10 @@ class ThemeService {
921
897
  this.theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
922
898
  }
923
899
  }
924
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ThemeService, deps: [{ token: i2.StorageService }], target: i0.ɵɵFactoryTarget.Injectable });
925
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ThemeService, providedIn: 'root' });
900
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: ThemeService, deps: [{ token: i2.StorageService }], target: i0.ɵɵFactoryTarget.Injectable });
901
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: ThemeService, providedIn: 'root' });
926
902
  }
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ThemeService, decorators: [{
903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: ThemeService, decorators: [{
928
904
  type: Injectable,
929
905
  args: [{
930
906
  providedIn: 'root',