fix(additional-components): render minimap node slot

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-05 17:52:42 +01:00
committed by Braks
parent 051dcc477f
commit 39997732c3
@@ -7,11 +7,15 @@ export default defineComponent({
props: ['id', 'position', 'dimensions', 'strokeWidth', 'strokeColor', 'borderRadius', 'color', 'shapeRendering', 'type'],
emits: ['click', 'dblclick', 'mouseenter', 'mousemove', 'mouseleave'],
setup(props: MiniMapNodeProps, { attrs, emit }) {
const style = (attrs.style ?? {}) as CSSProperties
const miniMapSlots: Slots = inject(MiniMapSlots)!
return () => [
h('rect', {
return () => {
const style = (attrs.style ?? {}) as CSSProperties
const slot = miniMapSlots[`node-${props.type}`]
if (slot) return slot!(props)
return h('rect', {
id: props.id,
class: ['vue-flow__minimap-node', attrs.class].join(' '),
style,
@@ -30,8 +34,7 @@ export default defineComponent({
onMouseenter: (e: MouseEvent) => emit('mouseenter', e),
onMousemove: (e: MouseEvent) => emit('mousemove', e),
onMouseleave: (e: MouseEvent) => emit('mouseleave', e),
}),
miniMapSlots[props.type] && miniMapSlots[props.type]!(props),
]
})
}
},
})