Browse Source

feat(lib): change to input functions

pull/6301/head
KenTandrian 23 hours ago
parent
commit
f210f842cd
  1. 2
      libs/ui/src/lib/accounts-table/accounts-table.component.html
  2. 29
      libs/ui/src/lib/accounts-table/accounts-table.component.ts

2
libs/ui/src/lib/accounts-table/accounts-table.component.html

@ -1,4 +1,4 @@
@if (showActions) { @if (showActions()) {
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
<button <button
class="align-items-center d-flex" class="align-items-center d-flex"

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

@ -13,7 +13,9 @@ import {
OnChanges, OnChanges,
OnDestroy, OnDestroy,
Output, Output,
ViewChild ViewChild,
inject,
input
} from '@angular/core'; } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
@ -60,13 +62,7 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy {
@Input() deviceType: string; @Input() deviceType: string;
@Input() hasPermissionToOpenDetails = true; @Input() hasPermissionToOpenDetails = true;
@Input() locale = getLocale(); @Input() locale = getLocale();
@Input() showActions: boolean;
@Input() showActivitiesCount = true;
@Input() showAllocationInPercentage: boolean;
@Input() showBalance = true;
@Input() showFooter = true; @Input() showFooter = true;
@Input() showValue = true;
@Input() showValueInBaseCurrency = true;
@Input() totalBalanceInBaseCurrency: number; @Input() totalBalanceInBaseCurrency: number;
@Input() totalValueInBaseCurrency: number; @Input() totalValueInBaseCurrency: number;
@ -81,6 +77,13 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy {
public isLoading = true; public isLoading = true;
public routeQueryParams: Subscription; public routeQueryParams: Subscription;
public readonly showActions = input<boolean>();
public readonly showActivitiesCount = input(true);
public readonly showAllocationInPercentage = input<boolean>();
public readonly showBalance = input(true);
public readonly showValue = input(true);
public readonly showValueInBaseCurrency = input(false);
private readonly notificationService = inject(NotificationService); private readonly notificationService = inject(NotificationService);
private readonly router = inject(Router); private readonly router = inject(Router);
private readonly unsubscribeSubject = new Subject<void>(); private readonly unsubscribeSubject = new Subject<void>();
@ -100,31 +103,31 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy {
public ngOnChanges() { public ngOnChanges() {
this.displayedColumns = ['status', 'account', 'platform']; this.displayedColumns = ['status', 'account', 'platform'];
if (this.showActivitiesCount) { if (this.showActivitiesCount()) {
this.displayedColumns.push('activitiesCount'); this.displayedColumns.push('activitiesCount');
} }
if (this.showBalance) { if (this.showBalance()) {
this.displayedColumns.push('balance'); this.displayedColumns.push('balance');
} }
if (this.showValue) { if (this.showValue()) {
this.displayedColumns.push('value'); this.displayedColumns.push('value');
} }
this.displayedColumns.push('currency'); this.displayedColumns.push('currency');
if (this.showValueInBaseCurrency) { if (this.showValueInBaseCurrency()) {
this.displayedColumns.push('valueInBaseCurrency'); this.displayedColumns.push('valueInBaseCurrency');
} }
if (this.showAllocationInPercentage) { if (this.showAllocationInPercentage()) {
this.displayedColumns.push('allocation'); this.displayedColumns.push('allocation');
} }
this.displayedColumns.push('comment'); this.displayedColumns.push('comment');
if (this.showActions) { if (this.showActions()) {
this.displayedColumns.push('actions'); this.displayedColumns.push('actions');
} }

Loading…
Cancel
Save