@univerjs/engine-formula 0.1.0-beta.1 → 0.1.0-beta.2

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 (70) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/es/index.js +3564 -3064
  3. package/lib/types/basics/common.d.ts +28 -26
  4. package/lib/types/basics/error-type.d.ts +1 -1
  5. package/lib/types/basics/function.d.ts +5 -1
  6. package/lib/types/basics/inverted-index-cache.d.ts +2 -2
  7. package/lib/types/basics/regex.d.ts +9 -10
  8. package/lib/types/commands/mutations/register-function.mutation.d.ts +30 -0
  9. package/lib/types/commands/mutations/unregister-function.mutation.d.ts +30 -0
  10. package/lib/types/controller/formula.controller.d.ts +5 -1
  11. package/lib/types/controller/register-function.controller.d.ts +26 -0
  12. package/lib/types/engine/analysis/__tests__/create-command-test-bed.d.ts +4 -0
  13. package/lib/types/engine/analysis/__tests__/parser.spec.d.ts +16 -0
  14. package/lib/types/engine/analysis/lexer-tree-builder.d.ts +1 -0
  15. package/lib/types/engine/ast-node/function-node.d.ts +11 -2
  16. package/lib/types/engine/ast-node/lambda-node.d.ts +0 -2
  17. package/lib/types/engine/ast-node/lambda-parameter-node.d.ts +0 -1
  18. package/lib/types/engine/dependency/dependency-tree.d.ts +3 -1
  19. package/lib/types/engine/reference-object/base-reference-object.d.ts +19 -14
  20. package/lib/types/engine/reference-object/range-reference-object.d.ts +2 -2
  21. package/lib/types/engine/utils/compare.d.ts +4 -0
  22. package/lib/types/engine/value-object/array-value-object.d.ts +12 -7
  23. package/lib/types/engine/value-object/base-value-object.d.ts +14 -0
  24. package/lib/types/engine/value-object/primitive-object.d.ts +1 -0
  25. package/lib/types/functions/array/function-map.d.ts +1 -3
  26. package/lib/types/functions/array/function-names.d.ts +0 -1
  27. package/lib/types/functions/base-function.d.ts +37 -2
  28. package/lib/types/functions/compatibility/function-map.d.ts +1 -3
  29. package/lib/types/functions/compatibility/function-names.d.ts +38 -1
  30. package/lib/types/functions/cube/function-names.d.ts +7 -0
  31. package/lib/types/functions/database/function-names.d.ts +12 -0
  32. package/lib/types/functions/date/function-names.d.ts +25 -0
  33. package/lib/types/functions/engineering/function-names.d.ts +54 -0
  34. package/lib/types/functions/financial/function-names.d.ts +55 -0
  35. package/lib/types/functions/information/function-names.d.ts +21 -0
  36. package/lib/types/functions/logical/function-map.d.ts +3 -1
  37. package/lib/types/functions/logical/function-names.d.ts +19 -0
  38. package/lib/types/functions/logical/lambda/index.d.ts +24 -0
  39. package/lib/types/functions/logical/makearray/__test__/index.spec.d.ts +16 -0
  40. package/lib/types/functions/lookup/address/__tests__/index.spec.d.ts +16 -0
  41. package/lib/types/functions/lookup/address/index.d.ts +22 -0
  42. package/lib/types/functions/lookup/function-map.d.ts +4 -1
  43. package/lib/types/functions/lookup/function-names.d.ts +36 -1
  44. package/lib/types/functions/lookup/indirect/__test__/index.spec.d.ts +16 -0
  45. package/lib/types/functions/lookup/indirect/index.d.ts +4 -3
  46. package/lib/types/functions/lookup/vlookup/__tests__/index.spec.d.ts +16 -0
  47. package/lib/types/functions/lookup/vlookup/index.d.ts +21 -0
  48. package/lib/types/functions/math/function-names.d.ts +75 -1
  49. package/lib/types/functions/math/sum/index.d.ts +1 -1
  50. package/lib/types/functions/meta/compare/index.d.ts +1 -2
  51. package/lib/types/functions/meta/divided/index.d.ts +1 -2
  52. package/lib/types/functions/meta/minus/index.d.ts +1 -2
  53. package/lib/types/functions/meta/multiply/index.d.ts +1 -2
  54. package/lib/types/functions/meta/plus/index.d.ts +2 -3
  55. package/lib/types/functions/statistical/function-names.d.ts +107 -1
  56. package/lib/types/functions/text/function-map.d.ts +3 -1
  57. package/lib/types/functions/text/function-names.d.ts +47 -0
  58. package/lib/types/functions/web/function-names.d.ts +3 -0
  59. package/lib/types/index.d.ts +19 -0
  60. package/lib/types/models/formula-data.model.d.ts +3 -1
  61. package/lib/types/plugin.d.ts +4 -0
  62. package/lib/types/services/current-data.service.d.ts +1 -0
  63. package/lib/types/services/feature-calculation-manager.service.d.ts +1 -1
  64. package/lib/types/services/function.service.d.ts +4 -0
  65. package/lib/types/services/other-formula-manager.service.d.ts +2 -2
  66. package/lib/types/services/runtime.service.d.ts +11 -5
  67. package/lib/umd/index.js +1 -1
  68. package/package.json +7 -7
  69. /package/lib/types/functions/{array → logical}/makearray/index.d.ts +0 -0
  70. /package/lib/types/functions/{compatibility → text}/concatenate/index.d.ts +0 -0
@@ -42,60 +42,60 @@ export interface IUnitData {
42
42
  [unitId: string]: ISheetData;
43
43
  }
44
44
  export interface IRuntimeUnitDataType {
45
- [unitId: string]: {
45
+ [unitId: string]: Nullable<{
46
46
  [sheetId: string]: ObjectMatrix<Nullable<ICellData>>;
47
- };
47
+ }>;
48
48
  }
49
49
  export interface IRuntimeOtherUnitDataType {
50
- [unitId: string]: {
51
- [sheetId: string]: {
50
+ [unitId: string]: Nullable<{
51
+ [sheetId: string]: Nullable<{
52
52
  [formulaId: string]: ICellData;
53
- };
54
- };
53
+ }>;
54
+ }>;
55
55
  }
56
56
  export interface IUnitSheetNameMap {
57
- [unitId: string]: {
57
+ [unitId: string]: Nullable<{
58
58
  [sheetName: string]: string;
59
- };
59
+ }>;
60
60
  }
61
61
  export interface IDirtyUnitSheetNameMap {
62
- [unitId: string]: {
62
+ [unitId: string]: Nullable<{
63
63
  [sheetId: string]: Nullable<string>;
64
- };
64
+ }>;
65
65
  }
66
66
  export interface IDirtyUnitFeatureMap {
67
- [unitId: string]: {
67
+ [unitId: string]: Nullable<{
68
68
  [sheetId: string]: {
69
69
  [featureId: string]: boolean;
70
70
  };
71
- };
71
+ }>;
72
72
  }
73
73
  export interface IArrayFormulaRangeType {
74
- [unitId: string]: {
74
+ [unitId: string]: Nullable<{
75
75
  [sheetId: string]: IObjectMatrixPrimitiveType<IRange>;
76
- };
76
+ }>;
77
77
  }
78
78
  export interface IFeatureDirtyRangeType {
79
- [unitId: string]: {
79
+ [unitId: string]: Nullable<{
80
80
  [sheetId: string]: IRange[];
81
- };
81
+ }>;
82
82
  }
83
83
  export interface IArrayFormulaUnitCellType {
84
- [unitId: string]: {
84
+ [unitId: string]: Nullable<{
85
85
  [sheetId: string]: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
86
- };
86
+ }>;
87
87
  }
88
88
  export interface IFormulaData {
89
- [unitId: string]: {
89
+ [unitId: string]: Nullable<{
90
90
  [sheetId: string]: IObjectMatrixPrimitiveType<IFormulaDataItem>;
91
- };
91
+ }>;
92
92
  }
93
93
  export interface IOtherFormulaData {
94
- [unitId: string]: {
95
- [subComponentId: string]: {
94
+ [unitId: string]: Nullable<{
95
+ [subUnitId: string]: Nullable<{
96
96
  [formulaId: string]: IFormulaDataItem;
97
- };
98
- };
97
+ }>;
98
+ }>;
99
99
  }
100
100
  /**
101
101
  * @f formulaString, the text string of the formula.
@@ -120,9 +120,9 @@ export declare enum TableOptionType {
120
120
  TOTALS = "#Totals"
121
121
  }
122
122
  export interface IUnitExcludedCell {
123
- [unitId: string]: {
123
+ [unitId: string]: Nullable<{
124
124
  [sheetId: string]: ObjectMatrix<boolean>;
125
- };
125
+ }>;
126
126
  }
127
127
  export interface IFormulaDatasetConfig {
128
128
  formulaData: IFormulaData;
@@ -132,6 +132,8 @@ export interface IFormulaDatasetConfig {
132
132
  dirtyNameMap: IDirtyUnitSheetNameMap;
133
133
  dirtyUnitFeatureMap: IDirtyUnitFeatureMap;
134
134
  excludedCell?: IUnitExcludedCell;
135
+ allUnitData?: IUnitData;
136
+ unitSheetNameMap?: IUnitSheetNameMap;
135
137
  }
136
138
  export declare enum ConcatenateType {
137
139
  FRONT = 0,
@@ -36,4 +36,4 @@ export declare enum ErrorType {
36
36
  /** In the case of SUM(B1 C1), */
37
37
  NULL = "#NULL!"
38
38
  }
39
- export declare const ERROR_TYPE_SET: Set<string>;
39
+ export declare const ERROR_TYPE_SET: Set<ErrorType>;
@@ -93,7 +93,11 @@ export declare enum FunctionType {
93
93
  /**
94
94
  * Univer-specific functions
95
95
  */
96
- Univer = 14
96
+ Univer = 14,
97
+ /**
98
+ * User-defined functions
99
+ */
100
+ User = 15
97
101
  }
98
102
  export interface IFunctionParam {
99
103
  /**
@@ -28,8 +28,8 @@ export declare class InvertedIndexCache {
28
28
  */
29
29
  private _cache;
30
30
  private _continueBuildingCache;
31
- set(unitId: string, sheetId: string, column: number, value: string | number | boolean, row: number): void;
32
- getCellValuePositions(unitId: string, sheetId: string, column: number): Map<string | number | boolean, number[]> | undefined;
31
+ set(unitId: string, sheetId: string, column: number, value: string | number | boolean | null, row: number): void;
32
+ getCellValuePositions(unitId: string, sheetId: string, column: number): Map<string | number | boolean | null, number[]> | undefined;
33
33
  getCellPositions(unitId: string, sheetId: string, column: number, value: string | number | boolean): number[] | undefined;
34
34
  getCellPosition(unitId: string, sheetId: string, column: number, value: string | number | boolean, startRow: number, endRow: number): number | undefined;
35
35
  setContinueBuildingCache(unitId: string, sheetId: string, column: number, startRow: number, endRow: number): void;
@@ -13,20 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const UNIT_NAME_REGEX = "'?\\[((?![\\/?:\"<>|*\\\\]).)*\\]";
17
16
  export declare const SHEET_NAME_REGEX = "((?![\\[\\]\\/?*\\\\]).)*!";
18
17
  export declare const ABSOLUTE_SYMBOL = "$";
19
18
  export declare const RANGE_SYMBOL = "\\s*?:\\s*?";
20
19
  export declare const SIMPLE_SINGLE_RANGE_REGEX = "\\$?[A-Za-z]+\\$?[0-9]+";
21
- export declare const REFERENCE_MULTIPLE_RANGE_REGEX = "^(@)?('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\$?[A-Za-z]+\\$?[0-9]+\\s*?:\\s*?\\$?[A-Za-z]+\\$?[0-9]+$";
22
- export declare const REFERENCE_SINGLE_RANGE_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\s*?\\$?[A-Za-z]+\\$?[0-9]+(#)?$";
23
- export declare const REFERENCE_REGEX_ROW = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\$?[0-9]+\\s*?:\\s*?\\$?[0-9]+$";
24
- export declare const REFERENCE_REGEX_COLUMN = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\$?[A-Za-z]+\\s*?:\\s*?\\$?[A-Za-z]+$";
25
- export declare const REFERENCE_REGEX_SINGLE_ROW = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\s*?\\$?[0-9]+$";
26
- export declare const REFERENCE_REGEX_SINGLE_COLUMN = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\s*?\\$?[A-Za-z]+$";
27
- export declare const REFERENCE_TABLE_ALL_COLUMN_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+$";
28
- export declare const REFERENCE_TABLE_SINGLE_COLUMN_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[((?<!#).)*\\]|\\[\\[#.+\\]\\s*?,\\s*?\\[((?<!#).)*\\]\\])+$";
29
- export declare const REFERENCE_TABLE_MULTIPLE_COLUMN_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[\\[((?<!#).)*\\]\\s*?:\\s*?\\[((?<!#).)*\\]\\])?$|^((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[\\[#.+\\]\\s*?,\\s*?\\[((?<!#).)*\\]\\s*?:\\s*?\\[((?<!#).)*\\]\\])?$";
20
+ export declare const REFERENCE_MULTIPLE_RANGE_REGEX = "^(@)?('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\$?[A-Za-z]+\\$?[0-9]+\\s*?:\\s*?\\$?[A-Za-z]+\\$?[0-9]+$";
21
+ export declare const REFERENCE_SINGLE_RANGE_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\s*?\\$?[A-Za-z]+\\$?[0-9]+(#)?$";
22
+ export declare const REFERENCE_REGEX_ROW = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\$?[0-9]+\\s*?:\\s*?\\$?[0-9]+$";
23
+ export declare const REFERENCE_REGEX_COLUMN = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\$?[A-Za-z]+\\s*?:\\s*?\\$?[A-Za-z]+$";
24
+ export declare const REFERENCE_REGEX_SINGLE_ROW = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\s*?\\$?[0-9]+$";
25
+ export declare const REFERENCE_REGEX_SINGLE_COLUMN = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?(((?![\\[\\]\\/?*\\\\]).)*!)?\\s*?\\$?[A-Za-z]+$";
26
+ export declare const REFERENCE_TABLE_ALL_COLUMN_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+$";
27
+ export declare const REFERENCE_TABLE_SINGLE_COLUMN_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[((?<!#).)*\\]|\\[\\[#.+\\]\\s*?,\\s*?\\[((?<!#).)*\\]\\])+$";
28
+ export declare const REFERENCE_TABLE_MULTIPLE_COLUMN_REGEX = "^('?\\[((?![\\/?:\"<>|*\\\\]).)*?\\])?((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[\\[((?<!#).)*\\]\\s*?:\\s*?\\[((?<!#).)*\\]\\])?$|^((?![~!@#$%^&*()_+<>?:,./;\u2019\uFF0C\u3002\u3001\u2018\uFF1A\u201C\u300A\u300B\uFF1F~\uFF01@#\uFFE5%\u2026\u2026\uFF08\uFF09\u3010\u3011\\[\\]\\/\\\\]).)+(\\[\\[#.+\\]\\s*?,\\s*?\\[((?<!#).)*\\]\\s*?:\\s*?\\[((?<!#).)*\\]\\])?$";
30
29
  export declare const $SUPER_TABLE_COLUMN_REGEX = "[.*?]";
31
30
  export declare const $ARRAY_VALUE_REGEX = "{.*?}";
32
31
  export declare function isReferenceString(refString: string): boolean;
@@ -0,0 +1,30 @@
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
+ import type { IMutation } from '@univerjs/core';
17
+ /**
18
+ *
19
+ * Register function in main thread, then send function to worker thread.
20
+ *
21
+ * In the formula engine, the mutation is solely responsible for communication between the worker and the main thread.
22
+ * It requires setting local to true during execution.
23
+ */
24
+ export interface IRegisterFunctionMutationParam {
25
+ /**
26
+ * function string, function name
27
+ */
28
+ functions: [[string, string]];
29
+ }
30
+ export declare const RegisterFunctionMutation: IMutation<IRegisterFunctionMutationParam>;
@@ -0,0 +1,30 @@
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
+ import type { IMutation } from '@univerjs/core';
17
+ /**
18
+ *
19
+ * Register function in main thread, then send function to worker thread.
20
+ *
21
+ * In the formula engine, the mutation is solely responsible for communication between the worker and the main thread.
22
+ * It requires setting local to true during execution.
23
+ */
24
+ export interface IUnregisterFunctionMutationParam {
25
+ /**
26
+ * Function string
27
+ */
28
+ functions: string[];
29
+ }
30
+ export declare const UnregisterFunctionMutation: IMutation<IUnregisterFunctionMutationParam>;
@@ -14,13 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable, ICommandService } from '@univerjs/core';
17
+ import type { Ctor } from '@wendellhu/redi';
17
18
  import { Injector } from '@wendellhu/redi';
19
+ import type { IFunctionNames } from '../basics/function';
20
+ import type { BaseFunction } from '../functions/base-function';
18
21
  import { IFunctionService } from '../services/function.service';
19
22
  export declare class FormulaController extends Disposable {
23
+ private _function;
20
24
  private readonly _commandService;
21
25
  private readonly _injector;
22
26
  private readonly _functionService;
23
- constructor(_commandService: ICommandService, _injector: Injector, _functionService: IFunctionService);
27
+ constructor(_function: Array<[Ctor<BaseFunction>, IFunctionNames]>, _commandService: ICommandService, _injector: Injector, _functionService: IFunctionService);
24
28
  private _initialize;
25
29
  private _registerCommands;
26
30
  private _registerFunctions;
@@ -0,0 +1,26 @@
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
+ import { Disposable, ICommandService } from '@univerjs/core';
17
+ import { FormulaDataModel } from '../models/formula-data.model';
18
+ import { IFunctionService } from '../services/function.service';
19
+ export declare class RegisterFunctionController extends Disposable {
20
+ private readonly _commandService;
21
+ private readonly _formulaDataModel;
22
+ private readonly _functionService;
23
+ constructor(_commandService: ICommandService, _formulaDataModel: FormulaDataModel, _functionService: IFunctionService);
24
+ private _initialize;
25
+ private _commandExecutedListener;
26
+ }
@@ -16,6 +16,7 @@
16
16
  import type { IWorkbookData } from '@univerjs/core';
17
17
  import { Univer } from '@univerjs/core';
18
18
  import type { Dependency } from '@wendellhu/redi';
19
+ import type { ISheetData } from '../../../basics/common';
19
20
  export declare function createCommandTestBed(workbookConfig?: IWorkbookData, dependencies?: Dependency[]): {
20
21
  univer: Univer;
21
22
  get: {
@@ -27,4 +28,7 @@ export declare function createCommandTestBed(workbookConfig?: IWorkbookData, dep
27
28
  <T_5>(id: import("@wendellhu/redi").DependencyIdentifier<T_5>, quantityOrLookup?: import("@wendellhu/redi").Quantity | import("@wendellhu/redi").LookUp | undefined, lookUp?: import("@wendellhu/redi").LookUp | undefined): T_5 | T_5[] | null;
28
29
  };
29
30
  sheet: import("@univerjs/core").Workbook;
31
+ unitId: string;
32
+ sheetId: string;
33
+ sheetData: ISheetData;
30
34
  };
@@ -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 {};
@@ -107,5 +107,6 @@ export declare class LexerTreeBuilder extends Disposable {
107
107
  private _negativeCondition;
108
108
  private _getSequenceArray;
109
109
  private _resetTemp;
110
+ private _checkSimilarErrorToken;
110
111
  private _nodeMaker;
111
112
  }
@@ -16,22 +16,31 @@
16
16
  import { Injector } from '@wendellhu/redi';
17
17
  import { AstNodePromiseType } from '../../basics/common';
18
18
  import type { BaseFunction } from '../../functions/base-function';
19
+ import { IFormulaCurrentConfigService } from '../../services/current-data.service';
19
20
  import { IFunctionService } from '../../services/function.service';
21
+ import { IFormulaRuntimeService } from '../../services/runtime.service';
20
22
  import type { LexerNode } from '../analysis/lexer-node';
21
23
  import { BaseAstNode } from './base-ast-node';
22
24
  import { BaseAstNodeFactory } from './base-ast-node-factory';
23
25
  import { NodeType } from './node-type';
24
26
  export declare class FunctionNode extends BaseAstNode {
25
27
  private _functionExecutor;
26
- constructor(token: string, _functionExecutor: BaseFunction);
28
+ private _currentConfigService;
29
+ private _runtimeService;
30
+ constructor(token: string, _functionExecutor: BaseFunction, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService);
27
31
  get nodeType(): NodeType;
28
32
  executeAsync(): Promise<AstNodePromiseType>;
29
33
  execute(): void;
34
+ private _calculate;
35
+ private _setRefInfo;
36
+ private _setRefData;
30
37
  }
31
38
  export declare class FunctionNodeFactory extends BaseAstNodeFactory {
32
39
  private readonly _functionService;
40
+ private readonly _currentConfigService;
41
+ private readonly _runtimeService;
33
42
  private readonly _injector;
34
- constructor(_functionService: IFunctionService, _injector: Injector);
43
+ constructor(_functionService: IFunctionService, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _injector: Injector);
35
44
  get zIndex(): number;
36
45
  create(token: string): BaseAstNode;
37
46
  checkAndCreateNodeType(param: LexerNode | string): BaseAstNode | undefined;
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { AstNodePromiseType } from '../../basics/common';
17
16
  import { IFormulaRuntimeService } from '../../services/runtime.service';
18
17
  import { LexerNode } from '../analysis/lexer-node';
19
18
  import { Interpreter } from '../interpreter/interpreter';
@@ -32,7 +31,6 @@ export declare class LambdaNode extends BaseAstNode {
32
31
  isFunctionParameter(): boolean;
33
32
  getLambdaId(): string;
34
33
  execute(): void;
35
- executeAsync(): Promise<AstNodePromiseType>;
36
34
  }
37
35
  export declare class LambdaNodeFactory extends BaseAstNodeFactory {
38
36
  private readonly _runtimeService;
@@ -26,7 +26,6 @@ export declare class LambdaParameterNode extends BaseAstNode {
26
26
  getCurrentLambdaPrivacyVar(): LambdaPrivacyVarType;
27
27
  get nodeType(): NodeType;
28
28
  execute(): void;
29
- private _getRootLexerNode;
30
29
  }
31
30
  export declare class LambdaParameterNodeFactory extends BaseAstNodeFactory {
32
31
  get zIndex(): number;
@@ -33,7 +33,9 @@ export declare class FormulaDependencyTree extends Disposable {
33
33
  formula: string;
34
34
  row: number;
35
35
  column: number;
36
- subComponentId: string;
36
+ rowCount: number;
37
+ columnCount: number;
38
+ subUnitId: string;
37
39
  unitId: string;
38
40
  rangeList: IUnitRange[];
39
41
  formulaId: Nullable<string>;
@@ -19,7 +19,7 @@ import type { IRuntimeUnitDataType, IUnitData, IUnitSheetNameMap } from '../../b
19
19
  import { ObjectClassType } from '../../basics/object-class-type';
20
20
  import { ArrayValueObject } from '../value-object/array-value-object';
21
21
  import { type BaseValueObject, ErrorValueObject } from '../value-object/base-value-object';
22
- import { BooleanValueObject, NumberValueObject, StringValueObject } from '../value-object/primitive-object';
22
+ import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../value-object/primitive-object';
23
23
  export type NodeValueType = BaseValueObject | BaseReferenceObject | AsyncObject | AsyncArrayObject;
24
24
  export type FunctionVariantType = BaseValueObject | BaseReferenceObject;
25
25
  export declare const FORMULA_REF_TO_ARRAY_CACHE: FormulaAstLRU<ArrayValueObject>;
@@ -30,8 +30,6 @@ export declare class BaseReferenceObject extends ObjectClassType {
30
30
  private _defaultSheetId;
31
31
  private _rangeData;
32
32
  private _unitData;
33
- private _rowCount;
34
- private _columnCount;
35
33
  private _defaultUnitId;
36
34
  private _forcedUnitId;
37
35
  private _runtimeData;
@@ -42,6 +40,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
42
40
  private _refOffsetY;
43
41
  constructor(_token: string);
44
42
  dispose(): void;
43
+ isExceedRange(): boolean;
45
44
  setRefOffset(x?: number, y?: number): void;
46
45
  getRefOffset(): {
47
46
  x: number;
@@ -55,7 +54,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
55
54
  };
56
55
  isReferenceObject(): boolean;
57
56
  iterator(callback: (valueObject: Nullable<BaseValueObject>, rowIndex: number, columnIndex: number) => Nullable<boolean>): Nullable<boolean>;
58
- getFirstCell(): NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
57
+ getFirstCell(): NullValueObject | NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
59
58
  getRangeData(): IRange;
60
59
  setRangeData(range: IRange): void;
61
60
  getUnitId(): string;
@@ -64,7 +63,7 @@ export declare class BaseReferenceObject extends ObjectClassType {
64
63
  getForcedUnitId(): string;
65
64
  setForcedSheetId(sheetNameMap: IUnitSheetNameMap): void;
66
65
  setForcedSheetIdDirect(sheetId: string): void;
67
- getForcedSheetId(): string;
66
+ getForcedSheetId(): Nullable<string>;
68
67
  setForcedSheetName(sheetName: string): void;
69
68
  getForcedSheetName(): string;
70
69
  setDefaultSheetId(sheetId: string): void;
@@ -94,23 +93,29 @@ export declare class BaseReferenceObject extends ObjectClassType {
94
93
  isTable(): boolean;
95
94
  unionBy(referenceObject: BaseReferenceObject): NodeValueType;
96
95
  unionRange(rangeData1: IRange, rangeData2: IRange): IRange;
97
- getCellValueObject(cell: ICellData): NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
98
- getCellByRow(row: number): NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
99
- getCellByColumn(column: number): NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
96
+ getCellValueObject(cell: ICellData): NullValueObject | NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
97
+ getCellByRow(row: number): NullValueObject | NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
98
+ getCellByColumn(column: number): NullValueObject | NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
100
99
  getCurrentActiveSheetData(): import("../../basics/common").ISheetItem;
101
- getCurrentRuntimeSheetData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>>;
102
- getCurrentActiveArrayFormulaCellData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>>;
103
- getCurrentRuntimeActiveArrayFormulaCellData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>>;
100
+ getCurrentRuntimeSheetData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>> | undefined;
101
+ getCurrentActiveArrayFormulaCellData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>> | undefined;
102
+ getCurrentRuntimeActiveArrayFormulaCellData(): import("@univerjs/core").ObjectMatrix<Nullable<ICellData>> | undefined;
104
103
  getCellData(row: number, column: number): ICellData;
105
104
  getRuntimeFeatureCellValue(row: number, column: number): ICellData | undefined;
106
- getCellByPosition(row?: number, column?: number): NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
107
- toArrayValueObject(): ArrayValueObject;
105
+ getCellByPosition(row?: number, column?: number): NullValueObject | NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
106
+ toArrayValueObject(useCache?: boolean): ArrayValueObject;
108
107
  toUnitRange(): {
109
- range: IRange;
108
+ range: {
109
+ startRow: number;
110
+ endRow: number;
111
+ startColumn: number;
112
+ endColumn: number;
113
+ };
110
114
  sheetId: string;
111
115
  unitId: string;
112
116
  };
113
117
  private _checkIfWorksheetMiss;
118
+ private _getBlankArrayValueObject;
114
119
  }
115
120
  export declare class AsyncObject extends ObjectClassType {
116
121
  private _promise;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IRange } from '@univerjs/core';
16
+ import type { IRange, Nullable } from '@univerjs/core';
17
17
  import { BaseReferenceObject } from './base-reference-object';
18
18
  export declare class RangeReferenceObject extends BaseReferenceObject {
19
- constructor(range: IRange, forcedSheetId?: string, forcedUnitId?: string);
19
+ constructor(range: IRange, forcedSheetId?: Nullable<string>, forcedUnitId?: string);
20
20
  isRange(): boolean;
21
21
  }
@@ -14,6 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { compareToken } from '../../basics/token';
17
+ export declare enum ArrayBinarySearchType {
18
+ MIN = 0,
19
+ MAX = 1
20
+ }
17
21
  export declare function getCompare(): (x: string, y: string) => number;
18
22
  export declare function isWildcard(str: string): boolean;
19
23
  export declare function isMatchWildcard(currentValue: string, value: string): boolean;
@@ -15,20 +15,23 @@
15
15
  */
16
16
  import { type Nullable } from '@univerjs/core';
17
17
  import { compareToken } from '../../basics/token';
18
+ import { ArrayBinarySearchType } from '../utils/compare';
18
19
  import type { callbackMapFnType, callbackProductFnType, IArrayValueObject } from './base-value-object';
19
20
  import { BaseValueObject, ErrorValueObject } from './base-value-object';
20
- import { BooleanValueObject, NumberValueObject, StringValueObject } from './primitive-object';
21
+ import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from './primitive-object';
21
22
  export declare function fromObjectToString(array: IArrayValueObject): string;
22
- export declare function transformToValueObject(array?: Array<Array<number | string | boolean>>): BaseValueObject[][];
23
- export declare function transformToValue(array?: BaseValueObject[][]): (string | number | boolean)[][];
23
+ export declare function transformToValueObject(array?: Array<Array<number | string | boolean | null>>): BaseValueObject[][];
24
+ export declare function transformToValue(array?: BaseValueObject[][]): (string | number | boolean | null)[][];
24
25
  export declare class ArrayValueObject extends BaseValueObject {
25
- private _value;
26
+ private _values;
26
27
  private _rowCount;
27
28
  private _columnCount;
28
29
  private _unitId;
29
30
  private _sheetId;
30
31
  private _currentRow;
31
32
  private _currentColumn;
33
+ private _sliceCache;
34
+ private _flattenCache;
32
35
  constructor(rawValue: string | IArrayValueObject);
33
36
  dispose(): void;
34
37
  getRowCount(): number;
@@ -75,7 +78,7 @@ export declare class ArrayValueObject extends BaseValueObject {
75
78
  * @columnParam start:stop:step
76
79
  * @param takeArray
77
80
  */
78
- slice(rowParam: Nullable<Array<Nullable<number>>>, columnParam: Nullable<Array<Nullable<number>>>): ArrayValueObject;
81
+ slice(rowParam: Nullable<Array<Nullable<number>>>, columnParam: Nullable<Array<Nullable<number>>>): ArrayValueObject | undefined;
79
82
  sum(): BaseValueObject;
80
83
  max(): BaseValueObject;
81
84
  min(): BaseValueObject;
@@ -85,6 +88,7 @@ export declare class ArrayValueObject extends BaseValueObject {
85
88
  sortByRow(index: number): void;
86
89
  sortByColumn(index: number): void;
87
90
  transpose(): ArrayValueObject;
91
+ binarySearch(valueObject: BaseValueObject, searchType?: ArrayBinarySearchType): number | null | undefined;
88
92
  getNegative(): BaseValueObject;
89
93
  getReciprocal(): BaseValueObject;
90
94
  plus(valueObject: BaseValueObject): BaseValueObject;
@@ -132,7 +136,8 @@ export declare class ArrayValueObject extends BaseValueObject {
132
136
  floorInverse(valueObject: BaseValueObject): BaseValueObject;
133
137
  ceil(valueObject: BaseValueObject): BaseValueObject;
134
138
  ceilInverse(valueObject: BaseValueObject): BaseValueObject;
135
- toValue(): (string | number | boolean)[][];
139
+ toValue(): (string | number | boolean | null)[][];
140
+ private _clearCache;
136
141
  private _sort;
137
142
  private _transposeArray;
138
143
  private _batchOperator;
@@ -143,5 +148,5 @@ export declare class ArrayValueObject extends BaseValueObject {
143
148
  private _createNewArray;
144
149
  }
145
150
  export declare class ValueObjectFactory {
146
- static create(rawValue: string | number | boolean): NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
151
+ static create(rawValue: string | number | boolean | null): NullValueObject | NumberValueObject | StringValueObject | BooleanValueObject | ErrorValueObject | ArrayValueObject;
147
152
  }
@@ -33,6 +33,16 @@ export declare class BaseValueObject extends ObjectClassType {
33
33
  private _rawValue;
34
34
  constructor(_rawValue: string | number | boolean);
35
35
  isValueObject(): boolean;
36
+ toUnitRange(): {
37
+ range: {
38
+ startColumn: number;
39
+ startRow: number;
40
+ endRow: number;
41
+ endColumn: number;
42
+ };
43
+ sheetId: string;
44
+ unitId: string;
45
+ };
36
46
  getValue(): string | number | boolean;
37
47
  getArrayValue(): BaseValueObject[][];
38
48
  setValue(value: string | number | boolean): void;
@@ -125,7 +135,11 @@ export declare class ErrorValueObject extends BaseValueObject {
125
135
  private _errorType;
126
136
  private _errorContent;
127
137
  constructor(_errorType: ErrorType, _errorContent?: string);
138
+ /**
139
+ * @deprecated use 'new' to replace.
140
+ */
128
141
  static create(errorType: ErrorType, errorContent?: string): ErrorValueObject;
142
+ getValue(): ErrorType;
129
143
  getErrorType(): ErrorType;
130
144
  getErrorContent(): string;
131
145
  isEqualType(object: ObjectClassType): boolean;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { compareToken } from '../../basics/token';
17
17
  import { BaseValueObject } from './base-value-object';
18
+ export type PrimitiveValueType = string | boolean | number | null;
18
19
  export declare class NullValueObject extends BaseValueObject {
19
20
  isNull(): boolean;
20
21
  plus(valueObject: BaseValueObject): BaseValueObject;
@@ -13,6 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { FUNCTION_NAMES_ARRAY } from './function-names';
17
- import { Makearray } from './makearray';
18
- export declare const functionArray: (FUNCTION_NAMES_ARRAY | typeof Makearray)[][];
16
+ export declare const functionArray: never[];
@@ -14,5 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare enum FUNCTION_NAMES_ARRAY {
17
- MAKEARRAY = "MAKEARRAY"
18
17
  }