New to KendoReact? Start a free 30-day trial

Definition

Package:@progress/kendo-react-diagram

Properties

The layer group that contains adorners for selection and editing.

The canvas element used for rendering the diagram.

Array of all connections in the diagram.

element

HTMLElement

The HTML element that contains the diagram.

events

string[]

Array of event names that this observable supports.

id

string

The unique identifier of the diagram.

The main layer group that contains all diagram elements.

Configuration options for the observable instance.

Indicates whether mouse handlers should be paused.

The scrollable container element.

The scroller component for panning.

selector

Selector

The selector tool for area selection.

Array of all shapes in the diagram.

size?

{ width: number; height: number }

The current size of the diagram viewport.

toolService

ToolService

The tool service that manages diagram tools and interactions.

Service for managing undo/redo operations.

wrapper

HTMLElement

The wrapper element for the diagram content.

Methods

Adds a connection to the diagram.

Parameters:connectionConnection

The connection to add.

undoable?boolean

Whether the operation can be undone. Defaults to true.

Returns:

Connection

The newly created connection.

Adds a shape to the diagram.

Parameters:itemShapeOptionsBase | Shape

A Shape instance or shape configuration used to create one. If a plain object is passed, a new Shape is created from it e.g. { x: 10, y: 10, width: 100, height: 50 }.

undoable?boolean

Indicates whether the operation should be added to the undo stack.

Returns:

Shape

The newly created shape.

Aligns shapes in the specified direction.

Parameters:direction?"left" | "right" | "top" | "bottom"

The alignment direction ('left', 'right', 'top', 'bottom')

Binds event handlers to one or more events.

Parameters:eventEventNames | { [key: string]: Handler }

The event name(s) to bind to, or an object mapping event names to handlers

handlers?EventHandlers

The event handler(s) to bind. Can be a function or an object mapping event names to handlers

one?boolean

If true, the handler will be executed only once and then automatically unbound

Returns:

this

The Observable instance for method chaining

Gets the bounding rectangle of the given items.

Parameters:itemsDiagramSelectionItem | DiagramSelectionItem[]

Shape, Connection or array of Shape and Connection instances.

origin?boolean

Boolean. Pass 'true' if you need to get the bounding box of the shapes without their rotation offset.

Returns:

Rect

The bounding rectangle of the items.

Brings the specified items or rectangle into view.

Parameters:itemRect | DiagramSelectionItem | DiagramSelectionItem[]

A shape, connection, array of diagram items, or rectangle to bring into view.

options?{ animate?: boolean; align?: string }

Options that control alignment and whether the pan is animated.

Clears the diagram by removing all selections and elements, then reinitializes.

Creates a connection between two endpoints (shapes, connectors, or points).

Parameters:sourceDiagramConnectionEndpoint

The source endpoint

targetDiagramConnectionEndpoint

The target endpoint

options?Partial​<ConnectionOptionsBase>

Optional connection configuration

Returns:

Connection

The newly created connection

Determines whether two diagram endpoints are connected.

Parameters:sourceDiagramConnectionEndpoint

The source shape, connector, or point.

targetDiagramConnectionEndpoint

The target shape, connector, or point.

Returns:

boolean

true when the endpoints are connected; otherwise, false.

Copies the currently selected items to the clipboard.

Cuts the currently selected items to the clipboard and removes them from the diagram.

Deselects items from the current selection.

Parameters:item?DiagramSelectionItem | DiagramSelectionItem[]

The item(s) to deselect. If not provided, deselects all items.

Destroys the diagram and cleans up all resources. Removes event listeners, destroys components, and clears all elements.

Destroys the scroller component and removes its element.

Converts a point from document coordinates to model coordinates.

Parameters:pointPoint

The point in document coordinates

Returns:

Point

The point in model coordinates

Converts a point from document coordinates to view coordinates.

Parameters:pointPoint

The point in document coordinates

Returns:

Point

The point in view coordinates

Exports the diagram's DOM visual representation for rendering or export purposes. Creates a clipped group containing the canvas content with proper transformations.

Returns:

Group

A drawing Group element containing the exported DOM visual

Exports the diagram's visual representation with proper scaling based on zoom level. Creates a scaled group containing the main layer content.

Returns:

Group

A drawing Group element containing the exported visual with inverse zoom scaling

Binds event handlers to be executed first (prepends to the handlers list). These handlers will be called before any previously bound handlers for the same event.

Parameters:eventNameEventNames

The event name(s) to bind to

handlersEventHandlers

The event handler(s) to bind

Returns:

this

The Observable instance for method chaining

Sets focus to the diagram element.

Returns:

undefined | boolean

True if focus was set, undefined otherwise

Gets a shape or connection by its unique identifier.

Parameters:idstring

The unique identifier of the diagram item

Returns:

undefined | DiagramSelectionItem

The matching shape or connection, or undefined if not found

Gets a shape by its model ID.

Parameters:idstring

The model ID of the shape

Returns:

undefined | Shape

The shape with the specified model ID, or undefined if not found

Gets a shape by its model UID.

Parameters:uidstring

The model UID of the shape

Returns:

undefined | Shape

The shape with the specified model UID, or undefined if not found

Converts a point from layer coordinates to model coordinates.

Parameters:pointPoint

The point in layer coordinates.

Returns:

Point

The converted point in model coordinates.

Converts a rectangle from layer coordinates to model coordinates.

Parameters:pointRect

The rectangle in layer coordinates.

Returns:

Rect

The converted rectangle in model coordinates.

Performs a diagram layout of the given type.

Parameters:options?{ [key: string]: any }

Layout-specific options.

Loads diagram data and recreates shapes and connections.

Parameters:optionsDiagramOptions

The diagram options containing shapes and connections data

Converts a point from model coordinates to document coordinates.

Parameters:pointPoint

The point in model coordinates

Returns:

Point

The point in document coordinates

Converts a point from model coordinates to layer coordinates.

Parameters:pointPoint

The point in model coordinates.

Returns:

Point

The converted point in layer coordinates.

Converts a rectangle from model coordinates to layer coordinates.

Parameters:pointRect

The rectangle in model coordinates.

Returns:

Rect

The converted rectangle in layer coordinates.

Converts a point from model coordinates to view coordinates.

Parameters:pointPoint

The point in model coordinates.

Returns:

Point

The converted point in view coordinates.

Converts a rectangle from model coordinates to view coordinates.

Parameters:pointRect

The rectangle in model coordinates.

Returns:

Rect

The converted rectangle in view coordinates.

Binds event handlers that will be executed only once. After execution, the handlers are automatically unbound.

Parameters:eventNamesEventNames

The event name(s) to bind to

handlersEventHandlers

The event handler(s) to bind

Returns:

this

The Observable instance for method chaining

Gets the current pan offset of the diagram.

Returns:

Point

The current pan offset.

Sets the pan offset of the diagram.

Parameters:panPoint

The new pan offset.

animate?boolean

Whether to animate the pan operation.

Gets whether pan mode is enabled.

Returns:

boolean

true when pan mode is enabled; otherwise, false.

Enables or disables pan mode. When enabled, the diagram can be panned by dragging the background.

Parameters:enabledboolean

Whether to enable pan mode.

Pastes items from the clipboard into the diagram.

Executes the previous undoable action on top of the redo stack if any.

Removes items (or single item) from the diagram.

Parameters:itemsDiagramSelectionItem | DiagramSelectionItem[]

Shape, Connection or array of Shape and Connection instances.

undoable?boolean

Indicates whether the operation should be added to the undo stack.

Serializes the diagram to a JSON object containing shapes and connections.

Returns:

{ shapes: ShapeOptionsBase[]; connections: ConnectionOptionsBase[] }

Object with shapes and connections arrays

Gets the currently selected diagram items.

Returns:

DiagramSelectionItem[]

The currently selected items.

Selects or deselects diagram items.

Parameters:itemfalse | DiagramSelectionItem | DiagramSelectionItem[]

The item or items to select, or false to deselect all items.

options?{ addToSelection?: boolean }

The selection options.

Selects all shapes and connections in the diagram.

Selects shapes and connections within a rectangular area.

Parameters:rectRect

The rectangular area to select items within

Sets options for the diagram by deep extending the current options.

Parameters:optionsDiagramOptions

The options to merge with current diagram options

Sends to back the passed items.

Parameters:items?DiagramSelectionItem | DiagramSelectionItem[]

Shape, Connection or array of Shape and Connection instances. If omitted, the current selection is used.

undoable?boolean

Whether the operation can be undone. Defaults to true.

Brings to front the passed items.

Parameters:items?DiagramSelectionItem | DiagramSelectionItem[]

Shape, Connection or array of Shape and Connection instances. If omitted, the current selection is used.

undoable?boolean

Whether the operation can be undone. Defaults to true.

Triggers an event, calling all bound handlers for that event.

Parameters:eventNamestring

The name of the event to trigger

eventArgs?any

Optional event arguments to pass to the handlers

Returns:

boolean

True if any handler called preventDefault(), false otherwise

Removes event handlers from events.

Parameters:eventName?string

The event name to unbind from. If undefined, all events are unbound

handler?EventHandlers

The specific handler to remove. If undefined, all handlers for the event are removed

Returns:

this

The Observable instance for method chaining

Executes the next undoable action on top of the undo stack if any.

Gets the viewport rectangle of the diagram.

Returns:

Rect

A Rect representing the current viewport

Converts a point from view coordinates to document coordinates.

Parameters:pointPointLike

The point in view coordinates

Returns:

Point

The point in document coordinates

Converts a point from view coordinates to model coordinates.

Parameters:pointPoint

The point in view coordinates.

Returns:

Point

The converted point in model coordinates.

Converts a rectangle from view coordinates to model coordinates.

Parameters:pointRect

The rectangle in view coordinates.

Returns:

Rect

The converted rectangle in model coordinates.

Gets the current zoom level of the diagram.

Returns:

number

The current zoom level.

Sets the zoom level of the diagram.

Parameters:zoomnumber

The zoom level to set, where 1 represents 100%.

options?{ point?: Point; zoom?: number }

The zoom operation options.

Returns:

number

The applied zoom level.