|
@ -1,5 +1,6 @@ |
|
|
import { SelectionModel } from '@angular/cdk/collections'; |
|
|
import { SelectionModel } from '@angular/cdk/collections'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
AfterViewInit, |
|
|
ChangeDetectionStrategy, |
|
|
ChangeDetectionStrategy, |
|
|
Component, |
|
|
Component, |
|
|
EventEmitter, |
|
|
EventEmitter, |
|
@ -11,6 +12,7 @@ import { |
|
|
ViewChild |
|
|
ViewChild |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { MatPaginator, PageEvent } from '@angular/material/paginator'; |
|
|
import { MatPaginator, PageEvent } from '@angular/material/paginator'; |
|
|
|
|
|
import { MatSort, Sort, SortDirection } from '@angular/material/sort'; |
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
import { Router } from '@angular/router'; |
|
|
import { Router } from '@angular/router'; |
|
|
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface'; |
|
|
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface'; |
|
@ -29,7 +31,7 @@ import { Subject, Subscription, takeUntil } from 'rxjs'; |
|
|
templateUrl: './activities-table-lazy.component.html' |
|
|
templateUrl: './activities-table-lazy.component.html' |
|
|
}) |
|
|
}) |
|
|
export class ActivitiesTableLazyComponent |
|
|
export class ActivitiesTableLazyComponent |
|
|
implements OnChanges, OnDestroy, OnInit |
|
|
implements AfterViewInit, OnChanges, OnDestroy, OnInit |
|
|
{ |
|
|
{ |
|
|
@Input() baseCurrency: string; |
|
|
@Input() baseCurrency: string; |
|
|
@Input() dataSource: MatTableDataSource<Activity>; |
|
|
@Input() dataSource: MatTableDataSource<Activity>; |
|
@ -44,6 +46,8 @@ export class ActivitiesTableLazyComponent |
|
|
@Input() showCheckbox = false; |
|
|
@Input() showCheckbox = false; |
|
|
@Input() showFooter = true; |
|
|
@Input() showFooter = true; |
|
|
@Input() showNameColumn = true; |
|
|
@Input() showNameColumn = true; |
|
|
|
|
|
@Input() sortColumn: string; |
|
|
|
|
|
@Input() sortDirection: SortDirection; |
|
|
@Input() totalItems = Number.MAX_SAFE_INTEGER; |
|
|
@Input() totalItems = Number.MAX_SAFE_INTEGER; |
|
|
|
|
|
|
|
|
@Output() activityDeleted = new EventEmitter<string>(); |
|
|
@Output() activityDeleted = new EventEmitter<string>(); |
|
@ -56,8 +60,10 @@ export class ActivitiesTableLazyComponent |
|
|
@Output() importDividends = new EventEmitter<UniqueAsset>(); |
|
|
@Output() importDividends = new EventEmitter<UniqueAsset>(); |
|
|
@Output() pageChanged = new EventEmitter<PageEvent>(); |
|
|
@Output() pageChanged = new EventEmitter<PageEvent>(); |
|
|
@Output() selectedActivities = new EventEmitter<Activity[]>(); |
|
|
@Output() selectedActivities = new EventEmitter<Activity[]>(); |
|
|
|
|
|
@Output() sortChanged = new EventEmitter<Sort>(); |
|
|
|
|
|
|
|
|
@ViewChild(MatPaginator) paginator: MatPaginator; |
|
|
@ViewChild(MatPaginator) paginator: MatPaginator; |
|
|
|
|
|
@ViewChild(MatSort) sort: MatSort; |
|
|
|
|
|
|
|
|
public defaultDateFormat: string; |
|
|
public defaultDateFormat: string; |
|
|
public displayedColumns = []; |
|
|
public displayedColumns = []; |
|
@ -86,6 +92,12 @@ export class ActivitiesTableLazyComponent |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ngAfterViewInit() { |
|
|
|
|
|
this.sort.sortChange.subscribe((value: Sort) => { |
|
|
|
|
|
this.sortChanged.emit(value); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public areAllRowsSelected() { |
|
|
public areAllRowsSelected() { |
|
|
const numSelectedRows = this.selectedRows.selected.length; |
|
|
const numSelectedRows = this.selectedRows.selected.length; |
|
|
const numTotalRows = this.dataSource.data.length; |
|
|
const numTotalRows = this.dataSource.data.length; |
|
|