import * as React from 'react'; import type { AriaLabelingProps, QAProps } from "../types.js"; import "./Table.css"; export interface TableDataItem { [key: string]: any; } type ActiveScrollElementType = 'scrollBar' | 'scrollContainer'; interface TableState { activeScrollElement: ActiveScrollElementType; columnsStyles: React.CSSProperties[]; columnHeaderRefs: React.RefObject[]; } export interface TableColumnConfig { /** Column ID */ id: string; /** Column name (header). By default: column ID */ name?: string | (() => React.ReactNode); /** CSS-class that will be added to all cells in the column. */ className?: string; /** Stub in the event there is no data in a cell. By default: — (—) */ placeholder?: string | ((item: I, index: number) => React.ReactNode); /** Cell contents. If you pass a row, the cell contents will be the value of the field named the same as this row. By default: The value of the field with the name equal to the column ID */ template?: string | ((item: I, index: number) => React.ReactNode); /** Content alignment. */ align?: 'start' | 'end' | 'center' | 'left' | 'right'; /** Sticky column. */ sticky?: 'start' | 'end' | 'left' | 'right'; /** Distinguishes a column among other. */ primary?: boolean; /** Column width in px or in %. Width can behave unexpectedly (it's more like min-width in block-elements). Sometimes you want to use `table-layout: fixed` */ width?: number | string; /** Various data, HOC settings. */ meta?: Record; } export interface DescriptorType { /** * Row ID. * Used when selecting and sorting rows. */ id?: string; /** * Row CSS classes. */ classNames?: string[]; /** * Condition for disabling columns. */ disabled?: boolean; /** Show row hover */ interactive?: boolean; } export type TableWidth = 'auto' | 'max'; export interface TableProps extends AriaLabelingProps, QAProps { /** Data */ data: I[]; /** Column parameters */ columns: TableColumnConfig[]; /** Vertical alignment of contents */ verticalAlign?: 'top' | 'middle'; /** Break long text to lines instead of cutting with hellip */ wordWrap?: boolean; /** * Horizontal sticky scroll. * Note: table cannot be with fixed height and with sticky scroll at the same time. * Sticky scroll wont work if table has overflow. * @default false */ stickyHorizontalScroll?: boolean; /** * Threshold when sticky scroll is enabled. * @default 0 */ stickyHorizontalScrollBreakpoint?: number; /** * @deprecated Use getRowDescriptor instead * * Row ID. * Used when selecting and sorting rows. If you pass a row, * its ID will be the value of the field in the row data named the same as the column ID. */ getRowId?: string | ((item: I, index: number) => string); /** * @deprecated Use getRowDescriptor instead * * Row CSS classes. */ getRowClassNames?: (item: I, index: number) => string[]; /** * @deprecated Use getRowDescriptor instead * * Condition for disabling columns. */ isRowDisabled?: (item: I, index: number) => boolean; /** * * @returns {DescriptorType} {@link DescriptorType} */ getRowDescriptor?: (item: I, index: number) => DescriptorType | undefined; /** Row click handler. When passed row's hover is visible. */ onRowClick?: (item: I, index: number, event: React.MouseEvent) => void; /** Row mouseenter handler. */ onRowMouseEnter?: (item: I, index: number, event: React.MouseEvent) => void; /** Row mouseleave handler. */ onRowMouseLeave?: (item: I, index: number, event: React.MouseEvent) => void; /** Row mousedown handler. */ onRowMouseDown?: (item: I, index: number, event: React.MouseEvent) => void; /** Message returned if data is missing. By default: "No data". */ emptyMessage?: string; /** Table CSS-class. */ className?: string; /** Adds horizontal padding for edge cells. */ edgePadding?: boolean; width?: TableWidth; } interface TableDefaultProps { edgePadding: boolean; } export declare class Table> extends React.Component, TableState> { static defaultProps: TableDefaultProps; static getRowId(props: TableProps, item: I, rowIndex?: number): string; static getHeadCellContent(column: TableColumnConfig): React.ReactNode; static getBodyCellContent(column: TableColumnConfig, item: I, rowIndex: number): React.ReactNode; static getDerivedStateFromProps(props: Readonly>, state: Readonly): Partial | null; state: TableState; private tableRef; private scrollContainerRef; private horizontalScrollBarRef; private horizontalScrollBarInnerRef; private tableResizeObserver; private columnsResizeObserver; componentDidMount(): void; componentDidUpdate(prevProps: TableProps): void; componentWillUnmount(): void; render(): import("react/jsx-runtime").JSX.Element; private renderHead; private renderBody; private renderTable; private renderRow; private renderEmptyRow; private renderHorizontalScrollBar; private updateColumnStyles; private getColumnStyles; private handleScrollContainerMouseenter; private handleScrollContainerScroll; private handleHorizontalScrollBarMouseenter; private handleHorizontalScrollBarScroll; } export {};