import { type ComputedRef, type Ref } from "vue"; import type { DataGridColumnSnapshot, DataGridRowNode, DataGridSelectionSnapshot } from "@affino/datagrid-core"; import { type DataGridFillBehavior } from "../composables/dataGridFillBehavior"; import { type DataGridCopyRange } from "../advanced"; import { type DataGridAppInteractionOwnerSnapshot } from "./dataGridInteractionOwner"; import type { UseDataGridRuntimeResult } from "../composables/useDataGridRuntime"; import type { DataGridFilterSnapshot, DataGridGroupBySpec, DataGridGroupExpansionSnapshot, DataGridPaginationSnapshot, DataGridSortState } from "@affino/datagrid-core"; interface DataGridAppFillProjectionContext { sortModel: readonly DataGridSortState[]; filterModel: DataGridFilterSnapshot | null; groupBy: DataGridGroupBySpec | null; groupExpansion: DataGridGroupExpansionSnapshot; treeData: null; pivot: null; pagination: DataGridPaginationSnapshot; } interface DataGridAppResolveFillBoundaryRequest { direction: "up" | "down" | "left" | "right"; baseRange: DataGridCopyRange; fillColumns: readonly string[]; referenceColumns: readonly string[]; projection: DataGridAppFillProjectionContext; startRowIndex: number; startColumnIndex: number; limit?: number | null; } interface DataGridAppResolveFillBoundaryResult { endRowIndex: number | null; endRowId?: string | number | null; boundaryKind: "data-end" | "gap" | "cache-boundary" | "projection-end" | "unresolved"; scannedRowCount?: number; truncated?: boolean; revision?: string | null; projectionHash?: string | null; boundaryToken?: string | null; } type DataGridAppServerFillInvalidation = { kind: "range"; range: DataGridCopyRange; reason?: string; } | { kind: "rows"; rowIds: readonly (string | number)[]; reason?: string; }; type DataGridAppServerOperationInvalidation = { kind: "all"; reason?: string; } | { kind: "range"; range: { start?: unknown; end?: unknown; startRow?: unknown; endRow?: unknown; } | DataGridCopyRange; reason?: string; } | { kind: "rows"; rowIds: readonly (string | number)[]; reason?: string; }; interface DataGridAppServerOperationResult { operationId?: string | null; revision?: string | number | null; status?: "committed" | "partial" | "rejected" | "blocked" | string; acceptedCells?: number; rejectedCells?: number; blockedCells?: number; affectedRows?: number; affectedCells?: number; affectedRowCount?: number; affectedCellCount?: number; invalidation?: DataGridAppServerOperationInvalidation | null; warnings?: readonly string[]; rejections?: readonly { reason?: string | null; }[]; } interface DataGridAppFillDataSource { resolveFillBoundary?: (request: DataGridAppResolveFillBoundaryRequest) => Promise | DataGridAppResolveFillBoundaryResult; executeOperation?: (request: Record) => Promise | DataGridAppServerOperationResult | null; commitFillOperation?: (request: { operationId?: string | null; revision?: string | number | null; baseRevision?: string | null; projectionHash?: string | null; boundaryToken?: string | null; projection: DataGridAppFillProjectionContext; sourceRange: DataGridCopyRange; targetRange: DataGridCopyRange; sourceRowIds?: readonly (string | number)[]; targetRowIds?: readonly (string | number)[]; fillColumns: readonly string[]; referenceColumns: readonly string[]; mode: DataGridFillBehavior; metadata?: { origin?: "drag-fill" | "double-click-fill" | "menu-reapply"; behaviorSource?: "default" | "explicit"; } | null; }) => Promise<{ operationId: string; revision?: string | number | null; affectedRowCount: number; affectedCellCount?: number; invalidation?: DataGridAppServerFillInvalidation | null; warnings?: readonly string[]; } | null>; undoFillOperation?: (request: { operationId: string; revision?: string | number | null; projection: DataGridAppFillProjectionContext; }) => Promise<{ operationId: string; revision?: string | number | null; invalidation?: DataGridAppServerFillInvalidation | null; warnings?: readonly string[]; } | null>; redoFillOperation?: (request: { operationId: string; revision?: string | number | null; projection: DataGridAppFillProjectionContext; }) => Promise<{ operationId: string; revision?: string | number | null; invalidation?: DataGridAppServerFillInvalidation | null; warnings?: readonly string[]; } | null>; } import { type DataGridAppAppliedFillSession } from "./useDataGridAppFill"; import type { DataGridAppCellCoord, DataGridAppSelectionAnchorLike } from "./useDataGridAppCellSelection"; import type { DataGridAppMode } from "./useDataGridAppControls"; type DataGridRowIndexKeyboardAction = "insert-row-above" | "copy-row" | "cut-row" | "paste-row" | "delete-selected-rows" | "open-row-menu"; export interface UseDataGridAppInteractionControllerOptions, TSnapshot> { mode: Ref; enableFillHandle?: Ref; enableRangeMove?: Ref; runtime: Pick, "api" | "getBodyRowAtIndex" | "resolveBodyRowIndexById" | "rowModel">; totalRows: Ref; visibleColumns: Ref; viewportRowStart: Ref; selectionSnapshot: Ref; bodyViewportRef: Ref; indexColumnWidth?: number; resolveColumnWidth: (column: DataGridColumnSnapshot) => number; resolveRowHeight: (rowIndex: number) => number; resolveRowIndexAtOffset: (offset: number) => number; normalizeRowId: (value: unknown) => string | number | null; normalizeCellCoord: (coord: DataGridAppCellCoord) => DataGridAppCellCoord | null; resolveSelectionRange: () => DataGridCopyRange | null; applySelectionRange: (range: DataGridCopyRange) => void; recordServerFillTransaction?: (descriptor: { intent: "fill"; label: string; affectedRange?: DataGridCopyRange | null; operationId: string; revision?: string | number | null; mode: DataGridFillBehavior; }) => void; applyCellSelectionByCoord: (coord: DataGridAppCellCoord, extend: boolean, fallbackAnchor?: DataGridAppSelectionAnchorLike, additive?: boolean) => void; setCellSelection: (row: DataGridRowNode, rowOffset: number, columnIndex: number, extend: boolean, additive?: boolean) => void; clearCellSelection: () => void; readCell: (row: DataGridRowNode, columnKey: string) => string; ensureEditableRowAtIndex?: (rowIndex: number) => DataGridRowNode | null; isCellEditable: (row: DataGridRowNode, rowIndex: number, columnKey: string, columnIndex: number) => boolean; cloneRowData: (row: TRow) => TRow; resolveRowIndexById?: (rowId: string | number) => number; isRowMaterializedAtIndex?: (rowIndex: number) => boolean; resolveFillBoundary?: (request: DataGridAppResolveFillBoundaryRequest) => Promise | DataGridAppResolveFillBoundaryResult; runtimeRowModel?: { dataSource?: DataGridAppFillDataSource; } | null; reportFillWarning?: (message: string) => void; reportFillPlumbingState?: (layer: string, present: boolean) => void; captureRowsSnapshot: () => TSnapshot; captureRowsSnapshotForRowIds?: (rowIds: readonly (string | number)[]) => TSnapshot; recordIntentTransaction: (descriptor: { intent: string; label: string; affectedRange?: DataGridCopyRange | null; }, beforeSnapshot: TSnapshot, afterSnapshotOverride?: TSnapshot) => void | Promise; clearPendingClipboardOperation: (clearSelection: boolean, clearBufferedClipboardPayload?: boolean) => boolean; clearExternalPendingClipboardOperation?: () => boolean; copySelectedCells: (trigger?: "keyboard" | "context-menu") => Promise; pasteSelectedCells: (trigger?: "keyboard" | "context-menu", options?: { mode?: "default" | "values"; }) => Promise; cutSelectedCells: (trigger?: "keyboard" | "context-menu") => Promise; normalizeClipboardRange: (range: DataGridCopyRange) => DataGridCopyRange | null; applyClipboardEdits: (range: DataGridCopyRange, matrix: string[][], options?: { recordHistory?: boolean; }) => number | Promise; rangesEqual: (left: DataGridCopyRange | null, right: DataGridCopyRange | null) => boolean; buildFillMatrixFromRange: (range: DataGridCopyRange) => string[][]; applyRangeMove?: (baseRange: DataGridCopyRange, targetRange: DataGridCopyRange) => boolean | Promise; refreshServerFillViewport?: (payload?: DataGridCopyRange | DataGridAppServerFillInvalidation | null) => void | Promise; syncViewport: () => void; editingCell: Ref<{ rowId: string | number; columnKey: string; } | null>; startInlineEdit: (row: DataGridRowNode, columnKey: string, options?: { draftValue?: string; openOnMount?: boolean; }) => void; appendInlineEditTextInput?: (value: string) => boolean; cancelInlineEdit: () => void; commitInlineEdit: (target?: "stay" | "next" | "previous" | "none") => void; canUndo: () => boolean; canRedo: () => boolean; runHistoryAction: (direction: "undo" | "redo") => Promise | unknown; ensureKeyboardActiveCellVisible: (rowIndex: number, columnIndex: number) => void; isContextMenuVisible?: () => boolean; closeContextMenu?: () => void; openContextMenuFromCurrentCell?: () => void; runRowIndexKeyboardAction?: (action: DataGridRowIndexKeyboardAction, rowId: string | number) => Promise | boolean; reportFillPlumbingDetail?: (layer: string, value: string) => void; } export interface UseDataGridAppInteractionControllerResult { isPointerSelectingCells: Ref; isFillDragging: Ref; interactionOwnerSnapshot: ComputedRef; globalPointerListenersActive: ComputedRef; fillPreviewRange: Ref; lastAppliedFill: Ref; isRangeMoving: Ref; selectionRange: ComputedRef; rangeMovePreviewRange: Ref; stopPointerSelection: () => void; stopFillSelection: (commit: boolean) => void; startFillHandleDrag: (event: MouseEvent) => void; startFillHandleDoubleClick: (event: MouseEvent) => void; applyLastFillBehavior: (behavior: DataGridFillBehavior) => boolean | Promise; handleCellMouseDown: (event: MouseEvent, row: DataGridRowNode, rowOffset: number, columnIndex: number) => void; handleCellKeydown: (event: KeyboardEvent, row: DataGridRowNode, rowOffset: number, columnIndex: number) => void; handleRowIndexKeydown: (event: KeyboardEvent, row: DataGridRowNode, rowOffset: number) => void; handleWindowMouseMove: (event: MouseEvent) => void; handleWindowMouseUp: () => void; handleWindowPointerUp: () => void; handleWindowPointerCancel: () => void; handleWindowBlur: () => void; handleWindowContextMenuCapture: (event: MouseEvent) => boolean; isCellInFillPreview: (rowOffset: number, columnIndex: number) => boolean; isFillHandleCell: (rowOffset: number, columnIndex: number) => boolean; clearSelectedCells: (trigger?: "keyboard" | "context-menu") => Promise; dispose: () => void; } export declare function useDataGridAppInteractionController, TSnapshot>(options: UseDataGridAppInteractionControllerOptions): UseDataGridAppInteractionControllerResult; export {}; //# sourceMappingURL=useDataGridAppInteractionController.d.ts.map