From 9e941966a4ae639e0d4729e2bf0eb6edeb3f6601 Mon Sep 17 00:00:00 2001
From: Braks <78412429+bcakmakoglu@users.noreply.github.com>
Date: Thu, 25 Nov 2021 13:25:28 +0100
Subject: [PATCH] feat(nodes): add option to pass a valid target pos / valid
source pos func to nodes
* edge updater cannot discern a valid connection by itself so we allow an option to pass a valid connection func to nodes which will then be used to determine if updating connection is valid
* it is optional, by default all connections are valid
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
---
examples/Validation/CustomInput.vue | 9 ++++++---
examples/Validation/CustomNode.vue | 8 +++-----
examples/Validation/ValidationExample.vue | 22 +++++++++++++++-------
src/components/Edges/EdgeWrapper.vue | 6 ++----
src/components/Handle/Handle.vue | 2 +-
src/components/Nodes/DefaultNode.vue | 18 +++++++++++++++---
src/components/Nodes/InputNode.vue | 10 ++++++++--
src/components/Nodes/NodeWrapper.vue | 4 ++++
src/components/Nodes/OutputNode.vue | 10 ++++++++--
src/composables/useHandle.ts | 17 ++++++++++-------
src/types/connection.ts | 10 +++++-----
src/types/hooks.ts | 3 +--
src/types/node.ts | 6 +++++-
13 files changed, 83 insertions(+), 42 deletions(-)
diff --git a/examples/Validation/CustomInput.vue b/examples/Validation/CustomInput.vue
index 32c30fa9..3d24fd6b 100644
--- a/examples/Validation/CustomInput.vue
+++ b/examples/Validation/CustomInput.vue
@@ -1,9 +1,12 @@
Only connectable with B
-
+
diff --git a/examples/Validation/CustomNode.vue b/examples/Validation/CustomNode.vue
index b455ca79..0c754302 100644
--- a/examples/Validation/CustomNode.vue
+++ b/examples/Validation/CustomNode.vue
@@ -1,16 +1,14 @@
-
+
{{ props.id }}
-
diff --git a/examples/Validation/ValidationExample.vue b/examples/Validation/ValidationExample.vue
index 87f8972f..8888deb2 100644
--- a/examples/Validation/ValidationExample.vue
+++ b/examples/Validation/ValidationExample.vue
@@ -1,24 +1,32 @@
-
+
-
+
diff --git a/src/components/Nodes/InputNode.vue b/src/components/Nodes/InputNode.vue
index e376bd15..b2bea4be 100644
--- a/src/components/Nodes/InputNode.vue
+++ b/src/components/Nodes/InputNode.vue
@@ -1,11 +1,12 @@