UNPKG

hightable

Version:

A dynamic windowed scrolling table component for react

50 lines (49 loc) 2.92 kB
import { KeyboardEvent, MouseEvent } from 'react'; import { ColumnConfiguration } from '../../helpers/columnConfiguration.js'; import { DataFrame } from '../../helpers/dataframe/index.js'; import { Selection } from '../../helpers/selection.js'; import { OrderBy } from '../../helpers/sort.js'; interface Props { data: DataFrame; columnConfiguration?: ColumnConfiguration; cacheKey?: string; overscan?: number; padding?: number; focus?: boolean; onDoubleClickCell?: (event: MouseEvent, col: number, row: number) => void; onMouseDownCell?: (event: MouseEvent, col: number, row: number) => void; onKeyDownCell?: (event: KeyboardEvent, col: number, row: number) => void; onError?: (error: unknown) => void; orderBy?: OrderBy; onOrderByChange?: (orderBy: OrderBy) => void; selection?: Selection; onSelectionChange?: (selection: Selection) => void; stringify?: (value: unknown) => string | undefined; className?: string; columnClassNames?: (string | undefined)[]; styled?: boolean; } export declare const defaultOverscan = 20; export declare const columnStatesSuffix = ":column:states"; /** * Render a table with streaming rows on demand from a DataFrame. * * orderBy: the order used to fetch the rows. If set, the component is controlled, and the property cannot be unset (undefined) later. If undefined, the component is uncontrolled (internal state). If the data cannot be sorted, it's ignored. * onOrderByChange: the callback to call when the order changes. If undefined, the component order is read-only if controlled (orderBy is set), or disabled if not (or if the data cannot be sorted). * selection: the selected rows and the anchor row. If set, the component is controlled, and the property cannot be unset (undefined) later. If undefined, the component is uncontrolled (internal state). * onSelectionChange: the callback to call when the selection changes. If undefined, the component selection is read-only if controlled (selection is set), or disabled if not. */ export default function HighTable(props: Props): import("react/jsx-runtime").JSX.Element; type PropsData = Omit<Props, 'data'>; type PropsInner = Omit<PropsData, 'orderBy' | 'onOrderByChange' | 'selection' | 'onSelectionChange'> & { version: number; }; /** * The component is a virtual table: only the visible rows are fetched and rendered as HTML <tr> elements. * * The main purpose of extracting HighTableInner from HighTable is to * separate the context providers from the main component. It will also * remove the need to reindent the code if adding a new context provide. */ export declare function HighTableInner({ overscan, padding, focus, onDoubleClickCell, onMouseDownCell, onKeyDownCell, onError, stringify, className, columnClassNames, styled, columnConfiguration, version, }: PropsInner): import("react/jsx-runtime").JSX.Element | undefined; export {};