FWorkbookSheetsUIMixin
| packages | @univerjs/sheets-ui |
|---|
APIs
abortEditingAsync
Signature
abortEditingAsync(): Promise<boolean>Returns
- (
Promise<boolean>) — Whether the editing process is ended successfully
Tags
@async— End the editing process of the current active cell
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
await fWorkbook.abortEditingAsync()customizeColumnHeader
Customize the column header of the all worksheets in the workbook.
Signature
customizeColumnHeader(cfg: IColumnsHeaderCfgParam): voidParameters
cfg(IColumnsHeaderCfgParam) — The configuration of the column header.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.customizeColumnHeader({
headerStyle: {
fontColor: '#fff',
backgroundColor: '#4e69ee',
fontSize: 9,
},
columnsCfg: {
0: 'kuma II',
3: {
text: 'Size',
textAlign: 'left', // CanvasTextAlign
fontColor: '#fff',
fontSize: 12,
borderColor: 'pink',
backgroundColor: 'pink',
},
4: 'Wow',
},
})customizeRowHeader
Customize the row header of the all worksheets in the workbook.
Signature
customizeRowHeader(cfg: IRowsHeaderCfgParam): voidParameters
cfg(IRowsHeaderCfgParam) — The configuration of the row header.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.customizeRowHeader({
headerStyle: {
backgroundColor: 'pink',
fontSize: 12,
},
rowsCfg: {
0: 'Moka II',
3: {
text: 'Size',
textAlign: 'left', // CanvasTextAlign
},
},
})disableSelection
Disable selection. After disabled, there would be no response for selection.
Signature
disableSelection(): FWorkbookReturns
- (
FWorkbook) — FWorkbook instance for chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.disableSelection()enableSelection
Enable selection. After this you can select range.
Signature
enableSelection(): FWorkbookReturns
- (
FWorkbook) — FWorkbook instance for chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.enableSelection()endEditing
Deprecated
Use endEditingAsync as instead
Signature
endEditing(save?: boolean): Promise<boolean>endEditingAsync
Signature
endEditingAsync(save?: boolean = true): Promise<boolean>Parameters
save(boolean) — - Whether to save the changes, default is true
Returns
- (
Promise<boolean>) — Whether the editing process is ended successfully
Tags
@async— End the editing process of the current active cell
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
await fWorkbook.endEditingAsync(false)generateCellParams
Signature
generateCellParams(cell: IHoverRichTextPosition | ICellPosWithEvent): ICellEventParamgetScrollStateBySheetId
Get scroll state of specified sheet.
Signature
getScrollStateBySheetId(sheetId: string): Nullable<IScrollState>Parameters
sheetId(string) — - sheet id
Returns
- (
Nullable<IScrollState>) — scroll state
Examples
univerAPI.getActiveWorkbook().getScrollStateBySheetId($sheetId)isCellEditing
Check if the current active cell is in editing state
Signature
isCellEditing(): booleanReturns
- (
boolean) — True if the current active cell is in editing state, false otherwise
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const isEditing = fWorkbook.isCellEditing()
console.log(isEditing)onCellClick
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => \{\}) instead
Signature
onCellClick(callback: (cell: IHoverRichTextInfo) => void): IDisposableonCellHover
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellHover, (params) => \{\}) instead
Signature
onCellHover(callback: (cell: IHoverRichTextPosition) => void): IDisposableonCellPointerDown
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellPointerDown, (params) => \{\}) instead
Signature
onCellPointerDown(callback: (cell: ICellPosWithEvent) => void): IDisposableonCellPointerMove
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => \{\}) instead
Signature
onCellPointerMove(callback: (cell: ICellPosWithEvent, event: IPointerEvent | IMouseEvent) => void): IDisposableonCellPointerUp
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellPointerUp, (params) => \{\}) instead
Signature
onCellPointerUp(callback: (cell: ICellPosWithEvent) => void): IDisposableonDragOver
Deprecated
use univerAPI.addEvent(univerAPI.Event.DragOver, (params) => \{\}) instead
Signature
onDragOver(callback: (cell: IDragCellPosition) => void): IDisposableonDrop
Deprecated
use univerAPI.addEvent(univerAPI.Event.Drop, (params) => \{\}) instead
Signature
onDrop(callback: (cell: IDragCellPosition) => void): IDisposableopenDialog
Open a dialog.
Deprecated
use univerAPI.openDialog instead
Signature
openDialog(dialog: IDialogPartMethodOptions): IDisposableParameters
dialog(IDialogPartMethodOptions) — the dialog options
Returns
- (
IDisposable) — the disposable object
Examples
import { Button } from '@univerjs/design';
univerAPI.openDialog({
id: 'mock-dialog-id',
width: 500,
title: {
label: 'Dialog Title',
},
children: {
label: 'Dialog Content',
},
footer: {
title: (
<>
<Button onClick={() => { console.log('Cancel clicked') }}>Cancel</Button>
<Button variant="primary" onClick={() => { console.log('Confirm clicked') }} style={{marginLeft: '10px'}}>Confirm</Button>
</>
)
},
draggable: true,
mask: true,
maskClosable: true,
});openSiderbar
Open a sidebar.
Deprecated
use univerAPI.openSidebar instead
Signature
openSiderbar(params: ISidebarMethodOptions): IDisposableParameters
params(ISidebarMethodOptions) — the sidebar options
Returns
- (
IDisposable) — the disposable object
Examples
univerAPI.openSidebar({
id: 'mock-sidebar-id',
width: 300,
header: {
label: 'Sidebar Header',
},
children: {
label: 'Sidebar Content',
},
footer: {
label: 'Sidebar Footer',
},
onClose: () => {
console.log('Sidebar closed')
},
})showSelection
Set selection visible.
Signature
showSelection(): FWorkbookReturns
- (
FWorkbook) — FWorkbook instance for chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.showSelection()startEditing
Start the editing process of the current active cell
Signature
startEditing(): booleanReturns
- (
boolean) — Whether the editing process is started successfully
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.startEditing()transparentSelection
Set selection invisible, Unlike disableSelection, selection still works, you just can not see them.
Signature
transparentSelection(): FWorkbookReturns
- (
FWorkbook) — FWorkbook instance for chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
fWorkbook.transparentSelection()