@smartbit4all/ng-client 3.0.34 → 3.0.36

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.
@@ -2500,7 +2500,6 @@ class SmartViewContextDialogService {
2500
2500
  let dialogData = smartDialog;
2501
2501
  let dialogRef = this.dialog.open(component, { data: dialogData });
2502
2502
  dialogRef.afterClosed().subscribe((result) => {
2503
- this.handleAfterClosed(result);
2504
2503
  this.closeDialog(dialogRef, dialogData);
2505
2504
  });
2506
2505
  return dialogRef;
@@ -2508,7 +2507,6 @@ class SmartViewContextDialogService {
2508
2507
  createDialogRef(smartDialog, component) {
2509
2508
  const dialogRef = this.dialog.open(component, { data: smartDialog });
2510
2509
  dialogRef.afterClosed().subscribe((result) => {
2511
- this.handleAfterClosed(result);
2512
2510
  dialogRef.close();
2513
2511
  });
2514
2512
  return dialogRef;
@@ -2523,10 +2521,6 @@ class SmartViewContextDialogService {
2523
2521
  };
2524
2522
  return this.createDialog(smartDialog, component);
2525
2523
  }
2526
- handleAfterClosed(result) { }
2527
- openDialog() {
2528
- throw new Error('openDialog function is not implemented!');
2529
- }
2530
2524
  async closeDialog(dialogRef, dialogData) {
2531
2525
  if (dialogData?.outlets) {
2532
2526
  await this.router.navigate([
@@ -2717,6 +2711,9 @@ class SmartViewContextService {
2717
2711
  }
2718
2712
  }
2719
2713
  openView(view) {
2714
+ let alreadyOpened = this.openedViewUuids.some((uuid) => uuid === view.uuid);
2715
+ if (alreadyOpened)
2716
+ return;
2720
2717
  let viewHandler = this.viewHandlers.find((handler) => handler.name === view.viewName);
2721
2718
  if (!viewHandler) {
2722
2719
  throw new Error(`SmartViewHandlerModel was not found by view name: ${view.viewName}`);
@@ -2727,7 +2724,22 @@ class SmartViewContextService {
2727
2724
  }
2728
2725
  let refIsAlradyAdded = this.dialogRefs.some((ref) => ref.uuid === view.uuid);
2729
2726
  if (!refIsAlradyAdded) {
2730
- let dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
2727
+ let dialogRef;
2728
+ try {
2729
+ this.openedViewUuids.push(view.uuid);
2730
+ this.openedViewData.push(view);
2731
+ sessionStorage.setItem(view.viewName, view.uuid);
2732
+ dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
2733
+ }
2734
+ finally {
2735
+ const index = this.openedViewUuids.indexOf(view.uuid);
2736
+ if (index >= 0) {
2737
+ this.openedViewUuids.splice(index, 1);
2738
+ this.openedViewData.splice(index, 1);
2739
+ sessionStorage.removeItem(view.viewName);
2740
+ }
2741
+ sessionStorage.setItem(view.viewName, view.uuid);
2742
+ }
2731
2743
  let dialogDisableClose = true;
2732
2744
  try {
2733
2745
  dialogDisableClose = this.inject.get(DIALOG_DISABLE_CLOSE);
@@ -2791,7 +2803,7 @@ class SmartViewContextService {
2791
2803
  this.dialogRefs.splice(index, 1);
2792
2804
  }
2793
2805
  else {
2794
- throw new Error('DialogRef is not found by uuid.');
2806
+ console.log('DialogRef is not found by uuid.');
2795
2807
  }
2796
2808
  }
2797
2809
  else if (view.type === ViewType.Normal) {