@univerjs/engine-formula 0.11.0 → 0.12.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 (34) hide show
  1. package/lib/cjs/index.js +1 -7
  2. package/lib/es/index.js +5762 -4954
  3. package/lib/index.js +5762 -4954
  4. package/lib/types/basics/common.d.ts +8 -3
  5. package/lib/types/basics/function.d.ts +5 -1
  6. package/lib/types/basics/inverted-index-cache.d.ts +4 -3
  7. package/lib/types/basics/regex.d.ts +10 -1
  8. package/lib/types/commands/mutations/set-array-formula-data.mutation.d.ts +2 -1
  9. package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +1 -0
  10. package/lib/types/engine/analysis/lexer-tree-builder.d.ts +2 -0
  11. package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -0
  12. package/lib/types/engine/ast-node/function-node.d.ts +4 -0
  13. package/lib/types/engine/ast-node/lambda-node.d.ts +2 -1
  14. package/lib/types/engine/ast-node/operator-node.d.ts +9 -2
  15. package/lib/types/engine/ast-node/reference-node.d.ts +11 -2
  16. package/lib/types/engine/reference-object/base-reference-object.d.ts +13 -6
  17. package/lib/types/engine/reference-object/multi-area-reference-object.d.ts +92 -0
  18. package/lib/types/engine/reference-object/table-reference-object.d.ts +86 -4
  19. package/lib/types/engine/value-object/base-value-object.d.ts +2 -1
  20. package/lib/types/engine/value-object/primitive-object.d.ts +2 -1
  21. package/lib/types/functions/information/cell/index.d.ts +1 -2
  22. package/lib/types/functions/lookup/offset/index.d.ts +1 -1
  23. package/lib/types/functions/math/base/index.d.ts +1 -2
  24. package/lib/types/functions/math/function-map.d.ts +1 -2
  25. package/lib/types/functions/math/subtotal/index.d.ts +2 -1
  26. package/lib/types/functions/math/sumproduct/index.d.ts +21 -0
  27. package/lib/types/functions/new-excel-functions.d.ts +2 -0
  28. package/lib/types/functions/text/function-map.d.ts +1 -2
  29. package/lib/types/index.d.ts +5 -2
  30. package/lib/types/services/defined-names.service.d.ts +3 -0
  31. package/lib/types/services/runtime.service.d.ts +9 -1
  32. package/lib/types/services/super-table.service.d.ts +6 -0
  33. package/lib/umd/index.js +1 -7
  34. package/package.json +5 -5
@@ -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 { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitSheetNameMap, } from './basics/common';
16
+ export type { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IRuntimeUnitDataType, ISheetData, IUnitData, 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';
@@ -26,7 +26,8 @@ export { includeFormulaLexerToken, isFormulaLexerToken, normalizeSheetName } fro
26
26
  export { matchRefDrawToken } from './basics/match-token';
27
27
  export { isReferenceString } from './basics/regex';
28
28
  export { convertUnitDataToRuntime } from './basics/runtime';
29
- export { compareToken, matchToken, operatorToken } from './basics/token';
29
+ export { compareToken, matchToken, OPERATOR_TOKEN_SET, operatorToken, prefixToken, SUFFIX_TOKEN_SET } from './basics/token';
30
+ export { DEFAULT_TOKEN_LAMBDA_FUNCTION_NAME, DEFAULT_TOKEN_LET_FUNCTION_NAME, DEFAULT_TOKEN_TYPE_LAMBDA_PARAMETER, DEFAULT_TOKEN_TYPE_PARAMETER, DEFAULT_TOKEN_TYPE_ROOT } from './basics/token-type';
30
31
  export { RegisterFunctionMutation } from './commands/mutations/register-function.mutation';
31
32
  export { type ISetArrayFormulaDataMutationParams, SetArrayFormulaDataMutation } from './commands/mutations/set-array-formula-data.mutation';
32
33
  export { type ISetDefinedNameMutationParam, type ISetDefinedNameMutationSearchParam, RemoveDefinedNameMutation, SetDefinedNameMutation } from './commands/mutations/set-defined-name.mutation';
@@ -36,6 +37,7 @@ export { type ISetFormulaCalculationNotificationMutation, type ISetFormulaCalcul
36
37
  export { type ISetFormulaDataMutationParams, SetFormulaDataMutation } from './commands/mutations/set-formula-data.mutation';
37
38
  export { type IRemoveOtherFormulaMutationParams, type ISetOtherFormulaMutationParams, RemoveOtherFormulaMutation, SetOtherFormulaMutation } from './commands/mutations/set-other-formula.mutation';
38
39
  export { RemoveSuperTableMutation, SetSuperTableMutation, SetSuperTableOptionMutation } from './commands/mutations/set-super-table.mutation';
40
+ export type { ISetSuperTableMutationParam, ISetSuperTableMutationSearchParam } from './commands/mutations/set-super-table.mutation';
39
41
  export { CalculateController } from './controller/calculate.controller';
40
42
  export { ENGINE_FORMULA_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_PLUGIN_CONFIG_KEY, type IUniverEngineFormulaConfig } from './controller/config.schema';
41
43
  export { Lexer } from './engine/analysis/lexer';
@@ -102,6 +104,7 @@ export { FUNCTION_NAMES_LOOKUP } from './functions/lookup/function-names';
102
104
  export { functionMath } from './functions/math/function-map';
103
105
  export { FUNCTION_NAMES_MATH } from './functions/math/function-names';
104
106
  export { functionMeta } from './functions/meta/function-map';
107
+ export { NEW_EXCEL_FUNCTIONS } from './functions/new-excel-functions';
105
108
  export { functionStatistical } from './functions/statistical/function-map';
106
109
  export { FUNCTION_NAMES_STATISTICAL } from './functions/statistical/function-names';
107
110
  export { functionText } from './functions/text/function-map';
@@ -7,6 +7,7 @@ export interface IDefinedNamesServiceParam {
7
7
  comment?: string;
8
8
  localSheetId?: string;
9
9
  hidden?: boolean;
10
+ formulaOrRefStringWithPrefix?: string;
10
11
  }
11
12
  export interface IDefinedNamesServiceFocusParam extends IDefinedNamesServiceParam {
12
13
  unitId: string;
@@ -34,6 +35,7 @@ export interface IDefinedNamesService {
34
35
  focusRange$: Observable<IDefinedNamesServiceFocusParam>;
35
36
  focusRange(unitId: string, id: string): void;
36
37
  getWorksheetByRef(unitId: string, ref: string): Nullable<Worksheet>;
38
+ getAllDefinedNames(): IDefinedNameMap;
37
39
  }
38
40
  export declare class DefinedNamesService extends Disposable implements IDefinedNamesService {
39
41
  private readonly _univerInstanceService;
@@ -61,6 +63,7 @@ export declare class DefinedNamesService extends Disposable implements IDefinedN
61
63
  getValueByName(unitId: string, name: string): IDefinedNamesServiceParam | null;
62
64
  getValueById(unitId: string, id: string): IDefinedNamesServiceParam;
63
65
  hasDefinedName(unitId: string): boolean;
66
+ getAllDefinedNames(): IDefinedNameMap;
64
67
  private _update;
65
68
  private _updateCache;
66
69
  }
@@ -1,5 +1,5 @@
1
1
  import { Nullable, Disposable } from '@univerjs/core';
2
- import { IArrayFormulaRangeType, IFeatureDirtyRangeType, IRuntimeOtherUnitDataType, IRuntimeUnitDataType } from '../basics/common';
2
+ import { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IFeatureDirtyRangeType, IRuntimeOtherUnitDataType, IRuntimeUnitDataType } from '../basics/common';
3
3
  import { BaseAstNode } from '../engine/ast-node/base-ast-node';
4
4
  import { FunctionVariantType } from '../engine/reference-object/base-reference-object';
5
5
  import { IFormulaCurrentConfigService } from './current-data.service';
@@ -28,6 +28,7 @@ export declare enum FormulaExecutedStateType {
28
28
  export interface IAllRuntimeData {
29
29
  unitData: IRuntimeUnitDataType;
30
30
  arrayFormulaRange: IArrayFormulaRangeType;
31
+ arrayFormulaEmbedded: IArrayFormulaEmbeddedMap;
31
32
  unitOtherData: IRuntimeOtherUnitDataType;
32
33
  functionsExecutedState: FormulaExecutedStateType;
33
34
  arrayFormulaCellData: IRuntimeUnitDataType;
@@ -94,6 +95,9 @@ export interface IFormulaRuntimeService {
94
95
  setRuntimeFeatureCellData(featureId: string, featureData: IRuntimeUnitDataType): void;
95
96
  setRuntimeFeatureRange(featureId: string, featureRange: IFeatureDirtyRangeType): void;
96
97
  clearReferenceAndNumberformatCache(): void;
98
+ getUnitArrayFormulaEmbeddedMap(): IArrayFormulaEmbeddedMap;
99
+ setUnitArrayFormulaEmbeddedMap(): void;
100
+ clearArrayObjectCache(): void;
97
101
  }
98
102
  export declare class FormulaRuntimeService extends Disposable implements IFormulaRuntimeService {
99
103
  private readonly _currentConfigService;
@@ -109,6 +113,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
109
113
  private _runtimeData;
110
114
  private _runtimeOtherData;
111
115
  private _unitArrayFormulaRange;
116
+ private _unitArrayFormulaEmbeddedMap;
112
117
  private _runtimeArrayFormulaCellData;
113
118
  private _runtimeClearArrayFormulaCellData;
114
119
  private _runtimeFeatureRange;
@@ -161,6 +166,8 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
161
166
  private _getValueObjectOfRuntimeData;
162
167
  getUnitData(): IRuntimeUnitDataType;
163
168
  getUnitArrayFormula(): IArrayFormulaRangeType;
169
+ getUnitArrayFormulaEmbeddedMap(): IArrayFormulaEmbeddedMap;
170
+ setUnitArrayFormulaEmbeddedMap(): void;
164
171
  getRuntimeOtherData(): IRuntimeOtherUnitDataType;
165
172
  getRuntimeArrayFormulaCellData(): IRuntimeUnitDataType;
166
173
  getRuntimeClearArrayFormulaCellData(): IRuntimeUnitDataType;
@@ -174,6 +181,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
174
181
  setRuntimeFeatureCellData(featureId: string, featureData: IRuntimeUnitDataType): void;
175
182
  getAllRuntimeData(): IAllRuntimeData;
176
183
  getRuntimeState(): IExecutionInProgressParams;
184
+ clearArrayObjectCache(): void;
177
185
  private _checkIfArrayFormulaRangeHasData;
178
186
  private _getRuntimeFeatureCellValue;
179
187
  private _arrayCellHasData;
@@ -1,4 +1,5 @@
1
1
  import { Nullable, Disposable } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
2
3
  import { ISuperTable, TableOptionType } from '../basics/common';
3
4
  export interface ISuperTableOptionParam {
4
5
  tableOption: string;
@@ -10,15 +11,20 @@ export interface ISuperTableService {
10
11
  registerTable(unitId: string, tableName: string, reference: ISuperTable): void;
11
12
  registerTableOptionMap(tableOption: string, tableOptionType: TableOptionType): void;
12
13
  remove(unitId: string, tableName: string): void;
14
+ update$: Observable<unknown>;
13
15
  }
14
16
  export declare class SuperTableService extends Disposable implements ISuperTableService {
15
17
  private _tableMap;
16
18
  private _tableOptionMap;
19
+ private readonly _update$;
20
+ readonly update$: Observable<unknown>;
21
+ constructor();
17
22
  dispose(): void;
18
23
  remove(unitId: string, tableName: string): void;
19
24
  getTableMap(unitId: string): Map<string, ISuperTable> | undefined;
20
25
  getTableOptionMap(): Map<string, TableOptionType>;
21
26
  registerTable(unitId: string, tableName: string, reference: ISuperTable): void;
22
27
  registerTableOptionMap(tableOption: string, tableOptionType: TableOptionType): void;
28
+ private _update;
23
29
  }
24
30
  export declare const ISuperTableService: import('@wendellhu/redi').IdentifierDecorator<ISuperTableService>;