@univerjs/engine-formula 1.3.1 → 1.5.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/README.md +23 -5
- package/lib/cjs/{en-US-BYMYuEpp.js → en-US-9VDUEyCa.js} +15 -30
- package/lib/cjs/facade.js +4 -8
- package/lib/cjs/index.js +435 -57921
- package/lib/cjs/locale/ar-SA.js +16 -32
- package/lib/cjs/locale/ca-ES.js +16 -32
- package/lib/cjs/locale/de-DE.js +16 -32
- package/lib/cjs/locale/en-US.js +2 -3
- package/lib/cjs/locale/es-ES.js +16 -32
- package/lib/cjs/locale/fa-IR.js +2 -3
- package/lib/cjs/locale/fr-FR.js +16 -32
- package/lib/cjs/locale/id-ID.js +16 -32
- package/lib/cjs/locale/it-IT.js +16 -32
- package/lib/cjs/locale/ja-JP.js +16 -32
- package/lib/cjs/locale/ko-KR.js +16 -32
- package/lib/cjs/locale/pl-PL.js +16 -32
- package/lib/cjs/locale/pt-BR.js +16 -32
- package/lib/cjs/locale/ru-RU.js +16 -32
- package/lib/cjs/locale/sk-SK.js +16 -32
- package/lib/cjs/locale/vi-VN.js +16 -32
- package/lib/cjs/locale/zh-CN.js +16 -32
- package/lib/cjs/locale/zh-HK.js +2 -3
- package/lib/cjs/locale/zh-TW.js +2 -3
- package/lib/cjs/plugin-BLJLwyCu.js +59607 -0
- package/lib/cjs/worker.js +9 -0
- package/lib/cjs/{zh-TW-B5pYt-NJ.js → zh-TW-DGiZe-tu.js} +15 -30
- package/lib/{en-US-l1Vb3W1H.js → en-US-CgN_37u8.js} +15 -30
- package/lib/es/{en-US-l1Vb3W1H.js → en-US-CgN_37u8.js} +15 -30
- package/lib/es/facade.js +4 -8
- package/lib/es/index.js +205 -57671
- package/lib/es/locale/ar-SA.js +16 -32
- package/lib/es/locale/ca-ES.js +16 -32
- package/lib/es/locale/de-DE.js +16 -32
- package/lib/es/locale/en-US.js +2 -3
- package/lib/es/locale/es-ES.js +16 -32
- package/lib/es/locale/fa-IR.js +2 -3
- package/lib/es/locale/fr-FR.js +16 -32
- package/lib/es/locale/id-ID.js +16 -32
- package/lib/es/locale/it-IT.js +16 -32
- package/lib/es/locale/ja-JP.js +16 -32
- package/lib/es/locale/ko-KR.js +16 -32
- package/lib/es/locale/pl-PL.js +16 -32
- package/lib/es/locale/pt-BR.js +16 -32
- package/lib/es/locale/ru-RU.js +16 -32
- package/lib/es/locale/sk-SK.js +16 -32
- package/lib/es/locale/vi-VN.js +16 -32
- package/lib/es/locale/zh-CN.js +16 -32
- package/lib/es/locale/zh-HK.js +2 -3
- package/lib/es/locale/zh-TW.js +2 -3
- package/lib/es/plugin-USnMdaGa.js +58260 -0
- package/lib/es/worker.js +3 -0
- package/lib/es/{zh-TW-BA0p9R2Z.js → zh-TW-CsrIhkUN.js} +15 -30
- package/lib/facade.js +4 -8
- package/lib/index.js +205 -57671
- package/lib/locale/ar-SA.js +16 -32
- package/lib/locale/ca-ES.js +16 -32
- package/lib/locale/de-DE.js +16 -32
- package/lib/locale/en-US.js +2 -3
- package/lib/locale/es-ES.js +16 -32
- package/lib/locale/fa-IR.js +2 -3
- package/lib/locale/fr-FR.js +16 -32
- package/lib/locale/id-ID.js +16 -32
- package/lib/locale/it-IT.js +16 -32
- package/lib/locale/ja-JP.js +16 -32
- package/lib/locale/ko-KR.js +16 -32
- package/lib/locale/pl-PL.js +16 -32
- package/lib/locale/pt-BR.js +16 -32
- package/lib/locale/ru-RU.js +16 -32
- package/lib/locale/sk-SK.js +16 -32
- package/lib/locale/vi-VN.js +16 -32
- package/lib/locale/zh-CN.js +16 -32
- package/lib/locale/zh-HK.js +2 -3
- package/lib/locale/zh-TW.js +2 -3
- package/lib/plugin-USnMdaGa.js +58260 -0
- package/lib/types/basics/cache-lru.d.ts +0 -1
- package/lib/types/basics/common.d.ts +5 -1
- package/lib/types/basics/complex.d.ts +10 -4
- package/lib/types/basics/date.d.ts +6 -1
- package/lib/types/basics/function.d.ts +2 -1
- package/lib/types/basics/inverted-index-cache.d.ts +2 -1
- package/lib/types/basics/match-token.d.ts +1 -1
- package/lib/types/commands/mutations/set-super-table.mutation.d.ts +3 -2
- package/lib/types/controllers/calculate.controller.d.ts +0 -2
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +2 -4
- package/lib/types/engine/analysis/lexer.d.ts +6 -2
- package/lib/types/engine/analysis/parser.d.ts +3 -1
- package/lib/types/engine/ast-node/function-node.d.ts +2 -1
- package/lib/types/engine/ast-node/reference-node.d.ts +1 -4
- package/lib/types/engine/ast-node/union-node.d.ts +1 -3
- package/lib/types/engine/dependency/formula-dependency.d.ts +24 -3
- package/lib/types/engine/dependency/reference-context.d.ts +33 -0
- package/lib/types/engine/reference-object/base-reference-object.d.ts +5 -3
- package/lib/types/engine/reference-object/column-reference-object.d.ts +1 -1
- package/lib/types/engine/reference-object/row-reference-object.d.ts +1 -1
- package/lib/types/engine/utils/check-variant-error.d.ts +4 -4
- package/lib/types/engine/utils/generate-ast-node.d.ts +0 -2
- package/lib/types/engine/utils/numfmt-kit.d.ts +1 -1
- package/lib/types/engine/utils/three-dimensional-reference.d.ts +21 -0
- package/lib/types/engine/value-object/array-value-object.d.ts +4 -0
- package/lib/types/engine/value-object/cube-value-object.d.ts +5 -2
- package/lib/types/engine/value-object/lambda-value-object.d.ts +2 -2
- package/lib/types/functions/array/function-map.d.ts +1 -1
- package/lib/types/functions/base-function.d.ts +5 -5
- package/lib/types/functions/compatibility/function-map.d.ts +2 -2
- package/lib/types/functions/database/function-map.d.ts +1 -1
- package/lib/types/functions/date/function-map.d.ts +1 -1
- package/lib/types/functions/engineering/function-map.d.ts +1 -1
- package/lib/types/functions/financial/function-map.d.ts +1 -1
- package/lib/types/functions/information/function-map.d.ts +1 -1
- package/lib/types/functions/information/isblank/index.d.ts +1 -1
- package/lib/types/functions/information/iserr/index.d.ts +1 -1
- package/lib/types/functions/information/iserror/index.d.ts +1 -1
- package/lib/types/functions/information/islogical/index.d.ts +1 -1
- package/lib/types/functions/information/isna/index.d.ts +1 -1
- package/lib/types/functions/information/isnontext/index.d.ts +1 -1
- package/lib/types/functions/information/isnumber/index.d.ts +1 -1
- package/lib/types/functions/information/istext/index.d.ts +1 -1
- package/lib/types/functions/logical/function-map.d.ts +1 -1
- package/lib/types/functions/logical/groupby/index.d.ts +1 -1
- package/lib/types/functions/logical/if/index.d.ts +1 -1
- package/lib/types/functions/logical/iferror/index.d.ts +1 -1
- package/lib/types/functions/logical/ifna/index.d.ts +1 -1
- package/lib/types/functions/logical/makearray/index.d.ts +1 -1
- package/lib/types/functions/lookup/choosecols/index.d.ts +1 -1
- package/lib/types/functions/lookup/chooserows/index.d.ts +1 -1
- package/lib/types/functions/lookup/column/index.d.ts +1 -1
- package/lib/types/functions/lookup/formulatext/index.d.ts +1 -1
- package/lib/types/functions/lookup/function-map.d.ts +1 -1
- package/lib/types/functions/lookup/getpivotdata/index.d.ts +7 -2
- package/lib/types/functions/lookup/hstack/index.d.ts +1 -1
- package/lib/types/functions/lookup/index/index.d.ts +1 -0
- package/lib/types/functions/lookup/indirect/index.d.ts +1 -1
- package/lib/types/functions/lookup/row/index.d.ts +1 -1
- package/lib/types/functions/lookup/sortby/index.d.ts +1 -1
- package/lib/types/functions/lookup/transpose/index.d.ts +1 -1
- package/lib/types/functions/lookup/vlookup/index.d.ts +1 -1
- package/lib/types/functions/lookup/vstack/index.d.ts +1 -1
- package/lib/types/functions/math/aggregate/index.d.ts +1 -1
- package/lib/types/functions/math/function-map.d.ts +1 -1
- package/lib/types/functions/math/randarray/index.d.ts +1 -1
- package/lib/types/functions/math/subtotal/index.d.ts +1 -1
- package/lib/types/functions/math/sumifs/index.d.ts +1 -1
- package/lib/types/functions/meta/cube/index.d.ts +4 -1
- package/lib/types/functions/meta/function-map.d.ts +1 -1
- package/lib/types/functions/statistical/function-map.d.ts +1 -1
- package/lib/types/functions/statistical/stdev-p/index.d.ts +1 -1
- package/lib/types/functions/statistical/stdev-s/index.d.ts +1 -1
- package/lib/types/functions/statistical/stdeva/index.d.ts +1 -1
- package/lib/types/functions/statistical/stdevpa/index.d.ts +1 -1
- package/lib/types/functions/statistical/var-p/index.d.ts +1 -1
- package/lib/types/functions/statistical/var-s/index.d.ts +1 -1
- package/lib/types/functions/statistical/vara/index.d.ts +1 -1
- package/lib/types/functions/statistical/varpa/index.d.ts +1 -1
- package/lib/types/functions/text/function-map.d.ts +1 -1
- package/lib/types/functions/text/textafter/index.d.ts +1 -1
- package/lib/types/functions/text/textbefore/index.d.ts +1 -1
- package/lib/types/functions/text/textsplit/index.d.ts +1 -1
- package/lib/types/functions/web/function-map.d.ts +1 -1
- package/lib/types/index.d.ts +4 -3
- package/lib/types/locale/en-US.d.ts +3005 -3005
- package/lib/types/models/formula-data-snapshot.d.ts +24 -0
- package/lib/types/models/formula-data.model.d.ts +9 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/active-dirty-manager.service.d.ts +3 -2
- package/lib/types/services/calculate-formula.service.d.ts +14 -4
- package/lib/types/services/current-data.service.d.ts +20 -6
- package/lib/types/services/defined-names.service.d.ts +1 -1
- package/lib/types/services/dependency-manager.service.d.ts +12 -2
- package/lib/types/services/external-reference-data-loader.service.d.ts +1 -1
- package/lib/types/services/feature-calculation-manager.service.d.ts +1 -1
- package/lib/types/services/formula/description.service.d.ts +1 -1
- package/lib/types/services/formula/formula-calculation-session.service.d.ts +2 -1
- package/lib/types/services/formula/register-function.service.d.ts +1 -1
- package/lib/types/services/formula-cache.service.d.ts +47 -0
- package/lib/types/services/formula-calculation-trigger.service.d.ts +1 -1
- package/lib/types/services/formula-changeset-calculation.service.d.ts +1 -1
- package/lib/types/services/formula-result.service.d.ts +29 -0
- package/lib/types/services/function.service.d.ts +4 -1
- package/lib/types/services/hyperlink-engine-formula.service.d.ts +1 -1
- package/lib/types/services/other-formula-manager.service.d.ts +1 -1
- package/lib/types/services/runtime.service.d.ts +16 -4
- package/lib/types/services/sheet-row-filtered.service.d.ts +1 -1
- package/lib/types/services/super-table.service.d.ts +4 -4
- package/lib/types/services/unit-reference-resolver.service.d.ts +1 -1
- package/lib/types/worker.d.ts +16 -0
- package/lib/umd/index.js +4 -4
- package/lib/worker.js +3 -0
- package/lib/{zh-TW-BA0p9R2Z.js → zh-TW-CsrIhkUN.js} +15 -30
- package/package.json +13 -8
|
@@ -0,0 +1,24 @@
|
|
|
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 { IFormulaData } from '../basics/common';
|
|
17
|
+
/**
|
|
18
|
+
* Internal calculation-engine input; not an application or Facade API.
|
|
19
|
+
* Ephemeral calculation input, not a serialized Workbook snapshot.
|
|
20
|
+
* Materialization returns an owned, mutable formula DTO cached for subsequent reads.
|
|
21
|
+
*/
|
|
22
|
+
export interface IFormulaDataSnapshot {
|
|
23
|
+
materialize(): IFormulaData;
|
|
24
|
+
}
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { ICellData, IObjectMatrixPrimitiveType, IRange, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import { Disposable, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
|
|
17
18
|
import type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData, IFormulaDataItem, IFormulaUnitNameMap, IRuntimeUnitDataType, IUnitData, IUnitImageFormulaDataType, IUnitRowData, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
18
19
|
import type { ICircularReference } from '../services/runtime.service';
|
|
19
|
-
import {
|
|
20
|
+
import type { IFormulaDataSnapshot } from './formula-data-snapshot';
|
|
20
21
|
import { LexerTreeBuilder } from '../engine/analysis/lexer-tree-builder';
|
|
21
22
|
export interface IRangeChange {
|
|
22
23
|
oldCell: IRange;
|
|
@@ -38,6 +39,13 @@ export declare class FormulaDataModel extends Disposable {
|
|
|
38
39
|
clearPreviousArrayFormulaCellData(clearArrayFormulaCellData: IRuntimeUnitDataType): void;
|
|
39
40
|
mergeArrayFormulaCellData(unitData: IRuntimeUnitDataType): void;
|
|
40
41
|
getFormulaData(): IFormulaData;
|
|
42
|
+
private _collectFormulaData;
|
|
43
|
+
/**
|
|
44
|
+
* Internal calculation-engine capture; customized model methods retain the eager DTO path.
|
|
45
|
+
* Reuse ordinary model traversal and metadata preparation, deferring per-formula DTO objects where possible.
|
|
46
|
+
* The optional classifier is retained for cooperating engines that reject a proxied model before capture.
|
|
47
|
+
*/
|
|
48
|
+
tryCreateFormulaDataSnapshot(isProxy?: (value: unknown) => boolean): IFormulaDataSnapshot | undefined;
|
|
41
49
|
initSheetFormulaData(formulaData: IFormulaData, unitId: string, sheetId: string, cellMatrix: ObjectMatrix<Nullable<ICellData>>): IFormulaData;
|
|
42
50
|
clearFormulaIdMap(unitId: string, sheetId?: string): void;
|
|
43
51
|
getSheetFormulaData(unitId: string, sheetId: string): Nullable<IObjectMatrixPrimitiveType<Nullable<IFormulaDataItem>>>;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IUniverEngineFormulaConfig } from './config/config';
|
|
17
16
|
import { IConfigService, Injector, Plugin } from '@univerjs/core';
|
|
17
|
+
import type { IUniverEngineFormulaConfig } from './config/config';
|
|
18
18
|
export declare class UniverFormulaEnginePlugin extends Plugin {
|
|
19
19
|
protected readonly _config: Partial<IUniverEngineFormulaConfig>;
|
|
20
20
|
protected _injector: Injector;
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { ICommandInfo, IExecutionOptions, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
-
import type { IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap } from '../basics/common';
|
|
18
17
|
import { Disposable } from '@univerjs/core';
|
|
18
|
+
import type { IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap } from '../basics/common';
|
|
19
19
|
export interface IDirtyConversionManagerParams {
|
|
20
20
|
commandId: string;
|
|
21
21
|
shouldTrigger?: (command: ICommandInfo, options?: IExecutionOptions) => boolean;
|
|
22
22
|
getDirtyData: (command: ICommandInfo) => {
|
|
23
23
|
dirtyIterationUnits?: string[];
|
|
24
|
+
dirtyReferenceUnits?: string[];
|
|
24
25
|
forceCalculation?: boolean;
|
|
25
26
|
dirtyRanges?: IUnitRange[];
|
|
26
27
|
dirtyNameMap?: IDirtyUnitSheetNameMap;
|
|
@@ -52,4 +53,4 @@ export declare class ActiveDirtyManagerService extends Disposable implements IAc
|
|
|
52
53
|
register(commandId: string, dirtyConversion: IDirtyConversionManagerParams): void;
|
|
53
54
|
getDirtyConversionMap(): Map<string, IDirtyConversionManagerParams>;
|
|
54
55
|
}
|
|
55
|
-
export declare const IActiveDirtyManagerService: import("@
|
|
56
|
+
export declare const IActiveDirtyManagerService: import("@univerjs/core").IdentifierDecorator<IActiveDirtyManagerService>;
|
|
@@ -15,21 +15,29 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { ICellData, IUnitRange, IWorkbookCalculationSettings } from '@univerjs/core';
|
|
17
17
|
import type { Observable } from 'rxjs';
|
|
18
|
+
import { AsyncLock, Disposable, IConfigService } from '@univerjs/core';
|
|
19
|
+
import { Subject } from 'rxjs';
|
|
18
20
|
import type { IArrayFormulaRangeType, IFeatureDirtyRangeType, IFormulaDatasetConfig, IFormulaExecuteResultMap, IFormulaStringMap, IRuntimeUnitDataType, IUnitExcludedCell, IUnitRowData } from '../basics/common';
|
|
19
21
|
import type { IFormulaDependencyTreeFullJson, IFormulaDependencyTreeJson, IFormulaDependentsAndInRangeResults } from '../engine/dependency/dependency-tree';
|
|
20
22
|
import type { FunctionVariantType } from '../engine/reference-object/base-reference-object';
|
|
23
|
+
import type { IFormulaDataSnapshot } from '../models/formula-data-snapshot';
|
|
21
24
|
import type { IAllRuntimeData, IExecutionInProgressParams } from './runtime.service';
|
|
22
|
-
import { AsyncLock, Disposable, IConfigService } from '@univerjs/core';
|
|
23
|
-
import { Subject } from 'rxjs';
|
|
24
25
|
import { Lexer } from '../engine/analysis/lexer';
|
|
25
26
|
import { AstTreeBuilder } from '../engine/analysis/parser';
|
|
26
27
|
import { IFormulaDependencyGenerator } from '../engine/dependency/formula-dependency';
|
|
27
28
|
import { Interpreter } from '../engine/interpreter/interpreter';
|
|
28
29
|
import { IFormulaCurrentConfigService } from './current-data.service';
|
|
30
|
+
import { FormulaResultService } from './formula-result.service';
|
|
29
31
|
import { IFormulaRuntimeService } from './runtime.service';
|
|
30
32
|
export declare const DEFAULT_INTERVAL_COUNT = 500;
|
|
31
33
|
export declare const EVERY_N_FUNCTION_EXECUTION_PAUSE = 100;
|
|
32
34
|
export interface ICalculateFormulaService {
|
|
35
|
+
/** Internal engine opt-in; engines without this capability and RPC proxies keep the complete formula DTO input. */
|
|
36
|
+
readonly supportsFormulaDataSnapshot?: boolean;
|
|
37
|
+
/** Internal engine capability to capture formula values in the same runtime. */
|
|
38
|
+
prepareFormulaDataSnapshot?(): IFormulaDataSnapshot | undefined;
|
|
39
|
+
/** Internal engine capability to execute the captured formula input. */
|
|
40
|
+
executeWithFormulaDataSnapshot?(config: Omit<IFormulaDatasetConfig, 'formulaData'>, snapshot: IFormulaDataSnapshot): Promise<void>;
|
|
33
41
|
readonly executionInProgressListener$: Observable<IExecutionInProgressParams>;
|
|
34
42
|
readonly executionCompleteListener$: Observable<IAllRuntimeData>;
|
|
35
43
|
setRuntimeFeatureCellData(featureId: string, featureData: IRuntimeUnitDataType): void;
|
|
@@ -44,7 +52,7 @@ export interface ICalculateFormulaService {
|
|
|
44
52
|
getInRangeFormulas(unitRanges: IUnitRange[]): Promise<IFormulaDependencyTreeJson[]>;
|
|
45
53
|
getDependentsAndInRangeFormulas(unitRanges: IUnitRange[]): Promise<IFormulaDependentsAndInRangeResults>;
|
|
46
54
|
}
|
|
47
|
-
export declare const ICalculateFormulaService: import("@
|
|
55
|
+
export declare const ICalculateFormulaService: import("@univerjs/core").IdentifierDecorator<ICalculateFormulaService>;
|
|
48
56
|
export declare class CalculateFormulaService extends Disposable implements ICalculateFormulaService {
|
|
49
57
|
protected readonly _configService: IConfigService;
|
|
50
58
|
protected readonly _lexer: Lexer;
|
|
@@ -53,6 +61,7 @@ export declare class CalculateFormulaService extends Disposable implements ICalc
|
|
|
53
61
|
protected readonly _formulaDependencyGenerator: IFormulaDependencyGenerator;
|
|
54
62
|
protected readonly _interpreter: Interpreter;
|
|
55
63
|
protected readonly _astTreeBuilder: AstTreeBuilder;
|
|
64
|
+
protected readonly _formulaResultService: FormulaResultService;
|
|
56
65
|
protected readonly _executionInProgressListener$: Subject<IExecutionInProgressParams>;
|
|
57
66
|
readonly executionInProgressListener$: Observable<IExecutionInProgressParams>;
|
|
58
67
|
protected readonly _executionCompleteListener$: Subject<IAllRuntimeData>;
|
|
@@ -92,7 +101,7 @@ export declare class CalculateFormulaService extends Disposable implements ICalc
|
|
|
92
101
|
preserve: boolean;
|
|
93
102
|
iteration: number;
|
|
94
103
|
}, void, unknown>;
|
|
95
|
-
constructor(_configService: IConfigService, _lexer: Lexer, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _formulaDependencyGenerator: IFormulaDependencyGenerator, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder);
|
|
104
|
+
constructor(_configService: IConfigService, _lexer: Lexer, _currentConfigService: IFormulaCurrentConfigService, _runtimeService: IFormulaRuntimeService, _formulaDependencyGenerator: IFormulaDependencyGenerator, _interpreter: Interpreter, _astTreeBuilder: AstTreeBuilder, _formulaResultService: FormulaResultService);
|
|
96
105
|
dispose(): void;
|
|
97
106
|
/**
|
|
98
107
|
* Stop the execution of the formula.
|
|
@@ -108,6 +117,7 @@ export declare class CalculateFormulaService extends Disposable implements ICalc
|
|
|
108
117
|
setRuntimeFeatureCellData(featureId: string, featureData: IRuntimeUnitDataType): void;
|
|
109
118
|
setRuntimeFeatureRange(featureId: string, featureRange: IFeatureDirtyRangeType): void;
|
|
110
119
|
execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
|
|
120
|
+
protected _completeExecution(): Promise<void>;
|
|
111
121
|
protected _executeStep(): Promise<true | undefined>;
|
|
112
122
|
protected _getArrayFormulaDirtyRangeAndExcludedRange(arrayFormulaRange: IArrayFormulaRangeType, runtimeFeatureRange: {
|
|
113
123
|
[featureId: string]: IFeatureDirtyRangeType;
|
|
@@ -14,11 +14,18 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IUnitRange, IWorkbookCalculationSettings, LocaleType, Nullable } from '@univerjs/core';
|
|
17
|
-
import type { IArrayFormulaRangeType, IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap, IFormulaData, IFormulaDatasetConfig, IFormulaExternalReferences, IFormulaUnitNameMap, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetIdToNameMap, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
18
17
|
import { DateSystem, Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
18
|
+
import type { IArrayFormulaRangeType, IDirtyUnitDefinedNameMap, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IDirtyUnitSuperTableMap, IFormulaData, IFormulaDatasetConfig, IFormulaExternalReferences, IFormulaUnitNameMap, IRuntimeUnitDataType, IUnitData, IUnitExcludedCell, IUnitRowData, IUnitSheetIdToNameMap, IUnitSheetNameMap, IUnitStylesData } from '../basics/common';
|
|
19
|
+
import type { IFormulaDataSnapshot } from '../models/formula-data-snapshot';
|
|
19
20
|
import { FormulaDataModel } from '../models/formula-data.model';
|
|
20
21
|
import { ISheetRowFilteredService } from './sheet-row-filtered.service';
|
|
22
|
+
/**
|
|
23
|
+
* Internal implementation bookkeeping, not an application integration API.
|
|
24
|
+
* Query deferred-input bookkeeping without observing service Proxy properties or getters.
|
|
25
|
+
*/
|
|
26
|
+
export declare function hasDeferredFormulaDataSnapshot(service: unknown): boolean;
|
|
21
27
|
export interface IFormulaDirtyData {
|
|
28
|
+
dirtyReferenceUnits?: string[];
|
|
22
29
|
dirtyIterationUnits?: string[];
|
|
23
30
|
forceCalculation: boolean;
|
|
24
31
|
dirtyRanges: IUnitRange[];
|
|
@@ -35,6 +42,8 @@ export interface IFormulaDirtyData {
|
|
|
35
42
|
}
|
|
36
43
|
export interface IFormulaCurrentConfigService {
|
|
37
44
|
load(config: IFormulaDatasetConfig): void;
|
|
45
|
+
/** Internal engine capability to defer formula DTO materialization. */
|
|
46
|
+
loadWithFormulaDataSnapshot?(config: Omit<IFormulaDatasetConfig, 'formulaData'>, snapshot: IFormulaDataSnapshot): void;
|
|
38
47
|
getUnitData(): IUnitData;
|
|
39
48
|
/**
|
|
40
49
|
* Get the unit styles data.
|
|
@@ -65,11 +74,11 @@ export interface IFormulaCurrentConfigService {
|
|
|
65
74
|
getExecuteSubUnitId(): Nullable<string>;
|
|
66
75
|
setExecuteUnitId(unitId: string): void;
|
|
67
76
|
setExecuteSubUnitId(subUnitId: string): void;
|
|
68
|
-
getDirtyData(): IFormulaDirtyData;
|
|
77
|
+
getDirtyData(forFeatureCalculation?: boolean): IFormulaDirtyData;
|
|
69
78
|
getClearDependencyTreeCache(): IDirtyUnitSheetNameMap;
|
|
70
79
|
getLocale(): LocaleType;
|
|
71
80
|
getDateSystem(unitId?: string): DateSystem;
|
|
72
|
-
getSheetsInfo(): {
|
|
81
|
+
getSheetsInfo(unitId?: string): {
|
|
73
82
|
sheetOrder: string[];
|
|
74
83
|
sheetNameMap: {
|
|
75
84
|
[sheetId: string]: string;
|
|
@@ -88,12 +97,14 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
88
97
|
private readonly _localeService;
|
|
89
98
|
private readonly _formulaDataModel;
|
|
90
99
|
private readonly _sheetRowFilteredService;
|
|
100
|
+
private _dirtyReferenceUnits;
|
|
91
101
|
private _dirtyIterationUnits;
|
|
92
102
|
private _unitData;
|
|
93
103
|
private _unitStylesData;
|
|
94
104
|
private _arrayFormulaCellData;
|
|
95
105
|
private _arrayFormulaRange;
|
|
96
106
|
private _formulaData;
|
|
107
|
+
private _formulaDataSnapshot;
|
|
97
108
|
private _sheetNameMap;
|
|
98
109
|
private _unitNameMap;
|
|
99
110
|
private _externalReferences;
|
|
@@ -139,7 +150,7 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
139
150
|
getClearDependencyTreeCache(): IDirtyUnitSheetNameMap;
|
|
140
151
|
getLocale(): LocaleType;
|
|
141
152
|
getDateSystem(unitId?: string | undefined): DateSystem;
|
|
142
|
-
getSheetsInfo(): {
|
|
153
|
+
getSheetsInfo(unitId?: string): {
|
|
143
154
|
sheetOrder: string[];
|
|
144
155
|
sheetNameMap: {
|
|
145
156
|
[sheetId: string]: string;
|
|
@@ -151,8 +162,11 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
151
162
|
};
|
|
152
163
|
getFilteredOutRows(unitId: string, sheetId: string, startRow: number, endRow: number): number[];
|
|
153
164
|
load(config: IFormulaDatasetConfig): void;
|
|
165
|
+
/** Internal engine capability to defer formula DTO materialization. */
|
|
166
|
+
loadWithFormulaDataSnapshot(config: Omit<IFormulaDatasetConfig, 'formulaData'>, snapshot: IFormulaDataSnapshot): void;
|
|
167
|
+
private _loadFormulaDataset;
|
|
154
168
|
loadDataLite(rowData?: IUnitRowData): void;
|
|
155
|
-
getDirtyData(): IFormulaDirtyData;
|
|
169
|
+
getDirtyData(forFeatureCalculation?: boolean): IFormulaDirtyData;
|
|
156
170
|
loadDirtyRangesAndExcludedCell(dirtyRanges: IUnitRange[], excludedCell?: IUnitExcludedCell): void;
|
|
157
171
|
registerUnitData(unitData: IUnitData): void;
|
|
158
172
|
registerFormulaData(formulaData: IFormulaData): void;
|
|
@@ -166,4 +180,4 @@ export declare class FormulaCurrentConfigService extends Disposable implements I
|
|
|
166
180
|
*/
|
|
167
181
|
private _applyUnitRowData;
|
|
168
182
|
}
|
|
169
|
-
export declare const IFormulaCurrentConfigService: import("@
|
|
183
|
+
export declare const IFormulaCurrentConfigService: import("@univerjs/core").IdentifierDecorator<IFormulaCurrentConfigService>;
|
|
@@ -94,4 +94,4 @@ export declare class DefinedNamesService extends Disposable implements IDefinedN
|
|
|
94
94
|
private _updateCache;
|
|
95
95
|
private _isDeepDefinedNameMapEmpty;
|
|
96
96
|
}
|
|
97
|
-
export declare const IDefinedNamesService: import("@
|
|
97
|
+
export declare const IDefinedNamesService: import("@univerjs/core").IdentifierDecorator<IDefinedNamesService>;
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IRange, IUnitRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import { Disposable, ObjectMatrix, RTree } from '@univerjs/core';
|
|
17
18
|
import type { AstRootNode } from '../engine/ast-node';
|
|
18
19
|
import type { FormulaDependencyTree, IFormulaDependencyTree } from '../engine/dependency/dependency-tree';
|
|
19
|
-
import { Disposable, ObjectMatrix, RTree } from '@univerjs/core';
|
|
20
20
|
export interface IDependencyManagerService {
|
|
21
21
|
dispose(): void;
|
|
22
22
|
reset(): void;
|
|
@@ -37,6 +37,7 @@ export interface IDependencyManagerService {
|
|
|
37
37
|
removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
|
|
38
38
|
addFormulaDependencyByDefinedName(tree: IFormulaDependencyTree, node: Nullable<AstRootNode>): void;
|
|
39
39
|
addDependencyRTreeCache(tree: IFormulaDependencyTree): void;
|
|
40
|
+
hasDependencyRTreeCache(treeId: number): boolean;
|
|
40
41
|
searchDependency(search: IUnitRange[], exceptTreeIds?: Set<number>): Set<number>;
|
|
41
42
|
getLastTreeId(): number;
|
|
42
43
|
getTreeById(treeId: number): Nullable<IFormulaDependencyTree>;
|
|
@@ -77,6 +78,12 @@ export declare class DependencyManagerBaseService extends Disposable implements
|
|
|
77
78
|
getFeatureFormulaDependency(unitId: string, sheetId: string, featureId: string): Nullable<number>;
|
|
78
79
|
getFormulaDependency(unitId: string, sheetId: string, row: number, column: number): Nullable<number>;
|
|
79
80
|
addDependencyRTreeCache(tree: IFormulaDependencyTree): void;
|
|
81
|
+
/**
|
|
82
|
+
* Whether this tree is currently present in the dependency index. A recalculation that
|
|
83
|
+
* reuses the ranges of an unchanged formula may skip the index write only while the entry
|
|
84
|
+
* it relies on still exists; a forced calculation resets the index and clears this state.
|
|
85
|
+
*/
|
|
86
|
+
hasDependencyRTreeCache(treeId: number): boolean;
|
|
80
87
|
getLastTreeId(): number;
|
|
81
88
|
protected _addAllTreeMap(tree: IFormulaDependencyTree): void;
|
|
82
89
|
protected _addDefinedName(unitId: string, definedName: string, treeId: number): void;
|
|
@@ -94,6 +101,8 @@ export declare class DependencyManagerBaseService extends Disposable implements
|
|
|
94
101
|
export declare class DependencyManagerService extends DependencyManagerBaseService implements IDependencyManagerService {
|
|
95
102
|
protected _allTreeMap: Map<number, Map<string, Map<string, IRange>>>;
|
|
96
103
|
protected _dependencyRTreeCache: RTree;
|
|
104
|
+
hasDependencyRTreeCache(treeId: number): boolean;
|
|
105
|
+
addDependencyRTreeCache(tree: IFormulaDependencyTree): void;
|
|
97
106
|
reset(): void;
|
|
98
107
|
addOtherFormulaDependency(unitId: string, sheetId: string, formulaId: string, dependencyTree: IFormulaDependencyTree): void;
|
|
99
108
|
removeOtherFormulaDependency(unitId: string, sheetId: string, formulaIds: string[]): void;
|
|
@@ -105,6 +114,7 @@ export declare class DependencyManagerService extends DependencyManagerBaseServi
|
|
|
105
114
|
removeFormulaDependency(unitId: string, sheetId: string, row: number, column: number): void;
|
|
106
115
|
clearFormulaDependency(unitId: string, sheetId?: string): void;
|
|
107
116
|
private _removeDependencyRTreeCache;
|
|
117
|
+
private _removeDependencyRTreeCaches;
|
|
108
118
|
removeFormulaDependencyByDefinedName(unitId: string, definedName: string): void;
|
|
109
119
|
openKdTree(): void;
|
|
110
120
|
closeKdTree(): void;
|
|
@@ -125,4 +135,4 @@ export declare class DependencyManagerService extends DependencyManagerBaseServi
|
|
|
125
135
|
*/
|
|
126
136
|
private _buildReverseDependency;
|
|
127
137
|
}
|
|
128
|
-
export declare const IDependencyManagerService: import("@
|
|
138
|
+
export declare const IDependencyManagerService: import("@univerjs/core").IdentifierDecorator<IDependencyManagerService>;
|
|
@@ -35,7 +35,7 @@ export interface IFormulaExternalReferenceDataLoader {
|
|
|
35
35
|
range: IRange;
|
|
36
36
|
}): Promise<ErrorType | boolean | void>;
|
|
37
37
|
}
|
|
38
|
-
export declare const IFormulaExternalReferenceDataLoader: import("@
|
|
38
|
+
export declare const IFormulaExternalReferenceDataLoader: import("@univerjs/core").IdentifierDecorator<IFormulaExternalReferenceDataLoader>;
|
|
39
39
|
export declare class NoopFormulaExternalReferenceDataLoader implements IFormulaExternalReferenceDataLoader {
|
|
40
40
|
load(): Promise<void>;
|
|
41
41
|
}
|
|
@@ -55,4 +55,4 @@ export declare class FeatureCalculationManagerService extends Disposable impleme
|
|
|
55
55
|
register(unitId: string, subUnitId: string, featureId: string, referenceExecutor: IFeatureCalculationManagerParam): void;
|
|
56
56
|
getReferenceExecutorMap(): Map<string, Map<string, Map<string, IFeatureCalculationManagerParam>>>;
|
|
57
57
|
}
|
|
58
|
-
export declare const IFeatureCalculationManagerService: import("@
|
|
58
|
+
export declare const IFeatureCalculationManagerService: import("@univerjs/core").IdentifierDecorator<IFeatureCalculationManagerService>;
|
|
@@ -68,7 +68,7 @@ export interface IDescriptionService {
|
|
|
68
68
|
*/
|
|
69
69
|
isFormulaDefinedName(name: string): boolean;
|
|
70
70
|
}
|
|
71
|
-
export declare const IDescriptionService: import("@
|
|
71
|
+
export declare const IDescriptionService: import("@univerjs/core").IdentifierDecorator<IDescriptionService>;
|
|
72
72
|
export declare class DescriptionService extends Disposable implements IDescriptionService {
|
|
73
73
|
private readonly _functionService;
|
|
74
74
|
private readonly _localeService;
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Disposable } from '@univerjs/core';
|
|
16
17
|
import type { ISetFormulaCalculationResultMutation } from '../../commands/mutations/set-formula-calculation.mutation';
|
|
17
18
|
import type { IExecutionInProgressParams } from '../runtime.service';
|
|
18
|
-
import { Disposable } from '@univerjs/core';
|
|
19
19
|
import { FormulaExecutedStateType } from '../runtime.service';
|
|
20
20
|
export interface IFormulaCalculationSessionState {
|
|
21
21
|
id: number;
|
|
@@ -36,6 +36,7 @@ export declare class FormulaCalculationSessionService extends Disposable {
|
|
|
36
36
|
private readonly _state$;
|
|
37
37
|
private readonly _resultApplied$;
|
|
38
38
|
private _currentResult;
|
|
39
|
+
private _lastAppliedResult;
|
|
39
40
|
private _hasEmittedCurrentResultApplied;
|
|
40
41
|
private _pendingResultApplicationTypes;
|
|
41
42
|
private _preAppliedSessionTypes;
|
|
@@ -79,7 +79,7 @@ export interface IRegisterFunctionService {
|
|
|
79
79
|
*/
|
|
80
80
|
registerAsyncFunction(params: ISingleFunctionRegisterParams): IDisposable;
|
|
81
81
|
}
|
|
82
|
-
export declare const IRegisterFunctionService: import("@
|
|
82
|
+
export declare const IRegisterFunctionService: import("@univerjs/core").IdentifierDecorator<IRegisterFunctionService>;
|
|
83
83
|
export interface ISingleFunctionRegisterParams {
|
|
84
84
|
/**
|
|
85
85
|
* function name
|
|
@@ -0,0 +1,47 @@
|
|
|
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 } from '@univerjs/core';
|
|
17
|
+
import type { IFunctionNames } from '../basics/function';
|
|
18
|
+
import type { LexerNode } from '../engine/analysis/lexer-node';
|
|
19
|
+
import type { AstRootNode } from '../engine/ast-node/ast-root-node';
|
|
20
|
+
import type { ArrayValueObject } from '../engine/value-object/array-value-object';
|
|
21
|
+
import { FormulaAstLRU } from '../basics/cache-lru';
|
|
22
|
+
import { InvertedIndexCache } from '../basics/inverted-index-cache';
|
|
23
|
+
/** Runtime-only context. Values may outlive a calculation, but must not revive its caches. */
|
|
24
|
+
export declare class FormulaCalculationCache extends Disposable {
|
|
25
|
+
readonly references: FormulaAstLRU<ArrayValueObject>;
|
|
26
|
+
readonly invertedIndex: InvertedIndexCache;
|
|
27
|
+
get closed(): boolean;
|
|
28
|
+
clearUnit(unitId: string): void;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
/** One owner per Univer injector; no dependency on the parser, calculator or function registry. */
|
|
32
|
+
export declare class FormulaCacheService extends Disposable {
|
|
33
|
+
private readonly _asts;
|
|
34
|
+
private readonly _lexerTrees;
|
|
35
|
+
private readonly _calculations;
|
|
36
|
+
get closed(): boolean;
|
|
37
|
+
getAst(key: string): AstRootNode | undefined;
|
|
38
|
+
setAst(key: string, unitId: string, node: AstRootNode): void;
|
|
39
|
+
getLexerTree(key: string): LexerNode | undefined;
|
|
40
|
+
setLexerTree(key: string, node: LexerNode, unitId?: string | null): void;
|
|
41
|
+
clearCompiled(): void;
|
|
42
|
+
clearFunctions(functionNames: IFunctionNames[]): void;
|
|
43
|
+
clearUnit(unitId: string): void;
|
|
44
|
+
createCalculation(): FormulaCalculationCache | undefined;
|
|
45
|
+
releaseCalculation(context: FormulaCalculationCache): void;
|
|
46
|
+
dispose(): void;
|
|
47
|
+
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IFormulaDirtyData } from './current-data.service';
|
|
17
16
|
import { Disposable, ICommandService } from '@univerjs/core';
|
|
17
|
+
import type { IFormulaDirtyData } from './current-data.service';
|
|
18
18
|
import { IActiveDirtyManagerService } from './active-dirty-manager.service';
|
|
19
19
|
/**
|
|
20
20
|
* Converts commands registered in ActiveDirtyManagerService into one formula
|
|
@@ -31,4 +31,4 @@ export interface IFormulaChangesetCalculationService {
|
|
|
31
31
|
/** Release temporary replay state so later local edits use the normal calculation path. */
|
|
32
32
|
end(unitId: string): void;
|
|
33
33
|
}
|
|
34
|
-
export declare const IFormulaChangesetCalculationService: import("@
|
|
34
|
+
export declare const IFormulaChangesetCalculationService: import("@univerjs/core").IdentifierDecorator<IFormulaChangesetCalculationService>;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 type { ISetFormulaCalculationResultMutation } from '../commands/mutations/set-formula-calculation.mutation';
|
|
18
|
+
import type { IAllRuntimeData } from './runtime.service';
|
|
19
|
+
import { FormulaDataModel } from '../models/formula-data.model';
|
|
20
|
+
import { IFormulaRuntimeService } from './runtime.service';
|
|
21
|
+
/** Applies calculation batches for every engine; completion notifications never resubmit them. */
|
|
22
|
+
export declare class FormulaResultService extends Disposable {
|
|
23
|
+
private readonly _commandService;
|
|
24
|
+
private readonly _formulaDataModel;
|
|
25
|
+
private readonly _runtimeService;
|
|
26
|
+
constructor(_commandService: ICommandService, _formulaDataModel: FormulaDataModel, _runtimeService: IFormulaRuntimeService);
|
|
27
|
+
applyTreeResult(data: IAllRuntimeData): Promise<void>;
|
|
28
|
+
applyResult(data: IAllRuntimeData, result?: ISetFormulaCalculationResultMutation): Promise<void>;
|
|
29
|
+
}
|
|
@@ -17,6 +17,7 @@ import type { IDisposable, Nullable } from '@univerjs/core';
|
|
|
17
17
|
import type { IFunctionInfo, IFunctionNames } from '../basics/function';
|
|
18
18
|
import type { BaseFunction } from '../functions/base-function';
|
|
19
19
|
import { Disposable } from '@univerjs/core';
|
|
20
|
+
import { FormulaCacheService } from './formula-cache.service';
|
|
20
21
|
export interface IFunctionService {
|
|
21
22
|
/**
|
|
22
23
|
* Use register to register a function, new CustomFunction(inject, name)
|
|
@@ -44,10 +45,12 @@ export interface IFunctionService {
|
|
|
44
45
|
clearDescriptions(): void;
|
|
45
46
|
deleteFormulaAstCacheKey(...functionToken: IFunctionNames[]): void;
|
|
46
47
|
}
|
|
47
|
-
export declare const IFunctionService: import("@
|
|
48
|
+
export declare const IFunctionService: import("@univerjs/core").IdentifierDecorator<IFunctionService>;
|
|
48
49
|
export declare class FunctionService extends Disposable implements IFunctionService {
|
|
50
|
+
private readonly _cacheService;
|
|
49
51
|
private _functionExecutors;
|
|
50
52
|
private _functionDescriptions;
|
|
53
|
+
constructor(_cacheService: FormulaCacheService);
|
|
51
54
|
dispose(): void;
|
|
52
55
|
registerExecutors(...functions: BaseFunction[]): void;
|
|
53
56
|
getExecutors(): Map<IFunctionNames, BaseFunction>;
|
|
@@ -26,4 +26,4 @@ export declare class HyperlinkEngineFormulaService extends Disposable implements
|
|
|
26
26
|
constructor(_univerInstanceService: IUniverInstanceService);
|
|
27
27
|
generateCellValue(url: string, label: string): ICellData;
|
|
28
28
|
}
|
|
29
|
-
export declare const IHyperlinkEngineFormulaService: import("@
|
|
29
|
+
export declare const IHyperlinkEngineFormulaService: import("@univerjs/core").IdentifierDecorator<IHyperlinkEngineFormulaService>;
|
|
@@ -51,4 +51,4 @@ export declare class OtherFormulaManagerService extends Disposable implements IO
|
|
|
51
51
|
batchRemove(formulaData: IDirtyUnitOtherFormulaMap): void;
|
|
52
52
|
getOtherFormulaData(): IOtherFormulaData;
|
|
53
53
|
}
|
|
54
|
-
export declare const IOtherFormulaManagerService: import("@
|
|
54
|
+
export declare const IOtherFormulaManagerService: import("@univerjs/core").IdentifierDecorator<IOtherFormulaManagerService>;
|
|
@@ -18,8 +18,10 @@ import type { IArrayFormulaEmbeddedMap, IArrayFormulaRangeType, IFeatureDirtyRan
|
|
|
18
18
|
import type { BaseAstNode } from '../engine/ast-node/base-ast-node';
|
|
19
19
|
import type { IFormulaDependencyTreeJson } from '../engine/dependency/dependency-tree';
|
|
20
20
|
import type { FunctionVariantType } from '../engine/reference-object/base-reference-object';
|
|
21
|
+
import type { FormulaCalculationCache } from './formula-cache.service';
|
|
21
22
|
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
22
23
|
import { IFormulaCurrentConfigService } from './current-data.service';
|
|
24
|
+
import { FormulaCacheService } from './formula-cache.service';
|
|
23
25
|
import { IHyperlinkEngineFormulaService } from './hyperlink-engine-formula.service';
|
|
24
26
|
/**
|
|
25
27
|
* The formula engine has a lot of stages. IDLE and CALCULATION_COMPLETED can be considered as
|
|
@@ -88,7 +90,12 @@ export interface IFormulaRuntimeService {
|
|
|
88
90
|
currentUnitId: string;
|
|
89
91
|
dispose(): void;
|
|
90
92
|
reset(): void;
|
|
91
|
-
|
|
93
|
+
/** Custom runtimes without cache hooks continue to compute uncached values. */
|
|
94
|
+
getCalculationCache?(): FormulaCalculationCache | undefined;
|
|
95
|
+
clearInvertedIndexCache?(): void;
|
|
96
|
+
releaseCalculationCache?(): void;
|
|
97
|
+
/** Start empty when the engine will supply the complete current cycle set. */
|
|
98
|
+
beginCircularReferences(clearPrevious?: boolean): void;
|
|
92
99
|
clearCircularReferenceCells(cells: {
|
|
93
100
|
unitId: string;
|
|
94
101
|
subUnitId: string;
|
|
@@ -149,9 +156,11 @@ export interface IFormulaRuntimeService {
|
|
|
149
156
|
getDependencyTreeModelData(): IFormulaDependencyTreeJson[];
|
|
150
157
|
}
|
|
151
158
|
export declare class FormulaRuntimeService extends Disposable implements IFormulaRuntimeService {
|
|
159
|
+
private readonly _cacheService;
|
|
152
160
|
private readonly _currentConfigService;
|
|
153
161
|
private readonly _hyperlinkEngineFormulaService;
|
|
154
162
|
private readonly _univerInstanceService;
|
|
163
|
+
private _calculationCache;
|
|
155
164
|
private _formulaExecuteStage;
|
|
156
165
|
private _circularReferences;
|
|
157
166
|
private _pendingCircularReferences;
|
|
@@ -184,7 +193,7 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
184
193
|
private _formulaCycleIndex;
|
|
185
194
|
private _isCycleDependency;
|
|
186
195
|
private _dependencyTreeModelData;
|
|
187
|
-
constructor(_currentConfigService: IFormulaCurrentConfigService, _hyperlinkEngineFormulaService: IHyperlinkEngineFormulaService, _univerInstanceService: IUniverInstanceService);
|
|
196
|
+
constructor(_cacheService: FormulaCacheService, _currentConfigService: IFormulaCurrentConfigService, _hyperlinkEngineFormulaService: IHyperlinkEngineFormulaService, _univerInstanceService: IUniverInstanceService);
|
|
188
197
|
get currentRow(): number;
|
|
189
198
|
get currentColumn(): number;
|
|
190
199
|
get currentRowCount(): number;
|
|
@@ -213,9 +222,12 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
213
222
|
isStopExecution(): boolean;
|
|
214
223
|
setFormulaExecuteStage(type: FormulaExecuteStageType): void;
|
|
215
224
|
getFormulaExecuteStage(): FormulaExecuteStageType;
|
|
225
|
+
getCalculationCache(): FormulaCalculationCache | undefined;
|
|
226
|
+
clearInvertedIndexCache(): void;
|
|
227
|
+
releaseCalculationCache(): void;
|
|
216
228
|
reset(): void;
|
|
217
229
|
clearReferenceAndNumberformatCache(): void;
|
|
218
|
-
beginCircularReferences(): void;
|
|
230
|
+
beginCircularReferences(clearPrevious?: boolean): void;
|
|
219
231
|
clearCircularReferenceCells(cells: {
|
|
220
232
|
unitId: string;
|
|
221
233
|
subUnitId: string;
|
|
@@ -276,4 +288,4 @@ export declare class FormulaRuntimeService extends Disposable implements IFormul
|
|
|
276
288
|
private _checkIfArrayFormulaExceeded;
|
|
277
289
|
private _isInDirtyRange;
|
|
278
290
|
}
|
|
279
|
-
export declare const IFormulaRuntimeService: import("@
|
|
291
|
+
export declare const IFormulaRuntimeService: import("@univerjs/core").IdentifierDecorator<IFormulaRuntimeService>;
|
|
@@ -29,5 +29,5 @@ export declare class SheetRowFilteredService extends Disposable implements IShee
|
|
|
29
29
|
getRowFiltered(unitId: string, subUnitId: string, row: number): boolean;
|
|
30
30
|
dispose(): void;
|
|
31
31
|
}
|
|
32
|
-
export declare const ISheetRowFilteredService: import("@
|
|
32
|
+
export declare const ISheetRowFilteredService: import("@univerjs/core").IdentifierDecorator<ISheetRowFilteredService>;
|
|
33
33
|
export {};
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '@univerjs/core';
|
|
17
17
|
import type { Observable } from 'rxjs';
|
|
18
|
-
import type { ISuperTable } from '../basics/common';
|
|
19
18
|
import { Disposable } from '@univerjs/core';
|
|
19
|
+
import type { ISuperTable, ISuperTableData } from '../basics/common';
|
|
20
20
|
import { TableOptionType } from '../basics/common';
|
|
21
21
|
export interface ISuperTableOptionParam {
|
|
22
22
|
tableOption: string;
|
|
@@ -25,7 +25,7 @@ export interface ISuperTableOptionParam {
|
|
|
25
25
|
export interface ISuperTableService {
|
|
26
26
|
getTableMap(unitId: string): Nullable<Map<string, ISuperTable>>;
|
|
27
27
|
getTableOptionMap(): Map<string, TableOptionType>;
|
|
28
|
-
registerTable(unitId: string, tableName: string, reference: ISuperTable): void;
|
|
28
|
+
registerTable(unitId: string, tableName: string, reference: ISuperTable | ISuperTableData): void;
|
|
29
29
|
registerTableOptionMap(tableOption: string, tableOptionType: TableOptionType): void;
|
|
30
30
|
remove(unitId: string, tableName: string): void;
|
|
31
31
|
update$: Observable<unknown>;
|
|
@@ -42,10 +42,10 @@ export declare class SuperTableService extends Disposable implements ISuperTable
|
|
|
42
42
|
remove(unitId: string, tableName: string): void;
|
|
43
43
|
getTableMap(unitId: string): Map<string, ISuperTable> | undefined;
|
|
44
44
|
getTableOptionMap(): Map<string, TableOptionType>;
|
|
45
|
-
registerTable(unitId: string, tableName: string, reference: ISuperTable): void;
|
|
45
|
+
registerTable(unitId: string, tableName: string, reference: ISuperTable | ISuperTableData): void;
|
|
46
46
|
registerTableOptionMap(tableOption: string, tableOptionType: TableOptionType): void;
|
|
47
47
|
getTable(unitId: string, tableName: string): Nullable<ISuperTable>;
|
|
48
48
|
hasTable(unitId: string, tableName: string): boolean;
|
|
49
49
|
private _update;
|
|
50
50
|
}
|
|
51
|
-
export declare const ISuperTableService: import("@
|
|
51
|
+
export declare const ISuperTableService: import("@univerjs/core").IdentifierDecorator<ISuperTableService>;
|
|
@@ -37,7 +37,7 @@ export interface IFormulaUnitReferenceResolution {
|
|
|
37
37
|
export interface IFormulaUnitReferenceResolver {
|
|
38
38
|
resolve(input: IFormulaUnitReferenceResolveInput): IFormulaUnitReferenceResolution | ErrorType;
|
|
39
39
|
}
|
|
40
|
-
export declare const IFormulaUnitReferenceResolver: import("@
|
|
40
|
+
export declare const IFormulaUnitReferenceResolver: import("@univerjs/core").IdentifierDecorator<IFormulaUnitReferenceResolver>;
|
|
41
41
|
export declare function normalizeFormulaUnitName(name: string): string;
|
|
42
42
|
export declare class FormulaUnitReferenceResolver implements IFormulaUnitReferenceResolver {
|
|
43
43
|
protected readonly _currentConfigService: IFormulaCurrentConfigService;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export { UniverFormulaEnginePlugin } from './plugin';
|