import { OnChanges, OnDestroy, SimpleChanges, OnInit } from '@angular/core'; import { DataVariable } from '@dvl-fw/core'; import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import { ActionDispatcherService } from '../../shared/services/actionDispatcher/action-dispatcher.service'; import { DataVariableHoverService } from '../../shared/services/hover/data-variable-hover.service'; import { DataService, DataSource } from '../shared/data.service'; import { ExportTableService } from '../shared/export-table.service'; /** * A component for displaying a paginated, collapsible table with a label, description, and zero or more sub-tables. */ export declare class TableComponent implements OnInit, OnChanges, OnDestroy { private actionDispatcherService; private dataService; private exportService; private hoverService; /** * Table data */ dataSource: DataSource; /** * Columns to display */ displayedColumns: DataVariable[]; /** * Vertical index of the table starting from the top */ tableIndex: number; /** * The current page of data to load */ pageIndex: number; /** * Number of rows per table page */ readonly pageSize = 3; /** * Subject for sending page updates */ private pageDataChange; /** * Page-sized data to display */ readonly pageData$: Observable; /** * The raw data to be paginated */ private rawData; /** * Gets column names as strings */ get columnNames(): string[]; /** * Gets the Obvervable that returns rows of data */ get data$(): Observable; /** * Gets the table's description */ get description(): string; /** * Gets the table's label */ get label(): string; /** * Gets number of rows of data */ get numberOfRows(): number; /** * Whether hovering over a table header has any effect */ hoverEnabled: boolean; /** * Contains all columns that can be hovered over */ private hoverableColumnIds; /** * The record set that can be hovered over */ private hoverableRecordSetId; /** * Data subscription */ private dataSubscription; /** * An array of all subscriptions that needs to be cleaned up during destroy */ private subscriptions; /** * Creates an instance of table component * * @param store The ngrx store * @param actionDispatcherService The service for emitting toggle events * @param dataService The service for emitting data changes * @param exportService The service used to save data as csv * @param hoverService The service for emitting hover events */ constructor(store: Store, actionDispatcherService: ActionDispatcherService, dataService: DataService, exportService: ExportTableService, hoverService: DataVariableHoverService); /** * Angular's OnInit lifecycle hook */ ngOnInit(): void; /** * Angular's OnChanges lifecycle hook. * Detects updates to `dataSource`. * * @param changes The changed values */ ngOnChanges(changes: SimpleChanges): void; /** * Angular's OnDestroy lifecycle hook. * Cleans up all subscriptions. */ ngOnDestroy(): void; /** * Updates data */ updateData(): void; /** * Set the current page index and send it to `pageDataChange` listeners * * @param pageIndex the page to send (or the current page) */ sendPage(pageIndex?: number): void; /** * Determines whether the table is hidden * * @returns True if the table should be hidden, else false */ isHidden(): boolean; /** * Determines whether the table is the top level in a hierarchy * * @returns True if the table is not a child of another table, else false */ isFirst(): boolean; /** * Determines whether all sub-tables are hidden * * @returns True if all sub-table should be hidden, else false */ isChildrenHidden(): boolean; /** * Determines whether the table has any data rows * * @returns True if there exists at least one row of data, else false */ hasData(): boolean; /** * Determines whether the table rows are hidden * * @returns True if the table rows should be hidden, else false */ hasHiddenData(): boolean; /** * Determines whether the table has any sub-tables * * @returns True if there exists at least one sub-table, else false */ hasChildren(): boolean; /** * Gets the material expand more/less arrow icon string specifier/name * * @param more Which of the two icons to get * @returns The string corresponding to the icon */ getToggleIcon(more: boolean): string; /** * Toggles visibility of sub-tables on/off */ toggleChildTables(): void; /** * Toggles visibility of table rows on/off */ toggleRows(): void; /** * Determine if a specific column can be highlighted * * @param column The column to check * @returns True if the column allows highlighting, else false */ shouldHighlight({ id, recordSet: { id: rsId } }: DataVariable): boolean; /** * Emits a start hover event for a column * * @param column The column that is being hovered over */ startHover({ id, recordSet: { id: rsId } }: DataVariable): void; /** * Emits an end hover event for a column * * @param column The column that is no longer being hovered over */ endHover(_data: DataVariable): void; /** * Saves a table to a csv file * * @param source The data to save */ exportTable(source: DataSource): void; /** * Subscribes to hover events * * @returns The new subscription */ private subscribeToHoverEvents; /** * Subscribes to hover enabled events * * @param store The ngrx store * @returns The new subscription */ private subscribeToHoverEnabled; }