update(examples): unidirectional example
Signed-off-by: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { CSSProperties } from 'vue'
|
import { CSSProperties } from 'vue'
|
||||||
import { Handle, Position } from '~/index'
|
import { Handle, Position } from '~/index'
|
||||||
import type { NodeProps } from '~/index'
|
|
||||||
|
|
||||||
const props = defineProps<NodeProps>()
|
interface Props {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>()
|
||||||
const nodeStyles: CSSProperties = { padding: '10px 15px', border: '1px solid #ddd' }
|
const nodeStyles: CSSProperties = { padding: '10px 15px', border: '1px solid #ddd' }
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,18 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import CustomNode from './CustomNode.vue'
|
import CustomNode from './CustomNode.vue'
|
||||||
import {
|
import { VueFlow, useZoomPanHelper, Elements, Node, ConnectionLineType, ConnectionMode, MarkerType } from '~/index'
|
||||||
VueFlow,
|
|
||||||
addEdge,
|
|
||||||
useZoomPanHelper,
|
|
||||||
Elements,
|
|
||||||
Connection,
|
|
||||||
Edge,
|
|
||||||
Node,
|
|
||||||
ConnectionLineType,
|
|
||||||
ConnectionMode,
|
|
||||||
updateEdge,
|
|
||||||
MarkerType,
|
|
||||||
} from '~/index'
|
|
||||||
|
|
||||||
const initialElements: Elements = [
|
const initialElements: Elements = [
|
||||||
{
|
{
|
||||||
@@ -66,7 +54,7 @@ const initialElements: Elements = [
|
|||||||
target: '01',
|
target: '01',
|
||||||
sourceHandle: 'left',
|
sourceHandle: 'left',
|
||||||
targetHandle: 'bottom',
|
targetHandle: 'bottom',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -75,7 +63,7 @@ const initialElements: Elements = [
|
|||||||
target: '01',
|
target: '01',
|
||||||
sourceHandle: 'top',
|
sourceHandle: 'top',
|
||||||
targetHandle: 'right',
|
targetHandle: 'right',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -84,7 +72,7 @@ const initialElements: Elements = [
|
|||||||
target: '02',
|
target: '02',
|
||||||
sourceHandle: 'top',
|
sourceHandle: 'top',
|
||||||
targetHandle: 'left',
|
targetHandle: 'left',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -93,7 +81,7 @@ const initialElements: Elements = [
|
|||||||
target: '02',
|
target: '02',
|
||||||
sourceHandle: 'right',
|
sourceHandle: 'right',
|
||||||
targetHandle: 'bottom',
|
targetHandle: 'bottom',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -102,7 +90,7 @@ const initialElements: Elements = [
|
|||||||
target: '03',
|
target: '03',
|
||||||
sourceHandle: 'right',
|
sourceHandle: 'right',
|
||||||
targetHandle: 'top',
|
targetHandle: 'top',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -111,7 +99,7 @@ const initialElements: Elements = [
|
|||||||
target: '03',
|
target: '03',
|
||||||
sourceHandle: 'bottom',
|
sourceHandle: 'bottom',
|
||||||
targetHandle: 'left',
|
targetHandle: 'left',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -120,7 +108,7 @@ const initialElements: Elements = [
|
|||||||
target: '04',
|
target: '04',
|
||||||
sourceHandle: 'bottom',
|
sourceHandle: 'bottom',
|
||||||
targetHandle: 'right',
|
targetHandle: 'right',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -129,7 +117,7 @@ const initialElements: Elements = [
|
|||||||
target: '04',
|
target: '04',
|
||||||
sourceHandle: 'left',
|
sourceHandle: 'left',
|
||||||
targetHandle: 'top',
|
targetHandle: 'top',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -138,7 +126,7 @@ const initialElements: Elements = [
|
|||||||
target: '10',
|
target: '10',
|
||||||
sourceHandle: 'top',
|
sourceHandle: 'top',
|
||||||
targetHandle: 'bottom',
|
targetHandle: 'bottom',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -147,7 +135,7 @@ const initialElements: Elements = [
|
|||||||
target: '20',
|
target: '20',
|
||||||
sourceHandle: 'right',
|
sourceHandle: 'right',
|
||||||
targetHandle: 'left',
|
targetHandle: 'left',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -156,7 +144,7 @@ const initialElements: Elements = [
|
|||||||
target: '30',
|
target: '30',
|
||||||
sourceHandle: 'bottom',
|
sourceHandle: 'bottom',
|
||||||
targetHandle: 'top',
|
targetHandle: 'top',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -165,7 +153,7 @@ const initialElements: Elements = [
|
|||||||
target: '40',
|
target: '40',
|
||||||
sourceHandle: 'left',
|
sourceHandle: 'left',
|
||||||
targetHandle: 'right',
|
targetHandle: 'right',
|
||||||
type: 'smoothstep',
|
type: 'step',
|
||||||
markerEnd: MarkerType.Arrow,
|
markerEnd: MarkerType.Arrow,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -189,6 +177,7 @@ const onPaneClick = (evt: MouseEvent) =>
|
|||||||
:connection-line-type="ConnectionLineType.SmoothStep"
|
:connection-line-type="ConnectionLineType.SmoothStep"
|
||||||
:connection-mode="ConnectionMode.Loose"
|
:connection-mode="ConnectionMode.Loose"
|
||||||
@pane-click="onPaneClick"
|
@pane-click="onPaneClick"
|
||||||
|
@pane-ready="({ fitView }) => fitView()"
|
||||||
>
|
>
|
||||||
<template #node-custom="props">
|
<template #node-custom="props">
|
||||||
<CustomNode v-bind="props" />
|
<CustomNode v-bind="props" />
|
||||||
|
|||||||
Reference in New Issue
Block a user