@onecx/angular-accelerator 4.33.0 → 4.33.1

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,9 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Directive, Optional, Input, HostListener, EventEmitter, Output, Component, Injectable, Injector, LOCALE_ID, Pipe, Inject, ViewEncapsulation, ContentChild, ViewChild, NgModule, inject } from '@angular/core';
3
3
  import * as i3 from '@onecx/angular-integration-interface';
4
- import { UserService, AppStateService } from '@onecx/angular-integration-interface';
4
+ import { UserService } from '@onecx/angular-integration-interface';
5
5
  import * as i1 from '@angular/common/http';
6
- import { HttpClient } from '@angular/common/http';
7
6
  import * as i3$1 from '@angular/common';
8
7
  import { CurrencyPipe, DecimalPipe, DatePipe, Location, CommonModule } from '@angular/common';
9
8
  import * as i6 from 'primeng/button';
@@ -13,7 +12,7 @@ import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angul
13
12
  import * as i2 from 'primeng/dropdown';
14
13
  import { DropdownModule } from 'primeng/dropdown';
15
14
  import * as i1$1 from '@ngx-translate/core';
16
- import { TranslatePipe, TranslateModule, TranslateLoader, MissingTranslationHandler } from '@ngx-translate/core';
15
+ import { TranslatePipe, TranslateModule } from '@ngx-translate/core';
17
16
  import * as i2$1 from 'primeng/api';
18
17
  import { PrimeIcons } from 'primeng/api';
19
18
  import { BehaviorSubject, filter, concat, of, map, combineLatest, mergeMap, withLatestFrom, tap, race, first, firstValueFrom, defaultIfEmpty, forkJoin } from 'rxjs';
@@ -3091,88 +3090,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3091
3090
  }]
3092
3091
  }] });
3093
3092
 
3094
- class AsyncTranslateLoader {
3095
- constructor(translateLoader$) {
3096
- this.translateLoader$ = translateLoader$;
3097
- this.timerId = AsyncTranslateLoader.lastTimerId++;
3098
- }
3099
- getTranslation(lang) {
3100
- return this.translateLoader$.pipe(tap(() => console.time('AsyncTranslateLoader_' + this.timerId)), defaultIfEmpty(undefined), first(), mergeMap((translateLoader) => translateLoader?.getTranslation(lang) ?? of({})), tap(() => console.timeEnd('AsyncTranslateLoader_' + this.timerId)));
3101
- }
3102
- }
3103
- AsyncTranslateLoader.lastTimerId = 0;
3104
-
3105
- class CachingTranslateLoader {
3106
- constructor(translationCache, http, prefix, suffix) {
3107
- this.translationCache = translationCache;
3108
- this.http = http;
3109
- this.prefix = prefix;
3110
- this.suffix = suffix;
3111
- this.translateLoader = new TranslateHttpLoader(this.http, this.prefix, this.suffix);
3112
- }
3113
- getTranslation(lang) {
3114
- const url = `${this.prefix}${lang}${this.suffix}`;
3115
- return this.translationCache.getTranslationFile(url, () => this.translateLoader.getTranslation(lang));
3116
- }
3117
- }
3118
-
3119
- class TranslateCombinedLoader {
3120
- constructor(...loaders) {
3121
- this._loaders = loaders;
3122
- }
3123
- getTranslation(lang) {
3124
- return forkJoin(this._loaders.map((l) => l.getTranslation(lang))).pipe(map((allTranslations) => {
3125
- let result = {};
3126
- allTranslations.forEach((translations) => {
3127
- result = this.mergeDeep(result, translations);
3128
- });
3129
- return result;
3130
- }));
3131
- }
3132
- isObject(item) {
3133
- return item && typeof item === 'object' && !Array.isArray(item);
3134
- }
3135
- mergeDeep(target, source) {
3136
- const output = Object.assign({}, target);
3137
- if (this.isObject(target) && this.isObject(source)) {
3138
- Object.keys(source).forEach((key) => {
3139
- if (this.isObject(source[key])) {
3140
- if (!(key in target))
3141
- Object.assign(output, { [key]: source[key] });
3142
- else
3143
- output[key] = this.mergeDeep(target[key], source[key]);
3144
- }
3145
- else {
3146
- Object.assign(output, { [key]: source[key] });
3147
- }
3148
- });
3149
- }
3150
- return output;
3151
- }
3152
- }
3153
-
3154
- let lastTranslateLoaderTimerId$1 = 0;
3155
- function createTranslateLoader(http, appStateService, translationCacheService) {
3156
- const ts = translationCacheService ?? inject(TranslationCacheService);
3157
- const timerId = lastTranslateLoaderTimerId$1++;
3158
- console.time('createTranslateLoader_' + timerId);
3159
- return new AsyncTranslateLoader(combineLatest([appStateService.currentMfe$.asObservable(), appStateService.globalLoading$.asObservable()]).pipe(filter(([, isLoading]) => !isLoading), map(([currentMfe]) => {
3160
- return new TranslateCombinedLoader(
3161
- // translations of shell or of app in standalone mode
3162
- new CachingTranslateLoader(ts, http, `./assets/i18n/`, '.json'),
3163
- // translations of portal-integration-angular of app
3164
- new CachingTranslateLoader(ts, http, Location.joinWithSlash(currentMfe.remoteBaseUrl, `onecx-portal-lib/assets/i18n/`), '.json'),
3165
- // translations of the app
3166
- new CachingTranslateLoader(ts, http, Location.joinWithSlash(currentMfe.remoteBaseUrl, `assets/i18n/`), '.json'));
3167
- }), tap(() => console.timeEnd('createTranslateLoader_' + timerId))));
3168
- }
3169
-
3170
- class AngularAcceleratorMissingTranslationHandler {
3171
- handle(params) {
3172
- console.log(`Missing translation for ${params.key}`, params);
3173
- return params.key;
3174
- }
3175
- }
3176
3093
  class AngularAcceleratorModule {
3177
3094
  }
3178
3095
  AngularAcceleratorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AngularAcceleratorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -3196,7 +3113,9 @@ AngularAcceleratorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0"
3196
3113
  OcxTimeAgoPipe,
3197
3114
  SrcDirective,
3198
3115
  AdvancedDirective], imports: [CommonModule,
3199
- AngularAcceleratorPrimeNgModule, i1$1.TranslateModule, FormsModule,
3116
+ AngularAcceleratorPrimeNgModule,
3117
+ TranslateModule,
3118
+ FormsModule,
3200
3119
  RouterModule,
3201
3120
  ReactiveFormsModule], exports: [ColumnGroupSelectionComponent,
3202
3121
  CustomGroupColumnSelectorComponent,
@@ -3227,18 +3146,7 @@ AngularAcceleratorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0"
3227
3146
  AppConfigService,
3228
3147
  ], imports: [CommonModule,
3229
3148
  AngularAcceleratorPrimeNgModule,
3230
- TranslateModule.forRoot({
3231
- isolate: true,
3232
- loader: {
3233
- provide: TranslateLoader,
3234
- useFactory: createTranslateLoader,
3235
- deps: [HttpClient, AppStateService, TranslationCacheService],
3236
- },
3237
- missingTranslationHandler: {
3238
- provide: MissingTranslationHandler,
3239
- useClass: AngularAcceleratorMissingTranslationHandler,
3240
- },
3241
- }),
3149
+ TranslateModule,
3242
3150
  FormsModule,
3243
3151
  RouterModule,
3244
3152
  ReactiveFormsModule] });
@@ -3248,18 +3156,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3248
3156
  imports: [
3249
3157
  CommonModule,
3250
3158
  AngularAcceleratorPrimeNgModule,
3251
- TranslateModule.forRoot({
3252
- isolate: true,
3253
- loader: {
3254
- provide: TranslateLoader,
3255
- useFactory: createTranslateLoader,
3256
- deps: [HttpClient, AppStateService, TranslationCacheService],
3257
- },
3258
- missingTranslationHandler: {
3259
- provide: MissingTranslationHandler,
3260
- useClass: AngularAcceleratorMissingTranslationHandler,
3261
- },
3262
- }),
3159
+ TranslateModule,
3263
3160
  FormsModule,
3264
3161
  RouterModule,
3265
3162
  ReactiveFormsModule,
@@ -3315,11 +3212,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3315
3212
  OcxTimeAgoPipe,
3316
3213
  SrcDirective,
3317
3214
  AdvancedDirective,
3318
- // DataListGridSortingComponent,
3319
3215
  ],
3320
3216
  }]
3321
3217
  }] });
3322
3218
 
3219
+ class AsyncTranslateLoader {
3220
+ constructor(translateLoader$) {
3221
+ this.translateLoader$ = translateLoader$;
3222
+ this.timerId = AsyncTranslateLoader.lastTimerId++;
3223
+ }
3224
+ getTranslation(lang) {
3225
+ return this.translateLoader$.pipe(tap(() => console.time('AsyncTranslateLoader_' + this.timerId)), defaultIfEmpty(undefined), first(), mergeMap((translateLoader) => translateLoader?.getTranslation(lang) ?? of({})), tap(() => console.timeEnd('AsyncTranslateLoader_' + this.timerId)));
3226
+ }
3227
+ }
3228
+ AsyncTranslateLoader.lastTimerId = 0;
3229
+
3230
+ class CachingTranslateLoader {
3231
+ constructor(translationCache, http, prefix, suffix) {
3232
+ this.translationCache = translationCache;
3233
+ this.http = http;
3234
+ this.prefix = prefix;
3235
+ this.suffix = suffix;
3236
+ this.translateLoader = new TranslateHttpLoader(this.http, this.prefix, this.suffix);
3237
+ }
3238
+ getTranslation(lang) {
3239
+ const url = `${this.prefix}${lang}${this.suffix}`;
3240
+ return this.translationCache.getTranslationFile(url, () => this.translateLoader.getTranslation(lang));
3241
+ }
3242
+ }
3243
+
3244
+ class TranslateCombinedLoader {
3245
+ constructor(...loaders) {
3246
+ this._loaders = loaders;
3247
+ }
3248
+ getTranslation(lang) {
3249
+ return forkJoin(this._loaders.map((l) => l.getTranslation(lang))).pipe(map((allTranslations) => {
3250
+ let result = {};
3251
+ allTranslations.forEach((translations) => {
3252
+ result = this.mergeDeep(result, translations);
3253
+ });
3254
+ return result;
3255
+ }));
3256
+ }
3257
+ isObject(item) {
3258
+ return item && typeof item === 'object' && !Array.isArray(item);
3259
+ }
3260
+ mergeDeep(target, source) {
3261
+ const output = Object.assign({}, target);
3262
+ if (this.isObject(target) && this.isObject(source)) {
3263
+ Object.keys(source).forEach((key) => {
3264
+ if (this.isObject(source[key])) {
3265
+ if (!(key in target))
3266
+ Object.assign(output, { [key]: source[key] });
3267
+ else
3268
+ output[key] = this.mergeDeep(target[key], source[key]);
3269
+ }
3270
+ else {
3271
+ Object.assign(output, { [key]: source[key] });
3272
+ }
3273
+ });
3274
+ }
3275
+ return output;
3276
+ }
3277
+ }
3278
+
3279
+ let lastTranslateLoaderTimerId$1 = 0;
3280
+ function createTranslateLoader(http, appStateService, translationCacheService) {
3281
+ const ts = translationCacheService ?? inject(TranslationCacheService);
3282
+ const timerId = lastTranslateLoaderTimerId$1++;
3283
+ console.time('createTranslateLoader_' + timerId);
3284
+ return new AsyncTranslateLoader(combineLatest([appStateService.currentMfe$.asObservable(), appStateService.globalLoading$.asObservable()]).pipe(filter(([, isLoading]) => !isLoading), map(([currentMfe]) => {
3285
+ return new TranslateCombinedLoader(
3286
+ // translations of shell or of app in standalone mode
3287
+ new CachingTranslateLoader(ts, http, `./assets/i18n/`, '.json'),
3288
+ // translations of portal-integration-angular of app
3289
+ new CachingTranslateLoader(ts, http, Location.joinWithSlash(currentMfe.remoteBaseUrl, `onecx-portal-lib/assets/i18n/`), '.json'),
3290
+ // translations of the app
3291
+ new CachingTranslateLoader(ts, http, Location.joinWithSlash(currentMfe.remoteBaseUrl, `assets/i18n/`), '.json'));
3292
+ }), tap(() => console.timeEnd('createTranslateLoader_' + timerId))));
3293
+ }
3294
+
3323
3295
  class DateUtils {
3324
3296
  constructor(locale) {
3325
3297
  this.locale = locale;
@@ -3379,5 +3351,5 @@ function enumToDropdownOptions(translateService, enumType, translationKeyPrefix)
3379
3351
  * Generated bundle index. Do not edit.
3380
3352
  */
3381
3353
 
3382
- 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 };
3354
+ export { AdvancedDirective, 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 };
3383
3355
  //# sourceMappingURL=onecx-angular-accelerator.mjs.map