@esfaenza/extensions 15.2.33 → 15.2.34

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.
@@ -7,6 +7,7 @@ import { of, Subject } from 'rxjs';
7
7
  import { ToastrService } from 'ngx-toastr';
8
8
  import swal from 'sweetalert2';
9
9
  import * as i2 from '@angular/router';
10
+ import * as i3 from '@angular/common';
10
11
 
11
12
  /**
12
13
  * Token che indica il prefisso delle searchView che serve per storicizzarle evitando di tirarsi in memoria anche tutti gli oggetti. Se vuoto viene supposto 'Hot'
@@ -1037,9 +1038,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1037
1038
  // Angular
1038
1039
  /* Classe che contiene tutte le informazioni sull'embedding in un unico contenitore per semplicità */
1039
1040
  class AppEmbeddingExtensions {
1040
- constructor(msgService, router) {
1041
+ constructor(msgService, router, location) {
1041
1042
  this.msgService = msgService;
1042
1043
  this.router = router;
1044
+ this.location = location;
1043
1045
  this.sidebarWidth = 230;
1044
1046
  this.Embedded = false;
1045
1047
  this.EmbeddingLevel = 0;
@@ -1050,6 +1052,7 @@ class AppEmbeddingExtensions {
1050
1052
  this.MainWindow = this.MainWindow.parent;
1051
1053
  this.EmbeddingLevel++;
1052
1054
  this.Embedded = true;
1055
+ this.EmbeddedModule = this.location.path().match(/module=([a-zA-Z_]+)/)[1];
1053
1056
  }
1054
1057
  this.configureEmbeddability();
1055
1058
  if (this.Embedded)
@@ -1083,6 +1086,9 @@ class AppEmbeddingExtensions {
1083
1086
  break;
1084
1087
  }
1085
1088
  }
1089
+ else if (event?.data?.type == "replace-state") {
1090
+ this.location.replaceState(event?.data?.url);
1091
+ }
1086
1092
  else if (event?.data?.type == "confirm") {
1087
1093
  console.log(`Window message - confirm -> Level: ${event?.data?.level}, Message: ${event?.data?.text}, Title: ${event?.data?.title}, ID: ${event?.data?.guid}`);
1088
1094
  var sourceWindow = event.source;
@@ -1180,6 +1186,15 @@ class AppEmbeddingExtensions {
1180
1186
  if (this.Embedded)
1181
1187
  document.body.style.setProperty("overflow-y", "auto", "important");
1182
1188
  }
1189
+ replaceState(basePath, url) {
1190
+ // Esempio basePath: pages
1191
+ // Esempio url: parties/leads_search
1192
+ // Normalizzazione senza slash prima o dopo
1193
+ basePath = basePath.endsWith("/") ? basePath.substring(0, basePath.length - 2) : basePath;
1194
+ url = url.startsWith("/") ? url.substring(1) : url;
1195
+ this.location.replaceState(`${basePath}/${url}`);
1196
+ this.MainWindow.postMessage({ type: "replace-state", url: `pages/embed/${this.EmbeddedModule}/${url}` }, "*");
1197
+ }
1183
1198
  refreshBoundariesOnMenuCollapse() {
1184
1199
  const wrapper = document.body.getElementsByClassName("main-wrapper")[0];
1185
1200
  let wrapperStyles = window.getComputedStyle(wrapper);
@@ -1195,12 +1210,12 @@ class AppEmbeddingExtensions {
1195
1210
  left.style.setProperty("width", leftSpace + "px");
1196
1211
  }
1197
1212
  }
1198
- AppEmbeddingExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, deps: [{ token: MessageService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1213
+ AppEmbeddingExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, deps: [{ token: MessageService }, { token: i2.Router }, { token: i3.Location }], target: i0.ɵɵFactoryTarget.Injectable });
1199
1214
  AppEmbeddingExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, providedIn: "root" });
1200
1215
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, decorators: [{
1201
1216
  type: Injectable,
1202
1217
  args: [{ providedIn: "root" }]
1203
- }], ctorParameters: function () { return [{ type: MessageService }, { type: i2.Router }]; } });
1218
+ }], ctorParameters: function () { return [{ type: MessageService }, { type: i2.Router }, { type: i3.Location }]; } });
1204
1219
 
1205
1220
  // Angular
1206
1221
  /**