clientIO / joint

A proven SVG-based JavaScript diagramming library powering exceptional UIs
https://jointjs.com
Mozilla Public License 2.0
4.73k stars 853 forks source link

types: fix untyped model when using ElementView/LinkView #2585

Closed michaelspiss closed 8 months ago

michaelspiss commented 8 months ago

Description

Instead of passing a generic Element/Link type to CellViewGeneric this provides an optional generic to pass the model type. It would be used like the following:

interface CustomElementAttributes extends dia.Element.Attributes {
  custom_attribute: string,
}

class CustomElement extends dia.Element<CustomElementAttributes> {
  // ...
}

class CustomElementView extends dia.ElementView<CustomElement> {
  // ...
}

Default behaviour is the current behaviour. The change is fully backwards compatible.

Motivation and Context