@univerjs/sheets-formula 0.4.1 → 0.4.2

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.
@@ -4,6 +4,7 @@ import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
4
4
  * This interface is for the progress bar to display the calculation progress.
5
5
  */
6
6
  export interface ICalculationProgress {
7
+ /** Task that already completed. */
7
8
  done: number;
8
9
  /** The total number of formulas need to calculate. */
9
10
  count: number;
@@ -15,12 +16,20 @@ export declare class TriggerCalculationController extends Disposable {
15
16
  private _executingDirtyData;
16
17
  private _setTimeoutKey;
17
18
  private _startExecutionTime;
18
- private _formulaCalculationDoneCount;
19
- private _arrayFormulaCalculationDoneCount;
19
+ private _totalCalculationTaskCount;
20
+ private _doneCalculationTaskCount;
20
21
  private _executionInProgressParams;
21
22
  private _restartCalculation;
23
+ /**
24
+ * The mark of forced calculation. If a new mutation triggers dirty area calculation during the forced calculation process, forced calculation is still required.
25
+ */
26
+ private _forceCalculating;
22
27
  private readonly _progress$;
23
28
  readonly progress$: import('rxjs').Observable<ICalculationProgress>;
29
+ private _emitProgress;
30
+ private _startProgress;
31
+ private _completeProgress;
32
+ clearProgress(): void;
24
33
  constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService);
25
34
  dispose(): void;
26
35
  private _commandExecutedListener;
@@ -31,18 +40,4 @@ export declare class TriggerCalculationController extends Disposable {
31
40
  private _initialExecuteFormulaProcessListener;
32
41
  private _resetExecutingDirtyData;
33
42
  private _initialExecuteFormula;
34
- /**
35
- * The user manually stops the progress bar
36
- */
37
- private _initialProgressBar;
38
- /**
39
- * Update progress by completed count
40
- * @param completedCount
41
- */
42
- private _pushFormulaTask;
43
- /**
44
- * Update progress by completed count
45
- * @param completedCount
46
- */
47
- private _pushArrayFormulaTask;
48
43
  }
@@ -16,6 +16,7 @@
16
16
  export { type IInsertFunction, type IInsertFunctionCommandParams, InsertFunctionCommand } from './commands/commands/insert-function.command';
17
17
  export { OtherFormulaMarkDirty } from './commands/mutations/formula.mutation';
18
18
  export { UpdateDefinedNameController } from './controllers/update-defined-name.controller';
19
+ export { TriggerCalculationController } from './controllers/trigger-calculation.controller';
19
20
  export { UpdateFormulaController } from './controllers/update-formula.controller';
20
21
  export { DescriptionService, IDescriptionService, type ISearchItem } from './services/description.service';
21
22
  export type { IFormulaInfo, IOtherFormulaResult } from './services/formula-common';
@@ -1,15 +1,23 @@
1
- import { IDisposable, IMutationInfo, Disposable, IUniverInstanceService } from '@univerjs/core';
1
+ import { IDisposable, IMutationInfo, IRange, Disposable, IUniverInstanceService } from '@univerjs/core';
2
+ import { EffectRefRangeParams, RefRangeService } from '@univerjs/sheets';
2
3
  import { LexerTreeBuilder } from '@univerjs/engine-formula';
3
- import { RefRangeService } from '@univerjs/sheets';
4
4
  export type FormulaChangeMap = Record<string, Record<string, Record<string, string>>>;
5
5
  export type FormulaChangeCallback = (formulaString: string) => {
6
6
  redos: IMutationInfo[];
7
7
  undos: IMutationInfo[];
8
8
  };
9
+ export type RangeFormulaChangeCallback = (formulas: {
10
+ formulaString: string;
11
+ ranges: IRange[];
12
+ }[]) => {
13
+ redos: IMutationInfo[];
14
+ undos: IMutationInfo[];
15
+ };
9
16
  export declare class FormulaRefRangeService extends Disposable {
10
17
  private readonly _refRangeService;
11
18
  private readonly _lexerTreeBuilder;
12
19
  private readonly _univerInstanceService;
13
20
  constructor(_refRangeService: RefRangeService, _lexerTreeBuilder: LexerTreeBuilder, _univerInstanceService: IUniverInstanceService);
14
- registerFormula(formula: string, callback: FormulaChangeCallback): IDisposable;
21
+ transformFormulaByEffectCommand(unitId: string, subUnitId: string, formula: string, params: EffectRefRangeParams): string;
22
+ registerFormula(unitId: string, subUnitId: string, formula: string, callback: FormulaChangeCallback): IDisposable;
15
23
  }