import type { RefObject } from '@mui/x-internals/types'; import type { GridPrivateApiPremium } from "../../../models/gridApiPremium.mjs"; import type { FormulaCompletionToken } from "./engine/index.mjs"; /** * Signature help shown while the caret is inside a function/special-form call. */ export interface GridFormulaSignatureHelp { name: string; signature: string; description?: string; /** * Zero-based index of the argument the caret is in. */ argIndex: number; } /** * The autocomplete state for one caret position, ready for the editor to render. */ export interface GridFormulaSuggestionState { /** * The partial token used for matching (`''` when none). */ token: string; /** * Replace span in FULL source coordinates (including the leading `=`): * accepting a suggestion replaces `value.slice(replaceStart, replaceEnd)`. */ replaceStart: number; replaceEnd: number; /** * Ranked suggestions for the caret. */ options: FormulaCompletionToken[]; /** * Signature help for the enclosing call, or `null`. */ signatureHelp: GridFormulaSignatureHelp | null; } /** * The reference text that resolves to `field` as a same-row reference. A field * whose name is not a bare identifier — or collides with a reserved name or a * boolean constant — must go through the `FIELD("…")` escape. In the A1 * editing dialect a name that reads as a cell address (a field named `q1`) * must be escaped too, or the commit transform would freeze it as cell Q1. */ export declare function toFormulaFieldReference(field: string, a1Notation?: boolean): string; /** * Computes the ranked autocomplete suggestions for a formula source and caret * position. Returns `null` when the value is not a formula (so escaped `'=` * literals and plain values show nothing). * * Token sourcing (D20): the static vocabulary (functions from the cell's * registry — custom functions included — special forms, constants, operators) * plus same-row field references in both modes, plus A1 column letters when A1 * notation is on. Ranking is the pure engine ranker. */ export declare function getFormulaSuggestions(apiRef: RefObject, value: string, caret: number, a1NotationEnabled: boolean): GridFormulaSuggestionState | null; export type GetFormulaSuggestions = (value: string, caret: number) => GridFormulaSuggestionState | null; /** * Returns a stable callback computing autocomplete suggestions for the formula * editor. The suggestions read the current registry, visible fields and A1 * position context through `apiRef` on each call (the editor is short-lived and * recomputes per keystroke), so no selector subscription is needed. */ export declare function useGridFormulaAutocomplete(apiRef: RefObject, a1NotationEnabled: boolean): GetFormulaSuggestions;