File

components/table-data-panel/table-data-panel.component.ts

Description

Expansion panel with data table and export.

Metadata

Index

Properties
Inputs

Inputs

filename
Default value : undefined

Filename for export

panelTitle
Default value : undefined

Expansion panel title

Properties

Readonly buttonText
Default value : input('Export as CSV')

Text for export button

Readonly filename
Default value : undefined

Filename for export

Readonly panelTitle
Default value : undefined

Expansion panel title

Readonly tableData
Default value : input<TableData[]>(undefined)

Table data

import {LowerCasePipe} from '@angular/common';
import {Component, input} from '@angular/core';
import {
  MatExpansionPanel,
  MatExpansionPanelHeader,
  MatExpansionPanelTitle,
} from '@angular/material/expansion';
import {
  NshmpLibNgDataTableComponent,
  NshmpLibNgExportDataTableComponent,
  TableData,
} from '@ghsc/nshmp-lib-ng/nshmp';

/**
 * Expansion panel with data table and export.
 */
@Component({
  imports: [
    NshmpLibNgExportDataTableComponent,
    NshmpLibNgDataTableComponent,
    MatExpansionPanel,
    MatExpansionPanelHeader,
    MatExpansionPanelTitle,
    LowerCasePipe,
  ],
  selector: 'app-table-data-panel',
  styleUrl: './table-data-panel.component.scss',
  templateUrl: './table-data-panel.component.html',
})
export class TableDataPanelComponent {
  /** Text for export button */
  readonly buttonText = input('Export as CSV');

  /** Filename for export  */
  readonly filename = input<string>(undefined);

  /** Expansion panel title */
  readonly panelTitle = input<string>(undefined);

  /** Table data */
  readonly tableData = input<TableData[]>(undefined);
}
<mat-expansion-panel expanded>
  <mat-expansion-panel-header>
    <mat-panel-title>{{ panelTitle() }}</mat-panel-title>
  </mat-expansion-panel-header>

  <nshmp-lib-ng-export-data-table
    [table]="tableData()"
    [filename]="filename() | lowercase"
    [buttonText]="buttonText()"
  />

  <nshmp-lib-ng-data-table [table]="tableData()" />
</mat-expansion-panel>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""