feat(nodes): Add teleport option to nodes

# What's changed?

* Add option to set a teleport target to nodes
This commit is contained in:
Braks
2022-05-27 23:36:01 +02:00
parent ce7569da5f
commit 0d35f1c7e3
2 changed files with 40 additions and 35 deletions
@@ -246,6 +246,7 @@ export default {
</script> </script>
<template> <template>
<Teleport :disabled="!node.teleport" :to="node.teleport">
<div <div
ref="nodeElement" ref="nodeElement"
:class="getClass" :class="getClass"
@@ -280,4 +281,5 @@ export default {
:node-element="nodeElement" :node-element="nodeElement"
/> />
</div> </div>
</Teleport>
</template> </template>
+4 -1
View File
@@ -1,4 +1,4 @@
import type { Component, VNode } from 'vue' import type { Component, TeleportProps, VNode } from 'vue'
import type { BaseElement, Dimensions, ElementData, Position, SnapGrid, XYPosition, XYZPosition } from './flow' import type { BaseElement, Dimensions, ElementData, Position, SnapGrid, XYPosition, XYZPosition } from './flow'
import type { DefaultNodeTypes, NodeComponent } from './components' import type { DefaultNodeTypes, NodeComponent } from './components'
import type { HandleElement, ValidConnectionFunc } from './handle' import type { HandleElement, ValidConnectionFunc } from './handle'
@@ -58,6 +58,9 @@ export interface Node<Data = ElementData> extends BaseElement<Data> {
/** overwrites current node type */ /** overwrites current node type */
template?: NodeComponent template?: NodeComponent
/** teleports node element to specified dom location */
teleport?: TeleportProps['to']
} }
export interface GraphNode<Data = ElementData> extends Node<Data> { export interface GraphNode<Data = ElementData> extends Node<Data> {