Removed Recipe Template as it was not needed.

Moved host listeners to the component declaration.
Form submit on Return fixed.
This commit is contained in:
2026-08-26 06:00:13 +00:00
parent fe5e4a2308
commit e3719faddd
79 changed files with 737 additions and 990 deletions
@@ -1,8 +1,8 @@
import { CurrencyPipe } from '@angular/common';
import { Component, HostListener, inject, input, computed, linkedSignal, signal, afterNextRender } from '@angular/core';
import { Component, inject, input, computed, linkedSignal, signal, afterNextRender } from '@angular/core';
import { form as createForm, FormField, FormRoot } from '@angular/forms/signals';
export interface BalanceSheetFormData {
date: moment.Moment;
date: Date;
}
import { MatButtonModule } from '@angular/material/button';
import { MatDatepickerModule } from '@angular/material/datepicker';
@@ -24,6 +24,9 @@ import { BalanceSheetService } from './balance-sheet.service';
selector: 'app-balance-sheet',
templateUrl: './balance-sheet.component.html',
styleUrls: ['./balance-sheet.component.css'],
host: {
'(window:keydown.f2)': 'focusDate($event)',
},
imports: [
FormField,
FormRoot,
@@ -56,7 +59,7 @@ export class BalanceSheetComponent {
formModel = linkedSignal<import('./balance-sheet').BalanceSheet, BalanceSheetFormData>({
source: this.info,
computation: (info: BalanceSheet): BalanceSheetFormData => ({
date: info.date ? moment(info.date, 'DD-MMM-YYYY') : moment(new Date()),
date: info.date ? moment(info.date, 'DD-MMM-YYYY').toDate() : new Date(),
}),
});
@@ -103,7 +106,6 @@ export class BalanceSheetComponent {
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['group', 'name', 'subAmount', 'total'];
@HostListener('window:keydown.f2', ['$event'])
focusDate(event: Event) {
event.preventDefault();
this.form().focusBoundControl();