export type DataTableAlignOptions = 'left' | 'center' | 'right'; export type DataTableVerticalAlignOptions = 'top' | 'middle' | 'bottom'; export type DataTableColumnClass = unknown | (() => unknown); export type DataTableColumnStyle = unknown | (() => unknown); export type DataTableSortingOrder = 'asc' | 'desc' | null; export type DataTableSortingOptions = DataTableSortingOrder[]; export type DataTableColumn = { [key: string]: any; key: Key; name?: string; label?: string; thTitle?: string; sortable?: boolean; sortingFn?: (a: any, b: any) => number; displayFormatFn?: (data: any) => any; sortingOptions?: DataTableSortingOptions; thAlign?: DataTableAlignOptions; thVerticalAlign?: DataTableVerticalAlignOptions; tdAlign?: DataTableAlignOptions; tdVerticalAlign?: DataTableVerticalAlignOptions; width?: string | number; thClass?: DataTableColumnClass; tdClass?: DataTableColumnClass; thStyle?: DataTableColumnStyle; tdStyle?: DataTableColumnStyle; /** @deprecated use `thTitle` instead */ headerTitle?: string; /** @deprecated use `thAlign` instead */ alignHead?: DataTableAlignOptions; /** @deprecated use `thVerticalAlign` instead */ verticalAlignHead?: DataTableVerticalAlignOptions; /** @deprecated use `tdAlign` instead */ align?: DataTableAlignOptions; /** @deprecated use `tdVerticalAlign` instead */ verticalAlign?: DataTableVerticalAlignOptions; /** @deprecated use `tdClass` instead */ classes?: DataTableColumnClass; /** @deprecated use `thClass` instead */ headerClasses?: DataTableColumnClass; /** @deprecated use `tdStyle` instead */ style?: DataTableColumnStyle; /** @deprecated use `thStyle` instead */ headerStyle?: DataTableColumnStyle; }; export type DataTableColumnSource = DataTableColumn | Key; export interface DataTableColumnInternal { [key: string]: any; source: DataTableColumnSource; initialIndex: number; key: string; name: string; label: string; thTitle: string; sortable: boolean; sortingFn: ((a: any, b: any) => number) | undefined; displayFormatFn: ((data: any) => any) | undefined; sortingOptions: DataTableSortingOptions; thAlign: DataTableAlignOptions; thVerticalAlign: DataTableVerticalAlignOptions; tdAlign: DataTableAlignOptions; tdVerticalAlign: DataTableVerticalAlignOptions; width?: string | number; tdClass?: DataTableColumnClass; thClass?: DataTableColumnClass; tdStyle?: DataTableColumnStyle; thStyle?: DataTableColumnStyle; } export type DataTableItem> = T; export type DataTableItemKey = any; export type DataTableRowData> = Item; export interface DataTableCell { rowIndex: number; rowKey: DataTableItemKey; rowData: DataTableRowData; column: DataTableColumnInternal; source: string; value: string; } export interface DataTableRow { initialIndex: number; itemKey: DataTableItemKey; source: Item; cells: DataTableCell[]; /** Same rowData as in DataTableCell */ rowData: DataTableRowData; toggleRowDetails: (show?: boolean) => void; isExpandableRowVisible: boolean; } export type DataTableFilterMethod = (source: any, cell: DataTableCell) => boolean; export type DataTableSelectMode = 'single' | 'multiple'; export type DataTableRowBind = Record | ((item: DataTableItem, index: number) => Record); export type DataTableCellBind = Record | ((cell: any, row: DataTableItem, column: DataTableColumnInternal, index: number) => Record);