/// import FastFormulaParser from "fast-formula-parser"; import { DepParser } from "fast-formula-parser/grammar/dependency/hooks"; import { DATATYPES } from "./helpers"; import { CellsBySheet } from "./calc"; import { CellConfig, CellConfigGetter } from "./types"; export declare type Sheet = string; export interface CellPosition { sheet: Sheet; row: number; col: number; } export interface CellRange { sheet: Sheet; from: Omit; to: Omit; } export declare type ResultArray = any[][]; export declare const DEFAULT_HYPERLINK_COLOR = "#1155CC"; export interface ParseResults { result?: React.ReactText | undefined | ResultArray; resultType?: DATATYPES; error?: string; hyperlink?: string; errorMessage?: string; color?: string; underline?: boolean; horizontalAlign?: string; } /** * Remove undefined entries from calculation results * @param Object */ export declare const removeUndefined: (o: ParseResults) => ParseResults; export interface CellInterface { rowIndex: number; columnIndex: number; } export declare type GetValue = (sheet: Sheet, cell: CellInterface) => CellConfig; export declare type Functions = Record any>; export interface FormulaProps { getSheetRange: (name: Sheet) => SheetConfig; getValue?: CellConfigGetter | undefined; functions?: Functions; } export interface SheetConfig { rowCount: number; columnCount: number; } /** * Create a formula parser * @param param0 */ declare class FormulaParser { formulaParser: FastFormulaParser; dependencyParser: DepParser; getValue: CellConfigGetter | undefined; currentValues: CellsBySheet | undefined; getSheetRange: (name: string) => SheetConfig; constructor(options: FormulaProps); sheetRange(name: Sheet): SheetConfig; cacheValues: (changes: CellsBySheet) => void; clearCachedValues: () => void; getCellConfig: (position: CellPosition) => string | number | boolean | Date | null | undefined; getCellValue: (pos: CellPosition) => string | number | boolean | Date | null | undefined; getRangeValue: (ref: CellRange) => (string | number | boolean | Date | null | undefined)[][]; parse: (text: string | null, position?: CellPosition, getValue?: CellConfigGetter | undefined) => Promise; getDependencies: (text: string, position?: CellPosition) => CellRange[] | CellPosition[]; } export { FormulaParser, FastFormulaParser };