@univerjs/engine-formula 1.0.0-alpha.2 → 1.0.0-alpha.4
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/facade.js +9 -5
- package/lib/cjs/index.js +2017 -356
- package/lib/es/facade.js +9 -5
- package/lib/es/index.js +1999 -359
- package/lib/facade.js +9 -5
- package/lib/index.js +1999 -359
- package/lib/types/basics/common.d.ts +16 -1
- package/lib/types/basics/date.d.ts +2 -2
- package/lib/types/basics/regex.d.ts +4 -4
- package/lib/types/commands/mutations/set-super-table.mutation.d.ts +4 -1
- package/lib/types/controllers/formula-calculation-trigger.controller.d.ts +20 -0
- package/lib/types/controllers/super-table-active-dirty.controller.d.ts +22 -0
- package/lib/types/engine/analysis/lexer-node.d.ts +3 -3
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +2 -1
- package/lib/types/engine/analysis/lexer.d.ts +2 -1
- package/lib/types/engine/analysis/parser.d.ts +2 -1
- package/lib/types/engine/ast-node/function-node.d.ts +9 -2
- package/lib/types/engine/ast-node/operator-node.d.ts +1 -0
- package/lib/types/engine/ast-node/prefix-node.d.ts +1 -0
- package/lib/types/engine/ast-node/reference-node.d.ts +14 -4
- package/lib/types/engine/interpreter/interpreter.d.ts +11 -0
- package/lib/types/engine/reference-object/base-reference-object.d.ts +3 -0
- package/lib/types/engine/reference-object/cell-reference-object.d.ts +1 -0
- package/lib/types/engine/reference-object/table-reference-object.d.ts +2 -0
- package/lib/types/engine/utils/generate-ast-node.d.ts +1 -1
- package/lib/types/engine/utils/math-kit.d.ts +5 -0
- package/lib/types/engine/utils/reference.d.ts +3 -5
- package/lib/types/engine/utils/unit-qualifier.d.ts +32 -0
- package/lib/types/engine/value-object/array-value-object.d.ts +5 -0
- package/lib/types/engine/value-object/base-value-object.d.ts +6 -0
- package/lib/types/facade/f-formula.d.ts +9 -5
- package/lib/types/functions/base-function.d.ts +21 -1
- package/lib/types/functions/cube/cubekpimember/index.d.ts +20 -0
- package/lib/types/functions/cube/cubemember/index.d.ts +20 -0
- package/lib/types/functions/cube/cubememberproperty/index.d.ts +20 -0
- package/lib/types/functions/cube/cuberankedmember/index.d.ts +20 -0
- package/lib/types/functions/cube/cubeset/index.d.ts +20 -0
- package/lib/types/functions/cube/cubesetcount/index.d.ts +20 -0
- package/lib/types/functions/cube/cubevalue/index.d.ts +20 -0
- package/lib/types/functions/financial/amordegrc/index.d.ts +20 -0
- package/lib/types/functions/information/info/index.d.ts +20 -0
- package/lib/types/functions/information/isomitted/index.d.ts +20 -0
- package/lib/types/functions/logical/function-map.d.ts +3 -2
- package/lib/types/functions/logical/function-names.d.ts +2 -0
- package/lib/types/functions/logical/groupby/index.d.ts +46 -0
- package/lib/types/functions/logical/if/index.d.ts +5 -0
- package/lib/types/functions/logical/iferror/index.d.ts +4 -1
- package/lib/types/functions/logical/percentof/index.d.ts +27 -0
- package/lib/types/functions/lookup/anchorarray/index.d.ts +23 -0
- package/lib/types/functions/lookup/function-names.d.ts +1 -0
- package/lib/types/functions/lookup/getpivotdata/index.d.ts +20 -0
- package/lib/types/functions/lookup/hlookup/index.d.ts +1 -0
- package/lib/types/functions/lookup/indirect/index.d.ts +2 -0
- package/lib/types/functions/lookup/rtd/index.d.ts +20 -0
- package/lib/types/functions/lookup/vlookup/index.d.ts +2 -0
- package/lib/types/functions/lookup/xlookup/index.d.ts +2 -0
- package/lib/types/functions/math/iso-ceiling/index.d.ts +20 -0
- package/lib/types/functions/math/sum/index.d.ts +1 -0
- package/lib/types/functions/meta/compare/index.d.ts +1 -0
- package/lib/types/functions/not-implemented-function.d.ts +23 -0
- package/lib/types/functions/statistical/average/index.d.ts +1 -0
- package/lib/types/functions/statistical/countifs/index.d.ts +1 -0
- package/lib/types/functions/statistical/forecast-ets/index.d.ts +20 -0
- package/lib/types/functions/statistical/forecast-ets-confint/index.d.ts +20 -0
- package/lib/types/functions/statistical/forecast-ets-seasonality/index.d.ts +20 -0
- package/lib/types/functions/statistical/forecast-ets-stat/index.d.ts +20 -0
- package/lib/types/functions/statistical/linest/index.d.ts +1 -0
- package/lib/types/functions/text/call/index.d.ts +20 -0
- package/lib/types/functions/text/euroconvert/index.d.ts +20 -0
- package/lib/types/functions/text/function-names.d.ts +1 -0
- package/lib/types/functions/text/phonetic/index.d.ts +20 -0
- package/lib/types/functions/text/register-id/index.d.ts +20 -0
- package/lib/types/functions/text/textsplit/index.d.ts +1 -0
- package/lib/types/functions/web/filterxml/index.d.ts +22 -0
- package/lib/types/functions/web/function-map.d.ts +2 -2
- package/lib/types/functions/web/webservice/index.d.ts +20 -0
- package/lib/types/index.d.ts +7 -2
- package/lib/types/models/formula-data.model.d.ts +4 -2
- package/lib/types/services/active-dirty-manager.service.d.ts +2 -1
- package/lib/types/services/calculate-formula.service.d.ts +2 -2
- package/lib/types/services/current-data.service.d.ts +6 -1
- package/lib/types/services/defined-names.service.d.ts +2 -2
- package/lib/types/services/formula-calculation-trigger.service.d.ts +43 -0
- package/lib/types/services/runtime.service.d.ts +6 -0
- package/lib/types/services/unit-reference-resolver.service.d.ts +39 -0
- package/lib/umd/index.js +5 -2
- package/package.json +5 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { NotImplementedFunction } from '../../not-implemented-function';
|
|
17
|
+
export declare class Call extends NotImplementedFunction {
|
|
18
|
+
minParams: number;
|
|
19
|
+
maxParams: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { NotImplementedFunction } from '../../not-implemented-function';
|
|
17
|
+
export declare class Euroconvert extends NotImplementedFunction {
|
|
18
|
+
minParams: number;
|
|
19
|
+
maxParams: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { NotImplementedFunction } from '../../not-implemented-function';
|
|
17
|
+
export declare class Phonetic extends NotImplementedFunction {
|
|
18
|
+
minParams: number;
|
|
19
|
+
maxParams: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { NotImplementedFunction } from '../../not-implemented-function';
|
|
17
|
+
export declare class RegisterId extends NotImplementedFunction {
|
|
18
|
+
minParams: number;
|
|
19
|
+
maxParams: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { BaseValueObject } from '../../../engine/value-object/base-value-object';
|
|
17
|
+
import { BaseFunction } from '../../base-function';
|
|
18
|
+
export declare class Filterxml extends BaseFunction {
|
|
19
|
+
minParams: number;
|
|
20
|
+
maxParams: number;
|
|
21
|
+
calculate(xml: BaseValueObject, xpath: BaseValueObject): BaseValueObject;
|
|
22
|
+
}
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { Filterxml } from './filterxml';
|
|
17
17
|
import { FUNCTION_NAMES_WEB } from './function-names';
|
|
18
|
-
export declare const functionWeb: (FUNCTION_NAMES_WEB | typeof
|
|
18
|
+
export declare const functionWeb: (FUNCTION_NAMES_WEB | typeof Filterxml)[][];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { NotImplementedFunction } from '../../not-implemented-function';
|
|
17
|
+
export declare class Webservice extends NotImplementedFunction {
|
|
18
|
+
minParams: number;
|
|
19
|
+
maxParams: number;
|
|
20
|
+
}
|
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 { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IFormulaExecuteResultMap, IFormulaStringMap, IRuntimeImageFormulaDataType, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitImageFormulaDataType, IUnitSheetNameMap, } from './basics/common';
|
|
16
|
+
export type { FormulaUnitType, IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IArrayFormulaUnitCellType, IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap, IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IFormulaDatasetConfig, IFormulaExecuteResultMap, IFormulaStringMap, IFormulaUnitNameMap, IFormulaUnitNameMapItem, IRuntimeImageFormulaDataType, IRuntimeUnitDataType, ISheetData, IUnitData, IUnitImageFormulaDataType, IUnitSheetNameMap, } from './basics/common';
|
|
17
17
|
export { BooleanValue } from './basics/common';
|
|
18
18
|
export { type IOtherFormulaData } from './basics/common';
|
|
19
19
|
export type { IExprTreeNode, ISuperTable, IUnitRowData } from './basics/common';
|
|
@@ -48,10 +48,11 @@ export type { ISetImageFormulaDataMutationParams } from './commands/mutations/se
|
|
|
48
48
|
export { RemoveOtherFormulaMutation, SetOtherFormulaMutation } from './commands/mutations/set-other-formula.mutation';
|
|
49
49
|
export type { IRemoveOtherFormulaMutationParams, ISetOtherFormulaMutationParams, } from './commands/mutations/set-other-formula.mutation';
|
|
50
50
|
export { RemoveSuperTableMutation, SetSuperTableMutation, SetSuperTableOptionMutation, } from './commands/mutations/set-super-table.mutation';
|
|
51
|
-
export type { ISetSuperTableMutationParam, ISetSuperTableMutationSearchParam, } from './commands/mutations/set-super-table.mutation';
|
|
51
|
+
export type { IRemoveSuperTableMutationParam, ISetSuperTableMutationParam, ISetSuperTableMutationSearchParam, } from './commands/mutations/set-super-table.mutation';
|
|
52
52
|
export { DEFAULT_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_PLUGIN_CONFIG_KEY, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE, } from './config/config';
|
|
53
53
|
export type { IUniverEngineFormulaConfig } from './config/config';
|
|
54
54
|
export { CalculateController } from './controllers/calculate.controller';
|
|
55
|
+
export { SuperTableActiveDirtyController } from './controllers/super-table-active-dirty.controller';
|
|
55
56
|
export { Lexer } from './engine/analysis/lexer';
|
|
56
57
|
export { LexerNode } from './engine/analysis/lexer-node';
|
|
57
58
|
export { LexerTreeBuilder } from './engine/analysis/lexer-tree-builder';
|
|
@@ -90,6 +91,7 @@ export { handleRefStringInfo } from './engine/utils/reference';
|
|
|
90
91
|
export { deserializeRangeWithSheetWithCache } from './engine/utils/reference-cache';
|
|
91
92
|
export { generateStringWithSequence, sequenceNodeType } from './engine/utils/sequence';
|
|
92
93
|
export type { ISequenceNode } from './engine/utils/sequence';
|
|
94
|
+
export { refactorFormulaUnitQualifier } from './engine/utils/unit-qualifier';
|
|
93
95
|
export { ArrayValueObject, ValueObjectFactory } from './engine/value-object/array-value-object';
|
|
94
96
|
export { BaseValueObject, ErrorValueObject } from './engine/value-object/base-value-object';
|
|
95
97
|
export { LambdaValueObjectObject } from './engine/value-object/lambda-value-object';
|
|
@@ -147,6 +149,7 @@ export { DependencyManagerService } from './services/dependency-manager.service'
|
|
|
147
149
|
export { DependencyManagerBaseService } from './services/dependency-manager.service';
|
|
148
150
|
export { FeatureCalculationManagerService, IFeatureCalculationManagerService, } from './services/feature-calculation-manager.service';
|
|
149
151
|
export type { IFeatureCalculationManagerParam } from './services/feature-calculation-manager.service';
|
|
152
|
+
export { FormulaCalculationTriggerService } from './services/formula-calculation-trigger.service';
|
|
150
153
|
export type { IFormulaInfo, IOtherFormulaResult } from './services/formula-common';
|
|
151
154
|
export { FormulaResultStatus } from './services/formula-common';
|
|
152
155
|
export { FunctionService } from './services/function.service';
|
|
@@ -160,3 +163,5 @@ export type { IAllRuntimeData, IExecutionInProgressParams } from './services/run
|
|
|
160
163
|
export { ISheetRowFilteredService, SheetRowFilteredService } from './services/sheet-row-filtered.service';
|
|
161
164
|
export { ISuperTableService } from './services/super-table.service';
|
|
162
165
|
export { SuperTableService } from './services/super-table.service';
|
|
166
|
+
export { FormulaUnitReferenceResolver, IFormulaUnitReferenceResolver, normalizeFormulaUnitName, } from './services/unit-reference-resolver.service';
|
|
167
|
+
export type { FormulaUnitReferenceKind, IFormulaUnitReferenceResolution, IFormulaUnitReferenceResolveInput, } from './services/unit-reference-resolver.service';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { ICellData, IObjectMatrixPrimitiveType, IRange, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
-
import type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IRuntimeUnitDataType, IUnitData, IUnitImageFormulaDataType, IUnitRowData, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
17
|
+
import type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IFormulaUnitNameMap, IRuntimeUnitDataType, IUnitData, IUnitImageFormulaDataType, IUnitRowData, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
18
18
|
import { Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
|
|
19
19
|
import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder';
|
|
20
20
|
export interface IRangeChange {
|
|
@@ -46,6 +46,7 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
46
46
|
allUnitData: IUnitData;
|
|
47
47
|
unitStylesData: IUnitStylesData;
|
|
48
48
|
unitSheetNameMap: IUnitSheetNameMap;
|
|
49
|
+
unitNameMap: IFormulaUnitNameMap;
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
52
|
* Get the hidden rows that are filtered or manually hidden.
|
|
@@ -54,6 +55,7 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
54
55
|
*/
|
|
55
56
|
getHiddenRowsFiltered(): IUnitRowData;
|
|
56
57
|
updateFormulaData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): IObjectMatrixPrimitiveType<IFormulaDataItem | null>;
|
|
58
|
+
private _rebindSharedFormulaData;
|
|
57
59
|
updateArrayFormulaRange(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): boolean;
|
|
58
60
|
updateArrayFormulaCellData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): boolean;
|
|
59
61
|
updateImageFormulaData(unitId: string, sheetId: string, cellValue: IObjectMatrixPrimitiveType<Nullable<ICellData>>): void;
|
|
@@ -63,6 +65,6 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
63
65
|
* @returns
|
|
64
66
|
*/
|
|
65
67
|
getFormulaDirtyRanges(): IUnitRange[];
|
|
66
|
-
private
|
|
68
|
+
private _initSheetArrayFormulaData;
|
|
67
69
|
}
|
|
68
70
|
export declare function initSheetFormulaData(formulaData: IFormulaData, unitId: string, sheetId: string, cellMatrix: ObjectMatrix<Nullable<ICellData>>): IFormulaData;
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICommandInfo, IUnitRange, Nullable } from '@univerjs/core';
|
|
16
|
+
import type { ICommandInfo, IExecutionOptions, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap } from '../basics/common';
|
|
18
18
|
import { Disposable } from '@univerjs/core';
|
|
19
19
|
export interface IDirtyConversionManagerParams {
|
|
20
20
|
commandId: string;
|
|
21
|
+
shouldTrigger?: (command: ICommandInfo, options?: IExecutionOptions) => boolean;
|
|
21
22
|
getDirtyData: (command: ICommandInfo) => {
|
|
22
23
|
forceCalculation?: boolean;
|
|
23
24
|
dirtyRanges?: IUnitRange[];
|
|
@@ -37,7 +37,7 @@ export interface ICalculateFormulaService {
|
|
|
37
37
|
setRuntimeFeatureRange(featureId: string, featureRange: IFeatureDirtyRangeType): void;
|
|
38
38
|
execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
|
|
39
39
|
stopFormulaExecution(): void;
|
|
40
|
-
calculate(formulaString: string, transformSuffix?: boolean): void;
|
|
40
|
+
calculate(formulaString: string, transformSuffix?: boolean, unitId?: string): void;
|
|
41
41
|
executeFormulas(formulas: IFormulaStringMap, rowData?: IUnitRowData): Promise<IFormulaExecuteResultMap>;
|
|
42
42
|
getAllDependencyJson(rowData?: IUnitRowData): Promise<IFormulaDependencyTreeJson[]>;
|
|
43
43
|
getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number, rowData?: IUnitRowData): Promise<IFormulaDependencyTreeFullJson | undefined>;
|
|
@@ -85,7 +85,7 @@ export declare class CalculateFormulaService extends Disposable implements ICalc
|
|
|
85
85
|
};
|
|
86
86
|
protected _apply(isArrayFormulaState?: boolean): Promise<IAllRuntimeData | undefined>;
|
|
87
87
|
executeFormulas(formulas: IFormulaStringMap, rowData?: IUnitRowData): Promise<IFormulaExecuteResultMap>;
|
|
88
|
-
calculate(formulaString: string): Promise<FunctionVariantType | undefined>;
|
|
88
|
+
calculate(formulaString: string, transformSuffix?: boolean, unitId?: string): Promise<FunctionVariantType | undefined>;
|
|
89
89
|
getAllDependencyJson(): Promise<IFormulaDependencyTreeJson[]>;
|
|
90
90
|
getCellDependencyJson(unitId: string, sheetId: string, row: number, column: number): Promise<IFormulaDependencyTreeFullJson | undefined>;
|
|
91
91
|
getRangeDependents(unitRanges: IUnitRange[]): Promise<IFormulaDependencyTreeJson[]>;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IUnitRange, LocaleType, Nullable } from '@univerjs/core';
|
|
17
|
-
import type { IArrayFormulaRangeType, IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap, IFormulaData, IFormulaDatasetConfig, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetIdToNameMap, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
17
|
+
import type { IArrayFormulaRangeType, IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap, IFormulaData, IFormulaDatasetConfig, IFormulaUnitNameMap, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetIdToNameMap, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
18
18
|
import { Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
19
19
|
import { FormulaDataModel } from '../models/formula-data.model';
|
|
20
20
|
import { ISheetRowFilteredService } from './sheet-row-filtered.service';
|
|
@@ -40,6 +40,7 @@ export interface IFormulaCurrentConfigService {
|
|
|
40
40
|
getUnitStylesData(): IUnitStylesData;
|
|
41
41
|
getFormulaData(): IFormulaData;
|
|
42
42
|
getSheetNameMap(): IUnitSheetNameMap;
|
|
43
|
+
getUnitNameMap(): IFormulaUnitNameMap;
|
|
43
44
|
isForceCalculate(): boolean;
|
|
44
45
|
getDirtyRanges(): IUnitRange[];
|
|
45
46
|
getDirtyNameMap(): IDirtyUnitSheetNameMap;
|
|
@@ -49,6 +50,7 @@ export interface IFormulaCurrentConfigService {
|
|
|
49
50
|
registerUnitData(unitData: IUnitData): void;
|
|
50
51
|
registerFormulaData(formulaData: IFormulaData): void;
|
|
51
52
|
registerSheetNameMap(sheetNameMap: IUnitSheetNameMap): void;
|
|
53
|
+
registerUnitNameMap(unitNameMap: IFormulaUnitNameMap): void;
|
|
52
54
|
getExcludedRange(): Nullable<IUnitExcludedCell>;
|
|
53
55
|
loadDirtyRangesAndExcludedCell(dirtyRanges: IUnitRange[], excludedCell?: IUnitExcludedCell): void;
|
|
54
56
|
getArrayFormulaCellData(): IRuntimeUnitDataType;
|
|
@@ -87,6 +89,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
87
89
|
private _arrayFormulaRange;
|
|
88
90
|
private _formulaData;
|
|
89
91
|
private _sheetNameMap;
|
|
92
|
+
private _unitNameMap;
|
|
90
93
|
private _forceCalculate;
|
|
91
94
|
private _clearDependencyTreeCache;
|
|
92
95
|
private _dirtyRanges;
|
|
@@ -112,6 +115,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
112
115
|
getArrayFormulaCellData(): IRuntimeUnitDataType;
|
|
113
116
|
getArrayFormulaRange(): IArrayFormulaRangeType;
|
|
114
117
|
getSheetNameMap(): IUnitSheetNameMap;
|
|
118
|
+
getUnitNameMap(): IFormulaUnitNameMap;
|
|
115
119
|
isForceCalculate(): boolean;
|
|
116
120
|
getDirtyRanges(): IUnitRange[];
|
|
117
121
|
getDirtyNameMap(): IDirtyUnitSheetNameMap;
|
|
@@ -141,6 +145,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
141
145
|
registerUnitData(unitData: IUnitData): void;
|
|
142
146
|
registerFormulaData(formulaData: IFormulaData): void;
|
|
143
147
|
registerSheetNameMap(sheetNameMap: IUnitSheetNameMap): void;
|
|
148
|
+
registerUnitNameMap(unitNameMap: IFormulaUnitNameMap): void;
|
|
144
149
|
private _mergeNameMap;
|
|
145
150
|
private _loadSheetData;
|
|
146
151
|
/**
|
|
@@ -43,7 +43,7 @@ export interface IDefinedNamesService {
|
|
|
43
43
|
registerDefinedName(unitId: string, param: IDefinedNamesServiceParam): void;
|
|
44
44
|
registerDefinedNames(unitId: string, params: IDefinedNameMapItem): void;
|
|
45
45
|
getDefinedNameMap(unitId: string): Nullable<IDefinedNameMapItem>;
|
|
46
|
-
getValueByName(unitId: string, name: string): Nullable<IDefinedNamesServiceParam>;
|
|
46
|
+
getValueByName(unitId: string, name: string, sheetId?: Nullable<string>): Nullable<IDefinedNamesServiceParam>;
|
|
47
47
|
getValueById(unitId: string, id: string): Nullable<IDefinedNamesServiceParam>;
|
|
48
48
|
removeDefinedName(unitId: string, name: string): void;
|
|
49
49
|
removeUnitDefinedName(unitId: string): void;
|
|
@@ -84,7 +84,7 @@ export declare class DefinedNamesService extends Disposable implements IDefinedN
|
|
|
84
84
|
removeDefinedName(unitId: string, id: string): void;
|
|
85
85
|
removeUnitDefinedName(unitId: string): void;
|
|
86
86
|
getDefinedNameMap(unitId: string): IDefinedNameMapItem;
|
|
87
|
-
getValueByName(unitId: string, name: string): IDefinedNamesServiceParam | null;
|
|
87
|
+
getValueByName(unitId: string, name: string, sheetId?: Nullable<string>): IDefinedNamesServiceParam | null;
|
|
88
88
|
getValueById(unitId: string, id: string): IDefinedNamesServiceParam;
|
|
89
89
|
hasDefinedName(unitId: string): boolean;
|
|
90
90
|
getAllDefinedNames(): IDefinedNameMap;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { IActiveDirtyManagerService } from './active-dirty-manager.service';
|
|
18
|
+
/**
|
|
19
|
+
* Converts commands registered in ActiveDirtyManagerService into one formula
|
|
20
|
+
* calculation stream. Product packages register dirty conversions, while this
|
|
21
|
+
* service owns batching and restart semantics for every unit type.
|
|
22
|
+
*/
|
|
23
|
+
export declare class FormulaCalculationTriggerService extends Disposable {
|
|
24
|
+
private readonly _commandService;
|
|
25
|
+
private readonly _activeDirtyManagerService;
|
|
26
|
+
private _waitingCommandQueue;
|
|
27
|
+
private _pendingDirtyData;
|
|
28
|
+
private _runningDirtyData;
|
|
29
|
+
private _timer;
|
|
30
|
+
private _started;
|
|
31
|
+
private _executionInProgress;
|
|
32
|
+
private _hasPendingCalculation;
|
|
33
|
+
private _stopRequested;
|
|
34
|
+
constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService);
|
|
35
|
+
start(): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
private _initialize;
|
|
38
|
+
private _scheduleFlush;
|
|
39
|
+
private _flush;
|
|
40
|
+
private _startCalculation;
|
|
41
|
+
private _handleCalculationNotification;
|
|
42
|
+
private _generateDirty;
|
|
43
|
+
}
|
|
@@ -70,11 +70,14 @@ export interface IExecutionInProgressParams {
|
|
|
70
70
|
export interface IFormulaRuntimeService {
|
|
71
71
|
currentRow: number;
|
|
72
72
|
currentColumn: number;
|
|
73
|
+
currentRowCount: number;
|
|
74
|
+
currentColumnCount: number;
|
|
73
75
|
currentSubUnitId: string;
|
|
74
76
|
currentUnitId: string;
|
|
75
77
|
dispose(): void;
|
|
76
78
|
reset(): void;
|
|
77
79
|
setCurrent(row: number, column: number, rowCount: number, columnCount: number, sheetId: string, unitId: string): void;
|
|
80
|
+
setFunctionRefInfoOverride(rowCount: number, columnCount: number): () => void;
|
|
78
81
|
registerFunctionDefinitionPrivacyVar(lambdaId: string, lambdaVar: Map<string, Nullable<BaseAstNode>>): void;
|
|
79
82
|
getFunctionDefinitionPrivacyVar(lambdaId: string): Nullable<Map<string, Nullable<BaseAstNode>>>;
|
|
80
83
|
setRuntimeData(functionVariant: FunctionVariantType): void;
|
|
@@ -130,6 +133,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
130
133
|
private _currentColumn;
|
|
131
134
|
private _currentRowCount;
|
|
132
135
|
private _currentColumnCount;
|
|
136
|
+
private _functionRefInfoOverrideStack;
|
|
133
137
|
private _currentSubUnitId;
|
|
134
138
|
private _currentUnitId;
|
|
135
139
|
private _runtimeData;
|
|
@@ -182,6 +186,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
182
186
|
reset(): void;
|
|
183
187
|
clearReferenceAndNumberformatCache(): void;
|
|
184
188
|
setCurrent(row: number, column: number, rowCount: number, columnCount: number, sheetId: string, unitId: string): void;
|
|
189
|
+
setFunctionRefInfoOverride(rowCount: number, columnCount: number): () => void;
|
|
185
190
|
clearFunctionDefinitionPrivacyVar(): void;
|
|
186
191
|
registerFunctionDefinitionPrivacyVar(lambdaId: string, lambdaVar: Map<string, Nullable<BaseAstNode>>): void;
|
|
187
192
|
getFunctionDefinitionPrivacyVar(lambdaId: string): Nullable<Map<string, Nullable<BaseAstNode>>>;
|
|
@@ -223,6 +228,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
223
228
|
* @returns
|
|
224
229
|
*/
|
|
225
230
|
private _isInOtherArrayFormulaRange;
|
|
231
|
+
private _isCurrentSingleCellArrayFormulaRange;
|
|
226
232
|
private _isInArrayFormulaRange;
|
|
227
233
|
private _isSameCellValue;
|
|
228
234
|
private _checkIfArrayFormulaExceeded;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { FormulaUnitType } from '../basics/common';
|
|
17
|
+
import { ErrorType } from '../basics/error-type';
|
|
18
|
+
import { IFormulaCurrentConfigService } from './current-data.service';
|
|
19
|
+
export type FormulaUnitReferenceKind = 'a1' | 'table';
|
|
20
|
+
export interface IFormulaUnitReferenceResolveInput {
|
|
21
|
+
hostUnitId: string;
|
|
22
|
+
qualifier: string;
|
|
23
|
+
referenceKind: FormulaUnitReferenceKind;
|
|
24
|
+
}
|
|
25
|
+
export interface IFormulaUnitReferenceResolution {
|
|
26
|
+
unitId: string;
|
|
27
|
+
unitType?: FormulaUnitType;
|
|
28
|
+
}
|
|
29
|
+
export interface IFormulaUnitReferenceResolver {
|
|
30
|
+
resolve(input: IFormulaUnitReferenceResolveInput): IFormulaUnitReferenceResolution | ErrorType;
|
|
31
|
+
}
|
|
32
|
+
export declare const IFormulaUnitReferenceResolver: import("@wendellhu/redi").IdentifierDecorator<IFormulaUnitReferenceResolver>;
|
|
33
|
+
export declare function normalizeFormulaUnitName(name: string): string;
|
|
34
|
+
export declare class FormulaUnitReferenceResolver implements IFormulaUnitReferenceResolver {
|
|
35
|
+
protected readonly _currentConfigService: IFormulaCurrentConfigService;
|
|
36
|
+
constructor(_currentConfigService: IFormulaCurrentConfigService);
|
|
37
|
+
resolve({ hostUnitId, qualifier, referenceKind, }: IFormulaUnitReferenceResolveInput): IFormulaUnitReferenceResolution | ErrorType;
|
|
38
|
+
private _validateReferenceKind;
|
|
39
|
+
}
|