|
|
@@ -1,18 +1,35 @@
|
|
|
<script lang="ts" setup>
|
|
|
+import { computed } from 'vue'
|
|
|
import { Handle, type Position, type ValidConnectionFunc } from '@vue-flow/core'
|
|
|
import HandlePort from './HandlePort.vue'
|
|
|
|
|
|
-defineProps<{
|
|
|
+const props = defineProps<{
|
|
|
handleId: string
|
|
|
handleClasses?: string | string[]
|
|
|
position: Position
|
|
|
offset?: Record<string, string>
|
|
|
- isConnectableStart?: boolean
|
|
|
- isConnectableEnd?: boolean
|
|
|
isValidConnection?: ValidConnectionFunc
|
|
|
type: 'source' | 'target'
|
|
|
label?: string
|
|
|
+ maxConnections?: number
|
|
|
+ connectionsCount: number
|
|
|
}>()
|
|
|
+
|
|
|
+const connectionsLimitReached = computed(() => {
|
|
|
+ return props.maxConnections && props.connectionsCount >= props.maxConnections
|
|
|
+})
|
|
|
+
|
|
|
+const isConnectableStart = computed(() => {
|
|
|
+ if (connectionsLimitReached.value) return false
|
|
|
+
|
|
|
+ return props.type === 'source'
|
|
|
+})
|
|
|
+
|
|
|
+const isConnectableEnd = computed(() => {
|
|
|
+ if (connectionsLimitReached.value) return false
|
|
|
+
|
|
|
+ return props.type === 'target'
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<template>
|