cat-qw-lib 0.43.25 → 0.43.28
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
|
@@ -678,6 +678,7 @@ class BaseControlComponent {
|
|
|
678
678
|
.pipe(takeUntil(this.destroy$))
|
|
679
679
|
.subscribe((res) => {
|
|
680
680
|
if (res) {
|
|
681
|
+
console.log("1 => isNavigating", res);
|
|
681
682
|
this.checkUnsavedChanges();
|
|
682
683
|
}
|
|
683
684
|
});
|
|
@@ -717,16 +718,22 @@ class BaseControlComponent {
|
|
|
717
718
|
return this.record[this.attributeModel.name];
|
|
718
719
|
}
|
|
719
720
|
checkUnsavedChanges() {
|
|
721
|
+
console.log("2 checkUnSavedCall");
|
|
720
722
|
const hasChanges = JSON.stringify(this.initialRecord) !== JSON.stringify(this.record);
|
|
721
|
-
console.log("
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
723
|
+
console.log("3 hasChanges", hasChanges);
|
|
724
|
+
this.formStateService.selectIsFormSaved().subscribe((res) => {
|
|
725
|
+
console.log("4 isSaved", res);
|
|
726
|
+
if (res) {
|
|
727
|
+
console.log("5 set confirmation false", res);
|
|
728
|
+
this.formStateService.setShowConfirmation(false);
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
if (!res && hasChanges) {
|
|
732
|
+
console.log("6 set confirmation true", res);
|
|
733
|
+
this.formStateService.setShowConfirmation(true);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
});
|
|
730
737
|
}
|
|
731
738
|
ngOnDestroy() {
|
|
732
739
|
this.destroy$.next();
|
|
@@ -1404,6 +1411,7 @@ class BaseFormComponent {
|
|
|
1404
1411
|
this.record = {};
|
|
1405
1412
|
this.baseStore?.setIsApiValidated(null);
|
|
1406
1413
|
this.onFormNavigate.emit(response);
|
|
1414
|
+
this.formStateService.setIsFormSaved(true);
|
|
1407
1415
|
},
|
|
1408
1416
|
error: (error) => {
|
|
1409
1417
|
console.error('Error updating record:', error);
|
|
@@ -1418,6 +1426,9 @@ class BaseFormComponent {
|
|
|
1418
1426
|
console.log('Record created:', response);
|
|
1419
1427
|
this.record = {};
|
|
1420
1428
|
this.baseStore?.setIsApiValidated(null);
|
|
1429
|
+
console.log("1 baseForm");
|
|
1430
|
+
this.formStateService.setIsFormSaved(true);
|
|
1431
|
+
console.log("2 baseForm");
|
|
1421
1432
|
this.onFormNavigate.emit(response);
|
|
1422
1433
|
},
|
|
1423
1434
|
error: (error) => {
|
|
@@ -1439,6 +1450,7 @@ class BaseFormComponent {
|
|
|
1439
1450
|
}
|
|
1440
1451
|
this.destroy$.next();
|
|
1441
1452
|
this.destroy$.complete();
|
|
1453
|
+
this.formStateService.setIsFormSaved(false);
|
|
1442
1454
|
}
|
|
1443
1455
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormComponent, deps: [{ token: FormStateService }, { token: BaseService }, { token: ValidatorService }, { token: i4$3.Router }, { token: i4$3.ActivatedRoute }, { token: BaseStore }, { token: BaseQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
1444
1456
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: BaseFormComponent, isStandalone: true, selector: "base-form", outputs: { onSave: "onSave", onFormNavigate: "onFormNavigate", onCancel: "onCancel" }, providers: [ValidatorService], ngImport: i0, template: "<p>base-form works!</p>\r\n", styles: [""] });
|