@siemens/ngx-datatable
Version:
ngx-datatable is an Angular table grid component for presenting large and complex data.
205 lines (204 loc) • 11 kB
TypeScript
import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit, TemplateRef, TrackByFunction } from '@angular/core';
import { ColumnGroupWidth, TableColumnInternal } from '../../types/internal.types';
import { ActivateEvent, DragEventData, Group, Row, RowOrGroup, ScrollEvent, SelectEvent, SelectionType } from '../../types/public.types';
import { RowHeightCache } from '../../utils/row-height-cache';
import { DatatableRowDetailDirective } from '../row-detail/row-detail.directive';
import { DatatableGroupHeaderDirective } from './body-group-header.directive';
import { DataTableBodyRowComponent } from './body-row.component';
import { ScrollerComponent } from './scroller.component';
import * as i0 from "@angular/core";
export declare class DataTableBodyComponent<TRow extends Row = any> implements OnInit, OnDestroy {
cd: ChangeDetectorRef;
rowDefTemplate?: TemplateRef<any>;
scrollbarV?: boolean;
scrollbarH?: boolean;
loadingIndicator?: boolean;
ghostLoadingIndicator?: boolean;
externalPaging?: boolean;
rowHeight: number | 'auto' | ((row?: any) => number);
offsetX: number;
selectionType?: SelectionType;
selected: any[];
rowIdentity: (x: RowOrGroup<TRow>) => unknown;
rowDetail?: DatatableRowDetailDirective;
groupHeader?: DatatableGroupHeaderDirective;
selectCheck?: (value: TRow, index: number, array: TRow[]) => boolean;
displayCheck?: (row: TRow, column: TableColumnInternal, value?: any) => boolean;
trackByProp?: string;
rowClass?: (row: TRow) => string | Record<string, boolean>;
groupedRows?: Group<TRow>[];
groupExpansionDefault?: boolean;
innerWidth: number;
groupRowsBy?: keyof TRow;
virtualization?: boolean;
summaryRow?: boolean;
summaryPosition: string;
summaryHeight: number;
rowDraggable?: boolean;
rowDragEvents: EventEmitter<DragEventData>;
disableRowCheck?: (row: TRow) => boolean | undefined;
ariaGroupHeaderCheckboxMessage: string;
set pageSize(val: number);
get pageSize(): number;
set rows(val: (TRow | undefined)[]);
get rows(): (TRow | undefined)[];
set columns(val: TableColumnInternal[]);
get columns(): any[];
set offset(val: number);
get offset(): number;
set rowCount(val: number);
get rowCount(): number;
get bodyWidth(): string;
set bodyHeight(val: number | string);
get bodyHeight(): number | string;
verticalScrollVisible: boolean;
ariaRowCheckboxMessage: string;
readonly scroll: EventEmitter<ScrollEvent>;
readonly page: EventEmitter<number>;
readonly activate: EventEmitter<ActivateEvent<TRow>>;
readonly select: EventEmitter<SelectEvent<TRow>>;
readonly rowContextmenu: EventEmitter<{
event: MouseEvent;
row: RowOrGroup<TRow>;
}>;
readonly treeAction: EventEmitter<{
row: TRow;
}>;
scroller: ScrollerComponent;
/**
* Returns if selection is enabled.
*/
get selectEnabled(): boolean;
/**
* Property that would calculate the height of scroll bar
* based on the row heights cache for virtual scroll and virtualization. Other scenarios
* calculate scroll height automatically (as height will be undefined).
*/
readonly scrollHeight: import("@angular/core").Signal<number | undefined>;
readonly rowsToRender: import("@angular/core").Signal<(RowOrGroup<TRow> | undefined)[]>;
readonly rowHeightsCache: import("@angular/core").WritableSignal<RowHeightCache>;
offsetY: number;
readonly indexes: import("@angular/core").WritableSignal<{
first: number;
last: number;
}>;
columnGroupWidths: ColumnGroupWidth;
rowTrackingFn: TrackByFunction<RowOrGroup<TRow> | undefined>;
listener: any;
rowExpansions: any[];
_rows: (TRow | undefined)[];
_bodyHeight: string;
_columns: TableColumnInternal[];
_rowCount: number;
_offset: number;
_pageSize: number;
_offsetEvent: number;
private _draggedRow?;
private _draggedRowElement?;
/**
* Creates an instance of DataTableBodyComponent.
*/
constructor();
/**
* Called after the constructor, initializing input properties
*/
ngOnInit(): void;
private toggleStateChange;
/**
* Called once, before the instance is destroyed.
*/
ngOnDestroy(): void;
/**
* Updates the Y offset given a new offset.
*/
updateOffsetY(offset?: number): void;
/**
* Body was scrolled, this is mainly useful for
* when a user is server-side pagination via virtual scroll.
*/
onBodyScroll(event: any): void;
/**
* Updates the page given a direction.
*/
updatePage(direction: string): void;
/**
* Updates the rows in the view port
*/
updateRows(): (RowOrGroup<TRow> | undefined)[];
/**
* Get the row height
*/
getRowHeight(row: RowOrGroup<TRow>): number;
/**
* @param group the group with all rows
*/
getGroupHeight(group: Group<TRow>): number;
/**
* Calculate row height based on the expanded state of the row.
*/
getRowAndDetailHeight(row: TRow): number;
/**
* Get the height of the detail row.
*/
getDetailRowHeight: (row?: TRow, index?: number) => number;
getGroupHeaderRowHeight: (row?: any, index?: any) => number;
/**
* Calculates the offset of the rendered rows.
* As virtual rows are not shown, we have to move all rendered rows
* by the total size of previous non-rendered rows.
* If each row has a size of 10px and the first 10 rows are not rendered due to scroll,
* then we have a renderOffset of 100px.
*/
readonly renderOffset: import("@angular/core").Signal<string>;
/**
* Updates the index of the rows in the viewport
*/
updateIndexes(): void;
/**
* Refreshes the full Row Height cache. Should be used
* when the entire row array state has changed.
*/
refreshRowHeightCache(): void;
/**
* Toggle the Expansion of the row i.e. if the row is expanded then it will
* collapse and vice versa. Note that the expanded status is stored as
* a part of the row object itself as we have to preserve the expanded row
* status in case of sorting and filtering of the row set.
*/
toggleRowExpansion(row: TRow): void;
/**
* Expand/Collapse all the rows no matter what their state is.
*/
toggleAllRows(expanded: boolean): void;
/**
* Recalculates the table
*/
recalcLayout(): void;
/**
* Returns if the row was expanded and set default row expansion when row expansion is empty
*/
getRowExpanded(row: RowOrGroup<TRow>): boolean;
getRowExpandedIdx(row: RowOrGroup<TRow>, expanded: RowOrGroup<TRow>[]): number;
onTreeAction(row: TRow): void;
dragOver(event: DragEvent, dropRow: RowOrGroup<TRow>): void;
drag(event: DragEvent, dragRow: RowOrGroup<TRow>, rowComponent: DataTableBodyRowComponent<TRow>): void;
drop(event: DragEvent, dropRow: RowOrGroup<TRow>, rowComponent: DataTableBodyRowComponent<TRow>): void;
dragEnter(event: DragEvent, dropRow: RowOrGroup<TRow>, rowComponent: DataTableBodyRowComponent<TRow>): void;
dragLeave(event: DragEvent, dropRow: RowOrGroup<TRow>, rowComponent: DataTableBodyRowComponent<TRow>): void;
dragEnd(event: DragEvent, dragRow: RowOrGroup<TRow>): void;
updateColumnGroupWidths(): void;
prevIndex?: number;
selectRow(event: Event, index: number, row: TRow): void;
onActivate(model: ActivateEvent<TRow>, index: number): void;
onKeyboardFocus(model: ActivateEvent<TRow>): void;
focusRow(rowElement: HTMLElement, key: string): void;
getPrevNextRow(rowElement: HTMLElement, key: string): any;
focusCell(cellElement: HTMLElement, rowElement: HTMLElement, key: string, cellIndex: number): void;
getRowSelected(row: TRow): boolean;
getRowSelectedIdx(row: TRow, selected: any[]): number;
protected isGroup(row: RowOrGroup<TRow>[]): row is Group<TRow>[];
protected isGroup(row: RowOrGroup<TRow>): row is Group<TRow>;
protected isRow(row: RowOrGroup<TRow> | undefined): row is TRow;
static ɵfac: i0.ɵɵFactoryDeclaration<DataTableBodyComponent<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DataTableBodyComponent<any>, "datatable-body", never, { "rowDefTemplate": { "alias": "rowDefTemplate"; "required": false; }; "scrollbarV": { "alias": "scrollbarV"; "required": false; }; "scrollbarH": { "alias": "scrollbarH"; "required": false; }; "loadingIndicator": { "alias": "loadingIndicator"; "required": false; }; "ghostLoadingIndicator": { "alias": "ghostLoadingIndicator"; "required": false; }; "externalPaging": { "alias": "externalPaging"; "required": false; }; "rowHeight": { "alias": "rowHeight"; "required": false; }; "offsetX": { "alias": "offsetX"; "required": false; }; "selectionType": { "alias": "selectionType"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "rowIdentity": { "alias": "rowIdentity"; "required": false; }; "rowDetail": { "alias": "rowDetail"; "required": false; }; "groupHeader": { "alias": "groupHeader"; "required": false; }; "selectCheck": { "alias": "selectCheck"; "required": false; }; "displayCheck": { "alias": "displayCheck"; "required": false; }; "trackByProp": { "alias": "trackByProp"; "required": false; }; "rowClass": { "alias": "rowClass"; "required": false; }; "groupedRows": { "alias": "groupedRows"; "required": false; }; "groupExpansionDefault": { "alias": "groupExpansionDefault"; "required": false; }; "innerWidth": { "alias": "innerWidth"; "required": false; }; "groupRowsBy": { "alias": "groupRowsBy"; "required": false; }; "virtualization": { "alias": "virtualization"; "required": false; }; "summaryRow": { "alias": "summaryRow"; "required": false; }; "summaryPosition": { "alias": "summaryPosition"; "required": false; }; "summaryHeight": { "alias": "summaryHeight"; "required": false; }; "rowDraggable": { "alias": "rowDraggable"; "required": false; }; "rowDragEvents": { "alias": "rowDragEvents"; "required": false; }; "disableRowCheck": { "alias": "disableRowCheck"; "required": false; }; "ariaGroupHeaderCheckboxMessage": { "alias": "ariaGroupHeaderCheckboxMessage"; "required": true; }; "pageSize": { "alias": "pageSize"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "offset": { "alias": "offset"; "required": false; }; "rowCount": { "alias": "rowCount"; "required": false; }; "bodyHeight": { "alias": "bodyHeight"; "required": false; }; "verticalScrollVisible": { "alias": "verticalScrollVisible"; "required": false; }; "ariaRowCheckboxMessage": { "alias": "ariaRowCheckboxMessage"; "required": true; }; }, { "scroll": "scroll"; "page": "page"; "activate": "activate"; "select": "select"; "rowContextmenu": "rowContextmenu"; "treeAction": "treeAction"; }, never, ["[loading-indicator]", "[empty-content]"], true, never>;
}