import { FormulaParser, Sheet, CellRange, Functions, ParseResults, SheetConfig } from "./parser"; import { Dag, Node, DependencyMapping } from "./graph"; import { CellConfig, CellConfigGetter } from "./types"; interface CellInterface { rowIndex: number; columnIndex: number; } export declare type CellsBySheet = Record; declare type Cells = Record; declare type Cell = Record; export interface CalcEngineOptions { functions?: Functions; getSheetRange: (name: Sheet) => SheetConfig; } /** * Todo * Remove dependencies on delete */ declare class CalcEngine { parser: FormulaParser; dag: Dag; mapping: DependencyMapping; constructor(options: CalcEngineOptions); /** * Parses a single cell * @param value * @param sheet * @param cell * @param getValue */ calculate: (value: string | undefined, sheet: Sheet, cell: CellInterface, getValue: CellConfigGetter) => Promise>> | undefined>; /** * Does array formula collides * @param result * @param sheet * @param cell * @param getValue */ detectCollision: (result: ParseResults, sheet: Sheet, cell: CellInterface, getValue: CellConfigGetter) => boolean | CellInterface; restrictRowRange: (ref: CellRange, rowCount: number) => { from: { row: number; col: number; }; to: { row: number; col: number; }; sheet: string; }; prepareOutput: (changes: CellsBySheet) => Record>> | undefined; prepareResult: (formula: string, result: ParseResults, sheet: Sheet, cell: CellInterface, changes: CellsBySheet) => Record>>; calculateDependencies: (dependencies: Set, getValue: CellConfigGetter) => Promise>>>; calculateBatch: (changes: CellsBySheet, getValue: CellConfigGetter) => Promise>> | undefined>; /** * Set dependencies in graph * @param changes */ initialize: (changes: CellsBySheet, getValue: CellConfigGetter) => Promise<{} | undefined>; } export default CalcEngine;