@univerjs-pro/sheets-pivot v0.5.4
Class: FPivotTableEvent
Defined in: packages/sheets-pivot/src/facade/f-event.ts:271
Extends
Implements
IPivotTableEventMixin
Constructors
new FPivotTableEvent()
new FPivotTableEvent(): FPivotTableEvent
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:114
Returns
Inherited from
Properties
Property | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
BeforePivotTableMove | readonly | "BeforePivotTableMove" | The before pivot table moved event.The event parameter is IPivotTableMovedEventParams Example univerAPI.addEvent(univerAPI.Event.BeforePivotTableMove, (params) => { const { pivotTableId, targetCellInfo } = params; if (pivotTableId === 'pivotTable1' && targetCellInfo.sheetName === 'Sheet 1') { params.cancel = true; console.log( The pivot table can’t be moved to the sheet ${targetCellInfo.sheetName}); } }); | IPivotTableEventMixin.BeforePivotTableMove FEventName.BeforePivotTableMove | packages/sheets-pivot/src/facade/f-event.ts:50 |
_instance | static | null | FEventName | - | FEventName ._instance | submodules/univer/packages/core/src/facade/f-event.ts:87 |
Accessors
BeforeCommandExecute
Get Signature
get BeforeCommandExecute(): "BeforeCommandExecute"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:252
Event fired before a command is executed
See
ICommandEvent
Example
univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => {
const { params, id, type } = event;
console.log('command executed', event);
});
Returns
"BeforeCommandExecute"
Inherited from
FEventName
.BeforeCommandExecute
BeforePivotTableAdd
Get Signature
get BeforePivotTableAdd(): "BeforePivotTableAdd"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:276
The before pivot table add event.The event parameter is IPivotTableAddedEventParams
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}`);
}
});
Returns
"BeforePivotTableAdd"
Implementation of
IPivotTableEventMixin.BeforePivotTableAdd
Overrides
FEventName.BeforePivotTableAdd
BeforeRedo
Get Signature
get BeforeRedo(): "BeforeRedo"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:207
Event fired before a redo command is executed
See
ICommandEvent
Example
univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => {
const { params, id, type } = event;
console.log('command executed', event);
});
Returns
"BeforeRedo"
Inherited from
BeforeSheetCreate
Get Signature
get BeforeSheetCreate(): "BeforeSheetCreate"
Defined in: submodules/univer/packages/sheets/src/facade/f-event.ts:46
Event fired before a sheet is created
See
Example
univerAPI.addEvent(univerAPI.event.BeforeSheetCreate, (params) => {
const { workbook, index, sheet } = params;
console.log('unit created', params);
});
Returns
"BeforeSheetCreate"
Inherited from
FEventName.BeforeSheetCreate
BeforeUndo
Get Signature
get BeforeUndo(): "BeforeUndo"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:222
Event fired before an undo command is executed
See
ICommandEvent
Example
univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => {
const { params, id, type } = event;
console.log('command executed', event);
});
Returns
"BeforeUndo"
Inherited from
CommandExecuted
Get Signature
get CommandExecuted(): "CommandExecuted"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:237
Event fired when a command is executed
See
ICommandEvent
Example
univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => {
const { params, id, type } = event;
console.log('command executed', event);
});
Returns
"CommandExecuted"
Inherited from
DocCreated
Get Signature
get DocCreated(): "DocCreated"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:132
Event fired when a document is created
See
IDocCreatedParam
Example
univerAPI.addEvent(univerAPI.event.DocCreated, (params) => {
const { unitId, type, doc, unit } = params;
console.log('doc created', params);
});
Returns
"DocCreated"
Inherited from
DocDisposed
Get Signature
get DocDisposed(): "DocDisposed"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:147
Event fired when a document is disposed
See
IDocDisposedEvent
Example
univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => {
const { unitId, unitType, snapshot } = params;
console.log('doc disposed', params);
});
Returns
"DocDisposed"
Inherited from
LifeCycleChanged
Get Signature
get LifeCycleChanged(): "LifeCycleChanged"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:162
Event fired when life cycle is changed
See
ILifeCycleChangedEvent
Example
univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => {
const { stage } = params;
console.log('life cycle changed', params);
});
Returns
"LifeCycleChanged"
Inherited from
PivotTableAdded
Get Signature
get PivotTableAdded(): "PivotTableAdded"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:272
The pivot table added event.The event parameter is IPivotTableAddedEventParams
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');
}
});
Returns
"PivotTableAdded"
Implementation of
IPivotTableEventMixin.PivotTableAdded
Overrides
FEventName.PivotTableAdded
PivotTableFieldAdded
Get Signature
get PivotTableFieldAdded(): "PivotTableFieldAdded"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:292
The pivot table field added event. The event parameter is IAddPivotFieldCommandParams
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);
Returns
"PivotTableFieldAdded"
Implementation of
IPivotTableEventMixin.PivotTableFieldAdded
Overrides
FEventName.PivotTableFieldAdded
PivotTableFieldCollapseChanged
Get Signature
get PivotTableFieldCollapseChanged(): "PivotTableFieldCollapseChanged"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:304
The pivot table field collapse changed event. The event parameter is ISetPivotCollapseCommandParams
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}`);
});
##### Returns
`"PivotTableFieldCollapseChanged"`
#### Implementation of
```ts
IPivotTableEventMixin.PivotTableFieldCollapseChanged
Overrides
FEventName.PivotTableFieldCollapseChanged
PivotTableFieldFilterChanged
Get Signature
get PivotTableFieldFilterChanged(): "PivotTableFieldFilterChanged"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:308
The pivot table field filter changed event. The event parameter is ISetPivotFilterCommandParams
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}`);
});
Returns
"PivotTableFieldFilterChanged"
Implementation of
IPivotTableEventMixin.PivotTableFieldFilterChanged
Overrides
FEventName.PivotTableFieldFilterChanged
PivotTableFieldMoved
Get Signature
get PivotTableFieldMoved(): "PivotTableFieldMoved"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:300
The pivot table field moved event. The event parameter is IMovePivotFieldCommandParams
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}`);
});
Returns
"PivotTableFieldMoved"
Implementation of
IPivotTableEventMixin.PivotTableFieldMoved
Overrides
FEventName.PivotTableFieldMoved
PivotTableFieldRemoved
Get Signature
get PivotTableFieldRemoved(): "PivotTableFieldRemoved"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:296
The pivot table field removed event. The event parameter is IRemovePivotFieldCommandParams
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);
});
Returns
"PivotTableFieldRemoved"
Implementation of
IPivotTableEventMixin.PivotTableFieldRemoved
Overrides
FEventName.PivotTableFieldRemoved
PivotTableFieldSettingChanged
Get Signature
get PivotTableFieldSettingChanged(): "PivotTableFieldSettingChanged"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:316
The pivot table field setting changed event. The event parameter is IUpdatePivotFieldSettingCommandParams
Example
const fWorkbook = univerAPI.getActiveWorkbook();
univerAPI.addEvent(univerAPI.Event.PivotTableFieldSettingChanged, (params) => {
const { pivotTableId, fieldId, setting } = params;
const pivotTable = fWorkbook.getPivotTableById(pivotTableId);
const fieldSetting = pivotTable.getFieldSetting(fieldId);
console.log(`The source name ${fieldSetting.sourceName} the display name ${fieldSetting.displayName}`);
});
Returns
"PivotTableFieldSettingChanged"
Implementation of
IPivotTableEventMixin.PivotTableFieldSettingChanged
Overrides
FEventName.PivotTableFieldSettingChanged
PivotTableFieldSortChanged
Get Signature
get PivotTableFieldSortChanged(): "PivotTableFieldSortChanged"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:312
The pivot table field sort changed event. The event parameter is ISetPivotSortCommandParams
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}`);
});
Returns
"PivotTableFieldSortChanged"
Implementation of
IPivotTableEventMixin.PivotTableFieldSortChanged
Overrides
FEventName.PivotTableFieldSortChanged
PivotTableMoved
Get Signature
get PivotTableMoved(): "PivotTableMoved"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:284
The pivot table moved event. The event parameter is IPivotTableMovedEventParams
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}`);
}
});
Returns
"PivotTableMoved"
Implementation of
IPivotTableEventMixin.PivotTableMoved
Overrides
FEventName.PivotTableMoved
PivotTableRemoved
Get Signature
get PivotTableRemoved(): "PivotTableRemoved"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:280
The pivot table removed event. The event parameter is IPivotTableRemovedEventParams
Example
univerAPI.addEvent(univerAPI.Event.PivotTableRemoved, (params) => {
const { pivotTableId } = params;
console.log(`The pivot table ${pivotTableId} has been removed`);
});
##### Returns
`"PivotTableRemoved"`
#### Implementation of
```ts
IPivotTableEventMixin.PivotTableRemoved
Overrides
FEventName.PivotTableRemoved
PivotTableRendered
Get Signature
get PivotTableRendered(): "PivotTableRendered"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:288
The pivot table calculated done and fill the value to worksheet, the event parameter is IPivotTableRenderedEventParams
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));
}
});
Returns
"PivotTableRendered"
Implementation of
IPivotTableEventMixin.PivotTableRendered
Overrides
FEventName.PivotTableRendered
PivotTableValuePositionChanged
Get Signature
get PivotTableValuePositionChanged(): "PivotTableValuePositionChanged"
Defined in: packages/sheets-pivot/src/facade/f-event.ts:320
The pivot table value position changed event. The event parameter is IUpdatePivotValuePositionCommandParams
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}`);
});
Returns
"PivotTableValuePositionChanged"
Implementation of
IPivotTableEventMixin.PivotTableValuePositionChanged
Overrides
FEventName.PivotTableValuePositionChanged
Redo
Get Signature
get Redo(): "Redo"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:177
Event fired when a redo command is executed
See
ICommandEvent
Example
univerAPI.addEvent(univerAPI.event.Redo, (event) => {
const { params, id, type } = event;
console.log('command executed', event);
});
Returns
"Redo"
Inherited from
SheetCreated
Get Signature
get SheetCreated(): "SheetCreated"
Defined in: submodules/univer/packages/sheets/src/facade/f-event.ts:34
Event fired after a sheet is created
See
Example
univerAPI.addEvent(univerAPI.event.SheetCreated, (params) => {
const { workbook, worksheet } = params;
console.log('unit created', params);
});
Returns
"SheetCreated"
Inherited from
FEventName.SheetCreated
Undo
Get Signature
get Undo(): "Undo"
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:192
Event fired when an undo command is executed
See
ICommandEvent
Example
univerAPI.addEvent(univerAPI.event.Undo, (event) => {
const { params, id, type } = event;
console.log('command executed', event);
});
Returns
"Undo"
Inherited from
WorkbookCreated
Get Signature
get WorkbookCreated(): "WorkbookCreated"
Defined in: submodules/univer/packages/sheets/src/facade/f-event.ts:58
Event fired after a workbook is created
See
Example
univerAPI.addEvent(univerAPI.event.WorkbookCreated, (params) => {
const { unitId, type, workbook, unit } = params;
console.log('unit created', params);
});
Returns
"WorkbookCreated"
Inherited from
FEventName.WorkbookCreated
WorkbookDisposed
Get Signature
get WorkbookDisposed(): "WorkbookDisposed"
Defined in: submodules/univer/packages/sheets/src/facade/f-event.ts:70
Event fired after a workbook is disposed
See
Example
univerAPI.addEvent(univerAPI.event.WorkbookDisposed, (params) => {
const { unitId, unitType, snapshot } = params;
console.log('unit disposed', params);
});
Returns
"WorkbookDisposed"
Inherited from
FEventName.WorkbookDisposed
Methods
extend()
static extend(source): void
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:98
Parameters
Parameter | Type |
---|---|
source | any |
Returns
void
Inherited from
get()
static get(): FEventName
Defined in: submodules/univer/packages/core/src/facade/f-event.ts:88