This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
model,
|
||||
signal,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
@@ -43,14 +44,14 @@ import { PaginatorModule, PaginatorState } from 'primeng/paginator';
|
||||
PaginatorModule,
|
||||
],
|
||||
template: `
|
||||
@if (file() && columns().length > 0) {
|
||||
@if (file() && enabledColumns().length > 0) {
|
||||
<div class="h-full">
|
||||
<p-table
|
||||
#table
|
||||
sortMode="multiple"
|
||||
[resizableColumns]="true"
|
||||
columnResizeMode="expand"
|
||||
[columns]="columns()"
|
||||
[columns]="enabledColumns()"
|
||||
[value]="currentValue()"
|
||||
showGridlines
|
||||
[scrollable]="true"
|
||||
@@ -124,7 +125,7 @@ import { PaginatorModule, PaginatorState } from 'primeng/paginator';
|
||||
@if (hasAggregates()) {
|
||||
<ng-template #footer>
|
||||
<tr>
|
||||
@for (col of columns(); track $index) {
|
||||
@for (col of enabledColumns(); track $index) {
|
||||
<td #attachment>
|
||||
@if (col.type === 'DOUBLE' || col.type === 'BIGINT') {
|
||||
<div class="flex items-baseline">
|
||||
@@ -174,7 +175,7 @@ export class FileViewerComponent {
|
||||
private duckdbService = inject(DuckdbService);
|
||||
|
||||
// Can't be computed since effect has to run first so file exists in duckdb
|
||||
protected columns = signal<Column[]>([]);
|
||||
columns = model<Column[]>([]);
|
||||
protected aggregates = signal<(Aggregate | undefined)[]>([]);
|
||||
protected currentAggregateColumn = signal<number | undefined>(undefined);
|
||||
protected aggregateValues = signal<(number | undefined)[]>([]);
|
||||
@@ -195,6 +196,10 @@ export class FileViewerComponent {
|
||||
() => !!this.columns().find((col) => this.isAggregateColumn(col)),
|
||||
);
|
||||
|
||||
protected enabledColumns = computed(() =>
|
||||
this.columns().filter((col) => col.enabled),
|
||||
);
|
||||
|
||||
protected aggregateItems: MenuItem[] = aggregateTypes.map((type) => ({
|
||||
label: type,
|
||||
command: () => this.updateAggregateValue(type),
|
||||
|
||||
Reference in New Issue
Block a user