import { type CSSProperties, type ReactNode } from "react"; import type { ColumnGroupProps } from "./ColumnGroup"; import type { CellValidationState, GridColumnInfo } from "./GridColumn"; export type ColumnSeparatorType = "regular" | "none" | "groupEdge" | "pinned"; export type ColumnGroupRowSeparatorType = "first" | "regular" | "last"; export type ColumnGroupColumnSeparatorType = "regular" | "none" | "pinned"; export type GridRowSelectionMode = "single" | "multi" | "none"; export type GridCellSelectionMode = "range" | "none"; export declare enum SortOrder { ASC = "asc", DESC = "desc", NONE = "none" } export type RowKeyGetter = (row: T, index: number) => string; export type GridColumnMoveHandler = (columnId: string, fromIndex: number, toIndex: number) => void; export interface GridProps { /** * At least 1 children is expected, options are `ColumnGroup` or `GridColumn`. * */ 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. `(row: T, index: number) => string` * */ 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; /** * Accepts `(columnId: string, fromIndex: number, toIndex: number) => void` * */ onColumnMoved?: GridColumnMoveHandler; /** * Options are `range` and `none`. * */ cellSelectionMode?: GridCellSelectionMode; onVisibleRowRangeChange?: (start: number, end: number) => void; /** * If `true`, keyboard navigation is enabled for the header. * */ headerIsFocusable?: boolean; getRowValidationStatus?: (row: GridRowModel) => CellValidationState | undefined; } 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) => import("react/jsx-runtime").JSX.Element;