Browse Source

feat(lib): make locale an input signal

pull/6352/head
KenTandrian 1 month ago
parent
commit
4fbbc523a2
  1. 4
      libs/ui/src/lib/account-balances/account-balances.component.html
  2. 8
      libs/ui/src/lib/account-balances/account-balances.component.ts

4
libs/ui/src/lib/account-balances/account-balances.component.html

@ -12,7 +12,7 @@
<ng-container i18n>Date</ng-container>
</th>
<td *matCellDef="let element" class="px-2" mat-cell>
<gf-value [isDate]="true" [locale]="locale" [value]="element?.date" />
<gf-value [isDate]="true" [locale]="locale()" [value]="element?.date" />
</td>
<td *matFooterCellDef class="px-2" mat-footer-cell>
<mat-form-field appearance="outline" class="py-1 without-hint">
@ -37,7 +37,7 @@
<div class="d-flex justify-content-end">
<gf-value
[isCurrency]="true"
[locale]="locale"
[locale]="locale()"
[unit]="element?.account?.currency"
[value]="element?.value"
/>

8
libs/ui/src/lib/account-balances/account-balances.component.ts

@ -15,7 +15,8 @@ import {
OnInit,
Output,
ViewChild,
inject
inject,
input
} from '@angular/core';
import {
FormGroup,
@ -66,7 +67,6 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit {
@Input() accountBalances: AccountBalancesResponse['balances'];
@Input() accountCurrency: string;
@Input() accountId: string;
@Input() locale = getLocale();
@Input() showActions = true;
@Output() accountBalanceCreated = new EventEmitter<CreateAccountBalanceDto>();
@ -85,6 +85,8 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit {
public displayedColumns: string[] = ['date', 'value', 'actions'];
protected readonly locale = input(getLocale());
private dateAdapter = inject<DateAdapter<Date, string>>(DateAdapter);
private notificationService = inject(NotificationService);
@ -93,7 +95,7 @@ export class GfAccountBalancesComponent implements OnChanges, OnInit {
}
public ngOnInit() {
this.dateAdapter.setLocale(this.locale);
this.dateAdapter.setLocale(this.locale());
}
public ngOnChanges() {

Loading…
Cancel
Save