@onecx/angular-accelerator 4.44.2 → 4.44.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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Directive, Inject, Optional, Input, HostListener, EventEmitter, Output, Component, Injectable, Injector, LOCALE_ID, Pipe, ViewEncapsulation, ContentChild, ViewChild, NgModule, inject } from '@angular/core';
2
+ import { InjectionToken, Directive, Inject, Optional, Input, HostListener, EventEmitter, Output, Component, Injectable, Injector, LOCALE_ID, Pipe, ViewEncapsulation, ContentChild, ViewChild, NgModule, APP_INITIALIZER, inject } from '@angular/core';
3
3
  import * as i1 from '@angular/common/http';
4
4
  import * as i4 from '@angular/common';
5
5
  import { CurrencyPipe, DecimalPipe, DatePipe, Location, CommonModule } from '@angular/common';
@@ -13,7 +13,7 @@ import * as i1$1 from '@ngx-translate/core';
13
13
  import { TranslateService, TranslatePipe, TranslateModule } from '@ngx-translate/core';
14
14
  import * as i2$1 from 'primeng/api';
15
15
  import { PrimeIcons } from 'primeng/api';
16
- import { BehaviorSubject, filter, concat, of, map, combineLatest, mergeMap, first, tap, firstValueFrom, defaultIfEmpty, forkJoin } from 'rxjs';
16
+ import { BehaviorSubject, filter, concat, of, map, combineLatest, mergeMap, first, tap, firstValueFrom, skip, defaultIfEmpty, forkJoin } from 'rxjs';
17
17
  import * as i3$1 from '@onecx/angular-integration-interface';
18
18
  import { UserService } from '@onecx/angular-integration-interface';
19
19
  import { __decorate, __metadata } from 'tslib';
@@ -3267,12 +3267,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3267
3267
  }]
3268
3268
  }] });
3269
3269
 
3270
+ class DynamicLocaleId {
3271
+ constructor(userService) {
3272
+ this.userService = userService;
3273
+ Object.getOwnPropertyNames(String.prototype).forEach((k) => {
3274
+ if (k != 'valueOf') {
3275
+ ;
3276
+ this[k] = function (...args) {
3277
+ const str = this.valueOf();
3278
+ return str[k](...args);
3279
+ };
3280
+ }
3281
+ });
3282
+ }
3283
+ valueOf() {
3284
+ return this.userService.lang$.getValue();
3285
+ }
3286
+ }
3287
+
3270
3288
  class AngularAcceleratorMissingTranslationHandler {
3271
3289
  handle(params) {
3272
3290
  console.log(`Missing translation for ${params.key}`, params);
3273
3291
  return params.key;
3274
3292
  }
3275
3293
  }
3294
+ function appInitializer(userService) {
3295
+ return async () => {
3296
+ await firstValueFrom(userService.lang$.pipe(skip(1)));
3297
+ };
3298
+ }
3276
3299
  class AngularAcceleratorModule {
3277
3300
  }
3278
3301
  AngularAcceleratorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AngularAcceleratorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -3321,15 +3344,19 @@ AngularAcceleratorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0"
3321
3344
  AngularAcceleratorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AngularAcceleratorModule, providers: [
3322
3345
  {
3323
3346
  provide: LOCALE_ID,
3324
- useFactory: (UserService) => {
3325
- return UserService.lang$.getValue();
3326
- },
3347
+ useClass: DynamicLocaleId,
3327
3348
  deps: [UserService],
3328
3349
  },
3329
3350
  {
3330
3351
  provide: HAS_PERMISSION_CHECKER,
3331
3352
  useExisting: UserService,
3332
3353
  },
3354
+ {
3355
+ provide: APP_INITIALIZER,
3356
+ useFactory: appInitializer,
3357
+ deps: [UserService],
3358
+ multi: true
3359
+ },
3333
3360
  AppConfigService,
3334
3361
  ], imports: [CommonModule,
3335
3362
  AngularAcceleratorPrimeNgModule,
@@ -3373,15 +3400,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3373
3400
  providers: [
3374
3401
  {
3375
3402
  provide: LOCALE_ID,
3376
- useFactory: (UserService) => {
3377
- return UserService.lang$.getValue();
3378
- },
3403
+ useClass: DynamicLocaleId,
3379
3404
  deps: [UserService],
3380
3405
  },
3381
3406
  {
3382
3407
  provide: HAS_PERMISSION_CHECKER,
3383
3408
  useExisting: UserService,
3384
3409
  },
3410
+ {
3411
+ provide: APP_INITIALIZER,
3412
+ useFactory: appInitializer,
3413
+ deps: [UserService],
3414
+ multi: true
3415
+ },
3385
3416
  AppConfigService,
3386
3417
  ],
3387
3418
  exports: [