refactor(nodes,edges,types!): Change label-type to string | VNode | Object
This commit is contained in:
@@ -17,8 +17,10 @@ const sourceHandle =
|
||||
store.connectionHandleId && store.connectionHandleType
|
||||
? props.sourceNode.handleBounds[store.connectionHandleType]?.find((d: HandleElement) => d.id === store.connectionHandleId)
|
||||
: store.connectionHandleType && props.sourceNode.handleBounds[store.connectionHandleType ?? 'source']?.[0]
|
||||
|
||||
const sourceHandleX = sourceHandle ? sourceHandle.x + sourceHandle.width / 2 : props.sourceNode.dimensions.width / 2
|
||||
const sourceHandleY = sourceHandle ? sourceHandle.y + sourceHandle.height / 2 : props.sourceNode.dimensions.height
|
||||
|
||||
const sourceX = props.sourceNode.computedPosition.x + sourceHandleX
|
||||
const sourceY = props.sourceNode.computedPosition.y + sourceHandleY
|
||||
|
||||
|
||||
@@ -39,11 +39,7 @@ export default {
|
||||
/>
|
||||
<text ref="edge-text" class="vue-flow__edge-text" :y="edgeRefBbox.height / 2" dy="0.3em" :style="props.labelStyle">
|
||||
<slot v-bind="props">
|
||||
<component
|
||||
:is="props.label?.component"
|
||||
v-if="typeof props.label !== 'string' && typeof props.label?.component !== 'undefined'"
|
||||
v-bind="props.label?.props"
|
||||
/>
|
||||
<component :is="props.label" v-if="typeof props.label !== 'string' && typeof props.label" />
|
||||
<template v-else v-html="props.label">
|
||||
{{ props.label }}
|
||||
</template>
|
||||
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
:is-connectable="props.connectable"
|
||||
:is-valid-connection="props.isValidTargetPos"
|
||||
/>
|
||||
<component :is="props.label.component" v-bind="props.label.props" v-if="typeof props.label !== 'string' && props.label" />
|
||||
<component :is="props.label" v-if="typeof props.label !== 'string' && props.label" />
|
||||
<span v-else v-html="props.label" />
|
||||
<Handle
|
||||
type="source"
|
||||
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<component :is="props.label.component" v-bind="props.label.props" v-if="typeof props.label !== 'string' && props.label" />
|
||||
<component :is="props.label" v-if="typeof props.label !== 'string' && props.label" />
|
||||
<span v-else v-html="props.label" />
|
||||
<Handle
|
||||
type="source"
|
||||
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<component :is="props.label.component" v-bind="props.label.props" v-if="typeof props.label !== 'string' && props.label" />
|
||||
<component :is="props.label" v-bind="props.label" v-if="typeof props.label !== 'string' && props.label" />
|
||||
<span v-else v-html="props.label" />
|
||||
<Handle
|
||||
type="source"
|
||||
|
||||
Reference in New Issue
Block a user