sesaparcours
    Preparing search index...

    JsPlumbInstance that renders to the DOM in a browser, and supports dragging of elements/connections.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    _idstamp addClass addDragFilter addEndpoint addEndpoints addGroup addOverlay addSourceSelector addTargetSelector addToDragGroup addToDragSelection addToGroup batch bind checkCondition clearDragGroup clearDragSelection collapseGroup connect consume deleteConnectionsForElement deleteEndpoint deleteEveryConnection destroy each expandGroup fire fireMoveEvent getAttribute getClass getConnections getConnectionType getContainer getEndpoint getEndpoints getEndpointType getGroup getGroupFor getId getListener getManagedElement getManagedElements getPosition getSuspendedAt getType hasClass hide importDefaults isDraggable isHoverSuspended isSuspendEvents manage manageAll off on registerConnectionType registerConnectionTypes registerEndpointType registerEndpointTypes removeAllEndpoints removeAllGroups removeAttribute removeClass removeDragFilter removeFromDragGroup removeFromDragSelection removeFromGroup removeGroup removeOverlay removeSourceSelector removeTargetSelector repaint repaintEverything reset restoreDefaults revalidate rotate select selectEndpoints setAttribute setAttributes setColor setConnectionType setContainer setDragConstrainFunction setDraggable setDragGrid setDragGroupState setElementPosition setEndpointUuid setLineStyle setLineWidth setOutlineColor setOutlineWidth setOverlayVisible setSource setSuspendDrawing setSuspendEvents setTarget setZoom shouldFireEvent show silently toggleClass toggleDraggable toggleDragSelection toggleGroup toggleVisible trigger unbind unmanage updateOffset

    Constructors

    Properties

    _connectorClick: Function
    _connectorContextmenu: Function
    _connectorDblClick: Function
    _connectorDblTap: Function
    _connectorMousedown: Function
    _connectorMouseout: Function
    _connectorMouseover: Function
    _connectorMouseup: Function
    _connectorTap: Function
    _elementClick: Function
    _elementContextmenu: Function
    _elementDblTap: Function
    _elementMousedown: Function
    _elementMouseenter: Function
    _elementMouseexit: Function
    _elementMousemove: Function
    _elementMouseup: Function
    _elementTap: Function
    _endpointClick: Function
    _endpointDblClick: Function
    _endpointMousedown: Function
    _endpointMouseout: Function
    _endpointMouseover: Function
    _endpointMouseup: Function
    _instanceIndex: number
    _overlayClick: Function
    _overlayDblClick: Function
    _overlayDblTap: Function
    _overlayMouseout: Function
    _overlayMouseover: Function
    _overlayTap: Function
    _suspendDrawing: boolean
    _suspendedAt: string
    allowNestedGroups: boolean
    connectedClass: string
    connections: Connection<any>[]
    connectorClass: string
    connectorOutlineClass: string
    containerType: "SVG" | "HTML"
    currentlyDragging: boolean
    draggingClass: string
    dragManager: DragManager
    dragSelectClass: string
    elementDraggingClass: string
    elementsDraggable: boolean

    Whether or not elements should be draggable. This can be provided in the constructor arguments, or simply toggled on the class. The default value is true.

    endpointAnchorClassPrefix: string
    endpointClass: string
    endpointConnectedClass: string
    endpointDropAllowedClass: string
    endpointDropForbiddenClass: string
    endpointFloatingClass: string
    endpointFullClass: string
    endpointsByElement: Record<string, Endpoint[]>
    eventManager: EventManager
    groupManager: GroupManager<Element>
    hoverClass: string
    hoverSourceClass: string
    hoverSuspended: boolean
    hoverTargetClass: string
    isConnectionBeingDragged: boolean
    managedElementsSelector: string
    overlayClass: string
    router: Router<{ E: Element }, any>
    sourceElementDraggingClass: string
    sourceSelectors: ConnectionDragSelector[]
    svg: {
        attr: (node: SVGElement, attributes: ElementAttributes) => void;
        node: (name: string, attributes?: ElementAttributes) => SVGElement;
        pos: (d: [number, number]) => string;
    }
    targetElementDraggingClass: string
    targetSelectors: ConnectionDragSelector[]
    viewport: Viewport<{ E: Element }>

    Accessors

    • get currentZoom(): number

      Returns number

    • get defaultScope(): string

      Returns string

    Methods

    • Returns string

    • Add one or more classes to the given element or list of elements.

      Parameters

      • el: Element | NodeListOf<Element>

        Element, or list of elements to which to add the class(es)

      • clazz: string

        A space separated list of classes to add.

      Returns void

    • Adds a filter to the list of filters used to determine whether or not a given event should start an element drag.

      Parameters

      • filter: string | Function

        CSS3 selector, or function that takes an element and returns true/false

      • Optionalexclude: boolean

        If true, the filter is inverted: anything but this value.

      Returns void

    • Adds an overlay to the given component, repainting the UI as necessary.

      Parameters

      • component: Component

        A Connection or Endpoint to add the overlay to

      • overlay: OverlaySpec

        Spec for the overlay

      • OptionaldoNotRevalidate: boolean

        Defaults to true. If false, a repaint won't occur after adding the overlay. This flag can be used when adding several overlays in a loop.

      Returns void

    • Registers a selector for connection drag on the instance. This is a newer version of the makeSource functionality that had been in jsPlumb since the early days (and which, in 5.x, has been removed). With this approach, rather than calling makeSource on every element, you can register a CSS selector on the instance that identifies something that is common to your elements. This will only respond to mouse/touch events on elements that are managed by the instance.

      Parameters

      • selector: string

        CSS3 selector identifying child element(s) of some managed element that should act as a connection source.

      • Optionalparams: BehaviouralTypeDescriptor<any>

        Options for the source: connector type, behaviour, etc.

      • Optionalexclude: boolean

        If true, the selector defines an 'exclusion': anything except elements that match this.

      Returns ConnectionDragSelector

    • Registers a selector for connection drag on the instance. This is a newer version of the makeTarget functionality that has been in jsPlumb since the early days. With this approach, rather than calling makeTarget on every element, you can register a CSS selector on the instance that identifies something that is common to your elements. This will only respond to mouse events on elements that are managed by the instance.

      Parameters

      • selector: string

        CSS3 selector identifying child element(s) of some managed element that should act as a connection target.

      • Optionalparams: BehaviouralTypeDescriptor<any>

        Options for the target

      • Optionalexclude: boolean

        If true, the selector defines an 'exclusion': anything except elements that match this.

      Returns ConnectionDragSelector

    • Adds the given element(s) to the given drag group.

      Parameters

      • spec: DragGroupSpec

        Either the ID of some drag group, in which case the elements are all added as 'active', or an object of the form { id:"someId", active:boolean }. In the latter case, active, if true, which is the default, indicates whether dragging the given element(s) should cause all the elements in the drag group to be dragged. If active is false it means the given element(s) is "passive" and should only move when an active member of the drag group is dragged.

      • ...els: Element[]

        Elements to add to the drag group.

      Returns void

    • Adds the given element(s) to the current drag selection.

      Parameters

      Returns void

    • Suspend drawing, run the given function, and then re-enable drawing, optionally repainting everything.

      Parameters

      • fn: Function

        Function to run while drawing is suspended.

      • OptionaldoNotRepaintAfterwards: boolean

        Whether or not to repaint everything after drawing is re-enabled.

      Returns void

    • Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.

      Type Parameters

      • T = any

      Parameters

      • event: string | String[]

        Name of the event(s) to bind to.

      • listener: (a: T, e?: any) => any

        Function to bind to the given event(s)

      • OptionalinsertAtStart: boolean

        Whether or not to insert this listener at the head of the listener queue. Defaults to false.

      Returns EventGenerator

    • Type Parameters

      • RetVal

      Parameters

      • conditionName: string
      • Optionalargs: any

      Returns RetVal

    • Removes all members from the drag group with the given name.

      Parameters

      • name: string

      Returns void

    • Clears the current drag selection

      Returns void

    • Consumes the given event.

      Parameters

      • e: Event
      • OptionaldoNotPreventDefault: boolean

      Returns void

    • Clears the instance and unbinds any listeners on the instance. After you call this method you cannot use this instance of jsPlumb again.

      Returns void

    • Fire the named event.

      Type Parameters

      • T

      Parameters

      • event: string

        Event to fire

      • Optionalvalue: T

        Value to pass to event handlers

      • OptionaloriginalEvent: Event

        Optional original event that caused this event to be fired.

      Returns any

    • Gets an attribute from the given element. Exposed publically but mostly for internal use, to allow the core to abstract out the details of how the UI is being rendered.

      Parameters

      Returns string

    • Gets the CSS class for the given element.

      Parameters

      Returns string

    • Returns any

    • Retrieve an endpoint by its UUID.

      Parameters

      • uuid: string

      Returns Endpoint

    • Gets the group with given id, null if not found.

      Parameters

      • groupId: string

      Returns UIGroup<Element>

    • Parameters

      • element: Element
      • Optionaluuid: string

      Returns string

    • Gets all listeners for the given named event.

      Parameters

      • forEvent: string

      Returns any[]

    • Gets the element with the given ID from the list managed elements, null if not currently managed.

      Parameters

      • id: string

      Returns Element

    • get the position of the given element, allowing for svg elements and html elements

      Parameters

      Returns PointXY

    • Returns string

    • Retrieve an endpoint or connection type by its id.

      Parameters

      • id: string
      • typeDescriptor: string

      Returns TypeDescriptor

    • Returns whether or not the given element has the given class.

      Parameters

      Returns boolean

    • Helper method to get the draggable state of some element. Under the hood all this does is check for the existence of the data-jtk-not-draggable attribute.

      Parameters

      • el: Element

        Element to get draggable state for.

      Returns boolean

    • Returns whether or not hover is currently suspended.

      Returns boolean

    • Returns whether not event firing is currently suspended

      Returns boolean

    • Manage an element. Adds the element to the viewport and sets up tracking for endpoints/connections for the element, as well as enabling dragging for the element. This method is called internally by various methods of the jsPlumb instance, such as connect, addEndpoint, makeSource and makeTarget, so if you use those methods to setup your UI then you may not need to call this. However, if you use the addSourceSelector and addTargetSelector methods to configure your UI then you will need to register elements using this method, or they will not be draggable.

      Parameters

      • element: Element

        Element to manage. This method does not accept a DOM element ID as argument. If you wish to manage elements via their DOM element ID, you should use manageAll and pass in an appropriate CSS selector that represents your element, eg #myElementId.

      • OptionalinternalId: string

        Optional ID for jsPlumb to use internally. If this is not supplied, one will be created.

      • Optional_recalc: boolean

        Maybe recalculate offsets for the element also. It is not recommended that clients of the API use this parameter; it's used in certain scenarios internally

      Returns ManagedElement<Element>

    • Manage a group of elements.

      Parameters

      • elements: string | ArrayLike<Element>

        Array-like object of strings or elements (can be an Array or a NodeList), or a CSS selector (which is applied with the instance's container element as its context)

      • Optionalrecalc: boolean

        Maybe recalculate offsets for the element also.

      Returns void

    • Remove an event binding from the given element or elements.

      Parameters

      • el: Document | Element | NodeListOf<Element>

        Element, or elements, from which to remove the event binding.

      • event: string

        Name of the event to unbind.

      • callback: Function

        The function you wish to unbind.

      Returns this

    • Bind an event listener to the given element or elements.

      Parameters

      • el: Document | Element | NodeListOf<Element>

        Element, or elements, to bind the event listener to.

      • event: string

        Name of the event to bind to.

      • callbackOrSelector: string | Function

        Either a callback function, or a CSS 3 selector. When this is a selector the event listener is bound as a "delegate", ie. the event listeners listens to events on children of the given el that match the selector.

      • Optionalcallback: Function

        Callback function for event. Only supplied when you're binding a delegated event handler.

      Returns this

    • Remove every endpoint registered to the given element.

      Parameters

      • el: Element

        Element to remove endpoints for.

      • Optionalrecurse: boolean

        If true, also remove endpoints for elements that are descendants of this element.

      Returns JsPlumbInstance

    • Remove all groups from this instance of jsPlumb

      Parameters

      • OptionaldeleteMembers: boolean
      • Optional_manipulateView: boolean

        Not for public usage. Used internally.

      Returns void

    • Remove an attribute from the given element. Exposed publically but mostly for internal use, to allow the core to abstract out the details of how the UI is being rendered.

      Parameters

      • el: Element

        Element to remove an attribute from

      • attName: string

        Name of the attribute to remove

      Returns void

    • Remove one or more classes from the given element or list of elements.

      Parameters

      • el: Element | NodeListOf<Element>

        Element, or list of elements from which to remove the class(es)

      • clazz: string

        A space separated list of classes to remove.

      Returns void

    • Removes a filter from the list of filters used to determine whether or not a given event should start an element drag.

      Parameters

      • filter: string | Function

        CSS3 selector, or function that takes an element and returns true/false

      Returns void

    • Removes the given element(s) from any drag group they may be in. You don't need to supply the drag group id, as elements can only be in one drag group anyway.

      Parameters

      • ...els: Element[]

        Elements to remove from drag groups.

      Returns void

    • Removes the given element(s) from the current drag selection

      Parameters

      Returns void

    • Remove an element from a group

      Parameters

      • group: string | UIGroup<Element>

        Group to remove element from

      • el: Element

        Element to remove.

      • Optional_doNotFireEvent: boolean

        Not for public usage. Used internally.

      Returns void

    • Remove a group from this instance of jsPlumb.

      Parameters

      • group: string | UIGroup<Element>

        Group to remove

      • OptionaldeleteMembers: boolean

        Whether or not to also delete any members of the group. If this is false (the default) then group members will be removed before the group is deleted.

      • Optional_manipulateView: boolean

        Not for public usage. Used internally.

      • Optional_doNotFireEvent: boolean

        Not recommended for public usage, used internally.

      Returns Record<string, PointXY>

    • Remove the overlay with the given id from the given component.

      Parameters

      • component: Component

        Component to remove the overlay from.

      • overlayId: string

        ID of the overlay to remove.

      Returns void

    • Repaints all connections and endpoints associated with the given element, without recomputing the element size and position. If you want to first recompute element size and position you should call revalidate(el) instead,

      Parameters

      • el: Element

        Element to repaint.

      • Optionaltimestamp: string

        Optional parameter used internally to avoid recalculating offsets multiple times in one paint.

      • OptionaloffsetsWereJustCalculated: boolean

        If true, we don't recalculate the offsets of child elements of the element we're repainting.

      Returns RedrawResult

    • Clears all endpoints and connections and managed elements from the instance of jsplumb. Does not also clear out event listeners, selectors, or connection/endpoint types - for that, use destroy().

      Returns void

    • Updates position/size information for the given element and redraws its Endpoints and their Connections. Use this method when you've made a change to some element that may have caused the element to change its position or size and you want to ensure the connections are in the right place.

      Parameters

      • el: Element

        Element to revalidate.

      • Optionaltimestamp: string

        Optional, used internally to avoid recomputing position/size information if it has already been computed.

      Returns RedrawResult

    • Rotates the given element. This method overrides the same method from the superclass: the superclass only makes a note of the current rotation for the given element, but in this class the element has appropriate CSS transforms applied to it to effect the rotation in the DOM.

      Parameters

      • element: Element

        Element to rotate.

      • rotation: number

        Rotation, in degrees.

      • OptionaldoNotRepaint: boolean

        If true, a repaint is not done afterwards. Defaults to false.

      Returns RedrawResult

    • Sets an attribute on the given element. Exposed publically but mostly for internal use, to allow the core to abstract out the details of how the UI is being rendered.

      Parameters

      • el: Element
      • name: string
      • value: string

      Returns void

    • Sets some attributes on the given element. Exposed publically but mostly for internal use, to allow the core to abstract out the details of how the UI is being rendered.

      Parameters

      • el: Element

        Element to set attributes on

      • atts: Record<string, string>

        Map of attributes to set.

      Returns void

    • Sets the color of the connection.

      Parameters

      Returns void

    • Sets the type of a connection and then repaints it.

      Parameters

      • connection: Connection
      • type: string
      • Optionalparams: any

      Returns void

    • Sets the element this instance will use as the container for everything it adds to the UI. In normal use this method is not expected to be called very often, if at all. The method is used by the instance constructor and also in certain situations by the Toolkit edition.

      Parameters

      Returns void

    • Sets the function used to constrain the dragging of elements.

      Parameters

      Returns void

    • Helper method to set the draggable state of some element. Under the hood all this does is add/remove the data-jtk-not-draggable attribute.

      Parameters

      • element: Element

        Element to set draggable state for.

      • draggable: boolean

      Returns void

    • Sets the grid that should be used when dragging elements.

      Parameters

      • grid: Grid

        Grid to use.

      Returns void

    • Sets the active/passive state for the given element(s) in their respective drag groups (if any). You don't need to supply the drag group id, as elements can only be in one drag group anyway.

      Parameters

      • state: boolean

        true for active, false for passive.

      • ...els: Element[]

      Returns void

    • Sets the position of the given element to be [x,y].

      Parameters

      • el: Element

        Element to set the position for

      • x: number

        Position in X axis

      • y: number

        Position in Y axis

      Returns RedrawResult

      The result of the redraw operation that follows the update of the viewport.

    • Set an endpoint's uuid, updating the internal map

      Parameters

      Returns void

    • Sets color, outline color, line width and outline width. Any values for which the key is present will not be set, but if the key is present and the value is null, the corresponding value in the connection's paint style will be set to null.

      Parameters

      • conn: Connection
      • style: {
            color?: string;
            lineWidth?: number;
            outlineColor?: string;
            outlineWidth?: number;
        }

      Returns void

    • Sets the line width of the connection

      Parameters

      Returns void

    • Set the outline color for the given connection

      Parameters

      Returns void

    • Sets the outline width for the given connection

      Parameters

      Returns void

    • Sets the visibility of some overlay.

      Parameters

      • o: Overlay

        Overlay to hide or show

      • visible: boolean

        If true, make the overlay visible, if false, make the overlay invisible.

      Returns void

    • Sets whether or not drawing is suspended.

      Parameters

      • Optionalval: boolean

        True to suspend, false to enable.

      • OptionalrepaintAfterwards: boolean

        If true, repaint everything afterwards.

      Returns boolean

    • Sets whether not event firing is currently suspended

      Parameters

      • val: boolean

      Returns void

    • Parameters

      • z: number
      • OptionalrepaintEverything: boolean

      Returns boolean

    • Parameters

      • event: string
      • value: any
      • OptionaloriginalEvent: Event

      Returns boolean

    • Run the given function without firing any events.

      Parameters

      Returns void

    • Toggles one or more classes on the given element or list of elements.

      Parameters

      • el: Element | NodeListOf<Element>

        Element, or list of elements on which to toggle the class(es)

      • clazz: string

        A space separated list of classes to toggle.

      Returns void

    • Parameters

      Returns boolean

    • Toggles membership in the current drag selection of the given element(s)

      Parameters

      Returns void

    • Expand a group if it is collapsed, or collapse it if it is expanded.

      Parameters

      Returns void

    • private method to do the business of toggling hiding/showing.

      Parameters

      • el: Element
      • OptionalchangeEndpoints: boolean

      Returns void

    • Trigger an event on the given element. Exposed publically but mostly intended for internal use.

      Parameters

      • el: Document | Element

        Element to trigger the event on.

      • event: string

        Name of the event to trigger.

      • OptionaloriginalEvent: Event

        Optional event that gave rise to this method being called.

      • Optionalpayload: any

        Optional payload to set on the Event that is created.

      • Optionaldetail: number

        Optional detail for the Event that is created.

      Returns void

    • Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.

      Parameters

      • OptionaleventOrListener: string | Function

        Either an event name, or an event handler function

      • Optionallistener: Function

        If eventOrListener is defined, this is the event handler to unbind.

      Returns EventGenerator

    • Stops managing the given element.

      Parameters

      • el: Element

        Element, or ID of the element to stop managing.

      • OptionalremoveElement: boolean

        If true, also remove the element from the renderer.

      Returns void

    • Update the cached offset information for some element.

      Parameters

      Returns ViewportElement<Element>

      an UpdateOffsetResult containing the offset information for the given element.