API Reference
@univerjs
@univerjs/facade
classes
Funiver

@univerjs/facade v0.1.17Docs


Class: FUniver

Constructors

new FUniver()

new FUniver(
   _injector, 
   _univerInstanceService, 
   _commandService, 
   _ws, 
   _renderManagerService): FUniver

Parameters

ParameterType
_injectorInjector
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService
_wsISocketService
_renderManagerServiceIRenderManagerService

Returns

FUniver

Defined in

facade.ts:94 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueDefined in
_injectorreadonlyInjectorundefinedfacade.ts:95 (opens in a new tab)
BorderStylestatictypeof BorderStyleTypesBorderStyleTypesfacade.ts:86 (opens in a new tab)
WrapStrategystatictypeof WrapStrategyWrapStrategyfacade.ts:87 (opens in a new tab)

Methods

createSocket()

createSocket(url): ISocket

Set WebSocket URL for WebSocketService

Parameters

ParameterTypeDescription
urlstringWebSocketService URL

Returns

ISocket

WebSocket info and callback

Defined in

facade.ts:320 (opens in a new tab)


createUniverDoc()

createUniverDoc(data): FDocument

Create a new document and get the API handler of that document.

Parameters

ParameterTypeDescription
dataPartial<IDocumentData>The snapshot of the document.

Returns

FDocument

Document API instance.

Defined in

facade.ts:119 (opens in a new tab)


createUniverSheet()

createUniverSheet(data): FWorkbook

Create a new spreadsheet and get the API handler of that spreadsheet.

Parameters

ParameterTypeDescription
dataPartial<IWorkbookData>The snapshot of the spreadsheet.

Returns

FWorkbook

Spreadsheet API instance.

Defined in

facade.ts:109 (opens in a new tab)


customizeColumnHeader()

customizeColumnHeader(cfg): void

customizeColumnHeader

Parameters

ParameterTypeDescription
cfgIColumnsHeaderCfgParamcfg example ({ headerStyle:{backgroundColor: 'pink', fontSize: 9}, columnsCfg: ['MokaII', undefined, null, {text: 'Size', textAlign: 'left'}]})

Returns

void

Defined in

facade.ts:372 (opens in a new tab)


customizeRowHeader()

customizeRowHeader(cfg): void

Parameters

ParameterType
cfgIRowsHeaderCfgParam

Returns

void

Defined in

facade.ts:383 (opens in a new tab)


disposeUnit()

disposeUnit(unitId): boolean

Dispose the UniverSheet by the unitId. The UniverSheet would be unload from the application.

Parameters

ParameterTypeDescription
unitIdstringThe unitId of the UniverSheet.

Returns

boolean

If the UniverSheet is disposed successfully, return true, otherwise return false.

Defined in

facade.ts:129 (opens in a new tab)


executeCommand()

executeCommand<P, R>(
   id, 
   params?, 
options?): Promise<R>

Execute command

Type Parameters

Type ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterTypeDescription
idstringCommand id
params?PCommand params
options?IExecutionOptionsCommand options

Returns

Promise<R>

Command Promise

Defined in

facade.ts:307 (opens in a new tab)


getActiveDocument()

getActiveDocument(): null | FDocument

Get the currently focused Univer document.

Returns

null | FDocument

the currently focused Univer document.

Defined in

facade.ts:178 (opens in a new tab)


getActiveWorkbook()

getActiveWorkbook(): null | FWorkbook

Get the currently focused Univer spreadsheet.

Returns

null | FWorkbook

the currently focused Univer spreadsheet.

Defined in

facade.ts:165 (opens in a new tab)


getHooks()

getHooks(): FHooks

Get hooks

Returns

FHooks

Defined in

facade.ts:341 (opens in a new tab)


getSheetHooks()

getSheetHooks(): FSheetHooks

Get sheet hooks

Returns

FSheetHooks

Defined in

facade.ts:334 (opens in a new tab)


getUniverDoc()

getUniverDoc(id): null | FDocument

Get the document API handler by the document id.

Parameters

ParameterTypeDescription
idstringThe document id.

Returns

null | FDocument

Document API instance.

Defined in

facade.ts:152 (opens in a new tab)


getUniverSheet()

getUniverSheet(id): null | FWorkbook

Get the spreadsheet API handler by the spreadsheet id.

Parameters

ParameterTypeDescription
idstringThe spreadsheet id.

Returns

null | FWorkbook

Spreadsheet API instance.

Defined in

facade.ts:138 (opens in a new tab)


onBeforeCommandExecute()

onBeforeCommandExecute(callback): IDisposable

Register a callback that will be triggered before invoking a command.

Parameters

ParameterTypeDescription
callbackCommandListenerthe callback.

Returns

IDisposable

A function to dispose the listening.

Defined in

facade.ts:281 (opens in a new tab)


onCommandExecuted()

onCommandExecuted(callback): IDisposable

Register a callback that will be triggered when a command is invoked.

Parameters

ParameterTypeDescription
callbackCommandListenerthe callback.

Returns

IDisposable

A function to dispose the listening.

Defined in

facade.ts:292 (opens in a new tab)


redo()

redo(): Promise<boolean>

Redo an editing on the currently focused document.

Returns

Promise<boolean>

redo result

Defined in

facade.ts:268 (opens in a new tab)


registerFunction()

registerFunction(config): IDisposable

Register a function to the spreadsheet.

Parameters

ParameterType
configIRegisterFunctionParams

Returns

IDisposable

Defined in

facade.ts:191 (opens in a new tab)


registerSheetColumnHeaderExtension()

registerSheetColumnHeaderExtension(unitId, ...extensions): IDisposable

Register sheet column header render extensions.

Parameters

ParameterType
unitIdstring
...extensionsSheetExtension[]

Returns

IDisposable

Defined in

facade.ts:229 (opens in a new tab)


registerSheetMainExtension()

registerSheetMainExtension(unitId, ...extensions): IDisposable

Register sheet main render extensions.

Parameters

ParameterType
unitIdstring
...extensionsSheetExtension[]

Returns

IDisposable

Defined in

facade.ts:244 (opens in a new tab)


registerSheetRowHeaderExtension()

registerSheetRowHeaderExtension(unitId, ...extensions): IDisposable

Register sheet row header render extensions.

Parameters

ParameterType
unitIdstring
...extensionsSheetExtension[]

Returns

IDisposable

Defined in

facade.ts:214 (opens in a new tab)


undo()

undo(): Promise<boolean>

Undo an editing on the currently focused document.

Returns

Promise<boolean>

redo result

Defined in

facade.ts:260 (opens in a new tab)


getDependencies()

protected static getDependencies(injector, derivedDependencies?): Dependency[]

Get dependencies for FUniver, you can override newAPI to add more dependencies.

Parameters

ParameterType
injectorInjector
derivedDependencies?[]

Returns

Dependency[]

Defined in

facade.ts:60 (opens in a new tab)


newAPI()

static newAPI(wrapped): FUniver

Create a FUniver instance, if the injector is not provided, it will create a new Univer instance.

Parameters

ParameterTypeDescription
wrappedInjector | UniverThe Univer instance or injector.

Returns

FUniver

FUniver instance.

Zh

创建一个 FUniver 实例,如果未提供注入器,将创建一个新的 Univer 实例。 @param_zh wrapped Univer 实例或注入器。 @returns_zh FUniver 实例。

Defined in

facade.ts:79 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.