@univerjssheetsindexclassesSheetinterceptorservice

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


Class: SheetInterceptorService

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:93
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:89

Methods

beforeCommandExecute()

beforeCommandExecute(info): Promise<boolean>

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

Parameters

ParameterTypeDescription
infoICommandInfo<object>ICommandInfo

Returns

Promise<boolean>

Promise

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:211


dispose()

dispose(): void

Returns

void

Overrides

Disposable.dispose

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:141


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


fetchThroughInterceptors()

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

Type Parameters

Type Parameter
T
C

Parameters

ParameterType
nameIInterceptor<T, C>
effect?InterceptorEffectEnum

Returns

Function

Parameters
ParameterType
initValueNullable<T>
initContextC
Returns

Nullable<T>

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:302


generateMutationsByRanges()

generateMutationsByRanges(info): IUndoRedoCommandInfosByInterceptor

Parameters

ParameterType
infoIRangesInfo

Returns

IUndoRedoCommandInfosByInterceptor

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:236


intercept()

intercept<T>(name, interceptor): IDisposable

Type Parameters

Type Parameter
T extends IInterceptor<any, any>

Parameters

ParameterType
nameT
interceptorT

Returns

IDisposable

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:269


interceptBeforeCommand()

interceptBeforeCommand(interceptor): IDisposable

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

Pairs with beforeCommandExecute.

Parameters

ParameterType
interceptorIBeforeCommandInterceptor

Returns

IDisposable

Defined in

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


interceptCommand()

interceptCommand(interceptor): IDisposable

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

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:159


interceptRanges()

interceptRanges(interceptor): IDisposable

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

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:225


onCommandExecute()

onCommandExecute(info): IUndoRedoCommandInfosByInterceptor

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

Parameters

ParameterType
infoICommandInfo<object>

Returns

IUndoRedoCommandInfosByInterceptor

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:175


onWriteCell()

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

Parameters

ParameterType
workbookWorkbook
worksheetWorksheet
rownumber
colnumber
cellDataICellData

Returns

Promise<Nullable<ICellDataForSheetInterceptor>>

Defined in

submodules/univer/packages/sheets/src/services/sheet-interceptor/sheet-interceptor.service.ts:249