feat(ui): refinar buscador y navegacion UX-06E.A

This commit is contained in:
Angel Capetillo Zavala
2026-10-13 14:43:52 -06:00
parent 61cdf5b72e
commit fe9442237b
7 changed files with 104 additions and 16 deletions
@@ -1,5 +1,5 @@
import { DOCUMENT } from '@angular/common';
import { afterNextRender, ChangeDetectorRef, Component, DestroyRef, ElementRef, Injector, inject, computed, signal } from '@angular/core';
import { afterNextRender, ChangeDetectorRef, Component, DestroyRef, ElementRef, Injector, inject, computed, signal, viewChild } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { FormsModule } from '@angular/forms';
@@ -7,6 +7,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatIconModule } from '@angular/material/icon';
import { MatSelectModule } from '@angular/material/select';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { catchError, map, of, startWith, Subject, switchMap } from 'rxjs';
@@ -19,7 +20,7 @@ import { httpMessage } from './indicadores-http';
@Component({
selector: 'app-indicadores-page',
imports: [RouterLink, FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatSelectModule, MatProgressBarModule, IndicadorCatalogCard],
imports: [RouterLink, FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, IndicadorCatalogCard],
templateUrl: './indicadores-page.html',
styleUrl: './indicadores-page.scss',
})
@@ -27,6 +28,11 @@ export class IndicadoresPage {
private readonly document = inject(DOCUMENT);
private readonly element = inject<ElementRef<HTMLElement>>(ElementRef);
private readonly injector = inject(Injector);
private readonly searchInput = viewChild<ElementRef<HTMLInputElement>>('searchInput');
clearSearch() {
this.changeSearchQuery('');
this.searchInput()?.nativeElement.focus({ preventScroll: true });
}
changeSearchQuery(query: string) {
const focused = this.document.activeElement;
this.searchQuery.set(query);