@univerjs/engine-formula 0.3.0 → 0.4.0-alpha.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 (47) hide show
  1. package/lib/cjs/index.js +2 -2
  2. package/lib/es/index.js +22119 -21333
  3. package/lib/types/basics/common.d.ts +2 -0
  4. package/lib/types/basics/match-token.d.ts +4 -0
  5. package/lib/types/basics/token-type.d.ts +1 -0
  6. package/lib/types/basics/token.d.ts +2 -1
  7. package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +8 -1
  8. package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +1 -1
  9. package/lib/types/commands/mutations/set-formula-data.mutation.d.ts +4 -1
  10. package/lib/types/controller/calculate.controller.d.ts +3 -4
  11. package/lib/types/controller/set-dependency.controller.d.ts +1 -0
  12. package/lib/types/controller/set-other-formula.controller.d.ts +1 -1
  13. package/lib/types/engine/analysis/lexer-tree-builder.d.ts +20 -3
  14. package/lib/types/engine/analysis/parser.d.ts +2 -1
  15. package/lib/types/engine/ast-node/base-ast-node.d.ts +4 -1
  16. package/lib/types/engine/ast-node/function-node.d.ts +9 -3
  17. package/lib/types/engine/ast-node/lambda-node.d.ts +0 -1
  18. package/lib/types/engine/ast-node/lambda-parameter-node.d.ts +1 -1
  19. package/lib/types/engine/dependency/dependency-tree.d.ts +12 -51
  20. package/lib/types/engine/dependency/formula-dependency.d.ts +10 -4
  21. package/lib/types/engine/dependency/generate-tree-id.d.ts +2 -0
  22. package/lib/types/engine/interpreter/interpreter.d.ts +2 -2
  23. package/lib/types/engine/reference-object/base-reference-object.d.ts +2 -2
  24. package/lib/types/engine/utils/check-variant-error.d.ts +9 -0
  25. package/lib/types/engine/utils/prefixHandler.d.ts +1 -1
  26. package/lib/types/engine/utils/reference.d.ts +1 -0
  27. package/lib/types/engine/utils/regexp-check.d.ts +22 -0
  28. package/lib/types/engine/utils/update-lambda-statement.d.ts +3 -0
  29. package/lib/types/engine/value-object/array-value-object.d.ts +1 -1
  30. package/lib/types/functions/text/function-names.d.ts +3 -0
  31. package/lib/types/functions/text/regexextract/__test__/index.spec.d.ts +16 -0
  32. package/lib/types/functions/text/regexextract/index.d.ts +7 -0
  33. package/lib/types/functions/text/regexmatch/__test__/index.spec.d.ts +16 -0
  34. package/lib/types/functions/text/regexmatch/index.d.ts +7 -0
  35. package/lib/types/functions/text/regexreplace/__test__/index.spec.d.ts +16 -0
  36. package/lib/types/functions/text/regexreplace/index.d.ts +7 -0
  37. package/lib/types/index.d.ts +42 -42
  38. package/lib/types/models/formula-data.model.d.ts +2 -2
  39. package/lib/types/plugin.d.ts +3 -1
  40. package/lib/types/services/active-dirty-manager.service.d.ts +1 -0
  41. package/lib/types/services/calculate-formula.service.d.ts +2 -2
  42. package/lib/types/services/current-data.service.d.ts +8 -1
  43. package/lib/types/services/defined-names.service.d.ts +5 -2
  44. package/lib/types/services/dependency-manager.service.d.ts +34 -10
  45. package/lib/types/services/runtime.service.d.ts +12 -0
  46. package/lib/umd/index.js +2 -2
  47. package/package.json +9 -10
@@ -141,12 +141,14 @@ export interface IUnitExcludedCell {
141
141
  export interface IFormulaDatasetConfig {
142
142
  formulaData: IFormulaData;
143
143
  arrayFormulaCellData: IArrayFormulaUnitCellType;
144
+ arrayFormulaRange: IArrayFormulaRangeType;
144
145
  forceCalculate: boolean;
145
146
  dirtyRanges: IUnitRange[];
146
147
  dirtyNameMap: IDirtyUnitSheetNameMap;
147
148
  dirtyDefinedNameMap: IDirtyUnitSheetNameMap;
148
149
  dirtyUnitFeatureMap: IDirtyUnitFeatureMap;
149
150
  dirtyUnitOtherFormulaMap: IDirtyUnitOtherFormulaMap;
151
+ clearDependencyTreeCache?: IUnitSheetIdToNameMap;
150
152
  excludedCell?: IUnitExcludedCell;
151
153
  allUnitData?: IUnitData;
152
154
  unitStylesData?: IUnitStylesData;
@@ -8,3 +8,7 @@ export declare function normalizeSheetName(sheetName: string): string;
8
8
  * @param char
9
9
  */
10
10
  export declare function matchRefDrawToken(char: string): boolean;
11
+ export declare const TOKEN_CANNOT_BE_AT_END_SET: Set<string>;
12
+ export declare function isTokenCannotBeAtEnd(token: string): boolean;
13
+ export declare const TOKEN_CANNOT_PRECEDE_SUFFIX_TOKEN_SET: Set<string>;
14
+ export declare function isTokenCannotPrecedeSuffixToken(token: string): boolean;
@@ -21,3 +21,4 @@ export declare const DEFAULT_TOKEN_TYPE_LAMBDA_OMIT_PARAMETER = "LO_1";
21
21
  export declare const DEFAULT_TOKEN_LET_FUNCTION_NAME = "LET";
22
22
  export declare const DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME = "LAMBDA";
23
23
  export declare const DEFAULT_TOKEN_CUBE_FUNCTION_NAME = "CUBE";
24
+ export declare const FORCED_RECALCULATION_FUNCTION_NAME: Set<string>;
@@ -57,6 +57,7 @@ export declare enum suffixToken {
57
57
  export declare const SUFFIX_TOKEN_SET: Set<string>;
58
58
  export declare enum prefixToken {
59
59
  AT = "@",
60
- MINUS = "-"
60
+ MINUS = "-",
61
+ PLUS = "+"
61
62
  }
62
63
  export declare const SPACE_TOKEN = " ";
@@ -1,4 +1,4 @@
1
- import { IMutation } from '@univerjs/core';
1
+ import { IAccessor, IMutation } from '@univerjs/core';
2
2
  export interface ISetDefinedNameMutationSearchParam {
3
3
  unitId: string;
4
4
  id: string;
@@ -10,6 +10,13 @@ export interface ISetDefinedNameMutationParam extends ISetDefinedNameMutationSea
10
10
  localSheetId?: string;
11
11
  hidden?: boolean;
12
12
  }
13
+ /**
14
+ * Generate undo mutation of a `SetDefinedNameMutation`
15
+ * @param accessor
16
+ * @param params
17
+ * @returns
18
+ */
19
+ export declare const SetDefinedNameMutationFactory: (accessor: IAccessor, params: ISetDefinedNameMutationParam) => ISetDefinedNameMutationParam;
13
20
  /**
14
21
  * In the formula engine, the mutation is solely responsible for communication between the worker and the main thread.
15
22
  * It requires setting local to true during execution.
@@ -1,7 +1,7 @@
1
1
  import { IExecutionOptions, IMutation, Nullable } from '@univerjs/core';
2
2
  import { IRuntimeOtherUnitDataType, IRuntimeUnitDataPrimitiveType } from '../../basics/common';
3
- import { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
4
3
  import { IFormulaDirtyData } from '../../services/current-data.service';
4
+ import { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
5
5
  export interface ISetFormulaCalculationStartMutation extends IFormulaDirtyData {
6
6
  options: Nullable<IExecutionOptions>;
7
7
  forceCalculation: boolean;
@@ -4,6 +4,9 @@ export interface ISetFormulaDataMutationParams {
4
4
  formulaData: IFormulaData;
5
5
  }
6
6
  /**
7
- * There is no need to process data here, it is used as the main thread to send data to the worker. The main thread has already updated the data in advance, and there is no need to update it again here.
7
+ * There is no need to process data here, it is used as the main thread to send data to the worker.
8
+ * The main thread has already updated the data in advance, and there is no need to update it again here.
9
+ *
10
+ * @deprecated Do not use command system as rpc calling method.
8
11
  */
9
12
  export declare const SetFormulaDataMutation: IMutation<ISetFormulaDataMutationParams>;
@@ -1,16 +1,15 @@
1
- import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
1
+ import { Disposable, ICommandService } from '@univerjs/core';
2
2
  import { FormulaDataModel } from '../models/formula-data.model';
3
3
  import { CalculateFormulaService } from '../services/calculate-formula.service';
4
4
  export declare class CalculateController extends Disposable {
5
5
  private readonly _commandService;
6
6
  private readonly _calculateFormulaService;
7
- private readonly _univerInstanceService;
8
7
  private readonly _formulaDataModel;
9
- constructor(_commandService: ICommandService, _calculateFormulaService: CalculateFormulaService, _univerInstanceService: IUniverInstanceService, _formulaDataModel: FormulaDataModel);
8
+ constructor(_commandService: ICommandService, _calculateFormulaService: CalculateFormulaService, _formulaDataModel: FormulaDataModel);
10
9
  private _initialize;
11
10
  private _commandExecutedListener;
12
11
  private _calculate;
13
12
  private _initialExecuteFormulaListener;
14
13
  private _initialExecuteFormulaProcessListener;
15
- private _applyFormula;
14
+ private _applyResult;
16
15
  }
@@ -9,4 +9,5 @@ export declare class SetDependencyController extends Disposable {
9
9
  private _initialize;
10
10
  private _featureCalculationManagerServiceListener;
11
11
  private _commandExecutedListener;
12
+ private _handleSetDefinedName;
12
13
  }
@@ -1,6 +1,6 @@
1
1
  import { Disposable, ICommandService } from '@univerjs/core';
2
- import { IOtherFormulaManagerService } from '../services/other-formula-manager.service';
3
2
  import { IDependencyManagerService } from '../services/dependency-manager.service';
3
+ import { IOtherFormulaManagerService } from '../services/other-formula-manager.service';
4
4
  export declare class SetOtherFormulaController extends Disposable {
5
5
  private readonly _commandService;
6
6
  private readonly _otherFormulaManagerService;
@@ -1,7 +1,7 @@
1
+ import { ISequenceArray, ISequenceNode } from '../utils/sequence';
1
2
  import { AbsoluteRefType, Disposable } from '@univerjs/core';
2
3
  import { FormulaAstLRU } from '../../basics/cache-lru';
3
4
  import { ErrorType } from '../../basics/error-type';
4
- import { ISequenceArray, ISequenceNode } from '../utils/sequence';
5
5
  import { LexerNode } from './lexer-node';
6
6
  export declare const FormulaLexerNodeCache: FormulaAstLRU<LexerNode>;
7
7
  export declare const FormulaSequenceNodeCache: FormulaAstLRU<(string | ISequenceNode)[]>;
@@ -16,6 +16,7 @@ export declare class LexerTreeBuilder extends Disposable {
16
16
  private _doubleQuotationState;
17
17
  private _lambdaState;
18
18
  private _colonState;
19
+ private _formulaErrorCount;
19
20
  private _tableBracketState;
20
21
  dispose(): void;
21
22
  getUpLevel(): number;
@@ -55,8 +56,11 @@ export declare class LexerTreeBuilder extends Disposable {
55
56
  *
56
57
  */
57
58
  private _mergeSequenceNodeReference;
59
+ /**
60
+ * =-A1 Separate the negative sign from the ref string.
61
+ */
62
+ private _minusSplitSequenceNode;
58
63
  private _pushSequenceNode;
59
- private _replacePrefixString;
60
64
  nodeMakerTest(formulaString: string): ErrorType.VALUE | (string | LexerNode)[] | undefined;
61
65
  treeBuilder(formulaString: string, transformSuffix?: boolean, injectDefinedName?: (sequenceArray: ISequenceArray[]) => {
62
66
  sequenceString: string;
@@ -91,6 +95,8 @@ export declare class LexerTreeBuilder extends Disposable {
91
95
  private _isTableBracket;
92
96
  private _openTableBracket;
93
97
  private _closeTableBracket;
98
+ private _formalErrorOccurred;
99
+ private _hasFormalError;
94
100
  private _getLastChildCurrentLexerNode;
95
101
  private _getLastChildCurrent;
96
102
  private _setParentCurrentLexerNode;
@@ -102,8 +108,19 @@ export declare class LexerTreeBuilder extends Disposable {
102
108
  private _newAndPushCurrentLexerNode;
103
109
  private _getTopNode;
104
110
  private _removeLastChild;
111
+ /**
112
+ * fix univer-pro/issues/2447
113
+ * =1/3+
114
+ * =+
115
+ * =sum(A1+)
116
+ */
117
+ private _formulaErrorLastTokenCheck;
105
118
  private _findPreviousToken;
106
- private _negativeCondition;
119
+ private _findSecondLastNonSpaceToken;
120
+ private _findNextToken;
121
+ private _unexpectedEndingTokenExcludeOperator;
122
+ private _unexpectedEndingToken;
123
+ private _isOperatorToken;
107
124
  private _getSequenceArray;
108
125
  private _resetTemp;
109
126
  private _checkErrorState;
@@ -1,7 +1,7 @@
1
1
  import { Nullable, Disposable } from '@univerjs/core';
2
+ import { BaseAstNode } from '../ast-node/base-ast-node';
2
3
  import { IFormulaRuntimeService } from '../../services/runtime.service';
3
4
  import { AstRootNodeFactory } from '../ast-node/ast-root-node';
4
- import { BaseAstNode } from '../ast-node/base-ast-node';
5
5
  import { FunctionNodeFactory } from '../ast-node/function-node';
6
6
  import { LambdaNodeFactory } from '../ast-node/lambda-node';
7
7
  import { LambdaParameterNodeFactory } from '../ast-node/lambda-parameter-node';
@@ -33,6 +33,7 @@ export declare class AstTreeBuilder extends Disposable {
33
33
  private _lambdaParameterHandler;
34
34
  private _changeLetToLambda;
35
35
  private _parse;
36
+ private _setPrefixRefOffset;
36
37
  private _checkAstNode;
37
38
  private _initializeAstNode;
38
39
  }
@@ -1,7 +1,7 @@
1
1
  import { Nullable, Disposable } from '@univerjs/core';
2
- import { AstNodePromiseType } from '../../basics/common';
3
2
  import { ErrorType } from '../../basics/error-type';
4
3
  import { FunctionVariantType } from '../reference-object/base-reference-object';
4
+ import { AstNodePromiseType } from '../../basics/common';
5
5
  import { ErrorValueObject } from '../value-object/base-value-object';
6
6
  import { NodeType } from './node-type';
7
7
  interface IAstNodeNodeJson {
@@ -21,15 +21,18 @@ export declare class BaseAstNode extends Disposable {
21
21
  private _address;
22
22
  private _refOffsetX;
23
23
  private _refOffsetY;
24
+ private _isForcedCalculateFunction;
24
25
  constructor(_token: string);
25
26
  dispose(): void;
26
27
  get nodeType(): NodeType;
27
28
  isAsync(): boolean;
28
29
  isAddress(): boolean;
30
+ isForcedCalculateFunction(): boolean;
29
31
  setAsync(): void;
30
32
  setAddress(): void;
31
33
  getParent(): Nullable<BaseAstNode>;
32
34
  setParent(node: BaseAstNode): void;
35
+ setForcedCalculateFunction(): void;
33
36
  getChildren(): BaseAstNode[];
34
37
  addChildren(...astNode: BaseAstNode[]): void;
35
38
  getToken(): string;
@@ -1,11 +1,11 @@
1
+ import { BaseFunction } from '../../functions/base-function';
2
+ import { LexerNode } from '../analysis/lexer-node';
1
3
  import { Injector } from '@univerjs/core';
2
4
  import { AstNodePromiseType } from '../../basics/common';
3
- import { BaseFunction } from '../../functions/base-function';
4
5
  import { IFormulaCurrentConfigService } from '../../services/current-data.service';
6
+ import { IDefinedNamesService } from '../../services/defined-names.service';
5
7
  import { IFunctionService } from '../../services/function.service';
6
8
  import { IFormulaRuntimeService } from '../../services/runtime.service';
7
- import { LexerNode } from '../analysis/lexer-node';
8
- import { IDefinedNamesService } from '../../services/defined-names.service';
9
9
  import { BaseAstNode } from './base-ast-node';
10
10
  import { BaseAstNodeFactory } from './base-ast-node-factory';
11
11
  import { NodeType } from './node-type';
@@ -35,6 +35,12 @@ export declare class FunctionNode extends BaseAstNode {
35
35
  private _setRefInfo;
36
36
  private _setRefData;
37
37
  }
38
+ export declare class ErrorFunctionNode extends BaseAstNode {
39
+ constructor(token?: string);
40
+ get nodeType(): NodeType;
41
+ executeAsync(): Promise<AstNodePromiseType>;
42
+ execute(): void;
43
+ }
38
44
  export declare class FunctionNodeFactory extends BaseAstNodeFactory {
39
45
  private readonly _functionService;
40
46
  private readonly _currentConfigService;
@@ -25,5 +25,4 @@ export declare class LambdaNodeFactory extends BaseAstNodeFactory {
25
25
  create(param: LexerNode): BaseAstNode;
26
26
  checkAndCreateNodeType(param: LexerNode | string): BaseAstNode | undefined;
27
27
  private _updateLambdaStatement;
28
- private _updateTree;
29
28
  }
@@ -1,5 +1,5 @@
1
- import { LexerNode } from '../analysis/lexer-node';
2
1
  import { LambdaPrivacyVarType, BaseAstNode } from './base-ast-node';
2
+ import { LexerNode } from '../analysis/lexer-node';
3
3
  import { BaseAstNodeFactory } from './base-ast-node-factory';
4
4
  import { NodeType } from './node-type';
5
5
  export declare class LambdaParameterNode extends BaseAstNode {
@@ -1,4 +1,4 @@
1
- import { Disposable, IRange, IUnitRange, Nullable } from '@univerjs/core';
1
+ import { IRange, IRTreeItem, IUnitRange, Nullable, Disposable } from '@univerjs/core';
2
2
  import { IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IRuntimeUnitDataType, IUnitExcludedCell } from '../../basics/common';
3
3
  import { IFormulaDirtyData } from '../../services/current-data.service';
4
4
  import { IAllRuntimeData } from '../../services/runtime.service';
@@ -8,18 +8,15 @@ export declare enum FDtreeStateType {
8
8
  ADDED = 1,
9
9
  SKIP = 2
10
10
  }
11
- export interface IUnitRangeWithToken {
12
- gridRange: IUnitRange;
13
- token: string;
14
- }
15
11
  /**
16
12
  * A dependency tree, capable of calculating mutual dependencies,
17
13
  * is used to determine the order of formula calculations.
18
14
  */
19
15
  export declare class FormulaDependencyTree extends Disposable {
16
+ treeId: string;
20
17
  node: Nullable<BaseAstNode>;
21
- children: FormulaDependencyTree[];
22
- parents: FormulaDependencyTree[];
18
+ children: Set<FormulaDependencyTree>;
19
+ parents: Set<FormulaDependencyTree>;
23
20
  formula: string;
24
21
  row: number;
25
22
  column: number;
@@ -27,20 +24,16 @@ export declare class FormulaDependencyTree extends Disposable {
27
24
  columnCount: number;
28
25
  subUnitId: string;
29
26
  unitId: string;
30
- rangeList: IUnitRangeWithToken[];
27
+ rangeList: IUnitRange[];
31
28
  formulaId: Nullable<string>;
32
29
  featureId: Nullable<string>;
33
- isPassive: boolean;
34
- _childIds: Set<string>;
35
- anchorToken: string;
30
+ isCache: boolean;
31
+ constructor(treeId?: string);
36
32
  getDirtyData: Nullable<(dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
37
33
  runtimeCellData: IRuntimeUnitDataType;
38
34
  dirtyRanges: IFeatureDirtyRangeType;
39
35
  }>;
40
36
  private _state;
41
- private _id;
42
- constructor();
43
- get id(): string;
44
37
  dispose(): void;
45
38
  disposeWithChildren(): void;
46
39
  resetState(): void;
@@ -49,19 +42,16 @@ export declare class FormulaDependencyTree extends Disposable {
49
42
  setSkip(): void;
50
43
  isSkip(): boolean;
51
44
  inRangeData(range: IRange): boolean;
52
- /**
53
- * "Determine whether all ranges of the current node exist within the dirty area.
54
- * If they are within the dirty area, return true, indicating that this node needs to be calculated.
55
- * @param dependencyRangeList
56
- */
57
- dependencyRange(dependencyRangeList: Map<string, Map<string, IRange[]>>, dirtyUnitSheetNameMap: IDirtyUnitSheetNameMap, unitExcludedCell: Nullable<IUnitExcludedCell>): boolean;
45
+ dependencySheetName(dirtyUnitSheetNameMap?: IDirtyUnitSheetNameMap): boolean;
46
+ isExcludeRange(unitExcludedCell: Nullable<IUnitExcludedCell>): boolean;
58
47
  pushChildren(tree: FormulaDependencyTree): void;
59
- hasChild(tree: FormulaDependencyTree): boolean;
60
48
  /**
61
49
  * Add the range corresponding to the current ast node.
62
50
  * @param range
63
51
  */
64
- pushRangeList(range: IUnitRangeWithToken): void;
52
+ pushRangeList(ranges: IUnitRange[]): void;
53
+ hasChildren(tree: FormulaDependencyTree): boolean;
54
+ toRTreeItem(): IRTreeItem;
65
55
  /**
66
56
  * Determine whether it is dependent on other trees.
67
57
  * @param dependenceTree
@@ -69,32 +59,3 @@ export declare class FormulaDependencyTree extends Disposable {
69
59
  dependency(dependenceTree: FormulaDependencyTree): boolean;
70
60
  private _pushParent;
71
61
  }
72
- export declare class FormulaDependencyTreeCache extends Disposable {
73
- private _cacheItems;
74
- private _map;
75
- private _dependencyMap;
76
- private _parentIdMap;
77
- private _rangeTokens;
78
- dispose(): void;
79
- size(): number;
80
- getDependencyMap(): Map<string, FormulaDependencyTree>;
81
- getDependencyTree(id: string): FormulaDependencyTree | undefined;
82
- get length(): number;
83
- add(unitRangeWithToken: IUnitRangeWithToken, tree: FormulaDependencyTree): void;
84
- addDependencyMap(tree: FormulaDependencyTree): void;
85
- updateParent(tree: FormulaDependencyTree): void;
86
- clear(): void;
87
- remove(token: string, tree: FormulaDependencyTree): void;
88
- delete(token: string): void;
89
- getDependencyId(dependenceTree: FormulaDependencyTree, ids: Set<string>): void;
90
- /**
91
- * Determine whether range is dependent on other trees.
92
- * @param dependenceTree
93
- */
94
- dependencyUseParentId(dependenceTree: FormulaDependencyTree): void;
95
- /**
96
- * Determine whether range is dependent on other trees.
97
- * @param dependenceTree
98
- */
99
- dependency(dependenceTree: FormulaDependencyTree): void;
100
- }
@@ -1,12 +1,12 @@
1
1
  import { Disposable } from '@univerjs/core';
2
2
  import { IFormulaCurrentConfigService } from '../../services/current-data.service';
3
+ import { IDependencyManagerService } from '../../services/dependency-manager.service';
3
4
  import { IFeatureCalculationManagerService } from '../../services/feature-calculation-manager.service';
4
5
  import { IOtherFormulaManagerService } from '../../services/other-formula-manager.service';
5
6
  import { IFormulaRuntimeService } from '../../services/runtime.service';
6
7
  import { Lexer } from '../analysis/lexer';
7
8
  import { AstTreeBuilder } from '../analysis/parser';
8
9
  import { Interpreter } from '../interpreter/interpreter';
9
- import { IDependencyManagerService } from '../../services/dependency-manager.service';
10
10
  import { FormulaDependencyTree } from './dependency-tree';
11
11
  export declare class FormulaDependencyGenerator extends Disposable {
12
12
  private readonly _currentConfigService;
@@ -17,9 +17,8 @@ export declare class FormulaDependencyGenerator extends Disposable {
17
17
  private readonly _astTreeBuilder;
18
18
  private readonly _lexer;
19
19
  private readonly _dependencyManagerService;
20
- private _updateRangeFlattenCache;
21
- private _dirtyUnitSheetNameMap;
22
20
  private _formulaASTCache;
21
+ private _updateRangeFlattenCache;
23
22
  constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _otherFormulaManagerService: IOtherFormulaManagerService, _featureCalculationManagerService: IFeatureCalculationManagerService, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _lexer: Lexer, _dependencyManagerService: IDependencyManagerService);
24
23
  dispose(): void;
25
24
  generate(): Promise<FormulaDependencyTree[]>;
@@ -59,11 +58,18 @@ export declare class FormulaDependencyGenerator extends Disposable {
59
58
  private _dependencyFeatureCalculation;
60
59
  private _clearFeatureCalculationNode;
61
60
  private _getExistTreeList;
62
- private _convertDirtyRangesToMap;
61
+ /**
62
+ * TODO @DR-Univer: The next step will be to try changing the incoming dirtyRanges to an array, thus avoiding conversion.
63
+ * @param dirtyRanges
64
+ * @returns
65
+ */
66
+ private _convertDirtyRangesToUnitRange;
63
67
  private _intersectFeatureCalculation;
64
68
  private _includeTreeFeature;
65
69
  private _includeOtherFormula;
66
70
  private _includeDefinedName;
71
+ private _detectForcedRecalculationNode;
72
+ private _detectForcedRecalculationNodeRecursion;
67
73
  /**
68
74
  * Determine whether all ranges of the current node exist within the dirty area.
69
75
  * If they are within the dirty area, return true, indicating that this node needs to be calculated.
@@ -0,0 +1,2 @@
1
+ import { IDependencyManagerService } from '../../services/dependency-manager.service';
2
+ export declare function generateRandomDependencyTreeId(dependencyManagerService: IDependencyManagerService): string;
@@ -1,8 +1,8 @@
1
- import { Disposable } from '@univerjs/core';
2
- import { IFormulaRuntimeService } from '../../services/runtime.service';
3
1
  import { BaseAstNode } from '../ast-node/base-ast-node';
4
2
  import { FunctionVariantType } from '../reference-object/base-reference-object';
5
3
  import { PreCalculateNodeType } from '../utils/node-type';
4
+ import { Disposable } from '@univerjs/core';
5
+ import { IFormulaRuntimeService } from '../../services/runtime.service';
6
6
  export declare class Interpreter extends Disposable {
7
7
  private readonly _runtimeService;
8
8
  constructor(_runtimeService: IFormulaRuntimeService);
@@ -1,10 +1,10 @@
1
1
  import { ICellData, IRange, Nullable } from '@univerjs/core';
2
+ import { IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } from '../../basics/common';
2
3
  import { FormulaAstLRU } from '../../basics/cache-lru';
3
4
  import { ObjectClassType } from '../../basics/object-class-type';
4
5
  import { ArrayValueObject } from '../value-object/array-value-object';
5
6
  import { BaseValueObject, ErrorValueObject } from '../value-object/base-value-object';
6
7
  import { NullValueObject, NumberValueObject, StringValueObject } from '../value-object/primitive-object';
7
- import { IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap, IUnitStylesData } from '../../basics/common';
8
8
  export type NodeValueType = BaseValueObject | BaseReferenceObject | AsyncObject | AsyncArrayObject;
9
9
  export type FunctionVariantType = BaseValueObject | BaseReferenceObject;
10
10
  export declare const FORMULA_REF_TO_ARRAY_CACHE: FormulaAstLRU<ArrayValueObject>;
@@ -98,7 +98,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
98
98
  getCurrentRuntimeActiveArrayFormulaCellData(): import('@univerjs/core').ObjectMatrix<Nullable<ICellData>> | undefined;
99
99
  getCellData(row: number, column: number): Nullable<ICellData>;
100
100
  getRuntimeFeatureCellValue(row: number, column: number): ICellData | undefined;
101
- getCellByPosition(row?: number, column?: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../..').BooleanValueObject | StringValueObject | ArrayValueObject;
101
+ getCellByPosition(rowRaw?: number, columnRaw?: number): ErrorValueObject | NullValueObject | NumberValueObject | import('../..').BooleanValueObject | StringValueObject | ArrayValueObject;
102
102
  /**
103
103
  * Get the pattern of the cell
104
104
  * @param unitId
@@ -1,5 +1,14 @@
1
1
  import { BaseValueObject } from '../value-object/base-value-object';
2
2
  export declare function checkVariantErrorIsArray(variant: BaseValueObject): BaseValueObject;
3
+ export declare function checkVariantsErrorIsArray(...variants: BaseValueObject[]): {
4
+ isError: boolean;
5
+ errorObject: BaseValueObject;
6
+ variants?: undefined;
7
+ } | {
8
+ isError: boolean;
9
+ variants: BaseValueObject[];
10
+ errorObject?: undefined;
11
+ };
3
12
  export declare function checkVariantsErrorIsArrayOrBoolean(...variants: BaseValueObject[]): {
4
13
  isError: boolean;
5
14
  errorObject: BaseValueObject;
@@ -1,7 +1,7 @@
1
1
  import { Injector, Nullable } from '@univerjs/core';
2
2
  import { IFunctionService } from '../../services/function.service';
3
3
  import { PrefixNode } from '../ast-node/prefix-node';
4
- export declare function prefixHandler(tokenTrim: string, functionService: IFunctionService, injector: Injector): {
4
+ export declare function prefixHandler(tokenTrimParam: string, functionService: IFunctionService, injector: Injector): {
5
5
  tokenTrim: string;
6
6
  minusPrefixNode: Nullable<PrefixNode>;
7
7
  atPrefixNode: Nullable<PrefixNode>;
@@ -44,6 +44,7 @@ export declare function handleRefStringInfo(refString: string): {
44
44
  };
45
45
  export declare function deserializeRangeWithSheet(refString: string): IUnitRangeName;
46
46
  export declare function isReferenceStringWithEffectiveColumn(refString: string): boolean;
47
+ export declare function replaceRefPrefixString(token: string): string;
47
48
  /**
48
49
  * implement getSheetIdByName
49
50
  * function getSheetIdByName(name: string) {
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare function handleRegExp(regExpString: string, isGlobal: boolean): {
17
+ isError: boolean;
18
+ regExp: null;
19
+ } | {
20
+ isError: boolean;
21
+ regExp: RegExp;
22
+ };
@@ -0,0 +1,3 @@
1
+ import { LambdaPrivacyVarType } from '../ast-node/base-ast-node';
2
+ import { LexerNode } from '../analysis/lexer-node';
3
+ export declare function updateLambdaStatement(functionStatementNode: LexerNode, lambdaId: string, currentLambdaPrivacyVar: LambdaPrivacyVarType): void;
@@ -1,7 +1,7 @@
1
1
  import { Nullable } from '@univerjs/core';
2
+ import { callbackMapFnType, IArrayValueObject, BaseValueObject, ErrorValueObject } from './base-value-object';
2
3
  import { compareToken } from '../../basics/token';
3
4
  import { ArrayBinarySearchType, ArrayOrderSearchType } from '../utils/compare';
4
- import { BaseValueObject, ErrorValueObject, callbackMapFnType, IArrayValueObject } from './base-value-object';
5
5
  import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from './primitive-object';
6
6
  export declare function fromObjectToString(array: IArrayValueObject): string;
7
7
  export declare function transformToValueObject(array?: Array<Array<number | string | boolean | null>>): BaseValueObject[][];
@@ -38,6 +38,9 @@ export declare enum FUNCTION_NAMES_TEXT {
38
38
  NUMBERVALUE = "NUMBERVALUE",
39
39
  PHONETIC = "PHONETIC",
40
40
  PROPER = "PROPER",
41
+ REGEXEXTRACT = "REGEXEXTRACT",
42
+ REGEXMATCH = "REGEXMATCH",
43
+ REGEXREPLACE = "REGEXREPLACE",
41
44
  REPLACE = "REPLACE",
42
45
  REPLACEB = "REPLACEB",
43
46
  REPT = "REPT",
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Regexextract extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, regularExpression: BaseValueObject): BaseValueObject;
7
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Regexmatch extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, regularExpression: BaseValueObject): BaseValueObject;
7
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BaseValueObject } from '../../../engine/value-object/base-value-object';
2
+ import { BaseFunction } from '../../base-function';
3
+ export declare class Regexreplace extends BaseFunction {
4
+ minParams: number;
5
+ maxParams: number;
6
+ calculate(text: BaseValueObject, regularExpression: BaseValueObject, replacement: BaseValueObject): BaseValueObject;
7
+ }