feat: refactor input component to use model binding for value management

This commit is contained in:
2026-06-26 10:22:25 -03:00
parent 0d46172325
commit bccb1b565f
2 changed files with 14 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import {
computed,
effect,
input,
model,
output,
signal,
untracked,
@@ -71,7 +72,7 @@ export class InputComponent {
readonly invalid = input(false);
readonly id = input(this.defaultId);
readonly placeholder = input('');
readonly value = input<string | number>('');
readonly value = model<string | number>('');
readonly maxlength = input<number | null>(null);
readonly accept = input('');
readonly fileName = input('');
@@ -83,7 +84,6 @@ export class InputComponent {
});
readonly disabledChange = output<boolean>();
readonly valueChange = output<string>();
readonly fileChange = output<File | null>();
readonly visibleChange = output<boolean>();
@@ -167,7 +167,7 @@ export class InputComponent {
}
protected onValueChange(event: Event): void {
this.valueChange.emit((event.target as HTMLInputElement).value);
this.value.set((event.target as HTMLInputElement).value);
}
protected onFileChange(event: Event): void {