cat-qw-lib 0.43.35 → 0.43.38

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Input, Output, Injectable, ViewChild, ViewEncapsulation, inject, HostListener, Pipe, Directive, NgModule, APP_INITIALIZER } from '@angular/core';
2
+ import { EventEmitter, Component, Input, Output, Injectable, ViewChild, ViewEncapsulation, HostListener, Pipe, Directive, NgModule, APP_INITIALIZER } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i3$1 from '@angular/forms';
@@ -664,7 +664,6 @@ class BaseControlComponent {
664
664
  attributeDestroy$ = new Subject();
665
665
  ngOnInit() {
666
666
  this.addToAttributeList();
667
- this.initialRecord = structuredClone(this.record); // Reset initial state after saving
668
667
  this.baseQuery.getIsFormSubmitted()
669
668
  .pipe(takeUntil(this.destroy$))
670
669
  .subscribe((res) => {
@@ -675,6 +674,11 @@ class BaseControlComponent {
675
674
  this.baseStore.setIsFormSubmitted(false);
676
675
  }
677
676
  });
677
+ console.log("oninit record=>", this.record);
678
+ if (this.record) {
679
+ this.initialRecord = structuredClone(this.record); // Reset initial state after saving
680
+ console.log("oninit initialRecord=>", this.initialRecord);
681
+ }
678
682
  this.formStateService.selectIsFormNavigating()
679
683
  .pipe(takeUntil(this.destroy$))
680
684
  .subscribe((res) => {
@@ -718,8 +722,12 @@ class BaseControlComponent {
718
722
  return this.record[this.attributeModel.name];
719
723
  }
720
724
  checkUnsavedChanges() {
725
+ console.log("1=> initialRecord", this.initialRecord);
726
+ console.log("2=> Record", this.record);
721
727
  const sanitizedInitialRecord = this.normalizeRecord(this.initialRecord);
722
728
  const sanitizedCurrentRecord = this.normalizeRecord(this.record);
729
+ console.log("3=> currentRecord", sanitizedCurrentRecord);
730
+ console.log("4=> Initial Record", sanitizedInitialRecord);
723
731
  const hasChanges = JSON.stringify(sanitizedInitialRecord) !== JSON.stringify(sanitizedCurrentRecord);
724
732
  this.formStateService.selectIsFormSaved().subscribe((res) => {
725
733
  if (res) {
@@ -727,9 +735,11 @@ class BaseControlComponent {
727
735
  }
728
736
  else {
729
737
  if (!res && hasChanges) {
738
+ console.log("hasChange");
730
739
  this.formStateService.setShowConfirmation(true);
731
740
  }
732
741
  if (!res && !hasChanges) {
742
+ console.log("No hasChange");
733
743
  this.formStateService.setShowConfirmation(false);
734
744
  }
735
745
  }
@@ -1324,7 +1334,6 @@ class BaseFormComponent {
1324
1334
  baseStore;
1325
1335
  baseQuery;
1326
1336
  subscriptions;
1327
- confirmationService = inject(ConfirmationService);
1328
1337
  record;
1329
1338
  initialRecord;
1330
1339
  recordChange = new BehaviorSubject({});
@@ -1471,11 +1480,11 @@ class BaseFormComponent {
1471
1480
  this.formStateService.setIsFormSaved(false);
1472
1481
  }
1473
1482
  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 });
1474
- 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" }, host: { listeners: { "window:beforeunload": "handleBeforeUnload($event)" } }, providers: [ValidatorService, ConfirmationService], ngImport: i0, template: "<p>base-form works!</p>\r\n", styles: [""] });
1483
+ 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" }, host: { listeners: { "window:beforeunload": "handleBeforeUnload($event)" } }, providers: [ValidatorService], ngImport: i0, template: "<p>base-form works!</p>\r\n", styles: [""] });
1475
1484
  }
1476
1485
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormComponent, decorators: [{
1477
1486
  type: Component,
1478
- args: [{ selector: 'base-form', providers: [ValidatorService, ConfirmationService], template: "<p>base-form works!</p>\r\n" }]
1487
+ args: [{ selector: 'base-form', providers: [ValidatorService], template: "<p>base-form works!</p>\r\n" }]
1479
1488
  }], ctorParameters: () => [{ type: FormStateService }, { type: BaseService }, { type: ValidatorService }, { type: i4$3.Router }, { type: i4$3.ActivatedRoute }, { type: BaseStore }, { type: BaseQuery }], propDecorators: { onSave: [{
1480
1489
  type: Output
1481
1490
  }], onFormNavigate: [{