Interface BehaviouralTypeDescriptor<T>

Extends EndpointTypeDescriptor to add the options supported by an addSourceSelector or addTargetSelector call.

interface BehaviouralTypeDescriptor<T> {
    allowLoopback?: boolean;
    anchor?: AnchorSpec;
    anchorPositionFinder?: ((el, elxy, def, e) => AnchorSpec);
    anchors?: [AnchorSpec, AnchorSpec];
    canAcceptNewConnection?: ((el, e) => boolean);
    connectionsDetachable?: boolean;
    connector?: ConnectorSpec;
    connectorClass?: string;
    connectorHoverStyle?: PaintStyle;
    connectorStyle?: PaintStyle;
    cssClass?: string;
    edgeType?: string;
    endpoint?: EndpointSpec;
    extract?: Record<string, string>;
    hoverPaintStyle?: PaintStyle;
    maxConnections?: number;
    mergeStrategy?: string;
    onMaxConnections?: ((value, event?) => any);
    overlays?: OverlaySpec[];
    paintStyle?: PaintStyle;
    parameterExtractor?: ((el, eventTarget, event) => Record<string, any>);
    parameters?: Record<string, any>;
    parentSelector?: string;
    portId?: string;
    rank?: number;
    reattachConnections?: boolean;
    redrop?: RedropPolicy;
    scope?: string;
    source?: boolean;
    target?: boolean;
    uniqueEndpoint?: boolean;
}

Type Parameters

  • T = any

Hierarchy (view full)

Properties

allowLoopback?: boolean

Defaults to true. If false, the user will not be permitted to drag a connection from the current node to itself.

anchor?: AnchorSpec

Spec for the anchor to use for both source and target.

anchorPositionFinder?: ((el, elxy, def, e) => AnchorSpec)

This function offers a means for you to provide the anchor to use for a new drag, or a drop. You're given the source/target element, the proportional location on the element that the drag started/drop occurred, the associated type descriptor, and the originating event. Return null if you don't wish to provide a value, and any other return value will be treated as an AnchorSpec.

Type declaration

anchors?: [AnchorSpec, AnchorSpec]

[source, target] anchor specs for edges.

canAcceptNewConnection?: ((el, e) => boolean)

Optional function that is used to determine whether at the start of a drag, a given element is able to accept new connections. For a source element returning false from here aborts the connection drag. For a target element returning false from here means the target element is not active as a drop target.

Type declaration

    • (el, e): boolean
    • Parameters

      • el: Element
      • e: Event

      Returns boolean

connectionsDetachable?: boolean

Whether or not connections created from this endpoint should be detachable via the mouse. Defaults to true.

connector?: ConnectorSpec

Spec for connectors created for this type.

connectorClass?: string

Class to add to any connectors created for this type.

connectorHoverStyle?: PaintStyle

Paint style for connectors created for this type when pointer is hovering over the component.

connectorStyle?: PaintStyle

Paint style for connectors created for this type.

cssClass?: string

CSS class to add to the given component's representation in the UI

edgeType?: string

Optional type for connections dragged from a source selector. This option is ignored for target selectors.

endpoint?: EndpointSpec

Spec for an endpoint created for this type.

extract?: Record<string, string>

Optional set of values to extract from an element when a drag starts from that element. For target selectors this option is ignored.

hoverPaintStyle?: PaintStyle

Paint style to use for the component when the pointer is hovering over it.

maxConnections?: number

Maximum number of connections this endpoint can support. Defaults to 1. A value of -1 means unlimited.

mergeStrategy?: string

When merging a type description into its parent(s), values in the child for connector, anchor and anchors will always overwrite any such values in the parent. But other values, such as overlays, will be merged with their parent's entry for that key. You can force a child's type to override every corresponding value in its parent by setting mergeStrategy:'override'.

onMaxConnections?: ((value, event?) => any)

Optional function to call if the user begins a new connection drag when the associated element is full.

Type declaration

    • (value, event?): any
    • Parameters

      • value: any
      • Optional event: any

      Returns any

overlays?: OverlaySpec[]

Array of overlays to add.

paintStyle?: PaintStyle

Paint style to use for the component.

parameterExtractor?: ((el, eventTarget, event) => Record<string, any>)

A function that can be used to extract a set of parameters pertinent to the connection that is being dragged from a given source or dropped on a given target.

Type declaration

    • (el, eventTarget, event): Record<string, any>
    • Parameters

      • el: T

        The element that is the drag source

      • eventTarget: T

        The element that captured the event that started the connection drag.

      • event: Event

      Returns Record<string, any>

parameters?: Record<string, any>

Optional set of parameters to store on the component that is generated from this type.

parentSelector?: string

Optional selector identifying the ancestor of the event target that could be the element to which connections are added. By default this is the internal attribute jsPlumb uses to mark managed elements (data-jtk-managed)

portId?: string

Optional logical id for the endpoint associated with a source or target selector.

rank?: number

Optional rank for a given source or target selector. When selecting a selector from a list of candidates, rank can be used to prioritise them. Higher values take precedence.

reattachConnections?: boolean

Whether or not when a user detaches a connection that was created from this endpoint it should be automatically reattached. Defaults to false.

redrop?: RedropPolicy

Optional policy for dropping existing connections that have been detached by their source/target.

  • 'strict' (RedropPolicy.STRICT) indicates that a connection can only be dropped back onto a part of an element that matches the original source/target's selector.

  • 'any' (RedropPolicy.ANY) indicates that a connection can be dropped anywhere onto an element.

  • 'anySource' (RedropPolicy.ANY_SOURCE) indicates that a connection can be dropped onto any part of an element that is configured as a source selector.

  • 'anyTarget' (RedropPolicy.ANY_TARGET) indicates that a connection can be dropped onto any part of an element that is configured as a target selector.

  • 'anySourceOrTarget' (RedropPolicy.ANY_SOURCE_OR_TARGET) indicates that a connection can be dropped onto any part of an element that is configured as a source selector or a target selector.

scope?: string

Provides a simple means for controlling connectivity in the UI.

source?: boolean

Whether or not an endpoint created from this definition should subsequently behave as a source for dragging connections with the mouse.

target?: boolean

Whether or not an endpoint created from this definition should subsequently behave as a target for dragging connections with the mouse.

uniqueEndpoint?: boolean

If true, only one endpoint will be created on any given element for this type descriptor, and subsequent connections will all attach to that endpoint. Defaults to false.

Version :