@univerjs/sheets-formula v0.5.0-beta.1Docs


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, 
   _configService, 
   _injector): UpdateFormulaController

Parameters

ParameterType
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService
_lexerTreeBuilderLexerTreeBuilder
_formulaDataModelFormulaDataModel
_sheetInterceptorServiceSheetInterceptorService
_definedNamesServiceIDefinedNamesService
_configServiceIConfigService
_injectorInjector

Returns

UpdateFormulaController

Overrides

Disposable.constructor

Defined in

submodules/univer/packages/sheets-formula/src/controllers/update-formula.controller.ts:88

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:93
_injectorreadonlyInjectorundefined-submodules/univer/packages/sheets-formula/src/controllers/update-formula.controller.ts:96

Methods

dispose()

dispose(): void

Returns

void

Inherited from

Disposable.dispose

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:106


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:96


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

Disposable.ensureNotDisposed

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:100