@esfaenza/core 15.2.125 → 15.2.126

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,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, ViewEncapsulation, Input, ViewChild, HostListener, ChangeDetectionStrategy, Optional, Inject, Injectable, EventEmitter, Output, NgModule } from '@angular/core';
3
3
  import * as i2$1 from '@angular/common';
4
- import { NgFor, NgIf, NgTemplateOutlet, NgClass, CommonModule } from '@angular/common';
4
+ import { NgFor, NgIf, NgTemplateOutlet, NgClass, Location, CommonModule } from '@angular/common';
5
5
  import * as i2 from '@esfaenza/core/services';
6
6
  import { AppState } from '@esfaenza/core/services';
7
7
  import * as i1 from '@angular/router';
@@ -457,6 +457,8 @@ class ReactiveComponent {
457
457
  this.Subscriptions = [];
458
458
  this.destroyed$ = new ReplaySubject(1);
459
459
  }
460
+ // TODO: Check
461
+ //takeUntilDestroyed = new pipe(() => takeUntil(this.destroyed$))
460
462
  ngOnDestroy() {
461
463
  this.destroyed$.next(true);
462
464
  this.destroyed$.complete();
@@ -832,7 +834,8 @@ class BaseComponent extends ReactiveComponent {
832
834
  this.NavigationParameters = null;
833
835
  let _activatedRoute = injector.get(ActivatedRoute);
834
836
  let _state = injector.get(AppState);
835
- let emb = injector.get(AppEmbeddingExtensions);
837
+ this._emb = injector.get(AppEmbeddingExtensions);
838
+ this._location = injector.get(Location);
836
839
  this._router = injector.get(Router);
837
840
  _state.registerNavigationIfMeaningful(_activatedRoute.snapshot);
838
841
  // Parametri in maniera "dinamica"
@@ -840,14 +843,9 @@ class BaseComponent extends ReactiveComponent {
840
843
  this.gatherRouteInformations(_activatedRoute);
841
844
  // Per i componenti navigabili non embeddati è inutile mandare il messaggio di navigazione
842
845
  // Così come per quelli per cui non esiste un titolo (cioè compoennti verso cui non si è navigato direttamente)
843
- if (!emb.Embedded || !this.NavigationTitle)
846
+ if (!this._emb.Embedded || !this.NavigationTitle)
844
847
  return;
845
- // Se sono dentro un iframe risalgo a quello di livello più alto in assoluto
846
- let tmpWindow = window;
847
- // Quando il parent non esiste window. parent è un riferimento a se stesso
848
- while (tmpWindow.parent != tmpWindow)
849
- tmpWindow = tmpWindow.parent;
850
- tmpWindow.postMessage({ type: "navigation", url: this.CompletePath, internalNavigation: this.InternalNavigation, title: this.NavigationTitle }, "*");
848
+ this._emb.MainWindow.postMessage({ type: "navigation", url: this.CompletePath, internalNavigation: this.InternalNavigation, title: this.NavigationTitle }, "*");
851
849
  }
852
850
  gatherRouteInformations(_activatedRoute) {
853
851
  let segs = _activatedRoute.snapshot._urlSegment.segments;
@@ -866,6 +864,14 @@ class BaseComponent extends ReactiveComponent {
866
864
  commands[0] = this.BasePath + commands[0];
867
865
  this._router.navigate(command, extras);
868
866
  }
867
+ back() {
868
+ if (this._emb.Embedded) {
869
+ this._emb.MainWindow.postMessage({ type: "navigate-back" }, "*");
870
+ setTimeout(() => { this._location.back(); });
871
+ }
872
+ else
873
+ this._location.back();
874
+ }
869
875
  }
870
876
  BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
871
877
  BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: BaseComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });