import type { Key } from '@react-types/shared'; import type { dh } from '@deephaven/jsapi-types'; import { type KeyedItem } from '@deephaven/utils'; export declare const ITEM_KEY_PREFIX = "DH_ITEM_KEY"; export type OnTableUpdatedEvent = dh.Event<{ offset: number; columns: dh.Column[]; rows: dh.Row[]; }>; export type RowDeserializer = (row: dh.Row, columns: dh.Column[]) => T; /** * Create a `KeyedItem.key` for a given index. The prefix is necessary to avoid * collisions with property values in the `item` property that may be used as * keys once the item is loaded and rendered. * @param index Index to create a key for. * @returns A unique key for the given index. */ export declare function createKeyedItemKey(index: number): string; /** * Creates a handler function for a `dh.Table.EVENT_UPDATED` event. Rows that * get passed to the handler will be bulk updated in the given `viewportData` * object based on their derived item keys. * @param viewportData State object for managing a list of KeyedItem data. * @param deserializeRow Converts a DH Row to an item object. * @returns Handler function for a `dh.Table.EVENT_UPDATED` event. */ export declare function createOnTableUpdatedHandler({ bulkUpdate }: { bulkUpdate: (itemMap: Map>) => void; }, deserializeRow: RowDeserializer): (event: OnTableUpdatedEvent) => void; /** * Maps a Row to a key / value object. Keys are mapped ver batim from column * names. * @param row Row to map to an item. * @param columns Columns to map. * @returns A key / value object for the row. */ export declare function defaultRowDeserializer(row: dh.Row, columns: dh.Column[]): T; /** * For windowing to work, the underlying list needs to maintain a KeyedItem for * each row in the backing table (even if these rows haven't been loaded yet). * This is needed internally by react-spectrum so it can calculate the content * area size. This generator can create a range of empty `KeyedItem` objects. * @param start The starting index to generate * @param end The ending index to generate */ export declare function generateEmptyKeyedItems(start: number, end: number): Generator, void, unknown>; /** * Check a Table to see if it is closed before checking its size property. This * is important because calling Table.size on a closed table throws an error. If * the table is null or closed, return zero. Otherwise, return the current size. * @param table The table to check for its size. * @returns The size of the table or zero if the table is null or closed. */ export declare function getSize(table?: dh.Table | dh.TreeTable | null): number; /** * Check if a given widget is closed based on `isClosed` prop. * Tree tables and other widgets don't have an `isClosed` prop, * so will always return false. * @param table The widget to check if it is closed. */ export declare function isClosed(widget: unknown): boolean; /** * Determine the first and last row index for a viewport + extra leading and * trailing padding. Values will be "clamped" to stay within the table size. * @param firstRow Starting row index for the viewport. * @param viewportSize Size of the viewport. * @param padding Extra rows to add to the viewport. Will be used for leading * and trailing rows. * @param tableSize Total table size. * @returns Tuple containing indices for the first and last row. */ export declare function padFirstAndLastRow(firstRow: number, viewportSize: number, padding: number, tableSize: number): [number, number]; //# sourceMappingURL=ViewportDataUtils.d.ts.map