import { CdkVirtualScrollViewport, ViewportRuler } from '@angular/cdk/scrolling'; import { AfterViewInit, ElementRef, OnDestroy, OnInit, TemplateRef, TrackByFunction } from '@angular/core'; import { LfI18n, LfRouter, LfStorage, PathBased } from '@lightweightform/core'; import { Identifier, ListSchema, TableSchema } from '@lightweightform/storage'; import { ScrollbarUtils, TableHeaderDirective } from '@lightweightform/theme-common'; import { InlineValue } from '../../abstract/inline-value'; import { ActionsMenuAction } from '../actions-menu/actions-menu.component'; import * as i0 from "@angular/core"; /** * Width of the selection column (in `px`). */ export declare const SELECTION_COLUMN_WIDTH = 25.6; /** * LF table component. * * Example usage: * ```html * * * * * * * * * * * * * * ``` */ export declare class TableComponent extends InlineValue implements OnInit, AfterViewInit, OnDestroy { private scrollbarUtils; private viewportRuler; /** * Height (in `px`) of a single row (virtual scroll settings). All rows must * have the same height. */ rowHeight: number; /** * Maximum number of visible rows at any given time. */ maxVisibleRows: number; /** * Size of the virtual scroll's template cache * (`cdkVirtualForTemplateCacheSize` input of Angular CDK's virtual for * directive). */ virtualScrollTemplateCacheSize: number; /** * Whether to allow addition of new rows. */ allowRowAddition: boolean; /** * Whether to allow removal of rows. */ allowRowRemoval: boolean; _tableHeader: TableHeaderDirective; _rowTemplate: TemplateRef; _noRowsTemplate: TemplateRef; _scrollableHeader?: ElementRef; _scrollableBody?: CdkVirtualScrollViewport; private hasHorizontalOverflow; private selectedRows; private lastSelectedId; private lastScrollPosition; private disposeObserveScrollables; private scrollSubscription; private disposeObservePath; private disposeObserveValue; private disposeObserveBodyHeight; private viewportSubscription; constructor(parentPathBasedComponent: PathBased | null, lfStorage: LfStorage, lfI18n: LfI18n, lfRouter: LfRouter | null, scrollbarUtils: ScrollbarUtils, viewportRuler: ViewportRuler); get _addRowText(): string; get _removeRowsText(): string; get _noRowsText(): string; get _columnLabels(): string[]; /** * Schema of this table's value. */ get _schema(): ListSchema | TableSchema; /** * Table's value. */ get _value(): any[]; /** * Whether to show the "is required" icon on the component. */ get _showIsRequired(): boolean; /** * Table actions. */ get _tableActions(): ActionsMenuAction[]; /** * Height (in px) that the scrollable body element should have. */ get _scrollableBodyHeight(): number; /** * Whether new rows can be added to the table (takes into consideration if the * table is in "read only" mode). */ get allowsRowAddition(): boolean; /** * Whether rows can be removed from the table (takes into consideration if the * table is in "read only" mode). */ get allowsRowRemoval(): boolean; /** * Number of rows that have been selected. */ get numberOfRowsSelected(): number; /** * Whether all rows are selected. */ get allRowsSelected(): boolean; /** * Whether no rows are selected. */ get noRowsSelected(): boolean; /** * Track either by index or reference, depending on the type of value for list * schemas; or by row id, when dealing with table schemas. */ get _trackBy(): TrackByFunction; /** * Width (in px) of the vertical scroll bar, when existent (`0` otherwise). */ private get verticalScrollbarWidth(); /** * Height (in px) of the horizontal scroll bar, when existent (`0` otherwise). */ private get horizontalScrollbarHeight(); ngAfterViewInit(): void; ngOnDestroy(): void; _columnLabel(columnId: string): string; /** * Minimum width (in px) that the table should have. * @param includeScrollbarColumn Whether the scrollbar column should be * included in the computation (should be set to `true` for the header table). * @returns Minimum width that the table should have. */ _tableMinWidth(includeScrollbarColumn: boolean): number; /** * Maximum width (in px) that the table should have. * @param includeScrollbarColumn Whether the scrollbar column should be * included in the computation (should be set to `true` for the header table). * @returns Maximum width that the table should have. */ _tableMaxWidth(includeScrollbarColumn: boolean): number; /** * Widths (as strings with correct units) of each column of the table. * @param includeScrollbarColumn Whether the scrollbar column should be * included (should be set to `true` for the header table). * @returns Widths of each column of the table. */ _columnWidths(includeScrollbarColumn: boolean): string[]; /** * Adds a new row to the table. */ addNewRow(): void; /** * Gets the selection status of the row with the provided id. * @param id Id of the row for which to check selection status. * @returns Whether the row with the provided id is selected. */ getRowSelectedStatus(id: Identifier): boolean; /** * Sets the selection status of the row with the provided id. * @param id Id of the row on which to set selection status. * @param selectedStatus `true` to set selected, `false` to set unselected. */ setRowSelectedStatus(id: Identifier, selectedStatus: boolean): void; /** * Sets the selection status of all rows from the last row that has had its * selection status set to the row with the provided id. * @param id Id of the row until which to set selection status. * @param selectedStatus `true` to set selected, `false` to set unselected. */ setRowSelectedStatusFromLastSelected(id: Identifier, selectedStatus: boolean): void; /** * Unselects all rows. */ unselectAllRows(): void; /** * Sets the selection status of all rows. * @param selectedStatus `true` to set selected, `false` to set unselected. */ setAllRowsSelectedStatus(selectedStatus: boolean): void; /** * Toggles the status of all rows (if they are all selected, then they all * become unselected, otherwise they all become selected). */ toggleAllRowsSelectedStatus(): void; /** * Removes all selected rows. */ removeSelectedRows(): void; /** * Scrolls to the row with the provided id. * @param id Identifier of the row to scroll to. */ scrollToId(id: Identifier): void; /** * Scrolls to row with the provided index. * @param index Index of the row to scroll to. */ scrollToIndex(index: number): void; /** * Identifier of the given element with the given index. * @param el Element for which to get identifier. * @param index Index of the element in the value. * @returns Identifier for the given element at the given index. */ _id(el: any, index: number): Identifier; /** * Action to run when the "remove rows" button is clicked. */ _onClickRemoveRows(): void; /** * Action to run when the "new row" button is clicked. */ _onClickNewRow(): void; protected validatePath(): void; protected onActivate(activatedPath: string): void; /** * State property name used to save the position of the scroll within the * table. * @param path Path of table. * @returns State property name. */ private scrollPositionStatePropName; /** * Update the status of the "horizontal overflow". */ private checkHasHorizontalOverflow; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }