cat-qw-lib 0.43.3 → 0.43.5
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
|
@@ -594,13 +594,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
594
594
|
}], ctorParameters: () => [{ type: BaseStore }] });
|
|
595
595
|
|
|
596
596
|
class FormStateService {
|
|
597
|
-
formChangesSubject
|
|
598
|
-
|
|
597
|
+
formChangesSubject$;
|
|
598
|
+
isFormNavigating$;
|
|
599
|
+
constructor() {
|
|
600
|
+
this.formChangesSubject$ = new BehaviorSubject(false);
|
|
601
|
+
this.isFormNavigating$ = new BehaviorSubject(false);
|
|
602
|
+
}
|
|
599
603
|
setFormChanges(hasChanges) {
|
|
600
|
-
this.formChangesSubject
|
|
604
|
+
this.formChangesSubject$.next(hasChanges);
|
|
605
|
+
}
|
|
606
|
+
setIsFormNavigating(isNavigation) {
|
|
607
|
+
this.isFormNavigating$.next(isNavigation);
|
|
608
|
+
}
|
|
609
|
+
getIsFormNavigating() {
|
|
610
|
+
this.isFormNavigating$.getValue();
|
|
601
611
|
}
|
|
602
|
-
|
|
603
|
-
return this.
|
|
612
|
+
selectIsFormNavigating() {
|
|
613
|
+
return this.isFormNavigating$.asObservable();
|
|
614
|
+
}
|
|
615
|
+
getSUnsavedChanges() {
|
|
616
|
+
return this.formChangesSubject$.getValue();
|
|
617
|
+
}
|
|
618
|
+
selectSUnsavedChanges() {
|
|
619
|
+
return this.formChangesSubject$.asObservable();
|
|
604
620
|
}
|
|
605
621
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FormStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
606
622
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: FormStateService, providedIn: 'root' });
|
|
@@ -610,7 +626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
610
626
|
args: [{
|
|
611
627
|
providedIn: 'root'
|
|
612
628
|
}]
|
|
613
|
-
}] });
|
|
629
|
+
}], ctorParameters: () => [] });
|
|
614
630
|
|
|
615
631
|
class BaseControlComponent {
|
|
616
632
|
baseStore;
|
|
@@ -649,6 +665,15 @@ class BaseControlComponent {
|
|
|
649
665
|
this.baseStore.setIsFormSubmitted(false);
|
|
650
666
|
}
|
|
651
667
|
});
|
|
668
|
+
if (this.formStateService) {
|
|
669
|
+
console.log("formchage");
|
|
670
|
+
this.formStateService.selectIsFormNavigating().subscribe((res) => {
|
|
671
|
+
if (res) {
|
|
672
|
+
console.log("navsjj", res);
|
|
673
|
+
this.checkUnsavedChanges();
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
}
|
|
652
677
|
}
|
|
653
678
|
ngOnChanges() {
|
|
654
679
|
if (this.store) {
|
|
@@ -684,8 +709,11 @@ class BaseControlComponent {
|
|
|
684
709
|
return this.record[this.attributeModel.name];
|
|
685
710
|
}
|
|
686
711
|
checkUnsavedChanges() {
|
|
712
|
+
console.log("0 Entry");
|
|
687
713
|
const hasChanges = JSON.stringify(this.initialRecord) !== JSON.stringify(this.record);
|
|
714
|
+
console.log("1", hasChanges);
|
|
688
715
|
if (this.formStateService) {
|
|
716
|
+
console.log("2", hasChanges);
|
|
689
717
|
this.formStateService.setFormChanges(hasChanges);
|
|
690
718
|
}
|
|
691
719
|
}
|