chore(core): cleanup node wrapper
This commit is contained in:
@@ -3,15 +3,7 @@ import { until, useVModel } from '@vueuse/core'
|
|||||||
import type { GraphNode, HandleConnectable, NodeComponent } from '~/types'
|
import type { GraphNode, HandleConnectable, NodeComponent } from '~/types'
|
||||||
import { NodeId, NodeRef } from '~/context'
|
import { NodeId, NodeRef } from '~/context'
|
||||||
import { isInputDOMNode, useDrag, useNodeHooks, useUpdateNodePositions, useVueFlow } from '~/composables'
|
import { isInputDOMNode, useDrag, useNodeHooks, useUpdateNodePositions, useVueFlow } from '~/composables'
|
||||||
import {
|
import { ARIA_NODE_DESC_KEY, arrowKeyDiffs, calcNextPosition, elementSelectionKeys, getXYZPos, handleNodeClick } from '~/utils'
|
||||||
ARIA_NODE_DESC_KEY,
|
|
||||||
arrowKeyDiffs,
|
|
||||||
calcNextPosition,
|
|
||||||
elementSelectionKeys,
|
|
||||||
getConnectedEdges,
|
|
||||||
getXYZPos,
|
|
||||||
handleNodeClick,
|
|
||||||
} from '~/utils'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: string
|
id: string
|
||||||
@@ -34,7 +26,6 @@ const NodeWrapper = defineComponent({
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
id: vueFlowId,
|
id: vueFlowId,
|
||||||
edges,
|
|
||||||
noPanClassName,
|
noPanClassName,
|
||||||
selectNodesOnDrag,
|
selectNodesOnDrag,
|
||||||
nodesSelectionActive,
|
nodesSelectionActive,
|
||||||
@@ -54,15 +45,16 @@ const NodeWrapper = defineComponent({
|
|||||||
snapToGrid,
|
snapToGrid,
|
||||||
snapGrid,
|
snapGrid,
|
||||||
nodeDragThreshold,
|
nodeDragThreshold,
|
||||||
|
getConnectedEdges,
|
||||||
} = useVueFlow()
|
} = useVueFlow()
|
||||||
|
|
||||||
const updateNodePositions = useUpdateNodePositions()
|
const updateNodePositions = useUpdateNodePositions()
|
||||||
|
|
||||||
const node = useVModel(props, 'node')
|
const node = useVModel(props, 'node')
|
||||||
|
|
||||||
const parentNode = computed(() => findNode(node.value.parentNode))
|
const parentNode = computed(() => findNode(node.value?.parentNode))
|
||||||
|
|
||||||
const connectedEdges = computed(() => getConnectedEdges([node.value], edges.value))
|
const connectedEdges = computed(() => getConnectedEdges(node.value ? [node.value] : []))
|
||||||
|
|
||||||
const nodeElement = ref<HTMLDivElement | null>(null)
|
const nodeElement = ref<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user