API Reference
@univerjs
@univerjs/facade
classes
Funiver

@univerjs/facade v0.3.0Docs


Class: FUniver

Constructors

new FUniver()

new FUniver(
   _injector, 
   _univerInstanceService, 
   _commandService): FUniver

Parameters

ParameterType
_injectorInjector
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService

Returns

FUniver

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:75 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueDefined in
_injectorreadonlyInjectorundefinedsubmodules/univer/packages/facade/src/apis/facade.ts:76 (opens in a new tab)
BorderStylestatictypeof BorderStyleTypesBorderStyleTypessubmodules/univer/packages/facade/src/apis/facade.ts:71 (opens in a new tab)
WrapStrategystatictypeof WrapStrategyWrapStrategysubmodules/univer/packages/facade/src/apis/facade.ts:73 (opens in a new tab)

Methods

copy()

copy(): Promise<boolean>

Returns

Promise<boolean>

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:336 (opens in a new tab)


createSocket()

createSocket(url): ISocket

Set WebSocket URL for WebSocketService

Parameters

ParameterTypeDescription
urlstringWebSocket URL

Returns

ISocket

WebSocket instance

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:396 (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

FDocument API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:164 (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

FWorkbook API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:153 (opens in a new tab)


customizeColumnHeader()

customizeColumnHeader(cfg): void

Customize the column header of the spreadsheet.

Parameters

ParameterTypeDescription
cfgIColumnsHeaderCfgParamThe configuration of the column header.

Returns

void

Example

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

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:461 (opens in a new tab)


customizeRowHeader()

customizeRowHeader(cfg): void

Customize the row header of the spreadsheet.

Parameters

ParameterTypeDescription
cfgIRowsHeaderCfgParamThe configuration of the row header.

Returns

void

Example

customizeRowHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, rowsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:482 (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 unit id of the UniverSheet.

Returns

boolean

Whether the Univer instance is disposed successfully.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:175 (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 parameters
options?IExecutionOptionsCommand execution options

Returns

Promise<R>

Command execution result

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:382 (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

submodules/univer/packages/facade/src/apis/facade.ts:228 (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

submodules/univer/packages/facade/src/apis/facade.ts:214 (opens in a new tab)


getFormula()

getFormula(): FFormula

Returns

FFormula

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:312 (opens in a new tab)


getHooks()

getHooks(): FHooks

Get hooks

Returns

FHooks

FHooks instance

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:421 (opens in a new tab)


getPermission()

getPermission(): FPermission

Get the PermissionInstance.

Returns

FPermission

  • The PermissionInstance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:524 (opens in a new tab)


getSheetHooks()

getSheetHooks(): FSheetHooks

Get sheet hooks

Returns

FSheetHooks

FSheetHooks instance

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:412 (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

The document API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:200 (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

The spreadsheet API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:185 (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

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:354 (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

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:366 (opens in a new tab)


paste()

paste(): Promise<boolean>

Returns

Promise<boolean>

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:340 (opens in a new tab)


redo()

redo(): Promise<boolean>

Redo an editing on the currently focused document.

Returns

Promise<boolean>

redo result

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:332 (opens in a new tab)


registerFunction()

registerFunction(config): IDisposable

Register a function to the spreadsheet.

Parameters

ParameterTypeDescription
configIRegisterFunctionParamsThe configuration of the function.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:243 (opens in a new tab)


registerSheetColumnHeaderExtension()

registerSheetColumnHeaderExtension(unitId, ...extensions): IDisposable

Register sheet column header render extensions.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the spreadsheet.
...extensionsSheetExtension[]The extensions to register.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:285 (opens in a new tab)


registerSheetMainExtension()

registerSheetMainExtension(unitId, ...extensions): IDisposable

Register sheet main render extensions.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the spreadsheet.
...extensionsSheetExtension[]The extensions to register.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:302 (opens in a new tab)


registerSheetRowHeaderExtension()

registerSheetRowHeaderExtension(unitId, ...extensions): IDisposable

Register sheet row header render extensions.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the spreadsheet.
...extensionsSheetExtension[]The extensions to register.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:268 (opens in a new tab)


setCrosshairHighlightColor()

setCrosshairHighlightColor(color): void

Set the color of the crosshair highlight.

Parameters

ParameterTypeDescription
colorstringthe color of the crosshair highlight

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:511 (opens in a new tab)


setCrosshairHighlightEnabled()

setCrosshairHighlightEnabled(enabled): void

Enable or disable crosshair highlight.

Parameters

ParameterTypeDescription
enabledbooleanif crosshair highlight should be enabled

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:499 (opens in a new tab)


undo()

undo(): Promise<boolean>

Undo an editing on the currently focused document.

Returns

Promise<boolean>

undo result

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:323 (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

ParameterTypeDescription
injectorInjectorThe injector instance used to retrieve dependencies.
derivedDependencies?[]Optional array of pre-derived dependencies.

Returns

Dependency[]

  • An array of dependencies required by the service.

Static

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:113 (opens in a new tab)


newAPI()

static newAPI(wrapped): FUniver

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

Parameters

ParameterTypeDescription
wrappedInjector | UniverThe Univer instance or injector instance.

Returns

FUniver

  • The FUniver instance.

Static

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:131 (opens in a new tab)


newDataValidation()

static newDataValidation(): FDataValidationBuilder

Returns

FDataValidationBuilder

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:138 (opens in a new tab)


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