@univerjs/facade v0.4.2 • Docs
Class: FUniver
Constructors
new FUniver()
new FUniver(
_injector,
_univerInstanceService,
_commandService): FUniver
Parameters
Parameter | Type |
---|---|
_injector | Injector |
_univerInstanceService | IUniverInstanceService |
_commandService | ICommandService |
Returns
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:78 (opens in a new tab)
Properties
Property | Modifier | Type | Default value | Defined in |
---|---|---|---|---|
_injector | readonly | Injector | undefined | submodules/univer/packages/facade/src/apis/facade.ts:79 (opens in a new tab) |
BorderStyle | static | typeof BorderStyleTypes | BorderStyleTypes | submodules/univer/packages/facade/src/apis/facade.ts:74 (opens in a new tab) |
WrapStrategy | static | typeof WrapStrategy | WrapStrategy | submodules/univer/packages/facade/src/apis/facade.ts:76 (opens in a new tab) |
Methods
addWatermark()
addWatermark(type, config)
addWatermark(type, config): void
Adds a watermark to the unit. Supports both text and image watermarks based on the specified type.
Parameters
Parameter | Type | Description |
---|---|---|
type | Text | The type of watermark to add. Can be either 'Text' or 'Image'. |
config | ITextWatermarkConfig | The configuration object for the watermark. - If the type is 'Text', the config should follow the ITextWatermarkConfig interface. - If the type is 'Image', the config should follow the IImageWatermarkConfig interface. |
Returns
void
Throws
Throws an error if the watermark type is unknown.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:552 (opens in a new tab)
addWatermark(type, config)
addWatermark(type, config): void
Parameters
Parameter | Type |
---|---|
type | Image |
config | IImageWatermarkConfig |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:553 (opens in a new tab)
copy()
copy(): Promise<boolean>
Returns
Promise
<boolean
>
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:349 (opens in a new tab)
createSocket()
createSocket(url): ISocket
Set WebSocket URL for WebSocketService
Parameters
Parameter | Type | Description |
---|---|---|
url | string | WebSocket URL |
Returns
WebSocket instance
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:409 (opens in a new tab)
createUniverDoc()
createUniverDoc(data): FDocument
Create a new document and get the API handler of that document.
Parameters
Parameter | Type | Description |
---|---|---|
data | Partial <IDocumentData > | The snapshot of the document. |
Returns
FDocument
FDocument API instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:167 (opens in a new tab)
createUniverSheet()
createUniverSheet(data): FWorkbook
Create a new spreadsheet and get the API handler of that spreadsheet.
Parameters
Parameter | Type | Description |
---|---|---|
data | Partial <IWorkbookData > | The snapshot of the spreadsheet. |
Returns
FWorkbook API instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:156 (opens in a new tab)
customizeColumnHeader()
customizeColumnHeader(cfg): void
Customize the column header of the spreadsheet.
Parameters
Parameter | Type | Description |
---|---|---|
cfg | IColumnsHeaderCfgParam | The 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:474 (opens in a new tab)
customizeRowHeader()
customizeRowHeader(cfg): void
Customize the row header of the spreadsheet.
Parameters
Parameter | Type | Description |
---|---|---|
cfg | IRowsHeaderCfgParam | The 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:495 (opens in a new tab)
deleteWatermark()
deleteWatermark(): void
Deletes the currently applied watermark from the unit.
This function retrieves the watermark service and invokes the method to remove any existing watermark configuration.
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:589 (opens in a new tab)
disposeUnit()
disposeUnit(unitId): boolean
Dispose the UniverSheet by the unitId
. The UniverSheet would be unload from the application.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unit id of the UniverSheet. |
Returns
boolean
Whether the Univer instance is disposed successfully.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:178 (opens in a new tab)
executeCommand()
executeCommand<P, R>(
id,
params?,
options?): Promise<R>
Execute command
Type Parameters
Type Parameter | Default type |
---|---|
P extends object | object |
R | boolean |
Parameters
Parameter | Type | Description |
---|---|---|
id | string | Command ID |
params ? | P | Command parameters |
options ? | IExecutionOptions | Command execution options |
Returns
Promise
<R
>
Command execution result
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:395 (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:231 (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:217 (opens in a new tab)
getCurrentLifecycleStage()
getCurrentLifecycleStage(): LifecycleStages
Get the current lifecycle stage.
Returns
- The current lifecycle stage.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:324 (opens in a new tab)
getFormula()
getFormula(): FFormula
Returns
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:315 (opens in a new tab)
getHooks()
getHooks(): FHooks
Get hooks
Returns
FHooks instance
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:434 (opens in a new tab)
getPermission()
getPermission(): FPermission
Get the PermissionInstance.
Returns
- The PermissionInstance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:537 (opens in a new tab)
getSheetHooks()
getSheetHooks(): FSheetHooks
Get sheet hooks
Returns
FSheetHooks instance
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:425 (opens in a new tab)
getUniverDoc()
getUniverDoc(id): null | FDocument
Get the document API handler by the document id.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The document id. |
Returns
null
| FDocument
The document API instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:203 (opens in a new tab)
getUniverSheet()
getUniverSheet(id): null | FWorkbook
Get the spreadsheet API handler by the spreadsheet id.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The spreadsheet id. |
Returns
null
| FWorkbook
The spreadsheet API instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:188 (opens in a new tab)
onBeforeCommandExecute()
onBeforeCommandExecute(callback): IDisposable
Register a callback that will be triggered before invoking a command.
Parameters
Parameter | Type | Description |
---|---|---|
callback | CommandListener | The callback. |
Returns
The disposable instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:367 (opens in a new tab)
onCommandExecuted()
onCommandExecuted(callback): IDisposable
Register a callback that will be triggered when a command is invoked.
Parameters
Parameter | Type | Description |
---|---|---|
callback | CommandListener | The callback. |
Returns
The disposable instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:379 (opens in a new tab)
paste()
paste(): Promise<boolean>
Returns
Promise
<boolean
>
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:353 (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:345 (opens in a new tab)
registerFunction()
registerFunction(config): IDisposable
Register a function to the spreadsheet.
Parameters
Parameter | Type | Description |
---|---|---|
config | IRegisterFunctionParams | The configuration of the function. |
Returns
The disposable instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:246 (opens in a new tab)
registerSheetColumnHeaderExtension()
registerSheetColumnHeaderExtension(unitId, ...extensions): IDisposable
Register sheet column header render extensions.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unit id of the spreadsheet. |
...extensions | SheetExtension [] | The extensions to register. |
Returns
The disposable instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:288 (opens in a new tab)
registerSheetMainExtension()
registerSheetMainExtension(unitId, ...extensions): IDisposable
Register sheet main render extensions.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unit id of the spreadsheet. |
...extensions | SheetExtension [] | The extensions to register. |
Returns
The disposable instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:305 (opens in a new tab)
registerSheetRowHeaderExtension()
registerSheetRowHeaderExtension(unitId, ...extensions): IDisposable
Register sheet row header render extensions.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unit id of the spreadsheet. |
...extensions | SheetExtension [] | The extensions to register. |
Returns
The disposable instance.
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:271 (opens in a new tab)
setCrosshairHighlightColor()
setCrosshairHighlightColor(color): void
Set the color of the crosshair highlight.
Parameters
Parameter | Type | Description |
---|---|---|
color | string | the color of the crosshair highlight |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:524 (opens in a new tab)
setCrosshairHighlightEnabled()
setCrosshairHighlightEnabled(enabled): void
Enable or disable crosshair highlight.
Parameters
Parameter | Type | Description |
---|---|---|
enabled | boolean | if crosshair highlight should be enabled |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:512 (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:336 (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
Parameter | Type | Description |
---|---|---|
injector | Injector | The injector instance used to retrieve dependencies. |
derivedDependencies ? | [] | Optional array of pre-derived dependencies. |
Returns
- An array of dependencies required by the service.
Static
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:116 (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
Parameter | Type | Description |
---|---|---|
wrapped | Injector | Univer | The Univer instance or injector instance. |
Returns
- The FUniver instance.
Static
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:134 (opens in a new tab)
newDataValidation()
static newDataValidation(): FDataValidationBuilder
Returns
Defined in
submodules/univer/packages/facade/src/apis/facade.ts:141 (opens in a new tab)