@rowsncolumns/fast-formula-parser 6.2.35 → 6.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -4,6 +4,12 @@ declare module "@rowsncolumns/fast-formula-parser" {
4
4
 
5
5
  /** Set of all implemented function names for O(1) lookup */
6
6
  export const implementedFunctionNames: Set<string>;
7
+ /**
8
+ * Is `formula` a SUBTOTAL / AGGREGATE call (the cells SUBTOTAL and
9
+ * AGGREGATE skip inside their ranges)? Hosts use it to decide which cell
10
+ * formulas to hand to `onCellFormula`.
11
+ */
12
+ export function isNestedAggregateFormula(formula: unknown): boolean;
7
13
  export type CellCoords = {
8
14
  sheet?: string;
9
15
  row: number;
@@ -109,6 +115,17 @@ declare module "@rowsncolumns/fast-formula-parser" {
109
115
  row?: number;
110
116
  sheet?: string;
111
117
  }) => CellRange | FormulaError | undefined;
118
+ /**
119
+ * Resolve a 3-D reference span (`Sheet1:Sheet3!A1`): return every sheet
120
+ * name between `first` and `last` in tab order (inclusive, regardless of
121
+ * which endpoint is written first), or a `FormulaError` (`#REF!`) when an
122
+ * endpoint is not a sheet (`undefined` is treated as `#REF!`). Without the
123
+ * callback the prefix is looked up as a single sheet name (legacy reading).
124
+ */
125
+ onSheetRange?: (
126
+ first: string,
127
+ last: string,
128
+ ) => string[] | FormulaError | undefined;
112
129
  /**
113
130
  * Report row visibility so SUBTOTAL can exclude hidden rows.
114
131
  * Filtered-out rows are excluded for every function_number;
@@ -118,6 +135,16 @@ declare module "@rowsncolumns/fast-formula-parser" {
118
135
  sheet?: string;
119
136
  row: number;
120
137
  }) => { hiddenByFilter?: boolean; hiddenByUser?: boolean } | undefined;
138
+ /**
139
+ * Formula text stored in a cell, or undefined for non-formula cells.
140
+ * SUBTOTAL / AGGREGATE use it to skip nested SUBTOTAL / AGGREGATE
141
+ * results, as Excel does.
142
+ */
143
+ onCellFormula?: (ref: {
144
+ sheet?: string;
145
+ row: number;
146
+ col: number;
147
+ }) => string | undefined;
121
148
  webServiceProvider?: (
122
149
  url: string,
123
150
  ) =>
@@ -156,6 +183,12 @@ declare module "@rowsncolumns/fast-formula-parser" {
156
183
  export default class FormulaParser<T extends unknown = any> {
157
184
  constructor(config: FormulaParserConfig);
158
185
  locale?: string;
186
+ /**
187
+ * When true, `checkFormulaResult` hands back an un-invoked LAMBDA value
188
+ * instead of Excel's #CALC! — used while evaluating a defined name's
189
+ * formula so `=name(args)` can apply it later.
190
+ */
191
+ keepLambdaResult: boolean;
159
192
  parseAsync: (
160
193
  text: string,
161
194
  position: CellCoords,
@@ -208,7 +241,10 @@ declare module "@rowsncolumns/fast-formula-parser" {
208
241
  }
209
242
 
210
243
  export interface DepParserConfig
211
- extends Pick<FormulaParserConfig, "onVariable" | "onStructuredReference"> {}
244
+ extends Pick<
245
+ FormulaParserConfig,
246
+ "onVariable" | "onStructuredReference" | "onSheetRange"
247
+ > {}
212
248
  export class DepParser {
213
249
  constructor(config: DepParserConfig);
214
250
  parse: (text: string, position: CellCoords) => CellCoords[] | CellRange[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/fast-formula-parser",
3
- "version": "6.2.35",
3
+ "version": "6.2.37",
4
4
  "description": "fast excel formula parser",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -44,7 +44,7 @@
44
44
  "author": "Lester(Dishu) Lyu",
45
45
  "license": "MIT",
46
46
  "dependencies": {
47
- "@rowsncolumns/utils": ">=9.2.39",
47
+ "@rowsncolumns/utils": ">=9.2.41",
48
48
  "bahttext": "^2.3.0",
49
49
  "bessel": "^1.0.2",
50
50
  "chevrotain": "^10.5.0",
@@ -57,7 +57,7 @@
57
57
  "@babel/preset-typescript": "^7.29.7",
58
58
  "@rollup/plugin-commonjs": "^28.0.3",
59
59
  "@rollup/plugin-node-resolve": "^16.0.1",
60
- "@rowsncolumns/common-types": ">=5.2.30",
60
+ "@rowsncolumns/common-types": ">=5.2.32",
61
61
  "rollup": "^4.41.1"
62
62
  }
63
63
  }