@joint/react
    Preparing search index...

    Class ElementModel<Attributes>

    The element class @joint/react registers and uses by default for every element you add to the graph. Its markup carries a dedicated <g> group (the '__portal__' selector) where your RenderElement output is mounted, so React content renders beneath the element's ports and highlighters. Extend it to customize the markup or default attributes, or supply any dia.Element subclass that implements PortalHostCell to host React content yourself.

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

    const element = new ElementModel({
    id: '1',
    position: { x: 10, y: 20 },
    size: { width: 100, height: 50 },
    });

    Type Parameters

    • Attributes extends dia.Element.Attributes = dia.Element.Attributes

    Hierarchy

    Implements

    Index

    Constructors

    Methods

    • Parameters

      • port: Port
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • ports: Port[]
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • graph: Graph
      • Optionalopt: Options

      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>[]

    • Parameters

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

      Returns this

    • Parameters

      • paper: Paper

      Returns CellView

    • Parameters

      • Optionalopt: FitToChildrenOptions

      Returns this

    • Parameters

      • Optionalopt: FitParentOptions

      Returns this

    • Parameters

      • Optionalopt: FitToChildrenOptions

      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

      • Optionalopt: BBoxOptions

      Returns Rect

    • Parameters

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

      Returns number

    • Parameters

      • Optionalopt: GetEmbeddedCellsOptions

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

    • Parameters

      • groupName: string

      Returns Port[]

    • 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

    • Parameters

      • portId: string
      • Optionalopt: RotateOptions

      Returns Rect

    • Parameters

      • portId: string

      Returns Point

    • Parameters

      • port: string | Port

      Returns number

    • Parameters

      • portId: string

      Returns PortPosition

    • Parameters

      • portId: string

      Returns PortRect

    • Parameters

      • groupName: string

      Returns { [id: string]: PortPosition }

    • Parameters

      • x: number
      • y: number

      Returns Point

    • Parameters

      • absolutePoint: PlainPoint

      Returns Point

    • Parameters

      • before: string | number | Port
      • port: Port
      • Optionalopt: ModelSetOptions

      Returns this

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

    • Parameters

      • cell: Cell
      • Optionalopt: EmbeddableOptions<boolean>

      Returns boolean

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

    • Parameters

      • Optionaloptions: any

      Returns boolean

    • Returns string | null

    • Parameters

      • id: string | null
      • Optionalopt: Options

      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

    • Parameters

      • portId: string
      • path: Path

      Returns any

    • Parameters

      • portId: string
      • path: Path
      • Optionalvalue: any
      • Optionalopt: ModelSetOptions

      Returns Element

    • Parameters

      • Optionalopt: PositionOptions

      Returns Point

    • Parameters

      • x: number
      • y: number
      • Optionalopt: PositionOptions

      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

      • port: string | Port
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • ports: (string | Port)[]
      • Optionalopt: ModelSetOptions

      Returns this

    • Parameters

      • path: Path
      • Optionalopt: Options

      Returns this

    • Parameters

      • width: number
      • height: number
      • Optionalopt: ResizeOptions

      Returns this

    • Parameters

      • deg: number
      • Optionalabsolute: boolean
      • Optionalorigin: PlainPoint
      • Optionalopt: { [key: string]: any }

      Returns this

    • Parameters

      • scaleX: number
      • scaleY: number
      • Optionalorigin: PlainPoint
      • Optionalopt: { [key: string]: any }

      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 Size

    • Parameters

      • size: Partial<Size>
      • Optionalopt: ResizeOptions

      Returns this

    • Parameters

      • width: number
      • height: number
      • Optionalopt: ResizeOptions

      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

    • Parameters

      • Optionalopt: ToFrontAndBackOptions

      Returns this

    • Parameters

      • Optionalopt: ToFrontAndBackOptions

      Returns this

    • Parameters

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

      Returns number

    • Parameters

      • tx: number
      • Optionalty: number
      • Optionalopt: TranslateOptions

      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

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

      Returns Constructor<Element<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

    attributes: Partial<T>
    changed: Partial<T>
    cid: string
    cidPrefix: string
    collection: Collection<ElementModel<Attributes>>
    graph: Graph
    id: ID
    idAttribute: string
    markup: MarkupJSON = ...

    Markup with a single <g> group ('__portal__') that hosts the React portal. JointJS appends ports and highlighters after this group, so they paint on top of your React content.

    portalSelector: string = PORTAL_SELECTOR

    Selector of the node in this cell's view where @joint/react mounts your RenderElement content, the '__portal__' <g> group.

    useCSSSelectors: boolean
    validationError: any
    attributes: {
        [attributeName: string]: PresentationAttributeDefinition<
            ElementView<Element<Attributes<Selectors>, ModelSetOptions>>,
        >;
    }