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:
2024-07-25 10:16:48 +05:30
parent c07c79ffda
commit 336a8f59c5
94 changed files with 846 additions and 1030 deletions
@@ -10,7 +10,7 @@ import { MatIcon } from '@angular/material/icon';
import { MatInput } from '@angular/material/input';
import { ActivatedRoute, Router } from '@angular/router';
import { ToasterService } from '../../core/toaster.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import { User } from '../../core/user';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { UserService } from '../user.service';
@@ -38,7 +38,7 @@ import { UserService } from '../user.service';
],
})
export class UserDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
form: FormGroup<{
name: FormControl<string | null>;
password: FormControl<string | null>;
@@ -56,7 +56,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
constructor(
private route: ActivatedRoute,
private router: Router,
private toaster: ToasterService,
private snackBar: MatSnackBar,
private dialog: MatDialog,
private ser: UserService,
) {
@@ -94,9 +94,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
setTimeout(() => {
if (this.nameElement) {
this.nameElement.nativeElement.focus();
}
this.nameElement.nativeElement.focus();
}, 0);
}
@@ -104,21 +102,21 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
if (this.route.snapshot.paramMap.get('id') === 'me') {
this.ser.updateMe(this.getItem()).subscribe({
next: () => {
this.toaster.show('Success', '');
this.snackBar.open('', 'Success');
this.router.navigateByUrl('/');
},
error: (error) => {
this.toaster.show('Danger', error);
this.snackBar.open(error, 'Danger');
},
});
} else {
this.ser.saveOrUpdate(this.getItem()).subscribe({
next: () => {
this.toaster.show('Success', '');
this.snackBar.open('', 'Success');
this.router.navigateByUrl('/users');
},
error: (error) => {
this.toaster.show('Danger', error);
this.snackBar.open(error, 'Danger');
},
});
}
@@ -127,11 +125,11 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
delete() {
this.ser.delete(this.item.id as string).subscribe({
next: () => {
this.toaster.show('Success', '');
this.snackBar.open('', 'Success');
this.router.navigateByUrl('/users');
},
error: (error) => {
this.toaster.show('Danger', error);
this.snackBar.open(error, 'Danger');
},
});
}
@@ -54,8 +54,8 @@ import { UserListDataSource } from './user-list-datasource';
],
})
export class UserListComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator = undefined;
@ViewChild(MatSort, { static: true }) sort?: MatSort = undefined;
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
@ViewChild(MatSort, { static: true }) sort!: MatSort;
list: User[] = [];
dataSource: UserListDataSource = new UserListDataSource(this.list);
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */