diff --git a/package-lock.json b/package-lock.json index a6f2089..83cbc5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7843,6 +7843,11 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, + "simple-keyboard": { + "version": "2.25.3", + "resolved": "https://registry.npmjs.org/simple-keyboard/-/simple-keyboard-2.25.3.tgz", + "integrity": "sha512-wEEPPbVUH8C4pzION3ROyJWuf079FtEpYi6VciDgKB77BzKsQsH9sBimCn4b+1Qsk7krYTzNOYUshbWLzSb+6A==" + }, "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", diff --git a/package.json b/package.json index 9f8a8b3..c6775da 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "ngx-bootstrap": "^5.1.1", "popper.js": "^1.15.0", "rxjs": "~6.4.0", + "simple-keyboard": "^2.25.3", "tslib": "^1.9.0", "zone.js": "~0.9.1" }, diff --git a/src/app/components/inicio/inicio.component.ts b/src/app/components/inicio/inicio.component.ts index 3e4abfc..6ba6763 100644 --- a/src/app/components/inicio/inicio.component.ts +++ b/src/app/components/inicio/inicio.component.ts @@ -6,7 +6,7 @@ import { ProductoService } from 'src/app/services/producto.service'; import { Router } from '@angular/router'; import { Promocion } from 'src/app/wrappers/promocion'; import { Sinonimo } from 'src/app/wrappers/sinonimo'; - +import { HostListener } from '@angular/core'; @Component({ selector: 'app-inicio', @@ -15,11 +15,16 @@ import { Sinonimo } from 'src/app/wrappers/sinonimo'; }) export class InicioComponent implements OnInit { + @HostListener('document:keypress', ["$event"]) catchInput(e: KeyboardEvent) { + this.busqueda += e.key; + }; + @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; private productoAcargar: Producto; private promoAcargar: Promocion; private tienePromo = false; private productoEsPromo = false; + private busqueda: string = ''; promociones: Promocion[] = []; sinonimos: Sinonimo[] = []; @@ -31,6 +36,8 @@ export class InicioComponent implements OnInit { ngOnInit() { + this.vaciarBusqueda(); + this.productoAcargar = this.productoService.productoAcargar; if (this.productoAcargar) { var sector = this.productoAcargar.CodSec; @@ -94,4 +101,11 @@ export class InicioComponent implements OnInit { } } + vaciarBusqueda() { + + setTimeout(() => { + this.busqueda = ''; + }, 2000); + } + }