Browse Source

feat(lib): change accounts to use input function

pull/6301/head
KenTandrian 23 hours ago
parent
commit
6efe097b0a
  1. 6
      libs/ui/src/lib/accounts-table/accounts-table.component.ts

6
libs/ui/src/lib/accounts-table/accounts-table.component.ts

@ -57,7 +57,6 @@ import { Subject, Subscription } from 'rxjs';
templateUrl: './accounts-table.component.html' templateUrl: './accounts-table.component.html'
}) })
export class GfAccountsTableComponent implements OnChanges, OnDestroy { export class GfAccountsTableComponent implements OnChanges, OnDestroy {
@Input() accounts: Account[];
@Input() activitiesCount: number; @Input() activitiesCount: number;
@Input() baseCurrency: string; @Input() baseCurrency: string;
@Input() deviceType: string; @Input() deviceType: string;
@ -77,6 +76,7 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy {
public isLoading = true; public isLoading = true;
public routeQueryParams: Subscription; public routeQueryParams: Subscription;
public readonly accounts = input.required<Account[] | undefined>();
public readonly showActions = input<boolean>(); public readonly showActions = input<boolean>();
public readonly showActivitiesCount = input(true); public readonly showActivitiesCount = input(true);
public readonly showAllocationInPercentage = input<boolean>(); public readonly showAllocationInPercentage = input<boolean>();
@ -137,12 +137,12 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy {
public ngOnChanges() { public ngOnChanges() {
this.isLoading = true; this.isLoading = true;
this.dataSource = new MatTableDataSource(this.accounts); this.dataSource = new MatTableDataSource(this.accounts());
this.dataSource.sortingDataAccessor = getLowercase; this.dataSource.sortingDataAccessor = getLowercase;
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
if (this.accounts) { if (this.accounts()) {
this.isLoading = false; this.isLoading = false;
} }
} }

Loading…
Cancel
Save