FWorksheetShapeMixin

GitHubEdit on GitHub
packages@univerjs-pro/sheets-shape-ui

Mixin facade APIs for inserting, updating, querying, and connecting sheet shapes.

APIs

insertShape

Adds a new shape to this sheet.

Signature

insertShape(shapeBuilderInfo: IShapeBuilderInfo): Promise<boolean>

Parameters

  • shapeBuilderInfo (IShapeBuilderInfo) - Shape info returned by FShape.build().

Returns

  • (Promise<boolean>) - Whether insertion succeeded.

updateShape

Updates an existing shape on this sheet.

Signature

updateShape(shapeBuilderInfo: IShapeBuilderInfo): Promise<boolean>

Parameters

  • shapeBuilderInfo (IShapeBuilderInfo) - Shape info returned by FShape.build().

Returns

  • (Promise<boolean>) - Whether update succeeded.

newShape

Creates a shape builder. It does not insert a shape until insertShape is called.

Signature

newShape(existingShape?: FShape): FShape

Parameters

  • existingShape (FShape, optional) - Existing shape used to initialize builder values for update scenarios.

Returns

  • (FShape) - Shape builder instance.

getShapes

Returns all shapes on this sheet.

Signature

getShapes(): FShape[]

Returns

  • (FShape[]) - Shape list on current sheet.

removeShape

Removes a shape from this sheet.

Signature

removeShape(shape: FShape): Promise<boolean>

Parameters

  • shape (FShape) - Target shape to remove.

Returns

  • (Promise<boolean>) - Whether removal succeeded.

connectShapes

Connects a connector shape endpoints to target shape connection sites.

Signature

connectShapes(params: IConnectShapesParams): Promise<boolean>

Parameters

  • params (IConnectShapesParams) - Connection parameters.
  • params.connector (FShape) - Connector shape to update.
  • params.startTarget ({ shape: FShape; connectionSiteIndex: number }, optional) - Start endpoint target.
  • params.endTarget ({ shape: FShape; connectionSiteIndex: number }, optional) - End endpoint target.

Returns

  • (Promise<boolean>) - Whether connection operation succeeded.

newConnector

Creates a connector builder. It does not insert a connector until insertShape is called.

Signature

newConnector(existingShape?: FShape): FConnectorShape

Parameters

  • existingShape (FShape, optional) - Existing connector used to initialize builder values.

Returns

  • (FConnectorShape) - Connector builder instance.