QueryViewportController interface

Module @runic-artifex/views in @runic-artifex/views 0.23.0

interface QueryViewportController<TRow>

Follows a scroll container for a query collection: it asks the collection for the rows the container shows and lays them out with variable heights. Bindings wrap it as useQueryCollection.

Properties

current

readonly current: QueryViewport<TRow>;

No documentation.

Methods

subscribe

subscribe(listener: () => void): () => void;

Calls listener after each change of current, until the returned function is called.

attach

attach(element: HTMLElement | null | undefined): void;

Follows element's scroll position and size. Pass null to detach.

observe

observe(element: Element, index: number): () => void;

Measures a rendered row element and follows its size until the returned function is called. A row above the visible ones that changes size keeps the visible rows where they are.

measure

measure(index: number, size: number): void;

Sets the measured size of row index.

scrollToIndex

scrollToIndex(index: number, align?: "start" | "center" | "end"): void;

Scrolls the container so that row index is at its top (start), center or bottom (end).

scrollToKey

scrollToKey(key: string, align?: "start" | "center" | "end"): Promise<boolean>;

Scrolls to the row with key: asks .NET for its position in the current query (query-index), then scrolls to it. Resolves false when no row has the key.

update

update(options: QueryViewportOptions): void;

Changes the estimate or overscan.

dispose

dispose(): void;

No documentation.