import { Directionality } from '@angular/cdk/bidi'; import { Platform } from '@angular/cdk/platform'; import { ViewportRuler } from '@angular/cdk/scrolling'; import { CdkTable } from '@angular/cdk/table'; import { AfterContentChecked, AfterContentInit, AfterViewChecked, ChangeDetectorRef, ElementRef, EventEmitter, IterableDiffers, NgZone, OnDestroy, OnInit, QueryList, Renderer2 } from '@angular/core'; import { TsWindowService } from '@terminus/ngx-tools/browser'; import { Observable } from 'rxjs'; import { TsHeaderCellDirective } from './cell'; import { TsRowComponent } from './row'; /** * The definition for a single column */ export interface TsColumn { name: string; width: number; [key: string]: any; } /** * The possible table density settings */ export declare type TsTableDensity = 'comfy' | 'compact'; /** * The payload for a columns change event */ export declare class TsTableColumnsChangeEvent { table: TsTableComponent; columns: TsColumn[]; constructor(table: TsTableComponent, columns: TsColumn[]); } /** * The primary data table implementation * * @example * * * * Title * * * {{ item.title }} * * * * * * ID * * * {{ item.id }}, * * * * * * * * https://getterminus.github.io/ui-demos-release/components/table */ export declare class TsTableComponent extends CdkTable implements OnInit, AfterViewChecked, AfterContentInit, AfterContentChecked, OnDestroy { protected platform: Platform; protected renderer: Renderer2; protected readonly differs: IterableDiffers; protected readonly changeDetectorRef: ChangeDetectorRef; document: any; protected readonly dir: Directionality; readonly elementRef: ElementRef; private ngZone; private windowService; private viewportRuler; /** * Combined stream of all of the columns resized events */ readonly columnResizeChanges$: Observable; /** * Create a debounced function to update CDK sticky styles */ debouncedStickyColumnUpdate: Function; /** * Store the header cell subscription */ private headerCellSubscription; /** * Store a mutable array of internal column definitions */ private columnsInternal; /** * Override the sticky CSS class set by the `CdkTable` */ protected stickyCssClass: string; /** * Store the stream of viewport changes */ private viewportChange$; /** * Define the default component ID */ readonly uid: string; /** * Return a simple array of column names * * Used by {@link TsHeaderRowDefDirective} and {@link TsRowDefDirective}. */ get columnNames(): string[]; /** * Build array of columns to emit out to the consumer */ get columnsToSendToConsumer(): TsColumn[]; /** * Return the width of the element wrapping the table */ get containerWidth(): number; /** * Determine if the container around the table has overflow (ie the table is scrollable) */ get hasOverflowX(): boolean; /** * Return the parent HTMLElement */ private get parentElement(); /** * Determine the remaining space in the table after the columns take up their needed width */ private get remainingTableSpace(); /** * Return the width of the table */ private get tableWidth(); /** * Return the total width of all visible columns */ private get totalWidthOfColumns(); /** * Access header cells */ headerCells: QueryList; /** * Access child rows */ rows: QueryList; /** * Define the array of columns * * @param value */ set columns(value: ReadonlyArray); get columns(): ReadonlyArray; private _columns; /** * Define the density of the cells */ density: TsTableDensity; /** * Define a custom ID * * @param value */ set id(value: string); get id(): string; private _id; /** * Emit when a column is resized * * NOTE: This output is not debounce or throttled and may be called repeatedly */ readonly columnsChange: EventEmitter; constructor(platform: Platform, renderer: Renderer2, differs: IterableDiffers, changeDetectorRef: ChangeDetectorRef, role: string, document: any, dir: Directionality, elementRef: ElementRef, ngZone: NgZone, windowService: TsWindowService, viewportRuler: ViewportRuler); /** * Subscribe to viewport changes */ ngOnInit(): void; /** * Set up header cell changes subscription */ ngAfterViewChecked(): void; /** * Subscribe to column resize events */ ngAfterContentInit(): void; /** * NOTE: Must be present for `untilComponentDestroyed` */ ngOnDestroy(): void; /** * Adjusts the last column of the array to fill any remaining space inside the table * * NOTE: Due to issues during testing, we have not made this function static. * * @param columns - The array of columns to adjust * @param remainingWidth - The remaining table width to be added to the last column * @returns The adjusted array of columns */ private addRemainingSpaceToLastColumn; /** * Return a fresh clone of the passed in array of columns * * @param columns - The array of columns to clone * @returns The array of fresh columns */ private getFreshColumnsCopy; /** * Set the column widths for all columns passed in * * @param columns - The array of columns */ private setAllColumnsToDefinedWidths; /** * Set the width for a specific column * * @param columnName - The name of the column that needs it's width updated * @param width - The width to set * @param updateStickCells - Whether the sticky cells should be updated */ private setColumnWidthStyle; /** * Set up subscription to header cell changes */ private subscribeToHeaderCellChanges; /** * Update the internal columns array and set widths * * @param columns - The array of columns to update */ private updateInternalColumns; /** * Update the last column's width and update the internal columns */ private updateLastColumnWidth; /** * Trigger an update on sticky cells if they exist */ private updateStickyCellsIfNeeded; }