/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { DatasetPage, RequestOptions } from '@elaraai/e3-api-client'; import { type EastTypeValue } from '@elaraai/east'; import { pruneRetainedPages } from '@elaraai/east-ui/internal'; import { type ValueTreePagedRow } from '@elaraai/east-ui-components'; import { type PreviewControls } from './preview-controls.js'; /** * The page size to address pages by, given one landed page (#829). * * The server trims every page of a dataset to the same byte budget, so a page * that came back SHORT while the dataset has more beyond it tells the size * every later page will be served at. Addressing pages by the requested size * instead would start page `p + 1` past the trimmed page's end and skip the * rows between for good. A short FINAL page is only the data ending. * * @param requested - Elements the page asked for * @param page - The landed page's placement * @returns The size to address pages by from here on */ export declare function servedPageSize(requested: number, page: Pick): number; /** Page retention — the row model's `pruneRetainedPages` (moved to * `@elaraai/east-ui` in #719), re-exported here for its existing importers. */ export { pruneRetainedPages }; export interface PagedDatasetPreviewProps { apiUrl: string; repo: string; workspace: string; /** Dotted path string, e.g. "inputs.rows". */ path: string; /** The dataset's East type (an Array/Set/Dict root). */ type: EastTypeValue; /** Content hash of the current value — resets pages when it changes. */ hash: string; /** Stored blob size, shown alongside the totals. */ sizeBytes: number; requestOptions?: RequestOptions; /** Triggers a whole-value download (the existing download flow). */ onDownload: () => void | Promise; /** Called when the server refuses the blob as un-pageable * (`dataset_not_indexed` — a legacy blob predating the stored-segmented * contract). The parent falls back to the inline tree so pre-index * values keep rendering instead of dead-ending here. */ onNotIndexed?: () => void; /** `false` draws no band above the rows — no totals, key search or * Download (#1120), nor the tree's Collapse all and Expand all (#1209). * Default `true`. */ toolbar?: boolean; /** The key search, controlled: found on the server as the search box * finds a query, scrolled to its first match; the preview draws no * search box of its own (#1120). */ search?: string; /** Told the text of the preview's own search box as it is edited, unless * `search` is given. */ onSearchChange?: (search: string) => void; /** The handle a host's own Collapse all and Expand all act on the tree * through (#1209). */ controls?: PreviewControls; } /** * Materializes one decoded page into the ValueTree renderer's paged-row * contract: an Array's or a Set's elements by their place in the whole, a * Dict's values under their keys — String keys as steps, others labelled. * * @param type - The collection's type: an Array, a Set or a Dict * @param decoded - The page, a value of that type * @param offset - The page's first element's place in the whole collection * @returns The page's root rows * * @internal */ export declare function pageRows(type: EastTypeValue, decoded: unknown, offset: number): ValueTreePagedRow[]; /** * The empty collection value of a pageable root — the paged tree's root node * carries kind only; rows come from the pages. * * @param type - The collection's type: an Array, a Set or a Dict * @returns The empty value of it * * @internal */ export declare function emptyOf(type: EastTypeValue): unknown; export declare const PagedDatasetPreview: import("react").MemoExoticComponent<({ apiUrl, repo, workspace, path, type, hash, sizeBytes, requestOptions, onDownload, onNotIndexed, toolbar, search, onSearchChange, controls, }: PagedDatasetPreviewProps) => import("react/jsx-runtime").JSX.Element>; //# sourceMappingURL=PagedDatasetPreview.d.ts.map