import { ComponentType, CSSProperties, KeyboardEvent, ReactNode } from "react"; import { GridColumnModel, GridRowModel } from "./Grid"; import { HeaderCellProps } from "./HeaderCell"; export declare type GridColumnPin = "left" | "right" | null; export interface GridCellProps { row: GridRowModel; column: GridColumnModel; className?: string; style?: CSSProperties; isFocused?: boolean; isSelected?: boolean; isEditable?: boolean; children?: ReactNode; } export interface GridCellValueProps { row: GridRowModel; column: GridColumnModel; isFocused?: boolean; value?: U; } export interface GridHeaderValueProps { column: GridColumnModel; } export interface GridEditorProps { row: GridRowModel; column: GridColumnModel; } export interface GridColumnProps { /** * Unique identifier of the column. * */ id: string; /** * Name is displayed on the column header by default. * */ name?: string; /** * Default width of the column. * */ defaultWidth?: number; /** * Callback invoked when the user resizes the column. * */ onWidthChanged?: (width: number) => void; /** * Whether the column should be pinned `left` or `right`. By default columns * are unpinned. * */ pinned?: GridColumnPin; /** * Text align for the header and cells. * */ align?: "left" | "right"; /** * Component to render for every cell in the column. Useful when major * customization is needed. Use this only if `cellValueComponent` is not * sufficient. Default implementation of cell component takes care of * selection, hover, focus and other basic grid features. * */ cellComponent?: ComponentType>; /** * Component to render inside every cell. This is the preferred way of * customizing grid cells. * */ cellValueComponent?: ComponentType>; /** * Cell value getter. Should return the value to be displayed in the cell * for the given row data item. * */ getValue?: (rowData: T) => any; /** * CSS class to be applied to the column header. * Useful for minor customizations * */ headerClassName?: string; /** * Custom header component. Use this when `headerValueComponent` doesn't * provide enough flexibility. * */ headerComponent?: ComponentType>; /** * Renders the content of the column header. This is the preferred way of * customizing column headers. * */ headerValueComponent?: ComponentType>; /** * A callback to be invoked when the user modifies a cell value. * */ onChange?: (row: T, rowIndex: number, value: string) => void; /** * A callback to be invoked on key down when the focus is in this column. */ onKeyDown?: (event: KeyboardEvent, rowIndex: number) => void; children?: ReactNode; } export interface GridColumnInfo { width: number; onWidthChanged: (width: number) => void; props: GridColumnProps; } export declare const GridColumn: (props: GridColumnProps) => JSX.Element;