feat: Allow node/edge template per element

* Allow templates to be overwritten per element with template option
This commit is contained in:
Braks
2022-04-11 11:30:10 +02:00
parent 367c7fdf40
commit 88f808711a
9 changed files with 126 additions and 23 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { useDraggableCore } from '@braks/revue-draggable'
import { CSSProperties } from 'vue'
import { CSSProperties, isVNode } from 'vue'
import { useVueFlow } from '../../composables'
import { GraphNode, NodeComponent, SnapGrid } from '../../types'
import { NodeId, Slots } from '../../context'
@@ -89,8 +89,9 @@ watch(
)
const type = computed(() => {
let nodeType = node.value.template ?? store.getNodeTypes[name.value]
const instance = getCurrentInstance()
let nodeType = store.getNodeTypes[name.value]
if (typeof nodeType === 'string') {
if (instance) {
const components = Object.keys(instance.appContext.components)