FEventName
Subscribe through univerAPI.addEvent. Its callback receives the payload documented for that event. Keep the returned disposable and release it when the subscriber is removed. Feature events require their plugins and Facade entries to be loaded.
const subscription = univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (event) => { console.log(event)})// Run when the component or subscriber is disposed.subscription.dispose()Set event.cancel = true only for events that support cancellation, as shown in their examples. After-events report completed operations. See addEvent for the subscription signature.
@univerjs-pro/bases
Event.BaseHierarchyChanged
Fired after an atomic hierarchy mutation is applied.
The event covers Facade and UI writes, remote collaboration mutations, Undo/Redo replay, and import mutations that carry hierarchy metadata. One event represents one committed mutation and may contain several Parent-edge changes. It is suitable for notifications, analytics, or SDK-side automation; do not write the same Parent edge again from the handler or an event loop may be created.
Use source to distinguish local SDK work from remote or history replay. The
source values are exposed through univerAPI.Enum.BaseEventSource; integrations
do not need to hard-code strings.
Callback parameters
type EventParameters = { /** Facade object for the Base containing the changed table. */ base: FBase /** Facade object for the table whose effective hierarchy changed. */ table: FBaseTable /** Ordered semantic edge changes committed by the atomic mutation. */ changes: readonly IBaseHierarchyChange[] /** Origin of the applied mutation. Compare with `univerAPI.Enum.BaseEventSource`. */ source: BaseEventSource /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBaseHierarchyChangedEventParams
Example
Trigger automation only for Facade writes
const disposable = univerAPI.addEvent( univerAPI.Event.BaseHierarchyChanged, ({ table, changes, source }) => { if (source !== univerAPI.Enum.BaseEventSource.Facade) return for (const { recordId, oldParentRecordId, parentRecordId } of changes) { console.log({ tableId: table.getId(), recordId, oldParentRecordId, parentRecordId, }) } },)// Call disposable.dispose() when the integration is torn down.Package: @univerjs-pro/bases · Type definitions
Event.BaseTableCellValueChanged
Event fired after a base table cell value is changed
Callback parameters
type EventParameters = { base: FBase table: FBaseTable field: FBaseTableField record: FBaseTableRecord value: CellValue /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBaseTableCellValueChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableCellValueChanged, (params) => { const { base, table, field, record, value } = params console.log('base table cell value changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BaseTableCreated
Event fired after a base table is created
Callback parameters
type EventParameters = { base: FBase table?: ITableSnapshot | undefined index?: number | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBaseTableCreatedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableCreated, (params) => { const { base, table } = params console.log('base table created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BaseTableFieldCreated
Event fired after a base table field is created
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined base: FBase table: FBaseTable field: IFieldSnapshot index?: number | undefined viewIndexes?: Record<string, number> | undefined}Payload type: IBaseTableFieldCreatedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableFieldCreated, (params) => { const { base, table, field } = params console.log('base table field created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BaseTableRecordCreated
Event fired after a base table record is created
Callback parameters
type EventParameters = { base: FBase table: FBaseTable records: IRecordSnapshot[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBaseTableRecordCreatedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableRecordCreated, (params) => { const { base, table, records } = params console.log('base table record created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BaseTableViewCreated
Event fired after a base table view is created
Callback parameters
type EventParameters = { base: FBase table: FBaseTable view: IViewSnapshot<ViewSpecificConfig> index?: number | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBaseTableViewCreatedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableViewCreated, (params) => { const { base, table, view } = params console.log('base table view created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BeforeBaseHierarchyChange
Fired before a local semantic hierarchy command is applied.
Covered writes include addChild(), setParent(), standard record creation
or duplication with an initial Parent value, deleting a parent whose surviving
children would be promoted, a direct Parent-cell update, and multi-record or
range writes touching the canonical Parent field.
Setting cancel = true rejects the complete command, including every Parent
edge, order update, and first-write field materialization in that command. No
partial mutation or Undo entry is produced.
The event is intentionally local: remote collaboration mutations and
Undo/Redo replay have already been accepted and cannot be cancelled here.
Use BaseHierarchyChanged to observe those sources.
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** Facade object for the Base containing the changed table. */ base: FBase /** Facade object for the table whose effective hierarchy changed. */ table: FBaseTable /** Ordered semantic edge changes committed by the atomic mutation. */ changes: readonly IBaseHierarchyChange[] /** Origin of the applied mutation. Compare with `univerAPI.Enum.BaseEventSource`. */ source: BaseEventSource}Payload type: IBeforeBaseHierarchyChangeEventParams
Example
Prevent records from moving below a protected parent
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseHierarchyChange, (event) => { const movesBelowProtectedParent = event.changes.some( ({ parentRecordId }) => parentRecordId === 'protected-task', ) if (movesBelowProtectedParent) { event.cancel = true }})// Call disposable.dispose() when the integration is torn down.Package: @univerjs-pro/bases · Type definitions
Event.BeforeBaseTableCellValueChange
Event fired before a base table cell value is changed
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined base: FBase table: FBaseTable field: FBaseTableField record: FBaseTableRecord value: CellValue}Payload type: IBeforeBaseTableCellValueChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableCellValueChange, (params) => { const { base, table, field, record, value } = params console.log('before base table cell value change', params) // Cancel the base table cell value change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BeforeBaseTableCreate
Event fired before a base table is created
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined base: FBase table?: ITableSnapshot | undefined index?: number | undefined}Payload type: IBeforeBaseTableCreateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableCreate, (params) => { const { base, table } = params console.log('before base create', params) // Cancel the base creation operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BeforeBaseTableFieldCreate
Event fired before a base table field is created
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined base: FBase table: FBaseTable field: IFieldSnapshot index?: number | undefined viewIndexes?: Record<string, number> | undefined}Payload type: IBeforeBaseTableFieldCreateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableFieldCreate, (params) => { const { base, table, field } = params console.log('before base table field create', params) // Cancel the base table field creation operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BeforeBaseTableRecordCreate
Event fired before a base table record is created
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined base: FBase table: FBaseTable records: IRecordSnapshot[]}Payload type: IBeforeBaseTableRecordCreateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableRecordCreate, (params) => { const { base, table, records } = params console.log('before base table record create', params) // Cancel the base table record creation operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
Event.BeforeBaseTableViewCreate
Event fired before a base table view is created
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined base: FBase table: FBaseTable view: IViewSnapshot<ViewSpecificConfig> index?: number | undefined}Payload type: IBeforeBaseTableViewCreateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableViewCreate, (params) => { const { base, table, view } = params console.log('before base table view create', params) // Cancel the base table view creation operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs-pro/bases · Type definitions
@univerjs-pro/collaboration-client
Event.CollaborationStatusChanged
Event triggered when collaboration status changes
Callback parameters
type EventParameters = { /** The unit ID whose collaboration status changed */ unitId: string /** The new collaboration status */ status: CollaborationStatus /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICollaborationStatusChangedEventParams
Example
univerAPI.addEvent(univerAPI.Event.CollaborationStatusChanged, (event) => { const { unitId, status } = event console.log(`Unit ${unitId} status changed to:`, status) if (status === univerAPI.Enum.CollaborationStatus.SYNCED) { console.log('All changes are synced!') }})Package: @univerjs-pro/collaboration-client · Type definitions
@univerjs-pro/shape-editor
Event.FormulaShapeResultChanged
Fired when a Formula Shape calculation or formatted display result changes. Shape geometry and ordinary visual-style updates do not fire this event.
Callback parameters
type EventParameters = { /** Live host-neutral Shape facade. */ shape: FShape /** Stable host and Shape identity. */ shapeRef: IShapeRef /** Newly applied result. */ result: IFormulaShapeResult /** Result visible before this change. */ previousResult: IFormulaShapeResult /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IFormulaShapeResultChangedEventParams
Example
Listen to all Formula Shape result changes
const workbook = univerAPI.getActiveWorkbook()if (!workbook) throw new Error('No active workbook.')const shape = workbook.getActiveSheet().getShape('formula-shape-1')if (!shape?.isFormulaShape()) throw new Error('Formula Shape not found.')const disposable = univerAPI.addEvent( univerAPI.Event.FormulaShapeResultChanged, ({ shape: changedShape, result }) => { if (changedShape.getId() !== shape.getId()) return console.log(changedShape.getFormula(), result.displayText) },)const formula = univerAPI.getFormula()const applied = formula.onCalculationResultApplied(30_000)shape.setFormula({ formula: '=SUM(A1:B10)', externalReferences: [], // Required; empty only because this formula has no external Unit.})await applieddisposable.dispose()Listen to one Formula Shape in the active Board
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board.')const shape = board.getShape('formula-shape-1')if (!shape?.isFormulaShape()) throw new Error('Formula Shape not found.')const disposable = univerAPI.addEvent( univerAPI.Event.FormulaShapeResultChanged, ({ shape: changedShape, result, previousResult }) => { if (changedShape.getId() !== shape.getId()) return console.log(previousResult.displayText, result.displayText) },)shape.setFormulaNumberFormat('$#,##0.00')disposable.dispose()Package: @univerjs-pro/shape-editor · Type definitions
@univerjs-pro/sheets-pivot
Event.BeforePivotTableAdd
The before pivot table add event.The event parameter is IPivotTableAddedEventParams
Callback parameters
type EventParameters = { positionType: PositionType /** The source range info of the pivot table. */ sourceRangeInfo: { startRow: number endRow: number startColumn: number endColumn: number unitId: string subUnitId: string sheetName?: string | undefined } /** The target cell info of the pivot table.Only the PositionType is 'exiting' will have this property. */ targetCellInfo?: | { row: number column: number unitId: string subUnitId: string sheetName?: string | undefined } | undefined /** The pivot table id.When create a pivot table, the id maybe undefined. */ pivotTableId: string | undefined /** The unit id of workbook which the pivot table belongs to. */ unitId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
univerAPI.addEvent(univerAPI.Event.BeforePivotTableAdd, (params) => { const { positionType, targetCellInfo } = params if ( positionType === univerAPI.Enum.PositionTypeEnum.Existing && targetCellInfo.sheetName === 'Sheet 1' ) { params.cancel = true console.log(`The pivot table can't be added to the sheet ${targetCellInfo.sheetName}`) }})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableAdded
The pivot table added event.The event parameter is IPivotTableAddedEventParams
Callback parameters
type EventParameters = { positionType: PositionType /** The source range info of the pivot table. */ sourceRangeInfo: { startRow: number endRow: number startColumn: number endColumn: number unitId: string subUnitId: string sheetName?: string | undefined } /** The target cell info of the pivot table.Only the PositionType is 'exiting' will have this property. */ targetCellInfo?: | { row: number column: number unitId: string subUnitId: string sheetName?: string | undefined } | undefined /** The pivot table id.When create a pivot table, the id maybe undefined. */ pivotTableId: string | undefined /** The unit id of workbook which the pivot table belongs to. */ unitId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
univerAPI.addEvent(univerAPI.Event.PivotTableAdded, (params) => { const { positionType, targetCellInfo } = params if (positionType === univerAPI.Enum.PositionTypeEnum.Existing) { console.log('A pivot table created in an existing sheet') console.log(` The target sheet name is ${targetCellInfo.sheetName}, the target row is ${targetCellInfo.row}, the target column is ${targetCellInfo.column} `) } else { console.log('A pivot table created in a new sheet') }})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldAdded
The pivot table field added event. The event parameter is IAddPivotFieldCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotTableId: string dataFieldId: string fieldArea: PivotTableFiledAreaEnum index: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldAdded, (params) => { const { pivotTableId, fieldId, fieldArea, fieldIndex } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting('fieldId') console.log(fieldSetting)})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldCollapseChanged
The pivot table field collapse changed event. The event parameter is ISetPivotCollapseCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string row: number col: number collapse: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldCollapseChanged, (params) => { const { pivotTableId, fieldId, isCollapsed } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting(fieldId) console.log( `The source name ${fieldSetting.sourceName} the display name ${fieldSetting.displayName}`, )})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldFilterChanged
The pivot table field filter changed event. The event parameter is ISetPivotFilterCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotTableId: string tableFieldId: string items: string[] isAll?: boolean | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldFilterChanged, (params) => { const { pivotTableId, fieldId, filter } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting(fieldId) console.log(`The Checklist filter value is ${fieldSetting.filterInfo.checklist}`)})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldMoved
The pivot table field moved event. The event parameter is IMovePivotFieldCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotTableId: string fieldId: string area: PivotTableFiledAreaEnum index: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldMoved, (params) => { const { pivotTableId, fieldId, fieldArea, fieldIndex } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting(fieldId) console.log( `The source name ${fieldSetting.sourceName} the display name ${fieldSetting.displayName}`, )})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldRemoved
The pivot table field removed event. The event parameter is IRemovePivotFieldCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotTableId: string fieldIds: string[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldRemoved, (params) => { const { pivotTableId, fieldId } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting(fieldId) console.log(fieldSetting)})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldSettingChanged
The pivot table field setting changed event. The event parameter is IUpdatePivotFieldSettingCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string tableFieldId: string pivotTableId: string displayName?: string | undefined format?: string | undefined subtotalType?: PivotSubtotalTypeEnum | undefined showDataAs?: IPivotTableShowDataAsInfo | undefined tableFieldInfo: IPivotPanelTableListItemBase dataFieldInfo: IPivotPanelSourceList /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldSettingChanged, (params) => { const { pivotTableId, tableFieldId, showDataAs } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting(tableFieldId) console.log(fieldSetting, showDataAs)})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableFieldSortChanged
The pivot table field sort changed event. The event parameter is ISetPivotSortCommandParams
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotTableId: string tableFieldId: string info?: IPivotTableSortInfo | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableFieldSortChanged, (params) => { const { pivotTableId, fieldId, sort } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const fieldSetting = pivotTable.getFieldSetting(fieldId) console.log(`The sort info is ${fieldSetting.sortInfo}`)})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableMoved
The pivot table moved event. The event parameter is IPivotTableMovedEventParams
Callback parameters
type EventParameters = { originTargetInfo: { subUnitId: string; unitId: string; row: number; column: number } targetCellInfo: { row: number; column: number; unitId: string; subUnitId: string } /** The pivot table id.When create a pivot table, the id maybe undefined. */ pivotTableId: string | undefined /** The unit id of workbook which the pivot table belongs to. */ unitId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
univerAPI.addEvent(univerAPI.Event.PivotTableMoved, (params) => { const { pivotTableId, targetCellInfo, originTargetInfo } = params if (pivotTableId === 'pivotTable1') { console.log(` The pivot table moved from row: ${originTargetInfo.row} & column: ${originTargetInfo.column} to the sheet ${targetCellInfo.sheetName} row: ${targetCellInfo.row} & column: ${targetCellInfo.column} `) }})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableRemoved
The pivot table removed event. The event parameter is IPivotTableRemovedEventParams
Callback parameters
type EventParameters = { /** The pivot table id.When create a pivot table, the id maybe undefined. */ pivotTableId: string | undefined /** The unit id of workbook which the pivot table belongs to. */ unitId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
univerAPI.addEvent(univerAPI.Event.PivotTableRemoved, (params) => { const { pivotTableId } = params console.log(`The pivot table ${pivotTableId} has been removed`)})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableRendered
The pivot table calculated done and fill the value to worksheet, the event parameter is IPivotTableRenderedEventParams
Callback parameters
type EventParameters = { isEmpty: boolean subUnitId: string changeType: PivotTableOperationEnum rangeInfo?: | { rowRanges: IRange[] colRanges: IRange[] cornerRanges: IRange[] dataRanges: IRange[] pageRanges: IRange[] } | undefined /** The pivot table id.When create a pivot table, the id maybe undefined. */ pivotTableId: string | undefined /** The unit id of workbook which the pivot table belongs to. */ unitId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
// import { unionPivotViewRange } from '@univerjs-pro/sheets-pivot';univerAPI.addEvent(univerAPI.Event.PivotTableRendered, (params) => { const { pivotTableId, rangeInfo } = params console.log(`The pivot table ${pivotTableId} has been rendered`) if (rangeInfo) { console.log(unionPivotViewRange(rangeInfo)) }})Package: @univerjs-pro/sheets-pivot · Type definitions
Event.PivotTableValuePositionChanged
The pivot table value position changed event. The event parameter is IUpdatePivotValuePositionCommandParams
Callback parameters
type EventParameters = { unitId?: string | undefined subUnitId?: string | undefined pivotTableId: string position: PivotTableValuePositionEnum index: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Example
const fWorkbook = univerAPI.getActiveWorkbook()univerAPI.addEvent(univerAPI.Event.PivotTableValuePositionChanged, (params) => { const { pivotTableId, valueId, position } = params const pivotTable = fWorkbook.getPivotTableById(pivotTableId) const valueSetting = pivotTable.getValueSetting(valueId) console.log( `The source name ${valueSetting.sourceName} the display name ${valueSetting.displayName}`, )})Package: @univerjs-pro/sheets-pivot · Type definitions
@univerjs-pro/sheets-pivot-chart
Event.PivotChartAdded
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotChartId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IPivotChartEventParams
Package: @univerjs-pro/sheets-pivot-chart · Type definitions
Event.PivotChartChanged
Callback parameters
type EventParameters = { /** Identifies whether the persisted definition or Sheet Drawing changed. */ kind: 'definition' | 'drawing' /** Present when {@link kind} is `definition`. */ change?: ISheetsPivotChartModelChange | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined unitId: string subUnitId: string pivotChartId: string}Payload type: IPivotChartChangedEventParams
Package: @univerjs-pro/sheets-pivot-chart · Type definitions
Event.PivotChartDataStateChanged
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined state: IPivotChartRuntimeState unitId: string subUnitId: string pivotChartId: string}Payload type: IPivotChartDataStateChangedEventParams
Package: @univerjs-pro/sheets-pivot-chart · Type definitions
Event.PivotChartRemoved
Callback parameters
type EventParameters = { unitId: string subUnitId: string pivotChartId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IPivotChartEventParams
Package: @univerjs-pro/sheets-pivot-chart · Type definitions
Event.PivotChartRendered
Callback parameters
type EventParameters = { result: IPivotChartCalculationResult /** Flag to cancel the event if supported */ cancel?: boolean | undefined unitId: string subUnitId: string pivotChartId: string}Payload type: IPivotChartRenderedEventParams
Package: @univerjs-pro/sheets-pivot-chart · Type definitions
@univerjs-pro/sheets-print
Event.BeforeSheetPrintCanceled
Event triggered before print operation is canceled
Callback parameters
type EventParameters = { /** The layout configuration being canceled */ layoutConfig: ISheetPrintLayoutConfig /** The render configuration being canceled */ renderConfig: ISheetPrintRenderConfig /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetPrintCancelEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetPrintCanceled, (params) => { const { renderConfig, layoutConfig } = params console.log('params', params) // Cancel the print cancel operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-print · Type definitions
Event.BeforeSheetPrintConfirm
Event triggered before print settings are confirmed
Callback parameters
type EventParameters = { /** The layout configuration to be applied */ layoutConfig: ISheetPrintLayoutConfig /** The render configuration to be applied */ renderConfig: ISheetPrintRenderConfig /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetPrintConfirmEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetPrintConfirm, (params) => { const { renderConfig, layoutConfig } = params console.log('params', params) // Cancel the print confirmation operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-print · Type definitions
Event.BeforeSheetPrintOpen
Event triggered before print dialog opens
Callback parameters
type EventParameters = { /** The workbook instance being printed */ workbook: FWorkbook /** The specific worksheet being printed */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetPrintOpenEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetPrintOpen, (params) => { const { workbook, worksheet } = params console.log('params', params) // Cancel open print configuration dialog operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-print · Type definitions
Event.SheetPrintCanceled
Event triggered when print operation is canceled
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The layout configuration at time of cancellation */ layoutConfig: ISheetPrintLayoutConfig /** The render configuration at time of cancellation */ renderConfig: ISheetPrintRenderConfig}Payload type: ISheetPrintCanceledEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetPrintCanceled, (params) => { const { renderConfig, layoutConfig } = params console.log('params', params)})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-print · Type definitions
Event.SheetPrintConfirmed
Event triggered when print settings are confirmed
Callback parameters
type EventParameters = { /** The final layout configuration for printing */ layoutConfig: ISheetPrintLayoutConfig /** The final render configuration for printing */ renderConfig: ISheetPrintRenderConfig /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetPrintConfirmedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetPrintConfirmed, (params) => { const { renderConfig, layoutConfig } = params console.log('params', params)})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-print · Type definitions
Event.SheetPrintOpen
Event triggered when print dialog opens
Callback parameters
type EventParameters = { /** The workbook instance being printed */ workbook: FWorkbook /** The specific worksheet being printed */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetPrintOpenEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetPrintOpen, (params) => { const { workbook, worksheet } = params console.log('params', params)})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-print · Type definitions
@univerjs-pro/sheets-sparkline
Event.SheetSparklineChanged
Trigger this event after the sparkline changes.
Type of the event parameter is IFSheetSparklineChangedEventParams
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet /** The sparkline array that have been changed. {@link ISparklineGroup} */ sparklines: ISparklineGroup[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IFSheetSparklineChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetSparklineChanged, (params) => { console.log('SheetSparklineChanged', params) const { workbook, worksheet, sparklines } = params})// Remove the event listener, use `disposable.dispose()`.Package: @univerjs-pro/sheets-sparkline · Type definitions
@univerjs/core
Event.BeforeCommandExecute
Event fired before a command is executed
Callback parameters
type EventParameters = { /** Parameters passed to the command */ params: any /** Unique identifier of the command */ id: string /** Type of the command */ type: CommandType /** optional execution options for the command */ options?: IExecutionOptions | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICommandEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => { const { params, id, type, options } = event console.log('before command executed', event) // Cancel the command execution event.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.BeforeRedo
Event fired before a redo command is executed
Callback parameters
type EventParameters = { /** Parameters passed to the command */ params: any /** Unique identifier of the command */ id: string /** Type of the command */ type: CommandType /** optional execution options for the command */ options?: IExecutionOptions | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICommandEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => { const { params, id, type } = event console.log('before redo command executed', event) // Cancel the redo operation event.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.BeforeUndo
Event fired before an undo command is executed
Callback parameters
type EventParameters = { /** Parameters passed to the command */ params: any /** Unique identifier of the command */ id: string /** Type of the command */ type: CommandType /** optional execution options for the command */ options?: IExecutionOptions | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICommandEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => { const { params, id, type } = event console.log('before undo command executed', event) // Cancel the undo operation event.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.CommandExecuted
Event fired when a command is executed
Callback parameters
type EventParameters = { /** Parameters passed to the command */ params: any /** Unique identifier of the command */ id: string /** Type of the command */ type: CommandType /** optional execution options for the command */ options?: IExecutionOptions | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICommandEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => { const { params, id, type, options } = event console.log('command executed', event)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.DocCreated
Event fired when a document is created
Callback parameters
type EventParameters = { /** Unique identifier of the document unit */ unitId: string /** Type identifier for document instances */ type: UniverType.UNIVER_DOC /** The created document instance */ doc: FDoc /** Reference to the document unit */ unit: FDoc /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IDocCreatedParam
Example
const disposable = univerAPI.addEvent(univerAPI.Event.DocCreated, (params) => { const { unitId, type, doc, unit } = params console.log('doc created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.DocDisposed
Event fired when a document is disposed
Callback parameters
type EventParameters = { /** Unique identifier of the disposed document unit */ unitId: string /** Type identifier for document instances */ unitType: UniverType.UNIVER_DOC /** Final state snapshot of the disposed document */ snapshot: IDocumentData /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IDocDisposedEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.DocDisposed, (params) => { const { unitId, unitType, snapshot } = params console.log('doc disposed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.LifeCycleChanged
Event fired when life cycle is changed
Callback parameters
type EventParameters = { /** Current stage of the lifecycle */ stage: LifecycleStages /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ILifeCycleChangedEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => { const { stage } = params console.log('life cycle changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.Redo
Event fired when a redo command is executed
Callback parameters
type EventParameters = { /** Parameters passed to the command */ params: any /** Unique identifier of the command */ id: string /** Type of the command */ type: CommandType /** optional execution options for the command */ options?: IExecutionOptions | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICommandEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.Redo, (event) => { const { params, id, type } = event console.log('redo command executed', event)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
Event.Undo
Event fired when an undo command is executed
Callback parameters
type EventParameters = { /** Parameters passed to the command */ params: any /** Unique identifier of the command */ id: string /** Type of the command */ type: CommandType /** optional execution options for the command */ options?: IExecutionOptions | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICommandEvent
Example
const disposable = univerAPI.addEvent(univerAPI.Event.Undo, (event) => { const { params, id, type } = event console.log('undo command executed', event)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/core · Type definitions
@univerjs/sheets
Event.ActiveSheetChanged
Event fired after the active sheet changes
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet that has become active */ activeSheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IActiveSheetChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ActiveSheetChanged, (params) => { const { workbook, activeSheet } = params console.log('after active sheet changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeActiveSheetChange
Event fired before the active sheet changes
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet that will become active */ activeSheet: FWorksheet /** The currently active worksheet */ oldActiveSheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeActiveSheetChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeActiveSheetChange, (params) => { const { workbook, activeSheet, oldActiveSheet } = params console.log('before active sheet change', params) // Cancel the active sheet change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeGridlineColorChange
Event fired before gridline color changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet where gridline color will change */ worksheet: FWorksheet /** The new color to be applied, undefined to use default color */ color: string | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeGridlineColorChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeGridlineColorChange, (params) => { const { workbook, worksheet, color } = params console.log('before gridline color change', params) // Cancel the gridline color change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeGridlineEnableChange
Event fired before gridline enable changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet where gridline state will change */ worksheet: FWorksheet /** The new enabled state to be applied */ enabled: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeGridlineEnableChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeGridlineEnableChange, (params) => { const { workbook, worksheet, enabled } = params console.log('before gridline enable change', params) // Cancel the gridline enable change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeSheetCreate
Event fired before a sheet is created
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** Optional index where the new sheet will be inserted */ index?: number | undefined /** Optional initial worksheet data */ sheet?: IWorksheetData | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetCreateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetCreate, (params) => { const { workbook, index, sheet } = params console.log('before sheet create', params) // Cancel the sheet creation operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeSheetDelete
Event fired before a sheet is deleted
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet that will be deleted */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetDelete, (params) => { const { workbook, worksheet } = params console.log('before sheet delete', params) // Cancel the sheet deletion operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeSheetHideChange
Event fired before a sheet is hidden
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet whose visibility will be changed */ worksheet: FWorksheet /** The new visibility state to be applied */ hidden: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetHideChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetHideChange, (params) => { const { workbook, worksheet, hidden } = params console.log('before sheet hide change', params) // Cancel the sheet hide operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeSheetMove
Event fired before a sheet is moved
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet that will be moved */ worksheet: FWorksheet /** The target position index for the sheet */ newIndex: number /** The current position index of the sheet */ oldIndex: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetMoveEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetMove, (params) => { const { workbook, worksheet, newIndex, oldIndex } = params console.log('before sheet move', params) // Cancel the sheet move operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeSheetNameChange
Event fired before a sheet name is changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet whose name will be changed */ worksheet: FWorksheet /** The new name to be applied */ newName: string /** The current name of the sheet */ oldName: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetNameChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNameChange, (params) => { const { workbook, worksheet, newName, oldName } = params console.log('before sheet name change', params) // Cancel the sheet name change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.BeforeSheetTabColorChange
Event fired before a sheet tab color is changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet whose tab color will be changed */ worksheet: FWorksheet /** The new color to be applied */ newColor: string | undefined /** The current color of the sheet tab */ oldColor: string | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetTabColorChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetTabColorChange, (params) => { const { workbook, worksheet, newColor, oldColor } = params console.log('before sheet tab color change', params) // Cancel the sheet tab color change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.GridlineChanged
Event fired when gridline changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet where gridline changes occurred */ worksheet: FWorksheet /** Flag indicating whether gridlines are enabled or disabled */ enabled: boolean /** The color of the gridlines, undefined if using default color */ color: string | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IGridlineChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.GridlineChanged, (params) => { const { workbook, worksheet, enabled, color } = params console.log('gridline changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetCreated
Event fired after a sheet is created
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The newly created worksheet */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetCreatedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetCreated, (params) => { const { workbook, worksheet } = params console.log('sheet created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetDeleted
Event fired after a sheet is deleted
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet that was deleted */ sheetId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetDeletedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetDeleted, (params) => { const { workbook, sheetId } = params console.log('sheet deleted', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetHideChanged
Event fired after a sheet is hidden
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet whose visibility was changed */ worksheet: FWorksheet /** The new visibility state */ hidden: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetHideChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetHideChanged, (params) => { const { workbook, worksheet, hidden } = params console.log('sheet hide changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetMoved
Event fired after a sheet is moved
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet that was moved */ worksheet: FWorksheet /** The new position index of the sheet */ newIndex: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetMovedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetMoved, (params) => { const { workbook, worksheet, newIndex } = params console.log('sheet moved', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetNameChanged
Event fired after a sheet name is changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet whose name was changed */ worksheet: FWorksheet /** The new name of the sheet */ newName: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetNameChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetNameChanged, (params) => { const { workbook, worksheet, newName } = params console.log('sheet name changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetTabColorChanged
Event fired after a sheet tab color is changed
Callback parameters
type EventParameters = { /** The workbook instance containing the worksheet */ workbook: FWorkbook /** The worksheet whose tab color was changed */ worksheet: FWorksheet /** The new color of the sheet tab */ newColor: string | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetTabColorChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetTabColorChanged, (params) => { const { workbook, worksheet, newColor } = params console.log('sheet tab color changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.SheetValueChanged
Event fired when sheet value changed
Callback parameters
type EventParameters = { /** The affected ranges of the sheet */ effectedRanges: FRange[] /** The payload of the value change */ payload: CommandListenerValueChange /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetValueChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => { const { effectedRanges, payload } = params console.log('sheet value changed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.WorkbookCreated
Event fired after a workbook is created
Callback parameters
type EventParameters = { /** Unique identifier for the workbook unit */ unitId: string /** Type identifier specifying this is a sheet instance */ type: UniverType.UNIVER_SHEET /** The workbook instance being created */ workbook: FWorkbook /** The workbook unit reference */ unit: FWorkbook /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IWorkbookCreateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.WorkbookCreated, (params) => { const { unitId, type, workbook, unit } = params console.log('workbook created', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
Event.WorkbookDisposed
Event fired after a workbook is disposed
Callback parameters
type EventParameters = { /** Unique identifier of the disposed workbook unit */ unitId: string /** Type identifier specifying this was a sheet instance */ unitType: UniverType.UNIVER_SHEET /** Snapshot data of the workbook at the time of disposal */ snapshot: IWorkbookData /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IWorkbookDisposedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.WorkbookDisposed, (params) => { const { unitId, unitType, snapshot } = params console.log('workbook disposed', params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets · Type definitions
@univerjs/sheets-crosshair-highlight
Event.CrosshairHighlightEnabledChanged
Triggered when the crosshair highlight is enabled or disabled.
Callback parameters
type EventParameters = { /** Whether the crosshair highlight is enabled. */ enabled: boolean /** The workbook that the crosshair highlight is enabled in. */ workbook: FWorkbook /** The worksheet that the crosshair highlight is enabled in. */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ICrosshairHighlightEnabledChangedEventParams
Example
const disposable = univerAPI.addEvent( univerAPI.Event.CrosshairHighlightEnabledChanged, (params) => { const { enabled, workbook, worksheet } = params console.log(params) },)// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-crosshair-highlight · Type definitions
@univerjs/sheets-data-validation
Event.BeforeSheetDataValidationAdd
Event fired before a rule is added
Callback parameters
type EventParameters = { /** The worksheet to add the validation to */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** The validation rule to be added */ rule: ISheetDataValidationRule /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDataValidationAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetDataValidationAdd, (params) => { const { worksheet, workbook, rule } = params console.log(params) // Cancel the data validation rule addition operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.BeforeSheetDataValidationCriteriaUpdate
Event fired before the criteria of a rule are updated
Callback parameters
type EventParameters = { /** The worksheet containing the validation */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Unique identifier of the rule to be updated */ ruleId: string /** The current validation rule */ rule: FDataValidation /** The new criteria to be applied */ newCriteria: IDataValidationRuleBase /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDataValidationCriteriaUpdateEventParams
Example
const disposable = univerAPI.addEvent( univerAPI.Event.BeforeSheetDataValidationCriteriaUpdate, (params) => { const { worksheet, workbook, ruleId, rule, newCriteria } = params console.log(params) // Cancel the data validation rule criteria update operation params.cancel = true },)// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.BeforeSheetDataValidationDelete
Event fired before a rule is deleted
Callback parameters
type EventParameters = { /** The worksheet containing the validation */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Unique identifier of the rule to be deleted */ ruleId: string /** The validation rule to be deleted */ rule: FDataValidation /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDataValidationDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetDataValidationDelete, (params) => { const { worksheet, workbook, ruleId, rule } = params console.log(params) // Cancel the data validation rule deletion operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.BeforeSheetDataValidationDeleteAll
Event fired before all rules are deleted
Callback parameters
type EventParameters = { /** The worksheet containing the validations */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Array of all validation rules to be deleted */ rules: FDataValidation[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDataValidationDeleteAllEventParams
Example
const disposable = univerAPI.addEvent( univerAPI.Event.BeforeSheetDataValidationDeleteAll, (params) => { const { worksheet, workbook, rules } = params console.log(params) // Cancel the data validation rule deletion operation params.cancel = true },)// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.BeforeSheetDataValidationOptionsUpdate
Event fired before the options of a rule are updated
Callback parameters
type EventParameters = { /** The worksheet containing the validation */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Unique identifier of the rule to be updated */ ruleId: string /** The current validation rule */ rule: FDataValidation /** The new options to be applied */ newOptions: IDataValidationRuleOptions /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDataValidationOptionsUpdateEventParams
Example
const disposable = univerAPI.addEvent( univerAPI.Event.BeforeSheetDataValidationOptionsUpdate, (params) => { const { worksheet, workbook, ruleId, rule, newOptions } = params console.log(params) // Cancel the data validation rule options update operation params.cancel = true },)// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.BeforeSheetDataValidationRangeUpdate
Event fired before the range of a rule is updated
Callback parameters
type EventParameters = { /** The worksheet containing the validation */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Unique identifier of the rule to be updated */ ruleId: string /** The current validation rule */ rule: FDataValidation /** The new ranges to be applied */ newRanges: IRange[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetDataValidationRangeUpdateEventParams
Example
const disposable = univerAPI.addEvent( univerAPI.Event.BeforeSheetDataValidationRangeUpdate, (params) => { const { worksheet, workbook, ruleId, rule, newRanges } = params console.log(params) // Cancel the data validation rule range update operation params.cancel = true },)// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.SheetDataValidationChanged
Event fired when a rule is added, deleted, or modified
Callback parameters
type EventParameters = { /** The source of the rule change */ origin: IRuleChange /** The worksheet containing the validation rule */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Type of change made to the validation rule */ changeType: DataValidationChangeType /** The previous validation rule, if it exists */ oldRule?: IDataValidationRule | undefined /** The new or modified validation rule */ rule: FDataValidation /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetDataValidationChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetDataValidationChanged, (params) => { const { origin, worksheet, workbook, changeType, oldRule, rule } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
Event.SheetDataValidatorStatusChanged
Event fired when a cell validator status is changed
Callback parameters
type EventParameters = { /** The worksheet containing the validation */ worksheet: FWorksheet /** The workbook instance */ workbook: FWorkbook /** Row index of the validated cell */ row: number /** Column index of the validated cell */ column: number /** Current validation status */ status: DataValidationStatus /** The validation rule that was checked */ rule: FDataValidation /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetDataValidatorStatusChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetDataValidatorStatusChanged, (params) => { const { worksheet, workbook, row, column, status, rule } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-data-validation · Type definitions
@univerjs/sheets-drawing
Event.BeforeOverGridImageChange
Triggered before floating image change.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of parameters of the images to be updated, there may be multiple images to be updated. {@link IBeforeOverGridImageChangeParamObject} */ images: IBeforeOverGridImageChangeParamObject[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeOverGridImageChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageChange, (params) => { console.log(params) // do something const { workbook, images } = params // Cancel the image change params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.BeforeOverGridImageInsert
Triggered before floating image insertion.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of parameters of the images to be inserted. {@link ISheetImage} */ insertImageParams: ISheetImage[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeOverGridImageInsertEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageInsert, (params) => { console.log(params) // do something const { workbook, insertImageParams } = params // Cancel the insertion operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.BeforeOverGridImageRemove
Triggered before floating image removal.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of instances of the images to be removed. {@link FOverGridImage} */ images: FOverGridImage[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeOverGridImageRemoveEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageRemove, (params) => { console.log(params) // do something const { workbook, images } = params // Cancel the removal operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.BeforeOverGridImageSelect
Triggered before floating image selection.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The images before selection. {@link FOverGridImage} */ oldSelectedImages: FOverGridImage[] selectedImages: FOverGridImage[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeOverGridImageSelectEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeOverGridImageSelect, (params) => { console.log(params) // do something const { workbook, selectedImages, oldSelectedImages } = params // cancel the selection operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.OverGridImageChanged
Triggered after floating image change.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Instances of the images after the update. {@link FOverGridImage} */ images: FOverGridImage[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IOverGridImageChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.OverGridImageChanged, (params) => { console.log(params) // do something const { workbook, images } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.OverGridImageInserted
Triggered after floating image insertion.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of instances of the images after insertion. {@link FOverGridImage} */ images: FOverGridImage[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IOverGridImageInsertedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.OverGridImageInserted, (params) => { console.log(params) // do something const { workbook, images } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.OverGridImageRemoved
Triggered after floating image removal.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of parameters of the images after removal. {@link ISheetImage} */ removeImageParams: IDrawingSearch[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IOverGridImageRemovedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.OverGridImageRemoved, (params) => { console.log(params) // do something const { workbook, removeImageParams } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
Event.OverGridImageSelected
Triggered after floating image selection.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The selected images. {@link FOverGridImage} */ selectedImages: FOverGridImage[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IOverGridImageSelectedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.OverGridImageSelected, (params) => { console.log(params) // do something const { workbook, selectedImages } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing · Type definitions
@univerjs/sheets-drawing-ui
Event.BeforeFloatDomAdd
Triggered before float dom insertion.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of float dom drawings to be added. */ drawings: ISheetFloatDom[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeFloatDomAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeFloatDomAdd, (params) => { console.log(params) // do something const { workbook, drawings } = params // Cancel the insertion operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing-ui · Type definitions
Event.BeforeFloatDomDelete
Triggered before float dom deletion.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of float dom drawings to be deleted. */ drawings: ISheetFloatDom[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeFloatDomDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeFloatDomDelete, (params) => { console.log(params) // do something const { workbook, drawings } = params // Cancel the deletion operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing-ui · Type definitions
Event.BeforeFloatDomUpdate
Triggered before float dom update.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of float dom drawings to be updated. */ drawings: ISheetFloatDom[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeFloatDomUpdateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeFloatDomUpdate, (params) => { console.log(params) // do something const { workbook, drawings } = params // Cancel the update operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing-ui · Type definitions
Event.FloatDomAdded
Triggered after float dom insertion.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of float dom drawings that were added. */ drawings: ISheetFloatDom[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IFloatDomAddedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.FloatDomAdded, (params) => { console.log(params) // do something const { workbook, drawings } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing-ui · Type definitions
Event.FloatDomDeleted
Triggered after float dom deletion.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of float dom drawing ids that were deleted. */ drawings: string[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IFloatDomDeletedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.FloatDomDeleted, (params) => { console.log(params) // do something const { workbook, drawings } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing-ui · Type definitions
Event.FloatDomUpdated
Triggered after float dom update.
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** Collection of float dom drawings that were updated. */ drawings: ISheetFloatDom[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IFloatDomUpdatedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.FloatDomUpdated, (params) => { console.log(params) // do something const { workbook, drawings } = params})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-drawing-ui · Type definitions
@univerjs/sheets-filter
Event.SheetBeforeRangeFilter
This event will be emitted before the filter criteria on a column is changed.
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined workbook: FWorkbook worksheet: FWorksheet col: number criteria: Nullable<IFilterColumn>}Payload type: ISheetsRangeFilteredEventParams
Example
const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeFilter, (params) => { console.log(params) const { workbook, worksheet, col, criteria } = params // your custom logic // Cancel the filter criteria change operation params.cancel = true})// Remove the event listener, use `callbackDisposable.dispose()`Package: @univerjs/sheets-filter · Type definitions
Event.SheetBeforeRangeFilterClear
This event will be emitted after the filter on a worksheet is cleared.
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetsRangeFilterClearedEventParams
Example
const callbackDisposable = univerAPI.addEvent( univerAPI.Event.SheetBeforeRangeFilterClear, (params) => { console.log(params) const { workbook, worksheet } = params // your custom logic // Cancel the filter clear operation params.cancel = true },)// Remove the event listener, use `callbackDisposable.dispose()`Package: @univerjs/sheets-filter · Type definitions
Event.SheetRangeFilterCleared
This event will be emitted when the filter on a worksheet is cleared.
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetsRangeFilterClearedEventParams
Example
const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeFilterCleared, (params) => { console.log(params) const { workbook, worksheet } = params // your custom logic})// Remove the event listener, use `callbackDisposable.dispose()`Package: @univerjs/sheets-filter · Type definitions
Event.SheetRangeFiltered
This event will be emitted when the filter criteria on a column is changed.
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined workbook: FWorkbook worksheet: FWorksheet col: number criteria: Nullable<IFilterColumn>}Payload type: ISheetsRangeFilteredEventParams
Example
const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeFiltered, (params) => { console.log(params) const { workbook, worksheet, col, criteria } = params // your custom logic})// Remove the event listener, use `callbackDisposable.dispose()`Package: @univerjs/sheets-filter · Type definitions
@univerjs/sheets-hyper-link
Event.BeforeSheetLinkAdd
Event triggered before adding a link
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet where the link will be added */ worksheet: FWorksheet /** The row index of the target cell */ row: number /** The column index of the target cell */ col: number /** The hyperlink information to be added */ link: ISheetHyperLink /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetLinkAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetLinkAdd, (params) => { const { workbook, worksheet, row, col, link } = params console.log('before sheet link add', params) // Cancel the sheet link add operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-hyper-link · Type definitions
Event.BeforeSheetLinkCancel
Event triggered before canceling a link
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the link */ worksheet: FWorksheet /** The row index of the cell */ row: number /** The column index of the cell */ column: number /** The unique identifier of the hyperlink */ id: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetLinkCancelEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetLinkCancel, (params) => { const { workbook, worksheet, row, column, id } = params console.log('before sheet link cancel', params) // Cancel the sheet link cancel operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-hyper-link · Type definitions
Event.BeforeSheetLinkUpdate
Event triggered before updating a link
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the link */ worksheet: FWorksheet /** The row index of the cell */ row: number /** The column index of the cell */ column: number /** The unique identifier of the hyperlink */ id: string /** The new hyperlink content/information */ payload: ICellLinkContent /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetLinkUpdateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetLinkUpdate, (params) => { const { workbook, worksheet, row, column, id, payload } = params console.log('before sheet link update', params) // Cancel the sheet link update operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-hyper-link · Type definitions
@univerjs/sheets-note
Event.BeforeSheetNoteAdd
Event fired before a note is added
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number note: ISheetNote cancel?: boolean | undefined}Payload type: ISheetNoteAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteAdd, (params) => { const { workbook, worksheet, row, col, note } = params console.log(params) // Cancel the note addition operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.BeforeSheetNoteDelete
Event fired before a note is deleted
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number oldNote: ISheetNote cancel?: boolean | undefined}Payload type: ISheetNoteDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteDelete, (params) => { const { workbook, worksheet, row, col, oldNote } = params console.log(params) // Cancel the note deletion operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.BeforeSheetNoteHide
Event fired before a note is hidden
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number cancel?: boolean | undefined}Payload type: ISheetNoteHideEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteHide, (params) => { const { workbook, worksheet, row, col } = params console.log(params) // Cancel the note hide operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.BeforeSheetNoteShow
Event fired before a note is shown
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number cancel?: boolean | undefined}Payload type: ISheetNoteShowEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteShow, (params) => { const { workbook, worksheet, row, col } = params console.log(params) // Cancel the note show operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.BeforeSheetNoteUpdate
Event fired before a note is updated
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number note: ISheetNote oldNote: ISheetNote cancel?: boolean | undefined}Payload type: ISheetNoteUpdateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetNoteUpdate, (params) => { const { workbook, worksheet, row, col, note, oldNote } = params console.log(params) // Cancel the note update operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.SheetNoteAdd
Event fired when a note is added
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number note: ISheetNote cancel?: boolean | undefined}Payload type: ISheetNoteAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteAdd, (params) => { const { workbook, worksheet, row, col, note } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.SheetNoteDelete
Event fired when a note is deleted
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number oldNote: ISheetNote cancel?: boolean | undefined}Payload type: ISheetNoteDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteDelete, (params) => { const { workbook, worksheet, row, col, oldNote } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.SheetNoteHide
Event fired when a note is hidden
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number cancel?: boolean | undefined}Payload type: ISheetNoteHideEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteHide, (params) => { const { workbook, worksheet, row, col } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.SheetNoteShow
Event fired when a note is shown
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number cancel?: boolean | undefined}Payload type: ISheetNoteShowEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteShow, (params) => { const { workbook, worksheet, row, col } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
Event.SheetNoteUpdate
Event fired when a note is updated
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet row: number col: number note: ISheetNote oldNote: ISheetNote cancel?: boolean | undefined}Payload type: ISheetNoteUpdateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetNoteUpdate, (params) => { const { workbook, worksheet, row, col, note, oldNote } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-note · Type definitions
@univerjs/sheets-sort
Event.SheetBeforeRangeSort
This event will be emitted before sorting a range on a worksheet.
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet range: FRange sortColumn: ISortColumn[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetsRangeSortEventParams
Example
const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeSort, (params) => { console.log(params) const { workbook, worksheet, range, sortColumn } = params // Cancel the sorting operation. params.cancel = true})// Remove the event listener, use `callbackDisposable.dispose()`Package: @univerjs/sheets-sort · Type definitions
Event.SheetRangeSorted
This event will be emitted when a range on a worksheet is sorted.
Callback parameters
type EventParameters = { workbook: FWorkbook worksheet: FWorksheet range: FRange sortColumn: ISortColumn[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetsRangeSortEventParams
Example
const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeSorted, (params) => { console.log(params) const { workbook, worksheet, range, sortColumn } = params})// Remove the event listener, use `callbackDisposable.dispose()`Package: @univerjs/sheets-sort · Type definitions
@univerjs/sheets-thread-comment
Event.BeforeCommentAdd
Event fired before comment added
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet where the comment will be added */ worksheet: FWorksheet /** Row index for the new comment */ row: number /** Column index for the new comment */ col: number /** The comment item to be added */ comment: FTheadCommentItem /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetCommentAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommentAdd, (params) => { const { comment, workbook, worksheet, row, col } = params console.log(params) // Cancel the comment add operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.BeforeCommentDelete
Event fired before comment delete
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the comment */ worksheet: FWorksheet /** Row index of the comment */ row: number /** Column index of the comment */ col: number /** The comment to be deleted */ comment: FThreadComment /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetCommentDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommentDelete, (params) => { const { comment, workbook, worksheet, row, col } = params console.log(params) // Cancel the comment delete operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.BeforeCommentResolve
Event fired before comment resolve
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the comment */ worksheet: FWorksheet /** Row index of the comment */ row: number /** Column index of the comment */ col: number /** The comment object */ comment: FThreadComment /** The new resolve status */ resolved: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetCommentResolveEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommentResolve, (params) => { const { comment, row, col, resolved, workbook, worksheet } = params console.log(params) // Cancel the comment resolve operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.BeforeCommentUpdate
Event fired before comment update
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the comment */ worksheet: FWorksheet /** Row index of the comment */ row: number /** Column index of the comment */ col: number /** The current comment object */ comment: FThreadComment /** The new content to replace the existing comment */ newContent: RichTextValue /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetCommentUpdateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeCommentUpdate, (params) => { const { comment, workbook, worksheet, row, col, newContent } = params console.log(params) // Cancel the comment update operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.CommentAdded
Event fired after comment added
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet where the comment is added */ worksheet: FWorksheet /** Row index of the comment */ row: number /** Column index of the comment */ col: number /** The added comment object */ comment: FThreadComment /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetCommentAddEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CommentAdded, (params) => { const { comment, workbook, worksheet, row, col } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.CommentDeleted
Event fired after comment deleted
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet that contained the comment */ worksheet: FWorksheet /** The ID of the deleted comment */ commentId: string /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetCommentDeleteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CommentDeleted, (params) => { const { commentId, workbook, worksheet } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.CommentResolved
Event fired after comment resolve
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the comment */ worksheet: FWorksheet /** Row index of the comment */ row: number /** Column index of the comment */ col: number /** The comment object */ comment: FThreadComment /** The new resolve status */ resolved: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetCommentResolveEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CommentResolved, (params) => { const { comment, row, col, resolved, workbook, worksheet } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
Event.CommentUpdated
Event fired after comment updated
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet containing the updated comment */ worksheet: FWorksheet /** Row index of the comment */ row: number /** Column index of the comment */ col: number /** The updated comment object */ comment: FThreadComment /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetCommentUpdateEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CommentUpdated, (params) => { const { comment, workbook, worksheet, row, col } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-thread-comment · Type definitions
@univerjs/sheets-ui
Event.BeforeClipboardChange
Trigger this event before the clipboard content changes.
Type of the event parameter is IBeforeClipboardChangeEventParams
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet /** Clipboard Text String */ text: string /** Clipboard HTML String */ html: string /** The sheet containing the content that was (copied/cut) */ fromSheet: FWorksheet /** The range containing the content that was (copied/cut) */ fromRange: FRange /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeClipboardChangeEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeClipboardChange, (params) => { const { workbook, worksheet, text, html, fromSheet, fromRange } = params console.log(params) // Cancel the clipboard change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.BeforeClipboardPaste
Trigger this event before pasting.
Type of the event parameter is IBeforeClipboardPasteEventParams
Callback parameters
type EventParameters = { /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorkbook} */ worksheet: FWorksheet /** Clipboard Text String */ text?: string | undefined /** Clipboard HTML String */ html?: string | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeClipboardPasteEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeClipboardPaste, (params) => { const { workbook, worksheet, text, html } = params console.log(params) // Cancel the clipboard paste operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.BeforeSheetEditEnd
Event fired before a cell edit ends
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet being edited */ worksheet: FWorksheet /** Row index of the editing cell */ row: number /** Column index of the editing cell */ column: number /** Current value being edited */ value: RichTextValue /** Type of input device event triggering the edit end */ eventType?: DeviceInputEventType | undefined /** Optional keycode triggering the edit end */ keycode?: KeyCode | undefined /** Whether the edit will be confirmed or cancelled */ isConfirm: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetEditEndEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => { const { worksheet, workbook, row, column, value, eventType, keycode, isConfirm } = params console.log(params) // Cancel the cell edit end operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.BeforeSheetEditStart
Event fired before a cell is edited
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet to be edited */ worksheet: FWorksheet /** Row index of the cell to be edited */ row: number /** Column index of the cell to be edited */ column: number /** Type of input device event triggering the edit */ eventType?: DeviceInputEventType | undefined /** Optional keycode triggering the edit */ keycode?: KeyCode | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: IBeforeSheetEditStartEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => { const { worksheet, workbook, row, column, eventType, keycode } = params console.log(params) // Cancel the cell edit start operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.BeforeSheetZoomChange
Event fired before zoom changed
Callback parameters
type EventParameters = { /** Zoom ratio */ zoom: number /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorkbook} */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetZoomEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetZoomChange, (params) => { const { worksheet, workbook, zoom } = params console.log(params) // Cancel the zoom change operation params.cancel = true})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.CellClicked
Event fired when a cell is clicked
Callback parameters
type EventParameters = { row: number column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ICellEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => { const { worksheet, workbook, row, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.CellHover
Event fired when a cell is hovered
Callback parameters
type EventParameters = { row: number column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ICellEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CellHover, (params) => { const { worksheet, workbook, row, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.CellPointerDown
Event fired when a cell is pointer down
Callback parameters
type EventParameters = { row: number column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ICellEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CellPointerDown, (params) => { const { worksheet, workbook, row, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.CellPointerMove
Event fired when move on spreadsheet cells
Callback parameters
type EventParameters = { row: number column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ICellEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => { const { worksheet, workbook, row, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.CellPointerUp
Event fired when a cell is pointer up
Callback parameters
type EventParameters = { row: number column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ICellEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.CellPointerUp, (params) => { const { worksheet, workbook, row, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.ClipboardChanged
Trigger this event after the clipboard content changes.
Type of the event parameter is IClipboardChangedEventParams
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet /** Clipboard Text String */ text: string /** Clipboard HTML String */ html: string /** The sheet containing the content that was (copied/cut) */ fromSheet: FWorksheet /** The range containing the content that was (copied/cut) */ fromRange: FRange}Payload type: IClipboardChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ClipboardChanged, (params) => { const { workbook, worksheet, text, html, fromSheet, fromRange } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.ClipboardPasted
Trigger this event after pasting.
Type of the event parameter is IClipboardPastedEventParams
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorkbook} */ worksheet: FWorksheet /** Clipboard Text String */ text?: string | undefined /** Clipboard HTML String */ html?: string | undefined}Payload type: IClipboardPastedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ClipboardPasted, (params) => { const { workbook, worksheet, text, html } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.ColumnHeaderClick
Triggered when a column header is clicked
Callback parameters
type EventParameters = { column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetColumnHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ColumnHeaderClick, (params) => { const { worksheet, workbook, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.ColumnHeaderHover
Triggered when pointer hovers over a column header
Callback parameters
type EventParameters = { column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetColumnHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ColumnHeaderHover, (params) => { const { worksheet, workbook, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.ColumnHeaderPointerDown
Triggered when pointer is pressed down on a column header
Callback parameters
type EventParameters = { column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetColumnHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ColumnHeaderPointerDown, (params) => { const { worksheet, workbook, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.ColumnHeaderPointerUp
Triggered when pointer is released on a column header
Callback parameters
type EventParameters = { column: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetColumnHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.ColumnHeaderPointerUp, (params) => { const { worksheet, workbook, column } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.DragOver
Event fired when the drag element passes over the spreadsheet cells
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined position: IPosition /** location of cell */ location: ISheetLocationBase dataTransfer: DataTransfer /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet row: number column: number}Payload type: IDragEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.DragOver, (params) => { const { row, column, dataTransfer } = params console.log(params, dataTransfer.files.length)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.Drop
Event fired when the drag element is dropped on the spreadsheet cells
Callback parameters
type EventParameters = { /** Flag to cancel the event if supported */ cancel?: boolean | undefined position: IPosition /** location of cell */ location: ISheetLocationBase dataTransfer: DataTransfer /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet row: number column: number}Payload type: IDragEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.Drop, (params) => { const { row, column, dataTransfer } = params console.log(params, dataTransfer.files.length)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.RowHeaderClick
Triggered when a row header is clicked
Callback parameters
type EventParameters = { row: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetRowHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.RowHeaderClick, (params) => { const { worksheet, workbook, row } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.RowHeaderHover
Triggered when pointer hovers over a row header
Callback parameters
type EventParameters = { row: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetRowHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.RowHeaderHover, (params) => { const { worksheet, workbook, row } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.RowHeaderPointerDown
Triggered when pointer is pressed down on a row header
Callback parameters
type EventParameters = { row: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetRowHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.RowHeaderPointerDown, (params) => { const { worksheet, workbook, row } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.RowHeaderPointerUp
Triggered when pointer is released on a row header
Callback parameters
type EventParameters = { row: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetRowHeaderEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.RowHeaderPointerUp, (params) => { const { worksheet, workbook, row } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.Scroll
Event fired when scroll spreadsheet.
Callback parameters
type EventParameters = { scrollX: number scrollY: number /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: IScrollEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.Scroll, (params) => { const { worksheet, workbook, scrollX, scrollY } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SelectionChanged
Event fired when selection changed.
Callback parameters
type EventParameters = { selections: IRange[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISelectionEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SelectionChanged, (params) => { const { worksheet, workbook, selections } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SelectionMoveEnd
Event fired when selection move end
Callback parameters
type EventParameters = { selections: IRange[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISelectionEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SelectionMoveEnd, (params) => { const { worksheet, workbook, selections } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SelectionMoveStart
Event fired when selection move start
Callback parameters
type EventParameters = { selections: IRange[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISelectionEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SelectionMoveStart, (params) => { const { worksheet, workbook, selections } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SelectionMoving
Event fired when selection move end
Callback parameters
type EventParameters = { selections: IRange[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISelectionEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SelectionMoving, (params) => { const { worksheet, workbook, selections } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SheetEditChanging
Event fired when a cell is being edited
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet being edited */ worksheet: FWorksheet /** Row index of the editing cell */ row: number /** Column index of the editing cell */ column: number /** Current value being edited */ value: RichTextValue /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetEditChangingEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetEditChanging, (params) => { const { worksheet, workbook, row, column, value } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SheetEditEnded
Event fired after a cell edit ends
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet being edited */ worksheet: FWorksheet /** Row index of the edited cell */ row: number /** Column index of the edited cell */ column: number /** Type of input device event that triggered the edit end */ eventType?: DeviceInputEventType | undefined /** Optional keycode that triggered the edit end */ keycode?: KeyCode | undefined /** Whether the edit was confirmed or cancelled */ isConfirm: boolean /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetEditEndedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => { const { worksheet, workbook, row, column, eventType, keycode, isConfirm } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SheetEditStarted
Event fired after a cell is edited
Callback parameters
type EventParameters = { /** The workbook instance */ workbook: FWorkbook /** The worksheet being edited */ worksheet: FWorksheet /** Row index of the editing cell */ row: number /** Column index of the editing cell */ column: number /** Type of input device event that triggered the edit */ eventType?: DeviceInputEventType | undefined /** Optional keycode that triggered the edit */ keycode?: KeyCode | undefined /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetEditStartedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetEditStarted, (params) => { const { worksheet, workbook, row, column, eventType, keycode } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SheetSkeletonChanged
Event fired when sheet skeleton changed
Callback parameters
type EventParameters = { skeleton: SpreadsheetSkeleton payload: CommandListenerSkeletonChange effectedRanges: FRange[] /** Flag to cancel the event if supported */ cancel?: boolean | undefined /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorksheet} */ worksheet: FWorksheet}Payload type: ISheetSkeletonChangedEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetSkeletonChanged, (params) => { const { worksheet, workbook, skeleton, payload, effectedRanges } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
Event.SheetZoomChanged
Event fired when zoom changed
Callback parameters
type EventParameters = { /** Zoom ratio */ zoom: number /** The workbook instance currently being operated on. {@link FWorkbook} */ workbook: FWorkbook /** The worksheet instance currently being operated on. {@link FWorkbook} */ worksheet: FWorksheet /** Flag to cancel the event if supported */ cancel?: boolean | undefined}Payload type: ISheetZoomEventParams
Example
const disposable = univerAPI.addEvent(univerAPI.Event.SheetZoomChanged, (params) => { const { worksheet, workbook, zoom } = params console.log(params)})// Remove the event listener, use `disposable.dispose()`Package: @univerjs/sheets-ui · Type definitions
How is this guide?