import React from 'react'; import { CalculatedColumn, CheckCellIsEditableEvent, Column, Filters, FormatterProps, Position, RowRendererProps, RowsUpdateEvent } from './types'; import { CellNavigationMode, SortDirection } from './enums'; export interface DataGridHandle { scrollToColumn: (colIdx: number) => void; scrollToRow: (rowIdx: number) => void; selectCell: (position: Position, openEditor?: boolean) => void; } declare type SharedDivProps = Pick, 'aria-label' | 'aria-labelledby' | 'aria-describedby'>; export interface DataGridProps extends SharedDivProps { /** * Grid and data Props */ /** An array of objects representing each column on the grid */ columns: readonly Column[]; /** A function called for each rendered row that should return a plain key/value pair object */ rows: readonly R[]; /** * Rows to be pinned at the bottom of the rows view for summary, the vertical scroll bar will not scroll these rows. * Bottom horizontal scroll bar can move the row left / right. Or a customized row renderer can be used to disabled the scrolling support. */ summaryRows?: readonly SR[]; /** The primary key property of each row */ rowKey?: K; /** * Callback called whenever row data is updated * When editing is enabled, this callback will be called for the following scenarios * 1. Using the supplied editor of the column. The default editor is the SimpleTextEditor. * 2. Copy/pasting the value from one cell to another CTRL+C, CTRL+V * 3. Update multiple cells by dragging the fill handle of a cell up or down to a destination cell. * 4. Update all cells under a given cell by double clicking the cell's fill handle. */ onRowsUpdate?: (event: E) => void; /** * Dimensions props */ /** The width of the grid in pixels */ width?: number; /** The height of the grid in pixels */ height?: number; /** Minimum column width in pixels */ minColumnWidth?: number; /** The height of each row in pixels */ rowHeight?: number; /** The height of the header row in pixels */ headerRowHeight?: number; /** The height of the header filter row in pixels */ headerFiltersHeight?: number; /** * Feature props */ /** Set of selected row keys */ selectedRows?: ReadonlySet; /** Function called whenever row selection is changed */ onSelectedRowsChange?: (selectedRows: Set) => void; /** The key of the column which is currently being sorted */ sortColumn?: string; /** The direction to sort the sortColumn*/ sortDirection?: SortDirection; /** Function called whenever grid is sorted*/ onSort?: (columnKey: string, direction: SortDirection) => void; filters?: Filters; onFiltersChange?: (filters: Filters) => void; /** * Custom renderers */ defaultFormatter?: React.ComponentType>; rowRenderer?: React.ComponentType>; emptyRowsRenderer?: React.ComponentType; /** * Event props */ /** Function called whenever a row is clicked */ onRowClick?: (rowIdx: number, row: R, column: CalculatedColumn) => void; /** Called when the grid is scrolled */ onScroll?: (event: React.UIEvent) => void; /** Called when a column is resized */ onColumnResize?: (idx: number, width: number) => void; /** Function called whenever selected cell is changed */ onSelectedCellChange?: (position: Position) => void; /** called before cell is set active, returns a boolean to determine whether cell is editable */ onCheckCellIsEditable?: (event: CheckCellIsEditableEvent) => boolean; /** * Toggles and modes */ /** Toggles whether filters row is displayed or not */ enableFilters?: boolean; enableCellCopyPaste?: boolean; enableCellDragAndDrop?: boolean; cellNavigationMode?: CellNavigationMode; /** * Miscellaneous */ /** The node where the editor portal should mount. */ editorPortalTarget?: Element; rowClass?: (row: R) => string | undefined; } declare const _default: (props: DataGridProps & { ref?: ((instance: DataGridHandle | null) => void) | React.RefObject | null | undefined; }) => JSX.Element; export default _default;