@dsivd/prestations-ng 19.2.0-beta.20 → 19.2.0-beta.21

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.
Files changed (39) hide show
  1. package/ANGULAR_SIGNALS.md +4 -0
  2. package/CHANGELOG.md +98 -3
  3. package/CONTRIBUTING.md +2 -2
  4. package/ESLINT_PLUGIN.md +103 -8
  5. package/GOOD_PRACTICES.md +79 -29
  6. package/UPGRADING_V19.md +187 -31
  7. package/eslint/configs/template-rules.mjs +5 -0
  8. package/eslint/configs/ts-recommended.mjs +4 -0
  9. package/eslint/form-reads.mjs +63 -0
  10. package/eslint/rules/index.mjs +4 -0
  11. package/eslint/rules/no-direct-signal-mutation.mjs +57 -19
  12. package/eslint/rules/no-item-track-in-form-list.mjs +99 -0
  13. package/eslint/rules/no-uninvoked-signal-in-template.mjs +8 -3
  14. package/eslint/rules/require-model-change.mjs +89 -0
  15. package/eslint/template-ast.mjs +12 -2
  16. package/fesm2022/dsivd-prestations-ng.mjs +907 -692
  17. package/fesm2022/dsivd-prestations-ng.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/schematics/migration-collection.json +5 -0
  20. package/schematics/ng-update/migrations/update-19_2_0/index.js +39 -0
  21. package/schematics/utility/form-signal/class-migration.js +396 -0
  22. package/schematics/utility/form-signal/edits.js +34 -0
  23. package/schematics/utility/form-signal/form-signal-migration.js +184 -0
  24. package/schematics/utility/form-signal/page-classes.js +129 -0
  25. package/schematics/utility/form-signal/template-migration.js +666 -0
  26. package/src/eslint/configs/template-rules.mjs +5 -0
  27. package/src/eslint/configs/ts-recommended.mjs +4 -0
  28. package/src/eslint/form-reads.mjs +63 -0
  29. package/src/eslint/rules/__tests__/no-direct-signal-mutation.test.mjs +58 -0
  30. package/src/eslint/rules/__tests__/no-item-track-in-form-list.test.mjs +127 -0
  31. package/src/eslint/rules/__tests__/no-uninvoked-signal-in-template.test.mjs +6 -0
  32. package/src/eslint/rules/__tests__/require-model-change.test.mjs +93 -0
  33. package/src/eslint/rules/index.mjs +4 -0
  34. package/src/eslint/rules/no-direct-signal-mutation.mjs +57 -19
  35. package/src/eslint/rules/no-item-track-in-form-list.mjs +99 -0
  36. package/src/eslint/rules/no-uninvoked-signal-in-template.mjs +8 -3
  37. package/src/eslint/rules/require-model-change.mjs +89 -0
  38. package/src/eslint/template-ast.mjs +12 -2
  39. package/types/dsivd-prestations-ng.d.ts +234 -35
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { ElementRef, OnInit, AfterViewInit, Signal, DestroyRef, OnDestroy, InjectionToken, OnChanges, SimpleChanges, EnvironmentProviders, Injector, SimpleChange, AfterViewChecked, PipeTransform, TemplateRef, TrackByFunction, ErrorHandler, NgZone } from '@angular/core';
2
+ import { ElementRef, OnInit, AfterViewInit, Signal, DestroyRef, WritableSignal, OnDestroy, InjectionToken, OnChanges, SimpleChanges, EnvironmentProviders, Injector, SimpleChange, AfterViewChecked, PipeTransform, TemplateRef, TrackByFunction, ErrorHandler, NgZone } from '@angular/core';
3
3
  import { Params, Route, ActivatedRoute, ActivatedRouteSnapshot, CanActivateFn, Router, QueryParamsHandling } from '@angular/router';
4
4
  import { Observable, Subject, BehaviorSubject } from 'rxjs';
5
5
  import { NgModel, NgForm } from '@angular/forms';
@@ -146,7 +146,7 @@ declare abstract class FoehnInputComponent<T> implements OnInit, AfterViewInit {
146
146
  #private;
147
147
  readonly model: _angular_core.ModelSignal<T | null | undefined>;
148
148
  readonly pattern: _angular_core.ModelSignal<string | undefined>;
149
- readonly helpModal: _angular_core.ModelSignal<HelpModal | undefined>;
149
+ readonly helpModal: _angular_core.ModelSignal<HelpModal | null | undefined>;
150
150
  readonly standardHelpText: _angular_core.ModelSignal<string | undefined>;
151
151
  readonly helpText: _angular_core.ModelSignal<string | undefined>;
152
152
  readonly disabled: _angular_core.ModelSignal<boolean>;
@@ -213,7 +213,7 @@ declare abstract class FoehnInputComponent<T> implements OnInit, AfterViewInit {
213
213
  * linkedSignal est un WritableSignal dont la valeur par défaut est recalculée si les dépendances changent,
214
214
  * mais qui peut être écrasé manuellement avec .set().
215
215
  */
216
- protected readonly hostId: _angular_core.WritableSignal<string | null>;
216
+ protected readonly hostId: _angular_core.WritableSignal<string>;
217
217
  /**
218
218
  * computed() — valeur dérivée
219
219
  * Quand le résultat est une valeur qui dépend d'autres signals. C'est une transformation pure, synchrone, sans side effect.
@@ -248,8 +248,8 @@ declare abstract class FoehnInputComponent<T> implements OnInit, AfterViewInit {
248
248
  refreshErrors(results: any[]): void;
249
249
  focus(scrollIntoView?: boolean): void;
250
250
  getMaxLength(): number | null;
251
- buildId(suffix?: string): string | null;
252
- buildChildId(suffix?: string): string | null;
251
+ buildId(suffix?: string): string;
252
+ buildChildId(suffix?: string): string;
253
253
  buildChildName(suffix?: string): string;
254
254
  onKeydown(_key: KeyboardEvent): void;
255
255
  reset(): void;
@@ -509,6 +509,87 @@ declare class GesdemHandlerService {
509
509
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<GesdemHandlerService>;
510
510
  }
511
511
 
512
+ type Depth = [never, 0, 1, 2, 3, 4, 5, 6, 7];
513
+ /**
514
+ * A path in an object: one of its keys, then the keys or the indexes of the objects and arrays it holds, e.g.
515
+ * `['firstName']`, `['address', 'locality']` or `['children', 0, 'firstName']`. For a union (`ApForm | AfForm`), the
516
+ * paths of each of its members.
517
+ */
518
+ type ObjectPath<T, D extends number = 7> = [D] extends [never] ? never : PathsOf<NonNullable<T>, D>;
519
+ type PathsOf<T, D extends number> = T extends readonly (infer E)[] ? [number] | [number, ...ObjectPath<E, Depth[D]>] : T extends object ? {
520
+ [K in keyof T & string]-?: [K] | [K, ...ObjectPath<T[K], Depth[D]>];
521
+ }[keyof T & string] : never;
522
+ /**
523
+ * The type of the value at a path of an object. For a union, the value in the members having the path.
524
+ */
525
+ type ObjectPathValue<T, P extends readonly unknown[]> = P extends readonly [infer K, ...infer R] ? ValueAtKey<NonNullable<T>, K, R> : T;
526
+ type ValueAtKey<T, K, R extends readonly unknown[]> = T extends readonly (infer E)[] ? ObjectPathValue<E, R> : K extends keyof T ? ObjectPathValue<T[K], R> : never;
527
+ /**
528
+ * Keys known at runtime only: a key with dots (`'address.street'`, `'children.0.firstName'`), or the list of the keys.
529
+ */
530
+ type ObjectKeys = string | readonly (string | number)[];
531
+ /**
532
+ * Reads and writes a value at a path of an object, without modifying the object: a write copies the objects and arrays
533
+ * along the path (with their prototype), and keeps the others as they are.
534
+ *
535
+ * A copy takes the own enumerable properties only: the objects along the path must be plain objects (e.g. the JSON of
536
+ * the backend), arrays or instances of classes with public fields. The copy of a `Date`, a `Map`, a `Set` or an
537
+ * instance with private fields (`#field`) loses their content, and their methods throw. The value written, and the
538
+ * objects beside the path, are not copied: they can be of any type.
539
+ *
540
+ * `get()`, `patch()` and `patchSignal()` take a path checked by TypeScript (a typo gives an error listing the valid
541
+ * keys). `getByKeys()` and `patchByKeys()` take keys known at runtime only (e.g. a key given as an input), not
542
+ * checked.
543
+ */
544
+ declare class ObjectPathHelper {
545
+ /**
546
+ * @param object an object
547
+ * @param path the keys and indexes leading to the value
548
+ * @returns the value at the path, `undefined` when an object of the path is `null` or `undefined`
549
+ */
550
+ static get<T, P extends ObjectPath<T>>(object: T, path: P): ObjectPathValue<T, P> | undefined;
551
+ /**
552
+ * Writes a value at a path of an object without modifying it.
553
+ *
554
+ * @param object an object
555
+ * @param path the keys and indexes leading to the value
556
+ * @param value the value to write
557
+ * @returns a new object, or the object itself when the value is already there
558
+ * @throws Error when an object of the path is `null` or `undefined`, as a write through it would
559
+ */
560
+ static patch<T, P extends ObjectPath<T>>(object: T, path: P, value: ObjectPathValue<T, P>): T;
561
+ /**
562
+ * Writes a value at a path of the object held by a signal, without modifying it in place: the signal gets a new
563
+ * object, and notifies its readers only when the value changes.
564
+ *
565
+ * @param signal a signal holding an object
566
+ * @param path the keys and indexes leading to the value
567
+ * @param value the value to write
568
+ * @throws Error when an object of the path, the value of the signal included, is `null` or `undefined`
569
+ */
570
+ static patchSignal<T, P extends ObjectPath<T>>(signal: WritableSignal<T>, path: P, value: ObjectPathValue<T, P>): void;
571
+ /**
572
+ * `get()` with keys known at runtime only, not checked by TypeScript.
573
+ *
574
+ * @param object an object
575
+ * @param keys `'address.street'`, or `['address', 'street']`
576
+ * @returns the value at the keys, `undefined` when an object of the path is `null` or `undefined`
577
+ */
578
+ static getByKeys(object: unknown, keys: ObjectKeys): unknown;
579
+ /**
580
+ * `patch()` with keys known at runtime only, not checked by TypeScript.
581
+ *
582
+ * @param object an object
583
+ * @param keys `'address.street'`, or `['address', 'street']`
584
+ * @param value the value to write
585
+ * @returns a new object, or the object itself when the value is already there
586
+ * @throws Error when an object of the path is `null` or `undefined`, as a write through it would
587
+ */
588
+ static patchByKeys<T>(object: T, keys: ObjectKeys, value: unknown): T;
589
+ private static keysOf;
590
+ private static patchFrom;
591
+ }
592
+
512
593
  type PlaceholderType = Record<string, string | null | undefined>;
513
594
  type DictionaryType = Record<string, string>;
514
595
  interface Language {
@@ -581,8 +662,16 @@ declare class SdkEventsLoggerService {
581
662
  declare abstract class AbstractPageComponent<T extends I18nForm> implements OnInit, AfterViewInit {
582
663
  #private;
583
664
  readonly foehnFormComponent: _angular_core.Signal<FoehnFormComponent | undefined>;
584
- form: T | undefined | null;
585
- reference: string | null | undefined;
665
+ /**
666
+ * The form of the page, a signal: never modify its value in place, write it with `patchForm()` (or `form.set()`
667
+ * / `form.update()` with a new object), so that the templates and the `computed()` reading it follow it.
668
+ */
669
+ readonly form: _angular_core.WritableSignal<T | null | undefined>;
670
+ /**
671
+ * The reference of the demand, set when the form is loaded. A template, a `computed()` or an `effect()` reading it
672
+ * follows it, also when the page sets it: read it with `untracked()` in an `effect()` which must not follow it.
673
+ */
674
+ readonly reference: _angular_core.WritableSignal<string | null | undefined>;
586
675
  protected _destroyRef: DestroyRef;
587
676
  protected _gesdemService: GesdemHandlerService;
588
677
  protected _gesdemEventService: GesdemEventService;
@@ -606,6 +695,17 @@ declare abstract class AbstractPageComponent<T extends I18nForm> implements OnIn
606
695
  send(goToNextPage?: boolean, displaySuccessMessage?: boolean): void;
607
696
  transmit(): void;
608
697
  sendAndTransmit(displaySuccessMessage?: boolean): void;
698
+ /**
699
+ * Writes a value into the form without modifying it in place: the objects and arrays along the path are copied.
700
+ * Bind a field with `[model]="form.firstName" (modelChange)="patchForm(['firstName'], $event)"`, inside an
701
+ * `@if (form(); as form)`.
702
+ *
703
+ * @param path the keys and indexes leading to the field, e.g. `['address', 'locality']` or
704
+ * `['children', $index, 'firstName']`
705
+ * @param value the new value (`null` and `undefined` included: the model of the `foehn-*` components can be, as
706
+ * with `[(model)]`)
707
+ */
708
+ patchForm<P extends ObjectPath<T>>(path: P, value: ObjectPathValue<T, P> | null | undefined): void;
609
709
  previous(): void;
610
710
  protected setPageTitle(pageTitle: string): void;
611
711
  protected setPageTitleAsync(pageTitle: Observable<string>): void;
@@ -1552,6 +1652,12 @@ declare class FoehnInputAddressComponent extends FoehnInputComponent<Address> im
1552
1652
  private clearAutocompletesWhenCountryIsUnappropriatedToComponentConfiguration;
1553
1653
  private getSwissCountry;
1554
1654
  private setDefaultCountry;
1655
+ private writeSwissCountry;
1656
+ /**
1657
+ * @returns whether the Swiss country is already set, in the component and in the model (unless the model has
1658
+ * nothing else: the country alone is not written)
1659
+ */
1660
+ private hasSwissCountry;
1555
1661
  private clearAutocompletes;
1556
1662
  private extractLocalityZipCodeId;
1557
1663
  private extractStreetEstrid;
@@ -1841,7 +1947,13 @@ declare class FoehnDateComponent extends FoehnInputComponent<FoehnDateModel> {
1841
1947
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FoehnDateComponent, "foehn-input-date", never, { "disableDay": { "alias": "disableDay"; "required": false; "isSignal": true; }; "disableMonth": { "alias": "disableMonth"; "required": false; "isSignal": true; }; "disableYear": { "alias": "disableYear"; "required": false; "isSignal": true; }; "hideDatePickerButton": { "alias": "hideDatePickerButton"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "childrenLabelSrOnly": { "alias": "childrenLabelSrOnly"; "required": false; "isSignal": true; }; "clearButton": { "alias": "clearButton"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
1842
1948
  }
1843
1949
 
1844
- declare class FoehnDateTimeComponent extends FoehnInputComponent<(number | null)[]> {
1950
+ /**
1951
+ * The model of `foehn-input-date-time`: `[year, month, day, hour, minute]`, a part not entered being `null`. It is the
1952
+ * JSON of a `LenientLocalDateTime` of prestations-be.
1953
+ */
1954
+ type FoehnDateTimeModel = (number | null)[];
1955
+
1956
+ declare class FoehnDateTimeComponent extends FoehnInputComponent<FoehnDateTimeModel> {
1845
1957
  readonly disableDay: _angular_core.InputSignal<boolean>;
1846
1958
  readonly disableMonth: _angular_core.InputSignal<boolean>;
1847
1959
  readonly disableYear: _angular_core.InputSignal<boolean>;
@@ -1850,7 +1962,7 @@ declare class FoehnDateTimeComponent extends FoehnInputComponent<(number | null)
1850
1962
  readonly hideDatePickerButton: _angular_core.InputSignal<boolean>;
1851
1963
  readonly childrenLabelSrOnly: _angular_core.InputSignal<boolean>;
1852
1964
  readonly clearButton: _angular_core.InputSignal<boolean>;
1853
- readonly date: _angular_core.WritableSignal<(number | null)[] | null>;
1965
+ readonly date: _angular_core.WritableSignal<FoehnDateModel | null>;
1854
1966
  readonly time: _angular_core.WritableSignal<string | null>;
1855
1967
  private readonly userInputTimeSubject;
1856
1968
  private readonly timeModelChangeSubject;
@@ -1866,7 +1978,7 @@ declare class FoehnDateTimeComponent extends FoehnInputComponent<(number | null)
1866
1978
  timeModelChange(value: string | null | undefined): void;
1867
1979
  handleUserInputTime(value: string | null | undefined): void;
1868
1980
  handleUserInputDate(): void;
1869
- getValidValue(): (number | null)[] | null | undefined;
1981
+ getValidValue(): FoehnDateTimeModel | null | undefined;
1870
1982
  resetModel(): void;
1871
1983
  isEmpty(): boolean;
1872
1984
  isEmptyDependingOnDisabled(): boolean;
@@ -1941,7 +2053,13 @@ declare class DisplayCurrencyPipe implements PipeTransform {
1941
2053
 
1942
2054
  declare class DisplayDatePipe implements PipeTransform {
1943
2055
  private readonly dateHelper;
1944
- transform(value: Date | number[] | null | undefined, showTime?: boolean): string | null;
2056
+ /**
2057
+ * @param value a Date, or a date or a date-time as an array (e.g. the model of `foehn-input-date` or
2058
+ * `foehn-input-date-time`)
2059
+ * @param showTime whether to display the time, when the value has one
2060
+ * @returns the date to display, null when it is not complete (a part not entered)
2061
+ */
2062
+ transform(value: Date | FoehnDateModel | FoehnDateTimeModel | null | undefined, showTime?: boolean): string | null;
1945
2063
  private transformFromDate;
1946
2064
  private transformFromArray;
1947
2065
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DisplayDatePipe, never>;
@@ -2775,7 +2893,6 @@ declare class PendingUploadService {
2775
2893
  private uploadPendingFilesAndSaveForm;
2776
2894
  private executeSingleUpload;
2777
2895
  private mergePendingUploadedServerResult;
2778
- private setNestedValue;
2779
2896
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PendingUploadService, never>;
2780
2897
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<PendingUploadService>;
2781
2898
  }
@@ -3045,7 +3162,8 @@ declare class FoehnConfirmModalComponent implements OnInit {
3045
3162
  }
3046
3163
 
3047
3164
  declare class FoehnHelpModalComponent {
3048
- readonly modalContent: _angular_core.InputSignal<HelpModal | undefined>;
3165
+ readonly id: _angular_core.InputSignal<string>;
3166
+ readonly modalContent: _angular_core.InputSignal<HelpModal | null | undefined>;
3049
3167
  readonly draggable: _angular_core.InputSignal<boolean>;
3050
3168
  readonly hideable: _angular_core.InputSignal<boolean>;
3051
3169
  readonly modalTrigger: _angular_core.Signal<ElementRef<any> | undefined>;
@@ -3058,8 +3176,9 @@ declare class FoehnHelpModalComponent {
3058
3176
  closeOnModalClick(): void;
3059
3177
  updateVisibilityStatus(status: boolean): void;
3060
3178
  hasContent(): boolean;
3179
+ buildId(suffix?: string): string;
3061
3180
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FoehnHelpModalComponent, never>;
3062
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FoehnHelpModalComponent, "foehn-help-modal", never, { "modalContent": { "alias": "modalContent"; "required": false; "isSignal": true; }; "draggable": { "alias": "draggable"; "required": false; "isSignal": true; }; "hideable": { "alias": "hideable"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
3181
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FoehnHelpModalComponent, "foehn-help-modal", never, { "id": { "alias": "id"; "required": true; "isSignal": true; }; "modalContent": { "alias": "modalContent"; "required": false; "isSignal": true; }; "draggable": { "alias": "draggable"; "required": false; "isSignal": true; }; "hideable": { "alias": "hideable"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
3063
3182
  }
3064
3183
 
3065
3184
  declare class FoehnPageModalComponent implements OnInit {
@@ -3104,15 +3223,51 @@ declare class DateHelper {
3104
3223
  private readonly dateTimeFormat;
3105
3224
  private readonly datePipe;
3106
3225
  constructor();
3226
+ /**
3227
+ * @param value a date (year, month, day), a part not entered being null
3228
+ * @returns whether the year, the month and the day are entered
3229
+ */
3107
3230
  private static isValidArray;
3231
+ /**
3232
+ * @param value a part of a time (e.g. an hour)
3233
+ * @param max its maximum (e.g. 23)
3234
+ * @returns whether it is entered and between 0 and max
3235
+ */
3236
+ private static isInRange;
3108
3237
  mapToDateFromNumberArray(object: any, ...fieldsNames: string[]): any;
3109
3238
  mapAllToDateFromNumberArray(objects: any[], ...fieldsNames: string[]): any[];
3110
- toDateFromNumberArray(dateInArray: number[] | null | undefined): Date | null;
3111
- arrayToDisplayDateDMY(d: number[] | null | undefined, showTime: boolean): string | null;
3112
- toDayjsFromNumberArray(value: number[]): dayjs.Dayjs | null;
3113
- isValid(value: number[]): boolean;
3114
- isToday(value: number[]): boolean;
3115
- leftPad(num: string): string;
3239
+ /**
3240
+ * @param dateInArray a date (`[year, month, day]`) or a date-time (`[year, month, day, hour, minute, second?]`)
3241
+ * @returns the date (in the time zone of the browser), null when it is not complete (e.g. the model of
3242
+ * `foehn-input-date` with a part not entered); the date only when the time is not complete
3243
+ * @throws for an array of 1, 2 or 4 numbers
3244
+ */
3245
+ toDateFromNumberArray(dateInArray: FoehnDateModel | FoehnDateTimeModel | null | undefined): Date | null;
3246
+ /**
3247
+ * @param value a date or a date-time
3248
+ * @returns whether it has an hour and a minute (a date-time with its time entered)
3249
+ */
3250
+ hasTime(value: FoehnDateModel | FoehnDateTimeModel | null | undefined): boolean;
3251
+ arrayToDisplayDateDMY(d: FoehnDateModel | FoehnDateTimeModel | null | undefined, showTime: boolean): string | null;
3252
+ toDayjsFromNumberArray(value: FoehnDateModel | null | undefined): dayjs.Dayjs | null;
3253
+ /**
3254
+ * @param value a date (3 parts, e.g. the model of `foehn-input-date`) or a date-time (5 parts or more, e.g. the
3255
+ * model of `foehn-input-date-time`), as the backend sends it (`LenientLocalDate`, `LenientLocalDateTime`)
3256
+ * @returns whether the date is complete and exists (not 30.02.2021) and, for a date-time, whether its hour (0 to
3257
+ * 23) and its minute (0 to 59) are entered, as `LenientLocalDateTime.isValid()` of prestations-be
3258
+ */
3259
+ isValid(value: FoehnDateModel | FoehnDateTimeModel | null | undefined): boolean;
3260
+ /**
3261
+ * @param value a date or a date-time (only its date is considered)
3262
+ * @returns whether the date exists and is today (30.02.2026 is not the 02.03.2026)
3263
+ */
3264
+ isToday(value: FoehnDateModel | FoehnDateTimeModel | null | undefined): boolean;
3265
+ leftPad(num: string | null | undefined): string;
3266
+ /**
3267
+ * @param value a date or a date-time
3268
+ * @returns whether its date is complete and exists (dayjs shifts the 30.02.2021 to the 02.03.2021)
3269
+ */
3270
+ private isExistingDate;
3116
3271
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DateHelper, never>;
3117
3272
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DateHelper>;
3118
3273
  }
@@ -3142,8 +3297,8 @@ declare class NumberCurrencyFormatterDirective implements OnInit {
3142
3297
  private readonly formattingEffect;
3143
3298
  onBlur(event: FocusEvent): void;
3144
3299
  onFocus(event: FocusEvent): void;
3145
- onModelChange(value: string | null | undefined): void;
3146
3300
  ngOnInit(): void;
3301
+ private formatModel;
3147
3302
  private setFormatting;
3148
3303
  private hasValueChanged;
3149
3304
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NumberCurrencyFormatterDirective, never>;
@@ -3339,11 +3494,48 @@ declare class FoehnListItem {
3339
3494
 
3340
3495
  declare abstract class AbstractListDetailPageComponent<FORM_TYPE extends I18nForm, ITEM_TYPE extends FoehnListItem> extends AbstractPageFromMenuComponent<FORM_TYPE> implements OnInit, OnDestroy {
3341
3496
  #private;
3342
- list: ITEM_TYPE[];
3343
- itemIndex: number | null;
3497
+ /**
3498
+ * The list of the form, at `getListPath()`.
3499
+ */
3500
+ readonly list: _angular_core.Signal<ITEM_TYPE[]>;
3501
+ /**
3502
+ * The index of the item edited, set once the form is loaded: the one of the URL, or the new item added at the end
3503
+ * of the list.
3504
+ */
3505
+ readonly itemIndex: _angular_core.WritableSignal<number | null>;
3506
+ /**
3507
+ * The item edited, `null` until the form is loaded.
3508
+ */
3509
+ readonly itemToEdit: _angular_core.Signal<ITEM_TYPE | null>;
3344
3510
  protected router: Router;
3345
3511
  protected location: Location;
3346
- get itemToEdit(): ITEM_TYPE | null;
3512
+ /**
3513
+ * @returns the list of the form, at `getListPath()`
3514
+ */
3515
+ getList(): ITEM_TYPE[];
3516
+ /**
3517
+ * Writes a value into the item edited, without modifying the form in place. Bind a field of the item with
3518
+ * `[model]="item.name" (modelChange)="patchItem(['name'], $event)"`, inside an `@if (itemToEdit(); as item)`.
3519
+ *
3520
+ * @param path the keys and indexes leading to the field in the item
3521
+ * @param value the new value (`null` and `undefined` included: the model of the `foehn-*` components can be, as
3522
+ * with `[(model)]`)
3523
+ */
3524
+ patchItem<P extends ObjectPath<ITEM_TYPE>>(path: P, value: ObjectPathValue<ITEM_TYPE, P> | null | undefined): void;
3525
+ /**
3526
+ * Replaces the item edited with the one returned by `update`, in a single write of the form, e.g. to empty several
3527
+ * fields at once: `this.updateItem((item) => ({ ...item, site: null, ideNumber: null }))`. Never modify the item
3528
+ * given: return a new one.
3529
+ *
3530
+ * @param update gives the new item from the current one
3531
+ */
3532
+ updateItem(update: (item: ITEM_TYPE) => ITEM_TYPE): void;
3533
+ /**
3534
+ * Replaces the item edited, e.g. bound as a whole to a component: `[model]="item" (modelChange)="setItem($event)"`.
3535
+ *
3536
+ * @param item the new item
3537
+ */
3538
+ setItem(item: ITEM_TYPE): void;
3347
3539
  ngOnInit(): void;
3348
3540
  ngOnDestroy(): void;
3349
3541
  protected getNextTrackingIndex(): number;
@@ -3354,7 +3546,10 @@ declare abstract class AbstractListDetailPageComponent<FORM_TYPE extends I18nFor
3354
3546
  private assignItemIndex;
3355
3547
  private scrollToSpecifiedElement;
3356
3548
  private showErrors;
3357
- abstract getList(): ITEM_TYPE[];
3549
+ /**
3550
+ * @returns the path of the list in the form, e.g. `['vehicles']`
3551
+ */
3552
+ abstract getListPath(): ObjectPath<FORM_TYPE>;
3358
3553
  abstract getNewListItem(): ITEM_TYPE;
3359
3554
  abstract getListPagePath(): string;
3360
3555
  abstract getListPageLabel(): string;
@@ -3544,7 +3739,6 @@ declare class FoehnDatePickerComponent implements OnInit {
3544
3739
  readonly weeks: _angular_core.WritableSignal<DayMonth[][]>;
3545
3740
  readonly selectedDate: _angular_core.WritableSignal<dayjs.Dayjs | null>;
3546
3741
  currentMonthYear: Observable<MonthYear | null>;
3547
- model_: number[] | undefined | null;
3548
3742
  readonly monthListItem: _angular_core.WritableSignal<FormSelectOption[]>;
3549
3743
  private readonly dictionary;
3550
3744
  private readonly injector;
@@ -3566,9 +3760,8 @@ declare class FoehnDatePickerComponent implements OnInit {
3566
3760
  handleKeyboardUpEvent(event: KeyboardEvent): void;
3567
3761
  handleKeyboardDownEvent(event: KeyboardEvent): void;
3568
3762
  ngOnInit(): void;
3569
- onModelChange(value: number[] | null): void;
3570
3763
  updateNgModel(value: number[] | null): void;
3571
- buildId(suffix?: string): string | null;
3764
+ buildId(suffix?: string): string;
3572
3765
  isToday(date: dayjs.Dayjs | undefined): boolean;
3573
3766
  isSelected(date: dayjs.Dayjs | undefined): boolean;
3574
3767
  handleUserInput(date: dayjs.Dayjs | undefined): void;
@@ -3586,6 +3779,12 @@ declare class FoehnDatePickerComponent implements OnInit {
3586
3779
  isNextMonthDisabled(monthYear: MonthYear): boolean;
3587
3780
  private isDateInRange;
3588
3781
  private initializeDatepicker;
3782
+ /**
3783
+ * Selects the date of the model and displays its month (the current month without any date). Not a computed: the
3784
+ * navigation helper keeps the displayed month, also changed by the navigation of the user.
3785
+ * @param value the model
3786
+ */
3787
+ private syncWithModel;
3589
3788
  private setDate;
3590
3789
  private getDateAsArray;
3591
3790
  private focusOnDatepickerTrigger;
@@ -3609,17 +3808,13 @@ declare class FoehnDatePickerButtonComponent implements OnInit {
3609
3808
  readonly selectedDateSrOnlyLabelKey: _angular_core.InputSignal<string>;
3610
3809
  readonly datepickerTrigger: _angular_core.Signal<ElementRef<any> | undefined>;
3611
3810
  readonly userInput: _angular_core.OutputEmitterRef<number[] | null>;
3612
- model_: number[] | null | undefined;
3613
3811
  private readonly isVisible;
3614
- private readonly modelEffect;
3615
3812
  get isDatepickerVisible(): boolean;
3616
3813
  ngOnInit(): void;
3617
- buildId(suffix?: string): string | null;
3814
+ buildId(suffix?: string): string;
3618
3815
  open(): void;
3619
3816
  close(): void;
3620
3817
  updateVisibilityStatus(status: boolean): void;
3621
- onModelChange(value: number[] | null): void;
3622
- updateNgModel(value: number[] | null): void;
3623
3818
  handleUserInput(date: number[] | null): void;
3624
3819
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FoehnDatePickerButtonComponent, never>;
3625
3820
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FoehnDatePickerButtonComponent, "foehn-date-picker-button", never, { "model": { "alias": "model"; "required": true; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "displaySelectedDate": { "alias": "displaySelectedDate"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": true; "isSignal": true; }; "minYear": { "alias": "minYear"; "required": false; "isSignal": true; }; "maxYear": { "alias": "maxYear"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "selectedDateSrOnlyLabelKey": { "alias": "selectedDateSrOnlyLabelKey"; "required": false; "isSignal": true; }; }, { "model": "modelChange"; "userInput": "userInput"; }, never, never, true, never>;
@@ -3677,6 +3872,10 @@ declare class ObjectHelper {
3677
3872
  */
3678
3873
  static deepCopy(obj: any): any;
3679
3874
  static stripHtml(html: string): string;
3875
+ /**
3876
+ * @deprecated use `ObjectPathHelper.getByKeys(obj, key)`, which it calls: the value at the path of the key
3877
+ * (`'address.street'`).
3878
+ */
3680
3879
  static getNestedProperty(obj: unknown, key: string): any;
3681
3880
  }
3682
3881
 
@@ -3974,5 +4173,5 @@ declare class SdkLogsService {
3974
4173
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<SdkLogsService>;
3975
4174
  }
3976
4175
 
3977
- export { APP_INFO_API_URL, AbstractFoehnUploaderComponent, AbstractListDetailPageComponent, AbstractMenuPageComponent, AbstractPageComponent, AbstractPageFromMenuComponent, ActionStatut, Address, AddressTypeLight, ApplicationInfo, ApplicationInfoService, BAD_PARAMS_HELP_TEXT, BoDocumentError, BoDocumentsWithErrors, BoMultiUploadService, Breadcrumb, BreadcrumbEventService, BreadcrumbItem, CAPTCHA_ERROR_NAME, CURRENCY_REGEXP, Calendar, Canton, Captcha, ChunkLoadErrorHandler, Configuration, Country, CurrencyHelper, CurrentWeek, DECIMALS_SEPARATOR, DEFAULT_INTERNATIONAL_FIX_AND_MOBILE, DEFAULT_INTERNATIONAL_FIX_ONLY, DEFAULT_INTERNATIONAL_MOBILE_ONLY, DEFAULT_PREFIX, DEFAULT_SWISS_FIX_AND_MOBILE, DEFAULT_SWISS_FIX_ONLY, DEFAULT_SWISS_MOBILE_ONLY, DICTIONARY_BASE_URL, DateHelper, DatePickerHelper, DatePickerNavigationHelper, DayMonth, DaySlots, DemandeExpirationService, DemandeHelper, DisplayCurrencyPipe, DisplayDatePipe, District, Document, DocumentError, DocumentReference, DocumentReferenceWithFile, DocumentsWithErrors, DropdownMenuGroup, DropdownMenuItem, EPaymentService, EtapeInfo, FEEDBACK_USAGERS_LOCAL_STORAGE_PREFIX, FORM_SUPPORT_CYBER_TITLE_FALLBACK, FocusedDay, FoehnAbbrComponent, FoehnAgendaComponent, FoehnAgendaNavigationComponent, FoehnAgendaTimeslotPanelComponent, FoehnAutocompleteComponent, FoehnBoMultiUploadComponent, FoehnBooleanCheckboxComponent, FoehnBooleanRadioComponent, FoehnBreadcrumbComponent, FoehnCheckableGroupComponent, FoehnCheckboxComponent, FoehnConfirmModalComponent, FoehnConfirmModalContent, FoehnConfirmModalService, FoehnDateComponent, FoehnDatePickerButtonComponent, FoehnDatePickerComponent, FoehnDateTimeComponent, FoehnDecisionElectroniqueComponent, FoehnDisplayAddressComponent, FoehnDropdownMenuComponent, FoehnErrorPillComponent, FoehnFeedbackNotificationComponent, FoehnFormComponent, FoehnGlobalUploadProgressBarComponent, FoehnHeaderComponent, FoehnHelpModalComponent, FoehnIconCalendarComponent, FoehnIconCheckComponent, FoehnIconCheckSquareOComponent, FoehnIconChevronDownComponent, FoehnIconChevronLeftComponent, FoehnIconChevronRightComponent, FoehnIconChevronUpComponent, FoehnIconClockComponent, FoehnIconCommentDotsComponent, FoehnIconEditComponent, FoehnIconExternalLinkAltComponent, FoehnIconFilePdfComponent, FoehnIconInfoCircleComponent, FoehnIconLockComponent, FoehnIconMapMarkerComponent, FoehnIconMinusCircleComponent, FoehnIconPencilComponent, FoehnIconPlusCircleComponent, FoehnIconPlusSquareComponent, FoehnIconSearchComponent, FoehnIconTimesComponent, FoehnIconTrashAltComponent, FoehnIconUnlockAltComponent, FoehnIconUserComponent, FoehnInputAddressComponent, FoehnInputComponent, FoehnInputEmailComponent, FoehnInputForeignLocalityComponent, FoehnInputForeignStreetComponent, FoehnInputHiddenComponent, FoehnInputNav13Component, FoehnInputNumberComponent, FoehnInputPasswordComponent, FoehnInputPhoneComponent, FoehnInputPrefixedTextComponent, FoehnInputStringComponent, FoehnInputTextComponent, FoehnInputTextareaComponent, FoehnListComponent, FoehnListItem, FoehnListSummaryComponent, FoehnMenuItemComponent, FoehnMenuItemTransmitComponent, FoehnModalComponent, FoehnMultiUploadComponent, FoehnMultiselectAutocompleteComponent, FoehnNavigationComponent, FoehnNavigationService, FoehnNotfoundComponent, FoehnPageComponent, FoehnPageCounterComponent, FoehnPageExpirationTimerComponent, FoehnPageModalComponent, FoehnPageService, FoehnPictureUploadComponent, FoehnRadioComponent, FoehnRecapSectionComponent, FoehnRemainingAlertsSummaryComponent, FoehnSelectComponent, FoehnSimpleNavigationComponent, FoehnSkipLinkComponent, FoehnStatusProgressBarComponent, FoehnTableColumnConfiguration, FoehnTableComponent, FoehnTablePageChangeEvent, FoehnTimeComponent, FoehnTransmitWaitingModalComponent, FoehnTransmitWaitingModalService, FoehnUploadProgressBarComponent, FoehnUserConnectedAsComponent, FoehnValidationAlertSummaryComponent, FoehnValidationAlertsComponent, FooterLink, FormMetadata, FormPostResponse, FormSelectOption, FormatAvsPipe, FormatIdePipe, GESDEM_MAX_DATA_LENGTH, GesdemActionRecoveryLoginComponent, GesdemActionRecoveryRegistrationComponent, GesdemConfirmationComponent, GesdemErrorComponent, GesdemEventService, GesdemHandlerService, GesdemStatutUtils, GlobalUploadProgressService, GrowlBrokerService, GrowlMessage, GrowlType, HTTP_LOADER_FILTERED_URL, I18nForm, IAM_ACV_OIDC_REDIRECT_LOCATION_REGEX, IAM_ACV_REDIRECT_LOCATION_REGEX, IbanFormatterDirective, IdeFormatterDirective, IntervalHelper, LineBreakAsHtmlPipe, Locality, MonthYear, MultiUploadService, Municipality, NDCFormatterDirective, NEVER_CONNECTED, NavigationDirection, NumberCurrencyFormatterDirective, OIDC_ENABLED, ObjectHelper, PORTAIL_BASE_URL_INT, PORTAIL_BASE_URL_PROD, PORTAIL_BASE_URL_VAL, PageChangeEvent, PageUploadLimitService, PaginationWeek, PendingFiles, PendingPaymentComponent, PendingUploadService, PlaceOfOrigin, Portail, PostalLocality, Preferences, RECAPTCHA_API_URL, RecaptchaService, RedirectComponent, RegisterNgModelService, RowElement, SESSION_INFO_API_URL, SWISS_ISO_ID, ScrollHelper, SdkDictionaryPipe, SdkDictionaryService, SdkEpaymentComponent, SdkEvent, SdkEventType, SdkEventsLoggerService, SdkLog, SdkLogLevel, SdkLogsService, SdkRecaptchaComponent, SdkStatisticsService, SelectedSlot, Session, SessionInfo, SessionInfoData, SessionInfoWithApplicationService, Street, StreetNumber, StringHelper, THOUSANDS_SEPARATOR, TRANSMIT_WAITING_MODAL_DELAY_IN_MILLISECONDS, TableSort, UploadProgress, UploadProgressService, UploaderHelper, ValidationHandlerService, formatDecimalCurrency, formatNonDecimalCurrency, formatNumberAsGiven, gesdemLoaderGuard, getSafeFileNameForErrorMessage, providePrestationsNgCore, replaceAll, splitDocumentChanges };
3978
- export type { BreadcrumbConfiguration, BrowserInfo, ComponentError, DictionaryType, DocumentChanges, FoehnDateModel, FoehnListItemDescription, FoehnModalSize, FoehnRecapSection, FoehnRecapSectionElement, FoehnRecapSectionElementValueType, FormError, HasCustomErrors, HelpModal, Image, Language, PlaceholderType, UploaderErrorLimits };
4176
+ export { APP_INFO_API_URL, AbstractFoehnUploaderComponent, AbstractListDetailPageComponent, AbstractMenuPageComponent, AbstractPageComponent, AbstractPageFromMenuComponent, ActionStatut, Address, AddressTypeLight, ApplicationInfo, ApplicationInfoService, BAD_PARAMS_HELP_TEXT, BoDocumentError, BoDocumentsWithErrors, BoMultiUploadService, Breadcrumb, BreadcrumbEventService, BreadcrumbItem, CAPTCHA_ERROR_NAME, CURRENCY_REGEXP, Calendar, Canton, Captcha, ChunkLoadErrorHandler, Configuration, Country, CurrencyHelper, CurrentWeek, DECIMALS_SEPARATOR, DEFAULT_INTERNATIONAL_FIX_AND_MOBILE, DEFAULT_INTERNATIONAL_FIX_ONLY, DEFAULT_INTERNATIONAL_MOBILE_ONLY, DEFAULT_PREFIX, DEFAULT_SWISS_FIX_AND_MOBILE, DEFAULT_SWISS_FIX_ONLY, DEFAULT_SWISS_MOBILE_ONLY, DICTIONARY_BASE_URL, DateHelper, DatePickerHelper, DatePickerNavigationHelper, DayMonth, DaySlots, DemandeExpirationService, DemandeHelper, DisplayCurrencyPipe, DisplayDatePipe, District, Document, DocumentError, DocumentReference, DocumentReferenceWithFile, DocumentsWithErrors, DropdownMenuGroup, DropdownMenuItem, EPaymentService, EtapeInfo, FEEDBACK_USAGERS_LOCAL_STORAGE_PREFIX, FORM_SUPPORT_CYBER_TITLE_FALLBACK, FocusedDay, FoehnAbbrComponent, FoehnAgendaComponent, FoehnAgendaNavigationComponent, FoehnAgendaTimeslotPanelComponent, FoehnAutocompleteComponent, FoehnBoMultiUploadComponent, FoehnBooleanCheckboxComponent, FoehnBooleanRadioComponent, FoehnBreadcrumbComponent, FoehnCheckableGroupComponent, FoehnCheckboxComponent, FoehnConfirmModalComponent, FoehnConfirmModalContent, FoehnConfirmModalService, FoehnDateComponent, FoehnDatePickerButtonComponent, FoehnDatePickerComponent, FoehnDateTimeComponent, FoehnDecisionElectroniqueComponent, FoehnDisplayAddressComponent, FoehnDropdownMenuComponent, FoehnErrorPillComponent, FoehnFeedbackNotificationComponent, FoehnFormComponent, FoehnGlobalUploadProgressBarComponent, FoehnHeaderComponent, FoehnHelpModalComponent, FoehnIconCalendarComponent, FoehnIconCheckComponent, FoehnIconCheckSquareOComponent, FoehnIconChevronDownComponent, FoehnIconChevronLeftComponent, FoehnIconChevronRightComponent, FoehnIconChevronUpComponent, FoehnIconClockComponent, FoehnIconCommentDotsComponent, FoehnIconEditComponent, FoehnIconExternalLinkAltComponent, FoehnIconFilePdfComponent, FoehnIconInfoCircleComponent, FoehnIconLockComponent, FoehnIconMapMarkerComponent, FoehnIconMinusCircleComponent, FoehnIconPencilComponent, FoehnIconPlusCircleComponent, FoehnIconPlusSquareComponent, FoehnIconSearchComponent, FoehnIconTimesComponent, FoehnIconTrashAltComponent, FoehnIconUnlockAltComponent, FoehnIconUserComponent, FoehnInputAddressComponent, FoehnInputComponent, FoehnInputEmailComponent, FoehnInputForeignLocalityComponent, FoehnInputForeignStreetComponent, FoehnInputHiddenComponent, FoehnInputNav13Component, FoehnInputNumberComponent, FoehnInputPasswordComponent, FoehnInputPhoneComponent, FoehnInputPrefixedTextComponent, FoehnInputStringComponent, FoehnInputTextComponent, FoehnInputTextareaComponent, FoehnListComponent, FoehnListItem, FoehnListSummaryComponent, FoehnMenuItemComponent, FoehnMenuItemTransmitComponent, FoehnModalComponent, FoehnMultiUploadComponent, FoehnMultiselectAutocompleteComponent, FoehnNavigationComponent, FoehnNavigationService, FoehnNotfoundComponent, FoehnPageComponent, FoehnPageCounterComponent, FoehnPageExpirationTimerComponent, FoehnPageModalComponent, FoehnPageService, FoehnPictureUploadComponent, FoehnRadioComponent, FoehnRecapSectionComponent, FoehnRemainingAlertsSummaryComponent, FoehnSelectComponent, FoehnSimpleNavigationComponent, FoehnSkipLinkComponent, FoehnStatusProgressBarComponent, FoehnTableColumnConfiguration, FoehnTableComponent, FoehnTablePageChangeEvent, FoehnTimeComponent, FoehnTransmitWaitingModalComponent, FoehnTransmitWaitingModalService, FoehnUploadProgressBarComponent, FoehnUserConnectedAsComponent, FoehnValidationAlertSummaryComponent, FoehnValidationAlertsComponent, FooterLink, FormMetadata, FormPostResponse, FormSelectOption, FormatAvsPipe, FormatIdePipe, GESDEM_MAX_DATA_LENGTH, GesdemActionRecoveryLoginComponent, GesdemActionRecoveryRegistrationComponent, GesdemConfirmationComponent, GesdemErrorComponent, GesdemEventService, GesdemHandlerService, GesdemStatutUtils, GlobalUploadProgressService, GrowlBrokerService, GrowlMessage, GrowlType, HTTP_LOADER_FILTERED_URL, I18nForm, IAM_ACV_OIDC_REDIRECT_LOCATION_REGEX, IAM_ACV_REDIRECT_LOCATION_REGEX, IbanFormatterDirective, IdeFormatterDirective, IntervalHelper, LineBreakAsHtmlPipe, Locality, MonthYear, MultiUploadService, Municipality, NDCFormatterDirective, NEVER_CONNECTED, NavigationDirection, NumberCurrencyFormatterDirective, OIDC_ENABLED, ObjectHelper, ObjectPathHelper, PORTAIL_BASE_URL_INT, PORTAIL_BASE_URL_PROD, PORTAIL_BASE_URL_VAL, PageChangeEvent, PageUploadLimitService, PaginationWeek, PendingFiles, PendingPaymentComponent, PendingUploadService, PlaceOfOrigin, Portail, PostalLocality, Preferences, RECAPTCHA_API_URL, RecaptchaService, RedirectComponent, RegisterNgModelService, RowElement, SESSION_INFO_API_URL, SWISS_ISO_ID, ScrollHelper, SdkDictionaryPipe, SdkDictionaryService, SdkEpaymentComponent, SdkEvent, SdkEventType, SdkEventsLoggerService, SdkLog, SdkLogLevel, SdkLogsService, SdkRecaptchaComponent, SdkStatisticsService, SelectedSlot, Session, SessionInfo, SessionInfoData, SessionInfoWithApplicationService, Street, StreetNumber, StringHelper, THOUSANDS_SEPARATOR, TRANSMIT_WAITING_MODAL_DELAY_IN_MILLISECONDS, TableSort, UploadProgress, UploadProgressService, UploaderHelper, ValidationHandlerService, formatDecimalCurrency, formatNonDecimalCurrency, formatNumberAsGiven, gesdemLoaderGuard, getSafeFileNameForErrorMessage, providePrestationsNgCore, replaceAll, splitDocumentChanges };
4177
+ export type { BreadcrumbConfiguration, BrowserInfo, ComponentError, DictionaryType, DocumentChanges, FoehnDateModel, FoehnDateTimeModel, FoehnListItemDescription, FoehnModalSize, FoehnRecapSection, FoehnRecapSectionElement, FoehnRecapSectionElementValueType, FormError, HasCustomErrors, HelpModal, Image, Language, ObjectKeys, ObjectPath, ObjectPathValue, PlaceholderType, UploaderErrorLimits };