@univerjs/engine-formula 0.12.4-experimental.20251208-c4b8a44 → 0.12.4

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.
@@ -126,20 +126,6 @@ export interface IFormulaIdMap {
126
126
  r: number;
127
127
  c: number;
128
128
  }
129
- export interface IFormulaStringMap {
130
- [unitId: string]: Nullable<{
131
- [sheetId: string]: IObjectMatrixPrimitiveType<string[]>;
132
- }>;
133
- }
134
- export interface IFormulaExecuteResultItem {
135
- value: Nullable<number | string | boolean | Array<Array<number | string | boolean | null>>>;
136
- formula: string;
137
- }
138
- export interface IFormulaExecuteResultMap {
139
- [unitId: string]: Nullable<{
140
- [sheetId: string]: IObjectMatrixPrimitiveType<IFormulaExecuteResultItem[]>;
141
- }>;
142
- }
143
129
  export interface IFormulaIdMapData {
144
130
  [unitId: string]: Nullable<{
145
131
  [subUnitId: string]: Nullable<{
@@ -33,6 +33,7 @@ export declare function formatDateDefault(date: Date): string;
33
33
  */
34
34
  export declare function isValidDateStr(dateStr: string): boolean;
35
35
  export declare function parseFormattedDate(value: string): numfmt.ParseData | null;
36
+ export declare function parseFormattedValue(value: string): numfmt.ParseData | null;
36
37
  export declare function parseFormattedTime(value: string): numfmt.ParseData | null;
37
38
  export declare function isDate(format: string): boolean;
38
39
  export declare function isValidWeekend(weekend: number | string): boolean;
@@ -1,39 +1,15 @@
1
1
  import { IExecutionOptions, IMutation, Nullable } from '@univerjs/core';
2
- import { IFormulaExecuteResultMap, IFormulaStringMap, IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
3
- import { IFormulaDependencyTreeFullJson, IFormulaDependencyTreeJson } from '../../engine/dependency/dependency-tree';
2
+ import { IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
4
3
  import { IFormulaDirtyData } from '../../services/current-data.service';
5
4
  import { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
6
5
  export interface ISetFormulaCalculationStartMutation extends IFormulaDirtyData {
7
6
  options: Nullable<IExecutionOptions>;
8
7
  }
9
- export interface ISetFormulaStringBatchCalculationMutation {
10
- formulas: IFormulaStringMap;
11
- }
12
- export interface ISetFormulaStringBatchCalculationResultMutation {
13
- result: IFormulaExecuteResultMap;
14
- }
15
- export interface ISetFormulaStringBatchCalculationResultMutation {
16
- result: IFormulaExecuteResultMap;
17
- }
18
- export interface ISetFormulaDependencyCalculationMutation {
19
- unitId: string;
20
- sheetId: string;
21
- row: number;
22
- column: number;
23
- }
24
- export interface ISetFormulaDependencyCalculationResultMutation {
25
- result: IFormulaDependencyTreeJson[];
26
- }
27
- export interface ISetCellFormulaDependencyCalculationResultMutation {
28
- result: IFormulaDependencyTreeFullJson | undefined;
29
- }
30
8
  /**
31
9
  * TODO: @DR-Univer
32
10
  * Trigger the calculation of the formula and stop the formula
33
11
  */
34
12
  export declare const SetFormulaCalculationStartMutation: IMutation<ISetFormulaCalculationStartMutation>;
35
- export declare const SetFormulaStringBatchCalculationMutation: IMutation<ISetFormulaStringBatchCalculationMutation>;
36
- export declare const SetFormulaStringBatchCalculationResultMutation: IMutation<ISetFormulaStringBatchCalculationResultMutation>;
37
13
  export interface ISetFormulaCalculationStopMutation {
38
14
  }
39
15
  export declare const SetFormulaCalculationStopMutation: IMutation<ISetFormulaCalculationStopMutation>;
@@ -47,7 +23,3 @@ export interface ISetFormulaCalculationResultMutation {
47
23
  unitOtherData: IRuntimeOtherUnitDataType;
48
24
  }
49
25
  export declare const SetFormulaCalculationResultMutation: IMutation<ISetFormulaCalculationResultMutation>;
50
- export declare const SetFormulaDependencyCalculationMutation: IMutation<{}>;
51
- export declare const SetFormulaDependencyCalculationResultMutation: IMutation<ISetFormulaDependencyCalculationResultMutation>;
52
- export declare const SetCellFormulaDependencyCalculationMutation: IMutation<ISetFormulaDependencyCalculationMutation>;
53
- export declare const SetCellFormulaDependencyCalculationResultMutation: IMutation<ISetCellFormulaDependencyCalculationResultMutation>;
@@ -9,9 +9,6 @@ export declare class CalculateController extends Disposable {
9
9
  private _initialize;
10
10
  private _commandExecutedListener;
11
11
  private _calculate;
12
- private _generateAllDependencyTreeJson;
13
- private _generateCellDependencyTreeJson;
14
- private _calculateFormulaString;
15
12
  private _initialExecuteFormulaListener;
16
13
  private _applyResult;
17
14
  }
@@ -115,43 +115,4 @@ export declare class FormulaDependencyTree extends FormulaDependencyTreeCalculat
115
115
  shouldBePushRangeList(): boolean;
116
116
  toRTreeItem(): IUnitRange[];
117
117
  }
118
- interface IFormulaDependencyTreeJsonBase {
119
- treeId: number;
120
- formula: string;
121
- row: number;
122
- column: number;
123
- unitId: string;
124
- subUnitId: string;
125
- refOffsetX: number;
126
- refOffsetY: number;
127
- rangeList: IUnitRange[];
128
- refTreeId: number | undefined;
129
- }
130
- export interface IFormulaDependencyTreeJson extends IFormulaDependencyTreeJsonBase {
131
- children: number[];
132
- parents: number[];
133
- }
134
- export interface IFormulaDependencyTreeFullJson extends IFormulaDependencyTreeJsonBase {
135
- children: IFormulaDependencyTreeJson[];
136
- parents: IFormulaDependencyTreeJson[];
137
- }
138
- export declare class FormulaDependencyTreeModel {
139
- children: Set<FormulaDependencyTreeModel>;
140
- parents: Set<FormulaDependencyTreeModel>;
141
- treeId: number;
142
- formula: string;
143
- refOffsetX: number;
144
- refOffsetY: number;
145
- row: number;
146
- column: number;
147
- unitId: string;
148
- subUnitId: string;
149
- rangeList: IUnitRange[];
150
- refTreeId: number | undefined;
151
- constructor(tree: IFormulaDependencyTree);
152
- toJson(): IFormulaDependencyTreeJson;
153
- toFullJson(): IFormulaDependencyTreeFullJson;
154
- addParent(parent: FormulaDependencyTreeModel): void;
155
- addChild(child: FormulaDependencyTreeModel): void;
156
- }
157
118
  export {};
@@ -4,20 +4,17 @@ import { IFeatureCalculationManagerParam, IFeatureCalculationManagerService } fr
4
4
  import { FunctionNode } from '../ast-node';
5
5
  import { BaseAstNode } from '../ast-node/base-ast-node';
6
6
  import { IExecuteAstNodeData } from '../utils/ast-node-tool';
7
- import { IFormulaDependencyTree, IFormulaDependencyTreeFullJson, IFormulaDependencyTreeJson, FormulaDependencyTree, FormulaDependencyTreeModel, FormulaDependencyTreeVirtual } from './dependency-tree';
7
+ import { IFormulaDependencyTree, FormulaDependencyTree, FormulaDependencyTreeVirtual } from './dependency-tree';
8
8
  import { IFormulaCurrentConfigService } from '../../services/current-data.service';
9
9
  import { IDependencyManagerService } from '../../services/dependency-manager.service';
10
10
  import { IOtherFormulaManagerService } from '../../services/other-formula-manager.service';
11
11
  import { IFormulaRuntimeService } from '../../services/runtime.service';
12
12
  import { Lexer } from '../analysis/lexer';
13
- import { LexerTreeBuilder } from '../analysis/lexer-tree-builder';
14
13
  import { AstTreeBuilder } from '../analysis/parser';
15
14
  import { Interpreter } from '../interpreter/interpreter';
16
15
  export declare function generateRandomDependencyTreeId(dependencyManagerService: IDependencyManagerService): number;
17
16
  export interface IFormulaDependencyGenerator {
18
17
  generate(): Promise<IFormulaDependencyTree[]>;
19
- getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
20
- getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number): Promise<IFormulaDependencyTreeFullJson | undefined>;
21
18
  }
22
19
  export declare const IFormulaDependencyGenerator: import('@wendellhu/redi').IdentifierDecorator<IFormulaDependencyGenerator>;
23
20
  export declare class FormulaDependencyGenerator extends Disposable {
@@ -29,10 +26,9 @@ export declare class FormulaDependencyGenerator extends Disposable {
29
26
  protected readonly _astTreeBuilder: AstTreeBuilder;
30
27
  protected readonly _lexer: Lexer;
31
28
  protected readonly _dependencyManagerService: IDependencyManagerService;
32
- protected readonly _lexerTreeBuilder: LexerTreeBuilder;
33
29
  private _updateRangeFlattenCache;
34
30
  protected _dependencyRTreeCacheForAddressFunction: RTree;
35
- constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _otherFormulaManagerService: IOtherFormulaManagerService, _featureCalculationManagerService: IFeatureCalculationManagerService, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _lexer: Lexer, _dependencyManagerService: IDependencyManagerService, _lexerTreeBuilder: LexerTreeBuilder);
31
+ constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _otherFormulaManagerService: IOtherFormulaManagerService, _featureCalculationManagerService: IFeatureCalculationManagerService, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _lexer: Lexer, _dependencyManagerService: IDependencyManagerService);
36
32
  dispose(): void;
37
33
  generate(): Promise<(FormulaDependencyTree | FormulaDependencyTreeVirtual)[]>;
38
34
  private _dependencyFeatureCalculation;
@@ -114,15 +110,4 @@ export declare class FormulaDependencyGenerator extends Disposable {
114
110
  * @param treeList
115
111
  */
116
112
  protected _calculateRunList(treeList: IFormulaDependencyTree[]): (FormulaDependencyTree | FormulaDependencyTreeVirtual)[];
117
- protected _initializeGenerateTreeList(): Promise<IFormulaDependencyTree[]>;
118
- protected _getAllTreeList(): Promise<IFormulaDependencyTree[]>;
119
- protected _formulaDependencyTreeModel: Map<number, FormulaDependencyTreeModel>;
120
- protected _getTreeModel(treeId: number): FormulaDependencyTreeModel;
121
- protected _getDependencyTreeParenIds(tree: IFormulaDependencyTree): Set<number>;
122
- protected _getDependencyTreeChildrenIds(tree: IFormulaDependencyTree): Set<number>;
123
- protected _getFormulaDependencyTreeModel(tree: IFormulaDependencyTree): FormulaDependencyTreeModel;
124
- protected _endFormulaDependencyTreeModel(): void;
125
- protected _startFormulaDependencyTreeModel(): void;
126
- getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
127
- getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number): Promise<IFormulaDependencyTreeFullJson | undefined>;
128
113
  }
@@ -1,5 +1,5 @@
1
1
  import { IDisposable, ICommandService, IConfigService, Injector } from '@univerjs/core';
2
- import { FormulaExecutedStateType, IExecutionInProgressParams, IFormulaDependencyTreeFullJson, IFormulaDependencyTreeJson, IFormulaExecuteResultMap, IFormulaStringMap, ISequenceNode, LexerTreeBuilder } from '@univerjs/engine-formula';
2
+ import { FormulaExecutedStateType, IExecutionInProgressParams, ISequenceNode, LexerTreeBuilder } from '@univerjs/engine-formula';
3
3
  import { FBase } from '@univerjs/core/facade';
4
4
  /**
5
5
  * This interface class provides methods to modify the behavior of the operation formula.
@@ -146,131 +146,4 @@ export declare class FFormula extends FBase {
146
146
  * ```
147
147
  */
148
148
  setMaxIteration(maxIteration: number): void;
149
- /**
150
- * Execute a batch of formulas asynchronously and receive computed results.
151
- *
152
- * Each formula cell is represented as a string array:
153
- * [fullFormula, ...subFormulas]
154
- *
155
- * Where:
156
- * - fullFormula (index 0) is the complete formula expression written in the cell.
157
- * Example: "=SUM(A1:A10) + SQRT(D7)".
158
- *
159
- * - subFormulas (index 1+) are **optional decomposed expressions** extracted from
160
- * the full formula. Each of them can be independently computed by the formula engine.
161
- *
162
- * These sub-expressions can include:
163
- * - Single-cell references: "A2", "B2", "C5"
164
- * - Range references: "A1:A10"
165
- * - Function calls: "SQRT(D7)", "ABS(A2-B2)"
166
- * - Any sub-formula that was parsed out of the original formula and can be
167
- * evaluated on its own.
168
- *
169
- * The batch execution engine may use these sub-formulas for dependency resolution,
170
- * incremental computation, or performance optimizations.
171
- *
172
- * @param {IFormulaStringMap} formulas
173
- * Nested structure (unit → sheet → row → column) describing formulas and
174
- * their decomposed sub-expressions.
175
- *
176
- * @param {(result: IFormulaExecuteResultMap) => void} callback
177
- * Receives the computed value map mirroring the input structure.
178
- *
179
- * @returns {IDisposable}
180
- * A disposer to stop listening for batch results.
181
- *
182
- * @example
183
- * ```ts
184
- * const formulaEngine = univerAPI.getFormula();
185
- * const formulas = {
186
- * Book1: {
187
- * Sheet1: {
188
- * 2: {
189
- * 3: [
190
- * // Full formula:
191
- * "=SUM(A1:A10) + SQRT(D7)",
192
- *
193
- * // Decomposed sub-formulas (each one can be evaluated independently):
194
- * "SUM(A1:A10)", // sub-formula 1
195
- * "SQRT(D7)", // sub-formula 2
196
- * "A1:A10", // range reference
197
- * "D7", // single-cell reference
198
- * ],
199
- * },
200
- * 4: {
201
- * 5: [
202
- * "=A2 + B2 + SQRT(C5)",
203
- * "A2",
204
- * "B2",
205
- * "SQRT(C5)",
206
- * ],
207
- * }
208
- * },
209
- * },
210
- * };
211
- *
212
- * const disposer = formulaEngine.executeFormulas(formulas, (result) => {
213
- * console.log(result);
214
- * });
215
- *
216
- * ```
217
- */
218
- executeFormulas(formulas: IFormulaStringMap, callback: (result: IFormulaExecuteResultMap) => void): void;
219
- /**
220
- * Retrieve all formula dependency trees that were produced during the latest
221
- * dependency-analysis run. This triggers a local dependency-calculation command
222
- * and returns the complete set of dependency trees once the calculation finishes.
223
- *
224
- * @param callback A function invoked with the resulting array of dependency trees.
225
- *
226
- * @returns {IDisposable} An object that disposes the internal event listener.
227
- *
228
- * @example
229
- * ```ts
230
- * const formulaEngine = univerAPI.getFormula();
231
- *
232
- * // Fetch all dependency trees generated for the current workbook.
233
- * const disposable = formulaEngine.getAllDependencyTrees((trees) => {
234
- * console.log('All dependency trees:', trees);
235
- * });
236
- *
237
- * ```
238
- */
239
- getAllDependencyTrees(callback: (result: IFormulaDependencyTreeJson[]) => void): void;
240
- /**
241
- * Retrieve the dependency tree of a specific cell. This triggers a local
242
- * dependency-calculation command for the given unit, sheet, and cell location,
243
- * and returns the computed dependency tree when the calculation is completed.
244
- *
245
- * @param param The target cell location:
246
- * - `unitId` The workbook ID.
247
- * - `sheetId` The sheet ID.
248
- * - `row` The zero-based row index.
249
- * - `column` The zero-based column index.
250
- *
251
- * @param callback A function invoked with the resulting dependency tree or
252
- * `undefined` if no dependency tree exists for that cell.
253
- *
254
- * @returns {IDisposable} An object that disposes the internal event listener.
255
- *
256
- * @example
257
- * ```ts
258
- * const formulaEngine = univerAPI.getFormula();
259
- *
260
- * // Query the dependency tree for cell B2 in a specific sheet.
261
- * const disposable = formulaEngine.getCellDependencyTree(
262
- * { unitId: 'workbook1', sheetId: 'sheet1', row: 1, column: 1 },
263
- * (tree) => {
264
- * console.log('Cell dependency tree:', tree);
265
- * }
266
- * );
267
- *
268
- * ```
269
- */
270
- getCellDependencyTree(param: {
271
- unitId: string;
272
- sheetId: string;
273
- row: number;
274
- column: number;
275
- }, callback: (result: IFormulaDependencyTreeFullJson | undefined) => void): void;
276
149
  }
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export type { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IFormulaExecuteResultMap, IFormulaStringMap, IRuntimeImageFormulaDataType, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitImageFormulaDataType, IUnitSheetNameMap, } from './basics/common';
16
+ export type { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeImageFormulaDataType, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitImageFormulaDataType, IUnitSheetNameMap, } from './basics/common';
17
17
  export { BooleanValue } from './basics/common';
18
18
  export { type IOtherFormulaData } from './basics/common';
19
19
  export { type IUnitRowData } from './basics/common';
@@ -33,7 +33,7 @@ export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation }
33
33
  export { type ISetDefinedNameMutationParam, type ISetDefinedNameMutationSearchParam, RemoveDefinedNameMutation, SetDefinedNameMutation } from './commands/mutations/set-defined-name.mutation';
34
34
  export { SetDefinedNameMutationFactory } from './commands/mutations/set-defined-name.mutation';
35
35
  export { RemoveFeatureCalculationMutation, SetFeatureCalculationMutation } from './commands/mutations/set-feature-calculation.mutation';
36
- export { type ISetCellFormulaDependencyCalculationResultMutation, type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalculationResultMutation, type ISetFormulaCalculationStartMutation, type ISetFormulaDependencyCalculationMutation, type ISetFormulaDependencyCalculationResultMutation, type ISetFormulaStringBatchCalculationResultMutation, SetCellFormulaDependencyCalculationMutation, SetCellFormulaDependencyCalculationResultMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, SetFormulaDependencyCalculationMutation, SetFormulaDependencyCalculationResultMutation, SetFormulaStringBatchCalculationMutation, SetFormulaStringBatchCalculationResultMutation, } from './commands/mutations/set-formula-calculation.mutation';
36
+ export { type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalculationResultMutation, type ISetFormulaCalculationStartMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, } from './commands/mutations/set-formula-calculation.mutation';
37
37
  export { type ISetFormulaDataMutationParams, SetFormulaDataMutation } from './commands/mutations/set-formula-data.mutation';
38
38
  export { type ISetImageFormulaDataMutationParams, SetImageFormulaDataMutation } from './commands/mutations/set-image-formula-data.mutation';
39
39
  export { type IRemoveOtherFormulaMutationParams, type ISetOtherFormulaMutationParams, RemoveOtherFormulaMutation, SetOtherFormulaMutation } from './commands/mutations/set-other-formula.mutation';
@@ -56,7 +56,7 @@ export { ReferenceNodeFactory } from './engine/ast-node/reference-node';
56
56
  export { SuffixNodeFactory } from './engine/ast-node/suffix-node';
57
57
  export { UnionNodeFactory } from './engine/ast-node/union-node';
58
58
  export { ValueNodeFactory } from './engine/ast-node/value-node';
59
- export { FormulaDependencyTree, FormulaDependencyTreeModel, type IFormulaDependencyTree, type IFormulaDependencyTreeFullJson, type IFormulaDependencyTreeJson } from './engine/dependency/dependency-tree';
59
+ export { FormulaDependencyTree, type IFormulaDependencyTree } from './engine/dependency/dependency-tree';
60
60
  export { FormulaDependencyTreeType } from './engine/dependency/dependency-tree';
61
61
  export { FormulaDependencyTreeVirtual } from './engine/dependency/dependency-tree';
62
62
  export { FormulaDependencyGenerator, IFormulaDependencyGenerator } from './engine/dependency/formula-dependency';
@@ -1,11 +1,10 @@
1
1
  import { Observable, Subject } from 'rxjs';
2
- import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFeatureDirtyRangeType, IFormulaData, IFormulaDatasetConfig, IFormulaExecuteResultMap, IFormulaStringMap, IRuntimeUnitDataType, IUnitRowData } from '../basics/common';
3
- import { IFormulaDependencyTreeFullJson, IFormulaDependencyTreeJson } from '../engine/dependency/dependency-tree';
4
- import { FunctionVariantType } from '../engine/reference-object/base-reference-object';
2
+ import { IFeatureDirtyRangeType, IFormulaDatasetConfig, IRuntimeUnitDataType } from '../basics/common';
5
3
  import { IAllRuntimeData, IExecutionInProgressParams, IFormulaRuntimeService } from './runtime.service';
6
4
  import { Disposable, IConfigService } from '@univerjs/core';
7
5
  import { Lexer } from '../engine/analysis/lexer';
8
6
  import { AstTreeBuilder } from '../engine/analysis/parser';
7
+ import { ErrorNode } from '../engine/ast-node/base-ast-node';
9
8
  import { IFormulaDependencyGenerator } from '../engine/dependency/formula-dependency';
10
9
  import { Interpreter } from '../engine/interpreter/interpreter';
11
10
  import { IFormulaCurrentConfigService } from './current-data.service';
@@ -20,9 +19,6 @@ export interface ICalculateFormulaService {
20
19
  execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
21
20
  stopFormulaExecution(): void;
22
21
  calculate(formulaString: string, transformSuffix?: boolean): void;
23
- executeFormulas(formulas: IFormulaStringMap, formulaData: IFormulaData, arrayFormulaCellData: IArrayFormulaUnitCellType, arrayFormulaRange: IArrayFormulaRangeType, rowData: IUnitRowData): Promise<IFormulaExecuteResultMap>;
24
- getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
25
- getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number): Promise<IFormulaDependencyTreeFullJson | undefined>;
26
22
  }
27
23
  export declare const ICalculateFormulaService: import('@wendellhu/redi').IdentifierDecorator<ICalculateFormulaService>;
28
24
  export declare class CalculateFormulaService extends Disposable implements ICalculateFormulaService {
@@ -57,8 +53,5 @@ export declare class CalculateFormulaService extends Disposable implements ICalc
57
53
  private _executeStep;
58
54
  private _getArrayFormulaDirtyRangeAndExcludedRange;
59
55
  protected _apply(isArrayFormulaState?: boolean): Promise<IAllRuntimeData | undefined>;
60
- executeFormulas(formulas: IFormulaStringMap, formulaData: IFormulaData, arrayFormulaCellData: IArrayFormulaUnitCellType, arrayFormulaRange: IArrayFormulaRangeType, rowData?: IUnitRowData): Promise<IFormulaExecuteResultMap>;
61
- calculate(formulaString: string): Promise<FunctionVariantType | undefined>;
62
- getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
63
- getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number): Promise<IFormulaDependencyTreeFullJson | undefined>;
56
+ calculate(formulaString: string, transformSuffix?: boolean): ErrorNode | undefined;
64
57
  }
@@ -1,5 +1,5 @@
1
1
  import { IUnitRange, LocaleType, Nullable, Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
- import { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetIdToNameMap, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
2
+ import { IArrayFormulaRangeType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetIdToNameMap, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
3
3
  import { FormulaDataModel } from '../models/formula-data.model';
4
4
  import { ISheetRowFilteredService } from './sheet-row-filtered.service';
5
5
  export interface IFormulaDirtyData {
@@ -55,7 +55,6 @@ export interface IFormulaCurrentConfigService {
55
55
  };
56
56
  getFilteredOutRows(unitId: string, sheetId: string, startRow: number, endRow: number): number[];
57
57
  setSheetNameMap(sheetIdToNameMap: IUnitSheetIdToNameMap): void;
58
- loadDataLite(formulaData: IFormulaData, arrayFormulaCellData: IArrayFormulaUnitCellType, arrayFormulaRange: IArrayFormulaRangeType, rowData?: IUnitRowData): void;
59
58
  }
60
59
  export declare class FormulaCurrentConfigService extends Disposable implements IFormulaCurrentConfigService {
61
60
  private readonly _univerInstanceService;
@@ -114,7 +113,6 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
114
113
  };
115
114
  getFilteredOutRows(unitId: string, sheetId: string, startRow: number, endRow: number): number[];
116
115
  load(config: IFormulaDatasetConfig): void;
117
- loadDataLite(formulaData: IFormulaData, arrayFormulaCellData: IArrayFormulaUnitCellType, arrayFormulaRange: IArrayFormulaRangeType, rowData?: IUnitRowData): void;
118
116
  getDirtyData(): IFormulaDirtyData;
119
117
  loadDirtyRangesAndExcludedCell(dirtyRanges: IUnitRange[], excludedCell?: IUnitExcludedCell): void;
120
118
  registerUnitData(unitData: IUnitData): void;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(a,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@univerjs/core/facade"),require("@univerjs/core"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core/facade","@univerjs/core","@univerjs/engine-formula","rxjs"],u):(a=typeof globalThis<"u"?globalThis:a||self,u(a.UniverEngineFormulaFacade={},a.UniverCoreFacade,a.UniverCore,a.UniverEngineFormula,a.rxjs))})(this,(function(a,u,c,n,l){"use strict";var f=Object.getOwnPropertyDescriptor,p=(s,e,t,i)=>{for(var r=i>1?void 0:i?f(e,t):e,o=s.length-1,m;o>=0;o--)(m=s[o])&&(r=m(r)||r);return r},d=(s,e)=>(t,i)=>e(t,i,s);a.FFormula=class extends u.FBase{constructor(e,t,i,r){super(),this._commandService=e,this._injector=t,this._lexerTreeBuilder=i,this._configService=r,this._initialize()}_initialize(){}get lexerTreeBuilder(){return this._lexerTreeBuilder}moveFormulaRefOffset(e,t,i,r){return this._lexerTreeBuilder.moveFormulaRefOffset(e,t,i,r)}sequenceNodesBuilder(e){return this._lexerTreeBuilder.sequenceNodesBuilder(e)||[]}executeCalculation(){this._commandService.executeCommand(n.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})}stopCalculation(){this._commandService.executeCommand(n.SetFormulaCalculationStopMutation.id,{})}calculationStart(e){return this._commandService.onCommandExecuted(t=>{if(t.id===n.SetFormulaCalculationStartMutation.id){const i=t.params;e(i.forceCalculation)}})}calculationEnd(e){return this._commandService.onCommandExecuted(t=>{if(t.id!==n.SetFormulaCalculationNotificationMutation.id)return;const i=t.params;i.functionsExecutedState!==void 0&&e(i.functionsExecutedState)})}whenComputingCompleteAsync(e){const t=this._injector.get(n.GlobalComputingStatusService);return t.computingStatus?Promise.resolve(!0):l.firstValueFrom(l.race(t.computingStatus$.pipe(l.filter(i=>i)),l.timer(e!=null?e:3e4).pipe(l.map(()=>!1))))}onCalculationEnd(){return new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("Calculation end timeout"))},3e4),r=this.calculationEnd(()=>{clearTimeout(i),r.dispose(),e()})})}calculationProcessing(e){return this._commandService.onCommandExecuted(t=>{if(t.id!==n.SetFormulaCalculationNotificationMutation.id)return;const i=t.params;i.stageInfo!==void 0&&e(i.stageInfo)})}setMaxIteration(e){this._configService.setConfig(n.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT,e)}executeFormulas(e,t){this._commandService.executeCommand(n.SetFormulaStringBatchCalculationMutation.id,{formulas:e},{onlyLocal:!0});const i=this._commandService.onCommandExecuted(r=>{if(r.id!==n.SetFormulaStringBatchCalculationResultMutation.id)return;const o=r.params;o.result!=null&&t(o.result),i.dispose()})}getAllDependencyTrees(e){this._commandService.executeCommand(n.SetFormulaDependencyCalculationMutation.id,void 0,{onlyLocal:!0});const t=this._commandService.onCommandExecuted(i=>{if(i.id!==n.SetFormulaDependencyCalculationResultMutation.id)return;const r=i.params;r.result!=null&&e(r.result),t.dispose()})}getCellDependencyTree(e,t){this._commandService.executeCommand(n.SetCellFormulaDependencyCalculationMutation.id,e,{onlyLocal:!0});const i=this._commandService.onCommandExecuted(r=>{if(r.id!==n.SetCellFormulaDependencyCalculationResultMutation.id)return;const o=r.params;o.result!==void 0&&t(o.result),i.dispose()})}},a.FFormula=p([d(0,c.Inject(c.ICommandService)),d(1,c.Inject(c.Injector)),d(2,c.Inject(n.LexerTreeBuilder)),d(3,c.IConfigService)],a.FFormula);class v extends u.FUniver{getFormula(){return this._injector.createInstance(a.FFormula)}}u.FUniver.extend(v),Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(r,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core/facade"),require("@univerjs/core"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core/facade","@univerjs/core","@univerjs/engine-formula","rxjs"],o):(r=typeof globalThis<"u"?globalThis:r||self,o(r.UniverEngineFormulaFacade={},r.UniverCoreFacade,r.UniverCore,r.UniverEngineFormula,r.rxjs))})(this,(function(r,o,u,a,s){"use strict";var f=Object.getOwnPropertyDescriptor,v=(c,e,t,i)=>{for(var n=i>1?void 0:i?f(e,t):e,d=c.length-1,m;d>=0;d--)(m=c[d])&&(n=m(n)||n);return n},l=(c,e)=>(t,i)=>e(t,i,c);r.FFormula=class extends o.FBase{constructor(e,t,i,n){super(),this._commandService=e,this._injector=t,this._lexerTreeBuilder=i,this._configService=n,this._initialize()}_initialize(){}get lexerTreeBuilder(){return this._lexerTreeBuilder}moveFormulaRefOffset(e,t,i,n){return this._lexerTreeBuilder.moveFormulaRefOffset(e,t,i,n)}sequenceNodesBuilder(e){return this._lexerTreeBuilder.sequenceNodesBuilder(e)||[]}executeCalculation(){this._commandService.executeCommand(a.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})}stopCalculation(){this._commandService.executeCommand(a.SetFormulaCalculationStopMutation.id,{})}calculationStart(e){return this._commandService.onCommandExecuted(t=>{if(t.id===a.SetFormulaCalculationStartMutation.id){const i=t.params;e(i.forceCalculation)}})}calculationEnd(e){return this._commandService.onCommandExecuted(t=>{if(t.id!==a.SetFormulaCalculationNotificationMutation.id)return;const i=t.params;i.functionsExecutedState!==void 0&&e(i.functionsExecutedState)})}whenComputingCompleteAsync(e){const t=this._injector.get(a.GlobalComputingStatusService);return t.computingStatus?Promise.resolve(!0):s.firstValueFrom(s.race(t.computingStatus$.pipe(s.filter(i=>i)),s.timer(e!=null?e:3e4).pipe(s.map(()=>!1))))}onCalculationEnd(){return new Promise((e,t)=>{const i=setTimeout(()=>{t(new Error("Calculation end timeout"))},3e4),n=this.calculationEnd(()=>{clearTimeout(i),n.dispose(),e()})})}calculationProcessing(e){return this._commandService.onCommandExecuted(t=>{if(t.id!==a.SetFormulaCalculationNotificationMutation.id)return;const i=t.params;i.stageInfo!==void 0&&e(i.stageInfo)})}setMaxIteration(e){this._configService.setConfig(a.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT,e)}},r.FFormula=v([l(0,u.Inject(u.ICommandService)),l(1,u.Inject(u.Injector)),l(2,u.Inject(a.LexerTreeBuilder)),l(3,u.IConfigService)],r.FFormula);class C extends o.FUniver{getFormula(){return this._injector.createInstance(r.FFormula)}}o.FUniver.extend(C),Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));