@eui/tools 5.3.40 → 5.3.43

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 +1 @@
1
- 5.3.40
1
+ 5.3.43
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## 5.3.43 (2022-09-07)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted CSDR file replacement for config files for v14 replacement feature of CSDR apps - EUI-6398 [EUI-6398](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6398) ([5a11343b](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/5a11343b53dd6ff2e6c25e8bea173e0983a0a6ce))
7
+
8
+ * * *
9
+ * * *
10
+ ## 5.3.42 (2022-09-06)
11
+
12
+ ##### Bug Fixes
13
+
14
+ * **other:**
15
+ * v14 csdr angular generation for development with source maps - EUI-6398 [EUI-6398](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6398) ([666ef173](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/666ef17395f0529051a53f28d2c1c04e686319fa))
16
+
17
+ * * *
18
+ * * *
19
+ ## 5.3.41 (2022-09-06)
20
+
21
+ ##### Chores
22
+
23
+ * **other:**
24
+ * minor changes MWP-8671 [MWP-8671](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8671) ([940f42b9](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/940f42b96083d42ca15bb5bc6f3da975d8504013))
25
+ * improve lifecycle of elements loaded in iframes and better centralization of code MWP-8671 [MWP-8671](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8671) ([7a4b08a6](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/7a4b08a6504cf0ac386c355f75d6b83529e860ed))
26
+
27
+ * * *
28
+ * * *
1
29
  ## 5.3.40 (2022-08-08)
2
30
 
3
31
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.40",
3
+ "version": "5.3.43",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -1,12 +1,9 @@
1
- import { Component, OnInit, Inject } from '@angular/core';
2
- import { Router } from '@angular/router';
1
+ import { Component, OnInit, Inject, ElementRef, OnDestroy } from '@angular/core';
3
2
 
4
3
  import { take } from 'rxjs/operators';
5
4
 
6
5
  import { CONFIG_TOKEN } from '@eui/core';
7
- import { ELEMENT_ROUTER_TOKEN, IRouterService, ElementSetupService } from '@csdr/integration/element';
8
-
9
- import { appConfig } from '../config/index';
6
+ import { ElementSetupService, ElementLifeCycleService } from '@csdr/integration/element';
10
7
 
11
8
  enum ElementStatus {
12
9
  Loading = 'loading',
@@ -49,21 +46,28 @@ enum ElementStatus {
49
46
  }
50
47
  `],
51
48
  })
52
- export class ModuleComponent implements OnInit {
49
+ export class ModuleComponent implements OnInit, OnDestroy {
50
+ remoteId: string;
51
+
53
52
  ElementStatus = ElementStatus;
54
53
  moduleStatus: ElementStatus;
55
54
 
56
- constructor(private router: Router,
57
- @Inject(ELEMENT_ROUTER_TOKEN) private routerService: IRouterService,
55
+ constructor(private elRef: ElementRef,
58
56
  @Inject(CONFIG_TOKEN) public config: any,
57
+ private elementLifeCycleService: ElementLifeCycleService,
59
58
  private elementSetupService: ElementSetupService) {
60
59
  }
61
60
 
62
- public ngOnInit() {
63
- this.router.navigateByUrl(this.routerService.getUrl(), { replaceUrl: true });
61
+ ngOnInit() {
62
+ this.remoteId = this.elRef.nativeElement.remoteId;
63
+ this.elementLifeCycleService.setup(this.remoteId);
64
64
  this.loadData();
65
65
  }
66
66
 
67
+ ngOnDestroy(): void {
68
+ this.elementLifeCycleService.cleanup();
69
+ }
70
+
67
71
  private loadData() {
68
72
  this.setStatus(ElementStatus.Loading);
69
73
  try {
@@ -72,7 +76,7 @@ export class ModuleComponent implements OnInit {
72
76
  .subscribe((loadStatus: { success: boolean, error?: string }) => {
73
77
  if (!loadStatus.success) {
74
78
  this.setStatus(ElementStatus.Error);
75
- console.error(`[ELEMENT: ${appConfig.global.elementName}] `, loadStatus.error);
79
+ console.error(`[ELEMENT: ${this.config.global.elementName}] `, loadStatus.error);
76
80
  } else {
77
81
  this.setStatus(ElementStatus.Loaded);
78
82
  }
@@ -1,16 +1,14 @@
1
- import { NgModule, NgZone, Inject } from '@angular/core';
2
- import { RouterModule, Routes, Router, NavigationStart } from '@angular/router';
3
- import { Subscription } from 'rxjs';
4
- import { filter, distinctUntilChanged } from 'rxjs/operators';
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
5
3
 
6
- import { CCRoute, ELEMENT_ROUTER_TOKEN, IRouterService } from '@csdr/integration/element';
4
+ import { ELEMENT_ROUTES_TOKEN } from '@csdr/integration/element';
7
5
 
8
6
  import { routes } from '@module.scope@/@module.name@';
9
7
  import { appConfig } from '../config/index';
10
8
  import { FallbackComponent } from './fallback.component';
11
9
  import { ModuleComponent } from './module.component';
12
10
 
13
- const prefixedRoutes: Routes = [
11
+ const elementRoutes: Routes = [
14
12
  { path: '', component: ModuleComponent },
15
13
  {
16
14
  path: appConfig.global.baseUrl,
@@ -22,32 +20,14 @@ const prefixedRoutes: Routes = [
22
20
  // @dynamic
23
21
  @NgModule({
24
22
  imports: [
25
- RouterModule.forRoot(prefixedRoutes),
23
+ RouterModule.forRoot(elementRoutes),
24
+ ],
25
+ providers: [
26
+ { provide: ELEMENT_ROUTES_TOKEN, useValue: elementRoutes },
26
27
  ],
27
28
  exports: [
28
29
  RouterModule,
29
30
  ],
30
31
  })
31
32
  export class RoutingModule {
32
- private routes: CCRoute[] = prefixedRoutes.map(route => route as CCRoute);
33
-
34
- private navigationStartSubscription: Subscription;
35
-
36
- constructor(private router: Router,
37
- private ngZone: NgZone,
38
- @Inject(ELEMENT_ROUTER_TOKEN) private routerService: IRouterService) {
39
-
40
- this.routerService.registerSubRouter(appConfig.global.baseUrl, (url: string) => {
41
- this.ngZone.run(() => router.navigateByUrl(url));
42
- }, this.routes);
43
-
44
- this.navigationStartSubscription = this.router.events
45
- .pipe(
46
- filter(event => event instanceof NavigationStart),
47
- distinctUntilChanged((prev, curr) => prev['url'] === curr['url']),
48
- )
49
- .subscribe((data: NavigationStart) => {
50
- this.routerService.subrouterEvent(appConfig.global.baseUrl, data);
51
- });
52
- }
53
33
  }
@@ -1,3 +1,3 @@
1
1
  import { ModulesConfig } from '@eui/core';
2
2
 
3
- export const MODULES: ModulesConfig = window['PROVIDERS']['CONFIG_TOKEN'].modules;
3
+ export const MODULES: ModulesConfig = JSON.parse(JSON.stringify(window['PROVIDERS']['CONFIG_TOKEN'].modules));
@@ -1010,6 +1010,12 @@ const angularProjectDefFullSkeletonV14 = {
1010
1010
 
1011
1011
 
1012
1012
  const angularProjectDefConfiguration = {
1013
+ "buildOptimizer": false,
1014
+ "optimization": false,
1015
+ "vendorChunk": true,
1016
+ "extractLicenses": false,
1017
+ "sourceMap": true,
1018
+ "namedChunks": true,
1013
1019
  "fileReplacements": [
1014
1020
  {
1015
1021
  "replace": "apps/@project.name@/src/assets/openid-login-config.json",
@@ -1034,6 +1040,23 @@ const angularProjectDefConfiguration = {
1034
1040
  ]
1035
1041
  };
1036
1042
 
1043
+
1044
+ const angularProjectDefConfigurationLight = {
1045
+ "buildOptimizer": false,
1046
+ "optimization": false,
1047
+ "vendorChunk": true,
1048
+ "extractLicenses": false,
1049
+ "sourceMap": true,
1050
+ "namedChunks": true,
1051
+ "fileReplacements": [
1052
+ {
1053
+ "replace": "apps/@project.name@/src/environments/environment.ts",
1054
+ "with": "apps/@project.name@/src/environments/environment.@config.key@.ts"
1055
+ }
1056
+ ]
1057
+ };
1058
+
1059
+
1037
1060
  const angularProjectDefConfigurationOptimized = {
1038
1061
  "fileReplacements": [
1039
1062
  {
@@ -1076,6 +1099,31 @@ const angularProjectDefConfigurationOptimized = {
1076
1099
  }
1077
1100
 
1078
1101
 
1102
+ const angularProjectDefConfigurationOptimizedLight = {
1103
+ "fileReplacements": [
1104
+ {
1105
+ "replace": "apps/@project.name@/src/environments/environment.ts",
1106
+ "with": "apps/@project.name@/src/environments/environment.@config.key@.ts"
1107
+ }
1108
+ ],
1109
+ "optimization": true,
1110
+ "outputHashing": "all",
1111
+ "sourceMap": false,
1112
+ "extractCss": true,
1113
+ "namedChunks": true,
1114
+ "aot": true,
1115
+ "extractLicenses": true,
1116
+ "vendorChunk": false,
1117
+ "buildOptimizer": true,
1118
+ "budgets": [
1119
+ {
1120
+ "type": "initial",
1121
+ "maximumWarning": "2mb",
1122
+ "maximumError": "7mb"
1123
+ }
1124
+ ]
1125
+ };
1126
+
1079
1127
  const angularPackageDef = {
1080
1128
  "root": "@path@/@module.name@",
1081
1129
  "sourceRoot": "@path@/@module.name@/src",
@@ -1497,8 +1545,17 @@ module.exports.registerAngularProjectDef = (project, build = false) => {
1497
1545
  // replacing custom configurations if provided
1498
1546
  if (angularConfigFile.configurations && angularConfigFile.configurations.length > 0) {
1499
1547
  tools.logInfo('Processing configurations injection');
1500
- const configurationDef = JSON.stringify(angularProjectDefConfiguration);
1501
- const configurationDefOptimized = JSON.stringify(angularProjectDefConfigurationOptimized);
1548
+
1549
+ let configurationDef, configurationDefOptimized;
1550
+ if (project.build && project.build.csdrFileReplacement) {
1551
+ tools.logInfo('Injecting light angular configuration - file replacement is handled by CSDR');
1552
+ configurationDef = JSON.stringify(angularProjectDefConfigurationLight);
1553
+ configurationDefOptimized = JSON.stringify(angularProjectDefConfigurationOptimizedLight);
1554
+ } else {
1555
+ tools.logInfo('Injecting angular configuration file replacement');
1556
+ configurationDef = JSON.stringify(angularProjectDefConfiguration);
1557
+ configurationDefOptimized = JSON.stringify(angularProjectDefConfigurationOptimized);
1558
+ }
1502
1559
 
1503
1560
  angularConfigFile.configurations.forEach((conf) => {
1504
1561
  const confKey = Object.keys(conf)[0];