Chore: Eslint v9
Chore: Angular Zoneless Chore: Removed Angular-Hotkeys dependency Fix: Localization works properly now Chore: Using Material 3 theme now Chore: Removed toaster service to use snackbar directly Fix: F2 Date working on all components now
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { DecimalPipe, CurrencyPipe } from '@angular/common';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatCard, MatCardHeader, MatCardTitle, MatCardContent } from '@angular/material/card';
|
||||
@@ -73,10 +73,11 @@ import { PurchasesItem } from './purchases-item';
|
||||
],
|
||||
})
|
||||
export class PurchasesComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort!: MatSort;
|
||||
@ViewChild('startDateElement', { static: true }) startDate!: ElementRef<HTMLInputElement>;
|
||||
info: Purchases = new Purchases();
|
||||
dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body);
|
||||
dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort);
|
||||
form: FormGroup<{
|
||||
startDate: FormControl<Date>;
|
||||
finishDate: FormControl<Date>;
|
||||
@@ -86,6 +87,13 @@ export class PurchasesComponent implements OnInit {
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['product', 'quantity', 'rate', 'amount'];
|
||||
|
||||
@HostListener('window:keydown.f2', ['$event'])
|
||||
focusDate(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.startDate.nativeElement.focus();
|
||||
this.startDate.nativeElement.select();
|
||||
}
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
|
||||
Reference in New Issue
Block a user