@onecx/angular-accelerator 4.40.1 → 4.41.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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Optional, Input, HostListener, EventEmitter, Output, Component, Injectable, Injector, LOCALE_ID, Pipe, Inject, ViewEncapsulation, ContentChild, ViewChild, NgModule, inject } from '@angular/core';
2
+ import { Directive, Optional, Input, HostListener, EventEmitter, Output, Component, Injectable, Injector, LOCALE_ID, Pipe, Inject, ViewEncapsulation, ContentChild, ViewChild, NgModule, InjectionToken, inject } from '@angular/core';
3
3
  import * as i3 from '@onecx/angular-integration-interface';
4
4
  import { UserService } from '@onecx/angular-integration-interface';
5
5
  import * as i1 from '@angular/common/http';
@@ -3011,14 +3011,15 @@ class TranslationCacheTopic extends SyncableTopic {
3011
3011
  }
3012
3012
  class TranslationCacheService {
3013
3013
  constructor() {
3014
+ this.id = '';
3014
3015
  this.translationTopic$ = new TranslationCacheTopic();
3015
3016
  this.translations$ = new BehaviorSubject({});
3016
3017
  this.translationTopic$
3017
- .pipe(withLatestFrom(this.translations$), map(([topicTranslations, translations]) => {
3018
+ .pipe(filter((message) => message['id'] === this.id), withLatestFrom(this.translations$), map(([topicTranslations, translations]) => {
3018
3019
  let foundValueOthersDoNotKnow = false;
3019
3020
  const newTranslations = { ...translations };
3020
3021
  Object.keys(topicTranslations).forEach((k) => {
3021
- if (!topicTranslations[k] && translations[k]) {
3022
+ if (!topicTranslations[k] && translations[k] && k !== this.id) {
3022
3023
  foundValueOthersDoNotKnow = true;
3023
3024
  }
3024
3025
  newTranslations[k] ?? (newTranslations[k] = topicTranslations[k]);
@@ -3034,13 +3035,16 @@ class TranslationCacheService {
3034
3035
  ngOnDestroy() {
3035
3036
  this.translationTopic$.destroy();
3036
3037
  }
3038
+ setId(id) {
3039
+ this.id = 'translation-'.concat(id);
3040
+ }
3037
3041
  getTranslationFile(url, cacheMissFunction) {
3038
3042
  if (this.translations$.value[url]) {
3039
3043
  return of(this.translations$.value[url]);
3040
3044
  }
3041
- this.translationTopic$.publish({ ...this.translations$.value, [url]: null });
3045
+ this.translationTopic$.publish({ ...this.translations$.value, [url]: null, id: this.id });
3042
3046
  return race(this.translations$.pipe(filter((t) => t[url]), map((t) => t[url])), cacheMissFunction().pipe(tap((t) => {
3043
- this.translationTopic$.publish({ ...this.translations$.value, [url]: t });
3047
+ this.translationTopic$.publish({ ...this.translations$.value, [url]: t, id: this.id });
3044
3048
  }))).pipe(first());
3045
3049
  }
3046
3050
  }
@@ -3370,8 +3374,10 @@ class TranslateCombinedLoader {
3370
3374
  }
3371
3375
 
3372
3376
  let lastTranslateLoaderTimerId$1 = 0;
3373
- function createTranslateLoader(http, appStateService, translationCacheService) {
3377
+ const MFE_ID = new InjectionToken('MFE_ID');
3378
+ function createTranslateLoader(http, appStateService, mfeId, translationCacheService) {
3374
3379
  const ts = translationCacheService ?? inject(TranslationCacheService);
3380
+ ts.setId(mfeId);
3375
3381
  const timerId = lastTranslateLoaderTimerId$1++;
3376
3382
  console.time('createTranslateLoader_' + timerId);
3377
3383
  return new AsyncTranslateLoader(combineLatest([appStateService.currentMfe$.asObservable(), appStateService.globalLoading$.asObservable()]).pipe(filter(([, isLoading]) => !isLoading), map(([currentMfe]) => {
@@ -3419,8 +3425,10 @@ function isValidDate(value) {
3419
3425
  }
3420
3426
 
3421
3427
  let lastTranslateLoaderTimerId = 0;
3422
- function createRemoteComponentTranslateLoader(http, baseUrlReplaySubject$, translationCacheService) {
3428
+ const REMOTE_COMPONENT_ID = new InjectionToken('REMOTE_COMPONENT_ID');
3429
+ function createRemoteComponentTranslateLoader(http, baseUrlReplaySubject$, remoteComponentId, translationCacheService) {
3423
3430
  const ts = translationCacheService ?? inject(TranslationCacheService);
3431
+ ts.setId(remoteComponentId);
3424
3432
  const timerId = lastTranslateLoaderTimerId++;
3425
3433
  console.time('createRemoteComponentTranslateLoader_' + timerId);
3426
3434
  return new AsyncTranslateLoader(baseUrlReplaySubject$.pipe(map((baseUrl) => {
@@ -3447,5 +3455,5 @@ function enumToDropdownOptions(translateService, enumType, translationKeyPrefix)
3447
3455
  * Generated bundle index. Do not edit.
3448
3456
  */
3449
3457
 
3450
- export { AdvancedDirective, AngularAcceleratorMissingTranslationHandler, AngularAcceleratorModule, AngularAcceleratorPrimeNgModule, AppConfigService, AsyncTranslateLoader, BreadcrumbService, CachingTranslateLoader, ColorUtils, ColumnGroupSelectionComponent, ColumnType, CustomGroupColumnSelectorComponent, DataLayoutSelectionComponent, DataListGridComponent, DataListGridSortingComponent, DataTableComponent, DataViewComponent, DateUtils, DiagramComponent, DynamicPipe, GroupByCountDiagramComponent, IfBreakpointDirective, IfPermissionDirective, InteractiveDataViewComponent, ObjectUtils, OcxTimeAgoPipe, PageHeaderComponent, SearchConfigComponent, SearchHeaderComponent, SrcDirective, TranslateCombinedLoader, TranslationCacheService, createRemoteComponentTranslateLoader, createTranslateLoader, enumToDropdownOptions, flattenObject, isValidDate };
3458
+ export { AdvancedDirective, AngularAcceleratorMissingTranslationHandler, AngularAcceleratorModule, AngularAcceleratorPrimeNgModule, AppConfigService, AsyncTranslateLoader, BreadcrumbService, CachingTranslateLoader, ColorUtils, ColumnGroupSelectionComponent, ColumnType, CustomGroupColumnSelectorComponent, DataLayoutSelectionComponent, DataListGridComponent, DataListGridSortingComponent, DataTableComponent, DataViewComponent, DateUtils, DiagramComponent, DynamicPipe, GroupByCountDiagramComponent, IfBreakpointDirective, IfPermissionDirective, InteractiveDataViewComponent, MFE_ID, ObjectUtils, OcxTimeAgoPipe, PageHeaderComponent, REMOTE_COMPONENT_ID, SearchConfigComponent, SearchHeaderComponent, SrcDirective, TranslateCombinedLoader, TranslationCacheService, createRemoteComponentTranslateLoader, createTranslateLoader, enumToDropdownOptions, flattenObject, isValidDate };
3451
3459
  //# sourceMappingURL=onecx-angular-accelerator.mjs.map