@univerjs/engine-formula 0.4.2 → 0.5.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -0
- package/lib/cjs/index.js +2 -2
- package/lib/es/facade.js +79 -0
- package/lib/es/index.js +23862 -21567
- package/lib/types/basics/common.d.ts +6 -2
- package/lib/types/basics/format.d.ts +2 -15
- package/lib/types/basics/math.d.ts +3 -0
- package/lib/types/basics/statistical.d.ts +19 -3
- package/lib/types/commands/mutations/set-other-formula.mutation.d.ts +2 -2
- package/lib/types/controller/calculate.controller.d.ts +2 -2
- package/lib/types/engine/analysis/parser.d.ts +0 -2
- package/lib/types/engine/ast-node/base-ast-node.d.ts +1 -0
- package/lib/types/engine/ast-node/function-node.d.ts +5 -2
- package/lib/types/engine/ast-node/operator-node.d.ts +1 -2
- package/lib/types/engine/ast-node/prefix-node.d.ts +6 -5
- package/lib/types/engine/ast-node/reference-node.d.ts +8 -10
- package/lib/types/engine/ast-node/suffix-node.d.ts +8 -5
- package/lib/types/engine/ast-node/union-node.d.ts +1 -2
- package/lib/types/engine/ast-node/value-node.d.ts +1 -2
- package/lib/types/engine/dependency/dependency-tree.d.ts +85 -38
- package/lib/types/engine/dependency/formula-dependency.d.ts +45 -36
- package/lib/types/engine/interpreter/interpreter.d.ts +3 -3
- package/lib/types/engine/utils/array-object.d.ts +1 -1
- package/lib/types/engine/utils/ast-node-tool.d.ts +1 -1
- package/lib/types/engine/utils/generate-ast-node.d.ts +8 -0
- package/lib/types/engine/utils/prefixHandler.d.ts +3 -2
- package/lib/types/engine/utils/value-object.d.ts +9 -1
- package/lib/types/engine/value-object/__tests__/array-inverted-index-cache.spec.d.ts +16 -0
- package/lib/types/engine/value-object/__tests__/array-inverted-index-cache2.spec.d.ts +16 -0
- package/lib/types/engine/value-object/cube-value-object.d.ts +1 -0
- package/lib/types/engine/value-object/lambda-value-object.d.ts +3 -1
- package/lib/types/engine/value-object/primitive-object.d.ts +0 -1
- package/lib/types/facade/f-formula.d.ts +31 -0
- package/lib/types/facade/f-univer.d.ts +9 -0
- package/lib/types/facade/index.d.ts +17 -0
- package/lib/types/functions/base-function.d.ts +7 -0
- package/lib/types/functions/compatibility/hypgeomdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/hypgeomdist/index.d.ts +8 -0
- package/lib/types/functions/compatibility/lognormdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/lognormdist/index.d.ts +8 -0
- package/lib/types/functions/compatibility/negbinomdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/negbinomdist/index.d.ts +8 -0
- package/lib/types/functions/compatibility/tdist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/tdist/index.d.ts +8 -0
- package/lib/types/functions/financial/fv/index.d.ts +1 -1
- package/lib/types/functions/financial/ipmt/index.d.ts +1 -1
- package/lib/types/functions/financial/pmt/index.d.ts +1 -1
- package/lib/types/functions/financial/ppmt/index.d.ts +1 -1
- package/lib/types/functions/financial/pv/index.d.ts +1 -1
- package/lib/types/functions/lookup/formulatext/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/lookup/formulatext/index.d.ts +10 -0
- package/lib/types/functions/lookup/lookup/index.d.ts +1 -1
- package/lib/types/functions/math/mmult/index.d.ts +0 -1
- package/lib/types/functions/statistical/frequency/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/frequency/index.d.ts +9 -0
- package/lib/types/functions/statistical/gamma/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gamma/index.d.ts +8 -0
- package/lib/types/functions/statistical/gamma-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gamma-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/gamma-inv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gamma-inv/index.d.ts +8 -0
- package/lib/types/functions/statistical/gammaln/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gammaln/index.d.ts +8 -0
- package/lib/types/functions/statistical/gauss/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/gauss/index.d.ts +8 -0
- package/lib/types/functions/statistical/geomean/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/geomean/index.d.ts +7 -0
- package/lib/types/functions/statistical/growth/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/growth/index.d.ts +16 -0
- package/lib/types/functions/statistical/harmean/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/harmean/index.d.ts +7 -0
- package/lib/types/functions/statistical/hypgeom-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/hypgeom-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/kurt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/kurt/index.d.ts +8 -0
- package/lib/types/functions/statistical/large/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/large/index.d.ts +9 -0
- package/lib/types/functions/statistical/lognorm-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/lognorm-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/lognorm-inv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/lognorm-inv/index.d.ts +8 -0
- package/lib/types/functions/statistical/median/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/median/index.d.ts +8 -0
- package/lib/types/functions/statistical/mode-mult/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/mode-mult/index.d.ts +8 -0
- package/lib/types/functions/statistical/mode-sngl/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/mode-sngl/index.d.ts +8 -0
- package/lib/types/functions/statistical/negbinom-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/negbinom-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/pearson/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/pearson/index.d.ts +8 -0
- package/lib/types/functions/statistical/percentile-exc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentile-exc/index.d.ts +9 -0
- package/lib/types/functions/statistical/percentile-inc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentile-inc/index.d.ts +9 -0
- package/lib/types/functions/statistical/percentrank-exc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentrank-exc/index.d.ts +9 -0
- package/lib/types/functions/statistical/percentrank-inc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/percentrank-inc/index.d.ts +9 -0
- package/lib/types/functions/statistical/permut/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/permut/index.d.ts +7 -0
- package/lib/types/functions/statistical/permutationa/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/permutationa/index.d.ts +7 -0
- package/lib/types/functions/statistical/phi/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/phi/index.d.ts +8 -0
- package/lib/types/functions/statistical/poisson-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/poisson-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/prob/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/prob/index.d.ts +9 -0
- package/lib/types/functions/statistical/quartile-exc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/quartile-exc/index.d.ts +9 -0
- package/lib/types/functions/statistical/quartile-inc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/quartile-inc/index.d.ts +9 -0
- package/lib/types/functions/statistical/rsq/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/rsq/index.d.ts +8 -0
- package/lib/types/functions/statistical/skew/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/skew/index.d.ts +8 -0
- package/lib/types/functions/statistical/skew-p/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/skew-p/index.d.ts +8 -0
- package/lib/types/functions/statistical/slope/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/slope/index.d.ts +8 -0
- package/lib/types/functions/statistical/small/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/small/index.d.ts +9 -0
- package/lib/types/functions/statistical/standardize/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/standardize/index.d.ts +8 -0
- package/lib/types/functions/statistical/steyx/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/steyx/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-dist-2t/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-dist-2t/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-dist-rt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-dist-rt/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-inv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-inv/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-inv-2t/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-inv-2t/index.d.ts +8 -0
- package/lib/types/functions/statistical/t-test/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/t-test/index.d.ts +14 -0
- package/lib/types/functions/statistical/trimmean/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/trimmean/index.d.ts +9 -0
- package/lib/types/functions/statistical/weibull-dist/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/weibull-dist/index.d.ts +8 -0
- package/lib/types/functions/statistical/z-test/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/z-test/index.d.ts +9 -0
- package/lib/types/functions/text/exact/index.d.ts +1 -1
- package/lib/types/functions/text/find/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/find/index.d.ts +8 -0
- package/lib/types/functions/text/findb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/findb/index.d.ts +8 -0
- package/lib/types/functions/text/function-map.d.ts +1 -2
- package/lib/types/functions/text/left/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/left/index.d.ts +8 -0
- package/lib/types/functions/text/lower/index.d.ts +2 -3
- package/lib/types/functions/text/mid/index.d.ts +2 -2
- package/lib/types/functions/text/midb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/midb/index.d.ts +8 -0
- package/lib/types/functions/text/proper/index.d.ts +1 -1
- package/lib/types/functions/text/replace/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/replace/index.d.ts +8 -0
- package/lib/types/functions/text/replaceb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/replaceb/index.d.ts +8 -0
- package/lib/types/functions/text/search/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/search/index.d.ts +8 -0
- package/lib/types/functions/text/searchb/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/searchb/index.d.ts +8 -0
- package/lib/types/functions/text/t/index.d.ts +1 -1
- package/lib/types/functions/text/textjoin/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/textjoin/index.d.ts +10 -0
- package/lib/types/functions/text/trim/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/trim/index.d.ts +8 -0
- package/lib/types/functions/text/upper/__test__/index.spec.d.ts +16 -0
- package/lib/types/functions/text/upper/index.d.ts +8 -0
- package/lib/types/index.d.ts +13 -2
- package/lib/types/models/formula-data.model.d.ts +6 -1
- package/lib/types/plugin.d.ts +3 -2
- package/lib/types/services/calculate-formula.service.d.ts +25 -14
- package/lib/types/services/dependency-manager.service.d.ts +70 -69
- package/lib/types/services/other-formula-manager.service.d.ts +4 -4
- package/lib/types/services/runtime.service.d.ts +2 -2
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/package.json +21 -11
|
@@ -49,7 +49,7 @@ export interface IRuntimeUnitDataPrimitiveType {
|
|
|
49
49
|
export interface IRuntimeOtherUnitDataType {
|
|
50
50
|
[unitId: string]: Nullable<{
|
|
51
51
|
[sheetId: string]: Nullable<{
|
|
52
|
-
[formulaId: string]: Nullable<ICellData>[][]
|
|
52
|
+
[formulaId: string]: IObjectMatrixPrimitiveType<Nullable<ICellData>[][]>;
|
|
53
53
|
}>;
|
|
54
54
|
}>;
|
|
55
55
|
}
|
|
@@ -107,7 +107,7 @@ export interface IFormulaData {
|
|
|
107
107
|
export interface IOtherFormulaData {
|
|
108
108
|
[unitId: string]: Nullable<{
|
|
109
109
|
[subUnitId: string]: Nullable<{
|
|
110
|
-
[formulaId: string]:
|
|
110
|
+
[formulaId: string]: IOtherFormulaDataItem;
|
|
111
111
|
}>;
|
|
112
112
|
}>;
|
|
113
113
|
}
|
|
@@ -121,6 +121,10 @@ export interface IFormulaDataItem {
|
|
|
121
121
|
y?: number;
|
|
122
122
|
si?: string;
|
|
123
123
|
}
|
|
124
|
+
export interface IOtherFormulaDataItem {
|
|
125
|
+
f: string;
|
|
126
|
+
ranges: IRange[];
|
|
127
|
+
}
|
|
124
128
|
export interface ISuperTable {
|
|
125
129
|
sheetId: string;
|
|
126
130
|
hasCustomTitle: BooleanNumber;
|
|
@@ -1,18 +1,4 @@
|
|
|
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
|
-
*/
|
|
1
|
+
import { BaseValueObject } from '../engine/value-object/base-value-object';
|
|
16
2
|
/**
|
|
17
3
|
* covert number to preview string by pattern
|
|
18
4
|
* @TODODushusir: Internationalization, reuse with numfmt
|
|
@@ -22,3 +8,4 @@
|
|
|
22
8
|
* @returns
|
|
23
9
|
*/
|
|
24
10
|
export declare const getFormatPreview: (pattern: string, value: number) => string;
|
|
11
|
+
export declare const getTextValueOfNumberFormat: (text: BaseValueObject) => string;
|
|
@@ -19,6 +19,9 @@ export declare function calculateGcd(a: number, b: number): number;
|
|
|
19
19
|
export declare function calculateLcm(a: number, b: number): number;
|
|
20
20
|
export declare function calculateMdeterm(matrix: number[][]): number;
|
|
21
21
|
export declare function calculateMinverse(matrix: number[][]): number[][] | null;
|
|
22
|
+
export declare function calculateMmult(matrix1: number[][], matrix2: number[][]): number[][];
|
|
23
|
+
export declare function matrixTranspose(matrix: number[][]): number[][];
|
|
24
|
+
export declare function inverseMatrixByUSV(matrix: number[][]): number[][] | null;
|
|
22
25
|
export declare const romanToArabicMap: Map<string, number>;
|
|
23
26
|
export declare const arabicToRomanMap: Map<number, string>;
|
|
24
27
|
/**
|
|
@@ -7,16 +7,32 @@ export declare function binomialPDF(x: number, trials: number, probability: numb
|
|
|
7
7
|
export declare function chisquareCDF(x: number, degFreedom: number): number;
|
|
8
8
|
export declare function chisquarePDF(x: number, degFreedom: number): number;
|
|
9
9
|
export declare function chisquareINV(probability: number, degFreedom: number): number;
|
|
10
|
-
export declare function studentTINV(probability: number, degFreedom: number): number;
|
|
11
|
-
export declare function exponentialCDF(x: number, lambda: number): number;
|
|
12
|
-
export declare function exponentialPDF(x: number, lambda: number): number;
|
|
13
10
|
export declare function centralFCDF(x: number, degFreedom1: number, degFreedom2: number): number;
|
|
14
11
|
export declare function centralFPDF(x: number, degFreedom1: number, degFreedom2: number): number;
|
|
15
12
|
export declare function centralFINV(probability: number, degFreedom1: number, degFreedom2: number): number;
|
|
13
|
+
export declare function exponentialCDF(x: number, lambda: number): number;
|
|
14
|
+
export declare function exponentialPDF(x: number, lambda: number): number;
|
|
16
15
|
export declare function forecastLinear(x: number, knownYs: number[], knownXs: number[]): number;
|
|
16
|
+
export declare function gamma(x: number): number;
|
|
17
|
+
export declare function gammaCDF(x: number, alpha: number, beta: number): number;
|
|
18
|
+
export declare function gammaPDF(x: number, alpha: number, beta: number): number;
|
|
19
|
+
export declare function gammaINV(probability: number, alpha: number, beta: number): number;
|
|
20
|
+
export declare function gammaln(x: number): number;
|
|
21
|
+
export declare function hypergeometricCDF(x: number, n: number, M: number, N: number): number;
|
|
22
|
+
export declare function hypergeometricPDF(x: number, n: number, M: number, N: number): number;
|
|
23
|
+
export declare function lognormalCDF(x: number, mean: number, standardDev: number): number;
|
|
24
|
+
export declare function lognormalPDF(x: number, mean: number, standardDev: number): number;
|
|
25
|
+
export declare function lognormalINV(probability: number, mean: number, standardDev: number): number;
|
|
26
|
+
export declare function negbinomialCDF(numberF: number, numberS: number, probabilityS: number): number;
|
|
27
|
+
export declare function negbinomialPDF(numberF: number, numberS: number, probabilityS: number): number;
|
|
17
28
|
export declare function normalCDF(x: number, mean: number, standardDev: number): number;
|
|
18
29
|
export declare function normalPDF(x: number, mean: number, standardDev: number): number;
|
|
19
30
|
export declare function normalINV(probability: number, mean: number, standardDev: number): number;
|
|
31
|
+
export declare function poissonCDF(x: number, mean: number): number;
|
|
32
|
+
export declare function poissonPDF(x: number, mean: number): number;
|
|
33
|
+
export declare function studentTCDF(x: number, degFreedom: number): number;
|
|
34
|
+
export declare function studentTPDF(x: number, degFreedom: number): number;
|
|
35
|
+
export declare function studentTINV(probability: number, degFreedom: number): number;
|
|
20
36
|
export declare function getTwoArrayNumberValues(array1: BaseValueObject, array2: BaseValueObject, count: number, array1ColumnCount: number, array2ColumnCount: number): {
|
|
21
37
|
isError: boolean;
|
|
22
38
|
errorObject: ErrorValueObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IMutation } from '@univerjs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { IOtherFormulaDataItem } from '../../basics/common';
|
|
3
3
|
export interface ISetOtherFormulaMutationParams {
|
|
4
4
|
unitId: string;
|
|
5
5
|
subUnitId: string;
|
|
6
|
-
formulaMap: Record<string,
|
|
6
|
+
formulaMap: Record<string, IOtherFormulaDataItem>;
|
|
7
7
|
}
|
|
8
8
|
export interface IRemoveOtherFormulaMutationParams {
|
|
9
9
|
unitId: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Disposable, ICommandService } from '@univerjs/core';
|
|
2
2
|
import { FormulaDataModel } from '../models/formula-data.model';
|
|
3
|
-
import {
|
|
3
|
+
import { ICalculateFormulaService } from '../services/calculate-formula.service';
|
|
4
4
|
export declare class CalculateController extends Disposable {
|
|
5
5
|
private readonly _commandService;
|
|
6
6
|
private readonly _calculateFormulaService;
|
|
7
7
|
private readonly _formulaDataModel;
|
|
8
|
-
constructor(_commandService: ICommandService, _calculateFormulaService:
|
|
8
|
+
constructor(_commandService: ICommandService, _calculateFormulaService: ICalculateFormulaService, _formulaDataModel: FormulaDataModel);
|
|
9
9
|
private _initialize;
|
|
10
10
|
private _commandExecutedListener;
|
|
11
11
|
private _calculate;
|
|
@@ -25,8 +25,6 @@ export declare class AstTreeBuilder extends Disposable {
|
|
|
25
25
|
private readonly _unionNodeFactory;
|
|
26
26
|
private readonly _valueNodeFactory;
|
|
27
27
|
private _astNodeFactoryList;
|
|
28
|
-
private _refOffsetX;
|
|
29
|
-
private _refOffsetY;
|
|
30
28
|
constructor(_runtimeService: IFormulaRuntimeService, _astRootNodeFactory: AstRootNodeFactory, _functionNodeFactory: FunctionNodeFactory, _lambdaNodeFactory: LambdaNodeFactory, _lambdaParameterNodeFactory: LambdaParameterNodeFactory, _operatorNodeFactory: OperatorNodeFactory, _prefixNodeFactory: PrefixNodeFactory, _referenceNodeFactory: ReferenceNodeFactory, _suffixNodeFactory: SuffixNodeFactory, _unionNodeFactory: UnionNodeFactory, _valueNodeFactory: ValueNodeFactory);
|
|
31
29
|
dispose(): void;
|
|
32
30
|
parse(lexerNode: LexerNode): Nullable<BaseAstNode>;
|
|
@@ -44,6 +44,7 @@ export declare class BaseAstNode {
|
|
|
44
44
|
serialize(): IAstNodeNodeJson;
|
|
45
45
|
hasDefinedName(definedName: string): boolean;
|
|
46
46
|
setDefinedNames(definedNames: Array<string>): void;
|
|
47
|
+
getDefinedNames(): Nullable<string[]>;
|
|
47
48
|
}
|
|
48
49
|
export declare class ErrorNode extends BaseAstNode {
|
|
49
50
|
private _errorValueObject;
|
|
@@ -2,6 +2,7 @@ import { BaseFunction } from '../../functions/base-function';
|
|
|
2
2
|
import { LexerNode } from '../analysis/lexer-node';
|
|
3
3
|
import { Injector } from '@univerjs/core';
|
|
4
4
|
import { AstNodePromiseType } from '../../basics/common';
|
|
5
|
+
import { FormulaDataModel } from '../../models/formula-data.model';
|
|
5
6
|
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
6
7
|
import { IDefinedNamesService } from '../../services/defined-names.service';
|
|
7
8
|
import { IFunctionService } from '../../services/function.service';
|
|
@@ -14,7 +15,8 @@ export declare class FunctionNode extends BaseAstNode {
|
|
|
14
15
|
private _currentConfigService;
|
|
15
16
|
private _runtimeService;
|
|
16
17
|
private _definedNamesService;
|
|
17
|
-
|
|
18
|
+
private _formulaDataModel;
|
|
19
|
+
constructor(token: string, _functionExecutor: BaseFunction, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _definedNamesService: IDefinedNamesService, _formulaDataModel: FormulaDataModel);
|
|
18
20
|
get nodeType(): NodeType;
|
|
19
21
|
executeAsync(): Promise<AstNodePromiseType>;
|
|
20
22
|
execute(): void;
|
|
@@ -49,7 +51,8 @@ export declare class FunctionNodeFactory extends BaseAstNodeFactory {
|
|
|
49
51
|
private readonly _runtimeService;
|
|
50
52
|
private readonly _definedNamesService;
|
|
51
53
|
private readonly _injector;
|
|
52
|
-
|
|
54
|
+
private readonly _formulaDataModel;
|
|
55
|
+
constructor(_functionService: IFunctionService, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _definedNamesService: IDefinedNamesService, _injector: Injector, _formulaDataModel: FormulaDataModel);
|
|
53
56
|
get zIndex(): number;
|
|
54
57
|
create(token: string): BaseAstNode;
|
|
55
58
|
checkAndCreateNodeType(param: LexerNode | string): BaseAstNode | undefined;
|
|
@@ -5,9 +5,8 @@ import { BaseAstNode } from './base-ast-node';
|
|
|
5
5
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
6
6
|
import { NodeType } from './node-type';
|
|
7
7
|
export declare class OperatorNode extends BaseAstNode {
|
|
8
|
-
private _operatorString;
|
|
9
8
|
private _functionExecutor;
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(operatorString: string, _functionExecutor: BaseFunction);
|
|
11
10
|
get nodeType(): NodeType;
|
|
12
11
|
execute(): void;
|
|
13
12
|
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
2
|
import { BaseFunction } from '../../functions/base-function';
|
|
3
3
|
import { IFunctionService } from '../../services/function.service';
|
|
4
|
+
import { IFormulaRuntimeService } from '../../services/runtime.service';
|
|
4
5
|
import { LexerNode } from '../analysis/lexer-node';
|
|
5
6
|
import { BaseAstNode, ErrorNode } from './base-ast-node';
|
|
6
7
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
7
8
|
import { NodeType } from './node-type';
|
|
8
9
|
export declare class PrefixNode extends BaseAstNode {
|
|
9
|
-
private
|
|
10
|
+
private _runtimeService;
|
|
10
11
|
private _operatorString;
|
|
11
12
|
private _functionExecutor?;
|
|
12
|
-
constructor(
|
|
13
|
+
constructor(_runtimeService: IFormulaRuntimeService, _operatorString: string, _functionExecutor?: Nullable<BaseFunction>);
|
|
13
14
|
get nodeType(): NodeType;
|
|
14
15
|
execute(): void;
|
|
15
16
|
private _handlerAT;
|
|
16
17
|
}
|
|
17
18
|
export declare class PrefixNodeFactory extends BaseAstNodeFactory {
|
|
18
19
|
private readonly _functionService;
|
|
19
|
-
private readonly
|
|
20
|
-
constructor(_functionService: IFunctionService,
|
|
20
|
+
private readonly _runtimeService;
|
|
21
|
+
constructor(_functionService: IFunctionService, _runtimeService: IFormulaRuntimeService);
|
|
21
22
|
get zIndex(): number;
|
|
22
23
|
checkAndCreateNodeType(param: LexerNode | string): ErrorNode | PrefixNode | undefined;
|
|
23
24
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseReferenceObject } from '../reference-object/base-reference-object';
|
|
1
|
+
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
3
2
|
import { IFunctionService } from '../../services/function.service';
|
|
4
3
|
import { IFormulaRuntimeService } from '../../services/runtime.service';
|
|
5
|
-
import { ISuperTableService } from '../../services/super-table.service';
|
|
6
4
|
import { LexerNode } from '../analysis/lexer-node';
|
|
5
|
+
import { ReferenceObjectType } from '../utils/value-object';
|
|
7
6
|
import { BaseAstNode } from './base-ast-node';
|
|
8
7
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
9
8
|
import { NodeType } from './node-type';
|
|
10
9
|
export declare class ReferenceNode extends BaseAstNode {
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
10
|
+
private _currentConfigService;
|
|
11
|
+
private _runtimeService;
|
|
12
|
+
private _referenceObjectType;
|
|
14
13
|
private _isPrepareMerge;
|
|
15
14
|
private _refOffsetX;
|
|
16
15
|
private _refOffsetY;
|
|
17
|
-
constructor(
|
|
16
|
+
constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, operatorString: string, _referenceObjectType: ReferenceObjectType, _isPrepareMerge?: boolean);
|
|
18
17
|
get nodeType(): NodeType;
|
|
19
18
|
execute(): void;
|
|
20
19
|
setRefOffset(x?: number, y?: number): void;
|
|
@@ -24,11 +23,10 @@ export declare class ReferenceNode extends BaseAstNode {
|
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
export declare class ReferenceNodeFactory extends BaseAstNodeFactory {
|
|
27
|
-
private readonly
|
|
26
|
+
private readonly _currentConfigService;
|
|
28
27
|
private readonly _formulaRuntimeService;
|
|
29
28
|
private readonly _functionService;
|
|
30
|
-
|
|
31
|
-
constructor(_superTableService: ISuperTableService, _formulaRuntimeService: IFormulaRuntimeService, _functionService: IFunctionService, _injector: Injector);
|
|
29
|
+
constructor(_currentConfigService: IFormulaCurrentConfigService, _formulaRuntimeService: IFormulaRuntimeService, _functionService: IFunctionService);
|
|
32
30
|
get zIndex(): number;
|
|
33
31
|
checkAndCreateNodeType(param: LexerNode | string): ReferenceNode | undefined;
|
|
34
32
|
private _checkParentIsUnionOperator;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { IAccessor, Injector } from '@univerjs/core';
|
|
2
1
|
import { BaseFunction } from '../../functions/base-function';
|
|
2
|
+
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
3
3
|
import { IFunctionService } from '../../services/function.service';
|
|
4
|
+
import { Lexer } from '../analysis/lexer';
|
|
4
5
|
import { LexerNode } from '../analysis/lexer-node';
|
|
5
6
|
import { BaseAstNode, ErrorNode } from './base-ast-node';
|
|
6
7
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
7
8
|
import { NodeType } from './node-type';
|
|
8
9
|
export declare class SuffixNode extends BaseAstNode {
|
|
9
|
-
private
|
|
10
|
+
private _currentConfigService;
|
|
11
|
+
private _lexer;
|
|
10
12
|
private _operatorString;
|
|
11
13
|
private _functionExecutor?;
|
|
12
|
-
constructor(
|
|
14
|
+
constructor(_currentConfigService: IFormulaCurrentConfigService, _lexer: Lexer, _operatorString: string, _functionExecutor?: BaseFunction | undefined);
|
|
13
15
|
get nodeType(): NodeType;
|
|
14
16
|
execute(): void;
|
|
15
17
|
private _handlerPound;
|
|
16
18
|
}
|
|
17
19
|
export declare class SuffixNodeFactory extends BaseAstNodeFactory {
|
|
18
20
|
private readonly _functionService;
|
|
19
|
-
private readonly
|
|
20
|
-
|
|
21
|
+
private readonly _lexer;
|
|
22
|
+
private readonly _currentConfigService;
|
|
23
|
+
constructor(_functionService: IFunctionService, _lexer: Lexer, _currentConfigService: IFormulaCurrentConfigService);
|
|
21
24
|
get zIndex(): number;
|
|
22
25
|
checkAndCreateNodeType(param: LexerNode | string): ErrorNode | SuffixNode | undefined;
|
|
23
26
|
}
|
|
@@ -4,8 +4,7 @@ import { BaseAstNode } from './base-ast-node';
|
|
|
4
4
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
5
5
|
import { NodeType } from './node-type';
|
|
6
6
|
export declare class UnionNode extends BaseAstNode {
|
|
7
|
-
|
|
8
|
-
constructor(_operatorString: string);
|
|
7
|
+
constructor(operatorString: string);
|
|
9
8
|
get nodeType(): NodeType;
|
|
10
9
|
execute(): void;
|
|
11
10
|
private _unionFunction;
|
|
@@ -3,8 +3,7 @@ import { BaseAstNode } from './base-ast-node';
|
|
|
3
3
|
import { BaseAstNodeFactory } from './base-ast-node-factory';
|
|
4
4
|
import { NodeType } from './node-type';
|
|
5
5
|
export declare class ValueNode extends BaseAstNode {
|
|
6
|
-
|
|
7
|
-
constructor(_operatorString: string);
|
|
6
|
+
constructor(operatorString: string);
|
|
8
7
|
get nodeType(): NodeType;
|
|
9
8
|
execute(): void;
|
|
10
9
|
}
|
|
@@ -1,69 +1,116 @@
|
|
|
1
|
-
import { IRange, IRTreeItem, IUnitRange, Nullable } from '@univerjs/core';
|
|
2
1
|
import { IDirtyUnitSheetNameMap, IFeatureDirtyRangeType, IRuntimeUnitDataType, IUnitExcludedCell } from '../../basics/common';
|
|
3
2
|
import { IFormulaDirtyData } from '../../services/current-data.service';
|
|
4
3
|
import { IAllRuntimeData } from '../../services/runtime.service';
|
|
5
|
-
import {
|
|
4
|
+
import { AstRootNode } from '../ast-node';
|
|
5
|
+
import { IRange, IUnitRange, Nullable } from '@univerjs/core';
|
|
6
6
|
export declare enum FDtreeStateType {
|
|
7
7
|
DEFAULT = 0,
|
|
8
8
|
ADDED = 1,
|
|
9
9
|
SKIP = 2
|
|
10
10
|
}
|
|
11
|
+
export declare enum FormulaDependencyTreeType {
|
|
12
|
+
NORMAL_FORMULA = 0,
|
|
13
|
+
OTHER_FORMULA = 1,
|
|
14
|
+
FEATURE_FORMULA = 2
|
|
15
|
+
}
|
|
16
|
+
declare class FormulaDependencyTreeCalculator {
|
|
17
|
+
private _state;
|
|
18
|
+
resetState(): void;
|
|
19
|
+
setAdded(): void;
|
|
20
|
+
isAdded(): boolean;
|
|
21
|
+
setSkip(): void;
|
|
22
|
+
isSkip(): boolean;
|
|
23
|
+
treeId: number;
|
|
24
|
+
children: Set<number>;
|
|
25
|
+
parents: Set<number>;
|
|
26
|
+
pushChildren(tree: FormulaDependencyTreeCalculator): void;
|
|
27
|
+
hasChildren(treeId: number): boolean;
|
|
28
|
+
private _pushParent;
|
|
29
|
+
}
|
|
30
|
+
type GetDirtyDataType = Nullable<(dirtyData: IFormulaDirtyData, runtimeData: IAllRuntimeData) => {
|
|
31
|
+
runtimeCellData: IRuntimeUnitDataType;
|
|
32
|
+
dirtyRanges: IFeatureDirtyRangeType;
|
|
33
|
+
}>;
|
|
34
|
+
export type IFormulaDependencyTree = FormulaDependencyTree | FormulaDependencyTreeVirtual;
|
|
35
|
+
export declare class FormulaDependencyTreeVirtual extends FormulaDependencyTreeCalculator {
|
|
36
|
+
refTree: Nullable<FormulaDependencyTree>;
|
|
37
|
+
refOffsetX: number;
|
|
38
|
+
refOffsetY: number;
|
|
39
|
+
isCache: boolean;
|
|
40
|
+
isDirty: boolean;
|
|
41
|
+
get isVirtual(): boolean;
|
|
42
|
+
get row(): number;
|
|
43
|
+
get column(): number;
|
|
44
|
+
get rowCount(): number;
|
|
45
|
+
get columnCount(): number;
|
|
46
|
+
get unitId(): string;
|
|
47
|
+
get subUnitId(): string;
|
|
48
|
+
get formula(): string;
|
|
49
|
+
get nodeData(): {
|
|
50
|
+
node: Nullable<AstRootNode>;
|
|
51
|
+
refOffsetX: number;
|
|
52
|
+
refOffsetY: number;
|
|
53
|
+
};
|
|
54
|
+
get node(): Nullable<AstRootNode>;
|
|
55
|
+
dispose(): void;
|
|
56
|
+
get rangeList(): {
|
|
57
|
+
unitId: string;
|
|
58
|
+
sheetId: string;
|
|
59
|
+
range: IRange;
|
|
60
|
+
}[];
|
|
61
|
+
toRTreeItem(): IUnitRange[];
|
|
62
|
+
inRangeData(range: IRange): boolean;
|
|
63
|
+
dependencySheetName(dirtyUnitSheetNameMap?: IDirtyUnitSheetNameMap): boolean;
|
|
64
|
+
isExcludeRange(unitExcludedCell: Nullable<IUnitExcludedCell>): boolean;
|
|
65
|
+
getDirtyData: GetDirtyDataType;
|
|
66
|
+
featureId: Nullable<string>;
|
|
67
|
+
get formulaId(): Nullable<string>;
|
|
68
|
+
}
|
|
11
69
|
/**
|
|
12
70
|
* A dependency tree, capable of calculating mutual dependencies,
|
|
13
71
|
* is used to determine the order of formula calculations.
|
|
14
72
|
*/
|
|
15
|
-
export declare class FormulaDependencyTree {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
73
|
+
export declare class FormulaDependencyTree extends FormulaDependencyTreeCalculator {
|
|
74
|
+
isCache: boolean;
|
|
75
|
+
featureId: Nullable<string>;
|
|
76
|
+
featureDirtyRanges: IUnitRange[];
|
|
77
|
+
refOffsetX: number;
|
|
78
|
+
refOffsetY: number;
|
|
79
|
+
type: FormulaDependencyTreeType;
|
|
80
|
+
formulaId: Nullable<string>;
|
|
81
|
+
subUnitId: string;
|
|
82
|
+
unitId: string;
|
|
83
|
+
rangeList: IUnitRange[];
|
|
20
84
|
formula: string;
|
|
21
85
|
row: number;
|
|
22
86
|
column: number;
|
|
23
87
|
rowCount: number;
|
|
24
88
|
columnCount: number;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
rangeList: IUnitRange[];
|
|
28
|
-
formulaId: Nullable<string>;
|
|
29
|
-
featureId: Nullable<string>;
|
|
30
|
-
isCache: boolean;
|
|
89
|
+
isDirty: boolean;
|
|
90
|
+
node: Nullable<AstRootNode>;
|
|
31
91
|
constructor(treeId: number);
|
|
92
|
+
get isVirtual(): boolean;
|
|
93
|
+
get nodeData(): {
|
|
94
|
+
node: Nullable<AstRootNode>;
|
|
95
|
+
refOffsetX: number;
|
|
96
|
+
refOffsetY: number;
|
|
97
|
+
};
|
|
32
98
|
toJson(): {
|
|
33
99
|
formula: string;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
subUnitId: string;
|
|
37
|
-
unitId: string;
|
|
38
|
-
formulaId: Nullable<string>;
|
|
39
|
-
featureId: Nullable<string>;
|
|
100
|
+
refOffsetX: number;
|
|
101
|
+
refOffsetY: number;
|
|
40
102
|
};
|
|
41
|
-
getDirtyData:
|
|
42
|
-
runtimeCellData: IRuntimeUnitDataType;
|
|
43
|
-
dirtyRanges: IFeatureDirtyRangeType;
|
|
44
|
-
}>;
|
|
45
|
-
private _state;
|
|
103
|
+
getDirtyData: GetDirtyDataType;
|
|
46
104
|
dispose(): void;
|
|
47
|
-
resetState(): void;
|
|
48
|
-
setAdded(): void;
|
|
49
|
-
isAdded(): boolean;
|
|
50
|
-
setSkip(): void;
|
|
51
|
-
isSkip(): boolean;
|
|
52
105
|
inRangeData(range: IRange): boolean;
|
|
53
106
|
dependencySheetName(dirtyUnitSheetNameMap?: IDirtyUnitSheetNameMap): boolean;
|
|
54
107
|
isExcludeRange(unitExcludedCell: Nullable<IUnitExcludedCell>): boolean;
|
|
55
|
-
pushChildren(tree: FormulaDependencyTree): void;
|
|
56
108
|
/**
|
|
57
109
|
* Add the range corresponding to the current ast node.
|
|
58
110
|
* @param range
|
|
59
111
|
*/
|
|
60
112
|
pushRangeList(ranges: IUnitRange[]): void;
|
|
61
|
-
|
|
62
|
-
toRTreeItem():
|
|
63
|
-
/**
|
|
64
|
-
* Determine whether it is dependent on other trees.
|
|
65
|
-
* @param dependenceTree
|
|
66
|
-
*/
|
|
67
|
-
dependency(dependenceTree: FormulaDependencyTree): boolean;
|
|
68
|
-
private _pushParent;
|
|
113
|
+
shouldBePushRangeList(): boolean;
|
|
114
|
+
toRTreeItem(): IUnitRange[];
|
|
69
115
|
}
|
|
116
|
+
export {};
|
|
@@ -1,44 +1,65 @@
|
|
|
1
|
-
import { Disposable } from '@univerjs/core';
|
|
1
|
+
import { IRange, IUnitRange, Nullable, Disposable } from '@univerjs/core';
|
|
2
|
+
import { IFeatureDirtyRangeType, IFormulaData, IFormulaDataItem, IOtherFormulaData, IUnitData } from '../../basics/common';
|
|
3
|
+
import { IFeatureCalculationManagerParam, IFeatureCalculationManagerService } from '../../services/feature-calculation-manager.service';
|
|
4
|
+
import { BaseAstNode } from '../ast-node/base-ast-node';
|
|
5
|
+
import { IExecuteAstNodeData } from '../utils/ast-node-tool';
|
|
6
|
+
import { IFormulaDependencyTree, FormulaDependencyTree, FormulaDependencyTreeVirtual } from './dependency-tree';
|
|
2
7
|
import { IFormulaCurrentConfigService } from '../../services/current-data.service';
|
|
3
8
|
import { IDependencyManagerService } from '../../services/dependency-manager.service';
|
|
4
|
-
import { IFeatureCalculationManagerService } from '../../services/feature-calculation-manager.service';
|
|
5
9
|
import { IOtherFormulaManagerService } from '../../services/other-formula-manager.service';
|
|
6
10
|
import { IFormulaRuntimeService } from '../../services/runtime.service';
|
|
7
11
|
import { Lexer } from '../analysis/lexer';
|
|
8
12
|
import { AstTreeBuilder } from '../analysis/parser';
|
|
9
13
|
import { Interpreter } from '../interpreter/interpreter';
|
|
10
|
-
|
|
14
|
+
export declare function generateRandomDependencyTreeId(dependencyManagerService: IDependencyManagerService): number;
|
|
15
|
+
export interface IFormulaDependencyGenerator {
|
|
16
|
+
generate(): Promise<IFormulaDependencyTree[]>;
|
|
17
|
+
}
|
|
18
|
+
export declare const IFormulaDependencyGenerator: import('@wendellhu/redi').IdentifierDecorator<IFormulaDependencyGenerator>;
|
|
11
19
|
export declare class FormulaDependencyGenerator extends Disposable {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
protected readonly _currentConfigService: IFormulaCurrentConfigService;
|
|
21
|
+
protected readonly _runtimeService: IFormulaRuntimeService;
|
|
22
|
+
protected readonly _otherFormulaManagerService: IOtherFormulaManagerService;
|
|
15
23
|
private readonly _featureCalculationManagerService;
|
|
16
24
|
private readonly _interpreter;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private _formulaASTCache;
|
|
25
|
+
protected readonly _astTreeBuilder: AstTreeBuilder;
|
|
26
|
+
protected readonly _lexer: Lexer;
|
|
27
|
+
protected readonly _dependencyManagerService: IDependencyManagerService;
|
|
21
28
|
private _updateRangeFlattenCache;
|
|
22
29
|
constructor(_currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _otherFormulaManagerService: IOtherFormulaManagerService, _featureCalculationManagerService: IFeatureCalculationManagerService, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _lexer: Lexer, _dependencyManagerService: IDependencyManagerService);
|
|
23
30
|
dispose(): void;
|
|
24
|
-
generate(): Promise<FormulaDependencyTree[]>;
|
|
31
|
+
generate(): Promise<(FormulaDependencyTree | FormulaDependencyTreeVirtual)[]>;
|
|
32
|
+
private _dependencyFeatureCalculation;
|
|
33
|
+
private _clearFeatureCalculationNode;
|
|
34
|
+
/**
|
|
35
|
+
* TODO @DR-Univer: The next step will be to try changing the incoming dirtyRanges to an array, thus avoiding conversion.
|
|
36
|
+
* @param dirtyRanges
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
protected _convertDirtyRangesToUnitRange(dirtyRanges: IFeatureDirtyRangeType): IUnitRange[];
|
|
40
|
+
private _intersectFeatureCalculation;
|
|
41
|
+
private _getExistTreeList;
|
|
25
42
|
private _isCyclicUtil;
|
|
26
|
-
|
|
43
|
+
protected _checkIsCycleDependency(treeList: IFormulaDependencyTree[]): boolean;
|
|
27
44
|
/**
|
|
28
45
|
* Generate nodes for the dependency tree, where each node contains all the reference data ranges included in each formula.
|
|
29
46
|
* @param formulaData
|
|
30
47
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
protected _generateTreeList(formulaData: IFormulaData, otherFormulaData: IOtherFormulaData, unitData: IUnitData): Promise<IFormulaDependencyTree[]>;
|
|
49
|
+
protected _registerFeatureFormulas(treeList: FormulaDependencyTree[]): void;
|
|
50
|
+
protected _getFeatureFormulaTree(featureId: string, treeId: Nullable<number>, params: IFeatureCalculationManagerParam): FormulaDependencyTree;
|
|
51
|
+
protected _registerOtherFormulas(otherFormulaData: IOtherFormulaData, otherFormulaDataKeys: string[], treeList: IFormulaDependencyTree[]): void;
|
|
52
|
+
protected _getFirstCellOfRange(ranges: IRange[]): {
|
|
53
|
+
firstRow: number;
|
|
54
|
+
firstColumn: number;
|
|
55
|
+
};
|
|
56
|
+
protected _registerFormulas(formulaDataKeys: string[], formulaData: IFormulaData, unitData: IUnitData, treeList: IFormulaDependencyTree[]): void;
|
|
57
|
+
protected _createFDtree(unitId: string, sheetId: string, row: number, column: number, unitData: IUnitData, formulaDataItem: IFormulaDataItem): FormulaDependencyTree;
|
|
58
|
+
protected _createVirtualFDtree(tree: FormulaDependencyTree, formulaDataItem: IFormulaDataItem): FormulaDependencyTreeVirtual;
|
|
37
59
|
/**
|
|
38
60
|
* Break down the dirty areas into ranges for subsequent matching.
|
|
39
61
|
*/
|
|
40
|
-
|
|
41
|
-
private _generateAstNode;
|
|
62
|
+
protected _updateRangeFlatten(): void;
|
|
42
63
|
private _addFlattenCache;
|
|
43
64
|
private _isPreCalculateNode;
|
|
44
65
|
private _nodeTraversalRef;
|
|
@@ -49,26 +70,14 @@ export declare class FormulaDependencyGenerator extends Disposable {
|
|
|
49
70
|
* including references and location functions (such as OFFSET, INDIRECT, INDEX, etc.).
|
|
50
71
|
* @param node
|
|
51
72
|
*/
|
|
52
|
-
|
|
53
|
-
private _isDirtyDefinedForNode;
|
|
73
|
+
protected _getRangeListByNode(nodeData: IExecuteAstNodeData): Promise<IUnitRange[]>;
|
|
54
74
|
/**
|
|
55
75
|
* Build a formula dependency tree based on the dependency relationships.
|
|
56
76
|
* @param treeList
|
|
57
77
|
*/
|
|
58
|
-
|
|
59
|
-
private _dependencyFeatureCalculation;
|
|
60
|
-
private _clearFeatureCalculationNode;
|
|
61
|
-
private _getExistTreeList;
|
|
62
|
-
/**
|
|
63
|
-
* TODO @DR-Univer: The next step will be to try changing the incoming dirtyRanges to an array, thus avoiding conversion.
|
|
64
|
-
* @param dirtyRanges
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
|
-
private _convertDirtyRangesToUnitRange;
|
|
68
|
-
private _intersectFeatureCalculation;
|
|
78
|
+
protected _getUpdateTreeListAndMakeDependency(treeList: IFormulaDependencyTree[]): IFormulaDependencyTree[];
|
|
69
79
|
private _includeTreeFeature;
|
|
70
80
|
private _includeOtherFormula;
|
|
71
|
-
private _includeDefinedName;
|
|
72
81
|
private _detectForcedRecalculationNode;
|
|
73
82
|
private _detectForcedRecalculationNodeRecursion;
|
|
74
83
|
/**
|
|
@@ -76,10 +85,10 @@ export declare class FormulaDependencyGenerator extends Disposable {
|
|
|
76
85
|
* If they are within the dirty area, return true, indicating that this node needs to be calculated.
|
|
77
86
|
* @param tree
|
|
78
87
|
*/
|
|
79
|
-
|
|
88
|
+
protected _includeTree(tree: IFormulaDependencyTree, node: BaseAstNode): boolean;
|
|
80
89
|
/**
|
|
81
90
|
* Generate the final formula calculation order array by traversing the dependency tree established via depth-first search.
|
|
82
91
|
* @param treeList
|
|
83
92
|
*/
|
|
84
|
-
|
|
93
|
+
protected _calculateRunList(treeList: IFormulaDependencyTree[]): (FormulaDependencyTree | FormulaDependencyTreeVirtual)[];
|
|
85
94
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { Nullable, Disposable } from '@univerjs/core';
|
|
1
2
|
import { BaseAstNode } from '../ast-node/base-ast-node';
|
|
2
3
|
import { FunctionVariantType } from '../reference-object/base-reference-object';
|
|
3
4
|
import { IExecuteAstNodeData } from '../utils/ast-node-tool';
|
|
4
5
|
import { PreCalculateNodeType } from '../utils/node-type';
|
|
5
|
-
import { Disposable } from '@univerjs/core';
|
|
6
6
|
import { IFormulaRuntimeService } from '../../services/runtime.service';
|
|
7
7
|
export declare class Interpreter extends Disposable {
|
|
8
8
|
private readonly _runtimeService;
|
|
9
9
|
constructor(_runtimeService: IFormulaRuntimeService);
|
|
10
10
|
executeAsync(nodeData: IExecuteAstNodeData): Promise<FunctionVariantType>;
|
|
11
11
|
execute(nodeData: IExecuteAstNodeData): FunctionVariantType;
|
|
12
|
-
executePreCalculateNode(node: PreCalculateNodeType):
|
|
13
|
-
checkAsyncNode(node: BaseAstNode): boolean;
|
|
12
|
+
executePreCalculateNode(node: PreCalculateNodeType): Nullable<FunctionVariantType>;
|
|
13
|
+
checkAsyncNode(node: Nullable<BaseAstNode>): boolean;
|
|
14
14
|
private _checkAsyncNode;
|
|
15
15
|
private _executeAsync;
|
|
16
16
|
private _execute;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayValueObject } from '../value-object/array-value-object';
|
|
2
1
|
import { BaseValueObject } from '../value-object/base-value-object';
|
|
2
|
+
import { ArrayValueObject } from '../value-object/array-value-object';
|
|
3
3
|
export declare function expandArrayValueObject(rowCount: number, columnCount: number, valueObject: BaseValueObject, defaultValue?: BaseValueObject): ArrayValueObject;
|
|
4
4
|
export declare function createNewArray(result: BaseValueObject[][], rowCount: number, columnCount: number, unitId?: string, sheetId?: string): ArrayValueObject;
|