UNPKG

hightable

Version:

A dynamic windowed scrolling table component for react

40 lines (39 loc) 1.91 kB
import { KeyboardEvent, MouseEvent, ReactNode } from 'react'; import { ResolvedValue } from '../../helpers/dataframe/index.js'; export interface CellContentProps { stringify: (value: unknown) => string | undefined; cell?: ResolvedValue; col: number; row?: number; } interface Props { ariaColIndex: number; ariaRowIndex: number; columnIndex: number; visibleColumnIndex: number; stringify: (value: unknown) => string | undefined; cell?: ResolvedValue; className?: string; onDoubleClickCell?: (event: MouseEvent, col: number, row: number) => void; onMouseDownCell?: (event: MouseEvent, col: number, row: number) => void; onKeyDownCell?: (event: KeyboardEvent, col: number, row: number) => void; rowNumber?: number; renderCellContent?: (props: CellContentProps) => ReactNode; } /** * Render a table cell <td> with title and optional custom rendering * * @param {Object} props * @param {number} props.ariaColIndex aria col index * @param {number} props.ariaRowIndex aria row index * @param {number} props.columnIndex column index in the table (0-based) * @param {function} props.stringify function to stringify the value * @param {ResolvedValue} [props.cell] cell value, undefined if the value has not been fetched yet * @param {string} [props.className] class name * @param {function} [props.onDoubleClick] double click callback * @param {function} [props.onMouseDown] mouse down callback * @param {function} [props.onKeyDown] key down callback * @param {number} [props.rowNumber] the row index in the original data, undefined if the value has not been fetched yet */ export default function Cell({ cell, onDoubleClickCell, onMouseDownCell, onKeyDownCell, stringify, columnIndex, visibleColumnIndex, className, ariaColIndex, ariaRowIndex, rowNumber, renderCellContent }: Props): import("react/jsx-runtime").JSX.Element; export {};