import { CSSProperties, ReactNode } from "react"; import { GridColumnInfo } from "./GridColumn"; import "./Grid.css"; import { ColumnGroupProps } from "./ColumnGroup"; export declare type ColumnSeparatorType = "regular" | "none" | "groupEdge" | "pinned"; export declare type ColumnGroupRowSeparatorType = "first" | "regular" | "last"; export declare type ColumnGroupColumnSeparatorType = "regular" | "none" | "pinned"; export declare type GridRowSelectionMode = "single" | "multi" | "none"; export declare type GridCellSelectionMode = "range" | "none"; export declare type RowKeyGetter = (row: T, index: number) => string; export declare type GridColumnMoveHandler = (columnId: string, fromIndex: number, toIndex: number) => void; export interface GridProps { children: ReactNode; /** * If `true`, zebra stripes are enabled (odd/even rows have alternate colours) * */ zebra?: boolean; /** * If `true`, grid header is hidden. * */ hideHeader?: boolean; /** * If `true`, column separators are rendered. * */ columnSeparators?: boolean; /** * If `true`, separators are rendered between pinned and unpinned columns. * */ pinnedSeparators?: boolean; /** * Row data objects. Sparse arrays are supported. * */ rowData: T[]; /** * Should return unique string for a given row data object. * If rowData is sparse then this function should work with undefined row data * objects and create keys based on row index. * */ rowKeyGetter?: RowKeyGetter; /** * Rows with these indices are selected by default. * */ defaultSelectedRowIdxs?: number[]; /** * Selected row indices for controlled mode. * */ selectedRowIdxs?: number[]; className?: string; style?: CSSProperties; /** * The variant to use. Options are `primary` and `secondary`. Default value is * `primary`. `secondary` variant changes grid background to reduce contrast. * */ variant?: "primary" | "secondary"; /** * Options are `single`, `multi` and `none`. * */ rowSelectionMode?: GridRowSelectionMode; onRowSelected?: (selectedRowIdxs: number[]) => void; /** * If `true`, user will be able to move columns using drag and drop. * */ columnMove?: boolean; onColumnMoved?: GridColumnMoveHandler; /** * Options are `range` and `none`. * */ cellSelectionMode?: GridCellSelectionMode; onVisibleRowRangeChange?: (start: number, end: number) => void; } export interface GridRowModel { key: string; index: number; data: T; } export interface GridColumnModel { index: number; separator: ColumnSeparatorType; info: GridColumnInfo; } export interface GridColumnGroupModel { index: number; data: ColumnGroupProps; childrenIds: string[]; rowSeparator: ColumnGroupRowSeparatorType; columnSeparator: ColumnGroupColumnSeparatorType; colSpan: number; } export declare const Grid: (props: GridProps) => JSX.Element;