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

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.
@@ -805,13 +805,17 @@ class FoehnInputComponent {
805
805
  // Only a change of the model must call onModelChange(), not a change
806
806
  // of the state it reads or updates (which can be signals).
807
807
  untracked(() => {
808
- // The model of the page is known (model_) once it has a value to display: when the user empties every
809
- // field, the getValidValue() of the components then returns null. A model without any value to display
810
- // stays unknown, so that it is never replaced by null without any input of the user. Set before
808
+ // The model of the page is known (model_) once it has a value to display, and then follows it: when the
809
+ // user empties every field, the getValidValue() of the components then returns null. A model without any
810
+ // value to display stays unknown, so that it is never replaced by null without any input of the user.
811
+ // Once known, it stays known: a model set back to undefined by the page is null. Set before
811
812
  // onModelChange(), which can change it.
812
813
  if (this.hasValueToDisplay(value)) {
813
814
  this.model_ = value;
814
815
  }
816
+ else if (this.model_ !== undefined) {
817
+ this.model_ = value ?? null;
818
+ }
815
819
  this.onModelChange(value);
816
820
  });
817
821
  }, ...(ngDevMode ? [{ debugName: "modelEffect" }] : /* istanbul ignore next */ []));
@@ -851,8 +855,14 @@ class FoehnInputComponent {
851
855
  ngAfterViewInit() {
852
856
  this.registerNgModelService.updateRegisteredNgModels();
853
857
  }
854
- onModelChange(value) {
855
- this.model_ = value;
858
+ /**
859
+ * Called with every new model (given by the page or set by the component), once `model_` is up to date. Does
860
+ * nothing by default: to override only to act on a new model, e.g. to normalize it. Fields derived from the
861
+ * model are `linkedSignal()` or `computed()`, not copies made here.
862
+ * @param _value the new model
863
+ */
864
+ onModelChange(_value) {
865
+ // Nothing by default
856
866
  }
857
867
  handleChange(value) {
858
868
  this.triggerUserInput(value);
@@ -6532,7 +6542,8 @@ class FoehnCheckableGroupComponent extends FoehnInputComponent {
6532
6542
  }
6533
6543
  else if (this.model()) {
6534
6544
  afterNextRender(() => {
6535
- this.updateNgModel(this.model_);
6545
+ // model_ stays unknown (undefined) for a model without any value to display, e.g. []
6546
+ this.updateNgModel(this.model_ === undefined ? this.model() : this.model_);
6536
6547
  }, { injector: this.#injector });
6537
6548
  }
6538
6549
  // Sync component disabled state only when it was auto-derived from elements.
@@ -7303,7 +7314,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
7303
7314
  args: [{ selector: 'foehn-icon-chevron-right', imports: [FaIconComponent], template: "<fa-icon\n aria-hidden=\"true\"\n [title]=\"title() ? title() : defaultTitle\"\n [icon]=\"iconName\"\n/>\n<span class=\"visually-hidden\">{{ title() ? title() : defaultTitle }}</span>\n" }]
7304
7315
  }] });
7305
7316
 
7306
- const hasInputChanged$2 = (change) => change && !ObjectHelper.isEqual(change.previousValue, change.currentValue);
7307
7317
  class FoehnTableComponent extends FoehnInputComponent {
7308
7318
  columnsConfiguration =
7309
7319
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -7320,30 +7330,36 @@ class FoehnTableComponent extends FoehnInputComponent {
7320
7330
  trackByFn = input((index, _item) => index, ...(ngDevMode ? [{ debugName: "trackByFn" }] : /* istanbul ignore next */ []));
7321
7331
  pageChange = output();
7322
7332
  rowClick = output();
7323
- currentPage = signal(1, ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
7324
- filteredList = signal([], ...(ngDevMode ? [{ debugName: "filteredList" }] : /* istanbul ignore next */ []));
7325
- _list = signal(undefined, ...(ngDevMode ? [{ debugName: "_list" }] : /* istanbul ignore next */ []));
7326
- onModelChange(value) {
7327
- this._list.set(value);
7328
- this.buildFilteredList();
7329
- }
7330
- trackFoehnTableColumnConfiguration = (index, item) => item.id || item.columnLabelKey || index;
7331
- ngOnChanges(changes) {
7332
- const itemsPerPageChange = changes.itemsPerPage;
7333
- const fixedPageCountChange = changes.fixedPageCount;
7334
- const sortInputChange = changes.sort;
7335
- const modelChange = changes.model;
7336
- if (!hasInputChanged$2(itemsPerPageChange) &&
7337
- !hasInputChanged$2(fixedPageCountChange) &&
7338
- !hasInputChanged$2(sortInputChange) &&
7339
- !hasInputChanged$2(modelChange)) {
7340
- return;
7333
+ /**
7334
+ * The page displayed, changed by the navigation. Back to the first page when the list, itemsPerPage or
7335
+ * fixedPageCount leave it without any item. Also checked again on a new sort (see filteredList).
7336
+ */
7337
+ currentPage = linkedSignal({ ...(ngDevMode ? { debugName: "currentPage" } : /* istanbul ignore next */ {}), source: () => [
7338
+ this.model(),
7339
+ this.itemsPerPage(),
7340
+ this.fixedPageCount(),
7341
+ this.sort(),
7342
+ ],
7343
+ computation: (_source, previous) => this.existingPage(previous?.value ?? 1) });
7344
+ /**
7345
+ * The items of the current page. A new sort refreshes them: the page can sort its list in place (same array),
7346
+ * which doesn't change the model.
7347
+ */
7348
+ filteredList = computed(() => {
7349
+ this.sort();
7350
+ const list = this.model();
7351
+ if (!list) {
7352
+ return [];
7341
7353
  }
7342
- this.buildFilteredList();
7343
- }
7354
+ if (this.fixedPageCount()) {
7355
+ return list;
7356
+ }
7357
+ const start = (this.currentPage() - 1) * this.itemsPerPage();
7358
+ return list.slice(start, start + this.itemsPerPage());
7359
+ }, ...(ngDevMode ? [{ debugName: "filteredList" }] : /* istanbul ignore next */ []));
7360
+ trackFoehnTableColumnConfiguration = (index, item) => item.id || item.columnLabelKey || index;
7344
7361
  previousPage() {
7345
- this.currentPage.set(this.currentPage() - 1);
7346
- this.buildFilteredList();
7362
+ this.currentPage.set(this.existingPage(this.currentPage() - 1));
7347
7363
  this.pageChange.emit({
7348
7364
  previousPage: this.currentPage() + 1,
7349
7365
  currentPage: this.currentPage(),
@@ -7354,8 +7370,7 @@ class FoehnTableComponent extends FoehnInputComponent {
7354
7370
  return this.currentPage() > 1;
7355
7371
  }
7356
7372
  nextPage() {
7357
- this.currentPage.set(this.currentPage() + 1);
7358
- this.buildFilteredList();
7373
+ this.currentPage.set(this.existingPage(this.currentPage() + 1));
7359
7374
  this.pageChange.emit({
7360
7375
  previousPage: this.currentPage() - 1,
7361
7376
  currentPage: this.currentPage(),
@@ -7370,8 +7385,7 @@ class FoehnTableComponent extends FoehnInputComponent {
7370
7385
  return;
7371
7386
  }
7372
7387
  const previousPage = this.currentPage();
7373
- this.currentPage.set(page);
7374
- this.buildFilteredList();
7388
+ this.currentPage.set(this.existingPage(page));
7375
7389
  if (emitPageChangeEvent) {
7376
7390
  this.pageChange.emit({
7377
7391
  previousPage,
@@ -7385,7 +7399,7 @@ class FoehnTableComponent extends FoehnInputComponent {
7385
7399
  if (fixedPageCount) {
7386
7400
  return fixedPageCount;
7387
7401
  }
7388
- const list = this._list();
7402
+ const list = this.model();
7389
7403
  return list ? Math.ceil(list.length / this.itemsPerPage()) : 0;
7390
7404
  }
7391
7405
  triggerSort(sortAttribute) {
@@ -7402,29 +7416,23 @@ class FoehnTableComponent extends FoehnInputComponent {
7402
7416
  manageRowClick(rowElem, item) {
7403
7417
  this.rowClick.emit({
7404
7418
  element: rowElem,
7405
- indexInArray: this._list()?.indexOf(item),
7419
+ indexInArray: this.model()?.indexOf(item),
7406
7420
  });
7407
7421
  }
7408
7422
  onSpaceKeydown(event, rowElem, item) {
7409
7423
  event.preventDefault();
7410
7424
  this.manageRowClick(rowElem, item);
7411
7425
  }
7412
- buildFilteredList() {
7413
- const list = this._list();
7414
- if (!list) {
7415
- this.filteredList.set([]);
7416
- return;
7417
- }
7418
- if (this.fixedPageCount()) {
7419
- this.filteredList.set(list);
7420
- return;
7421
- }
7422
- const currentPageExists = (this.currentPage() - 1) * this.itemsPerPage() <= list.length;
7423
- if (!currentPageExists) {
7424
- this.currentPage.set(1);
7426
+ /**
7427
+ * @param page a page of the list
7428
+ * @returns the page, or the first one when the list has no item for it
7429
+ */
7430
+ existingPage(page) {
7431
+ const list = this.model();
7432
+ if (!list || this.fixedPageCount()) {
7433
+ return page;
7425
7434
  }
7426
- const start = (this.currentPage() - 1) * this.itemsPerPage();
7427
- this.filteredList.set(list.slice(start, start + this.itemsPerPage()));
7435
+ return (page - 1) * this.itemsPerPage() <= list.length ? page : 1;
7428
7436
  }
7429
7437
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FoehnTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
7430
7438
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FoehnTableComponent, isStandalone: true, selector: "foehn-table", inputs: { columnsConfiguration: { classPropertyName: "columnsConfiguration", publicName: "columnsConfiguration", isSignal: true, isRequired: false, transformFunction: null }, itemsPerPage: { classPropertyName: "itemsPerPage", publicName: "itemsPerPage", isSignal: true, isRequired: false, transformFunction: null }, fixedPageCount: { classPropertyName: "fixedPageCount", publicName: "fixedPageCount", isSignal: true, isRequired: false, transformFunction: null }, sort: { classPropertyName: "sort", publicName: "sort", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, totalElements: { classPropertyName: "totalElements", publicName: "totalElements", isSignal: true, isRequired: false, transformFunction: null }, titleSrOnly: { classPropertyName: "titleSrOnly", publicName: "titleSrOnly", isSignal: true, isRequired: false, transformFunction: null }, previousLabel: { classPropertyName: "previousLabel", publicName: "previousLabel", isSignal: true, isRequired: false, transformFunction: null }, nextLabel: { classPropertyName: "nextLabel", publicName: "nextLabel", isSignal: true, isRequired: false, transformFunction: null }, tableClass: { classPropertyName: "tableClass", publicName: "tableClass", isSignal: true, isRequired: false, transformFunction: null }, trackByFn: { classPropertyName: "trackByFn", publicName: "trackByFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sort: "sortChange", pageChange: "pageChange", rowClick: "rowClick" }, providers: [
@@ -7432,7 +7440,7 @@ class FoehnTableComponent extends FoehnInputComponent {
7432
7440
  provide: FoehnInputComponent,
7433
7441
  useExisting: forwardRef(() => FoehnTableComponent),
7434
7442
  },
7435
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrors()\"\n [class.vd-form-group-danger]=\"hasErrors()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n @if (label() && type !== 'hidden') {\n <p\n [attr.id]=\"buildChildId('Label')\"\n [class.visually-hidden]=\"isLabelSrOnly()\"\n [class.vd-p]=\"!isLabelSrOnly()\"\n >\n <span [innerHTML]=\"label()\"></span>\n @if (!required() && !hideNotRequiredExtraLabel()) {\n <span aria-hidden=\"true\">\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n }\n </p>\n }\n\n <foehn-validation-alerts [component]=\"this\" />\n\n @if (helpText() && type !== 'hidden') {\n <small\n [attr.id]=\"buildChildId('Help')\"\n class=\"form-text text-secondary\"\n [innerHTML]=\"helpText()\"\n ></small>\n }\n\n <!-- Fake input with NgModel to be registered into Form controls -->\n <input type=\"hidden\" [name]=\"name() || label() || ''\" [ngModel]=\"model()\" />\n\n <!-- Templates must be stored inside component so that \"@ViewChildren subComponents\" can be filled up with FoehnInputComponent -->\n <ng-content />\n\n <div class=\"row\" [id]=\"buildId() || 'foehn-table'\">\n <div class=\"col-12\">\n @if (!!totalElements() && totalElements() === 1) {\n <h4>\n {{ 'foehn-table.totalElements.1' | fromDictionary }}\n </h4>\n }\n @if (!!totalElements() && totalElements() !== 1) {\n <h4>\n {{\n 'foehn-table.totalElements'\n | fromDictionary\n : { total: totalElements()?.toString() }\n }}\n </h4>\n }\n </div>\n\n <div class=\"col-12 table-responsive\">\n <table class=\"table table-hover {{ tableClass() }}\" #entryComponent>\n @if (title()?.length) {\n <caption [class.visually-hidden]=\"titleSrOnly()\">\n {{\n title()\n }}\n </caption>\n }\n <thead>\n <tr>\n @for (\n col of columnsConfiguration();\n track trackFoehnTableColumnConfiguration(\n $index,\n col\n )\n ) {\n <th\n class=\"vd-bg-pattern-bars-gray\"\n scope=\"col\"\n [id]=\"col.id\"\n >\n @if (\n !filteredList().length || !col.sortAttribute\n ) {\n <span\n [innerHTML]=\"\n col.columnLabelKey | fromDictionary\n \"\n ></span>\n }\n @if (\n !!filteredList().length &&\n !!col.sortAttribute\n ) {\n <a\n href=\"#\"\n class=\"vd-text-thin\"\n (click)=\"\n $event.preventDefault();\n triggerSort(col.sortAttribute)\n \"\n [title]=\"\n 'Trier par ' +\n (col.columnLabelKey\n | fromDictionary)\n \"\n >\n <span\n [innerHTML]=\"\n col.columnLabelKey\n | fromDictionary\n \"\n ></span>\n @if (\n sort()?.sortAttribute ===\n col.sortAttribute\n ) {\n @if (\n sort()?.sortDirection === 'ASC'\n ) {\n <span class=\"ms-3\">\n <foehn-icon-chevron-up />\n </span>\n }\n @if (\n sort()?.sortDirection === 'DESC'\n ) {\n <span class=\"ms-3\">\n <foehn-icon-chevron-down />\n </span>\n }\n }\n </a>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (\n item of filteredList();\n track trackByFn()(index, item);\n let index = $index\n ) {\n <tr\n #tableRowElement\n tabindex=\"0\"\n (click)=\"manageRowClick(tableRowElement, item)\"\n (keydown.enter)=\"\n manageRowClick(tableRowElement, item)\n \"\n (keydown.space)=\"\n onSpaceKeydown($event, tableRowElement, item)\n \"\n >\n @for (\n col of columnsConfiguration();\n track trackFoehnTableColumnConfiguration(\n $index,\n col\n )\n ) {\n <td [id]=\"col.id + '-' + index\">\n @if (!!col.isImportant) {\n @if (col.isImportant(item)) {\n <span\n class=\"cell-vertical-align-middle\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"30\"\n height=\"30\"\n fill=\"currentColor\"\n class=\"bi bi-exclamation text-danger\"\n viewBox=\"0 0 16 16\"\n >\n <path\n d=\"M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995z\"\n />\n </svg>\n </span>\n }\n }\n @if (!!col.iconGetter) {\n @if (col.iconGetter(item); as iconDef) {\n <span\n class=\"cell-vertical-align-middle me-2\"\n >\n <fa-icon\n aria-hidden=\"true\"\n [icon]=\"iconDef.icon\"\n [title]=\"iconDef.label\"\n />\n <span class=\"visually-hidden\">\n {{ iconDef.label }}\n </span>\n </span>\n }\n }\n @if (!!col.template) {\n <ng-template\n [ngTemplateOutlet]=\"col.template\"\n [ngTemplateOutletContext]=\"{\n item: item,\n index: index,\n }\"\n />\n }\n @if (!col.template && !!col.valueGetter) {\n <span\n [innerHTML]=\"col.valueGetter(item)\"\n class=\"cell-vertical-align-middle\"\n ></span>\n }\n </td>\n }\n </tr>\n }\n @if (!!columnsConfiguration() && !filteredList().length) {\n <tr>\n <td [colSpan]=\"columnsConfiguration()?.length\">\n <div class=\"w-100 text-center\">\n {{\n 'foehn-table.totalElements.0'\n | fromDictionary\n }}\n </div>\n </td>\n </tr>\n }\n </tbody>\n </table>\n\n @if (hasPreviousPage() || hasNextPage()) {\n <nav\n [id]=\"buildId('_navContainer')\"\n class=\"vd-pagination\"\n aria-label=\"Pagination\"\n >\n <ul class=\"vd-pagination__list\">\n @if (hasPreviousPage()) {\n <li\n class=\"vd-pagination__item vd-pagination__item--previous\"\n >\n <button\n [id]=\"buildId('_prevButton')\"\n type=\"button\"\n class=\"btn btn-link vd-pagination__link btn-no-extra vd-pagination__link-reset\"\n (click)=\"previousPage()\"\n >\n <span class=\"vd-pagination__title\">\n <foehn-icon-chevron-left />\n {{ previousLabel() }}\n </span>\n <span class=\"visually-hidden\">:</span>\n <span class=\"vd-pagination__label\">\n {{ currentPage() - 1 }} sur\n {{ pagesCount() }}\n </span>\n </button>\n </li>\n }\n @if (hasNextPage()) {\n <li\n class=\"vd-pagination__item vd-pagination__item--next\"\n >\n <button\n [id]=\"buildId('_nextButton')\"\n type=\"button\"\n class=\"btn btn-link vd-pagination__link btn-no-extra vd-pagination__link-reset\"\n (click)=\"nextPage()\"\n >\n <span class=\"vd-pagination__title\">\n {{ nextLabel() }}\n <foehn-icon-chevron-right />\n </span>\n <span class=\"visually-hidden\">:</span>\n <span class=\"vd-pagination__label\">\n {{ currentPage() + 1 }} sur\n {{ pagesCount() }}\n </span>\n </button>\n </li>\n }\n </ul>\n </nav>\n }\n </div>\n </div>\n</div>\n", styles: [".btn-no-extra{padding:0;border:none;font-weight:400;text-decoration-line:none}.vd-pagination{margin-bottom:1rem}.vd-pagination__link-reset{background:none;border:none;font-weight:inherit;text-decoration-line:none;text-align:inherit;cursor:pointer}.vd-pagination__link-reset:focus{background-color:var(--vd-focus)}:host ::ng-deep .btn.btn-link .svg-inline--fa{color:var(--vd-primary-dark)}:host ::ng-deep .btn.btn-link:hover .svg-inline--fa{color:var(--vd-neutral-dark)}.btn.btn-link{text-transform:none}.cell-vertical-align-middle{vertical-align:middle}\n"], dependencies: [{ kind: "component", type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FoehnIconChevronUpComponent, selector: "foehn-icon-chevron-up" }, { kind: "component", type: FoehnIconChevronDownComponent, selector: "foehn-icon-chevron-down" }, { kind: "component", type: FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FoehnIconChevronLeftComponent, selector: "foehn-icon-chevron-left" }, { kind: "component", type: FoehnIconChevronRightComponent, selector: "foehn-icon-chevron-right" }, { kind: "pipe", type: SdkDictionaryPipe, name: "fromDictionary" }] });
7443
+ ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrors()\"\n [class.vd-form-group-danger]=\"hasErrors()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n @if (label() && type !== 'hidden') {\n <p\n [attr.id]=\"buildChildId('Label')\"\n [class.visually-hidden]=\"isLabelSrOnly()\"\n [class.vd-p]=\"!isLabelSrOnly()\"\n >\n <span [innerHTML]=\"label()\"></span>\n @if (!required() && !hideNotRequiredExtraLabel()) {\n <span aria-hidden=\"true\">\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n }\n </p>\n }\n\n <foehn-validation-alerts [component]=\"this\" />\n\n @if (helpText() && type !== 'hidden') {\n <small\n [attr.id]=\"buildChildId('Help')\"\n class=\"form-text text-secondary\"\n [innerHTML]=\"helpText()\"\n ></small>\n }\n\n <!-- Fake input with NgModel to be registered into Form controls -->\n <input type=\"hidden\" [name]=\"name() || label() || ''\" [ngModel]=\"model()\" />\n\n <!-- Templates must be stored inside component so that \"@ViewChildren subComponents\" can be filled up with FoehnInputComponent -->\n <ng-content />\n\n <div class=\"row\" [id]=\"buildId() || 'foehn-table'\">\n <div class=\"col-12\">\n @if (!!totalElements() && totalElements() === 1) {\n <h4>\n {{ 'foehn-table.totalElements.1' | fromDictionary }}\n </h4>\n }\n @if (!!totalElements() && totalElements() !== 1) {\n <h4>\n {{\n 'foehn-table.totalElements'\n | fromDictionary\n : { total: totalElements()?.toString() }\n }}\n </h4>\n }\n </div>\n\n <div class=\"col-12 table-responsive\">\n <table class=\"table table-hover {{ tableClass() }}\" #entryComponent>\n @if (title()?.length) {\n <caption [class.visually-hidden]=\"titleSrOnly()\">\n {{\n title()\n }}\n </caption>\n }\n <thead>\n <tr>\n @for (\n col of columnsConfiguration();\n track trackFoehnTableColumnConfiguration(\n $index,\n col\n )\n ) {\n <th\n class=\"vd-bg-pattern-bars-gray\"\n scope=\"col\"\n [id]=\"col.id\"\n >\n @if (\n !filteredList().length || !col.sortAttribute\n ) {\n <span\n [innerHTML]=\"\n col.columnLabelKey | fromDictionary\n \"\n ></span>\n }\n @if (\n !!filteredList().length &&\n !!col.sortAttribute\n ) {\n <a\n href=\"#\"\n class=\"vd-text-thin\"\n (click)=\"\n $event.preventDefault();\n triggerSort(col.sortAttribute)\n \"\n [title]=\"\n 'Trier par ' +\n (col.columnLabelKey\n | fromDictionary)\n \"\n >\n <span\n [innerHTML]=\"\n col.columnLabelKey\n | fromDictionary\n \"\n ></span>\n @if (\n sort()?.sortAttribute ===\n col.sortAttribute\n ) {\n @if (\n sort()?.sortDirection === 'ASC'\n ) {\n <span class=\"ms-3\">\n <foehn-icon-chevron-up />\n </span>\n }\n @if (\n sort()?.sortDirection === 'DESC'\n ) {\n <span class=\"ms-3\">\n <foehn-icon-chevron-down />\n </span>\n }\n }\n </a>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (\n item of filteredList();\n track trackByFn()(index, item);\n let index = $index\n ) {\n <tr\n #tableRowElement\n tabindex=\"0\"\n (click)=\"manageRowClick(tableRowElement, item)\"\n (keydown.enter)=\"\n manageRowClick(tableRowElement, item)\n \"\n (keydown.space)=\"\n onSpaceKeydown($event, tableRowElement, item)\n \"\n >\n @for (\n col of columnsConfiguration();\n track trackFoehnTableColumnConfiguration(\n $index,\n col\n )\n ) {\n <td [id]=\"col.id + '-' + index\">\n @if (!!col.isImportant) {\n @if (col.isImportant(item)) {\n <span\n class=\"cell-vertical-align-middle\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"30\"\n height=\"30\"\n fill=\"currentColor\"\n class=\"bi bi-exclamation text-danger\"\n viewBox=\"0 0 16 16\"\n >\n <path\n d=\"M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995z\"\n />\n </svg>\n </span>\n }\n }\n @if (!!col.iconGetter) {\n @if (col.iconGetter(item); as iconDef) {\n <span\n class=\"cell-vertical-align-middle me-2\"\n >\n <fa-icon\n aria-hidden=\"true\"\n [icon]=\"iconDef.icon\"\n [title]=\"iconDef.label\"\n />\n <span class=\"visually-hidden\">\n {{ iconDef.label }}\n </span>\n </span>\n }\n }\n @if (!!col.template) {\n <ng-template\n [ngTemplateOutlet]=\"col.template\"\n [ngTemplateOutletContext]=\"{\n item: item,\n index: index,\n }\"\n />\n }\n @if (!col.template && !!col.valueGetter) {\n <span\n [innerHTML]=\"col.valueGetter(item)\"\n class=\"cell-vertical-align-middle\"\n ></span>\n }\n </td>\n }\n </tr>\n }\n @if (!!columnsConfiguration() && !filteredList().length) {\n <tr>\n <td [colSpan]=\"columnsConfiguration()?.length\">\n <div class=\"w-100 text-center\">\n {{\n 'foehn-table.totalElements.0'\n | fromDictionary\n }}\n </div>\n </td>\n </tr>\n }\n </tbody>\n </table>\n\n @if (hasPreviousPage() || hasNextPage()) {\n <nav\n [id]=\"buildId('_navContainer')\"\n class=\"vd-pagination\"\n aria-label=\"Pagination\"\n >\n <ul class=\"vd-pagination__list\">\n @if (hasPreviousPage()) {\n <li\n class=\"vd-pagination__item vd-pagination__item--previous\"\n >\n <button\n [id]=\"buildId('_prevButton')\"\n type=\"button\"\n class=\"btn btn-link vd-pagination__link btn-no-extra vd-pagination__link-reset\"\n (click)=\"previousPage()\"\n >\n <span class=\"vd-pagination__title\">\n <foehn-icon-chevron-left />\n {{ previousLabel() }}\n </span>\n <span class=\"visually-hidden\">:</span>\n <span class=\"vd-pagination__label\">\n {{ currentPage() - 1 }} sur\n {{ pagesCount() }}\n </span>\n </button>\n </li>\n }\n @if (hasNextPage()) {\n <li\n class=\"vd-pagination__item vd-pagination__item--next\"\n >\n <button\n [id]=\"buildId('_nextButton')\"\n type=\"button\"\n class=\"btn btn-link vd-pagination__link btn-no-extra vd-pagination__link-reset\"\n (click)=\"nextPage()\"\n >\n <span class=\"vd-pagination__title\">\n {{ nextLabel() }}\n <foehn-icon-chevron-right />\n </span>\n <span class=\"visually-hidden\">:</span>\n <span class=\"vd-pagination__label\">\n {{ currentPage() + 1 }} sur\n {{ pagesCount() }}\n </span>\n </button>\n </li>\n }\n </ul>\n </nav>\n }\n </div>\n </div>\n</div>\n", styles: [".btn-no-extra{padding:0;border:none;font-weight:400;text-decoration-line:none}.vd-pagination{margin-bottom:1rem}.vd-pagination__link-reset{background:none;border:none;font-weight:inherit;text-decoration-line:none;text-align:inherit;cursor:pointer}.vd-pagination__link-reset:focus{background-color:var(--vd-focus)}:host ::ng-deep .btn.btn-link .svg-inline--fa{color:var(--vd-primary-dark)}:host ::ng-deep .btn.btn-link:hover .svg-inline--fa{color:var(--vd-neutral-dark)}.btn.btn-link{text-transform:none}.cell-vertical-align-middle{vertical-align:middle}\n"], dependencies: [{ kind: "component", type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FoehnIconChevronUpComponent, selector: "foehn-icon-chevron-up" }, { kind: "component", type: FoehnIconChevronDownComponent, selector: "foehn-icon-chevron-down" }, { kind: "component", type: FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FoehnIconChevronLeftComponent, selector: "foehn-icon-chevron-left" }, { kind: "component", type: FoehnIconChevronRightComponent, selector: "foehn-icon-chevron-right" }, { kind: "pipe", type: SdkDictionaryPipe, name: "fromDictionary" }] });
7436
7444
  }
7437
7445
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FoehnTableComponent, decorators: [{
7438
7446
  type: Component,
@@ -9027,8 +9035,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
9027
9035
  class FoehnInputForeignLocalityComponent extends FoehnInputComponent {
9028
9036
  localityRequired = input(false, ...(ngDevMode ? [{ debugName: "localityRequired" }] : /* istanbul ignore next */ []));
9029
9037
  zipCodeRequired = input(false, ...(ngDevMode ? [{ debugName: "zipCodeRequired" }] : /* istanbul ignore next */ []));
9030
- zipCode = signal(null, ...(ngDevMode ? [{ debugName: "zipCode" }] : /* istanbul ignore next */ []));
9031
- longName = signal(null, ...(ngDevMode ? [{ debugName: "longName" }] : /* istanbul ignore next */ []));
9038
+ /** The zip code and the name of the model, changed by the sub components. */
9039
+ zipCode = linkedSignal(() => this.model()?.zipCode ?? null, ...(ngDevMode ? [{ debugName: "zipCode" }] : /* istanbul ignore next */ []));
9040
+ longName = linkedSignal(() => this.model()?.longName ?? null, ...(ngDevMode ? [{ debugName: "longName" }] : /* istanbul ignore next */ []));
9032
9041
  updateLocality() {
9033
9042
  const validValue = this.getValidValue();
9034
9043
  if (validValue !== undefined) {
@@ -9041,16 +9050,6 @@ class FoehnInputForeignLocalityComponent extends FoehnInputComponent {
9041
9050
  this.handleChange(validValue);
9042
9051
  }
9043
9052
  }
9044
- onModelChange(value) {
9045
- if (value) {
9046
- this.zipCode.set(value.zipCode ?? null);
9047
- this.longName.set(value.longName ?? null);
9048
- }
9049
- else {
9050
- this.zipCode.set(null);
9051
- this.longName.set(null);
9052
- }
9053
- }
9054
9053
  isRequired() {
9055
9054
  return Boolean(this.required() ||
9056
9055
  this.zipCodeRequired() ||
@@ -9088,7 +9087,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
9088
9087
  }], propDecorators: { localityRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "localityRequired", required: false }] }], zipCodeRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "zipCodeRequired", required: false }] }] } });
9089
9088
 
9090
9089
  class FoehnInputForeignStreetComponent extends FoehnInputComponent {
9091
- longName = signal(null, ...(ngDevMode ? [{ debugName: "longName" }] : /* istanbul ignore next */ []));
9090
+ /** The name of the model, changed by the sub component. */
9091
+ longName = linkedSignal(() => this.model()?.longName ?? null, ...(ngDevMode ? [{ debugName: "longName" }] : /* istanbul ignore next */ []));
9092
9092
  updateStreet() {
9093
9093
  const validValue = this.getValidValue();
9094
9094
  if (validValue !== undefined) {
@@ -9101,14 +9101,6 @@ class FoehnInputForeignStreetComponent extends FoehnInputComponent {
9101
9101
  this.handleChange(validValue);
9102
9102
  }
9103
9103
  }
9104
- onModelChange(value) {
9105
- if (value) {
9106
- this.longName.set(value.longName ?? null);
9107
- }
9108
- else {
9109
- this.longName.set(null);
9110
- }
9111
- }
9112
9104
  getValidValue() {
9113
9105
  if (this.isEmpty(this.longName())) {
9114
9106
  if (this.model_ !== undefined) {
@@ -9194,9 +9186,17 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9194
9186
  addressInjector = inject(Injector);
9195
9187
  isSanitizationScheduled = false;
9196
9188
  isDefaultCountryScheduled = false;
9197
- iso2IdSubject = new BehaviorSubject(null);
9198
- zipCodeIdSubject = new BehaviorSubject(null);
9199
- estrIdSubject = new BehaviorSubject(null);
9189
+ /**
9190
+ * The URL of the Swiss localities. They are requested once the Swiss fields are displayed (`isSwiss()`), and again
9191
+ * only when this URL changes.
9192
+ */
9193
+ localitiesUrl = computed(() => {
9194
+ const specifiedCanton = this.specifiedCanton();
9195
+ const queryParams = this.withCompanyLocalities()
9196
+ ? '?withCompanyLocalities=true'
9197
+ : '';
9198
+ return `${this.swissNpaLocalityBaseUrl()}/${specifiedCanton?.length ? specifiedCanton : 'all'}${queryParams}`;
9199
+ }, ...(ngDevMode ? [{ debugName: "localitiesUrl" }] : /* istanbul ignore next */ []));
9200
9200
  countryModelChangeSubject = new BehaviorSubject(null);
9201
9201
  isOnlySwissChangeSubject = new BehaviorSubject(true);
9202
9202
  constructor() {
@@ -9230,24 +9230,27 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9230
9230
  .pipe(switchMap(() => this.dictionaryService.getKey('errors.NotNull')), takeUntilDestroyed(this._destroyRef))
9231
9231
  .subscribe((notNullErrorLabel) => this.replaceAtLeastOneNotNull(notNullErrorLabel));
9232
9232
  this.countries = this.getCountries();
9233
- this.localities = this.iso2IdSubject.pipe(distinctUntilChanged(),
9234
- // The list of localities, or an empty array as the default value.
9235
- switchMap((iso2Id) => this.getLocalities(iso2Id)), shareReplay(1));
9233
+ // The streets follow the locality and the street numbers the street, whether they come from the model given by
9234
+ // the page or from the choices of the user.
9235
+ const injector = this.addressInjector;
9236
+ this.localities = toObservable(this.localitiesUrl, { injector }).pipe(distinctUntilChanged(), switchMap((url) => this.getLocalities(url)),
9237
+ // An empty list until the first response: the autocompletes stay enabled meanwhile
9238
+ startWith$1([]), shareReplay(1));
9236
9239
  this.streets = combineLatest([
9237
- this.zipCodeIdSubject,
9240
+ toObservable(this.locality, { injector }),
9238
9241
  this.localities,
9239
9242
  ]).pipe(
9240
- // The zipCodeId when locality changes or match locality (postalLocalityHistoryId) from model
9241
- map(([zipCodeId, localities]) => zipCodeId ||
9242
- this.extractLocalityZipCodeId(localities, this.locality())), distinctUntilChanged(),
9243
+ // The zipCodeId of the locality, or the one of the locality matched in the list (postalLocalityHistoryId)
9244
+ map(([locality, localities]) => locality?.zipCodeId ||
9245
+ this.extractLocalityZipCodeId(localities, locality)), distinctUntilChanged(),
9243
9246
  // The list of streets or a default value to an empty array
9244
- switchMap((zipCodeId) => this.getStreetsFor(zipCodeId)), shareReplay(1));
9247
+ switchMap((zipCodeId) => this.getStreetsFor(zipCodeId)), startWith$1([]), shareReplay(1));
9245
9248
  this.streetNumbers = combineLatest([
9246
- this.estrIdSubject,
9249
+ toObservable(this.street, { injector }),
9247
9250
  this.streets,
9248
9251
  ]).pipe(
9249
- // The estrid when street changes or match street (longName) from model
9250
- map(([estrid, streets]) => estrid || this.extractStreetEstrid(streets, this.street())), distinctUntilChanged(),
9252
+ // The estrid of the street, or the one of the street matched in the list (longName)
9253
+ map(([street, streets]) => street?.estrid || this.extractStreetEstrid(streets, street)), distinctUntilChanged(),
9251
9254
  // The list of streets or a default value to an empty array
9252
9255
  switchMap((estrid) => this.getStreetNumberFor(estrid)),
9253
9256
  // Some street might not have an name, RefInf sometimes returns weird data.
@@ -9257,7 +9260,7 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9257
9260
  sensitivity: 'base',
9258
9261
  });
9259
9262
  return values.sort((a, b) => collator.compare(a.name ?? '', b.name ?? ''));
9260
- }), shareReplay(1));
9263
+ }), startWith$1([]), shareReplay(1));
9261
9264
  }
9262
9265
  ngOnChanges(changes) {
9263
9266
  const modelChange = changes.model;
@@ -9281,25 +9284,10 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9281
9284
  this.handleChange(validValue);
9282
9285
  }
9283
9286
  }
9284
- onModelChange(value) {
9285
- // The fields (country, locality...) are linked signals of the model
9286
- // Need to manually load localities because country "modelChange" event does not fire anymore because a signal
9287
- // only fires when value has changed
9288
- if (value &&
9289
- !this.isOnlySwiss() &&
9290
- value.country?.iso2Id === SWISS_ISO_ID) {
9291
- this.iso2IdSubject.next(SWISS_ISO_ID);
9292
- }
9293
- }
9294
9287
  isSwiss() {
9295
9288
  return this.isOnlySwiss() || this.country()?.iso2Id === SWISS_ISO_ID;
9296
9289
  }
9297
- userInputCountry(country) {
9298
- if (!country) {
9299
- this.iso2IdSubject.next(null);
9300
- }
9301
- this.zipCodeIdSubject.next(null);
9302
- this.estrIdSubject.next(null);
9290
+ userInputCountry() {
9303
9291
  this.locality.set(null);
9304
9292
  this.street.set(null);
9305
9293
  this.houseNumber.set(null);
@@ -9309,21 +9297,13 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9309
9297
  this.updateAddress();
9310
9298
  this.handleUserInput();
9311
9299
  }
9312
- userInputLocality(locality) {
9313
- if (!locality) {
9314
- this.zipCodeIdSubject.next(null);
9315
- }
9316
- // Always reset suggestion list of houseNumber when locality changes
9317
- this.estrIdSubject.next(null);
9300
+ userInputLocality() {
9318
9301
  this.street.set(null);
9319
9302
  this.houseNumber.set(null);
9320
9303
  this.updateAddress();
9321
9304
  this.handleUserInput();
9322
9305
  }
9323
- userInputStreet(street) {
9324
- if (!street) {
9325
- this.estrIdSubject.next(null);
9326
- }
9306
+ userInputStreet() {
9327
9307
  this.houseNumber.set(null);
9328
9308
  this.updateAddress();
9329
9309
  this.handleUserInput();
@@ -9332,14 +9312,6 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9332
9312
  // No double-binding on country in view to ensure we update properly model
9333
9313
  this.country.set(country);
9334
9314
  this.updateAddress();
9335
- if (!country) {
9336
- this.iso2IdSubject.next(null);
9337
- this.zipCodeIdSubject.next(null);
9338
- this.estrIdSubject.next(null);
9339
- return;
9340
- }
9341
- const { iso2Id } = country;
9342
- this.iso2IdSubject.next(iso2Id ?? null);
9343
9315
  }
9344
9316
  getLocalityDisplayedName(locality) {
9345
9317
  if (!locality) {
@@ -9351,24 +9323,11 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9351
9323
  // No double-binding on locality in view to ensure we update properly model
9352
9324
  this.locality.set(locality);
9353
9325
  this.updateAddress();
9354
- if (!locality) {
9355
- this.zipCodeIdSubject.next(null);
9356
- this.estrIdSubject.next(null);
9357
- return;
9358
- }
9359
- const { zipCodeId } = locality;
9360
- this.zipCodeIdSubject.next(zipCodeId ?? null);
9361
9326
  }
9362
9327
  streetUpdated(street) {
9363
9328
  // No double-binding on street in view to ensure we update properly model
9364
9329
  this.street.set(street);
9365
9330
  this.updateAddress();
9366
- if (!street) {
9367
- this.estrIdSubject.next(null);
9368
- return;
9369
- }
9370
- const { estrid } = street;
9371
- this.estrIdSubject.next(estrid ?? null);
9372
9331
  }
9373
9332
  isStreetRequired() {
9374
9333
  const streetRequired = this.streetRequired();
@@ -9460,24 +9419,8 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9460
9419
  getCountries() {
9461
9420
  return this.httpClient.get(this.countriesUrl()).pipe(catchError(() => of([])));
9462
9421
  }
9463
- getLocalities(iso2Id) {
9464
- if (iso2Id !== SWISS_ISO_ID) {
9465
- return of([]);
9466
- }
9467
- const queryParams = this.withCompanyLocalities()
9468
- ? '?withCompanyLocalities=true'
9469
- : '';
9470
- const specifiedCanton = this.specifiedCanton();
9471
- if (specifiedCanton?.length) {
9472
- return this.httpClient
9473
- .get(`${this.swissNpaLocalityBaseUrl()}/${specifiedCanton}${queryParams}`)
9474
- .pipe(catchError(() => of([])));
9475
- }
9476
- else {
9477
- return this.httpClient
9478
- .get(`${this.swissNpaLocalityBaseUrl()}/all${queryParams}`)
9479
- .pipe(catchError(() => of([])));
9480
- }
9422
+ getLocalities(url) {
9423
+ return this.httpClient.get(url).pipe(catchError(() => of([])));
9481
9424
  }
9482
9425
  getStreetNumberFor(estrid) {
9483
9426
  if (!estrid) {
@@ -9517,13 +9460,11 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9517
9460
  if (this.withDefaultCountry() &&
9518
9461
  (this.isOnlySwiss() || !this.country()?.iso2Id)) {
9519
9462
  this.country.set(this.getSwissCountry());
9520
- this.iso2IdSubject.next(SWISS_ISO_ID);
9521
9463
  this.updateAddress();
9522
9464
  }
9523
9465
  else if (!this.withDefaultCountry() && this.isOnlySwiss()) {
9524
9466
  console.error(`Wrong 'foehn-input-address' component configuration. You cannot set withDefaultCountry to false and isOnlySwiss to true. Setting country to Switzerland.`);
9525
9467
  this.country.set(this.getSwissCountry());
9526
- this.iso2IdSubject.next(SWISS_ISO_ID);
9527
9468
  this.updateAddress();
9528
9469
  }
9529
9470
  }
@@ -9650,7 +9591,7 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
9650
9591
  provide: FoehnInputComponent,
9651
9592
  useExisting: forwardRef(() => FoehnInputAddressComponent),
9652
9593
  },
9653
- ], viewQueries: [{ propertyName: "foreignLocalityComponent", first: true, predicate: FoehnInputForeignLocalityComponent, descendants: true, isSignal: true }, { propertyName: "foreignStreetComponent", first: true, predicate: FoehnInputForeignStreetComponent, descendants: true, isSignal: true }, { propertyName: "foreignHouseNumber", first: true, predicate: ["foreignHouseNumber"], descendants: true, isSignal: true }, { propertyName: "countryAutocomplete", first: true, predicate: ["countryAutocomplete"], descendants: true, isSignal: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\n [attr.id]=\"buildId() + 'Container'\"\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [tabIndex]=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n @if (!!label()) {\n <legend\n [class.visually-hidden]=\"isLabelSrOnly()\"\n [class.vd-p]=\"!isLabelSrOnly()\"\n >\n <span [innerHTML]=\"label()\"></span>\n @if (!required() && !hideNotRequiredExtraLabel()) {\n <span aria-hidden=\"true\">\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n }\n </legend>\n }\n\n <foehn-validation-alerts [component]=\"this\" />\n\n @if (helpText()) {\n <small\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText()\"\n ></small>\n }\n\n <ng-content />\n\n @if (!isOnlySwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.country.label' | fromDictionary\"\n [elements]=\"countries | async\"\n elementLabel=\"shortNameFr\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"countryIdentity\"\n (modelChange)=\"countryUpdated($event)\"\n (userInput)=\"userInputCountry($event)\"\n [model]=\"country()\"\n [name]=\"name() + '.country'\"\n [required]=\"countryRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n #countryAutocomplete\n />\n }\n\n @if (isSwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [elements]=\"localities | async\"\n [elementLabel]=\"getLocalityDisplayedName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"localityIdentity\"\n (modelChange)=\"localityUpdated($event)\"\n (userInput)=\"userInputLocality($event)\"\n [model]=\"locality()\"\n [name]=\"name() + '.locality'\"\n [allowCustomValue]=\"disabled()\"\n [required]=\"swissNpaLocalityRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [elements]=\"streets | async\"\n elementLabel=\"longName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"streetIdentity\"\n (modelChange)=\"streetUpdated($event)\"\n [model]=\"street()\"\n [name]=\"name() + '.street'\"\n [allowCustomValue]=\"streetAllowCustomValue()\"\n [customValueModelGenerator]=\"streetGenerator\"\n [required]=\"isStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n (userInput)=\"userInputStreet($event)\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [elements]=\"streetNumbers | async\"\n elementLabel=\"name\"\n elementValue=\"name\"\n [(model)]=\"houseNumber\"\n [name]=\"name() + '.houseNumber'\"\n [allowCustomValue]=\"true\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"streetNumberRequired()\"\n [hideNotRequiredExtraLabel]=\"\n hideNotRequiredExtraLabelStreetNumber()\n \"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (!isSwiss()) {\n <!--\n Component <foehn-input-foreign-locality> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'locality' when NULL or on 'zipCode' and 'longName' model inside component when EMPTY\n - Hide label from component because we need label from children to be displayed (isLabelSrOnly: true)\n - required and disabled params are transmitted to children\n -->\n <foehn-input-foreign-locality\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [name]=\"name() + '.locality'\"\n [(model)]=\"locality\"\n [zipCodeRequired]=\"foreignZipCodeRequired()\"\n [localityRequired]=\"foreignLocalityRequired()\"\n [isLabelSrOnly]=\"true\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n <!--\n Component <foehn-input-foreign-street> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'street' when NULL or on 'longName' model inside component when EMPTY\n - required, helpText, isLabelSrOnly and disabled params are transmitted to children\n -->\n <foehn-input-foreign-street\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [name]=\"name() + '.street'\"\n [(model)]=\"street\"\n [required]=\"isForeignStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-input-text\n #foreignHouseNumber\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [name]=\"name() + '.houseNumber'\"\n [(model)]=\"houseNumber\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"foreignStreetNumberRequired()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showPostOfficeBoxText()) {\n <foehn-input-text\n [(model)]=\"postOfficeBoxText\"\n [helpText]=\"\n 'foehn-input-address.postOfficeBoxText.help-text'\n | fromDictionary\n \"\n [label]=\"\n 'foehn-input-address.postOfficeBoxText.label'\n | fromDictionary\n \"\n [name]=\"name() + '.postOfficeBoxText'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"isPostOfficeBoxTextRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine1()) {\n <foehn-input-text\n [(model)]=\"addressLine1\"\n [label]=\"\n 'foehn-input-address.addressLine1.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine1'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine1Required()\"\n [autocomplete]=\"'address-line2'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine2()) {\n <foehn-input-text\n [(model)]=\"addressLine2\"\n [label]=\"\n 'foehn-input-address.addressLine2.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine2'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine2Required()\"\n [autocomplete]=\"'address-line3'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n </fieldset>\n</div>\n", dependencies: [{ kind: "component", type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { kind: "component", type: FoehnAutocompleteComponent, selector: "foehn-autocomplete", inputs: ["searchValueMinCharsCount", "allowCustomValue", "isSuggestionListDynamic", "customValueModelGenerator", "itemHeightInSuggestionListInPx", "elementSuggestionLabel", "caseSensitiveSearch"], outputs: ["userSearchInput"] }, { kind: "component", type: FoehnInputForeignLocalityComponent, selector: "foehn-input-foreign-locality", inputs: ["localityRequired", "zipCodeRequired"] }, { kind: "component", type: FoehnInputForeignStreetComponent, selector: "foehn-input-foreign-street" }, { kind: "component", type: FoehnInputTextComponent, selector: "foehn-input-text", inputs: ["numberOnly"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: SdkDictionaryPipe, name: "fromDictionary" }] });
9594
+ ], viewQueries: [{ propertyName: "foreignLocalityComponent", first: true, predicate: FoehnInputForeignLocalityComponent, descendants: true, isSignal: true }, { propertyName: "foreignStreetComponent", first: true, predicate: FoehnInputForeignStreetComponent, descendants: true, isSignal: true }, { propertyName: "foreignHouseNumber", first: true, predicate: ["foreignHouseNumber"], descendants: true, isSignal: true }, { propertyName: "countryAutocomplete", first: true, predicate: ["countryAutocomplete"], descendants: true, isSignal: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\n [attr.id]=\"buildId() + 'Container'\"\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [tabIndex]=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n @if (!!label()) {\n <legend\n [class.visually-hidden]=\"isLabelSrOnly()\"\n [class.vd-p]=\"!isLabelSrOnly()\"\n >\n <span [innerHTML]=\"label()\"></span>\n @if (!required() && !hideNotRequiredExtraLabel()) {\n <span aria-hidden=\"true\">\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n }\n </legend>\n }\n\n <foehn-validation-alerts [component]=\"this\" />\n\n @if (helpText()) {\n <small\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText()\"\n ></small>\n }\n\n <ng-content />\n\n @if (!isOnlySwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.country.label' | fromDictionary\"\n [elements]=\"countries | async\"\n elementLabel=\"shortNameFr\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"countryIdentity\"\n (modelChange)=\"countryUpdated($event)\"\n (userInput)=\"userInputCountry()\"\n [model]=\"country()\"\n [name]=\"name() + '.country'\"\n [required]=\"countryRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n #countryAutocomplete\n />\n }\n\n @if (isSwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [elements]=\"localities | async\"\n [elementLabel]=\"getLocalityDisplayedName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"localityIdentity\"\n (modelChange)=\"localityUpdated($event)\"\n (userInput)=\"userInputLocality()\"\n [model]=\"locality()\"\n [name]=\"name() + '.locality'\"\n [allowCustomValue]=\"disabled()\"\n [required]=\"swissNpaLocalityRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [elements]=\"streets | async\"\n elementLabel=\"longName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"streetIdentity\"\n (modelChange)=\"streetUpdated($event)\"\n [model]=\"street()\"\n [name]=\"name() + '.street'\"\n [allowCustomValue]=\"streetAllowCustomValue()\"\n [customValueModelGenerator]=\"streetGenerator\"\n [required]=\"isStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n (userInput)=\"userInputStreet()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [elements]=\"streetNumbers | async\"\n elementLabel=\"name\"\n elementValue=\"name\"\n [(model)]=\"houseNumber\"\n [name]=\"name() + '.houseNumber'\"\n [allowCustomValue]=\"true\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"streetNumberRequired()\"\n [hideNotRequiredExtraLabel]=\"\n hideNotRequiredExtraLabelStreetNumber()\n \"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (!isSwiss()) {\n <!--\n Component <foehn-input-foreign-locality> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'locality' when NULL or on 'zipCode' and 'longName' model inside component when EMPTY\n - Hide label from component because we need label from children to be displayed (isLabelSrOnly: true)\n - required and disabled params are transmitted to children\n -->\n <foehn-input-foreign-locality\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [name]=\"name() + '.locality'\"\n [(model)]=\"locality\"\n [zipCodeRequired]=\"foreignZipCodeRequired()\"\n [localityRequired]=\"foreignLocalityRequired()\"\n [isLabelSrOnly]=\"true\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n <!--\n Component <foehn-input-foreign-street> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'street' when NULL or on 'longName' model inside component when EMPTY\n - required, helpText, isLabelSrOnly and disabled params are transmitted to children\n -->\n <foehn-input-foreign-street\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [name]=\"name() + '.street'\"\n [(model)]=\"street\"\n [required]=\"isForeignStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-input-text\n #foreignHouseNumber\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [name]=\"name() + '.houseNumber'\"\n [(model)]=\"houseNumber\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"foreignStreetNumberRequired()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showPostOfficeBoxText()) {\n <foehn-input-text\n [(model)]=\"postOfficeBoxText\"\n [helpText]=\"\n 'foehn-input-address.postOfficeBoxText.help-text'\n | fromDictionary\n \"\n [label]=\"\n 'foehn-input-address.postOfficeBoxText.label'\n | fromDictionary\n \"\n [name]=\"name() + '.postOfficeBoxText'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"isPostOfficeBoxTextRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine1()) {\n <foehn-input-text\n [(model)]=\"addressLine1\"\n [label]=\"\n 'foehn-input-address.addressLine1.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine1'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine1Required()\"\n [autocomplete]=\"'address-line2'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine2()) {\n <foehn-input-text\n [(model)]=\"addressLine2\"\n [label]=\"\n 'foehn-input-address.addressLine2.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine2'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine2Required()\"\n [autocomplete]=\"'address-line3'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n </fieldset>\n</div>\n", dependencies: [{ kind: "component", type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { kind: "component", type: FoehnAutocompleteComponent, selector: "foehn-autocomplete", inputs: ["searchValueMinCharsCount", "allowCustomValue", "isSuggestionListDynamic", "customValueModelGenerator", "itemHeightInSuggestionListInPx", "elementSuggestionLabel", "caseSensitiveSearch"], outputs: ["userSearchInput"] }, { kind: "component", type: FoehnInputForeignLocalityComponent, selector: "foehn-input-foreign-locality", inputs: ["localityRequired", "zipCodeRequired"] }, { kind: "component", type: FoehnInputForeignStreetComponent, selector: "foehn-input-foreign-street" }, { kind: "component", type: FoehnInputTextComponent, selector: "foehn-input-text", inputs: ["numberOnly"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: SdkDictionaryPipe, name: "fromDictionary" }] });
9654
9595
  }
9655
9596
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FoehnInputAddressComponent, decorators: [{
9656
9597
  type: Component,
@@ -9667,7 +9608,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
9667
9608
  FoehnInputTextComponent,
9668
9609
  AsyncPipe,
9669
9610
  SdkDictionaryPipe,
9670
- ], template: "<div\n [attr.id]=\"buildId() + 'Container'\"\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [tabIndex]=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n @if (!!label()) {\n <legend\n [class.visually-hidden]=\"isLabelSrOnly()\"\n [class.vd-p]=\"!isLabelSrOnly()\"\n >\n <span [innerHTML]=\"label()\"></span>\n @if (!required() && !hideNotRequiredExtraLabel()) {\n <span aria-hidden=\"true\">\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n }\n </legend>\n }\n\n <foehn-validation-alerts [component]=\"this\" />\n\n @if (helpText()) {\n <small\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText()\"\n ></small>\n }\n\n <ng-content />\n\n @if (!isOnlySwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.country.label' | fromDictionary\"\n [elements]=\"countries | async\"\n elementLabel=\"shortNameFr\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"countryIdentity\"\n (modelChange)=\"countryUpdated($event)\"\n (userInput)=\"userInputCountry($event)\"\n [model]=\"country()\"\n [name]=\"name() + '.country'\"\n [required]=\"countryRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n #countryAutocomplete\n />\n }\n\n @if (isSwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [elements]=\"localities | async\"\n [elementLabel]=\"getLocalityDisplayedName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"localityIdentity\"\n (modelChange)=\"localityUpdated($event)\"\n (userInput)=\"userInputLocality($event)\"\n [model]=\"locality()\"\n [name]=\"name() + '.locality'\"\n [allowCustomValue]=\"disabled()\"\n [required]=\"swissNpaLocalityRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [elements]=\"streets | async\"\n elementLabel=\"longName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"streetIdentity\"\n (modelChange)=\"streetUpdated($event)\"\n [model]=\"street()\"\n [name]=\"name() + '.street'\"\n [allowCustomValue]=\"streetAllowCustomValue()\"\n [customValueModelGenerator]=\"streetGenerator\"\n [required]=\"isStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n (userInput)=\"userInputStreet($event)\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [elements]=\"streetNumbers | async\"\n elementLabel=\"name\"\n elementValue=\"name\"\n [(model)]=\"houseNumber\"\n [name]=\"name() + '.houseNumber'\"\n [allowCustomValue]=\"true\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"streetNumberRequired()\"\n [hideNotRequiredExtraLabel]=\"\n hideNotRequiredExtraLabelStreetNumber()\n \"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (!isSwiss()) {\n <!--\n Component <foehn-input-foreign-locality> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'locality' when NULL or on 'zipCode' and 'longName' model inside component when EMPTY\n - Hide label from component because we need label from children to be displayed (isLabelSrOnly: true)\n - required and disabled params are transmitted to children\n -->\n <foehn-input-foreign-locality\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [name]=\"name() + '.locality'\"\n [(model)]=\"locality\"\n [zipCodeRequired]=\"foreignZipCodeRequired()\"\n [localityRequired]=\"foreignLocalityRequired()\"\n [isLabelSrOnly]=\"true\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n <!--\n Component <foehn-input-foreign-street> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'street' when NULL or on 'longName' model inside component when EMPTY\n - required, helpText, isLabelSrOnly and disabled params are transmitted to children\n -->\n <foehn-input-foreign-street\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [name]=\"name() + '.street'\"\n [(model)]=\"street\"\n [required]=\"isForeignStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-input-text\n #foreignHouseNumber\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [name]=\"name() + '.houseNumber'\"\n [(model)]=\"houseNumber\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"foreignStreetNumberRequired()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showPostOfficeBoxText()) {\n <foehn-input-text\n [(model)]=\"postOfficeBoxText\"\n [helpText]=\"\n 'foehn-input-address.postOfficeBoxText.help-text'\n | fromDictionary\n \"\n [label]=\"\n 'foehn-input-address.postOfficeBoxText.label'\n | fromDictionary\n \"\n [name]=\"name() + '.postOfficeBoxText'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"isPostOfficeBoxTextRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine1()) {\n <foehn-input-text\n [(model)]=\"addressLine1\"\n [label]=\"\n 'foehn-input-address.addressLine1.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine1'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine1Required()\"\n [autocomplete]=\"'address-line2'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine2()) {\n <foehn-input-text\n [(model)]=\"addressLine2\"\n [label]=\"\n 'foehn-input-address.addressLine2.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine2'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine2Required()\"\n [autocomplete]=\"'address-line3'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n </fieldset>\n</div>\n" }]
9611
+ ], template: "<div\n [attr.id]=\"buildId() + 'Container'\"\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [tabIndex]=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n @if (!!label()) {\n <legend\n [class.visually-hidden]=\"isLabelSrOnly()\"\n [class.vd-p]=\"!isLabelSrOnly()\"\n >\n <span [innerHTML]=\"label()\"></span>\n @if (!required() && !hideNotRequiredExtraLabel()) {\n <span aria-hidden=\"true\">\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n }\n </legend>\n }\n\n <foehn-validation-alerts [component]=\"this\" />\n\n @if (helpText()) {\n <small\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText()\"\n ></small>\n }\n\n <ng-content />\n\n @if (!isOnlySwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.country.label' | fromDictionary\"\n [elements]=\"countries | async\"\n elementLabel=\"shortNameFr\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"countryIdentity\"\n (modelChange)=\"countryUpdated($event)\"\n (userInput)=\"userInputCountry()\"\n [model]=\"country()\"\n [name]=\"name() + '.country'\"\n [required]=\"countryRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n #countryAutocomplete\n />\n }\n\n @if (isSwiss()) {\n <foehn-autocomplete\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [elements]=\"localities | async\"\n [elementLabel]=\"getLocalityDisplayedName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"localityIdentity\"\n (modelChange)=\"localityUpdated($event)\"\n (userInput)=\"userInputLocality()\"\n [model]=\"locality()\"\n [name]=\"name() + '.locality'\"\n [allowCustomValue]=\"disabled()\"\n [required]=\"swissNpaLocalityRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [elements]=\"streets | async\"\n elementLabel=\"longName\"\n [elementValue]=\"identity\"\n [elementValueIdentity]=\"streetIdentity\"\n (modelChange)=\"streetUpdated($event)\"\n [model]=\"street()\"\n [name]=\"name() + '.street'\"\n [allowCustomValue]=\"streetAllowCustomValue()\"\n [customValueModelGenerator]=\"streetGenerator\"\n [required]=\"isStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n (userInput)=\"userInputStreet()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-autocomplete\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [elements]=\"streetNumbers | async\"\n elementLabel=\"name\"\n elementValue=\"name\"\n [(model)]=\"houseNumber\"\n [name]=\"name() + '.houseNumber'\"\n [allowCustomValue]=\"true\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"streetNumberRequired()\"\n [hideNotRequiredExtraLabel]=\"\n hideNotRequiredExtraLabelStreetNumber()\n \"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (!isSwiss()) {\n <!--\n Component <foehn-input-foreign-locality> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'locality' when NULL or on 'zipCode' and 'longName' model inside component when EMPTY\n - Hide label from component because we need label from children to be displayed (isLabelSrOnly: true)\n - required and disabled params are transmitted to children\n -->\n <foehn-input-foreign-locality\n [label]=\"'foehn-input-address.locality.label' | fromDictionary\"\n [name]=\"name() + '.locality'\"\n [(model)]=\"locality\"\n [zipCodeRequired]=\"foreignZipCodeRequired()\"\n [localityRequired]=\"foreignLocalityRequired()\"\n [isLabelSrOnly]=\"true\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n <!--\n Component <foehn-input-foreign-street> is special because we use the same model when swiss or foreigner.\n To do so, we need:\n - Errors will be bind on 'street' when NULL or on 'longName' model inside component when EMPTY\n - required, helpText, isLabelSrOnly and disabled params are transmitted to children\n -->\n <foehn-input-foreign-street\n [label]=\"'foehn-input-address.street.label' | fromDictionary\"\n [name]=\"name() + '.street'\"\n [(model)]=\"street\"\n [required]=\"isForeignStreetRequired()\"\n [helpText]=\"\n 'foehn-input-address.street.help-text' | fromDictionary\n \"\n [customErrors]=\"streetCustomErrors()\"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n\n <foehn-input-text\n #foreignHouseNumber\n [label]=\"\n 'foehn-input-address.houseNumber.label' | fromDictionary\n \"\n [name]=\"name() + '.houseNumber'\"\n [(model)]=\"houseNumber\"\n [helpText]=\"\n 'foehn-input-address.houseNumber.help-text' | fromDictionary\n \"\n [disabled]=\"!country() || disabled()\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"foreignStreetNumberRequired()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showPostOfficeBoxText()) {\n <foehn-input-text\n [(model)]=\"postOfficeBoxText\"\n [helpText]=\"\n 'foehn-input-address.postOfficeBoxText.help-text'\n | fromDictionary\n \"\n [label]=\"\n 'foehn-input-address.postOfficeBoxText.label'\n | fromDictionary\n \"\n [name]=\"name() + '.postOfficeBoxText'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"isPostOfficeBoxTextRequired()\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine1()) {\n <foehn-input-text\n [(model)]=\"addressLine1\"\n [label]=\"\n 'foehn-input-address.addressLine1.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine1'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine1Required()\"\n [autocomplete]=\"'address-line2'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n\n @if (showAdressLines() && showAdressLine2()) {\n <foehn-input-text\n [(model)]=\"addressLine2\"\n [label]=\"\n 'foehn-input-address.addressLine2.label' | fromDictionary\n \"\n [name]=\"name() + '.addressLine2'\"\n (modelChange)=\"updateAddress()\"\n (userInput)=\"handleUserInput()\"\n [required]=\"addressLine2Required()\"\n [autocomplete]=\"'address-line3'\"\n [disabled]=\"disabled()\"\n [showErrorWhenDisabled]=\"showErrorWhenDisabled()\"\n [updateModelWhenDisabled]=\"updateModelWhenDisabled()\"\n />\n }\n </fieldset>\n</div>\n" }]
9671
9612
  }], ctorParameters: () => [], propDecorators: { isOnlySwiss: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOnlySwiss", required: false }] }], showPostOfficeBoxText: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPostOfficeBoxText", required: false }] }], showAdressLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAdressLines", required: false }] }], showAdressLine1: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAdressLine1", required: false }] }], showAdressLine2: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAdressLine2", required: false }] }], countryRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "countryRequired", required: false }] }], swissNpaLocalityRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissNpaLocalityRequired", required: false }] }], swissNpaLocalityBaseUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissNpaLocalityBaseUrl", required: false }] }], streetRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "streetRequired", required: false }] }], streetAllowCustomValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "streetAllowCustomValue", required: false }] }], streetNumberRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "streetNumberRequired", required: false }] }], hideNotRequiredExtraLabelStreetNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideNotRequiredExtraLabelStreetNumber", required: false }] }], foreignZipCodeRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "foreignZipCodeRequired", required: false }] }], foreignLocalityRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "foreignLocalityRequired", required: false }] }], foreignStreetRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "foreignStreetRequired", required: false }] }], foreignStreetNumberRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "foreignStreetNumberRequired", required: false }] }], postOfficeBoxTextRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "postOfficeBoxTextRequired", required: false }] }], addressLine1Required: [{ type: i0.Input, args: [{ isSignal: true, alias: "addressLine1Required", required: false }] }], addressLine2Required: [{ type: i0.Input, args: [{ isSignal: true, alias: "addressLine2Required", required: false }] }], withCompanyLocalities: [{ type: i0.Input, args: [{ isSignal: true, alias: "withCompanyLocalities", required: false }] }], withDefaultCountry: [{ type: i0.Input, args: [{ isSignal: true, alias: "withDefaultCountry", required: false }] }], specifiedCanton: [{ type: i0.Input, args: [{ isSignal: true, alias: "specifiedCanton", required: false }] }], countriesUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "countriesUrl", required: false }] }], foreignLocalityComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FoehnInputForeignLocalityComponent), { isSignal: true }] }], foreignStreetComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FoehnInputForeignStreetComponent), { isSignal: true }] }], foreignHouseNumber: [{ type: i0.ViewChild, args: ['foreignHouseNumber', { isSignal: true }] }], countryAutocomplete: [{ type: i0.ViewChild, args: ['countryAutocomplete', { isSignal: true }] }] } });
9672
9613
 
9673
9614
  class FoehnCheckboxComponent extends FoehnCheckableGroupComponent {
@@ -9696,19 +9637,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
9696
9637
  }] });
9697
9638
 
9698
9639
  class FoehnRadioComponent extends FoehnCheckableGroupComponent {
9699
- inputValue = signal(undefined, ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
9700
- ngOnInit() {
9701
- super.ngOnInit();
9702
- // Re-assign the model once the input signal have been set. This is mandatory
9703
- // otherwise the component doesn't display the initial value when
9704
- // used with an object as the value.
9705
- this.onModelChange(this.model());
9706
- }
9707
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9708
- onModelChange(value) {
9709
- this.inputValue.set(this.getValueOrObject(value));
9710
- super.onModelChange(value);
9711
- }
9640
+ /** The value of the model in the radio buttons: follows the model, elementValue and elementValueIdentity. */
9641
+ inputValue = computed(() => this.getValueOrObject(this.model()), ...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
9712
9642
  ngAfterViewChecked() {
9713
9643
  this.syncDisabledState();
9714
9644
  }
@@ -10069,8 +9999,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
10069
9999
  }], propDecorators: { elementBadgeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "elementBadgeLabel", required: false }] }], selectedItemsListLegend: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItemsListLegend", required: false }] }], noElementsSelectedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "noElementsSelectedLabel", required: false }] }], excludeFromErrorSummary: [{ type: i0.Input, args: [{ isSignal: true, alias: "excludeFromErrorSummary", required: false }] }], defaultElementValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultElementValues", required: false }] }], autocompleteComponent: [{ type: i0.ViewChild, args: ['autocompleteComponent', { isSignal: true }] }], alertMessageContainer: [{ type: i0.ViewChild, args: ['alertMessageContainer', { isSignal: true }] }], selectedElemRef: [{ type: i0.ViewChildren, args: ['selectedElemRef', { isSignal: true }] }], defaultElemRef: [{ type: i0.ViewChildren, args: ['defaultElemRef', { isSignal: true }] }], defaultDeleteFocusArea: [{ type: i0.ViewChild, args: ['defaultDeleteFocusArea', { isSignal: true }] }] } });
10070
10000
 
10071
10001
  class FoehnInputEmailComponent extends FoehnInputStringComponent {
10072
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10073
- timeoutReference;
10074
10002
  autocomplete = input('email', { ...(ngDevMode ? { debugName: "autocomplete" } : /* istanbul ignore next */ {}), transform: () => 'email' });
10075
10003
  dictionaryService = inject(SdkDictionaryService);
10076
10004
  ngOnInit() {
@@ -10098,17 +10026,6 @@ class FoehnInputEmailComponent extends FoehnInputStringComponent {
10098
10026
  }
10099
10027
  });
10100
10028
  }
10101
- onModelChange(value) {
10102
- clearTimeout(this.timeoutReference);
10103
- if (value === undefined || value === null || !!value) {
10104
- this.updateNgModel(value);
10105
- }
10106
- else {
10107
- this.timeoutReference = setTimeout(() => {
10108
- this.updateNgModel(null);
10109
- }, 0);
10110
- }
10111
- }
10112
10029
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FoehnInputEmailComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
10113
10030
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FoehnInputEmailComponent, isStandalone: true, selector: "foehn-input-email", inputs: { autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
10114
10031
  {
@@ -10134,8 +10051,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
10134
10051
  }], propDecorators: { autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }] } });
10135
10052
 
10136
10053
  class FoehnInputHiddenComponent extends FoehnInputStringComponent {
10137
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10138
- timeoutReference;
10139
10054
  model = model(...(ngDevMode ? [undefined, { debugName: "model" }] : /* istanbul ignore next */ []));
10140
10055
  constructor() {
10141
10056
  super();
@@ -10145,17 +10060,6 @@ class FoehnInputHiddenComponent extends FoehnInputStringComponent {
10145
10060
  super.ngOnInit();
10146
10061
  this.type = 'hidden';
10147
10062
  }
10148
- onModelChange(value) {
10149
- clearTimeout(this.timeoutReference);
10150
- if (value === undefined || value === null || !!value) {
10151
- this.updateNgModel(value);
10152
- }
10153
- else {
10154
- this.timeoutReference = setTimeout(() => {
10155
- this.updateNgModel(null);
10156
- }, 0);
10157
- }
10158
- }
10159
10063
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FoehnInputHiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10160
10064
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FoehnInputHiddenComponent, isStandalone: true, selector: "foehn-input-hidden", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange" }, providers: [
10161
10065
  {
@@ -10585,24 +10489,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
10585
10489
  }], propDecorators: { hideStandardHelpText: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideStandardHelpText", required: false }] }], allowDecimal: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDecimal", required: false }] }], allowNegative: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowNegative", required: false }] }], maxDecimalCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDecimalCount", required: false }] }], allowFreeInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowFreeInput", required: false }] }], allowLeadingZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowLeadingZero", required: false }] }] } });
10586
10490
 
10587
10491
  class FoehnInputPasswordComponent extends FoehnInputStringComponent {
10588
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10589
- timeoutReference;
10590
10492
  autocomplete = input('current-password', { ...(ngDevMode ? { debugName: "autocomplete" } : /* istanbul ignore next */ {}), transform: () => 'current-password' });
10591
10493
  ngOnInit() {
10592
10494
  super.ngOnInit();
10593
10495
  this.type = 'password';
10594
10496
  }
10595
- onModelChange(value) {
10596
- clearTimeout(this.timeoutReference);
10597
- if (value === undefined || value === null || !!value) {
10598
- this.updateNgModel(value);
10599
- }
10600
- else {
10601
- this.timeoutReference = setTimeout(() => {
10602
- this.updateNgModel(null);
10603
- }, 0);
10604
- }
10605
- }
10606
10497
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FoehnInputPasswordComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
10607
10498
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FoehnInputPasswordComponent, isStandalone: true, selector: "foehn-input-password", inputs: { autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
10608
10499
  {
@@ -10802,66 +10693,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
10802
10693
  class FoehnInputTextareaComponent extends FoehnInputStringComponent {
10803
10694
  rows = input(3, ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
10804
10695
  displayCharCount = input(...(ngDevMode ? [undefined, { debugName: "displayCharCount" }] : /* istanbul ignore next */ []));
10805
- isCharCountExceeded = signal(false, ...(ngDevMode ? [{ debugName: "isCharCountExceeded" }] : /* istanbul ignore next */ []));
10806
- charCountLeft = signal(undefined, ...(ngDevMode ? [{ debugName: "charCountLeft" }] : /* istanbul ignore next */ []));
10807
- charCountLabel = signal(undefined, ...(ngDevMode ? [{ debugName: "charCountLabel" }] : /* istanbul ignore next */ []));
10808
- ariaLiveStatus = signal('off', ...(ngDevMode ? [{ debugName: "ariaLiveStatus" }] : /* istanbul ignore next */ []));
10809
- dictionary = inject(SdkDictionaryService);
10810
- ngOnInit() {
10811
- super.ngOnInit();
10812
- if (this.displayCharCount()) {
10813
- this.countCharLeft();
10814
- }
10815
- }
10816
- onModelChange(value) {
10817
- this.updateNgModel(value);
10818
- if (this.displayCharCount()) {
10819
- this.checkCharCountExceeded();
10820
- this.countCharLeft();
10821
- }
10822
- }
10823
- countCharLeft() {
10696
+ /** The characters left before max, when the count is displayed. */
10697
+ charCountLeft = computed(() => {
10824
10698
  const max = this.max();
10825
- if (!max) {
10826
- return;
10699
+ if (!this.displayCharCount() || !max) {
10700
+ return undefined;
10827
10701
  }
10828
- if (this.model() !== null && this.model() !== undefined && max) {
10829
- const charCountLeft = max - (this.model()?.length ?? 0);
10830
- this.charCountLeft.set(charCountLeft);
10831
- if (charCountLeft > 0) {
10832
- this.charCountLabel.set(this.getCharCountLabel(charCountLeft));
10833
- if (charCountLeft <= 10 && charCountLeft >= 1) {
10834
- this.ariaLiveStatus.set('assertive');
10835
- }
10836
- else {
10837
- this.ariaLiveStatus.set('off');
10838
- }
10839
- }
10840
- else if (charCountLeft === 0) {
10841
- this.ariaLiveStatus.set('assertive');
10842
- this.charCountLabel.set(this.dictionary.getKeySync('foehn-textarea.chars-remaining.zero'));
10843
- }
10844
- else {
10845
- this.ariaLiveStatus.set('assertive');
10846
- this.charCountLabel.set(this.dictionary.getKeySync('foehn-textarea.chars-remaining.exceeded', { charCountLeft: (charCountLeft * -1).toString() }));
10847
- }
10702
+ const model = this.model();
10703
+ return model !== null && model !== undefined
10704
+ ? max - (model?.length ?? 0)
10705
+ : max;
10706
+ }, ...(ngDevMode ? [{ debugName: "charCountLeft" }] : /* istanbul ignore next */ []));
10707
+ charCountLabel = computed(() => {
10708
+ const charCountLeft = this.charCountLeft();
10709
+ if (charCountLeft === undefined) {
10710
+ return undefined;
10848
10711
  }
10849
- else {
10850
- this.charCountLeft.set(max);
10851
- this.charCountLabel.set(this.getCharCountLabel(max));
10852
- this.ariaLiveStatus.set('off');
10712
+ if (charCountLeft > 0) {
10713
+ return this.getCharCountLabel(charCountLeft);
10853
10714
  }
10854
- }
10855
- checkCharCountExceeded() {
10715
+ if (charCountLeft === 0) {
10716
+ return this.dictionary.getKeySync('foehn-textarea.chars-remaining.zero');
10717
+ }
10718
+ return this.dictionary.getKeySync('foehn-textarea.chars-remaining.exceeded', { charCountLeft: (charCountLeft * -1).toString() });
10719
+ }, ...(ngDevMode ? [{ debugName: "charCountLabel" }] : /* istanbul ignore next */ []));
10720
+ isCharCountExceeded = computed(() => {
10856
10721
  const max = this.max();
10857
- if (this.model() && max) {
10858
- this.isCharCountExceeded.set((this.model()?.length ?? 0) > max);
10859
- return;
10722
+ const model = this.model();
10723
+ return (!!this.displayCharCount() &&
10724
+ !!model &&
10725
+ !!max &&
10726
+ (model?.length ?? 0) > max);
10727
+ }, ...(ngDevMode ? [{ debugName: "isCharCountExceeded" }] : /* istanbul ignore next */ []));
10728
+ /** Announces the count once 10 characters or less are left. */
10729
+ ariaLiveStatus = computed(() => {
10730
+ const charCountLeft = this.charCountLeft();
10731
+ const model = this.model();
10732
+ if (charCountLeft === undefined ||
10733
+ model === null ||
10734
+ model === undefined) {
10735
+ return 'off';
10860
10736
  }
10861
- this.isCharCountExceeded.set(false);
10862
- }
10737
+ return charCountLeft > 10 ? 'off' : 'assertive';
10738
+ }, ...(ngDevMode ? [{ debugName: "ariaLiveStatus" }] : /* istanbul ignore next */ []));
10739
+ dictionary = inject(SdkDictionaryService);
10863
10740
  getCharCountLabel(nbRemaining) {
10864
- return this.charCountLeft() === 1
10741
+ return nbRemaining === 1
10865
10742
  ? this.dictionary.getKeySync('foehn-textarea.chars-remaining.singular', { charCountLeft: nbRemaining.toString() })
10866
10743
  : this.dictionary.getKeySync('foehn-textarea.chars-remaining.plural', { charCountLeft: nbRemaining.toString() });
10867
10744
  }
@@ -11739,10 +11616,29 @@ class FoehnDateComponent extends FoehnInputComponent {
11739
11616
  maxDate = input(...(ngDevMode ? [undefined, { debugName: "maxDate" }] : /* istanbul ignore next */ []));
11740
11617
  childrenLabelSrOnly = input(false, ...(ngDevMode ? [{ debugName: "childrenLabelSrOnly" }] : /* istanbul ignore next */ []));
11741
11618
  clearButton = input(true, ...(ngDevMode ? [{ debugName: "clearButton" }] : /* istanbul ignore next */ []));
11742
- day = signal(null, ...(ngDevMode ? [{ debugName: "day" }] : /* istanbul ignore next */ []));
11743
- month = signal(null, ...(ngDevMode ? [{ debugName: "month" }] : /* istanbul ignore next */ []));
11744
- year = signal(null, ...(ngDevMode ? [{ debugName: "year" }] : /* istanbul ignore next */ []));
11745
- datePickerModel = signal(null, ...(ngDevMode ? [{ debugName: "datePickerModel" }] : /* istanbul ignore next */ []));
11619
+ /*
11620
+ * The day, the month and the year of the model, changed by the sub components, and the date of the date picker.
11621
+ * They are linked to the model: a new model resets them at once, not at the next change detection. A model too
11622
+ * short to hold a date keeps them.
11623
+ */
11624
+ day = linkedSignal({ ...(ngDevMode ? { debugName: "day" } : /* istanbul ignore next */ {}), source: this.model,
11625
+ computation: (value, previous) => this.getDatePart(value, 2, previous?.value) });
11626
+ month = linkedSignal({ ...(ngDevMode ? { debugName: "month" } : /* istanbul ignore next */ {}), source: this.model,
11627
+ computation: (value, previous) => this.getDatePart(value, 1, previous?.value) });
11628
+ year = linkedSignal({ ...(ngDevMode ? { debugName: "year" } : /* istanbul ignore next */ {}), source: this.model,
11629
+ computation: (value, previous) => this.getDatePart(value, 0, previous?.value) });
11630
+ datePickerModel = linkedSignal({ ...(ngDevMode ? { debugName: "datePickerModel" } : /* istanbul ignore next */ {}), source: this.model,
11631
+ computation: (value, previous) => {
11632
+ if (value && value.length > 2) {
11633
+ const date = value
11634
+ .slice(0, 3)
11635
+ .map((part) => this.toNumber(this.numberToString(part)));
11636
+ return date.some((part) => part !== null)
11637
+ ? date
11638
+ : null;
11639
+ }
11640
+ return value ? (previous?.value ?? null) : null;
11641
+ } });
11746
11642
  disabledComputed = computed(() => this.disabled() ||
11747
11643
  (this.disableDay() && this.disableMonth() && this.disableYear()), ...(ngDevMode ? [{ debugName: "disabledComputed" }] : /* istanbul ignore next */ []));
11748
11644
  constructor() {
@@ -11772,20 +11668,6 @@ class FoehnDateComponent extends FoehnInputComponent {
11772
11668
  this.handleChange(date);
11773
11669
  }
11774
11670
  }
11775
- onModelChange(value) {
11776
- if (value && value.length > 2) {
11777
- this.year.set(this.numberToString(value[0]));
11778
- this.month.set(this.numberToString(value[1]));
11779
- this.day.set(this.numberToString(value[2]));
11780
- this.datePickerModel.set(this.getValidValue() ?? null);
11781
- }
11782
- else if (!value) {
11783
- this.year.set(null);
11784
- this.month.set(null);
11785
- this.day.set(null);
11786
- this.datePickerModel.set(null);
11787
- }
11788
- }
11789
11671
  getValidValue() {
11790
11672
  if (this.isEmpty()) {
11791
11673
  if (this.model_ !== undefined) {
@@ -11846,6 +11728,12 @@ class FoehnDateComponent extends FoehnInputComponent {
11846
11728
  const yearEmptyOrDisabled = this.disableYear() || super.isEmpty(this.year());
11847
11729
  return (dayEmptyOrDisabled && monthEmptyOrDisabled && yearEmptyOrDisabled);
11848
11730
  }
11731
+ getDatePart(value, index, previous) {
11732
+ if (value && value.length > 2) {
11733
+ return this.numberToString(value[index]);
11734
+ }
11735
+ return value ? (previous ?? null) : null;
11736
+ }
11849
11737
  toNumber(str) {
11850
11738
  return str ? Number(str) : null;
11851
11739
  }
@@ -11905,9 +11793,6 @@ class FoehnTimeComponent extends FoehnInputStringComponent {
11905
11793
  this.handleChange(validValue);
11906
11794
  }
11907
11795
  }
11908
- onModelChange(_value) {
11909
- // The hour and the minute are linked signals of the model
11910
- }
11911
11796
  resetModel() {
11912
11797
  this.hour.set(null);
11913
11798
  this.minute.set(null);
@@ -12043,9 +11928,6 @@ class FoehnDateTimeComponent extends FoehnInputComponent {
12043
11928
  this.updateDateTime();
12044
11929
  this.handleUserInput();
12045
11930
  }
12046
- onModelChange(_value) {
12047
- // The date and the time are linked signals of the model
12048
- }
12049
11931
  getValidValue() {
12050
11932
  if (this.isEmpty()) {
12051
11933
  if (this.model_ !== undefined) {
@@ -12159,9 +12041,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
12159
12041
 
12160
12042
  class FoehnInputNav13Component extends FoehnInputStringComponent {
12161
12043
  PREFIX_NAVS = '756';
12162
- part2 = signal(null, ...(ngDevMode ? [{ debugName: "part2" }] : /* istanbul ignore next */ []));
12163
- part3 = signal(null, ...(ngDevMode ? [{ debugName: "part3" }] : /* istanbul ignore next */ []));
12164
- part4 = signal(null, ...(ngDevMode ? [{ debugName: "part4" }] : /* istanbul ignore next */ []));
12044
+ /** The parts of the model after 756, changed by the sub components. */
12045
+ part2 = linkedSignal(() => this.splitValue(this.model())[0], ...(ngDevMode ? [{ debugName: "part2" }] : /* istanbul ignore next */ []));
12046
+ part3 = linkedSignal(() => this.splitValue(this.model())[1], ...(ngDevMode ? [{ debugName: "part3" }] : /* istanbul ignore next */ []));
12047
+ part4 = linkedSignal(() => this.splitValue(this.model())[2], ...(ngDevMode ? [{ debugName: "part4" }] : /* istanbul ignore next */ []));
12165
12048
  label = input('Votre numéro <abbr title="Numéro AVS">AVS</abbr>', { ...(ngDevMode ? { debugName: "label" } : /* istanbul ignore next */ {}), transform: (value) => value?.length
12166
12049
  ? value
12167
12050
  : 'Votre numéro <abbr title="Numéro AVS">AVS</abbr>' });
@@ -12187,15 +12070,8 @@ class FoehnInputNav13Component extends FoehnInputStringComponent {
12187
12070
  this.handleChange(validValue);
12188
12071
  }
12189
12072
  }
12190
- onModelChange(value) {
12191
- if (value) {
12192
- this.splitValue(value);
12193
- }
12194
- else {
12195
- this.part2.set(null);
12196
- this.part3.set(null);
12197
- this.part4.set(null);
12198
- }
12073
+ onModelChange(_value) {
12074
+ // The parts are linked signals of the model, which is normalized (756.xxxx.xxxx.xx)
12199
12075
  this.updateNavs();
12200
12076
  }
12201
12077
  onPaste(event) {
@@ -12216,23 +12092,28 @@ class FoehnInputNav13Component extends FoehnInputStringComponent {
12216
12092
  ? `${this.PREFIX_NAVS}.${pastedValue}`
12217
12093
  : this.PREFIX_NAVS + pastedValue;
12218
12094
  }
12219
- this.onModelChange(valueToPaste);
12095
+ const [part2, part3, part4] = this.splitValue(valueToPaste);
12096
+ this.part2.set(part2);
12097
+ this.part3.set(part3);
12098
+ this.part4.set(part4);
12099
+ this.updateNavs();
12220
12100
  this.handleUserInput();
12221
12101
  event.preventDefault();
12222
12102
  }
12223
12103
  }
12224
12104
  splitValue(value) {
12225
- if (value.length === 13 && !value.includes('.')) {
12226
- this.part2.set(value.substring(3, 7));
12227
- this.part3.set(value.substring(7, 11));
12228
- this.part4.set(value.substring(11, 13));
12105
+ if (!value) {
12106
+ return [null, null, null];
12229
12107
  }
12230
- else {
12231
- const splitted = value.split('.');
12232
- this.part2.set(splitted[1]);
12233
- this.part3.set(splitted[2]);
12234
- this.part4.set(splitted[3]);
12108
+ if (value.length === 13 && !value.includes('.')) {
12109
+ return [
12110
+ value.substring(3, 7),
12111
+ value.substring(7, 11),
12112
+ value.substring(11, 13),
12113
+ ];
12235
12114
  }
12115
+ const splitted = value.split('.');
12116
+ return [splitted[1], splitted[2], splitted[3]];
12236
12117
  }
12237
12118
  getValidValue() {
12238
12119
  if (!this.part2() && !this.part3() && !this.part4()) {
@@ -15905,8 +15786,14 @@ class FoehnAgendaTimeslotPanelComponent extends FoehnInputComponent {
15905
15786
  return nbVisibleElements;
15906
15787
  }, ...(ngDevMode ? [{ debugName: "visibleElementsCount" }] : /* istanbul ignore next */ []));
15907
15788
  timeSlotButtonsElemRef = viewChildren('timeSlotButtonsElemRef', ...(ngDevMode ? [{ debugName: "timeSlotButtonsElemRef" }] : /* istanbul ignore next */ []));
15908
- selectedTimeSlot = signal(null, ...(ngDevMode ? [{ debugName: "selectedTimeSlot" }] : /* istanbul ignore next */ []));
15909
- timeInputValue = signal(undefined, ...(ngDevMode ? [{ debugName: "timeInputValue" }] : /* istanbul ignore next */ []));
15789
+ selectedTimeSlot = computed(() => {
15790
+ const value = this.model();
15791
+ return value ? `${value.day}-${value.time}` : null;
15792
+ }, ...(ngDevMode ? [{ debugName: "selectedTimeSlot" }] : /* istanbul ignore next */ []));
15793
+ timeInputValue = computed(() => {
15794
+ const value = this.model();
15795
+ return value ? value.time : null;
15796
+ }, ...(ngDevMode ? [{ debugName: "timeInputValue" }] : /* istanbul ignore next */ []));
15910
15797
  /**
15911
15798
  * TRUE when only the first visibleElementsCount() time slots are displayed.
15912
15799
  * Closed again when the time slots change, unless the selected slot would be hidden.
@@ -15928,7 +15815,10 @@ class FoehnAgendaTimeslotPanelComponent extends FoehnInputComponent {
15928
15815
  */
15929
15816
  canClose = computed(() => this.selectedSlotIndex() < this.visibleElementsCount(), ...(ngDevMode ? [{ debugName: "canClose" }] : /* istanbul ignore next */ []));
15930
15817
  dictionaryService = inject(SdkDictionaryService);
15931
- dayInputValue = signal(undefined, ...(ngDevMode ? [{ debugName: "dayInputValue" }] : /* istanbul ignore next */ []));
15818
+ dayInputValue = computed(() => {
15819
+ const value = this.model();
15820
+ return value ? value.day : null;
15821
+ }, ...(ngDevMode ? [{ debugName: "dayInputValue" }] : /* istanbul ignore next */ []));
15932
15822
  keyboardNavigationAllowed = false;
15933
15823
  currentActiveElement = null;
15934
15824
  /**
@@ -15975,17 +15865,9 @@ class FoehnAgendaTimeslotPanelComponent extends FoehnInputComponent {
15975
15865
  togglePanel() {
15976
15866
  this.isClosed.update((isClosed) => !isClosed);
15977
15867
  }
15978
- onModelChange(value) {
15979
- if (value) {
15980
- this.selectedTimeSlot.set(`${value.day}-${value.time}`);
15981
- this.timeInputValue.set(value.time);
15982
- this.dayInputValue.set(value.day);
15983
- }
15984
- else {
15985
- this.selectedTimeSlot.set(null);
15986
- this.timeInputValue.set(null);
15987
- this.dayInputValue.set(null);
15988
- }
15868
+ onModelChange(_value) {
15869
+ // Shows every time slot when the selected one would be hidden. Not part of isClosed: a new model only opens
15870
+ // the panel, it never closes a panel opened by the user.
15989
15871
  this.searchTimeValueInTimeSlot();
15990
15872
  }
15991
15873
  getTimeInputValue(s) {