-
+ |
Name
|
@@ -18,12 +22,7 @@
-
+ |
Value
|
@@ -38,12 +37,7 @@
-
+ |
Allocation
%
|
@@ -61,6 +55,7 @@
@@ -68,71 +63,61 @@
[@detailExpand]="element.expand ? 'expanded' : 'collapsed'"
class="allocationByParent"
>
-
-
- @for (
- parentHolding of element.parents?.slice(0, 10);
- track parentHolding;
- let i = $index
- ) {
- 0"
- [matTooltip]="parentHolding.name"
- [style.background-color]="getColor(parentHolding?.symbol)"
- [style.width.%]="100 * parentHolding?.allocationInPercentage"
- (click)="onClickOpenPositionModal(parentHolding.position)"
- >
- {{ parentHolding?.symbol }}
-
- }
-
-
+
+
+
+
+
+
+
- Name |
-
{{ parentHolding?.name }}
|
-
-
- Symbol |
-
- {{ parentHolding?.symbol }}
+ |
+ Name
|
- Value |
-
+
+
+
+ |
+
+ Value
|
- Allocation |
-
+
+
+
+ |
+
+ Allocation
+ %
|
@@ -144,8 +129,10 @@
0"
- [class.expanded]="element.expand ?? false"
+ [ngClass]="{
+ 'cursor-pointer': element.parents?.length > 0,
+ expanded: element.expand ?? false
+ }"
(click)="
element.expand ? (element.expand = false) : (element.expand = true)
"
diff --git a/libs/ui/src/lib/top-holdings/top-holdings.component.scss b/libs/ui/src/lib/top-holdings/top-holdings.component.scss
index aa5b177eb..9064c54f0 100644
--- a/libs/ui/src/lib/top-holdings/top-holdings.component.scss
+++ b/libs/ui/src/lib/top-holdings/top-holdings.component.scss
@@ -2,73 +2,32 @@
display: block;
.holdings-table {
- th {
- ::ng-deep {
- .mat-sort-header-container {
- justify-content: inherit;
- }
+ tr {
+ &:not(.expanded) + tr.holding-detail td {
+ border-bottom: 0;
}
- }
-
- tr.holding-detail {
- height: 0;
- &:hover {
- // Disable hover effect.
- background-color: var(--mat-table-background-color-even) !important;
- }
- }
-
- tr.expanded {
- background-color: var(--mat-table-background-color-even);
- }
-
- tr:not(.expanded) + tr.holding-detail td {
- border-bottom: 0;
- }
- .holdingParents {
- padding: 1em 0;
- --table-padding: 0.5em;
-
- .holdingParentProportionChart {
- height: 2em;
-
- div {
- box-sizing: border-box;
- line-height: 2em;
- padding: 0 var(--table-padding);
- overflow: hidden;
-
- &:hover {
- filter: brightness(0.95);
- }
+ &.expanded {
+ > td {
+ font-weight: bold;
}
}
- .colorBadge {
- width: 0.75em;
- height: 0.75em;
- border-radius: 100%;
- display: inline-block;
+ &.holding-detail {
+ height: 0;
}
- table,
- tr,
- th,
- td {
- background-color: transparent;
- }
+ .holding-parents-table {
+ --table-padding: 0.5em;
+
+ tr {
+ height: auto;
- tr {
- height: auto;
- &:hover {
- background-color: var(--mat-table-background-color-hover);
+ td {
+ padding: var(--table-padding);
+ }
}
}
- th,
- td {
- padding: var(--table-padding);
- }
}
}
}
diff --git a/libs/ui/src/lib/top-holdings/top-holdings.component.ts b/libs/ui/src/lib/top-holdings/top-holdings.component.ts
index 7bb1ff889..400c68da5 100644
--- a/libs/ui/src/lib/top-holdings/top-holdings.component.ts
+++ b/libs/ui/src/lib/top-holdings/top-holdings.component.ts
@@ -27,29 +27,11 @@ import {
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
-import { MatSort, MatSortModule } from '@angular/material/sort';
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
-import { MatTooltipModule } from '@angular/material/tooltip';
import { DataSource } from '@prisma/client';
-import { get } from 'lodash';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { Subject } from 'rxjs';
-const {
- blue,
- cyan,
- grape,
- green,
- indigo,
- lime,
- orange,
- pink,
- red,
- teal,
- violet,
- yellow
-} = require('open-color');
-
@Component({
animations: [
trigger('detailExpand', [
@@ -67,9 +49,7 @@ const {
GfValueComponent,
MatButtonModule,
MatPaginatorModule,
- MatSortModule,
MatTableModule,
- MatTooltipModule,
NgxSkeletonLoaderModule
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
@@ -91,14 +71,9 @@ export class GfTopHoldingsComponent implements OnChanges, OnDestroy {
};
} = {};
- @Output() proportionChartClicked = new EventEmitter();
+ @Output() holdingClicked = new EventEmitter();
@ViewChild(MatPaginator) paginator: MatPaginator;
- @ViewChild(MatSort) sort: MatSort;
-
- private colorMap: {
- [symbol: string]: string;
- } = {};
public dataSource = new MatTableDataSource();
public displayedColumns: string[] = [
@@ -106,66 +81,25 @@ export class GfTopHoldingsComponent implements OnChanges, OnDestroy {
'valueInBaseCurrency',
'allocationInPercentage'
];
- public displayedHoldingParentColumns: string[] = [
- 'name',
- 'symbol',
- 'valueInBaseCurrency',
- 'allocationInPercentage'
- ];
public isLoading = true;
private unsubscribeSubject = new Subject();
- private colorPaletteIndex = 0;
- private colorPalette = [
- blue[5],
- teal[5],
- lime[5],
- orange[5],
- pink[5],
- violet[5],
- indigo[5],
- cyan[5],
- green[5],
- yellow[5],
- red[5],
- grape[5]
- ];
-
- public getColor(symbol) {
- if (this.colorMap[symbol]) {
- // Reuse color
- return this.colorMap[symbol];
- } else {
- const color = this.colorPalette[this.colorPaletteIndex];
- this.colorPaletteIndex =
- this.colorPaletteIndex < this.colorPalette.length
- ? this.colorPaletteIndex + 1
- : 0;
- this.colorMap[symbol] = color;
- return color;
- }
- }
-
- public onClickOpenPositionModal(holding: AssetProfileIdentifier) {
- try {
- this.proportionChartClicked.emit(holding);
- } catch {}
- }
-
public ngOnChanges() {
this.isLoading = true;
this.dataSource = new MatTableDataSource(this.topHoldings);
this.dataSource.paginator = this.paginator;
- this.dataSource.sort = this.sort;
- this.dataSource.sortingDataAccessor = get;
if (this.topHoldings) {
this.isLoading = false;
}
}
+ public onClickHolding(assetProfileIdentifier: AssetProfileIdentifier) {
+ this.holdingClicked.emit(assetProfileIdentifier);
+ }
+
public onShowAllHoldings() {
this.pageSize = Number.MAX_SAFE_INTEGER;
| | |