FSheetHooksUIMixin

GitHubEdit on GitHub
packages@univerjs/sheets-ui

APIs

onAfterCellEdit

The onAfterCellEdit event is fired after a cell is edited.

Deprecated use univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => \{\}) instead

Signature

onAfterCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable

Parameters

  • callback ((params: IEditorBridgeServiceVisibleParam) => void) — Callback function that will be called when the event is fired

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onAfterCellEdit((params) => { console.log(params) })

onBeforeCellEdit

The onBeforeCellEdit event is fired before a cell is edited.

Deprecated use univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => \{\}) instead

Signature

onBeforeCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable

Parameters

  • callback ((params: IEditorBridgeServiceVisibleParam) => void) — Callback function that will be called when the event is fired

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onBeforeCellEdit((params) => { console.log(params) })

onCellDragOver

The onCellDragOver event is fired when an element or text selection is being dragged into a cell's hit test boundaries.

Deprecated use univerAPI.addEvent(univerAPI.Event.DragOver, (params) => \{\}) instead

Signature

onCellDragOver(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable

Parameters

  • callback ((cellPos: Nullable<IDragCellPosition>) => void) — Callback function that will be called when the event is fired

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onCellDragOver((cellPos) => { console.log(cellPos) })

onCellDrop

The onCellDrop event is fired when an element or text selection is being dropped on the cell.

Deprecated use univerAPI.addEvent(univerAPI.Event.Drop, (params) => \{\}) instead

Signature

onCellDrop(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable

Parameters

  • callback ((cellPos: Nullable<IDragCellPosition>) => void) — Callback function that will be called when the event is fired

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onCellDrop((cellPos) => { console.log(cellPos) })

onCellPointerMove

The onCellPointerMove event is fired when a pointer changes coordinates.

Deprecated use univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => \{\}) instead

Signature

onCellPointerMove(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable

Parameters

  • callback ((cellPos: Nullable<IHoverCellPosition>) => void) — - function that will be called when the event is fired

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onCellPointerMove((cellPos) => { console.log(cellPos) })

onCellPointerOver

The onCellPointerOver event is fired when a pointer is moved into a cell's hit test boundaries.

Deprecated use univerAPI.addEvent(univerAPI.Event.CellHover, (params) => \{\}) instead

Signature

onCellPointerOver(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable

Parameters

  • callback ((cellPos: Nullable<IHoverCellPosition>) => void) — - function that will be called when the event is fired

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onCellPointerOver((cellPos) => { console.log(cellPos) })

onCellRender

The onCellRender event is fired when a cell is rendered.

Signature

onCellRender(customRender: Nullable<ICellCustomRender[]>, effect?: InterceptorEffectEnum = InterceptorEffectEnum.Style, priority?: number = InterceptCellContentPriority.DATA_VALIDATION): IDisposable

Parameters

  • customRender (Nullable<ICellCustomRender[]>) — Custom render function
  • effect (InterceptorEffectEnum) — The effect of the interceptor
  • priority (number) — The priority of the interceptor

Returns

  • (IDisposable) — A disposable object that can be used to unsubscribe from the event

Examples

univerAPI.getSheetHooks().onCellRender([{
  drawWith: (ctx, info) => {
    const { row, col } = info
    // Update to any cell location you want
    if (row === 1 && col === 2) {
      const { primaryWithCoord } = info
      const { startX, startY } = primaryWithCoord
      ctx.fillText('Univer', startX, startY + 10)
    }
  },
}])