import { type Ref } from "vue"; import type { DataGridApiCapabilities, DataGridApiPluginDefinition, DataGridApiProjectionMode, DataGridApiRuntimeInfo, DataGridApiSchemaSnapshot, DataGridMigrateStateOptions, CreateDataGridCoreOptions, DataGridAggregationModel, DataGridClientRowPatch, DataGridClientRowPatchOptions, DataGridColumnInput, DataGridColumnModelSnapshot, DataGridRowNode, DataGridRowModel, DataGridRowModelSnapshot, DataGridViewportRange, DataGridGetStateOptions, DataGridSetStateOptions, DataGridSetViewportPositionOptions, DataGridUnifiedState, DataGridViewportCellTarget, DataGridViewportColumnTarget, DataGridViewportPositionSnapshot, DataGridViewportRowTarget } from "@affino/datagrid-core"; import type { DataGridPivotCellDrilldown, DataGridPivotCellDrilldownInput, DataGridPivotLayoutImportOptions, DataGridPivotInteropSnapshot, DataGridPivotLayoutSnapshot, DataGridPivotSpec } from "@affino/datagrid-pivot"; import { type CreateDataGridRuntimeOptions, type DataGridRuntimeVirtualWindowSnapshot, type DataGridRuntimeOverrides } from "@affino/datagrid-orchestration"; import type { DataGridVueRuntime } from "../runtime/createDataGridVueRuntime"; export type { DataGridRuntimeVirtualWindowSnapshot, }; type MaybeRef = T | Ref; export interface DataGridEditOptions extends Omit { /** * Excel-style default: freeze sort/filter/group projection during edit patches. */ freezeView?: boolean; /** * Explicitly reapply projection after patch (sort/filter/group). */ reapplyView?: boolean; } export interface UseDataGridRuntimeOptions { rows?: MaybeRef; rowModel?: DataGridRowModel; workerOwnedRowModelOptions?: { source: unknown; target: unknown; channel?: string | null; initialSnapshot?: DataGridRowModelSnapshot | null; requestInitialSync?: boolean; viewportCoalescingStrategy?: "split" | "simple"; }; plugins?: readonly DataGridApiPluginDefinition[]; clientRowModelOptions?: CreateDataGridRuntimeOptions["clientRowModelOptions"]; columns: MaybeRef; services?: DataGridRuntimeOverrides; startupOrder?: CreateDataGridCoreOptions["startupOrder"]; autoStart?: boolean; } export interface UseDataGridRuntimeResult extends DataGridVueRuntime { columnSnapshot: Ref; /** * Scroll-window snapshot in body-row coordinates only. * Pinned top and pinned bottom rows are excluded from rowStart, rowEnd, and rowTotal. */ virtualWindow: Ref; /** * Partition of the current runtime row model into scrollable body rows and pinned lanes. */ rowPartition: Ref>; setRows: (rows: readonly TRow[]) => void; setAggregationModel: (aggregationModel: DataGridAggregationModel | null) => void; getAggregationModel: () => DataGridAggregationModel | null; setPivotModel: (pivotModel: DataGridPivotSpec | null) => void; getPivotModel: () => DataGridPivotSpec | null; getPivotCellDrilldown: (input: DataGridPivotCellDrilldownInput) => DataGridPivotCellDrilldown | null; exportPivotLayout: () => DataGridPivotLayoutSnapshot; exportPivotInterop: () => DataGridPivotInteropSnapshot | null; importPivotLayout: (layout: DataGridPivotLayoutSnapshot, options?: DataGridPivotLayoutImportOptions) => void; patchRows: (updates: readonly DataGridClientRowPatch[], options?: DataGridClientRowPatchOptions) => void; applyEdits: (updates: readonly DataGridClientRowPatch[], options?: DataGridEditOptions) => void | Promise; reapplyView: () => void; autoReapply: Ref; getProjectionMode: () => DataGridApiProjectionMode; setProjectionMode: (mode: DataGridApiProjectionMode) => DataGridApiProjectionMode; getSchema: () => DataGridApiSchemaSnapshot; getApiCapabilities: () => DataGridApiCapabilities; getRuntimeInfo: () => DataGridApiRuntimeInfo; registerPlugin: (plugin: DataGridApiPluginDefinition) => boolean; unregisterPlugin: (id: string) => boolean; hasPlugin: (id: string) => boolean; listPlugins: () => readonly string[]; clearPlugins: () => void; getUnifiedState: (options?: DataGridGetStateOptions) => DataGridUnifiedState; migrateUnifiedState: (state: unknown, options?: DataGridMigrateStateOptions) => DataGridUnifiedState | null; setUnifiedState: (state: DataGridUnifiedState, options?: DataGridSetStateOptions) => void; start: () => Promise; stop: () => void; syncRowsInRange: (range: DataGridViewportRange) => readonly DataGridRowNode[]; /** * Sync rows for a body-relative viewport range. * The range must address only scrollable body rows. */ syncBodyRowsInRange: (range: DataGridBodyViewportRange) => readonly DataGridRowNode[]; /** * Resolve a scrollable body row by body-relative index. */ getBodyRowAtIndex: (rowIndex: number) => DataGridRowNode | null; /** * Resolve a scrollable body row index by row id. */ resolveBodyRowIndexById: (rowId: string | number) => number; /** * Set the current body-relative viewport range. * Pinned rows are excluded from this coordinate system. */ setViewportRange: (range: DataGridViewportRange) => void; getViewportPosition: () => DataGridViewportPositionSnapshot | null; setViewportPosition: (position: DataGridViewportPositionSnapshot, options?: DataGridSetViewportPositionOptions) => void; scrollToRow: (target: DataGridViewportRowTarget) => void; scrollToColumn: (target: DataGridViewportColumnTarget) => void; scrollToCell: (target: DataGridViewportCellTarget) => void; /** * Cheap body-relative viewport window update for render pipelines. * Keeps the canonical virtualWindow in sync without forcing a full row-model snapshot emit. */ setVirtualWindowRange: (range: DataGridViewportRange) => void; /** * Get the current body-relative viewport range. * Pinned rows are excluded from this coordinate system. */ getViewportRange: () => DataGridBodyViewportRange; } /** * Viewport coordinates for the scrollable body lane only. * Pinned top and pinned bottom rows never participate in this range. */ export type DataGridBodyViewportRange = DataGridViewportRange; export interface DataGridRuntimeRowPartitionSnapshot { bodyRowCount: number; pinnedTopRows: readonly DataGridRowNode[]; pinnedBottomRows: readonly DataGridRowNode[]; } export declare function useDataGridRuntime(options: UseDataGridRuntimeOptions): UseDataGridRuntimeResult; //# sourceMappingURL=useDataGridRuntime.d.ts.map