clientIO / joint

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

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

Closed michaelspiss closed 1 month ago

michaelspiss commented 1 month 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