Ir al contenido

ThemeBinding

Defined in: binding/ThemeBinding.ts:18

GoJS-compatible: a Binding whose source value comes from the target’s Diagram’s ThemeManager instead of the model data — created by GraphObject.theme() (a literal theme key), themeData() (a data property’s value names the theme key), or themeModel(). Always one-way (theme → target); applyToModel is a no-op.

graphojs has no Model.modelData (a shared, model-wide data object) — themeModel() falls back to the same per-part data lookup themeData() uses, rather than real GoJS’s model-wide source.

new ThemeBinding(targetprop?, sourceprop?, themeSource?, conv?, themeConverter?): ThemeBinding

Defined in: binding/ThemeBinding.ts:23

string = ''

string

string | null

(value, data) => unknown

(value, target) => unknown

ThemeBinding

Binding.constructor

get mode(): number

Defined in: binding/Binding.ts:73

GoJS-compatible: Get the mode (BindingMode.OneWay or BindingMode.TwoWay).

number

set mode(value): void

Defined in: binding/Binding.ts:68

GoJS-compatible: Set the mode to BindingMode.OneWay or BindingMode.TwoWay.

number

void

Binding.mode


get sourceObjectName(): string

Defined in: binding/Binding.ts:48

The name of the source object (default “data”).

string

Binding.sourceObjectName


get sourceProperty(): string

Defined in: binding/Binding.ts:58

The model data property name to read.

string

Binding.sourceProperty


get targetProperty(): string

Defined in: binding/Binding.ts:53

The target property name to set.

string

Binding.targetProperty


get themeConverter(): ((value, target) => unknown) | null

Defined in: binding/ThemeBinding.ts:55

((value, target) => unknown) | null

set themeConverter(value): void

Defined in: binding/ThemeBinding.ts:59

((value, target) => unknown) | null

void


get themeSource(): string

Defined in: binding/ThemeBinding.ts:47

string

set themeSource(value): void

Defined in: binding/ThemeBinding.ts:51

string

void


get twoWay(): boolean

Defined in: binding/Binding.ts:63

Whether this is a TwoWay binding.

boolean

Binding.twoWay

applyToModel(): boolean

Defined in: binding/ThemeBinding.ts:82

Apply TwoWay: read target property and write back to model data. Returns true if the property was set on the model.

boolean

Binding.applyToModel


applyToPart(part, nodeData): boolean

Defined in: binding/Binding.ts:235

Part

NodeData

boolean

Binding.applyToPart


applyToTarget(target, nodeData): boolean

Defined in: binding/Binding.ts:100

Apply this binding: read from model data and set on the target. Returns true if the property was set.

BindingTarget

NodeData

boolean

Binding.applyToTarget


copy(): ThemeBinding

Defined in: binding/ThemeBinding.ts:86

Create a deep copy of this binding.

ThemeBinding

Binding.copy


equals(other): boolean

Defined in: binding/Binding.ts:226

Check if two bindings are equivalent.

Binding

boolean

Binding.equals


getSourceValue(nodeData, target?): unknown

Defined in: binding/ThemeBinding.ts:63

Read the source property from model data, applying the converter if present. Supports dot paths (e.g. “data.name”, “meta.color”). Resolves the source object per ofObject(): “data” (default), “parent”, or a named GraphObject in the visual tree.

NodeData

BindingTarget

unknown

Binding.getSourceValue


getSourceValueFromPart(part): unknown

Defined in: binding/Binding.ts:240

Part

unknown

Binding.getSourceValueFromPart


getSourceValueFromTarget(target): unknown

Defined in: binding/Binding.ts:217

Read the target property and write to model data, applying back-converter if present.

BindingTarget

unknown

Binding.getSourceValueFromTarget


makeTwoWay(): this

Defined in: binding/Binding.ts:84

Make this a TwoWay binding so target property changes flow back to the model.

this

Binding.makeTwoWay


ofBackConverter(backConverter): this

Defined in: binding/Binding.ts:90

Set a back-converter for TwoWay bindings that transforms target property → model data.

(value, target) => unknown

this

Binding.ofBackConverter


ofConverter(converter): this

Defined in: binding/Binding.ts:78

Set a converter function that transforms model data → target property.

(value, data) => unknown

this

Binding.ofConverter


ofData(): this

Defined in: binding/ThemeBinding.ts:36

Switch this binding to resolve its theme key from a data property’s value (used by GraphObject.themeData).

this


ofModel(): this

Defined in: binding/ThemeBinding.ts:42

Switch this binding to resolve its theme key from model-wide data (used by GraphObject.themeModel).

this


ofObject(name): this

Defined in: binding/Binding.ts:42

GoJS-compatible: Specify which object is the source of the binding. Common values: “data” (the part’s model data, the default), “parent” (the parent panel’s data). Named GraphObjects are resolved when possible.

string

this

Binding.ofObject


setTargetValue(target, value): void

Defined in: binding/Binding.ts:210

Write a value to the target, applying the back-converter if present.

BindingTarget

unknown

void

Binding.setTargetValue