@eui/tools 5.3.38 → 5.3.41

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.38
1
+ 5.3.41
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## 5.3.41 (2022-09-06)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * 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))
7
+ * 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))
8
+
9
+ * * *
10
+ * * *
11
+ ## 5.3.40 (2022-08-08)
12
+
13
+ ##### Bug Fixes
14
+
15
+ * **resolutions:**
16
+ * resolutions.json for v10 on npm package nopt - EUI-6319 [EUI-6319](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6319) ([f9abfa0d](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f9abfa0d37a217bf4ab93c2ae496039abcc5004b))
17
+
18
+ * * *
19
+ * * *
20
+ ## 5.3.39 (2022-08-08)
21
+
22
+ ##### Bug Fixes
23
+
24
+ * **resolutions:**
25
+ * resolutions.json for v10 on npm package glob - EUI-6319 [EUI-6319](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6319) ([d8491bee](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d8491beeb4d782d2688437f4ccaa3d0f1d2a310f))
26
+
27
+ * * *
28
+ * * *
1
29
  ## 5.3.38 (2022-07-29)
2
30
 
3
31
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.38",
3
+ "version": "5.3.41",
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));
@@ -4,5 +4,7 @@
4
4
  "@types/node": "14.14.10",
5
5
  "mem": ">=4.3.0 <=8.1.1",
6
6
  "lru-cache": "5.1.1",
7
- "update-notifier": "4.1.3"
7
+ "update-notifier": "4.1.3",
8
+ "glob": ">=7.0.0 <8.0.0",
9
+ "nopt": ">=5.0.0 <6.0.0"
8
10
  }