UNPKG

hightable

Version:

A dynamic windowed scrolling table component for react

44 lines (43 loc) 1.55 kB
import type { Cells } from '../index.js'; import { ResolvablePromise, WrappedPromise } from './promise.js'; /** * A row where each cell is a promise. * The promise must be wrapped with `wrapPromise` so that HighTable can render * the state synchronously. * Raise an error with format: {numRows: number} if the row cannot be resolved because * it's beyond the max number of rows (eg: iceberg position/equality deletes, or filtered rows). */ export interface AsyncRow { cells: Record<string, WrappedPromise<any>>; index: WrappedPromise<number>; } /** * A row where each cell is a resolved value. */ export interface Row { cells: Cells; index: number; } export interface PartialRow { index?: number; cells: Cells; } export interface ResolvableRow { cells: Record<string, ResolvablePromise<any>>; index: ResolvablePromise<number>; } export declare function resolvableRow(header: string[]): ResolvableRow; /** * Helper method to wrap future rows into AsyncRows. * Helpful when you want to define a DataFrame with simple async fetching of rows. * This function turns future data into a "grid" of wrapped promises. */ export declare function asyncRows(rows: Promise<Row[] | AsyncRow[]>, numRows: number, header: string[]): AsyncRow[]; /** * Await all promises in an AsyncRow and return resolved row. */ export declare function awaitRow(row: AsyncRow): Promise<Row>; /** * Await all promises in list of AsyncRows and return resolved rows. */ export declare function awaitRows(rows: AsyncRow[]): Promise<Row[]>;