hyperformula
Version:
HyperFormula is a JavaScript engine for efficient processing of spreadsheet-like data and formulas
40 lines (39 loc) • 2.27 kB
TypeScript
/**
* @license
* Copyright (c) 2025 Handsoncode. All rights reserved.
*/
import { AbsoluteCellRange } from '../AbsoluteCellRange';
import { SimpleCellAddress } from '../Cell';
import { Maybe } from '../Maybe';
import { ColumnsSpan, RowsSpan } from '../Span';
import { ArrayFormulaVertex } from './';
/**
* Maps top-left corner addresses to their ArrayFormulaVertex instances.
* An ArrayFormulaVertex is created for formulas that output multiple values (e.g., MMULT, TRANSPOSE, array literals).
* The same ArrayFormulaVertex is referenced in AddressMapping for all cells within its spill range.
* ArrayFormulaVertex lifecycle:
* - Prediction (ArraySizePredictor.checkArraySize) → determines if formula will produce array
* - Creation → new ArrayFormulaVertex(...) added via addArrayFormulaVertex()
* - Address registration → setAddressMappingForArrayFormulaVertex() sets the vertex for all cells in range
* - Evaluation → computes actual values, stores in ArrayFormulaVertex.array
* - Shrinking → if content placed in array area, array shrinks via shrinkArrayToCorner()
*/
export declare class ArrayMapping {
readonly arrayMapping: Map<string, ArrayFormulaVertex>;
getArray(range: AbsoluteCellRange): Maybe<ArrayFormulaVertex>;
getArrayByCorner(address: SimpleCellAddress): Maybe<ArrayFormulaVertex>;
setArray(range: AbsoluteCellRange, vertex: ArrayFormulaVertex): void;
removeArray(range: string | AbsoluteCellRange): void;
count(): number;
arraysInRows(rowsSpan: RowsSpan): IterableIterator<[string, ArrayFormulaVertex]>;
arraysInCols(col: ColumnsSpan): IterableIterator<[string, ArrayFormulaVertex]>;
isFormulaArrayInRow(sheet: number, row: number): boolean;
isFormulaArrayInAllRows(span: RowsSpan): boolean;
isFormulaArrayInColumn(sheet: number, column: number): boolean;
isFormulaArrayInAllColumns(span: ColumnsSpan): boolean;
isFormulaArrayInRange(range: AbsoluteCellRange): boolean;
isFormulaArrayAtAddress(address: SimpleCellAddress): boolean;
moveArrayVerticesAfterRowByRows(sheet: number, row: number, numberOfRows: number): void;
moveArrayVerticesAfterColumnByColumns(sheet: number, column: number, numberOfColumns: number): void;
private updateArrayVerticesInSheet;
}