@joint/react
    Preparing search index...

    Class LinkModel<Attributes>

    The link class @joint/react registers and uses by default for every link you add to the graph. Its markup has two paths, a wide transparent wrapper that widens the pointer hit area and the visible line, and it mounts the experimental RenderLink output into the link's root <g>. Extend it to customize the markup or default attributes, or supply any dia.Link subclass that implements PortalHostCell to host React content yourself.

    import { LinkModel } from '@joint/react';

    const link = new LinkModel({
    id: 'link-1',
    source: { id: '1' },
    target: { id: '2' },
    });

    Type Parameters

    • Attributes extends dia.Link.Attributes = dia.Link.Attributes

    Hierarchy

    Implements

    Index

    Constructors

    • Type Parameters

      • Attributes extends Attributes<Selectors> = Attributes<Selectors>

      Parameters

      • Optionalattributes: _DeepPartial<_DeepRequired<Attributes>>
      • Optionalopt: ConstructorOptions

      Returns LinkModel<Attributes>

    Methods

    • Parameters

      • graph: Graph
      • Optionalopt: Options

      Returns this

    • Parameters

      • label: Label
      • Optionalopt: ModelSetOptions

      Returns Label[]

    • Parameters

      • fn: (p: PlainPoint) => PlainPoint
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • Optionalkey: Path

      Returns any

    • Parameters

      • object: Selectors
      • Optionalopt: Options

      Returns this

    • Parameters

      • key: Path
      • value: any
      • Optionalopt: Options

      Returns this

    • Parameters

      • eventName: string
      • callback: EventHandler
      • Optionalcontext: any

      Returns this

    • Parameters

      • eventMap: EventMap
      • Optionalcontext: any

      Returns this

    • Parameters

      • cell:
            | Cell<Attributes<Selectors>, ModelSetOptions>
            | Cell<Attributes<Selectors>, ModelSetOptions>[]

      Returns boolean

    • Return an object containing all the attributes that have changed, or false if there are no changed attributes. Useful for determining what parts of a view need to be updated and/or what attributes need to be persisted to the server. Unset attributes will be set to undefined. You can also pass an attributes object to diff against the model, determining if there would be a change.

      Parameters

      Returns false | Partial<Attributes>

    • Parameters

      • Optionaloptions: Silenceable

      Returns this

    • Returns this

    • Parameters

      • opt: EmbeddableOptions<false>

      Returns this

    • Parameters

      • opt: EmbeddableOptions<true>

      Returns Cell<Attributes<Selectors>, ModelSetOptions>[]

    • Returns Connector | ConnectorJSON | null

    • Parameters

      • connector: Connector | ConnectorJSON
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • name: keyof ConnectorArgumentsMap
      • Optionalargs: { [key: string]: any }
      • Optionalopt: ModelSetOptions

      Returns this

    • Default attributes for every LinkModel: the 'link' type, the default link styling, and an empty data object. The styling sets connection: true on the line/wrapper paths, which JointJS needs to compute the link path.

      Returns Attributes

      The default attributes.

    • Parameters

      • cell:
            | Cell<Attributes<Selectors>, ModelSetOptions>
            | Cell<Attributes<Selectors>, ModelSetOptions>[]
      • Optionalopt: EmbedOptions

      Returns this

    • For strongly-typed access to attributes, use the get method only privately in public getter properties.

      Type Parameters

      • A extends string

      Parameters

      • attributeName: A

      Returns Attributes[A] | undefined

      get name(): string {
      return super.get("name");
      }
    • Parameters

      • x: number
      • y: number

      Returns Point

    • Parameters

      • relativePoint: PlainPoint

      Returns Point

    • Returns Cell<Attributes<Selectors>, ModelSetOptions>[]

    • Parameters

      • attributes: { [key: string]: number }

      Returns number

    • Parameters

      • Optionalopt: GetEmbeddedCellsOptions

      Returns Cell<Attributes<Selectors>, ModelSetOptions>[]

    • Returns Cell<Attributes<Selectors>, ModelSetOptions> | null

    • Parameters

      • link: Link
      • endType: LinkEnd

      Returns Point

    • Parameters

      • angle: number
      • x: number
      • y: number

      Returns Point

    • Parameters

      • angle: number
      • point: PlainPoint

      Returns Point

    • Returns Element<Attributes<Selectors>, ModelSetOptions> | undefined

    • Parameters

      • x: number
      • y: number

      Returns Point

    • Parameters

      • absolutePoint: PlainPoint

      Returns Point

    • Returns Cell<Attributes<Selectors>, ModelSetOptions> | null

    • Returns Element<Attributes<Selectors>, ModelSetOptions> | null

    • Returns Cell<Attributes<Selectors>, ModelSetOptions> | null

    • Returns Element<Attributes<Selectors>, ModelSetOptions> | null

    • Parameters

      • Optionalopt: EmbeddableOptions<boolean>

      Returns boolean

    • Parameters

      • index: number
      • label: Label
      • Optionalopt: ModelSetOptions

      Returns Label[]

    • Parameters

      • index: number
      • vertex: Vertex
      • Optionalopt: ModelSetOptions

      Returns Vertex[]

    • Returns this is Element<Attributes<Selectors>, ModelSetOptions>

    • Parameters

      • cell: Cell
      • Optionalopt: EmbeddableOptions<boolean>

      Returns boolean

    • Returns this is Link<Attributes<Selectors>, ModelSetOptions>

    • Parameters

      • cell: Cell

      Returns boolean

    • Parameters

      • Optionaloptions: any

      Returns boolean

    • Parameters

      • Optionalindex: number

      Returns Label

    • Parameters

      • index: number
      • label: Label
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • object: any
      • events: string
      • callback: EventHandler

      Returns this

    • Parameters

      • object: any
      • eventMap: EventMap

      Returns this

    • Parameters

      • object: any
      • events: string
      • callback: EventHandler

      Returns this

    • Parameters

      • object: any
      • eventMap: EventMap

      Returns this

    • Parameters

      • OptionaleventName: string | null
      • Optionalcallback: EventHandler | null
      • Optionalcontext: any

      Returns this

    • Parameters

      • eventName: string
      • callback: EventHandler
      • Optionalcontext: any

      Returns this

    • Parameters

      • eventMap: EventMap
      • Optionalcontext: any

      Returns this

    • Parameters

      • events: string
      • callback: EventHandler
      • Optionalcontext: any

      Returns this

    • Parameters

      • eventMap: EventMap
      • Optionalcontext: any

      Returns this

    • For use with models as ES classes. If you define a preinitialize method, it will be invoked when the Model is first created, before any instantiation logic is run for the Model.

      Parameters

      • Optionalattributes: Attributes
      • Optionaloptions: any

      Returns void

    • Parameters

      • key: Path

      Returns any

    • Parameters

      • object: DeepPartial<A>
      • Optionalopt: Options

      Returns this

    • Parameters

      • key: Path
      • value: any
      • Optionalopt: Options

      Returns this

    • Parameters

      • Optionalopt: RemoveCellOptions

      Returns this

    • Parameters

      • path: Path
      • Optionalopt: Options

      Returns this

    • Parameters

      • Optionalindex: number
      • Optionalopt: ModelSetOptions

      Returns Label[]

    • Parameters

      • path: Path
      • Optionalopt: Options

      Returns this

    • Parameters

      • Optionalindex: number
      • Optionalopt: ModelSetOptions

      Returns Vertex[]

    • Parameters

      • Optionalopt: ModelSetOptions

      Returns Element

    • Returns Router | RouterJSON | null

    • Parameters

      • router: Router | RouterJSON
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • name: keyof RouterArgumentsMap
      • Optionalargs: { [key: string]: any }
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • sx: number
      • sy: number
      • Optionalorigin: PlainPoint
      • Optionalopt: ModelSetOptions

      Returns this

    • For strongly-typed assignment of attributes, use the set method only privately in public setter properties.

      Type Parameters

      • A extends string

      Parameters

      • attributeName: A
      • Optionalvalue: Attributes[A]
      • Optionaloptions: ModelSetOptions

      Returns this

      set name(value: string) {
      super.set("name", value);
      }
    • For strongly-typed assignment of attributes, use the set method only privately in public setter properties.

      Parameters

      • attributeName: Partial<T>
      • Optionaloptions: ModelSetOptions

      Returns this

      set name(value: string) {
      super.set("name", value);
      }
    • For strongly-typed assignment of attributes, use the set method only privately in public setter properties.

      Type Parameters

      • A extends string

      Parameters

      • attributeName: Partial<Attributes> | A
      • Optionalvalue: ModelSetOptions | Attributes[A]
      • Optionaloptions: ModelSetOptions

      Returns this

      set name(value: string) {
      super.set("name", value);
      }
    • Returns EndJSON

    • Parameters

      • source: EndJSON
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • source: Cell
      • Optionalargs: EndCellArgs
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • name: string
      • Optionalopt: Options

      Returns this

    • Parameters

      • name: string
      • Optionalopt: Options

      Returns this

    • Parameters

      • Optionalobject: any
      • Optionalevents: string
      • Optionalcallback: EventHandler

      Returns this

    • Parameters

      • Optionalpath: Path
      • Optionaldelim: string

      Returns this

    • Returns EndJSON

    • Parameters

      • target: EndJSON
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • target: Cell
      • Optionalargs: EndCellArgs
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • Optionalopt: ToFrontAndBackOptions

      Returns this

    • Parameters

      • Optionalopt: ToFrontAndBackOptions

      Returns this

    • Parameters

      • path: Path
      • Optionalvalue: any
      • Optionalopt: TransitionOptions
      • Optionaldelim: string

      Returns number

    • Parameters

      • tx: number
      • ty: number
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • eventName: string
      • ...args: any[]

      Returns this

    • Parameters

      • OptionaleventName: string
      • Optionalcallback: EventHandler
      • Optionalcontext: any

      Returns this

    • Parameters

      • cell:
            | Cell<Attributes<Selectors>, ModelSetOptions>
            | Cell<Attributes<Selectors>, ModelSetOptions>[]
      • Optionalopt: Options

      Returns this

    • Parameters

      • attributes: Partial<T>
      • Optionaloptions: any

      Returns any

    • Parameters

      • Optionalindex: number

      Returns Vertex

    • Parameters

      • index: number
      • vertex: Vertex
      • Optionalopt: ModelSetOptions

      Returns this

    • Returns Vertex[]

    • Parameters

      • vertices: Vertex[]
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • type: string
      • Optionaldefaults: any
      • OptionalprotoProps: any
      • OptionalstaticProps: any

      Returns Constructor<Link<Attributes<Selectors>, ModelSetOptions>>

    • Do not use, prefer TypeScript's extend functionality.

      Parameters

      • properties: any
      • OptionalclassProperties: any

      Returns any

    • Parameters

      • attrName: string

      Returns PresentationAttributeDefinition<CellView> | null

    Properties

    arrowHeadMarkup: string
    attributes: Partial<T>
    changed: Partial<T>
    cid: string
    cidPrefix: string
    collection: Collection<LinkModel<Attributes>>
    defaultLabel?: Label
    doubleToolMarkup?: string
    graph: Graph
    id: ID
    idAttribute: string
    labelMarkup?: string | MarkupJSON

    use defaultLabel.markup instead

    markup: MarkupJSON = ...

    Markup with two paths: a wide, transparent wrapper that widens the pointer hit area, and the visible line. React content (if any) mounts into the link's root <g> via RenderLink.

    portalSelector: string = 'root'

    Selector of the node in this cell's view where @joint/react mounts React content, the link's root <g> ('root'). The markup keeps no dedicated portal group so React-less links stay lean; the experimental RenderLink mounts here when enabled.

    toolMarkup: string
    useCSSSelectors: boolean
    validationError: any
    vertexMarkup: string
    attributes: {
        [attributeName: string]: PresentationAttributeDefinition<
            LinkView<Link<Attributes<Selectors>, ModelSetOptions>>,
        >;
    }