@univerjs-pro/engine-formula 1.0.0-alpha.2 → 1.0.0-alpha.3

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.
@@ -1,6 +1,6 @@
1
1
  import type { IUnitRange, Nullable } from '@univerjs/core';
2
2
  import type { BaseAstNode, IFormulaDataItem, IFormulaDependencyTree, IFormulaDependencyTreeJson, IUnitData } from '@univerjs/engine-formula';
3
- import type { DynamicResolver } from './dependency-engine';
3
+ import type { DynamicResolver } from './dependency-engine/types';
4
4
  import type { ISharedFormulaCompressionMetrics } from './shared-formula-group-analyzer';
5
5
  import { FormulaDependencyGenerator, FormulaDependencyTree, FormulaDependencyTreeType } from '@univerjs/engine-formula';
6
6
  export interface IFormulaCalculationTree {
@@ -37,14 +37,14 @@ export declare class FormulaDependencyProGenerator extends FormulaDependencyGene
37
37
  clearCachedCalculationNodeData(): void;
38
38
  clearCachedCalculationTree(): void;
39
39
  getCachedCalculationNodeData(nodeIndex: number): IFormulaCalculationNodeData | undefined;
40
- getCalculationOrder(): import("./dependency-engine").ICalculationOrderResult;
40
+ getCalculationOrder(): import("./dependency-engine/types").ICalculationOrderResult;
41
41
  getSharedFormulaCompressionMetrics(): ISharedFormulaCompressionMetrics;
42
42
  hasDynamicDepsByIndex(nodeIndex: number): boolean;
43
43
  refreshDynamicDepsByIndex(nodeIndex: number, resolver: DynamicResolver): boolean;
44
44
  hasUncalculatedDirtyPrecedentByIndex(nodeIndex: number, calculatedNodeIndices: ReadonlySet<number>): boolean;
45
45
  getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
46
46
  generatePro(isCalculateTreeModel?: boolean): Promise<{
47
- calculationOrderResult: import("./dependency-engine").ICalculationOrderResult;
47
+ calculationOrderResult: import("./dependency-engine/types").ICalculationOrderResult;
48
48
  dependencyTree: Map<number, IFormulaCalculationTree>;
49
49
  }>;
50
50
  /**
@@ -66,9 +66,12 @@ export declare class FormulaDependencyProGenerator extends FormulaDependencyGene
66
66
  private _normalizeSharedFormulaRange;
67
67
  private _recordCompressedSharedFormulaGroupMetrics;
68
68
  private _recordExpandedSharedFormulaGroupMetrics;
69
+ private _shouldEagerCacheCalculationTrees;
70
+ private _hasAnyDirtyMapValue;
69
71
  private _markDirtyDependenciesPro;
70
72
  private _markForcedRecalculationNodesPro;
71
73
  private _markDirtyDefinedNameDependenciesPro;
74
+ private _markDirtySuperTableDependenciesPro;
72
75
  private _cacheCalculationTree;
73
76
  private _cacheCompressedVirtualCalculationTree;
74
77
  private _getOffsetRangeList;
@@ -78,13 +81,36 @@ export declare class FormulaDependencyProGenerator extends FormulaDependencyGene
78
81
  private _releaseDependencyTree;
79
82
  private _hasDirtyDefinedNames;
80
83
  private _syncForcedRecalculationNodeIndex;
81
- private _syncCompressedVirtualForcedRecalculationNodeIndex;
84
+ private _hasForcedRecalculationFunction;
82
85
  private _detectForcedRecalculationNodePro;
83
86
  private _includeDirtyDefinedNamePro;
87
+ private _includeDirtySuperTablePro;
84
88
  private _ensureTreeInitializedForDependencies;
85
- private _ensureTreeNodeForCalculation;
86
89
  private _getFeatureFormulaDependencyNodes;
87
90
  private _rangesIntersectAny;
88
91
  private _initialAstNodeAndRanges;
92
+ private _initialDependencyRanges;
93
+ private _tryInitialStaticReferenceRanges;
94
+ private _replaceDoubleQuotedStrings;
95
+ private _replaceQuotedSheetNames;
96
+ private _hasOnlyStaticReferenceSafeIdentifiers;
97
+ private _looksLikeA1ReferenceAt;
98
+ private _looksLikeColumnReferencePart;
99
+ private _isStaticReferenceTokenBoundarySafe;
100
+ private _tryCreateStaticReferenceRange;
101
+ private _tryCreateStaticColumnReferenceRange;
102
+ private _tryExtractStaticOffsetRanges;
103
+ private _tryCreateStaticOffsetRange;
104
+ private _tryInferOffsetRowSpan;
105
+ private _tryInferPositiveInteger;
106
+ private _tryParseInteger;
107
+ private _tryParseSingleStaticReference;
108
+ private _extractFunctionCalls;
109
+ private _findMatchingParen;
110
+ private _splitTopLevelArguments;
111
+ private _getStaticReferenceSheetSize;
112
+ private _dedupeStaticReferenceRanges;
113
+ private _columnNameToIndex;
114
+ private _nextNonSpaceChar;
89
115
  protected _createFDtree(unitId: string, sheetId: string, row: number, column: number, unitData: IUnitData, formulaDataItem: IFormulaDataItem): FormulaDependencyTree;
90
116
  }
@@ -1,5 +1,6 @@
1
- export { FormulaDependencyProGenerator } from './engine/formula-dependency';
2
1
  export { UniverProFormulaEnginePlugin } from './plugin';
3
- export { CalculateFormulaProService } from './services/calculate-formula.service';
4
- export { DependencyManagerProService } from './services/dependency-manager.service';
5
- export * from '@univerjs/engine-formula';
2
+ export { RemoveSuperTableMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetSuperTableMutation, } from '@univerjs/engine-formula';
3
+ export type { ISetFormulaCalculationResultMutation, ISetFormulaCalculationStartMutation, ISuperTable, } from '@univerjs/engine-formula';
4
+ export { SetFormulaDataMutation } from '@univerjs/engine-formula';
5
+ export type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
6
+ export { FormulaCalculationTriggerService, FormulaDataModel, IActiveDirtyManagerService, ISuperTableService, } from '@univerjs/engine-formula';
@@ -1,5 +1,5 @@
1
1
  import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
2
- import type { CalcNodeIndex, DynamicResolver, ICalculationOrderResult } from '../engine/dependency-engine';
2
+ import type { CalcNodeIndex, DynamicResolver, ICalculationOrderResult } from '../engine/dependency-engine/types';
3
3
  import type { IFormulaCalculationTree } from '../engine/formula-dependency';
4
4
  import { CalculateFormulaService } from '@univerjs/engine-formula';
5
5
  export declare class CalculateFormulaProService extends CalculateFormulaService {
@@ -8,7 +8,8 @@ export declare class CalculateFormulaProService extends CalculateFormulaService
8
8
  protected _executeStep(cycleReferenceCount?: number): Promise<true | undefined>;
9
9
  protected _apply(isArrayFormulaState?: boolean, cycleReferenceCount?: number): Promise<import("@univerjs/engine-formula").IAllRuntimeData | undefined>;
10
10
  private _shouldRescheduleAfterDynamicChange;
11
- protected _forEachCalculationPlanTree(calculationOrderResult: Pick<ICalculationOrderResult, 'calculationForest'>, dependencyTree: Map<CalcNodeIndex, IFormulaCalculationTree>, cycleReferenceCount: number, visitor: (tree: IFormulaCalculationTree, nodeIndex: CalcNodeIndex, cycleIndex?: number) => Promise<boolean | void>): Promise<void>;
11
+ protected _forEachCalculationPlanTree(calculationOrderResult: Pick<ICalculationOrderResult, 'calculationForest'>, dependencyTree: Map<CalcNodeIndex, IFormulaCalculationTree>, cycleReferenceCount: number, visitor: (tree: IFormulaCalculationTree, nodeIndex: CalcNodeIndex, cycleIndex?: number, shouldPreserveCycleTree?: boolean) => Promise<boolean | void>): Promise<void>;
12
+ private _calculationPlanHasSelfReference;
12
13
  protected _getCalculationPlanTreeCount(calculationOrderResult: Pick<ICalculationOrderResult, 'calculationForest'>, dependencyTree: Map<CalcNodeIndex, IFormulaCalculationTree>, cycleReferenceCount: number): number;
13
14
  protected _getDynamicResolver(): DynamicResolver | undefined;
14
15
  private _refreshDynamicDepsAfterCalculate;
@@ -17,5 +18,9 @@ export declare class CalculateFormulaProService extends CalculateFormulaService
17
18
  private _getRangeSignature;
18
19
  private _waitForExecutionSlot;
19
20
  private _calculateDependencyTree;
21
+ private _setFunctionRefInfoForTree;
22
+ private _formulaReferencesTreeCell;
23
+ private _isReferenceMetadataFunctionArgument;
24
+ private _parseA1Reference;
20
25
  private _getCalculationNodeData;
21
26
  }
@@ -1,6 +1,6 @@
1
1
  import type { IUnitRange } from '@univerjs/core';
2
2
  import type { FormulaDependencyTree, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IFormulaDependencyTree } from '@univerjs/engine-formula';
3
- import type { DynamicResolver, ICalcNodeRef, ICompressedSharedFormulaGroup } from '../engine/dependency-engine';
3
+ import type { DynamicResolver, ICalcNodeRef, ICompressedSharedFormulaGroup } from '../engine/dependency-engine/types';
4
4
  import { DependencyManagerBaseService } from '@univerjs/engine-formula';
5
5
  export declare class DependencyManagerProService extends DependencyManagerBaseService {
6
6
  private _dependencyEngineCache;
@@ -16,8 +16,13 @@ export declare class DependencyManagerProService extends DependencyManagerBaseSe
16
16
  clearFeatureFormulaDependency(unitId: string, sheetId?: string): void;
17
17
  getFeatureFormulaDependencyPro(unitId: string, sheetId: string, featureId: string): number | undefined;
18
18
  getFeatureFormulaDependencyNodePro(unitId: string, sheetId: string, featureId: string): ICalcNodeRef;
19
+ reserveFormulaDependencyCapacity(minNodeCapacity: number, minRangeCapacity?: number): void;
19
20
  addFormulaDependencyPro(unitId: string, sheetId: string, row: number, column: number, dependencyTree: IFormulaDependencyTree, featureNodes?: ICalcNodeRef[], mode?: 'replace' | 'merge'): number;
20
21
  addFormulaDependencyNodeOnlyPro(unitId: string, sheetId: string, row: number, column: number): number;
22
+ addFormulaDependencyNodeOnlyRangePro(unitId: string, sheetId: string, range: IUnitRange['range'], skip?: {
23
+ row: number;
24
+ col: number;
25
+ }): number[];
21
26
  registerCompressedSharedFormulaGroup(group: ICompressedSharedFormulaGroup): void;
22
27
  clearCompressedSharedFormulaGroups(unitId?: string, sheetId?: string): void;
23
28
  removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void;
@@ -45,5 +50,5 @@ export declare class DependencyManagerProService extends DependencyManagerBaseSe
45
50
  prepareDynamicDependencies(resolver: DynamicResolver): boolean;
46
51
  getCalculationOrder(options?: {
47
52
  detectCycles?: boolean;
48
- }): import("../engine/dependency-engine").ICalculationOrderResult;
53
+ }): import("../engine/dependency-engine/types").ICalculationOrderResult;
49
54
  }
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- function _0xae46(_0xc61b3b,_0x1ab20f){_0xc61b3b=_0xc61b3b-0x14b;var _0x6d171a=_0x6d17();var _0xae4607=_0x6d171a[_0xc61b3b];return _0xae4607;}(function(_0x5c68b1,_0x3aa87b){var _0x191e94=_0xae46,_0x201c42=_0x5c68b1();while(!![]){try{var _0x27ed55=-parseInt(_0x191e94(0x156))/0x1*(-parseInt(_0x191e94(0x14f))/0x2)+parseInt(_0x191e94(0x152))/0x3+parseInt(_0x191e94(0x15b))/0x4+-parseInt(_0x191e94(0x155))/0x5*(parseInt(_0x191e94(0x160))/0x6)+-parseInt(_0x191e94(0x15f))/0x7*(-parseInt(_0x191e94(0x14d))/0x8)+-parseInt(_0x191e94(0x153))/0x9*(-parseInt(_0x191e94(0x14b))/0xa)+-parseInt(_0x191e94(0x158))/0xb;if(_0x27ed55===_0x3aa87b)break;else _0x201c42['push'](_0x201c42['shift']());}catch(_0x278375){_0x201c42['push'](_0x201c42['shift']());}}}(_0x6d17,0x85e2f),function(_0x1b2c38,_0x3152c2){var _0x27aea4=_0xae46;typeof exports==_0x27aea4(0x154)&&typeof module<'u'?_0x3152c2(exports,require('@univerjs/engine-formula/facade')):typeof define==_0x27aea4(0x15a)&&define[_0x27aea4(0x14c)]?define([_0x27aea4(0x14e),_0x27aea4(0x157)],_0x3152c2):(_0x1b2c38=typeof globalThis<'u'?globalThis:_0x1b2c38||self,_0x3152c2(_0x1b2c38[_0x27aea4(0x159)]={},_0x1b2c38[_0x27aea4(0x151)]));}(this,function(_0x46a933,_0x1e51ca){var _0xd43bb1=_0xae46;Object[_0xd43bb1(0x15c)](_0x46a933,Symbol[_0xd43bb1(0x150)],{'value':_0xd43bb1(0x15d)}),Object[_0xd43bb1(0x15c)](_0x46a933,_0xd43bb1(0x15e),{'enumerable':!0x0,'get':function(){var _0x5662e6=_0xd43bb1;return _0x1e51ca[_0x5662e6(0x15e)];}});}));function _0x6d17(){var _0x22ea04=['561406zqfEYm','toStringTag','UniverEngineFormulaFacade','1173423eyILoy','16857qIpbGf','object','15scIOZG','2gNUvgy','@univerjs/engine-formula/facade','17198313BrgCsR','UniverProEngineFormulaFacade','function','3258360QDYMiE','defineProperty','Module','FFormula','4360748GqbHEx','1807602jcgDrf','3340yVmibu','amd','8DrQXMU','exports'];_0x6d17=function(){return _0x22ea04;};return _0x6d17();}
1
+ function _0x4c13(_0x6ab70f,_0x6f80dd){_0x6ab70f=_0x6ab70f-0xcf;var _0x532531=_0x5325();var _0x4c139d=_0x532531[_0x6ab70f];return _0x4c139d;}function _0x5325(){var _0x4675ce=['14216CSIwBJ','exports','object','function','414Yknbbc','UniverEngineFormulaFacade','defineProperty','66VDWCuG','1555449nhuZhk','toStringTag','10077561ztnGVl','FFormula','314heBcbt','4742rHNCIC','31926984RKlZty','288235vKSKrh','90jIQwXP','@univerjs/engine-formula/facade','16vKwOTW','Module','1545247BHFhPa'];_0x5325=function(){return _0x4675ce;};return _0x5325();}(function(_0x325504,_0x3467cf){var _0x44b044=_0x4c13,_0x3e930b=_0x325504();while(!![]){try{var _0x74adb0=-parseInt(_0x44b044(0xe1))/0x1*(-parseInt(_0x44b044(0xe2))/0x2)+-parseInt(_0x44b044(0xd9))/0x3*(-parseInt(_0x44b044(0xd5))/0x4)+-parseInt(_0x44b044(0xcf))/0x5*(parseInt(_0x44b044(0xdc))/0x6)+parseInt(_0x44b044(0xdd))/0x7*(parseInt(_0x44b044(0xd2))/0x8)+parseInt(_0x44b044(0xdf))/0x9+-parseInt(_0x44b044(0xd0))/0xa*(-parseInt(_0x44b044(0xd4))/0xb)+-parseInt(_0x44b044(0xe3))/0xc;if(_0x74adb0===_0x3467cf)break;else _0x3e930b['push'](_0x3e930b['shift']());}catch(_0x201788){_0x3e930b['push'](_0x3e930b['shift']());}}}(_0x5325,0xbbaab),function(_0x2f19de,_0xfa9cd5){var _0x46c9a8=_0x4c13;typeof exports==_0x46c9a8(0xd7)&&typeof module<'u'?_0xfa9cd5(exports,require('@univerjs/engine-formula/facade')):typeof define==_0x46c9a8(0xd8)&&define['amd']?define([_0x46c9a8(0xd6),_0x46c9a8(0xd1)],_0xfa9cd5):(_0x2f19de=typeof globalThis<'u'?globalThis:_0x2f19de||self,_0xfa9cd5(_0x2f19de['UniverProEngineFormulaFacade']={},_0x2f19de[_0x46c9a8(0xda)]));}(this,function(_0x517bca,_0x379bfb){var _0x337f15=_0x4c13;Object[_0x337f15(0xdb)](_0x517bca,Symbol[_0x337f15(0xde)],{'value':_0x337f15(0xd3)}),Object[_0x337f15(0xdb)](_0x517bca,_0x337f15(0xe0),{'enumerable':!0x0,'get':function(){return _0x379bfb['FFormula'];}});}));