import React, { ComponentPropsWithoutRef, ReactNode } from 'react'; import { MarginProps } from '../../helpers'; import { OffsetPaginationProps } from '../OffsetPagination'; import { StatelessPaginationProps } from '../StatelessPagination'; import { TableColumnDisplayProps } from './helpers'; export interface TableSelectable { selectedItems: Record; onSelectionChange(selectedItems: Record): void; isChildrenRowsSelectable?: boolean; initialSelectedParentRows?: string[]; } export interface LoadMoreAction { isLoading: boolean; onClick: (event: React.MouseEvent, parentRowIndex: number) => void; text: string; } type LoadMoreActionCallback = (parentRowId: string) => LoadMoreAction | undefined; export interface TableExpandable { expandedRows: Record; getChildren: (item: T) => T[] | undefined; onExpandedChange(expandedRows: Record, expandedRowId: string): void; getLoadMoreAction?: LoadMoreActionCallback; } export type TableSortDirection = 'ASC' | 'DESC'; export interface TableSortable { direction: TableSortDirection; columnHash?: string; onSort(columnHash: string, direction: TableSortDirection, column: TableColumn): void; } export interface TableItem { id?: string | number; [key: string]: any; } export interface TableColumn extends TableColumnDisplayProps { align?: 'left' | 'center' | 'right'; hash: string; header: string; tooltip?: string; hideHeader?: boolean; isSortable?: boolean; render: React.ComponentType | ((props: T & { children?: ReactNode; }, context?: any) => string | number); verticalAlign?: 'top' | 'middle'; width?: number | string; withPadding?: boolean; } type WithoutMarginProps = Omit; type StatelessPaginationPropsWithItemTotal = StatelessPaginationProps & { totalItems?: number; }; export type DiscriminatedTablePaginationProps = (WithoutMarginProps & { type: 'offset'; }) | (WithoutMarginProps & { type: 'stateless'; }); export type TablePaginationProps = WithoutMarginProps | WithoutMarginProps; interface Localization { ascendingOrder: string; descendingOrder: string; } export interface TableProps extends ComponentPropsWithoutRef<'table'> { actions?: React.ReactNode; columns: Array>; emptyComponent?: React.ReactElement; expandable?: TableExpandable; headerless?: boolean; itemName?: string; items: T[]; keyField?: string; localization?: Localization; onRowDrop?(from: number, to: number): void; pagination?: TablePaginationProps; selectable?: TableSelectable; sortable?: TableSortable; stickyHeader?: boolean; getRowId?: (item: T, parentRowIndex: number, childRowIndex?: number) => string; } export {}; //# sourceMappingURL=types.d.ts.map