@dsivd/prestations-ng 19.2.0-beta.6 → 19.2.0-beta.7
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 +4 -0
- package/dsivd-prestations-ng-19.2.0-beta.7.tgz +0 -0
- package/fesm2022/dsivd-prestations-ng.mjs +44 -66
- package/fesm2022/dsivd-prestations-ng.mjs.map +1 -1
- package/package.json +1 -1
- package/types/dsivd-prestations-ng.d.ts +11 -3
- package/dsivd-prestations-ng-19.2.0-beta.6.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -122,6 +122,10 @@ Please check the [UPGRADING_V19.md](UPGRADING_V19.md) guide for more information
|
|
|
122
122
|
- dynamic list: a model changed by the project (another value, `null`) is displayed again; once a value had been
|
|
123
123
|
displayed, the display no longer followed the model. The elements loaded for the search of the user still do
|
|
124
124
|
not replace what they type.
|
|
125
|
+
- `foehn-input-address` without zone.js: an address given by the parent right after the initialization of the
|
|
126
|
+
component (e.g. prefilled with `SessionInfoWithApplicationService.prefillForm()` for a connected user) is no
|
|
127
|
+
longer overwritten by the model with the default country only; the default country and the clean-up of the model
|
|
128
|
+
are applied after the next rendering, from the latest model.
|
|
125
129
|
- `foehn-input-address`: the deferred clean-up of the model (hidden address lines and post office box) applies
|
|
126
130
|
to the latest model, it could restore a previous value (e.g. remove the default country); nothing is
|
|
127
131
|
updated anymore once the component is destroyed.
|
|
Binary file
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, inject, InjectionToken, model, input, viewChildren, viewChild, forwardRef, output, computed, linkedSignal, DestroyRef, signal, effect, untracked, PendingTasks, Directive, ChangeDetectorRef, Pipe, Component, contentChildren, EnvironmentInjector, runInInjectionContext, afterNextRender, ElementRef, Injector, makeEnvironmentProviders, ErrorHandler, provideBrowserGlobalErrorListeners, provideAppInitializer, importProvidersFrom, NgZone, contentChild, TemplateRef } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed, toSignal, toObservable, outputToObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { Router, ActivatedRoute, RouterLink, NavigationStart, NavigationEnd } from '@angular/router';
|
|
5
|
-
import { Subject, BehaviorSubject, combineLatest, of, filter as filter$1, tap as tap$1, throwError, switchMap as switchMap$1, forkJoin, from, concatMap, toArray, EMPTY, startWith, merge, noop, interval, withLatestFrom,
|
|
5
|
+
import { Subject, BehaviorSubject, combineLatest, of, filter as filter$1, tap as tap$1, throwError, switchMap as switchMap$1, forkJoin, from, concatMap, toArray, EMPTY, startWith, merge, noop, interval, withLatestFrom, map as map$1, concat } from 'rxjs';
|
|
6
6
|
import { filter, shareReplay, tap, map, debounceTime, catchError, switchMap, first, finalize, throttleTime, mergeMap, share, take, distinctUntilChanged, startWith as startWith$1, takeWhile, takeUntil } from 'rxjs/operators';
|
|
7
7
|
import { HttpClient, HttpEventType, HttpResponse, HTTP_INTERCEPTORS, HttpStatusCode, HttpResponseBase, HttpErrorResponse, HttpParams, provideHttpClient, withInterceptorsFromDi, withInterceptors } from '@angular/common/http';
|
|
8
8
|
import * as i1 from '@angular/forms';
|
|
@@ -9044,34 +9044,6 @@ class StreetNumber {
|
|
|
9044
9044
|
}
|
|
9045
9045
|
const isDefined$1 = (value) => value === true || value === false;
|
|
9046
9046
|
const hasInputChanged$1 = (change) => change && !ObjectHelper.isEqual(change.previousValue, change.currentValue);
|
|
9047
|
-
/**
|
|
9048
|
-
* Same as `debounceTime(0)`, but the application is not stable (PendingTasks, e.g. `fixture.whenStable()`)
|
|
9049
|
-
* while a value is waiting to be emitted and processed synchronously by the next operators.
|
|
9050
|
-
*/
|
|
9051
|
-
const debounceTimeZeroAsPendingTask = (pendingTasks) => (source) => new Observable((subscriber) => {
|
|
9052
|
-
let removeTask = null;
|
|
9053
|
-
const subscription = source
|
|
9054
|
-
.pipe(tap(() => (removeTask ??= pendingTasks.add())), debounceTime(0))
|
|
9055
|
-
.subscribe({
|
|
9056
|
-
next: (value) => {
|
|
9057
|
-
const removeSettledTask = removeTask;
|
|
9058
|
-
removeTask = null;
|
|
9059
|
-
try {
|
|
9060
|
-
subscriber.next(value);
|
|
9061
|
-
}
|
|
9062
|
-
finally {
|
|
9063
|
-
removeSettledTask?.();
|
|
9064
|
-
}
|
|
9065
|
-
},
|
|
9066
|
-
error: (error) => subscriber.error(error),
|
|
9067
|
-
complete: () => subscriber.complete(),
|
|
9068
|
-
});
|
|
9069
|
-
return () => {
|
|
9070
|
-
subscription.unsubscribe();
|
|
9071
|
-
removeTask?.();
|
|
9072
|
-
removeTask = null;
|
|
9073
|
-
};
|
|
9074
|
-
});
|
|
9075
9047
|
class FoehnInputAddressComponent extends FoehnInputComponent {
|
|
9076
9048
|
isOnlySwiss = input(true, ...(ngDevMode ? [{ debugName: "isOnlySwiss" }] : /* istanbul ignore next */ []));
|
|
9077
9049
|
showPostOfficeBoxText = input(false, ...(ngDevMode ? [{ debugName: "showPostOfficeBoxText" }] : /* istanbul ignore next */ []));
|
|
@@ -9118,8 +9090,9 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
|
|
|
9118
9090
|
streetCustomErrors = signal({}, ...(ngDevMode ? [{ debugName: "streetCustomErrors" }] : /* istanbul ignore next */ []));
|
|
9119
9091
|
httpClient = inject(HttpClient);
|
|
9120
9092
|
dictionaryService = inject(SdkDictionaryService);
|
|
9121
|
-
|
|
9093
|
+
addressInjector = inject(Injector);
|
|
9122
9094
|
isSanitizationScheduled = false;
|
|
9095
|
+
isDefaultCountryScheduled = false;
|
|
9123
9096
|
iso2IdSubject = new BehaviorSubject(null);
|
|
9124
9097
|
zipCodeIdSubject = new BehaviorSubject(null);
|
|
9125
9098
|
estrIdSubject = new BehaviorSubject(null);
|
|
@@ -9355,32 +9328,21 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
|
|
|
9355
9328
|
return ObjectHelper.isDifferent(value, sanitized) ? sanitized : null;
|
|
9356
9329
|
}
|
|
9357
9330
|
/**
|
|
9358
|
-
* The sanitized model is set
|
|
9359
|
-
*
|
|
9331
|
+
* The sanitized model is set after the next rendering (not while the view is checked), from the latest model: the
|
|
9332
|
+
* model given by the parent in between (e.g. prefilled asynchronously) has been received, it is not overwritten.
|
|
9360
9333
|
*/
|
|
9361
9334
|
scheduleModelSanitization() {
|
|
9362
9335
|
if (this.isSanitizationScheduled) {
|
|
9363
9336
|
return;
|
|
9364
9337
|
}
|
|
9365
9338
|
this.isSanitizationScheduled = true;
|
|
9366
|
-
|
|
9367
|
-
const timeoutId = setTimeout(() => {
|
|
9368
|
-
unregisterOnDestroy();
|
|
9339
|
+
afterNextRender(() => {
|
|
9369
9340
|
this.isSanitizationScheduled = false;
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
this.updateNgModel(sanitized);
|
|
9374
|
-
}
|
|
9341
|
+
const sanitized = this.getSanitizedModel(this.model());
|
|
9342
|
+
if (sanitized) {
|
|
9343
|
+
this.updateNgModel(sanitized);
|
|
9375
9344
|
}
|
|
9376
|
-
|
|
9377
|
-
removeTask();
|
|
9378
|
-
}
|
|
9379
|
-
});
|
|
9380
|
-
const unregisterOnDestroy = this._destroyRef.onDestroy(() => {
|
|
9381
|
-
clearTimeout(timeoutId);
|
|
9382
|
-
removeTask();
|
|
9383
|
-
});
|
|
9345
|
+
}, { injector: this.addressInjector });
|
|
9384
9346
|
}
|
|
9385
9347
|
replaceAtLeastOneNotNull(notNullErrorLabel) {
|
|
9386
9348
|
if (!this.showPostOfficeBoxText()) {
|
|
@@ -9522,29 +9484,45 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
|
|
|
9522
9484
|
this.isEmpty(this.addressLine2()));
|
|
9523
9485
|
}
|
|
9524
9486
|
manageDefaultCountry() {
|
|
9525
|
-
// The application is not stable until the debounced changes are processed (the model can be updated).
|
|
9526
9487
|
combineLatest([
|
|
9527
|
-
this.countryModelChangeSubject
|
|
9488
|
+
this.countryModelChangeSubject
|
|
9489
|
+
.asObservable()
|
|
9490
|
+
.pipe(distinctUntilChanged((previous, current) => previous?.iso2Id === current?.iso2Id)),
|
|
9528
9491
|
this.isOnlySwissChangeSubject
|
|
9529
9492
|
.asObservable()
|
|
9530
|
-
.pipe(
|
|
9493
|
+
.pipe(distinctUntilChanged()),
|
|
9531
9494
|
])
|
|
9532
|
-
.pipe(
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9495
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
9496
|
+
.subscribe(() => this.scheduleDefaultCountry());
|
|
9497
|
+
}
|
|
9498
|
+
/**
|
|
9499
|
+
* The default country is applied after the next rendering (once for the changes of the same rendering), from the
|
|
9500
|
+
* latest state: without zone.js, a model given by the parent in between (e.g. prefilled asynchronously) is only
|
|
9501
|
+
* received with the next change detection, it must not be overwritten by the model with the default country only.
|
|
9502
|
+
*/
|
|
9503
|
+
scheduleDefaultCountry() {
|
|
9504
|
+
if (this.isDefaultCountryScheduled) {
|
|
9505
|
+
return;
|
|
9506
|
+
}
|
|
9507
|
+
this.isDefaultCountryScheduled = true;
|
|
9508
|
+
afterNextRender(() => {
|
|
9509
|
+
this.isDefaultCountryScheduled = false;
|
|
9510
|
+
this.applyDefaultCountry();
|
|
9511
|
+
}, { injector: this.addressInjector });
|
|
9512
|
+
}
|
|
9513
|
+
applyDefaultCountry() {
|
|
9514
|
+
const country = this.country();
|
|
9515
|
+
if (!this.isOnlySwiss() && !country && !this.isCountryInputDirty()) {
|
|
9516
|
+
this.setDefaultCountry();
|
|
9517
|
+
return;
|
|
9518
|
+
}
|
|
9519
|
+
if (this.isOnlySwiss()) {
|
|
9520
|
+
// When there is a country, we need to check if it has to be cleaned and set to default
|
|
9521
|
+
if (country && !ObjectHelper.isEmpty(country)) {
|
|
9522
|
+
this.clearAutocompletesWhenCountryIsUnappropriatedToComponentConfiguration();
|
|
9545
9523
|
}
|
|
9546
|
-
|
|
9547
|
-
|
|
9524
|
+
this.setDefaultCountry();
|
|
9525
|
+
}
|
|
9548
9526
|
}
|
|
9549
9527
|
isCountryInputDirty() {
|
|
9550
9528
|
const countryAutocomplete = this.countryAutocomplete();
|