refactor(types)!: Remove elements prop, change EdgeTypes/NodeTypes prop to string[]
* no more elements prop - v-model instead! * Instead of passing an object map to components just pass in an array of strings as nodeTypes/edgeTypes object * the string name will either be resolved to a dynamic component with :is="type" or a slot with the type-name * update all examples Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -16,13 +16,15 @@ const props = withDefaults(defineProps<EdgeProps>(), {})
|
||||
const store = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const edgeType = props.edge.type || 'default'
|
||||
const t = store.getEdgeTypes[edgeType] || store.getEdgeTypes.default
|
||||
if (!store.getEdgeTypes[edgeType]) {
|
||||
console.warn(`Edge type "${edgeType}" not found. Using fallback type "default".`)
|
||||
const t = props.edge.type ?? 'default'
|
||||
let edge = store.getEdgeTypes[t]
|
||||
if (!edge) {
|
||||
edge = store.getEdgeTypes.default
|
||||
console.warn(`Edge type "${t}" not found. Using fallback type "default".`)
|
||||
}
|
||||
return t
|
||||
return edge
|
||||
})
|
||||
|
||||
const updating = ref<boolean>(false)
|
||||
|
||||
const onEdgeClick = (event: MouseEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user