import { Cell, Rect, Selection } from '../types'; import { Context } from '../context'; /** True when the formula is only numeric ops on TODAY()/NOW() (incl. unary +/−); used to display serials as dates. */ export declare function isTodayNowPureArithmeticDateResult(formula: string, value: number): boolean; export declare class FormulaCache { parser: any; func_selectedrange?: Selection; data_parm_index: number; cellTextToIndexList: any; rangechangeindex?: number; selectingRangeIndex: number; rangeResizeObj?: any; rangeResize?: any; rangeResizeIndex?: number; rangeResizexy?: any; rangeResizeWinH?: any; rangeResizeWinW?: any; rangeResizeTo?: any; rangeSetValueTo?: any; rangeIndex?: number; rangestart?: boolean; rangetosheet?: string; rangedrag_column_start?: boolean; rangedrag_row_start?: boolean; rangeSelectionActive?: boolean | null; keyboardRangeSelectionLock?: boolean; /** True after arrow/Shift+arrow moved `func_selectedrange` without updating yellow selection. */ formulaKeyboardRefSync?: boolean; formulaEditorOwner?: 'cell' | 'fx' | null; functionRangeIndex?: number[]; functionRangeGlobalOffset?: number | null; functionlistMap: any; execFunctionExist?: any[]; execFunctionGlobalData: any; /** Formula dependency graph: cell -> referenced cells. Key format: `${sheetId}:${r}:${c}` */ depsByCell: Map>; /** Reverse dependency graph: referenced cell -> dependent formula cells. */ revDepsByCell: Map>; /** * Dependency collection state for the currently-parsed formula, set by `execfunction`. * When null, dependency recording is disabled. */ activeDepCollection: null | { originKey: string; deps: Set; }; constructor(); tryGetCellAsNumber(cell: Cell): string | number | boolean | undefined; } export declare function iscelldata(txt: string): boolean; export declare function getcellrange(ctx: Context, txt: string, formulaId?: string): any; export declare function getAllFunctionGroup(ctx: Context): any[]; export declare function delFunctionGroup(ctx: Context, r: number, c: number, id?: string): void; export declare function insertUpdateFunctionGroup(ctx: Context, r: number, c: number, id?: string, calcChainSet?: Set): void; export declare function execfunction(ctx: Context, txt: string, r: number, c: number, id?: string, calcChainSet?: Set, isrefresh?: boolean, notInsertFunc?: boolean): any[]; export declare function groupValuesRefresh(ctx: Context): void; export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean): void; /** * Before the first `moveHighlightCell/Range(..., "rangeOfFormula")` while editing * a formula, copy the current yellow selection into `func_selectedrange` so * keyboard navigation updates only the blue formula overlay (like mouse drag), * without resizing `luckysheet_select_save`. */ export declare function seedFormulaFuncSelectedRangeFromLastSelection(ctx: Context): boolean; export declare function createFormulaRangeSelect(ctx: Context, select: { rangeIndex: number; } & Rect): void; export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void; export declare function moveCursorToEnd(editableDiv: HTMLDivElement | null | undefined): void; export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number, parentTextDom?: HTMLElement): void; export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined; export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void; export declare function functionHTMLGenerate(txt: string): string; export declare function getLastFormulaRangeIndex($editor: HTMLDivElement): number | null; /** Range cell that contains the caret, if any (inside #luckysheet-rich-text-editor tree). */ export declare function getFormulaRangeIndexAtCaret($editor: HTMLDivElement): number | null; export declare function setFormulaEditorOwner(ctx: Context, owner: 'cell' | 'fx' | null): void; export declare function getFormulaEditorOwner(ctx: Context): 'cell' | 'fx' | null; /** * True when the formula text looks like a truncated A1-style range: LHS has a row * number but RHS after ":" is only column letters (e.g. =A1:A after deleting the * row digit from A2). Those states should not allow range recovery / keyboard ref nav. */ export declare function hasIncompleteTruncatedCellRangeSyntax(formulaText: string): boolean; /** * True when the formula is only "=" plus a single cell or range token (no parentheses, * so no function call). Same UX as =A1: do not use arrow keys to drive sheet refs until * the user changes the formula shape (e.g. adds a function). */ export declare function isBareCellOrRangeOnlyFormula(formulaText: string): boolean; /** * When opening in-cell / FX edit on a cell that already stores a formula (`cell.f`), * disable sheet-driven range selection until the caret reaches a fresh insertion slot * (comma, open paren, operator, etc.) or the user starts an active range drag. */ export declare function suppressFormulaRangeSelectionForInitialEdit(ctx: Context): void; export declare function isCaretAtValidFormulaRangeInsertionPoint(editor: HTMLElement | null): boolean; export declare function markRangeSelectionDirty(ctx: Context): void; /** * Which `rangeindex` keyboard selection sync should update: caret's cell if any; * else the last range cell when the caret is editing that ref — not when the caret * is before it (`=,A4` between `=` and `,`) or **past** it into a following comma / * next argument (`=SUM(A1,` after the comma must not replace `A1`). */ export declare function getFormulaRangeIndexForKeyboardSync($editor: HTMLDivElement): number | null; export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void; export declare function toggleFormulaAbsoluteReferenceAtCaret(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement | null | undefined): boolean; /** True while picking a range for a formula (sheet selection drives references). */ export declare function isLegacyFormulaRangeMode(ctx: Context): boolean; export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean; export declare function isFormulaReferenceInputMode(ctx: Context): boolean; export declare function maybeRecoverDirtyRangeSelection(ctx: Context): boolean; export declare function functionStrChange(txt: string, type: string, rc: 'row' | 'col', orient: string | null, stindex: number, step: number): string; export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void; export declare function onFormulaRangeDragEnd(ctx: Context): void; export declare function rangeDrag(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void; export declare function rangeDragColumn(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void; export declare function rangeDragRow(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void; export declare function functionCopy(ctx: Context, txt: string, mode: string, step: number): string; type MoveReferenceRect = { rowStart: number; rowEnd: number; colStart: number; colEnd: number; }; export declare function remapFormulaReferencesByMap(formula: string, formulaSheetName: string, movedSheetName: string, maps: { rowMap?: Record; colMap?: Record; }): string; export declare function functionMoveReference(txt: string, formulaSheetName: string, movedSheetName: string, sourceRect: MoveReferenceRect, targetRowStart: number, targetColStart: number): string; export {};