API Reference
@univerjs
@univerjs/sheets-formula
classes
Updateformulacontroller

@univerjs/sheets-formula v0.4.2Docs


Class: UpdateFormulaController

Update formula process

  1. Command intercepts, converts the command information to adapt refRange, offsets the formula content, and obtains the formula that requires offset content.

  2. Use refRange to offset the formula position and return undo/redo data to setRangeValues mutation

    • Redo data: Delete the old value at the old position on the match, and add the new value at the new position (the new value first checks whether the old position has offset content, if so, use the new offset content, if not, take the old value)
    • Undo data: the old position on the match saves the old value, and the new position delete value. Using undos when undoing will operate the data after the offset position.
  3. onCommandExecuted, before formula calculation, use the setRangeValues information to delete the old formulaData, ArrayFormula and ArrayFormulaCellData, and send the worker (complementary setRangeValues after collaborative conflicts, normal operation triggers formula update, undo/redo are captured and processed here)

Extends

Constructors

new UpdateFormulaController()

new UpdateFormulaController(
   _univerInstanceService, 
   _commandService, 
   _lexerTreeBuilder, 
   _formulaDataModel, 
   _sheetInterceptorService, 
   _definedNamesService, 
   _injector): UpdateFormulaController

Parameters

ParameterType
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService
_lexerTreeBuilderLexerTreeBuilder
_formulaDataModelFormulaDataModel
_sheetInterceptorServiceSheetInterceptorService
_definedNamesServiceIDefinedNamesService
_injectorInjector

Returns

UpdateFormulaController

Overrides

Disposable.constructor

Defined in

packages/sheets-formula/src/controllers/update-formula.controller.ts:84 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedpackages/core/src/shared/lifecycle.ts:93 (opens in a new tab)
_injectorreadonlyInjectorundefined-packages/sheets-formula/src/controllers/update-formula.controller.ts:91 (opens in a new tab)

Methods

dispose()

dispose(): void

Returns

void

Inherited from

Disposable.dispose

Defined in

packages/core/src/shared/lifecycle.ts:106 (opens in a new tab)


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe

Defined in

packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

Disposable.ensureNotDisposed

Defined in

packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.