fixed text filter to work on Enter

This commit is contained in:
Flaminel
2026-03-26 11:55:20 +02:00
parent 226ee269bf
commit f00a7a32d8
5 changed files with 13 additions and 3 deletions

View File

@@ -35,7 +35,7 @@
placeholder="Search events..."
type="search"
[(value)]="searchQuery"
(blurred)="onFilterChange()"
(entered)="onFilterChange()"
/>
</div>
<div class="toolbar__actions">

View File

@@ -11,7 +11,7 @@
placeholder="Search by title..."
type="search"
[(value)]="searchQuery"
(blurred)="onFilterChange()"
(entered)="onFilterChange()"
/>
<app-select
[value]="sortBy()"

View File

@@ -118,7 +118,7 @@
placeholder="Search by title..."
type="search"
[(value)]="searchQuery"
(blurred)="onSearchFilterChange()"
(entered)="onSearchFilterChange()"
/>
</div>
<div class="toolbar__actions">

View File

@@ -20,6 +20,8 @@
[readOnly]="readonly()"
[(ngModel)]="value"
(blur)="blurred.emit($event)"
(keydown.enter)="entered.emit()"
(search)="onSearchCleared($event)"
/>
@if (hasEye()) {
<button type="button" class="input-eye-btn" (click)="toggleSecret($event)" [attr.aria-label]="showSecret() ? 'Hide password' : 'Show password'">

View File

@@ -28,6 +28,7 @@ export class InputComponent {
inputRef = viewChild<ElementRef<HTMLInputElement>>('inputEl');
blurred = output<FocusEvent>();
entered = output<void>();
readonly showSecret = signal(false);
readonly hasEye = computed(() => this.type() === 'password' && this.revealable());
@@ -46,6 +47,13 @@ export class InputComponent {
this.showSecret.update(v => !v);
}
onSearchCleared(event: Event): void {
const input = event.target as HTMLInputElement;
if (input.value === '') {
this.entered.emit();
}
}
onHelpClick(event: Event): void {
event.preventDefault();
event.stopPropagation();