Feature/set up output for click in holdings table component (#3851)
* Set up @Output for click in holdings table component
This commit is contained in:
parent
2ad91e5796
commit
7f6b8145d7
@ -111,7 +111,7 @@ export class HomeHoldingsComponent implements OnDestroy, OnInit {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
public onSymbolClicked({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
public onHoldingClicked({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
if (dataSource && symbol) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { dataSource, symbol, holdingDetailDialog: true }
|
||||
|
@ -40,7 +40,7 @@
|
||||
cursor="pointer"
|
||||
[dateRange]="user?.settings?.dateRange"
|
||||
[holdings]="holdings"
|
||||
(treemapChartClicked)="onSymbolClicked($event)"
|
||||
(treemapChartClicked)="onHoldingClicked($event)"
|
||||
/>
|
||||
}
|
||||
<div [ngClass]="{ 'd-none': viewModeFormControl.value !== 'TABLE' }">
|
||||
@ -50,6 +50,7 @@
|
||||
[hasPermissionToCreateActivity]="hasPermissionToCreateOrder"
|
||||
[holdings]="holdings"
|
||||
[locale]="user?.settings?.locale"
|
||||
(holdingClicked)="onHoldingClicked($event)"
|
||||
/>
|
||||
@if (hasPermissionToCreateOrder && holdings?.length > 0) {
|
||||
<div class="text-center">
|
||||
|
@ -14,10 +14,12 @@ import {
|
||||
CUSTOM_ELEMENTS_SCHEMA,
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
Output,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@ -25,7 +27,6 @@ import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatSort, MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
||||
import { Router, RouterModule } from '@angular/router';
|
||||
import { AssetSubClass } from '@prisma/client';
|
||||
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
||||
import { Subject, Subscription } from 'rxjs';
|
||||
@ -44,8 +45,7 @@ import { Subject, Subscription } from 'rxjs';
|
||||
MatPaginatorModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
NgxSkeletonLoaderModule,
|
||||
RouterModule
|
||||
NgxSkeletonLoaderModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
selector: 'gf-holdings-table',
|
||||
@ -63,6 +63,8 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy, OnInit {
|
||||
@Input() locale = getLocale();
|
||||
@Input() pageSize = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
@Output() holdingClicked = new EventEmitter<AssetProfileIdentifier>();
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
@ -75,7 +77,7 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy, OnInit {
|
||||
|
||||
private unsubscribeSubject = new Subject<void>();
|
||||
|
||||
public constructor(private router: Router) {}
|
||||
public constructor() {}
|
||||
|
||||
public ngOnInit() {}
|
||||
|
||||
@ -107,9 +109,7 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy, OnInit {
|
||||
|
||||
public onOpenHoldingDialog({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
if (this.hasPermissionToOpenDetails) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { dataSource, symbol, holdingDetailDialog: true }
|
||||
});
|
||||
this.holdingClicked.emit({ dataSource, symbol });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user