/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { NavigationOptions, DiagramChangeEvent, DiagramDomEvent, DiagramDragEvent, DiagramItemBoundsChangeEvent, DiagramPanEvent, DiagramSelectEvent, DiagramZoomEndEvent, DiagramZoomStartEvent, DiagramEditable, DiagramLayout, Pannable, Selectable } from '@progress/kendo-diagram-common'; import { ConnectionDefaults, ConnectionModelFields, ConnectionOptions } from './ConnectionTypes'; import { ShapeDefaults, ShapeModelFields, ShapeOptions } from './ShapeTypes'; /** * Represents a typed item or a custom data object used for data binding in the `Diagram`. * When `T` is provided, the item is a known typed option (e.g., `ShapeOptions` or `ConnectionOptions`). * Otherwise, it can be a custom object that will be mapped using the corresponding model fields configuration. */ export type DiagramDataItem = T | Record; /** * Defines the navigation configuration options for the `Diagram`. */ export interface DiagramNavigationOptions extends Pick { /** * Controls whether navigation is enabled. */ enabled?: boolean; } /** * Represents the props of the [KendoReact Diagram component](https://www.telerik.com/kendo-react-ui/components/diagram). */ export interface DiagramProps { /** * Defines the default configuration options applicable to all connections. */ connectionDefaults?: ConnectionDefaults; /** * Defines the connections that render between the shapes in the `Diagram`. * Accepts either an array of `ConnectionOptions` or an array of any objects * that will be mapped using the `connectionModelFields` configuration. */ connections?: DiagramDataItem[]; /** * Defines the field mapping configuration for connections data binding. * Maps source object properties to `Diagram` connection properties. * Only used when `connections` is an array of custom objects instead of `ConnectionOptions`. */ connectionModelFields?: ConnectionModelFields; /** * A set of settings to configure the `Diagram` behavior when the user attempts to drag, resize, or remove shapes. * Changing the property value dynamically triggers a reinitialization of the `Diagram`. * * @default true */ editable?: boolean | DiagramEditable; /** * Defines the layout configuration for arranging shapes and connections in the `Diagram`. */ layout?: DiagramLayout; /** * Defines the pannable options. Use this setting to disable `Diagram` pan or change the key that activates the pan behavior. * * @default true */ pannable?: boolean | Pannable; /** * Defines the `Diagram` selection options. * * @default true */ selectable?: boolean | Selectable; /** * Defines the default configuration options applicable to all shapes. */ shapeDefaults?: ShapeDefaults; /** * Defines the shapes that render in the `Diagram`. * Accepts either an array of `ShapeOptions` or an array of any objects * that will be mapped using the `shapeModelFields` configuration. */ shapes?: DiagramDataItem[]; /** * Defines the field mapping configuration for shapes data binding. * Maps source object properties to `Diagram` shape properties. * Only used when `shapes` is an array of custom objects instead of `ShapeOptions`. */ shapeModelFields?: ShapeModelFields; /** * Defines the zoom level of the `Diagram`. * * @default 1 */ zoom?: number; /** * Defines the maximum zoom level of the `Diagram`. * * @default 2 */ zoomMax?: number; /** * Defines the minimum zoom level of the `Diagram`. * * @default 0.1 */ zoomMin?: number; /** * Defines the zoom rate of the `Diagram`. * * @default 0.1 */ zoomRate?: number; /** * Enables keyboard navigation in the `Diagram`. * When set to `true`, navigate between shapes using arrow keys. * Alternatively, pass a `DiagramNavigationOptions` object to customize navigation behavior. * * @default true * * @remarks * This property is related to accessibility. */ navigable?: boolean | DiagramNavigationOptions; /** * Fires when a shape or connection is created or removed. */ onChange?: (event: DiagramChangeEvent) => void; /** * Fires when the user clicks on a shape or a connection. */ onDiagramClick?: (event: DiagramDomEvent) => void; /** * Fires when the user drags an item. */ onDrag?: (event: DiagramDragEvent) => void; /** * Fires when the user stops dragging an item. */ onDragEnd?: (event: DiagramDragEvent) => void; /** * Fires when the user starts dragging an item. */ onDragStart?: (event: DiagramDragEvent) => void; /** * Fires when the location or size of an item are changed. */ onShapeBoundsChange?: (event: DiagramItemBoundsChangeEvent) => void; /** * Fires when the mouse pointer enters a shape or connection. */ onMouseEnter?: (event: DiagramDomEvent) => void; /** * Fires when the mouse pointer leaves a shape or connection. */ onMouseLeave?: (event: DiagramDomEvent) => void; /** * Fires when the user pans the `Diagram`. */ onPan?: (event: DiagramPanEvent) => void; /** * Fires when the user selects one or more items. */ onSelect?: (event: DiagramSelectEvent) => void; /** * Fires when the `Diagram` has finished zooming out. */ onZoomEnd?: (event: DiagramZoomEndEvent) => void; /** * Fires when the `Diagram` starts zooming in or out. */ onZoomStart?: (event: DiagramZoomStartEvent) => void; /** * Fires when a tooltip should be shown for a shape or connection. */ onTooltipShow?: (item: ShapeOptions | ConnectionOptions) => void; /** * Fires when a tooltip should be hidden. */ onTooltipHide?: (item: ShapeOptions | ConnectionOptions) => void; /** * Sets the inline styles for the outermost wrapper element of the `Diagram`. * * @example * ```tsx * * ``` */ style?: React.CSSProperties; /** * Sets additional CSS class names on the outermost wrapper element of the `Diagram`. * * @example * ```tsx * * ``` */ className?: string; /** * Sets the `role` attribute on the outermost wrapper element of the `Diagram`. * * @default 'application' */ role?: string; /** * Sets the `aria-label` attribute on the outermost wrapper element of the `Diagram`. */ ariaLabel?: string; /** * @hidden */ children?: React.ReactNode; }