@univerjssheetsindexclassesSheetinterceptorservice

@univerjs/sheets v0.5.4


Class: SheetInterceptorService

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:82

This class expose methods for sheet features to inject code to sheet underlying logic.

Extends

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
writeCellInterceptorreadonlyInterceptorManager<{ AFTER_CELL_EDIT: IInterceptor<ICellDataForSheetInterceptor, ISheetLocationForEditor>; AFTER_CELL_EDIT_ASYNC: IInterceptor<Promise<Nullable<ICellDataForSheetInterceptor>>, ISheetLocationForEditor>; BEFORE_CELL_EDIT: IInterceptor<ICellDataForSheetInterceptor, ISheetLocationForEditor>; }>undefined-submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:96

Methods

afterCommandExecute()

afterCommandExecute(info): IUndoRedoCommandInfosByInterceptor

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:206

Parameters

ParameterType
infoICommandInfo

Returns

IUndoRedoCommandInfosByInterceptor


beforeCommandExecute()

beforeCommandExecute(info): Promise<boolean>

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:240

before command execute, call this method to get the flag of whether it can be executed the command,

Parameters

ParameterTypeDescription
infoICommandInfoICommandInfo

Returns

Promise<boolean>

Promise


dispose()

dispose(): void

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:148

Returns

void

Overrides

Disposable.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

Disposable.ensureNotDisposed


fetchThroughInterceptors()

fetchThroughInterceptors<T, C>(
   name, 
   effect?, 
   _key?, 
filter?): (initValue, initContext) => Nullable<T>

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:334

Type Parameters

Type Parameter
T
C

Parameters

ParameterType
nameIInterceptor<T, C>
effect?InterceptorEffectEnum
_key?string
filter?(interceptor) => boolean

Returns

Function

Parameters
ParameterType
initValueNullable<T>
initContextC
Returns

Nullable<T>


generateMutationsByRanges()

generateMutationsByRanges(info): IUndoRedoCommandInfosByInterceptor

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:265

Parameters

ParameterType
infoIRangesInfo

Returns

IUndoRedoCommandInfosByInterceptor


intercept()

intercept<T>(name, interceptor): IDisposable

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:298

Type Parameters

Type Parameter
T extends IInterceptor<any, any>

Parameters

ParameterType
nameT
interceptorT

Returns

IDisposable


interceptAfterCommand()

interceptAfterCommand(interceptor): IDisposable

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:195

Parameters

ParameterType
interceptorICommandInterceptor

Returns

IDisposable


interceptBeforeCommand()

interceptBeforeCommand(interceptor): IDisposable

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:224

Add a listener function to a specific command to determine if the command can execute mutations. It should be called in controllers.

Pairs with beforeCommandExecute.

Parameters

ParameterType
interceptorIBeforeCommandInterceptor

Returns

IDisposable


interceptCommand()

interceptCommand(interceptor): IDisposable

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:168

Add a listener function to a specific command to add affiliated mutations. It should be called in controllers.

Pairs with onCommandExecute.

Parameters

ParameterType
interceptorICommandInterceptor

Returns

IDisposable


interceptRanges()

interceptRanges(interceptor): IDisposable

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:254

By adding callbacks to some Ranges can get some additional mutations, such as clearing all plugin data in a certain area.

Parameters

ParameterTypeDescription
interceptorIRangeInterceptorsIRangeInterceptors

Returns

IDisposable

IDisposable


onCommandExecute()

onCommandExecute(info): IUndoRedoCommandInfosByInterceptor

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:184

When command is executing, call this method to gether undo redo mutations from upper features.

Parameters

ParameterType
infoICommandInfo

Returns

IUndoRedoCommandInfosByInterceptor


onWriteCell()

onWriteCell(
   workbook, 
   worksheet, 
   row, 
   col, 
cellData): Promise<Nullable<ICellDataForSheetInterceptor>>

Defined in: submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:280

Parameters

ParameterType
workbookWorkbook
worksheetWorksheet
rownumber
colnumber
cellDataICellData

Returns

Promise<Nullable<ICellDataForSheetInterceptor>>