cat-qw-lib 0.43.43 → 0.43.44
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.
package/fesm2022/cat-qw-lib.mjs
CHANGED
|
@@ -670,6 +670,8 @@ class BaseControlComponent {
|
|
|
670
670
|
query;
|
|
671
671
|
destroy$ = new Subject();
|
|
672
672
|
attributeDestroy$ = new Subject();
|
|
673
|
+
sanitizedInitialRecord;
|
|
674
|
+
sanitizedCurrentRecord;
|
|
673
675
|
ngOnInit() {
|
|
674
676
|
this.addToAttributeList();
|
|
675
677
|
this.baseQuery.getIsFormSubmitted()
|
|
@@ -736,22 +738,27 @@ class BaseControlComponent {
|
|
|
736
738
|
checkUnsavedChanges() {
|
|
737
739
|
this.formStateService.selectInitialRecord().subscribe((res) => {
|
|
738
740
|
if (res) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
741
|
+
this.sanitizedInitialRecord = this.normalizeRecord(res);
|
|
742
|
+
this.sanitizedCurrentRecord = this.normalizeRecord(this.record);
|
|
743
|
+
console.log("1 sanitizedInitialRecord", this.sanitizedInitialRecord);
|
|
744
|
+
console.log("2 sanitizedCurrentRecord", this.sanitizedCurrentRecord);
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
const hasChanges = JSON.stringify(this.sanitizedInitialRecord) !== JSON.stringify(this.sanitizedCurrentRecord);
|
|
748
|
+
this.formStateService.selectIsFormSaved().subscribe((res) => {
|
|
749
|
+
if (res) {
|
|
750
|
+
this.formStateService.setShowConfirmation(false);
|
|
751
|
+
console.log("3 isFormSaved");
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
if (!res && hasChanges) {
|
|
755
|
+
console.log("4 not saved but hasChanges");
|
|
756
|
+
this.formStateService.setShowConfirmation(true);
|
|
757
|
+
}
|
|
758
|
+
if (!res && !hasChanges) {
|
|
759
|
+
console.log("5 not saved and not hasChanges");
|
|
760
|
+
this.formStateService.setShowConfirmation(false);
|
|
761
|
+
}
|
|
755
762
|
}
|
|
756
763
|
});
|
|
757
764
|
}
|