@univerjs/engine-formula 0.10.14 → 0.11.0-nightly.202511151013
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.
- package/lib/cjs/index.js +1 -7
- package/lib/es/index.js +5862 -5041
- package/lib/index.js +5862 -5041
- package/lib/types/basics/common.d.ts +8 -3
- package/lib/types/basics/function.d.ts +5 -1
- package/lib/types/basics/inverted-index-cache.d.ts +4 -3
- package/lib/types/basics/regex.d.ts +10 -1
- package/lib/types/commands/mutations/set-array-formula-data.mutation.d.ts +2 -1
- package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +1 -0
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +16 -6
- package/lib/types/engine/analysis/lexer.d.ts +1 -5
- package/lib/types/engine/ast-node/base-ast-node.d.ts +2 -2
- package/lib/types/engine/ast-node/function-node.d.ts +4 -0
- package/lib/types/engine/ast-node/lambda-node.d.ts +2 -1
- package/lib/types/engine/ast-node/operator-node.d.ts +9 -2
- package/lib/types/engine/ast-node/reference-node.d.ts +11 -2
- package/lib/types/engine/reference-object/base-reference-object.d.ts +13 -6
- package/lib/types/engine/reference-object/multi-area-reference-object.d.ts +92 -0
- package/lib/types/engine/reference-object/table-reference-object.d.ts +86 -4
- package/lib/types/engine/utils/reference.d.ts +12 -0
- package/lib/types/engine/value-object/base-value-object.d.ts +2 -1
- package/lib/types/engine/value-object/primitive-object.d.ts +2 -1
- package/lib/types/functions/information/cell/index.d.ts +1 -2
- package/lib/types/functions/lookup/offset/index.d.ts +1 -1
- package/lib/types/functions/math/base/index.d.ts +1 -2
- package/lib/types/functions/math/function-map.d.ts +1 -2
- package/lib/types/functions/math/subtotal/index.d.ts +2 -1
- package/lib/types/functions/math/sumproduct/index.d.ts +21 -0
- package/lib/types/functions/new-excel-functions.d.ts +2 -0
- package/lib/types/functions/text/function-map.d.ts +1 -2
- package/lib/types/index.d.ts +7 -4
- package/lib/types/services/defined-names.service.d.ts +3 -0
- package/lib/types/services/runtime.service.d.ts +9 -1
- package/lib/types/services/super-table.service.d.ts +6 -0
- package/lib/umd/index.js +1 -7
- package/package.json +5 -5
- package/LICENSE +0 -176
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
|
|
2
|
+
import { ArrayValueObject } from '../../../engine/value-object/array-value-object';
|
|
2
3
|
import { BaseFunction } from '../../base-function';
|
|
3
4
|
export declare class Subtotal extends BaseFunction {
|
|
4
5
|
minParams: number;
|
|
@@ -6,7 +7,7 @@ export declare class Subtotal extends BaseFunction {
|
|
|
6
7
|
needsReferenceObject: boolean;
|
|
7
8
|
needsFilteredOutRows: boolean;
|
|
8
9
|
needsFormulaDataModel: boolean;
|
|
9
|
-
calculate(functionNum: FunctionVariantType, ...refs: FunctionVariantType[]): FunctionVariantType;
|
|
10
|
+
calculate(functionNum: FunctionVariantType, ...refs: FunctionVariantType[]): ArrayValueObject | FunctionVariantType;
|
|
10
11
|
private _handleSingleObject;
|
|
11
12
|
private _getIndexNumValue;
|
|
12
13
|
private _average;
|
|
@@ -4,6 +4,27 @@ export declare class Sumproduct extends BaseFunction {
|
|
|
4
4
|
minParams: number;
|
|
5
5
|
maxParams: number;
|
|
6
6
|
calculate(array1: BaseValueObject, ...variants: BaseValueObject[]): BaseValueObject;
|
|
7
|
+
/**
|
|
8
|
+
* Validate all variants:
|
|
9
|
+
* - propagate first error BaseValueObject
|
|
10
|
+
* - ensure array dimensions are compatible with base (rowCount/columnCount)
|
|
11
|
+
* Returns an ErrorValueObject / BaseValueObject on failure, or null when OK.
|
|
12
|
+
*/
|
|
13
|
+
private _validateVariants;
|
|
14
|
+
/**
|
|
15
|
+
* Core SUMPRODUCT loop.
|
|
16
|
+
* - baseArray already contains numeric values from array1
|
|
17
|
+
* - variants may be scalar or array; non-number cells are treated as 0
|
|
18
|
+
* - any error cell short-circuits with that error
|
|
19
|
+
*/
|
|
20
|
+
private _sumProduct;
|
|
21
|
+
/**
|
|
22
|
+
* Get the value object of a variant at (r, c).
|
|
23
|
+
* - For scalar variants, returns the variant itself.
|
|
24
|
+
* - For array variants, returns the cell at (r, c).
|
|
25
|
+
* If cell does not exist, returns null and let caller convert to #VALUE!.
|
|
26
|
+
*/
|
|
27
|
+
private _getVariantCell;
|
|
7
28
|
private _initArray1;
|
|
8
29
|
private _getResultArrayByArray1;
|
|
9
30
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Concat } from './concat';
|
|
2
1
|
import { Concatenate } from './concatenate';
|
|
3
2
|
import { FUNCTION_NAMES_TEXT } from './function-names';
|
|
4
3
|
import { Textafter } from './textafter';
|
|
5
4
|
import { Textbefore } from './textbefore';
|
|
6
5
|
import { Textsplit } from './textsplit';
|
|
7
|
-
export declare const functionText: ((FUNCTION_NAMES_TEXT | typeof
|
|
6
|
+
export declare const functionText: ((FUNCTION_NAMES_TEXT | typeof Concatenate)[] | (FUNCTION_NAMES_TEXT | typeof Textafter)[] | (FUNCTION_NAMES_TEXT | typeof Textbefore)[] | (FUNCTION_NAMES_TEXT | typeof Textsplit)[])[];
|
package/lib/types/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -43,7 +45,7 @@ export { LexerNode } from './engine/analysis/lexer-node';
|
|
|
43
45
|
export { LexerTreeBuilder } from './engine/analysis/lexer-tree-builder';
|
|
44
46
|
export { AstTreeBuilder } from './engine/analysis/parser';
|
|
45
47
|
export { AstRootNodeFactory } from './engine/ast-node/ast-root-node';
|
|
46
|
-
export type { BaseAstNode } from './engine/ast-node/base-ast-node
|
|
48
|
+
export type { BaseAstNode, IAstNodeNodeJson } from './engine/ast-node/base-ast-node';
|
|
47
49
|
export { FunctionNodeFactory } from './engine/ast-node/function-node';
|
|
48
50
|
export { LambdaNodeFactory } from './engine/ast-node/lambda-node';
|
|
49
51
|
export { LambdaParameterNodeFactory } from './engine/ast-node/lambda-parameter-node';
|
|
@@ -68,7 +70,7 @@ export { generateAstNode } from './engine/utils/generate-ast-node';
|
|
|
68
70
|
export { strip, stripErrorMargin } from './engine/utils/math-kit';
|
|
69
71
|
export { handleNumfmtInCell } from './engine/utils/numfmt-kit';
|
|
70
72
|
export { deserializeRangeForR1C1 } from './engine/utils/r1c1-reference';
|
|
71
|
-
export { deserializeRangeWithSheet, getAbsoluteRefTypeWithSingleString, getAbsoluteRefTypeWitString, getRangeWithRefsString, type IAbsoluteRefTypeForRange, isReferenceStrings, isReferenceStringWithEffectiveColumn, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, singleReferenceToGrid, } from './engine/utils/reference';
|
|
73
|
+
export { deserializeRangeWithSheet, getAbsoluteRefTypeWithSingleString, getAbsoluteRefTypeWitString, getRangeWithRefsString, type IAbsoluteRefTypeForRange, isReferenceStrings, isReferenceStringWithEffectiveColumn, needsQuoting, quoteSheetName, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, singleReferenceToGrid, unquoteSheetName, } from './engine/utils/reference';
|
|
72
74
|
export { handleRefStringInfo } from './engine/utils/reference';
|
|
73
75
|
export { deserializeRangeWithSheetWithCache } from './engine/utils/reference-cache';
|
|
74
76
|
export { generateStringWithSequence, type ISequenceNode, sequenceNodeType } from './engine/utils/sequence';
|
|
@@ -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>;
|