Display aliases in the UI, allow adding and removing aliases from the Person Edit modal

Adds forgotten translation string
This commit is contained in:
Amelia 2025-05-06 19:51:28 +02:00
parent c36123a58f
commit d1c5f4a377
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
21 changed files with 228 additions and 18 deletions

View file

@ -9,7 +9,7 @@ import {
OnInit,
Output
} from '@angular/core';
import {FormArray, FormControl, FormGroup, ReactiveFormsModule} from "@angular/forms";
import {AsyncValidatorFn, FormArray, FormControl, FormGroup, ReactiveFormsModule, ValidatorFn} from "@angular/forms";
import {TranslocoDirective} from "@jsverse/transloco";
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
import {debounceTime, distinctUntilChanged, tap} from "rxjs/operators";
@ -28,6 +28,10 @@ export class EditListComponent implements OnInit {
@Input({required: true}) items: Array<string> = [];
@Input({required: true}) label = '';
@Input() validators: ValidatorFn[] = []
@Input() asyncValidators: AsyncValidatorFn[] = [];
// TODO: Make this more dynamic based on which validator failed
@Input() errorMessage: string | null = null;
@Output() updateItems = new EventEmitter<Array<string>>();
form: FormGroup = new FormGroup({items: new FormArray([])});
@ -51,7 +55,7 @@ export class EditListComponent implements OnInit {
}
createItemControl(value: string = ''): FormControl {
return new FormControl(value, []);
return new FormControl(value, this.validators, this.asyncValidators);
}
add() {