cat-qw-lib 0.43.49 → 0.43.50

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.
@@ -714,7 +714,7 @@ class BaseControlComponent {
714
714
  .pipe(takeUntil(this.destroy$))
715
715
  .subscribe((res) => {
716
716
  if (res) {
717
- this.checkUnsavedChanges(true);
717
+ this.checkUnsavedChangesforBrowser(true);
718
718
  }
719
719
  });
720
720
  }
@@ -766,17 +766,9 @@ class BaseControlComponent {
766
766
  if (res) {
767
767
  this.sanitizedInitialRecord = this.normalizeRecord(res);
768
768
  this.sanitizedCurrentRecord = this.normalizeRecord(this.record);
769
- console.log("1 sanitizedInitialRecord", this.sanitizedInitialRecord);
770
- console.log("2 sanitizedCurrentRecord", this.sanitizedCurrentRecord);
771
769
  }
772
770
  });
773
771
  const hasChanges = JSON.stringify(this.sanitizedInitialRecord) !== JSON.stringify(this.sanitizedCurrentRecord);
774
- if (isBrowserEvent && hasChanges) {
775
- this.formStateService.setShowBroswerConfirmDialog(true);
776
- }
777
- else {
778
- this.formStateService.setShowBroswerConfirmDialog(false);
779
- }
780
772
  this.formStateService.selectIsFormSaved().subscribe((res) => {
781
773
  if (res) {
782
774
  this.formStateService.setShowConfirmation(false);
@@ -794,6 +786,23 @@ class BaseControlComponent {
794
786
  }
795
787
  });
796
788
  }
789
+ checkUnsavedChangesforBrowser(isBrowserEvent) {
790
+ this.formStateService.selectInitialRecord().subscribe((res) => {
791
+ if (res) {
792
+ this.sanitizedInitialRecord = this.normalizeRecord(res);
793
+ this.sanitizedCurrentRecord = this.normalizeRecord(this.record);
794
+ console.log("1 sanitizedInitialRecord", this.sanitizedInitialRecord);
795
+ console.log("2 sanitizedCurrentRecord", this.sanitizedCurrentRecord);
796
+ }
797
+ });
798
+ const hasChanges = JSON.stringify(this.sanitizedInitialRecord) !== JSON.stringify(this.sanitizedCurrentRecord);
799
+ if (isBrowserEvent && hasChanges) {
800
+ this.formStateService.setShowBroswerConfirmDialog(true);
801
+ }
802
+ else {
803
+ this.formStateService.setShowBroswerConfirmDialog(false);
804
+ }
805
+ }
797
806
  normalizeRecord(record) {
798
807
  if (!record)
799
808
  return {};