import { ComputedRef, Ref, WatchSource } from 'vue'; import { PvDataWidgetDataRow, PvDataWidgetProps } from './types'; /** Overlay text shown when a data handler fails and no `errorText` option is provided. */ export declare const DEFAULT_DATA_WIDGET_ERROR_TEXT = "Unable to load data"; /** Fetches the data rows for a PvDataWidget, e.g. from an API. */ export type PvDataWidgetDataHandler = () => PvDataWidgetDataRow[] | Promise; export interface UsePvDataWidgetDataOptions { /** Overlay text shown on the widget when the handler fails. */ errorText?: string; /** When false, data is not fetched until `refresh` is called. Defaults to true. */ immediate?: boolean; /** Reactive sources (e.g. filter state) that trigger a refetch when changed. */ watch?: WatchSource | WatchSource[]; } export interface UsePvDataWidgetDataReturn { /** Rows returned by the most recent successful handler call. */ chartData: Ref; /** True while a handler call is pending. */ chartLoading: Ref; /** Error from the most recent handler call, cleared on the next successful call. */ error: Ref; /** Re-invokes the handler. Resolves when the call settles. */ refresh: () => Promise; /** * Spreadable PvDataWidget props: `chartData`, `chartLoading`, and — only while in an * error state — `noDataOverlayText`. Place `v-bind="widgetProps"` after your own * bindings: your `noDataOverlayText` then applies to genuinely empty data, while the * error text takes precedence when a fetch fails. */ widgetProps: ComputedRef>; } /** * Manages the fetch lifecycle for a PvDataWidget whose rows come from an async * source: loading state, error-to-overlay mapping, stale-response protection, * and refetching on demand or when watched sources change. * * Entirely optional — PvDataWidget itself stays a pure presentational component * and can be fed `chartData` directly. */ export declare const usePvDataWidgetData: (handler: PvDataWidgetDataHandler, options?: UsePvDataWidgetDataOptions) => UsePvDataWidgetDataReturn;