diff --git a/libs/ui/src/lib/activities-table/activities-table.component.html b/libs/ui/src/lib/activities-table/activities-table.component.html
index b20e97a21..746a46c45 100644
--- a/libs/ui/src/lib/activities-table/activities-table.component.html
+++ b/libs/ui/src/lib/activities-table/activities-table.component.html
@@ -488,9 +488,9 @@
-
+
(true, []);
public readonly dataSource = input.required>();
+ public readonly showAccountColumn = input(true);
+ public readonly showCheckbox = input(false);
+ public readonly showNameColumn = input(true);
- public readonly isLoading = computed(() => {
+ protected readonly displayedColumns = computed(() => {
+ let columns = [
+ 'select',
+ 'importStatus',
+ 'icon',
+ 'nameWithSymbol',
+ 'type',
+ 'date',
+ 'quantity',
+ 'unitPrice',
+ 'fee',
+ 'value',
+ 'currency',
+ 'valueInBaseCurrency',
+ 'account',
+ 'comment',
+ 'actions'
+ ];
+
+ if (!this.showAccountColumn()) {
+ columns = columns.filter((column) => {
+ return column !== 'account';
+ });
+ }
+
+ if (!this.showCheckbox()) {
+ columns = columns.filter((column) => {
+ return column !== 'importStatus' && column !== 'select';
+ });
+ }
+
+ if (!this.showNameColumn()) {
+ columns = columns.filter((column) => {
+ return column !== 'nameWithSymbol';
+ });
+ }
+ return columns;
+ });
+
+ protected readonly isLoading = computed(() => {
return !this.dataSource();
});
@@ -166,7 +203,7 @@ export class GfActivitiesTableComponent
}
public ngOnInit() {
- if (this.showCheckbox) {
+ if (this.showCheckbox()) {
this.toggleAllRows();
this.selectedRows.changed
.pipe(takeUntil(this.unsubscribeSubject))
@@ -184,44 +221,6 @@ export class GfActivitiesTableComponent
});
}
- public ngOnChanges() {
- this.displayedColumns = [
- 'select',
- 'importStatus',
- 'icon',
- 'nameWithSymbol',
- 'type',
- 'date',
- 'quantity',
- 'unitPrice',
- 'fee',
- 'value',
- 'currency',
- 'valueInBaseCurrency',
- 'account',
- 'comment',
- 'actions'
- ];
-
- if (!this.showAccountColumn) {
- this.displayedColumns = this.displayedColumns.filter((column) => {
- return column !== 'account';
- });
- }
-
- if (!this.showCheckbox) {
- this.displayedColumns = this.displayedColumns.filter((column) => {
- return column !== 'importStatus' && column !== 'select';
- });
- }
-
- if (!this.showNameColumn) {
- this.displayedColumns = this.displayedColumns.filter((column) => {
- return column !== 'nameWithSymbol';
- });
- }
- }
-
public areAllRowsSelected() {
const numSelectedRows = this.selectedRows.selected.length;
const numTotalRows = this.dataSource().data.length;
@@ -251,7 +250,7 @@ export class GfActivitiesTableComponent
}
public onClickActivity(activity: Activity) {
- if (this.showCheckbox) {
+ if (this.showCheckbox()) {
if (!activity.error) {
this.selectedRows.toggle(activity);
}