@univerjs/sheets-drawing-ui v0.5.4


Class: FUniverDrawingMixin

Defined in: sheets-drawing-ui/src/facade/f-univer.ts:48

Extends

Constructors

new FUniverDrawingMixin()

new FUniverDrawingMixin(
   _injector, 
   _commandService, 
   _univerInstanceService, 
   _lifecycleService): FUniverDrawingMixin

Defined in: core/src/facade/f-univer.ts:65

Parameters

ParameterType
_injectorInjector
_commandServiceICommandService
_univerInstanceServiceIUniverInstanceService
_lifecycleServiceLifecycleService

Returns

FUniverDrawingMixin

Inherited from

FUniver.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefinedFUniver._commandServicecore/src/facade/f-univer.ts:67
_disposedprotectedbooleanfalseFUniver._disposedcore/src/shared/lifecycle.ts:96
_eventRegistryprotectedMap<string, Registry<(param) => void>>undefinedFUniver._eventRegistrycore/src/facade/f-univer.ts:55
_injectorreadonlyInjectorundefinedFUniver._injectorcore/src/facade/f-univer.ts:66
_lifecycleServicereadonlyLifecycleServiceundefinedFUniver._lifecycleServicecore/src/facade/f-univer.ts:69
_univerInstanceServicereadonlyIUniverInstanceServiceundefinedFUniver._univerInstanceServicecore/src/facade/f-univer.ts:68

Accessors

Enum

Get Signature

get Enum(): FEnum

Defined in: core/src/facade/f-univer.ts:281

Returns

FEnum

Inherited from

FUniver.Enum


Event

Get Signature

get Event(): FEventName

Defined in: core/src/facade/f-univer.ts:285

Returns

FEventName

Inherited from

FUniver.Event


Util

Get Signature

get Util(): FUtil

Defined in: core/src/facade/f-univer.ts:289

Returns

FUtil

Inherited from

FUniver.Util

Methods

_ensureEventRegistry()

protected _ensureEventRegistry(event): Registry<(param) => void>

Defined in: core/src/facade/f-univer.ts:57

Parameters

ParameterType
eventstring

Returns

Registry<(param) => void>

Inherited from

FUniver._ensureEventRegistry


_eventListend()

protected _eventListend(key): 
  | undefined
| Registry<(param) => void>

Defined in: core/src/facade/f-univer.ts:180

Parameters

ParameterType
keystring

Returns

| undefined | Registry<(param) => void>

Inherited from

FUniver._eventListend


_initialize()

_initialize(injector): void

Defined in: sheets-drawing-ui/src/facade/f-univer.ts:49

Parameters

ParameterType
injectorInjector

Returns

void

Overrides

FUniver._initialize


addEvent()

addEvent(event, callback): IDisposable

Defined in: core/src/facade/f-univer.ts:305

Add an event listener

Parameters

ParameterTypeDescription
eventkeyof IEventParamConfigkey of event
callback(params) => voidcallback when event triggered

Returns

IDisposable

The Disposable instance, for remove the listener

Example

univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
    console.log('unit created', params);
});

Inherited from

FUniver.addEvent


createUniverSheet()

createUniverSheet(data): FWorkbook

Defined in: sheets/src/facade/f-univer.ts:31

Parameters

ParameterType
dataPartial<IWorkbookData>

Returns

FWorkbook

Deprecated

use univerAPI.createWorkbook instead.

Inherited from

FUniver.createUniverSheet

createWorkbook()

createWorkbook(data): FWorkbook

Defined in: sheets/src/facade/f-univer.ts:42

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.

Example

univerAPI.createWorkbook({ id: 'Sheet1', name: 'Sheet1' });

Inherited from

FUniver.createWorkbook

customizeColumnHeader()

customizeColumnHeader(cfg): void

Defined in: sheets-ui/src/facade/f-univer.ts:46

Customize the column header of the spreadsheet.

Parameters

ParameterTypeDescription
cfgIColumnsHeaderCfgParamThe configuration of the column header.

Returns

void

Example

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

Inherited from

FUniver.customizeColumnHeader

customizeRowHeader()

customizeRowHeader(cfg): void

Defined in: sheets-ui/src/facade/f-univer.ts:55

Customize the row header of the spreadsheet.

Parameters

ParameterTypeDescription
cfgIRowsHeaderCfgParamThe configuration of the row header.

Returns

void

Example

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

Inherited from

FUniver.customizeRowHeader

dispose()

dispose(): void

Defined in: core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FUniver.dispose


disposeUnit()

disposeUnit(unitId): boolean

Defined in: core/src/facade/f-univer.ts:189

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.

Inherited from

FUniver.disposeUnit


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FUniver.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FUniver.ensureNotDisposed


executeCommand()

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

Defined in: core/src/facade/f-univer.ts:249

Execute a command with the given id and parameters.

Type Parameters

Type ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterTypeDescription
idstringIdentifier of the command.
params?PParameters of this execution.
options?IExecutionOptionsOptions of this execution.

Returns

Promise<R>

The result of the execution. It is a boolean value by default which indicates the command is executed.

Inherited from

FUniver.executeCommand


fireEvent()

protected fireEvent<T>(event, params): undefined | boolean

Defined in: core/src/facade/f-univer.ts:320

Fire an event, used in internal only.

Type Parameters

Type Parameter
T extends keyof IEventParamConfig

Parameters

ParameterTypeDescription
eventT{string} key of event
paramsIEventParamConfig[T]{any} params of event

Returns

undefined | boolean

should cancel

Example

this.fireEvent(univerAPI.event.UnitCreated, params);

Inherited from

FUniver.fireEvent


getActiveUniverSheet()

getActiveUniverSheet(): null | FWorkbook

Defined in: sheets/src/facade/f-univer.ts:57

Returns

null | FWorkbook

Deprecated

use univerAPI.getActiveWorkbook instead

Inherited from

FUniver.getActiveUniverSheet

getActiveWorkbook()

getActiveWorkbook(): null | FWorkbook

Defined in: sheets/src/facade/f-univer.ts:52

Get the currently focused Univer spreadsheet.

Returns

null | FWorkbook

The currently focused Univer spreadsheet.

Example

univerAPI.getActiveWorkbook();

Inherited from

FUniver.getActiveWorkbook

getCommandSheetTarget()

getCommandSheetTarget(commandInfo): Nullable<{
  workbook: FWorkbook;
  worksheet: FWorksheet;
}>

Defined in: sheets/src/facade/f-univer.ts:113

Get the target of the sheet.

Parameters

ParameterTypeDescription
commandInfoICommandInfoThe commandInfo of the command.

Returns

Nullable<{ workbook: FWorkbook; worksheet: FWorksheet; }>

  • The target of the sheet.

Example

univerAPI.addEvent(univerAPI.event.CommandExecuted, (commandInfo) => {
     const target = univerAPI.getCommandSheetTarget(commandInfo);
     if (!target) return;
     const { workbook, worksheet } = target;
});

Inherited from

FUniver.getCommandSheetTarget

getCurrentLifecycleStage()

getCurrentLifecycleStage(): LifecycleStages

Defined in: core/src/facade/f-univer.ts:197

Get the current lifecycle stage.

Returns

LifecycleStages

  • The current lifecycle stage.

Inherited from

FUniver.getCurrentLifecycleStage


getHooks()

getHooks(): FHooks

Defined in: core/src/facade/f-univer.ts:277

Get hooks.

Returns

FHooks

FHooks instance

Deprecated

use addEvent instead.

Inherited from

FUniver.getHooks


getPermission()

getPermission(): FPermission

Defined in: sheets/src/facade/f-univer.ts:71

Get the PermissionInstance.

Returns

FPermission

Deprecated

This function is deprecated and will be removed in version 0.6.0. Please use the function with the same name on the FWorkbook instance instead.

Inherited from

FUniver.getPermission

getSheetHooks()

getSheetHooks(): FSheetHooks

Defined in: sheets-ui/src/facade/f-univer.ts:81

Returns

FSheetHooks

Deprecated

use univerAPI.addEvent as instead.

Inherited from

FUniver.getSheetHooks

getSheetTarget()

getSheetTarget(unitId, subUnitId): Nullable<{
  workbook: FWorkbook;
  worksheet: FWorksheet;
}>

Defined in: sheets/src/facade/f-univer.ts:98

Get the target of the sheet.

Parameters

ParameterTypeDescription
unitIdstringThe unitId of the sheet.
subUnitIdstringThe subUnitId of the sheet.

Returns

Nullable<{ workbook: FWorkbook; worksheet: FWorksheet; }>

  • The target of the sheet.

Example

univerAPI.getSheetTarget('unitId', 'subUnitId');

Inherited from

FUniver.getSheetTarget

getUniverSheet()

getUniverSheet(id): null | FWorkbook

Defined in: sheets/src/facade/f-univer.ts:64

Get the spreadsheet API handler by the spreadsheet id.

Parameters

ParameterTypeDescription
idstringThe spreadsheet id.

Returns

null | FWorkbook

The spreadsheet API instance.

Inherited from

FUniver.getUniverSheet

getUserManager()

getUserManager(): FUserManager

Defined in: core/src/facade/f-univer.ts:338

Returns

FUserManager

Inherited from

FUniver.getUserManager


getWorkbook()

getWorkbook(id): null | FWorkbook

Defined in: sheets/src/facade/f-univer.ts:66

Parameters

ParameterType
idstring

Returns

null | FWorkbook

Inherited from

FUniver.getWorkbook

hasEventCallback()

protected hasEventCallback(event): boolean

Defined in: core/src/facade/f-univer.ts:333

Get the callback map corresponding to the event

Parameters

ParameterType
eventkeyof IEventParamConfig

Returns

boolean

The number of callbacks

Inherited from

FUniver.hasEventCallback


newBlob()

newBlob(): FBlob

Defined in: core/src/facade/f-univer.ts:350

Create a new blob.

Returns

FBlob

The new blob instance

Example

const blob = univerApi.newBlob();

Inherited from

FUniver.newBlob


newColor()

newColor(): ColorBuilder

Defined in: core/src/facade/f-univer.ts:362

Create a new color.

Returns

ColorBuilder

The new color instance

Example

const color = univerApi.newColor();

Inherited from

FUniver.newColor


newDefinedName()

newDefinedName(): FDefinedNameBuilder

Defined in: sheets/src/facade/f-univer.ts:86

Create a new defined name builder.

Returns

FDefinedNameBuilder

  • The defined name builder.

Example

univerAPI.newDefinedName();

Inherited from

FUniver.newDefinedName

newParagraphStyle()

newParagraphStyle(style?): ParagraphStyleBuilder

Defined in: core/src/facade/f-univer.ts:401

Create a new paragraph style.

Parameters

ParameterTypeDescription
style?IParagraphStyleThe paragraph style

Returns

ParagraphStyleBuilder

The new paragraph style instance

Example

const paragraphStyle = univerApi.newParagraphStyle();

Inherited from

FUniver.newParagraphStyle


newParagraphStyleValue()

newParagraphStyleValue(style?): ParagraphStyleValue

Defined in: core/src/facade/f-univer.ts:414

Create a new paragraph style value.

Parameters

ParameterTypeDescription
style?IParagraphStyleThe paragraph style

Returns

ParagraphStyleValue

The new paragraph style value instance

Example

const paragraphStyleValue = univerApi.newParagraphStyleValue();

Inherited from

FUniver.newParagraphStyleValue


newRichText()

newRichText(data?): RichTextBuilder

Defined in: core/src/facade/f-univer.ts:375

Create a new rich text.

Parameters

ParameterType
data?IDocumentData

Returns

RichTextBuilder

The new rich text instance

Example

const richText = univerApi.newRichText();

Inherited from

FUniver.newRichText


newRichTextValue()

newRichTextValue(data): RichTextValue

Defined in: core/src/facade/f-univer.ts:388

Create a new rich text value.

Parameters

ParameterTypeDescription
dataIDocumentDataThe rich text data

Returns

RichTextValue

The new rich text value instance

Example

const richTextValue = univerApi.newRichTextValue();

Inherited from

FUniver.newRichTextValue


newTextDecoration()

newTextDecoration(decoration?): TextDecorationBuilder

Defined in: core/src/facade/f-univer.ts:444

Parameters

ParameterType
decoration?ITextDecoration

Returns

TextDecorationBuilder

Inherited from

FUniver.newTextDecoration


newTextStyle()

newTextStyle(style?): TextStyleBuilder

Defined in: core/src/facade/f-univer.ts:427

Create a new text style.

Parameters

ParameterTypeDescription
style?ITextStyleThe text style

Returns

TextStyleBuilder

The new text style instance

Example

const textStyle = univerApi.newTextStyle();

Inherited from

FUniver.newTextStyle


newTextStyleValue()

newTextStyleValue(style?): TextStyleValue

Defined in: core/src/facade/f-univer.ts:440

Create a new text style value.

Parameters

ParameterTypeDescription
style?ITextStyleThe text style

Returns

TextStyleValue

The new text style value instance

Example

const textStyleValue = univerApi.newTextStyleValue();

Inherited from

FUniver.newTextStyleValue


onBeforeCommandExecute()

onBeforeCommandExecute(callback): IDisposable

Defined in: core/src/facade/f-univer.ts:224

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

Parameters

ParameterTypeDescription
callbackCommandListenerThe callback.

Returns

IDisposable

The disposable instance.

Deprecated

use addEvent(univerAPI.event.BeforeCommandExecute, () => {}) instead.

Inherited from

FUniver.onBeforeCommandExecute


onCommandExecuted()

onCommandExecuted(callback): IDisposable

Defined in: core/src/facade/f-univer.ts:236

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

Parameters

ParameterTypeDescription
callbackCommandListenerThe callback.

Returns

IDisposable

The disposable instance.

Deprecated

use addEvent(univerAPI.event.CommandExecuted, () => {}) instead.

Inherited from

FUniver.onCommandExecuted


onUniverSheetCreated()

onUniverSheetCreated(callback): IDisposable

Defined in: sheets/src/facade/f-univer.ts:76

Parameters

ParameterType
callback(workbook) => void

Returns

IDisposable

Deprecated

Use univerAPI.addEvent(univerAPI.Event.UnitCreated, () => {})

Inherited from

FUniver.onUniverSheetCreated

redo()

redo(): Promise<boolean>

Defined in: core/src/facade/f-univer.ts:214

Redo an editing on the currently focused document.

Returns

Promise<boolean>

redo result

Inherited from

FUniver.redo


registerSheetColumnHeaderExtension()

registerSheetColumnHeaderExtension(unitId, ...extensions): IDisposable

Defined in: sheets-ui/src/facade/f-univer.ts:69

Register sheet column header render extensions.

Parameters

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

Returns

IDisposable

The disposable instance.

Inherited from

FUniver.registerSheetColumnHeaderExtension

registerSheetMainExtension()

registerSheetMainExtension(unitId, ...extensions): IDisposable

Defined in: sheets-ui/src/facade/f-univer.ts:76

Register sheet main render extensions.

Parameters

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

Returns

IDisposable

The disposable instance.

Inherited from

FUniver.registerSheetMainExtension

registerSheetRowHeaderExtension()

registerSheetRowHeaderExtension(unitId, ...extensions): IDisposable

Defined in: sheets-ui/src/facade/f-univer.ts:62

Register sheet row header render extensions.

Parameters

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

Returns

IDisposable

The disposable instance.

Inherited from

FUniver.registerSheetRowHeaderExtension

syncExecuteCommand()

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

Defined in: core/src/facade/f-univer.ts:264

Execute a command with the given id and parameters synchronously.

Type Parameters

Type ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterTypeDescription
idstringIdentifier of the command.
params?PParameters of this execution.
options?IExecutionOptionsOptions of this execution.

Returns

R

The result of the execution. It is a boolean value by default which indicates the command is executed.

Inherited from

FUniver.syncExecuteCommand


undo()

undo(): Promise<boolean>

Defined in: core/src/facade/f-univer.ts:206

Undo an editing on the currently focused document.

Returns

Promise<boolean>

undo result

Inherited from

FUniver.undo


extend()

static extend(source): void

Defined in: core/src/facade/f-base.ts:68

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FUniver.extend


newAPI()

static newAPI(wrapped): FUniver

Defined in: core/src/facade/f-univer.ts:50

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

Parameters

ParameterTypeDescription
wrapped| Injector | UniverThe Univer instance or injector instance.

Returns

FUniver

  • The FUniver instance.

Static

Inherited from

FUniver.newAPI