@univerjs/sheets-formula 0.5.0-alpha.0 → 0.5.0-beta.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/index.js +1 -1
- package/lib/es/index.js +1703 -1584
- package/lib/types/controllers/trigger-calculation.controller.d.ts +3 -1
- package/lib/types/services/__test__/formula-ref.spec.d.ts +16 -0
- package/lib/types/services/__test__/util.d.ts +7 -0
- package/lib/types/services/formula-ref-range.service.d.ts +7 -4
- package/lib/types/services/register-other-formula.service.d.ts +5 -24
- package/lib/umd/index.js +1 -1
- package/package.json +15 -14
- package/lib/types/common/selection.d.ts +0 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Disposable, ICommandService, IConfigService, ILogService, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { FormulaDataModel, IActiveDirtyManagerService } from '@univerjs/engine-formula';
|
|
3
|
+
import { RegisterOtherFormulaService } from '../services/register-other-formula.service';
|
|
3
4
|
/**
|
|
4
5
|
* This interface is for the progress bar to display the calculation progress.
|
|
5
6
|
*/
|
|
@@ -18,6 +19,7 @@ export declare class TriggerCalculationController extends Disposable {
|
|
|
18
19
|
private readonly _configService;
|
|
19
20
|
private readonly _formulaDataModel;
|
|
20
21
|
private readonly _localeService;
|
|
22
|
+
private readonly _registerOtherFormulaService;
|
|
21
23
|
private _waitingCommandQueue;
|
|
22
24
|
private _executingDirtyData;
|
|
23
25
|
private _setTimeoutKey;
|
|
@@ -38,7 +40,7 @@ export declare class TriggerCalculationController extends Disposable {
|
|
|
38
40
|
private _calculateProgress;
|
|
39
41
|
private _completeProgress;
|
|
40
42
|
clearProgress(): void;
|
|
41
|
-
constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _logService: ILogService, _configService: IConfigService, _formulaDataModel: FormulaDataModel, _localeService: LocaleService);
|
|
43
|
+
constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _logService: ILogService, _configService: IConfigService, _formulaDataModel: FormulaDataModel, _localeService: LocaleService, _registerOtherFormulaService: RegisterOtherFormulaService);
|
|
42
44
|
dispose(): void;
|
|
43
45
|
private _commandExecutedListener;
|
|
44
46
|
private _generateDirty;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dependency, IWorkbookData, Workbook, Injector, Univer } from '@univerjs/core';
|
|
2
|
+
export interface ITestBed {
|
|
3
|
+
univer: Univer;
|
|
4
|
+
get: Injector['get'];
|
|
5
|
+
sheet: Workbook;
|
|
6
|
+
}
|
|
7
|
+
export declare function createCommandTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): ITestBed;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisposable, IMutationInfo, IRange, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { IDisposable, IMutationInfo, IRange, Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { EffectRefRangeParams, RefRangeService } from '@univerjs/sheets';
|
|
3
3
|
import { LexerTreeBuilder } from '@univerjs/engine-formula';
|
|
4
4
|
export type FormulaChangeMap = Record<string, Record<string, Record<string, string>>>;
|
|
@@ -6,8 +6,8 @@ export type FormulaChangeCallback = (formulaString: string) => {
|
|
|
6
6
|
redos: IMutationInfo[];
|
|
7
7
|
undos: IMutationInfo[];
|
|
8
8
|
};
|
|
9
|
-
export type RangeFormulaChangeCallback = (
|
|
10
|
-
|
|
9
|
+
export type RangeFormulaChangeCallback = (infos: {
|
|
10
|
+
formulas: string[];
|
|
11
11
|
ranges: IRange[];
|
|
12
12
|
}[]) => {
|
|
13
13
|
redos: IMutationInfo[];
|
|
@@ -17,7 +17,10 @@ export declare class FormulaRefRangeService extends Disposable {
|
|
|
17
17
|
private readonly _refRangeService;
|
|
18
18
|
private readonly _lexerTreeBuilder;
|
|
19
19
|
private readonly _univerInstanceService;
|
|
20
|
-
|
|
20
|
+
private readonly _injector;
|
|
21
|
+
constructor(_refRangeService: RefRangeService, _lexerTreeBuilder: LexerTreeBuilder, _univerInstanceService: IUniverInstanceService, _injector: Injector);
|
|
21
22
|
transformFormulaByEffectCommand(unitId: string, subUnitId: string, formula: string, params: EffectRefRangeParams): string;
|
|
22
23
|
registerFormula(unitId: string, subUnitId: string, formula: string, callback: FormulaChangeCallback): IDisposable;
|
|
24
|
+
private _getFormulaDependcy;
|
|
25
|
+
registerRangeFormula(unitId: string, subUnitId: string, oldRanges: IRange[], formulas: string[], callback: RangeFormulaChangeCallback): IDisposable;
|
|
23
26
|
}
|
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import { IRange, Nullable, Disposable, ICommandService } from '@univerjs/core';
|
|
1
|
+
import { IRange, Nullable, Disposable, ICommandService, LifecycleService } from '@univerjs/core';
|
|
2
2
|
import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
4
|
import { IOtherFormulaResult } from './formula-common';
|
|
4
5
|
export declare class RegisterOtherFormulaService extends Disposable {
|
|
5
6
|
private readonly _commandService;
|
|
6
7
|
private _activeDirtyManagerService;
|
|
8
|
+
private readonly _lifecycleService;
|
|
7
9
|
private _formulaCacheMap;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use _formulaChangeWithRange$ instead
|
|
10
|
-
*/
|
|
11
|
-
private _formulaChange$;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use formulaChangeWithRange$ instead
|
|
14
|
-
*/
|
|
15
|
-
formulaChange$: import('rxjs').Observable<{
|
|
16
|
-
unitId: string;
|
|
17
|
-
subUnitId: string;
|
|
18
|
-
formulaText: string;
|
|
19
|
-
formulaId: string;
|
|
20
|
-
}>;
|
|
21
10
|
private _formulaChangeWithRange$;
|
|
22
11
|
formulaChangeWithRange$: import('rxjs').Observable<{
|
|
23
12
|
unitId: string;
|
|
@@ -28,21 +17,13 @@ export declare class RegisterOtherFormulaService extends Disposable {
|
|
|
28
17
|
}>;
|
|
29
18
|
private _formulaResult$;
|
|
30
19
|
formulaResult$: import('rxjs').Observable<Record<string, Record<string, IOtherFormulaResult[]>>>;
|
|
31
|
-
|
|
20
|
+
calculateStarted$: BehaviorSubject<boolean>;
|
|
21
|
+
constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _lifecycleService: LifecycleService);
|
|
32
22
|
dispose(): void;
|
|
33
23
|
private _ensureCacheMap;
|
|
34
24
|
private _createFormulaId;
|
|
35
25
|
private _initFormulaRegister;
|
|
36
26
|
private _initFormulaCalculationResultChange;
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated Use registerFormulaWithRange instead
|
|
39
|
-
* @param unitId
|
|
40
|
-
* @param subUnitId
|
|
41
|
-
* @param formulaText
|
|
42
|
-
* @param extra
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
registerFormula(unitId: string, subUnitId: string, formulaText: string, extra?: Record<string, any>): string;
|
|
46
27
|
registerFormulaWithRange(unitId: string, subUnitId: string, formulaText: string, ranges?: IRange[], extra?: Record<string, any>): string;
|
|
47
28
|
deleteFormula(unitId: string, subUnitId: string, formulaIdList: string[]): void;
|
|
48
29
|
getFormulaValue(unitId: string, subUnitId: string, formulaId: string): Promise<Nullable<IOtherFormulaResult>>;
|