From c96f62f62280f8a934537ca3fa179c744f7a2199 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 11 Dec 2021 17:17:44 +0100 Subject: [PATCH] refactor(flow)!: properly nest components Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- examples/CustomNode/ColorSelectorNode.vue | 14 ++-- examples/CustomNode/CustomNode.vue | 6 +- examples/EdgeWithButton/ButtonEdge.vue | 2 +- examples/Empty/EmptyExample.vue | 6 +- examples/Stress/StressExample.vue | 61 +--------------- examples/Stress/utils.ts | 19 ++--- src/composables/useHandle.ts | 2 +- src/container/Renderer/Renderer.vue | 21 +++++- src/container/SelectionPane/SelectionPane.vue | 24 ++++++- src/container/VueFlow/VueFlow.vue | 70 ++++++------------- src/container/ZoomPane/ZoomPane.vue | 43 ++++++++---- src/types/flow.ts | 2 +- 12 files changed, 121 insertions(+), 149 deletions(-) diff --git a/examples/CustomNode/ColorSelectorNode.vue b/examples/CustomNode/ColorSelectorNode.vue index a43e567c..a0823f2f 100644 --- a/examples/CustomNode/ColorSelectorNode.vue +++ b/examples/CustomNode/ColorSelectorNode.vue @@ -25,13 +25,11 @@ const sourceHandleStyleB: CSSProperties = { ...targetHandleStyle, bottom: '10px' const onConnect = (params: Connection | Edge) => console.log('handle onConnect', params) diff --git a/examples/CustomNode/CustomNode.vue b/examples/CustomNode/CustomNode.vue index 5400a417..be4a5c82 100644 --- a/examples/CustomNode/CustomNode.vue +++ b/examples/CustomNode/CustomNode.vue @@ -63,7 +63,7 @@ onMounted(() => { { id: '1', type: 'input', - data: { label: 'An input node' }, + label: 'An input node', position: { x: 0, y: 50 }, sourcePosition: Position.Right, }, @@ -77,14 +77,14 @@ onMounted(() => { { id: '3', type: 'output', - data: { label: 'Output A' }, + label: 'Output A', position: { x: 650, y: 25 }, targetPosition: Position.Left, }, { id: '4', type: 'output', - data: { label: 'Output B' }, + label: 'Output B', position: { x: 650, y: 100 }, targetPosition: Position.Left, }, diff --git a/examples/EdgeWithButton/ButtonEdge.vue b/examples/EdgeWithButton/ButtonEdge.vue index 879092ea..ef213a4a 100644 --- a/examples/EdgeWithButton/ButtonEdge.vue +++ b/examples/EdgeWithButton/ButtonEdge.vue @@ -17,7 +17,7 @@ interface CustomEdgeProps extends EdgeProps { const props = defineProps() const store = useVueFlow() const onEdgeClick = (evt: Event, id: string) => { - const edge = store.getEdges.find((edge) => edge.id === id) + const edge = store.getEdge(id) if (edge) { store.hooks.elementsRemove.trigger([edge]) } diff --git a/examples/Empty/EmptyExample.vue b/examples/Empty/EmptyExample.vue index 5d5ce58a..5bae2491 100644 --- a/examples/Empty/EmptyExample.vue +++ b/examples/Empty/EmptyExample.vue @@ -29,10 +29,10 @@ const addRandomNode = () => { const nodeId = (elements.value.length + 1).toString() const newNode: Node = { id: nodeId, - data: { label: `Node: ${nodeId}` }, + label: `Node: ${nodeId}`, position: { x: Math.random() * window.innerWidth, y: Math.random() * window.innerHeight }, } as Node - elements.value = [...elements.value, newNode] + elements.value.push(newNode) }