@dsivd/prestations-ng 18.1.0-beta.2 → 18.1.0-beta.4

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/CHANGELOG.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  - [foehn-page.component.ts](projects/prestations-ng/src/foehn-page/foehn-page.component.ts)
20
20
 
21
- - Added `@Input() showBeforeUnloadNativeConfirmAlert = true;` to display or hide native browser alert message when closing the tab, closing the browser or reloading the page while having unsaved data.
21
+ - Added `@Input() showBeforeUnloadNativeConfirmAlert = true;` to display or hide native browser alert message when closing the tab, closing the browser or reloading the page while having unsaved data or a gesdem reference.
22
22
 
23
23
  - [foehn-modal.component.ts](projects/prestations-ng/src/foehn-modal/foehn-modal.component.ts)
24
24
  - [foehn-help-modal.component.ts](projects/prestations-ng/src/foehn-help-modal/foehn-help-modal.component.ts)
@@ -1722,19 +1722,17 @@ class FoehnFormComponent {
1722
1722
  }
1723
1723
  this.ngFormComponent.form.markAsUntouched();
1724
1724
  this.ngFormComponent.form.markAsPristine();
1725
- this.registerNgModelService.setHasInteractions(false);
1726
1725
  }
1727
1726
  ngOnDestroy() {
1728
1727
  this.registerNgModelServiceSubscription?.unsubscribe();
1729
1728
  this.formValueChangesSubscription?.unsubscribe();
1730
- this.registerNgModelService.setHasInteractions(false);
1731
1729
  }
1732
1730
  ngAfterViewInit() {
1733
1731
  this.updateRegisteredNgModels();
1734
1732
  // eslint-disable-next-line rxjs-angular/prefer-async-pipe
1735
1733
  this.childrenInputComponents.changes.subscribe(() => this.updateRegisteredNgModels());
1736
- // eslint-disable-next-line rxjs-angular/prefer-async-pipe
1737
1734
  this.formValueChangesSubscription =
1735
+ // eslint-disable-next-line rxjs-angular/prefer-async-pipe
1738
1736
  this.ngFormComponent.form.valueChanges.subscribe(() => {
1739
1737
  if (this.ngFormComponent.form.dirty) {
1740
1738
  this.registerNgModelService.setHasInteractions(true);
@@ -3585,9 +3583,13 @@ class AbstractPageComponent {
3585
3583
  this._gesdemService.lastResponse.form &&
3586
3584
  this._gesdemService.lastResponse.form.language;
3587
3585
  this._dictionaryService.changeLanguage(languageCode);
3586
+ if (this.reference) {
3587
+ this._registerNgModelService.setHasInteractions(true);
3588
+ }
3588
3589
  if (!shouldPreventNavigationToLast &&
3589
3590
  this.reference &&
3590
3591
  GesdemStatutUtils.isFinal(ActionStatut[statut])) {
3592
+ this._registerNgModelService.setHasInteractions(false);
3591
3593
  this._navigation.last();
3592
3594
  }
3593
3595
  if (this.reference &&
@@ -3667,8 +3669,9 @@ class AbstractPageComponent {
3667
3669
  return EMPTY;
3668
3670
  }))
3669
3671
  .subscribe(() => {
3670
- this._registerNgModelService.setHasInteractions(false);
3671
3672
  if (!this._gesdemService.lastResponse.errors.length) {
3673
+ // Do not show warning alert on closing tab or navigator when form has been transmitted
3674
+ this._registerNgModelService.setHasInteractions(false);
3672
3675
  this._gesdemEventService.formTransmittedSubject.next(this._gesdemService.lastResponse);
3673
3676
  this._navigation.next();
3674
3677
  }
@@ -3706,11 +3709,7 @@ class AbstractPageComponent {
3706
3709
  }
3707
3710
  onFormSent(goToNextPage) {
3708
3711
  // Some pages don't have a form.
3709
- if (!this.foehnFormComponent) {
3710
- this._registerNgModelService.setHasInteractions(false);
3711
- }
3712
- else {
3713
- // NB: Reset the form sets hasInteractions to false
3712
+ if (this.foehnFormComponent) {
3714
3713
  this.foehnFormComponent.reset();
3715
3714
  }
3716
3715
  this._navigation.current().then(() => {