refactor(core): change nodeEl and edgeEl type to allow ref(null)

This commit is contained in:
braks
2023-07-10 19:20:26 +02:00
committed by Braks
parent 11f584a08a
commit 435cb9b687
9 changed files with 12 additions and 13 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ interface UseDragParams {
onStart: (args: Omit<NodeDragEvent, 'intersections'>) => void
onDrag: (event: Omit<NodeDragEvent, 'intersections'>) => void
onStop: (event: Omit<NodeDragEvent, 'intersections'>) => void
el: Ref<Element | undefined>
el: Ref<Element | null>
disabled?: MaybeRefOrGetter<boolean>
selectable?: MaybeRefOrGetter<boolean>
dragHandle?: MaybeRefOrGetter<string | undefined>
+2 -2
View File
@@ -1,4 +1,4 @@
import { inject } from 'vue'
import { inject, ref } from 'vue'
import { useVueFlow } from './useVueFlow'
import type { CustomEvent, ElementData } from '~/types'
import { ErrorCode, VueFlowError } from '~/utils'
@@ -13,7 +13,7 @@ import { EdgeId, EdgeRef } from '~/context'
*/
export function useEdge<Data = ElementData, CustomEvents extends Record<string, CustomEvent> = any>(id?: string) {
const edgeId = id ?? inject(EdgeId, '')
const edgeEl = inject(EdgeRef, null)
const edgeEl = inject(EdgeRef, ref(null))
const { findEdge, emits } = useVueFlow()
+2 -2
View File
@@ -1,4 +1,4 @@
import { computed, inject } from 'vue'
import { computed, inject, ref } from 'vue'
import { useVueFlow } from './useVueFlow'
import type { CustomEvent, ElementData } from '~/types'
import { NodeId, NodeRef } from '~/context'
@@ -13,7 +13,7 @@ import { ErrorCode, VueFlowError, getConnectedEdges } from '~/utils'
*/
export function useNode<Data = ElementData, CustomEvents extends Record<string, CustomEvent> = any>(id?: string) {
const nodeId = id ?? inject(NodeId, '')
const nodeEl = inject(NodeRef, null)
const nodeEl = inject(NodeRef, ref(null))
const { findNode, edges, emits } = useVueFlow()