@esfaenza/extensions 15.2.33 → 15.2.35

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,10 @@ class AppEmbeddingExtensions {
1083
1086
  break;
1084
1087
  }
1085
1088
  }
1089
+ else if (event?.data?.type == "replace-state") {
1090
+ console.log(`Window message - replace-state -> Url: ${event?.data?.url}`);
1091
+ this.location.replaceState(event?.data?.url);
1092
+ }
1086
1093
  else if (event?.data?.type == "confirm") {
1087
1094
  console.log(`Window message - confirm -> Level: ${event?.data?.level}, Message: ${event?.data?.text}, Title: ${event?.data?.title}, ID: ${event?.data?.guid}`);
1088
1095
  var sourceWindow = event.source;
@@ -1180,6 +1187,15 @@ class AppEmbeddingExtensions {
1180
1187
  if (this.Embedded)
1181
1188
  document.body.style.setProperty("overflow-y", "auto", "important");
1182
1189
  }
1190
+ replaceState(basePath, url) {
1191
+ // Esempio basePath: pages
1192
+ // Esempio url: parties/leads_search
1193
+ // Normalizzazione senza slash prima o dopo
1194
+ basePath = basePath.endsWith("/") ? basePath.substring(0, basePath.length - 2) : basePath;
1195
+ url = url.startsWith("/") ? url.substring(1) : url;
1196
+ this.location.replaceState(`${basePath}/${url}`);
1197
+ this.MainWindow.postMessage({ type: "replace-state", url: `pages/embed/${this.EmbeddedModule}/${url}` }, "*");
1198
+ }
1183
1199
  refreshBoundariesOnMenuCollapse() {
1184
1200
  const wrapper = document.body.getElementsByClassName("main-wrapper")[0];
1185
1201
  let wrapperStyles = window.getComputedStyle(wrapper);
@@ -1195,12 +1211,12 @@ class AppEmbeddingExtensions {
1195
1211
  left.style.setProperty("width", leftSpace + "px");
1196
1212
  }
1197
1213
  }
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 });
1214
+ 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
1215
  AppEmbeddingExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, providedIn: "root" });
1200
1216
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, decorators: [{
1201
1217
  type: Injectable,
1202
1218
  args: [{ providedIn: "root" }]
1203
- }], ctorParameters: function () { return [{ type: MessageService }, { type: i2.Router }]; } });
1219
+ }], ctorParameters: function () { return [{ type: MessageService }, { type: i2.Router }, { type: i3.Location }]; } });
1204
1220
 
1205
1221
  // Angular
1206
1222
  /**