refactor(core): use data obj for labels in default nodes

This commit is contained in:
braks
2024-02-15 17:46:21 +01:00
committed by Braks
parent 060f9e4748
commit 6c638b8e27
3 changed files with 17 additions and 8 deletions
@@ -4,19 +4,22 @@ import Handle from '../Handle/Handle.vue'
import type { NodeProps } from '../../types'
import { Position } from '../../types'
const InputNode: FunctionalComponent<NodeProps> = function ({
const InputNode: FunctionalComponent<NodeProps<{ label: any }>> = function ({
sourcePosition = Position.Bottom,
label,
label: _label,
connectable = true,
isValidSourcePos,
data,
}) {
const label = data.label || _label
return [
typeof label !== 'string' && label ? h(label) : h('div', { innerHTML: label }),
h(Handle as Component, { type: 'source', position: sourcePosition, connectable, isValidConnection: isValidSourcePos }),
]
}
InputNode.props = ['sourcePosition', 'label', 'isValidSourcePos', 'connectable']
InputNode.props = ['sourcePosition', 'label', 'isValidSourcePos', 'connectable', 'data']
InputNode.inheritAttrs = false
InputNode.compatConfig = { MODE: 3 }