@univerjs/engine-formula 1.4.0 → 1.5.0

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.
Files changed (39) hide show
  1. package/README.md +23 -5
  2. package/lib/cjs/facade.js +2 -2
  3. package/lib/cjs/index.js +13 -4
  4. package/lib/cjs/{plugin-CDy-SbDF.js → plugin-BLJLwyCu.js} +2467 -1554
  5. package/lib/cjs/worker.js +1 -1
  6. package/lib/es/facade.js +2 -2
  7. package/lib/es/index.js +2 -2
  8. package/lib/es/{plugin-BO47k05w.js → plugin-USnMdaGa.js} +2546 -1627
  9. package/lib/es/worker.js +1 -1
  10. package/lib/facade.js +2 -2
  11. package/lib/index.js +2 -2
  12. package/lib/{plugin-BO47k05w.js → plugin-USnMdaGa.js} +2546 -1627
  13. package/lib/types/basics/complex.d.ts +10 -4
  14. package/lib/types/basics/date.d.ts +6 -1
  15. package/lib/types/basics/function.d.ts +2 -1
  16. package/lib/types/basics/inverted-index-cache.d.ts +2 -1
  17. package/lib/types/controllers/calculate.controller.d.ts +0 -2
  18. package/lib/types/engine/analysis/lexer-tree-builder.d.ts +1 -3
  19. package/lib/types/engine/analysis/lexer.d.ts +6 -2
  20. package/lib/types/engine/analysis/parser.d.ts +3 -1
  21. package/lib/types/engine/ast-node/reference-node.d.ts +1 -4
  22. package/lib/types/engine/ast-node/union-node.d.ts +1 -3
  23. package/lib/types/engine/reference-object/base-reference-object.d.ts +5 -3
  24. package/lib/types/engine/utils/generate-ast-node.d.ts +0 -2
  25. package/lib/types/engine/utils/three-dimensional-reference.d.ts +21 -0
  26. package/lib/types/engine/value-object/array-value-object.d.ts +4 -0
  27. package/lib/types/index.d.ts +3 -2
  28. package/lib/types/models/formula-data-snapshot.d.ts +24 -0
  29. package/lib/types/models/formula-data.model.d.ts +9 -1
  30. package/lib/types/services/calculate-formula.service.d.ts +11 -1
  31. package/lib/types/services/current-data.service.d.ts +12 -0
  32. package/lib/types/services/formula/formula-calculation-session.service.d.ts +2 -1
  33. package/lib/types/services/formula-cache.service.d.ts +47 -0
  34. package/lib/types/services/formula-result.service.d.ts +29 -0
  35. package/lib/types/services/function.service.d.ts +3 -0
  36. package/lib/types/services/runtime.service.d.ts +15 -3
  37. package/lib/umd/index.js +4 -4
  38. package/lib/worker.js +1 -1
  39. package/package.json +6 -6
@@ -18,8 +18,10 @@ import type { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IFeatureDirtyRan
18
18
  import type { BaseAstNode } from '../engine/ast-node/base-ast-node';
19
19
  import type { IFormulaDependencyTreeJson } from '../engine/dependency/dependency-tree';
20
20
  import type { FunctionVariantType } from '../engine/reference-object/base-reference-object';
21
+ import type { FormulaCalculationCache } from './formula-cache.service';
21
22
  import { Disposable, IUniverInstanceService } from '@univerjs/core';
22
23
  import { IFormulaCurrentConfigService } from './current-data.service';
24
+ import { FormulaCacheService } from './formula-cache.service';
23
25
  import { IHyperlinkEngineFormulaService } from './hyperlink-engine-formula.service';
24
26
  /**
25
27
  * The formula engine has a lot of stages. IDLE and CALCULATION_COMPLETED can be considered as
@@ -88,7 +90,12 @@ export interface IFormulaRuntimeService {
88
90
  currentUnitId: string;
89
91
  dispose(): void;
90
92
  reset(): void;
91
- beginCircularReferences(): void;
93
+ /** Custom runtimes without cache hooks continue to compute uncached values. */
94
+ getCalculationCache?(): FormulaCalculationCache | undefined;
95
+ clearInvertedIndexCache?(): void;
96
+ releaseCalculationCache?(): void;
97
+ /** Start empty when the engine will supply the complete current cycle set. */
98
+ beginCircularReferences(clearPrevious?: boolean): void;
92
99
  clearCircularReferenceCells(cells: {
93
100
  unitId: string;
94
101
  subUnitId: string;
@@ -149,9 +156,11 @@ export interface IFormulaRuntimeService {
149
156
  getDependencyTreeModelData(): IFormulaDependencyTreeJson[];
150
157
  }
151
158
  export declare class FormulaRuntimeService extends Disposable implements IFormulaRuntimeService {
159
+ private readonly _cacheService;
152
160
  private readonly _currentConfigService;
153
161
  private readonly _hyperlinkEngineFormulaService;
154
162
  private readonly _univerInstanceService;
163
+ private _calculationCache;
155
164
  private _formulaExecuteStage;
156
165
  private _circularReferences;
157
166
  private _pendingCircularReferences;
@@ -184,7 +193,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
184
193
  private _formulaCycleIndex;
185
194
  private _isCycleDependency;
186
195
  private _dependencyTreeModelData;
187
- constructor(_currentConfigService: IFormulaCurrentConfigService, _hyperlinkEngineFormulaService: IHyperlinkEngineFormulaService, _univerInstanceService: IUniverInstanceService);
196
+ constructor(_cacheService: FormulaCacheService, _currentConfigService: IFormulaCurrentConfigService, _hyperlinkEngineFormulaService: IHyperlinkEngineFormulaService, _univerInstanceService: IUniverInstanceService);
188
197
  get currentRow(): number;
189
198
  get currentColumn(): number;
190
199
  get currentRowCount(): number;
@@ -213,9 +222,12 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
213
222
  isStopExecution(): boolean;
214
223
  setFormulaExecuteStage(type: FormulaExecuteStageType): void;
215
224
  getFormulaExecuteStage(): FormulaExecuteStageType;
225
+ getCalculationCache(): FormulaCalculationCache | undefined;
226
+ clearInvertedIndexCache(): void;
227
+ releaseCalculationCache(): void;
216
228
  reset(): void;
217
229
  clearReferenceAndNumberformatCache(): void;
218
- beginCircularReferences(): void;
230
+ beginCircularReferences(clearPrevious?: boolean): void;
219
231
  clearCircularReferenceCells(cells: {
220
232
  unitId: string;
221
233
  subUnitId: string;